📦 Swift Package Manager 🔗
Swift SDK for iOS and macOS is distributed with the Swift Package Manager as a binary package.
Copy the following URL and add it to your Swift Package Dependencies (Xcode 12 and upwards).
https://github.com/localazy/localazy-swift
Minimum target:
- iOS 13
- macOS 10.15
👷 Manual installation 🔗
To install the Localazy SDK manually, copy Localazy.xcframework
into your project root (Xcode) and add it to the Frameworks, Libraries and Embedded Content section.
⚙️ Setup 🔗
In your code you can import Localazy by adding:
#if os(macOS)
import Localazy_macOS
#else
import Localazy_iOS
#endif
💻 macOS 🔗
For macOS targets, you need to ensure Outgoing connections (Client)
and Disable Library Validation
entitlement is checked in Signing & Capabilities (App Sandbox)
section.
🎛 Configuration 🔗
To configure Swift SDK for iOS and macOS create and set up the Localazy.plist
configuration file. You can start by copying the example below to your Xcode project.
Localazy.plist
options
Key | Type | Description | Default |
---|---|---|---|
readKey |
String |
Your Localazy read key. | null |
tag |
String |
Release tag to be used to fetch translations. | latest |
statistics |
Dictionary |
Statistics configuration dictionary allows Localazy to optimize its behaviour and prioritize translations. (see table below) | - |
statistics
dictionary options
Key | Type | Description | Default |
---|---|---|---|
statsEnabled |
Boolean |
Should the library send stats | true |
updateInterval |
Number |
Update interval in ms | 86400 |
updateIntervalForFailure |
Number |
Update interval for failure in ms | 14400 |
statsInterval |
Number |
Send stats interval in ms | 86400 |
statsIntervalForFailure |
Number |
Send stats interval for failure in ms | 14400 |
updateDelay |
Number |
Update delay in ms | 0 |
statsDelay |
Number |
Stats delay in ms | 0 |
minimalStatsSize |
Number |
Minimal stats size in bytes | 2048 |
maximumStatsSize |
Number |
Maximum stats size in bytes | 262144 |
sendStatsRegularly |
Boolean |
Send stats regularly | false |
Example configuration file (Localazy.plist)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>readKey</key>
<string>Your-Read-Key</string>
<key>tag</key>
<string>Your-Tag</string>
<key>updateInterval</key>
<integer>3600</integer>
<key>statistics</key>
<dict>
<key>statsEnabled</key>
<true/>
<key>sendStatsRegularly</key>
<true/>
<key>statsInterval</key>
<integer>900</integer>
</dict>
</dict>
</plist>
🤖 Automatic strings upload 🔗
You can ensure that your local strings are uploaded on every build by creating a new Run Script Phase for your target:
localazy upload
For more info check Quick Start iOS – Localazy CLI & File Format iOS/macOS