User Entity Model-
class UserEntity: NSObject {
var isAlreadyUser:Bool
init(isAlerdy:Bool){
isAlreadyUser = isAlerdy
}
}
App Delegate / Global Array
let new = ["F","E","D","C","B","A"]
for obj in new{
arrUser.append(UserEntity(isAlerdy: false))
}
VIEW CONTROLLER
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
let home = Array(appDelegate.arrUser)
home[0].isAlreadyUser = true
print(appDelegate.arrUser[0].isAlreadyUser)
After I edit the local home array and update isAlreadyUser to true from false. This also changes in global array. Even I am mutating any making a copy of global array it still changes it i both the array.
I think some thing is wrong with entity. It is strong and not changing according to local scope of array.
Help me out.
EDIT:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
var areAlreadyUsers:[UserEntity] = []
areAlreadyUsers = Array(appDelegate.arrUser)
areAlreadyUsers[0].isAlreadyUser = true
print(appDelegate.arrUser[0].isAlreadyUser)
Still no help. My global array is still changing.