Learning Native IOS Week 1

New Year New Blog Post

It's the first week of January of the new year and my classes have already begun for the second to last quarter of my master's program and I could not be any more anxious to be done. This quarter I've decided to take the capstone class which I have a good idea of what I want to do, but will wait for the first session before pitching that idea. In addition to that I decided to pair an easier, albeit beneficial, class which involves something that I am quite experienced in and also have no experience at all... building IOS (iOS? ios? iOs???) apps. I've released several apps on the app store but they've all been developed using Unity which didn't make it any easier than I wished it would have been. I can immediately recall the dread of those long nights staying up until 4am trying to figure out how to get Bluetooth headphones to work with our app and deal with all the different states or when I first started and I was told to figure out Apple Music. Luckily my job is awesome and didn't reprimand me for not having 99% of the experience I do now and agreed we should outsource the task which they did let me drum up the requirements and thank the software gods that I actually managed to do that right. We also cannot forget having to integrate a sticker app component after it was just announced at the WWDC that year. How I managed to figure that one I'll never know, but the challenge was to limit the number of stickers available based on the user's progress in the main app. Also, the stickers that were available was a dynamic list and had to download them from a remote server, but my research led me to solving it (well figuring out the solution was one thing. I did need help from our lead engineer at that time to do the swift that was necessary). I've even had to go in and write custom extern c functions for plugins as well as countless other THINGS, but I digress... The experience I don't have is building an IOS app from the ground up in XCode with the native code.

Swift and Storyboards

The class is on Mondays and today is Tuesday. I finished the homework that is due next week which, based on the requirements, is a 5 minute assignment. I on the other hand decided to make it harder and turn it into an hour long assignment. Actually the amount of time I spent might have been a little bit longer because I was trying to get the git repo (link at the end of the post) working and making stupid icons because the online tools only gave me half the icons I needed and then I wanted the code to be clean and other blah blah blah stuff. I heard the class was going to be easy, but I think this might be a little too easy. The class is focusing on Swift and making the UI with storyboards which in IOS lingo is a WYSIWYG editor (what you see is what you get). Just to clarify, the UI stuff is WYSIWYG and the Swift is real programming. To put it into context, the second half of my intro to programming 11.5 years ago involved learning with Windows Forms in Visual studio and at that time I thought that was how every application was made and the world made sense and I could make any kind of application I wanted. That is also a WYSIWYG editor that you write code for all the different UI elements. With all the experience I have now I'm smart enough to know that's not how the majority of apps are built and everything is very dynamic. It would be very painful to manually drag and drop all the different elements you want for you window and have to write code that references each element just to turn them on/off. It's much cleaner and more manageable to create those elements on the fly when they are needed. What I'm trying to say is using storyboards feels just like it did when I was learning how to program with Windows Forms, very basic.

The professor gave me the green light to work purely in Swift which made me happy and now all is right in the world. Swift has some interesting things about it that I'm not too familiar with, namely the syntax. The assignment was to get some labels on there, change some fonts, and add some colors. The hardest part was figuring out what the classes were and how reference them syntactically correct. Google is my friend though and pointed me in the right direction.

I do need to mention though that the professor said that there's this hot button debate on which style is better/preferred (storyboards vs swift) and some googling showed it's about 50/50 in terms of preference which was really surprising to me. I'd suspect that the 50 in favor of storyboards are mostly front end developers (engineers who know how to program but they might not be comfortable living in the backend). Any application developer I've talked to looks down on Windows Forms as the black sheep of the family that was tossed into a meat grinder and put into a stuffed animal that was given back to the family that no one wants to acknowledge their presence.

Here's a screenshot of what I managed to make with way too much time than was necessary.


Here's the GitHub to follow along: https://github.com/voporak5/mobile-app-ios

I'm also going to plug in my latest YouTube video about object pooling right here: https://www.youtube.com/watch?v=7X_mWTTFwj4

I made a quick little piano player that just plays piano sounds I found online when different keys are pressed on the keyboard. The caveat is that you can press as many keys as rapidly as you want and the pooler will generate new audio sources or reuse old ones. There are ways to use a single audio source to play all of these sounds, but that wasn't the point of the video so if pooling is something you're interested in then I suggest giving it a watch. I might do a separate blog post later when I have time.

Comments

Popular posts from this blog

Learning Native IOS Week 2

Tips For Working In The Database - Tip 1. Always Write It Down

Tips For Optimizing Collision