我创建了一个.Framework
并包含在示例应用程序中,一切正常。我的.Framework
包含2个ViewControllers
和.swift
类。我的问题是,一旦任务完成,如何将.Framework
类中的值返回给示例应用程序。任务完成后,我需要从任何.swift
类文件中返回值。
以下是.Framework
代码,我必须从示例应用程序中调用该代码,
open class func getMerchantDetails(Values: Dictionary<String, Any>, VC: UIViewController ,NC: UINavigationController, completionHandler: CompletionHandler) {
let storyboardName = "main1"
let storyboardBundle = Bundle(for: self)
let storyboard = UIStoryboard(name: storyboardName, bundle: storyboardBundle)
if Values["secure"] == "secure"
{
let vc = storyboard.instantiateViewController(withIdentifier: "secureView") as! secureViewController
vc.merchantDetails = merchantValues
NC.pushViewController(vc, animated: true)
}else
{
let vc = storyboard.instantiateViewController(withIdentifier: "webView") as! WebViewController
vc.merchantDetails = merchantValues
NC.pushViewController(vc, animated: true)
}
}
如何从.Framework内的任何类中完成该completeHandler?
ObjectiveC
在.h文件中,我将声明以下内容
@property(strong)myCompletion _compblk;
在.m文件中,我将获得与下面相同的引用,
-(void) callQRAPI :(UIViewController *)controller :(myCompletion)compblock
{
__compblk = [compblock copy];
}
我将在任何地方使用__compblk对象来完成该过程。同样,我在Swift或其他任何方式中需要将.Framework中的值传递给示例应用程序。