Under The BridgeUnder The Bridge

Musings
MyLivePhoto

Way back in the day our first reaction to Live Photos was er, Apple reinvented the GIF, yay? But obvious though you’d think a simple conversion app would be, far as we’ve noticed no one got off their butts and actually did anything about it … until now!

Our magnificently esteemed (even if he is French) coworker JB Stevenard’s latest is called — just to make it totally clear —

MyLivePhoto – Convert Live Photo – GIF Frame Movie

and, y’know, you want those Live Photos as a movie or a GIF or a picked frame, this really does look like the easiest way there is to go about it. So we recommend you grab that while it’s free!

And just as a demonstration of how to use its power for EVIL … here’s your FULL SIZE LiveGIF of the morning rush hour traffic over in Ha Long Bay:

So yep, yep it works. Might want to apply a little more common sense than we did here to how you actually use its output, but if you want to have a 5 meg pageload … now it’s easy!

New Bestie: Microsoft?

Feels pretty strange writing this when you lived through the 80s and 90s, but Microsoft is kinda on a roll helping out Apple-based programmers recently, isn’t it?

First off, Visual Studio Code is definitely our favorite Electron app, and is rapidly taking over pretty much all our text editing needs not done in Xcode.

Then, we have Visual Studio for Mac! OK, what we really have is a rebranded Xamarin, yes. That’s still a massive leap forward in officially endorsing practical cross-platform options by anybody’s lights, and downright glorious if you’re a Mono/C# fan. Or a Unity game dude. Or a .NET Core server dude. Or someone who loves shopping at NuGet.org. Or, people who like working with Docker and/or Azure:

Visual Studio for Mac: now generally available

Since we released the first Visual Studio for Mac preview last November, we’ve been working hard on porting over the web editor tools from Visual Studio on Windows. Now with this release, you have full support to build out rich web-based applications using ASP.NET Core and front-end languages like HTML5, CSS3, and JavaScript.

And when your web app is perfectly polished and ready for release, you can directly publish to Azure using the new Publish to Azure wizard, without having to leave the IDE…

… today we also talked about some great new preview features, which we’ll make available in our alpha channel really soon. These are preview features that are not present on the stable release, but ready for you to try once released and give us feedback:

  • Docker support: supporting deploying and debugging of .NET Core and ASP.NET Core in Docker containers.
  • Azure Functions support: use this preview to develop, debug and deploy Azure Functions from your Mac.
  • Target IoT devices: target IoT devices like Android Things with your C# code and Xamarin.

That’s … quite the toolkit to have officially supported by Microsoft on macOS!

But what’s got us really paying attention now isn’t actually the tools, interesting as those are. We’ve been feeling a little bit grumbly about Google grabbing up Crashlytics et al. and the ALL YOUR DATA BELONG TO GOOGLE licensing terms coming into force, so this looks very very interesting indeed:

More Platforms, More Choices, More Power: Visual Studio Mobile Center at Build

Last fall we introduced Visual Studio Mobile Center (Preview), a cloud service designed to help developers manage the lifecycle of their mobile apps and ship higher-quality apps faster than ever. Today we announced several exciting improvements that expand the features of the service and extend Mobile Center to new audiences and platforms…

A great CI/CD pipeline is critical to delivering software quickly and with confidence. The Mobile Center Build, Test, and Distribute services are designed to make this a part of every developer’s workflow. Our Crash reporting and Analytics services ensure that you can learn about each release’s quality and usage, but a common request we’ve heard from developers is the ability to send Push messages using Mobile Center Analytics data to help ensure that the right end-user is receiving timely notifications. This tightens the loop from check-in all the way through deep engagement with end-users.

With our new Push service, Mobile Center developers can send targeted messages to specific sets of users at exactly the right time. Customers can create segments based on over a dozen different properties, including carrier, language, device model, screen size, and time zone, with many more to come…

Several Preview customers told us they loved our Test service, but they wanted to write their tests in a more familiar, platform-specific framework. We listened, and we now support XCUITest and Espresso, the native test frameworks for iOS and Android. Now developers can write their automated UI tests in their preferred languages and port existing tests to Mobile Center Test…

