Last updated by at .

Some Things I Learned With Swift

 

Lately I’ve been hard at work learning the in and outs of Swift 3. Now that I’ve finished 3 apps in the language I feel comfortable enough to share a few things I’ve learned in Swift.

Organization

I can’t say whether or not what I’ve been doing in terms of organization is best practice but it looks neat to me, and for the time being, that’s good enough.

Extensions are Sweet

In swift, Extensions are so easy to implement I find myself using them every where. Mostly I’ll use them inside a class to separate portions of code. In Objective-C I would have used the #pragma mark, but in Swift I tend to use the // MARK: – combined with and extension for new sections of code. I’ll typically make a section for properties, styling, and actions to name a few.
[Read more…]

Objective-C and Swift Comparison

This week I thought I would share some notes I took on the differences between Objective-C and Swift at basic level. IE chapter one of Apple’s Swift Programming Language iBook. I encourage you to go download it for free if you haven’t already.

The set of note offered here were just some notes I took while reading the first chapter, I haven’t gone back and edited so proceed with caution.

Anyway, without further ado:

Objective-C and Swift Comparison

Swift Optionals

As an Objective-C developer, the biggest point of confusion for me was with optionals. There are of course other tricky idiosyncrasies, but the hardest thing to wrap my head around was the use of optionals and what the hell “?”,”!”, and “??” means.

Why We Needed Optionals

If you are at all familiar with objective-C , then your well aware that every object had the option of returning nil. To make code safe, we had to typically check for nil all of the time. Often we would set a return nil when something went wrong as well. So we would end up with a bunch of ugly code that looked something like this:

[Read more…]

5 More Tips and Tricks

The last few posts have been pretty long and drawn out, so this time we’ll make a short and sweet post that helps save you some time. Building on the past tips’n’tricks article, here’s a few more.

Assumptions

[Read more…]

Memory Management Part II

In part one of this series we talked about the heap, the stack, object ownership, and how reference counting works. In this article we’re going to expand on this to include the role of properties and how all of this works in ARC (Automatic Reference Counting).

[Read more…]

Memory Management Part I

Not too long ago I came under the painful realization that I had been hacking my way through iOS apps without fully understanding how Memory Management works in Objective-C. Up to this point my memory management tactic was waiting for the compiler to complain and then take the suggestion the compiler provided. If that failed, Stack Overflow to the rescue! While this usually fixed the problem and works fine on small applications, it probably isn’t the best tactic when working with apps of a larger scope where performance is a big issue. So hopefully with this article I can help clarify things for you so you’re not left stuttering stupidly in an interview when they ask “What’s the difference between the stack and heap?” or “How does reference counting work?”.

[Read more…]

5 Time Saving Tips In Xcode

Working with Xcode can sometimes be a frustrating experience…

However, Xcode has a few times saving features that really make a difference in day to day development. In this post we are going to break from the traditional format in order to examine a few of these features.

1. Snippets

Xcode snippets have gotten a bad wrap since they were introduced. This is mostly because they seem to lack some obvious features and are poorly documented. However, this doesn’t stop them from being an immensely powerful addition to Xcode. So let’s dive into using existing snippets and creating new ones.

[Read more…]

Development Tools – Opacity

Assumptions:

  1. It isn’t required, but it will be helpful if you are familiar with layer based image editing or have experience with a graphics editing program such as Adobe Photo Shop

Getting Started

A important aspect of developing apps for iOS or OS X is creating a great User Interface. Even if your app has all the latest and greatest functionality, you are going to have a hard time getting anybody to use it if it is lacking in the UI department,.

Opacity to the rescue!

Opacity is a layer based vector graphics application for the Mac that makes designing graphics for your app a breeze. Opacity has built in templates for skinning buttons, creating 1x and 2x resolutions non-retina & retina devices, and many other time saving features as you will see!

Step 1: Download Opacity

Currently (as of this writing) Opacity is not available through the Mac App Store and I’m not sure if the developer has any plans to add it any time soon, however it can be downloaded at http://likethought.com/opacity/. I recommend starting with the trial version (free), but the full version will be necessary to remove a pesky watermark from your exported images (currently the full version is $89.99).

