Under the Radar

270: WWDC 2023


00:00:00   Welcome to Under the Radar, a show about independent iOS app development.

00:00:03   I'm Mark Orment.

00:00:04   And I'm David Smith. Under the Radar is usually not longer than 30 minutes.

00:00:08   And we say the usually because of days like today, special days where we have special guests and we have abilities to do things that are out of our ordinary.

00:00:15   So we are recording, I would say live, but we're not actually live, but we are recording from the Apple podcast studio at Apple Park at W3C 2023.

00:00:23   And even more importantly, we have some we have two guests with us today.

00:00:26   We have Josh Schaffer and we have Chris Thielen, who will be joining us to talk about the announcements, to talk about the things that we talked about.

00:00:35   I think in many ways, for me, while the morning keynote is exciting, the morning keynote is something that is really cool to see.

00:00:42   And I can watch it with my kids.

00:00:43   The afternoon platform State of the Union is where the real fun happens for me.

00:00:47   That's, you know, it's like have lunch, settle down.

00:00:49   And then that's where the real show starts.

00:00:50   And I would love to kind of get some context and some things about that platform State of the Union and kind of get the director's commentary of that.

00:00:56   And so I'm so glad to have you guys here to do that.

00:00:58   And it's just wonderful to have you.

00:01:00   So let's get started.

00:01:01   So let's get started. That's right.

00:01:03   I forgot to say it. So I always feel like at the beginning of the if you pay attention to the platform State of the Union and there's always a sense of there's a theme, there's something that you're trying to get across.

00:01:13   Last year, I would say it was the best way to make apps is with Swift and Swift UI.

00:01:18   That was the theme that I think was trying to be communicated last year.

00:01:21   And a phrase that came up several times this year was that the natural sort of the natural way to write it to write code is now the best or the safest way to write the code.

00:01:29   And that seemed to be the philosophy that you were trying to communicate this year.

00:01:32   And I was wondering if you could elaborate a bit on that philosophy or sort of approach.

00:01:37   Yeah, I mean, I think from the beginning of Swift UI, one of our key goals is that like we made the thing that you would naturally write be the right thing to write.

00:01:47   Swift UI aims to have a very succinct syntax where you would just describe the elements in your UI and doing it the way that was most natural would get you the right result.

00:01:57   And we certainly tried to extend that to Swift data this year where you'd naturally in Swift just write a bunch of types.

00:02:05   You'd write some classes and structs and unums and you want them to be persisted.

00:02:10   The way you wrote it should just naturally work for you and you shouldn't have to go and restructure your data in unnatural ways in order to get it to be persisted.

00:02:17   And I think that kind of philosophy has been following what we've been doing in this space now for a few years.

00:02:23   And I think it's been working really well.

00:02:25   And with Swift more broadly, I think even going back, was it nine years now?

00:02:29   With Swift UI and Swift data, I think you can kind of start to see the trajectory of what sort of the era of Swift frameworks looks like.

00:02:35   And that's absolutely one of the design principles.

00:02:38   Yeah. And I think too, it's something that I noticed is it speaks to the maturity of the platform that you're able to have a sense of what is the idiomatically best way to do something now.

00:02:49   In a way that maybe like eight years ago, that was still something that we collectively, like as the developer community and as the developer tools community are coming up with.

00:02:58   And it's like now things are mature to a place that it makes sense to have something like macros where you can replace our boilerplate code with something more idiomatic.

00:03:08   And because it knows what idiomatic, the correct thing is now.

00:03:12   Yeah. And I think if you look across the frameworks we've been doing over the last few years in Swift, there's some patterns that are emerging now of things like, you know, you create a struct that conforms to a protocol and then there's a bunch of standard methods that you implement.

00:03:25   So things like Swift UI has the body method.

00:03:28   Things like the app intense have a perform method and there's a bunch of structure around it.

00:03:34   And it feels very object oriented.

00:03:35   But most of these APIs in Swift are structured around structs, except where it makes sense.

00:03:40   Like in Swift data where your primary persisted objects are classes.

00:03:44   Sure. Yeah. And code first too.

00:03:46   I mean, with Swift data now, you don't have to go into the core data model editor is as great as it is.

00:03:51   I still love that model editor.

00:03:52   Yeah. You know, app intense is the same way.

00:03:54   There's this sort of code first approach now.

00:03:55   And I love that, by the way.

00:03:57   Like, you know, having previously used the former, you know, intent definition files and things like that, you know, those would then generate some code behind them.

00:04:04   And that process always was, I thought, a little bug prone and a little bit more difficult to get into and difficult to manage in certain areas.

00:04:12   And so moving things to code first and everything, you know, everything becomes easier to version, easier to merge, easier to work with.

00:04:19   And the tooling around it becomes much, much simpler and more reliable.

00:04:23   So I very much appreciate that.

00:04:25   I'm curious, you know, talking about macros in the sense that, you know, you have these two competing, you know, a pro and a con here.

