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 Foundation | |
import ObjectMapper | |
struct Geoposition { | |
let localizedName: String | |
let englishName: String | |
let localizedRegion: String | |
let englishRegion: String | |
let country: String | |
let key: String |
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
class WeatherSpec: QuickSpec { | |
override func spec() { | |
let weatherJSON: [String: Any] = try! JSONSerialization.jsonObject(with: try! Data.init(contentsOf: Bundle.test.url(forResource: "Weather", withExtension: "json")!)) as! [String: Any] | |
describe("parsing") { | |
let weather = try? Weather(JSON: weatherJSON) | |
it("should parse weather") { | |
expect(weather).notTo(beNil()) | |
} | |
it("should parse precipitation probability") { | |
expect(weather!.day.precipitationProbability).to(equal(12)) |
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
extension Weather: ImmutableMappable { | |
init(map: Map) throws { | |
effectiveDate = try map.value("EpochDate", using: DateTransform()) | |
temperature = try map.value("Temperature") | |
realFeel = try map.value("RealFeelTemperature") | |
day = try map.value("Day") | |
night = try map.value("Night") | |
} | |
func mapping(map: Map) { | |
} |
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 Foundation | |
import Quick | |
import Nimble | |
@testable import Simple_Weather_App | |
class WeatherSpec: QuickSpec { | |
override func spec() { | |
let weatherJSON: [String: Any] = try! JSONSerialization.jsonObject(with: try! Data.init(contentsOf: Bundle.test.url(forResource: "Weather", withExtension: "json")!)) as! [String: Any] | |
describe("parsing") { | |
it("should parse weather") { |
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
{ | |
"Date": "2017-10-26T07:00:00+01:00", | |
"EpochDate": 1508997600, | |
"Sun": { | |
"Rise": "2017-10-26T08:21:00+01:00", | |
"EpochRise": 1509002460, | |
"Set": "2017-10-26T19:23:00+01:00", | |
"EpochSet": 1509042180 | |
}, | |
"Moon": { |
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 WeatherValue<Value> { | |
case single(value: Value) | |
case minmax(min: Value, max: Value) | |
} | |
struct WeatherFeature<T> { | |
let unit: String | |
let value: WeatherValue<T> | |
} |
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 SnapKit | |
class ViewController: UIViewController { | |
@IBOutlet private weak var containerView: UIView! | |
@IBOutlet private weak var segmentedControl: UISegmentedControl! | |
@IBOutlet private weak var leftBarButtonItem: UIBarButtonItem! | |
@IBOutlet private weak var rightBarButtonItem: UIBarButtonItem! | |
private lazy var currentWeatherView: WeatherView = WeatherView.fromNib() | |
override func viewDidLoad() { |
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 | |
class WeatherView: UIView { | |
private struct Const { | |
static let cellIdentifier = "WeatherFeatureCell" | |
} | |
@IBOutlet private weak var tableView: UITableView! | |
static func fromNib() -> WeatherView { | |
guard let view = Bundle.main.loadNibNamed("WeatherView", owner: nil)?.first as? WeatherView else { |
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
source 'https://github.com/CocoaPods/Specs.git' | |
use_frameworks! | |
inhibit_all_warnings! | |
def common_pods | |
pod 'Redux-ReactiveSwift', '~> 0.1.1' # Our Redux library | |
pod 'ReactiveCocoa', '~> 7.0.0-alpha1' # ReactiveCocoa has necessary UI bindings | |
pod 'ObjectMapper', '3.0.0' # ObjectMapper is for fast from/to JSON transformations | |
end |
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
public protocol A { | |
associatedtype V | |
associatedtype E | |
var a: V { get } | |
} | |
public protocol B { | |
associatedtype V | |
var b: V { get } | |
} |