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 User: Equatable { | |
| var firstName: String | |
| var lastName: String | |
| } | |
| @main | |
| struct MyApp: App { | |
| @State var value = User(firstName: "", lastName: "") | |
| @State var showEdit = false |
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 ConditionalContent<TrueContent: View, FalseContent: View>: View { | |
| let value: Bool | |
| let trueContent: () -> TrueContent | |
| let falseContent: () -> FalseContent | |
| var body: some View { | |
| if value { | |
| return AnyView(trueContent()) |
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 PlaygroundSupport | |
| struct iPod: View { | |
| var body: some View { | |
| VStack(spacing: 40) { | |
| Screen() | |
| ClickWheel() | |
| Spacer() | |
| } |
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 PlaygroundSupport | |
| struct Sunset: View { | |
| @State var backgroundColor = Color.blue | |
| @State var sunSetted = false | |
| let sunGradient = [Color.yellow, Color.orange] | |
| let moonGradient = [Color.gray, Color.black] | |
| @State var alignment = Alignment.top | |
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
| // | |
| // Apple.swift | |
| // Playground | |
| // | |
| // Created by Navdeep Singh on 7/14/20. | |
| // | |
| import SwiftUI | |
| struct Apple: 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
| import SwiftUI | |
| struct RGBAWheelView: WheelPickable { | |
| typealias DataType = RGBAData | |
| let data: DataType | |
| @State var thumbOffset = CGPoint() | |
| var _$thumbOffset: Binding<CGPoint> { $thumbOffset } | |
| let angularGradient: Gradient | |
| let radialGradient: Gradient | |
| init(data: DataType) { |
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 | |
| // Widgets | |
| // | |
| // Created by Kyle Halevi on 7/3/20. | |
| // | |
| import SwiftUI | |
| struct Widget: 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
| // A fun little game written in SwiftUI | |
| // Copyright (c) John Sundell 2020, MIT license. | |
| // This is a hacky implementation written just for fun. | |
| // It's only verified to work on iPhones in portrait mode. | |
| import SwiftUI | |
| final class GameController: ObservableObject { | |
| @Published var plane = GameObject.plane() | |
| @Published private(set) var clouds = [GameObject]() |
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 | |
| // | |
| // | |
| // Created by Bernstein, Joel on 7/4/20. | |
| // | |
| import SwiftUI | |
| struct ElementModel: Identifiable |