This file contains 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 containerFrame: CGRect = .zero | |
private var colors = [[Color]](repeating: .rainbow(count: 50), count: 300) | |
.flatMap { $0 } | |
.enumerated() | |
.map { $0 } | |
var body: some View { |
This file contains 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 | |
extension [Color] { | |
static func rainbow(hue: Double = 0, count: Int) -> Self { | |
(0..<count).map { i in | |
var value = hue + Double(i) / Double(count) | |
value -= floor(value) | |
return Color(hue: value, saturation: 1/4, brightness: 1) | |
} | |
} |
This file contains 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 mode = EditMode.inactive | |
var body: some View { | |
NavigationStack { | |
VStack { | |
ForEach(1..<12) { offset in | |
FooView(count: 12, offset: offset) |
This file contains 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 SqureFlowView: View { | |
@StateObject private var holder = SquresHolder() | |
var body: some View { | |
TimelineView(.animation) { timeline in | |
Canvas { context, size in | |
holder.update(at: timeline.date, in: size) | |
for item in holder.squre { |
This file contains 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 LoadingView: View { | |
@State var theta: Double = 0 | |
let radius: Double = 60 | |
var body: some View { | |
ZStack { | |
ForEach(0..<8) { index in | |
let offset = ((2 * .pi) * Double(index)) / 8 |
This file contains 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 theta: Double = 0 | |
let radius: Double = 60 | |
let colors: [Color] = [.purple, .red, .yellow, .blue, .green] | |
var body: some View { | |
ZStack { | |
ForEach(Array(colors.enumerated()), id: \.offset) { offset, style in |
This file contains 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 | |
let symbols = [ | |
"pencil", | |
"trash", | |
"folder", | |
"camera", | |
"photo", | |
"clock", | |
"arrow.right.circle.fill", |
This file contains 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 AnimationGridView: View { | |
@State | |
private var id: UUID = .init() | |
var body: some View { | |
ZStack { | |
Color(.systemBackground) | |
VStack { |
NewerOlder