SwiftUI Tips and Tricks with Craig Clayton

SwiftUI Tips and Tricks with Craig Clayton

[00:00:00] Designing with SwiftUI
---

[00:00:00] Leo Dion (host): Hey everybody. Before we begin the episode today, I wanted to let you know of a few things. One I'm still open to new opportunities, so if you or your company needs someone to come in and help with any swift development, bright digit is available reach out to me, Leo, at bright digit.com. Or you can go to our, the website right digit.com to get more details.

[00:00:20] Leo Dion (host): Let's set up a time to talk and see how I can help you or your team. With whatever project they're working on. So yeah, just let me know and I would love to help in any way I can. Secondly, I'll be speaking at Swift Craft. This will be in May dates. You can check that out here and on the website. And I will be speaking on learning how to count and being an advanced swift programmer.

[00:00:45] Leo Dion (host): So I'll go over some stuff about the history of numbers and mathematics and how it's related to the evolution and complexities of Swift. So I would love to see you there if you're gonna be in the UK, in Kent. Come check it out. And then I have been doing a live stream every Tuesday and Thursday at 9:00 AM and I'm hoping to continue to do that as well.

[00:01:08] Leo Dion (host): For the foresee future. I. I've been doing stuff with bushel and with a new app that I'm working on that will be revealing soon. So if you are interested in learning what is coming down the line, you can definitely want to check out my live stream. It's on my YouTube channel, bright YouTube dot.

[00:01:24] Leo Dion (host): Com slash break digit. It's also on LinkedIn and on Twitter as well. If you like what in those live streams, I want to test some of these features out. I'm still looking for beta testers for Bushell, and I'd love for you to join and get an exciting look at what you can do in Bushel. So definitely check that out.

[00:01:43] Leo Dion (host): And lastly, we still have our Patreon, so if you want to get early access to episodes like this or you want to, get access to upcoming articles and drafts and a little of the feedback I've been getting from folks. Super helpful. Reach out to me and let me know. That's about it. So thank you again for joining me for this episode, and I hope you enjoy the rest of it. Bye.

[00:02:09] Leo Dion (host): Welcome to another episode of Empower Apps. I'm your host, Leo Dion. Today I am joined by Craig Clayton. Craig, thank you so much for coming on today.

[00:02:20] Criag Clayton (guest): Thank you for having me.

[00:02:21] Leo Dion (host): You are obviously a prolific YouTuber amongst other things. I'll let you, for those who don't know, I'll let you go ahead and introduce yourself.

[00:02:29] Criag Clayton (guest): All right. I wouldn't say prolific, but I'm definitely a YouTuber.

[00:02:33] Leo Dion (host): You're more prolific for me, but I guess that puts the bar down pretty low yeah.

[00:02:37] Criag Clayton (guest): I've been doing iOS. I started in 2010 teaching myself objective CI, then got a job working in sports, mostly N-B-A-N-F-L-N-H-L-C-H-L MMA. And I did that for eight years. Once I got out of that, I did a couple of other jobs working mentoring market and just trying to. Get my feet wet and different things.

[00:03:05] Criag Clayton (guest): So I mentor and I do a lot of helping others online when I can, if I see someone ask a question or just struggling. 'cause you never know. I know that I, when I tried, when I started it was very helpful to have someone, which I never did. So my way of giving back and not having someone else do the go through the same struggles is to try to help others.

[00:03:27] Criag Clayton (guest): Besides that, I've written about. Four or five books and three of them, three of them were on ob were on storyboard, and then I wrote one on SwiftUI. And yeah, there's a ton of them out there from me. It was taken over yeah, I've been doing this for a while.

[00:03:48] Leo Dion (host): What have you seen is the big change. I assume we're talking like iOS development specifically. What is you see, what have you seen as like the big change in those eight years as far as development in that space?

[00:04:02] Criag Clayton (guest): For me I think the biggest changes is going from storyboard to SwiftUI was the biggest change. The reason why I like Swift GY is probably different than most. Doing a lot of the design work in storyboard was. A little more. It wasn't complicated. Like I, I didn't have problems how a layout, like everyone else didn't like it.

[00:04:26] Criag Clayton (guest): They had, you had some things that it didn't do right. But overall I was able to do anything that I really wanted to. But the problem with the storyboard was it took forever to prototype. And the biggest thing that I find with Swift July is within a day or two, I can have a prototype done and ready to go.

[00:04:44] Criag Clayton (guest): And so with storyboard in a day or two, I might have one view ready

[00:04:50] Leo Dion (host): is funny you said that 'cause that's exactly what we said in the last episode with Malin. And Kai was like, it's so easy now to prototype on SwiftUI and just get it out there and get it into people's hands to see, how it actually works. Yeah, for me, I didn't hate storyboards, but for me it was like dealing with get conflicts.

[00:05:09] Leo Dion (host): That was always the biggest pain point for me. Any of that stuff, whether it's like the model data schema or storyboards or Xcode projects, it's like anything I could avoid a get conflict for, I'll try to do it 'cause that workup is a mess. But yeah, swift fuel, I definitely, I'm not surprised by any answer do a lot of people who come to your educational content, do they come to it with a background in storyboards or are they coming to it from a totally new, fresh perspective where they haven't done any UI development work in Swift.

[00:05:40] Criag Clayton (guest): Most of it is new, and most of it, I would say is pretty much from the design perspective. So what normally happens is I get the Paul Hudson, where they've done some tutorials, they've done that kind of stuff, and now I. They're looking for the UI part and how to like, customize different things.

[00:06:01] Criag Clayton (guest): And I think that's pretty much why I focused on why a lot of my video and my content focus on more design because I. I'm a rare guy who has design skills that can actually do things visually without needing a designer. Now I'm not perfect. I don't claim to be but I feel like most designers.

