Installation
Detailed installation instructions for Xcode and Package.swift.
SwiftDataTables is distributed via Swift Package Manager (SPM), Apple's built-in dependency manager. This guide covers all installation methods and common troubleshooting.
Requirements
| Requirement | Minimum Version |
|---|---|
| iOS | 17.0+ |
| Swift | 5.9+ |
| Xcode | 15.0+ |
Via Xcode (Recommended)
The easiest way to add SwiftDataTables to an existing Xcode project:
- Open your project in Xcode
- Go to File → Add Package Dependencies...
- In the search field, paste:
https://github.com/pavankataria/SwiftDataTables - Click Add Package
- Select your target and click Add Package again
Xcode will fetch the package and add it to your project. You can now import SwiftDataTables in any Swift file.
Choosing a Version Rule
When adding the package, Xcode asks for a version rule. Here's what each option means:
| Rule | When to Use |
|---|---|
| Up to Next Major | Recommended. Gets bug fixes and new features, but not breaking changes. |
| Up to Next Minor | More conservative. Only gets patch releases (bug fixes). |
| Exact Version | Locks to a specific version. Use if you need reproducible builds. |
| Branch | Tracks a branch (e.g., main). Use for testing unreleased features. |
For most projects, Up to Next Major starting from 0.9.0 is the best choice.
Via Package.swift
If you're building a Swift package or prefer manual configuration, add SwiftDataTables to your Package.swift:
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "YourPackage",
platforms: [
.iOS(.v17)
],
dependencies: [
.package(url: "https://github.com/pavankataria/SwiftDataTables", from: "0.9.0")
],
targets: [
.target(
name: "YourTarget",
dependencies: ["SwiftDataTables"]
)
]
)Then run swift build or open the package in Xcode.
Verifying Installation
To confirm SwiftDataTables is installed correctly, add this to any Swift file and build:
import SwiftDataTables
// If this compiles, you're all set!
let _ = SwiftDataTable<String>.selfTroubleshooting
"No such module 'SwiftDataTables'"
- Make sure the package was added to the correct target (not just the project)
- Try Product → Clean Build Folder (⇧⌘K) then rebuild
- Close and reopen Xcode
- Check that your deployment target is iOS 17.0 or higher
Package resolution fails
- Check your internet connection
- Try File → Packages → Reset Package Caches
- If using a VPN or corporate network, ensure GitHub is accessible
Version conflicts
If you see version resolution errors, another package may depend on a different version of SwiftDataTables. Try updating all packages with File → Packages → Update to Latest Package Versions.
Next Steps
Now that SwiftDataTables is installed, head to the Quick Start to build your first data table.