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 static let primeNumbers = sieveOfEratosthenes(upTo: 1000000) | |
@State private var scale = 1.0 | |
@State private var start = Date() | |
var body: some View { | |
TimelineView(.animation) { context in | |
let time = context.date.timeIntervalSince(start) |
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() | |
var body: some View { | |
TimelineView(.animation) { context in | |
let time = context.date.timeIntervalSince(start) / 120 | |
let rotation = 0.8 + 0.2 * abs((cos(.pi * time) + 1.0) / 2.0) | |
Canvas { context, size in |
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 | |
import Observation | |
@Observable | |
@MainActor | |
final class ContentViewModel { | |
var isLoading = false | |
var colors: [Color] = Array(repeating: Color.random(), count: 10) | |
func fetch() { |
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 | |
// https://x.com/okazz_/status/1870807939944243631 | |
struct ContentView: View { | |
@State private var progress: Double = 0 | |
var body: some View { | |
MyGroup { |
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 isInfinityWidth = false | |
@State var isFixedSize = false | |
var body: some View { | |
Form { | |
Section { | |
Toggle("maxWidth: .infinity", isOn: $isInfinityWidth.animation()) |
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 private var digits: [Int] = [] | |
var body: some View { | |
AuthCodeInput(digits: $digits, count: 6) | |
.padding() | |
.ignoresSafeArea(.keyboard) | |
.onChange(of: digits) { _, digits in |
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: - Model | |
@MainActor | |
@Observable | |
final class Model { | |
var rotations: [[Int]] | |
var positions: [IndexPath] | |
init(row: Int, column: Int) { |