(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| prefix operator .. | |
| infix operator ..: MultiplicationPrecedence | |
| /* | |
| Custom operator that lets you configure an instance inline | |
| ```swift | |
| let label = UILabel()..{ | |
| $0.numberOfLines = 0 | |
| $0.textColor = .systemRed | |
| } |
| @propertyWrapper | |
| public struct AnyProxy<EnclosingSelf, Value> { | |
| private let keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value> | |
| public init(_ keyPath: ReferenceWritableKeyPath<EnclosingSelf, Value>) { | |
| self.keyPath = keyPath | |
| } | |
| @available(*, unavailable, message: "The wrapped value must be accessed from the enclosing instance property.") | |
| public var wrappedValue: Value { |
| // | |
| // Created by Eric Firestone on 3/22/16. | |
| // Copyright © 2016 Square, Inc. All rights reserved. | |
| // Released under the Apache v2 License. | |
| // | |
| // Adapted from https://gist.github.com/blakemerryman/76312e1cbf8aec248167 | |
| import Foundation | |
| xcrun llvm-cov report -use-color=true -instr-profile \ | |
| ./Build/Intermediates/CodeCoverage/Coverage.profdata \ | |
| ./Build/Intermediates/CodeCoverage/MyApp/Products/Debug-iphonesimulator/MyApp.app/MyApp |
| #import <Foundation/Foundation.h> | |
| int main(int argc, const char * argv[]) { | |
| @autoreleasepool { | |
| void (^benchmark)(const char *str) = ^(const char *str) { | |
| const long count = 10000000; | |
| NSDate *start = [NSDate date]; | |
| for (long i = 0; i < count; i++) { | |
| (void)[[NSString alloc] initWithUTF8String:str]; | |
| } |
| /// Observes a run loop to detect any stalling or blocking that occurs. | |
| /// | |
| /// This class is thread-safe. | |
| @interface GHRunLoopWatchdog : NSObject | |
| /// Initializes the receiver to watch the specified run loop, using a default | |
| /// stalling threshold. | |
| - (id)initWithRunLoop:(CFRunLoopRef)runLoop; | |
| /// Initializes the receiver to detect when the specified run loop blocks for |
| import UIKit | |
| extension NSLocale { | |
| class func currentLocale() -> NSLocale { | |
| return NSLocale.localeWithLocaleIdentifier("en_GB"); | |
| } | |
| } | |
| NSLocale.currentLocale().localeIdentifier |
| // See: https://devforums.apple.com/message/1000934#1000934 | |
| import Foundation | |
| // Logic | |
| operator prefix ¬ {} | |
| @prefix func ¬ (value: Bool) -> Bool { | |
| return !value | |
| } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
std::set phoenix;
phoenix.key_comp();