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
// | |
// Author: The SwiftUI-Lab | |
// The charts in this code are used in the article: https://swiftui-lab.com/swiftui-22-in-numbers | |
// | |
import SwiftUI | |
import Charts | |
@main | |
struct ChartGistApp: App { | |
var body: some Scene { |
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
// 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 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
// 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 { | |
ClockView() | |
.background(.gray) |
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
// Author: The SwiftUI-Lab | |
// This code is part of the tutorial: https://swiftui-lab.com/swiftui-animations-part4/ | |
import SwiftUI | |
// Sample usage | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
GifImage(url: URL(string: "https://media.giphy.com/media/YAlhwn67KT76E/giphy.gif?cid=790b7611b26260b2ad23535a70e343e67443ff80ef623844&rid=giphy.gif&ct=g")!) | |
.padding(10) |
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
//------------------------------------------------------------------------ | |
// 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 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
//------------------------------------------------------------------------ | |
// 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 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
//------------------------------------------------------------------------ | |
// 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 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 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" | |
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
struct Triangle: View { | |
let direction: Direction | |
let color: Color | |
init(_ direction: Direction = .down, _ color: Color = .black) { | |
self.direction = direction | |
self.color = color | |
} | |
var body: some View { |
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
// | |
// 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 |