top | item 43942037

(no title)

catapps | 9 months ago

I've been starting to use Swift again lately after like four years, and while the language is beautiful & the package management story is now a LOT better with SwiftPM, I found that none of it plays nicely with XCode, Simulator, or anything to do with iOS/macOS development -- its primary use-case!

I found myself awestruck that I *HAD* to use XCode or xcodebuild, and could not just run `swift build` and generate an iOS app.

In the end, I had to:

- compile the .app structure myself

- run codesign manually

- manage the simulator manually

- bundle xcAssets manually

- provide swift linker flags manually targeting the toolchain/sdk I needed

- manually copy an embedded.mobileprovision

It was a good learning experience, but what's the story here? Did Apple just give away Swift to the OSS community and then make no ongoing effort to integrate their platforms nicely into the non-xcode build tooling? Looking into https://github.com/stackotter/swift-bundler

discuss

order

seankit|9 months ago

The Swift language team has recently open sourced swift-build, and the community's assumption is that it was done in order to eventually move everything away from xcodebuild to swift-build, which would let you build an app from swift packages and fully break from Xcode: https://github.com/swiftlang/swift-build

tough|9 months ago

yep can confirm swift build works, at least i was able to build a MacOS app and avoid Xcode at all costs thanks to it phew

viktorcode|9 months ago

You are talking about the language but bringing up an example of creating an app for an Apple platform. Regardless of the language you will have to create app bundle structure, copy assets inside, add mobile provision and sign it.

If you ask me, those platform specific things should never be integrated part of the language.

catapps|9 months ago

Sure, but developing for Apple's platforms is Swift's primary use. I'd say Dart & Flutter is a fair comparison:

As flawed as they are in my eyes, its dev tooling quality is something I appreciate and wish I saw here. There are two CLIs, one for the language (Dart) and one for the framework (Flutter). Some would say that the CLI equivalent would be xcodebuild, but that depends on the complex .xcodeproj/.xcworkspace structure and still requires XCode to be installed.

marcellus23|9 months ago

I'm confused. You said "none if it plays nicely with Xcode" but then you complain about what the experience is like when not using Xcode.

catapps|9 months ago

As far as I could tell, if you create a Main.swift file, you can't just open that in XCode and start running it as an iOS/macOS application, and instead have to create a .xcodeproj/.xcworkspace through XCode, and add your Swift to the scaffolded project - this seems backwards to me.

(I then separately complained at all the steps it took to get it running without XCode, as I didn't want to be locked into using it)

realaleris149|9 months ago

Not op, but I think "doesn't play nicely" means does not work so you have to do it in other ways. This has been my experience as well, albeit it was couple of years ago.