RSSAmplifier

Blog

samhuri.net

Sami Samhuri's blog about programming, mainly about iOS and Ruby and Rails these days.

samhuri.netRSS feed ↗30 posts

Latest posts

Migrating to Swift 6 by keeping code on Swift 5 forever

22nd July, 2026 This week I’m at the inaugural Swift Rockies conference in Calgary and it’s been great so far. At Matt Massicotte’s lab yesterday there was a whole lot of discussion about Swift concurrency which was enlightening and fun (seriously). Those discussions made me realize that I should share a trick that I haven’t seen mentioned anywhere yet. Recently while migrating to Swift 6, I came…

→ Swift Concurrency Lab at Swift Rockies

22nd June, 2026 Join Matt Massicotte for an open Swift Concurrency Lab at Swift Rockies 2026. Bring your questions and code. July 21st, 2026. Can’t wait to see what I learn here next month! And I really need to prep a few questions by trying to convert some of my trickier Swift 5 code to find out what’s lurking. ∞

Type-safe notifications and async stream monitoring with Swift 6

6th June, 2025 Swift 6 concurrency checking made handling notifications without warnings kinda tedious. The old Combine approach doesn’t work with @Sendable closures and manually managing tasks gets repetitive. I made a couple of tiny Swift packages to help out with the situation: AsyncMonitor which wraps task management, and NotificationSmuggler which adds a type-safe interface on top of…

Reverse-engineering the photos-navigation URL scheme on iOS

18th April, 2024 It would be cool to open up the Photos app to a specific asset on iOS, just like the Photo Shuffle lock screen. There are some references to the photos-navigation URL scheme out on the web but they all effectively just say that they have no clue how to actually use it. And the obvious guesses haven’t worked for me. The only way forward was to roll up my sleeves and dive into some…

A nil-coalescing alternative for Swift

6th October, 2017 Swift compile times leave something to be desired and a common culprit is the affectionately-named nil-coalescing operator . A small extension to Optional can improve this without sacrificing a lot of readability. extension Optional { func or ( _ defaultValue : Wrapped ) -> Wrapped { switch self { case . none : return defaultValue case let . some ( value ): return value } } } And…

Easy Optimization Wins

10th August, 2016 It’s not hard to hide a whole lot of complexity behind a function call, so you have to be very aware of what the functions you are using actually do, and how long they take to do it. Here’s some example code illustrating a big performance problem I found in a codebase I’ve inherited. We have a dictionary keyed by a string representing a date, e.g. “2016-08-10”, and where the…

A Git Pre-commit Hook for iOS

4th August, 2016 Krzysztof Zabłocki wrote a nice article on using a git pre-commit hook to catch mistakes in iOS projects before you push those mistakes out to the whole team/world. It’s a great idea! But the shell script has some problems, so let’s fix those. If you don’t care what I did or why then you can just see the updated script . Repeated code The diff command is repeated. This is any easy…

Tales of PRK Laser Eye Surgery

12th April, 2016 Today I scheduled PRK laser eye surgery on April 19th. Exciting but also kind of terrifying because the procedure sounds a bit horrific. Most accounts from people don’t sound very bad though so the operation itself should be a breeze! I scoured the web for PRK recovery stories to get an idea of what I was in for and found some good quotes. Munchkin had the surgery in South Africa…

→ Reduce the cognitive load of your code

30th March, 2016 This is all good advice. I should use more intermediate variables for longer conditions. ∞

→ Moving Beyond the OOP Obsession

28th March, 2016 I really like this style of modularity in C and Lisp. Using delegation and other patterns you can go a really long way without inheritance too. ∞

→ Cloak's Updated Privacy Policy

27th August, 2015 This is exactly what I want to see from my VPN. Good stuff. ∞

→ Acorn 5's Live Help Search

25th August, 2015 If you make Mac software please look into this. It looks sweet. ∞

→ Swift: New stuff in Xcode 7 Beta 3

