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
enum Notifications { | |
public class Notification<T, Identifier: Equatable> { | |
private var allObservers: [WeakContainer] = [] | |
public var observers: [RegisteredObserver] { | |
observersRegisteredByOwners = observersRegisteredByOwners.filter({ $0.owner != nil }) // remove observers where owner is nil | |
let aliveObservers = allObservers.compactMap({ $0.value }) | |
if aliveObservers.count != allObservers.count { | |
allObservers = allObservers.filter({ $0.value != nil }) // remove dead observers |
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 Foundation | |
let string = "{\"bool\" : true, \"int\": 1 }" | |
let json = try! JSONSerialization.jsonObject(with: string.data(using: .utf8)!, options: []) | |
if let dict = json as? [String: Any] { | |
dict["bool"] is NSNumber | |
dict["int"] is NSNumber | |
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
#!/bin/sh | |
MERGEPBX_TARGET=mergepbx | |
MERGEPBX_PREFIX=/usr/local/bin | |
MERGEPBX_BUILD_DIR=/tmp | |
MERGEPBX_REPO=https://github.com/simonwagner/mergepbx.git | |
build() | |
{ | |
cd $MERGEPBX_BUILD_DIR/$MERGEPBX_TARGET |