What I worked on last week
As is well known, RAD Studio and Delphi allow to develop for iOS - among other things - with the benefit of using practically identical code for various platforms and operating systems. Today, let's take a look at different way how to create iOS apps - from junior programmer's angle of view and using alternative developer's IDE.
For the past week, I was working on an app called Pass Keeper. Pass Keeper a 1Password clone, that is, this app is for secure password storing. To make the passwords are really safe and almost impossible to steal, I used Apple's Keychain which Apple itself recommends to use when dealing with sensitive data instead of using, say, Core Data.
Quick Look at the App
The app always starts on LockViewController. Even if you left the app while on a different screen, thanks to willResignActive and didBecomeActive, you will be taken back to the LockViewController and will have to type in your password again. Or, use either TouchID or FaceID, depending what your iPhone has.
Upon getting in, you will find yourself on TableViewController. This screen contains?-?you guessed that?-?Table View with cells representing every saved account. Cells are 'clickable' and if you press one of them, a new screen will show with all the information (service name, username and password) along with the option to delete this record.
In the top right corner of TableViewController, you can see '+' button. Click on it and a new screen will show up, allowing you to save login information.
Finally, there are Settings, although not with many options. You can activate Dark Mode here which will (de)activate Dark Mode on every screen. At the bottom, there's a button for deleting all the records. Be careful, once it's pressed, everything is gone!
The biggest problem I ran into was a 'problem' with TouchID/FaceID. When you are on the lock screen, you can always get into by inserting your master password. However, if your iPhone has either TouchID or FaceID, you can use that to log in as well. One common functionality for all apps dealing with sensitive data is that, if you log in and then leave the app, when you come back, you are put back to the login screen and without inserting the correct login information, you will not get to the sensitive data. 1Password has this functionality and so I decided to adopt this functionality as well.
For that, I created my own 2 methods which are triggered whenever methods willResignActive and didBecomeActivate are called?-?that is, when the app will stop being active and after the app became active?-?and they worked perfectly if I used master password to get in. However, when I used TouchID to login, I got into a never-ending loop where I will call TouchID, I will login using TouchID and right after that, I was put back to the lock screen.
How come? After some time, I found out that when TouchID is called, the method willResignActive was called as well. And this method, alongside didBecomeActive, is the one which always puts you on the lock screen. How to deal with this?
Unwind Segue. In the method sending me on the login screen?-?goToLogin()?-?I perform the segue only if a variable isAuth is equal to false. isAuth is, on default, set to false and is set on false whenever you leave the app. Now I just had to set it to true somewhere so I wouldn't into a never-ending loop. That's when I used unwind segue. Whenever I would go back from the lock screen, the unwind segue would get triggered and set isAuth to true. Pretty simple, isn't?
What I learnt and what I practised
- I learnt how to work with Keychain. I can now save a password, as well as load it
- I learnt how to use unwind segue
- I worked with CoreData. I have already learnt about them but until now, I haven't used them in my own project.
- I finally learnt how to use guard keyword. And I found out it's not as scary as it looks like
- I learnt about Image Literals and Colour Literals. Choosing images and colours is much easier now!
- To add a button on Navigation Bar, I actually have to add UIBarButtonItem to UINavigationItem which I will then add to UINavigationBar
- I learnt how to use simple animations to make my app looks more appealing
If you are interested, you can take a look on GitHub.
About the AuthorJiri Janecek
More interesting links and pages
Discover UK licensed casino sites at Casinopilot
Check the best online casinos in UK
What is control panel?
Try out new casino sites at SmartphoneCasinos.co.uk