6 01, 2017

Strong Reference Cycles With Closures

By | 2017-01-15T11:28:45+00:00 January 6th, 2017|Swift Programming|0 Comments

Hi there, I’m Charles Nyisztor, and I welcome you to this new episode on Swift. In this video, I am going to talk about strong reference cycles that can occur in Swift when you assign a closure to a class property, and the closure captures the instance. All right, let’s switch to XCode to illustrate the problem. I am going to create a very simple Contact class. It has two properties of type String: name and phoneNumber. Note that phoneNumber is optional. Let’s implement the initializer next. When a new Contact instance is created, a dedicated console message [...]

6 01, 2017

How to Use C in Swift 3

By | 2017-01-15T11:31:57+00:00 January 6th, 2017|Swift Programming|0 Comments

Hi there, I’m Charles Nyisztor, and I welcome you to this new episode on Swift 3. Today I am going to show you how to use C in Swift. Now, let me first talk a bit about the importance of being able to consume C from Swift code. As you may know, there are plenty of useful, highly popular C libraries out there: ZLib, OpenSSL, SQLite3 just to name a few. If Swift did not maintain the compatibility with C, we’d have to re-implement the functionality that is already provided by existing C libraries. In this demo, I [...]

6 07, 2016

Blocks are NOT Synonyms for Threads

By | 2017-01-06T21:21:58+00:00 July 6th, 2016|iOS Programming|0 Comments

Unfortunately, Objective-C blocks  are often confused with threading. The root cause is probably that GCD* heavily relies on blocks. (*)Grand Central Dispatch  is a library that makes working with threads easier. However, the fact that GCD functions typically use blocks does not mean that blocks are bound to asynchronous execution. Blocks do indeed simplify the work with threads – but there is no rule saying that a block can only be invoked asynchronously. For example, you can define a block like this - no threading involved at all. NSInteger (^add)(NSInteger, NSInteger) = ^(NSInteger left, NSInteger right { return left + right; [...]

22 05, 2016

Swift 3.0 Is Going To Break Your Build

By | 2017-01-06T21:28:36+00:00 May 22nd, 2016|Swift Programming|1 Comment

Get Prepared for Swift 3.0 Changes The upcoming Swift 3.0 brings several changes, and you’ll have to adapt your code so that it builds after the update. Our video shows some of the most important changes that will be included in Swift 3.0. Since this version is still under development, further changes may also appear. We are going to publish updates as new changes are announced. Don’t forget to subscribe to our channel to be notified when a new update is available. 1. lowerCamelCase instead of UpperCamelCase for enums and properties In Swift 3.0, all properties, enums and parameters will start with [...]