00:04:33   The pro, as Josh mentioned a second ago, is like, you know, it's easier to write correct code.

00:04:39   And of course, we've all seen times when we're writing Swift UI and we're like, why isn't my view updating when this changes for some reason?

00:04:45   And you got to kind of dive through and figure out somewhere that you should have used a binding and said use a state or that you or somewhere you weren't updating the observable, you know, various protocols and triggers and things like that.

00:04:57   You know, with the new observable macro that is taking care of a lot of that for us.

00:05:02   And thank goodness for that.

00:05:05   But also, you know, as we look at what macros will enable, there's also large potential for hidden magic or hidden complexity that is non-obvious for the caller or, you know, at the call sites.

00:05:21   And so how do you manage the problems of having like hidden unexpected behavior happening versus the benefits of something like observable where you're taking away all these all this bug surface?

00:05:32   Yeah, I mean, that's a great point.

00:05:34   I think, you know, if anything, macros are actually designed to help us make that less magical and easier for developers to understand, because if you look at something like property wrappers, which we did a few years ago, they have a huge amount of power behind them.

00:05:47   And there's a ton of stuff that the community has done with these that that is really cool.

00:05:50   But the transform is mostly hidden.

00:05:52   You know, you you write a property wrapper on something and you can't really as a developer using it, see what happened.

00:05:59   You can maybe dive into the source code if you have it for the for the thing that to find the property wrapper, but you don't really have visibility.

00:06:04   And when we went to extend this further for things like, you know, the observable or at model macros, we considered going that route where they maybe have like a type wrapper instead of a property wrapper.

00:06:15   Bring it up and let you modify the type.

00:06:17   Sure. But the downside of doing that in the property wrapper style is that it would have been another set of hidden behavior that a developer wouldn't have insight into what was happening.

00:06:24   And so the really cool thing about at observable and at model is that there actually is no magic there.

00:06:29   And in Xcode, there's like a deep integration with the macro system where you can just right click on at observable and say, expand macro and see exactly what it does.

00:06:38   So the fact that it transforms some properties from stored properties into computed properties becomes immediately visible and evident.

00:06:45   Now, that same thing happens with the property wrappers.

00:06:48   It converts stored properties into computer properties, adds a backing property, but you can't see it.

00:06:53   So the really cool thing about about macros is that this kind of behavior is no longer magical.

00:06:57   You can actually see exactly what's happening, debug through it and fully understand it if you want.

00:07:02   If all you want to do is use it and you're not worried about how it works, you don't have to see that.

00:07:05   Like the complexity can stay hidden.

00:07:07   So it's a really great balance between ease of entry where a new developer just coming to the platform and trying to learn can know like, oh, I want to use my object with Swift UI.

00:07:16   Let me mark it at observable.

00:07:18   It's just going to work for me.

00:07:19   But as you get more advanced or if you really want to get into the details, you can go expand it and see what's happening.

00:07:23   And there's nothing that's fully hidden and obfuscated for me.

00:07:26   Yeah, I think there was a moment when Holly was doing the step into like debug.

00:07:31   I think there was an audibly gasped.

00:07:33   It was the like, how is that possible?

00:07:35   That is absolutely amazing.

00:07:36   It's like, oh, just add, add, what is it, add async to a thing and then just like and then just it was all there.

00:07:42   And it wasn't, it wasn't just magic that, oh, some there's something that's like, no, no, you can just in the debugger, you could debug it and you could work out.

00:07:49   Well, why isn't this continuation being called in the way that I'm expecting it to?

00:07:52   And you could just step through it and understand why that's happening.

00:07:55   Or even I could see as an educational tool, it's this really interesting opportunity for like progressive disclosure to that point of like, if you're new to the platform and you're trying to understand how async works, having the ability to step through the canonical sort of best way to do this in code is a great way to understand.

00:08:16   Like, why is, you know, how should you make up an async method?

00:08:19   And this is clearly, you know, Apple has come up with this macro is the canonical best place to start from.

00:08:26   Yeah.

00:08:26   And that progressive disclosure, I think, is one of the things that macros are a great example of and Swift has been trying to do the whole time of you don't have to know what a macro is.

00:08:34   You don't have to understand them to start using them.

00:08:37   Right.

00:08:37   If you just want to pick up Swift data and you're relatively new to the platform, it's pretty easy to just add app model to your class and understand the behaviors that you get.

00:08:44   But then, of course, if you want to dive deep, if you want to make your own, you can still do that.

00:08:47   And so that just balancing that ease of use with these more sophisticated features is, I think, a trick that's been pulled off time and time again.

00:08:54   Yeah.

00:08:54   And I think on in the way that sort of extending that into the way that this allows, I imagine on your side as the platform developers with, I think, of the new data flow changes in Swift UI or the least, I don't know if they're necessarily changes, but enhancements or sort of straight simplifications that I've, you know, in a non insignificant amount of time.

00:09:13   My last couple of years has been spent debugging issues where like, oh, I'm using the wrong.

00:09:17   It should have been a state object rather than a observable object, or it should have been a state.

00:09:22   A lot of those issues where if you get it right, it's fabulous.

00:09:27   But if you get it slightly wrong, then you can have really strange things, whether it's never updating or it's updating way more often than you think it should.

00:09:33   And it seems like you're able to, because you're controlling both ends of that, you're able to eliminate a whole host of issues that we're running into currently.

00:09:42   Because we don't know, we're not the ones writing the observable class in the same way.

00:09:45   We're just we just add a macro to it.

00:09:47   And then you can take advantage of the fact that you know how it should behave because you wrote the macro.

00:09:52   Yeah.

00:09:53   I mean, I think this is one of the things that we've learned over the last few years, both observing how people are using it in the community and using it ourselves more is the observable integration for observable object was a source of, you know, challenge for people doing some adoption.

00:10:06   And so it was clearly one of the things that we were most excited about trying to address here.

00:10:11   And I think the removal of all the need to add the property wrappers, the automatic focusing on only invalidating for object or properties that you actually read are going to address a huge swath of the issues that people have been encountering in that space.

00:10:27   You won't end up with, "Oh, I inadvertently didn't mark something had observed object." And you won't end up with extra invalidation for things that didn't actually contribute to this body.

00:10:37   Yeah.

00:10:38   That contorted people's data models, too.

00:10:40   I mean, to handle these sort of performance issues, people would have to break up their data models in unnatural ways just to get the view and validation right, which no one wants to have to do.

00:10:47   Yes.

00:10:47   And observable.

00:10:48   Yeah, back to our previous statement about like the natural thing to write is the correct thing to write. Like you shouldn't have to contort your data model in order to appease the framework. You should be able to write it the way that is most natural.

00:10:57   Well, there's a huge benefit, too, in learning and education of, you know, learning how to code in SwiftUI because, you know, SwiftUI, for all of the clean code that we see up front on presentation slides and stuff, some of the concepts there are very advanced.

00:11:11   And for a beginner programmer, heck, even for an experienced programmer, a lot of this stuff can be very tricky to get right because there is so much really advanced abstraction and programming concepts going on, you know, below the surface.

00:11:23   And what I like about the new observable system is like the little details of like, I'll tell you, I'll be honest, I just learned about state object like two weeks ago.

00:11:31   And I've been using it wrong.

00:11:34   I've been using certain things wrong and didn't know about that.

00:11:37   Like there's so many little subtle differences in some in like what's the right one of these things to use.

00:11:42   So the more you can keep that on your end and the tooling end and let people just write what comes naturally to us and we don't even have to know about those differences.

00:11:52   Like the more of that you can do the better because not everyone is going to be a super expert in all these little little detailed areas of this.

00:11:58   Yeah, totally. I mean, we were very excited to write the slides that went from like, here's five things that here's two because it seems like a kind of silly slide transition.

00:12:05   But it's a big deal.

00:12:06   Everyone loves the slides where the names go away.

00:12:08   Exactly.

00:12:08   Because deleting code is the most satisfying thing.

00:12:11   Very satisfying.

00:12:12   Can you talk a little bit to the backwards compatibility aspect of those kinds of things in terms of one of the things that I found challenging over the years, maybe with SwiftUI is it has been something that has evolved.

00:12:23   It is something that which is wonderful in the sense of it is getting tremendously better as time is moving on.

00:12:29   But it is definitely every year there is certainly changes and there are wonderful steps forward but it sometimes can be difficult then to if you still are deploying something back to iOS 14 or 15 or 16.

00:12:39   In terms of with this kind of the new observable system and these kind of things, can you talk a bit to kind of what we should expect there and sort of our philosophy as we're adopting these new things?

00:12:49   Look, it's been a long running philosophy that we have an SDK and we have a set of APIs and you deploy them.

00:12:57   And totally get that does mean that when you go to back deploy the new things that we just introduced might require a little while before you can use them.

00:13:05   But I think there's a few things there.

00:13:07   One, the adoption rate of this stuff in our community and the population of iOS users is incredibly fast.

00:13:15   So people can start using these things pretty quickly without losing much deployment audience.

00:13:22   Right.

00:13:23   I think we just published 81% of adoption for iOS 16 and then 90% if you look at devices that were introduced in the last four years.

00:13:31   Right.

00:13:32   So users are aggressively adopting the latest.

00:13:35   And so I think developers, I certainly understand the desire to maintain sort of this compatibility that where you're kind of climbing the exponential curve of how old can I go.

00:13:47   But I'm not sure that you buy that much by going back say three years.

00:13:51   Sure.

00:13:51   But that's probably a hot debate in the developer communities to what to set that min deploy target to.

00:13:55   No, you're pretty much right.

00:13:56   It's mostly like our bosses tell us you have to support iOS 9 or whatever and we're you know but we want to push it to 17.

00:14:03   That's that's mostly I think what we mostly hear.

00:14:05   I think you know for the point zero zero zero zero zero zero zero one percent of people out there with iOS 9 you know it's probably they appreciate it.

