This category is for all posts around iOS development (both Objective-C and SWIFT).
Story Problem: OK. So I made another app and now I am beside myself with joy that I can actually submit it for review. I run the application in the Xcode 8.2.1 simulator, I go to File–> Save Screen Shot and the simulator crashes!! I now get a box appearing telling me the the ‘Simulator […]read more
Ok, let’s talk academics! Here is an interview question I was recently asked – Given a list of unsorted numbers, print each number and the number of occurrences in the list. Example: 1, 1, 2, 3, 5, 5, 2, 2. Should print like following. 1 – 2 2 – 3 3 – 1 5 – […]read more
Question: When do I use NSString vs NSMutableString? Answer: It depends. Let’s talk about each first. NSString was created to set once and use. Any modification attempt to it really creates another separate string in memory. NSMutableString assumes it can be changed and therefore it’s methods will work on the current string as it is […]read more
It just so happens I am up late working to upgrade one of my apps on the Apple AppStore. I happened to need a color from a screen in another XCODE project. I proceeded to bring both projects up (so I had 2 XCODE instances running). In Interface Builder one can double click on the Background Color of […]read more
Question: When do I use NSSet and when do I use NSArray? Answer: It depends. If (you have duplicate entries, care about the order or want to access an element by an index) THEN use NSArray ELSE use NSSet Basically if the order is not important to you NSSet will be faster for you as […]read more
Question: What is Fast Enumeration in iOS programming? Answer: This is the best way to traverse a collection. (like an NSArray or NSSet) Actually, a collection can be an NSArray, NSMutableArray, NSSet, NSMutableSet, NSDictionary, NSMutableDictionary. Let’s look at a traditional way of traversing an NSArray. First I define the array and then we just look through each […]read more
Question: How do I get the accelerometer to work in an iOS app using CoreMotion (XCODE 8.2.1 / iOS 10). That is to say – I want to detect when the user shakes the device. Answer (Shown in Objective-C): First, you will need to import the CoreMotion Framework. You can do this by going to […]read more