Installation (iOS / Swift)¶
Aksara ships two products:
| Product | Import | What it gives you |
|---|---|---|
Aksara |
import Aksara |
Core runtime: Localizer, plurals, interpolation, applyBundle. No UI dependency. |
AksaraSwiftUI |
import AksaraSwiftUI |
LocalizationManager + LocText — SwiftUI views that update live. |
Pick your package manager:
| Manager | Builds from | Best for |
|---|---|---|
| Swift Package Manager | source | most projects (recommended) |
| CocoaPods | source | apps already on CocoaPods |
| Carthage | prebuilt XCFrameworks | apps already on Carthage |
| Manual XCFramework | prebuilt XCFrameworks | no dependency manager |
Repo: https://github.com/iQbalADR/aksara
Requirements¶
- Xcode 15+, Swift 5.9+
- Deployment targets: iOS 15+, macOS 12+, tvOS 15+, watchOS 8+
(the SwiftUI layer uses
ObservableObject/@Published, so it works on iOS 15).
Swift Package Manager¶
The Package.swift manifest lives at the repository root, so the repo is
consumable directly.
Xcode¶
- File ▸ Add Package Dependencies…
- Enter the repo URL:
https://github.com/iQbalADR/aksara.git - Choose a version rule (e.g. Up to Next Major from
0.2.0). - Add the products you need —
Aksaraand/orAksaraSwiftUI— to your target.
Package.swift¶
dependencies: [
.package(url: "https://github.com/iQbalADR/aksara.git", from: "0.2.0"),
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "Aksara", package: "aksara"),
.product(name: "AksaraSwiftUI", package: "aksara"), // optional
]
),
]
Local / monorepo path¶
If you vendor this repo alongside your app:
Build & test the package itself¶
CocoaPods¶
The Aksara.podspec is at the repository root. It exposes two
subspecs; Core is the default.
Podfile¶
Then:
and open the generated .xcworkspace.
Consuming from the Git repo before it's published to trunk¶
pod 'Aksara', :git => 'https://github.com/iQbalADR/aksara.git', :tag => '0.2.0'
pod 'Aksara/SwiftUI', :git => 'https://github.com/iQbalADR/aksara.git', :tag => '0.2.0'
Maintainer notes¶
- Validate the spec before releasing:
- Add a
LICENSEfile — the podspec references it andpod trunk pushrequires it. - Publish:
pod trunk push Aksara.podspec.
Carthage¶
Carthage does not build Swift Package Manager packages, so Aksara is distributed to Carthage as prebuilt XCFrameworks attached to each GitHub Release. Your app consumes those binaries.
Cartfile¶
Then build (XCFrameworks are required — always pass --use-xcframeworks):
Carthage downloads the *.xcframework.zip assets from the matching release (it does
not compile them). You'll get, in Carthage/Build/:
Aksara.xcframeworkAksaraSwiftUI.xcframework(only if you need the SwiftUI layer)
Drag the ones you need into your target's General ▸ Frameworks, Libraries, and
Embedded Content and set them to Embed & Sign. (XCFrameworks don't need the old
copy-frameworks run-script phase.)
Alternative: explicit binary spec¶
If you're not resolving via GitHub, point Carthage at a binary spec JSON per framework:
binary "https://cdn.example.com/carthage/Aksara.json"
binary "https://cdn.example.com/carthage/AksaraSwiftUI.json"
where Aksara.json maps versions to the zipped XCFramework:
Maintainer notes — producing the release artifacts¶
This archives each scheme for iOS device + simulator, repackages the Swift module
interface into each .framework, and emits:
build/xcframeworks/Aksara.xcframework (+ Aksara.xcframework.zip)
build/xcframeworks/AksaraSwiftUI.xcframework (+ AksaraSwiftUI.xcframework.zip)
Attach both *.xcframework.zip files to the GitHub Release for the version tag so the
github "iQbalADR/aksara" route above finds them. To add tvOS / watchOS / macOS slices,
uncomment entries in the PLATFORMS list at the top of the script.
Manual XCFramework¶
No dependency manager? Build the binaries yourself and embed them:
Drag build/xcframeworks/Aksara.xcframework (and AksaraSwiftUI.xcframework if
needed) into your target's Frameworks, Libraries, and Embedded Content, set to
Embed & Sign, and import Aksara.
Verify the integration¶
import Aksara
import AksaraSwiftUI // if you added it
Localizer.shared.configure(.init(
defaultLanguage: "en",
fallbackLanguage: "en",
bundledResource: "en"
))
print(Localizer.shared.t("common.welcome", args: ["name": "Oncom"]))
See the Home page for the full API
and the format spec for how to author en.json.