mercredi 24 juin 2015

Passing an object between controller Swift

I have a storyboard which start with a login page. And I have a User class like this

class User {
    // Properties
    var firmCode : String
    var firmId : String
    var userId : String

    // Default Initializer
    init() {
        self.firmCode = ""
        self.firmId = ""
        self.userId = ""


    // Defult Initializer with prams
    init(firmCode: String, firmId: String, userId: String) {
        self.firmCode = firmCode
        self.firmId = firmId
        self.userId = userId


I am generating some values in login page, and I can create my User object with these values.

Now I want to make this object global and use this user object in all scene.

How to pass this object to other scenes? For example I want to pass this values with my object to an embed static table view controller like this

enter image description here

Note: Does it matter, the embed controller has a tab bar controller? I guess I need to use my delegate file?

See more ..

Aucun commentaire:

Enregistrer un commentaire