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 ClangFormatAT8 < Formula | |
desc "Formatting tool for C/C++/Java/JavaScript/Objective-C/Protobuf" | |
homepage "https://releases.llvm.org/8.0.0/tools/clang/docs/ClangFormat.html" | |
version "8.0.0" | |
if MacOS.version >= :sierra | |
url "https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final/", :using => :svn | |
else | |
url "http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_800/final/", :using => :svn | |
end |
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 User: Codable { | |
typealias Id = String | |
let id: Id | |
let cellNumber: CellNumber | |
let status: Status | |
enum Status { | |
case notRegistered |
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
// MARK:- User Helper methods | |
extension User { | |
var isRegistered: Bool { | |
return status.isRegistered | |
} | |
var profile: Profile? { | |
return status.profile | |
} | |
} |
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 User { | |
typealias Id = String | |
let id: Id | |
let cellNumber: CellNumber | |
let status: Status | |
enum Status { | |
case notRegistered | |
case registered(profile: Profile) |
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 User { | |
struct Profile { | |
let name: String | |
let lastName: String | |
let email: Email? | |
let isEmailVerified: Bool | |
} | |
} | |
extension User.Profile: Codable { |
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 CellNumber: Codable { | |
let digits: String | |
init(from decoder: Decoder) throws { | |
let container = try decoder.singleValueContainer() | |
let rawDigits = try container.decode(String.self) | |
// validate rawDigits by some Regex maybe? and throw appropriate errors? | |
// or extract CountryCode and AreaCode and save them in another way? | |
digits = rawDigits | |
} |
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
// not registered user | |
"user": { | |
"id": "a_unique_id", | |
"cell_number": "+989354358291", | |
"is_registered": false | |
} | |
// registered user | |
"user": { | |
"id": "a_unique_id", | |
"cell_number": "+989354358291", |
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 User { | |
typealias Id = String | |
let id: Id | |
let cellNumber: CellNumber | |
let status: Status | |
enum Status { | |
case notRegistered |
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 User { | |
typealias Id = String | |
let id: Id | |
let cellNumber: CellNumber | |
let isRegistered: Bool | |
let profile: Profile? | |
struct Profile { |
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
typealias UserId = String | |
struct User { | |
let id: UserId | |
let cellNumber: CellNumber | |
let isRegistered: Bool | |
let profile: UserProfile? | |
} | |
struct UserProfile { |
NewerOlder