Swift Struct vs. Class

I've been having a tough time in Swift with the Struct vs. Class issue. Unlike Java and Objective-C, Swift allows value type "classes" known as Struct types. These behave very similar to C++ objects that are created without dynamic memory allocation - in other words they're created on the stack instead of the heap. This … Continue reading Swift Struct vs. Class

What in the Hell is a Grapheme Cluster?

In my previous post I talked about Swift's handling of strings and the problems making the characters of a string randomly accessible because of Swift Strings being Unicode compliant. Another part of the issue, and the reason that we can think of Characters in Swift as just Strings in and of themselves, is the concept … Continue reading What in the Hell is a Grapheme Cluster?

Working with Dynamic Libraries in Xcode

Here's just a little tidbit that I ran across recently where Xcode, which normally does a good job covering all the bases, fell short just a bit. When you're working with dynamic libraries in just about any environment, especially Linux and MacOS, there is a two-way street when it comes to a program or another … Continue reading Working with Dynamic Libraries in Xcode

Always an Easier Way

Previously in¬†Avoiding an Objective-C Pitfall¬†#1¬†I discussed a more stable way of creating singletons in Objective-C. ¬†As with all things in the world of Apple there's always an easier way and that way comes to us via two very powerful yet unnoticed (in the Windows and Linux communities at least) APIs that Apple has contributed to … Continue reading Always an Easier Way

Avoiding an Objective-C Pitfall #1

Below is a very commonly used design pattern in Objective-C. It's the typical¬†Objective-C "Singleton Pattern" because it does just that. ¬†Returns a singleton of the class it belongs to. ¬†If we take a look at an example that uses it we can see it in action. The¬†"@synchronized(self)" statement ensures that only one thread at a … Continue reading Avoiding an Objective-C Pitfall #1