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
| var express = require('express') | |
| var app = express() | |
| app.get('/footballPlayers', function(req, res) { | |
| var json_string = {"players":[ | |
| {"name":"Messi", "goals":8}, | |
| {"name":"Ronaldo", "goals":22}, | |
| {"name":"Costa", "goals":20}, | |
| {"name":"Neymar", "goals":13}, |
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
| class ViewController: UIViewController { | |
| @IBOutlet weak var textField: UITextField! | |
| @IBOutlet weak var resultLabel: UILabel! | |
| var viewModel: ViewModel! | |
| let disposeBag = DisposeBag() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // Do any additional setup after loading the view, typically from a nib. | |
| } |
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
| class ViewModel { | |
| var numberVariable = Variable<String?>(nil) | |
| var isEvenObservable: Observable<String>! | |
| init () { | |
| isEvenObservable = numberVariable.asObservable() | |
| .map {number in | |
| guard let numberTemp = number else {return "Invalid"} | |
| guard let numberIsNumber = Int(numberTemp) else {return (numberTemp + " is not number")} | |
| return (numberIsNumber % 2 == 0) ? numberTemp + " is Even" : numberTemp + " is Odd" |
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
| source 'https://github.com/CocoaPods/Specs.git' | |
| platform :ios, '8.0' | |
| use_frameworks! | |
| target 'AAA' do | |
| pod 'RxSwift' | |
| pod 'RxCocoa' | |
| end |
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
| class ViewModel { | |
| var numberVariable = Variable<String?>(nil) | |
| var isEvenObservable: Observable<String>! | |
| } |