Mobile Center has offered a powerful beta tester distribution service since our first preview, with successful builds automatically sent to testers with ease. Developers have told us they’d love this same mechanism to let them deploy the applications to app stores and company portals.

With our new enhancements to the Distribute service, once a developer is confident about their apps quality, they can promote the latest build directly to an app store or company portal. Today you can do this with Google Play, and very soon we’ll be adding connectors for Intune, the App Store, and the Windows Store…

Mobile Center is the next generation of HockeyApp. Starting today, we’re launching the first step in our transition plan for HockeyApp users: use existing apps from HockeyApp inside Mobile Center, analyze crash reports and analytics, and connect to the Build, Test, and Push services…

New mobile platforms, testing frameworks, push services, and repo support are just the beginning—we have a lot more coming soon. Deployments to consumer app stores and secure private portals will be coming in the next few months, as will increased support for UWP, parity with our HockeyApp and Test Cloud services, and entirely new cloud development services. Sign up now to get started!

Yup … we’re thinking that looks like a really attractive alternative to Google-dependent lifecycle management for our apps. We’ve signed up, we’ll use it for our next cross-platform app, and see how that goes!

May The 4th Be Swift You

Got your Swift 3 rewrites all done? Good, good, because now it’s time for…

What’s new in Swift 4.0

Swift 4.0 is a major new release for everyone’s favorite app development language, and introduces a variety of features that let us write simpler, safer code. You’ll be pleased to know it’s nothing as dramatic as the epic changes introduced with Swift 3.0, and indeed most changes are fully backwards-compatible with your existing Swift code. So, while you might need to make a handful of changes it shouldn’t take long.

WARNING: Swift 4 is still under active development. I’ve selected some of the most interesting and useful new features for discussion below, all of which are implemented and available to try now. Please keep in mind that more features are likely ship in the months before final release.

  • Swifty encoding and decoding…
  • Multi-line string literals…
  • Improved keypaths for key-value coding…
  • Improved dictionary functionality…
  • Strings are collections again!…
  • One-sided ranges…
  • There’s more still to come…

The first release of Xcode that ships with Swift 4 is likely to arrive in June, presumably along with iOS 11, tvOS 11, watchOS 4, and macOS Somewhere Else In California. What we’ve seen so far is already promising, particularly because it’s clear the team is working hard to make Swift 4 as additive as possible. Primarily adding new features rather than breaking or modifying existing ones should make it easier to upgrade to, and hopefully signals the start of a new stability for the language…

One feature that was postponed was ABI compatibility, which would allow developers to distribute compiled libraries – one of the few key missing features that remain in Swift today. Hopefully we’ll get it before Swift 5…

So if you want to get a jump on this year’s Grand Transition, go check that out.

And if you’re really eager:

Playground: Whatʼs new in Swift 4

I made an Xcode playground that lets you try out many of the new features coming in Swift 4. You can download it on GitHub.

The cool thing is that you can run the playground right now in Xcode 8.3; you donʼt have to wait for the first official Swift 4.0 beta, which will probably come as part of Xcode 9 at WWDC. All you need to do is install the latest Swift snapshot from swift.org (donʼt worry, itʼs easy)…

Hands-on code examples to help you learn what’s new in Swift 4: new encoding and decoding, smarter keypaths, multi-line strings, and more!

Yeah, personally I think we’ll manage to contain ourselves for that 17 more days, thanks. Handy playground to have around then though!

UPDATES:

Building Swift Projects In Source Compatibility Mode

Swift Witness For Sourcery

Yep, think we’ve outdone ourselves with the obscure title references this time. If you knew it was from Malachi 3:5, our congratulations!

What we’re talking about today is what you might have noticed when it was named Insanity, but these days is called Sourcery:

What is Sourcery?

Sourcery scans your source code, applies your personal templates and generates Swift code for you, allowing you to use meta-programming techniques to save time and decrease potential mistakes.

