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 Todo: Identifiable { | |
let id: UUID | |
var title = "Untitled" | |
var isComplete = false | |
static var sample: [Todo] { | |
[ |
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 Todo: Identifiable { | |
let id: UUID | |
var title: String = "Untitled" | |
var isComplete: Bool = false | |
static var sample: [Todo] { | |
[ | |
Todo( |
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 Foundation | |
protocol Animal { | |
associatedtype CommodityType: Food | |
associatedtype FeedType: AnimalFeed | |
var isHungry: Bool { get } | |
func produce() -> CommodityType | |
func eat(_: FeedType) |
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 SwiftLogo: Shape { | |
func path(in rect: CGRect) -> Path { | |
var path = Path() | |
let width = rect.width | |
let height = rect.height | |
let startPoint = CGPoint(x: rect.minX, y: height * 0.63) | |
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 ImageDetailView: View { | |
let image: Image | |
@State var scale = 1.0 | |
@State private var lastScale = 1.0 | |
private let minScale = 1.0 | |
private let maxScale = 5.0 | |
var magnification: some Gesture { |
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 { | |
@GestureState var anotherState = false | |
@State var isTapped = false | |
var tap: some Gesture { | |
TapGesture(count: 4) | |
.onEnded { state in | |
// State is an empty tuple (void) |