diff --git a/FRDIntent.podspec b/FRDIntent.podspec index dce0b0a..c98248b 100644 --- a/FRDIntent.podspec +++ b/FRDIntent.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "FRDIntent" - s.version = "0.10.4" + s.version = "0.10.6" s.summary = "FRDIntent can handle the call between view controller" s.description = "FRDIntent has two components URLRoutes and Intent, using for calling view controllers inner app or outer app." @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.license = { :type => 'MIT', :text => 'LICENSE' } s.author = { "lincode" => "guolin@douban.com" } - s.platform = :ios, "8.0" + s.platform = :ios, "13.0" s.source = { :git => "https://github.com/douban/FRDIntent.git", :tag => "#{s.version}" } s.subspec 'Intent' do |intent| diff --git a/FRDIntent.xcodeproj/project.pbxproj b/FRDIntent.xcodeproj/project.pbxproj index 2434b7e..47490dc 100644 --- a/FRDIntent.xcodeproj/project.pbxproj +++ b/FRDIntent.xcodeproj/project.pbxproj @@ -526,12 +526,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -580,11 +580,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -603,14 +603,14 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = FRDIntent/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntent; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "FRDIntent/Source/FRDIntent-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -625,13 +625,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = FRDIntent/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntent; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OBJC_BRIDGING_HEADER = "FRDIntent/Source/FRDIntent-Bridging-Header.h"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -639,10 +639,11 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = FRDIntentTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntentTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -650,10 +651,11 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = FRDIntentTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntentTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -663,11 +665,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FRDIntentDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntentDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -677,11 +679,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FRDIntentDemo/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.douban.FRDIntentDemo; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 6.0; }; name = Release; }; diff --git a/FRDIntent/Source/Core/RouteManager.swift b/FRDIntent/Source/Core/RouteManager.swift index 3ee2649..69ce875 100644 --- a/FRDIntent/Source/Core/RouteManager.swift +++ b/FRDIntent/Source/Core/RouteManager.swift @@ -16,7 +16,7 @@ import Foundation The clazz is for FRDIntent's register. The handler is for URLRoute's register. */ -class RouteManager { +class RouteManager: @unchecked Sendable { static let URLRouteURL = "URLRouteURL" diff --git a/FRDIntent/Source/Intent/FRDControllerManager.swift b/FRDIntent/Source/Intent/FRDControllerManager.swift index 5a5fabb..b8e7e37 100644 --- a/FRDIntent/Source/Intent/FRDControllerManager.swift +++ b/FRDIntent/Source/Intent/FRDControllerManager.swift @@ -11,7 +11,7 @@ import UIKit /** FRDControllerManager is a way to manage view controllers and invoke view controllers from a URL or class name. */ -public class FRDControllerManager: NSObject { +public class FRDControllerManager: NSObject, @unchecked Sendable { /// Singleton instance of FRDControllerManager @objc public static let sharedInstance = FRDControllerManager() @@ -77,6 +77,7 @@ public class FRDControllerManager: NSObject { - parameter source: The source view controller. - parameter intent: The intent for launch a new view controller. */ + @MainActor @objc public func startController(from source: UIViewController, with intent: FRDIntent) { var parameters = [String: Any]() @@ -124,6 +125,7 @@ public class FRDControllerManager: NSObject { - parameter intent: The intent for start new view controller. - parameter requestCode : this code will be returned in onControllerResult() when the view controller exits. */ + @MainActor @objc public func startControllerForResult(from source: UIViewController, with intent: FRDIntent, requestCode: Int) { typealias ControllerType = FRDIntentForResultReceivable.Type @@ -170,6 +172,7 @@ public class FRDControllerManager: NSObject { } + @MainActor private func viewController(fromClazz clazz: FRDIntentReceivable.Type?, extras: [String: Any]) -> FRDIntentReceivable? { guard let controllerClass = clazz else { return nil } return controllerClass.init(extras: extras) @@ -248,7 +251,7 @@ public extension UIViewController { - parameter extras: The datas of intent received. */ - @objc func setupExtras(_ extras: [String: Any]) { + @MainActor @objc func setupExtras(_ extras: [String: Any]) { if let title = extras[FRDIntentParameters.title] as? String { self.title = title } diff --git a/FRDIntent/Source/Intent/FRDIntentReceivable.swift b/FRDIntent/Source/Intent/FRDIntentReceivable.swift index 4f842b9..9eccea6 100644 --- a/FRDIntent/Source/Intent/FRDIntentReceivable.swift +++ b/FRDIntent/Source/Intent/FRDIntentReceivable.swift @@ -18,5 +18,5 @@ import Foundation - parameter extras: The extra data. */ - init?(extras: [String: Any]) + @MainActor init?(extras: [String: Any]) } diff --git a/FRDIntent/Source/URLRoutes/FRDURLRoutes.swift b/FRDIntent/Source/URLRoutes/FRDURLRoutes.swift index 14e5671..1b1c6fd 100644 --- a/FRDIntent/Source/URLRoutes/FRDURLRoutes.swift +++ b/FRDIntent/Source/URLRoutes/FRDURLRoutes.swift @@ -11,7 +11,7 @@ import UIKit /** FRDURLRoutes is a way to manage URL routes and invoke them from a URL. */ -public class FRDURLRoutes: NSObject { +public class FRDURLRoutes: NSObject, @unchecked Sendable { /// Singleton instance of URLRoutes. @objc public static let sharedInstance = FRDURLRoutes() @@ -87,8 +87,10 @@ public extension FRDURLRoutes { let resultForRoute = register(url) { (params: [String: Any]) in guard let url = params[RouteManager.URLRouteURL] as? URL else { return } let intent = FRDIntent(url: url) - if let topViewController = UIApplication.topViewController() { - FRDControllerManager.sharedInstance.startController(from: topViewController, with: intent) + MainActor.assumeIsolated { + if let topViewController = UIApplication.topViewController() { + FRDControllerManager.sharedInstance.startController(from: topViewController, with: intent) + } } } diff --git a/FRDIntentTests/ControllerManagerTests.swift b/FRDIntentTests/ControllerManagerTests.swift index 2af1cb3..f16b458 100644 --- a/FRDIntentTests/ControllerManagerTests.swift +++ b/FRDIntentTests/ControllerManagerTests.swift @@ -9,7 +9,7 @@ import XCTest @testable import FRDIntent -class FRDControllerManagerTests: XCTestCase { +@MainActor class FRDControllerManagerTests: XCTestCase { func testNormalSearch() { diff --git a/FRDIntentTests/RouteManagerTests.swift b/FRDIntentTests/RouteManagerTests.swift index 8040d2a..843ac0a 100644 --- a/FRDIntentTests/RouteManagerTests.swift +++ b/FRDIntentTests/RouteManagerTests.swift @@ -9,7 +9,7 @@ import XCTest @testable import FRDIntent -class RouteSearch: XCTestCase { +@MainActor class RouteSearch: XCTestCase { var routeManager: RouteManager! diff --git a/FRDIntentTests/URLRoutesTests.swift b/FRDIntentTests/URLRoutesTests.swift index 6447399..49b0871 100644 --- a/FRDIntentTests/URLRoutesTests.swift +++ b/FRDIntentTests/URLRoutesTests.swift @@ -9,7 +9,7 @@ import XCTest @testable import FRDIntent -class URLRoutesTests: XCTestCase { +@MainActor class URLRoutesTests: XCTestCase { func testURLRoutes() { let router = FRDURLRoutes.sharedInstance