Category: Swift
-
How to Use Custom Table Cells in a UITableView
While very versatile, there’s some point where every developer finds table views lacking something: the cell format is too limited. Apps like Facebook, Twitter, and Instagram don’t use simple table views. They use custom table cell formats. In this lesson, we’ll start learning how to make and use custom table view cells. Set Up the…
-
How to Add Stack Views Programmatically and (almost) avoid AutoLayout
Some people don’t like Interface Builder and like to code instead. Sometimes your layout is so dynamic you need to lay out in code. In either case, programmatic layout of views becomes the answer instead of auto layout. In Xcode 7 Apple introduced stack views. In an earlier post, I introduced stack views in Interface…
-
Why your Web View Doesn’t Work in iOS9 — and what to do about it
While updating my tutorial for UIWebView I came across a problem I had heard about but had not experienced. I had even heard a claim that a lot of apps are broken or rejected because of this. Apple has increased security on web accesses, and it does crash a web view rather quickly. I’m going…
-
Swift WatchKit: Selecting With Multiple Rows in Apple Watch
In the last lesson we created a multi-row table. However, we can only view the table, not select from the table. Multi-row tables provide some challenges with selection. Along the way, we’ll make a new interface to display selected information, using a technique we have not yet covered in this series: A dictionary as a…
-
A Swift Tutorial for Working with Classes Part 3: Abstract classes.
In the first tutorial in this series we introduced classes. In the second we did some more advanced manipulations of classes. In both, we discussed the idea of inheritance, which has one final possibility: a class whose only purpose is to define other classes. This is known as an abstract class. Abstract classes are mere…
-
Swift Watchkit: How to Add Simple Dynamic Tables to Apple Watch
In the last post, we looked at scroll views and static tables. There are many instances where tables filled with data at runtime are necessary. If you are familiar with UITableViewController, you may be delighted to know that WKInterfaceTable is a lot simpler to put together: there are no delegate or data sources involved. It’s…
-
A Swift Guide to Working with Classes Part Two: Advanced Class Techniques
In our first part we looked at some of the basics of classes in Swift. In this part, we look at some of the more advanced features of classes which developers use every day — often without knowing it. We’ll explore first a bit more on class methods, scope, keeping others from messing with your…
-
A Swift Tutorial to Working with Classes Part 1:Basic Classes
I find a lot of confusion among beginners and a handful of intermediate developers about what is a class. Object oriented languages like Swift, Objective C or C++ use classes to organize everything in the language and the API’s. You might have heard words like callback, override, setter and getter and have no idea what…