提交 81b90978 authored 作者: JarvanMo's avatar JarvanMo

add swift docs & demo

上级 f6717bfc
...@@ -11,4 +11,19 @@ We have to make the headers in `WeChatOpenSDK` public in order to support swift: ...@@ -11,4 +11,19 @@ We have to make the headers in `WeChatOpenSDK` public in order to support swift:
![make_headers_public](../arts/public_headers_2.png) ![make_headers_public](../arts/public_headers_2.png)
## ## Response
\ No newline at end of file override the following functions in `AppDelegate.swift`:
```swift
import fluwx
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
// NOTE: 9.0以后使用新API接口
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
```
\ No newline at end of file
...@@ -11,4 +11,19 @@ ...@@ -11,4 +11,19 @@
![make_headers_public](../arts/public_headers_2.png) ![make_headers_public](../arts/public_headers_2.png)
## ## 回调监听
\ No newline at end of file 在你的`AppDelegate.swift`文件中重写以下方法:
```swift
import fluwx
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
// NOTE: 9.0以后使用新API接口
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
```
\ No newline at end of file
import UIKit
import Flutter
import fluwx
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
// NOTE: 9.0以后使用新API接口
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
}
//
// Generated file. Do not edit.
//
#ifndef GeneratedPluginRegistrant_h
#define GeneratedPluginRegistrant_h
#import <Flutter/Flutter.h>
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
#endif /* GeneratedPluginRegistrant_h */
//
// Generated file. Do not edit.
//
#import "GeneratedPluginRegistrant.h"
#import <fluwx/FluwxPlugin.h>
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FluwxPlugin registerWithRegistrar:[registry registrarForPlugin:@"FluwxPlugin"]];
}
@end
#import "GeneratedPluginRegistrant.h"
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论