00:14:11   Yeah.

00:14:11   So one difference though with you know with back compatibility obviously some of the new library functions are going to be 17 and up only.

00:14:20   But is it safe to assume that macros are more of a tooling version issue and that you can use macros to generate code that works on older versions.

00:14:27   Yeah.

00:14:27   So I mean it does depend a little on what the macro generates obviously.

00:14:30   But if a macro is going to generate something that did exist before you can write a macro that supports back deployment.

00:14:36   It's just that like what you generate must obviously be available on the target.

00:14:40   Sure.

00:14:40   But that is because it's being integrated so deeply into the actual compilation process that it is.

00:14:45   It's not a it's not a iOS feature so much as it is a tool chain feature that you'd like if you had do the add async thing anywhere that would support Swift async should be able to then run that code and it would work just as you would expect.

00:14:57   Yeah the macros themselves are defined in Swift and the written in Swift and they run at the Swift compilation time and then generate new code.

00:15:06   And so they basically can transform the code that they're applied to.

00:15:09   But yeah the what they generate then is pretty flexible.

00:15:14   Like you can do some pretty complicated things in them.

00:15:16   Yeah.

00:15:17   And it seems I think that's one of those things that I saw that it's like this is in some ways I'm glad that you did it in that way.

00:15:22   And taking that approach because it does make that so much an easier story for us with backwards compatibility and those kinds of issues because it's as long as the code that I end up with is the code that I was could have would have written in myself and it would have worked if I needed to support iOS 15.

00:15:36   Then I'm great.

00:15:37   I don't.

00:15:37   It's not a problem.

00:15:38   I'm not taking it's not.

00:15:40   You didn't build it into iOS 17.

00:15:42   You built it as a tool for us to be more efficient and more correct in our work.

00:15:46   Yeah absolutely.

00:15:46   And macros can be defined in packages as well so that they can be shared and deployed with others who want to use your tools as well.

00:15:55   Yeah.

00:15:55   Yeah you know we didn't look to you know the C preprocessor for too much inspiration on macros but that is one of the ones where it's completely on your code.

00:16:03   So by the time you actually have that binary you don't have to worry about it.

00:16:05   Yeah and actually to that point like they're very different than the C preprocessor in a lot of ways.

00:16:10   But one key one is that your code has to compile and fully type check before the macro is applied.

00:16:16   Sure.

00:16:17   So you don't end up in a place where somebody is going to maybe define a macro that results in your code looking super weird and not even syntactically accurate and swift.

00:16:24   Like it has to be syntactically valid code before the macro is actually expanded.

00:16:29   Which keeps code looking more natural and standard.

00:16:32   I mean the fact that some of the like the fact that macros can generate sort of it seems like sort of custom errors and warnings and things is also just.

00:16:40   And fix it.

00:16:40   It's genius to be able to be able to integrate into the actual development process itself.

00:16:46   It's not just something that is being used and then like you write it and then it only happens in compilation.

00:16:52   It's like you know it can be helping you while you're writing it if you're using the macro wrong it can tell you hey it seems like you're using this wrong which is amazing.

00:16:58   Yeah absolutely.

00:16:59   Yeah right.

00:17:00   Fix it.

00:17:01   You know quick help.

00:17:01   I mean these are these are components of people's API so they have full support for sort of all those features that you would expect.

00:17:07   Yeah.

00:17:08   This episode of Under The Radar is brought to you by Indeed.

00:17:10   What's a game where no one wins?

00:17:12   The waiting game.

00:17:13   When it comes to hiring don't wait for great talent to find you.

00:17:16   Find them first with Indeed.

00:17:18   When you're hiring you need Indeed.

00:17:21   Indeed is the hiring platform where you can attract, interview and hire all in one place.

00:17:25   Instead of spending hours on multiple job sites searching for candidates with just the right skills you can use their powerful hiring platform that can help you do it all.

00:17:33   Indeed streamlines hiring with powerful tools that find you matched candidates.

00:17:38   With instant match over 80 percent of employers get quality candidates whose resume on Indeed matches their job description the moment they sponsor a job.

00:17:45   According to Indeed data US Indeed's hiring platform really is great because it matches you with quality candidates instantly.

00:17:53   Even better Indeed is the only job site where you only pay for applications that meet your must have requirements.

00:17:59   Making it an unbelievably powerful hiring platform delivering four times more hires than all other job sites combined according to Talent Nest 2019.

00:18:08   Join more than three million businesses worldwide that use Indeed to hire great talent fast.

00:18:14   Start hiring now with a $75 sponsored job credit to upgrade your job post at Indeed.com/undertheradar.

00:18:21   Offer good for a limited time.

00:18:23   Claim your $75 credit now at Indeed.com/undertheradar.

00:18:27   That's Indeed I N D E E D dot com slash under the radar to support the show by saying you heard about it on this podcast.

00:18:35   Terms and conditions apply.

00:18:36   Need to hire? You need Indeed.

00:18:38   Our thanks to Indeed for their support of this show and Relay FM.

00:18:41   Swift data.

00:18:43   Amazing.

00:18:45   First of all let me be the one to say finally.

00:18:47   Also thank you for sure locking the library I spent the last six months writing.

00:18:53   So I'm I'm curious on a lot of the you know obviously macros were key to making Swift data possible the way the way it is written.

00:19:01   So this you know the timing of it makes sense.

00:19:03   What's the story with Swift data?

00:19:05   Should we all start using it now?

00:19:06   Is this like a 1.0 that we should kind of wait on or you know because obviously it's backed by core data and built upon core data in so many ways.

00:19:13   Where do you see it fitting in?

00:19:16   Is this like the new default that everyone should be using?

00:19:18   I think it's a really great default.

00:19:21   It follows a long line of technologies in this space core data being the most recent and builds upon the infrastructure of core data uses the persistence back end of core data.

00:19:31   So you know the storage to SQL is well tested and well used.

00:19:36   It's very understood and reliable.

00:19:39   So yeah I think it's a much more natural Swift interface on something that is very well understood and well trusted.

00:19:47   What's the what are your guidelines around concurrency with it?

00:19:51   I see there are some actor classes for it but documentation is a little thin right now.

00:19:54   How do you see the role of Swift data with managing concurrency?

00:19:58   Yeah so Swift data is certainly designed to integrate really well with Swift concurrency.

00:20:03   If you looked at how core data worked conceptually a managed object context was an actor and you would enqueue operations on it.

00:20:13   Like you could ask it to perform a closure.

00:20:17   We kind of inverted that with Swift data and the object context is not itself an actor but it is actor bound.

00:20:25   So if you have a main object context for your views on the main queue or the main actor you can you know you've got a set of objects and object graph out of that object context that you can operate on on the main actor.

00:20:36   But if you have another actor where you're maybe doing some networking or data processing or something you can have another separate object context in that actor with its own object graph.

00:20:46   And you know in that isolation domain you can have a separate graph mutate it and save and they'll all merge on the back end.

00:20:53   But yeah so one object context per actor and then then you merge them when you save.

00:20:58   And it seems to like Swift data is just one of these things where it's it's in the same way that it creates this very natural syntax for an operation that is very common.

00:21:08   That it is a very natural thing that you're going to create objects and then you need to get them back later is a very natural thing rather than having to.

00:21:17   But it's interesting for me to be doing it totally in Swift that it isn't like you're saying there's it's not an object editor it's not a it's not a database like behind the scenes deep down there's dark magic make turning it into a database.

00:21:29   But it's from my perspective this is just Swift like I'm just the fact that it happens to be persistible and it happens to be able to come back and be queerable and all the things that are very like the really cool aspects of it functionally.

00:21:42   But from the developers perspective they're just Swift classes and structs and hot properties and things that I'm working with normally.

00:21:49   And it's the ability to just you're adding macro to it and a couple of other things in your environment to set it up and then it then it's persistible.

00:21:58   It's just that I think making it so native is just such a wonderful aspect of this to me.

00:22:02   Even down at the predicates.

00:22:04   I don't know if you had a chance to look at that but the predicates are in Swift now and they're fully type checked.

00:22:08   It's quite nice.

00:22:10   Yeah.

00:22:10   And that kind of thing was where it's by making it then because you know the tooling can help me make sure that I'm doing it right.

00:22:17   That I'm not in core data you would sometimes run into the issue where well if you might ref if you misspelled a you know a column name in your predicate you wouldn't you would just get no.

00:22:28   Oh well you get no data back or you get a weird error at runtime or things like that in a way that you just you wouldn't know because well the schema was defined in a different file than the Objective C version that was using it.

00:22:39   And you're just like you just hope for the best and eventually it works.

00:22:41   But this is like first class just part of Swift itself.

00:22:45   Yeah and I mean you know the point we talked about earlier like we really wanted it to be natural that what you would have written in Swift normally is what you would write here and we just give you persistence of it.

00:22:54   And just being able to model your types the way you normally would is a really key part of that.

00:22:59   And so things that are just natural and Swift like unums with associated values you shouldn't have to think about the fact that OK there's a database on the back end that I'm trying to write into it just works.

00:23:08   And so yeah that was really a key part.

00:23:11   Another thing in the early days that we spent a lot of time talking about was kind of a minimal edit distance between an early prototype where you were just doing some in-memory prototyping with maybe some objects in that state and turning it into a persisted object.

00:23:25   And so like the demo that we did in State of the Union showed going from at state with some default data to an at query.

00:23:34   And that's an example of where we were trying to get to like what you would have written naturally if you were just prototyping something can be easily transformed with like the smallest number of edits into now a truly persisted real thing.

00:23:45   Yeah and I think it's the magic is because they're both just natural Swift things that you have the translation between those two things.

00:23:52   They aren't.

00:23:53   Oh now I'm using a database.

00:23:54   I need to write a whole new model layer.

