Array is one of the most used collection types in Swift. Although it is extremely powerful (and the language provides much faster array iterations compared to Objective-C) it lacks many of the capabilities we were used to when working with NSArray and NSMutableArray collection types.
Tag: xcode
Xcode 5: Test UITableView with XCTest framework
In WWDC 2013, Apple introduced Xcode 5 and iOS SDK 7 with a built in framework for testing: XCTest.framework. Unfortunately Apple documentation lacks details for this framework. In this post I am going to present a simple way to test a UITableView using XCTest framework.
Migrating to modern Objective-C
Last year at WWDC 2012, Apple introduced Modern Objective-C alongside iOS 6. So what's this? In a few words, it is a huge step forward to help developers write less code to achieve the same things. Worth mentioning is that modern Objective-C has nothing to do with iOS versions, it has to do with the compiler, which means that it is backward compatible. Let's dive into the basics of transitioning to modern Objective-C. Xcode offers a refactoring tool (edit>Refactor>Convert to Modern Objective-C syntax) which will convert your project to modern objective-c (it will also set the appropriate flag in build settings). If you would like to adopt modern Objective-C when writing your code, which is the best, as it is intended to help you write less lines of code, general rules for doing so are the following.
Extend UIImageView class to easily add border to images
When coding for iOS, I usually style images with shadows show the layout looks more elegant. Adding shadows is easy, but when it comes to adding borders to UIImageViews things become trickier. That's because when adding a border to a UIImageView, this border hides info from the image. To solve this issue, we have to rescale the image and then add the border to the scaled image.
Learn to use Xcode 4 snippets
One of my favorite features of the new Xcode 4 is code snippets. Code snippets let you use (and re-use) common classes and objects by simply typing a shortcut. For example if you type dealloc, Xcode 4 automatically generates the deallocation method for you: - (void)dealloc { <#deallocations#> [super dealloc]; } To add your code … Continue reading Learn to use Xcode 4 snippets
How to: Fix the “Base SDK missing” issue in Xcode
Sometimes after upgrading your Xcode and iPhone SDK installation you may see the alert "Base SDK missing" when you try to compile and build an old project (that was written with a previous version of Xcode and an older version of iPhone SDK). That issue is as easy to fix as performing some clicks. Let's … Continue reading How to: Fix the “Base SDK missing” issue in Xcode
iPhone programming: How to force your app to run in landscape mode
As you may have mentioned, lot of iPhone apps (especially games) run by default in landscape mode! You can easily force the app you develop to run in landscape mode! Let's see how: In Xcode find the file [YourAppName]-Info.plist and open it up. Right click on the table and select "Add Row". Select "Initial interface … Continue reading iPhone programming: How to force your app to run in landscape mode