Filters

Hide filters
Platform
Content Type
Difficulty

All Tutorials · 23 Results

Contained in: UIKit Apprentice objective c
iOS & Swift

Chapter in UIKit Apprentice

Introduction

…similar to other popular languages such as PHP, C#, or JavaScript. If you’ve tried iOS development before with the old language, Objective-C, then its low-level nature and strange syntax may have put you off. Well, there’s good news: Now that we have a modern language…
iOS & Swift

Chapter in UIKit Apprentice

Swift Review

…always be the name of a type inside the [ ] brackets or following the word Array in < > brackets. If you’re coming from Objective-C, be aware that the < > mean something completely different there. For Dictionary, you need to supply two type names: one for the type…
iOS & Swift

Chapter in UIKit Apprentice

Saving Locations

Learn all about how to save your locations on the device using Core Data, the object persistence framework for iOS.
iOS & Swift

Chapter in UIKit Apprentice

Add Item Screen

…lower bound and an upper bound. So, why did we convert the original NSRange value to a Range value, you ask? NSRange is an Objective-C structure whereas Range is its Swift equivalent — they are similar, but not exactly the same. So, while an NSRange parameter is used…
iOS & Swift

Chapter in UIKit Apprentice

Use Location Data

…operation. Instead, it uses a closure. Closures are an important Swift feature and you can expect to see them all over the place — for Objective-C programmers, a closure is similar to a “block”. Closures can have parameters too and here, the parameters for the closure are placemarks and error…
iOS & Swift

Chapter in UIKit Apprentice

The Data Model

…for.accessoryType = .checkmark. That also sounds a little odd, doesn’t it? This split between external and internal labels is unique to Swift and Objective-C and takes some getting used to if you’re familiar with other languages. This naming convention primarily exists so that Swift can talk to older…
iOS & Swift

Chapter in UIKit Apprentice

The Locations Tab

…type The type of the sender parameter is Any. You have seen this type in a few places before. What is it? Objective-C has a special type, id, that means “any object”. It’s similar to NSObject except that it doesn’t make any assumptions at all about…
iOS & Swift

Chapter in UIKit Apprentice

Image Picker

…declaring the type of photoID as NSNumber and not as Int or, more precisely, Int32. Remember that Core Data is an Objective-C framework, so you’re limited by the possibilities of that language. NSNumber is how number objects are handled in Objective-C. For various reasons…
iOS & Swift

Chapter in UIKit Apprentice

Objects vs. Classes

Time for some more theory! You'll learn all about objects, classes, inheritance, and a few other object oriented principles from Swift that you need…
iOS & Swift

Chapter in UIKit Apprentice

Table Views

…section) { . . . } In Swift we do things a little differently, mostly to be compatible with the iOS frameworks, which are all written in the Objective-C programming language. Let’s take a look again at numberOfRowsInSection: override func tableView( _ tableView: UITableView, numberOfRowsInSection section: Int ) -> Int { . . . } The method signature…
iOS & Swift

Chapter in UIKit Apprentice

The One-Button App

…since our focus is on developing using UIKit. Language: Swift. This is basically the programming language you’ll be using. The other option is Objective-C, but our focus will be on Swift. Make sure the last two options — Testing System and Storage — are set to None…
iOS & Swift

Chapter in UIKit Apprentice

Edit Items

…this, but we’ll go for the easy one. ➤ In ChecklistItem.swift, change the class line to: class ChecklistItem: NSObject { If you’ve programmed in Objective-C before, you’ll be familiar with NSObject. Almost all objects in Objective-C programs are based on NSObject. It’s the most basic building…
iOS & Swift

Chapter in UIKit Apprentice

Lists

…type casting in action. The main reason you need all these type casts is for interoperability with the iOS frameworks that are written in Objective-C. Swift is less forgiving about types than Objective-C and requires you to be much more explicit about specifying the types of the various…
iOS & Swift

Chapter in UIKit Apprentice

Local Notifications

…itemID = -1 Note that you called the last variable itemID and not simply “id”. The reason is that id is a special keyword in Objective-C, and this could cause trouble if you ever wanted to mix your Swift code with Objective-C code. In the above code, you have…
iOS & Swift

Chapter in UIKit Apprentice

Adding Polish

…table view — so, you have to implement the method and respond to that message. Also, remember that selectors have their root in Objective-C and so, any method which is called via a selector has to be accessible from Objective-C.) ➤ Add the hideKeyboard() method to LocationDetailsViewController.swift: @objc func hideKeyboard…
iOS & Swift

Chapter in UIKit Apprentice

Saving & Loading

…file in the app’s Documents folder, and you’ll leave the technical details to Codable. Incidentally, you have already used Codable‘s’ Objective-C cousin, NSCoder, behind the scenes in storyboards. When you add a view controller to a storyboard, Xcode uses the NSCoder system to write this object…
iOS & Swift

Chapter in UIKit Apprentice

Get Location Data

…percent (%) sign. Examples of common placeholders are: %d for integer values, %f for floating-point, and %@ for objects. Format strings are very common in Objective-C code, but less so in Swift because string interpolation is much simpler (but less powerful). The %.8f format specifier does the same thing…
iOS & Swift

Chapter in UIKit Apprentice

Slider & Labels

…wrong: 'I should have double quotes' ''Two single quotes do not make a double quote'' “My quotes are too fancy” @"I am an Objective-C string" Anything between the characters \( and ) inside a string is special. The print() statement used the string, "The value of the slider is now: \(slider.value…
iOS & Swift

Chapter in UIKit Apprentice

Networking

…need to say break at the end. They do not automatically “fall through” from one case to the other as they do in Objective-C. Now the item type should display not as a value from the web service, but instead, as the value you set for each item type…
iOS & Swift

Chapter in UIKit Apprentice

Custom Table Cells

…compiler will usually make sure to do the right thing. However, it’s still possible to mess up if you’re talking to Objective-C code or low-level APIs. EXC_BREAKPOINT is not an error. The app has stopped on a breakpoint, the blue arrow points at the line…