diff --git a/.gitignore b/.gitignore index c06aa2e..d419a96 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ build/ *.perspectivev3 !default.perspectivev3 xcuserdata/ +*.xcuserdatad *.xccheckout profile *.moved-aside diff --git a/.swift-version b/.swift-version index f398a20..7ed6ff8 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 \ No newline at end of file +5 diff --git a/.travis.yml b/.travis.yml index d8bd69f..5e6655f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,33 @@ -language: objective-c -osx_image: xcode8 +language: swift +osx_image: xcode10 env: global: - LC_CTYPE=en_US.UTF-8 - LANG=en_US.UTF-8 - WORKSPACE=Localize.xcworkspace - IOS_FRAMEWORK_SCHEME="LocalizeTests" - - IOS_SDK=iphonesimulator10.0 + - IOS_SDK=iphonesimulator12.0 - EXAMPLE_SCHEME="Example" matrix: - - DESTINATION="OS=10.0,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=12.0,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=11.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=10.1,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + before_install: - gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet + - brew install swiftlint + script: - set -o pipefail - xcodebuild -version - xcodebuild -showsdks + - swiftlint + + # Build Framework + - xcodebuild -workspace "$WORKSPACE" -scheme "Localize" -sdk "$SDK" -destination "$DESTINATION" + # Build Framework in Debug and Run Tests if specified - if [ $RUN_TESTS == "YES" ]; then xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty; @@ -34,10 +44,14 @@ script: # Build Example in Debug if specified - if [ $BUILD_EXAMPLE == "YES" ]; then + xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty; xcodebuild -workspace "$WORKSPACE" -scheme "$EXAMPLE_SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty; fi # Run `pod lib lint` if specified - if [ $POD_LINT == "YES" ]; then pod lib lint; - fi \ No newline at end of file + fi + +after_success: + - bash <(curl -s https://codecov.io/bash) -J 'LocalizeTests' -t cba7ac32-fe0f-4d63-977c-bc2b5588a082 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 44504a9..903a5cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,100 +1,233 @@ # Change Log + All notable changes to this project will be documented in this file. `Localize` adheres to [Semantic Versioning](http://semver.org/). +## [2.3.0](https://github.com/andresilvagomez/Localize/releases/tag/2.3.0) + +Released on 2019-04-30. + +- Pluralizations + - By [Andres Silva](https://github.com/andresilvagomez). + +--- + +## [2.2.0](https://github.com/andresilvagomez/Localize/releases/tag/2.2.0) + +Released on 2019-03-28. + +- Added function to check if key exist +- Added Swift 5 + - By [Andres Silva](https://github.com/andresilvagomez). + +--- + +## [2.1.0](https://github.com/andresilvagomez/Localize/releases/tag/2.1.0) + +Released on 2018-10-24. + +- Added auto localize flag to UI components. + - By [adbqpa](https://github.com/adbqpa) in Pull Request [#44](https://github.com/andresilvagomez/Localize/pull/44). +- Added support for custom providers + - By [Andres Silva](https://github.com/andresilvagomez). + +--- + +## [2.0.5](https://github.com/andresilvagomez/Localize/releases/tag/2.0.5) + +Released on 2018-09-26. + +- Swift 4.2 Support. + - By [Gustavo Graña](https://github.com/ggrana) in Pull Request [#36](https://github.com/andresilvagomez/Localize/pull/36). + +--- + +## [2.0.4](https://github.com/andresilvagomez/Localize/releases/tag/2.0.4) + +Released on 2018-09-20. + +- Swift 4.2 Support. + - By [Daniel Clelland](https://github.com/dclelland) in Pull Request [#34](https://github.com/andresilvagomez/Localize/pull/34). + +--- + +## [2.0.3](https://github.com/andresilvagomez/Localize/releases/tag/2.0.3) + +Released on 2018-05-15. + +### Added + +- Fix localize strings when user only has a one string file. + - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request + [#27](https://github.com/andresilvagomez/Localize/pull/27). + +--- + +## [2.0.2](https://github.com/andresilvagomez/Localize/releases/tag/2.0.2) + +Released on 2018-05-10. + +### Added + +- Improve strings with extended languajes like to es-mx for defaults localizations. + - By [Benjamin Erhart](https://github.com/tladesignz) in Pull Request + [#25](https://github.com/andresilvagomez/Localize/pull/25). + +--- + +## [2.0.1](https://github.com/andresilvagomez/Localize/releases/tag/2.0.1) + +Released on 2018-04-15. + +### Added + +- Include testing with cocoapods. +- Code coverage 99+. +- General changes to improve test. +- Included in awesome ios. + - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request + [#23](https://github.com/andresilvagomez/Localize/pull/23). + +--- + +## [2.0.0](https://github.com/andresilvagomez/Localize/releases/tag/2.0.0) + +Released on 2018-04-12. + +### Added + +- Transfer ownership to [andresilvagomez](https://github.com/andresilvagomez/Localize) +- Swift 4.1 Support. +- Faster. +- Localize.currentLanguage. +- Localize.availableLanguages. +- Segment controls localize key using "," and base. +- UIView components tested. + - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request + [#22](https://github.com/andresilvagomez/Localize/pull/22). + +--- + +## [1.5.2](https://github.com/andresilvagomez/Localize/releases/tag/1.5.2) + +Released on 2017-09-27. + +### Added + +- Swift 4. +- By [Andres Silva](https://github.com/andresilvagomez) in Pull Request + [#18](https://github.com/andresilvagomez/Localize/pull/18). + --- -## [1.5.1](https://github.com/kekiiwaa/Localize/releases/tag/1.5.1) +## [1.5.1](https://github.com/andresilvagomez/Localize/releases/tag/1.5.1) + Released on 2017-08-10. -#### Added +### Added + - Fix with country code. - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#14](https://github.com/Kekiiwaa/Localize/pull/17). + [#17](https://github.com/andresilvagomez/Localize/pull/17). --- -## [1.5.0](https://github.com/kekiiwaa/Localize/releases/tag/1.5.0) +## [1.5.0](https://github.com/andresilvagomez/Localize/releases/tag/1.5.0) + Released on 2017-08-08. -#### Added +### Added + - Localize UI elements with @IBInspectable. - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#14](https://github.com/Kekiiwaa/Localize/pull/14). + [#14](https://github.com/andresilvagomez/Localize/pull/14). + +### Deleted -#### Deleted - - Delete custom classes for UI elements in favor to @IBInspectable extensions. - - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#14](https://github.com/Kekiiwaa/Localize/pull/14). +- Delete custom classes for UI elements in favor to @IBInspectable extensions. + - By [Andres Silva](https://github.com/andresilvagomez) in Pull Request + [#14](https://github.com/andresilvagomez/Localize/pull/14). --- -## [1.4.0](https://github.com/kekiiwaa/Localize/releases/tag/1.4.0) +## [1.4.0](https://github.com/andresilvagomez/Localize/releases/tag/1.4.0) + Released on 2017-07-10. -#### Added +### Added + - Dynamic bundle. - Update bundle. - Added by [Benjamin Erhart](https://github.com/tladesignz) in Pull Request - [#13](https://github.com/Kekiiwaa/Localize/pull/13). + [#13](https://github.com/andresilvagomez/Localize/pull/13). + +### Updated -#### Updated - Remove enums for language. - Fixed #localize with placeholder replacement. - Added by [Benjamin Erhart](https://github.com/tladesignz) in Pull Request - [#13](https://github.com/kekiiwaa/Localize/pull/13). + [#13](https://github.com/andresilvagomez/Localize/pull/13). --- -## [1.3.0](https://github.com/kekiiwaa/Localize/releases/tag/1.3.0) +## [1.3.0](https://github.com/andresilvagomez/Localize/releases/tag/1.3.0) + Released on 2017-02-14. -#### Added +### Added + - Support to Apple Strings. - Get your localized string using different table names. - JSON Provider and Strings Provider. - Testing mode. - 100% documented using jazzy. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#8](https://github.com/kekiiwaa/Localize/pull/4). + [#8](https://github.com/andresilvagomez/Localize/pull/4). + +### Updated -#### Updated - Not use vars to config. - Delete cache json file. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#8](https://github.com/kekiiwaa/Localize/pull/4). + [#8](https://github.com/andresilvagomez/Localize/pull/4). --- -## [1.2.0](https://github.com/kekiiwaa/Localize/releases/tag/1.2.0) +## [1.2.0](https://github.com/andresilvagomez/Localize/releases/tag/1.2.0) + Released on 2017-01-19. -#### Added +### Added + - Renamed JsonLocalized to Localize, according with the next features. - Static methods. - Config methods. - Testing mode. - Testing for more methods and cases. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#4](https://github.com/kekiiwaa/Localize/pull/4). + [#4](https://github.com/andresilvagomez/Localize/pull/4). + +### Updated -#### Updated - Config methods. - Statics calleds. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#4](https://github.com/kekiiwaa/Localize/pull/4). + [#4](https://github.com/andresilvagomez/Localize/pull/4). + +### Fixed -#### Fixed - Getting default language key when in current language key no was available. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#4](https://github.com/kekiiwaa/Localize/pull/4). + [#4](https://github.com/andresilvagomez/Localize/pull/4). --- -## [1.1](https://github.com/kekiiwaa/Localize/releases/tag/1.1) +## [1.1](https://github.com/andresilvagomez/Localize/releases/tag/1.1) + Released on 2017-01-17. -#### Added +### Added + - Documentation for all methods. - Method to detect all available languages. - Method to localize languages codes. @@ -102,9 +235,10 @@ Released on 2017-01-17. - Notification when user change a language. - Update all localized components when user change language. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#2](https://github.com/kekiiwaa/Localize/pull/2). + [#2](https://github.com/andresilvagomez/Localize/pull/2). + +### Updated -#### Updated - Updated Example. - Added by [Andres Silva](https://github.com/andresilvagomez) in Pull Request - [#2](https://github.com/kekiiwaa/Localize/pull/2). + [#2](https://github.com/andresilvagomez/Localize/pull/2). diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index fb518bf..07b1b8b 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -14,21 +14,22 @@ 9F761AEA1E3063AB00904B4B /* lang-fr.json in Resources */ = {isa = PBXBuildFile; fileRef = 9F761AE71E3063AB00904B4B /* lang-fr.json */; }; 9F8D41511E29359A00D7CE9A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F8D41501E29359A00D7CE9A /* AppDelegate.swift */; }; 9F8D41531E29359A00D7CE9A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F8D41521E29359A00D7CE9A /* ViewController.swift */; }; + 9FA387DC217E1C9F007D1D28 /* CustomLocalize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FA387DB217E1C9F007D1D28 /* CustomLocalize.swift */; }; 9FB68F231E2B5D1400D386CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F1F1E2B5D1400D386CE /* LaunchScreen.storyboard */; }; 9FB68F241E2B5D1400D386CE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9FB68F211E2B5D1400D386CE /* Main.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 9F3617451E33CB1F006E81BC /* PBXContainerItemProxy */ = { + 9FF5FC531F7C5618001C14D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 9F3617401E33CB1F006E81BC /* Localize.xcodeproj */; + containerPortal = 9FF5FC4E1F7C5618001C14D6 /* Localize.xcodeproj */; proxyType = 2; remoteGlobalIDString = 69F1B5741D955990000A2B87; remoteInfo = Localize; }; - 9F3617471E33CB1F006E81BC /* PBXContainerItemProxy */ = { + 9FF5FC551F7C5618001C14D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 9F3617401E33CB1F006E81BC /* Localize.xcodeproj */; + containerPortal = 9FF5FC4E1F7C5618001C14D6 /* Localize.xcodeproj */; proxyType = 2; remoteGlobalIDString = 9F9345531E291D4E00C400F7; remoteInfo = LocalizeTests; @@ -49,7 +50,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 9F3617401E33CB1F006E81BC /* Localize.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Localize.xcodeproj; path = ../Localize.xcodeproj; sourceTree = ""; }; 9F36174C1E33CDA1006E81BC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 9F761AE51E3063AB00904B4B /* lang-en.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-en.json"; sourceTree = ""; }; 9F761AE61E3063AB00904B4B /* lang-es.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "lang-es.json"; sourceTree = ""; }; @@ -59,8 +59,10 @@ 9F8D41501E29359A00D7CE9A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 9F8D41521E29359A00D7CE9A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 9F8D415C1E29359A00D7CE9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9FA387DB217E1C9F007D1D28 /* CustomLocalize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomLocalize.swift; sourceTree = ""; }; 9FB68F201E2B5D1400D386CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 9FB68F221E2B5D1400D386CE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9FF5FC4E1F7C5618001C14D6 /* Localize.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Localize.xcodeproj; path = ../Localize.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -74,15 +76,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 9F3617411E33CB1F006E81BC /* Products */ = { - isa = PBXGroup; - children = ( - 9F3617461E33CB1F006E81BC /* Localize.framework */, - 9F3617481E33CB1F006E81BC /* LocalizeTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; 9F761AE21E3060B100904B4B /* Supporting Files */ = { isa = PBXGroup; children = ( @@ -100,7 +93,7 @@ children = ( 9F8D414F1E29359A00D7CE9A /* Example */, 9F8D414E1E29359A00D7CE9A /* Products */, - 9F3617401E33CB1F006E81BC /* Localize.xcodeproj */, + 9FF5FC4E1F7C5618001C14D6 /* Localize.xcodeproj */, ); sourceTree = ""; }; @@ -117,6 +110,7 @@ children = ( 9F8D41501E29359A00D7CE9A /* AppDelegate.swift */, 9F8D41521E29359A00D7CE9A /* ViewController.swift */, + 9FA387DB217E1C9F007D1D28 /* CustomLocalize.swift */, 9FB68F1F1E2B5D1400D386CE /* LaunchScreen.storyboard */, 9FB68F211E2B5D1400D386CE /* Main.storyboard */, 9F36174C1E33CDA1006E81BC /* Images.xcassets */, @@ -125,6 +119,15 @@ path = Example; sourceTree = ""; }; + 9FF5FC4F1F7C5618001C14D6 /* Products */ = { + isa = PBXGroup; + children = ( + 9FF5FC541F7C5618001C14D6 /* Localize.framework */, + 9FF5FC561F7C5618001C14D6 /* LocalizeTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -153,18 +156,18 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Kekiiwaa "; TargetAttributes = { 9F8D414C1E29359A00D7CE9A = { CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; + ProvisioningStyle = Manual; }; }; }; buildConfigurationList = 9F8D41481E29359A00D7CE9A /* Build configuration list for PBXProject "Example" */; compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -176,8 +179,8 @@ projectDirPath = ""; projectReferences = ( { - ProductGroup = 9F3617411E33CB1F006E81BC /* Products */; - ProjectRef = 9F3617401E33CB1F006E81BC /* Localize.xcodeproj */; + ProductGroup = 9FF5FC4F1F7C5618001C14D6 /* Products */; + ProjectRef = 9FF5FC4E1F7C5618001C14D6 /* Localize.xcodeproj */; }, ); projectRoot = ""; @@ -188,18 +191,18 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 9F3617461E33CB1F006E81BC /* Localize.framework */ = { + 9FF5FC541F7C5618001C14D6 /* Localize.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = Localize.framework; - remoteRef = 9F3617451E33CB1F006E81BC /* PBXContainerItemProxy */; + remoteRef = 9FF5FC531F7C5618001C14D6 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 9F3617481E33CB1F006E81BC /* LocalizeTests.xctest */ = { + 9FF5FC561F7C5618001C14D6 /* LocalizeTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = LocalizeTests.xctest; - remoteRef = 9F3617471E33CB1F006E81BC /* PBXContainerItemProxy */; + remoteRef = 9FF5FC551F7C5618001C14D6 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -228,6 +231,7 @@ files = ( 9F8D41531E29359A00D7CE9A /* ViewController.swift in Sources */, 9F8D41511E29359A00D7CE9A /* AppDelegate.swift in Sources */, + 9FA387DC217E1C9F007D1D28 /* CustomLocalize.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -263,15 +267,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -294,7 +306,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -314,15 +326,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -339,7 +359,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -354,16 +374,16 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 69RRCEKXZC; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.kekiiwaa.localize; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -373,15 +393,15 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 69RRCEKXZC; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.kekiiwaa.localize; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index bbb24aa..838afcd 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index c3c0cef..1c1c849 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -2,7 +2,7 @@ // AppDelegate.swift // Example // -// Copyright © 2017 Kekkiwaa Inc. All rights reserved. +// Copyright © 2019 @andresilvagomez. // import UIKit @@ -10,11 +10,13 @@ import Localize @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) + -> Bool { + let localize = Localize.shared // Set your localize provider. localize.update(provider: .json) @@ -27,41 +29,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // If you want remove storaged languaje use localize.resetLanguage() // The used language - print(localize.language()) + print(localize.currentLanguage) // List of aviable languajes - print(localize.availableLanguages()) - + print(localize.availableLanguages) + // Or you can use static methods for all - + Localize.update(fileName: "lang") Localize.update(defaultLanguage: "fr") Localize.update(language: "en-DE") - + return true } func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } + func applicationWillTerminate(_ application: UIApplication) { + } } - diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard index 9716529..1900d8c 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Example/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -23,7 +23,7 @@ - + @@ -46,6 +46,12 @@ + + + + + +