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

Add FactHelpers

parent e72395cd
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!71Fact improvements & helpers
import XXClient
extension Array where Element == Fact {
public var username: String? {
get { first(where: { $0.type == 0 })?.fact }
set {
removeAll(where: { $0.type == 0 })
if let newValue = newValue {
append(Fact(fact: newValue, type: 0))
sort(by: { $0.type < $1.type })
}
}
}
public var email: String? {
get { first(where: { $0.type == 1 })?.fact }
set {
removeAll(where: { $0.type == 1 })
if let newValue = newValue {
append(Fact(fact: newValue, type: 1))
sort(by: { $0.type < $1.type })
}
}
}
public var phone: String? {
get { first(where: { $0.type == 2 })?.fact }
set {
removeAll(where: { $0.type == 2 })
if let newValue = newValue {
append(Fact(fact: newValue, type: 2))
sort(by: { $0.type < $1.type })
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment