読者です 読者をやめる 読者になる 読者になる

Swiftエンジニアのみなさんお待たせしました #岡山ナイト by Ryo Fukuda!

 

これが岡山ナイトの素晴らしさです!!!! 

 

import RxSwift

import RxCocoa

 

class ViewController: UIViewController {

 

    private let disposeBag = DisposeBag()

    

    override func viewDidLoad() {

        super.viewDidLoad()

        

        let whatsOkayamaNight = Observable<Int>

            .interval(1.0, scheduler: MainScheduler.instance)

            .map { _ in OkayamaNight(Int(arc4random_uniform(UInt32(Int(5))))) }

            .shareReplay(1)

        

        let answerOfQuestion = [whatsOkayamaNight, whatsOkayamaNight.skip(1), whatsOkayamaNight.skip(2), whatsOkayamaNight.skip(3), whatsOkayamaNight.skip(4)]

            .zip { $0 }

            .skipWhile { $0 != [.EventName, .BeVerb, .String, .Address, .Place] }

        

        answerOfQuestion

            .doOnNext { okayama in

                okayama.forEach { print($0.rawValue) }

            }

            .concat(Observable.never().take(1.0, scheduler: MainScheduler.instance))

            .subscribeNext { _ in print("岡山佳孝 @okayama1991") }

            .addDisposableTo(disposeBag)

    }

}

 

enum OkayamaNight: String {

    case EventName = "Okayama Night"

    case Place = "at HiveShibuya"

    case Address = "150-0043東京都渋谷区道玄坂2-10-12 新大宗ビル3号館531"

    case BeVerb = "is"

    case String = "where all the engineers are at"

    case unknown = ""

    

    init(_ number: Int) {

        switch number {

        case 0: self = .EventName

        case 1: self = .Place

        case 2: self = .Address

        case 3: self = .BeVerb

        case 4: self = .String

        default: self = .unknown

        }

    }

}

 

岡山ナイトはこちらから

http://svmeetup.connpass.com/event/34950/