[00:06:20] Criag Clayton (guest): If they see my work, they'll appreciate it. And they always have feedback, which is good. And over the last I think 10 years, and especially eight years, when I was working with the sports group in particular, I worked with one designer. His name was Pixel. And he taught me a lot of stuff, just things that he saw and I learned, okay, these are the things I need to pay attention to.

[00:06:42] Criag Clayton (guest): So then when I started, working in design, those are the things that I started with. And. And that knowledge gave me a heads up on, on just how to handle different layouts in ui.

[00:06:53] Leo Dion (host): So your background is mostly software development and then you picked up design along the way. Okay. That's what I was wondering. What do you think are some of the things that folks have a difficult time understanding when they start getting into SwiftUI? I.

[00:07:10] Criag Clayton (guest): I think swift UY stacks are a little confusing for some people when you first get into it because it's a little different. I like to use the CSS analogy to explain the floating and the pushing and the doing of the different things. 'cause I feel like that. Most people understand somewhat what CSS, how it works.

[00:07:30] Criag Clayton (guest): And I think that's a good jumping off point. But overall, I think using Stax, getting used to being able to do different things with them and knowing that you can combine them overlay them, have backgrounds to them like they do so much with those like basically the three stack modifiers and then using the background and the overlay, you can literally accomplish any layout you want.

[00:07:54] Leo Dion (host): Is there something, do you, so do you have a background in CSS at all?

[00:07:58] Criag Clayton (guest): I, I used to do web design and web development before I got into iOS, so yeah, I

[00:08:04] Leo Dion (host): Okay. What is something you might miss from that world that you wish SwiftUI had?

[00:08:09] Criag Clayton (guest): none. That's why I'm in iOS. I didn't.

[00:08:15] Leo Dion (host): Fair enough.

[00:08:16] Criag Clayton (guest): I didn't really my, my grief or my gripe with with web was having to deal with the browsers, having to always constantly figure out and back then when I did it, there was only like two main ones, and now there's I don't even know, four or five. And so I just didn't like that.

[00:08:32] Criag Clayton (guest): I liked the controlled environment with iOS and I liked being able to, even when I started it was just iPhone, iPad, and it was only one. And then now we've gotten like phones and all kinds of stuff, but even then I still feel like I know what I'm gonna do or how to, I know how to do different things for different devices and not have to stress it.

[00:08:52] Leo Dion (host): Yeah. The web is a lot better than it used to be. Even with the four browsers, it's better than having to constantly make sure that your app works in IE. Seven or God knows what version, but yeah there's a lot more and we've seen that slow switch towards response. Can you call it responsive design?

[00:09:09] Leo Dion (host): Even though it's one device, but like being able to design for multiple iPhone screen sizes. Like that transition definitely happened, but it's nowhere near as bad as it was on the web browser is when it comes to having to design for different sizes and browsers and yeah. What, so what are some things that you wish you knew when you started doing swifty?

[00:09:31] Leo Dion (host): Y.

[00:09:32] Criag Clayton (guest): Honestly, I was there when they announced it. And I would, within the first day or two, I was playing around with it and I absolutely loved it. I don't know if there was anything that I guess it was just at that time more resources because anything that just releases, there's nothing just like visionOS like I had the same issues with visionOS.

[00:09:53] Criag Clayton (guest): It was just. Figuring out how to accomplish what I want to accomplish with the new, like going from storyboard to now, this whole new thing, but nobody really. Has anything for me to see. So like right now, I I'll see some code, like I'll see things on, YouTube from different people that I'm like, oh I didn't even think about doing it that way.

[00:10:15] Criag Clayton (guest): I can still accomplish it, but I did it in a different way. And now I'm like, okay, I see an alternative way that might be a little bit better. So I feel like there wasn't really anything that when it came out but it was just like. Figuring out how it worked. And I think my code from SwiftUI day one to now is like drastically different.

[00:10:33] Criag Clayton (guest): 'cause I made a lot of assumptions just because we, there was really nothing to really go off of.

[00:10:40] Leo Dion (host): I think there's two things when a new API comes out A, there isn't a lot of resources and B you're not sure if you are crazy or the API is broken

[00:10:50] Criag Clayton (guest): Very true.

[00:10:51] Leo Dion (host): and you're like, and then you go to look for a Apple's documentation, it's like nothing. And you're like, wait a second, am I do, I thought I did this right.

[00:10:59] Leo Dion (host): And or they'll skip off, they'll skip some like very important part in a WWDC video and it's wait, what happened there? Yeah, no I totally get it. I totally get it. I've had the same thing, visionOS SwiftUI, SwiftData recently. So yeah, I totally get that. Okay,

[00:11:16] SwiftUI Tips
---

[00:11:16] Leo Dion (host): so let's go over like some tips that you have or hidden gems in SwiftUI that you think people should know about.

[00:11:26] Criag Clayton (guest): Alright, so the biggest one that I think Apple started with at the very beginning, and I think it's lo been lost in the ether, is really small. Taking your code and making small views in small components that is huge. That I pretty much write, try to recommend to people right away. I think that's the number one.

[00:11:49] Criag Clayton (guest): The other one that I find that's useful is code folding. If you don't have code folding enabled NX code for SwiftUI, you're doing yourself a disservice because it literally allows me to see which bracket, which v like which stack is. Containing the code I'm looking for and I can minimize it and then see other things that I don't, like I can hide things and still be able to see code.

[00:12:15] Criag Clayton (guest): So I think code folding and enabling that in Xcode is

[00:12:20] Leo Dion (host): So that goes to a bigger thing that I would suggest is that breaking your types, your files into small of a pieces you can possibly do like into it in incremental pieces is like one of my biggest like tips for any software developer out there. Like even if it's a one line body, like whatever, I don't even care.

