Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit f5b80bc

Browse files
committed
swift format
1 parent a548386 commit f5b80bc

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

packages/quick_actions/quick_actions_ios/ios/Classes/QuickActionsPlugin.swift

+16-9
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,17 @@ public final class QuickActionsPlugin: NSObject, FlutterPlugin {
2424
@objc
2525
public init(
2626
channel: FlutterMethodChannel,
27-
shortcutStateManager: FLTShortcutStateManager = FLTShortcutStateManager())
28-
{
27+
shortcutStateManager: FLTShortcutStateManager = FLTShortcutStateManager()
28+
) {
2929
self.channel = channel
3030
self.shortcutStateManager = shortcutStateManager
3131
}
3232

3333
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
3434
switch call.method {
3535
case "setShortcutItems":
36-
guard let items = call.arguments as? [[String:Any]] else {
37-
preconditionFailure("The argument must be a list of dictionaries")
38-
}
36+
// `arguments` must be a list of dictionaries
37+
let items = call.arguments as! [[String: Any]]
3938
shortcutStateManager.setShortcutItems(items)
4039
result(nil)
4140
case "clearShortcutItems":
@@ -48,13 +47,21 @@ public final class QuickActionsPlugin: NSObject, FlutterPlugin {
4847
}
4948
}
5049

51-
public func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) -> Bool {
50+
public func application(
51+
_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem,
52+
completionHandler: @escaping (Bool) -> Void
53+
) -> Bool {
5254
handleShortcut(shortcutItem.type)
5355
return true
5456
}
5557

56-
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool {
57-
if let shortcutItem = launchOptions[UIApplication.LaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
58+
public func application(
59+
_ application: UIApplication,
60+
didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any] = [:]
61+
) -> Bool {
62+
if let shortcutItem = launchOptions[UIApplication.LaunchOptionsKey.shortcutItem]
63+
as? UIApplicationShortcutItem
64+
{
5865
// Keep hold of the shortcut type and handle it in the
5966
// `applicationDidBecomeActure:` method once the Dart MethodChannel
6067
// is initialized.
@@ -63,7 +70,7 @@ public final class QuickActionsPlugin: NSObject, FlutterPlugin {
6370
// Return false to indicate we handled the quick action to ensure
6471
// the `application:performActionFor:` method is not called (as
6572
// per Apple's documentation:
66-
// https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622935-application?language=objc).
73+
// https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622935-application).
6774
return false
6875
}
6976
return true

0 commit comments

Comments
 (0)