All Projects → SwiftXcode → Swift Xcode

SwiftXcode / Swift Xcode

Licence: apache-2.0
Use Swift Package Manager directly from within Xcode, w/o the cmdline

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Swift Xcode

Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+695.87%)
Mutual labels:  xcode, swift-package-manager
Dtgradientbutton
Easy way to set gradient background to your buttons.
Stars: ✭ 76 (-37.19%)
Mutual labels:  xcode, swift-package-manager
Xclogparser
Tool to parse Xcode and xcodebuild logs stored in the xcactivitylog format
Stars: ✭ 978 (+708.26%)
Mutual labels:  xcode, swift-package-manager
Xcbeautify
A little beautifier tool for xcodebuild
Stars: ✭ 372 (+207.44%)
Mutual labels:  xcode, swift-package-manager
Appicon
AppIcon generates *.appiconset contains each resolution image for iOS
Stars: ✭ 1,454 (+1101.65%)
Mutual labels:  xcode, swift-package-manager
Brisk
A proof of concept scripting library for Swift
Stars: ✭ 478 (+295.04%)
Mutual labels:  xcode, swift-package-manager
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+875.21%)
Mutual labels:  xcode, swift-package-manager
Dtpagercontroller
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.
Stars: ✭ 240 (+98.35%)
Mutual labels:  xcode, swift-package-manager
Easing
Easing functions in Swift 5
Stars: ✭ 107 (-11.57%)
Mutual labels:  xcode, swift-package-manager
Xmlmapper
A simple way to map XML to Objects written in Swift
Stars: ✭ 90 (-25.62%)
Mutual labels:  xcode, swift-package-manager
Swift5 Module Template
An opinionated starting point for awesome, reusable Swift 5 modules
Stars: ✭ 331 (+173.55%)
Mutual labels:  xcode, swift-package-manager
Alamofire
Elegant HTTP Networking in Swift
Stars: ✭ 36,896 (+30392.56%)
Mutual labels:  xcode, swift-package-manager
Containercontroller
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version
Stars: ✭ 273 (+125.62%)
Mutual labels:  xcode, swift-package-manager
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-74.38%)
Mutual labels:  xcode, swift-package-manager
Roundcode
Custom rounded QR code with lots of customization.
Stars: ✭ 267 (+120.66%)
Mutual labels:  xcode, swift-package-manager
Mockswift
MockSwift is a Mock library written in Swift.
Stars: ✭ 56 (-53.72%)
Mutual labels:  xcode, swift-package-manager
Carting
🚘 A simple tool for updating Carthage script phase
Stars: ✭ 182 (+50.41%)
Mutual labels:  xcode, swift-package-manager
Dtphotoviewercontroller
A fully customizable photo viewer ViewController to display single photo or collection of photos, inspired by Facebook photo viewer.
Stars: ✭ 212 (+75.21%)
Mutual labels:  xcode, swift-package-manager
Statefultabview
A SwiftUI TabView that retains the state of each tab as well as some other goodies.
Stars: ✭ 83 (-31.4%)
Mutual labels:  xcode, swift-package-manager
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+8747.93%)
Mutual labels:  xcode, swift-package-manager

swift-xcode

Swift4 Swift5 macOS homebrew

Breaking News from WWDC 2019: Xcode 11 is finally supporting Swift Package Manager. Rendering this project obsolete.

Use Swift packages directly from within Xcode, w/o having to jump to the Terminal. With swift builds, in a non-annoying way. Build large dependencies once, not for every project. Do not require an Internet connection just to create a new project.

... finally got sherlocked at WWDC 2019!

Too much text? Want a GIF? Here you go.

Goals

1. Use Swift Package Manager directly from within Xcode

Goal (duration: a few seconds):

  1. Create a project from within Xcode. (Cmd-Shift-N, follow wizard)
  2. Build and run. Works. You need to add a package? Just edit Package.swift and build.

State of the art (duration: some minutes or more):

  1. Open terminal.
  2. Call mkdir MyProject. Do a cd MyProject.
  3. Call swift package init, kitura init, or something similar.
  4. Call swift package generate-xcodeproj to create the Xcode project.
  5. Open MyProject.xcodeproj, find and select the right scheme
  6. Build and Run. You need to add a package? Start again at step 4, sometimes 3.

2. Reduce Compile Time

Calling swift build as a tool is somewhat expensive.

Goal: Instead of doing calling swift build on every build, do a swift build only if the Package.swift changes. Produces a static library (pretty big, bundles up all the packages), which is directly linked against the Xcode target.

3. Reduce Initial Compile Time

State of the art: When you create a new Swift Package Manager project, for instance a Kitura endpoint, the initial setup takes a long time:

  1. all the required packages are resolved and fetched from the Internet
  2. all those packages are built from source

