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 | |
| public protocol ValueTransforming: NSSecureCoding { | |
| static var valueTransformerName: NSValueTransformerName { get } | |
| } | |
| public class NSSecureCodingValueTransformer<T: NSObject & ValueTransforming>: ValueTransformer { | |
| public override class func transformedValueClass() -> AnyClass { T.self } | |
| public override class func allowsReverseTransformation() -> Bool { true } |
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 Combine | |
| extension URLSession { | |
| /// Returns a publisher that wraps a URL session download task for a given | |
| /// URL. | |
| /// | |
| /// - Parameter url: The URL for which to create a download task. | |
| /// - Returns: A publisher that wraps a download task for the URL. |
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 Combine | |
| import CoreData | |
| public final class FetchedResultsPublisher | |
| <ResultType> | |
| : Publisher | |
| where | |
| ResultType: NSFetchRequestResult | |
| { | |
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
| //------------------------------------------------------------------------ | |
| // The SwiftUI Lab: Advanced SwiftUI Animations | |
| // https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths) | |
| // https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect) | |
| // https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier) | |
| //------------------------------------------------------------------------ | |
| import SwiftUI | |
| 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
| import SwiftUI | |
| import CoreData | |
| import Combine | |
| struct NamesByYearView: View { | |
| @EnvironmentObject var coreDataStack: CoreDataStack | |
| @Environment(\.managedObjectContext) var managedObjectContext | |
| @EnvironmentObject var importer: NameDatabaseImporter | |
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 PlaygroundSupport | |
| PlaygroundPage.current.needsIndefiniteExecution = true | |
| import Combine | |
| import Dispatch | |
| /// Returns a subscriber that buffers up to `size` values before calling the given `handler`. The | |
| /// subscriber will request more values from the upstream publisher once the `completion` closure | |
| /// given to the `handler` is called. | |
| func subscriber<Output, Failure>(size: Int, handler: @escaping (_ values: [Output], _ completion: @escaping () -> ()) -> ()) -> AnySubscriber<Output, Failure> { |
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
| // | |
| // FetchedResultsControllerPublisher.swift | |
| // ListsModel | |
| // | |
| // Created by Joseph Lord on 09/06/2019. | |
| // Copyright © 2019 Joseph Lord. All rights reserved. | |
| // | |
| import Foundation | |
| import Combine |
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 Combine | |
| import AlamofireImage | |
| let imageDownloader = ImageDownloader( | |
| configuration: ImageDownloader.defaultURLSessionConfiguration(), | |
| downloadPrioritization: .fifo, | |
| maximumActiveDownloads: 4, | |
| imageCache: AutoPurgingImageCache() | |
| ) |
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 Combine | |
| class MyDatabase: BindableObject { | |
| let didChange = PassthroughSubject<MyDatabase, Never>() | |
| var contacts: [Contact] = [ | |
| Contact(id: 1, name: "Anna"), Contact(id: 2, name: "Beto"), | |
| Contact(id: 3, name: "Jack"), Contact(id: 4, name: "Sam") | |
| ] { |
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 React, { Component } from 'react'; | |
| import { Alert, AppRegistry, Button, StyleSheet, View } from 'react-native'; | |
| export default class ButtonBasics extends Component { | |
| _onPressButton() { | |
| Alert.alert('You tapped the button!') | |
| } | |
| render() { | |
| return ( |