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
// | |
// Swift4Compat.swift | |
// openrider | |
// | |
// Created by Jeremie Girault on 14/06/2017. | |
// Copyright © 2017 EC1. All rights reserved. | |
// | |
import UIKit |
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 UILayoutPriority: ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral { | |
public init(floatLiteral value: Float) { | |
self.init(rawValue: value) | |
} | |
public init(integerLiteral value: Int) { | |
self.init(rawValue: Float(value)) | |
} | |
public static func +(lhs: UILayoutPriority, rhs: UILayoutPriority) -> UILayoutPriority { |
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 sad state of tuples in swift 4 | |
func test() { | |
return () // why is it not mandatory ? | |
} | |
// func test() -> Void {} // error: invalid redeclaration of 'test()' why is it a redefinition ? | |
/* | |
The problem is that Void in swift is not the "Absence" of a parameter but the type of the empty tuple | |
We should change the definition to: |
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 CustomTransform { | |
associatedtype Result | |
func apply(_ sink: (Result) -> Void) | |
} | |
enum FilterMap<Result>: CustomTransform { | |
case filter | |
case map(Result) |
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
//: [Previous](@previous) | |
import UIKit | |
import PlaygroundSupport | |
let view = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 400)) | |
var test: Bool = false | |
class Handler: NSObject { |
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
// Generated using SwiftGen, template by @jeremiegirault — https://github.com/SwiftGen/SwiftGen | |
#if os(iOS) || os(tvOS) || os(watchOS) | |
import UIKit.UIFont | |
typealias Font = UIFont | |
#elseif os(OSX) | |
import AppKit.NSFont | |
typealias Font = NSFont | |
#endif |
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
final class AssertComplete { | |
var defused: Bool = false | |
let function: String | |
init(function: String = #function) { | |
self.function = function | |
} | |
func defuse() { defused = 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 RxSwift | |
private var disposeBagKey: UInt8 = 0 | |
private final class KeyboardObserver { | |
private static var key: UInt8 = 0 | |
let guide = UILayoutGuide() | |
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
private final class KeyboardObserver { | |
private static var key: UInt8 = 0 | |
let guide = UILayoutGuide() | |
private var isAttached = false | |
private let top: NSLayoutConstraint | |
private let left: NSLayoutConstraint | |
private let width: NSLayoutConstraint | |
private let height: NSLayoutConstraint |
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 RxSwift | |
fileprivate final class MutableReference<T> { | |
var value: T | |
init(_ value: T) { self.value = value } | |
} | |
struct SideEffect<State> { |