├── README.md ├── SemaphoreAndBolts ├── Assets.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── CCBoltsViewController.h ├── AppDelegate.h ├── main.m ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── AppDelegate.m └── CCBoltsViewController.m ├── Pods ├── Target Support Files │ ├── Bolts │ │ ├── Bolts.modulemap │ │ ├── Bolts-dummy.m │ │ ├── Bolts-prefix.pch │ │ ├── Bolts.xcconfig │ │ ├── Info.plist │ │ └── Bolts-umbrella.h │ ├── Masonry │ │ ├── Masonry.modulemap │ │ ├── Masonry-dummy.m │ │ ├── Masonry-prefix.pch │ │ ├── Masonry.xcconfig │ │ ├── Info.plist │ │ └── Masonry-umbrella.h │ └── Pods-SemaphoreAndBolts │ │ ├── Pods-SemaphoreAndBolts.modulemap │ │ ├── Pods-SemaphoreAndBolts-dummy.m │ │ ├── Pods-SemaphoreAndBolts-umbrella.h │ │ ├── Pods-SemaphoreAndBolts.debug.xcconfig │ │ ├── Pods-SemaphoreAndBolts.release.xcconfig │ │ ├── Info.plist │ │ ├── Pods-SemaphoreAndBolts-acknowledgements.markdown │ │ ├── Pods-SemaphoreAndBolts-acknowledgements.plist │ │ ├── Pods-SemaphoreAndBolts-resources.sh │ │ └── Pods-SemaphoreAndBolts-frameworks.sh ├── Masonry │ ├── Masonry │ │ ├── MASLayoutConstraint.m │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── MASLayoutConstraint.h │ │ ├── MASCompositeConstraint.h │ │ ├── Masonry.h │ │ ├── ViewController+MASAdditions.h │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── MASViewAttribute.m │ │ ├── MASViewAttribute.h │ │ ├── ViewController+MASAdditions.m │ │ ├── MASViewConstraint.h │ │ ├── MASConstraint+Private.h │ │ ├── NSArray+MASAdditions.h │ │ ├── View+MASAdditions.h │ │ ├── View+MASShorthandAdditions.h │ │ ├── MASCompositeConstraint.m │ │ ├── MASConstraintMaker.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ ├── MASUtilities.h │ │ ├── NSArray+MASAdditions.m │ │ ├── View+MASAdditions.m │ │ └── MASConstraint.h │ └── LICENSE ├── Bolts │ ├── Bolts │ │ ├── iOS │ │ │ ├── Internal │ │ │ │ ├── BFURL_Internal.h │ │ │ │ ├── BFAppLinkReturnToRefererView_Internal.h │ │ │ │ ├── BFMeasurementEvent_Internal.h │ │ │ │ └── BFAppLink_Internal.h │ │ │ ├── BFWebViewAppLinkResolver.h │ │ │ ├── BFAppLinkResolving.h │ │ │ ├── BFAppLinkTarget.m │ │ │ ├── BFAppLinkTarget.h │ │ │ ├── BFAppLink.h │ │ │ ├── BFMeasurementEvent.h │ │ │ ├── BFMeasurementEvent.m │ │ │ ├── BFAppLink.m │ │ │ ├── BFAppLinkReturnToRefererView.h │ │ │ ├── BFURL.h │ │ │ ├── BFAppLinkReturnToRefererController.h │ │ │ ├── BFAppLinkNavigation.h │ │ │ ├── BFURL.m │ │ │ └── BFAppLinkReturnToRefererController.m │ │ └── Common │ │ │ ├── Bolts.m │ │ │ ├── BFCancellationTokenRegistration.h │ │ │ ├── BFGeneric.h │ │ │ ├── Bolts.h │ │ │ ├── BFCancellationToken.h │ │ │ ├── BFCancellationTokenSource.m │ │ │ ├── BFExecutor.h │ │ │ ├── BFCancellationTokenSource.h │ │ │ ├── BFTaskCompletionSource.m │ │ │ ├── BFCancellationTokenRegistration.m │ │ │ ├── BFTaskCompletionSource.h │ │ │ ├── BFCancellationToken.m │ │ │ └── BFExecutor.m │ └── LICENSE ├── Manifest.lock └── Pods.xcodeproj │ └── xcuserdata │ └── liuchong.xcuserdatad │ └── xcschemes │ ├── xcschememanagement.plist │ ├── Bolts.xcscheme │ ├── Masonry.xcscheme │ └── Pods-SemaphoreAndBolts.xcscheme ├── Podfile ├── SemaphoreAndBolts.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── liuchong.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── SemaphoreAndBolts.xcworkspace ├── xcshareddata │ └── IDEWorkspaceChecks.plist └── contents.xcworkspacedata ├── Podfile.lock ├── SemaphoreAndBoltsTests ├── Info.plist └── SemaphoreAndBoltsTests.m └── SemaphoreAndBoltsUITests ├── Info.plist └── SemaphoreAndBoltsUITests.m /README.md: -------------------------------------------------------------------------------- 1 | # SemaphoreAndBolts 2 | GCD信号量与其替代品Bolts(Facebook出品) 3 | 4 | https://www.jianshu.com/p/0f83ac97e8ff 5 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts.modulemap: -------------------------------------------------------------------------------- 1 | framework module Bolts { 2 | umbrella header "Bolts-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Bolts : NSObject 3 | @end 4 | @implementation PodsDummy_Bolts 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.modulemap: -------------------------------------------------------------------------------- 1 | framework module Masonry { 2 | umbrella header "Masonry-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | 2 | platform :ios, '9.0' 3 | 4 | source 'https://github.com/CocoaPods/Specs.git' 5 | use_frameworks! 6 | 7 | target 'SemaphoreAndBolts' do 8 | 9 | pod 'Bolts' 10 | pod 'Masonry' 11 | 12 | end 13 | 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_SemaphoreAndBolts { 2 | umbrella header "Pods-SemaphoreAndBolts-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SemaphoreAndBolts : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SemaphoreAndBolts 5 | @end 6 | -------------------------------------------------------------------------------- /SemaphoreAndBolts.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/CCBoltsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CCBoltsViewController.h 3 | // Interview 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 刘冲. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CCBoltsViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SemaphoreAndBolts.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SemaphoreAndBolts.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SemaphoreAndBolts.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SemaphoreAndBolts 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 lc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SemaphoreAndBolts 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 lc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Bolts 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Bolts 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_SemaphoreAndBoltsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_SemaphoreAndBoltsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /SemaphoreAndBolts.xcodeproj/xcuserdata/liuchong.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SemaphoreAndBolts.xcscheme 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/Internal/BFURL_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @interface BFURL (Internal) 14 | + (BFURL *)URLForRenderBackToReferrerBarURL:(NSURL *)url; 15 | @end 16 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/Bolts.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "Bolts.h" 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | NSString *const BoltsFrameworkVersionString = @"1.9.0"; 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Masonry 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/Internal/BFAppLinkReturnToRefererView_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @interface BFAppLinkReturnToRefererView (Internal) 14 | 15 | - (CGFloat)statusBarHeight; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Bolts (1.9.0): 3 | - Bolts/AppLinks (= 1.9.0) 4 | - Bolts/Tasks (= 1.9.0) 5 | - Bolts/AppLinks (1.9.0): 6 | - Bolts/Tasks 7 | - Bolts/Tasks (1.9.0) 8 | - Masonry (1.1.0) 9 | 10 | DEPENDENCIES: 11 | - Bolts 12 | - Masonry 13 | 14 | SPEC REPOS: 15 | https://github.com/cocoapods/specs.git: 16 | - Bolts 17 | - Masonry 18 | 19 | SPEC CHECKSUMS: 20 | Bolts: ac6567323eac61e203f6a9763667d0f711be34c8 21 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 22 | 23 | PODFILE CHECKSUM: 1a20136ea9f477b0d1c2d22ee362eed300d3db2e 24 | 25 | COCOAPODS: 1.5.3 26 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Bolts (1.9.0): 3 | - Bolts/AppLinks (= 1.9.0) 4 | - Bolts/Tasks (= 1.9.0) 5 | - Bolts/AppLinks (1.9.0): 6 | - Bolts/Tasks 7 | - Bolts/Tasks (1.9.0) 8 | - Masonry (1.1.0) 9 | 10 | DEPENDENCIES: 11 | - Bolts 12 | - Masonry 13 | 14 | SPEC REPOS: 15 | https://github.com/cocoapods/specs.git: 16 | - Bolts 17 | - Masonry 18 | 19 | SPEC CHECKSUMS: 20 | Bolts: ac6567323eac61e203f6a9763667d0f711be34c8 21 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 22 | 23 | PODFILE CHECKSUM: 1a20136ea9f477b0d1c2d22ee362eed300d3db2e 24 | 25 | COCOAPODS: 1.5.3 26 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/Internal/BFMeasurementEvent_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | /*! 13 | Provides methods for posting notifications from the Bolts framework 14 | */ 15 | @interface BFMeasurementEvent (Internal) 16 | 17 | + (void)postNotificationForEventName:(NSString *)name args:(NSDictionary *)args; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Bolts/Bolts.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Bolts" -framework "Masonry" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Bolts" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Bolts/Bolts.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "Bolts" -framework "Masonry" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /SemaphoreAndBoltsTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SemaphoreAndBoltsUITests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | /*! 16 | A reference implementation for an App Link resolver that uses a hidden UIWebView 17 | to parse the HTML containing App Link metadata. 18 | */ 19 | @interface BFWebViewAppLinkResolver : NSObject 20 | 21 | /*! 22 | Gets the instance of a BFWebViewAppLinkResolver. 23 | */ 24 | + (instancetype)sharedInstance; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/liuchong.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Bolts.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | Masonry.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 1 20 | 21 | Pods-SemaphoreAndBolts.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 2 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | /*! 16 | Represents the registration of a cancellation observer with a cancellation token. 17 | Can be used to unregister the observer at a later time. 18 | */ 19 | @interface BFCancellationTokenRegistration : NSObject 20 | 21 | /*! 22 | Removes the cancellation observer registered with the token 23 | and releases all resources associated with this registration. 24 | */ 25 | - (void)dispose; 26 | 27 | @end 28 | 29 | NS_ASSUME_NONNULL_END 30 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.9.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFGeneric.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #pragma once 14 | 15 | /** 16 | This exists to use along with `BFTask` and `BFTaskCompletionSource`. 17 | 18 | Instead of returning a `BFTask` with no generic type, or a generic type of 'NSNull' 19 | when there is no usable result from a task, we use the type 'BFVoid', which will always have a value of `nil`. 20 | 21 | This allows you to provide a more enforced API contract to the caller, 22 | as sending any message to `BFVoid` will result in a compile time error. 23 | */ 24 | @class _BFVoid_Nonexistant; 25 | typedef _BFVoid_Nonexistant *BFVoid; 26 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Masonry/Masonry-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "MASCompositeConstraint.h" 14 | #import "MASConstraint+Private.h" 15 | #import "MASConstraint.h" 16 | #import "MASConstraintMaker.h" 17 | #import "MASLayoutConstraint.h" 18 | #import "Masonry.h" 19 | #import "MASUtilities.h" 20 | #import "MASViewAttribute.h" 21 | #import "MASViewConstraint.h" 22 | #import "NSArray+MASAdditions.h" 23 | #import "NSArray+MASShorthandAdditions.h" 24 | #import "NSLayoutConstraint+MASDebugAdditions.h" 25 | #import "View+MASAdditions.h" 26 | #import "View+MASShorthandAdditions.h" 27 | #import "ViewController+MASAdditions.h" 28 | 29 | FOUNDATION_EXPORT double MasonryVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Bolts/Bolts-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "BFAppLink.h" 14 | #import "BFAppLinkNavigation.h" 15 | #import "BFAppLinkResolving.h" 16 | #import "BFAppLinkReturnToRefererController.h" 17 | #import "BFAppLinkReturnToRefererView.h" 18 | #import "BFAppLinkTarget.h" 19 | #import "BFMeasurementEvent.h" 20 | #import "BFURL.h" 21 | #import "BFWebViewAppLinkResolver.h" 22 | #import "BFCancellationToken.h" 23 | #import "BFCancellationTokenRegistration.h" 24 | #import "BFCancellationTokenSource.h" 25 | #import "BFExecutor.h" 26 | #import "BFGeneric.h" 27 | #import "BFTask.h" 28 | #import "BFTaskCompletionSource.h" 29 | #import "Bolts.h" 30 | 31 | FOUNDATION_EXPORT double BoltsVersionNumber; 32 | FOUNDATION_EXPORT const unsigned char BoltsVersionString[]; 33 | 34 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; 26 | 27 | 28 | @end 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkResolving.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @class BFTask; 14 | 15 | /*! 16 | Implement this protocol to provide an alternate strategy for resolving 17 | App Links that may include pre-fetching, caching, or querying for App Link 18 | data from an index provided by a service provider. 19 | */ 20 | @protocol BFAppLinkResolving 21 | 22 | /*! 23 | Asynchronously resolves App Link data for a given URL. 24 | 25 | @param url The URL to resolve into an App Link. 26 | @returns A BFTask that will return a BFAppLink for the given URL. 27 | */ 28 | - (BFTask *)appLinkFromURLInBackground:(NSURL *)url NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension"); 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkTarget.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFAppLinkTarget.h" 12 | 13 | @interface BFAppLinkTarget () 14 | 15 | @property (nonatomic, strong, readwrite) NSURL *URL; 16 | @property (nonatomic, copy, readwrite) NSString *appStoreId; 17 | @property (nonatomic, copy, readwrite) NSString *appName; 18 | 19 | @end 20 | 21 | @implementation BFAppLinkTarget 22 | 23 | + (instancetype)appLinkTargetWithURL:(NSURL *)url 24 | appStoreId:(NSString *)appStoreId 25 | appName:(NSString *)appName { 26 | BFAppLinkTarget *target = [[self alloc] init]; 27 | target.URL = url; 28 | target.appStoreId = appStoreId; 29 | target.appName = appName; 30 | return target; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /SemaphoreAndBoltsTests/SemaphoreAndBoltsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SemaphoreAndBoltsTests.m 3 | // SemaphoreAndBoltsTests 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 lc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SemaphoreAndBoltsTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SemaphoreAndBoltsTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Pods/Masonry/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkTarget.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! 14 | Represents a target defined in App Link metadata, consisting of at least 15 | a URL, and optionally an App Store ID and name. 16 | */ 17 | @interface BFAppLinkTarget : NSObject 18 | 19 | /*! Creates a BFAppLinkTarget with the given app site and target URL. */ 20 | + (instancetype)appLinkTargetWithURL:(NSURL *)url 21 | appStoreId:(NSString *)appStoreId 22 | appName:(NSString *)appName; 23 | 24 | /*! The URL prefix for this app link target */ 25 | @property (nonatomic, strong, readonly) NSURL *URL; 26 | 27 | /*! The app ID for the app store */ 28 | @property (nonatomic, copy, readonly) NSString *appStoreId; 29 | 30 | /*! The name of the app */ 31 | @property (nonatomic, copy, readonly) NSString *appName; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/Internal/BFAppLink_Internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | FOUNDATION_EXPORT NSString *const BFAppLinkDataParameterName; 14 | FOUNDATION_EXPORT NSString *const BFAppLinkTargetKeyName; 15 | FOUNDATION_EXPORT NSString *const BFAppLinkUserAgentKeyName; 16 | FOUNDATION_EXPORT NSString *const BFAppLinkExtrasKeyName; 17 | FOUNDATION_EXPORT NSString *const BFAppLinkVersionKeyName; 18 | FOUNDATION_EXPORT NSString *const BFAppLinkRefererAppLink; 19 | FOUNDATION_EXPORT NSString *const BFAppLinkRefererAppName; 20 | FOUNDATION_EXPORT NSString *const BFAppLinkRefererUrl; 21 | 22 | @interface BFAppLink (Internal) 23 | 24 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 25 | targets:(NSArray *)targets 26 | webURL:(NSURL *)webURL 27 | isBackToReferrer:(BOOL)isBackToReferrer; 28 | 29 | /*! return if this AppLink is to go back to referrer. */ 30 | @property (nonatomic, assign, readonly, getter=isBackToReferrer) BOOL backToReferrer; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/Bolts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | 19 | #if __has_include() && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #endif 30 | 31 | 32 | NS_ASSUME_NONNULL_BEGIN 33 | 34 | /** 35 | A string containing the version of the Bolts Framework used by the current application. 36 | */ 37 | extern NSString *const BoltsFrameworkVersionString; 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationToken.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /*! 18 | A block that will be called when a token is cancelled. 19 | */ 20 | typedef void(^BFCancellationBlock)(void); 21 | 22 | /*! 23 | The consumer view of a CancellationToken. 24 | Propagates notification that operations should be canceled. 25 | A BFCancellationToken has methods to inspect whether the token has been cancelled. 26 | */ 27 | @interface BFCancellationToken : NSObject 28 | 29 | /*! 30 | Whether cancellation has been requested for this token source. 31 | */ 32 | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; 33 | 34 | /*! 35 | Register a block to be notified when the token is cancelled. 36 | If the token is already cancelled the delegate will be notified immediately. 37 | */ 38 | - (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block; 39 | 40 | @end 41 | 42 | NS_ASSUME_NONNULL_END 43 | -------------------------------------------------------------------------------- /SemaphoreAndBoltsUITests/SemaphoreAndBoltsUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SemaphoreAndBoltsUITests.m 3 | // SemaphoreAndBoltsUITests 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 lc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SemaphoreAndBoltsUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SemaphoreAndBoltsUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | - (MASViewAttribute *)mas_topLayoutGuide { 16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 17 | } 18 | - (MASViewAttribute *)mas_topLayoutGuideTop { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 23 | } 24 | 25 | - (MASViewAttribute *)mas_bottomLayoutGuide { 26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 27 | } 28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 33 | } 34 | 35 | 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationTokenSource.h" 12 | 13 | #import "BFCancellationToken.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface BFCancellationToken (BFCancellationTokenSource) 18 | 19 | - (void)cancel; 20 | - (void)cancelAfterDelay:(int)millis; 21 | 22 | - (void)dispose; 23 | - (void)throwIfDisposed; 24 | 25 | @end 26 | 27 | @implementation BFCancellationTokenSource 28 | 29 | #pragma mark - Initializer 30 | 31 | - (instancetype)init { 32 | self = [super init]; 33 | if (!self) return self; 34 | 35 | _token = [BFCancellationToken new]; 36 | 37 | return self; 38 | } 39 | 40 | + (instancetype)cancellationTokenSource { 41 | return [BFCancellationTokenSource new]; 42 | } 43 | 44 | #pragma mark - Custom Setters/Getters 45 | 46 | - (BOOL)isCancellationRequested { 47 | return _token.isCancellationRequested; 48 | } 49 | 50 | - (void)cancel { 51 | [_token cancel]; 52 | } 53 | 54 | - (void)cancelAfterDelay:(int)millis { 55 | [_token cancelAfterDelay:millis]; 56 | } 57 | 58 | - (void)dispose { 59 | [_token dispose]; 60 | } 61 | 62 | @end 63 | 64 | NS_ASSUME_NONNULL_END 65 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Pods/Bolts/LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Bolts software 4 | 5 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Facebook nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /SemaphoreAndBolts/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/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 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/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 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! The version of the App Link protocol that this library supports */ 14 | FOUNDATION_EXPORT NSString *const BFAppLinkVersion; 15 | 16 | /*! 17 | Contains App Link metadata relevant for navigation on this device 18 | derived from the HTML at a given URL. 19 | */ 20 | @interface BFAppLink : NSObject 21 | 22 | /*! 23 | Creates a BFAppLink with the given list of BFAppLinkTargets and target URL. 24 | 25 | Generally, this will only be used by implementers of the BFAppLinkResolving protocol, 26 | as these implementers will produce App Link metadata for a given URL. 27 | 28 | @param sourceURL the URL from which this App Link is derived 29 | @param targets an ordered list of BFAppLinkTargets for this platform derived 30 | from App Link metadata. 31 | @param webURL the fallback web URL, if any, for the app link. 32 | */ 33 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 34 | targets:(NSArray *)targets 35 | webURL:(NSURL *)webURL; 36 | 37 | /*! The URL from which this BFAppLink was derived */ 38 | @property (nonatomic, strong, readonly) NSURL *sourceURL; 39 | 40 | /*! 41 | The ordered list of targets applicable to this platform that will be used 42 | for navigation. 43 | */ 44 | @property (nonatomic, copy, readonly) NSArray *targets; 45 | 46 | /*! The fallback web URL to use if no targets are installed on this device. */ 47 | @property (nonatomic, strong, readonly) NSURL *webURL; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFMeasurementEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | /*! The name of the notification posted by BFMeasurementEvent */ 14 | FOUNDATION_EXPORT NSString *const BFMeasurementEventNotificationName; 15 | 16 | /*! Defines keys in the userInfo object for the notification named BFMeasurementEventNotificationName */ 17 | /*! The string field for the name of the event */ 18 | FOUNDATION_EXPORT NSString *const BFMeasurementEventNameKey; 19 | /*! The dictionary field for the arguments of the event */ 20 | FOUNDATION_EXPORT NSString *const BFMeasurementEventArgsKey; 21 | 22 | /*! Bolts Events raised by BFMeasurementEvent for Applink */ 23 | /*! 24 | The name of the event posted when [BFURL URLWithURL:] is called successfully. This represents the successful parsing of an app link URL. 25 | */ 26 | FOUNDATION_EXPORT NSString *const BFAppLinkParseEventName; 27 | 28 | /*! 29 | The name of the event posted when [BFURL URLWithInboundURL:] is called successfully. 30 | This represents parsing an inbound app link URL from a different application 31 | */ 32 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateInEventName; 33 | 34 | /*! The event raised when the user navigates from your app to other apps */ 35 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateOutEventName; 36 | 37 | /*! 38 | The event raised when the user navigates out from your app and back to the referrer app. 39 | e.g when the user leaves your app after tapping the back-to-referrer navigation bar 40 | */ 41 | FOUNDATION_EXPORT NSString *const BFAppLinkNavigateBackToReferrerEventName; 42 | 43 | @interface BFMeasurementEvent : NSObject 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFExecutor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | /*! 16 | An object that can run a given block. 17 | */ 18 | @interface BFExecutor : NSObject 19 | 20 | /*! 21 | Returns a default executor, which runs continuations immediately until the call stack gets too 22 | deep, then dispatches to a new GCD queue. 23 | */ 24 | + (instancetype)defaultExecutor; 25 | 26 | /*! 27 | Returns an executor that runs continuations on the thread where the previous task was completed. 28 | */ 29 | + (instancetype)immediateExecutor; 30 | 31 | /*! 32 | Returns an executor that runs continuations on the main thread. 33 | */ 34 | + (instancetype)mainThreadExecutor; 35 | 36 | /*! 37 | Returns a new executor that uses the given block to execute continuations. 38 | @param block The block to use. 39 | */ 40 | + (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block; 41 | 42 | /*! 43 | Returns a new executor that runs continuations on the given queue. 44 | @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. 45 | */ 46 | + (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; 47 | 48 | /*! 49 | Returns a new executor that runs continuations on the given queue. 50 | @param queue The instance of `NSOperationQueue` to run all continuations on. 51 | */ 52 | + (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; 53 | 54 | /*! 55 | Runs the given block using this executor's particular strategy. 56 | @param block The block to execute. 57 | */ 58 | - (void)execute:(void(^)(void))block; 59 | 60 | @end 61 | 62 | NS_ASSUME_NONNULL_END 63 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @class BFCancellationToken; 16 | 17 | /*! 18 | BFCancellationTokenSource represents the producer side of a CancellationToken. 19 | Signals to a CancellationToken that it should be canceled. 20 | It is a cancellation token that also has methods 21 | for changing the state of a token by cancelling it. 22 | */ 23 | @interface BFCancellationTokenSource : NSObject 24 | 25 | /*! 26 | Creates a new cancellation token source. 27 | */ 28 | + (instancetype)cancellationTokenSource; 29 | 30 | /*! 31 | The cancellation token associated with this CancellationTokenSource. 32 | */ 33 | @property (nonatomic, strong, readonly) BFCancellationToken *token; 34 | 35 | /*! 36 | Whether cancellation has been requested for this token source. 37 | */ 38 | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; 39 | 40 | /*! 41 | Cancels the token if it has not already been cancelled. 42 | */ 43 | - (void)cancel; 44 | 45 | /*! 46 | Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds. 47 | @param millis The number of milliseconds to wait before completing the returned task. 48 | If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped. 49 | */ 50 | - (void)cancelAfterDelay:(int)millis; 51 | 52 | /*! 53 | Releases all resources associated with this token source, 54 | including disposing of all registrations. 55 | */ 56 | - (void)dispose; 57 | 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/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 | } -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFTaskCompletionSource.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFTaskCompletionSource.h" 12 | 13 | #import "BFTask.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface BFTask (BFTaskCompletionSource) 18 | 19 | - (BOOL)trySetResult:(nullable id)result; 20 | - (BOOL)trySetError:(NSError *)error; 21 | - (BOOL)trySetCancelled; 22 | 23 | @end 24 | 25 | @implementation BFTaskCompletionSource 26 | 27 | #pragma mark - Initializer 28 | 29 | + (instancetype)taskCompletionSource { 30 | return [[self alloc] init]; 31 | } 32 | 33 | - (instancetype)init { 34 | self = [super init]; 35 | if (!self) return self; 36 | 37 | _task = [[BFTask alloc] init]; 38 | 39 | return self; 40 | } 41 | 42 | #pragma mark - Custom Setters/Getters 43 | 44 | - (void)setResult:(nullable id)result { 45 | if (![self.task trySetResult:result]) { 46 | [NSException raise:NSInternalInconsistencyException 47 | format:@"Cannot set the result on a completed task."]; 48 | } 49 | } 50 | 51 | - (void)setError:(NSError *)error { 52 | if (![self.task trySetError:error]) { 53 | [NSException raise:NSInternalInconsistencyException 54 | format:@"Cannot set the error on a completed task."]; 55 | } 56 | } 57 | 58 | - (void)cancel { 59 | if (![self.task trySetCancelled]) { 60 | [NSException raise:NSInternalInconsistencyException 61 | format:@"Cannot cancel a completed task."]; 62 | } 63 | } 64 | 65 | - (BOOL)trySetResult:(nullable id)result { 66 | return [self.task trySetResult:result]; 67 | } 68 | 69 | - (BOOL)trySetError:(NSError *)error { 70 | return [self.task trySetError:error]; 71 | } 72 | 73 | - (BOOL)trySetCancelled { 74 | return [self.task trySetCancelled]; 75 | } 76 | 77 | @end 78 | 79 | NS_ASSUME_NONNULL_END 80 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFMeasurementEvent.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFMeasurementEvent_Internal.h" 12 | 13 | NSString *const BFMeasurementEventNotificationName = @"com.parse.bolts.measurement_event"; 14 | 15 | NSString *const BFMeasurementEventNameKey = @"event_name"; 16 | NSString *const BFMeasurementEventArgsKey = @"event_args"; 17 | 18 | /* app Link Event raised by this BFURL */ 19 | NSString *const BFAppLinkParseEventName = @"al_link_parse"; 20 | NSString *const BFAppLinkNavigateInEventName = @"al_nav_in"; 21 | 22 | /*! AppLink events raised in this class */ 23 | NSString *const BFAppLinkNavigateOutEventName = @"al_nav_out"; 24 | NSString *const BFAppLinkNavigateBackToReferrerEventName = @"al_ref_back_out"; 25 | 26 | __attribute__((noinline)) void warnOnMissingEventName() { 27 | NSLog(@"Warning: Missing event name when logging bolts measurement event. \n" 28 | " Ignoring this event in logging."); 29 | } 30 | 31 | @implementation BFMeasurementEvent { 32 | NSString *_name; 33 | NSDictionary *_args; 34 | } 35 | 36 | - (void)postNotification { 37 | if (!_name) { 38 | warnOnMissingEventName(); 39 | return; 40 | } 41 | NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; 42 | NSDictionary *userInfo = @{BFMeasurementEventNameKey : _name, 43 | BFMeasurementEventArgsKey : _args}; 44 | 45 | [center postNotificationName:BFMeasurementEventNotificationName 46 | object:self 47 | userInfo:userInfo]; 48 | } 49 | 50 | - (instancetype)initEventWithName:(NSString *)name args:(NSDictionary *)args { 51 | if ((self = [super init])) { 52 | _name = name; 53 | _args = args ? args : @{}; 54 | } 55 | return self; 56 | } 57 | 58 | + (void)postNotificationForEventName:(NSString *)name args:(NSDictionary *)args { 59 | [[[self alloc] initEventWithName:name args:args] postNotification]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationTokenRegistration.h" 12 | 13 | #import "BFCancellationToken.h" 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | @interface BFCancellationTokenRegistration () 18 | 19 | @property (nonatomic, weak) BFCancellationToken *token; 20 | @property (nullable, nonatomic, strong) BFCancellationBlock cancellationObserverBlock; 21 | @property (nonatomic, strong) NSObject *lock; 22 | @property (nonatomic) BOOL disposed; 23 | 24 | @end 25 | 26 | @interface BFCancellationToken (BFCancellationTokenRegistration) 27 | 28 | - (void)unregisterRegistration:(BFCancellationTokenRegistration *)registration; 29 | 30 | @end 31 | 32 | @implementation BFCancellationTokenRegistration 33 | 34 | + (instancetype)registrationWithToken:(BFCancellationToken *)token delegate:(BFCancellationBlock)delegate { 35 | BFCancellationTokenRegistration *registration = [BFCancellationTokenRegistration new]; 36 | registration.token = token; 37 | registration.cancellationObserverBlock = delegate; 38 | return registration; 39 | } 40 | 41 | - (instancetype)init { 42 | self = [super init]; 43 | if (!self) return self; 44 | 45 | _lock = [NSObject new]; 46 | 47 | return self; 48 | } 49 | 50 | - (void)dispose { 51 | @synchronized(self.lock) { 52 | if (self.disposed) { 53 | return; 54 | } 55 | self.disposed = YES; 56 | } 57 | 58 | BFCancellationToken *token = self.token; 59 | if (token != nil) { 60 | [token unregisterRegistration:self]; 61 | self.token = nil; 62 | } 63 | self.cancellationObserverBlock = nil; 64 | } 65 | 66 | - (void)notifyDelegate { 67 | @synchronized(self.lock) { 68 | [self throwIfDisposed]; 69 | self.cancellationObserverBlock(); 70 | } 71 | } 72 | 73 | - (void)throwIfDisposed { 74 | NSAssert(!self.disposed, @"Object already disposed"); 75 | } 76 | 77 | @end 78 | 79 | NS_ASSUME_NONNULL_END 80 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLink.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFAppLink_Internal.h" 12 | 13 | NSString *const BFAppLinkDataParameterName = @"al_applink_data"; 14 | NSString *const BFAppLinkTargetKeyName = @"target_url"; 15 | NSString *const BFAppLinkUserAgentKeyName = @"user_agent"; 16 | NSString *const BFAppLinkExtrasKeyName = @"extras"; 17 | NSString *const BFAppLinkRefererAppLink = @"referer_app_link"; 18 | NSString *const BFAppLinkRefererAppName = @"app_name"; 19 | NSString *const BFAppLinkRefererUrl = @"url"; 20 | NSString *const BFAppLinkVersionKeyName = @"version"; 21 | NSString *const BFAppLinkVersion = @"1.0"; 22 | 23 | @interface BFAppLink () 24 | 25 | @property (nonatomic, strong, readwrite) NSURL *sourceURL; 26 | @property (nonatomic, copy, readwrite) NSArray *targets; 27 | @property (nonatomic, strong, readwrite) NSURL *webURL; 28 | 29 | @property (nonatomic, assign, readwrite, getter=isBackToReferrer) BOOL backToReferrer; 30 | 31 | @end 32 | 33 | @implementation BFAppLink 34 | 35 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 36 | targets:(NSArray *)targets 37 | webURL:(NSURL *)webURL 38 | isBackToReferrer:(BOOL)isBackToReferrer { 39 | BFAppLink *link = [[self alloc] initWithIsBackToReferrer:isBackToReferrer]; 40 | link.sourceURL = sourceURL; 41 | link.targets = [targets copy]; 42 | link.webURL = webURL; 43 | return link; 44 | } 45 | 46 | + (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL 47 | targets:(NSArray *)targets 48 | webURL:(NSURL *)webURL { 49 | return [self appLinkWithSourceURL:sourceURL 50 | targets:targets 51 | webURL:webURL 52 | isBackToReferrer:NO]; 53 | } 54 | 55 | - (BFAppLink *)initWithIsBackToReferrer:(BOOL)backToReferrer { 56 | if ((self = [super init])) { 57 | _backToReferrer = backToReferrer; 58 | } 59 | return self; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/liuchong.xcuserdatad/xcschemes/Bolts.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/liuchong.xcuserdatad/xcschemes/Masonry.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | 52 | 53 | 55 | 56 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFTaskCompletionSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | 15 | @class BFTask<__covariant ResultType>; 16 | 17 | /*! 18 | A BFTaskCompletionSource represents the producer side of tasks. 19 | It is a task that also has methods for changing the state of the 20 | task by settings its completion values. 21 | */ 22 | @interface BFTaskCompletionSource<__covariant ResultType> : NSObject 23 | 24 | /*! 25 | Creates a new unfinished task. 26 | */ 27 | + (instancetype)taskCompletionSource; 28 | 29 | /*! 30 | The task associated with this TaskCompletionSource. 31 | */ 32 | @property (nonatomic, strong, readonly) BFTask *task; 33 | 34 | /*! 35 | Completes the task by setting the result. 36 | Attempting to set this for a completed task will raise an exception. 37 | @param result The result of the task. 38 | */ 39 | - (void)setResult:(nullable ResultType)result NS_SWIFT_NAME(set(result:)); 40 | 41 | /*! 42 | Completes the task by setting the error. 43 | Attempting to set this for a completed task will raise an exception. 44 | @param error The error for the task. 45 | */ 46 | - (void)setError:(NSError *)error NS_SWIFT_NAME(set(error:)); 47 | 48 | /*! 49 | Completes the task by marking it as cancelled. 50 | Attempting to set this for a completed task will raise an exception. 51 | */ 52 | - (void)cancel; 53 | 54 | /*! 55 | Sets the result of the task if it wasn't already completed. 56 | @returns whether the new value was set. 57 | */ 58 | - (BOOL)trySetResult:(nullable ResultType)result NS_SWIFT_NAME(trySet(result:)); 59 | 60 | /*! 61 | Sets the error of the task if it wasn't already completed. 62 | @param error The error for the task. 63 | @returns whether the new value was set. 64 | */ 65 | - (BOOL)trySetError:(NSError *)error NS_SWIFT_NAME(trySet(error:)); 66 | 67 | /*! 68 | Sets the cancellation state of the task if it wasn't already completed. 69 | @returns whether the new value was set. 70 | */ 71 | - (BOOL)trySetCancelled; 72 | 73 | @end 74 | 75 | NS_ASSUME_NONNULL_END 76 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SemaphoreAndBolts 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 lc. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "CCBoltsViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | 22 | CCBoltsViewController *boltsViewController = [[CCBoltsViewController alloc] init]; 23 | self.window.rootViewController = boltsViewController; 24 | 25 | return YES; 26 | } 27 | 28 | 29 | - (void)applicationWillResignActive:(UIApplication *)application { 30 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 31 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 32 | } 33 | 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | 46 | - (void)applicationDidBecomeActive:(UIApplication *)application { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | 14 | #import 15 | 16 | @class BFAppLinkReturnToRefererView; 17 | @class BFURL; 18 | 19 | typedef NS_ENUM(NSUInteger, BFIncludeStatusBarInSize) { 20 | BFIncludeStatusBarInSizeNever, 21 | BFIncludeStatusBarInSizeIOS7AndLater, 22 | BFIncludeStatusBarInSizeAlways, 23 | }; 24 | 25 | /*! 26 | Protocol that a class can implement in order to be notified when the user has navigated back 27 | to the referer of an App Link. 28 | */ 29 | @protocol BFAppLinkReturnToRefererViewDelegate 30 | 31 | /*! 32 | Called when the user has tapped inside the close button. 33 | */ 34 | - (void)returnToRefererViewDidTapInsideCloseButton:(BFAppLinkReturnToRefererView *)view; 35 | 36 | /*! 37 | Called when the user has tapped inside the App Link portion of the view. 38 | */ 39 | - (void)returnToRefererViewDidTapInsideLink:(BFAppLinkReturnToRefererView *)view 40 | link:(BFAppLink *)link; 41 | 42 | @end 43 | 44 | /*! 45 | Provides a UIView that displays a button allowing users to navigate back to the 46 | application that launched the App Link currently being handled, if the App Link 47 | contained referer data. The user can also close the view by clicking a close button 48 | rather than navigating away. If the view is provided an App Link that does not contain 49 | referer data, it will have zero size and no UI will be displayed. 50 | */ 51 | NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension") 52 | @interface BFAppLinkReturnToRefererView : UIView 53 | 54 | /*! 55 | The delegate that will be notified when the user navigates back to the referer. 56 | */ 57 | @property (nonatomic, weak) id delegate; 58 | 59 | /*! 60 | The color of the text label and close button. 61 | */ 62 | @property (nonatomic, strong) UIColor *textColor; 63 | 64 | @property (nonatomic, strong) BFAppLink *refererAppLink; 65 | 66 | /*! 67 | Indicates whether to extend the size of the view to include the current status bar 68 | size, for use in scenarios where the view might extend under the status bar on iOS 7 and 69 | above; this property has no effect on earlier versions of iOS. 70 | */ 71 | @property (nonatomic, assign) BFIncludeStatusBarInSize includeStatusBarInSize; 72 | 73 | /*! 74 | Indicates whether the user has closed the view by clicking the close button. 75 | */ 76 | @property (nonatomic, assign) BOOL closed; 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Pods/Pods.xcodeproj/xcuserdata/liuchong.xcuserdatad/xcschemes/Pods-SemaphoreAndBolts.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFURL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | @class BFAppLink; 14 | 15 | /*! 16 | Provides a set of utilities for working with NSURLs, such as parsing of query parameters 17 | and handling for App Link requests. 18 | */ 19 | @interface BFURL : NSObject 20 | 21 | /*! 22 | Creates a link target from a raw URL. 23 | On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's 24 | application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication: 25 | to support better BFMeasurementEvent notifications 26 | @param url The instance of `NSURL` to create BFURL from. 27 | */ 28 | + (BFURL *)URLWithURL:(NSURL *)url; 29 | 30 | /*! 31 | Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's 32 | application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event. 33 | @param url The instance of `NSURL` to create BFURL from. 34 | @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation: 35 | */ 36 | + (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; 37 | 38 | /*! 39 | Gets the target URL. If the link is an App Link, this is the target of the App Link. 40 | Otherwise, it is the url that created the target. 41 | */ 42 | @property (nonatomic, strong, readonly) NSURL *targetURL; 43 | 44 | /*! 45 | Gets the query parameters for the target, parsed into an NSDictionary. 46 | */ 47 | @property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters; 48 | 49 | /*! 50 | If this link target is an App Link, this is the data found in al_applink_data. 51 | Otherwise, it is nil. 52 | */ 53 | @property (nonatomic, strong, readonly) NSDictionary *appLinkData; 54 | 55 | /*! 56 | If this link target is an App Link, this is the data found in extras. 57 | */ 58 | @property (nonatomic, strong, readonly) NSDictionary *appLinkExtras; 59 | 60 | /*! 61 | The App Link indicating how to navigate back to the referer app, if any. 62 | */ 63 | @property (nonatomic, strong, readonly) BFAppLink *appLinkReferer; 64 | 65 | /*! 66 | The URL that was used to create this BFURL. 67 | */ 68 | @property (nonatomic, strong, readonly) NSURL *inputURL; 69 | 70 | /*! 71 | The query parameters of the inputURL, parsed into an NSDictionary. 72 | */ 73 | @property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Bolts 5 | 6 | BSD License 7 | 8 | For Bolts software 9 | 10 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | * Neither the name Facebook nor the names of its contributors may be used to 23 | endorse or promote products derived from this software without specific 24 | prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 27 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 30 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 33 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | ## Masonry 38 | 39 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 40 | 41 | Permission is hereby granted, free of charge, to any person obtaining a copy 42 | of this software and associated documentation files (the "Software"), to deal 43 | in the Software without restriction, including without limitation the rights 44 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 45 | copies of the Software, and to permit persons to whom the Software is 46 | furnished to do so, subject to the following conditions: 47 | 48 | The above copyright notice and this permission notice shall be included in 49 | all copies or substantial portions of the Software. 50 | 51 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 52 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 53 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 54 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 55 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 56 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 57 | THE SOFTWARE. 58 | Generated by CocoaPods - https://cocoapods.org 59 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | #import 13 | 14 | #import 15 | 16 | @class BFAppLink; 17 | @class BFAppLinkReturnToRefererController; 18 | 19 | /*! 20 | Protocol that a class can implement in order to be notified when the user has navigated back 21 | to the referer of an App Link. 22 | */ 23 | @protocol BFAppLinkReturnToRefererControllerDelegate 24 | 25 | @optional 26 | 27 | /*! Called when the user has tapped to navigate, but before the navigation has been performed. */ 28 | - (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller 29 | willNavigateToAppLink:(BFAppLink *)appLink; 30 | 31 | /*! Called after the navigation has been attempted, with an indication of whether the referer 32 | app link was successfully opened. */ 33 | - (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller 34 | didNavigateToAppLink:(BFAppLink *)url 35 | type:(BFAppLinkNavigationType)type; 36 | 37 | @end 38 | 39 | /*! 40 | A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including 41 | the ability to display the view above the navigation bar for navigation-based apps. 42 | */ 43 | NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension") 44 | @interface BFAppLinkReturnToRefererController : NSObject 45 | 46 | /*! 47 | The delegate that will be notified when the user navigates back to the referer. 48 | */ 49 | @property (nonatomic, weak) id delegate; 50 | 51 | /*! 52 | The BFAppLinkReturnToRefererView this controller is controlling. 53 | */ 54 | @property (nonatomic, strong) BFAppLinkReturnToRefererView *view; 55 | 56 | /*! 57 | Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed 58 | contained within another UIView (i.e., not displayed above the navigation bar). 59 | */ 60 | - (instancetype)init; 61 | 62 | /*! 63 | Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed 64 | displayed above the navigation bar. 65 | */ 66 | - (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController; 67 | 68 | /*! 69 | Removes the view entirely from the navigation controller it is currently displayed in. 70 | */ 71 | - (void)removeFromNavController; 72 | 73 | /*! 74 | Shows the BFAppLinkReturnToRefererView with the specified referer information. If nil or missing data, 75 | the view will not be displayed. */ 76 | - (void)showViewForRefererAppLink:(BFAppLink *)refererAppLink; 77 | 78 | /*! 79 | Shows the BFAppLinkReturnToRefererView with referer information extracted from the specified URL. 80 | If nil or missing referer App Link data, the view will not be displayed. */ 81 | - (void)showViewForRefererURL:(NSURL *)url; 82 | 83 | /*! 84 | Closes the view, possibly animating it. 85 | */ 86 | - (void)closeViewAnimated:(BOOL)animated; 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | BSD License 18 | 19 | For Bolts software 20 | 21 | Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 22 | 23 | Redistribution and use in source and binary forms, with or without modification, 24 | are permitted provided that the following conditions are met: 25 | 26 | * Redistributions of source code must retain the above copyright notice, this 27 | list of conditions and the following disclaimer. 28 | 29 | * Redistributions in binary form must reproduce the above copyright notice, 30 | this list of conditions and the following disclaimer in the documentation 31 | and/or other materials provided with the distribution. 32 | 33 | * Neither the name Facebook nor the names of its contributors may be used to 34 | endorse or promote products derived from this software without specific 35 | prior written permission. 36 | 37 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 38 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 39 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 41 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 42 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 44 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 45 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 46 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | License 48 | BSD 49 | Title 50 | Bolts 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | FooterText 56 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 57 | 58 | Permission is hereby granted, free of charge, to any person obtaining a copy 59 | of this software and associated documentation files (the "Software"), to deal 60 | in the Software without restriction, including without limitation the rights 61 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 62 | copies of the Software, and to permit persons to whom the Software is 63 | furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in 66 | all copies or substantial portions of the Software. 67 | 68 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 69 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 70 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 71 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 72 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 73 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 74 | THE SOFTWARE. 75 | License 76 | MIT 77 | Title 78 | Masonry 79 | Type 80 | PSGroupSpecifier 81 | 82 | 83 | FooterText 84 | Generated by CocoaPods - https://cocoapods.org 85 | Title 86 | 87 | Type 88 | PSGroupSpecifier 89 | 90 | 91 | StringsTable 92 | Acknowledgements 93 | Title 94 | Acknowledgements 95 | 96 | 97 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFCancellationToken.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFCancellationToken.h" 12 | #import "BFCancellationTokenRegistration.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface BFCancellationToken () 17 | 18 | @property (nullable, nonatomic, strong) NSMutableArray *registrations; 19 | @property (nonatomic, strong) NSObject *lock; 20 | @property (nonatomic) BOOL disposed; 21 | 22 | @end 23 | 24 | @interface BFCancellationTokenRegistration (BFCancellationToken) 25 | 26 | + (instancetype)registrationWithToken:(BFCancellationToken *)token delegate:(BFCancellationBlock)delegate; 27 | 28 | - (void)notifyDelegate; 29 | 30 | @end 31 | 32 | @implementation BFCancellationToken 33 | 34 | @synthesize cancellationRequested = _cancellationRequested; 35 | 36 | #pragma mark - Initializer 37 | 38 | - (instancetype)init { 39 | self = [super init]; 40 | if (!self) return self; 41 | 42 | _registrations = [NSMutableArray array]; 43 | _lock = [NSObject new]; 44 | 45 | return self; 46 | } 47 | 48 | #pragma mark - Custom Setters/Getters 49 | 50 | - (BOOL)isCancellationRequested { 51 | @synchronized(self.lock) { 52 | [self throwIfDisposed]; 53 | return _cancellationRequested; 54 | } 55 | } 56 | 57 | - (void)cancel { 58 | NSArray *registrations; 59 | @synchronized(self.lock) { 60 | [self throwIfDisposed]; 61 | if (_cancellationRequested) { 62 | return; 63 | } 64 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil]; 65 | _cancellationRequested = YES; 66 | registrations = [self.registrations copy]; 67 | } 68 | 69 | [self notifyCancellation:registrations]; 70 | } 71 | 72 | - (void)notifyCancellation:(NSArray *)registrations { 73 | for (BFCancellationTokenRegistration *registration in registrations) { 74 | [registration notifyDelegate]; 75 | } 76 | } 77 | 78 | - (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block { 79 | @synchronized(self.lock) { 80 | BFCancellationTokenRegistration *registration = [BFCancellationTokenRegistration registrationWithToken:self delegate:[block copy]]; 81 | [self.registrations addObject:registration]; 82 | 83 | return registration; 84 | } 85 | } 86 | 87 | - (void)unregisterRegistration:(BFCancellationTokenRegistration *)registration { 88 | @synchronized(self.lock) { 89 | [self throwIfDisposed]; 90 | [self.registrations removeObject:registration]; 91 | } 92 | } 93 | 94 | // Delay on a non-public method to prevent interference with a user calling performSelector or 95 | // cancelPreviousPerformRequestsWithTarget on the public method 96 | - (void)cancelPrivate { 97 | [self cancel]; 98 | } 99 | 100 | - (void)cancelAfterDelay:(int)millis { 101 | [self throwIfDisposed]; 102 | if (millis < -1) { 103 | [NSException raise:NSInvalidArgumentException format:@"Delay must be >= -1"]; 104 | } 105 | 106 | if (millis == 0) { 107 | [self cancel]; 108 | return; 109 | } 110 | 111 | @synchronized(self.lock) { 112 | [self throwIfDisposed]; 113 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancelPrivate) object:nil]; 114 | if (self.cancellationRequested) { 115 | return; 116 | } 117 | 118 | if (millis != -1) { 119 | double delay = (double)millis / 1000; 120 | [self performSelector:@selector(cancelPrivate) withObject:nil afterDelay:delay]; 121 | } 122 | } 123 | } 124 | 125 | - (void)dispose { 126 | @synchronized(self.lock) { 127 | if (self.disposed) { 128 | return; 129 | } 130 | [self.registrations makeObjectsPerformSelector:@selector(dispose)]; 131 | self.registrations = nil; 132 | self.disposed = YES; 133 | } 134 | } 135 | 136 | - (void)throwIfDisposed { 137 | if (self.disposed) { 138 | [NSException raise:NSInternalInconsistencyException format:@"Object already disposed"]; 139 | } 140 | } 141 | 142 | @end 143 | 144 | NS_ASSUME_NONNULL_END 145 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/Common/BFExecutor.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFExecutor.h" 12 | 13 | #import 14 | 15 | NS_ASSUME_NONNULL_BEGIN 16 | 17 | /*! 18 | Get the remaining stack-size of the current thread. 19 | 20 | @param totalSize The total stack size of the current thread. 21 | 22 | @return The remaining size, in bytes, available to the current thread. 23 | 24 | @note This function cannot be inlined, as otherwise the internal implementation could fail to report the proper 25 | remaining stack space. 26 | */ 27 | __attribute__((noinline)) static size_t remaining_stack_size(size_t *restrict totalSize) { 28 | pthread_t currentThread = pthread_self(); 29 | 30 | // NOTE: We must store stack pointers as uint8_t so that the pointer math is well-defined 31 | uint8_t *endStack = pthread_get_stackaddr_np(currentThread); 32 | *totalSize = pthread_get_stacksize_np(currentThread); 33 | 34 | // NOTE: If the function is inlined, this value could be incorrect 35 | uint8_t *frameAddr = __builtin_frame_address(0); 36 | 37 | return (*totalSize) - (size_t)(endStack - frameAddr); 38 | } 39 | 40 | @interface BFExecutor () 41 | 42 | @property (nonatomic, copy) void(^block)(void(^block)(void)); 43 | 44 | @end 45 | 46 | @implementation BFExecutor 47 | 48 | #pragma mark - Executor methods 49 | 50 | + (instancetype)defaultExecutor { 51 | static BFExecutor *defaultExecutor = NULL; 52 | static dispatch_once_t onceToken; 53 | dispatch_once(&onceToken, ^{ 54 | defaultExecutor = [self executorWithBlock:^void(void(^block)(void)) { 55 | // We prefer to run everything possible immediately, so that there is callstack information 56 | // when debugging. However, we don't want the stack to get too deep, so if the remaining stack space 57 | // is less than 10% of the total space, we dispatch to another GCD queue. 58 | size_t totalStackSize = 0; 59 | size_t remainingStackSize = remaining_stack_size(&totalStackSize); 60 | 61 | if (remainingStackSize < (totalStackSize / 10)) { 62 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); 63 | } else { 64 | @autoreleasepool { 65 | block(); 66 | } 67 | } 68 | }]; 69 | }); 70 | return defaultExecutor; 71 | } 72 | 73 | + (instancetype)immediateExecutor { 74 | static BFExecutor *immediateExecutor = NULL; 75 | static dispatch_once_t onceToken; 76 | dispatch_once(&onceToken, ^{ 77 | immediateExecutor = [self executorWithBlock:^void(void(^block)(void)) { 78 | block(); 79 | }]; 80 | }); 81 | return immediateExecutor; 82 | } 83 | 84 | + (instancetype)mainThreadExecutor { 85 | static BFExecutor *mainThreadExecutor = NULL; 86 | static dispatch_once_t onceToken; 87 | dispatch_once(&onceToken, ^{ 88 | mainThreadExecutor = [self executorWithBlock:^void(void(^block)(void)) { 89 | if (![NSThread isMainThread]) { 90 | dispatch_async(dispatch_get_main_queue(), block); 91 | } else { 92 | @autoreleasepool { 93 | block(); 94 | } 95 | } 96 | }]; 97 | }); 98 | return mainThreadExecutor; 99 | } 100 | 101 | + (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block { 102 | return [[self alloc] initWithBlock:block]; 103 | } 104 | 105 | + (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue { 106 | return [self executorWithBlock:^void(void(^block)(void)) { 107 | dispatch_async(queue, block); 108 | }]; 109 | } 110 | 111 | + (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue { 112 | return [self executorWithBlock:^void(void(^block)(void)) { 113 | [queue addOperation:[NSBlockOperation blockOperationWithBlock:block]]; 114 | }]; 115 | } 116 | 117 | #pragma mark - Initializer 118 | 119 | - (instancetype)initWithBlock:(void(^)(void(^block)(void)))block { 120 | self = [super init]; 121 | if (!self) return self; 122 | 123 | _block = block; 124 | 125 | return self; 126 | } 127 | 128 | #pragma mark - Execution 129 | 130 | - (void)execute:(void(^)(void))block { 131 | self.block(block); 132 | } 133 | 134 | @end 135 | 136 | NS_ASSUME_NONNULL_END 137 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import 12 | 13 | #import 14 | 15 | /*! 16 | The result of calling navigate on a BFAppLinkNavigation 17 | */ 18 | typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { 19 | /*! Indicates that the navigation failed and no app was opened */ 20 | BFAppLinkNavigationTypeFailure, 21 | /*! Indicates that the navigation succeeded by opening the URL in the browser */ 22 | BFAppLinkNavigationTypeBrowser, 23 | /*! Indicates that the navigation succeeded by opening the URL in an app on the device */ 24 | BFAppLinkNavigationTypeApp 25 | }; 26 | 27 | @protocol BFAppLinkResolving; 28 | @class BFTask; 29 | 30 | /*! 31 | Represents a pending request to navigate to an App Link. Most developers will 32 | simply use navigateToURLInBackground: to open a URL, but developers can build 33 | custom requests with additional navigation and app data attached to them by 34 | creating BFAppLinkNavigations themselves. 35 | */ 36 | NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension") 37 | @interface BFAppLinkNavigation : NSObject 38 | 39 | /*! 40 | The extras for the AppLinkNavigation. This will generally contain application-specific 41 | data that should be passed along with the request, such as advertiser or affiliate IDs or 42 | other such metadata relevant on this device. 43 | */ 44 | @property (nonatomic, copy, readonly) NSDictionary *extras; 45 | 46 | /*! 47 | The al_applink_data for the AppLinkNavigation. This will generally contain data common to 48 | navigation attempts such as back-links, user agents, and other information that may be used 49 | in routing and handling an App Link request. 50 | */ 51 | @property (nonatomic, copy, readonly) NSDictionary *appLinkData; 52 | 53 | /*! The AppLink to navigate to */ 54 | @property (nonatomic, strong, readonly) BFAppLink *appLink; 55 | 56 | /*! Creates an AppLinkNavigation with the given link, extras, and App Link data */ 57 | + (instancetype)navigationWithAppLink:(BFAppLink *)appLink 58 | extras:(NSDictionary *)extras 59 | appLinkData:(NSDictionary *)appLinkData; 60 | 61 | /*! 62 | Creates an NSDictionary with the correct format for iOS callback URLs, 63 | to be used as 'appLinkData' argument in the call to navigationWithAppLink:extras:appLinkData: 64 | */ 65 | + (NSDictionary *)callbackAppLinkDataForAppWithName:(NSString *)appName url:(NSString *)url; 66 | 67 | /*! Performs the navigation */ 68 | - (BFAppLinkNavigationType)navigate:(NSError **)error; 69 | 70 | /*! Returns a BFAppLink for the given URL */ 71 | + (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; 72 | 73 | /*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ 74 | + (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id)resolver; 75 | 76 | /*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ 77 | + (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; 78 | 79 | /*! 80 | Returns a BFAppLinkNavigationType based on a BFAppLink. 81 | It's essentially a no-side-effect version of navigateToAppLink:error:, 82 | allowing apps to determine flow based on the link type (e.g. open an 83 | internal web view instead of going straight to the browser for regular links.) 84 | */ 85 | + (BFAppLinkNavigationType)navigationTypeForLink:(BFAppLink *)link; 86 | 87 | /*! 88 | Return navigation type for current instance. 89 | No-side-effect version of navigate: 90 | */ 91 | - (BFAppLinkNavigationType)navigationType; 92 | 93 | /*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ 94 | + (BFTask *)navigateToURLInBackground:(NSURL *)destination; 95 | 96 | /*! 97 | Navigates to a URL (an asynchronous action) using the given App Link resolution 98 | strategy and returns a BFNavigationType 99 | */ 100 | + (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id)resolver; 101 | 102 | /*! 103 | Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, 104 | a basic, built-in resolver will be used. 105 | */ 106 | + (id)defaultResolver; 107 | 108 | /*! 109 | Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the 110 | default resolver to the basic, built-in resolver provided by Bolts. 111 | */ 112 | + (void)setDefaultResolver:(id)resolver; 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | /** 14 | * Provides constraint maker block 15 | * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs 16 | */ 17 | @interface MAS_VIEW (MASAdditions) 18 | 19 | /** 20 | * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute 21 | */ 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_top; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_right; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_width; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_height; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX; 31 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; 32 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; 33 | @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr); 34 | 35 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 36 | 37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_firstBaseline; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_lastBaseline; 39 | 40 | #endif 41 | 42 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 43 | 44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; 49 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; 50 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; 51 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; 52 | 53 | #endif 54 | 55 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 56 | 57 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0)); 58 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); 59 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); 60 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); 61 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); 62 | 63 | #endif 64 | 65 | /** 66 | * a key to associate with this view 67 | */ 68 | @property (nonatomic, strong) id mas_key; 69 | 70 | /** 71 | * Finds the closest common superview between this view and another view 72 | * 73 | * @param view other view 74 | * 75 | * @return returns nil if common superview could not be found 76 | */ 77 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; 78 | 79 | /** 80 | * Creates a MASConstraintMaker with the callee view. 81 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing 82 | * 83 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 84 | * 85 | * @return Array of created MASConstraints 86 | */ 87 | - (NSArray *)mas_makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 88 | 89 | /** 90 | * Creates a MASConstraintMaker with the callee view. 91 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 92 | * If an existing constraint exists then it will be updated instead. 93 | * 94 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 95 | * 96 | * @return Array of created/updated MASConstraints 97 | */ 98 | - (NSArray *)mas_updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 99 | 100 | /** 101 | * Creates a MASConstraintMaker with the callee view. 102 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 103 | * All constraints previously installed for the view will be removed. 104 | * 105 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 106 | * 107 | * @return Array of created/updated MASConstraints 108 | */ 109 | - (NSArray *)mas_remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand view additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface MAS_VIEW (MASShorthandAdditions) 18 | 19 | @property (nonatomic, strong, readonly) MASViewAttribute *left; 20 | @property (nonatomic, strong, readonly) MASViewAttribute *top; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *right; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *bottom; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *leading; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *trailing; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *width; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *height; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *centerX; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); 31 | 32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 33 | 34 | @property (nonatomic, strong, readonly) MASViewAttribute *firstBaseline; 35 | @property (nonatomic, strong, readonly) MASViewAttribute *lastBaseline; 36 | 37 | #endif 38 | 39 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 40 | 41 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; 42 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; 43 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; 44 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; 49 | 50 | #endif 51 | 52 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 53 | 54 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); 55 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); 56 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); 57 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); 58 | 59 | #endif 60 | 61 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 62 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 63 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 64 | 65 | @end 66 | 67 | #define MAS_ATTR_FORWARD(attr) \ 68 | - (MASViewAttribute *)attr { \ 69 | return [self mas_##attr]; \ 70 | } 71 | 72 | @implementation MAS_VIEW (MASShorthandAdditions) 73 | 74 | MAS_ATTR_FORWARD(top); 75 | MAS_ATTR_FORWARD(left); 76 | MAS_ATTR_FORWARD(bottom); 77 | MAS_ATTR_FORWARD(right); 78 | MAS_ATTR_FORWARD(leading); 79 | MAS_ATTR_FORWARD(trailing); 80 | MAS_ATTR_FORWARD(width); 81 | MAS_ATTR_FORWARD(height); 82 | MAS_ATTR_FORWARD(centerX); 83 | MAS_ATTR_FORWARD(centerY); 84 | MAS_ATTR_FORWARD(baseline); 85 | 86 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 87 | 88 | MAS_ATTR_FORWARD(firstBaseline); 89 | MAS_ATTR_FORWARD(lastBaseline); 90 | 91 | #endif 92 | 93 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 94 | 95 | MAS_ATTR_FORWARD(leftMargin); 96 | MAS_ATTR_FORWARD(rightMargin); 97 | MAS_ATTR_FORWARD(topMargin); 98 | MAS_ATTR_FORWARD(bottomMargin); 99 | MAS_ATTR_FORWARD(leadingMargin); 100 | MAS_ATTR_FORWARD(trailingMargin); 101 | MAS_ATTR_FORWARD(centerXWithinMargins); 102 | MAS_ATTR_FORWARD(centerYWithinMargins); 103 | 104 | #endif 105 | 106 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 107 | 108 | MAS_ATTR_FORWARD(safeAreaLayoutGuideTop); 109 | MAS_ATTR_FORWARD(safeAreaLayoutGuideBottom); 110 | MAS_ATTR_FORWARD(safeAreaLayoutGuideLeft); 111 | MAS_ATTR_FORWARD(safeAreaLayoutGuideRight); 112 | 113 | #endif 114 | 115 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { 116 | return [self mas_attribute]; 117 | } 118 | 119 | - (NSArray *)makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 120 | return [self mas_makeConstraints:block]; 121 | } 122 | 123 | - (NSArray *)updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 124 | return [self mas_updateConstraints:block]; 125 | } 126 | 127 | - (NSArray *)remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 128 | return [self mas_remakeConstraints:block]; 129 | } 130 | 131 | @end 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASCompositeConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASCompositeConstraint.h" 10 | #import "MASConstraint+Private.h" 11 | 12 | @interface MASCompositeConstraint () 13 | 14 | @property (nonatomic, strong) id mas_key; 15 | @property (nonatomic, strong) NSMutableArray *childConstraints; 16 | 17 | @end 18 | 19 | @implementation MASCompositeConstraint 20 | 21 | - (id)initWithChildren:(NSArray *)children { 22 | self = [super init]; 23 | if (!self) return nil; 24 | 25 | _childConstraints = [children mutableCopy]; 26 | for (MASConstraint *constraint in _childConstraints) { 27 | constraint.delegate = self; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark - MASConstraintDelegate 34 | 35 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { 36 | NSUInteger index = [self.childConstraints indexOfObject:constraint]; 37 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); 38 | [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint]; 39 | } 40 | 41 | - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 42 | id strongDelegate = self.delegate; 43 | MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 44 | newConstraint.delegate = self; 45 | [self.childConstraints addObject:newConstraint]; 46 | return newConstraint; 47 | } 48 | 49 | #pragma mark - NSLayoutConstraint multiplier proxies 50 | 51 | - (MASConstraint * (^)(CGFloat))multipliedBy { 52 | return ^id(CGFloat multiplier) { 53 | for (MASConstraint *constraint in self.childConstraints) { 54 | constraint.multipliedBy(multiplier); 55 | } 56 | return self; 57 | }; 58 | } 59 | 60 | - (MASConstraint * (^)(CGFloat))dividedBy { 61 | return ^id(CGFloat divider) { 62 | for (MASConstraint *constraint in self.childConstraints) { 63 | constraint.dividedBy(divider); 64 | } 65 | return self; 66 | }; 67 | } 68 | 69 | #pragma mark - MASLayoutPriority proxy 70 | 71 | - (MASConstraint * (^)(MASLayoutPriority))priority { 72 | return ^id(MASLayoutPriority priority) { 73 | for (MASConstraint *constraint in self.childConstraints) { 74 | constraint.priority(priority); 75 | } 76 | return self; 77 | }; 78 | } 79 | 80 | #pragma mark - NSLayoutRelation proxy 81 | 82 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { 83 | return ^id(id attr, NSLayoutRelation relation) { 84 | for (MASConstraint *constraint in self.childConstraints.copy) { 85 | constraint.equalToWithRelation(attr, relation); 86 | } 87 | return self; 88 | }; 89 | } 90 | 91 | #pragma mark - attribute chaining 92 | 93 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 94 | [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 95 | return self; 96 | } 97 | 98 | #pragma mark - Animator proxy 99 | 100 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) 101 | 102 | - (MASConstraint *)animator { 103 | for (MASConstraint *constraint in self.childConstraints) { 104 | [constraint animator]; 105 | } 106 | return self; 107 | } 108 | 109 | #endif 110 | 111 | #pragma mark - debug helpers 112 | 113 | - (MASConstraint * (^)(id))key { 114 | return ^id(id key) { 115 | self.mas_key = key; 116 | int i = 0; 117 | for (MASConstraint *constraint in self.childConstraints) { 118 | constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]); 119 | } 120 | return self; 121 | }; 122 | } 123 | 124 | #pragma mark - NSLayoutConstraint constant setters 125 | 126 | - (void)setInsets:(MASEdgeInsets)insets { 127 | for (MASConstraint *constraint in self.childConstraints) { 128 | constraint.insets = insets; 129 | } 130 | } 131 | 132 | - (void)setInset:(CGFloat)inset { 133 | for (MASConstraint *constraint in self.childConstraints) { 134 | constraint.inset = inset; 135 | } 136 | } 137 | 138 | - (void)setOffset:(CGFloat)offset { 139 | for (MASConstraint *constraint in self.childConstraints) { 140 | constraint.offset = offset; 141 | } 142 | } 143 | 144 | - (void)setSizeOffset:(CGSize)sizeOffset { 145 | for (MASConstraint *constraint in self.childConstraints) { 146 | constraint.sizeOffset = sizeOffset; 147 | } 148 | } 149 | 150 | - (void)setCenterOffset:(CGPoint)centerOffset { 151 | for (MASConstraint *constraint in self.childConstraints) { 152 | constraint.centerOffset = centerOffset; 153 | } 154 | } 155 | 156 | #pragma mark - MASConstraint 157 | 158 | - (void)activate { 159 | for (MASConstraint *constraint in self.childConstraints) { 160 | [constraint activate]; 161 | } 162 | } 163 | 164 | - (void)deactivate { 165 | for (MASConstraint *constraint in self.childConstraints) { 166 | [constraint deactivate]; 167 | } 168 | } 169 | 170 | - (void)install { 171 | for (MASConstraint *constraint in self.childConstraints) { 172 | constraint.updateExisting = self.updateExisting; 173 | [constraint install]; 174 | } 175 | } 176 | 177 | - (void)uninstall { 178 | for (MASConstraint *constraint in self.childConstraints) { 179 | [constraint uninstall]; 180 | } 181 | } 182 | 183 | @end 184 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraintMaker.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | typedef NS_OPTIONS(NSInteger, MASAttribute) { 13 | MASAttributeLeft = 1 << NSLayoutAttributeLeft, 14 | MASAttributeRight = 1 << NSLayoutAttributeRight, 15 | MASAttributeTop = 1 << NSLayoutAttributeTop, 16 | MASAttributeBottom = 1 << NSLayoutAttributeBottom, 17 | MASAttributeLeading = 1 << NSLayoutAttributeLeading, 18 | MASAttributeTrailing = 1 << NSLayoutAttributeTrailing, 19 | MASAttributeWidth = 1 << NSLayoutAttributeWidth, 20 | MASAttributeHeight = 1 << NSLayoutAttributeHeight, 21 | MASAttributeCenterX = 1 << NSLayoutAttributeCenterX, 22 | MASAttributeCenterY = 1 << NSLayoutAttributeCenterY, 23 | MASAttributeBaseline = 1 << NSLayoutAttributeBaseline, 24 | 25 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 26 | 27 | MASAttributeFirstBaseline = 1 << NSLayoutAttributeFirstBaseline, 28 | MASAttributeLastBaseline = 1 << NSLayoutAttributeLastBaseline, 29 | 30 | #endif 31 | 32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 33 | 34 | MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin, 35 | MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin, 36 | MASAttributeTopMargin = 1 << NSLayoutAttributeTopMargin, 37 | MASAttributeBottomMargin = 1 << NSLayoutAttributeBottomMargin, 38 | MASAttributeLeadingMargin = 1 << NSLayoutAttributeLeadingMargin, 39 | MASAttributeTrailingMargin = 1 << NSLayoutAttributeTrailingMargin, 40 | MASAttributeCenterXWithinMargins = 1 << NSLayoutAttributeCenterXWithinMargins, 41 | MASAttributeCenterYWithinMargins = 1 << NSLayoutAttributeCenterYWithinMargins, 42 | 43 | #endif 44 | 45 | }; 46 | 47 | /** 48 | * Provides factory methods for creating MASConstraints. 49 | * Constraints are collected until they are ready to be installed 50 | * 51 | */ 52 | @interface MASConstraintMaker : NSObject 53 | 54 | /** 55 | * The following properties return a new MASViewConstraint 56 | * with the first item set to the makers associated view and the appropriate MASViewAttribute 57 | */ 58 | @property (nonatomic, strong, readonly) MASConstraint *left; 59 | @property (nonatomic, strong, readonly) MASConstraint *top; 60 | @property (nonatomic, strong, readonly) MASConstraint *right; 61 | @property (nonatomic, strong, readonly) MASConstraint *bottom; 62 | @property (nonatomic, strong, readonly) MASConstraint *leading; 63 | @property (nonatomic, strong, readonly) MASConstraint *trailing; 64 | @property (nonatomic, strong, readonly) MASConstraint *width; 65 | @property (nonatomic, strong, readonly) MASConstraint *height; 66 | @property (nonatomic, strong, readonly) MASConstraint *centerX; 67 | @property (nonatomic, strong, readonly) MASConstraint *centerY; 68 | @property (nonatomic, strong, readonly) MASConstraint *baseline; 69 | 70 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 71 | 72 | @property (nonatomic, strong, readonly) MASConstraint *firstBaseline; 73 | @property (nonatomic, strong, readonly) MASConstraint *lastBaseline; 74 | 75 | #endif 76 | 77 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 78 | 79 | @property (nonatomic, strong, readonly) MASConstraint *leftMargin; 80 | @property (nonatomic, strong, readonly) MASConstraint *rightMargin; 81 | @property (nonatomic, strong, readonly) MASConstraint *topMargin; 82 | @property (nonatomic, strong, readonly) MASConstraint *bottomMargin; 83 | @property (nonatomic, strong, readonly) MASConstraint *leadingMargin; 84 | @property (nonatomic, strong, readonly) MASConstraint *trailingMargin; 85 | @property (nonatomic, strong, readonly) MASConstraint *centerXWithinMargins; 86 | @property (nonatomic, strong, readonly) MASConstraint *centerYWithinMargins; 87 | 88 | #endif 89 | 90 | /** 91 | * Returns a block which creates a new MASCompositeConstraint with the first item set 92 | * to the makers associated view and children corresponding to the set bits in the 93 | * MASAttribute parameter. Combine multiple attributes via binary-or. 94 | */ 95 | @property (nonatomic, strong, readonly) MASConstraint *(^attributes)(MASAttribute attrs); 96 | 97 | /** 98 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeEdges 99 | * which generates the appropriate MASViewConstraint children (top, left, bottom, right) 100 | * with the first item set to the makers associated view 101 | */ 102 | @property (nonatomic, strong, readonly) MASConstraint *edges; 103 | 104 | /** 105 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeSize 106 | * which generates the appropriate MASViewConstraint children (width, height) 107 | * with the first item set to the makers associated view 108 | */ 109 | @property (nonatomic, strong, readonly) MASConstraint *size; 110 | 111 | /** 112 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeCenter 113 | * which generates the appropriate MASViewConstraint children (centerX, centerY) 114 | * with the first item set to the makers associated view 115 | */ 116 | @property (nonatomic, strong, readonly) MASConstraint *center; 117 | 118 | /** 119 | * Whether or not to check for an existing constraint instead of adding constraint 120 | */ 121 | @property (nonatomic, assign) BOOL updateExisting; 122 | 123 | /** 124 | * Whether or not to remove existing constraints prior to installing 125 | */ 126 | @property (nonatomic, assign) BOOL removeExisting; 127 | 128 | /** 129 | * initialises the maker with a default view 130 | * 131 | * @param view any MASConstraint are created with this view as the first item 132 | * 133 | * @return a new MASConstraintMaker 134 | */ 135 | - (id)initWithView:(MAS_VIEW *)view; 136 | 137 | /** 138 | * Calls install method on any MASConstraints which have been created by this maker 139 | * 140 | * @return an array of all the installed MASConstraints 141 | */ 142 | - (NSArray *)install; 143 | 144 | - (MASConstraint * (^)(dispatch_block_t))group; 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSLayoutConstraint+MASDebugAdditions.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | 13 | @implementation NSLayoutConstraint (MASDebugAdditions) 14 | 15 | #pragma mark - description maps 16 | 17 | + (NSDictionary *)layoutRelationDescriptionsByValue { 18 | static dispatch_once_t once; 19 | static NSDictionary *descriptionMap; 20 | dispatch_once(&once, ^{ 21 | descriptionMap = @{ 22 | @(NSLayoutRelationEqual) : @"==", 23 | @(NSLayoutRelationGreaterThanOrEqual) : @">=", 24 | @(NSLayoutRelationLessThanOrEqual) : @"<=", 25 | }; 26 | }); 27 | return descriptionMap; 28 | } 29 | 30 | + (NSDictionary *)layoutAttributeDescriptionsByValue { 31 | static dispatch_once_t once; 32 | static NSDictionary *descriptionMap; 33 | dispatch_once(&once, ^{ 34 | descriptionMap = @{ 35 | @(NSLayoutAttributeTop) : @"top", 36 | @(NSLayoutAttributeLeft) : @"left", 37 | @(NSLayoutAttributeBottom) : @"bottom", 38 | @(NSLayoutAttributeRight) : @"right", 39 | @(NSLayoutAttributeLeading) : @"leading", 40 | @(NSLayoutAttributeTrailing) : @"trailing", 41 | @(NSLayoutAttributeWidth) : @"width", 42 | @(NSLayoutAttributeHeight) : @"height", 43 | @(NSLayoutAttributeCenterX) : @"centerX", 44 | @(NSLayoutAttributeCenterY) : @"centerY", 45 | @(NSLayoutAttributeBaseline) : @"baseline", 46 | 47 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 48 | @(NSLayoutAttributeFirstBaseline) : @"firstBaseline", 49 | @(NSLayoutAttributeLastBaseline) : @"lastBaseline", 50 | #endif 51 | 52 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 53 | @(NSLayoutAttributeLeftMargin) : @"leftMargin", 54 | @(NSLayoutAttributeRightMargin) : @"rightMargin", 55 | @(NSLayoutAttributeTopMargin) : @"topMargin", 56 | @(NSLayoutAttributeBottomMargin) : @"bottomMargin", 57 | @(NSLayoutAttributeLeadingMargin) : @"leadingMargin", 58 | @(NSLayoutAttributeTrailingMargin) : @"trailingMargin", 59 | @(NSLayoutAttributeCenterXWithinMargins) : @"centerXWithinMargins", 60 | @(NSLayoutAttributeCenterYWithinMargins) : @"centerYWithinMargins", 61 | #endif 62 | 63 | }; 64 | 65 | }); 66 | return descriptionMap; 67 | } 68 | 69 | 70 | + (NSDictionary *)layoutPriorityDescriptionsByValue { 71 | static dispatch_once_t once; 72 | static NSDictionary *descriptionMap; 73 | dispatch_once(&once, ^{ 74 | #if TARGET_OS_IPHONE || TARGET_OS_TV 75 | descriptionMap = @{ 76 | @(MASLayoutPriorityDefaultHigh) : @"high", 77 | @(MASLayoutPriorityDefaultLow) : @"low", 78 | @(MASLayoutPriorityDefaultMedium) : @"medium", 79 | @(MASLayoutPriorityRequired) : @"required", 80 | @(MASLayoutPriorityFittingSizeLevel) : @"fitting size", 81 | }; 82 | #elif TARGET_OS_MAC 83 | descriptionMap = @{ 84 | @(MASLayoutPriorityDefaultHigh) : @"high", 85 | @(MASLayoutPriorityDragThatCanResizeWindow) : @"drag can resize window", 86 | @(MASLayoutPriorityDefaultMedium) : @"medium", 87 | @(MASLayoutPriorityWindowSizeStayPut) : @"window size stay put", 88 | @(MASLayoutPriorityDragThatCannotResizeWindow) : @"drag cannot resize window", 89 | @(MASLayoutPriorityDefaultLow) : @"low", 90 | @(MASLayoutPriorityFittingSizeCompression) : @"fitting size", 91 | @(MASLayoutPriorityRequired) : @"required", 92 | }; 93 | #endif 94 | }); 95 | return descriptionMap; 96 | } 97 | 98 | #pragma mark - description override 99 | 100 | + (NSString *)descriptionForObject:(id)obj { 101 | if ([obj respondsToSelector:@selector(mas_key)] && [obj mas_key]) { 102 | return [NSString stringWithFormat:@"%@:%@", [obj class], [obj mas_key]]; 103 | } 104 | return [NSString stringWithFormat:@"%@:%p", [obj class], obj]; 105 | } 106 | 107 | - (NSString *)description { 108 | NSMutableString *description = [[NSMutableString alloc] initWithString:@"<"]; 109 | 110 | [description appendString:[self.class descriptionForObject:self]]; 111 | 112 | [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]]; 113 | if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) { 114 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.firstAttribute)]]; 115 | } 116 | 117 | [description appendFormat:@" %@", self.class.layoutRelationDescriptionsByValue[@(self.relation)]]; 118 | 119 | if (self.secondItem) { 120 | [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]]; 121 | } 122 | if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) { 123 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.secondAttribute)]]; 124 | } 125 | 126 | if (self.multiplier != 1) { 127 | [description appendFormat:@" * %g", self.multiplier]; 128 | } 129 | 130 | if (self.secondAttribute == NSLayoutAttributeNotAnAttribute) { 131 | [description appendFormat:@" %g", self.constant]; 132 | } else { 133 | if (self.constant) { 134 | [description appendFormat:@" %@ %g", (self.constant < 0 ? @"-" : @"+"), ABS(self.constant)]; 135 | } 136 | } 137 | 138 | if (self.priority != MASLayoutPriorityRequired) { 139 | [description appendFormat:@" ^%@", self.class.layoutPriorityDescriptionsByValue[@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]]; 140 | } 141 | 142 | [description appendString:@">"]; 143 | return description; 144 | } 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /SemaphoreAndBolts/CCBoltsViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CCBoltsViewController.m 3 | // Interview 4 | // 5 | // Created by 刘冲 on 2018/7/12. 6 | // Copyright © 2018年 刘冲. All rights reserved. 7 | // 8 | 9 | #import "CCBoltsViewController.h" 10 | @import Bolts; 11 | @import Masonry; 12 | 13 | @interface CCBoltsViewController () 14 | 15 | @end 16 | 17 | @implementation CCBoltsViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.view.backgroundColor = [UIColor whiteColor]; 23 | 24 | UIButton *semaphoreButton = [UIButton buttonWithType:UIButtonTypeCustom]; 25 | semaphoreButton.backgroundColor = [UIColor redColor]; 26 | [semaphoreButton setTitle:@"semaphore(信号量并发多任务)" forState:UIControlStateNormal]; 27 | [semaphoreButton addTarget:self action:@selector(semaphore) forControlEvents:UIControlEventTouchUpInside]; 28 | [self.view addSubview:semaphoreButton]; 29 | 30 | UIButton *boltsConcurrenceButton = [UIButton buttonWithType:UIButtonTypeCustom]; 31 | boltsConcurrenceButton.backgroundColor = [UIColor greenColor]; 32 | [boltsConcurrenceButton setTitle:@"boltsConcurrence(Bolts并发多任务)" forState:UIControlStateNormal]; 33 | [boltsConcurrenceButton addTarget:self action:@selector(boltsConcurrence) forControlEvents:UIControlEventTouchUpInside]; 34 | [self.view addSubview:boltsConcurrenceButton]; 35 | 36 | UIButton *boltsSerialButton = [UIButton buttonWithType:UIButtonTypeCustom]; 37 | boltsSerialButton.backgroundColor = [UIColor blueColor]; 38 | [boltsSerialButton setTitle:@"boltsSerial(Bolts串行任务)" forState:UIControlStateNormal]; 39 | [boltsSerialButton addTarget:self action:@selector(boltsSerial) forControlEvents:UIControlEventTouchUpInside]; 40 | [self.view addSubview:boltsSerialButton]; 41 | 42 | [semaphoreButton mas_makeConstraints:^(MASConstraintMaker *make) { 43 | make.leading.trailing.equalTo(self.view); 44 | make.height.mas_equalTo(70.0); 45 | make.top.equalTo(self.view.mas_top).offset(50.0); 46 | }]; 47 | 48 | [boltsConcurrenceButton mas_makeConstraints:^(MASConstraintMaker *make) { 49 | make.leading.trailing.height.equalTo(semaphoreButton); 50 | make.top.equalTo(semaphoreButton.mas_bottom).offset(50.0); 51 | }]; 52 | 53 | [boltsSerialButton mas_makeConstraints:^(MASConstraintMaker *make) { 54 | make.leading.trailing.height.equalTo(semaphoreButton); 55 | make.top.equalTo(boltsConcurrenceButton.mas_bottom).offset(50.0); 56 | }]; 57 | } 58 | 59 | - (void)didReceiveMemoryWarning { 60 | [super didReceiveMemoryWarning]; 61 | // Dispose of any resources that can be recreated. 62 | } 63 | 64 | #pragma mark - semaphore 65 | // 信号量并行执行多个任务 66 | - (void)semaphore { 67 | NSLog(@"主线程开始执行"); 68 | dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); // 创建一个信号量 69 | dispatch_group_t group = dispatch_group_create(); // 创建一个线程group 70 | dispatch_queue_t quene = dispatch_get_global_queue(0, 0); // 创建一个线程队列 71 | dispatch_group_async(group, quene, ^{ 72 | dispatch_async(dispatch_get_global_queue(0, 0), ^{ 73 | NSLog(@"线程1"); 74 | sleep(1); 75 | NSLog(@"线程1.1"); 76 | dispatch_semaphore_signal(semaphore); 77 | }); 78 | }); 79 | dispatch_group_async(group, quene, ^{ 80 | dispatch_async(dispatch_get_global_queue(0, 0), ^{ 81 | NSLog(@"线程2"); 82 | sleep(2); 83 | NSLog(@"线程2.1"); 84 | dispatch_semaphore_signal(semaphore); 85 | }); 86 | }); 87 | dispatch_group_notify(group, quene, ^{ 88 | // 两次信号等待 89 | dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); 90 | dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); 91 | // 开始执行第三个线程 92 | dispatch_async(dispatch_get_global_queue(0, 0), ^{ 93 | NSLog(@"线程3"); 94 | sleep(3); 95 | dispatch_async(dispatch_get_main_queue(), ^{ 96 | NSLog(@"回到主线程"); 97 | }); 98 | }); 99 | }); 100 | NSLog(@"主线程执行完毕"); 101 | } 102 | 103 | #pragma mark - Bolts 104 | // Bolts并行执行多个任务 105 | - (void)boltsConcurrence { 106 | [[BFTask taskForCompletionOfAllTasks:@[[self task1], [self task2]] ] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { 107 | if (t.error) { 108 | #warning t.error为task1或者task2其中的错误,如果都失败了,那么则以先后顺序为主 109 | NSLog(@"失败:%@", t.error); 110 | } else { 111 | #warning 当两个请求都成功时,t.result为nil 112 | NSLog(@"成功:%@", t.result); 113 | } 114 | return nil; 115 | }]; 116 | } 117 | // Bolts串行执行多个任务 118 | - (void)boltsSerial { 119 | [[[self task1] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { 120 | if (t.error) { 121 | // 如果task1失败了,那么就不执行task2,直接返回task1的BFTask对象 122 | return t; 123 | } 124 | // task1成功,执行task2 125 | return [self task2]; 126 | }] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { 127 | if (t.error) { 128 | // 如果task1失败则打印task1的错误信息,task2亦然 129 | NSLog(@"task1或者task2至少其中之一失败:%@", t.error); 130 | } else { 131 | NSLog(@"task1或者task2全部成功,执行后续操作"); 132 | } 133 | return nil; 134 | }]; 135 | } 136 | 137 | - (BFTask *)task1 { 138 | // 创建一个source 139 | BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource]; 140 | // 数据请求1 141 | dispatch_async(dispatch_get_global_queue(0, 0), ^{ 142 | sleep(1); 143 | BOOL isSuccess = YES; 144 | if (isSuccess) { 145 | // 请求成功,执行 setResult 方法 146 | [source setResult:@{@"key": @"success"}]; 147 | } else { 148 | // 请求成功,执行 setError 方法 149 | [source setError:[NSError errorWithDomain:@"ErrorDomain" code:-1 userInfo:@{@"key": @"无网络"}]]; 150 | } 151 | }); 152 | return source.task; 153 | } 154 | 155 | - (BFTask *)task2 { 156 | // 创建一个source 157 | BFTaskCompletionSource *source = [BFTaskCompletionSource taskCompletionSource]; 158 | // 数据请求2 159 | dispatch_async(dispatch_get_global_queue(0, 0), ^{ 160 | sleep(2); 161 | BOOL isSuccess = NO; 162 | if (isSuccess) { 163 | // 请求成功,执行 setResult 方法 164 | [source setResult:@{@"key": @"success"}]; 165 | } else { 166 | // 请求成功,执行 setError 方法 167 | [source setError:[NSError errorWithDomain:@"ErrorDomain" code:-1 userInfo:@{@"key": @"未登录"}]]; 168 | } 169 | }); 170 | return source.task; 171 | } 172 | 173 | @end 174 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASUtilities.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 19/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | #if TARGET_OS_IPHONE || TARGET_OS_TV 14 | 15 | #import 16 | #define MAS_VIEW UIView 17 | #define MAS_VIEW_CONTROLLER UIViewController 18 | #define MASEdgeInsets UIEdgeInsets 19 | 20 | typedef UILayoutPriority MASLayoutPriority; 21 | static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired; 22 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh; 23 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500; 24 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow; 25 | static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel; 26 | 27 | #elif TARGET_OS_MAC 28 | 29 | #import 30 | #define MAS_VIEW NSView 31 | #define MASEdgeInsets NSEdgeInsets 32 | 33 | typedef NSLayoutPriority MASLayoutPriority; 34 | static const MASLayoutPriority MASLayoutPriorityRequired = NSLayoutPriorityRequired; 35 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = NSLayoutPriorityDefaultHigh; 36 | static const MASLayoutPriority MASLayoutPriorityDragThatCanResizeWindow = NSLayoutPriorityDragThatCanResizeWindow; 37 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 501; 38 | static const MASLayoutPriority MASLayoutPriorityWindowSizeStayPut = NSLayoutPriorityWindowSizeStayPut; 39 | static const MASLayoutPriority MASLayoutPriorityDragThatCannotResizeWindow = NSLayoutPriorityDragThatCannotResizeWindow; 40 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = NSLayoutPriorityDefaultLow; 41 | static const MASLayoutPriority MASLayoutPriorityFittingSizeCompression = NSLayoutPriorityFittingSizeCompression; 42 | 43 | #endif 44 | 45 | /** 46 | * Allows you to attach keys to objects matching the variable names passed. 47 | * 48 | * view1.mas_key = @"view1", view2.mas_key = @"view2"; 49 | * 50 | * is equivalent to: 51 | * 52 | * MASAttachKeys(view1, view2); 53 | */ 54 | #define MASAttachKeys(...) \ 55 | { \ 56 | NSDictionary *keyPairs = NSDictionaryOfVariableBindings(__VA_ARGS__); \ 57 | for (id key in keyPairs.allKeys) { \ 58 | id obj = keyPairs[key]; \ 59 | NSAssert([obj respondsToSelector:@selector(setMas_key:)], \ 60 | @"Cannot attach mas_key to %@", obj); \ 61 | [obj setMas_key:key]; \ 62 | } \ 63 | } 64 | 65 | /** 66 | * Used to create object hashes 67 | * Based on http://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html 68 | */ 69 | #define MAS_NSUINT_BIT (CHAR_BIT * sizeof(NSUInteger)) 70 | #define MAS_NSUINTROTATE(val, howmuch) ((((NSUInteger)val) << howmuch) | (((NSUInteger)val) >> (MAS_NSUINT_BIT - howmuch))) 71 | 72 | /** 73 | * Given a scalar or struct value, wraps it in NSValue 74 | * Based on EXPObjectify: https://github.com/specta/expecta 75 | */ 76 | static inline id _MASBoxValue(const char *type, ...) { 77 | va_list v; 78 | va_start(v, type); 79 | id obj = nil; 80 | if (strcmp(type, @encode(id)) == 0) { 81 | id actual = va_arg(v, id); 82 | obj = actual; 83 | } else if (strcmp(type, @encode(CGPoint)) == 0) { 84 | CGPoint actual = (CGPoint)va_arg(v, CGPoint); 85 | obj = [NSValue value:&actual withObjCType:type]; 86 | } else if (strcmp(type, @encode(CGSize)) == 0) { 87 | CGSize actual = (CGSize)va_arg(v, CGSize); 88 | obj = [NSValue value:&actual withObjCType:type]; 89 | } else if (strcmp(type, @encode(MASEdgeInsets)) == 0) { 90 | MASEdgeInsets actual = (MASEdgeInsets)va_arg(v, MASEdgeInsets); 91 | obj = [NSValue value:&actual withObjCType:type]; 92 | } else if (strcmp(type, @encode(double)) == 0) { 93 | double actual = (double)va_arg(v, double); 94 | obj = [NSNumber numberWithDouble:actual]; 95 | } else if (strcmp(type, @encode(float)) == 0) { 96 | float actual = (float)va_arg(v, double); 97 | obj = [NSNumber numberWithFloat:actual]; 98 | } else if (strcmp(type, @encode(int)) == 0) { 99 | int actual = (int)va_arg(v, int); 100 | obj = [NSNumber numberWithInt:actual]; 101 | } else if (strcmp(type, @encode(long)) == 0) { 102 | long actual = (long)va_arg(v, long); 103 | obj = [NSNumber numberWithLong:actual]; 104 | } else if (strcmp(type, @encode(long long)) == 0) { 105 | long long actual = (long long)va_arg(v, long long); 106 | obj = [NSNumber numberWithLongLong:actual]; 107 | } else if (strcmp(type, @encode(short)) == 0) { 108 | short actual = (short)va_arg(v, int); 109 | obj = [NSNumber numberWithShort:actual]; 110 | } else if (strcmp(type, @encode(char)) == 0) { 111 | char actual = (char)va_arg(v, int); 112 | obj = [NSNumber numberWithChar:actual]; 113 | } else if (strcmp(type, @encode(bool)) == 0) { 114 | bool actual = (bool)va_arg(v, int); 115 | obj = [NSNumber numberWithBool:actual]; 116 | } else if (strcmp(type, @encode(unsigned char)) == 0) { 117 | unsigned char actual = (unsigned char)va_arg(v, unsigned int); 118 | obj = [NSNumber numberWithUnsignedChar:actual]; 119 | } else if (strcmp(type, @encode(unsigned int)) == 0) { 120 | unsigned int actual = (unsigned int)va_arg(v, unsigned int); 121 | obj = [NSNumber numberWithUnsignedInt:actual]; 122 | } else if (strcmp(type, @encode(unsigned long)) == 0) { 123 | unsigned long actual = (unsigned long)va_arg(v, unsigned long); 124 | obj = [NSNumber numberWithUnsignedLong:actual]; 125 | } else if (strcmp(type, @encode(unsigned long long)) == 0) { 126 | unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long); 127 | obj = [NSNumber numberWithUnsignedLongLong:actual]; 128 | } else if (strcmp(type, @encode(unsigned short)) == 0) { 129 | unsigned short actual = (unsigned short)va_arg(v, unsigned int); 130 | obj = [NSNumber numberWithUnsignedShort:actual]; 131 | } 132 | va_end(v); 133 | return obj; 134 | } 135 | 136 | #define MASBoxValue(value) _MASBoxValue(@encode(__typeof__((value))), (value)) 137 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/NSArray+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.m 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | #import "View+MASAdditions.h" 11 | 12 | @implementation NSArray (MASAdditions) 13 | 14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block { 15 | NSMutableArray *constraints = [NSMutableArray array]; 16 | for (MAS_VIEW *view in self) { 17 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 18 | [constraints addObjectsFromArray:[view mas_makeConstraints:block]]; 19 | } 20 | return constraints; 21 | } 22 | 23 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block { 24 | NSMutableArray *constraints = [NSMutableArray array]; 25 | for (MAS_VIEW *view in self) { 26 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 27 | [constraints addObjectsFromArray:[view mas_updateConstraints:block]]; 28 | } 29 | return constraints; 30 | } 31 | 32 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { 33 | NSMutableArray *constraints = [NSMutableArray array]; 34 | for (MAS_VIEW *view in self) { 35 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 36 | [constraints addObjectsFromArray:[view mas_remakeConstraints:block]]; 37 | } 38 | return constraints; 39 | } 40 | 41 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { 42 | if (self.count < 2) { 43 | NSAssert(self.count>1,@"views to distribute need to bigger than one"); 44 | return; 45 | } 46 | 47 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 48 | if (axisType == MASAxisTypeHorizontal) { 49 | MAS_VIEW *prev; 50 | for (int i = 0; i < self.count; i++) { 51 | MAS_VIEW *v = self[i]; 52 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 53 | if (prev) { 54 | make.width.equalTo(prev); 55 | make.left.equalTo(prev.mas_right).offset(fixedSpacing); 56 | if (i == self.count - 1) {//last one 57 | make.right.equalTo(tempSuperView).offset(-tailSpacing); 58 | } 59 | } 60 | else {//first one 61 | make.left.equalTo(tempSuperView).offset(leadSpacing); 62 | } 63 | 64 | }]; 65 | prev = v; 66 | } 67 | } 68 | else { 69 | MAS_VIEW *prev; 70 | for (int i = 0; i < self.count; i++) { 71 | MAS_VIEW *v = self[i]; 72 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 73 | if (prev) { 74 | make.height.equalTo(prev); 75 | make.top.equalTo(prev.mas_bottom).offset(fixedSpacing); 76 | if (i == self.count - 1) {//last one 77 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing); 78 | } 79 | } 80 | else {//first one 81 | make.top.equalTo(tempSuperView).offset(leadSpacing); 82 | } 83 | 84 | }]; 85 | prev = v; 86 | } 87 | } 88 | } 89 | 90 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { 91 | if (self.count < 2) { 92 | NSAssert(self.count>1,@"views to distribute need to bigger than one"); 93 | return; 94 | } 95 | 96 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 97 | if (axisType == MASAxisTypeHorizontal) { 98 | MAS_VIEW *prev; 99 | for (int i = 0; i < self.count; i++) { 100 | MAS_VIEW *v = self[i]; 101 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 102 | make.width.equalTo(@(fixedItemLength)); 103 | if (prev) { 104 | if (i == self.count - 1) {//last one 105 | make.right.equalTo(tempSuperView).offset(-tailSpacing); 106 | } 107 | else { 108 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); 109 | make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 110 | } 111 | } 112 | else {//first one 113 | make.left.equalTo(tempSuperView).offset(leadSpacing); 114 | } 115 | }]; 116 | prev = v; 117 | } 118 | } 119 | else { 120 | MAS_VIEW *prev; 121 | for (int i = 0; i < self.count; i++) { 122 | MAS_VIEW *v = self[i]; 123 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 124 | make.height.equalTo(@(fixedItemLength)); 125 | if (prev) { 126 | if (i == self.count - 1) {//last one 127 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing); 128 | } 129 | else { 130 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); 131 | make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 132 | } 133 | } 134 | else {//first one 135 | make.top.equalTo(tempSuperView).offset(leadSpacing); 136 | } 137 | }]; 138 | prev = v; 139 | } 140 | } 141 | } 142 | 143 | - (MAS_VIEW *)mas_commonSuperviewOfViews 144 | { 145 | MAS_VIEW *commonSuperview = nil; 146 | MAS_VIEW *previousView = nil; 147 | for (id object in self) { 148 | if ([object isKindOfClass:[MAS_VIEW class]]) { 149 | MAS_VIEW *view = (MAS_VIEW *)object; 150 | if (previousView) { 151 | commonSuperview = [view mas_closestCommonSuperview:commonSuperview]; 152 | } else { 153 | commonSuperview = view; 154 | } 155 | previousView = view; 156 | } 157 | } 158 | NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); 159 | return commonSuperview; 160 | } 161 | 162 | @end 163 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/View+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | #import 11 | 12 | @implementation MAS_VIEW (MASAdditions) 13 | 14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block { 15 | self.translatesAutoresizingMaskIntoConstraints = NO; 16 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 17 | block(constraintMaker); 18 | return [constraintMaker install]; 19 | } 20 | 21 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *))block { 22 | self.translatesAutoresizingMaskIntoConstraints = NO; 23 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 24 | constraintMaker.updateExisting = YES; 25 | block(constraintMaker); 26 | return [constraintMaker install]; 27 | } 28 | 29 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { 30 | self.translatesAutoresizingMaskIntoConstraints = NO; 31 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 32 | constraintMaker.removeExisting = YES; 33 | block(constraintMaker); 34 | return [constraintMaker install]; 35 | } 36 | 37 | #pragma mark - NSLayoutAttribute properties 38 | 39 | - (MASViewAttribute *)mas_left { 40 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft]; 41 | } 42 | 43 | - (MASViewAttribute *)mas_top { 44 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop]; 45 | } 46 | 47 | - (MASViewAttribute *)mas_right { 48 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight]; 49 | } 50 | 51 | - (MASViewAttribute *)mas_bottom { 52 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom]; 53 | } 54 | 55 | - (MASViewAttribute *)mas_leading { 56 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading]; 57 | } 58 | 59 | - (MASViewAttribute *)mas_trailing { 60 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing]; 61 | } 62 | 63 | - (MASViewAttribute *)mas_width { 64 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth]; 65 | } 66 | 67 | - (MASViewAttribute *)mas_height { 68 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight]; 69 | } 70 | 71 | - (MASViewAttribute *)mas_centerX { 72 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX]; 73 | } 74 | 75 | - (MASViewAttribute *)mas_centerY { 76 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY]; 77 | } 78 | 79 | - (MASViewAttribute *)mas_baseline { 80 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline]; 81 | } 82 | 83 | - (MASViewAttribute *(^)(NSLayoutAttribute))mas_attribute 84 | { 85 | return ^(NSLayoutAttribute attr) { 86 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:attr]; 87 | }; 88 | } 89 | 90 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 91 | 92 | - (MASViewAttribute *)mas_firstBaseline { 93 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeFirstBaseline]; 94 | } 95 | - (MASViewAttribute *)mas_lastBaseline { 96 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLastBaseline]; 97 | } 98 | 99 | #endif 100 | 101 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 102 | 103 | - (MASViewAttribute *)mas_leftMargin { 104 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin]; 105 | } 106 | 107 | - (MASViewAttribute *)mas_rightMargin { 108 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRightMargin]; 109 | } 110 | 111 | - (MASViewAttribute *)mas_topMargin { 112 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTopMargin]; 113 | } 114 | 115 | - (MASViewAttribute *)mas_bottomMargin { 116 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottomMargin]; 117 | } 118 | 119 | - (MASViewAttribute *)mas_leadingMargin { 120 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeadingMargin]; 121 | } 122 | 123 | - (MASViewAttribute *)mas_trailingMargin { 124 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailingMargin]; 125 | } 126 | 127 | - (MASViewAttribute *)mas_centerXWithinMargins { 128 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterXWithinMargins]; 129 | } 130 | 131 | - (MASViewAttribute *)mas_centerYWithinMargins { 132 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterYWithinMargins]; 133 | } 134 | 135 | #endif 136 | 137 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 138 | 139 | - (MASViewAttribute *)mas_safeAreaLayoutGuide { 140 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 141 | } 142 | - (MASViewAttribute *)mas_safeAreaLayoutGuideTop { 143 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 144 | } 145 | - (MASViewAttribute *)mas_safeAreaLayoutGuideBottom { 146 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 147 | } 148 | - (MASViewAttribute *)mas_safeAreaLayoutGuideLeft { 149 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; 150 | } 151 | - (MASViewAttribute *)mas_safeAreaLayoutGuideRight { 152 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; 153 | } 154 | 155 | #endif 156 | 157 | #pragma mark - associated properties 158 | 159 | - (id)mas_key { 160 | return objc_getAssociatedObject(self, @selector(mas_key)); 161 | } 162 | 163 | - (void)setMas_key:(id)key { 164 | objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 165 | } 166 | 167 | #pragma mark - heirachy 168 | 169 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view { 170 | MAS_VIEW *closestCommonSuperview = nil; 171 | 172 | MAS_VIEW *secondViewSuperview = view; 173 | while (!closestCommonSuperview && secondViewSuperview) { 174 | MAS_VIEW *firstViewSuperview = self; 175 | while (!closestCommonSuperview && firstViewSuperview) { 176 | if (secondViewSuperview == firstViewSuperview) { 177 | closestCommonSuperview = secondViewSuperview; 178 | } 179 | firstViewSuperview = firstViewSuperview.superview; 180 | } 181 | secondViewSuperview = secondViewSuperview.superview; 182 | } 183 | return closestCommonSuperview; 184 | } 185 | 186 | @end 187 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFURL.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFURL_Internal.h" 12 | #import "BFAppLink_Internal.h" 13 | #import "BFAppLinkTarget.h" 14 | #import "BFMeasurementEvent_Internal.h" 15 | 16 | @implementation BFURL 17 | 18 | - (instancetype)initWithURL:(NSURL *)url forOpenInboundURL:(BOOL)forOpenURLEvent sourceApplication:(NSString *)sourceApplication forRenderBackToReferrerBar:(BOOL)forRenderBackToReferrerBar { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _inputURL = url; 23 | _targetURL = url; 24 | 25 | // Parse the query string parameters for the base URL 26 | NSDictionary *baseQuery = [BFURL queryParametersForURL:url]; 27 | _inputQueryParameters = baseQuery; 28 | _targetQueryParameters = baseQuery; 29 | 30 | // Check for applink_data 31 | NSString *appLinkDataString = baseQuery[BFAppLinkDataParameterName]; 32 | if (appLinkDataString) { 33 | // Try to parse the JSON 34 | NSError *error = nil; 35 | NSDictionary *applinkData = [NSJSONSerialization JSONObjectWithData:[appLinkDataString dataUsingEncoding:NSUTF8StringEncoding] 36 | options:0 37 | error:&error]; 38 | if (!error && [applinkData isKindOfClass:[NSDictionary class]]) { 39 | // If the version is not specified, assume it is 1. 40 | NSString *version = applinkData[BFAppLinkVersionKeyName] ?: @"1.0"; 41 | NSString *target = applinkData[BFAppLinkTargetKeyName]; 42 | if ([version isKindOfClass:[NSString class]] && 43 | [version isEqual:BFAppLinkVersion]) { 44 | // There's applink data! The target should actually be the applink target. 45 | _appLinkData = applinkData; 46 | id applinkExtras = applinkData[BFAppLinkExtrasKeyName]; 47 | if (applinkExtras && [applinkExtras isKindOfClass:[NSDictionary class]]) { 48 | _appLinkExtras = applinkExtras; 49 | } 50 | _targetURL = ([target isKindOfClass:[NSString class]] ? [NSURL URLWithString:target] : url); 51 | _targetQueryParameters = [BFURL queryParametersForURL:_targetURL]; 52 | 53 | NSDictionary *refererAppLink = _appLinkData[BFAppLinkRefererAppLink]; 54 | NSString *refererURLString = refererAppLink[BFAppLinkRefererUrl]; 55 | NSString *refererAppName = refererAppLink[BFAppLinkRefererAppName]; 56 | 57 | if (refererURLString && refererAppName) { 58 | BFAppLinkTarget *appLinkTarget = [BFAppLinkTarget appLinkTargetWithURL:[NSURL URLWithString:refererURLString] 59 | appStoreId:nil 60 | appName:refererAppName]; 61 | _appLinkReferer = [BFAppLink appLinkWithSourceURL:[NSURL URLWithString:refererURLString] 62 | targets:@[ appLinkTarget ] 63 | webURL:nil 64 | isBackToReferrer:YES]; 65 | } 66 | 67 | // Raise Measurement Event 68 | NSString *const EVENT_YES_VAL = @"1"; 69 | NSString *const EVENT_NO_VAL = @"0"; 70 | NSMutableDictionary *logData = [[NSMutableDictionary alloc] init]; 71 | logData[@"version"] = version; 72 | if (refererURLString) { 73 | logData[@"refererURL"] = refererURLString; 74 | } 75 | if (refererAppName) { 76 | logData[@"refererAppName"] = refererAppName; 77 | } 78 | if (sourceApplication) { 79 | logData[@"sourceApplication"] = sourceApplication; 80 | } 81 | if ([_targetURL absoluteString]) { 82 | logData[@"targetURL"] = [_targetURL absoluteString]; 83 | } 84 | if ([_inputURL absoluteString]) { 85 | logData[@"inputURL"] = [_inputURL absoluteString]; 86 | } 87 | if ([_inputURL scheme]) { 88 | logData[@"inputURLScheme"] = [_inputURL scheme]; 89 | } 90 | logData[@"forRenderBackToReferrerBar"] = forRenderBackToReferrerBar ? EVENT_YES_VAL : EVENT_NO_VAL; 91 | logData[@"forOpenUrl"] = forOpenURLEvent ? EVENT_YES_VAL : EVENT_NO_VAL; 92 | [BFMeasurementEvent postNotificationForEventName:BFAppLinkParseEventName args:logData]; 93 | if (forOpenURLEvent) { 94 | [BFMeasurementEvent postNotificationForEventName:BFAppLinkNavigateInEventName args:logData]; 95 | } 96 | } 97 | } 98 | } 99 | 100 | return self; 101 | } 102 | 103 | + (BFURL *)URLWithURL:(NSURL *)url { 104 | return [[BFURL alloc] initWithURL:url forOpenInboundURL:NO sourceApplication:nil forRenderBackToReferrerBar:NO]; 105 | } 106 | 107 | + (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication { 108 | return [[BFURL alloc] initWithURL:url forOpenInboundURL:YES sourceApplication:sourceApplication forRenderBackToReferrerBar:NO]; 109 | } 110 | 111 | + (BFURL *)URLForRenderBackToReferrerBarURL:(NSURL *)url { 112 | return [[BFURL alloc] initWithURL:url forOpenInboundURL:NO sourceApplication:nil forRenderBackToReferrerBar:YES]; 113 | } 114 | 115 | + (NSString *)decodeURLString:(NSString *)string { 116 | return (NSString *)CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapes(NULL, 117 | (CFStringRef)string, 118 | CFSTR(""))); 119 | } 120 | 121 | + (NSDictionary *)queryParametersForURL:(NSURL *)url { 122 | NSMutableDictionary *parameters = [NSMutableDictionary dictionary]; 123 | NSString *query = url.query; 124 | if ([query isEqualToString:@""]) { 125 | return @{}; 126 | } 127 | NSArray *queryComponents = [query componentsSeparatedByString:@"&"]; 128 | for (NSString *component in queryComponents) { 129 | NSRange equalsLocation = [component rangeOfString:@"="]; 130 | if (equalsLocation.location == NSNotFound) { 131 | // There's no equals, so associate the key with NSNull 132 | parameters[[self decodeURLString:component]] = [NSNull null]; 133 | } else { 134 | NSString *key = [self decodeURLString:[component substringToIndex:equalsLocation.location]]; 135 | NSString *value = [self decodeURLString:[component substringFromIndex:equalsLocation.location + 1]]; 136 | parameters[key] = value; 137 | } 138 | } 139 | return [NSDictionary dictionaryWithDictionary:parameters]; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-SemaphoreAndBolts/Pods-SemaphoreAndBolts-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | 145 | if [[ "$CONFIGURATION" == "Debug" ]]; then 146 | install_framework "${BUILT_PRODUCTS_DIR}/Bolts/Bolts.framework" 147 | install_framework "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework" 148 | fi 149 | if [[ "$CONFIGURATION" == "Release" ]]; then 150 | install_framework "${BUILT_PRODUCTS_DIR}/Bolts/Bolts.framework" 151 | install_framework "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework" 152 | fi 153 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 154 | wait 155 | fi 156 | -------------------------------------------------------------------------------- /Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | * 9 | */ 10 | 11 | #import "BFAppLinkReturnToRefererController.h" 12 | 13 | #import "BFAppLink.h" 14 | #import "BFAppLinkReturnToRefererView_Internal.h" 15 | #import "BFURL_Internal.h" 16 | 17 | static const CFTimeInterval kBFViewAnimationDuration = 0.25f; 18 | 19 | @implementation BFAppLinkReturnToRefererController { 20 | UINavigationController *_navigationController; 21 | BFAppLinkReturnToRefererView *_view; 22 | } 23 | 24 | #pragma mark - Object lifecycle 25 | 26 | - (instancetype)init { 27 | return [self initForDisplayAboveNavController:nil]; 28 | } 29 | 30 | - (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController { 31 | self = [super init]; 32 | if (self) { 33 | _navigationController = navController; 34 | 35 | if (_navigationController != nil) { 36 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 37 | [nc addObserver:self 38 | selector:@selector(statusBarFrameWillChange:) 39 | name:UIApplicationWillChangeStatusBarFrameNotification 40 | object:nil]; 41 | [nc addObserver:self 42 | selector:@selector(statusBarFrameDidChange:) 43 | name:UIApplicationDidChangeStatusBarFrameNotification 44 | object:nil]; 45 | [nc addObserver:self 46 | selector:@selector(orientationDidChange:) 47 | name:UIDeviceOrientationDidChangeNotification 48 | object:nil]; 49 | } 50 | } 51 | return self; 52 | } 53 | 54 | - (void)dealloc { 55 | _view.delegate = nil; 56 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 57 | } 58 | 59 | #pragma mark - Public API 60 | 61 | - (BFAppLinkReturnToRefererView *)view { 62 | if (!_view) { 63 | self.view = [[BFAppLinkReturnToRefererView alloc] initWithFrame:CGRectZero]; 64 | if (_navigationController) { 65 | [_navigationController.view addSubview:_view]; 66 | } 67 | } 68 | return _view; 69 | } 70 | 71 | - (void)setView:(BFAppLinkReturnToRefererView *)view { 72 | if (_view != view) { 73 | _view.delegate = nil; 74 | } 75 | 76 | _view = view; 77 | _view.delegate = self; 78 | 79 | if (_navigationController) { 80 | _view.includeStatusBarInSize = BFIncludeStatusBarInSizeAlways; 81 | } 82 | } 83 | 84 | - (void)showViewForRefererAppLink:(BFAppLink *)refererAppLink { 85 | self.view.refererAppLink = refererAppLink; 86 | 87 | [_view sizeToFit]; 88 | 89 | if (_navigationController) { 90 | if (!_view.closed) { 91 | dispatch_async(dispatch_get_main_queue(), ^{ 92 | [self moveNavigationBar]; 93 | }); 94 | } 95 | } 96 | } 97 | 98 | - (void)showViewForRefererURL:(NSURL *)url { 99 | BFAppLink *appLink = [BFURL URLForRenderBackToReferrerBarURL:url].appLinkReferer; 100 | [self showViewForRefererAppLink:appLink]; 101 | } 102 | 103 | - (void)removeFromNavController { 104 | if (_navigationController) { 105 | [_view removeFromSuperview]; 106 | _navigationController = nil; 107 | } 108 | } 109 | 110 | #pragma mark - BFAppLinkReturnToRefererViewDelegate 111 | 112 | - (void)returnToRefererViewDidTapInsideCloseButton:(BFAppLinkReturnToRefererView *)view { 113 | [self closeViewAnimated:YES explicitlyClosed:YES]; 114 | } 115 | 116 | - (void)returnToRefererViewDidTapInsideLink:(BFAppLinkReturnToRefererView *)view 117 | link:(BFAppLink *)link { 118 | [self openRefererAppLink:link]; 119 | [self closeViewAnimated:NO explicitlyClosed:NO]; 120 | } 121 | 122 | #pragma mark - Private 123 | 124 | - (void)statusBarFrameWillChange:(NSNotification *)notification { 125 | NSValue *rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey]; 126 | CGRect newFrame; 127 | [rectValue getValue:&newFrame]; 128 | 129 | if (_navigationController && !_view.closed) { 130 | if (CGRectGetHeight(newFrame) == 40) { 131 | UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState; 132 | [UIView animateWithDuration:kBFViewAnimationDuration delay:0.0 options:options animations:^{ 133 | _view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0); 134 | } completion:nil]; 135 | } 136 | } 137 | } 138 | 139 | - (void)statusBarFrameDidChange:(NSNotification *)notification { 140 | NSValue *rectValue = [[notification userInfo] valueForKey:UIApplicationStatusBarFrameUserInfoKey]; 141 | CGRect newFrame; 142 | [rectValue getValue:&newFrame]; 143 | 144 | if (_navigationController && !_view.closed) { 145 | if (CGRectGetHeight(newFrame) == 40) { 146 | UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState; 147 | [UIView animateWithDuration:kBFViewAnimationDuration delay:0.0 options:options animations:^{ 148 | [_view sizeToFit]; 149 | [self moveNavigationBar]; 150 | } completion:nil]; 151 | } 152 | } 153 | } 154 | 155 | - (void)orientationDidChange:(NSNotificationCenter *)notification { 156 | if (_navigationController && !_view.closed && CGRectGetHeight(_view.bounds) > 0) { 157 | dispatch_async(dispatch_get_main_queue(), ^{ 158 | [self moveNavigationBar]; 159 | }); 160 | } 161 | } 162 | 163 | - (void)moveNavigationBar { 164 | if (_view.closed || !_view.refererAppLink) { 165 | return; 166 | } 167 | 168 | [self updateNavigationBarY:CGRectGetHeight(_view.bounds)]; 169 | } 170 | 171 | - (void)updateNavigationBarY:(CGFloat)y { 172 | UINavigationBar *navigationBar = _navigationController.navigationBar; 173 | CGRect navigationBarFrame = navigationBar.frame; 174 | CGFloat oldContainerViewY = CGRectGetMaxY(navigationBarFrame); 175 | navigationBarFrame.origin.y = y; 176 | navigationBar.frame = navigationBarFrame; 177 | 178 | CGFloat dy = CGRectGetMaxY(navigationBarFrame) - oldContainerViewY; 179 | UIView *containerView = _navigationController.visibleViewController.view.superview; 180 | containerView.frame = UIEdgeInsetsInsetRect(containerView.frame, UIEdgeInsetsMake(dy, 0.0, 0.0, 0.0)); 181 | } 182 | 183 | - (void)closeViewAnimated:(BOOL)animated { 184 | [self closeViewAnimated:animated explicitlyClosed:YES]; 185 | } 186 | 187 | - (void)closeViewAnimated:(BOOL)animated explicitlyClosed:(BOOL)explicitlyClosed { 188 | void (^closer)(void) = ^{ 189 | if (_navigationController) { 190 | [self updateNavigationBarY:_view.statusBarHeight]; 191 | } 192 | 193 | CGRect frame = _view.frame; 194 | frame.size.height = 0.0; 195 | _view.frame = frame; 196 | }; 197 | 198 | if (animated) { 199 | [UIView animateWithDuration:kBFViewAnimationDuration animations:^{ 200 | closer(); 201 | } completion:^(BOOL finished) { 202 | if (explicitlyClosed) { 203 | _view.closed = YES; 204 | } 205 | }]; 206 | } else { 207 | closer(); 208 | if (explicitlyClosed) { 209 | _view.closed = YES; 210 | } 211 | } 212 | } 213 | 214 | - (void)openRefererAppLink:(BFAppLink *)refererAppLink { 215 | if (refererAppLink) { 216 | id delegate = _delegate; 217 | if ([delegate respondsToSelector:@selector(returnToRefererController:willNavigateToAppLink:)]) { 218 | [delegate returnToRefererController:self willNavigateToAppLink:refererAppLink]; 219 | } 220 | 221 | NSError *error = nil; 222 | BFAppLinkNavigationType type = [BFAppLinkNavigation navigateToAppLink:refererAppLink error:&error]; 223 | 224 | if ([delegate respondsToSelector:@selector(returnToRefererController:didNavigateToAppLink:type:)]) { 225 | [delegate returnToRefererController:self didNavigateToAppLink:refererAppLink type:type]; 226 | } 227 | } 228 | } 229 | 230 | @end 231 | -------------------------------------------------------------------------------- /Pods/Masonry/Masonry/MASConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * Enables Constraints to be created with chainable syntax 13 | * Constraint can represent single NSLayoutConstraint (MASViewConstraint) 14 | * or a group of NSLayoutConstraints (MASComposisteConstraint) 15 | */ 16 | @interface MASConstraint : NSObject 17 | 18 | // Chaining Support 19 | 20 | /** 21 | * Modifies the NSLayoutConstraint constant, 22 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 23 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight 24 | */ 25 | - (MASConstraint * (^)(MASEdgeInsets insets))insets; 26 | 27 | /** 28 | * Modifies the NSLayoutConstraint constant, 29 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 30 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight 31 | */ 32 | - (MASConstraint * (^)(CGFloat inset))inset; 33 | 34 | /** 35 | * Modifies the NSLayoutConstraint constant, 36 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 37 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight 38 | */ 39 | - (MASConstraint * (^)(CGSize offset))sizeOffset; 40 | 41 | /** 42 | * Modifies the NSLayoutConstraint constant, 43 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 44 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY 45 | */ 46 | - (MASConstraint * (^)(CGPoint offset))centerOffset; 47 | 48 | /** 49 | * Modifies the NSLayoutConstraint constant 50 | */ 51 | - (MASConstraint * (^)(CGFloat offset))offset; 52 | 53 | /** 54 | * Modifies the NSLayoutConstraint constant based on a value type 55 | */ 56 | - (MASConstraint * (^)(NSValue *value))valueOffset; 57 | 58 | /** 59 | * Sets the NSLayoutConstraint multiplier property 60 | */ 61 | - (MASConstraint * (^)(CGFloat multiplier))multipliedBy; 62 | 63 | /** 64 | * Sets the NSLayoutConstraint multiplier to 1.0/dividedBy 65 | */ 66 | - (MASConstraint * (^)(CGFloat divider))dividedBy; 67 | 68 | /** 69 | * Sets the NSLayoutConstraint priority to a float or MASLayoutPriority 70 | */ 71 | - (MASConstraint * (^)(MASLayoutPriority priority))priority; 72 | 73 | /** 74 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityLow 75 | */ 76 | - (MASConstraint * (^)(void))priorityLow; 77 | 78 | /** 79 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityMedium 80 | */ 81 | - (MASConstraint * (^)(void))priorityMedium; 82 | 83 | /** 84 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityHigh 85 | */ 86 | - (MASConstraint * (^)(void))priorityHigh; 87 | 88 | /** 89 | * Sets the constraint relation to NSLayoutRelationEqual 90 | * returns a block which accepts one of the following: 91 | * MASViewAttribute, UIView, NSValue, NSArray 92 | * see readme for more details. 93 | */ 94 | - (MASConstraint * (^)(id attr))equalTo; 95 | 96 | /** 97 | * Sets the constraint relation to NSLayoutRelationGreaterThanOrEqual 98 | * returns a block which accepts one of the following: 99 | * MASViewAttribute, UIView, NSValue, NSArray 100 | * see readme for more details. 101 | */ 102 | - (MASConstraint * (^)(id attr))greaterThanOrEqualTo; 103 | 104 | /** 105 | * Sets the constraint relation to NSLayoutRelationLessThanOrEqual 106 | * returns a block which accepts one of the following: 107 | * MASViewAttribute, UIView, NSValue, NSArray 108 | * see readme for more details. 109 | */ 110 | - (MASConstraint * (^)(id attr))lessThanOrEqualTo; 111 | 112 | /** 113 | * Optional semantic property which has no effect but improves the readability of constraint 114 | */ 115 | - (MASConstraint *)with; 116 | 117 | /** 118 | * Optional semantic property which has no effect but improves the readability of constraint 119 | */ 120 | - (MASConstraint *)and; 121 | 122 | /** 123 | * Creates a new MASCompositeConstraint with the called attribute and reciever 124 | */ 125 | - (MASConstraint *)left; 126 | - (MASConstraint *)top; 127 | - (MASConstraint *)right; 128 | - (MASConstraint *)bottom; 129 | - (MASConstraint *)leading; 130 | - (MASConstraint *)trailing; 131 | - (MASConstraint *)width; 132 | - (MASConstraint *)height; 133 | - (MASConstraint *)centerX; 134 | - (MASConstraint *)centerY; 135 | - (MASConstraint *)baseline; 136 | 137 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 138 | 139 | - (MASConstraint *)firstBaseline; 140 | - (MASConstraint *)lastBaseline; 141 | 142 | #endif 143 | 144 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 145 | 146 | - (MASConstraint *)leftMargin; 147 | - (MASConstraint *)rightMargin; 148 | - (MASConstraint *)topMargin; 149 | - (MASConstraint *)bottomMargin; 150 | - (MASConstraint *)leadingMargin; 151 | - (MASConstraint *)trailingMargin; 152 | - (MASConstraint *)centerXWithinMargins; 153 | - (MASConstraint *)centerYWithinMargins; 154 | 155 | #endif 156 | 157 | 158 | /** 159 | * Sets the constraint debug name 160 | */ 161 | - (MASConstraint * (^)(id key))key; 162 | 163 | // NSLayoutConstraint constant Setters 164 | // for use outside of mas_updateConstraints/mas_makeConstraints blocks 165 | 166 | /** 167 | * Modifies the NSLayoutConstraint constant, 168 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 169 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight 170 | */ 171 | - (void)setInsets:(MASEdgeInsets)insets; 172 | 173 | /** 174 | * Modifies the NSLayoutConstraint constant, 175 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 176 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight 177 | */ 178 | - (void)setInset:(CGFloat)inset; 179 | 180 | /** 181 | * Modifies the NSLayoutConstraint constant, 182 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 183 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight 184 | */ 185 | - (void)setSizeOffset:(CGSize)sizeOffset; 186 | 187 | /** 188 | * Modifies the NSLayoutConstraint constant, 189 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following 190 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY 191 | */ 192 | - (void)setCenterOffset:(CGPoint)centerOffset; 193 | 194 | /** 195 | * Modifies the NSLayoutConstraint constant 196 | */ 197 | - (void)setOffset:(CGFloat)offset; 198 | 199 | 200 | // NSLayoutConstraint Installation support 201 | 202 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) 203 | /** 204 | * Whether or not to go through the animator proxy when modifying the constraint 205 | */ 206 | @property (nonatomic, copy, readonly) MASConstraint *animator; 207 | #endif 208 | 209 | /** 210 | * Activates an NSLayoutConstraint if it's supported by an OS. 211 | * Invokes install otherwise. 212 | */ 213 | - (void)activate; 214 | 215 | /** 216 | * Deactivates previously installed/activated NSLayoutConstraint. 217 | */ 218 | - (void)deactivate; 219 | 220 | /** 221 | * Creates a NSLayoutConstraint and adds it to the appropriate view. 222 | */ 223 | - (void)install; 224 | 225 | /** 226 | * Removes previously installed NSLayoutConstraint 227 | */ 228 | - (void)uninstall; 229 | 230 | @end 231 | 232 | 233 | /** 234 | * Convenience auto-boxing macros for MASConstraint methods. 235 | * 236 | * Defining MAS_SHORTHAND_GLOBALS will turn on auto-boxing for default syntax. 237 | * A potential drawback of this is that the unprefixed macros will appear in global scope. 238 | */ 239 | #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__))) 240 | #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__))) 241 | #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__))) 242 | 243 | #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__))) 244 | 245 | 246 | #ifdef MAS_SHORTHAND_GLOBALS 247 | 248 | #define equalTo(...) mas_equalTo(__VA_ARGS__) 249 | #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__) 250 | #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__) 251 | 252 | #define offset(...) mas_offset(__VA_ARGS__) 253 | 254 | #endif 255 | 256 | 257 | @interface MASConstraint (AutoboxingSupport) 258 | 259 | /** 260 | * Aliases to corresponding relation methods (for shorthand macros) 261 | * Also needed to aid autocompletion 262 | */ 263 | - (MASConstraint * (^)(id attr))mas_equalTo; 264 | - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo; 265 | - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo; 266 | 267 | /** 268 | * A dummy method to aid autocompletion 269 | */ 270 | - (MASConstraint * (^)(id offset))mas_offset; 271 | 272 | @end 273 | --------------------------------------------------------------------------------