mirror of
https://github.com/tappollo/WWDC.git
synced 2026-01-12 22:45:32 +08:00
29 lines
579 B
Swift
29 lines
579 B
Swift
//
|
|
// FocusesJSONAdapter.swift
|
|
// WWDC
|
|
//
|
|
// Created by Guilherme Rambo on 08/02/17.
|
|
// Copyright © 2017 Guilherme Rambo. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftyJSON
|
|
|
|
final class FocusesJSONAdapter: Adapter {
|
|
|
|
typealias InputType = JSON
|
|
typealias OutputType = Focus
|
|
|
|
func adapt(_ input: JSON) -> Result<Focus, AdapterError> {
|
|
guard let name = input.string else {
|
|
return .error(.invalidData)
|
|
}
|
|
|
|
let focus = Focus()
|
|
focus.name = name
|
|
|
|
return .success(focus)
|
|
}
|
|
|
|
}
|