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
    
  
  
    
  | // | |
| // PrintLocalesController.m | |
| // NSFormatterTest | |
| // | |
| // Created by Maciek Grzybowski on 02.04.2014. | |
| // | |
| #import "PrintLocalesController.h" | |
| @interface PrintLocalesController () | 
  
    
      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
    
  
  
    
  | // | |
| // APIService+Alamofire.swift | |
| // | |
| // Created by Maciek on 07.10.2015. | |
| // Copyright © 2015 Code Latte. All rights reserved. | |
| // | |
| import SWXMLHash | |
| import Alamofire | 
  
    
      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
    
  
  
    
  | // Crash: | |
| let cell = tableView.dequeueReusableCell(withIdentifier: Constants.twoLabelsCellIdentifier) as! TwoLabelsIconCell | |
| // Crash with verbose message: | |
| guard let cell = tableView.dequeueReusableCell(withIdentifier: Constants.twoLabelsCellIdentifier) as? TwoLabelsIconCell else { | |
| fatalEror("Cannot dequeue `TwoLabelsIconCell`") | |
| } | |
| // Crash in DEBUG, recover in Release: | |
| guard let cell = tableView.dequeueReusableCell(withIdentifier: Constants.twoLabelsCellIdentifier) as? TwoLabelsIconCell else { | 
  
    
      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
    
  
  
    
  | //: Playground - noun: a place where people can play | |
| import UIKit | |
| import PlaygroundSupport | |
| struct Frame { | |
| let x: CGFloat | |
| let y: CGFloat | |
| let width: CGFloat | 
  
    
      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
    
  
  
    
  | // Imperative | |
| protocol EditableMapSourceDelegate: class { | |
| func sourceDidChangeActiveTerritory(_ source: EditableMapSource) | |
| func sourceDidChangeData(_ source: MapDataSource) | |
| } | |
| final class EditableMapSource: MapDataSource { | |
| weak var delegate: EditableMapSourceDelegate? | 
  
    
      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
    
  
  
    
  | import RxSwift | |
| import RxCocoa | |
| final class Autocomplete { | |
| func autocomplete(text: Observable<String>) -> (result: Driver<AutocompleteResult>, | |
| isBusy: Driver<Bool>) { | |
| return (result: .empty(), isBusy: .empty()) // TODO | |
| } | |
| } | 
  
    
      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
    
  
  
    
  | import RxSwift | |
| protocol AutocompleteProvider { | |
| func autocomplete(text: String) -> Observable<[Prediction]> | |
| } | 
  
    
      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
    
  
  
    
  | struct Prediction { | |
| let predictedText: String | |
| let matchingRange: Range<String.Index> | |
| } | 
  
    
      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
    
  
  
    
  | import RxSwift | |
| private let countries = ["Afghanistan", "Albania", /* all the countries */ "Zambia", "Zimbabwe"] | |
| final class CountryAutocompleteProvider: AutocompleteProvider { | |
| func autocomplete(text: String) -> Observable<[Prediction]> { | |
| func predictionsFor(prefix: String) -> [Prediction] { | |
| return countries | |
| .flatMap { country in | 
  
    
      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
    
  
  
    
  | final class Autocomplete { | |
| // MARK: - Properties | |
| private let provider: AutocompleteProvider | |
| // MARK: - Initializers | |
| init(provider: AutocompleteProvider) { | |
| self.provider = provider | 
OlderNewer