Using it offers many benefits:

  • Write less repetitive code and make it easy to adhere to DRY principle.
  • It allows you to create better code, one that would be hard to maintain without it, e.g. performing automatic property level difference in tests
  • Limits the risk of introducing human error when refactoring.
  • Sourcery doesn’t use runtime tricks, in fact, it allows you to leverage compiler, even more, creating more safety.
  • Immediate feedback: Sourcery features built-in daemon support, enabling you to write your templates in real-time side-by-side with generated code.

Sourcery is so meta that it is used to code-generate its boilerplate code

We’re pretty leery of tools like this in general as they end up being yet another cesspool of technical debt, but that this one is based on SourceKitten is interesting enough to at least pay some attention to it. And it’s catching a bit of buzz:

How to Automate Swift Boilerplate Code with Sourcery

Switching between our Android projects written in Java (or more recently, Kotlin) and iOS projects in Swift makes me sorely miss annotation processing. Annotations in Java can be used to generate common code and things that Swift developers would have to hand write. Hand written code has to be bug free and consistently updated and maintained. Things like implementing equals and parsing JSON typically require boilerplate code, unique enough that you cannot abstract it away.

Although Swift does not have annotation processing, we can get pretty close with Sourcery. Let’s take a look at how it all works in this quick Sourcery tutorial…

AutoEquatable and AutoHashable by Sourcery

I’m really interested in Sourcery, so I installed it in my one of repositories. In my case, I generated AutoEquatable and AutoHashable at first because I felt these implementations contain really a lot of boilerplate codes…

If I add a new property or a new API, it prevents a human error! Though it looks trivial, Sourcery uses a safe Hashable as I mentioned in Safe Hashable in Swift. Isn’t it cool?

The Magic of Sourcery

Sourcery is a code generation tool for Swift. It is particularly well suited for auto-generating code that is very repetitious; code most developers refer to as “boilerplate”. Some examples that come to mind:

  • Equatable implementations
  • Hashable implementations
  • struct initializers
  • Lens implementations …

Sourcery — Meta-programing in Swift

Think of the potential : you can basically generate all the boilerplates of your architecture be it CLEAN or VIPER, you can generate all the protocol implementation or even the Realm data object, or even a view based on the variables that are being declared ( Sourcery do support inline code generate ). A declarative view ! The sky is the limit !

Meta Programming Swift with Sourcery

#292: Metaprogramming with Sourcery 🔮

#294: Annotations with Sourcery 🔮

#295: Building an API client with Sourcery Key/Value Annotations 🔮

If you’re looking for a good project to try this out with, a decent set of VIPER templates would be eagerly welcomed. Let us know if you come up with something!

SaVaGe!

You know, one thing we’ve found very strange over the last nearly 20 years: Various strategies for animations arrive, cause a flurry of activity, then slowly die out; but nobody ever seems to take the obvious to us path of working with Scalable Vector Graphics (SVG) to leverage what’s a long proven and widely supported (for flexible values of “supported”…) cross-platform vector animation format. When we did that October Challenge thing seven years ago we used LevelSVG to do it, and did the editing in Inkscape which was … well … we don’t like to be impolite (unless it’s funny, of course) so let’s just say it is clearly not a native app.

There are many other options, pretty much every vector drawing program supports SVG in some fashion, but generally they’re far better at importing than exporting, and quality of export is generally suboptimal and definitely not tuned to the format capabilities. What we need is an editor designed specifically for the format, and free and Open Source would be perfect …

… wait, what’s this?

macSVG.png

macSVG is a MIT-licensed open-source macOS application for designing and editing Scalable Vector Graphics (SVG) content for HTML5 web pages, mobile apps, animation design, and general graphics usage.

SVG is an open-source format for computer graphics documents based on the authoritative Scalable Vector Graphics (SVG) 1.1 (Second Edition) – W3C Recommendation 16 August 2011 from the World Wide Web Consortium (W3C), and is supported on most modern web browsers, and many application frameworks.

macSVG can produce dynamic, high-quality graphics and animation for HTML5 web views that can be displayed on most major desktop and mobile platforms, including iOS, Android, macOS, Microsoft Windows and Linux…