00:23:56   I need to do a whole new thing.

00:23:58   It's like they're the same as if you in your prototyping phase if you just throw together some structs to hold some example data.

00:24:04   Well those same structs you just need to annotate in a slightly different way to make sure that they're appropriate to be stored and they are stored.

00:24:11   I think that that that step yeah between it we don't have to keep rewriting what we're doing based on the context it's all just the same basic model you model your domain in Swift is like using the sort of the things you would normally do and then model your UI based on the states that

00:24:27   that data projects and you're you're good to go.

00:24:30   Yeah totally.

00:24:31   And if you have relationships between two objects like you probably shouldn't have to learn about foreign keys and everything in order to do that in Swift.

00:24:36   And yeah we it just works like you don't even have to write at relationship we detect the relationships.

00:24:41   Sure.

00:24:41   And it all just happens.

00:24:44   So there's been a lot of I don't know I don't know Dave if you are familiar with the widget system.

00:24:49   I have some passing familiarity with widgets.

00:24:52   That is that is definitely something that I I have some familiarity with.

00:24:55   There's been quite a lot of movement there this year to put it lightly one area that that I think we're all very excited to see that I frankly I was not expecting even though a lot of people were is interactive widgets and.

00:25:08   You know the the reason I wasn't expecting this is because the you know the structure of how that's run where your process is not just continually running in the background and you know you're being woken up for timeline updates every so often or whatever.

00:25:21   That didn't seem like it was possible to to combine that with an activity in any way that we that we knew it and what you delivered is this app intent based system where you can have buttons and things that trigger app intense to presumably wake up the background process of the app and or the extension and have it do things I'm wondering is the intention here for this to be kind of like real time interaction when someone is interacting with it like or is it more kind of like.

00:25:47   Set it and forget it like you check off that box and then you go away and the app learns you know hopefully within a short amount of time but like is the app expected to respond in real time or is it more just like we're going to modify the state variable and in the UI and kind of you know a sync tell the app like is this meant for real time interaction.

00:26:04   Yeah it's absolutely meant for real time interaction I mean some of the examples that you saw like checking off reminders or turning on your lights with home kit there I guess maybe you get away with the reminders when not being real time but the home get one absolutely not like they really are meant to be live and interactive and quick to respond and they do.

00:26:21   I don't know if you try to get but the speed of interaction is pretty great you check off a reminder and you're going to see the number update and it'll animate out it's pretty cool and the animations really make it feel lively in a way that is really just pretty great.

00:26:37   One thing that I was a little surprised to hear but when I thought about it kind of broke my brain it might make some sense is it seems like you're now encouraging us to create reusable components that fire off app intense as the interaction model and actually use those in our regular app UIs kind of using the app intent system as almost like a like an action trigger system is that did I understand that correctly.

00:26:59   So you definitely the API that we added to trigger app intense from buttons and toggles is was designed for widgets is the reason we added it so we can enable this but it's also available in regular Swift UI apps so if you already have app intense that perform the actions that you want that's actually you know a lower overhead way then to go set up your UI as well and it then will pay potentially dividends in other ways because if you've created your app intent for some action it can now be available in the shortcuts app so you can set up shortcuts based on it can be exposed to Siri.

00:27:28   So there's a bunch of value that you get out of you know wrapping your functionality in an app intent that now makes it available in these different places.

00:27:35   It's not the only way to do it like the regular you know closure initializers a button in the binding for toggle are available and great they're very low friction ways to do stuff but you know wrapping it up in an app intent gives you some extra flexibility to use it in other ways.

00:27:51   Yeah I think with widgets I mean I would say it's like I'm I've been using widgets since they since since they began it's been a huge part of my life and career at this point and I think what has been fascinating to me is to watch how there is some like the architecture of widgets where being able to archive a Swift UI view in a way that means that my code can exist in a place that is very.

00:28:14   Very fundamentally important to the device that like I can my code is running on you know on the main home screen of a user's phone and to do that in a way that is safe reliable performance and it seems like it's all coming from that sense of Swift UI's.

00:28:27   Are you sort of declarative architecture that you can archive something that you can do it and then yeah it's a fascinating thing for me is how that then extends to being able to you can send that archive across over to a Mac you can in the case of the interactive widgets aspect that you're just updating the archive rather than running my app.

00:28:44   You're just I'll just ask my app for another archive and get it back and it seems like a really beautiful extension of the just that the way that you originally structured it to be able to do this these kind of operations without having to tell me oh we're doing interactive widgets.

00:28:57   You have to build this whole new thing in this whole new way it's just an extension of the same existing and an initial widget system that we had from the start.

00:29:07   Yeah I mean there's a ton of cool stuff we've been able to do with this the fact that now you can add interactivity the timelines and widgets give you a flexibility to like without having to rerun your code have you know a large amount of updated data throughout the day so if you have like a calendar or something can be updating without the extension having to run again.

00:29:25   And then yeah the fact that we can encapsulate this thing and send it over the network really extends the power of what we can do with this stuff in a pretty cool way.

