SwiftBites

This section contains some short posts or annotated code snippets that albeit interesting or likely useful didn't warrant a complete blog article.

All these examples and posts are compatible with Swift 3.

#17: Generate Random Numbers with Swift
Random numbers with arc4random

#16: Singletons in Swift 3
How to write a singleton in Swift

#15: Rounding Floating Point Numbers to Specific Decimal Places
Rounding numbers to get the desired format.

#14: NSTimer with Swift 3
Using the Timer class with Swift 3

#13: KVO and KVC in Swift 3
Key-Value Observing/Coding from Obj-C to Swift.

#12: Rounding Floating Point Numbers in Swift 3
Rounding float and doubles the right way.

#11: Print object's content with dump
Debug using the dump method to see your object's content.

#10: Executing closures with a delay in Swift 3
Delayed execution with libDispatch.

#09: Creating DispatchQueues in Swift 3
GCD's Queues after the great rename.

#08: Merging Dictionaries in Swift
Extending dictionaries with merge methods.

#07: Labeled statements in Swift
Labeled statements in Swift, to jump to a specific outer loop.

#06: URL/URI Escaping in Swift 3: Encoding and Decoding
Escaping/encoding url or uri strings.

#05: Sorting Array and Dictionaries in Swift
A few examples on how to sort collections in Swift 3 with sorted(by:).

#04: Splitting Strings in Swift
Splitting strings in Swift with or without Foundation.

#03: String trimming in Swift 3
Trimming a string removing unwanted surrounding characters.

#02: CustomStringConvertible and Description in Swift
The NSObject description is now implemented with this protocol.

#01: Swapping variables in Swift
Swapping variables in Swift leveraging tuples.

I'm also on Twitter and GitHub.

Subscribe via RSS or email.