Swifternalization icon indicating copy to clipboard operation
Swifternalization copied to clipboard

watchOS support

Open lexrus opened this issue 10 years ago • 6 comments

Hi, this project is great. I'd like to use it in my WATCH App. Do you have any plan to support watchOS?

lexrus avatar Aug 19 '15 15:08 lexrus

Hey @lexrus, it should work as is now. Just configure framework with correct NSBundle instance and you should be able to do this. If this not still work for you could you share how files are located in the project and how you're configuring it and getting localized values? If this should work but don't it means that something is broken in Swifternalization. Unfortunately I'll take a look on this probably during the weekend.

tomkowz avatar Aug 19 '15 18:08 tomkowz

Hi @tomkowz Thank you for the rapid reply. I tried to import this lib as a framework with CocoaPods. My Podfile:

use_frameworks!
inhibit_all_warnings!

...other targets...

target 'VPNOnWatchKitExtension' do
  platform :watchos
  pod 'Swifternalization',
    :git    => '[email protected]:tomkowz/Swifternalization.git',
    :branch => 'swift2'
  pod 'KeychainAccess',
    :git    => '[email protected]:kishikawakatsumi/KeychainAccess.git',
    :branch => 'swift-2.0'
end

target 'VPNOnWatchKitApp' do
  platform :watchos
  pod 'Swifternalization',
    :git    => '[email protected]:tomkowz/Swifternalization.git',
    :branch => 'swift2'
  pod 'KeychainAccess',
    :git    => '[email protected]:kishikawakatsumi/KeychainAccess.git',
    :branch => 'swift-2.0'
end

But failed while pod install:

[!] The platform of the target `VPNOnWatchKitApp` (watchOS 2.0) is not compatible with `Swifternalization (1.2)`, which does not support `watchos`.
[!] The platform of the target `VPNOnWatchKitExtension` (watchOS 2.0) is not compatible with `Swifternalization (1.2)`, which does not support `watchOS`.

If I comment out Swifternalization, the KeychainAccess can be installed without problems. I don't know what the difference between them.

lexrus avatar Aug 20 '15 02:08 lexrus

What is plaform version that you specified in Podfile? I don't see it here.

Here is my configuration that I used for example:

platform :ios, '8.0'
use_frameworks!
pod 'Swifternalization', :git => 'https://github.com/tomkowz/Swifternalization.git', :branch => 'swift2'

I don't think so you need Swifternalization for Apple Watch App target. You need it in extension because the translation files will be used by extension.

tomkowz avatar Aug 20 '15 04:08 tomkowz

The default platform for the whole project was set to iOS 9.

platform :ios, '9.0'

But I did mention above platform :watchos in targets of both WatchKitApp and WatchKitExtension.

lexrus avatar Aug 20 '15 04:08 lexrus

https://github.com/lexrus/VPNOn/blob/feature/ios9/Podfile Here is my podfile which works fine. But failed after import Swifternalization in the 2 watchOS targets.

lexrus avatar Aug 20 '15 04:08 lexrus

Ahh, right, I see. I'll fix it in the weekend.

tomkowz avatar Aug 20 '15 04:08 tomkowz