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
GET /users/connected=true | |
[{ | |
first_name: "John", | |
family_name: "Smith", | |
Birthday: "2001-04-12T09:20:32.000+01:00" | |
}] |
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 SwiftUINavigation | |
import XCTestDynamicOverlay | |
// MARK: - Screen One | |
@MainActor class ScreenOne: ObservableObject { | |
@CasePathable | |
@dynamicMemberLookup | |
enum Destination { |
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 Dependencies | |
import AsyncExtensions | |
public struct Setting<Value:Sendable>: Sendable { | |
let id: String | |
let name: String | |
let fallback: Value | |
let load: @Sendable (String) -> Value? |
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
// MARK: - Audio | |
extension Audio.InputDidChange: TrackedAction {} | |
extension Audio.OutputDidChange: TrackedAction {} | |
extension Audio.RecordingDidStop: TrackedAction {} | |
extension Audio.RecordingDidStart: TrackedAction {} | |
extension AudioRoutePicker.DidAppear: TrackedAction {} | |
extension AudioRoutePicker.DidDisappear: TrackedAction {} |
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
struct ContentView: View { | |
let count = 1_000_000 | |
var body: some View { | |
ScrollViewReader { reader in | |
VStack { | |
Button(action: { reader.scrollTo(100, anchor: .center) }) { | |
Text("Scroll to 100") // Works | |
} |
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 | |
struct TappableView: UIViewRepresentable { | |
let onTap: () -> Void | |
let onPress: (Bool) -> Void | |
func makeUIView(context: Context) -> UIView { | |
TappableUIView(onTap: onTap, onPress: onPress) | |
} |
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 | |
/// SwiftUI implementation of a responsive-feeling scrollview with tappable tiles. | |
/// We use a custom UIScrollView via UIViewRepresentable and a UIView tap overlay to | |
/// get around current SwiftUI issues with simultaneous gesture recognition and allow | |
/// the tiles to respond instantly to presses while scrolling. | |
struct ContentView: View { | |
@State private var showSheet = false |
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 | |
struct Person { | |
let id: UUID | |
var name: String | |
var score: Float | |
} | |
class PersonStore: ObservableObject { | |
@Published var people: [Person] = [ |
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
extension Sequence where Element: AdditiveArithmetic { | |
func sum() -> Element { | |
reduce(.zero, +) | |
} | |
} | |
extension Sequence { | |
func sum<T: AdditiveArithmetic>(_ keyPath: KeyPath<Element, T>) -> T { | |
map { $0[keyPath: keyPath] }.sum() | |
} |
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
xml.instruct! :xml, version: "1.0" | |
rss_attributes = { | |
"version" => "2.0", | |
"xmlns:dc" => "http://purl.org/dc/elements/1.1/", | |
"xmlns:sy" => "http://purl.org/rss/1.0/modules/syndication/", | |
"xmlns:atom" => "http://www.w3.org/2005/Atom", | |
"xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | |
"xmlns:content" => "http://purl.org/rss/1.0/modules/content/", | |
"xmlns:itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd", |
NewerOlder