This is a Cheatsheet for RxSwift developers migrating to projects using ReactiveSwift.
Inspired by the RxSwift to Combine cheatsheet
RxSwift | ReactiveSwift | |
---|---|---|
Deployment Target | iOS 8.0+ | iOS 8.0+ |
#!/usr/bin/swift | |
import Foundation | |
func processFile(_ path: String, keyPrefix: String?) { | |
guard let file = freopen(path, "r", stdin) else { | |
fputs("Failed to open file.\n", stderr) | |
return | |
} | |
defer { | |
fclose(file) |
This is a Cheatsheet for RxSwift developers migrating to projects using ReactiveSwift.
Inspired by the RxSwift to Combine cheatsheet
RxSwift | ReactiveSwift | |
---|---|---|
Deployment Target | iOS 8.0+ | iOS 8.0+ |
-- Sets your audio input source to "Internal Microphone" | |
-- Frequently needed if you use bluetooth headpohones and | |
-- run the Xcode iOS simulator, which will often set your | |
-- headphones to be the input device, resulting in a drastic | |
-- decrease in sound quality, and making it mono | |
tell application "System Preferences" to activate | |
tell application "System Preferences" | |
reveal anchor "input" of pane id "com.apple.preference.sound" | |
end tell |
import { both, converge, equals as eq, ifElse, not, pipe, toLower, type, keys, curry } from "ramda" | |
import { Either, left, right, isLeft, isRight, getOrElse } from "fp-ts/lib/Either" | |
export type Json = string|number|boolean|Date|JsonObject | |
interface JsonObject { | |
[x: string]: Json; | |
} | |
interface JsonArray extends Array<Json> { } |
func dict<T, U: Hashable>(from array: [T], getKey: (T) -> U) -> [U : T] { | |
var dict: [U : T] = .init(minimumCapacity: array.count) | |
array.forEach { | |
dict[getKey($0)] = $0 | |
} | |
return dict | |
} |
import Foundation | |
func encodeString(str: String) -> String { | |
return Array(str.utf16).map { | |
String(format: "%04x", $0) | |
}.reduce("") { | |
return $0 + $1 | |
} | |
} |
// Circular primes | |
// Problem 35 | |
// The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. | |
// | |
// There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. | |
// | |
// How many circular primes are there below one million? | |
import Foundation |
@import UIKit; | |
#import "PersistentStack.h" | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@end |