Skip to content

Instantly share code, notes, and snippets.

@TAATHub
TAATHub / ChipsSelection.swift
Last active April 17, 2025 18:21
Responsive Chips Selection
// Responsive Chips Selection
// See Also: https://youtu.be/T82izB2XBMA?si=Cnf6rGdyisG8ZWoX
import SwiftUI
struct Tag: Hashable {
var name: String
var color: Color
}
@PlugFox
PlugFox / main.dart
Last active June 15, 2025 14:55
A simple declarative navigation system for Flutter.
/*
* Declarative Navigation
* A simple declarative navigation system for Flutter.
* https://gist.github.com/PlugFox/aaa2a1ab4ab71b483b736530ebb03894
* https://dartpad.dev?id=aaa2a1ab4ab71b483b736530ebb03894
* Mike Matiunin <[email protected]>, 14 March 2025
*/
import 'dart:async';
import 'dart:collection';
import SwiftUI
extension Color {
static var random: Self {
Color(
hue: .random(in: 0..<1),
saturation: .random(in: (0.9)..<1),
brightness: .random(in: (0.9)..<1)
)
}
struct CardView: View {
var item: ItemData
var animation: Namespace.ID
var body: some View {
HStack {
Circle()
.frame(width: 75)
.foregroundColor(item.color)
.overlay {
@yimajo
yimajo / Larning_EnvironmentValues.swift
Created January 23, 2020 02:24
SwiftUIのEnvironmentValuesはSubViewに伝搬するしカスタムなKeyも指定できる
/*:
# EnvironmentValuesはSubViewに伝搬するしカスタムなKeyも指定できる
- EnvironmentValuesは特定のKeyに対して値を設定できる
- 標準のKey
- https://developer.apple.com/documentation/swiftui/environmentvalues
- EnvironmentValuesが特定のViewの項目にそのまま紐付いている
- 例えば標準のKeyである\.fontはView上のTextのfontと結びついている
- Keyの値がView暗黙的にバインディングされている感じ