SwiftLee Weekly - Issue 246


This week's SwiftLee Weekly covers:

  • App Store Nominations
  • ChatGPT for Xcode
  • Lazy vars and observable classes

Enjoy this week's SwiftLee Weekly!

THIS WEEK'S BLOG POST

Contingent pricing for in-app subscriptions

Contingent pricing is close to one year old and still in the piloting phase. After joining forces with the team behind Helm, I wrote an article based on my experience integrating discounted subscription offerings using contingent pricing.

SPONSORED

Master Test Distribution & App Releases Amid App Center’s Shutdown

Bitrise hosts a webinar on navigating the sunsetting of Microsoft’s Visual Studio App Center. Learn how to transition smoothly to alternative platforms, optimize test and store distributions, and prepare for the future of mobile app releases. The session also includes a sneak peek of Bitrise’s new tool designed to simplify distribution workflows. Watch it now for free.

CURATED FROM THE COMMUNITY

App Store Nominations

Last week, Apple released improvements to App Store Nominations, and now, you can upload a CSV to request a feature of your app. Just one week later, a tool will already help you generate these CSV files: Helm.
helm-app.com

Lazy vars in @Observable classes in Swift

If you’ve ever tried to use lazy vars inside an observable class, you know it’s tricky to make it work. This article explains how you can solve this issue using @ObservationIgnored.
nilcoalescing.com

Copilot is now available in Xcode (and it’s good!)

It feels like there’s a new AI update every week these days. The GitHub Copilot integration has been well received, and Vincent decided to dive into how it works.
swiftwithvincent.com

ChatGPT for macOS can now work with Xcode

Speaking of AI, it’s not the only improvement we’ve got! ChatGPT has been focusing on Xcode, too, and allows you to ask questions within the context of a Swift file or code selection.
dimillian.medium.com

Understanding SwiftUI's View Update Mechanism

While we’re getting better at understanding SwiftUI’s mechanics, it’s still sometimes surprising how one view updates while another doesn’t. This article covers one of those scenarios and explains the cause.
fatbobman.com

SWIFT EVOLUTION

An overview of last week's Swift Proposal state changes. Check them out when they're in review, as it's your opportunity to influence the direction of Swift's future.

QUESTION OF THE WEEK

How do you determine the best way to organize and split your Swift projects into separate files, including deciding what should go in each file and when to break content into multiple files?
Sam

Separation of concern: it's a golden rule, especially when your keen on testing your code. Large files are hard to read, test, and navigate.

First make it work, then make it shine. I always find myself writing a solution first, all within the same file. For example, a SwiftUI View, several extensions, and a view model all within a single Swift file.

Once it all works, I start moving code around. Xcode 16 introduces a new feature "Create file from clipboard content" which makes this extra easy.

Eventually, you might even want to consider moving files into an individual package. Ideally, you would even indicate this beforehand and start writing any code within that package. I don't recommend doing this for every feature of your app, but if you know that code will be large or reused, it might be a good consideration.

These best practices will cover most cases, but you might occasionally still run into unexpected large files. Progressively migrate these into individual files whenever you touch the code for new changes. Don't go over your whole project after reading this answer, but take it step by step while in the context.

Your goal should be readable, self-explanatory code, and large files don't contribute.

Good luck!

Want to have your question answered next week? Ask your question via this form (anonymously)

EARN ROCKETSIM LIFETIME

Share and Earn Rewards

Apple lists RocketSim as an Essential Developer Tool in the Mac App Store, and now you can enjoy lifetime Pro access by spreading the word!

Share your unique referral link below with fellow developers who would appreciate my newsletter:

[RH_REFLINK GOES HERE]

Check your referral count anytime and track your progress toward earning your reward.

Thanks, and until next Tuesday,

Antoine

SwiftLee Weekly by Antoine van der Lee

SwiftLee Weekly keeps you up-to-date with the latest Swift Evolution proposals, delivers 5 handpicked articles from the community, and challenges your knowledge with a weekly question. Enjoy a monthly giveaway and dive into a fresh new article from SwiftLee every week. Plus, unlock $264 worth of exclusive discounts by subscribing.

Read more from SwiftLee Weekly by Antoine van der Lee

This week's SwiftLee Weekly covers: SwiftUI Navigation Patterns Will AI replace app developers? Building crash-free apps Enjoy this week's SwiftLee Weekly! THIS WEEK'S BLOG POST SwiftUI Lists: Present rows of data explained with code examples Many of the apps built using SwiftUI use lists in some way. You can add sections, selection, or use different list styles. This week's article shows an overview of possibilities, including one modifier you must apply to use a custom list background....

This week's SwiftLee Weekly covers: From Apple Design Award to Going Indie An Xcode feature that removed 66k lines of code What defines a Senior? Enjoy this week's SwiftLee Weekly! THIS WEEK'S BLOG POST iOS App Development: How to get started? Many of you likely know how to build an iOS application, but perhaps you have friends who should know, yet aren’t sure where to begin. I’m frequently asked how to get started with app development, so I decided to write this article to help guide those...

This week's SwiftLee Weekly covers: SwiftLee 2024 In Review SwiftLee's Most Read Articles of 2024 What to expect from SwiftLee in 2025 Enjoy this week's SwiftLee Weekly! THIS WEEK'S BLOG POST SwiftLee in 2024: Lessons learned and achievements Time flies when you're having fun! I truly started having fun after going indie in March of 2024: one of my significant achievements. This week's article reviews my lessons learned, achievements, and looks ahead into 2025. SPONSORED Screenshotbot: Scale...