Articles tagged "Swift"
-
In this article, I look at constructing Cocoa views in code using a unique syntax that offers dynamic and constant options with no syntactic overhead, support for parameters inherited through the class hierarchy, support for large numbers of optional parameters without needing to push unused parameters onto the stack, avoidance of parentheses, and avoiding the need to specify types – all while remaining completely typesafe.
-
A discussion about reference counted lifetimes in Swift; how the lifetime of scope variables differs from C++ and Objective-C, how releases are reordered by the Swift compiler and the conventional use of
withExtendedLifetime
versus my unconventional usage. -
I present an implementation of a a double-ended queue type (deque) in Swift and look at what is required to implement copy-on-write in an optimized way so that this double-ended queue is faster than Array when used as a first-in-first-out (FIFO) queue.
-
This is a quick look at the changes I needed to make to bring Cocoa with Love up to date for Swift 3 and the latest iOS 10 and macOS Sierra.
-
A concrete look at the languages studied by the Swift developers when designing Swift's approach to error handling. By comparing these to Swift, I'll try to better understand what balance the Swift developers sought on the topics of feature complexity, syntactic efficiency, abstraction, information signalling and safety.
-
In this article, I'll discuss the Result type in Swift as well as common variations in implementation and approach used for this data type. I'll also look at *why* the type was rejected for inclusion in the standard library and what effect that rejection is likely to have.
-
One of the most annoying problems in Swift is when the compiler gives an 'Expression was too complex to be solved in a reasonable time' error. I look at why this error occurs, how to avoid it and talk about how this should be solved in a future compiler update.
-
Fun with a pushdown automaton (implemented as a single mighty switch statement) for parsing whitespace in Swift source files. The result is an Xcode 8 Source Editor Command extension for detecting and correcting whitespace issues in Swift files.
-
I'm going to talk about the absence of any threading or thread synchronization language features in Swift and the concurrency proposal for Swift's future. I'll also try to get a wrapper around different mutex machinery to perform optimally.
-
I present a few random number generators in Swift and investigate their quality versus performance. I also look at performance implementations and see if I can make a C algorithm run as fast as Swift.
-
I present an implementation of Swift's Demangle.cpp, rewritten in Swift and use the two versions (the original C++ and my Swift version) to compare the C++ and Swift for writing parsers.
-
Struct types are not usually heap allocated, reference counted or able to perform work on deallocation. You can coerce them into having these properties but careful if you do: it can be a source of memory leaks, errant behavior and compiler crashes.
-
Another debug analysis post, this time looking at gathering basic system information for attaching to diagnostic reports and other forms of reporting.
-
In this tongue-twister titled article, I discuss capturing control flow information with stack traces during ongoing tasks to aid debugging. Also included: a reimplementation of NSThread.callStackReturnAddresses in Swift for faster and more flexible stack traces.
-
Swift and C have different memory layouts. This means that using Swift to call C functions in a manner that would be valid in C can cause memory safety problems. I'll show how this can occur with a subtle Release build bug inspired by issues that occurred while writing the previous article.