I need to duplicate a custom object. Is is possible without copying each and every field manually?
var test1 = CustomerInfo()
var test2 = CustomerInfo()
test1 = test2
test1.customername = "First"
test2.customername = "Second"
print(test1.customername) /* Getting "Second" , actually i want to get "First" */
You can use NSCopying class for copying objects.
Refer to this article with example, https://www.hackingwithswift.com/example-code/system/how-to-copy-objects-in-swift-using-copy