├── .gitignore ├── Demo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── Package.resolved ├── Package.swift ├── README.md ├── Sources ├── Extensions │ ├── TaskInfo.swift │ └── UIDevice+Free.swift ├── General │ ├── TRCache.swift │ ├── TRCommon.swift │ ├── TRDownloadTask.swift │ ├── TRSessionConfiguration.swift │ ├── TRSessionManager.swift │ └── TRURLConvertible.swift ├── Info.plist └── TiercelObjCBridge.h ├── TiercelObjCBridge.podspec ├── TiercelObjCBridge.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist └── TiercelObjCBridge.xcworkspace ├── contents.xcworkspacedata └── xcshareddata └── IDEWorkspaceChecks.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | .swiftpm/ 9 | # OSX 10 | .DS_Store 11 | 12 | ## Various settings 13 | *.pbxuser 14 | !default.pbxuser 15 | *.mode1v3 16 | !default.mode1v3 17 | *.mode2v3 18 | !default.mode2v3 19 | *.perspectivev3 20 | !default.perspectivev3 21 | xcuserdata/ 22 | 23 | ## Other 24 | *.moved-aside 25 | *.xccheckout 26 | *.xcscmblueprint 27 | 28 | ## Obj-C/Swift specific 29 | *.hmap 30 | *.ipa 31 | *.dSYM.zip 32 | *.dSYM 33 | 34 | ## Playgrounds 35 | timeline.xctimeline 36 | playground.xcworkspace 37 | 38 | # Swift Package Manager 39 | # 40 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 41 | # Packages/ 42 | # Package.pins 43 | # Package.resolved 44 | .build/ 45 | 46 | # CocoaPods 47 | # 48 | # We recommend against adding the Pods directory to your .gitignore. However 49 | # you should judge for yourself, the pros and cons are mentioned at: 50 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 51 | # 52 | Pods/ 53 | 54 | 55 | # Carthage 56 | # 57 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 58 | # Carthage/Checkouts 59 | 60 | Carthage/Build 61 | 62 | # fastlane 63 | # 64 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 65 | # screenshots whenever they are needed. 66 | # For more information about the recommended setup visit: 67 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 68 | 69 | fastlane/report.xml 70 | fastlane/Preview.html 71 | fastlane/screenshots 72 | fastlane/test_output 73 | -------------------------------------------------------------------------------- /Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Demo 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (nonatomic, strong) TRSessionManager *sessionManager; 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Demo 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | 20 | TRSessionConfiguration *configuraion = [[TRSessionConfiguration alloc] init]; 21 | configuraion.allowsCellularAccess = YES; 22 | self.sessionManager = [[TRSessionManager alloc] initWithIdentifier:@"ViewController" configuration:configuraion]; 23 | 24 | return YES; 25 | } 26 | 27 | - (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler { 28 | if (identifier == self.sessionManager.identifier) { 29 | self.sessionManager.completionHandler = completionHandler; 30 | } 31 | } 32 | 33 | 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Demo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 38 | 45 | 52 | 58 | 65 | 71 | 77 | 83 | 89 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | UILaunchStoryboardName 29 | LaunchScreen 30 | UIMainStoryboardFile 31 | Main 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Demo 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Demo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Demo 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "AppDelegate.h" 12 | 13 | @interface ViewController () 14 | 15 | @property (weak, nonatomic) IBOutlet UILabel *speedLabel; 16 | @property (weak, nonatomic) IBOutlet UILabel *progressLabel; 17 | @property (weak, nonatomic) IBOutlet UIProgressView *progressView; 18 | @property (weak, nonatomic) IBOutlet UILabel *timeRemainingLabel; 19 | @property (weak, nonatomic) IBOutlet UILabel *startDateLabel; 20 | @property (weak, nonatomic) IBOutlet UILabel *endDateLabel; 21 | @property (weak, nonatomic) IBOutlet UILabel *validationLabel; 22 | 23 | @property (nonatomic, strong) TRSessionManager *sessionManager; 24 | @property (nonatomic, strong) NSString *URLString; 25 | 26 | @end 27 | 28 | 29 | @implementation ViewController 30 | 31 | - (NSString *)URLString { 32 | 33 | if (!_URLString) { 34 | // _URLString = @"https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/OfficeMac/Microsoft_Office_2016_16.10.18021001_Installer.pkg"; 35 | _URLString = @"http://dldir1.qq.com/qqfile/QQforMac/QQ_V4.2.4.dmg"; 36 | } 37 | return _URLString; 38 | } 39 | 40 | - (void)viewDidLoad { 41 | [super viewDidLoad]; 42 | 43 | // 检查磁盘空间 44 | int64_t free = [UIDevice currentDevice].tr_freeDiskSpaceInBytes / 1024 / 1024; 45 | NSLog(@"手机剩余储存空间为: %lld", free); 46 | 47 | TRSessionManager.logLevel = TRLogLevelSimple; 48 | 49 | self.sessionManager = ((AppDelegate *)[UIApplication sharedApplication].delegate).sessionManager; 50 | 51 | if (self.sessionManager.tasks.count > 0) { 52 | TRDownloadTask *task = self.sessionManager.tasks[0]; 53 | [self updateUIWithTask:task]; 54 | } 55 | 56 | } 57 | 58 | - (void)updateUIWithTask:(TRDownloadTask *)task { 59 | double per = task.progress.fractionCompleted; 60 | self.progressLabel.text = [NSString stringWithFormat:@"progress: %.2f%%", per * 100]; 61 | self.progressView.progress = (float)per; 62 | self.speedLabel.text = [NSString stringWithFormat:@"speed: %@", [@(task.speed) tr_convertSpeedToString]]; 63 | self.timeRemainingLabel.text = [NSString stringWithFormat:@"剩余时间: %@", [@(task.timeRemaining) tr_convertTimeToString]]; 64 | self.startDateLabel.text = [NSString stringWithFormat:@"开始时间: %@", [@(task.startDate) tr_convertTimeToString]]; 65 | self.endDateLabel.text = [NSString stringWithFormat:@"结束时间: %@", [@(task.endDate) tr_convertTimeToString]]; 66 | NSString *validation; 67 | switch (task.validation) { 68 | case TRValidationUnkown: 69 | self.validationLabel.textColor = [UIColor blueColor]; 70 | validation = @"未知"; 71 | break; 72 | case TRValidationCorrect: 73 | self.validationLabel.textColor = [UIColor blueColor]; 74 | validation = @"正确"; 75 | break; 76 | case TRValidationIncorrect: 77 | self.validationLabel.textColor = [UIColor blueColor]; 78 | validation = @"错误"; 79 | break; 80 | } 81 | self.validationLabel.text = [NSString stringWithFormat:@"文件验证: %@", validation]; 82 | 83 | } 84 | 85 | - (IBAction)start:(id)sender { 86 | __weak typeof(self) weakSelf = self; 87 | [[[[[self.sessionManager downloadWithUrl:self.URLString headers:nil fileName:nil] progressOnMainQueue:YES handler:^(TRDownloadTask * _Nonnull task) { 88 | [weakSelf updateUIWithTask:task]; 89 | }] successOnMainQueue:YES handler:^(TRDownloadTask * _Nonnull task) { 90 | [weakSelf updateUIWithTask:task]; 91 | }] failureOnMainQueue:YES handler:^(TRDownloadTask * _Nonnull task) { 92 | [weakSelf updateUIWithTask:task]; 93 | }] validateFileWithCode:@"9e2a3650530b563da297c9246acaad5c" type:TRFileVerificationTypeMd5 onMainQueue:YES handler:^(TRDownloadTask * _Nonnull task) { 94 | [weakSelf updateUIWithTask:task]; 95 | if (task.validation == TRValidationCorrect) { 96 | NSLog(@"文件正确"); 97 | } else { 98 | NSLog(@"文件错误"); 99 | } 100 | }]; 101 | } 102 | 103 | - (IBAction)suspend:(id)sender { 104 | [self.sessionManager suspendWithUrl:self.URLString]; 105 | } 106 | 107 | - (IBAction)cancel:(id)sender { 108 | [self.sessionManager cancelWithUrl:self.URLString]; 109 | } 110 | 111 | - (IBAction)deleteTask:(id)sender { 112 | [self.sessionManager removeWithUrl:self.URLString]; 113 | } 114 | 115 | - (IBAction)clearDisk:(id)sender { 116 | [self.sessionManager.cache clearDiskCache]; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Danie1s 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "Tiercel", 6 | "repositoryURL": "https://github.com/Danie1s/Tiercel", 7 | "state": { 8 | "branch": null, 9 | "revision": "d08e264e97c29b50ab9d7e3e01faf42d8bdc1010", 10 | "version": "2.4.0" 11 | } 12 | } 13 | ] 14 | }, 15 | "version": 1 16 | } 17 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "TiercelObjCBridge", 8 | platforms: [.iOS(.v8)], 9 | products: [ 10 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 11 | .library( 12 | name: "TiercelObjCBridge", 13 | targets: ["TiercelObjCBridge"]) 14 | ], 15 | dependencies: [ 16 | // Dependencies declare other packages that this package depends on. 17 | // .package(url: /* package url */, from: "1.0.0"), 18 | .package(url: "https://github.com/Danie1s/Tiercel", .exact("2.4.1")) 19 | ], 20 | targets: [ 21 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 22 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 23 | .target( 24 | name: "TiercelObjCBridge", 25 | dependencies: ["Tiercel"], 26 | path: "Sources") 27 | ], 28 | swiftLanguageVersions: [.v5] 29 | ) 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TiercelObjCBridge 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/TiercelObjCBridge.svg?style=flat)](http://cocoapods.org/pods/TiercelObjCBridge) 4 | [![Platform](https://img.shields.io/cocoapods/p/TiercelObjCBridge.svg?style=flat)](http://cocoapods.org/pods/TiercelObjCBridge) 5 | [![Language](https://img.shields.io/badge/language-swift-red.svg?style=flat)]() 6 | [![Support](https://img.shields.io/badge/support-iOS%208%2B%20-brightgreen.svg?style=flat)](https://www.apple.com/nl/ios/) 7 | [![License](https://img.shields.io/cocoapods/l/TiercelObjCBridge.svg?style=flat)](http://cocoapods.org/pods/TiercelObjCBridge) 8 | 9 | TiercelObjCBridge 是使用 Swift 编写的 Tiercel 桥接扩展,只要使用 TiercelObjCBridge ,就可以在 Objective-C 上使用 Tiercel 10 | 11 | 由于 Tiercel 是纯 Swift 编写的,里面使用了一些 Swift 的特性,导致无法直接在 Objective-C 上使用,而 TiercelObjCBridge 做了一些中间处理,可以让开发者在 Objective-C 上使用 Tiercel ,但也意味会带来更高的开销成本,更低的效率。TiercelObjCBridge 将 Tiercel 上大部分功能都做了转换处理,用法和原来的 Tiercel 接近,基本满足大部分开发需求,只是由于语言的差异,存在某些功能目前没有实现 12 | 13 | 14 | 15 | ## 环境要求 16 | 17 | - iOS 8.0+ 18 | - Xcode 10.2+ 19 | - Swift 5.0+ 20 | 21 | 22 | 23 | ## 安装 24 | 25 | ### CocoaPods 26 | 27 | TiercelObjCBridge 支持 CocoaPods 集成,首先需要使用以下命令安装CocoaPod: 28 | 29 | ```bash 30 | $ gem install cocoapods 31 | ``` 32 | 33 | 在`Podfile`文件中 34 | 35 | ```ruby 36 | source 'https://github.com/CocoaPods/Specs.git' 37 | platform :ios, '8.0' 38 | use_frameworks! 39 | 40 | target '' do 41 | pod 'TiercelObjCBridge' 42 | end 43 | ``` 44 | 45 | 最后运行命令 46 | 47 | ```bash 48 | $ pod install 49 | ``` 50 | 51 | 52 | 53 | ## Demo 54 | 55 | - TiercelObjCBridge 依赖 Tiercel,所以运行 Demo 需要先下载 Tiercel 项目 56 | 57 | - 打开 TiercelObjCBridge 项目文件夹里面的`TiercelObjCBridge.xcworkspace`文件,点击菜单栏的`File`,选择`Add Files To "TiercelObjCBridge"...` ,把 Tiercel 项目中`Tiercel.xcodeproj`添加进去 58 | - 按顺序编译`Tiercel` Target、`TiercelObjCBridge` Target,最后就可以运行 Demo 59 | 60 | 61 | 62 | ## 用法 63 | 64 | TiercelObjCBridge 只是提供了桥接,本质上还是使用 Tiercel,所以在 Objective-C 上的用法和原版的用法基本一样,具体用法可以参考本项目的 Demo 和 Tiercel 的Demo。唯一注意点就是导入的方式,在需要使用 Tiercel 的文件加上以下这句宏即可 65 | 66 | ```objective-c 67 | #import 68 | ``` 69 | 70 | 71 | 72 | ## License 73 | 74 | TiercelObjCBridge is available under the MIT license. See the LICENSE file for more info. -------------------------------------------------------------------------------- /Sources/Extensions/TaskInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TaskInfo.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels Lau on 2019/11/19. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import Foundation 28 | 29 | extension NSNumber { 30 | 31 | /// 返回下载速度的字符串,如:1MB/s 32 | @objc public func tr_convertSpeedToString() -> String { 33 | let size = tr_convertBytesToString() 34 | return [size, "s"].joined(separator: "/") 35 | } 36 | 37 | /// 返回 00:00格式的字符串 38 | @objc public func tr_convertTimeToString() -> String { 39 | let formatter = DateComponentsFormatter() 40 | 41 | formatter.unitsStyle = .positional 42 | 43 | return formatter.string(from: TimeInterval(self.int64Value)) ?? "" 44 | } 45 | 46 | /// 返回字节大小的字符串 47 | @objc public func tr_convertBytesToString() -> String { 48 | return ByteCountFormatter.string(fromByteCount: Int64(self.int64Value), countStyle: .file) 49 | } 50 | 51 | 52 | @objc public func tr_convertTimeToDateString() -> String { 53 | let date = Date(timeIntervalSince1970: self.doubleValue) 54 | let formatter = DateFormatter() 55 | formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" 56 | return formatter.string(from: date) 57 | } 58 | } 59 | 60 | 61 | extension NSURL { 62 | 63 | @objc public var tr_fileName: String { 64 | return (self as URL).tr.fileName 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Sources/Extensions/UIDevice+Free.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIDevice+Free.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels Lau on 2019/11/19. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | 29 | extension UIDevice { 30 | @objc public var tr_freeDiskSpaceInBytes: Int64 { 31 | if #available(iOS 11.0, *) { 32 | if let space = try? URL(fileURLWithPath: NSHomeDirectory() as String).resourceValues(forKeys: [URLResourceKey.volumeAvailableCapacityForImportantUsageKey]).volumeAvailableCapacityForImportantUsage { 33 | return space 34 | } else { 35 | return 0 36 | } 37 | } else { 38 | if let systemAttributes = try? FileManager.default.attributesOfFileSystem(forPath: NSHomeDirectory() as String), 39 | let freeSpace = (systemAttributes[FileAttributeKey.systemFreeSize] as? NSNumber)?.int64Value { 40 | return freeSpace 41 | } else { 42 | return 0 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Sources/General/TRCache.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRCache.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels Lau on 2019/11/19. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | import Tiercel 29 | 30 | @objcMembers public class TRCache: NSObject { 31 | 32 | private let cache: Cache 33 | 34 | public var downloadPath: String { 35 | return cache.downloadPath 36 | } 37 | 38 | public var downloadTmpPath: String { 39 | return cache.downloadTmpPath 40 | } 41 | 42 | public var downloadFilePath: String { 43 | return cache.downloadFilePath 44 | } 45 | 46 | public var identifier: String { 47 | return cache.identifier 48 | } 49 | 50 | public init(_ name: String) { 51 | self.cache = Cache(name) 52 | } 53 | 54 | internal init(cache: Cache) { 55 | self.cache = cache 56 | } 57 | 58 | public func filePath(fileName: String) -> String? { 59 | return cache.filePath(fileName: fileName) 60 | } 61 | 62 | public func fileURL(fileName: String) -> URL? { 63 | return cache.fileURL(fileName: fileName) 64 | } 65 | 66 | public func fileExists(fileName: String) -> Bool { 67 | return cache.fileExists(fileName: fileName) 68 | 69 | } 70 | 71 | public func filePath(url: TRURLConvertible) -> String? { 72 | return cache.filePath(url: asURLConvertible(url)) 73 | } 74 | 75 | public func fileURL(url: TRURLConvertible) -> URL? { 76 | return cache.fileURL(url: asURLConvertible(url)) 77 | 78 | } 79 | 80 | public func fileExists(url: TRURLConvertible) -> Bool { 81 | return cache.fileExists(url: asURLConvertible(url)) 82 | 83 | } 84 | 85 | 86 | 87 | public func clearDiskCache(onMainQueue: Bool, handler: Handler?) { 88 | cache.clearDiskCache(onMainQueue: onMainQueue) { [weak self] _ in 89 | guard let self = self else { return } 90 | handler?(self) 91 | } 92 | } 93 | 94 | public func clearDiskCache() { 95 | clearDiskCache(onMainQueue: true, handler: nil) 96 | } 97 | 98 | } 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Sources/General/TRCommon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRCommon.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels Lau on 2019/11/19. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import Foundation 28 | import Tiercel 29 | 30 | @objc public enum TRStatus: Int { 31 | case waiting 32 | case running 33 | case suspended 34 | case canceled 35 | case failed 36 | case removed 37 | case succeeded 38 | 39 | case willSuspend 40 | case willCancel 41 | case willRemove 42 | 43 | internal init(_ status: Status) { 44 | switch status { 45 | case .waiting: 46 | self = .waiting 47 | case .running: 48 | self = .running 49 | case .suspended: 50 | self = .suspended 51 | case .canceled: 52 | self = .canceled 53 | case .failed: 54 | self = .failed 55 | case .removed: 56 | self = .removed 57 | case .succeeded: 58 | self = .succeeded 59 | case .willSuspend: 60 | self = .willSuspend 61 | case .willCancel: 62 | self = .willCancel 63 | case .willRemove: 64 | self = .willRemove 65 | 66 | } 67 | } 68 | } 69 | 70 | @objc public enum TRFileVerificationType : Int { 71 | case md5 72 | case sha1 73 | case sha256 74 | case sha512 75 | } 76 | 77 | @objc public enum TRLogLevel: Int { 78 | case detailed 79 | case simple 80 | case none 81 | } 82 | -------------------------------------------------------------------------------- /Sources/General/TRDownloadTask.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRDownloadTask.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels on 2019/11/18. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | import Tiercel 29 | 30 | @objcMembers public class TRDownloadTask: NSObject { 31 | 32 | @objc public enum TRValidation: Int { 33 | case unkown 34 | case correct 35 | case incorrect 36 | } 37 | 38 | internal let downloadTask: DownloadTask 39 | 40 | public var originalRequest: URLRequest? { 41 | downloadTask.originalRequest 42 | } 43 | 44 | public var currentRequest: URLRequest? { 45 | downloadTask.currentRequest 46 | } 47 | 48 | public var response: URLResponse? { 49 | downloadTask.response 50 | } 51 | 52 | public var statusCode: Int { 53 | downloadTask.statusCode ?? -1 54 | } 55 | 56 | public var filePath: String { 57 | return downloadTask.filePath 58 | } 59 | 60 | public var pathExtension: String? { 61 | return downloadTask.pathExtension 62 | } 63 | 64 | 65 | 66 | public var status: TRStatus { 67 | return TRStatus(downloadTask.status) 68 | } 69 | 70 | public var validation: TRValidation { 71 | 72 | switch downloadTask.validation { 73 | case .unkown: 74 | return .unkown 75 | case .correct: 76 | return .correct 77 | case .incorrect: 78 | return .incorrect 79 | } 80 | } 81 | 82 | public var url: URL { 83 | return downloadTask.url 84 | } 85 | 86 | 87 | public var progress: Progress { 88 | return downloadTask.progress 89 | } 90 | 91 | public var startDate: Double { 92 | return downloadTask.startDate 93 | } 94 | 95 | public var endDate: Double { 96 | return downloadTask.endDate 97 | } 98 | 99 | 100 | public var speed: Int64 { 101 | return downloadTask.speed 102 | } 103 | 104 | 105 | public var fileName: String { 106 | return downloadTask.fileName 107 | } 108 | 109 | public var timeRemaining: Int64 { 110 | return downloadTask.timeRemaining 111 | } 112 | 113 | public var error: Error? { 114 | return downloadTask.error 115 | } 116 | 117 | 118 | internal init(_ downloadTask: DownloadTask) { 119 | self.downloadTask = downloadTask; 120 | } 121 | 122 | 123 | @discardableResult 124 | public func validateFile(code: String, 125 | type: TRFileVerificationType, 126 | onMainQueue: Bool = true, 127 | handler: @escaping Handler) -> Self { 128 | let convertType: FileVerificationType 129 | switch type { 130 | case .md5: 131 | convertType = .md5 132 | case .sha1: 133 | convertType = .sha1 134 | case .sha256: 135 | convertType = .sha256 136 | case .sha512: 137 | convertType = .sha512 138 | } 139 | downloadTask.validateFile(code: code, type: convertType, onMainQueue: onMainQueue) { [weak self] _ in 140 | guard let self = self else { return } 141 | handler(self) 142 | } 143 | return self 144 | } 145 | 146 | @discardableResult 147 | public func progress(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 148 | downloadTask.progress(onMainQueue: onMainQueue) { [weak self] _ in 149 | guard let self = self else { return } 150 | handler(self) 151 | } 152 | return self 153 | } 154 | 155 | @discardableResult 156 | public func success(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 157 | downloadTask.success(onMainQueue: onMainQueue) { [weak self] _ in 158 | guard let self = self else { return } 159 | handler(self) 160 | } 161 | return self 162 | 163 | } 164 | 165 | @discardableResult 166 | public func failure(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 167 | downloadTask.failure(onMainQueue: onMainQueue) { [weak self] _ in 168 | guard let self = self else { return } 169 | handler(self) 170 | } 171 | return self 172 | } 173 | 174 | } 175 | -------------------------------------------------------------------------------- /Sources/General/TRSessionConfiguration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRSessionConfiguration.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | import Tiercel 29 | 30 | @objcMembers public class TRSessionConfiguration: NSObject { 31 | 32 | internal weak var sessionManager: SessionManager? 33 | 34 | // 请求超时时间 35 | public var timeoutIntervalForRequest: TimeInterval = 60.0 { 36 | didSet { 37 | sessionManager?.configuration.timeoutIntervalForRequest = timeoutIntervalForRequest 38 | } 39 | } 40 | 41 | // 最大并发数 42 | private var _maxConcurrentTasksLimit: Int = MaxConcurrentTasksLimit { 43 | didSet { 44 | sessionManager?.configuration.maxConcurrentTasksLimit = _maxConcurrentTasksLimit 45 | } 46 | } 47 | public var maxConcurrentTasksLimit: Int { 48 | get { 49 | return _maxConcurrentTasksLimit 50 | } 51 | set { 52 | if newValue > MaxConcurrentTasksLimit { 53 | _maxConcurrentTasksLimit = MaxConcurrentTasksLimit 54 | } else if newValue < 1 { 55 | _maxConcurrentTasksLimit = 1 56 | } else { 57 | _maxConcurrentTasksLimit = newValue 58 | } 59 | } 60 | } 61 | 62 | // 是否允许蜂窝网络下载 63 | public var allowsCellularAccess: Bool = false { 64 | didSet { 65 | sessionManager?.configuration.allowsCellularAccess = allowsCellularAccess 66 | } 67 | } 68 | 69 | } 70 | 71 | var MaxConcurrentTasksLimit: Int { 72 | if #available(iOS 11.0, *) { 73 | return 6 74 | } else { 75 | return 3 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Sources/General/TRSessionManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRSessionManager.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import UIKit 28 | import Tiercel 29 | 30 | @objcMembers public class TRSessionManager: NSObject { 31 | 32 | private let sessionManager: SessionManager 33 | 34 | public static var logLevel: TRLogLevel = .detailed { 35 | didSet { 36 | switch logLevel { 37 | case .detailed: 38 | SessionManager.logLevel = .detailed 39 | case .simple: 40 | SessionManager.logLevel = .simple 41 | case .none: 42 | SessionManager.logLevel = .none 43 | } 44 | } 45 | } 46 | 47 | public static var isControlNetworkActivityIndicator = true { 48 | didSet { 49 | SessionManager.isControlNetworkActivityIndicator = isControlNetworkActivityIndicator 50 | } 51 | } 52 | 53 | public let operationQueue: DispatchQueue 54 | 55 | public let cache: TRCache 56 | 57 | public let identifier: String 58 | 59 | public var completionHandler: (() -> Void)? { 60 | get { 61 | return sessionManager.completionHandler 62 | } 63 | set { 64 | sessionManager.completionHandler = newValue 65 | } 66 | } 67 | 68 | 69 | public var configuration: TRSessionConfiguration { 70 | didSet { 71 | configuration.sessionManager = sessionManager 72 | var config = SessionConfiguration() 73 | config.timeoutIntervalForRequest = configuration.timeoutIntervalForRequest 74 | config.maxConcurrentTasksLimit = configuration.maxConcurrentTasksLimit 75 | config.allowsCellularAccess = configuration.allowsCellularAccess 76 | sessionManager.configuration = config 77 | } 78 | } 79 | 80 | public var status: TRStatus { 81 | return TRStatus(sessionManager.status) 82 | } 83 | 84 | public private(set) var tasks: [TRDownloadTask] = [] 85 | 86 | 87 | public var completedTasks: [TRDownloadTask] { 88 | return tasks.filter { $0.status == .succeeded } 89 | } 90 | 91 | public var progress: Progress { 92 | return sessionManager.progress 93 | } 94 | 95 | public var speed: Int64 { 96 | return sessionManager.speed 97 | } 98 | 99 | public var timeRemaining: Int64 { 100 | return sessionManager.timeRemaining 101 | } 102 | 103 | public init(identifier: String, 104 | configuration: TRSessionConfiguration, 105 | operationQueue: DispatchQueue) { 106 | self.identifier = identifier 107 | self.operationQueue = operationQueue 108 | var config = SessionConfiguration() 109 | config.timeoutIntervalForRequest = configuration.timeoutIntervalForRequest 110 | config.maxConcurrentTasksLimit = configuration.maxConcurrentTasksLimit 111 | config.allowsCellularAccess = configuration.allowsCellularAccess 112 | self.configuration = configuration 113 | sessionManager = SessionManager(identifier, configuration: config, operationQueue: operationQueue) 114 | self.configuration.sessionManager = sessionManager 115 | cache = TRCache(cache: sessionManager.cache) 116 | super.init() 117 | tasks = sessionManager.tasks.map { TRDownloadTask($0) } 118 | 119 | } 120 | 121 | public convenience init(identifier: String, 122 | configuration: TRSessionConfiguration) { 123 | self.init(identifier: identifier, configuration: configuration, operationQueue: DispatchQueue(label: "com.Tiercel.SessionManager.operationQueue")) 124 | } 125 | 126 | public func invalidate() { 127 | sessionManager.invalidate() 128 | } 129 | 130 | @discardableResult 131 | public func download(url: TRURLConvertible, 132 | headers: [String: String]?, 133 | fileName: String?) -> TRDownloadTask? { 134 | if let downloadTask = sessionManager.download(asURLConvertible(url), headers: headers, fileName: fileName) { 135 | let convertDownloadTask = TRDownloadTask(downloadTask) 136 | tasks.append(convertDownloadTask) 137 | return convertDownloadTask 138 | } else { 139 | return nil 140 | } 141 | 142 | } 143 | 144 | @discardableResult 145 | public func download(url: TRURLConvertible) -> TRDownloadTask? { 146 | return download(url: url, headers: nil, fileName: nil) 147 | } 148 | 149 | 150 | 151 | @discardableResult 152 | public func multiDownload(urls: [TRURLConvertible], 153 | headers: [[String: String]]?, 154 | fileNames: [String]?) -> [TRDownloadTask] { 155 | let convertURLs = urls.map { asURLConvertible($0) } 156 | let downloadTasks = sessionManager.multiDownload(convertURLs, headers: headers, fileNames: fileNames) 157 | let convertDownloadTasks = downloadTasks.map { TRDownloadTask($0) } 158 | tasks.append(contentsOf: convertDownloadTasks) 159 | return convertDownloadTasks 160 | } 161 | 162 | 163 | @discardableResult 164 | public func multiDownload(urls: [TRURLConvertible]) -> [TRDownloadTask] { 165 | return multiDownload(urls: urls, headers: nil, fileNames: nil) 166 | } 167 | 168 | 169 | 170 | 171 | public func fetchTask(url: TRURLConvertible) -> TRDownloadTask? { 172 | do { 173 | let validURL = try url.tr_asURL() 174 | return tasks.first { $0.url == validURL } 175 | } catch { 176 | return nil 177 | } 178 | } 179 | 180 | public func start(url: TRURLConvertible) { 181 | sessionManager.start(asURLConvertible(url)) 182 | } 183 | 184 | public func start(task: TRDownloadTask) { 185 | sessionManager.start(task.downloadTask) 186 | } 187 | 188 | public func suspend(url: TRURLConvertible, onMainQueue: Bool, handler: Handler?) { 189 | sessionManager.suspend(asURLConvertible(url), onMainQueue: onMainQueue) { [weak self] _ in 190 | if let task = self?.fetchTask(url: url) { 191 | handler?(task) 192 | } 193 | } 194 | } 195 | 196 | public func suspend(url: TRURLConvertible) { 197 | suspend(url: url, onMainQueue: true, handler: nil) 198 | } 199 | 200 | 201 | public func cancel(url: TRURLConvertible, onMainQueue: Bool, handler: Handler?) { 202 | guard let task = fetchTask(url: url) else { return } 203 | tasks.removeAll { $0.url == task.url} 204 | sessionManager.cancel(asURLConvertible(url), onMainQueue: onMainQueue) { [weak self] _ in 205 | if let task = self?.fetchTask(url: url) { 206 | handler?(task) 207 | } 208 | } 209 | } 210 | 211 | public func cancel(url: TRURLConvertible) { 212 | cancel(url: url, onMainQueue: true, handler: nil) 213 | } 214 | 215 | public func remove(url: TRURLConvertible, completely: Bool, onMainQueue: Bool, handler: Handler?) { 216 | guard let task = fetchTask(url: url) else { return } 217 | tasks.removeAll { $0.url == task.url} 218 | sessionManager.remove(asURLConvertible(url), completely: completely, onMainQueue: onMainQueue) { [weak self] _ in 219 | if let task = self?.fetchTask(url: url) { 220 | handler?(task) 221 | } 222 | } 223 | } 224 | 225 | public func remove(url: TRURLConvertible) { 226 | remove(url: url, completely: false, onMainQueue: true, handler: nil) 227 | } 228 | 229 | public func totalStart() { 230 | self.tasks.forEach { task in 231 | start(task: task) 232 | } 233 | } 234 | 235 | public func totalSuspend(onMainQueue: Bool, handler: Handler?) { 236 | sessionManager.totalSuspend(onMainQueue: onMainQueue) { [weak self] _ in 237 | guard let self = self else { return } 238 | handler?(self) 239 | } 240 | } 241 | 242 | public func totalSuspend() { 243 | totalSuspend(onMainQueue: true, handler: nil) 244 | } 245 | 246 | public func totalCancel(onMainQueue: Bool, handler: Handler?) { 247 | tasks.removeAll() 248 | sessionManager.totalCancel(onMainQueue: onMainQueue) { [weak self] _ in 249 | guard let self = self else { return } 250 | handler?(self) 251 | } 252 | } 253 | 254 | public func totalCancel() { 255 | totalCancel(onMainQueue: true, handler: nil) 256 | } 257 | 258 | public func totalRemove(completely: Bool, onMainQueue: Bool, handler: Handler?) { 259 | tasks.removeAll() 260 | sessionManager.totalRemove(completely: completely, onMainQueue: onMainQueue) { [weak self] _ in 261 | guard let self = self else { return } 262 | handler?(self) 263 | } 264 | } 265 | 266 | public func totalRemove() { 267 | totalRemove(completely: false, onMainQueue: true, handler: nil) 268 | } 269 | 270 | @discardableResult 271 | public func progress(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 272 | sessionManager.progress(onMainQueue: onMainQueue) { [weak self] _ in 273 | guard let self = self else { return } 274 | handler(self) 275 | } 276 | return self 277 | } 278 | 279 | @discardableResult 280 | public func success(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 281 | sessionManager.success(onMainQueue: onMainQueue) { [weak self] _ in 282 | guard let self = self else { return } 283 | handler(self) 284 | } 285 | return self 286 | } 287 | 288 | @discardableResult 289 | public func failure(onMainQueue: Bool = true, handler: @escaping Handler) -> Self { 290 | sessionManager.failure(onMainQueue: onMainQueue) { [weak self] _ in 291 | guard let self = self else { return } 292 | handler(self) 293 | } 294 | return self 295 | } 296 | } 297 | 298 | -------------------------------------------------------------------------------- /Sources/General/TRURLConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TRURLConvertible.swift 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels on 2019/11/18. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | import Foundation 28 | import Tiercel 29 | 30 | @objc public protocol TRURLConvertible { 31 | 32 | func tr_asURL() throws -> URL 33 | } 34 | 35 | extension NSString: TRURLConvertible { 36 | 37 | public func tr_asURL() throws -> URL { 38 | return try self.asURLConvertible().asURL() 39 | } 40 | 41 | internal func asURLConvertible() -> URLConvertible { 42 | return self as String 43 | } 44 | } 45 | 46 | extension NSURL: TRURLConvertible { 47 | 48 | public func tr_asURL() throws -> URL { return try self.asURLConvertible().asURL() } 49 | 50 | internal func asURLConvertible() -> URLConvertible { 51 | return self as URL 52 | } 53 | } 54 | 55 | extension NSURLComponents: TRURLConvertible { 56 | 57 | public func tr_asURL() throws -> URL { 58 | return try self.asURLConvertible().asURL() 59 | } 60 | 61 | internal func asURLConvertible() -> URLConvertible { 62 | return self as URLComponents 63 | } 64 | } 65 | 66 | internal func asURLConvertible(_ url: TRURLConvertible) -> URLConvertible { 67 | if let temp = url as? NSString { 68 | return temp as String 69 | } else if let temp = url as? NSURL { 70 | return temp as URL 71 | } else { 72 | return url as! URLComponents 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Sources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sources/TiercelObjCBridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // TiercelObjCBridge.h 3 | // TiercelObjCBridge 4 | // 5 | // Created by Daniels on 2019/11/16. 6 | // Copyright © 2019 Daniels. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | 28 | #import 29 | 30 | //! Project version number for TiercelObjCBridge. 31 | FOUNDATION_EXPORT double TiercelObjCBridgeVersionNumber; 32 | 33 | //! Project version string for TiercelObjCBridge. 34 | FOUNDATION_EXPORT const unsigned char TiercelObjCBridgeVersionString[]; 35 | 36 | // In this header, you should import all the public headers of your framework using statements like #import 37 | 38 | 39 | -------------------------------------------------------------------------------- /TiercelObjCBridge.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = 'TiercelObjCBridge' 4 | s.version = '1.0.4' 5 | s.swift_version = '5.0' 6 | s.summary = 'TiercelObjCBridge is an extension of Tiercel.' 7 | 8 | s.homepage = 'https://github.com/Danie1s/TiercelObjCBridge' 9 | s.license = { :type => 'MIT', :file => 'LICENSE' } 10 | s.author = { 'Daniels' => '176516837@qq.com' } 11 | s.source = { :git => 'https://github.com/Danie1s/TiercelObjCBridge.git', :tag => s.version.to_s } 12 | 13 | s.ios.deployment_target = '8.0' 14 | 15 | s.source_files = 'Sources/**/*.swift' 16 | s.requires_arc = true 17 | s.frameworks = 'CFNetwork' 18 | s.dependency 'Tiercel', '2.4.1' 19 | end 20 | -------------------------------------------------------------------------------- /TiercelObjCBridge.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E101E40423838A8E0006C296 /* TRCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = E101E40323838A8E0006C296 /* TRCache.swift */; }; 11 | E101E4062383AB3F0006C296 /* TRCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = E101E4052383AB3F0006C296 /* TRCommon.swift */; }; 12 | E101E4092383D5E60006C296 /* TaskInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E101E4082383D5E60006C296 /* TaskInfo.swift */; }; 13 | E101E40B2383D9900006C296 /* UIDevice+Free.swift in Sources */ = {isa = PBXBuildFile; fileRef = E101E40A2383D9900006C296 /* UIDevice+Free.swift */; }; 14 | E1385E0C2382E03000DC580C /* TRDownloadTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1385E0B2382E03000DC580C /* TRDownloadTask.swift */; }; 15 | E1385E0E2382E0BA00DC580C /* TRURLConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1385E0D2382E0BA00DC580C /* TRURLConvertible.swift */; }; 16 | E174DA06239FA5430085FD9E /* TiercelObjCBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1DA6447237FDD73005FD6A9 /* TiercelObjCBridge.framework */; }; 17 | E174DA07239FA5430085FD9E /* TiercelObjCBridge.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E1DA6447237FDD73005FD6A9 /* TiercelObjCBridge.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 18 | E1DA644C237FDD73005FD6A9 /* TiercelObjCBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = E1DA644A237FDD73005FD6A9 /* TiercelObjCBridge.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 | E1DA6454237FDDDA005FD6A9 /* TRSessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DA6453237FDDDA005FD6A9 /* TRSessionManager.swift */; }; 20 | E1DA6460237FDFAC005FD6A9 /* Tiercel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1DA645F237FDFAC005FD6A9 /* Tiercel.framework */; }; 21 | E1DA6461237FDFAC005FD6A9 /* Tiercel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E1DA645F237FDFAC005FD6A9 /* Tiercel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 22 | E1DA646F237FE490005FD6A9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E1DA646E237FE490005FD6A9 /* AppDelegate.m */; }; 23 | E1DA6475237FE490005FD6A9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E1DA6474237FE490005FD6A9 /* ViewController.m */; }; 24 | E1DA6478237FE490005FD6A9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1DA6476237FE490005FD6A9 /* Main.storyboard */; }; 25 | E1DA647A237FE492005FD6A9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E1DA6479237FE492005FD6A9 /* Assets.xcassets */; }; 26 | E1DA647D237FE492005FD6A9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E1DA647B237FE492005FD6A9 /* LaunchScreen.storyboard */; }; 27 | E1DA6480237FE492005FD6A9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E1DA647F237FE492005FD6A9 /* main.m */; }; 28 | E1DA6485237FEF22005FD6A9 /* TRSessionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DA6484237FEF22005FD6A9 /* TRSessionConfiguration.swift */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | E174DA08239FA5430085FD9E /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = E1DA643E237FDD73005FD6A9 /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = E1DA6446237FDD73005FD6A9; 37 | remoteInfo = TiercelObjCBridge; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXCopyFilesBuildPhase section */ 42 | E174DA0A239FA5430085FD9E /* Embed Frameworks */ = { 43 | isa = PBXCopyFilesBuildPhase; 44 | buildActionMask = 2147483647; 45 | dstPath = ""; 46 | dstSubfolderSpec = 10; 47 | files = ( 48 | E174DA07239FA5430085FD9E /* TiercelObjCBridge.framework in Embed Frameworks */, 49 | ); 50 | name = "Embed Frameworks"; 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | E1DA6462237FDFAC005FD6A9 /* Embed Frameworks */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | E1DA6461237FDFAC005FD6A9 /* Tiercel.framework in Embed Frameworks */, 60 | ); 61 | name = "Embed Frameworks"; 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXCopyFilesBuildPhase section */ 65 | 66 | /* Begin PBXFileReference section */ 67 | E101E40323838A8E0006C296 /* TRCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRCache.swift; sourceTree = ""; }; 68 | E101E4052383AB3F0006C296 /* TRCommon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRCommon.swift; sourceTree = ""; }; 69 | E101E4082383D5E60006C296 /* TaskInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskInfo.swift; sourceTree = ""; }; 70 | E101E40A2383D9900006C296 /* UIDevice+Free.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIDevice+Free.swift"; sourceTree = ""; }; 71 | E1385E0B2382E03000DC580C /* TRDownloadTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRDownloadTask.swift; sourceTree = ""; }; 72 | E1385E0D2382E0BA00DC580C /* TRURLConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRURLConvertible.swift; sourceTree = ""; }; 73 | E1DA6447237FDD73005FD6A9 /* TiercelObjCBridge.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TiercelObjCBridge.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | E1DA644A237FDD73005FD6A9 /* TiercelObjCBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TiercelObjCBridge.h; sourceTree = ""; }; 75 | E1DA644B237FDD73005FD6A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 76 | E1DA6453237FDDDA005FD6A9 /* TRSessionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRSessionManager.swift; sourceTree = ""; }; 77 | E1DA6456237FDE04005FD6A9 /* Tiercel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Tiercel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | E1DA645A237FDF9A005FD6A9 /* Tiercel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Tiercel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | E1DA645E237FDFA6005FD6A9 /* Tiercel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Tiercel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | E1DA645F237FDFAC005FD6A9 /* Tiercel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Tiercel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | E1DA646B237FE490005FD6A9 /* TiercelObjCBridge-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TiercelObjCBridge-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | E1DA646D237FE490005FD6A9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 83 | E1DA646E237FE490005FD6A9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 84 | E1DA6473237FE490005FD6A9 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 85 | E1DA6474237FE490005FD6A9 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 86 | E1DA6477237FE490005FD6A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 87 | E1DA6479237FE492005FD6A9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 88 | E1DA647C237FE492005FD6A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 89 | E1DA647E237FE492005FD6A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 90 | E1DA647F237FE492005FD6A9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 91 | E1DA6484237FEF22005FD6A9 /* TRSessionConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TRSessionConfiguration.swift; sourceTree = ""; }; 92 | /* End PBXFileReference section */ 93 | 94 | /* Begin PBXFrameworksBuildPhase section */ 95 | E1DA6444237FDD73005FD6A9 /* Frameworks */ = { 96 | isa = PBXFrameworksBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | E1DA6460237FDFAC005FD6A9 /* Tiercel.framework in Frameworks */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | E1DA6468237FE490005FD6A9 /* Frameworks */ = { 104 | isa = PBXFrameworksBuildPhase; 105 | buildActionMask = 2147483647; 106 | files = ( 107 | E174DA06239FA5430085FD9E /* TiercelObjCBridge.framework in Frameworks */, 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | /* End PBXFrameworksBuildPhase section */ 112 | 113 | /* Begin PBXGroup section */ 114 | E101E4072383D5C30006C296 /* Extensions */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | E101E4082383D5E60006C296 /* TaskInfo.swift */, 118 | E101E40A2383D9900006C296 /* UIDevice+Free.swift */, 119 | ); 120 | path = Extensions; 121 | sourceTree = ""; 122 | }; 123 | E1DA643D237FDD73005FD6A9 = { 124 | isa = PBXGroup; 125 | children = ( 126 | E1DA6449237FDD73005FD6A9 /* Sources */, 127 | E1DA646C237FE490005FD6A9 /* Demo */, 128 | E1DA6448237FDD73005FD6A9 /* Products */, 129 | E1DA6455237FDE04005FD6A9 /* Frameworks */, 130 | ); 131 | sourceTree = ""; 132 | }; 133 | E1DA6448237FDD73005FD6A9 /* Products */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | E1DA6447237FDD73005FD6A9 /* TiercelObjCBridge.framework */, 137 | E1DA646B237FE490005FD6A9 /* TiercelObjCBridge-Demo.app */, 138 | ); 139 | name = Products; 140 | sourceTree = ""; 141 | }; 142 | E1DA6449237FDD73005FD6A9 /* Sources */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | E1DA644A237FDD73005FD6A9 /* TiercelObjCBridge.h */, 146 | E1DA644B237FDD73005FD6A9 /* Info.plist */, 147 | E101E4072383D5C30006C296 /* Extensions */, 148 | E1DA6452237FDDAF005FD6A9 /* General */, 149 | ); 150 | path = Sources; 151 | sourceTree = ""; 152 | }; 153 | E1DA6452237FDDAF005FD6A9 /* General */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | E101E4052383AB3F0006C296 /* TRCommon.swift */, 157 | E1DA6484237FEF22005FD6A9 /* TRSessionConfiguration.swift */, 158 | E1DA6453237FDDDA005FD6A9 /* TRSessionManager.swift */, 159 | E1385E0B2382E03000DC580C /* TRDownloadTask.swift */, 160 | E1385E0D2382E0BA00DC580C /* TRURLConvertible.swift */, 161 | E101E40323838A8E0006C296 /* TRCache.swift */, 162 | ); 163 | path = General; 164 | sourceTree = ""; 165 | }; 166 | E1DA6455237FDE04005FD6A9 /* Frameworks */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | E1DA645F237FDFAC005FD6A9 /* Tiercel.framework */, 170 | E1DA645A237FDF9A005FD6A9 /* Tiercel.framework */, 171 | E1DA645E237FDFA6005FD6A9 /* Tiercel.framework */, 172 | E1DA6456237FDE04005FD6A9 /* Tiercel.framework */, 173 | ); 174 | name = Frameworks; 175 | sourceTree = ""; 176 | }; 177 | E1DA646C237FE490005FD6A9 /* Demo */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | E1DA646D237FE490005FD6A9 /* AppDelegate.h */, 181 | E1DA646E237FE490005FD6A9 /* AppDelegate.m */, 182 | E1DA6473237FE490005FD6A9 /* ViewController.h */, 183 | E1DA6474237FE490005FD6A9 /* ViewController.m */, 184 | E1DA6476237FE490005FD6A9 /* Main.storyboard */, 185 | E1DA6479237FE492005FD6A9 /* Assets.xcassets */, 186 | E1DA647B237FE492005FD6A9 /* LaunchScreen.storyboard */, 187 | E1DA647E237FE492005FD6A9 /* Info.plist */, 188 | E1DA647F237FE492005FD6A9 /* main.m */, 189 | ); 190 | path = Demo; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXGroup section */ 194 | 195 | /* Begin PBXHeadersBuildPhase section */ 196 | E1DA6442237FDD73005FD6A9 /* Headers */ = { 197 | isa = PBXHeadersBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | E1DA644C237FDD73005FD6A9 /* TiercelObjCBridge.h in Headers */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | /* End PBXHeadersBuildPhase section */ 205 | 206 | /* Begin PBXNativeTarget section */ 207 | E1DA6446237FDD73005FD6A9 /* TiercelObjCBridge */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = E1DA644F237FDD73005FD6A9 /* Build configuration list for PBXNativeTarget "TiercelObjCBridge" */; 210 | buildPhases = ( 211 | E1DA6442237FDD73005FD6A9 /* Headers */, 212 | E1DA6443237FDD73005FD6A9 /* Sources */, 213 | E1DA6444237FDD73005FD6A9 /* Frameworks */, 214 | E1DA6445237FDD73005FD6A9 /* Resources */, 215 | E1DA6462237FDFAC005FD6A9 /* Embed Frameworks */, 216 | ); 217 | buildRules = ( 218 | ); 219 | dependencies = ( 220 | ); 221 | name = TiercelObjCBridge; 222 | productName = TiercelObjCBridge; 223 | productReference = E1DA6447237FDD73005FD6A9 /* TiercelObjCBridge.framework */; 224 | productType = "com.apple.product-type.framework"; 225 | }; 226 | E1DA646A237FE490005FD6A9 /* Demo */ = { 227 | isa = PBXNativeTarget; 228 | buildConfigurationList = E1DA6481237FE492005FD6A9 /* Build configuration list for PBXNativeTarget "Demo" */; 229 | buildPhases = ( 230 | E1DA6467237FE490005FD6A9 /* Sources */, 231 | E1DA6468237FE490005FD6A9 /* Frameworks */, 232 | E1DA6469237FE490005FD6A9 /* Resources */, 233 | E174DA0A239FA5430085FD9E /* Embed Frameworks */, 234 | ); 235 | buildRules = ( 236 | ); 237 | dependencies = ( 238 | E174DA09239FA5430085FD9E /* PBXTargetDependency */, 239 | ); 240 | name = Demo; 241 | productName = Demo; 242 | productReference = E1DA646B237FE490005FD6A9 /* TiercelObjCBridge-Demo.app */; 243 | productType = "com.apple.product-type.application"; 244 | }; 245 | /* End PBXNativeTarget section */ 246 | 247 | /* Begin PBXProject section */ 248 | E1DA643E237FDD73005FD6A9 /* Project object */ = { 249 | isa = PBXProject; 250 | attributes = { 251 | LastUpgradeCheck = 1120; 252 | ORGANIZATIONNAME = Daniels; 253 | TargetAttributes = { 254 | E1DA6446237FDD73005FD6A9 = { 255 | CreatedOnToolsVersion = 11.2.1; 256 | LastSwiftMigration = 1120; 257 | }; 258 | E1DA646A237FE490005FD6A9 = { 259 | CreatedOnToolsVersion = 11.2.1; 260 | LastSwiftMigration = 1120; 261 | }; 262 | }; 263 | }; 264 | buildConfigurationList = E1DA6441237FDD73005FD6A9 /* Build configuration list for PBXProject "TiercelObjCBridge" */; 265 | compatibilityVersion = "Xcode 9.3"; 266 | developmentRegion = en; 267 | hasScannedForEncodings = 0; 268 | knownRegions = ( 269 | en, 270 | Base, 271 | ); 272 | mainGroup = E1DA643D237FDD73005FD6A9; 273 | productRefGroup = E1DA6448237FDD73005FD6A9 /* Products */; 274 | projectDirPath = ""; 275 | projectRoot = ""; 276 | targets = ( 277 | E1DA6446237FDD73005FD6A9 /* TiercelObjCBridge */, 278 | E1DA646A237FE490005FD6A9 /* Demo */, 279 | ); 280 | }; 281 | /* End PBXProject section */ 282 | 283 | /* Begin PBXResourcesBuildPhase section */ 284 | E1DA6445237FDD73005FD6A9 /* Resources */ = { 285 | isa = PBXResourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | E1DA6469237FE490005FD6A9 /* Resources */ = { 292 | isa = PBXResourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | E1DA647D237FE492005FD6A9 /* LaunchScreen.storyboard in Resources */, 296 | E1DA647A237FE492005FD6A9 /* Assets.xcassets in Resources */, 297 | E1DA6478237FE490005FD6A9 /* Main.storyboard in Resources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXResourcesBuildPhase section */ 302 | 303 | /* Begin PBXSourcesBuildPhase section */ 304 | E1DA6443237FDD73005FD6A9 /* Sources */ = { 305 | isa = PBXSourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | E101E4062383AB3F0006C296 /* TRCommon.swift in Sources */, 309 | E101E40B2383D9900006C296 /* UIDevice+Free.swift in Sources */, 310 | E101E4092383D5E60006C296 /* TaskInfo.swift in Sources */, 311 | E1385E0C2382E03000DC580C /* TRDownloadTask.swift in Sources */, 312 | E1DA6454237FDDDA005FD6A9 /* TRSessionManager.swift in Sources */, 313 | E101E40423838A8E0006C296 /* TRCache.swift in Sources */, 314 | E1DA6485237FEF22005FD6A9 /* TRSessionConfiguration.swift in Sources */, 315 | E1385E0E2382E0BA00DC580C /* TRURLConvertible.swift in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | E1DA6467237FE490005FD6A9 /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | E1DA6475237FE490005FD6A9 /* ViewController.m in Sources */, 324 | E1DA646F237FE490005FD6A9 /* AppDelegate.m in Sources */, 325 | E1DA6480237FE492005FD6A9 /* main.m in Sources */, 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | /* End PBXSourcesBuildPhase section */ 330 | 331 | /* Begin PBXTargetDependency section */ 332 | E174DA09239FA5430085FD9E /* PBXTargetDependency */ = { 333 | isa = PBXTargetDependency; 334 | target = E1DA6446237FDD73005FD6A9 /* TiercelObjCBridge */; 335 | targetProxy = E174DA08239FA5430085FD9E /* PBXContainerItemProxy */; 336 | }; 337 | /* End PBXTargetDependency section */ 338 | 339 | /* Begin PBXVariantGroup section */ 340 | E1DA6476237FE490005FD6A9 /* Main.storyboard */ = { 341 | isa = PBXVariantGroup; 342 | children = ( 343 | E1DA6477237FE490005FD6A9 /* Base */, 344 | ); 345 | name = Main.storyboard; 346 | sourceTree = ""; 347 | }; 348 | E1DA647B237FE492005FD6A9 /* LaunchScreen.storyboard */ = { 349 | isa = PBXVariantGroup; 350 | children = ( 351 | E1DA647C237FE492005FD6A9 /* Base */, 352 | ); 353 | name = LaunchScreen.storyboard; 354 | sourceTree = ""; 355 | }; 356 | /* End PBXVariantGroup section */ 357 | 358 | /* Begin XCBuildConfiguration section */ 359 | E1DA644D237FDD73005FD6A9 /* Debug */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ALWAYS_SEARCH_USER_PATHS = NO; 363 | CLANG_ANALYZER_NONNULL = YES; 364 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_ENABLE_OBJC_WEAK = YES; 370 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_COMMA = YES; 373 | CLANG_WARN_CONSTANT_CONVERSION = YES; 374 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 386 | CLANG_WARN_STRICT_PROTOTYPES = YES; 387 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 388 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 389 | CLANG_WARN_UNREACHABLE_CODE = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | COPY_PHASE_STRIP = NO; 392 | CURRENT_PROJECT_VERSION = 1; 393 | DEBUG_INFORMATION_FORMAT = dwarf; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | ENABLE_TESTABILITY = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu11; 397 | GCC_DYNAMIC_NO_PIC = NO; 398 | GCC_NO_COMMON_BLOCKS = YES; 399 | GCC_OPTIMIZATION_LEVEL = 0; 400 | GCC_PREPROCESSOR_DEFINITIONS = ( 401 | "DEBUG=1", 402 | "$(inherited)", 403 | ); 404 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 405 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 406 | GCC_WARN_UNDECLARED_SELECTOR = YES; 407 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 408 | GCC_WARN_UNUSED_FUNCTION = YES; 409 | GCC_WARN_UNUSED_VARIABLE = YES; 410 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 411 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 412 | MTL_FAST_MATH = YES; 413 | ONLY_ACTIVE_ARCH = YES; 414 | SDKROOT = iphoneos; 415 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 416 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 417 | VERSIONING_SYSTEM = "apple-generic"; 418 | VERSION_INFO_PREFIX = ""; 419 | }; 420 | name = Debug; 421 | }; 422 | E1DA644E237FDD73005FD6A9 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ALWAYS_SEARCH_USER_PATHS = NO; 426 | CLANG_ANALYZER_NONNULL = YES; 427 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 428 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 429 | CLANG_CXX_LIBRARY = "libc++"; 430 | CLANG_ENABLE_MODULES = YES; 431 | CLANG_ENABLE_OBJC_ARC = YES; 432 | CLANG_ENABLE_OBJC_WEAK = YES; 433 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 434 | CLANG_WARN_BOOL_CONVERSION = YES; 435 | CLANG_WARN_COMMA = YES; 436 | CLANG_WARN_CONSTANT_CONVERSION = YES; 437 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 438 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 439 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 445 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 446 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 448 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 449 | CLANG_WARN_STRICT_PROTOTYPES = YES; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 452 | CLANG_WARN_UNREACHABLE_CODE = YES; 453 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 454 | COPY_PHASE_STRIP = NO; 455 | CURRENT_PROJECT_VERSION = 1; 456 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 457 | ENABLE_NS_ASSERTIONS = NO; 458 | ENABLE_STRICT_OBJC_MSGSEND = YES; 459 | GCC_C_LANGUAGE_STANDARD = gnu11; 460 | GCC_NO_COMMON_BLOCKS = YES; 461 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 462 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 463 | GCC_WARN_UNDECLARED_SELECTOR = YES; 464 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 465 | GCC_WARN_UNUSED_FUNCTION = YES; 466 | GCC_WARN_UNUSED_VARIABLE = YES; 467 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 468 | MTL_ENABLE_DEBUG_INFO = NO; 469 | MTL_FAST_MATH = YES; 470 | SDKROOT = iphoneos; 471 | SWIFT_COMPILATION_MODE = wholemodule; 472 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 473 | VALIDATE_PRODUCT = YES; 474 | VERSIONING_SYSTEM = "apple-generic"; 475 | VERSION_INFO_PREFIX = ""; 476 | }; 477 | name = Release; 478 | }; 479 | E1DA6450237FDD73005FD6A9 /* Debug */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | CLANG_ENABLE_MODULES = YES; 483 | CODE_SIGN_STYLE = Automatic; 484 | DEFINES_MODULE = YES; 485 | DEVELOPMENT_TEAM = Y3437T5EGX; 486 | DYLIB_COMPATIBILITY_VERSION = 1; 487 | DYLIB_CURRENT_VERSION = 1; 488 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 489 | INFOPLIST_FILE = Sources/Info.plist; 490 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 491 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 492 | LD_RUNPATH_SEARCH_PATHS = ( 493 | "$(inherited)", 494 | "@executable_path/Frameworks", 495 | "@loader_path/Frameworks", 496 | ); 497 | MARKETING_VERSION = 1.0.4; 498 | PRODUCT_BUNDLE_IDENTIFIER = com.Daniels.TiercelObjCBridge; 499 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 500 | SKIP_INSTALL = YES; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 502 | SWIFT_VERSION = 5.0; 503 | TARGETED_DEVICE_FAMILY = "1,2"; 504 | }; 505 | name = Debug; 506 | }; 507 | E1DA6451237FDD73005FD6A9 /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | CLANG_ENABLE_MODULES = YES; 511 | CODE_SIGN_STYLE = Automatic; 512 | DEFINES_MODULE = YES; 513 | DEVELOPMENT_TEAM = Y3437T5EGX; 514 | DYLIB_COMPATIBILITY_VERSION = 1; 515 | DYLIB_CURRENT_VERSION = 1; 516 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 517 | INFOPLIST_FILE = Sources/Info.plist; 518 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 519 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 520 | LD_RUNPATH_SEARCH_PATHS = ( 521 | "$(inherited)", 522 | "@executable_path/Frameworks", 523 | "@loader_path/Frameworks", 524 | ); 525 | MARKETING_VERSION = 1.0.4; 526 | PRODUCT_BUNDLE_IDENTIFIER = com.Daniels.TiercelObjCBridge; 527 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 528 | SKIP_INSTALL = YES; 529 | SWIFT_VERSION = 5.0; 530 | TARGETED_DEVICE_FAMILY = "1,2"; 531 | }; 532 | name = Release; 533 | }; 534 | E1DA6482237FE492005FD6A9 /* Debug */ = { 535 | isa = XCBuildConfiguration; 536 | buildSettings = { 537 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 538 | CLANG_ENABLE_MODULES = YES; 539 | CODE_SIGN_STYLE = Automatic; 540 | DEVELOPMENT_TEAM = Y3437T5EGX; 541 | INFOPLIST_FILE = Demo/Info.plist; 542 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 543 | LD_RUNPATH_SEARCH_PATHS = ( 544 | "$(inherited)", 545 | "@executable_path/Frameworks", 546 | ); 547 | PRODUCT_BUNDLE_IDENTIFIER = "com.Daniels.TiercelObjCBridge-Demo"; 548 | PRODUCT_NAME = "TiercelObjCBridge-Demo"; 549 | SWIFT_OBJC_BRIDGING_HEADER = "Demo/Demo-Bridging-Header.h"; 550 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 551 | SWIFT_VERSION = 5.0; 552 | TARGETED_DEVICE_FAMILY = "1,2"; 553 | }; 554 | name = Debug; 555 | }; 556 | E1DA6483237FE492005FD6A9 /* Release */ = { 557 | isa = XCBuildConfiguration; 558 | buildSettings = { 559 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 560 | CLANG_ENABLE_MODULES = YES; 561 | CODE_SIGN_STYLE = Automatic; 562 | DEVELOPMENT_TEAM = Y3437T5EGX; 563 | INFOPLIST_FILE = Demo/Info.plist; 564 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 565 | LD_RUNPATH_SEARCH_PATHS = ( 566 | "$(inherited)", 567 | "@executable_path/Frameworks", 568 | ); 569 | PRODUCT_BUNDLE_IDENTIFIER = "com.Daniels.TiercelObjCBridge-Demo"; 570 | PRODUCT_NAME = "TiercelObjCBridge-Demo"; 571 | SWIFT_OBJC_BRIDGING_HEADER = "Demo/Demo-Bridging-Header.h"; 572 | SWIFT_VERSION = 5.0; 573 | TARGETED_DEVICE_FAMILY = "1,2"; 574 | }; 575 | name = Release; 576 | }; 577 | /* End XCBuildConfiguration section */ 578 | 579 | /* Begin XCConfigurationList section */ 580 | E1DA6441237FDD73005FD6A9 /* Build configuration list for PBXProject "TiercelObjCBridge" */ = { 581 | isa = XCConfigurationList; 582 | buildConfigurations = ( 583 | E1DA644D237FDD73005FD6A9 /* Debug */, 584 | E1DA644E237FDD73005FD6A9 /* Release */, 585 | ); 586 | defaultConfigurationIsVisible = 0; 587 | defaultConfigurationName = Release; 588 | }; 589 | E1DA644F237FDD73005FD6A9 /* Build configuration list for PBXNativeTarget "TiercelObjCBridge" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | E1DA6450237FDD73005FD6A9 /* Debug */, 593 | E1DA6451237FDD73005FD6A9 /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | E1DA6481237FE492005FD6A9 /* Build configuration list for PBXNativeTarget "Demo" */ = { 599 | isa = XCConfigurationList; 600 | buildConfigurations = ( 601 | E1DA6482237FE492005FD6A9 /* Debug */, 602 | E1DA6483237FE492005FD6A9 /* Release */, 603 | ); 604 | defaultConfigurationIsVisible = 0; 605 | defaultConfigurationName = Release; 606 | }; 607 | /* End XCConfigurationList section */ 608 | }; 609 | rootObject = E1DA643E237FDD73005FD6A9 /* Project object */; 610 | } 611 | -------------------------------------------------------------------------------- /TiercelObjCBridge.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TiercelObjCBridge.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TiercelObjCBridge.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TiercelObjCBridge.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | --------------------------------------------------------------------------------