[00:12:42] Leo Dion (host): Maybe one line's ridiculous, three lines, four lines, whatever, you shouldn't. I almost, I like the code folding feature, but I also feel like it's a good smell that maybe you need to break this body up into smaller pieces one way or another. And like what I do sometimes is I'll break it into like properties maybe at first, and then if I see it like to a point where it could go into a separate swift view, eye view, I'll do that as well.

[00:13:09] Leo Dion (host): Yeah that's a really great tip. I don't see a lot of benefit to having a large SwiftUI view type, like that's just really difficult to manage.

[00:13:18] Criag Clayton (guest): Yeah, I think the, so there's like this, so right now I'm working in countdown to binge in my own app and there are some files that are. Big, and it's more because of once I move them into another file, then I have to worry about state and binding and then moving property. So if I have a model object, then there starts to become like other issues that I don't really want to deal with at that time.

[00:13:46] Criag Clayton (guest): So what I'll do is I'll keep it in the file until I've gotten it situated, and then I'll move it. So that's when the code

[00:13:53] Leo Dion (host): Like I said, it's an incremental thing. Yeah, totally. Totally. Yeah.

[00:13:57] Criag Clayton (guest): So yeah I would say I do the same thing as you is I start with, okay, I'm gonna move it into a, like a variable and then I'll use it in my file, but it won't be in the main section of my code.

[00:14:09] Criag Clayton (guest): I like to take my body and make content and then use that. And then put everything within content variable. So like the main body isn't stacked with a bunch of code. And then as I progressively as I progress through the project and I start to know okay, this view is done, then I'll start refactoring into the smaller views and then saying if I have a view that I really like, that I want to reuse, then I'll start creating new views and do it from there.

[00:14:36] Criag Clayton (guest): But. I always increment. I don't really want to waste time moving stuff if I don't really need to. So I try to

[00:14:42] Leo Dion (host): And like you said, if you're especially in that design part, like you don't know you're gonna start, it's like you're gonna rip stuff out and change things. So that's obviously not a good time to refactor. So Yeah, I totally get it. Do you, I think it's like Xcode, is it Xcode 15 where you can start doing like refactor into sub view and stuff like that.

[00:15:01] Leo Dion (host): Which like, yeah, that stuff is awesome if you can get up to work.

[00:15:05] Criag Clayton (guest): It's worked from there from time to time, but it is come in handy.

[00:15:09] Leo Dion (host): Yeah. You mentioned state and binding, I think to a lot of people. Some of those property wrappers and the way the data binding works in swift ey can be a bit of a mystery. Do you have any do you have any like pointers on how they work and how they should be used properly?

[00:15:28] Criag Clayton (guest): I think the easiest thing to do so with state and then binding is because now we have bind a bull is when you're working with something that's within a view strictly like the parent, and you want to handle toggles or you wanna handle, has someone done something, anything that you're doing with any, you.

[00:15:51] Criag Clayton (guest): Is contained within the view you would use state and always make it private. I always remember when I was, again, when, back when I was learning I still remember Paul Hudson saying state variables are always private, state variables are always private. So I always, every time I see one that's not, I'm like, make it private.

[00:16:09] Criag Clayton (guest): And then where the binding comes in is when you have a child view that basically, one you want to have it also listen to a property, so you bind it through to the child. And that is probably the easier portion of like state and binding. When it gets a little more complicated is now we have two different versions where the new iOS 17 version does state and state objects and all of that, and that's where it gets a little bit more confusing and.

[00:16:38] Criag Clayton (guest): And how you work with it. But the state and the binding part, I think that is, is carried over from the previous ioss. So those are to me a little bit easier to grasp. But when you first start, it's a little confusing,

[00:16:51] Leo Dion (host): Yeah. Yeah. State. Yeah. And then on top of it, we have the new observable macro. Have you done anything with that or observable object? It's using observable. Okay. Yeah. That's what I've been using. RIP combined. But yeah, I do a lot of observable stuff and that's changed the way that, of course, bindable as well has changed a lot of that to make it so that the line between class and struct used to be a lot more strict.

[00:17:20] Leo Dion (host): And then now basically you can put a. Observable object how do I say this on a podcast, but like the new observation stuff it doesn't matter if something's a class or a state, whereas it used to matter. That's where you get like state object and stuff. Do you, how about as far as like the environment stuff?

[00:17:40] Leo Dion (host): Have you dealt with any of that where it's like you want to pass an environment, there's an environment object and then there's the environment values.

[00:17:49] Criag Clayton (guest): Yeah. Right now. Yeah, there, there's a, yeah, there's a definitely a difference. So in in my app that I'm working on now, I'm using Environment and I find it a little easier. So before I used to always have to add the environment modifier and then make sure it was attached to the view. Whereas now you just have to do it in the initial state and then all of the children really do have access to it.

[00:18:18] Criag Clayton (guest): And so that's the great thing. Like I, I find myself writing less code that way. I. When to use it and like how each one works is a little different. But I think, having the observable and not having to do app publish everywhere that is definitely cleaned up code and it, the paradigm has changed.

[00:18:37] Criag Clayton (guest): And now instead of doing MVVM you're trying to, you're really doing model view instead. And so that kind of design pattern and that kind of thinking is where I'm transitioning to, depending on the project and the size of it. But yeah, that's where I'm at.

[00:18:53] What's Countdown to Binge?
---

[00:18:53] Leo Dion (host): you wanna explain a little bit more about this app Countdown to binge? Is this is an app you wanna publish in the actual app store, or is it just a demo teaching tool?

[00:19:02] Criag Clayton (guest): No. So countdown to pin, countdown to binge came about a few years ago. So I like binge watching. I work from home and I watch shows all the time, and I can't stand waiting for a show to go week to week. So pretty much Game of Thrones is the only show I ever. We'll watch week to week and not wait.

