This plugin provide customizable app group.
Because app group is strong bound to AppleID, it is hard to distribute iOS project using app group. This plugin enable each user to customize app group name at setup phase. This make easy to distribute your iOS project.
- CocoaPods 0.36
gem install cocoapods-app_group
Put followings to Podfile
:
target 'WriteToAppGroup'
target 'ReadFromAppGroup'
plugin 'cocoapods-app_group'
Then running pod install
will prompt for the keys not yet set and you can ensure everyone has the same setup.
Save group name by running following command:
pod app-group GROUP_NAME
Generate wrapper class by running following command:
pod install
Open *.xcworkspace
and enable app group of each target. Use group.$(APP_IDENTIFIER)
as app group name.
Write code using wrapper class:
#import <Foundation/Foundation.h>
@interface AppGroup : NSObject
+ (NSString *)appGroupID;
+ (NSString *)pathForResource:(NSString *)subpath;
+ (NSUserDefaults*)userDefaults;
@end
If you want to make your keys available to your whole project:
- Make sure you have a bridging header already setup.
- In the bridging header, import the generated key file:
#import <AppGroup/AppGroup.h>
If you've added the use_frameworks!
and only want your Keys to be available in
specific files, simply use Swift's import
statement. The name of the generated
module is AppGroup
.
import AppGroup
This was built with a lot of help from @banjun.
I explain how to work at Japanese document.
The gem is available as open source under the terms of the MIT License.