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 | |
struct AlertActionComponent { | |
var title: String | |
var style: UIAlertAction.Style | |
var handler: ((UIAlertAction) -> Void)? | |
init(title: String, style: UIAlertAction.Style = .default, handler: ((UIAlertAction) -> Void)?) { | |
self.title = title | |
self.style = style |
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 String { | |
func toDate(withFormat format: String = "yyyy-MM-dd") -> Date { | |
let dateFormatter = DateFormatter() | |
dateFormatter.dateFormat = format | |
guard let date = dateFormatter.date(from: self) else { | |
preconditionFailure("Take a look to your format") | |
} | |
return date | |
} | |
} |
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
struct State { | |
let name: String | |
init(name: String) { | |
self.name = name | |
} | |
} | |
extension State: ExpressibleByStringLiteral { |
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 | |
let start = "2017-05-25" | |
let end = "2017-11-12" | |
let dateFormat = "yyyy-MM-dd" | |
let dateFormatter = DateFormatter() | |
dateFormatter.dateFormat = dateFormat | |
let startDate = dateFormatter.date(from: start) |
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 | |
let feedCellId = "feedCellId" | |
class FeedViewController: UICollectionViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.collectionView!.backgroundColor = UIColor.whiteColor() |
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
/build |