Thomas Lextrait

Sr. iOS Developer at Google Founder at LycheeApps

Page 2


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 →


USCIS Help

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.

Me

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 →


Drone Hardware For The Rest Of Us

Coming from a software background I learned a few things about hardware while working on my Arduino drone. Much of what I learned is probably very simple and obvious and often that means it is not discussed much online as it’s considered common knowledge. However the landscape is changing: with Arduino, the barrier of entry has been lowered and people (such as me) who are not electrical engineers or hardcore hobbyists are able to build things. In this post I’ll go over a few things I learned and I hope it can save a few people many hours of research and trial & error.

CW and CCW propellers

I always knew propellers could be designed to rotate either clockwise or counter clockwise.

FullSizeRender.jpg

However when I bought a set for 4 propellers on Amazon, I didn’t expect half of them to be clockwise and the other counter clockwise. It wasn’t mentioned on the listing at all. It is obvious now, quadcopter...

Continue reading →


Generic UI: Input<T>

Generic User Interface

For quite some time I’ve been bothered by the small use of generics in Apple’s iOS libraries. Third party libraries also typically make little use of generics. Generic typing is a fantastic feature of Objective-C and Swift. It allows developers to write code that is incredibly re-usable. The point of generics is really to write less code yet make it even more robust and less prone to errors.

TL;DR GitHub Generic UI

What Are Generics? (or skip this to the next part)

For those who don’t use statically-typed languages much or just don’t know about generics, the simplest example is that of the array:

class Array<Element> { ... }

In this example the generic type is Element. The person who created the Array class made it so you can customize it for your own use. You can supply – at compile-time – the type of element the array will store. So if you make an Array<String> you will know...

Continue reading →


Find All Images With Given Attributes

I’m an iOS developer and with the release of Xcode 8 came a little issue. Apple introduced wide-color support on iOS 9. This meant that if you had 16 bit images then you couldn’t target older iOS versions, otherwise you would see something like this:

ERROR ITMS-90682: Invalid Bundle - The asset catalog at ‘Payload/XXXXX/Assets.car’ can’t contain 16-bit or P3 assets if the app supports iOS 8 or earlier.

So this prompted the need for me to easily find 16-bit images. Apple did help with that but it was really Xcode-project specific and I wanted to have something more generic.

Note For iOS Devs (Others can skip)

For those of you who are finding this page because you’ve had this error, do also check this page: https://forums.developer.apple.com/thread/60919?tstart=0 and note the following:

If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will...

Continue reading →


Source Code Is Only Half the IP

Nowadays every company needs to be making some kind of software. Every company needs a website, a mobile app maybe or more. Because of that most companies, including non-tech companies have either adopted a team of developers or have allocated a budget for outsourced software development.

We have all come to realize that source code becomes stale very quickly if it is not maintained and updated. Libraries, API’s, plugins, smart phones all change and applications that depend on those eventually stop working if they’re not updated. This means we live in a world where you can’t just pay a team of developers to build a website or an app and then it’s just “done”. Software development is a never-ending process.

Because software development is never ending, projects typically last years if not eternity. People rarely stick around for the whole lifespan of a software project. Software...

Continue reading →


The Developer’s Dilemma

Screen Shot 2016-10-18 at 10.53.47 AM.png

I often see developers, team leads, development managers and so on who say they don’t have time for non-programming activities. Because of an aggressive schedule (I don’t know any company that doesn’t have an aggressive software development schedule), there is no time for:

  • Documentation
  • Recruiting
  • Blogging
  • Experimenting with new frameworks and tools
  • Building experimental features
  • Looking into new processes
  • Doing security audits
  • Fixing security issues that nobody knows about
  • the list goes on…

All these things though are crucial in the long term to ensure the success of the project and the company. Many recognize that and often the complaint is: “my boss (who may be a lead, a manager, director, VP Engineering or CEO even) doesn’t give me the time and flexibility I need”.

My theory and of course it’s just my own and I very well may be mistaken, is that when given the choice between...

Continue reading →