Tags


All Swift Posts

One of the more common parts of web-based client/server app architecture is converting groups of strings into URL-encoded values that can be included in a URL or form data. It's a tedious process, and...
Here's a convenience String extension that will return a URL-encoded string based on the current string. [You can find the code for my extension on Github](https://github.com/coreyklass/common-swi...
Often times when you have some kind of a "Done" button in your view controller, you'll have logic where you want to resign the first responder. There are a few different approaches to this, such as (f...
My iOS app version numbers conform to the format "1.2.3 (1004)", where "1" is the major version, "2" is the minor version, "3" is the patch version, and "1004" is the overall build number. "1.2.3" is ...
Newer versions of Swift introduced the Selector convention ` #selector(ClassName.FunctionName()) ` to replace the old-style Objective C style Selector conventions. func makeButton() { let but...
As of this writing, NSFileManager unfortunately doesn't have a Swift-native way of determining if the object at an NSURL is a file or a directory. You can call the `NSFileManager fileExistsAtPath:isDi...
As a web developer by day, my world revolves around the 6 character hexadecimal color codes that we use on web pages. For example, **#FF0000** is the reddest of the reds. Unfortunately, UIColor doe...
Swift supports some pretty cool subscript operations, particularly in `for` loops. But what about `String` manipulation? Extensions to the rescue! Here you can find a Swift extension that lets you ...
On a `UIView`, you're able to set the `backgroundColor` property to change the background color of the view. This works, most of the time. Unfortunately, when you change the background color when t...
MAY BE OUT OF DATE
The iPhone app I'm working on in my spare time lets the user capture photos as part of its functionality. After I receive the image, I need to resize it so that it's a thumbnail size. To make this...