This week I began to learn more about the swift language and the general Xcode workflow. I began by following the autoLayout lab to get a hang of the constraint features in Xcode (Figure 1).
Then I developed my own lock screen application based on phone brightness. The application uses the brightness value on the users phone to determine if the phone can be unlocked or not. If the brightness is at 100% the phone can be unlocked. If the phone is at any value lower than 100%, the app will not unlock. Figure 2 shows an example of someone successfully unlocking the app.
Figure 3 shows an example of someone failing to unlock the screen three times and on the fourth time the app tells them that they failed and they need to restart.
One feature that I struggled with was changing the button label based on the brightness. When the user changes the brightness in the control center, I wanted the button label to dynamically change. Since there is not loop function in swift, I struggled to figure out how to make this work.
Click here for links to the code.
Update: After office hours I was able to add the dynamic button feature. Figure 4 shows this adjustment.