Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FRDIntent.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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."
s.homepage = "https://github.com/douban/FRDIntent"
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|
Expand Down
30 changes: 16 additions & 14 deletions FRDIntent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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";
Expand All @@ -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;
};
Expand All @@ -625,35 +625,37 @@
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;
};
A354CC3D1D6EA93E00830990 /* Debug */ = {
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;
};
A354CC3E1D6EA93E00830990 /* Release */ = {
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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion FRDIntent/Source/Core/RouteManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 5 additions & 2 deletions FRDIntent/Source/Intent/FRDControllerManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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]()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion FRDIntent/Source/Intent/FRDIntentReceivable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ import Foundation

- parameter extras: The extra data.
*/
init?(extras: [String: Any])
@MainActor init?(extras: [String: Any])
}
8 changes: 5 additions & 3 deletions FRDIntent/Source/URLRoutes/FRDURLRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion FRDIntentTests/ControllerManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest
@testable import FRDIntent

class FRDControllerManagerTests: XCTestCase {
@MainActor class FRDControllerManagerTests: XCTestCase {

func testNormalSearch() {

Expand Down
2 changes: 1 addition & 1 deletion FRDIntentTests/RouteManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest
@testable import FRDIntent

class RouteSearch: XCTestCase {
@MainActor class RouteSearch: XCTestCase {

var routeManager: RouteManager!

Expand Down
2 changes: 1 addition & 1 deletion FRDIntentTests/URLRoutesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import XCTest
@testable import FRDIntent

class URLRoutesTests: XCTestCase {
@MainActor class URLRoutesTests: XCTestCase {

func testURLRoutes() {
let router = FRDURLRoutes.sharedInstance
Expand Down