[00:19:25] Criag Clayton (guest): 'cause I can't wait one, like I can't wait a whole like two months for that show to end. So the idea is, what I used to do is I'd go to IMDB, find a show I liked, and then it says, oh, it ends in May. And then I'm like, okay, trying to remember May. And then and then December comes around and I'm like, oh yeah, that show that I wanted to watch back that ended in May is ready to go.

[00:19:47] Criag Clayton (guest): And it's about to start a new season. So that is where it derived from. So what countdown to binge does is it lets you add shows you watch, and then it will tell you how many days until the show ends. It will also tell you how many days until the show launches. And then the other great thing is any shows that are pending, for example, daredevils coming out for Disney.

[00:20:13] Criag Clayton (guest): And most people don't know that. But when you, when I was doing like building my app and I added Daredevil there's the daredevil from Netflix and then there's now the daredevil from Disney and the Daredevil from Disney has the same characters, but it hasn't get gotten a release date specifically. So what my app will do is it.

[00:20:33] Criag Clayton (guest): Checks to make sure, like every couple of days or whatever, it will go and see if there's a date. And then when you open the app and there is one, it'll tell you when the date is for the launch rather than you having to go look for it every time.

[00:20:46] Leo Dion (host): Is this using IMDB?

[00:20:48] Criag Clayton (guest): No, it's using movie db the movie DB actually.

[00:20:52] Leo Dion (host): Okay. Yeah, we did an episode with Casey Liss for Call Sheet, and he had, I think he was using movie DB or TV db, something like

[00:21:00] Criag Clayton (guest): That's, it's probably the same one I'm using.

[00:21:02] Leo Dion (host): Yeah. What are you watching right now?

[00:21:04] Leo Dion (host): To watch?

[00:21:05] Criag Clayton (guest): I just finished the really good shows that I finished were Money Heist. Somebody told me to watch that, and then I got into Berlin, which is a spinoff. From that I. What else am I watching? I'm in a transition. I'm watching some European shows, so I'm watching line of, I can't remember the name of it.

[00:21:23] Criag Clayton (guest): It's like a cop show based out of the out of Britain. And I'm in the final season of that. I'm waiting on Masters of Air to finish, so that's coming up in a week, less than a week.

[00:21:35] Leo Dion (host): That's on Max, right?

[00:21:37] Criag Clayton (guest): that is on apple tv. Actually.

[00:21:40] Leo Dion (host): Oh okay. But it's I was thinking Max, because it's like a band of brothers type

[00:21:45] Criag Clayton (guest): Yeah. It's more, I think it's based on a true story of the flight. I didn't, I'm not, I've seen a trailer, but I didn't want to get into it too much. I'm waiting for it to end, so I'm, I should be binging it soon. And there's a couple other shows that I have on my list, but I've been.

[00:22:00] Criag Clayton (guest): I go through, I try to find shows that have I haven't watched at all. I'll go to like old shows that are like, eight or nine seasons that'll just take me two, three months and then when I'm coding I'll throw it on and I'll just watch while I'm coding. And that's usually where I get hooked.

[00:22:14] Criag Clayton (guest): But I never really was into TV shows until probably, maybe 10 years ago.

[00:22:20] Leo Dion (host): I was trying to do Sopranos recently. I've never watched it. It's slow, but

[00:22:25] Criag Clayton (guest): yeah, Sopranos is good. I got through that after the, after it was over. And everybody was talking about how the ending was bad, and I liked it. It is slow. You do have to have some patience with it. Same with the wi the wire. The wire took some time for me to get into the first few episodes every season.

[00:22:43] Leo Dion (host): like the one, I'm a big Breaking Bad fan. So like I, I've heard of those shows amongst the greatest shows ever made. So I was always like, curious about that. Yeah.

[00:22:53] Criag Clayton (guest): Is Epic.

[00:22:55] Leo Dion (host): let's see. Yeah, that's what everybody said. I gotta try it again. What did you learn in the making of this app? So you got like API calls you you must have some sort of.

[00:23:06] Leo Dion (host): Back. Do you have a backend and do you have any like local storage?

[00:23:11] Criag Clayton (guest): So right now I'm using SwiftData. I am hopefully going to integrate cloud kit into it so that way when you go from device to device, everything is saved. But right now my focus is really on the core functionality.

[00:23:26] Leo Dion (host): Yeah.

[00:23:26] Criag Clayton (guest): I've learned a lot. The API actually does not do a really good job of what I'm trying to do.

[00:23:32] Criag Clayton (guest): So there's a lot of custom

[00:23:35] Leo Dion (host): Which API.

[00:23:36] Criag Clayton (guest): The movie db, because it tells me it's weird. It like. It tells you like the last episode, it tells you the next episode, but that's not really reliable. And then it gives you episodes and then you have to like basically go through the data and find it. So what, like with the strike that happened, I think this is probably the worst year to build this app or maybe the best year.

[00:24:02] Criag Clayton (guest): So with the strike, we have shows that are not being, like their entire schedule isn't being released when the show's released. For example, the rookie just came out about 4, 3, 4 weeks ago. They've only have four episodes that they've actually told people what the dates are, and then there's still maybe 12 more episodes, but they haven't released the dates.

[00:24:25] Criag Clayton (guest): So my app has to constantly check to look for updates and then update the timing. So it's a little weird. But it's helpful now because. I don't, I'm, because of this, I'm actually able to ride it to where it will, it should work no matter what the situation is. And it also knows if it's a Netflix show versus a show that's on like A, B, C or CBS or one of the other ones that are weekly shows.

[00:24:52] Criag Clayton (guest): So

[00:24:52] Leo Dion (host): I miss the days when they just released the whole entire

[00:24:55] Criag Clayton (guest): that is, and that's the point of this app

[00:24:58] Leo Dion (host): Yeah. Yeah.

[00:24:58] Criag Clayton (guest): Not having to

[00:24:59] Leo Dion (host): SwiftData, what'd you think?

