Search code examples
iphonecore-dataswiftuifingerprinttouch-id

In SwiftUI, How do I use core data to store touch ID as an attribute of a person/class and record them?


I have looked at many tutorials on touchID and swiftUI but have all of them only use touchID as a boolean component to authenticate the user (The person is/is not authenticated). However, I am looking for a way to use touchID to identify the person with the ID, which is stored in the database. Thus, the process would be like so:

touchID -> program searches for touchID associated with a certain person -> record that the certain person has, for example, logged in by recording the person's other attribute, such as name.

For example, when the program prompts the user for his touch, if Jack touches the ID, the program can print("Jack has logged in"), while if Tom touches the ID, the program will print("Tom has logged in") by the idea of print("(name) has logged in") given that name is a state associated with the attribute stored in core data.

To sum up:

  1. how to use touchID as an attribute in core data?

  2. how to use touchID as an indicator of the object (or person in this case) stored in core data?

If touchID has no such feature, would it be possible to instead do the same with an external fingerprint scanning hardware? How would this work?

As I am a beginner in swiftUI and core data, I am sorry if the question seems to be common sense for more advanced coders. If there are any articles or links related, please provide them for me to see as well. Thank you very much


Solution

  • This is not possible with TouchID. As you have already pointed out correctly you can only get a boolean feedback. Everything else would clearly be a security breach if every App could receive and store TouchID-data from iOS and do with it whatever it wants.

    Genereally speaking, to receive data from an external device and store it inside the App / upload it somewhere would be possible. But your question is so abstract that a more detailed answer is not possible.