VOUser
@interface VOUser : NSObject <NSCoding, NSCopying>
VOUser
model for the VouchrSDK. Users are used to identify the logged in user and typically
gifts are sent to a VOUser
(s).
-
The user id of the
VOUser
.Declaration
Objective-C
@property (readonly, nonatomic) long long userId;
Swift
var userId: Int64 { get }
-
The email address of the
VOUser
.Declaration
Objective-C
@property (readonly, strong, nonatomic) NSString *_Nonnull email;
Swift
var email: String { get }
-
The phone number of the
VOUser
.Declaration
Objective-C
@property (readonly, nonatomic) NSString *_Nonnull phoneNumber;
Swift
var phoneNumber: String { get }
-
The first name of the
VOUser
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *firstName;
Swift
var firstName: String? { get }
-
The last name of the
VOUser
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *lastName;
Swift
var lastName: String? { get }
-
The business name of the
VOUser
. If aVOUser
is a ‘brand’ they will typically have a business name.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *businessName;
Swift
var businessName: String? { get }
-
The full name of the
VOUser
. Usually`firstName` `lastName`
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *fullName;
Swift
var fullName: String? { get }
-
A short name of the
VOUser
. Usually`firstName` `L.`
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *shortName;
Swift
var shortName: String? { get }
-
The cover photo for a
VOUser
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *coverImageUrl;
Swift
var coverImageUrl: String? { get }
-
A profile picture for a
VOUser
.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) NSString *profileImageUrl;
Swift
var profileImageUrl: String? { get }
-
A list of
VOUserNetwork
s for aVOUser
. If a user authenticates with different platforms using the same id or email address, or they add a secondary email, they will show up here.Declaration
Objective-C
@property (readonly, strong, nonatomic) NSArray<VOUserNetwork *> *_Nonnull userNetworks;
Swift
var userNetworks: [VOUserNetwork] { get }
-
Default initializer for a
VOUser
.Declaration
Objective-C
+ (nonnull instancetype)userWithDictionary:(nonnull NSDictionary *)dictionary;
Swift
convenience init(dictionary: [AnyHashable : Any])
Parameters
dictionary
- A dictionary representation of a
VOUser
that will be parsed. Typically this is returned from the Vouchr Server.Return Value
an Instance of
VOUser
. -
This method creates a dictionary, which can be passed to
VOUser
s default initializer. It can be used to map custom user objects toVOUser
s.Declaration
Objective-C
+ (nonnull NSDictionary *) userDictionaryWithFirstName:(nonnull NSString *)firstName lastName:(nonnull NSString *)lastName contactInfoType:(VOUserContactInfoType)contactInfoType contactInfo:(nonnull NSString *)contactInfo;
Swift
class func userDictionary(withFirstName firstName: String, lastName: String, contactInfoType: VOUserContactInfoType, contactInfo: String) -> [AnyHashable : Any]
Parameters
firstName
- first name of user.
lastName
- last name of user.
contactInfoType
- email, phone number, or unknown.
contactInfo
- the user’s email or phone number.
Return Value
dictionary representing a potential
VOUser
. -
Converts a
VOUser
to an NSDictionary that can be used for caching or sending to the server.Declaration
Objective-C
- (nonnull NSDictionary *)dictionaryRepresentation;
Swift
func dictionaryRepresentation() -> [AnyHashable : Any]
Return Value
dictionary - Dictionary form of a
VOUser
.