Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is universally unique identifier (UUID)? In swift

What is UUID (universally unique identifier) in swift . I looked at apple documents but I still don’t understand what we use for how we use it and what is the use

Thanks.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

A UUID is a universally unique identifier, which means if you generate a UUID right now using UUID it’s guaranteed to be unique across all devices in the world. This means it’s a great way to generate a unique identifier for users, for files, or anything else you need to reference individually – guaranteed.

Here’s how to create a UUID as a string:

let uuid = UUID().uuidString

for uniqueness and avoid duplication for saving a person
for example Facebook have more than 1 Alex and if they want to identify a specific Alex that is register in fb app then they should must define an identifiable property for Alex like id,

struct Person:Identifiable // identifiable must have id property {
  let id = UUID() //identifier to make an object unique
  let name:String
  let address:String
  let age:Int
}

lets take an another example if your application have million users and you just give away an iPhone with to random person named xyz so there is more than 100 xyz so how you differentiate them?

Yes with universal identifier!
you just filter him by id that is unique

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading