- iOS 10.0+
- Xcode 10.0+
- Swift 5.0+
TGASDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TGASDK'
import TGASDK
TGASdk.shared.configuration.lang = "\(Locale.current.languageCode ?? "")"
TGASdk.shared.configuration.statusBarStyle = .lightContent
TGASdk.shared.configuration.navigationBackImage = UIImage()
TGASdk.shared.setLogLevel(level: .all)
// env: default is empty
// appkey: SDK key to use for the instance of the TGASDK SDK
// userInfo: user information userId, userName, avatar
TGASdk.shared.initSdk(env: nil, appKey: "", userInfo: nil, delegate: self)
TGASdk.shared.openGameCenter(secUrl: "", secTitle: "")
TGASdk.shared.logout()
func tgaSdkInitSucceed() {
debugPrint("init Succeed")
}
func tgaSdkInitError(_ error: NSError) {
debugPrint("init failure\(error.localizedDescription)")
}
func tgaSdkOnLogout() {
debugPrint("sdk User logout")
}
func tgaSdkCloseGameCenter() {
debugPrint("close game Controller")
}
func tgaSdkGetUserInfo(completion: @escaping ((TGAUserInfo?) -> Void)) {
debugPrint("TGAUserInfo: user information userId, userName, avatar")
}
#import "TGASDK/TGASDK-Swift.h"
// TGASDK config attribute
TGASdk.shared.configuration.lang = [NSLocale currentLocale].languageCode;
TGASdk.shared.configuration.statusBarStyle = UIStatusBarStyleLightContent;
TGASdk.shared.configuration.navigationBackImage = [UIImage imageNamed:@"navigation_back_default"];
[TGASdk.shared initSdkWithEnv:nil appKey:@"" userInfo:nil delegate:self];
[TGASdk.shared openGameCenterWithSecUrl:nil secTitle:nil];
[TGASdk.shared logout];
-(void)tgaSdkInitSucceed {
NSLog(@"register success");
}
-(void)tgaSdkInitError:(NSError *)error {
NSLog(@"%@", [[NSString alloc] initWithFormat:@"%@%@", @"error reason: ", error.localizedDescription]);
}
-(void)tgaSdkOnLogout {
NSLog(@"sdk User logout")
}
-(void)tgaSdkCloseGameCenter {
NSLog(@"close game Controller");
}
-(void)tgaSdkGetUserInfoWithCompletion:(void (^ _Nonnull)(TGAUserInfo * _Nullable))completion {
NSLog(@"TGAUserInfo: user information userId, userName, avatar")
}
TGASDK is available under the Apache2.0 License. See the LICENSE file for more info.