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
//TransferMoney context | |
class TransferMoney: Context { | |
private let SourceAccount: SourceAccountRole | |
private let DestinationAccount: DestinationAccountRole | |
init(source:AccountData, destination:AccountData) { | |
SourceAccount = source as! SourceAccountRole | |
DestinationAccount = destination as! DestinationAccountRole |
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
APP="MyApp" | |
CONSTRUCT=xcodebuild -workspace $(APP).xcworkspace -scheme $(APP) clean | |
install_deps: | |
pod install | |
create_config: | |
swift package fetch | |
swift package generate-xcodeproj | |
wipe: | |
rm -rf .build $(APP).xcodeproj $(APP).xcworkspace Package.pins Pods Podfile.lock |
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
enum Pair<T, WORLD> { | |
case cons (T, WORLD) // (value, outside) | |
} | |
// Outside the computer | |
typealias WORLD = Any | |
// IO Monad Instance (a.k.a IO Action) | |
typealias IO<T> = (WORLD) -> Pair<T, WORLD> |
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 UIKit | |
struct UILabelDebugOptions: OptionSet { | |
let rawValue: Int | |
static let bounds = UILabelDebugOptions(rawValue: 1 << 0) | |
static let ascender = UILabelDebugOptions(rawValue: 1 << 1) | |
static let descender = UILabelDebugOptions(rawValue: 1 << 2) | |
static let xHeight = UILabelDebugOptions(rawValue: 1 << 3) | |
static let capHeight = UILabelDebugOptions(rawValue: 1 << 4) |
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 | |
/// Predicatable is the protocol that all predicting objects conform. | |
public protocol Predicatable: CustomStringConvertible { | |
/// Returns a Boolean value indicating whether the specified object matches the conditions specified by the predicate. | |
/// | |
/// - Parameter object: The object against which to evaluate the predicate. | |
/// - Returns: `true` if object matches the conditions specified by the predicate, otherwise `false`. | |
func evaluate(with object: Any?) -> Bool |
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
# Uncomment the next line to define a global platform for your project | |
# platform :ios, '9.0' | |
target '%TargetName%' do | |
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
# Pods for %TargetName% | |
# pod 'FBSDKCoreKit' | |
end |
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
// | |
// ContentView.swift | |
// TestingMoreSwiftUI | |
// | |
// Created by Chris Eidhof on 04.06.19. | |
// Copyright © 2019 Chris Eidhof. All rights reserved. | |
// | |
import SwiftUI | |
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
struct LazyView<Content: View>: View { | |
let build: () -> Content | |
init(_ build: @autoclosure @escaping () -> Content) { | |
self.build = build | |
} | |
var body: Content { | |
build() | |
} | |
} |
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
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
///<<< Support Code for Lazy Streams | |
///<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | |
/// | |
/// Enables simple refactoring of lazy processing of 'streams' of values. | |
/// A stream is taken here ot mean a lazy sequence. | |
/// | |
/// The code is not generic so if streams of different types are required | |
/// then extra sctions will be needed. | |
/// Simple to construct for a new type T though: |
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 NaturalLanguage | |
let languages: [NLLanguage] = [ | |
.amharic, .arabic, .armenian, .bengali, .bulgarian, | |
.burmese, .catalan, .cherokee, .croatian, .czech, | |
.danish, .dutch, .english, .finnish, .french, | |
.georgian, .german, .greek, .gujarati, .hebrew, | |
.hindi, .hungarian, .icelandic, .indonesian, .italian, | |
.japanese, .kannada, .khmer, .korean, .lao, | |
.malay, .malayalam, .marathi, .mongolian, .norwegian, |