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
/* | |
Once you've signed in with Apple in your iOS app, turn the `identityToken` into a string with something like | |
`String(data: identityToken, encoding: .utf8)`. Then use that string in the Authorization header: | |
`urlRequest.addValue("Bearer \(identityString)", forHTTPHeaderField: "Authorization")` | |
*/ | |
import Vapor | |
import JWT |
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
# | |
# Multi-Stage Docker build: | |
# Laravel 5.8 + PHP73 + Postgres || MySQL | |
# | |
# @link https://laravel.com/docs/5.8 | |
# @link https://hub.docker.com/_/php | |
# @link https://hub.docker.com/_/mysql | |
# @link https://hub.docker.com/_/postgres | |
# |
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
// | |
// Combine+WithLatestFrom.swift | |
// | |
// Created by Shai Mishali on 29/08/2019. | |
// Copyright © 2019 Shai Mishali. All rights reserved. | |
// | |
import Combine | |
// MARK: - Operator methods |
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 | |
struct ZipMany<Element, Failure>: Publisher where Failure: Error { | |
typealias Output = [Element] | |
private let underlying: AnyPublisher<Output, Failure> | |
init<T: Publisher>(publishers: [T]) where T.Output == Element, T.Failure == Failure { | |
let zipped: AnyPublisher<[T.Output], T.Failure>? = publishers.reduce(nil) { result, publisher in | |
if let result = result { |
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
/// Similar to a `Binding`, but this is also observable/dynamic. | |
@propertyDelegate | |
@dynamicMemberLookup | |
final class Derived<A>: BindableObject { | |
let didChange = PassthroughSubject<A, Never>() | |
fileprivate var cancellables: [AnyCancellable] = [] | |
private let get: () -> (A) | |
private let mutate: ((inout A) -> ()) -> () | |
init(get: @escaping () -> A, mutate: @escaping ((inout A) -> ()) -> ()) { | |
self.get = get |
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 | |
/** | |
An observable, mutable property. | |
Replays the current value when subscribed. | |
*/ | |
@propertyWrapper | |
struct Published<Output>: Publisher { | |
typealias Failure = Never |
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
/*: | |
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI | |
The only purpose of this code is to implement those wrappers myself | |
just to understand how they work internally and why they are needed, | |
⚠️ This is not supposed to be a reference implementation nor cover all | |
subtleties of the real Binding and State types. | |
The only purpose of this playground is to show how re-implementing | |
them myself has helped me understand the whole thing better |
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
#if os(macOS) | |
import AppKit | |
public typealias UXImage = NSImage | |
#elseif os(iOS) | |
import UIKit | |
public typealias UXImage = UIImage | |
#endif | |
/// Extensions for system images included in SF Symbols | |
@available(macOS 10.15, iOS 13.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
// | |
// DispatchQueueScheduler.swift | |
// | |
import Combine | |
import Foundation | |
// DO NOT USE THIS IN PRODUCTION | |
struct DispatchQueueScheduler: Scheduler { | |
let queue: DispatchQueue |