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
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: a honeycomb eager grid | |
// blog article: https://swiftui-lab.com/eager-grids | |
import SwiftUI | |
struct Person { | |
let name: String | |
let image: String | |
var color: Color = .accentColor |
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
// Advanced SwiftUI Transitions | |
// https://swiftui-lab.com | |
// https://swiftui-lab.com/advanced-transitions | |
import SwiftUI | |
struct CrossEffectDemo: View { | |
let animationDuration: Double = 2 | |
let images = ["photo1", "photo2", "photo3", "photo4"] | |
@State private var idx = 0 |
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
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: A demonstration of a recursive Layout | |
// blog article: https://swiftui-lab.com/layout-protocol-part-2 | |
import SwiftUI | |
struct ContentView: View { | |
let colors: [Color] = [.yellow, .orange, .red, .pink, .purple, .blue, .cyan, .green] | |
@State var angle: Angle = .zero |
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
// | |
// ContentView.swift | |
// Grabber | |
// | |
// SwiftUI-Lab | |
// | |
// For more information on the techniques used in this example, check | |
// The Power of the Hosting+Representable Combo (https://swiftui-lab.com/a-powerful-combo/) | |
import SwiftUI |
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
// Author: SwiftUI-Lab (www.swiftui-lab.com) | |
// Description: This code is part of the "Advanced SwiftUI Animations - Part 5" | |
// Article: https://swiftui-lab.com/swiftui-animations-part5/ | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
DigitalRain() | |
} |
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
//------------------------------------------------------------------------ | |
// Author: The SwiftUI Lab | |
// Post: Advanced SwiftUI Animations - Part 4 | |
// Link: https://swiftui-lab.com/swiftui-animations-part4 (TimelineView) | |
// | |
import SwiftUI | |
struct CyclicTimelineSchedule: TimelineSchedule { | |
let timeOffsets: [TimeInterval] |
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
//------------------------------------------------------------------------ | |
// Author: The SwiftUI Lab | |
// Post: Advanced SwiftUI Animations - Part 4 | |
// Link: https://swiftui-lab.com/swiftui-animations-part4 (TimelineView) | |
// | |
struct RoundedTrapezoid: Shape { | |
let pct: CGFloat | |
let cornerSizes: [CGSize] | |
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
//------------------------------------------------------------------------ | |
// Author: The SwiftUI Lab | |
// Post: Advanced SwiftUI Animations - Part 4 | |
// Link: https://swiftui-lab.com/swiftui-animations-part4 (TimelineView) | |
// | |
import SwiftUI | |
struct ContentView: View { | |
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 | |
class MyModel: ObservableObject { | |
@Published var attempted: Bool = false | |
@Published var firstname: String = "" { | |
didSet { updateDismissability() } | |
} | |
@Published var lastname: String = "" { |
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 | |
import WebKit | |
import Combine | |
class WebViewData: ObservableObject { | |
@Published var loading: Bool = false | |
@Published var scrollPercent: Float = 0 | |
@Published var url: URL? = nil | |
@Published var urlBar: String = "https://nasa.gov" | |