In my case i just wanted to create an object and not persist it. so segiddins
‘s solution didn’t work for me.
Swift 3
To create a clone of user object in swift
just use
let newUser = User(value: oldUser)
;
The new user object is not persisted.
More Related Contents:
- Concatenate dictionary values in Swift
- BigInteger equivalent in Swift?
- What’s the difference between “as?”, “as!”, and “as”?
- The “++” and “–” operators have been deprecated Xcode 7.3
- How to print double quotes inside “”?
- Changing the Status Bar Color for specific ViewControllers using Swift in iOS8
- Swift extension example
- Swift function object wrapper in apple/swift
- Swift Alamofire: How to get the HTTP response status code
- UITextView with hyperlink text
- First item in a List is always selected
- How do I make my exponentiation operator work with all numeric types in Swift?
- What’s the simplest way to convert from a single character String to an ASCII value in Swift?
- How to create local scopes in Swift?
- Get terminal output after a command swift
- Swift – How to mutate a struct object when iterating over it
- Assign value of a Firestore document to a variable
- Deletable Table with TextField on SwiftUI
- How add tabs programmatically in UITabBarController with swift?
- Generating random numbers with Swift
- Can you override between extensions in Swift or not? (Compiler seems confused!)
- How String Comparison happens in Swift
- In Swift 3, how to calculate the factorial when the result becomes too high? [duplicate]
- Why convenience keyword is even needed in Swift?
- Xcode: Using custom fonts inside Dynamic framework
- Separating multiple if conditions with commas in Swift
- Swift alternative to performSelectorOnMainThread
- Equivalent of or alternative to CGPathApply in Swift?
- Using Codable on a dynamic type/object
- Class ‘ViewController’ has no initializers in swift