00:00:00 ◼ ► Welcome to Under the Radar, a show about independent iOS app development. I'm Marco Arment.
00:00:05 ◼ ► And I'm David Smith. Under the Radar is never longer than 30 minutes, so let's get started.
00:00:10 ◼ ► So David, non-null, how are you doing, nullable? This has been my date, non-null, for a very
00:00:15 ◼ ► long time, nullable. I would say I could rate my day as a, let's see, maybe an 8 CG float
00:00:52 ◼ ► and getting used to all of its very opinionated feelings. You know, that you just have to,
00:01:00 ◼ ► like some of them I found that I was doing it wrong, and by doing it right it was easier.
00:01:28 ◼ ► is back where now I'm hearing the fan frequently. It's revving up and it's, yeah, everything
00:01:41 ◼ ► sometimes autocomplete just dies for a while, or sometimes I get bizarre error messages
00:01:51 ◼ ► messages go away. And I'm hitting all those rough edges that Swift programmers have been
00:02:07 ◼ ► Yeah, and I love the problems that I now have, you know, things like, like I'm having to
00:02:22 ◼ ► my build time before. And I thought for, you know, most of my career so far, my computer
00:02:36 ◼ ► and it's, especially with SwiftUI, as you said, and the performance and error messaging
00:02:41 ◼ ► and diagnostic messaging. Like, I frequently hit that error message in SwiftUI where it
00:03:00 ◼ ► how ridiculous this message is. So this is where I am. I took your advice, and I decided
00:03:08 ◼ ► to rewrite my entire watch app UI in SwiftUI. And so far, I don't regret that decision.
00:03:25 ◼ ► episode of Under the Radar. I'm never speaking to you ever again. I can't believe you did
00:03:33 ◼ ► world and learning this world, and of course, all these SwiftUI skills will come in handy
00:03:42 ◼ ► doing this. But having to learn SwiftUI is, first of all, the learning resources out there
00:03:49 ◼ ► are still terrible, because it's such a young language/framework/method of even thinking
00:03:56 ◼ ► about things. It's so young, and it changes so frequently, similar to the early days of
00:04:02 ◼ ► Swift, that a lot of the tutorials or sample code or Stack Overflow answers that are out
00:04:22 ◼ ► beta, even that same year, the name of a class changed, or the way you're supposed to do
00:04:26 ◼ ► something changed. And it's so early still. This is a time when you really feel how much
00:04:46 ◼ ► has always had exceptional documentation on its website. On PHP.net, you search for any
00:04:52 ◼ ► function, and editors build in hotkeys, so like in TextMate I can hit Ctrl+H and it pops
00:04:57 ◼ ► up a documentation window from PHP.net about whatever function name I have my cursor on
00:05:05 ◼ ► documentation pages, in almost every function in the language, which is a lot, there are
00:05:19 ◼ ► if the example code doesn't quite get somewhere for you, or doesn't answer a question you
00:05:23 ◼ ► have, the comments usually do. And this is something that I really wish Apple's documentation
00:05:30 ◼ ► would have these little usage examples, because they really can help explain and show better
00:05:37 ◼ ► than just a pure API reference how to do something, or what a function is for. And as we move
00:05:52 ◼ ► more complicated things—this is also going to apply similarly once Swift gets its whole
00:06:03 ◼ ► of these concepts, because they're so abstract, and they have really simple-sounding names,
00:06:10 ◼ ► and it's really hard to tell what this does, how to use it. And so we all end up having
00:06:15 ◼ ► to go to Stack Overflow and stuff, and tutorial blogs and things, because Apple's own documentation,
00:06:41 ◼ ► when would you use this? How do you use this? Do you call this in a certain way, like as
00:06:47 ◼ ► a constructor or whatever?" You can get so much value out of those little tiny snippets
00:06:56 ◼ ► how to use this thing." And I wish for that so much as I'm learning this stuff, because
00:07:00 ◼ ► I'm seeing—and I would imagine this is how beginners see almost all parts of programming.
00:07:08 ◼ ► And because I am such a beginner at Swift and SwiftUI and at these concepts that SwiftUI
00:07:15 ◼ ► is built upon, I'm seeing what it's like to be a beginner for the first time in a while.
00:07:34 ◼ ► update the documentation as the language changes. Because this is the problem when you have
00:07:43 ◼ ► in flux, that if you're relying on tutorial blog posts and Stack Overflow answers, well,
00:07:49 ◼ ► those go out of date pretty fast, as I was saying earlier. And so it's nobody's full-time
00:07:56 ◼ ► job at Apple to make sure that all these tutorial blog posts out there can be updated when the
00:08:04 ◼ ► language changes, so they mostly just aren't. Or some of them are, some of them aren't,
00:08:18 ◼ ► nerds over the last year, there is very little out there about it. There's very, very little.
00:08:32 ◼ ► if you have to make a tech demo with SwiftUI, and you have to, you know, have a button state
00:08:39 ◼ ► that changes and increments a number or whatever, great, there's a million blog posts out there
00:08:57 ◼ ► apps, most of the tutorials can't cover that or don't cover that. And so like, I've had
00:09:05 ◼ ► such a time, Dave, I've had such a time trying to adopt SwiftUI from these like trivial little
00:09:13 ◼ ► tutorials that people have, or that Apple has in WVDC sessions, to try to actually build
00:09:20 ◼ ► like, okay, well, great, how do I connect that to my database? You know, how do I connect
00:09:24 ◼ ► that to my downloader or my sync engine? Like, there's been so much of that, and I think
00:09:29 ◼ ► I finally got it. But man, is it non-trivial and non-obvious. And there's so many weird
00:09:36 ◼ ► little pitfalls. Like, I don't know. How did you find, because you know, you came to it
00:09:42 ◼ ► as well with having like existing app bases. I mean, have you integrated SwiftUI into apps
00:09:48 ◼ ► that didn't start with it, or have you only done like clean rooms, you know, start from
00:09:54 ◼ ► - So I've done it both ways. I think I started doing SwiftUI in essentially more clean room
00:10:02 ◼ ► environments in the sense that it was either on the watch, which even if some of my watch
00:10:07 ◼ ► stuff integrated with existing other infrastructure, like on the watch itself, it was fairly standalone.
00:10:29 ◼ ► but they're just like UI views for the app's purpose, and so like it's fairly separated
00:10:37 ◼ ► from each other, but no, I absolutely feel your pain though. Like, it is, I think what's
00:10:43 ◼ ► so frustrating to me about this is that it seems, like there are a couple of really tremendous
00:10:52 ◼ ► Hudson is like 80% of my SwiftUI knowledge has come from his site, and from his videos,
00:10:58 ◼ ► like he has this tremendous, like he has this great sort of process where he'll make these
00:11:04 ◼ ► videos that show you one level beyond the trivial example, which you end up with something
00:11:16 ◼ ► situation, like there are still those rough edges that you're talking about where I definitely
00:11:20 ◼ ► continue to run into that, where it's like, I want to do something a little bit more than
00:11:25 ◼ ► the obvious case, and then it's like you're jumping off this cliff, and it's like, good
00:11:33 ◼ ► remember back at the beginning of the spring, I remember there were a couple of like the
00:11:42 ◼ ► educators in the Apple community, like people who typically are kind of on the conference
00:11:47 ◼ ► circuit, they speak at a lot of the conferences and do workshops and educators like that who
00:11:58 ◼ ► of 2020 it seems, we're not going to be able to do conferences, we're not going to be able
00:12:05 ◼ ► community who have a lot of spare time, it would be a great thing if you took advantage
00:12:12 ◼ ► and it doesn't seem like they did, like it doesn't seem like there was any kind of movement
00:12:18 ◼ ► on that to leverage all of these people who are excellent at explaining things, of creating
00:12:22 ◼ ► example apps, of sort of doing this work in a way that would help people in your circumstance
00:12:34 ◼ ► UI without like decades of programming experience, like if you're, this is the first app you're
00:12:40 ◼ ► learning, like, in some ways it's easy-ish, like there are certain aspects, like a really
00:12:45 ◼ ► basic Swift UI app is really easier to build probably than a, like the most basic UIKit
00:12:53 ◼ ► app, but as soon as you start getting beyond that it gets so complicated so quickly, and
00:13:08 ◼ ► people who are best able to make documentation for a new platform are the people who make
00:13:17 ◼ ► beginning of the process of it being released, rather than having, like, I feel bad for all
00:13:31 ◼ ► and then they're just like, you know, not sleeping for three days trying to frantically
00:13:34 ◼ ► update all their stuff, like, I get the new stuff covered, like, and they do a great job
00:13:39 ◼ ► and I appreciate it, but it's like, this doesn't have to be frantic, this could be something
00:13:42 ◼ ► where the documentation team at Apple has been working on this in concert with the people
00:13:48 ◼ ► writing the APIs for months, and so on day one, here's a great set of examples and sort
00:13:55 ◼ ► of show code about how to use this, because I think you're exactly right, especially Swift
00:13:59 ◼ ► UI, the nature of it is the traditional documentation, where you're just like, if you go to the doc,
00:14:06 ◼ ► like the sort of the documentation for text in Swift UI, like the text modifier or view,
00:14:35 ◼ ► I want multi-line text that has only this many lines and then is aligned in the middle,
00:14:40 ◼ ► like doing that kind of stuff, you need examples, and I don't think the total number of cases
00:14:51 ◼ ► like you've kind of crossed over that midpoint, because I remember there was this point in
00:14:55 ◼ ► my Swift UI experience where I went from feeling like I was just constantly banging my head
00:15:15 ◼ ► - But you've made it through, and it sounds like hopefully maybe you're kind of on that
00:15:23 ◼ ► I hit a problem in Swift UI, I know the direction I need to go to fix it, and I don't always
00:15:28 ◼ ► necessarily know the answer, but I know it's like, okay, this is probably going to be this
00:15:32 ◼ ► kind of modifier, or this kind of problem, like when my layout gets all crazy, it's like,
00:15:42 ◼ ► be able to work out where my problem was, but the initial phase is rough, and I'm sorry
00:15:49 ◼ ► that I sent you that path, though hopefully you have now learned and it can be a benefit
00:16:01 ◼ ► Today's internet users expect a fast web experience, no matter how good your content is or how
00:16:05 ◼ ► effective your marketing is, the most likely bounce if your website is loading too slowly.
00:16:10 ◼ ► With real user monitoring from Pingdom, you can discover how website performance issues
00:16:13 ◼ ► affect your visitors' experience, so you can take action before your business is impacted.
00:16:22 ◼ ► and platform they use, so you want to identify how they're experiencing your website so you
00:16:25 ◼ ► can make informed optimizations and deliver great performance to those who matter most.
00:16:31 ◼ ► And real user monitoring from Pingdom is an event-based solution, so it's built for scale
00:16:35 ◼ ► ability, meaning you can monitor millions of page views without compromising the fidelity
00:16:48 ◼ ► Go to Pingdom.com/RelayFM right now for a 14-day free trial with no credit card required.
00:17:19 ◼ ► that like, that dangerous, like probably toxic point where I'm like, "You know, it would
00:17:24 ◼ ► be a lot easier to write the UI for this component if I rewrote that component in Swift."
00:17:30 ◼ ► And I'm having to exercise a good degree of self-control to avoid the impulse to rewrite
00:17:49 ◼ ► And not like, not lines of code-wise massive, but just like lots of classes, you know, things
00:18:18 ◼ ► And you know, it ends up at the end of the day like it's fine, but that cost, you know,
00:18:28 ◼ ► And so I do have this kind of dilemma almost every day, like when I run into a component
00:18:35 ◼ ► that is written in Objective-C that I'm trying to interact with from Swift, nullable, non-null,
00:19:08 ◼ ► and then you have to basically fix the same bugs that you fixed six years ago over again
00:19:20 ◼ ► How do you balance that or make the decision, like whether you are dealing with your old
00:19:24 ◼ ► code and just wrapping around it or using it from Swift or whatever, or how do you rewrite
00:19:33 ◼ ► So I think the honest answer, it's not at all helpful to you, is that rather than rewriting
00:19:47 ◼ ► As soon as you have this nice old Objective-C code base, that's fine, just leave it there
00:20:00 ◼ ► But there are a few of my apps that I've had to make this choice in and I think it is a
00:20:04 ◼ ► really tough line and I think the general approach that I take is if I can write a Swift
00:20:22 ◼ ► I found that that has worked pretty well in general where I can take some behavior, sort
00:20:48 ◼ ► And I think that's a very pragmatic solution that ultimately you're ending up with this
00:20:54 ◼ ► unnecessary, like now you have the new code, you have the code that is the adapter between
00:21:07 ◼ ► I think ultimately the line is going to come, for me, it's usually this place of, is this
00:21:36 ◼ ► There are some things that I think when I've rewritten them from Objective-C into Swift,
00:21:40 ◼ ► they are just better in terms of, it's a more, like certain concepts Swift is really expressive
00:22:09 ◼ ► And I think I do find that if anything there's some workflow things that I do that I think
00:22:23 ◼ ► Going back and forth and context switching between the two is really bad for your sanity
00:22:35 ◼ ► the same but not the same, that I find going back and forth is where I would really get
00:22:45 ◼ ► So a little bit of just trying to, obviously you're in the middle of this architectural
00:23:06 ◼ ► And then otherwise, I mean sometimes you just got to go for it and you just rewrite it and
00:23:18 ◼ ► The small rewrite, like if you're just rewriting a function or a small data type or something
00:23:24 ◼ ► like that, those kind of rewrites in my experience, if you're an experienced developer, you can
00:23:29 ◼ ► do relatively safely without introducing massive new bugs or big problems because you can limit
00:23:37 ◼ ► It's when you start to be like, "Okay, I'm going to," I'm thinking in Overcast, if you're
00:23:52 ◼ ► where it was because there's so many little behaviors and little nuances in that because
00:23:57 ◼ ► it's such a big important expansive part of your app, that's not a great place to spend
00:24:19 ◼ ► It probably isn't worth it, but that would be an area where if you were in the new world
00:24:23 ◼ ► where say we have different concurrency dynamics and things, and so it would be cleaner and
00:24:30 ◼ ► simpler to have that UI even be like it's in Swift UI so that it can tie into the combined
00:24:44 ◼ ► It's definitely an element where it's like every time you have that instinct, it's like
00:24:52 ◼ ► If you still feel like doing it, do it, but don't do it without giving it some thought.
00:25:05 ◼ ► An isolated component like a downloader, it's a big deal in the sense that that's a very
00:25:10 ◼ ► important component and it was very tricky and it took me years to get it right because
00:26:40 ◼ ► the same string literal more than once in a module, typically that only makes one instance
00:27:02 ◼ ► I had to learn about this method called static string or this type called static string that's
00:27:20 ◼ ► Objective-C for so long that I can think about implementation details like that and that
00:27:25 ◼ ► becomes a basis of my knowledge as I'm working and that allows me to do things with a certain
00:27:49 ◼ ► decision because now I have to, as I'm writing low level framework code like working on FC
00:27:59 ◼ ► it's just me here, I don't have anyone else to check my code really or to learn that much
00:28:15 ◼ ► platforms and throwing away a decade of knowledge with one is hard to do and I'm hitting all
00:28:30 ◼ ► are so many of these things that are, the unfortunate reality is it's kind of inescapable
00:28:36 ◼ ► I feel like in the last few years, Apple has been very clear that they are heading in a
00:28:47 ◼ ► That is where all of their energy seems to be heading in that direction and I think it's