Skip to content

Instantly share code, notes, and snippets.

View srdanrasic's full-sized avatar

Srđan Rašić srdanrasic

View GitHub Profile
error: Error in auto-import:
failed to get module 'Realm Example' from AST context:
could not build Objective-C module 'Realm' A fatal parse error has occurred. LLDB may become unstable; please restart your debug session as soon as possible.
----
/Users/srdan/Develop/RealmExample/RealmExample/RLMSupport.swift:19:8: Could not build Objective-C module 'Realm'
@srdanrasic
srdanrasic / gist:3210c99c3fecd00c76fa
Created February 17, 2016 09:28
error levels emoji
verbose: 🔍
debug: 💬
warning: ☝️
error: ‼️
import XCTest
import ReactiveKit
import ReactiveSwift
import RxSwift
let iterations = 1000
let elements = 100
class BenchmarkTests: XCTestCase {
@srdanrasic
srdanrasic / Stepper.swift
Created January 9, 2017 21:52
Stateless Control
/// Example interface of a control that does not manage its own state.
public class Stepper {
/// Enum is usually a convenient type to represent action.
public enum Action {
case increase
case decrease
}
/// On the output is an action or intent describing what to do with the state.
public class Authentication {
public typealias Credentials = (username: String, password: String)
public let credentials: SafeObserver<Credentials>
public let token: SafeSignal<Token>
public init(client: SafeClient) {
let credentials = SafePublishSubject<Credentials>()
public class RecipeList {
public let sortDescriptor: SafeObserver<SortDescriptor>
public let recipes: SafeSignal<[Recipe]>
public init(client: SafeClient, category: Category) {
let recipes = client
.response(for: API.Recipe.all(category: category))
.shareReplay(limit: 1)
extension ViewController {
public class Authentication: UIViewController {
public let usernameTextField = UITextField()
public let passwordTextField = UITextField()
public let loginButton = UIButton()
public override func viewDidLoad() {
super.viewDidLoad()
extension ViewController {
public class RecipeList: UITableViewController {
public let sortDescriptorPickerView = PickerView<SortDescriptor>()
public override func viewDidLoad() {
super.viewDidLoad()
// setup subviews and layout
}
extension Interactor {
public func createScene() -> Output {
...
}
}
extension Authentication {
public typealias Scene = (
viewController: UIViewController,
token: SafeSignal<Token>
)
public func createScene() -> Scene {
let vc = ViewController.Authentication()