diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml
new file mode 100644
index 0000000..9225a31
--- /dev/null
+++ b/.github/workflows/buildAndTest.yml
@@ -0,0 +1,18 @@
+name: Swift
+
+on: [push]
+
+jobs:
+ build:
+
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: swift-actions/setup-swift@v1
+ with:
+ swift-version: "5.8.0"
+ - name: Build
+ run: swift build
+ - name: Run tests
+ run: swift test
diff --git a/.gitignore b/.gitignore
index 8663598..330d167 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,90 @@
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
## User settings
-xcuserdata/
\ No newline at end of file
+xcuserdata/
+
+## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
+*.xcscmblueprint
+*.xccheckout
+
+## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
+build/
+DerivedData/
+*.moved-aside
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+
+## Obj-C/Swift specific
+*.hmap
+
+## App packaging
+*.ipa
+*.dSYM.zip
+*.dSYM
+
+## Playgrounds
+timeline.xctimeline
+playground.xcworkspace
+
+# Swift Package Manager
+#
+# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
+# Packages/
+# Package.pins
+# Package.resolved
+# *.xcodeproj
+#
+# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
+# hence it is not needed unless you have added a package configuration file to your project
+# .swiftpm
+
+.build/
+
+# CocoaPods
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+# Pods/
+#
+# Add this line if you want to avoid checking in source code from the Xcode workspace
+# *.xcworkspace
+
+# Carthage
+#
+# Add this line if you want to avoid checking in source code from Carthage dependencies.
+# Carthage/Checkouts
+
+Carthage/Build/
+
+# Accio dependency management
+Dependencies/
+.accio/
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo.
+# Instead, use fastlane to re-generate the screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://docs.fastlane.tools/best-practices/source-control/#source-control
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots/**/*.png
+fastlane/test_output
+
+# Code Injection
+#
+# After new code Injection tools there's a generated folder /iOSInjectionProject
+# https://github.com/johnno1962/injectionforxcode
+
+iOSInjectionProject/
diff --git a/PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
old mode 100755
new mode 100644
similarity index 69%
rename from PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata
rename to .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
index 69b346c..919434a
--- a/PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
+ location = "self:">
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..7756132
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,23 @@
+// swift-tools-version: 5.8
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+import PackageDescription
+
+let package = Package(
+ name: "phrase-swift",
+ products: [
+ // Products define the executables and libraries a package produces, making them visible to other packages.
+ .library(
+ name: "PhraseSwift",
+ targets: ["PhraseSwift"]),
+ ],
+ targets: [
+ // Targets are the basic building blocks of a package, defining a module or a test suite.
+ // Targets can depend on other targets in this package and products from dependencies.
+ .target(
+ name: "PhraseSwift"),
+ .testTarget(
+ name: "PhraseSwiftTests",
+ dependencies: ["PhraseSwift"]),
+ ]
+)
diff --git a/PhraseSwift.podspec b/PhraseSwift.podspec
index 35d3613..a3f7b0e 100755
--- a/PhraseSwift.podspec
+++ b/PhraseSwift.podspec
@@ -7,29 +7,23 @@
Pod::Spec.new do |s|
s.name = 'PhraseSwift'
- s.version = '0.1.3'
+ s.version = '1.0.0'
s.summary = 'A swift port of Squares Phrase library.'
-# This description is used to generate tags and improve search results.
-# * Think: What does it do? Why did you write it? What is the focus?
-# * Try to keep it short, snappy and to the point.
-# * Write the description between the DESC delimiters below.
-# * Finally, don't worry about the indent, CocoaPods strips it!
-
s.description = <<-DESC
-TODO: Add long description of the pod here.
+Use curly bracket placeholders within strings and be able to use the same localization phrases as on Android.
DESC
s.homepage = 'https://github.com/nextbike/phrase-swift'
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
- s.author = { 'Jan Meier' => 'meier@nextbike.com' }
+ s.author = { 'Jonas Vogel' => 'vogel@nextbike.com' }
s.source = { :git => 'https://github.com/nextbike/phrase-swift.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
- s.swift_versions = ['4', '5']
+ s.swift_versions = ['5']
- s.source_files = 'PhraseSwift/PhraseSwift/*.swift', 'PhraseSwift/PhraseSwift/Extensions/*.swift'
+ s.source_files = 'Sources/PhraseSwift/*.swift', 'Sources/PhraseSwift/Extensions/*.swift'
- s.frameworks = 'UIKit'
+ s.frameworks = 'Foundation'
end
diff --git a/PhraseSwift/PhraseSwift.xcodeproj/project.pbxproj b/PhraseSwift/PhraseSwift.xcodeproj/project.pbxproj
deleted file mode 100755
index 117e35b..0000000
--- a/PhraseSwift/PhraseSwift.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,497 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 50;
- objects = {
-
-/* Begin PBXBuildFile section */
- 10DB4CD423A934D10013896E /* PhraseSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10DB4CCA23A934D10013896E /* PhraseSwift.framework */; };
- 10DB4CD923A934D10013896E /* PhraseSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CD823A934D10013896E /* PhraseSwiftTests.swift */; };
- 10DB4CE523A935520013896E /* Phrase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CE423A935520013896E /* Phrase.swift */; };
- 10DB4CE823A9357B0013896E /* NSMutableAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CE723A9357B0013896E /* NSMutableAttributedString+Extensions.swift */; };
- 10DB4CEA23A9358D0013896E /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CE923A9358D0013896E /* String+Extensions.swift */; };
- 10DB4CEC23AA42A60013896E /* PhraseConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CEB23AA42A60013896E /* PhraseConfig.swift */; };
- 10DB4CEE23AA440A0013896E /* PhraseLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CED23AA440A0013896E /* PhraseLogger.swift */; };
- 10DB4CF023AA56390013896E /* PhraseCharacterSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CEF23AA56390013896E /* PhraseCharacterSet.swift */; };
- 10DB4CF223AA567B0013896E /* PhraseConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CF123AA567B0013896E /* PhraseConstant.swift */; };
- 10DB4CF423AA57EE0013896E /* CharValidation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DB4CF323AA57EE0013896E /* CharValidation.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
- 10DB4CD523A934D10013896E /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 10DB4CC123A934D10013896E /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 10DB4CC923A934D10013896E;
- remoteInfo = PhraseSwift;
- };
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
- 10DB4CCA23A934D10013896E /* PhraseSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PhraseSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 10DB4CCE23A934D10013896E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 10DB4CD323A934D10013896E /* PhraseSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PhraseSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
- 10DB4CD823A934D10013896E /* PhraseSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhraseSwiftTests.swift; sourceTree = ""; };
- 10DB4CDA23A934D10013896E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- 10DB4CE423A935520013896E /* Phrase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Phrase.swift; sourceTree = ""; };
- 10DB4CE723A9357B0013896E /* NSMutableAttributedString+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+Extensions.swift"; sourceTree = ""; };
- 10DB4CE923A9358D0013896E /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; };
- 10DB4CEB23AA42A60013896E /* PhraseConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhraseConfig.swift; sourceTree = ""; };
- 10DB4CED23AA440A0013896E /* PhraseLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhraseLogger.swift; sourceTree = ""; };
- 10DB4CEF23AA56390013896E /* PhraseCharacterSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhraseCharacterSet.swift; sourceTree = ""; };
- 10DB4CF123AA567B0013896E /* PhraseConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhraseConstant.swift; sourceTree = ""; };
- 10DB4CF323AA57EE0013896E /* CharValidation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharValidation.swift; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 10DB4CC723A934D10013896E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 10DB4CD023A934D10013896E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 10DB4CD423A934D10013896E /* PhraseSwift.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 10DB4CC023A934D10013896E = {
- isa = PBXGroup;
- children = (
- 10DB4CCC23A934D10013896E /* PhraseSwift */,
- 10DB4CD723A934D10013896E /* PhraseSwiftTests */,
- 10DB4CCB23A934D10013896E /* Products */,
- );
- sourceTree = "";
- };
- 10DB4CCB23A934D10013896E /* Products */ = {
- isa = PBXGroup;
- children = (
- 10DB4CCA23A934D10013896E /* PhraseSwift.framework */,
- 10DB4CD323A934D10013896E /* PhraseSwiftTests.xctest */,
- );
- name = Products;
- sourceTree = "";
- };
- 10DB4CCC23A934D10013896E /* PhraseSwift */ = {
- isa = PBXGroup;
- children = (
- 10DB4CE623A9355F0013896E /* Extensions */,
- 10DB4CCE23A934D10013896E /* Info.plist */,
- 10DB4CF323AA57EE0013896E /* CharValidation.swift */,
- 10DB4CE423A935520013896E /* Phrase.swift */,
- 10DB4CEB23AA42A60013896E /* PhraseConfig.swift */,
- 10DB4CF123AA567B0013896E /* PhraseConstant.swift */,
- 10DB4CED23AA440A0013896E /* PhraseLogger.swift */,
- 10DB4CEF23AA56390013896E /* PhraseCharacterSet.swift */,
- );
- path = PhraseSwift;
- sourceTree = "";
- };
- 10DB4CD723A934D10013896E /* PhraseSwiftTests */ = {
- isa = PBXGroup;
- children = (
- 10DB4CD823A934D10013896E /* PhraseSwiftTests.swift */,
- 10DB4CDA23A934D10013896E /* Info.plist */,
- );
- path = PhraseSwiftTests;
- sourceTree = "";
- };
- 10DB4CE623A9355F0013896E /* Extensions */ = {
- isa = PBXGroup;
- children = (
- 10DB4CE723A9357B0013896E /* NSMutableAttributedString+Extensions.swift */,
- 10DB4CE923A9358D0013896E /* String+Extensions.swift */,
- );
- path = Extensions;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 10DB4CC523A934D10013896E /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
- 10DB4CC923A934D10013896E /* PhraseSwift */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 10DB4CDE23A934D10013896E /* Build configuration list for PBXNativeTarget "PhraseSwift" */;
- buildPhases = (
- 10DB4CC523A934D10013896E /* Headers */,
- 10DB4CC623A934D10013896E /* Sources */,
- 10DB4CC723A934D10013896E /* Frameworks */,
- 10DB4CC823A934D10013896E /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = PhraseSwift;
- productName = PhraseSwift;
- productReference = 10DB4CCA23A934D10013896E /* PhraseSwift.framework */;
- productType = "com.apple.product-type.framework";
- };
- 10DB4CD223A934D10013896E /* PhraseSwiftTests */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 10DB4CE123A934D10013896E /* Build configuration list for PBXNativeTarget "PhraseSwiftTests" */;
- buildPhases = (
- 10DB4CCF23A934D10013896E /* Sources */,
- 10DB4CD023A934D10013896E /* Frameworks */,
- 10DB4CD123A934D10013896E /* Resources */,
- );
- buildRules = (
- );
- dependencies = (
- 10DB4CD623A934D10013896E /* PBXTargetDependency */,
- );
- name = PhraseSwiftTests;
- productName = PhraseSwiftTests;
- productReference = 10DB4CD323A934D10013896E /* PhraseSwiftTests.xctest */;
- productType = "com.apple.product-type.bundle.unit-test";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 10DB4CC123A934D10013896E /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastSwiftUpdateCheck = 1110;
- LastUpgradeCheck = 1110;
- ORGANIZATIONNAME = "Onur Torna";
- TargetAttributes = {
- 10DB4CC923A934D10013896E = {
- CreatedOnToolsVersion = 11.1;
- LastSwiftMigration = 1110;
- };
- 10DB4CD223A934D10013896E = {
- CreatedOnToolsVersion = 11.1;
- };
- };
- };
- buildConfigurationList = 10DB4CC423A934D10013896E /* Build configuration list for PBXProject "PhraseSwift" */;
- compatibilityVersion = "Xcode 9.3";
- developmentRegion = en;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 10DB4CC023A934D10013896E;
- productRefGroup = 10DB4CCB23A934D10013896E /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 10DB4CC923A934D10013896E /* PhraseSwift */,
- 10DB4CD223A934D10013896E /* PhraseSwiftTests */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 10DB4CC823A934D10013896E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 10DB4CD123A934D10013896E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 10DB4CC623A934D10013896E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 10DB4CF423AA57EE0013896E /* CharValidation.swift in Sources */,
- 10DB4CF023AA56390013896E /* PhraseCharacterSet.swift in Sources */,
- 10DB4CE823A9357B0013896E /* NSMutableAttributedString+Extensions.swift in Sources */,
- 10DB4CEA23A9358D0013896E /* String+Extensions.swift in Sources */,
- 10DB4CEE23AA440A0013896E /* PhraseLogger.swift in Sources */,
- 10DB4CEC23AA42A60013896E /* PhraseConfig.swift in Sources */,
- 10DB4CE523A935520013896E /* Phrase.swift in Sources */,
- 10DB4CF223AA567B0013896E /* PhraseConstant.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 10DB4CCF23A934D10013896E /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 10DB4CD923A934D10013896E /* PhraseSwiftTests.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXTargetDependency section */
- 10DB4CD623A934D10013896E /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = 10DB4CC923A934D10013896E /* PhraseSwift */;
- targetProxy = 10DB4CD523A934D10013896E /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
-/* Begin XCBuildConfiguration section */
- 10DB4CDC23A934D10013896E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
- MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
- MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Debug;
- };
- 10DB4CDD23A934D10013896E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_ENABLE_OBJC_WEAK = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- MTL_FAST_MATH = YES;
- SDKROOT = iphoneos;
- SWIFT_COMPILATION_MODE = wholemodule;
- SWIFT_OPTIMIZATION_LEVEL = "-O";
- VALIDATE_PRODUCT = YES;
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
- };
- name = Release;
- };
- 10DB4CDF23A934D10013896E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = PhraseSwift/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- MARKETING_VERSION = 1.0.0;
- PRODUCT_BUNDLE_IDENTIFIER = net.nextbike.phrase.ios;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 10DB4CE023A934D10013896E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- INFOPLIST_FILE = PhraseSwift/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- MARKETING_VERSION = 1.0.0;
- PRODUCT_BUNDLE_IDENTIFIER = net.nextbike.phrase.ios;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
- SKIP_INSTALL = YES;
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
- 10DB4CE223A934D10013896E /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = PhraseSwiftTests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = net.nextbike.phrase.ios.PhraseSwiftTests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Debug;
- };
- 10DB4CE323A934D10013896E /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
- CODE_SIGN_STYLE = Automatic;
- INFOPLIST_FILE = PhraseSwiftTests/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/Frameworks",
- "@loader_path/Frameworks",
- );
- PRODUCT_BUNDLE_IDENTIFIER = net.nextbike.phrase.ios.PhraseSwiftTests;
- PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 5.0;
- TARGETED_DEVICE_FAMILY = "1,2";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 10DB4CC423A934D10013896E /* Build configuration list for PBXProject "PhraseSwift" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 10DB4CDC23A934D10013896E /* Debug */,
- 10DB4CDD23A934D10013896E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 10DB4CDE23A934D10013896E /* Build configuration list for PBXNativeTarget "PhraseSwift" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 10DB4CDF23A934D10013896E /* Debug */,
- 10DB4CE023A934D10013896E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 10DB4CE123A934D10013896E /* Build configuration list for PBXNativeTarget "PhraseSwiftTests" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 10DB4CE223A934D10013896E /* Debug */,
- 10DB4CE323A934D10013896E /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 10DB4CC123A934D10013896E /* Project object */;
-}
diff --git a/PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100755
index 18d9810..0000000
--- a/PhraseSwift/PhraseSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/PhraseSwift/PhraseSwift/Info.plist b/PhraseSwift/PhraseSwift/Info.plist
deleted file mode 100755
index c0701c6..0000000
--- a/PhraseSwift/PhraseSwift/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- $(MARKETING_VERSION)
- CFBundleVersion
- $(CURRENT_PROJECT_VERSION)
-
-
diff --git a/PhraseSwift/PhraseSwiftTests/Info.plist b/PhraseSwift/PhraseSwiftTests/Info.plist
deleted file mode 100755
index 64d65ca..0000000
--- a/PhraseSwift/PhraseSwiftTests/Info.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- $(DEVELOPMENT_LANGUAGE)
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- $(PRODUCT_BUNDLE_IDENTIFIER)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- $(PRODUCT_BUNDLE_PACKAGE_TYPE)
- CFBundleShortVersionString
- 1.0
- CFBundleVersion
- 1
-
-
diff --git a/README.md b/README.md
index f929b5b..4011f1b 100755
--- a/README.md
+++ b/README.md
@@ -2,21 +2,53 @@
**Description**: Use curly bracket placeholders within strings [just like on Android](https://github.com/square/phrase). We created this in order to use the same translation phrases for both our Android and iOS apps.
-This is a lightweight port of [Phrase - Android string formatting](https://github.com/square/phrase) into Swift 5 and used in production for our iOS customer app. It has no other dependencies and can be installed using CocoaPods.
+This is a lightweight port of [Phrase - Android string formatting](https://github.com/square/phrase) into Swift 5 and used in production for our iOS customer app. It has no other dependencies and can be installed using Swift Package Manager or CocoaPods.
## Features
-- Replace placeholders with curly brackets within strings with corresponding content (`Hello, my name is {name}` becomes `"Hello, my name is Ada"`)
+- Replace placeholders with curly brackets within strings with corresponding content (`"Hello, my name is {name}"` becomes `"Hello, my name is Ada"`)
- Supports multiple placeholders per string
- When using [Phrase](https://github.com/square/phrase) for Android and [PhraseSwift](https://github.com/nextbike/phrase-swift) for iOS, you can use the same translation sources for both platforms
- Licence: [Apache 2.0](https://github.com/nextbike/phrase-swift/blob/master/LICENSE)
## Installation
-__CocoaPods only__: [CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website.
+### Swift Package Manager (SPM)
+
+_This is the recommended way to install and use this library._
+
+
+#### Within an Xcode Project
+
+In Project Settings, on the tab "Package Dependencies", click "+" and add `github.com/nextbike/phrase-swift`
+
+
+#### `Package.swift`-Based SPM Project
+
+1. Add a dependency in Package.swift:
+ ```swift
+ dependencies: [
+ .package(url: "https://github.com/nextbike/phrase-swift", from: "1.0.0")
+ ]
+ ```
+2. For each relevant target, add a dependency
+ ```swift
+ .target(
+ name: "Example",
+ dependencies: [
+ .product(name: "PhraseSwift", package: "phrase-swift"),
+ ]
+ )
+ ```
+
+Also check out [Editing a package dependency as a local package](https://developer.apple.com/documentation/xcode/editing-a-package-dependency-as-a-local-package) to work in local changes within your existing project that uses this package.
+
+### CocoaPods
+
+[CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website.
```
-pod 'PhraseSwift', :git => 'https://github.com/nextbike/phrase-swift.git'
+pod 'PhraseSwift', :git => 'https://github.com/nextbike/phrase-swift.git', '~> 1.0.0
```
## Usage
@@ -33,4 +65,4 @@ let output = Phrase.localize(source, keyValues: ["world": "nextbike"])
## How to test
-Includes a suite of unit tests to cover frequent cases of placeholder location and handling within strings. Open in Xcode and run the tests to see the coverage.
+Includes a suite of unit tests to cover frequent cases of placeholder location and handling within strings. Run `swift test` or open up the Swift Package within Xcode.
diff --git a/PhraseSwift/PhraseSwift/CharValidation.swift b/Sources/PhraseSwift/CharValidation.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/CharValidation.swift
rename to Sources/PhraseSwift/CharValidation.swift
diff --git a/PhraseSwift/PhraseSwift/Extensions/NSMutableAttributedString+Extensions.swift b/Sources/PhraseSwift/Extensions/NSMutableAttributedString+Extensions.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/Extensions/NSMutableAttributedString+Extensions.swift
rename to Sources/PhraseSwift/Extensions/NSMutableAttributedString+Extensions.swift
diff --git a/PhraseSwift/PhraseSwift/Extensions/String+Extensions.swift b/Sources/PhraseSwift/Extensions/String+Extensions.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/Extensions/String+Extensions.swift
rename to Sources/PhraseSwift/Extensions/String+Extensions.swift
diff --git a/PhraseSwift/PhraseSwift/Phrase.swift b/Sources/PhraseSwift/Phrase.swift
similarity index 99%
rename from PhraseSwift/PhraseSwift/Phrase.swift
rename to Sources/PhraseSwift/Phrase.swift
index 0eb48d2..10d7e3b 100755
--- a/PhraseSwift/PhraseSwift/Phrase.swift
+++ b/Sources/PhraseSwift/Phrase.swift
@@ -5,7 +5,7 @@
// Created by Jan Meier on 09.12.19.
//
-import UIKit
+import Foundation
public final class Phrase {
diff --git a/PhraseSwift/PhraseSwift/PhraseCharacterSet.swift b/Sources/PhraseSwift/PhraseCharacterSet.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/PhraseCharacterSet.swift
rename to Sources/PhraseSwift/PhraseCharacterSet.swift
diff --git a/PhraseSwift/PhraseSwift/PhraseConfig.swift b/Sources/PhraseSwift/PhraseConfig.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/PhraseConfig.swift
rename to Sources/PhraseSwift/PhraseConfig.swift
diff --git a/PhraseSwift/PhraseSwift/PhraseConstant.swift b/Sources/PhraseSwift/PhraseConstant.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/PhraseConstant.swift
rename to Sources/PhraseSwift/PhraseConstant.swift
diff --git a/PhraseSwift/PhraseSwift/PhraseLogger.swift b/Sources/PhraseSwift/PhraseLogger.swift
similarity index 100%
rename from PhraseSwift/PhraseSwift/PhraseLogger.swift
rename to Sources/PhraseSwift/PhraseLogger.swift
diff --git a/Sources/PhraseSwift/PhraseSwift.swift b/Sources/PhraseSwift/PhraseSwift.swift
new file mode 100644
index 0000000..1aa4e70
--- /dev/null
+++ b/Sources/PhraseSwift/PhraseSwift.swift
@@ -0,0 +1 @@
+// Intentionally left blank
diff --git a/PhraseSwift/PhraseSwiftTests/PhraseSwiftTests.swift b/Tests/PhraseSwiftTests/PhraseSwiftTests.swift
similarity index 100%
rename from PhraseSwift/PhraseSwiftTests/PhraseSwiftTests.swift
rename to Tests/PhraseSwiftTests/PhraseSwiftTests.swift