[00:25:03] Criag Clayton (guest): It is good. I like it. I'm actually going through an issue right now with a bug that it's not updating and it keeps crashing on me. So as soon as this is over, I'm hoping to finish fix it. But overall it's the, it's a breeze to use. Haven't really had any major issues other than the one that I'm encountering now.

[00:25:24] Criag Clayton (guest): And that's pretty much it. I enjoy it. That obviously, I think it'll, as it grows, it'll get better, but I like it

[00:25:31] Concurrency, SwiftData, and Storyboards?
---

[00:25:31] Leo Dion (host): Yeah. I think this June we're gonna have a big house cleaning, and that, along with the updates for synchronization and stuff. Yeah I'm looking forward to that. I, by the time this episode comes out, hopefully I'll have published that. The article I'm working on model actors. Maybe after this recording I'll share it with you and see if it helps you in your issue because that's the one thing I had a hard time with in the Making a bushel was dealing with synchronization and SwiftData and threads and actors and all that fun stuff.

[00:26:04] Leo Dion (host): Yeah. But I like, I, like I had said at the beginning of the episode, like storyboards, xcode projects, any of the core data, like. Model files. I forgot what those are called. The schema files or whatever, like any of that stuff that was like some special appeal list, XML format that you don't want to have to deal with when you're merging is if I can remove that.

[00:26:28] Leo Dion (host): So so data, it's like the same thing. It's like core data moving to a purely swift model or purely swift format, just like storyboards move to a purely swift format. UI moved to a purely swift format with SwiftUI,

[00:26:43] Leo Dion (host): I'm all for it. It's not perfect, but yeah, like you said, it's just, it's so much nicer to deal with that stuff in actual swift as opposed to a UI that you don't want to have to deal with.

[00:26:53] Criag Clayton (guest): Yeah, I mean for me, so one thing that I did when we did storyboards, I wasn't, I didn't work for a huge team, but it was three of us. It started with two of us, but now it was three of us before I left. Working with storyboards and we just communicated, Hey, I. I'm gonna be doing some major design work in storyboard, and we had it separated so that all of the individual items that were repeated were in nibs.

[00:27:19] Criag Clayton (guest): We, I never put anything in the actual storyboard. Most of the storyboard was blank. So it was more

[00:27:26] Leo Dion (host): when storyboards didn't even have like storyboard references and you had to put all the UI in? Oh my God.

[00:27:33] Criag Clayton (guest): Yes. That's the, when it wasn't, when it wasn't that one big file and it was like you had to refer, like you had to do nibs and do that kind of stuff. That's how I adopted and used storyboarding. So it made it easy. But then when they started giving like more features and like doing containers and doing other things, I always found ways to help me.

[00:27:56] Criag Clayton (guest): But I always just communicated I always out overwrote anybody that I worked with because I did most of the design work. So if my coworker happened to open a file and we had conflicts, he would take mine and and then he would do whatever he needed to do.

[00:28:11] Leo Dion (host): it would do the thing too where it was like it would change an id like some, it's like somebody opens the file, right? And they don't know what they're doing. They open the file and then they close the file. They didn't do anything. It just changed some stupid random ID in the file. And then you're like, oh, great.

[00:28:26] Leo Dion (host): Now I have this conflict because all, he like the poor guy, like all he did was just open the file. It's not like he meant to change anything.

[00:28:32] Criag Clayton (guest): Happens a ton of times, but we al, whenever we mer, whenever we merged code, we always got in a chat. And then if there was a conflict with a storyboard file, my, my coworker would be like, I'm taking yours. And then I. He, he's oh, I didn't do anything. It's just conflicting. Or I changed one thing and he's I'll go back and just change it when I get the new version.

[00:28:53] Criag Clayton (guest): So it, we, as long as you communicated, I felt like it worked. We never really had major conflict issues because we always are like, you're working in that file and no one else will touch it.

[00:29:04] Leo Dion (host): But it's a black box. That's what I don't like about it. Like you like, yeah. Obviously communication is the key, but like it is a black box. It's like, why? Why would you do this? Why not just make it a format that people can understand?

[00:29:16] Criag Clayton (guest): Agreed. Agreed,

[00:29:17] Leo Dion (host): yeah. So I was looking over your YouTube channel and there was a few interesting things that you've been talking about recently that people don't know about.

[00:29:26] Leo Dion (host): Like for instance, your last video, you were talking about the con, is it content unavailable view?

[00:29:32] Criag Clayton (guest): correct.

[00:29:33] Leo Dion (host): That amongst other, what are some like hidden, other hidden times views that people should be using? When they are when they're using SwiftUI that they just don't know about.

[00:29:44] Criag Clayton (guest): So I think if we're talking iOS 17, we have con unavailable view. That's new tip kit, which is also new. And those are just ways to put in like a. Basically an image text, a title that you can tell a user when they're in an empty, when your view's in an empty state. For example, if somebody's doing a search in your list and they're looking for a product and the product isn't there, instead of it just being empty, you can just say, so and so does not, is not found.

[00:30:18] Criag Clayton (guest): So the user knows. So continental available view just makes it really easy for you to not have to. Write that like all of us can do it. It's not like it's hard to do them, but when you can write like one line of code to put a content unavailable view into your project and move on, it's great. The other one tip kit I think is really good for the simple fact that if you're trying to educate your users on some icons or some stuff that you want them to know tip kit works and I think.

[00:30:49] Criag Clayton (guest): Once it expands broader than what it's covering right now, then I think it'll be even more powerful. But for now it's working in most of the things that you would work, you would use. But it's a little, it's still it doesn't do everything. So you have to just be mindful of that for that.

[00:31:06] Criag Clayton (guest): Is there anything else inside of. SwiftUI iOS17 I would say those are the two main ones that I can think of. I haven't actually covered tip kit yet.

