This file contains hidden or 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
//MARK: UIViewController | |
extension UIViewController { | |
func IKAddChildViewController(child:UIViewController) { | |
child.willMove(toParentViewController: self) | |
addChildViewController(child) | |
child.beginAppearanceTransition(true, animated: true) | |
view.addSubview(child.view) | |
child.endAppearanceTransition() |
This file contains hidden or 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
//First Implementation | |
func numberOfVowelsInString(string: String) -> Int { | |
let vowels: [Character] = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"] | |
var numberOfVowels = 0 | |
for character in string.characters { | |
if vowels.contains(character) { | |
numberOfVowels += 1 | |
} |
This file contains hidden or 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
do { | |
let disposeBag = DisposeBag() | |
let variable = Variable("A") | |
variable.value = "B" | |
variable.asObservable() | |
.subscribe { print($0) } | |
.addDisposableTo(disposeBag) |
This file contains hidden or 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
//disposeBag from memoy management | |
let disposeBag = DisposeBag() | |
//Create our ReplaySubject with a string type | |
let subject = ReplaySubject<String>.create(bufferSize: 2) | |
subject.on(.Next("A")) | |
//New Subscription | |
subject.subscribe { | |
print($0) |
This file contains hidden or 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
//disposeBag from memoy management | |
let disposeBag = DisposeBag() | |
//Create our BehaviorSubject with a string type | |
let subject = BehaviorSubject(value: "Bob") | |
//New Subscription | |
subject.subscribe { | |
print($0) | |
} | |
.addDisposableTo(disposeBag) |
This file contains hidden or 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
//disposeBag from memoy management | |
let disposeBag = DisposeBag() | |
//Create our PublishSubject with a string type | |
let subject = PublishSubject<String>() | |
//ErrorType will be used for emitting an Error event | |
enum Error: ErrorType { | |
case Test | |
} | |
//emit our first event before any subscription to the subject |
This file contains hidden or 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
{ | |
"id": "2", | |
"firstName": "Maria", | |
"lastName": "Sharapova", | |
"photo": "http://thewallmachine.com/files/1363603040.jpg" | |
} |
This file contains hidden or 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
"extended_entities": { | |
"media": [ | |
{ | |
"id": 613466166028189700, | |
"id_str": "613466166028189697", | |
"indices": [ | |
11, | |
33 | |
], | |
"media_url": "http://pbs.twimg.com/media/CIN4OkvUwAE1gJr.jpg", |
This file contains hidden or 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
{ | |
"text": "Oxford Town The text in here", | |
"html": "<p><a href=\"http://dylan.town\">Oxford Town</a> The text in here</p>", | |
"embeds": { | |
"facebook": [ | |
{ | |
"url": "https://www.facebook.com/FacebookDevelopers/posts/10151471074398553", | |
"html": "<div class=\"fb-post\" data-href=\"https://www.facebook.com/FacebookDevelopers/posts/10151471074398553\" data-width=\"500\"></div>", | |
"line": 1 | |
}, |