I'm new to Swift and i would be glad if anyone could help me to merge those two delegete written in two different languages. This is my problem:
ZZAppDelegate.h:
#import <UIKit/UIKit.h>
@interface ZZAppDelegate : UIResponder <UIApplicationDelegate>
@property(strong, nonatomic) UIWindow *window;
@end
ZZAppDelegate.m:
#import "ZZAppDelegate.h"
#import "PayPalMobile.h"
@implementation ZZAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction :@"TEST",PayPalEnvironmentSandbox :@"TEST"}];
return YES;
}
@end
Both in Obj-C. I have to put them inside this AppDelegate.swift method:
import UIKit
import Parse
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
.
.
.
return true
}
If i try to move this (i wrote this in swift):
PayPalMobile.initializeWithClientIdsForEnvironments(PayPalEnvironmentProduction:"TEST", PayPalEnvironmentSandbox:"TEST")
into my AppDelegate.swift method i get this error:
Extra argument 'PayPalEnvironmentSandbox' in call.
This is the description about that method:
/// For example,
/// @{PayPalEnvironmentProduction : @"my-client-id-for-Production",
/// PayPalEnvironmentSandbox : @"my-client-id-for-Sandbox"}
+ (void)initializeWithClientIdsForEnvironments:(NSDictionary *)clientIdsForEnvironments;
Also, if i remove this extra argument i get this error:
Cannot convert the expression's type (PayPalEnvironmentSandbox: StringLiteralConvertible)' to type 'StringLiteralConvertible'
About this, i read into another question that: "Objective-C automatically promoted variables, Swift does not."
PS: I got two bridging header files, one with #import "PayPalMobile.h" and another one (for parse) with #import Bolts/Bolts.h .