9th July, 2015 This is all good stuff. I need to spend more time reading the Swift 2 book. ∞

→ Scripts to Rule Them All

1st July, 2015 I really like this idea. I try to make bootstrap scripts for most projects but can do better. ∞

→ Debugging Layouts with Recursive View Descriptions in Xcode

2nd June, 2015 Yoink . ∞

→ The Unofficial Guide to xcconfig files

1st June, 2015 One of the least documented aspects of the configuration process are xcconfig files. As of this writing there seem to be no documents provided by Apple that explain how to use xcconfigs or why they exist. A xcconfig file is used as a supplemental file to a specific build configuration. A build configuration can have an associated xcconfig file, this allows for additional changes to…

→ GitHub Flow Like a Pro

28th May, 2015 I’m going to snag bclean and bdone and add them to my git aliases . ∞

→ Magical Wristband

27th May, 2015 When everything works, the reader flashes green and emits a pleasing tone; if something goes wrong, it glows blue—never red. Red lights are forbidden at Disney, as they imply something bad happened. Nothing bad can happen at Disney World. ∞

→ Undocumented CoreStorage Commands

24th May, 2015 You can upgrade a drive to a Fusion drive in-place with these commands. Without cloning or reinstalling. convert , addDisk , then resizeVolume . ∞

→ Lenovo ThinkPad X1 Carbon

22nd May, 2015 Being an iOS developer, it wouldn’t make sense to buy a Windows machine. But this looks like one hell of a notebook. I love that it has an LTE option. ∞

→ A bitcoin miner in every device and in every hand

19th May, 2015 A wide variety of new internet-connected devices require an associated SAAS subscription to work. Rather than paying a number of different subscription bills, by including the right-sized 21 BitShare with the device one can under many scenarios wholly or partially defray the expense of the cloud service. I’ve joked about shipping apps that mine bitcoins instead of showing ads. Now…

→ Constraints and Transforms in iOS 8

15th May, 2015 Looks like a nice improvement. ∞

→ Importing Modules in LLDB

12th May, 2015 It’s great that Apple added this but I don’t understand why Foundation and UIKit aren’t imported automatically when you’re writing an iOS app. ∞

→ Apple Watch Human Interface Guidelines

10th May, 2015 Time to read this again now that I’ve had a watch for a few days. ∞

Structure of an Ember app

3rd February, 2014 I made a diagram of an Ember app. There’s a discussion about it on the Ember Discussion Forum . Here is the source file, created with OmniGraffle: Ember structure.graffle ∞

Linky

27th September, 2013 Send links from mobile devices to your computers. The last few months I’ve been annoyed by my workflow for sending links from my touch devices to my computers. For example if I come across a cool Mac app or an open source project I want to check out, or anything along those lines. Until now I have been mailing links to my work or home addresses, or saving links in Instapaper.…

Zelda Tones for iOS

6th March, 2013 Zelda Matt Gemmell recently shared some sweet Super Nintendo wallpapers for iPhone 5 . Although I don't have an iPhone 5 I was happy to snap them up and crop them for my 4S. If you like that sort of thing then you might want these tones that I whipped up. The first pack is a few Zelda ringtones along with a few more SMS tones. Most of them are from A Link to the Past . Get the…

→ Fujitsu has lost their mind

19th January, 2012 Does this even warrant any comments on why it’s already a massive failure? The many, many drawbacks seem so apparent I cannot believe this escaped from their drawing board. ∞

→ SOPA lives - and MPAA calls protests an "abuse of power"

17th January, 2012 rather than coming to the table to find solutions to a problem that all now seem to agree is very real and damaging. No. All most certainly do not agree. It is also an abuse of power given the freedoms these companies enjoy in the marketplace today. It’s a dangerous and troubling development when the platforms that serve as gateways to information intentionally skew the facts to…

→ Recovering From a Computer Science Education

17th January, 2012 Something to keep in mind. ∞