Well, isn’t that just awesome with a side helping of awesomesauce?

And the rendering side is active these days too, if you haven’t caught our various off-handed references check out Macaw, and Macaw-Examples, and these posts:

How friendly can drawing API be on iOS?

…I don’t even want to think about maintaining such a hierarchy using pure CoreGraphics. To use the power of Macaw you only need to inherit your control view class from MacawView or use MacawView as a container and let the magic begin. An added benefit is that any change to the scene’s properties will automatically trigger a content update for the view…

Macaw iOS Library: Morphing Animations

Macaw is an open source library which makes vector graphics drawing and animation easy and enjoyable. Not long ago we released the 0.8.2 version with interesting updates.

Morphing Animations

From the beginning of this project we wanted to implement smooth transformation between shapes. Ability to morph paths into other arbitrary paths provides a way to create complex effects. We introduced a new member of the animation’s family — Morphing Animation…

Touch Events

We also made improvements to the existing API. For example, new touch events API additions to make more advanced touch events handling possible…

So yeah, next time you have some vector interactivity and/or animation needs, we’re thinking that macSVG plus Macaw looks like a really promising strategy. Try it out and let us know!

h/t: @oss_objc!

PS. For another approach, check out Snowflake based on the Reindeer XML and HTML parser which could be kinda handy other places as well!

UPDATES:

Is Using SVG Images Good for Your Website’s Performance?

Sketching The Future

So no doubt you’re aware that Sketch is pretty much the goto tool for UI/UX work these days, but unless you were watching very closely — even if you were watching very closely, actually — you might have missed a most interesting improvement in the latest release, Sketch 43:

Here’s a quick overview of the key updates Sketch 43 introduces:

  • Improved shape editing to speed up your workflow
  • We’re retiring legacy plugins, so they’ll no longer work
  • Over 40 other improvements and bug fixes, including an update to Mirror, a new file format and changes to nested symbol overrides

Missing the interesting part? It’s the “a new file format” part:

With this release, we’ve introduced a new Sketch file format, which means documents created with Sketch 43 will not be compatible with previous versions.

Still not getting the interesting here? Let us examine some outside opinions:

With Sketch 43, Design IS Code & Code IS Design

Sketch 43 will revolutionise software design work. The next version of Sketch will have an new file format that allows to read and write .sketch files manually or programatically. This strategic move will make designers and frontend engineers skip (the visual aspect of) frontend frameworks like Bootstrap or Zurb Foundation and go from Sketch straight to implementation…

With Sketch 43 you can now alter or create the very document that describes visual form and color from scratch, programmtically. That could be any element, modular component or an entire screen UI.

We do not have a need anymore to build templates based on visual layouts. Furthermore, we do not need to go through design definition phases before going into implementation. Forget the USP “Pixel-perfect design”.

The design IS the code, and the code IS the design.

Anything visual can now go back and forth between Sketch and UI frontend seamlessly. Designers now define the actual UI code. Developers can now make changes to the .sketch file with a simple click…

asdf

Various articles with further tidbits:

Sketch 43 is coming to town with a new game. An open file format!

Sketch 43 will change the way we work and think

New file format in Sketch 43

New file format in Sketch 43 and what we learned about it

Everything you need to know about the Sketch 43 file format

Sketch 43: A brief tour of fact vs folklore

sketch-web-viewer: “View and inspect Sketch 43 files in browser

And while this isn’t new, it will probably be of interest for scripting workflows:

Sketch-Server: “A Sketch Plugin that creates a local web server for your Sketch Documents.”

By default, Sketch Server returns an HTML page containing your image, centered (when smaller than viewport). You can specify both page, artboard, scale, and what kind of content the server returns to you… If you’d like just the image (png), you can get it using the /image path

Our immediate application is, we’d like something like this, but that draws 30+ localized languages from our CMS:

Generate App Store images for all iPhone sizes from Sketch

which should now be eminently doable. That’ll streamline the release process nicely!

