Skip to content

Instantly share code, notes, and snippets.

@Busta117
Busta117 / updateDictionaty
Last active October 25, 2016 20:35
merge 2 dictionaries in 1 with the operator += changes will keep in the left one
/**
add the content of a dictionary into another dictionary
swift 3
*/
func += <K>( dict1:inout [K:Any], dict2:[K:Any]){
dict2.forEach { (key: K, value: Any) in
dict1[key] = value
}
}
@Busta117
Busta117 / rxbi
Created November 21, 2016 21:25
Bidirectional bind RxSwift, swift 3
infix operator <~> : AssignmentPrecedence
//Bidirectional bind RxSwift, swift 3
public func <~> <E,C: ControlPropertyType>(property: C, variable: Variable<E>) -> Disposable where C.E == E? {
let bindToUIDisposable = variable.asObservable()
.bindTo(property)
let bindToVariable = property
.subscribe(onNext: { n in
if let n = n{
variable.value = n
@Busta117
Busta117 / ObjectMapperRealmHelper.swift
Created February 15, 2017 19:03
transform array from objectMapper parsing to Realm List
//
// ObjectMapperRealmHelper.swift
// Pods
//
// Created by Santiago Bustamante on 10/13/16.
//
//
import ObjectMapper
import RealmSwift
@Busta117
Busta117 / ObjectMapperRealmHelper.swift
Last active March 1, 2020 16:56
map Realm arrays into ObjectMapper
//
// ObjectMapperRealmHelper.swift
//
// Created by Santiago Bustamante on 07/27/18.
//
//
import ObjectMapper
import RealmSwift