00:29:32   Yeah the idea of you that you can kind of beam your widget state from the iPhone to a Mac without there being a companion app on the Mac installed that that was one that was one of those head blowing moments for me during the during the keynote as well.

00:29:44   I hope that works as well as as as I want it to.

00:29:48   It's very cool and the interaction and interactivity and animations all work in that environment too so if you have your interactive widget and you tap it on the Mac message gets sent back to the phone operation happens UI updates and it's all just seamless.

00:30:00   It's very cool.

00:30:01   And to the animation point in terms of it seems like those are animated in the same way that I would expect sort of animations to happen within a SwiftUI app as I was doing it in the sense of it's just you have the value before and the value after and it's diffing the view tree and just changing things between it rather than it's not just oh you can in say like last year with in live activities there were a couple of kind of animatable things you could do when you were changing numbers in labels.

00:30:26   It's like no this is seems the full on we can do SwiftUI animation between different and between different states and it's doing all the things you would logically expect of if you move a control from one corner to the other while it will animate smoothly between those two places.

00:30:38   Yeah we maintain the view identity in the archives so that as you go from archive to archive we match them up and can do the kinds of transition animations you'd expect where something slides around or scales or any of that.

00:30:48   And there's also these content animations which is sort of what you mentioned from live activities but they're also very cool where you can do things like if you have a number that might increment or decrement like the count of your of your completed reminders when it changes you can have it like do this really cool like slide up down transition animation.

00:31:06   There's some really very well designed animations in there.

00:31:11   And as someone who spends my entire life working on widget timelines I got to say just as a thank you to you to you to everyone who worked to make the new Xcode previews system for widgets.

00:31:22   That's nice.

00:31:22   That is incredible.

00:31:24   Like it is like absolutely life changing for someone who spends my life making widget timelines to now be able to see my timeline as it's going to be rendered to interact with them to even animate between those various timeline entries.

00:31:38   Like that was one of those things where it is lovely for me to see the obviously there's enough widgets are in a lot of places but they're also in the tools.

00:31:46   It isn't just a user facing feature it is also a developer focused biggest focus feature to make our life better and to make it easier for us to make good widgets.

00:31:53   And so like I think as someone who's I guess just straight up thank you.

00:31:57   Like it's just like amazing.

00:31:58   We'll let the team know.

00:31:58   Yeah.

00:31:59   Because that one is huge right like the new pound preview syntax is for widgets but for everything else it's just a much lighter way to get into previews which is super cool.

00:32:08   But for the widgets in particular we really wanted to make it a first class experience in previews because it is less convenient than testing an app to test the widget.

00:32:17   You have to go put it somewhere.

00:32:18   If you want to see the timeline you have to figure out how to get it to update while you're trying to test it.

00:32:22   Being able to just see it splayed out and quickly move between it I think is going to make previews like by far the best way to develop and test widgets.

00:32:30   Yeah we're pretty excited about what we did there.

00:32:32   Oh sure.

00:32:33   Because I say previews are just a fundamental change I find to the philosophy you take as you're developing because it becomes it's so easy to iterate to change.

00:32:43   Well what happens if I change this.

00:32:45   What happens if I change this and I can progressively add complexity in a way that is interactive.

00:32:50   I know if I made a mistake it's not something where you know there's this long build and run cycle that I have to do between every operation.

00:32:57   Instead it is a situation where I can make small changes see what they do and then just keep iterating on it.

00:33:02   I feel like that changes the philosophy of how you are as a developer to be able to work incredibly quickly and with that sense of the code isn't getting in your way.

00:33:14   It's very much it's the tooling is encouraging you to write and if you do it the right way using the doing things the Swift and Swift UI way everything just works.

00:33:23   Yeah and app kit and UI kit.

00:33:26   Oh sure.

00:33:26   I love that you just slipped that in there.

00:33:28   Like it was like two words.

00:33:29   You can also use app kit.

00:33:30   What?

00:33:31   Well it's funny because.

00:33:33   You can click that manus button in there.

00:33:34   I mean it's actually always been possible to do previews of your UI kit and app kit content but I think it wasn't front of mind for people because you would have to have created a UI view or NSV representable and then set up the Swift UI preview for your UI kit or app kit content.

00:33:46   But it is a great way to develop your UI kit and app kit views.

00:33:52   I mean if you were debugging your auto layout constraints and trying to change some things like making a change building and running seeing how it worked is a pretty high overhead way to do that.

00:34:01   Being able to just go and like edit your constraints and see the results right there is really great.

00:34:06   Yeah it's you know yet more areas where you've moved what used to be like custom configuration files in this case you know zibs and Xcode like moved from that to a code focused world in more ways throughout the tooling and everything.

00:34:18   Yeah I'm a huge fan of that and it's.

00:34:20   And I also I appreciate that you know a lot of times when new technologies come out at dub dub we think oh wow this will be great until we you know once we can start requiring it and that's everyone that's a little bit different as we talked about earlier.

