Thomas Lextrait

Sr. iOS Developer at Google

Read this first

Early Words - iOS App

Screen Shot 2020-01-20 at 1.25.07 PM.png

I’ve just released Early Words to the iOS AppStore. You can find the app right here. This is the first commercially viable mobile app I’ve built entirely on my own from A to Z, for my own business (LycheeApps Inc.), and without external funding.

Early Words took me quite some time to build. I actually wrote the first line of code in 2018. I took a few breaks in between where I did some consulting and non-programming projects. The idea first came from my daughter Camelia. She is 2.5 years old now and she spent quite some time with flashcards learning new words. One challenge for us is we want her to learn multiple languages because our families speak English, Vietnamese, and French. It’s not that easy for all of us to teach her all of these languages. With Early Words I wanted to build an app where I could easily add new “flash cards” and have recorded voice in multiple languages.



Continue reading →

View Containment in Swift

I’m always looking for this code snippet around and for some reason it doesn’t pop on Google that easily so I thought I’d post the 4 lines of code necessary for achieving view containment in Swift (this is Swift 4 by the way):

override func viewDidLoad() {

    // View containment
    childViewController.view.frame = view.bounds
    childViewController.didMove(toParent: self)

What’s view containment you ask? it’s when you replace the view of a view / view controller with the view of another view controller. It’s incredibly useful for many use cases. One use case is: you want to build a view controller that can serve as a router and display one of multiple view controllers based on some logic. Another use case is if you want to overlay something on top of a view controller without...

Continue reading →

Working Remote From Nha Trang, Vietnam

Recently I went to Vietnam to visit some family and stayed in Nha Trang for a little over 2 weeks. Very luckily Square is flexible on work schedules and work locations. Additionally my manager allowed me to work from Vietnam, and I did for most of my stay!

I had always wondered what it would be like to freelance while backpacking through Asia and this gave me a little sense of it (minus the backpacking), which I’ll share in this post.

Nha Trang

Where I stayed

My parents in-law own a small hotel in Nha Trang called Modern Sky Hotel, and that’s where I stayed for a little over 2 weeks. Nha Trang is a little beach town somewhere in the middle of Vietnam, see below:

Vietnam Map.png

Nha Trang is a very popular destination for both Vietnamese and international tourists. It has plenty of major hotel names such as Intercontinental and Sheraton. The most expensive hotels are on the beach ($100+/night) and...

Continue reading →

Deleting Old iOS Simulators

I’ve been developing iOS apps for some time now and after a few iOS versions, my list of simulators starts looking like this:

Screen Shot 2018-11-27 at 1.48.17 PM.png

Each simulator takes from 100MB to 1GB of space, so this can eat up your disk space really quick! The trick is to simply delete the simulators you don’t need.

In the menu bar simply go into “Window” and click “Devices and Simulators”. The shortcut for this is ⌘+⇧+2 (Command+Shift+2).

Screen Shot 2018-11-27 at 1.48.30 PM.png

Then go into the “Simulators” tab and hit the delete key on all the simulators you no longer want!

Screen Shot 2018-11-27 at 1.48.37 PM.png

You can also rename your simulators:

Screen Shot 2018-11-27 at 2.10.28 PM.png

Continue reading →

A Few Xcode Tips

In this post I just want to share a few super useful tips & tricks I’ve learned over time with Xcode.




If you don’t know ⌘+⇧+O (Command+Shift+O) then I’m really sorry because life must be hard. This is definitely the very most important shortcut in Xcode. Try it out, ⌘+⇧+O is a magical “open anything” shortcut. It summons a search bar, a little bit like CMD+Space does on Finder and allows you fuzzy-search anything in your codebase. It can find text, symbols, class names, methods, and more. Given it does fuzzy search, if you want to find a class named MySuperCrazyLongNamedViewController you can type something like MSuCrNa and it will find it.


“Mash” is common language for ⌘+⌥+⌃ (Command+Option+Control). So hitting ⌘+⌥+⌃+U will run all the unit tests in the file current open.


⌘+⌥+⌃+G will run again whichever was the very last unit test you ran.



Continue reading →

A Day At Square

Square,_Inc._logo.svg (1).png

I work at Square as a Senior iOS Engineer and here’s what a typical day looks like for me.

Sunrise – 6AM-7:30AM

I usually get up at 6am, brush my teeth, feed my pets and jump in my car to get to work around 7:30am. I don’t usually eat anything nor make coffee because I’ll get those in the office. I live in Hayward, California and the commute to San Francisco is 27 miles. This usually takes 1 to 2 hours driving in a gas car, or about 1 hour in a low-emissions vehicle. This is because low emissions vehicles are allowed to take the HOV (high occupancy vehicle) lanes and skip much of the traffic. I recently switched my car for an electric car and saved myself 30-60 minutes a day. I could also take the BART and the trip is about 45 minutes, but it does take extra time to get to the BART station and parking the car.

Below is a timelapse video of my commute.

The video above was shot...

Continue reading →

Un-implemented Methods in Swift

A great feature of Swift is that you can require that subclasses of a class implement a method. This can be achieved with required. However, if you’re on the other side wanting to subclass something with no intention to implement all the required methods then it’s a lousy situation and this has bothered me for a while. Xcode recommends by default that you crash the app. A super famous example is this:

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")

A lot of of the iOS SDK classes are NSCoding, which means they can be serialized and deserialized. If you subclass UIButton for example then you’ll have to implement the method above because UIButton is NSCoding. By default, Xcode fills the implementation of your method with fatalError("init(coder:) has not been implemented"), which suggests that if you don’t plan on implementing the...

Continue reading →

measureBlock: How Does Performance Testing Work In iOS?

I was working on a mini project at Square involving performance unit testing for iOS. Essentially I’m looking into how we could introduce performance unit testing, what our options are and how it would scale on our CI. In this post I’ll just focus on the one tool Apple provides as part of its unit testing suite: the magical measureBlock method. The question was: how does it work? and is this going to work for us and our CI (continuous integration) process?

What’s measureBlock

For those who don’t know measureBlock here’s a little background. When you write a unit test in XCTest, a feature allows you to measure how long a block of code takes to execute. It looks like this in Objective-C:

- (void)testMyCodesPerformance
    [self measureBlock:^{
        [someClass doSomethingFancy];

Or in Swift:

func testMyCodesPerformance() {
    measureBlock {

Continue reading →


I mostly focus on technical posts but usually when I write I try to write about things I personally struggled to find on the web so that perhaps my own post may help others looking for information in the future.

This will be about the United States Citizenship & Immigration Services (formerly I.N.S.). Plus I feel like immigration is a topic that affects people in technology a decent amount so I guess this should be relevant. Take this article as a list of resources that can help you getting processed by USCIS within your lifetime.


I’ve dealt with the US immigration and USCIS for over a decade and learned a lot over time. Some of my learnings I really wish I had learned earlier. For those who are citizens: a USCIS office is very much like the DMV with numbered waiting coupons except they have leather chairs. The reality with USCIS though is that if you fall through the cracks and...

Continue reading →

Getting Started With Chrome Extensions

Screen Shot 2018-01-18 at 4.27.30 PM.png

A long time ago, during an internship at Rakuten in Boston, I worked on a Firefox extension. It involved using an obscure markup language called XUL. There was very little documentation on it and it took me about a summer to build an MVP that could make requests to a NodeJS backend. That said, I wasn’t super keen on doing browser extension development again, however an opportunity arose.

At Yelp, all code repositories are stored in git on private servers. There is no UI so how do you do code reviews? Yelp engineers use an antiquated and open source piece of software called Review Board. Yelp is actually a contributor to the code base and maintains its own fork. Long story short… I didn’t like the Review Board UI and decided to fix it. However it was going to be a major pain for me to get access to Yelp’s fork of it and it wasn’t clear Yelp would let me deploy any changes. So I decided...

Continue reading →