[00:31:16] Leo Dion (host): yeah, I tried using TipKit and Bushel and I, so it's a macOS App and it was like this. This felt like awkward and I think maybe I just wasn't using it in the right place at the right. Time. But I I wanna get better at onboarding. Especially in the app, as complex as it is, it deals with virtual machines and stuff.

[00:31:36] Leo Dion (host): And if there's anything I could do to alleviate that tip kit seemed like the ideal. But yeah. Have you done, you've done such with stuff with searching Correct?

[00:31:46] Criag Clayton (guest): I've used content available view for searching, but tip kit, I did a whole course. I did a whole course on design and I cover tip kit in there. So I. You can do a lot of, do really good things by Hey, I don't want this tip to show up. For example, let's say you have a detail page for product and they go to the page, but they may not see the favorites and you're like, Hey, by the fifth view, if they don't see, if they don't like Mark favorite, show them the tip that, Hey, there's favorites that you can favorite your product.

[00:32:18] Criag Clayton (guest): So you can customize it down to like. How many times you see it. Once they see it, it never comes back and you don't have to really do user defaults or any of that stuff because it's all built in and it's great. So I think the more people start using it and seeing it in the world and in, out, in where people can see the code, then they'll start to see the power of it.

[00:32:41] Criag Clayton (guest): But I think that was one of those that I had to like really hunt for during the summer when I was trying to integrate it into. My course.

[00:32:48] Leo Dion (host): How hard is it like to implement or difficult is it to implement searching in SwiftUI now?

[00:32:55] Criag Clayton (guest): Oh, it's pretty easy. I have a whole video on YouTube that kind of covers it within a few minutes. You basically implement one property, two properties, a modifier, and you just tie in your array and that's it. You tell it what you're actually gonna search for during the array to filter. And that's it.

[00:33:17] Criag Clayton (guest): And then you, from the search, you can then integrate content unavailable view. So it all works together. But I would say searching can be done in about 15, 20 minutes into your app.

[00:33:28] Leo Dion (host): Is there anything you have done in SwiftUI where you're like, man, I just wanna go back to UI kit on this particular piece. anything you miss? Is there anything you miss?

[00:33:41] Criag Clayton (guest): So I would say before the grid stuff really came out, those, that was pretty much it. But I didn't really miss collection views because collection views took forever to get going. And I. And I hated the way that they separated the sections. And it was like, is it this one? Is it that one? Okay. And like it, I just felt like the amount of work I had to do just to get it up and running never really was worth it.

[00:34:12] Criag Clayton (guest): And with SwiftUI, I can immediately. See results. Like once I know if I need a lazy V grid or an H grid or a grid, like the newer ones, I can get it up and running within, five minutes and I get feedback, I can work with it. So I would say there's nothing in particular that I miss. I really do.

[00:34:32] Criag Clayton (guest): I think maybe because I'm more design heavy, I find that it's. To me better to use. I didn't like using third party third party libraries and I felt like that was really heavily used in UI kit, but everyone praised UI kit, so I'm like, you're praising UI kit, but then you're using 40 different libraries in your

[00:34:53] Leo Dion (host): Yeah.

[00:34:54] Leo Dion (host): You a web developer

[00:34:56] Criag Clayton (guest): do

[00:34:56] Leo Dion (host): on,

[00:34:57] Leo Dion (host): I have

[00:34:57] Criag Clayton (guest): to NPM install? Yeah, no, I get it. Totally. Yeah, and it was probably Cocoa Pods too,

[00:35:02] Criag Clayton (guest): Yes. Or a Carthage.

[00:35:05] Shapes and Fonts in SwiftUI
---

[00:35:05] Leo Dion (host): Yeah. There's a couple of videos I see about fonts and shapes. Is there anything you wanna talk about those subjects?

[00:35:11] Leo Dion (host): 'cause those are like, when you get into really like fancy designs, you're gonna start implementing custom fonts or custom shapes.

[00:35:19] Criag Clayton (guest): Yeah. I.

[00:35:20] Leo Dion (host): there anything you wanna expand on that?

[00:35:22] Criag Clayton (guest): I do a lot of custom fonts. I think fonts are great for taking your app to a, just having, it's not it's not hard, it's just, it gives it a different look and feel.

[00:35:34] Leo Dion (host): It is a branding thing too, right? Like you look, you don't look like an out of the box app, right?

[00:35:40] Criag Clayton (guest): And I love it. So when I, when we worked with the sports teams, they had particular fonts that they always had that they, it was, their legal team were like, you have to use the swamp for this thing.

[00:35:50] Criag Clayton (guest): And fonts are great. I think the new condensed, compressed all of those new ones from Apple, even if you just use those. Are amazing because if you combine them with other ones I like the really thick font, the little condensed thin fonts, you start mixing and matching with those and your app goes from okay, that looks like a basic app to, oh, you put some thought into your app.

[00:36:15] Criag Clayton (guest): So I think. Using fonts are great and I talk about how to integrate custom fonts and I have a little way to make it so that it's really easy, just type dot custom and then boom, it works. And then you don't have to put everything in strings because I. If I want to change a font, let's say I have a regular font that I'm using and it's San Francisco condensed, but then I want to change it to a different condensed font.

[00:36:39] Criag Clayton (guest): I don't have to go in and replace all the strings that I did in my entire project. I can just go in, simply replace it in one place, and then my entire font, my entire app is updated. So I find that it's a lot more

[00:36:54] Leo Dion (host): you do like an extension or something to do that? Like where you Basically because one of the, one of the things I do miss, honestly, from web design is like the ability to just say here's the font for the entire body. Here's the font for headers, here's the font. And being able to like. To like have like with style sheets, just being able to or have that better organized. Do you have any tips on that when it comes to SwiftUI?

