Basem Emara

Mobile Architect / iOS Jedi

  • About
  • Portfolio
  • Contact

Connect

  • GitHub
  • LinkedIn
  • Twitter

Swifty Locations with Observables

March 3, 2017 By Basem Emara 3 Comments

This entry is part 2 of 2 in the series Swifty Delegates

Let’s use the closure-based pattern to wrap CLLocationManager for allowing callers to subscribe to observables instead of using shared delegate functions.

Filed Under: Swift Tagged With: corelocation, ios, swift, watchkit

Delegates to Swift Closure Pattern

March 3, 2017 By Basem Emara 6 Comments

This entry is part 1 of 2 in the series Swifty Delegates

Delegation is a simple and powerful pattern. However, closures are more Swifty and scales better. Let’s convert delegates to closures!

Filed Under: Swift Tagged With: delegates, swift, threads

Creating Thread-Safe Arrays in Swift

March 1, 2017 By Basem Emara 28 Comments

This entry is part 5 of 6 in the series Swift Utility Belt Series

Thread-safe resources in Swift can be achieved with Grand Central Dispatch. Using a concurrent queue and the barrier flag, reads can occur in parallel while writes are given mutual exclusivity for safety and optimization.

Filed Under: Swift Tagged With: gcd, swift, threads

Multi-Threading with Unsafe Resources in Swift

February 13, 2017 By Basem Emara 4 Comments

This entry is part 4 of 6 in the series Swift Utility Belt Series

GCD is not for thread-unsafe shared resources since it does not guarantee the same thread will be used for the queue. We can use the threads API with a bit of sugar syntax.

Filed Under: Swift Tagged With: ios, swift, threads

Full Stack iOS and WordPress in Swift

January 25, 2017 By Basem Emara 13 Comments

WordPress has been around for almost a decade and a half. It survived the CMS wars and remained relevant during the mobile shift. It’s been battle-tested under various scenarios and load. It showed us what a thriving 3rd party marketplace looks like. Now, WordPress is realizing a grander vision! In the release of WordPress 4.7, the REST API plugin was merged […]

Filed Under: Swift Tagged With: ios, swift, wordpress

Enum-based Queue Factory for GCD

August 14, 2016 By Basem Emara 4 Comments

This entry is part 3 of 6 in the series Swift Utility Belt Series

Grand Central Dispatch (GCD) is a great technology provided by Apple. It provides an elegant level of abstraction to work with threads, queues, and locks. And it went through a much needed make-over in Swift 3. In this post, I would like to take this one step further using enums as a queue factory.

Filed Under: Swift Tagged With: gcd, swift

Percentage-based Spacing Using Autolayout and Storyboard

June 28, 2016 By Basem Emara 3 Comments

This entry is part 2 of 6 in the series Swift Utility Belt Series

Due to the many screen sizes in the mobile world, staying relative to screen size is crucial. Hard-coding margins and sizes based on points can be short-sighted. In this post, we will subclass NSLayoutConstraint to achieve percentage-based margins.

Filed Under: Mobile Tagged With: auto-layout, ios, responsive-design, xcode

What’s New in iOS 10 and Beyond

June 27, 2016 By Basem Emara Leave a Comment

It is clear from this year’s WWDC that Apple envisions a new era beyond the traditional apps-in-a-grid-on-your-home-screen model. iOS 10 is more of a revolutionary iteration to the Apple ecosystem and vision. There were many initiatives uncovered that gives us clues to the future of Apple.

Filed Under: Mobile Tagged With: ai, ios, iot

Common Initializer Patterns in Swift

May 28, 2016 By Basem Emara 11 Comments

Swift initialization rules are there for very good reasons, but sometimes it can make things tedious. In this post, I will show how to avoid duplicating code across initializers while still obey Swift initialization rules. This pattern uses static functions, tuples, and typealiasing.

Filed Under: Swift Tagged With: swift

Memory Leaks and Resource Management in Swift and iOS

May 24, 2016 By Basem Emara 5 Comments

This entry is part 5 of 10 in the series Building a Scalable App

Less code and less memory while performing the same task at hand is truly where the art comes in. In this post, I’d like to highlight some of the various pitfalls that lead to memory leaks, which inevitably result in crashes. I will also cover some tools and remedies to resolve these issues.

Filed Under: Swift Tagged With: ios, memory, swift, xcode

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • …
  • 9
  • Next Page »

My Life Philosophy

Simplicity is the key to elegance.

Post Series

  • Building a Scalable iOS App
  • Swift Utility Belt

Popular Posts

  • Creating Thread-Safe Arrays in Swift
  • Creating Cross-Platform Swift Frameworks for iOS, watchOS, and tvOS via Carthage and CocoaPods
  • Memory Leaks and Resource Management in Swift and iOS
  • So Swift, So Clean Architecture for iOS
  • Reading values from any plist file or bundle in Swift

Mobile App

Download the Basem Emara Blog app

Find It