Additionally, there is a great video tutorial on the home page that I would recommend watching before moving on to Step 2.

Step 2: Creating a UIButton Image

Lets get started!

[Read more…]

Familiarizing Yourself With Xcode

This post is a quick rundown of the Key Elements of Xcode and a quick start guide to a Hello World App. I won’t get into all of the nitty gritty details of what Xcode can do, but I will provide some information on the most useful bits of Xcode.

Assumptions

  • You Have Already Installed Xcode 4.5 . If not Please do so.

Creating A Project

After opening Xcode and creating a new project you will be presented with a number of template options for the new iOS project. As a beginner, the Single View Application will be most useful to you. As a Starting point, a lot of Developers tend to use A single View Controller or a Empty Application instead of the other options.

Select Single View Application and press Next.

The next Screen will be for Project Options. The Product Name is the most important Field here as it will be the project name. Fill in the Organization and Company Identifier. These fields are arbitrary while learning but Xcode still requires them. Make sure the “Use Storyboards” and “Use Automatic Reference Counting” check boxes are checked. Since we’re doing an iPhone App choose iPhone from the devices drop down.

[Read more…]

5 Steps To Beginning App Development

Assumptions:

  1. You’re already familiar with Mac OS X and or iOS, if not I suggest following step 1 below and then familiarizing yourself with the Mac for a bit before continuing on to step 2.
  2. You are familiar with the concept of software and writing code, but haven’t necessarily written any before. If not check out Wikipedia for a quick crash course. http://en.wikipedia.org/wiki/Software & http://en.wikipedia.org/wiki/C_(programming_language) should do the trick!

Step 1: Buy a Mac & maybe an iOS device

If you want to develop apps for iOS (iPhone, iPad, etc.) or OS X (Mac) the first thing you will need is a Mac. While it is possible to develop apps for these platforms without a true Mac, I do not recommend going down this route, especially when just getting started.

I recommend getting a used MacBook Pro 2010 or newer off Craigslist or Ebay if you can’t muster up the cash for a new system! I started with a 21.5in iMac personally, but the portability of the laptop allows you to work away from the house and the coffee shop can be your best friend when writing software.

You will need to install the latest version of OS X (currently Mountain Lion) on the system, and I recommend ensuring it has a minimum of 4gb ram installed.

Step 2: Register for the Apple Developer Program

Registering for an Apple developer account is essential to beginning app development for iOS or OS X. It is very simple, just visit https://developer.apple.com and choose either iOS dev center or Mac Dev Center, then click register.

If you already have an iTunes account (Apple ID), you can link your developer account to that and avoid creating and remembering yet another password. There are a few different types of developer accounts and I won’t go into the details of each one, but you basically have two choices here:

  1. Free program – which allows you access to minimal resources and you can only run your apps on a device simulator
  2. Paid program – $100 per year which gives you access to an abundance of resources and the ability to install your apps on device

If you’re really serious about being an App Developer, I recommend biting the bullet and going for the paid program. In my opinion, not being able to see your creation running directly on your iPhone or iPad is a major disadvantage for a number of reasons. First of all, device testing is essential to developing an app that both looks great and performs well. Secondly, seeing an app that you developed running directly on your device is an awesome experience and one that can be the difference between giving up and carrying on (I would not let yourself pass on that experience if your serious about building apps). However, if you really can’t afford the $100 after throwing down some dough for that new Mac you purchased in step 1, then the free program will get you though the beginner process for awhile, but I would still recommend upgrading as soon as you can.

Another important feature of the paid program is the ability to download/view WWDC videos and sample code (World Wide Developer Conference). These are videos created by Apple engineers detailing the tools and APIs (Application Programming Interface) available from Apple. Many of these videos are of a “how to” format and are essential to developing great apps!

Once you have signed up for your developer account you can find the WWDC videos .and other resources here https://developer.apple.com/wwdc/

Step 3: Install Xcode

[Read more…]

css.php
Privacy Policy