Saving a video of the iOS simulator

If you want a quick way to save a video from the simulator, you can now write this on the command line:

xcrun simctl io booted recordVideo --codec "h264" --mask black --force ~/Downloads/Simulator-$(date +%Y-%m-%d_at_%H.%M.%S).mov

Then use the simulator as normal, and when you to finish the recording just press Crtl+C on the terminal.

You will find your video in the Downloads folder.

Note: This only works with Xcode version 11.4 and above.

Converting a project to SwiftUI

I think the best way to get more knowledge about an API is to do a real project with it. So to improve in SwiftUI, I decided to convert one of my hobby projects, FontMetrics, to use it.

FontMetrics is a straightforward application that lists all the fonts available on iOS and visualizes the typography metrics of each one.


Video in SwiftUI: macOS

One of the great features of SwiftUI is that the same code can run on iOS and macOS. After all, you are just declaring what kind of views you want; the system will translate those to the adequate component according to the system.

So how can we make our Video view compatible with macOS?


Video in SwiftUI: Coordinator

So you may think we finish the work on the isMuted property on part 2 of this series? Not quite.

Start the demo app, notice the mute icon on the top right of the video controls, what happens if you tap on that control?

Sure thing it will mute our video, but notice that our toggle command does not update accordingly, it gets out of sync with the state of the underlying video player property.

So how can we sync between the player class and our SwiftUI Video view?


Video in SwiftUI: Properties

On the previous article, we created our Video component for SwiftUI. It was working correctly, but there was not a lot of configuration you could do to it.

For example, if you wanted to mute the sound of the video, there was no way to achieve that with our current component. Let’s see how we can change that.


Improving Offline Posting

Great article from my colleague Diego, about the new offline experience on the WordPress apps.

The best technology is invisible and reliable. You almost forget it’s there, because things just work. Bad technology never disappears into the background — it’s always visible, and worse, it gets in your way. We rarely stop to think “My, what good Wifi!” But we sure notice when the Wifi is iffy.

Good technology in an app requires solid offline support. A WordPress app should give you a seamless, reliable posting experience, and you shouldn’t have to worry whether you’re online or offline while using WordPress Mobile. And if we’ve done our jobs right, you won’t any more.

Getting Started

Our first step was a review of the current offline posting experience, done by a cross functional team composed of designers, QA engineers, and developers.

The process was pretty straightforward: we went offline, started testing, and taking notes. We also took into account support requests and existing bug reports.


View original post 527 more words

Video in SwiftUI

Recently I have been tinkering with SwiftUI, the new UI framework from Apple

I’m enjoying the declarative approach, the ability to have real-time previews, and that all settings are save in code (bye, bye Interface Builder).

While this new framework has a lot going for it, it still doesn’t have the same depth of functionality of UIKit, that has years of development, and you may found out that some components you rely upon in UIKit are entirely non-existent in SwiftUI. But don’t despair Apple make it very easy to reuse any UIKit components by using two protocols to wrap around UIKit components:

They have very similar interfaces the main difference being what type of class they wrap around.


UIKonf 2019

Last week I attended UIKonf 2019 at Berlin.

This year conference had an all-female speaker line up, and I think this was an excellent idea to help increase gender diversity on our profession. A lot of female attendees commented they felt inspired to have the opportunity to see so many great presentations delivered by female speakers, and that it will help to attract more people to the mobile development space.

The videos will all be available online soon; bellow is just a quick review of the presentations I saw.


Aztec: A native HTML editor

One of the most important aspects of the WordPress app is the post editor, after all the content generated by our users is what make their site different from all the others.

Since we started developing the WordPress apps, we wanted to provide the best writing experience to our users, writing is already hard by itself so you don’t need that the tool you are using to write to be complex, slow, or error prone.

Last August my team at Automattic started a project called Aztec, the ambitious goal was to have HTML editor that could support the same feature set has our web editor but completely written in native code.

After some hard working months, we are now releasing the first beta version of the editor in our native apps. If you want to know more you can read the official release post here and for the more technical inclined an architecture overview is available here. You can also check our open source code on our Github repo.

Remember this is not limited to be used on the WordPress apps, you can use it in any app that needs an HTML editor.

Pull Requests are welcome!

Font Metrics update

I developed FontMetrics some years ago when I was working for several publishing clients. Clients in publishing normally want to use their own brand fonts and have precise requirements regarding layout and text alignments.

This was a bit tricky to do with the iOS text system at the time, so I developed this app to allow to preview fonts and check their different metrics. This allowed the design team to do quick checks on the fonts files provided by the client and to quickly find the metrics to use for layouts.

This week I finally got some free time so I decided to have a look what needed to be done to bring it up to iOS 10. The last time I updated this app was when iOS 7 was launched, so it really needed some TLC!

This was implemented way before Swift was a thing so all of the app was written in Objective-C, and when I started to look at the code I found a lot of small issues and some really bad code.

It’s very humbling to look at code that you developed some years ago, it really makes you understand that you are always learning and you can always improve.

The app was so simple that I decided to update all code to Swift and do some much needed updates to the UI/UX.

I’m pretty happy with the end result so I decided to make the app open source and publish the repo on GitHub, bug reports and PRs are welcome!