7
votes

So i figure this should be really easy but after a day of Googling and playing around i still can't seem to get this working. I have a private cocoapod which downloads code from a private git repository. This is all set-up and works fine.

What i'm struggling with is i need to include localized xibs in the cocoapod. I have a LoginView which is shared code across a number of our internal apps. However we have localised versions of the view. From what i can tell due to the way cocoapods flattens out the structure it's just copying the localized xib which is causing the *.lproj directories to be lost. When i then try and use the cocoapod it seems to pick up the first xib regardless of the language setting on the device.

I'm hoping someone might be able to guide me as to how i go about retaining the folder heirachy or if there's another way to include the localised xibs into the cocoapod.

#
# Be sure to run `pod lib lint NAME.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = "ios-XX-common"
  s.version          = "1.0"
  s.summary          = "XXXXXX"
  s.description      = "Pod containing common source code used across multiple apps"
  s.homepage         = "http://www.example.com"
  s.license          = 'Copyright'
  s.author           = { xxx }
  s.source           = { :git => "xxxx:/data/git/ios-xx-common.git", :tag => 'v1.0'}
  s.platform = :ios, '7.0'
  s.requires_arc = false
  s.header_dir = 'ios-xx-common'
  s.header_mappings_dir = 'CommonSourceCode'
  s.source_files = "CommonSourceCode/**/*.{h,m}", "CommonSourceCode/CustomUIObjects/**/*.{h,m}",
                   "CommonSourceCode/Data Objects/**/*.{h,m}", "CommonSourceCode/Helpers/**/*.{h,m}", 
                   "CommonSourceCode/UID/**/*.{h,m}", "CommonSourceCode/UIViews/**/*.{h,m}",
                   "CommonSourceCode/ViewControllers/**/*.{h,m}" 
  s.resource_bundles = { 'rr-common-xibs' => ['CommonResources/Xibs/*.lproj'],
                         'rr-common-other' => ['CommonResources/Icons/*.*', 'CommonResources/IPhone/*.*', 'CommonResources/IPhoneIPad/*.*', 'CommonResources/Sounds/*.*'] }
  s.public_header_files = '**/*.h'
  s.dependencies = { 'Parse-iOS-SDK' => '~> 1.2.19', 'CocoaLumberjack' => '~> 1.7.0',
   'MBProgressHUD' => '~> 0.8', 'AFNetworking' => '~> 1.0' }
end

Thanks

1
Is this what your looking for? stackoverflow.com/questions/21168826/…Rob

1 Answers

2
votes

I think you might be after "Development Pods".

So I have two projects, a library project and an app specific project. In my library project I have a library.podspec file

Pod::Spec.new do |s|
    s.name         = "Library"
    s.version      = "0.0.1"
    s.summary      = "Shared library."
    s.description  = "This is an iOS library for shared common code across all apps"
    s.homepage     = "http://blah.com"
    s.license      = 'COMMERCIAL'
    s.author             = { "My name" => "[email protected]" }
    s.social_media_url = "http://twitter.com/blah"
    s.platform     = :ios, '8.0'
    s.source       = { :git => "https://bitbucket.org/blah/library.git", :tag => '0.0.1' }
    s.source_files  = 'Library/Classes/**/*.{h,m}', 'Library/Models/**/*.{h,m}', 'Library/ViewModels/**/*.{h,m}', 'Library/Views/**/*.{h,m}'
    s.resources = "Library/Images/**/*.png", "Library/Images/**/*.jpg", 'Library/Views/**/*.xib', "Library/Fonts/*.otf"
    s.requires_arc = true
    s.framework    = 'MapKit', 'CoreLocation'
    s.dependency 'AFNetworking'
    s.dependency 'ReactiveCocoa'
    s.dependency 'JLRoutes'
end

Then in my specific app project's Podfile...

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
link_with 'Myapp', 'Myapp-Tests'

pod 'Library', :path => '../library/'

Now when I run "pod update" for my specific app project I can see under the Pod project instead of under Pods, I have a new folder called Development Pods. Just be aware that if you add new files in your Library project, be sure to pod update again.

Peace.