AppForce1: news and info for iOS app developers
AppForce1: news and info for iOS app developers
Obsessing over Obsidian
Obsidian note taking
Articles of this week:
- Slicing Environment Object
- Global Routing Using Navigation Stack
- Asset Catalog and Dark Mode
- Delay an async Task in Swift using the new clock APIs
- Background tasks in SwiftUI
- The Trade-offs of Using Mirror API to do Code Reflection in Swift
- How to create a list with Compositional Layout
- Code generation using Swift Package Plugins
- First Experience With Transferable Implementing Drag And Drop In SwiftUI
Runway
Put your mobile releases on autopilot and keep the whole team in sync throughout. More info on runway.team
Lead Software Developer
Learn best practices for being a great lead software developer.
Rate me on Apple Podcasts.
Send feedback on SpeakPipe
Or contact me on Mastodon: https://hachyderm.io/@appforce1
Support my podcast with a monthly subscription, it really helps.
My book: Being a Lead Software Developer
Hi, and welcome to AppForce1, episode 86. My name is Jeroen Leenarts. And I've been developing software for over 20 years developing iOS app for 10 years, running the JaCoCo has for over nine years. If you're an iOS app developer, you should listen to my podcast because we'll keep you updated on interesting articles, conferences and events you might not have heard about. In this episode, I'm going to talk about slicing confinements objects, global routing using navigation stack, acid catalog and dark mode, delay and async tasks in Swift using the new clock API's, background tasks swift UI, the trade offs of using Mirror API to do coke reflections, Swift has created a list with compositional layout. code generation uses fifth backs, plugins and first experience with transferable implementing drag and drop in Swift UI. It's been a relaxing two weeks for me, my family and I went on a two week vacation to resort of success. A very much kids focus place. And it's true if the kids are having fun, and parents are having fun too. Lisa Milam had so much stuff to do that. And I must admit, I was the guy at the biggest waterslide asking if I can hit you right on the tube with strangers. So last resort had a big center with a nice spacious room for up to 250 people, just the thought of ever organizing an event there, it would be a little bit like swift islands or episode CH, I guess. So anyways, this time, I have nine links for you. These are based on all the links captured by an RSS aggregator over the past three weeks, I had a lot of stuff to go through. But I think there is some really nice piece in there. Speaking of keeping track of things, I want to talk a little bit about obsidian. And obsidian is it's a notetaking app. And one of the things I've been struggling with a lot since my move into developer relations is feeling accomplished at the end of my week. So with software development, it was always very clear, I could look at lines of code, how many tickets are closed, or release that went out. But with developer relations work, and especially since part of my job is leading to peers, it has been tough. I've had weeks where I would think I did loads. But what did I actually accomplish. So no more, I decided to bite the bullet and sell the knowledge management system for myself. With the specific aim of tracking accomplishments and personal results, I have always been a fan of note taking provider which provided I would actually take them. But now with obsidian, I've created a little workflow revolving around the daily notes and an aggregation of tasks from my notes. I worked in earnest with it for one day, and I think I have created something that potentially can provide me with a huge value. It's a little bit more involved in that. But my focus was to create something that is easy for me to work with during the day. And at the end of the week allowed me to look back at what I did. If this works out, I should probably do a little bit of a video about this. Talking about accomplishments. I've read a tweet the other day with someone asking whether or not doing no coding, besides a job is a problem or not. This person was clearly someone not doing much coding besides his day job, and was curious to learn if that's okay or not. First of all, if that's what you are comfortable with, and doing your day job makes you feel accomplished at the end of the week. Why would you care what the internet thinks of you? You are doing great and have a lot of time and attention for other things in your private life. Right? I myself am somebody who enjoys living and breathing coding. Does this conflict with my private life sometimes? Yeah, sure. But but I do get a lot of enjoyment out of these additional coding related activities most of the time at least. So do I have to do these extra things beside my day job? Probably not. But obviously, I probably wouldn't be in developer relations if I didn't start my podcast. But I never started my podcast to achieve some career goal. I started this experiment and wants to learn if I could actually do a podcast, you could say my podcast is a large portion of my additional work taken on besides my day job. But should I feel bad if I wouldn't do this or any other additional substantial piece of work that is closely related but not my job. Again, I think people should do what they enjoy doing with spare time and someone on Twitter telling you You are doing too much or too little besides your day job, Hey, it's your choice, your life. Nobody gets to tell you. What you should do. And what you should not do are the benefits to doing coding related things besides the job of course, some people even makes significant portions of the income through something that started out as a fun little hobby project. It does it does get you exposure and other tangential benefits like speaking engagements, maybe at some point being able to make the switch to venture out on your own even but if what makes you happy beyond your day job is not coding related in any way. Going to use for following your own heart coding at night side hustling, doing even more work type things beyond your day job. Not wanting to do any of the above that's all fine you just be you. That can make things hard enough sometimes already. Anyways, let's dive into the articles of the past couple of weeks. I went through 471 articles for this episode alone. The first article is by Adam sharp slicing environment objects. At environment object in Swift UI provides a way to configure global state for your application. Updating the global state allows the view to re render refresh. Sometimes we are only interested to update the view when a small part of the global state changes. In this post as I'm we'll cover how you can create segments of your of global state so your view only updates when that's has changed. When you deal with state in Swift UI, you quickly run into the situation that your UI updates too frequently due to having too much data in the environment object for the current view. You can find. You can prevent this by splitting your global state into multiple segments, as I'm showing you how you could do this in his article. The second article is also known as some sharp global routing using navigation stack navigation stack in iOS 16 allows developers to set up global routing for your application. Now just like React and flutter, you can configure routes for your entire application in the central place. In this post, as am, we'll cover how you can set up global routing for your swift UI application. It is a quick article, but as I'm showing how you could use an enum to direct users towards specific areas within your app, while enums are a tried and true mechanism. This is the first time I'm seeing this applied to iOS 16 Switch why navigation stack. Juna shares an article on using acid catalogs in your app to help properly support dark mode, asset catalog and dark mode. If you're supporting iOS 13 At a minimum, you should give asset catalog and dark system mode another look, it was in iOS 13 Back in 2019, that Apple added Dark Mode supports the time is ripe if you've been supporting dark mode prior to iOS 13. Using your custom method, you might want to migrate to the newer asset catalog and make use of the system dark mode support. iOS has a lot of support for dark mode and June indicates this is often forgotten and old custom code is kept around even though there's a much easier alternative available helping you support dark mode in your code, especially with the Swift UI color scheme environment. The fourth article is by Natalia pan for alpha delay and async task is swift using the new clock API's. She writes about using the new clock API in Swift 5.7 to delay asynchronous task in Swift 5.7. We have new API's for interacting with time that consists of three main components clock instant and duration. We can use these new API's to delay an async task in a more descriptive way than the old API that accepted nanoseconds. Our article contains a code sample to just what she said there. So you should check it out. Majeed writes about BG app refresh task requests introduced with iOS 13 or less. The article is titled background tasks in Swift UI. It allows you to schedule work intelligently in the background. Finally, you can handle background tasks using the Swift UI app lifecycle. In his article, you will learn how to schedule and handle background tasks in Swift UI. Majeed explains a few of the details you have to get right before you can use the background task framework and swift UI. After that, he shows a nice way to integrate background tasks into Swift UI application. Leonardo Maya Puglisi has a nice reflection piece on his use of the Mirror API. It's titled the trade offs of using Mirror API to do code reflection in Swift. When using Swift Mirror API, there are some caveats you have to be aware of after the internet. After the initial introduction Leonardo starts with Imagine you have a code structure. It can be a class or a struct that you want to parse all values of all properties automatically. You don't want each time anyone adds a new property, you have to add something new manually. His article provides a look into the Mirror API on Swift. And fortunately, he clearly indicates it's an API that has its uses, but it should not be applied to every bit of code you touch. The second article is by Philip nemecheck. How to Create a list with compositional layout lists are one of the most common layouts in iOS apps. And while in the past, you created these with UI TableView. You can quickly achieve the same results of a list with UI collection view which gives you much more flexibility. Philip is a big fan of compositional layout on iOS. And this article shows that FX also this article really lines up well with the minor indications Apple has been sending out about UITableView future I personally think you would take a few we've come a deprecated API sooner than later. So it is best when possible to avoid using table views and adopt collection views. Up next is bulk PLR Abadia with an article about Swift packs, plugins cogeneration using Swift plugins. If you have been using Doxie you probably have dealt with Swift backs plugins already both set out on a mission to create a bill to plugin which is to run as part of the build process of a Swift package. Unlike command plugins introduced with Xcode 14 which run arbitrary and rely on user inputs. It is nice article sharing some details with how you get started with Swift backs plugins. It is a rather long article but that's just because Paul is really thorough. Gabriel 30 Plus has the final ninth article of today. first experience with transfer By implementing drag and drop in Swift UI at WWDC 2022, Apple presents a new protocol in Swift named transferable in a nutshell, transferable makes it really easy and absolutely straightforward to copy data either among different spots within the same app, or even different apps. And when talking about copy, this does not include only copy and paste, but drag and drop as well. Before transferable became available, it had been necessary to perform a series of certain steps in order to transfer data as mentioned above. For custom types, especially it had been mandatory to adopt specific protocols and implement some required methods in order to serialize and deserialize. Work with identifiers enter contain data, and more. However, all related details are not of much interest here, as the topic is the evolution of all that a transferable protocol. For someone that has worked with all of that transferable is definitely a game changer. This is a long article that shows because Gabriel has a lot to explain. But the bits about transferable did not require much code at all. It's get drag and drop to work. And I think this is a great starting point for you to adopt, drag and drop in your apps. And that's it for this episode. If you want to support the podcast, then have a look or buy me a coffee page. You can give me a cup of coffee there or you can even become a member of podcasts. And if you want to, you can even get continuous coaching type sessions through my primary account page. So have a look at that. I would love to get some supporters from podcast because I've been doing it's close to 200 episodes now if you have any feedback, I'm just a DM away on Twitter at first one. Talk to you again next week.