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 { | |
@State var tags = ["apple", "egg", "banana", "pop", "orange", "acid", "whiskey", "soda"] | |
@State var constrainedWidth = 300.0 | |
var body: some View { | |
VStack { | |
addAndRemoveButtons |
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 | |
@main | |
struct MyApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} |
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 | |
class Foo: ObservableObject { | |
@Published var bars = [Bar(), Bar(), Bar()] | |
} | |
class Bar: ObservableObject, Identifiable { | |
@Published var value = 0 | |
} |
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 | |
class Foo: ObservableObject { | |
@Published var bars = [Bar(), Bar(), Bar()] | |
} | |
struct Bar: Identifiable { | |
var id = UUID() | |
var value = 0 | |
} |
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 Crossword { | |
var cells: [[Cell]] = [ | |
[Cell(0), Cell(1), Cell(2)], | |
[Cell(11), Cell(22)], | |
[Cell(777)] | |
] | |
} |
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 | |
let kBookmarkUDKey = "somekey" | |
struct ContentView: 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
class EZIO { | |
//URL <-> bookmark Data (assume security access) | |
public static func makeBookmark(url: URL) -> Data? { | |
do { | |
return try url.bookmarkData( | |
options: .minimalBookmark, | |
includingResourceValuesForKeys: nil, |
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 | |
class Emoji { | |
var character = "🧚🏼♀️" | |
var position = CGPoint(x: 100, y: 0) | |
} | |
struct ContentView: View { | |
let emoji = Emoji() | |
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
import SwiftUI | |
struct ContentView: View { | |
let arr = [1, 2, 4, 7] | |
@State var currentIndex = 0 | |
var body: some View { | |
VStack { | |
IntArraySlider(arr: arr, currentIndex: $currentIndex) | |
Text("index: \(currentIndex), value: \(arr[currentIndex])") | |
} |
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 AVFoundation | |
struct ContentView: View { | |
let mar = MyAudioRecorder() | |
var body: some View { | |
VStack(spacing: 16) { | |
NewerOlder