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
| extension CreditCard { | |
| mutating func clear() { | |
| self.number = "" | |
| self.date = "" | |
| self.name = "" | |
| self.ccv = "" | |
| } | |
| } |
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
| extension CreditCard { | |
| func info() -> [String: String] { | |
| return ["number": number, | |
| "date": date, | |
| "name": name, | |
| "ccv": ccv] | |
| } | |
| } |
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 CreditCard { | |
| var number: String | |
| var date: String | |
| var name: String | |
| var ccv: String | |
| } | |
| extension CreditCard { | |
| init(number: String, date: String, ccv: String) { |
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
| protocol ActivityIndicatorProtocol: class { | |
| var activityIndicator: UIView? { get set } | |
| } | |
| extension ActivityIndicatorProtocol { | |
| var activityIndicator: UIView? { | |
| get { | |
| // getter code | |
| return nil |
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
| extension NewClassType: Hashable { | |
| // implementation of protocol requirements goes here | |
| } |
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
| extension UIView { | |
| // new functionality to add to SomeType goes here | |
| } |
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
| enum MachingError: Error { | |
| case NotEnoughtCharacters(count: Int) | |
| } | |
| func throwingFunction(_ source: String) throws -> Bool { | |
| let minCharacters = 5 | |
| guard source.count >= minCharacters else { | |
| throw MachingError.NotEnoughtCharacters(count: minCharacters) | |
| } | |
| return true |
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
| func throwingFunction() throws -> Bool { | |
| return true | |
| } | |
| func regularFunction() -> Bool { | |
| return true | |
| } |
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
| enum MachingError: Error { | |
| case NotEnoughtCharacters(count: Int) | |
| } | |
| enum CollectionError: Error { | |
| case Empty | |
| } | |
| throw MachingError.NotEnoughtCharacters(count: 1) |
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
| class TransportStorage { | |
| var output: NSObject! | |
| let database: Any // <----- Constant | |
| var token: String? | |
| init(database: Any) { | |
| self.database = database | |
| } |