User

class User : NSObject, NSCoding, NSSecureCoding

User type

Properties

  • This is name Variable

    Declaration

    Swift

    let name: String
  • This is a UIImage that is used to display profile picture

    Declaration

    Swift

    let profilePic: UIImage
  • This is a UIImagethat is used to disply background Image

    Declaration

    Swift

    let backgroundImage: UIImage
  • This is a set of Contents that is used to store user’s bookmarked Content

    Declaration

    Swift

    var bookmarkedContent: Set<Content>
  • This is a list of Content that is used to store history Content

    Declaration

    Swift

    var historyContent: [Content]
  • Initialising user

    Declaration

    Swift

    init(name: String, profilePic: UIImage, backgroundImage: UIImage)

Methods

  • This is used to generateDefaultUser for testing purpose

    Declaration

    Swift

    static func generateDefaultUser() -> User
  • Bookmark a Content

    Usage Example:

     MainController.user.bookmark(content)
    

    Declaration

    Swift

    func bookmark(content: Content)

    Parameters

    content

    self-defined type Content

  • Unbookmark a Content

    Usage Example:

     MainController.user.unbookmark(content)
    

    Declaration

    Swift

    func unbookmark(content: Content)

    Parameters

    content

    self-defined type Content

Persistant Data

  • Returns an object initialized from data in a given unarchiver.

    Declaration

    Swift

    required convenience init(coder decoder: NSCoder)
  • Encodes the receiver using a given archiver.

    Declaration

    Swift

    func encode(with coder: NSCoder)
  • Set up secure Coding

    Declaration

    Swift

    static var supportsSecureCoding: Bool { get }