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 | |
public final class ModuleController<State, Update, Message, Task> { | |
private var state: State | |
private var reducer: (inout State, Message) -> ([Update], [Task]) | |
private var worker: (ModuleController, Task) -> Void | |
private var presenter: (Update) -> Void | |
public init(state: State, | |
reducer: @escaping (inout State, Message) -> ([Update], [Task]), |
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 | |
public final class ModuleController<Module: ModuleDescription> { | |
public var uiComponent: UIComponent { return presenter.uiComponent } | |
private var state: Module.State | |
private let dispatcher: (inout Module.State, Module.Message) -> (changes: [Module.Change], tasks: [Module.Task]) | |
private let worker: (@escaping (Module.Message) -> Void, Module.Task) -> Void | |
private var presenter: Module.Presenter | |
public init(state: Module.State, |
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 sys | |
import os | |
import subprocess | |
import venv | |
import runpy | |
import logging | |
import requirements | |
def run(dev_env: bool): |
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
ARG SWIFT_VERSION="5.0.1" | |
# builder image | |
FROM swift:${SWIFT_VERSION} as builder | |
RUN apt-get -qq update && apt-get install -y \ | |
libssl-dev zlib1g-dev \ | |
&& rm -r /var/lib/apt/lists/* | |
# compile application | |
WORKDIR /app |
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 | |
public protocol Executor { | |
func execute(_ task: @escaping () -> Void) | |
} | |
extension DispatchQueue: Executor { | |
@inlinable public func execute(_ task: @escaping () -> Void) { | |
async(execute: task) |
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 Darwin | |
internal enum AtomicFlag { | |
internal typealias Pointer = UnsafeMutablePointer<atomic_flag> | |
@inline(__always) | |
internal static func make() -> Pointer { | |
let pointer = Pointer.allocate(capacity: 1) | |
pointer.pointee = atomic_flag() |
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 | |
public protocol DataEncoder { | |
func encode<T>(_ value: T) throws -> Data where T: Encodable | |
} | |
extension JSONEncoder: DataEncoder {} | |
public protocol DataDecoder { | |
func decode<T>(_ type: T.Type, from data: Data) throws -> T where T: Decodable |
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 Style where T: UILabel { | |
public func font(_ weight: UIFont.Weight, size: CGFloat) -> Style<T> { | |
return with { label in | |
label.font = UIFont.systemFont(ofSize: size, weight: weight) | |
} | |
} | |
public func color(_ color: UIColor) -> Style<T> { | |
return with { label in | |
label.textColor = color |
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 | |
internal protocol AnyOptional { | |
var isNone: Bool { get } | |
} | |
extension Optional: AnyOptional { | |
var isNone: Bool { | |
switch self { | |
case .none: return 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 UIKit | |
import ObjectiveC | |
private var originalAdditionalSafeAreaInsetsKey: Int = 0 | |
open class KeyboardAwareViewController: UIViewController { | |
open class var backgroundTapEditingEndHandlerEnabled: Bool { true } | |
private var originalAdditionalSafeAreaInsets: UIEdgeInsets? { | |
get { |
OlderNewer