[00:37:18] Criag Clayton (guest): No, but you bring up a good point so you can do exactly what you just said. So Apple has Title A, they have header, they have H one, H two, H three, so right. You can actually make a custom version of that in your app and make it with custom fonts. What I typically do is I'll use a custom font and I'll use a font size and then.

[00:37:39] Criag Clayton (guest): Based off of the font size, it scales up and down off of accessibility. So it, when a user

[00:37:46] Leo Dion (host): So I just wanna make sure this is clear. If you set a font

[00:37:49] Leo Dion (host): With a custom font, it'll automatically scale from accessibility. 'cause I thought there was like, oh no, you have to do this for the dynamic type to work. Or you don't have to do any, anything fancy for that. Okay?

[00:38:02] Leo Dion (host): Okay.

[00:38:04] Criag Clayton (guest): No, you if you use, if you watch my video, it'll, you can integrate it and it's basically, it's all within the code that I'd share in there. And once you have it integrated. Even like my app now and my countdown to binge, I have it where it works with accessibility. Now what's great now with SwiftUI is I can do ranges.

[00:38:25] Criag Clayton (guest): So I can say that I want this header to be only from small to like extra large. And then once it hits, once it goes past extra large, it stops. So it doesn't break my app.

[00:38:38] Leo Dion (host): Yeah. Okay.

[00:38:39] Criag Clayton (guest): So you can do it that way. I prefer to do it by the font size. But to go back to what you asked, you can do it by, you can set up a sheet that says, my titles are 22, my paragraphs, or 14.

[00:38:54] Criag Clayton (guest): And then you can just do dot paragraph and then it'll do exactly that. And then again, it'll scale and do everything that you're trying to do. So you can make it not assertive, but you can make it behave like

[00:39:06] Leo Dion (host): that's a, that's awesome. And I'll put a link to your video and maybe even a YouTube card here somewhere, wherever.

[00:39:12] Criag Clayton (guest): I'll do a, I'm gonna do one on the one that you just mentioned. I'll do that one next. Because I think it's out there, but there's not a lot of resources on it, so I'll post a video on how you can do it by going the other way. 'cause I, like I said, for me, I prefer just putting in a number and then I let scale.

[00:39:29] Criag Clayton (guest): But if you prefer to put the number in and base it off of an H, like a Title one, title two, title three, where it scales down, you can

[00:39:37] Deep Slice of Design and Testing
---

[00:39:37] Leo Dion (host): So yeah, let's talk. So you're gonna be talking at Deep Dish, which is awesome 'cause I will be there. I. What are you gonna be talking on in Chicago?

[00:39:47] Criag Clayton (guest): So we talked earlier about why I like SwiftUI being prototype, and my particular workflow is different than most devs where I like to visually see everything before I integrate models, before I integrate APIs, before I do anything, I literally want to see my app running from tab to tab and page to page.

[00:40:10] Criag Clayton (guest): Just generic, just a basic prototype with nothing hard coded everything. And then I go to the testing. And so what I have learned over the last two to three months with John Reed is that there's actually two, like two different ways of testing and there's a what we call outside in and inside out, and most devs do.

[00:40:36] Criag Clayton (guest): Inside out, whereas in I in particular where I wanted to be outside in and I never really understood this particular concept or even knew about it. And so my talk is how do you go about doing test driven development if you do prototype design or development first? And I will give, I still haven't worked on it.

[00:40:58] Criag Clayton (guest): I started with the presentation yet, but the idea will be, you can do. Stuff like Kiwi and oh man, the other one. So there's a, it's based off of our spec for Ruby Development and they made a library for iOS that does the same thing where it's story based T so behavior driven development and it's using quick and quick and what's the other one? Kiwi, I think is a Ruby. But but yeah, so basically that's, that is where my talk is gonna be baselined from. So I'm gonna do a DDD, I'm sorry, a BDD version and a TDD version. But I'm gonna do it in the flip. Instead of doing inside out, I'm gonna show outside in and then I'm gonna show how you use it from that other perspective as well, so that people can see you can do it this way. Instead of the typical, I'm gonna start with my model and then I'm going to, I'm gonna put the properties in. To me that's I, like when I see the design is when I know how I'm going to create my objects and my models and how that works. Because the designer really is the one who dictates what you do.

[00:42:09] Criag Clayton (guest): And that's the way I've always worked

[00:42:11] Leo Dion (host): I think that's especially helpful if you have an actual client you're working with. And like for me, when I have a client, like I want them to see what it's gonna look like in the end. And like I think the other side of that comes from the fact that we're not totally comfortable with what's going on underneath.

[00:42:28] Leo Dion (host): And we might want to see like how. What is going on underneath might behave, whether it's networking or database, but as far as like knowing what you want in the end, yeah, I totally like that outside in approach. So I'm like really excited to see her talk in Chicago. That's gonna be awesome. Yeah.

[00:42:45] Vision Pro Stuff
---

[00:42:45] Leo Dion (host): Anything else lately you've been working on? Any Vision Pro stuff or AI

[00:42:50] Criag Clayton (guest): I did a, I, so I did a workshop for tri Swift in New York over the summer, and I learned a ton about Vision Pro and design,

[00:43:00] Leo Dion (host): do you have one I'm obligated to ask?

[00:43:04] Criag Clayton (guest): I have, I don't have one in the store. I have one that I've done but I haven't put one in the store. Oh, no, I'm not. I'm still on the four, 4K is still a bit much that I wanna spend.

[00:43:17] Criag Clayton (guest): I plan on getting one, but I'm not, I don't have one yet yeah.

[00:43:20] Leo Dion (host): yeah. What'd you learn in that? Like from doing Vision Pro stuff?

[00:43:24] Criag Clayton (guest): a ton. A ton. So I learned that it vision Pro. Is different than anything you're doing in SwiftUI for iOS, iPad that you're normally used to. So backgrounds are different. The way that you handle colors and overlays are different.

