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 default implmentation that provides a few convenience methods for starting and stopping coordinators. | |
*/ | |
extension Coordinator { | |
// Default implementation, so that we don't have to do this for all coordinators. | |
func startChild<T: NSObject where T: Coordinator>(coordinator coordinator: T, withIdentifier identifier: String, callback: CoordinatorCallback?) -> T { | |
childCoordinators[identifier] = coordinator | |
coordinator.start(withCallback: callback) | |
return coordinator |
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
// sample graphql server deployed with firebase functions | |
// pulling some basic stockmarket data from a firebase db | |
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const express = require('express'); | |
const graphqlHTTP = require('express-graphql'); | |
const values = require('lodash.values'); | |
const { GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLString } = require('graphql'); | |
// Init express |
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
class Coordinator { | |
private(set) var childCoordinators: [Coordinator] = [] | |
func start() { | |
preconditionFailure("This method needs to be overriden by concrete subclass.") | |
} | |
func finish() { | |
preconditionFailure("This method needs to be overriden by concrete subclass.") |
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 UIKit | |
public protocol Configure {} | |
extension Configure { | |
/// Makes it available to set properties with closures just after initializing. | |
/// | |
/// let frame = UIView().configure { |
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
protocol EmptyOrNil { | |
var isEmpty: Bool { get } | |
} | |
extension Optional where Wrapped: EmptyOrNil { | |
var isEmptyOrNil: Bool { | |
return self?.isEmpty ?? true | |
} | |
} |
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 | |
protocol InitConfigurable { | |
init() | |
} | |
extension InitConfigurable { | |
init(configure: (Self) -> Void) { |
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 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 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 DecodingError.Context { | |
var pathDescription: String { | |
pathDescription(for: codingPath) | |
} | |
func path(including final: CodingKey) -> String { | |
pathDescription(for: codingPath + [final]) | |
} | |
private func pathDescription(for path: [CodingKey]) -> 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
class ViewController: UIViewController { | |
@IBAction func onSearch(_ sender: Any) { | |
let fakeWindow = UIWindow(windowScene: view.window!.windowScene!) | |
let fakeTextField = UITextField() | |
fakeTextField.autocorrectionType = .no | |
fakeWindow.addSubview(fakeTextField) | |
fakeWindow.makeKeyAndVisible() | |
fakeTextField.becomeFirstResponder() |
OlderNewer