Senior iOS Developer @Spotify | Blogging swiftrocks.com | Built @BurnoutBuddy | Kendo Mastodon: @rockbruno@hachyderm.io 🇧🇷🇸🇪

Stockholm, Sweden
BurnoutBuddy is out for iOS! BB for iOS lets you fight smartphone/work addiction harder than the native Screen Time app and has more features than the macOS version. Check it out! App Store: apple.co/3RZDEwr Wanna know more? burnoutbuddy.rockbruno.com/ @BurnoutBuddy
5
9
45
You've heard of Swift on VSCode, now get ready for Xcode on the Steam Deck!
27
30
688
42,320
When updating your Xcode, run "xcrun simctl delete unavailable" to delete obsolete Simulator versions. I haven't done this in a while and it cleaned up almost 50GB for me.
5
58
441
Apple: provides tons of debugging capabilities, logging hooks, conditional breakpoints, lldb runtime hacks me every time:
30
33
407
43,027
My latest invention is a very complex device that flips out and smacks you when you type Apple names wrong like xCode and Ios. This is a VERY serious issue #iosdev
9
40
379
I'm sure you might know you can store a method as a closure, but did you know you could also do this with operators???? I thought this was impossible because I always tried to do like in the image, but it works if you put it between parenthesis! TIL
10
35
337
Super excited to announce that I'll be joining Spotify as an iOS Software Engineer early next year! I absolutely love the product, and I would like to thank those who helped me throughout the years to reach this point in my life. It means a lot to me!
22
2
335
Some UIControls now support UIAction closures directly in their initializers in iOS 14! No more selectors and "addTarget" calls! 🥳
6
50
291
I'm a firm believer that having a few UI Tests that navigate your basic flows is the best way to eliminate what I call "release anxiety". Even if your version has some bugs, these tests will guarantee the users will still be able to use the app. I really like UI Tests.
12
24
283
Got to convert Spotify's core AppDelegate module to Swift! 🎉 This reduced the number of lines in that module by over 1k, and everything's much easier to read, test and improve on.
5
6
261
Funny reminder that 10 is the max amount of subviews you can have in SwiftUI because as Swift doesn't have variadic generics, 10 methods with different amounts of generic args is the furthest the Apple engineer went before saying "aight fuck this"
8
43
243
It's widely taught that you should use [weak self] in closures to avoid cycles, but I think there's a lack of content on how to identify these cycles. In the following example, the closure retains `self`, but `self` doesn't retain the closure or the queue. No leaks here.
10
36
194
Reminder that associatedtypes can have default values! Can be useful when building APIs. Here's an example of a HTTPClient that automatically parses requests to a dictionary unless another type is provided. If the type isn't Codable, you have to implement `serialize` manually.
4
31
184
You probably already know how to use async/await. But have you ever wondered *how it works*? In this article, we're gonna dive into the compiler to answer this and other questions about how async/await works in Swift! swiftrocks.com/how-async-awa… #ios #swiftlang
1
26
170
15,419
If you have any "useless" Swift protocols like the one in the picture, you can tag them with the _marker attribute to save a bit of app size. This was added along `Sendable` to represent protocols that have some form of compile-time importance, but do nothing in runtime.
3
18
176
19,043
I can't wait to test the newest Objective-C improvements! Have you seen that "ARC" feature? 😍
Next project: try to fix the water damage in the keyboard of my 2009 Macbook. You need to disassemble the ENTIRE thing to get to the keyboard. Thanks Apple
8
6
168
Ever had issues with Xcode not symbolicating crashes? Me too, and I found the fix by reverse-engineering the IDE! If you think that sounds interesting, this should be a fun read! swiftrocks.com/reverse-engin… #iosdev #SwiftLang
4
28
158
Xcode 13.3 introduces the unavailability expression I work on last year 🥰 Now your UIScene migration code can look a little bit better!
3
12
149
Sorry for the crash Apple engineer, but I think I can't debug your issue
6
140
Mindblown moment of the day: You can work on multiple branches at the same time with the "git worktree" command. I searched for this because I'm having an issue where the app takes years to build and I can't work on anything else while I wait. Now I can! stackoverflow.com/questions/…
7
27
144
2019 was a big year for me. I was able to defeat a big personal trauma that followed most of my life, while: - I moved in with my girlfriend - I grew a lot professionally - I spoke at NSBrazil - SwiftRocks grew a lot Now I'm moving to Sweden to work at Spotify. Excited for 2020☺️
13
139
It turns out that Swift internally uses the ~= operator for case statements, and you can override it to all sorts of cool stuff. I wrote a bit about it here: swiftrocks.com/writing-custo…
2
36
133
dump() is a cool alternative to print(). It prints objects using reflection, so in some cases you'll get a lot of information about the hierarchy in your print. #iOSDev #SwiftLang
5
28
142
My WWDC want is the same every year, which is iOS being able to move the window when a keyboard appears to prevent fields from being covered by it. Having to register a notification and manually move things so your user can see what they're writing sucks
3
7
123
me: worked as staff engineer, implemented crazy build systems for huge iOS apps also me: spends 30+ minutes banging my head on why I can't test a specific module -- it's because I forgot to add @testable to the import
1
4
121
So a few days ago I found out how the Shortcuts app is able to create Home icons that triggers their deeplinks, and extracted it so you can make your app provide icons that opens specific parts of your/other's apps. Check it out: swiftrocks.com/adding-deepli… #iosdev #SwiftLang #iOS
3
25
116
Using OSLog in iOS is a really cool experience. Being able to filter the logs by severity in Console is awesome and I wish Xcode automatically opened a Console session instead of cramming everything in that little debugger box. It's so nice it makes me want to log everything
7
9
113
Need to debug your app being launched externally, like deeplinks? Use Xcode's "Attach" option. It's similar to ^⌘+R, but Xcode waits for your app to be launched instead of launching it itself. Then you can go to Safari and trigger a deeplink for the debugging session to start.
4
15
112
Just published my new open source project: SwiftInfo! This is a simple CLI tool that extracts and tracks metrics of your iOS app including .ipa size, number of dependencies and more. Fully customizable to allow you to track anything. github.com/rockbruno/SwiftIn… #SwiftLang #iOSDev
3
14
108
Everybody protesting the e-mail app being rejected in the App Store and I'm here thinking why the hell would I pay $99/year for e-mail
5
5
108
I wanted to know how CaseIterable was able to automatically provide allCases, so I researched it and wrote about it 🎉 As a bonus, I added my own synthesized "first" property to it. Check it out! swiftrocks.com/how-caseitera… #iosdev #SwiftLang
4
16
104
Reducing iOS Build Times by using Interface Targets Bad dependency graphs in modular apps can cause serious build performance issues. Let's take a look at how iFood avoids directly importing dependencies by using "interface" targets. swiftrocks.com/reducing-ios-… #iOSDev #SwiftLang
4
18
108
A reminder that unit tests can be marked as `throws` to automatically handle errors. If you see yourself having to write guards in tests, it's likely that XCTest has a throwable version of what you're trying to do, like XCTUnwrap and XCTSkip. You can also make your own. #iosdev
2
17
108
My talk about Spotify's iOS architecture from @swiftheroes_it is now on YouTube! piped.video/watch?v=sZuI6z8q… #iOSDev #SwiftLang
2
13
104
"App Attest: (Properly!) Protecting iOS apps from Jailbreak Tweaks in iOS 14" In this article, I've detailed how Apple's new iOS 14 APIs can be implemented to protect apps from being compromised by hackers. #iosdev #SwiftLang swiftrocks.com/app-attest-ap…
5
25
107
Love this change on Swift 5.6! Seems like I missed it when it was first proposed!
5
11
102
Vapor is awesome! I'm working on a web app and every "standard" backend out there requires me to manually download and install a trillion random dependencies. Vapor is super easy to setup and use, I loved it.
4
5
101
Do you have a favorite Swift feature? For me it's probably the guard keyword. So simple, but has such a big impact in the code's quality. #iOSDev #swiftlang
28
96
The simulator having native support for the new Nearby Interaction framework is awesome. Can totally see myself using it for some fancy home automation shenanigans 🤖
3
9
96
DispatchQueues are most people's entry point to concurrency in iOS, and understanding how they work is a key to writing great multi-threaded apps. One of the first articles I wrote for SwiftRocks was exactly about this! #iosdev #swiftlang swiftrocks.com/understanding…
16
97
10,056
In iOS 14, apps can bundle their own local push notification server that can send pushes to other devices in the same network. This is meant to be used in places like cruise ships where connection to APNS may be limited. Pretty interesting stuff. developer.apple.com/wwdc20/1…
2
24
91
OMG, something I did ended up at #WWDC21 ! Me and @rakaramos wrote the first version of Swift's Algorithms' partial sorting methods 🥳
2
2
93
I missed SE-0287: "Extend implicit member syntax to cover chains of member references" being accepted. This is great! This being an error was really annoying. forums.swift.org/t/accepted-… #iosdev #swiftlang
5
20
87
TIL that since Xcode 11.4 you can drag APNs files to the simulator to test push notifications. They just need to additionally contain a '"Simulator Target Bundle": (your bundle)' entry to indicate a simulated push.
1
14
89
Hate imports? You can avoid them with a local typealias. I use this trick to prevent non-abstracted dependencies from leaking -- for example, a network target with Alamofire underneath can do this to prevent the main app from *also* having to import Alamofire in its files.
6
12
88
If you hate Xcode, then oh friend, I have something coming up that you might really enjoy... Stay tuned!
16
89
13,953
FYI, autoreleasepools are an easy way to unit test retain cycles. If you want to test that something is being deallocated, put it inside a pool to force it to be released immediately. Much easier than asserting a class's deinit method :) swiftrocks.com/autoreleasepo… #iosdev #swiftlang
4
9
83
How I'm using ChatGPT for software engineering swiftrocks.com/how-im-using-…
7
84
7,967
SwiftShield 3.2.0 now automatically obfuscates method names! I'm also removing the beta tag from it, because with the recent SourceKit changes I was finally able to fully obfuscate my ~15 pods gigantic project with zero issues 🙂 Check it out! github.com/rockbruno/swiftsh…
19
80
Slides for my SwiftConf talk about App Size are now available on SwiftRocks! I'll update it with the video as soon as it's released by the coordinators. swiftrocks.com/talks #iosdev #swiftlang
1
13
77
7,338
See you all tomorrow in my talk about Spotify's iOS architecture! I wish we could all be there in person 😢
Studio coming together: lighting, cables, cameras, branding. We're getting ready. Are you?! 👉Want to shoot a 'getting ready' video, get involved here: swiftheroes.com/2021/pyxie-2… 👉Want to see your messages on our social wall, post with #SwiftHeroes: swiftheroes.com/2021/social-…
3
1
73
Woohoo, back to the office on Oct 4 🥳 This pic is from 2019 when I interviewed at Spotify, and since then I haven't seen the office more than maybe 5 times.
1
70
Publishing an app made me realize I'm not cut out to be CEO. I love building things that help others, but the business bits like marketing, competition, dealing with angry customers, etc *really* stresses me out. I don't want to deal with any of that, I just want to build...
9
1
76
14,259
Every WWDC has a session on lldb commands. They are usually kind of similar but every year they show something new and cool. The one from this year is pretty cool, lots of things I didn't know before such as how you can open crash logs directly in Xcode! developer.apple.com/videos/p…
4
71
5,264
Just finished watching the WWDC sessions that I wanted to watch, so here are some thoughts and recommendations! swiftrocks.com/recommended-w…
1
9
75
8,183
I wrote a list of my favorite software engineering books and added it to SwiftRocks! These are the books I feel had the greatest impact on my career and that I recommend to others. swiftrocks.com/software-engi…
12
66
6,862
Swift 5.8 comes with some great features! I especially like the improvement to result builders. swift.org/blog/swift-5.8-rel…
1
10
71
11,252
My iOS teammate @DanZimm has been affected by Spotify's layoffs. Dan is US-based and has also worked in Meta and Snap in the area of performance and lower-level infra. Absolutely brilliant engineer, if you know who's hiring, please help me connect him with them!
3
16
71
18,731
It wasn't until now that I had built a complete app with SwiftUI. I compiled some thoughts about what I like and don't like about it and how I would use SwiftUI in my projects! #iosdev #swiftlang swiftrocks.com/my-experience…
1
10
68
"Creating a licensing system for paid apps in Swift"! We'll use our knowledge of serial numbers and asymmetric cryptography to create license files that cannot be reverse-engineered, and use them to activate an app's premium features. swiftrocks.com/creating-a-li… #iosdev #swiftlang
3
12
67
In preparation for some cool news next week, I made a brand new design for SwiftRocks! 🥳
2
68
After almost 4 years SwiftShield finally supports obfuscating properties! 4.1.0 finishes the list of important obfuscation features, and with the newer releases of Xcode fixing lots of SourceKit issues, using it should now be stable 🎉 github.com/rockbruno/swiftsh… #iOSDev #SwiftLang
3
6
68
TIL about dispatchPrecondition. Asserting for a specific queue is not a good practice, but I think this is neat as a debug utility to see if your code is going where you want it to go.
1
8
67
I recommend taking a look at XCRemoteCache! It's a great tool developed internally at Spotify 🎉
A 70% decrease in clean build times 🤯. That’s what XCRemoteCache does for our iOS projects — and it’s what it can do for yours too. Learn more about it on our blog: engineering.atspotify.com/20… #opensource
1
6
62
Swift 5.6 will also finally introduce negative availability, but by the time it arrives we'll have already dropped iOS 12 so I won't have much use for it anymore :/
2
5
65
The moment when Xcode adds color back to a method and its parameters as a result of you correctly fixing a compilation error
3
4
61
I got to see snow for the first time today and I love it!!! Born-in-a-tropical-country people problems.
3
61
God I hate Tech Twitter so much. Almost 100% of the "content" recommended to me is either made-up bullshit or techbro clickbait, Swift included. Can't understand how this ever caught on in the first place. I want to leave but a lot of great folks insist on using this crap!
6
6
63
12,899
Since I'm playing with old devices I decided to download the latest compatible iOS 6 version of Spotify in my iPhone 3GS and... IT STILL WORKS! 🤯 Spotify's compatibility game in on point
3
4
62
I already said this once, but I'm still surprised at how buggy iOS is and how you only notice this when your app is big enough to trigger said bugs. Lots of Spotify crashes are internal iOS problems that we report to Apple and they ignore/refuse to fix
5
1
64
I find it amusing how Xcode defaults to the iPod Touch simulator. Out of all devices, that's the one you want to choose? 😛 Hope they allow this to be configurable in the future.
2
1
65
Got myself a stand. Pretty good for the back and looks pretty neat :)
7
66
Tip: Never install anything with your mac's default Ruby/Python, always use a virtual environment. If something goes wrong, it's much easier to reset the manager than formatting your machine. My favorites are rbenv, pyenv, javaenv and nodeenv.
2
3
64
Announcing sourcekit-bazel-bsp: iOS development in IDEs like Cursor / VSCode, for Bazel projects! It's in very early stages, but I'm already very excited about the potential this has for the iOS community! github.com/spotify/sourcekit… #iosdev #swiftlang
2
16
72
4,308
I Googled an issue I was having and the first result was something *I* wrote from years ago. I was just taught something from my past self. I can barely describe this experience
1
1
60
Indie friends, who are you commissioning nowadays to do your app's logos? I'm working on a side project and am looking to pay someone to give it a face! 😀
46
2
54
I don't know what's happening to my memory... I wanted to learn something specific about async/await, so I looked it up on Google, right? Well, the result was my own blog post... I did this huge deep dive some years ago and I didn't remembered it one bit 😫
7
63
8,809
Me a while ago: "Why is everyone complaining about Safari? Such a dumb thing to get stressed over" Me after updating to iOS 15: "oh... oh."
10
4
58
Small tip: If you wanna play with async/await and actors don't use the Swift version packaged with the Xcode beta -- download the latest `main` toolchain. Many things have changed, and for Actors there are even new properties/protocols. swift.org/download/#snapshot… #swiftlang #iOSDev
1
10
61
Woohoo, my visa got approved! 🇸🇪
4
60
It seems that as a consequence of AsyncSequences being added you can now add `try` to for loops, but it will do nothing because normal Sequences can't throw. Subscribe for more useless Swift news
1
1
57
After a lot of suffering, today I think the best concurrency is no concurrency at all. Having a simple serial queue saves so much headache -- the code is a little slower but these multithread issues that are impossible to debug / unit test are gone forever.
3
1
58
Ever wondered what it means when you write "MyType.self" in Swift? The concept of metatypes confuses even those who are experienced with Swift, and one of SwiftRocks's most popular articles talks exactly about that. Check it out! #iosdev #swiftlang swiftrocks.com/whats-type-an…
3
56
8,633
Xcode project generation pros: No more pbxproj conflicts! Xcode project generation cons:
6
1
56
Did you know that there's a proposal to add Obj-C-like macros to Swift? I always find myself missing those when working with Swift code. github.com/apple/swift-evolu…
2
3
54
9,970
My article about thread safety used to be focused on the APIs, but I reworked it to explain the concept of thread safety and what are some common mistakes devs make when trying to do it in practice. Check it out! swiftrocks.com/thread-safety… #iosdev #swiftlang
10
54
I've updated my article on Swift thread safety to cover a bit of async/await! The original didn't say much about it, so now that I got the time to play with it I finally formed an opinion about it. I'm also finally working on an article about how it works. swiftrocks.com/thread-safety…
1
8
54
6,189
Loving the new UIButton styles/configuration API! I can't remember how many thousands of those "full-width background buttons" I coded in the past!
7
56
Found this thread on "what do you don't like about Swift" and have to strongly agree with the feature creep one. I feel we could easily live without most of the stuff added in the last few years, the language became really complex for little to no benefit. forums.swift.org/t/poll-what…
6
11
53
13,903
From now on I'll be using most of my free time to develop indie products. This has always been my main objective, but I lacked the time and means to do that until now. I already got the first one done and will release it 2 weeks from now! 🥳
5
1
52
Did you know it's possible to terminate your app in the middle of an XCUITest and launch it again from somewhere else? Let's see how to use this trick to write UI Tests that boot deeplinks and universal links in Safari and iMessage. swiftrocks.com/ui-testing-de… #iosdev #SwiftLang
2
13
51
DispatchQueue has some interesting hidden gems. Let's see how we can `DispatchQueue.getSpecific` to get a method's current DispatchQueue -- a trick that can also be used to send and retrieve information to/from queues. swiftrocks.com/discovering-w… #iOSDev #SwiftLang #ios
3
5
50
I spelunked Never's implementation in the Swift compiler to learn more about how the compiler knows that a return value isn't needed. Check it out! swiftrocks.com/how-never-wor…
13
50
I highly recommend using merge queues! A very important step to avoid conflicts in big teams :) github.blog/changelog/2021-1…
1
8
52
Async/await is one of Swift's most anticipated features and is getting closer each day. If you're not familiar with this concept and want to know more, I suggest playing with PromiseKit. To this day, this is one of the best frameworks I used in iOS 😊 github.com/mxcl/PromiseKit
1
4
50