[00:43:42] Criag Clayton (guest): The way that you handle state is different. The way that you handle fonts are different. So there's a lot

[00:43:48] Leo Dion (host): Why state? What do you mean by state? Exactly.

[00:43:52] Criag Clayton (guest): So let's say that you select a button when you select a button, they like it for it to be

[00:43:57] Leo Dion (host): Oh, okay. Okay. Visually, but

[00:43:59] Criag Clayton (guest): visually, yes. Not in the code part of it, but in the visual aspects of it.

[00:44:04] Criag Clayton (guest): Sorry, I should have prefaced that. So a lot of the things that I was like trying to figure out is how do I take a design and what is it that. What, like what is the ideal design for Vision Pro? And those were the, some of the things like, you need to use blurred backgrounds. You can't, don't they're against, not against, but they recommend you don't use solid backgrounds because they want you to be able to see different things in the environment while

[00:44:29] Leo Dion (host): Like a translucent background like that. Yeah. Frosted glass or

[00:44:33] Criag Clayton (guest): And you're. And the buttons that you use all should basically go from there. So I found it very difficult again, like I did when Switch UI first came out. How do I implement a button with a, when I, when it's a state that's like empty or when it's just what is it that they call it?

[00:44:53] Leo Dion (host): Selected or not

[00:44:54] Criag Clayton (guest): when there's nothing going on. Yes when you're not interacting with it, there's that state, then there's the state when you're actually hovering over it, which is actually when you're looking at it. And so it has a little bit of a glow and a it. It like does different things and those are the things that I didn't, that I was like learning and it took me hours upon hours.

[00:45:16] Criag Clayton (guest): How to do mods, how to do share

[00:45:19] Leo Dion (host): all in this simulator. Okay. What anything as far as do you know what Fitz Law is? I was just trying to search what it was called. Do you know what I'm talking about? Fitz Law? Okay. The idea being like your fat finger is not as precise as a mouse coor and your eye, your eyeball, is not as precise as your finger and so on.

[00:45:40] Leo Dion (host): Was there anything there that you were like, oh yeah, these buttons need to be a lot bigger, or this button needs to be smaller, or what?

[00:45:47] Criag Clayton (guest): So Apple covers those in the video. So I found that those were helpful. The, but what Apple doesn't cover in detail are the other nuances of them. They cover fonts and they say, Hey, our fonts are steps up. One step up bigger than what they would be normally in, in an iPhone app or an iPad app.

[00:46:07] Criag Clayton (guest): And so that makes sense. And they like Boulder fonts because obviously that's easier to read. But they, but like how you handle the state of a button, how you handle the background of them, and when there's. When you're on a background that has a blur and then you have another object that's on top of it, how do you handle those different like scenarios?

[00:46:29] Criag Clayton (guest): Like all of that they talk about, but then you get into Vision Pro and then you're like how do I implement it? And that was the problem that I had. I was literally like, okay, I see what you're showing in the demo, but there's no demo project. There's no anything that I can see code with. So I literally.

[00:46:49] Criag Clayton (guest): I swear I hunted for days on just little things and I, like I said, I just gave a talk on it about a month ago in regards to all of it, like my top five things for Vision

[00:47:00] Leo Dion (host): Awesome. Is that talk available online or was that Try

[00:47:04] Criag Clayton (guest): I. So unfortunately something happened with zoom and the, and they are having trouble getting the video, so I'm probably gonna have to make a YouTube video of it because they, right now, they still haven't put it up. It should have gone up like literally the weekend I, after the weekend I did it and he's, he keeps telling me he has, he's having trouble.

[00:47:27] Leo Dion (host): If you find a video or have the video, let me know. I'll try to put it on here, so for sure. That's awesome,

[00:47:32] Criag Clayton (guest): You got it.

[00:47:33] Leo Dion (host): Craig. Anything else you wanna plug before we close up?

[00:47:36] Criag Clayton (guest): I'd probably say my YouTube channel, design a SwiftUI, and then my website design a SwiftUI.com, which has courses and I'm hoping to launch more. I'm working currently on a bootcamp and I'm hoping to eventually do a design visionOS where we go from, we open up sketch, we create an A design, and then we go into Xcode and we implement it.

[00:48:01] Criag Clayton (guest): Just the design. Not like any functionality, but just understanding how to take like how you take a thought in your head or design and work it into vision. So those are those are my next

[00:48:12] Leo Dion (host): you so much, Craig for coming on. Besides that, where are you online as well?

[00:48:18] Criag Clayton (guest): So Mastodon Twitter is pretty much where you can find me. The Dev me is my name on both platforms. And I, if you respond to something I say, or at me, I always respond. Even though if, even if it's a thumbs up or a thank you, but I'm always pretty active on there because I know how it is and it's a really good resource for people to reach out and get

[00:48:41] Leo Dion (host): Awesome. Craig, thank you so much for coming on. I look forward to seeing you in Chicago. I'm excited for the talk. That's gonna be good. People can find me on Twitter at Leo g Dion, Macon, Leo G Dion at c Im my company's bright digit. If you're watching this on YouTube, please and subscribe. I would really appreciate it.

[00:49:01] Leo Dion (host): Thank you again and I look forward to talking to you in the next episode. Bye everyone.

Creators and Guests

Leo Dion
Host
Leo Dion
Swift developer for Apple devices and more; Founder of BrightDigit; husband and father of 6 adorable kids
Craig Clayton
Guest
Craig Clayton
Sr. iOS Engineer | Teacher | Mentor https://t.co/9TnkPUHVw3 of SwiftUI Projects | iOS Content creator YouTube

Join our newsletter

checkmark Got it. You're on the list!
image of podcast supporter image of podcast supporter image of podcast supporter image of podcast supporter
Join 4 supporters
Mastodon © Bright Digit, LLC 2018