Coding Explorer Blog

Exploring how to code for iOS in Swift and Objective-C

  • Home
  • Apps
  • About
  • Contact

Getting Started With UITableView in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

One of the most common Views used in iOS apps is the UITableView.  In the default iPhone apps alone, the only ones that I didn’t easily find what is PROBABLY a UITableView was in Newsstand, Videos, Camera, and the Calculator.  Even then, the first two of those appear to use UITableView’s close cousin UICollectionView.  With the exception of the Settings app itself, I wasn’t even counting their settings pages (which probably all of them have, and show up as a UITableView either in their own app or via the Settings app).

You probably want to know how to use such an important view?  There is too much to go into all of it today, but let’s start out with how to get one working and fill it with data.
[Read more…]

Filed Under: Tutorial Tagged With: optionals, Swift

How to Create a UIColor in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

There comes a time in many iOS developers’s careers that they will need to save a reference to a color itself.  Maybe it is just to change the background color of a view, maybe it is for custom drawing, or any number of other reasons.

This is where UIColor comes in.  UIColor is particularly optimized to work on iOS devices, so while there are older similar classes like CGColor or CIColor, you should probably use UIColor, unless you are working on some app that needs to translate between different colorspaces.
[Read more…]

Filed Under: Class Reference Tagged With: Swift

Segue between Swift View Controllers

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

So, last time we learned how to make a simple Hello World app on a single view controller.  As fancy as it was, you probably want more than one screen in your app, right?

Perhaps you want a way to segue into the next screen?

That’s what we’re going to go over today, as well as one of the simple ways to share data between view controllers.
[Read more…]

Filed Under: Tutorial Tagged With: Access Controls, optionals, properties, Swift

Hello World! Your first iOS App in Swift

Xcode 11.6 Swift 5.2.4

Last updated on August 12, 2020

So far we’ve covered a lot of how Swift the language works, some WatchKit tutorials, and how to get started with some Cocoa classes.  However, we have not really done much in the way of actually writing sample apps on the Coding Explorer Blog.  It was covered a little bit in the WatchKit tutorials, but there is a lot done there specific to getting WatchKit working.  Let’s go all the way back to the basics, let’s write a Hello World app.

For those that don’t know, it is very common to have the first program written by somebody learning a new language be one that somehow displays “Hello World!”  At least according to Wikipedia, this goes back to an example from “The C Programming Language” book by Brian Kernighan and Dennis Ritchie.  Now, of course the simplest form of this in Swift is just:

print("Hello, World!")

But we’ll do something a bit more advanced than that.  You don’t often (or ever) see a console on your iOS device, so that doesn’t help us make an app directly.

This is a pretty basic tutorial, but I want to make it pretty comprehensive for how to start an iOS app.  This will even include going over some of the features of the IDE (integrated Development Environment), like the different editors, the utility pane, and the various inspectors therein.  This may be a bit too basic for some, but I want this site to be a place for all kinds of iOS developers, especially the beginners.  We all had to start sometime, and those are the people I want to help in particular today.

Also, I figured that it’s a new year, let’s start it with how to start a new app.
[Read more…]

Filed Under: Tutorial Tagged With: Swift

Swiftly getting a human-readable date with NSDateFormatter

Xcode 11.6 Swift 5.2.4

Last updated on May 23, 2023

Now that we know a bit about Date and DateComponents, let’s actually get a readable date in our Swift app, shall we?  This is the job of DateFormatter.  DateFormatter is a class that can take a Date, and output a String describing that time/date as its format instructions dictate.  In other words, you tell it what you want to know, and it will give you a String that says that.  It has a few pretty useful built-in formats, and the capability to accept a custom date format string.

There’s not too much to the actual creation of an DateFormatter object.  It pretty much just has an empty initializer (and an NSCoding one, but we aren’t covering NSCoding today).  After initializing your DateFormatter, you set the appropriate style for the date and time, and that’s all you need.
[Read more…]

Filed Under: Class Reference Tagged With: Swift

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • …
  • 16
  • Next Page »

Subscribe to the Coding Explorer Newsletter

* indicates required

Follow Us

Facebooktwitterrss

Recent Posts

  • Error Handling in Swift
  • Creating and Modifying a URL in your Swift App
  • Watch Connectivity in Swift — Application Context
  • watchOS Hello World App in Swift
  • API Availability Checking in Swift

Categories

  • Class Reference
  • General
  • Interface Builder
  • My Apps
  • Objective-C
  • Swift
  • Syntax
  • Tutorial
  • Uncategorized

Archives

  • May 2016
  • March 2016
  • February 2016
  • December 2015
  • July 2015
  • June 2015
  • April 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • January 2014
  • November 2013
  • September 2013
  • August 2013
  • July 2013
  • Terms Of Use
  • Privacy Policy
  • Affiliate Disclaimer

Subscribe to the Coding Explorer Newsletter

* indicates required

Copyright © 2025 Wayne Media LLC · Powered by Genesis Framework · WordPress