This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State var start: Date = .now | |
var body: some View { | |
TimelineView(.animation) { context in | |
let progress = context.date.timeIntervalSince(start) / 10 | |
ZStack { | |
Sphere(color: .red).frame(width: 30) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
// https://x.com/TAAT626/status/1895841081365053901 | |
// https://gist.github.com/TAATHub/8f9e7d987c82ef0eea62d2e420d51144 | |
struct CountdownView: View { | |
@State private var counter = Counter() | |
var body: some View { | |
let radius = 120.0 | |
ZStack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
// MARK: - ContentView | |
struct ContentView: View { | |
private var items: [Int] = (1...5).map(\.self) | |
@State private var numberOfDisplays = 5 | |
@State private var showsIndicator = false | |
@State private var viewId = UUID() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct HPicker<SelectionValue, Content>: View where SelectionValue: Hashable, Content: View { | |
private var items: [SelectionValue] | |
private var numberOfDisplays: Int | |
private var content: (SelectionValue) -> Content | |
@Binding private var selection: SelectionValue? | |
@State private var contentOffset: Double = 0 | |
@State private var itemWidth: Double = 100.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
WavingText() | |
.foregroundStyle(.white) | |
.frame(maxWidth: .infinity, maxHeight: .infinity) | |
.background(Color(hue: 220/360, saturation: 0.3, brightness: 0.9)) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
private var title: String { | |
Item.sample.title | |
} | |
private var message: String { | |
Item.sample.message | |
} |