First of all: SORRY for mentioning so many people in this post. But I'm currently failing miserably at a task and would be grateful for any advice. That's why I thought I'd address this request directly to people who I think might be able to help me. So, once again: Sorry.

What's the issue?
I'm currently unable to create an Xcode project template for a Swift package. The package in question is this one:

https://github.com/phranck/TUIkit

I based my work on the existing command line tool template, which is similar. My requirement is just a little different, namely I need conditionals. When creating a project with my template, the user should be able to select various options. And this is where it gets tricky!

There is little documentation on this. Much of it is outdated or incorrect. There also seem to be two ways of defining conditionals internally, i.e. in the template. But as I said, I can't find any really helpful documentation on this.

So, if you know exactly where I need to look, or have a sample template like this, please let me know. Otherwise, I would be very grateful for any help or referrals to someone who knows about this.

#Xcode, #Swift #SwiftPackage #Apple
โ€”

@natpanferova @harlan @danielpunkass @chbeer @icanzilb @curtclifton @twostraws @chontorres @pmdj @babbage @tempelorg @cdfinder @brentsimmons @peterfriese @pixel @me_ @dlx @fhe @paul @tapforms @todd @rafa @eternalstorms @krzyzanowskim @mccarron @ricobeck @dgregor79 @gregheo @melle @finestructure @dimillian @monkeydom @map @lucabernardi @drewmccormack @tuparev

GitHub - phranck/TUIkit: A declarative, SwiftUI-like framework for building Terminal User Interfaces in Swift.

A declarative, SwiftUI-like framework for building Terminal User Interfaces in Swift. - phranck/TUIkit

GitHub

I really like the #SwiftPackage approach. It creates a clean and readable environment within larger workspaces. ๐Ÿ˜Š

The #Xcode Workspace works perfectly with folders, making it easy to create new packages and manage their structures inside the IDE. ๐Ÿงฐ

#DevDiary #BuildInPublic

All Auth dependencies are registered in ๐Ÿ› ๏ธ Auth #Assembly. This is a core place of preparing the shareable logic and resolve it when it is needed.

Each #Module can have many assemblies to make clear division how the #SwiftPackage is built. ๐Ÿงฉ

#DevDiary #iOS #Architecture #Swift

In my experience, the fewer targets a #SwiftPackage has, the better. ๐Ÿš€

To facilitate function separation, I created Assembly - submodules that enable code separation within the module. ๐Ÿงฉ

Tomorrow, I will show you one of the assemblies. ๐Ÿ’ก

#BuildInPublic #DevDiary #Swift #SPM

Every #Module represents a target located in a #SwiftPackage. There are three types:

๐Ÿ—๏ธ Core: An architecture-only module that can be reused in any app.

๐Ÿ”„ Commons: Shareable modules providing global logic.

๐Ÿš€ Features: Modules that provide specific behavior.

#BuildInPublic

So it begins... ๐ŸŒŸ

Until now, the package had #MainActor default isolation. This was intentional to gain a clear understanding of where the #Sendable declaration is necessary.

Now, it's time to make this package truly thread-safe! ๐Ÿš€

#BuildInPublic #SwiftPackage #concurrency

I've added more modifier variations!

You can now set string as body content, automatically setting the #ContentType to text/plain. Additionally, if you wish to #override all the headings saved in the configuration, you now have that opportunity! ๐Ÿ’ก

#BuildInPublic #SwiftPackage

It is so satisfying! ๐Ÿ˜Š

I have cleaned the code, and here is the final result. The custom #Request uses associated types for the #Response Body and Error types.

The code is clean and type-safe. Under the hood, it builds a complex URL Request. ๐Ÿ› ๏ธ

#BuildInPublic #SwiftPackage

Morning #debugging session. ๐ŸŒ…

I can't find a proper solution for sharing Configuration through the Request tree, so I started with a small case: the EmptyRequest with one modifier. ๐Ÿ’ป

Working on a #SwiftPackage is easier with a sample app that you can run to test your code. ๐Ÿ“ฆ

#BuildInPublic

This is how it looks. ๐Ÿง

The method modifier sets the appropriate method in the configuration. I'm uncertain if this is the final solution, as I have concerns about the store location and how to pass configuration through the tree. ๐Ÿค”

Brainstorm! โ›ˆ๏ธ
#SwiftPackage #BuildInPublic