3 ms·
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
by catapps 1y 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 https://github.com/stackotter/swift-bundler
- seankit 1y agoThe 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 https://github.com/swiftlang/swift-build
- tough 1y agoyep 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
- singularity2001 1y agoyep Swift build Works magnificently but only for Mac so far
- tough 1y agoohh gotcha, well hoping it gets linux/win support soon too, it's great!
- marcellus23 1y agoI'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 1y agoAs 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)
- marcellus23 1y agoOh — actually you can create a Swift package and open it with Xcode. You don't need an explicit xcodeproj or xcworkspace.
- realaleris149 1y agoNot 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.
- viktorcode 1y agoYou 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 1y agoSure, 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.