NEW: Nominations are now open for the 2019 Swift Community Awards! >>

Sherlock turbocharges your iOS simulator

Inspect and adjust any app in real time

Paul Hudson       @twostraws

There aren’t many times outside of WWDC where Apple developers see a new tool and immediately think “I need that in my life.” Sherlock by Inspired Code is one such tool: it injects itself into the iOS Simulator so that it can monitor views and adjust them in real time.

If you aren’t already thinking you need that, let me rephrase what I just said: you can inspect any app in the simulator, including system apps, see how they were built, and dynamically change large parts of them. Want to adjust the way image views fit their images, how text is aligned, or what background color is used? Sherlock does all those things and more – you just select the thing you want to change and click away until you’re happy.

When working with one of your own apps, Sherlock provides an unparalleled ability to experiment: navigate your way through your view hierarchy, select something you want to work with, then adjust any number of settings right from a macOS window. And when you want to compare your changes to the code, there’s even a “Jump to File” button that takes you straight there.

Even more impressively, you can attach a resizable screen to any app, allowing you instantly flick between various common iOS device sizes: iPhone 5, 6, and X are all available. Selecting a size immediately updates the layout to how it would look on the new device – it’s not just stretched to fit.

Right now the app is available as a free beta, so there really is no reason not to give it a try. In the future it would be great to see even more view properties exposed, and in particular the ability to visualize and dynamically adjust Auto Layout constraints would be particularly useful. Of course, it’s hard to be too demanding – Sherlock only just launched, so for it to be so impressive out of the box is quite remarkable.

For more information visit https://sherlock.inspiredcode.io or follow @getsherlockapp on Twitter.

Bonus: Interview with the creators

Sherlock is being developed by Samuel Stone and Jake Lawson, and Sam was kind enough to take the time to answer a few questions about their motivations and plans, and even a little about it works.

Hacking with Swift: What was your inspiration for creating Sherlock?

Samuel Stone: Primarily, the amount of time we were wasting.

We both work on pretty large apps with a lot of nested screens, and a fairly involved process to onboard a new device, so we were burning a lot of time testing out design tweaks, rebuilding every time and then having to switch between simulators to confirm that the layout worked on all device types.

Similarly, we’d often find ourselves working on unfamiliar screens, wanting to know what UIViews and UIViewControllers we were actually looking at, and having to pause and unpause the app to confirm in Xcode’s visual debugger was frustrating.

 

HWS: Are there more features you're working on for the next release?

SS: Our focus at the moment is on making the existing features work as well as possible. Right now, that includes expanding the range of inspectable properties and making the Jump to File feature faster and more reliable for larger codebases.

Longer term, we’ve got a lot of ideas for exciting new features, such as a way to undo changes, or to have changes automatically reflected in your storyboards, but which ones actually make it into the app will depend on whether we can get them working in a reliable and consistent way.

 

HWS: The question many people will be asking is “how does it work?” What can you tell us?

SS: The Objective-C runtime and a lot of black magic.

Sherlock works in much the same way as Reveal or Xcode’s own visual debugger works - it loads a library into the target app to expose a way for other processes to interact with it.

It also uses some extra magic to inject itself without requiring any configuration by making use of the same sort of techniques that Xcode itself uses to speak to the Simulators.

 

HWS: Given its history in the Apple world, why did you choose the name “Sherlock”?

SS: Because we think it’s super smart, and using Sherlock is like having a detective for your app!

Regarding the history of the name, we knew a lot of people would comment on it, but that just made us like it even more.

And in the end, if Apple does decide to sherlock Sherlock, that’s not the worst thing that could happen. They’re the best positioned people to build something like this, so if they did it would be a big win for iOS developers in general.

SAVE 20% ON iOS CONF SG The largest iOS conference in Southeast Asia is back in Singapore for the 5th time in January 2020, now with two days of workshops plus two days of talks on SwiftUI, Combine, GraphQL, and more! Save a massive 20% on your tickets by clicking on this link.

MASTER SWIFT NOW
Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

About the author

Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and a speaker at Swift events around the world. If you're curious you can learn more here.

Was this page useful? Let us know!

Average rating: 4.5/5