0:00:00Welcome to Under the Radar, a show about independent iOS app development.
0:00:03I'm Mark Orment.
0:00:04And I'm David Smith. Under the Radar is usually not longer than 30 minutes.
0:00:08And 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.
0:00:15So 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.
0:00:23And even more importantly, we have some we have two guests with us today.
0:00:26We 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.
0:00:35I think in many ways, for me, while the morning keynote is exciting, the morning keynote is something that is really cool to see.
0:00:42And I can watch it with my kids.
0:00:43The afternoon platform State of the Union is where the real fun happens for me.
0:00:47That's, you know, it's like have lunch, settle down.
0:00:49And then that's where the real show starts.
0:00:50And 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.
0:00:56And so I'm so glad to have you guys here to do that.
0:00:58And it's just wonderful to have you.
0:01:00So let's get started.
0:01:01So let's get started. That's right.
0:01:03I 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.
0:01:13Last year, I would say it was the best way to make apps is with Swift and Swift UI.
0:01:18That was the theme that I think was trying to be communicated last year.
0:01:21And 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.
0:01:29And that seemed to be the philosophy that you were trying to communicate this year.
0:01:32And I was wondering if you could elaborate a bit on that philosophy or sort of approach.
0:01:37Yeah, 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.
0:01:47Swift 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.
0:01:57And we certainly tried to extend that to Swift data this year where you'd naturally in Swift just write a bunch of types.
0:02:05You'd write some classes and structs and unums and you want them to be persisted.
0:02:10The 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.
0:02:17And I think that kind of philosophy has been following what we've been doing in this space now for a few years.
0:02:23And I think it's been working really well.
0:02:25And with Swift more broadly, I think even going back, was it nine years now?
0:02:29With 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.
0:02:35And that's absolutely one of the design principles.
0:02:38Yeah. 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.
0:02:49In 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.
0:02:58And 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.
0:03:08And because it knows what idiomatic, the correct thing is now.
0:03:12Yeah. 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.
0:03:25So things like Swift UI has the body method.
0:03:28Things like the app intense have a perform method and there's a bunch of structure around it.
0:03:34And it feels very object oriented.
0:03:35But most of these APIs in Swift are structured around structs, except where it makes sense.
0:03:40Like in Swift data where your primary persisted objects are classes.
0:03:44Sure. Yeah. And code first too.
0:03:46I mean, with Swift data now, you don't have to go into the core data model editor is as great as it is.
0:03:51I still love that model editor.
0:03:52Yeah. You know, app intense is the same way.
0:03:54There's this sort of code first approach now.
0:03:55And I love that, by the way.
0:03:57Like, 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.
0:04:04And 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.
0:04:12And so moving things to code first and everything, you know, everything becomes easier to version, easier to merge, easier to work with.
0:04:19And the tooling around it becomes much, much simpler and more reliable.
0:04:23So I very much appreciate that.
0:04:25I'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.
0:04:33The pro, as Josh mentioned a second ago, is like, you know, it's easier to write correct code.
0:04:39And 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?
0:04:45And 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.
0:04:57You know, with the new observable macro that is taking care of a lot of that for us.
0:05:02And thank goodness for that.
0:05:05But 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.
0:05:21And 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?
0:05:32Yeah, I mean, that's a great point.
0:05:34I 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.
0:05:47And there's a ton of stuff that the community has done with these that that is really cool.
0:05:50But the transform is mostly hidden.
0:05:52You know, you you write a property wrapper on something and you can't really as a developer using it, see what happened.
0:05:59You 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.
0:06:04And 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.
0:06:15Bring it up and let you modify the type.
0:06:17Sure. 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.
0:06:24And so the really cool thing about at observable and at model is that there actually is no magic there.
0:06:29And 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.
0:06:38So the fact that it transforms some properties from stored properties into computed properties becomes immediately visible and evident.
0:06:45Now, that same thing happens with the property wrappers.
0:06:48It converts stored properties into computer properties, adds a backing property, but you can't see it.
0:06:53So the really cool thing about about macros is that this kind of behavior is no longer magical.
0:06:57You can actually see exactly what's happening, debug through it and fully understand it if you want.
0:07:02If all you want to do is use it and you're not worried about how it works, you don't have to see that.
0:07:05Like the complexity can stay hidden.
0:07:07So 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.
0:07:16Let me mark it at observable.
0:07:18It's just going to work for me.
0:07:19But 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.
0:07:23And there's nothing that's fully hidden and obfuscated for me.
0:07:26Yeah, I think there was a moment when Holly was doing the step into like debug.
0:07:31I think there was an audibly gasped.
0:07:33It was the like, how is that possible?
0:07:35That is absolutely amazing.
0:07:36It'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.
0:07:42And 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.
0:07:49Well, why isn't this continuation being called in the way that I'm expecting it to?
0:07:52And you could just step through it and understand why that's happening.
0:07:55Or 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.
0:08:16Like, why is, you know, how should you make up an async method?
0:08:19And this is clearly, you know, Apple has come up with this macro is the canonical best place to start from.
0:08:26Yeah.
0:08:26And 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.
0:08:34You don't have to understand them to start using them.
0:08:37Right.
0:08:37If 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.
0:08:44But then, of course, if you want to dive deep, if you want to make your own, you can still do that.
0:08:47And 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.
0:08:54Yeah.
0:08:54And 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.
0:09:13My last couple of years has been spent debugging issues where like, oh, I'm using the wrong.
0:09:17It should have been a state object rather than a observable object, or it should have been a state.
0:09:22A lot of those issues where if you get it right, it's fabulous.
0:09:27But 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.
0:09:33And 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.
0:09:42Because we don't know, we're not the ones writing the observable class in the same way.
0:09:45We're just we just add a macro to it.
0:09:47And then you can take advantage of the fact that you know how it should behave because you wrote the macro.
0:09:52Yeah.
0:09:53I 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.
0:10:06And so it was clearly one of the things that we were most excited about trying to address here.
0:10:11And 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.
0:10:27You 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.
0:10:37Yeah.
0:10:38That contorted people's data models, too.
0:10:40I 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.
0:10:47Yes.
0:10:47And observable.
0:10:48Yeah, 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.
0:10:57Well, 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.
0:11:11And 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.
0:11:23And 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.
0:11:31And I've been using it wrong.
0:11:34I've been using certain things wrong and didn't know about that.
0:11:37Like there's so many little subtle differences in some in like what's the right one of these things to use.
0:11:42So 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.
0:11:52Like 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.
0:11:58Yeah, 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.
0:12:05But it's a big deal.
0:12:06Everyone loves the slides where the names go away.
0:12:08Exactly.
0:12:08Because deleting code is the most satisfying thing.
0:12:11Very satisfying.
0:12:12Can 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.
0:12:23It is something that which is wonderful in the sense of it is getting tremendously better as time is moving on.
0:12:29But 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.
0:12:39In 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?
0:12:49Look, it's been a long running philosophy that we have an SDK and we have a set of APIs and you deploy them.
0:12:57And 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.
0:13:05But I think there's a few things there.
0:13:07One, the adoption rate of this stuff in our community and the population of iOS users is incredibly fast.
0:13:15So people can start using these things pretty quickly without losing much deployment audience.
0:13:22Right.
0:13:23I 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.
0:13:31Right.
0:13:32So users are aggressively adopting the latest.
0:13:35And 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.
0:13:47But I'm not sure that you buy that much by going back say three years.
0:13:51Sure.
0:13:51But that's probably a hot debate in the developer communities to what to set that min deploy target to.
0:13:55No, you're pretty much right.
0:13:56It'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.
0:14:03That's that's mostly I think what we mostly hear.
0:14:05I 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.
0:14:11Yeah.
0:14:11So one difference though with you know with back compatibility obviously some of the new library functions are going to be 17 and up only.
0:14:20But 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.
0:14:27Yeah.
0:14:27So I mean it does depend a little on what the macro generates obviously.
0:14:30But if a macro is going to generate something that did exist before you can write a macro that supports back deployment.
0:14:36It's just that like what you generate must obviously be available on the target.
0:14:40Sure.
0:14:40But that is because it's being integrated so deeply into the actual compilation process that it is.
0:14:45It'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.
0:14:57Yeah 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.
0:15:06And so they basically can transform the code that they're applied to.
0:15:09But yeah the what they generate then is pretty flexible.
0:15:14Like you can do some pretty complicated things in them.
0:15:16Yeah.
0:15:17And 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.
0:15:22And 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.
0:15:36Then I'm great.
0:15:37I don't.
0:15:37It's not a problem.
0:15:38I'm not taking it's not.
0:15:40You didn't build it into iOS 17.
0:15:42You built it as a tool for us to be more efficient and more correct in our work.
0:15:46Yeah absolutely.
0:15:46And 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.
0:15:55Yeah.
0:15:55Yeah 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.
0:16:03So by the time you actually have that binary you don't have to worry about it.
0:16:05Yeah and actually to that point like they're very different than the C preprocessor in a lot of ways.
0:16:10But one key one is that your code has to compile and fully type check before the macro is applied.
0:16:16Sure.
0:16:17So 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.
0:16:24Like it has to be syntactically valid code before the macro is actually expanded.
0:16:29Which keeps code looking more natural and standard.
0:16:32I 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.
0:16:40And fix it.
0:16:40It's genius to be able to be able to integrate into the actual development process itself.
0:16:46It's not just something that is being used and then like you write it and then it only happens in compilation.
0:16:52It'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.
0:16:58Yeah absolutely.
0:16:59Yeah right.
0:17:00Fix it.
0:17:01You know quick help.
0:17:01I 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.
0:17:07Yeah.
0:17:08This episode of Under The Radar is brought to you by Indeed.
0:17:10What's a game where no one wins?
0:17:12The waiting game.
0:17:13When it comes to hiring don't wait for great talent to find you.
0:17:16Find them first with Indeed.
0:17:18When you're hiring you need Indeed.
0:17:21Indeed is the hiring platform where you can attract, interview and hire all in one place.
0:17:25Instead 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.
0:17:33Indeed streamlines hiring with powerful tools that find you matched candidates.
0:17:38With instant match over 80 percent of employers get quality candidates whose resume on Indeed matches their job description the moment they sponsor a job.
0:17:45According to Indeed data US Indeed's hiring platform really is great because it matches you with quality candidates instantly.
0:17:53Even better Indeed is the only job site where you only pay for applications that meet your must have requirements.
0:17:59Making it an unbelievably powerful hiring platform delivering four times more hires than all other job sites combined according to Talent Nest 2019.
0:18:08Join more than three million businesses worldwide that use Indeed to hire great talent fast.
0:18:14Start hiring now with a $75 sponsored job credit to upgrade your job post at Indeed.com/undertheradar.
0:18:21Offer good for a limited time.
0:18:23Claim your $75 credit now at Indeed.com/undertheradar.
0:18:27That'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.
0:18:35Terms and conditions apply.
0:18:36Need to hire? You need Indeed.
0:18:38Our thanks to Indeed for their support of this show and Relay FM.
0:18:41Swift data.
0:18:43Amazing.
0:18:45First of all let me be the one to say finally.
0:18:47Also thank you for sure locking the library I spent the last six months writing.
0:18:53So 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.
0:19:01So this you know the timing of it makes sense.
0:19:03What's the story with Swift data?
0:19:05Should we all start using it now?
0:19:06Is 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.
0:19:13Where do you see it fitting in?
0:19:16Is this like the new default that everyone should be using?
0:19:18I think it's a really great default.
0:19:21It 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.
0:19:31So you know the storage to SQL is well tested and well used.
0:19:36It's very understood and reliable.
0:19:39So yeah I think it's a much more natural Swift interface on something that is very well understood and well trusted.
0:19:47What's the what are your guidelines around concurrency with it?
0:19:51I see there are some actor classes for it but documentation is a little thin right now.
0:19:54How do you see the role of Swift data with managing concurrency?
0:19:58Yeah so Swift data is certainly designed to integrate really well with Swift concurrency.
0:20:03If you looked at how core data worked conceptually a managed object context was an actor and you would enqueue operations on it.
0:20:13Like you could ask it to perform a closure.
0:20:17We kind of inverted that with Swift data and the object context is not itself an actor but it is actor bound.
0:20:25So 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.
0:20:36But 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.
0:20:46And 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.
0:20:53But yeah so one object context per actor and then then you merge them when you save.
0:20:58And 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.
0:21:08That 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.
0:21:17But 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.
0:21:29But 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.
0:21:42But from the developers perspective they're just Swift classes and structs and hot properties and things that I'm working with normally.
0:21:49And 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.
0:21:58It's just that I think making it so native is just such a wonderful aspect of this to me.
0:22:02Even down at the predicates.
0:22:04I 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.
0:22:08It's quite nice.
0:22:10Yeah.
0:22:10And 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.
0:22:17That 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.
0:22:28Oh 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.
0:22:39And you're just like you just hope for the best and eventually it works.
0:22:41But this is like first class just part of Swift itself.
0:22:45Yeah 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.
0:22:54And just being able to model your types the way you normally would is a really key part of that.
0:22:59And 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.
0:23:08And so yeah that was really a key part.
0:23:11Another 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.
0:23:25And 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.
0:23:34And 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.
0:23:45Yeah 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.
0:23:52They aren't.
0:23:53Oh now I'm using a database.
0:23:54I need to write a whole new model layer.
0:23:56I need to do a whole new thing.
0:23:58It'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.
0:24:04Well 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.
0:24:11I 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
0:24:27that data projects and you're you're good to go.
0:24:30Yeah totally.
0:24:31And 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.
0:24:36And yeah we it just works like you don't even have to write at relationship we detect the relationships.
0:24:41Sure.
0:24:41And it all just happens.
0:24:44So there's been a lot of I don't know I don't know Dave if you are familiar with the widget system.
0:24:49I have some passing familiarity with widgets.
0:24:52That is that is definitely something that I I have some familiarity with.
0:24:55There'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.
0:25:08You 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.
0:25:21That 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.
0:25:47Set 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.
0:26:04Yeah 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.
0:26:21I 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.
0:26:37One 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.
0:26:59So 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.
0:27:28So 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.
0:27:35It'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.
0:27:51Yeah 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.
0:28:14Very 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.
0:28:27Are 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.
0:28:44You'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.
0:28:57You 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.
0:29:07Yeah 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.
0:29:25And 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.
0:29:32Yeah 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.
0:29:44I hope that works as well as as as I want it to.
0:29:48It'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.
0:30:00It's very cool.
0:30:01And 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.
0:30:26It'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.
0:30:38Yeah 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.
0:30:48And 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.
0:31:06There's some really very well designed animations in there.
0:31:11And 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.
0:31:22That's nice.
0:31:22That is incredible.
0:31:24Like 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.
0:31:38Like 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.
0:31:46It 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.
0:31:53And so like I think as someone who's I guess just straight up thank you.
0:31:57Like it's just like amazing.
0:31:58We'll let the team know.
0:31:58Yeah.
0:31:59Because 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.
0:32:08But 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.
0:32:17You have to go put it somewhere.
0:32:18If you want to see the timeline you have to figure out how to get it to update while you're trying to test it.
0:32:22Being 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.
0:32:30Yeah we're pretty excited about what we did there.
0:32:32Oh sure.
0:32:33Because 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.
0:32:43Well what happens if I change this.
0:32:45What happens if I change this and I can progressively add complexity in a way that is interactive.
0:32:50I 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.
0:32:57Instead it is a situation where I can make small changes see what they do and then just keep iterating on it.
0:33:02I 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.
0:33:14It'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.
0:33:23Yeah and app kit and UI kit.
0:33:26Oh sure.
0:33:26I love that you just slipped that in there.
0:33:28Like it was like two words.
0:33:29You can also use app kit.
0:33:30What?
0:33:31Well it's funny because.
0:33:33You can click that manus button in there.
0:33:34I 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.
0:33:46But it is a great way to develop your UI kit and app kit views.
0:33:52I 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.
0:34:01Being able to just go and like edit your constraints and see the results right there is really great.
0:34:06Yeah 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.
0:34:18Yeah I'm a huge fan of that and it's.
0:34:20And 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.
0:34:31But 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.
0:34:50And I think all of us all of us do.
0:34:52Yeah I mean not not only have we maintained a lot of interop we're continuing to invest in the interop.
0:34:56You 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.
0:35:03So UI kit trade collections were now expanded this year to have support for custom traits so you can define your own.
0:35:09But 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.
0:35:25And it's really it's a great way to move data between UI kit and Swift UI.
0:35:30But 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.
0:35:37And 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.
0:35:50Oh sure.
0:35:50I 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.
0:36:05Swift 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.
0:36:16And it's like now that same thing can go it's like everywhere.
0:36:20And I think there is something that code first and it's even the same code in multiple places first.
0:36:35And 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.
0:36:50Right right.
0:36:51I 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.
0:37:00Yeah 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.
0:37:26You 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.
0:37:56In 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.
0:38:06And 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.
0:38:17We 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.
0:38:34The 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.
0:38:46We need these kind of productivity multiplying tools and techniques and so we very much appreciate that.
0:38:52Yeah 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.
0:38:58I 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.
0:39:15Feeling 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.
0:39:43There'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.
0:40:00Bye.
0:40:01Thank you very much.