Skip to content
Snippets Groups Projects
Commit 1c5f710c authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Confirm FactType to RawRepresentable

parent 593d5f10
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!71Fact improvements & helpers
This commit is part of merge request !71. Comments created here will be created in the context of that merge request.
import Foundation import Foundation
public enum FactType: Equatable { public enum FactType: Equatable {
public static let knownTypes: [FactType] = [.username, .email, .phone]
case username case username
case email case email
case phone case phone
case other(Int) case other(Int)
}
public static let knownTypes: [FactType] = [.username, .email, .phone] extension FactType: RawRepresentable {
public init(rawValue: Int) { public init(rawValue: Int) {
if let known = FactType.knownTypes.first(where: { $0.rawValue == rawValue }) { if let known = FactType.knownTypes.first(where: { $0.rawValue == rawValue }) {
self = known self = known
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment