Matteo Gavagnin


Bézier Curves

Few weeks ago I had the pleasure to prepare and host a lesson on Bézier Curves during the Analisi matematica con elementi di algebra course, part of the bachelor degree Interfacce e Tecnologie della Comunicazione taking place in Rovereto.

I’m listing here some existing material that inspired me, and a Swift Playground I’ve prepared for the lesson.

Inspiring sources


Magic Keyboard 2

Apple all but confirmed that the next MacBook Pro models will be unveiled tomorrow and will include support for Touch ID and a custom bar is going to replace the current top row of keys in the embedded keyboard.

Pay MacBook Pro

The above image is already on your Mac if you installed the latest macOS Sierra 10.12.1 update. Check for yourself looking at


Besides the lack of a visible physical power button and of the Esc key, Steve Troughton Smith suggested that developers, in order to populate the Magic Bar with custom controls, will need to create extensions much like the ones used in watchOS 1.

Dynamic Framework with CocoaPods support

A short and compact guide to create a basic redistributable framework with CocoaPods support. This example is intended to work on iOS, but the same principles can be applied to watchOS, tvOS and macOS.

Create a new Xcode project and select Cocoa Touch Framework.


For redistributable libraries Objective-C is still the language-to-go. But you can also choose to write them in Swift if the host apps are willing to include the swift runtime.



Blurred Rounded UIView

Maps and Apple Music apps in iOS 10 include a brand new way to present modal contents: a floating semi-modal view. Widgets and notifications have been redesigned to be presented with a similar shape.

Due to beta developer agreement I cannot share screenshots of those features. However you can have a look at them visiting the dedicated iOS 10 preview page on Apple’s website.

Unfortunately the technique used in iOS 8 and 9 to round the corner won’t work anymore: you’ll end up with rounded corners and a transparent background instead.

There’s an entire thread on Apple’s Developer Forums with motivations behind this change (you need to register as developer to read it).

However the trick is to avoid using layer.mask on the view that contains the UIVisualEffectView as subview or on the UIVisualEffectView itself as we used to do. Instead you are supposed to use layer.maskView or, if you just need rounded corners, the layer.cornerRadius property associated with layer.masksToBounds = true.

I’ve also found that if you try to add an external shadow to the container view’s layer, you’ll end up without blur. The trick is to set the shadow inside func layoutSubiviews() override method.

libjpeg-turbo with bitcode

For a little side project I’m developing for iOS, I needed to build libjpeg-turbo.

Unfortunately the binary provided by the project maintainers doesn’t include bitcode and even if at the moment it’s not compulsory (unless you are targeting WatchOS), I like to be future proof, as Apple will eventually require it to be included in every app binary.

I’ve found a dedicated repository by David Hoerl with instructions to build libjpeg-turbo for iOS, but unfortunately it doesn’t include bitcode too.

In the issues on GitHub there’s a build script to build with bitcode enabled, but with the current SDK versions it fails.

twitter telegram github email
Leave this world a little better than you found it1