So keep an eye on Sketch Hunt and Sketch App Sources and all the rest of the Sketch developer community … likely to be some mighty interesting stuff coming!

Live Photos Is Life

(And there’s your earworm for the day, fellow 80’s kids. You’re welcome.)

So we hadn’t been overly impressed with Live Photos when they were introduced — GIFs with sound, that nothing supports, yay? — and proceeded to assume that would shortly end up on the long list of forgotten Apple multimedia technologies that we were experts in back in the day, so might as well forget it immediately and save time. But perhaps we were a trifle cavalier in that evaluation, looks like Apple’s doubling down on them at least somewhat, got a top level folder for them now:

Live Photos for Developers

Live Photos allows you to relive your favorite memories with movement and sound. Take advantage of the new Live Photos API and let users enjoy these moments in your web app…

API and docs are still Spartan as ever,

PHLivePhoto

Live Photo HIG

Live Photo Editing and RAW Processing with Core Image

but this is new, a library to support web page embedding:

LivePhotosKit JS

Use the LivePhotosKit JS library to play Live Photos on your web pages.

The JavaScript API presents the player in the form of a DOM element, much like an image or video tag, which can be configured with photo and video resources and other options, and have its playback controlled either programmatically by the consuming developer, or via pre-provided controls by the browsing end-user…

and published with npm even. That … hopefully … indicates they’re serious about supporting it then!

So if you have any site that uses photos for anything, take a look at supporting Live Photos as well, now that it’s easy and all!

TestFlight Spreads Its Wings

You catch the latest TestFlight news just now? This looks pretty interesting:

What’s New in TestFlight

TestFlight in iTunes Connect now provides multiple build support, enhanced group capabilities, and improved tester management—making it even easier to test your apps.

Multiple Builds

TestFlight now lets you distribute and test multiple builds at the same time, so testers can choose from a number of builds to test.

Groups

TestFlight groups have changed. You can now do more with them, like create groups of TestFlight users, and each group can test a different build. To get you started, we’ve added all of your existing external testers to the group “External Testers,” which you can edit at any time.

Tester Management

Testers can continue testing a build when it goes live on the App Store, minimizing disruptions. iTunes Connect users can also access all active builds, letting them seamlessly compare different builds and you can easily resend invitations to testers who have not yet accepted their invitation.

Learn more about TestFlight.

Well doesn’t that just sort a whole lot of issues we routinely run into amirite? Sure we can play games with app IDs and icon tagging and whatever, not even going to bother linking to our various posts on tips and tricks for that kind of thing, but this looks waaay easier.

Mind you, we haven’t actually distributed an app using Apple’s incarnation of TestFlight yet, next one’ll be the first. When they first acquired it the no iOS 7 thing was a flat out dealbreaker, and by the time that wasn’t well we’d settled into a Crashlytics centred flow nicely so eh whatever dudes.

First time it crossed our mind hmmm maybe we could rethink that was this post last fall

How Not to Crash #1

Interestingly, these crashes did not appear in our usual crash reporting service, HockeyApp, so it actually took us a while to realize that we had a problem. To be aware of all crashes, developers need to check for crash reports through iTunes Connect or Xcode too…

Well, if we have to check them there, why bother checking other places too? Always like to streamline our process, being awesome DevOps dudes and all. But that wasn’t enough to seriously consider going all in, until a few weeks ago Google gobbled as Google gobbles and we were a tad miffed you might recall

Clearly this is great if you’ve already bought into the Firebase platform, but if you haven’t there’s a bit of thinking to do now, especially for those of us in businesses that Google actively competes with so have a smidgen of trepidation about handing over our collective user profiles and activity. Paranoid, yes yes, but hey paranoids have enemies too.

So that was enough to prod us into actively researching alternatives. In our considered opinion Bugsee is the best out there right now by a spectacular margin, oooh network logs would rock! but oh come on dudes we’re an indie place here (OK, actually these days we’re DevOps at Agoda.com because BANGKOK! come join us we need lots of everything especially iOS, but speaking as Trollwerks here) you actually think we can pay? Heh, that’s cute. And yes yes Dear Reader your favourite is very nice too, but nothing else really struck us as worth the effort to switch to.