00:34:31   But another thing is like oh this will be great if I was rewriting my entire app from scratch but I'm not right and I like that with Swift UI you've maintained a lot of interop between Swift UI UI kit app kit you know that that we don't have to go all in on Swift UI and that and I really appreciate that.

00:34:50   And I think all of us all of us do.

00:34:52   Yeah I mean not not only have we maintained a lot of interop we're continuing to invest in the interop.

00:34:56   You may not have seen it yet if you haven't gone deep in it but this year we added really first class bridging between environment and trade collections.

00:35:03   So UI kit trade collections were now expanded this year to have support for custom traits so you can define your own.

00:35:09   But we also added full bridging between the Swift UI environment and the UI kit trade collection so if you have the same trait and environment that map one to one you can connect them together and access the value across the boundary on either side through either API and they're fully bridged.

00:35:25   And it's really it's a great way to move data between UI kit and Swift UI.

00:35:30   But you know like they said in platform state of the union you know these are the same tools and frameworks and libraries that we use ourselves right.

00:35:37   And so we have you know there's a lot of code written in app kit there's a lot of code written UI kit so that interop story is something that we invest in not just for the developer community but for ourselves as well because that's the realistic path to adopting Swift UI for a lot of folks.

00:35:50   Oh sure.

00:35:50   I mean I think it's one of those things that it makes it easier as a developer to invest our time energy and effort into Swift UI and having that be the path that we take forward because clearly it's like every platform that Apple makes.

00:36:05   Swift UI is the like is the primary thing and it's kind of amazing at the beginning you had you talked about where it's you know it's like it can be you start the code in your widget and then you put it into your watch app and you put it from your watch app into your main app.

00:36:16   And it's like now that same thing can go it's like everywhere.

00:36:20   And I think there is something that code first and it's even the same code in multiple places first.

00:36:35   And it will express itself appropriately on iPad OS or anywhere that that's that you're doing that work for us rather than us having to write our app four times we're doing it just the one time and then you're doing the sort of the hard work on the back end to make that actually something that can work and be appropriate.

00:36:50   Right right.

00:36:51   I mean you know Mac apps iPad apps iPhone apps they're different but there's a lot of commonality you know and so it's nice to be able to leverage the same API as whether it's commonality.

00:37:00   Yeah and I think in a bit and it's been it speaks to just yeah it's like I think so much it's the I appreciate you're sort of getting back to the overall theme of this year of the sense of like you know like that the best is that the natural way to write something is also the correct and best way is it's like that natural way is now applies in so many more contexts and applies in the same way that it's nice that the way that you define a widget is the same as it was before and it's a very natural natural syntax.

00:37:26   You know you want to make it interactive well you just had an app intent to the button in then it happens and I think there is something very powerful in that philosophy that you guys have taken that it seems very like it's easy to get started it's easy to learn and then as you get more more mature and as a developer in your developer career all those skills transferred forward with you that you're not having to oh now you're an advanced developer now you need this then you need you can take off the training wheels and then you'll use the real thing it's like no no Swift data is the same thing that you would use.

00:37:56   In some super complicated thing is this versus if it's the you know the first time you're ever building a hello world application and you're just trying to learn how to how to model anything.

00:38:06   And I think it's it helps to you know for people like us you know our audience and the two of us with a lot of us who are very small teams one person two people you know and it helps a lot that.

00:38:17   We are able as individual developers are a small teams to make first class apps that look as good or and work as well as apps that are made by giant companies that have thousands of engineers and a lot of that is due to these factors of pushing more stuff to code making things more reusable.

00:38:34   The surface area that our apps are expected to cover by modern consumers is huge we have all these different platforms we have all these different areas within each platform that our apps might have some surface area to appear to integrate.

00:38:46   We need these kind of productivity multiplying tools and techniques and so we very much appreciate that.

00:38:52   Yeah and I think that's probably a good place to wrap up our time was a timer flashing letting us know that we are very close to the end.

00:38:58   I just wanted to say thank you so much for joining us and to talk about this it's think it's I've been coming to think Mark when I both started coming to WBC in 2009 like we've been doing this a long time and this is this year feels very special it feels both in terms of the things that were announced the.

00:39:15   Feeling of all being back together in a way that last year had a slightly tentative feel this year is the opposite this is the community is back together people are excited in a way that they can express to each other and I think it's been a very cool year and it's been very fortunate to be able to have been part of it and so it's very exciting and I'm sure you know hopefully you guys can now rest and relax slightly after I'm sure it's been a tremendous amount of efforts to clearly to get it bring these tools in this event to this level into this point.

00:39:43   There's nothing like the Monday of dubbed up share it's a great feeling it is and thanks for having us is great chat thank you thank you Josh and Chris will have so much more to talk about obviously this is a big event we're going to cover Apple vision pro and vision os and everything else at dub dub in future episodes so thank you everybody for listening and we'll talk to you in 2 weeks.

00:40:00   Bye.

00:40:01   Thank you very much.