Back to the front page

Queues are not bound to any specific thread

It all started with this snippet from @jspahrsummers #import <Foundation/Foundation.h> int main (int argc, const char **argv) { @autoreleasepool { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_sync(dispatch_get_main_queue(), ^{ NSLog(@"is main thread? %i", (int)[NSThread isMainThread]); }); }); dispatch_…

Status of Portable Swift code

Portable Swift source code is so damn hard to do. Main problem is that OSX and Linux Swift is using different Foundation codebase. Linux is using SwiftFoundation and OSX is using Foundation. What's the difference ? Foundation vs SwiftFoundation Foundation is written in Objective-C, it's complete and stable. SwiftFoundation on the…

CloudKit Security model

CloudKit security model is barely described in documentation, yet it's very important aspect of this cloud solution. I do care about privacy and I believe privacy aspect is important when implementing Cloud driven solutions. The subject is not widely explained in documentation, hence I'm writing this blog post as a…

Overload Swift type ambiguity

I may define default type for overloaded functions. sometimes. This is Swift return overloading that may lead to ambiguity: extension String { func encode() -> NSData? { return self.dataUsingEncoding(NSUTF8StringEncoding)?.base64EncodedDataWithOptions([]) } func encode() -> String? { return self.dataUsingEncoding(NSUTF8StringEncoding)?.base64EncodedStringWithOptions([]) } } I have two functions encode() that returns value of…

Retry! in the wild

In perfect world every action finish with the success. In real world it's not. In perfect world sending network request returns with a result. In real world it fail sometimes due to dozen of reasons, and since we're living in the real world I have to deal with it. don't…