But this. This here, this actively solves recurring problems! And far as we’re aware — please correct us if we’re wrong — the only actual downside from a dev perspective remaining with TestFlight is that users can opt out of reporting, and then no doubt those that choose to are the exact ones that would get that one weird crash we’d get grumpies 1-starring us with no way to figure out wtf they’re going on about, which would be … suboptimal. But, oh wait, that problem’s sorted now too, so … what’s left as a practical objection to going all in on TestFlight for your iOS platform needs? Why, nothing we can see!

If there’s anything we’ve still overlooked, please comment, but at first glance our verdict is yep, next project, no Google libs, all in Apple. We’ll update here if any flaws arise in that cunning plan!

Rolling Back In

PSA: Did you think, like us, that Rollout thing looked pretty neat, but questionable despite their assurances

Update Native iOS Apps without the App Store. How is this Legit?

…FYI, Rollout’s SDK is installed on over 50 million iOS devices and there’s never been an app rejected because it uses Rollout. I’m just saying that because it’s good to know that thousands of other developers are using Rollout, so you’re not alone.

Um, yeah. About that:

Apple Rejecting Apps That Use Rollout

Just got this message for a few of my apps that are live in the app store (and have been for years).

“Your app, extension, and/or linked framework appears to contain code designed explicitly with the capability to change your app’s behavior or functionality after App Review approval, which is not in compliance with section 3.3.2 of the Apple Developer Program License Agreement and App Store Review Guideline 2.5.2. This code, combined with a remote resource, can facilitate significant changes to your app’s behavior compared to when it was initially reviewed for the App Store. While you may not be using this functionality currently, it has the potential to load private frameworks, private methods, and enable future feature changes.

This includes any code which passes arbitrary parameters to dynamic methods such as dlopen(), dlsym(), respondsToSelector:, performSelector:, method_exchangeImplementations(), and running remote scripts in order to change app behavior or call SPI, based on the contents of the downloaded script…

Well, that’s a start; how about banning React Native next so we can stop having to argue with pointy-haired bosses that JavaScript sucks? We kid, we kid. We like JavaScripters, really. It’s so cute watching them pretend to be grownups! Okay, we’ll actually stop teasing now, let’s see how Rollout is addressing the situation:

While Apple has not modified its guidelines , it appears that these guidelines are now being interpreted in a more narrow way. We are disappointed that Apple has made this change before we have had an opportunity to address any concerns. We have already reached out to Apple to discuss and are committed to adjusting our offering as needed to remain in compliance under the more narrow interpretation of the guidelines…

We understand and respect the fact that Apple must have the ability to control its ecosystem, and we recognize that our appeal may not succeed.

However, Rollout.io will move forward regardless!

First, for the last year we have been readying an entirely NEW product offering which addresses the entire app development process, not only post-production. This new product, which we will be announcing and launching for developer preview in April, will be in full compliance with Apple’s more narrow interpretation of its guidelines…

Well, good luck with that, guys. We’ll check back in April and update with how that’s going!

UPDATES:

An Open Letter to Apple from Rollout.io – Proposing a SECURE JavaScript Injection Approval Process

All About Errors

Here’s one to bookmark for reference: The veritably _definitive_ guide to

Error Handling in Swift

Regardless of your skill, handling errors is a common task for any developer. As developers we have complete control of the code we write and features we include, but despite our best efforts, we don’t control everything. We don’t control the values our users enter or whether our applications have access to the resources they need. In this post we’re going to look at how we can handle these situations by looking at error handling in Swift…

Pretty certain you’ll find something new here no matter what your skill level:

Up to now we didn’t even realize catch could take a where clause, huh. That’s what a couple decades of C++ will do to you, reflexively cringe in triggered terror at the mere thought of “exception”. But we’ll get through it — that bit about propagating back asynchronously looks particularly interesting!

UPDATES:

Providing a unified Swift error API

Picking the right way of failing in Swift