The Composable Architecture (TCA, pour faire court) est une bibliothèque permettant de construire des applications de manière cohérente et compréhensible, en tenant compte de la composition, des tests et de l'ergonomie. Elle peut être utilisée avec SwiftUI, UIKit, et encore, et sur toutes les plateformes Apple (iOS, ma
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 Foundation | |
import CryptoKit | |
import AuthenticationServices | |
import UIKit | |
struct SignInWithAppleResult { | |
let token: String | |
let nonce: String | |
} |
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 Combine | |
struct ContentView: View { | |
@State var items: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
var body: some View { | |
List { | |
ForEach(items, id: \.self) { item in | |
Text("Item: \(item)") |
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
// | |
// ContentView.swift | |
// WeirdSheet | |
// | |
// Created by lotusirous on 28/11/2022. | |
// | |
import SwiftUI | |
protocol Nameable { |
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 UIKit | |
import SwiftUI | |
// Credits to: https://www.avanderlee.com/swiftui/integrating-swiftui-with-uikit/ | |
extension UIViewController { | |
/// Add a SwiftUI `View` as a child of the input `UIView`. | |
/// - Parameters: | |
/// - swiftUIView: The SwiftUI `View` to add as a child. |
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 CloudKit | |
import Combine | |
/// Fetches the user's CloudKit Account status. | |
/// | |
/// - Parameter container: The container to check the status in. | |
/// | |
/// - Returns: A deferred future that resolves to the user's CloudKit Account status. | |
func getAccountStatus(for container: CKContainer) -> AnyPublisher<CKAccountStatus, Error> { | |
Deferred { |
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
// | |
// Do not edit! File generated using SwiftGen — https://github.com/SwiftGen/SwiftGen | |
// | |
// SwiftUI Template by Felix Mau – https://felix.hamburg | |
// | |
// Latest version available at https://gist.github.com/fxm90/d1eb5439ad0f45d727bdb98132e933a6 | |
// | |
import SwiftUI |
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 Publisher where Self.Failure == Never { | |
public func assignNoRetain<Root>(to keyPath: ReferenceWritableKeyPath<Root, Self.Output>, on object: Root) -> AnyCancellable where Root: AnyObject { | |
sink { [weak object] (value) in | |
object?[keyPath: keyPath] = 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
extension Result { | |
func tryMap<T>(_ transform:(Success) throws -> T) -> Result<T, Swift.Error> { | |
switch self { | |
case let .success(success): | |
do { | |
return .success(try transform(success)) | |
} catch { | |
return .failure(error) | |
} | |
case let .failure(failure): |
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
@propertyWrapper struct MustInjected<Value> { | |
private var _value: Value! = nil | |
#if DEBUG | |
let line: UInt | |
let file: StaticString | |
#endif | |
@available(*, unavailable) | |
init(wrappedValue: @autoclosure @escaping () -> Value) { | |
self._value = nil | |
line = #line |
NewerOlder