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
// Configuration settings file format documentation can be found at: | |
// https://help.apple.com/xcode/#/dev745c5c974 | |
SUPPORTED_PLATFORMS = iphoneos macosx appletvos watchos iphonesimulator appletvsimulator watchsimulator | |
SWIFT_VERSION = 4.2 | |
IPHONEOS_DEPLOYMENT_TARGET = 9.0 | |
MACOSX_DEPLOYMENT_TARGET = 10.11 |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016 Alexander Grebenyuk (github.com/kean). | |
import Foundation | |
public class Promise<T> { | |
private var state: State<T> = .pending(Handlers<T>()) | |
private var queue = DispatchQueue(label: "com.github.kean.Promise") | |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016-2019 Alexander Grebenyuk (github.com/kean). | |
import Foundation | |
/// Future extenions. | |
public struct FutureExtension<Base> { | |
/// Base object to extend. | |
public let base: Base |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2020 Alexander Grebenyuk (github.com/kean). | |
import CoreData | |
final class FetchedEntities<Element: NSManagedObject>: NSObject, NSFetchedResultsControllerDelegate, RandomAccessCollection, ObservableObject { | |
private let controller: NSFetchedResultsController<Element> | |
init(context: NSManagedObjectContext, request: NSFetchRequest<Element>) { |
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
// A speculative _ViewRendererHost implementation which uses Mirror (Swift reflection) to find all | |
// of the dynamic properties (`DynamicProperty`) associated with a given view (`View`), observe | |
// the changes to these properties and automatically refresh the view whenever any of these property change. | |
protocol _DynamicProperty { | |
var objectWillChange: AnyPublisher<Void, Never> { get } | |
} | |
extension ObservedObject: _DynamicProperty { | |
var objectWillChange: AnyPublisher<Void, Never> { |
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 Future | |
import Combine | |
public extension Future { | |
var publisher: Combine.Future<Value, Error> { | |
Combine.Future { fulfill in | |
self.on(success: { | |
fulfill(.success($0)) | |
}, failure: { | |
fulfill(.failure($0)) |
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 SearchView: View { | |
@ObservedObject var viewModel: SearchViewModel | |
var body: some View { | |
VStack { | |
TextField("Search", text: $viewModel.query) | |
List(viewModel.songs) { | |
Text($0.name) | |
} | |
} |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2017 Alexander Grebenyuk (github.com/kean). | |
import Foundation | |
/// Proof-of-concept List implementation, not optimized in any way. | |
/// | |
/// Usage: | |
/// |
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
asd |