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
| find . -type f -name "*.swift" -exec grep -H -c '[^[:space:]]' {} \; | \sort -nr -t":" -k2 | awk -F: '{printf("Your largest file %s contains: %s lines \n", $1, $2); exit;}' |
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
| // | |
| // MobletError.swift | |
| // Moblet | |
| // | |
| // Created by Sameh Mabrouk on 20/10/2017. | |
| // Copyright © 2017 Mobiquity Inc. All rights reserved. | |
| // | |
| import Foundation |
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 EnumCollection: Hashable { | |
| static func cases() -> AnySequence<Self> | |
| static var allValues: [Self] { get } | |
| } | |
| extension EnumCollection { | |
| static func cases() -> AnySequence<Self> { | |
| return AnySequence { () -> AnyIterator<Self> in | |
| var raw = 0 | |
| return AnyIterator() { |
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
| import Foundation | |
| public protocol AlmostEquatable { | |
| @warn_unused_result | |
| func ==~(lhs: Self, rhs: Self) -> Bool | |
| } | |
| public protocol EquatableWithinEpsilon: Strideable { | |
| static var Epsilon: Self.Stride { get } | |
| } |
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
| // | |
| // ListAccountsInteractorTests.swift | |
| // INGBankieren | |
| // | |
| // Created by Sameh Mabrouk on 30/05/2017. | |
| // Copyright © 2017 Sameh Mabrouk. All rights reserved. | |
| // | |
| import XCTest | |
| @testable import INGBankierenDataKit |
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 isValidNumber(string: String) -> Bool { | |
| for char in string.characters { | |
| let scalarValues = String(char).unicodeScalars | |
| let charAscii = scalarValues[scalarValues.startIndex].value | |
| //ASCII value of 0 = 48, 9 = 57. So if value is outside of numeric range then fail | |
| //Checking for negative sign "-" could be added: ASCII value 45. | |
| if charAscii < 48 || charAscii > 57 { | |
| return false | |
| } | |
| } |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 DictionaryConvertable { | |
| static func fromDictionary(dictionary: [String: AnyObject]) throws -> Self | |
| func toDictionary() -> [String: AnyObject] | |
| } | |
| protocol DictionaryValueType { | |
| func dictionaryValue() -> AnyObject? | |
| } | |
| extension Optional: DictionaryValueType { | |
| func dictionaryValue() -> AnyObject? { |