Skip to content

Instantly share code, notes, and snippets.

@hachinobu
hachinobu / ProtcolType.swift
Last active December 22, 2015 05:24
Protocol Type generic
protocol MyProtocol {
var myName: String { get }
init()
}
struct MyA: MyProtocol {
var myName: String {
return "My Name is A"
struct Address : Codable {
var street: String
var zipCode: String
var city: String
var state: String
}
struct AnyCodingKey : CodingKey {
var stringValue: String
class ViewController: UIViewController {
enum ImageViewState: Int {
case open
case close
var opposite: ImageViewState {
switch self {
case .open:
return .close