For a plain Kitura HelloWorld this is about 3-5 minutes before you can get going, even on a fast machine.

But worse: This has to be done every single time you create a new project! Want to create HelloKitten? Another 3mins lost. HelloCow? Again.

Goals, alongside goal 1:

  1. Create a project from within Xcode. (Cmd-Shift-N, follow wizard)
  2. Edit your main.swift or whatever
  3. Build and run. Only build your own project sources.

3.1. Bonus: Do not require Internet to create new projects

Internet is only required when you install an image, once. After that, the bundled image is available and as many projects as desired can be created.

Installation

brew tap swiftxcode/swiftxcode
brew install swift-xcode
swift xcode link-templates # <-- important!

Extra Images

Images are pairs of Xcode templates and precompiled Swift packages (used by those templates). The precompilation happens when you install a Homebrew image formula (or manually using the GIT repo) and can take some time. Afterwards you can create new Xcode projects using those templates, without having to wait for the SPM bootstrap (fetch and compilation of the dependencies).

Image: SwiftNIO

Find it here: SwiftXcode/SwiftNIO_XcodeImage.

brew install swift-xcode-nio
swift xcode link-templates # <-- important!

Image: Kitura

Find it here: SwiftXcode/Kitura_XcodeImage.

(One time) compile time: ~5 minutes. Image size: ~100MB. Fresh project setup from create to run: 3 seconds.

brew install swift-xcode-kitura
swift xcode link-templates # <-- important!

Image: SwiftObjects

Find it here: SwiftObjects/SwiftObjects_XcodeImage.

brew install swift-xcode-wo
swift xcode link-templates # <-- important!

Image: RxSwift

Find it here: SwiftXcode/RxSwift_XcodeImage.

(not in Homebrew)

Using it for iOS Projects

Here is the basic version:

  1. Create new Project in Xcode (File Menu / New / Project)
  2. Select iOS / Swift Package Manager App
  3. Give it a name, optionally preconfigure SPM modules you want
  4. Build project (can take a moment w/o an image)
  5. In Package.swift, add modules as you wish, e.g. cows
  6. in AppDelegate.swift, import cows, do print(cows.vaca())
  7. Build project and run

Manual Setup

The functionality can be added to any existing project, there is no requirement to use the templates.

Steps:

  • Create a Package.swift in your project, DO NOT ADD it to the Xcode target
  • Add an Xcode shell buildstep to your target, put it at the very top. Within that, invoke swift xcode build (optionally prefixed by an SPM_IMAGE=ImageYouWantToUse)
  • Add some build settings (either in Xcode or in an xcconfig file):
    • "Header Search Paths" / HEADER_SEARCH_PATHS
      • $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)
    • "Import Paths" (Swift) / SWIFT_INCLUDE_PATHS
      • $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)
    • "Library Search Paths" / LIBRARY_SEARCH_PATHS
      • $(SRCROOT)/$(PRODUCT_NAME)/.buildzz/.build/Xcode/$(PLATFORM_PREFERRED_ARCH)-apple-$(SWIFT_PLATFORM_TARGET_PREFIX)$($(DEPLOYMENT_TARGET_SETTING_NAME))/$(CONFIGURATION)
    • "Other Linker Flags" / OTHER_LDFLAGS
      • -lXcodeSPMDependencies

If you do this a lot and you don't want to use the templates, create an xcconfig file to carry the settings, and just add that to your project. We also provide an xcconfig you can use/include: /usr/local/lib/xcconfig/swift-xcode.xcconfig.

Status

Supposed to work fine, patches welcome!

Comparison w/ other Package Managers

Note that swift-xcode is not really a package manager on its own. The package manager is still the official Swift Package Manager, just enhanced a little.

So you inherit a lot of its limitations. For example it cannot deal with resources, produce frameworks, or bundles. Yet, you can still build reusable modules with it.

So is it a replacement for Cocoa Pods or Carthage? In some cases it can be. In other cases it can't :-)

FAQ

  • Q: Does that make sense?
  • Q: Does it work on iOS projects? macOS?
    • A: Yes! You cannot build an iOS or macOS app using SPM itself, but using this you can create reusable modules which you import into your iOS app.
  • Q: Those static libraries and images are BIG! Isn't that an issue?
    • A: Well, they have the same size they would otherwise have :-) Since they are static libraries, the linker will cherrypick the requires components, meaning your binary won't be own-stuff plus static-lib size, but just own-stuff plus stuff-you-use.
  • Q: What if I have multiple Xcode versions installed?
    • A: This should generally work fine. Images are scoped by the Swift version. However, if you switch the Swift version, you may have to first build a shared image (it will still work w/o, but it will be slow on 1st setup as usual).

SPM Modules to Try

Links

Who

Brought to you by The Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].