diff --git a/Examples/Shared/QVKey.swift b/Examples/Shared/QVKey.swift index a6cd7d6..6fe36d1 100644 --- a/Examples/Shared/QVKey.swift +++ b/Examples/Shared/QVKey.swift @@ -2,10 +2,10 @@ import Foundation /** We always recommend declaring your keys centrally in their own file, instead of accessing by key inline. - You can then use something like: QuickVerse.shared.stringFor(key: QVKey.Onboarding_Demo_Body) + You can then use something like: QuickVerse.stringFor(key: QVKey.onboardingDemoTitle) */ class QVKey { - static let Onboarding_Demo_Body = "Onboarding.Demo.Body" - static let Onboarding_Demo_Title = "Onboarding.Demo.Title" + static let onboardingDemoTitle = "Onboarding.Demo.Title" + static let onboardingDemoBody = "Onboarding.Demo.Body" } diff --git a/Examples/SwiftUI-Example/ContentView.swift b/Examples/SwiftUI-Example/ContentView.swift index 14d7327..47e602f 100644 --- a/Examples/SwiftUI-Example/ContentView.swift +++ b/Examples/SwiftUI-Example/ContentView.swift @@ -16,10 +16,10 @@ struct ContentView: View { VStack() { Spacer() Spacer() - Text(viewModel.titleText) + Text(viewModel.titleText ?? "") .font(Font(Fonts.lexendMedium(size: 20))) .foregroundColor(Brand.Colors.darkGrey.color) - Text(viewModel.bodyText) + Text(viewModel.bodyText ?? "") .font(Font(Fonts.lexendRegular(size: 14))) .foregroundColor(Brand.Colors.lightGrey.color) .multilineTextAlignment(.center) diff --git a/Examples/SwiftUI-Example/ContentViewModel.swift b/Examples/SwiftUI-Example/ContentViewModel.swift index e0f2bad..fdbb8fb 100644 --- a/Examples/SwiftUI-Example/ContentViewModel.swift +++ b/Examples/SwiftUI-Example/ContentViewModel.swift @@ -13,8 +13,8 @@ class ContentViewModel: ObservableObject { private let demoLanguages = ["es", "it", "fr", "de", "en"] private var demoLanguageIndex = 0 - @Published var titleText = String() - @Published var bodyText = String() + @Published var titleText: String? + @Published var bodyText: String? @Published var resultSourceText = String() func getDeviceLanguageLocalizations() { @@ -46,8 +46,11 @@ class ContentViewModel: ObservableObject { } private func updateLocalizedText() { // Strongly Recommended - Use a centrally-declared keys file, such as QVKey - seen here - titleText = QuickVerse.stringFor(key: QVKey.Onboarding_Demo_Title, defaultValue: "Welcome to QuickVerse") + titleText = QuickVerse.stringFor(key: QVKey.onboardingDemoTitle) // Alternatively, keys can be hardcoded "inline" - bodyText = QuickVerse.stringFor(key: QVKey.Onboarding_Demo_Body, defaultValue: "") + bodyText = QuickVerse.stringFor(key: QVKey.onboardingDemoBody) + + // Optionally provide a default value + titleText = QuickVerse.stringFor(key: QVKey.onboardingDemoTitle, defaultValue: "Welcome to QuickVerse!") } } diff --git a/Examples/UIKit-Example/ViewController.swift b/Examples/UIKit-Example/ViewController.swift index 75027ac..a07fb36 100644 --- a/Examples/UIKit-Example/ViewController.swift +++ b/Examples/UIKit-Example/ViewController.swift @@ -68,9 +68,12 @@ private extension ViewController { } func updateLocalizedText() { // Strongly Recommended - Use a centrally-declared keys file, such as QVKey - seen here - onboardingTitleLabel.text = QuickVerse.stringFor(key: QVKey.Onboarding_Demo_Title) + onboardingTitleLabel.text = QuickVerse.stringFor(key: QVKey.onboardingDemoTitle) // Alternatively, keys can be hardcoded "inline" onboardingBodyLabel.text = QuickVerse.stringFor(key: "Onboarding.Demo.Body") + + // Optionally provide a default value + onboardingTitleLabel.text = QuickVerse.stringFor(key: QVKey.onboardingDemoTitle, defaultValue: "Welcome to QuickVerse!") } } diff --git a/QuickVerse.podspec b/QuickVerse.podspec index acefbc5..e56e604 100644 --- a/QuickVerse.podspec +++ b/QuickVerse.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "QuickVerse" - spec.version = "1.3.4" + spec.version = "1.4.0" spec.summary = "Effortlessly integrate your quickverse.io localisations into your iOS app, for instant, over-the-air updates & more." spec.description = <<-DESC QuickVerse lets you translate your web and mobile apps with ease. Powered by instant, over-the-air updates, you can change your app copy anytime, anywhere. diff --git a/README.md b/README.md index bbfa762..730112a 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The library should have been added to the Swift Package Dependencies section, an ``` pod 'QuickVerse' // Always use the latest version -pod 'QuickVerse', '~> 1.3.4' // Or pin to a specific version +pod 'QuickVerse', '~> 1.4.0' // Or pin to a specific version ``` 2. In a terminal window, navigate to the directory of your `Podfile`, and run `pod install --repo-update`