├── .gitignore ├── CodeExamples ├── CodeExamples.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── CodeExamples.xcworkspace │ └── contents.xcworkspacedata ├── CodeExamples │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── FDTemplateLayoutCell示例 │ │ ├── 1.官方示例 │ │ │ ├── FDTemplateLayoutCellTestController.h │ │ │ ├── FDTemplateLayoutCellTestController.m │ │ │ ├── LTFeedCell.h │ │ │ ├── LTFeedCell.m │ │ │ ├── LTFeedEntity.h │ │ │ ├── LTFeedEntity.m │ │ │ └── data.json │ │ ├── 2.模仿朋友圈 │ │ │ ├── FriendCircleController.h │ │ │ ├── FriendCircleController.m │ │ │ ├── Model │ │ │ │ ├── FriendCircleModel.h │ │ │ │ └── FriendCircleModel.m │ │ │ ├── Property List.plist │ │ │ └── View │ │ │ │ ├── FriendCircleCell.h │ │ │ │ ├── FriendCircleCell.m │ │ │ │ ├── FriendCircleImageCell.h │ │ │ │ ├── FriendCircleImageCell.m │ │ │ │ ├── FriendCircleImageView.h │ │ │ │ └── FriendCircleImageView.m │ │ ├── 3.xib朋友圈示例 │ │ │ ├── FriendCircleXibTestCell.h │ │ │ ├── FriendCircleXibTestCell.m │ │ │ ├── FriendCircleXibTestCell.xib │ │ │ ├── FriendCircleXibTestController.h │ │ │ └── FriendCircleXibTestController.m │ │ ├── 4.图片测试 │ │ │ ├── FriendCircleImageViewTestController.h │ │ │ └── FriendCircleImageViewTestController.m │ │ ├── FDTemplateLayoutCellTabbarController.h │ │ └── FDTemplateLayoutCellTabbarController.m │ ├── Info.plist │ ├── LTUITools │ │ ├── LTUITools.h │ │ └── LTUITools.m │ ├── MainViewController.h │ ├── MainViewController.m │ ├── Masonry试列 │ │ ├── 4.更新约束 │ │ │ ├── MasonryTest4Controller.h │ │ │ └── MasonryTest4Controller.m │ │ ├── MasonryTestController.h │ │ ├── MasonryTestController.m │ │ ├── 文字居中与图片 │ │ │ ├── MasonryTest1Controller.h │ │ │ └── MasonryTest1Controller.m │ │ ├── 父View适应子View大小 │ │ │ ├── MasonryTest2Controller.h │ │ │ └── MasonryTest2Controller.m │ │ └── 等间距 │ │ │ ├── MasonryTest3Controller.h │ │ │ └── MasonryTest3Controller.m │ ├── Others │ │ └── ThirdParty │ │ │ └── SDPhotoBrowser │ │ │ ├── SDBrowserImageView.h │ │ │ ├── SDBrowserImageView.m │ │ │ ├── SDPhotoBrowser.h │ │ │ ├── SDPhotoBrowser.m │ │ │ ├── SDPhotoBrowserConfig.h │ │ │ ├── SDWaitingView.h │ │ │ ├── SDWaitingView.m │ │ │ ├── YHActionSheet.h │ │ │ └── YHActionSheet.m │ ├── Rac常见用法 │ │ ├── RacTestController.h │ │ └── RacTestController.m │ ├── TestHeader.h │ ├── ViewController.h │ ├── ViewController.m │ ├── main.m │ └── tu1.jpg ├── Podfile ├── Podfile.lock └── Pods │ ├── BlocksKit │ ├── BlocksKit │ │ ├── BlocksKit+MessageUI.h │ │ ├── BlocksKit+UIKit.h │ │ ├── BlocksKit.h │ │ ├── Core │ │ │ ├── BKMacros.h │ │ │ ├── NSArray+BlocksKit.h │ │ │ ├── NSArray+BlocksKit.m │ │ │ ├── NSDictionary+BlocksKit.h │ │ │ ├── NSDictionary+BlocksKit.m │ │ │ ├── NSIndexSet+BlocksKit.h │ │ │ ├── NSIndexSet+BlocksKit.m │ │ │ ├── NSInvocation+BlocksKit.h │ │ │ ├── NSInvocation+BlocksKit.m │ │ │ ├── NSMutableArray+BlocksKit.h │ │ │ ├── NSMutableArray+BlocksKit.m │ │ │ ├── NSMutableDictionary+BlocksKit.h │ │ │ ├── NSMutableDictionary+BlocksKit.m │ │ │ ├── NSMutableIndexSet+BlocksKit.h │ │ │ ├── NSMutableIndexSet+BlocksKit.m │ │ │ ├── NSMutableOrderedSet+BlocksKit.h │ │ │ ├── NSMutableOrderedSet+BlocksKit.m │ │ │ ├── NSMutableSet+BlocksKit.h │ │ │ ├── NSMutableSet+BlocksKit.m │ │ │ ├── NSObject+BKAssociatedObjects.h │ │ │ ├── NSObject+BKAssociatedObjects.m │ │ │ ├── NSObject+BKBlockExecution.h │ │ │ ├── NSObject+BKBlockExecution.m │ │ │ ├── NSObject+BKBlockObservation.h │ │ │ ├── NSObject+BKBlockObservation.m │ │ │ ├── NSOrderedSet+BlocksKit.h │ │ │ ├── NSOrderedSet+BlocksKit.m │ │ │ ├── NSSet+BlocksKit.h │ │ │ ├── NSSet+BlocksKit.m │ │ │ ├── NSTimer+BlocksKit.h │ │ │ └── NSTimer+BlocksKit.m │ │ ├── DynamicDelegate │ │ │ ├── A2BlockInvocation.h │ │ │ ├── A2BlockInvocation.m │ │ │ ├── A2DynamicDelegate.h │ │ │ ├── A2DynamicDelegate.m │ │ │ ├── Foundation │ │ │ │ ├── NSCache+BlocksKit.h │ │ │ │ ├── NSCache+BlocksKit.m │ │ │ │ ├── NSURLConnection+BlocksKit.h │ │ │ │ └── NSURLConnection+BlocksKit.m │ │ │ ├── NSObject+A2BlockDelegate.h │ │ │ ├── NSObject+A2BlockDelegate.m │ │ │ ├── NSObject+A2DynamicDelegate.h │ │ │ └── NSObject+A2DynamicDelegate.m │ │ ├── MessageUI │ │ │ ├── MFMailComposeViewController+BlocksKit.h │ │ │ ├── MFMailComposeViewController+BlocksKit.m │ │ │ ├── MFMessageComposeViewController+BlocksKit.h │ │ │ └── MFMessageComposeViewController+BlocksKit.m │ │ └── UIKit │ │ │ ├── UIActionSheet+BlocksKit.h │ │ │ ├── UIActionSheet+BlocksKit.m │ │ │ ├── UIAlertView+BlocksKit.h │ │ │ ├── UIAlertView+BlocksKit.m │ │ │ ├── UIBarButtonItem+BlocksKit.h │ │ │ ├── UIBarButtonItem+BlocksKit.m │ │ │ ├── UIControl+BlocksKit.h │ │ │ ├── UIControl+BlocksKit.m │ │ │ ├── UIGestureRecognizer+BlocksKit.h │ │ │ ├── UIGestureRecognizer+BlocksKit.m │ │ │ ├── UIImagePickerController+BlocksKit.h │ │ │ ├── UIImagePickerController+BlocksKit.m │ │ │ ├── UIPopoverController+BlocksKit.h │ │ │ ├── UIPopoverController+BlocksKit.m │ │ │ ├── UITextField+BlocksKit.h │ │ │ ├── UITextField+BlocksKit.m │ │ │ ├── UIView+BlocksKit.h │ │ │ ├── UIView+BlocksKit.m │ │ │ ├── UIWebView+BlocksKit.h │ │ │ └── UIWebView+BlocksKit.m │ ├── LICENSE │ └── README.md │ ├── Manifest.lock │ ├── Masonry │ ├── LICENSE │ ├── Masonry │ │ ├── MASCompositeConstraint.h │ │ ├── MASCompositeConstraint.m │ │ ├── MASConstraint+Private.h │ │ ├── MASConstraint.h │ │ ├── MASConstraint.m │ │ ├── MASConstraintMaker.h │ │ ├── MASConstraintMaker.m │ │ ├── MASLayoutConstraint.h │ │ ├── MASLayoutConstraint.m │ │ ├── MASUtilities.h │ │ ├── MASViewAttribute.h │ │ ├── MASViewAttribute.m │ │ ├── MASViewConstraint.h │ │ ├── MASViewConstraint.m │ │ ├── Masonry.h │ │ ├── NSArray+MASAdditions.h │ │ ├── NSArray+MASAdditions.m │ │ ├── NSArray+MASShorthandAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ ├── View+MASAdditions.h │ │ ├── View+MASAdditions.m │ │ ├── View+MASShorthandAdditions.h │ │ ├── ViewController+MASAdditions.h │ │ └── ViewController+MASAdditions.m │ └── README.md │ ├── Pods.xcodeproj │ └── project.pbxproj │ ├── ReactiveCocoa │ ├── LICENSE.md │ ├── README.md │ └── ReactiveCocoa │ │ ├── MKAnnotationView+RACSignalSupport.h │ │ ├── MKAnnotationView+RACSignalSupport.m │ │ ├── NSArray+RACSequenceAdditions.h │ │ ├── NSArray+RACSequenceAdditions.m │ │ ├── NSData+RACSupport.h │ │ ├── NSData+RACSupport.m │ │ ├── NSDictionary+RACSequenceAdditions.h │ │ ├── NSDictionary+RACSequenceAdditions.m │ │ ├── NSEnumerator+RACSequenceAdditions.h │ │ ├── NSEnumerator+RACSequenceAdditions.m │ │ ├── NSFileHandle+RACSupport.h │ │ ├── NSFileHandle+RACSupport.m │ │ ├── NSIndexSet+RACSequenceAdditions.h │ │ ├── NSIndexSet+RACSequenceAdditions.m │ │ ├── NSInvocation+RACTypeParsing.h │ │ ├── NSInvocation+RACTypeParsing.m │ │ ├── NSNotificationCenter+RACSupport.h │ │ ├── NSNotificationCenter+RACSupport.m │ │ ├── NSObject+RACDeallocating.h │ │ ├── NSObject+RACDeallocating.m │ │ ├── NSObject+RACDescription.h │ │ ├── NSObject+RACDescription.m │ │ ├── NSObject+RACKVOWrapper.h │ │ ├── NSObject+RACKVOWrapper.m │ │ ├── NSObject+RACLifting.h │ │ ├── NSObject+RACLifting.m │ │ ├── NSObject+RACPropertySubscribing.h │ │ ├── NSObject+RACPropertySubscribing.m │ │ ├── NSObject+RACSelectorSignal.h │ │ ├── NSObject+RACSelectorSignal.m │ │ ├── NSOrderedSet+RACSequenceAdditions.h │ │ ├── NSOrderedSet+RACSequenceAdditions.m │ │ ├── NSSet+RACSequenceAdditions.h │ │ ├── NSSet+RACSequenceAdditions.m │ │ ├── NSString+RACKeyPathUtilities.h │ │ ├── NSString+RACKeyPathUtilities.m │ │ ├── NSString+RACSequenceAdditions.h │ │ ├── NSString+RACSequenceAdditions.m │ │ ├── NSString+RACSupport.h │ │ ├── NSString+RACSupport.m │ │ ├── NSURLConnection+RACSupport.h │ │ ├── NSURLConnection+RACSupport.m │ │ ├── NSUserDefaults+RACSupport.h │ │ ├── NSUserDefaults+RACSupport.m │ │ ├── RACArraySequence.h │ │ ├── RACArraySequence.m │ │ ├── RACBehaviorSubject.h │ │ ├── RACBehaviorSubject.m │ │ ├── RACBlockTrampoline.h │ │ ├── RACBlockTrampoline.m │ │ ├── RACChannel.h │ │ ├── RACChannel.m │ │ ├── RACCommand.h │ │ ├── RACCommand.m │ │ ├── RACCompoundDisposable.h │ │ ├── RACCompoundDisposable.m │ │ ├── RACCompoundDisposableProvider.d │ │ ├── RACDelegateProxy.h │ │ ├── RACDelegateProxy.m │ │ ├── RACDisposable.h │ │ ├── RACDisposable.m │ │ ├── RACDynamicSequence.h │ │ ├── RACDynamicSequence.m │ │ ├── RACDynamicSignal.h │ │ ├── RACDynamicSignal.m │ │ ├── RACEagerSequence.h │ │ ├── RACEagerSequence.m │ │ ├── RACEmptySequence.h │ │ ├── RACEmptySequence.m │ │ ├── RACEmptySignal.h │ │ ├── RACEmptySignal.m │ │ ├── RACErrorSignal.h │ │ ├── RACErrorSignal.m │ │ ├── RACEvent.h │ │ ├── RACEvent.m │ │ ├── RACGroupedSignal.h │ │ ├── RACGroupedSignal.m │ │ ├── RACImmediateScheduler.h │ │ ├── RACImmediateScheduler.m │ │ ├── RACIndexSetSequence.h │ │ ├── RACIndexSetSequence.m │ │ ├── RACKVOChannel.h │ │ ├── RACKVOChannel.m │ │ ├── RACKVOProxy.h │ │ ├── RACKVOProxy.m │ │ ├── RACKVOTrampoline.h │ │ ├── RACKVOTrampoline.m │ │ ├── RACMulticastConnection+Private.h │ │ ├── RACMulticastConnection.h │ │ ├── RACMulticastConnection.m │ │ ├── RACObjCRuntime.h │ │ ├── RACObjCRuntime.m │ │ ├── RACPassthroughSubscriber.h │ │ ├── RACPassthroughSubscriber.m │ │ ├── RACQueueScheduler+Subclass.h │ │ ├── RACQueueScheduler.h │ │ ├── RACQueueScheduler.m │ │ ├── RACReplaySubject.h │ │ ├── RACReplaySubject.m │ │ ├── RACReturnSignal.h │ │ ├── RACReturnSignal.m │ │ ├── RACScheduler+Private.h │ │ ├── RACScheduler+Subclass.h │ │ ├── RACScheduler.h │ │ ├── RACScheduler.m │ │ ├── RACScopedDisposable.h │ │ ├── RACScopedDisposable.m │ │ ├── RACSequence.h │ │ ├── RACSequence.m │ │ ├── RACSerialDisposable.h │ │ ├── RACSerialDisposable.m │ │ ├── RACSignal+Operations.h │ │ ├── RACSignal+Operations.m │ │ ├── RACSignal.h │ │ ├── RACSignal.m │ │ ├── RACSignalProvider.d │ │ ├── RACSignalSequence.h │ │ ├── RACSignalSequence.m │ │ ├── RACStream+Private.h │ │ ├── RACStream.h │ │ ├── RACStream.m │ │ ├── RACStringSequence.h │ │ ├── RACStringSequence.m │ │ ├── RACSubject.h │ │ ├── RACSubject.m │ │ ├── RACSubscriber+Private.h │ │ ├── RACSubscriber.h │ │ ├── RACSubscriber.m │ │ ├── RACSubscriptingAssignmentTrampoline.h │ │ ├── RACSubscriptingAssignmentTrampoline.m │ │ ├── RACSubscriptionScheduler.h │ │ ├── RACSubscriptionScheduler.m │ │ ├── RACTargetQueueScheduler.h │ │ ├── RACTargetQueueScheduler.m │ │ ├── RACTestScheduler.h │ │ ├── RACTestScheduler.m │ │ ├── RACTuple.h │ │ ├── RACTuple.m │ │ ├── RACTupleSequence.h │ │ ├── RACTupleSequence.m │ │ ├── RACUnarySequence.h │ │ ├── RACUnarySequence.m │ │ ├── RACUnit.h │ │ ├── RACUnit.m │ │ ├── RACValueTransformer.h │ │ ├── RACValueTransformer.m │ │ ├── ReactiveCocoa.h │ │ ├── UIActionSheet+RACSignalSupport.h │ │ ├── UIActionSheet+RACSignalSupport.m │ │ ├── UIAlertView+RACSignalSupport.h │ │ ├── UIAlertView+RACSignalSupport.m │ │ ├── UIBarButtonItem+RACCommandSupport.h │ │ ├── UIBarButtonItem+RACCommandSupport.m │ │ ├── UIButton+RACCommandSupport.h │ │ ├── UIButton+RACCommandSupport.m │ │ ├── UICollectionReusableView+RACSignalSupport.h │ │ ├── UICollectionReusableView+RACSignalSupport.m │ │ ├── UIControl+RACSignalSupport.h │ │ ├── UIControl+RACSignalSupport.m │ │ ├── UIControl+RACSignalSupportPrivate.h │ │ ├── UIControl+RACSignalSupportPrivate.m │ │ ├── UIDatePicker+RACSignalSupport.h │ │ ├── UIDatePicker+RACSignalSupport.m │ │ ├── UIGestureRecognizer+RACSignalSupport.h │ │ ├── UIGestureRecognizer+RACSignalSupport.m │ │ ├── UIImagePickerController+RACSignalSupport.h │ │ ├── UIImagePickerController+RACSignalSupport.m │ │ ├── UIRefreshControl+RACCommandSupport.h │ │ ├── UIRefreshControl+RACCommandSupport.m │ │ ├── UISegmentedControl+RACSignalSupport.h │ │ ├── UISegmentedControl+RACSignalSupport.m │ │ ├── UISlider+RACSignalSupport.h │ │ ├── UISlider+RACSignalSupport.m │ │ ├── UIStepper+RACSignalSupport.h │ │ ├── UIStepper+RACSignalSupport.m │ │ ├── UISwitch+RACSignalSupport.h │ │ ├── UISwitch+RACSignalSupport.m │ │ ├── UITableViewCell+RACSignalSupport.h │ │ ├── UITableViewCell+RACSignalSupport.m │ │ ├── UITableViewHeaderFooterView+RACSignalSupport.h │ │ ├── UITableViewHeaderFooterView+RACSignalSupport.m │ │ ├── UITextField+RACSignalSupport.h │ │ ├── UITextField+RACSignalSupport.m │ │ ├── UITextView+RACSignalSupport.h │ │ ├── UITextView+RACSignalSupport.m │ │ └── extobjc │ │ ├── RACEXTKeyPathCoding.h │ │ ├── RACEXTRuntimeExtensions.h │ │ ├── RACEXTRuntimeExtensions.m │ │ ├── RACEXTScope.h │ │ └── RACmetamacros.h │ ├── SDWebImage │ ├── LICENSE │ ├── README.md │ └── SDWebImage │ │ ├── NSData+ImageContentType.h │ │ ├── NSData+ImageContentType.m │ │ ├── SDImageCache.h │ │ ├── SDImageCache.m │ │ ├── SDWebImageCompat.h │ │ ├── SDWebImageCompat.m │ │ ├── SDWebImageDecoder.h │ │ ├── SDWebImageDecoder.m │ │ ├── SDWebImageDownloader.h │ │ ├── SDWebImageDownloader.m │ │ ├── SDWebImageDownloaderOperation.h │ │ ├── SDWebImageDownloaderOperation.m │ │ ├── SDWebImageManager.h │ │ ├── SDWebImageManager.m │ │ ├── SDWebImageOperation.h │ │ ├── SDWebImagePrefetcher.h │ │ ├── SDWebImagePrefetcher.m │ │ ├── UIButton+WebCache.h │ │ ├── UIButton+WebCache.m │ │ ├── UIImage+GIF.h │ │ ├── UIImage+GIF.m │ │ ├── UIImage+MultiFormat.h │ │ ├── UIImage+MultiFormat.m │ │ ├── UIImageView+HighlightedWebCache.h │ │ ├── UIImageView+HighlightedWebCache.m │ │ ├── UIImageView+WebCache.h │ │ ├── UIImageView+WebCache.m │ │ ├── UIView+WebCacheOperation.h │ │ └── UIView+WebCacheOperation.m │ ├── Target Support Files │ ├── BlocksKit │ │ ├── BlocksKit-dummy.m │ │ ├── BlocksKit-prefix.pch │ │ ├── BlocksKit-umbrella.h │ │ ├── BlocksKit.modulemap │ │ ├── BlocksKit.xcconfig │ │ └── Info.plist │ ├── Masonry │ │ ├── Info.plist │ │ ├── Masonry-dummy.m │ │ ├── Masonry-prefix.pch │ │ ├── Masonry-umbrella.h │ │ ├── Masonry.modulemap │ │ └── Masonry.xcconfig │ ├── Pods-CodeExamples │ │ ├── Info.plist │ │ ├── Pods-CodeExamples-acknowledgements.markdown │ │ ├── Pods-CodeExamples-acknowledgements.plist │ │ ├── Pods-CodeExamples-dummy.m │ │ ├── Pods-CodeExamples-frameworks.sh │ │ ├── Pods-CodeExamples-resources.sh │ │ ├── Pods-CodeExamples-umbrella.h │ │ ├── Pods-CodeExamples.debug.xcconfig │ │ ├── Pods-CodeExamples.modulemap │ │ └── Pods-CodeExamples.release.xcconfig │ ├── ReactiveCocoa │ │ ├── Info.plist │ │ ├── ReactiveCocoa-dummy.m │ │ ├── ReactiveCocoa-prefix.pch │ │ ├── ReactiveCocoa-umbrella.h │ │ ├── ReactiveCocoa.modulemap │ │ └── ReactiveCocoa.xcconfig │ ├── SDWebImage │ │ ├── Info.plist │ │ ├── SDWebImage-dummy.m │ │ ├── SDWebImage-prefix.pch │ │ ├── SDWebImage-umbrella.h │ │ ├── SDWebImage.modulemap │ │ └── SDWebImage.xcconfig │ └── UITableView+FDTemplateLayoutCell │ │ ├── Info.plist │ │ ├── UITableView+FDTemplateLayoutCell-dummy.m │ │ ├── UITableView+FDTemplateLayoutCell-prefix.pch │ │ ├── UITableView+FDTemplateLayoutCell-umbrella.h │ │ ├── UITableView+FDTemplateLayoutCell.modulemap │ │ └── UITableView+FDTemplateLayoutCell.xcconfig │ └── UITableView+FDTemplateLayoutCell │ ├── Classes │ ├── UITableView+FDIndexPathHeightCache.h │ ├── UITableView+FDIndexPathHeightCache.m │ ├── UITableView+FDKeyedHeightCache.h │ ├── UITableView+FDKeyedHeightCache.m │ ├── UITableView+FDTemplateLayoutCell.h │ ├── UITableView+FDTemplateLayoutCell.m │ ├── UITableView+FDTemplateLayoutCellDebug.h │ └── UITableView+FDTemplateLayoutCellDebug.m │ ├── LICENSE │ └── README.md ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. 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 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/1.官方示例/FDTemplateLayoutCellTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDTemplateLayoutCellTestController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/4. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FDTemplateLayoutCellTestController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/1.官方示例/LTFeedCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDFeedCell.h 3 | // CodeExamples 4 | // 5 | // Created by sunnyxx on 15/4/17. 6 | // Copyright (c) 2015年 forkingdog. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LTFeedEntity.h" 11 | 12 | @interface LTFeedCell : UITableViewCell 13 | 14 | @property (nonatomic, strong) LTFeedEntity *entity; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/1.官方示例/LTFeedEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDFeedEntity.h 3 | // CodeExamples 4 | // 5 | // Created by sunnyxx on 15/4/16. 6 | // Copyright (c) 2015年 forkingdog. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LTFeedEntity : NSObject 12 | 13 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary; 14 | 15 | @property (nonatomic, copy, readonly) NSString *identifier; 16 | @property (nonatomic, copy, readonly) NSString *title; 17 | @property (nonatomic, copy, readonly) NSString *content; 18 | @property (nonatomic, copy, readonly) NSString *username; 19 | @property (nonatomic, copy, readonly) NSString *time; 20 | @property (nonatomic, copy, readonly) NSString *imageName; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/1.官方示例/LTFeedEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // FDFeedEntity.m 3 | // CodeExamples 4 | // 5 | // Created by sunnyxx on 15/4/16. 6 | // Copyright (c) 2015年 forkingdog. All rights reserved. 7 | // 8 | 9 | #import "LTFeedEntity.h" 10 | 11 | @implementation LTFeedEntity 12 | 13 | - (instancetype)initWithDictionary:(NSDictionary *)dictionary 14 | { 15 | self = super.init; 16 | if (self) { 17 | _identifier = [self uniqueIdentifier]; 18 | _title = dictionary[@"title"]; 19 | _content = dictionary[@"content"]; 20 | _username = dictionary[@"username"]; 21 | _time = dictionary[@"time"]; 22 | _imageName = dictionary[@"imageName"]; 23 | } 24 | return self; 25 | } 26 | 27 | - (NSString *)uniqueIdentifier 28 | { 29 | static NSInteger counter = 0; 30 | return [NSString stringWithFormat:@"unique-id-%@", @(counter++)]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/FriendCircleController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleController.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/Model/FriendCircleModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleModel.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleModel : NSObject 12 | 13 | /** <#des#> */ 14 | @property (nonatomic,copy) NSString * icon; 15 | 16 | /** <#des#> */ 17 | @property (nonatomic,copy) NSString * userId; 18 | 19 | /** <#des#> */ 20 | @property (nonatomic,copy) NSString * name; 21 | 22 | /** <#des#> */ 23 | @property (nonatomic,copy) NSString * personalizedSignature; 24 | 25 | /** <#des#> */ 26 | @property (nonatomic,copy) NSString * content; 27 | 28 | /** <#des#> */ 29 | @property (nonatomic,copy) NSString * time; 30 | 31 | /** <#des#> */ 32 | @property (nonatomic,strong) NSArray * images; 33 | 34 | /** <#des#> */ 35 | @property (nonatomic, assign,getter=isSelect) BOOL select; 36 | 37 | + (NSArray *)getDatasFormPlist; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/Model/FriendCircleModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleModel.m 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import "FriendCircleModel.h" 10 | 11 | @implementation FriendCircleModel 12 | 13 | + (NSArray *)getDatasFormPlist 14 | { 15 | NSString * path = [[NSBundle mainBundle]pathForResource:@"Property List.plist" ofType:nil]; 16 | NSArray * data = [NSArray arrayWithContentsOfFile:path]; 17 | NSMutableArray * datas = [NSMutableArray array]; 18 | for (NSDictionary *dic in data) { 19 | FriendCircleModel * model = [FriendCircleModel new]; 20 | [model setValuesForKeysWithDictionary:dic]; 21 | [datas addObject:model]; 22 | } 23 | return datas.copy; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/View/FriendCircleCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleCell.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | @class FriendCircleModel; 11 | @interface FriendCircleCell : UITableViewCell 12 | 13 | - (void)cellDataWithModel:(FriendCircleModel *)model; 14 | 15 | - (void)cellClickBt:(dispatch_block_t)clickBtBlock; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/View/FriendCircleImageCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleImageCell.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleImageCell : UICollectionViewCell 12 | 13 | /** <#des#> */ 14 | @property (nonatomic,strong) UIImageView * imageView; 15 | 16 | - (void)cellDataWithImageName:(NSString *)imageName; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/View/FriendCircleImageCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleImageCell.m 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import "FriendCircleImageCell.h" 10 | #import 11 | 12 | @interface FriendCircleImageCell () 13 | 14 | @end 15 | 16 | @implementation FriendCircleImageCell 17 | 18 | - (instancetype)initWithFrame:(CGRect)frame 19 | { 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | self.imageView = [LTUITools lt_creatImageView]; 23 | [self.contentView addSubview:self.imageView]; 24 | self.imageView.contentMode = UIViewContentModeScaleAspectFill; 25 | self.imageView.clipsToBounds = YES; 26 | [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { 27 | make.edges.equalTo(self); 28 | }]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)cellDataWithImageName:(NSString *)imageName 34 | { 35 | // self.imageView.image = [UIImage imageNamed:imageName]; 36 | [self.imageView sd_setImageWithURL:[NSURL URLWithString:imageName]]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/2.模仿朋友圈/View/FriendCircleImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleImageView.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleImageView : UIView 12 | 13 | /** <#des#> */ 14 | @property (nonatomic,strong) UICollectionView * collectionView; 15 | 16 | - (void)cellDataWithImageArray:(NSArray *)imageArray; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/3.xib朋友圈示例/FriendCircleXibTestCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleXibTestCell.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | @class FriendCircleModel; 11 | @interface FriendCircleXibTestCell : UITableViewCell 12 | 13 | - (void)cellDataWithModel:(FriendCircleModel *)model; 14 | 15 | - (void)cellClickBt:(dispatch_block_t)clickBtBlock; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/3.xib朋友圈示例/FriendCircleXibTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleXibTestController.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleXibTestController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/4.图片测试/FriendCircleImageViewTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FriendCircleImageViewTestController.h 3 | // ReactCocoaDemo 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FriendCircleImageViewTestController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/FDTemplateLayoutCell示例/FDTemplateLayoutCellTabbarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FDTemplateLayoutCellTabbarController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FDTemplateLayoutCellTabbarController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | NSAppTransportSecurity 8 | 9 | NSAllowsArbitraryLoads 10 | 11 | 12 | NSCameraUsageDescription 13 | 点击同意使用相册资源可以更方便得为您服务哦 14 | NSPhotoLibraryUsageDescription 15 | 点击同意使用相册资源可以更方便得为您服务哦 16 | CFBundleExecutable 17 | $(EXECUTABLE_NAME) 18 | CFBundleIdentifier 19 | $(PRODUCT_BUNDLE_IDENTIFIER) 20 | CFBundleInfoDictionaryVersion 21 | 6.0 22 | CFBundleName 23 | $(PRODUCT_NAME) 24 | CFBundlePackageType 25 | APPL 26 | CFBundleShortVersionString 27 | 1.0 28 | CFBundleVersion 29 | 1 30 | LSRequiresIPhoneOS 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UIRequiredDeviceCapabilities 37 | 38 | armv7 39 | 40 | UISupportedInterfaceOrientations 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/LTUITools/LTUITools.h: -------------------------------------------------------------------------------- 1 | // 2 | // LTUITools.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/1. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LTUITools : NSObject 13 | 14 | 15 | /** 16 | @param tableViewStyle 样式 17 | @return UITableView实例 18 | */ 19 | + (UITableView *)lt_creatTableViewWithStyle:(UITableViewStyle )tableViewStyle; 20 | 21 | /** 22 | @return labe实例,默认换行0,字体14,黑色字体 23 | */ 24 | + (UILabel *)lt_creatLabel; 25 | 26 | /** 27 | @return UIView实例,默认亮灰色 28 | */ 29 | + (UIView *)lt_creatView; 30 | 31 | /** 32 | @return 返回UITextView实例 33 | */ 34 | + (UITextView *)lt_creatTextView; 35 | 36 | 37 | /** 38 | @return UIImageView实例 39 | */ 40 | + (UIImageView *)lt_creatImageView; 41 | 42 | /** 43 | @return collectionView实例 44 | */ 45 | + (UICollectionView *)lt_creatCollectionView; 46 | 47 | /** 48 | @return TextField实例 49 | */ 50 | + (UITextField *)lt_creatTextField; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/1. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Masonry试列/4.更新约束/MasonryTest4Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasonryTest4Controller.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/4. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasonryTest4Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Masonry试列/MasonryTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasonryTestController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/1. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasonryTestController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Masonry试列/文字居中与图片/MasonryTest1Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasonryTest1.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/4. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasonryTest1Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Masonry试列/父View适应子View大小/MasonryTest2Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasonryTest2Controller.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/4. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasonryTest2Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Masonry试列/等间距/MasonryTest3Controller.h: -------------------------------------------------------------------------------- 1 | // 2 | // MasonryTest3Controller.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/4. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MasonryTest3Controller : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Others/ThirdParty/SDPhotoBrowser/SDBrowserImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDBrowserImageView.h 3 | // SDPhotoBrowser 4 | // 5 | // Created by aier on 15-2-6. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SDWaitingView.h" 11 | 12 | 13 | @interface SDBrowserImageView : UIImageView 14 | 15 | @property (nonatomic, assign) CGFloat progress; 16 | @property (nonatomic, assign, readonly) BOOL isScaled; 17 | @property (nonatomic, assign) BOOL hasLoadedImage; 18 | 19 | - (void)eliminateScale; // 清除缩放 20 | 21 | - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder; 22 | 23 | - (void)doubleTapToZommWithScale:(CGFloat)scale; 24 | 25 | - (void)clear; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Others/ThirdParty/SDPhotoBrowser/SDPhotoBrowser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDPhotoBrowser.h 3 | // photobrowser 4 | // 5 | // Created by aier on 15-2-3. 6 | // Copyright (c) 2015年 aier. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @class SDButton, SDPhotoBrowser; 13 | 14 | @protocol SDPhotoBrowserDelegate 15 | 16 | @required 17 | 18 | - (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index; 19 | 20 | @optional 21 | 22 | - (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index; 23 | 24 | @end 25 | 26 | 27 | @interface SDPhotoBrowser : UIView 28 | 29 | @property (nonatomic, weak) UIView *sourceImagesContainerView; 30 | @property (nonatomic, assign) NSInteger currentImageIndex; 31 | @property (nonatomic, assign) NSInteger imageCount; 32 | 33 | @property (nonatomic, weak) id delegate; 34 | 35 | - (void)show; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Others/ThirdParty/SDPhotoBrowser/SDPhotoBrowserConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDPhotoBrowserConfig.h 3 | // SDPhotoBrowser 4 | // 5 | // Created by aier on 15-2-9. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | 10 | typedef enum { 11 | SDWaitingViewModeLoopDiagram, // 环形 12 | SDWaitingViewModePieDiagram // 饼型 13 | } SDWaitingViewMode; 14 | 15 | // 图片保存成功提示文字 16 | #define SDPhotoBrowserSaveImageSuccessText @" 保存成功 "; 17 | 18 | // 图片保存失败提示文字 19 | #define SDPhotoBrowserSaveImageFailText @" 保存失败 "; 20 | 21 | // browser背景颜色 22 | #define SDPhotoBrowserBackgrounColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.95] 23 | 24 | // browser中图片间的margin 25 | #define SDPhotoBrowserImageViewMargin 10 26 | 27 | // browser中显示图片动画时长 28 | #define SDPhotoBrowserShowImageAnimationDuration 0.4f 29 | 30 | // browser中显示图片动画时长 31 | #define SDPhotoBrowserHideImageAnimationDuration 0.4f 32 | 33 | // 图片下载进度指示进度显示样式(SDWaitingViewModeLoopDiagram 环形,SDWaitingViewModePieDiagram 饼型) 34 | #define SDWaitingViewProgressMode SDWaitingViewModeLoopDiagram 35 | 36 | // 图片下载进度指示器背景色 37 | #define SDWaitingViewBackgroundColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7] 38 | 39 | // 图片下载进度指示器内部控件间的间距 40 | #define SDWaitingViewItemMargin 10 41 | 42 | 43 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Others/ThirdParty/SDPhotoBrowser/SDWaitingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDWaitingView.h 3 | // SDPhotoBrowser 4 | // 5 | // Created by aier on 15-2-6. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SDPhotoBrowserConfig.h" 11 | 12 | @interface SDWaitingView : UIView 13 | 14 | @property (nonatomic, assign) CGFloat progress; 15 | @property (nonatomic, assign) int mode; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Others/ThirdParty/SDPhotoBrowser/YHActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // YHActionSheet.h 3 | // github: https://github.com/samuelandkevin 4 | // 5 | // Created by samuelandkevin on 16/4/28. 6 | // Copyright © 2016年 HKP. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 操作回调,如果用户点击空白处,不选中任何button,则 clickedIndex = NSNotFound, isCancel = YES 13 | * clickedIndex 从0开始, cancelButton是最后一个, titleButton不能点击 14 | */ 15 | typedef void(^YHSheetCompletionHanlde)(NSInteger clickedIndex, BOOL isCancel); 16 | 17 | @interface YHActionSheet : UIView 18 | @property (nullable, nonatomic, copy) NSString *cancelTitle;// 19 | @property (nullable, nonatomic, copy) NSArray *otherTitles; 20 | @property (copy,nonatomic,nonnull)YHSheetCompletionHanlde handle; 21 | 22 | - (nonnull instancetype)initWithCancelTitle:(nonnull NSString*)cancelTitle otherTitles:(nonnull NSArray *)otherTitles; 23 | - (void)show; 24 | - (void)dismissForCompletionHandle:(nullable YHSheetCompletionHanlde)handle; 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/Rac常见用法/RacTestController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RacTestController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/5. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RacTestController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/TestHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestHeader.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/1. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #ifndef TestHeader_h 10 | #define TestHeader_h 11 | 12 | #import 13 | #import 14 | 15 | #import "LTUITools.h" 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | 22 | 23 | 24 | #define LT_WEAKSELF typeof(self) __weak weakSelf = self; 25 | #define LT_STRONGSELF typeof(weakSelf) __strong strongSelf = weakSelf; 26 | #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width 27 | #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height 28 | #define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1] 29 | 30 | #endif /* TestHeader_h */ 31 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CodeExamples 4 | // 5 | // Created by letian on 16/12/6. 6 | // Copyright © 2016年 cmsg. 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 | -------------------------------------------------------------------------------- /CodeExamples/CodeExamples/tu1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhl916235259/CodeExamples/1b79f89657105aa3baf116026301bc5a4c9efad0/CodeExamples/CodeExamples/tu1.jpg -------------------------------------------------------------------------------- /CodeExamples/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '8.0' 2 | use_frameworks! 3 | 4 | target ‘CodeExamples’ do 5 | pod 'ReactiveCocoa’,'~> 2.5’ 6 | pod ‘Masonry’ 7 | pod 'UITableView+FDTemplateLayoutCell', '~> 1.5.beta' 8 | pod 'BlocksKit', '~> 2.2.5' 9 | pod 'SDWebImage', '~> 3.8.1' 10 | end -------------------------------------------------------------------------------- /CodeExamples/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BlocksKit (2.2.5): 3 | - BlocksKit/All (= 2.2.5) 4 | - BlocksKit/All (2.2.5): 5 | - BlocksKit/Core 6 | - BlocksKit/DynamicDelegate 7 | - BlocksKit/MessageUI 8 | - BlocksKit/UIKit 9 | - BlocksKit/Core (2.2.5) 10 | - BlocksKit/DynamicDelegate (2.2.5) 11 | - BlocksKit/MessageUI (2.2.5): 12 | - BlocksKit/Core 13 | - BlocksKit/DynamicDelegate 14 | - BlocksKit/UIKit (2.2.5): 15 | - BlocksKit/Core 16 | - BlocksKit/DynamicDelegate 17 | - Masonry (1.0.2) 18 | - ReactiveCocoa (2.5): 19 | - ReactiveCocoa/UI (= 2.5) 20 | - ReactiveCocoa/Core (2.5): 21 | - ReactiveCocoa/no-arc 22 | - ReactiveCocoa/no-arc (2.5) 23 | - ReactiveCocoa/UI (2.5): 24 | - ReactiveCocoa/Core 25 | - SDWebImage (3.8.2): 26 | - SDWebImage/Core (= 3.8.2) 27 | - SDWebImage/Core (3.8.2) 28 | - UITableView+FDTemplateLayoutCell (1.5.beta) 29 | 30 | DEPENDENCIES: 31 | - BlocksKit (~> 2.2.5) 32 | - Masonry 33 | - ReactiveCocoa (~> 2.5) 34 | - SDWebImage (~> 3.8.1) 35 | - UITableView+FDTemplateLayoutCell (~> 1.5.beta) 36 | 37 | SPEC CHECKSUMS: 38 | BlocksKit: 7f422b971407001178d181a43b99014ea2591fe6 39 | Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e 40 | ReactiveCocoa: e2db045570aa97c695e7aa97c2bcab222ae51f4a 41 | SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c 42 | UITableView+FDTemplateLayoutCell: 02b508ab1cb4cea16a8c17ac83d2cd1fd72124f9 43 | 44 | PODFILE CHECKSUM: a8cca1c59e57afc3fc6250936d3ccb0e26f9f97e 45 | 46 | COCOAPODS: 1.1.1 47 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/BlocksKit+MessageUI.h: -------------------------------------------------------------------------------- 1 | // 2 | // BlocksKit+MessageUI 3 | // 4 | // The Objective-C block utilities you always wish you had. 5 | // 6 | // Copyright (c) 2011-2012, 2013-2014 Zachary Waldowski 7 | // Copyright (c) 2012-2013 Pandamonia LLC 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import 29 | #import 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSInvocation+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSInvocation+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** BlocksKit extensions for NSInvocation. */ 9 | @interface NSInvocation (BlocksKit) 10 | 11 | /** Generates a forwarding `NSInvocation` instance for a given method call 12 | encapsulated by the given block. 13 | 14 | NSInvocation *invocation = [NSInvocation invocationWithTarget:target block:^(id myObject) { 15 | [myObject someMethodWithArg:42.0]; 16 | }]; 17 | 18 | This returns an invocation with the appropriate target, selector, and arguments 19 | without creating the buffers yourself. It is only recommended to call a method 20 | on the argument to the block only once. More complicated forwarding machinery 21 | can be accomplished by the A2DynamicDelegate family of classes included in 22 | BlocksKit. 23 | 24 | Created by [Jonathan Rentzch](https://github.com/rentzsch) as 25 | `NSInvocation-blocks`. 26 | 27 | @param target The object to "grab" the block invocation from. 28 | @param block A code block. 29 | @return A fully-prepared instance of NSInvocation ready to be invoked. 30 | */ 31 | + (NSInvocation *)bk_invocationWithTarget:(id)target block:(void (^)(id target))block; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSInvocation+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSInvocation+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSInvocation+BlocksKit.h" 7 | 8 | @interface BKInvocationGrabber : NSProxy 9 | 10 | + (BKInvocationGrabber *)grabberWithTarget:(id)target; 11 | 12 | @property (nonatomic, strong) id target; 13 | @property (nonatomic, strong) NSInvocation *invocation; 14 | 15 | @end 16 | 17 | @implementation BKInvocationGrabber 18 | 19 | + (BKInvocationGrabber *)grabberWithTarget:(id)target { 20 | BKInvocationGrabber *instance = [BKInvocationGrabber alloc]; 21 | instance.target = target; 22 | return instance; 23 | } 24 | 25 | - (NSMethodSignature*)methodSignatureForSelector:(SEL)selector { 26 | return [self.target methodSignatureForSelector:selector]; 27 | } 28 | 29 | - (void)forwardInvocation:(NSInvocation*)invocation { 30 | [invocation setTarget:self.target]; 31 | NSParameterAssert(self.invocation == nil); 32 | self.invocation = invocation; 33 | } 34 | 35 | @end 36 | 37 | 38 | @implementation NSInvocation (BlocksKit) 39 | 40 | + (NSInvocation *)bk_invocationWithTarget:(id)target block:(void (^)(id target))block 41 | { 42 | NSParameterAssert(block != nil); 43 | BKInvocationGrabber *grabber = [BKInvocationGrabber grabberWithTarget:target]; 44 | block(grabber); 45 | return grabber.invocation; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableArray+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block extensions for NSMutableArray. 9 | 10 | These utilities expound upon the BlocksKit additions to the immutable 11 | superclass by allowing certain utilities to work on an instance of the mutable 12 | class, saving memory by not creating an immutable copy of the results. 13 | 14 | Includes code by the following: 15 | 16 | - [Martin Schürrer](https://github.com/MSch) 17 | - [Zach Waldowski](https://github.com/zwaldowski) 18 | 19 | @see NSArray(BlocksKit) 20 | */ 21 | @interface NSMutableArray (BlocksKit) 22 | 23 | /** Filters a mutable array to the objects matching the block. 24 | 25 | @param block A single-argument, BOOL-returning code block. 26 | @see bk_reject: 27 | */ 28 | - (void)bk_performSelect:(BOOL (^)(id obj))block; 29 | 30 | /** Filters a mutable array to all objects but the ones matching the block, 31 | the logical inverse to bk_select:. 32 | 33 | @param block A single-argument, BOOL-returning code block. 34 | @see bk_select: 35 | */ 36 | - (void)bk_performReject:(BOOL (^)(id obj))block; 37 | 38 | /** Transform the objects in the array to the results of the block. 39 | 40 | This is sometimes referred to as a transform, mutating one of each object: 41 | [foo bk_performMap:^id(id obj) { 42 | return [dateTransformer dateFromString:obj]; 43 | }]; 44 | 45 | @param block A single-argument, object-returning code block. 46 | @see bk_map: 47 | */ 48 | - (void)bk_performMap:(id (^)(id obj))block; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableArray+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSMutableArray+BlocksKit.h" 7 | 8 | @implementation NSMutableArray (BlocksKit) 9 | 10 | - (void)bk_performSelect:(BOOL (^)(id obj))block { 11 | NSParameterAssert(block != nil); 12 | 13 | NSIndexSet *list = [self indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { 14 | return !block(obj); 15 | }]; 16 | 17 | if (!list.count) return; 18 | [self removeObjectsAtIndexes:list]; 19 | } 20 | 21 | - (void)bk_performReject:(BOOL (^)(id obj))block { 22 | NSParameterAssert(block != nil); 23 | return [self bk_performSelect:^BOOL(id obj) { 24 | return !block(obj); 25 | }]; 26 | } 27 | 28 | - (void)bk_performMap:(id (^)(id obj))block { 29 | NSParameterAssert(block != nil); 30 | 31 | NSMutableArray *new = [self mutableCopy]; 32 | 33 | [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 34 | id value = block(obj) ?: [NSNull null]; 35 | if ([value isEqual:obj]) return; 36 | new[idx] = value; 37 | }]; 38 | 39 | [self setArray:new]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableDictionary+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block extensions for NSMutableDictionary. 9 | 10 | These utilities expound upon the BlocksKit additions to the immutable 11 | superclass by allowing certain utilities to work on an instance of the mutable 12 | class, saving memory by not creating an immutable copy of the results. 13 | 14 | Includes code by the following: 15 | 16 | - [Martin Schürrer](https://github.com/MSch) 17 | - [Zach Waldowski](https://github.com/zwaldowski) 18 | 19 | @see NSDictionary(BlocksKit) 20 | */ 21 | @interface NSMutableDictionary (BlocksKit) 22 | 23 | /** Filters a mutable dictionary to the key/value pairs matching the block. 24 | 25 | @param block A BOOL-returning code block for a key/value pair. 26 | @see bk_reject: 27 | */ 28 | - (void)bk_performSelect:(BOOL (^)(id key, id obj))block; 29 | 30 | /** Filters a mutable dictionary to the key/value pairs not matching the block, 31 | the logical inverse to bk_select:. 32 | 33 | @param block A BOOL-returning code block for a key/value pair. 34 | @see bk_select: 35 | */ 36 | - (void)bk_performReject:(BOOL (^)(id key, id obj))block; 37 | 38 | /** Transform each value of the dictionary to a new value, as returned by the 39 | block. 40 | 41 | @param block A block that returns a new value for a given key/value pair. 42 | @see bk_map: 43 | */ 44 | - (void)bk_performMap:(id (^)(id key, id obj))block; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableDictionary+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableDictionary+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSMutableDictionary+BlocksKit.h" 7 | 8 | @implementation NSMutableDictionary (BlocksKit) 9 | 10 | - (void)bk_performSelect:(BOOL (^)(id key, id obj))block 11 | { 12 | NSParameterAssert(block != nil); 13 | 14 | NSArray *keys = [[self keysOfEntriesWithOptions:NSEnumerationConcurrent passingTest:^BOOL(id key, id obj, BOOL *stop) { 15 | return !block(key, obj); 16 | }] allObjects]; 17 | 18 | [self removeObjectsForKeys:keys]; 19 | } 20 | 21 | - (void)bk_performReject:(BOOL (^)(id key, id obj))block 22 | { 23 | NSParameterAssert(block != nil); 24 | [self bk_performSelect:^BOOL(id key, id obj) { 25 | return !block(key, obj); 26 | }]; 27 | } 28 | 29 | - (void)bk_performMap:(id (^)(id key, id obj))block 30 | { 31 | NSParameterAssert(block != nil); 32 | 33 | NSMutableDictionary *new = [self mutableCopy]; 34 | 35 | [self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 36 | id value = block(key, obj) ?: [NSNull null]; 37 | if ([value isEqual:obj]) return; 38 | new[key] = value; 39 | }]; 40 | 41 | [self setDictionary:new]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableIndexSet+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableIndexSet+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block extensions for NSMutableIndexSet. 9 | 10 | These utilities expound upon the BlocksKit additions to the immutable 11 | superclass by allowing certain utilities to work on an instance of the mutable 12 | class, saving memory by not creating an immutable copy of the results. 13 | 14 | @see NSIndexSet(BlocksKit) 15 | */ 16 | @interface NSMutableIndexSet (BlocksKit) 17 | 18 | /** Filters a mutable index set to the indexes matching the block. 19 | 20 | @param block A single-argument, BOOL-returning code block. 21 | @see bk_reject: 22 | */ 23 | - (void)bk_performSelect:(BOOL (^)(NSUInteger index))block; 24 | 25 | /** Filters a mutable index set to all indexes but the ones matching the block, 26 | the logical inverse to bk_select:. 27 | 28 | @param block A single-argument, BOOL-returning code block. 29 | @see bk_select: 30 | */ 31 | - (void)bk_performReject:(BOOL (^)(NSUInteger index))block; 32 | 33 | /** Transform each index of the index set to a new index, as returned by the 34 | block. 35 | 36 | @param block A block that returns a new index for a index. 37 | @see bk_map: 38 | */ 39 | - (void)bk_performMap:(NSUInteger (^)(NSUInteger index))block; 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableIndexSet+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableIndexSet+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSMutableIndexSet+BlocksKit.h" 7 | 8 | @implementation NSMutableIndexSet (BlocksKit) 9 | 10 | - (void)bk_performSelect:(BOOL (^)(NSUInteger index))block 11 | { 12 | NSParameterAssert(block != nil); 13 | 14 | NSIndexSet *list = [self indexesPassingTest:^BOOL(NSUInteger idx, BOOL *stop) { 15 | return !block(idx); 16 | }]; 17 | 18 | if (!list.count) return; 19 | [self removeIndexes:list]; 20 | } 21 | 22 | - (void)bk_performReject:(BOOL (^)(NSUInteger index))block 23 | { 24 | NSParameterAssert(block != nil); 25 | return [self bk_performSelect:^BOOL(NSUInteger idx) { 26 | return !block(idx); 27 | }]; 28 | } 29 | 30 | - (void)bk_performMap:(NSUInteger (^)(NSUInteger index))block 31 | { 32 | NSParameterAssert(block != nil); 33 | 34 | NSMutableIndexSet *new = [self mutableCopy]; 35 | 36 | [self enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { 37 | [new addIndex:block(idx)]; 38 | }]; 39 | 40 | [self removeAllIndexes]; 41 | [self addIndexes:new]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableOrderedSet+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableOrderedSet+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block extensions for NSMutableOrderedSet. 9 | 10 | These utilities expound upon the BlocksKit additions to the immutable 11 | superclass by allowing certain utilities to work on an instance of the mutable 12 | class, saving memory by not creating an immutable copy of the results. 13 | 14 | Includes code by the following: 15 | 16 | - [Martin Schürrer](https://github.com/MSch) 17 | - [Zach Waldowski](https://github.com/zwaldowski) 18 | 19 | @see NSOrderedSet(BlocksKit) 20 | */ 21 | @interface NSMutableOrderedSet (BlocksKit) 22 | 23 | /** Filters a mutable ordered set to the objects matching the block. 24 | 25 | @param block A single-argument, BOOL-returning code block. 26 | @see bk_reject: 27 | */ 28 | - (void)bk_performSelect:(BOOL (^)(id obj))block; 29 | 30 | /** Filters a mutable ordered set to all objects but the ones matching the 31 | block, the logical inverse to bk_select:. 32 | 33 | @param block A single-argument, BOOL-returning code block. 34 | @see bk_select: 35 | */ 36 | - (void)bk_performReject:(BOOL (^)(id obj))block; 37 | 38 | /** Transform the objects in the ordered set to the results of the block. 39 | 40 | This is sometimes referred to as a transform, mutating one of each object: 41 | [foo bk_performMap:^id(id obj) { 42 | return [dateTransformer dateFromString:obj]; 43 | }]; 44 | 45 | @param block A single-argument, object-returning code block. 46 | @see bk_map: 47 | */ 48 | - (void)bk_performMap:(id (^)(id obj))block; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableOrderedSet+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableOrderedSet+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSMutableOrderedSet+BlocksKit.h" 7 | 8 | @implementation NSMutableOrderedSet (BlocksKit) 9 | 10 | - (void)bk_performSelect:(BOOL (^)(id obj))block { 11 | NSParameterAssert(block != nil); 12 | 13 | NSIndexSet *list = [self indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { 14 | return !block(obj); 15 | }]; 16 | 17 | if (!list.count) return; 18 | [self removeObjectsAtIndexes:list]; 19 | } 20 | 21 | - (void)bk_performReject:(BOOL (^)(id obj))block { 22 | NSParameterAssert(block != nil); 23 | return [self bk_performSelect:^BOOL(id obj) { 24 | return !block(obj); 25 | }]; 26 | } 27 | 28 | - (void)bk_performMap:(id (^)(id obj))block { 29 | NSParameterAssert(block != nil); 30 | 31 | NSMutableIndexSet *newIndexes = [NSMutableIndexSet indexSet]; 32 | NSMutableArray *newObjects = [NSMutableArray arrayWithCapacity:self.count]; 33 | 34 | [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 35 | id value = block(obj) ?: [NSNull null]; 36 | if ([value isEqual:obj]) return; 37 | [newIndexes addIndex:idx]; 38 | [newObjects addObject:obj]; 39 | }]; 40 | 41 | [self replaceObjectsAtIndexes:newIndexes withObjects:newObjects]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableSet+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableSet+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block extensions for NSMutableSet. 9 | 10 | These utilities expound upon the BlocksKit additions to the immutable 11 | superclass by allowing certain utilities to work on an instance of the mutable 12 | class, saving memory by not creating an immutable copy of the results. 13 | 14 | Includes code by the following: 15 | 16 | - [Martin Schürrer](https://github.com/MSch) 17 | - [Zach Waldowski](https://github.com/zwaldowski) 18 | 19 | @see NSSet(BlocksKit) 20 | */ 21 | @interface NSMutableSet (BlocksKit) 22 | 23 | /** Filters a mutable set to the objects matching the block. 24 | 25 | @param block A single-argument, BOOL-returning code block. 26 | @see bk_reject: 27 | */ 28 | - (void)bk_performSelect:(BOOL (^)(id obj))block; 29 | 30 | /** Filters a mutable set to all objects but the ones matching the block, 31 | the logical inverse to bk_select:. 32 | 33 | @param block A single-argument, BOOL-returning code block. 34 | @see bk_select: 35 | */ 36 | - (void)bk_performReject:(BOOL (^)(id obj))block; 37 | 38 | /** Transform the objects in the set to the results of the block. 39 | 40 | This is sometimes referred to as a transform, mutating one of each object: 41 | [controllers bk_map:^id(id obj) { 42 | return [obj view]; 43 | }]; 44 | 45 | @param block A single-argument, object-returning code block. 46 | @see bk_map: 47 | */ 48 | - (void)bk_performMap:(id (^)(id obj))block; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSMutableSet+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableSet+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSMutableSet+BlocksKit.h" 7 | 8 | @implementation NSMutableSet (BlocksKit) 9 | 10 | - (void)bk_performSelect:(BOOL (^)(id obj))block { 11 | NSParameterAssert(block != nil); 12 | 13 | NSSet *list = [self objectsPassingTest:^BOOL(id obj, BOOL *stop) { 14 | return block(obj); 15 | }]; 16 | 17 | [self setSet:list]; 18 | } 19 | 20 | - (void)bk_performReject:(BOOL (^)(id obj))block { 21 | NSParameterAssert(block != nil); 22 | [self bk_performSelect:^BOOL(id obj) { 23 | return !block(obj); 24 | }]; 25 | } 26 | 27 | - (void)bk_performMap:(id (^)(id obj))block { 28 | NSParameterAssert(block != nil); 29 | 30 | NSMutableSet *new = [NSMutableSet setWithCapacity:self.count]; 31 | 32 | [self enumerateObjectsUsingBlock:^(id obj, BOOL *stop) { 33 | id value = block(obj); 34 | if (!value) return; 35 | [new addObject:value]; 36 | }]; 37 | 38 | [self setSet:new]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/Core/NSTimer+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSTimer+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "NSTimer+BlocksKit.h" 7 | 8 | @interface NSTimer (BlocksKitPrivate) 9 | 10 | + (void)bk_executeBlockFromTimer:(NSTimer *)aTimer; 11 | 12 | @end 13 | 14 | @implementation NSTimer (BlocksKit) 15 | 16 | + (id)bk_scheduledTimerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)(NSTimer *timer))block repeats:(BOOL)inRepeats 17 | { 18 | NSParameterAssert(block != nil); 19 | return [self scheduledTimerWithTimeInterval:inTimeInterval target:self selector:@selector(bk_executeBlockFromTimer:) userInfo:[block copy] repeats:inRepeats]; 20 | } 21 | 22 | + (id)bk_timerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)(NSTimer *timer))block repeats:(BOOL)inRepeats 23 | { 24 | NSParameterAssert(block != nil); 25 | return [self timerWithTimeInterval:inTimeInterval target:self selector:@selector(bk_executeBlockFromTimer:) userInfo:[block copy] repeats:inRepeats]; 26 | } 27 | 28 | + (void)bk_executeBlockFromTimer:(NSTimer *)aTimer { 29 | void (^block)(NSTimer *) = [aTimer userInfo]; 30 | if (block) block(aTimer); 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/DynamicDelegate/Foundation/NSCache+BlocksKit.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSCache+BlocksKit.m 3 | // BlocksKit 4 | // 5 | 6 | #import "A2DynamicDelegate.h" 7 | #import "NSCache+BlocksKit.h" 8 | #import "NSObject+A2BlockDelegate.h" 9 | 10 | #pragma mark Custom delegate 11 | 12 | @interface A2DynamicNSCacheDelegate : A2DynamicDelegate 13 | 14 | @end 15 | 16 | @implementation A2DynamicNSCacheDelegate 17 | 18 | - (void)cache:(NSCache *)cache willEvictObject:(id)obj 19 | { 20 | id realDelegate = self.realDelegate; 21 | if (realDelegate && [realDelegate respondsToSelector:@selector(cache:willEvictObject:)]) 22 | [realDelegate cache:cache willEvictObject:obj]; 23 | 24 | void (^orig)(NSCache *, id) = [self blockImplementationForMethod:_cmd]; 25 | if (orig) orig(cache, obj); 26 | } 27 | 28 | @end 29 | 30 | #pragma mark Category 31 | 32 | @implementation NSCache (BlocksKit) 33 | 34 | @dynamic bk_willEvictBlock; 35 | 36 | + (void)load 37 | { 38 | @autoreleasepool { 39 | [self bk_registerDynamicDelegate]; 40 | [self bk_linkDelegateMethods:@{ @"bk_willEvictBlock": @"cache:willEvictObject:" }]; 41 | } 42 | } 43 | 44 | #pragma mark Methods 45 | 46 | - (id)bk_objectForKey:(id)key withGetter:(id (^)(void))block 47 | { 48 | id object = [self objectForKey:key]; 49 | if (object) return object; 50 | 51 | if (block) { 52 | object = block(); 53 | [self setObject:object forKey:key]; 54 | } 55 | 56 | return object; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/MessageUI/MFMailComposeViewController+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // MFMailComposeViewController+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** MFMailComposeViewController with block callbacks. 9 | 10 | If you provide a completion handler to an instance of 11 | MFMailComposeViewController but do not implement a delegate callback for 12 | mailComposeController:didFinishWithResult:error:, the mail compose view 13 | controller will automatically be dismissed if it was launched modally. 14 | 15 | Created by [Igor Evsukov](https://github.com/evsukov89) and contributed to 16 | BlocksKit. 17 | 18 | @warning MFMailComposeViewController is only available on a platform with MessageUI. 19 | */ 20 | @interface MFMailComposeViewController (BlocksKit) 21 | 22 | /** The block fired on the dismissal of the mail composition interface. 23 | 24 | This block callback is an analog for the 25 | mailComposeController:didFinishWithResult:error:method 26 | of MFMailComposeViewControllerDelegate. 27 | */ 28 | @property (nonatomic, copy, setter = bk_setCompletionBlock:) void (^bk_completionBlock)(MFMailComposeViewController *controller, MFMailComposeResult result, NSError *error); 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/MessageUI/MFMessageComposeViewController+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // MFMessageComposeViewController+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** MFMessageComposeViewController with block callback in addition to delegation. 9 | 10 | If you provide a completion handler to an instance of 11 | MFMessageComposeViewController but do not implement a delegate callback for 12 | messageComposeViewController:didFinishWithResult:error:, the message compose 13 | view controller will automatically be dismissed if it was launched modally. 14 | 15 | Created by [Igor Evsukov](https://github.com/evsukov89) and contributed to 16 | BlocksKit. 17 | 18 | @warning MFMessageComposeViewController is only available on a platform with MessageUI. 19 | */ 20 | @interface MFMessageComposeViewController (BlocksKit) 21 | 22 | /** The block fired on the dismissal of the SMS composition interface. 23 | 24 | This block callback is an analog for the 25 | messageComposeViewController:didFinishWithResult: method 26 | of MFMessageComposeViewControllerDelegate. 27 | */ 28 | @property (nonatomic, copy, setter = bk_setCompletionBlock:) void (^bk_completionBlock)(MFMessageComposeViewController *controller, MessageComposeResult result); 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/UIKit/UIImagePickerController+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImagePickerController+BlocksKit.h 3 | // BlocksKit 4 | // 5 | // Contributed by Yas Kuraishi. 6 | // 7 | 8 | #import 9 | 10 | /** UIImagePickerController with block callback. 11 | 12 | Created by [Yas Kuraishi](https://github.com/YasKuraishi) and contributed to 13 | BlocksKit. 14 | 15 | @warning UIImagePickerController is only available on a platform with 16 | UIKit. 17 | */ 18 | @interface UIImagePickerController (BlocksKit) 19 | 20 | /** 21 | * The block that fires after the receiver finished picking up an image 22 | */ 23 | @property (nonatomic, copy) void(^bk_didFinishPickingMediaBlock)(UIImagePickerController *, NSDictionary *); 24 | 25 | /** 26 | * The block that fires after the user cancels out of picker 27 | */ 28 | @property (nonatomic, copy) void(^bk_didCancelBlock)(UIImagePickerController *); 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/UIKit/UIPopoverController+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIPopoverController+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block functionality for UIPopoverController. 9 | 10 | Created by [Alexsander Akers](https://github.com/a2) and contributed to BlocksKit. 11 | 12 | @warning UIPopovercontroller is only available on a platform with UIKit. 13 | */ 14 | @interface UIPopoverController (BlocksKit) 15 | 16 | /** The block to be called when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view. */ 17 | @property (nonatomic, copy, setter = bk_setShouldDismissBlock:) BOOL (^bk_shouldDismissBlock)(UIPopoverController *popoverController); 18 | 19 | /** The block to be called when the user has taken action to dismiss the popover. This is not called when -dismissPopoverAnimated: is called directly. */ 20 | @property (nonatomic, copy, setter = bk_setDidDismissBlock:) void (^bk_didDismissBlock)(UIPopoverController *popoverController); 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/BlocksKit/UIKit/UIWebView+BlocksKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWebView+BlocksKit.h 3 | // BlocksKit 4 | // 5 | 6 | #import 7 | 8 | /** Block callbacks for UIWebView. 9 | 10 | @warning UIWebView is only available on a platform with UIKit. 11 | */ 12 | 13 | @interface UIWebView (BlocksKit) 14 | 15 | /** The block to be decide whether a URL will be loaded. 16 | 17 | @warning If the delegate implements webView:shouldStartLoadWithRequest:navigationType:, 18 | the return values of both the delegate method and the block will be considered. 19 | */ 20 | @property (nonatomic, copy, setter = bk_setShouldStartLoadBlock:) BOOL (^bk_shouldStartLoadBlock)(UIWebView *webView, NSURLRequest *request, UIWebViewNavigationType navigationType); 21 | 22 | /** The block that is fired when the web view starts loading. */ 23 | @property (nonatomic, copy, setter = bk_setDidStartLoadBlock:) void (^bk_didStartLoadBlock)(UIWebView *webView); 24 | 25 | /** The block that is fired when the web view finishes loading. */ 26 | @property (nonatomic, copy, setter = bk_setDidFinishLoadBlock:) void (^bk_didFinishLoadBlock)(UIWebView *webView); 27 | 28 | /** The block that is fired when the web view stops loading due to an error. */ 29 | @property (nonatomic, copy, setter = bk_setDidFinishWithErrorBlock:) void (^bk_didFinishWithErrorBlock)(UIWebView *webView, NSError *error); 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/BlocksKit/LICENSE: -------------------------------------------------------------------------------- 1 | // 2 | // LICENSE 3 | // BlocksKit 4 | // 5 | 6 | Copyright (c) 2011-2014 Zachary Waldowski, Alexsander Akers, and the BlocksKit Contributors 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BlocksKit (2.2.5): 3 | - BlocksKit/All (= 2.2.5) 4 | - BlocksKit/All (2.2.5): 5 | - BlocksKit/Core 6 | - BlocksKit/DynamicDelegate 7 | - BlocksKit/MessageUI 8 | - BlocksKit/UIKit 9 | - BlocksKit/Core (2.2.5) 10 | - BlocksKit/DynamicDelegate (2.2.5) 11 | - BlocksKit/MessageUI (2.2.5): 12 | - BlocksKit/Core 13 | - BlocksKit/DynamicDelegate 14 | - BlocksKit/UIKit (2.2.5): 15 | - BlocksKit/Core 16 | - BlocksKit/DynamicDelegate 17 | - Masonry (1.0.2) 18 | - ReactiveCocoa (2.5): 19 | - ReactiveCocoa/UI (= 2.5) 20 | - ReactiveCocoa/Core (2.5): 21 | - ReactiveCocoa/no-arc 22 | - ReactiveCocoa/no-arc (2.5) 23 | - ReactiveCocoa/UI (2.5): 24 | - ReactiveCocoa/Core 25 | - SDWebImage (3.8.2): 26 | - SDWebImage/Core (= 3.8.2) 27 | - SDWebImage/Core (3.8.2) 28 | - UITableView+FDTemplateLayoutCell (1.5.beta) 29 | 30 | DEPENDENCIES: 31 | - BlocksKit (~> 2.2.5) 32 | - Masonry 33 | - ReactiveCocoa (~> 2.5) 34 | - SDWebImage (~> 3.8.1) 35 | - UITableView+FDTemplateLayoutCell (~> 1.5.beta) 36 | 37 | SPEC CHECKSUMS: 38 | BlocksKit: 7f422b971407001178d181a43b99014ea2591fe6 39 | Masonry: 7c429b56da9d4ee0bbb3ed77a5ea710d6a5df39e 40 | ReactiveCocoa: e2db045570aa97c695e7aa97c2bcab222ae51f4a 41 | SDWebImage: 098e97e6176540799c27e804c96653ee0833d13c 42 | UITableView+FDTemplateLayoutCell: 02b508ab1cb4cea16a8c17ac83d2cd1fd72124f9 43 | 44 | PODFILE CHECKSUM: a8cca1c59e57afc3fc6250936d3ccb0e26f9f97e 45 | 46 | COCOAPODS: 1.1.1 47 | -------------------------------------------------------------------------------- /CodeExamples/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. -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASAttribute.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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint.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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/LICENSE.md: -------------------------------------------------------------------------------- 1 | **Copyright (c) 2012 - 2015, GitHub, Inc.** 2 | **All rights reserved.** 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/MKAnnotationView+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // MKAnnotationView+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Zak Remer on 3/31/15. 6 | // Copyright (c) 2015 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class RACSignal; 13 | 14 | @interface MKAnnotationView (RACSignalSupport) 15 | 16 | /// A signal which will send a RACUnit whenever -prepareForReuse is invoked upon 17 | /// the receiver. 18 | /// 19 | /// Examples 20 | /// 21 | /// [[[self.cancelButton 22 | /// rac_signalForControlEvents:UIControlEventTouchUpInside] 23 | /// takeUntil:self.rac_prepareForReuseSignal] 24 | /// subscribeNext:^(UIButton *x) { 25 | /// // do other things 26 | /// }]; 27 | @property (nonatomic, strong, readonly) RACSignal *rac_prepareForReuseSignal; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/MKAnnotationView+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // MKAnnotationView+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Zak Remer on 3/31/15. 6 | // Copyright (c) 2015 GitHub. All rights reserved. 7 | // 8 | 9 | #import "MKAnnotationView+RACSignalSupport.h" 10 | #import "NSObject+RACDescription.h" 11 | #import "NSObject+RACSelectorSignal.h" 12 | #import "RACSignal+Operations.h" 13 | #import "RACUnit.h" 14 | #import 15 | 16 | @implementation MKAnnotationView (RACSignalSupport) 17 | 18 | - (RACSignal *)rac_prepareForReuseSignal { 19 | RACSignal *signal = objc_getAssociatedObject(self, _cmd); 20 | if (signal != nil) return signal; 21 | 22 | signal = [[[self 23 | rac_signalForSelector:@selector(prepareForReuse)] 24 | mapReplace:RACUnit.defaultUnit] 25 | setNameWithFormat:@"%@ -rac_prepareForReuseSignal", self.rac_description]; 26 | 27 | objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return signal; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSArray+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSArray (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence corresponding to the receiver. 16 | /// 17 | /// Mutating the receiver will not affect the sequence after it's been created. 18 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSArray+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSArray+RACSequenceAdditions.h" 10 | #import "RACArraySequence.h" 11 | 12 | @implementation NSArray (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | return [RACArraySequence sequenceWithArray:self offset:0]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSData+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/11/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACScheduler; 12 | @class RACSignal; 13 | 14 | @interface NSData (RACSupport) 15 | 16 | // Read the data at the URL using -[NSData initWithContentsOfURL:options:error:]. 17 | // Sends the data or the error. 18 | // 19 | // scheduler - cannot be nil. 20 | + (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSData+RACSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+RACSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/11/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSData+RACSupport.h" 10 | #import "RACReplaySubject.h" 11 | #import "RACScheduler.h" 12 | 13 | @implementation NSData (RACSupport) 14 | 15 | + (RACSignal *)rac_readContentsOfURL:(NSURL *)URL options:(NSDataReadingOptions)options scheduler:(RACScheduler *)scheduler { 16 | NSCParameterAssert(scheduler != nil); 17 | 18 | RACReplaySubject *subject = [RACReplaySubject subject]; 19 | [subject setNameWithFormat:@"+rac_readContentsOfURL: %@ options: %lu scheduler: %@", URL, (unsigned long)options, scheduler]; 20 | 21 | [scheduler schedule:^{ 22 | NSError *error = nil; 23 | NSData *data = [[NSData alloc] initWithContentsOfURL:URL options:options error:&error]; 24 | if (data == nil) { 25 | [subject sendError:error]; 26 | } else { 27 | [subject sendNext:data]; 28 | [subject sendCompleted]; 29 | } 30 | }]; 31 | 32 | return subject; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSDictionary+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSDictionary (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence of RACTuple key/value pairs. The key will be 16 | /// the first element in the tuple, and the value will be the second. 17 | /// 18 | /// Mutating the receiver will not affect the sequence after it's been created. 19 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 20 | 21 | /// Creates and returns a sequence corresponding to the keys in the receiver. 22 | /// 23 | /// Mutating the receiver will not affect the sequence after it's been created. 24 | @property (nonatomic, copy, readonly) RACSequence *rac_keySequence; 25 | 26 | /// Creates and returns a sequence corresponding to the values in the receiver. 27 | /// 28 | /// Mutating the receiver will not affect the sequence after it's been created. 29 | @property (nonatomic, copy, readonly) RACSequence *rac_valueSequence; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSDictionary+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+RACSequenceAdditions.h" 10 | #import "NSArray+RACSequenceAdditions.h" 11 | #import "RACSequence.h" 12 | #import "RACTuple.h" 13 | 14 | @implementation NSDictionary (RACSequenceAdditions) 15 | 16 | - (RACSequence *)rac_sequence { 17 | NSDictionary *immutableDict = [self copy]; 18 | 19 | // TODO: First class support for dictionary sequences. 20 | return [immutableDict.allKeys.rac_sequence map:^(id key) { 21 | id value = immutableDict[key]; 22 | return RACTuplePack(key, value); 23 | }]; 24 | } 25 | 26 | - (RACSequence *)rac_keySequence { 27 | return self.allKeys.rac_sequence; 28 | } 29 | 30 | - (RACSequence *)rac_valueSequence { 31 | return self.allValues.rac_sequence; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSEnumerator+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSEnumerator+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 07/01/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSEnumerator (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence corresponding to the receiver. 16 | /// 17 | /// The receiver is exhausted lazily as the sequence is enumerated. 18 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSEnumerator+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSEnumerator+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 07/01/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSEnumerator+RACSequenceAdditions.h" 10 | #import "RACSequence.h" 11 | 12 | @implementation NSEnumerator (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | return [RACSequence sequenceWithHeadBlock:^{ 16 | return [self nextObject]; 17 | } tailBlock:^{ 18 | return self.rac_sequence; 19 | }]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSFileHandle+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileHandle+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/10/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface NSFileHandle (RACSupport) 14 | 15 | // Read any available data in the background and send it. Completes when data 16 | // length is <= 0. 17 | - (RACSignal *)rac_readInBackground; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSFileHandle+RACSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileHandle+RACSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/10/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSFileHandle+RACSupport.h" 10 | #import "NSNotificationCenter+RACSupport.h" 11 | #import "NSObject+RACDescription.h" 12 | #import "RACReplaySubject.h" 13 | #import "RACDisposable.h" 14 | 15 | @implementation NSFileHandle (RACSupport) 16 | 17 | - (RACSignal *)rac_readInBackground { 18 | RACReplaySubject *subject = [RACReplaySubject subject]; 19 | [subject setNameWithFormat:@"%@ -rac_readInBackground", self.rac_description]; 20 | 21 | RACSignal *dataNotification = [[[NSNotificationCenter defaultCenter] rac_addObserverForName:NSFileHandleReadCompletionNotification object:self] map:^(NSNotification *note) { 22 | return note.userInfo[NSFileHandleNotificationDataItem]; 23 | }]; 24 | 25 | __block RACDisposable *subscription = [dataNotification subscribeNext:^(NSData *data) { 26 | if (data.length > 0) { 27 | [subject sendNext:data]; 28 | [self readInBackgroundAndNotify]; 29 | } else { 30 | [subject sendCompleted]; 31 | [subscription dispose]; 32 | } 33 | }]; 34 | 35 | [self readInBackgroundAndNotify]; 36 | 37 | return subject; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSIndexSet+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSIndexSet+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Sergey Gavrilyuk on 12/17/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSIndexSet (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence of indexes (as `NSNumber`s) corresponding to 16 | /// the receiver. 17 | /// 18 | /// Mutating the receiver will not affect the sequence after it's been created. 19 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSIndexSet+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSIndexSet+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Sergey Gavrilyuk on 12/17/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSIndexSet+RACSequenceAdditions.h" 10 | #import "RACIndexSetSequence.h" 11 | 12 | @implementation NSIndexSet (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | return [RACIndexSetSequence sequenceWithIndexSet:self]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSNotificationCenter+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNotificationCenter+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/10/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface NSNotificationCenter (RACSupport) 14 | 15 | // Sends the NSNotification every time the notification is posted. 16 | - (RACSignal *)rac_addObserverForName:(NSString *)notificationName object:(id)object; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSNotificationCenter+RACSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNotificationCenter+RACSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/10/12. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSNotificationCenter+RACSupport.h" 10 | #import "RACEXTScope.h" 11 | #import "RACSignal.h" 12 | #import "RACSubscriber.h" 13 | #import "RACDisposable.h" 14 | 15 | @implementation NSNotificationCenter (RACSupport) 16 | 17 | - (RACSignal *)rac_addObserverForName:(NSString *)notificationName object:(id)object { 18 | @unsafeify(object); 19 | return [[RACSignal createSignal:^(id subscriber) { 20 | @strongify(object); 21 | id observer = [self addObserverForName:notificationName object:object queue:nil usingBlock:^(NSNotification *note) { 22 | [subscriber sendNext:note]; 23 | }]; 24 | 25 | return [RACDisposable disposableWithBlock:^{ 26 | [self removeObserver:observer]; 27 | }]; 28 | }] setNameWithFormat:@"-rac_addObserverForName: %@ object: <%@: %p>", notificationName, [object class], object]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACDeallocating.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+RACDeallocating.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Kazuo Koga on 2013/03/15. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACCompoundDisposable; 12 | @class RACDisposable; 13 | @class RACSignal; 14 | 15 | @interface NSObject (RACDeallocating) 16 | 17 | /// The compound disposable which will be disposed of when the receiver is 18 | /// deallocated. 19 | @property (atomic, readonly, strong) RACCompoundDisposable *rac_deallocDisposable; 20 | 21 | /// Returns a signal that will complete immediately before the receiver is fully 22 | /// deallocated. If already deallocated when the signal is subscribed to, 23 | /// a `completed` event will be sent immediately. 24 | - (RACSignal *)rac_willDeallocSignal; 25 | 26 | @end 27 | 28 | @interface NSObject (RACDeallocatingDeprecated) 29 | 30 | - (RACSignal *)rac_didDeallocSignal __attribute__((deprecated("Use -rac_willDeallocSignal"))); 31 | 32 | - (void)rac_addDeallocDisposable:(RACDisposable *)disposable __attribute__((deprecated("Add disposables to -rac_deallocDisposable instead"))); 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACDescription.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+RACDescription.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // A private category providing a terser but faster alternative to -description. 12 | @interface NSObject (RACDescription) 13 | 14 | // A simplified description of the receiver, which does not invoke -description 15 | // (and thus should be much faster in many cases). 16 | // 17 | // This is for debugging purposes only, and will return a constant string 18 | // unless the RAC_DEBUG_SIGNAL_NAMES environment variable is set. 19 | - (NSString *)rac_description; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSObject+RACDescription.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+RACDescription.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSObject+RACDescription.h" 10 | #import "RACTuple.h" 11 | 12 | @implementation NSObject (RACDescription) 13 | 14 | - (NSString *)rac_description { 15 | if (getenv("RAC_DEBUG_SIGNAL_NAMES") != NULL) { 16 | return [[NSString alloc] initWithFormat:@"<%@: %p>", self.class, self]; 17 | } else { 18 | return @"(description skipped)"; 19 | } 20 | } 21 | 22 | @end 23 | 24 | @implementation NSValue (RACDescription) 25 | 26 | - (NSString *)rac_description { 27 | return self.description; 28 | } 29 | 30 | @end 31 | 32 | @implementation NSString (RACDescription) 33 | 34 | - (NSString *)rac_description { 35 | return self.description; 36 | } 37 | 38 | @end 39 | 40 | @implementation RACTuple (RACDescription) 41 | 42 | - (NSString *)rac_description { 43 | if (getenv("RAC_DEBUG_SIGNAL_NAMES") != NULL) { 44 | return self.allObjects.description; 45 | } else { 46 | return @"(description skipped)"; 47 | } 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSOrderedSet+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSOrderedSet+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSOrderedSet (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence corresponding to the receiver. 16 | /// 17 | /// Mutating the receiver will not affect the sequence after it's been created. 18 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSOrderedSet+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSOrderedSet+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSOrderedSet+RACSequenceAdditions.h" 10 | #import "NSArray+RACSequenceAdditions.h" 11 | 12 | @implementation NSOrderedSet (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | // TODO: First class support for ordered set sequences. 16 | return self.array.rac_sequence; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSSet+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSSet+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSSet (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence corresponding to the receiver. 16 | /// 17 | /// Mutating the receiver will not affect the sequence after it's been created. 18 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSSet+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSSet+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSSet+RACSequenceAdditions.h" 10 | #import "NSArray+RACSequenceAdditions.h" 11 | 12 | @implementation NSSet (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | // TODO: First class support for set sequences. 16 | return self.allObjects.rac_sequence; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACKeyPathUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACKeyPathUtilities.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 05/05/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // A private category of methods to extract parts of a key path. 12 | @interface NSString (RACKeyPathUtilities) 13 | 14 | // Returns an array of the components of the receiver. 15 | // 16 | // Calling this method on a string that isn't a key path is considered undefined 17 | // behavior. 18 | - (NSArray *)rac_keyPathComponents; 19 | 20 | // Returns a key path with all the components of the receiver except for the 21 | // last one. 22 | // 23 | // Calling this method on a string that isn't a key path is considered undefined 24 | // behavior. 25 | - (NSString *)rac_keyPathByDeletingLastKeyPathComponent; 26 | 27 | // Returns a key path with all the components of the receiver expect for the 28 | // first one. 29 | // 30 | // Calling this method on a string that isn't a key path is considered undefined 31 | // behavior. 32 | - (NSString *)rac_keyPathByDeletingFirstKeyPathComponent; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACKeyPathUtilities.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACKeyPathUtilities.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 05/05/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSString+RACKeyPathUtilities.h" 10 | 11 | @implementation NSString (RACKeyPathUtilities) 12 | 13 | - (NSArray *)rac_keyPathComponents { 14 | if (self.length == 0) { 15 | return nil; 16 | } 17 | return [self componentsSeparatedByString:@"."]; 18 | } 19 | 20 | - (NSString *)rac_keyPathByDeletingLastKeyPathComponent { 21 | NSUInteger lastDotIndex = [self rangeOfString:@"." options:NSBackwardsSearch].location; 22 | if (lastDotIndex == NSNotFound) { 23 | return nil; 24 | } 25 | return [self substringToIndex:lastDotIndex]; 26 | } 27 | 28 | - (NSString *)rac_keyPathByDeletingFirstKeyPathComponent { 29 | NSUInteger firstDotIndex = [self rangeOfString:@"."].location; 30 | if (firstDotIndex == NSNotFound) { 31 | return nil; 32 | } 33 | return [self substringFromIndex:firstDotIndex + 1]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACSequenceAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACSequenceAdditions.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSequence; 12 | 13 | @interface NSString (RACSequenceAdditions) 14 | 15 | /// Creates and returns a sequence containing strings corresponding to each 16 | /// composed character sequence in the receiver. 17 | /// 18 | /// Mutating the receiver will not affect the sequence after it's been created. 19 | @property (nonatomic, copy, readonly) RACSequence *rac_sequence; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACSequenceAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACSequenceAdditions.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "NSString+RACSequenceAdditions.h" 10 | #import "RACStringSequence.h" 11 | 12 | @implementation NSString (RACSequenceAdditions) 13 | 14 | - (RACSequence *)rac_sequence { 15 | return [RACStringSequence sequenceWithString:self offset:0]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/11/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACScheduler; 12 | @class RACSignal; 13 | 14 | @interface NSString (RACSupport) 15 | 16 | // Reads in the contents of the file using +[NSString stringWithContentsOfURL:usedEncoding:error:]. 17 | // Note that encoding won't be valid until the signal completes successfully. 18 | // 19 | // scheduler - cannot be nil. 20 | + (RACSignal *)rac_readContentsOfURL:(NSURL *)URL usedEncoding:(NSStringEncoding *)encoding scheduler:(RACScheduler *)scheduler; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSString+RACSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+RACSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/11/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSString+RACSupport.h" 10 | #import "RACReplaySubject.h" 11 | #import "RACScheduler.h" 12 | 13 | @implementation NSString (RACSupport) 14 | 15 | + (RACSignal *)rac_readContentsOfURL:(NSURL *)URL usedEncoding:(NSStringEncoding *)encoding scheduler:(RACScheduler *)scheduler { 16 | NSCParameterAssert(scheduler != nil); 17 | 18 | RACReplaySubject *subject = [RACReplaySubject subject]; 19 | [subject setNameWithFormat:@"+rac_readContentsOfURL: %@ usedEncoding:scheduler: %@", URL, scheduler]; 20 | 21 | [scheduler schedule:^{ 22 | NSError *error = nil; 23 | NSString *string = [NSString stringWithContentsOfURL:URL usedEncoding:encoding error:&error]; 24 | if (string == nil) { 25 | [subject sendError:error]; 26 | } else { 27 | [subject sendNext:string]; 28 | [subject sendCompleted]; 29 | } 30 | }]; 31 | 32 | return subject; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSURLConnection+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURLConnection+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-01. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface NSURLConnection (RACSupport) 14 | 15 | // Lazily loads data for the given request in the background. 16 | // 17 | // request - The URL request to load. This must not be nil. 18 | // 19 | // Returns a signal which will begin loading the request upon each subscription, 20 | // then send a `RACTuple` of the received `NSURLResponse` and downloaded 21 | // `NSData`, and complete on a background thread. If any errors occur, the 22 | // returned signal will error out. 23 | + (RACSignal *)rac_sendAsynchronousRequest:(NSURLRequest *)request; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSUserDefaults+RACSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSUserDefaults+RACSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Matt Diephouse on 12/19/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface NSUserDefaults (RACSupport) 14 | 15 | /// Creates and returns a terminal for binding the user defaults key. 16 | /// 17 | /// **Note:** The value in the user defaults is *asynchronously* updated with 18 | /// values sent to the channel. 19 | /// 20 | /// key - The user defaults key to create the channel terminal for. 21 | /// 22 | /// Returns a channel terminal that sends the value of the user defaults key 23 | /// upon subscription, sends an updated value whenever the default changes, and 24 | /// updates the default asynchronously with values it receives. 25 | - (RACChannelTerminal *)rac_channelTerminalForKey:(NSString *)key; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/NSUserDefaults+RACSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSUserDefaults+RACSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Matt Diephouse on 12/19/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "NSUserDefaults+RACSupport.h" 10 | #import "RACEXTScope.h" 11 | #import "NSNotificationCenter+RACSupport.h" 12 | #import "NSObject+RACDeallocating.h" 13 | #import "RACChannel.h" 14 | #import "RACScheduler.h" 15 | #import "RACSignal+Operations.h" 16 | 17 | @implementation NSUserDefaults (RACSupport) 18 | 19 | - (RACChannelTerminal *)rac_channelTerminalForKey:(NSString *)key { 20 | RACChannel *channel = [RACChannel new]; 21 | 22 | RACScheduler *scheduler = [RACScheduler scheduler]; 23 | __block BOOL ignoreNextValue = NO; 24 | 25 | @weakify(self); 26 | [[[[[[[NSNotificationCenter.defaultCenter 27 | rac_addObserverForName:NSUserDefaultsDidChangeNotification object:self] 28 | map:^(id _) { 29 | @strongify(self); 30 | return [self objectForKey:key]; 31 | }] 32 | startWith:[self objectForKey:key]] 33 | // Don't send values that were set on the other side of the terminal. 34 | filter:^ BOOL (id _) { 35 | if (RACScheduler.currentScheduler == scheduler && ignoreNextValue) { 36 | ignoreNextValue = NO; 37 | return NO; 38 | } 39 | return YES; 40 | }] 41 | distinctUntilChanged] 42 | takeUntil:self.rac_willDeallocSignal] 43 | subscribe:channel.leadingTerminal]; 44 | 45 | [[channel.leadingTerminal 46 | deliverOn:scheduler] 47 | subscribeNext:^(id value) { 48 | @strongify(self); 49 | ignoreNextValue = YES; 50 | [self setObject:value forKey:key]; 51 | }]; 52 | 53 | return channel.followingTerminal; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACArraySequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACArraySequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class that adapts an array to the RACSequence interface. 12 | @interface RACArraySequence : RACSequence 13 | 14 | // Returns a sequence for enumerating over the given array, starting from the 15 | // given offset. The array will be copied to prevent mutation. 16 | + (instancetype)sequenceWithArray:(NSArray *)array offset:(NSUInteger)offset; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACBehaviorSubject.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACBehaviorSubject.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/16/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubject.h" 10 | 11 | /// A behavior subject sends the last value it received when it is subscribed to. 12 | @interface RACBehaviorSubject : RACSubject 13 | 14 | /// Creates a new behavior subject with a default value. If it hasn't received 15 | /// any values when it gets subscribed to, it sends the default value. 16 | + (instancetype)behaviorSubjectWithDefaultValue:(id)value; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACBehaviorSubject.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACBehaviorSubject.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/16/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACBehaviorSubject.h" 10 | #import "RACDisposable.h" 11 | #import "RACScheduler+Private.h" 12 | 13 | @interface RACBehaviorSubject () 14 | 15 | // This property should only be used while synchronized on self. 16 | @property (nonatomic, strong) id currentValue; 17 | 18 | @end 19 | 20 | @implementation RACBehaviorSubject 21 | 22 | #pragma mark Lifecycle 23 | 24 | + (instancetype)behaviorSubjectWithDefaultValue:(id)value { 25 | RACBehaviorSubject *subject = [self subject]; 26 | subject.currentValue = value; 27 | return subject; 28 | } 29 | 30 | #pragma mark RACSignal 31 | 32 | - (RACDisposable *)subscribe:(id)subscriber { 33 | RACDisposable *subscriptionDisposable = [super subscribe:subscriber]; 34 | 35 | RACDisposable *schedulingDisposable = [RACScheduler.subscriptionScheduler schedule:^{ 36 | @synchronized (self) { 37 | [subscriber sendNext:self.currentValue]; 38 | } 39 | }]; 40 | 41 | return [RACDisposable disposableWithBlock:^{ 42 | [subscriptionDisposable dispose]; 43 | [schedulingDisposable dispose]; 44 | }]; 45 | } 46 | 47 | #pragma mark RACSubscriber 48 | 49 | - (void)sendNext:(id)value { 50 | @synchronized (self) { 51 | self.currentValue = value; 52 | [super sendNext:value]; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACBlockTrampoline.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACBlockTrampoline.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 10/21/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACTuple; 12 | 13 | // A private class that allows a limited type of dynamic block invocation. 14 | @interface RACBlockTrampoline : NSObject 15 | 16 | // Invokes the given block with the given arguments. All of the block's 17 | // argument types must be objects and it must be typed to return an object. 18 | // 19 | // At this time, it only supports blocks that take up to 15 arguments. Any more 20 | // is just cray. 21 | // 22 | // block - The block to invoke. Must accept as many arguments as are given in 23 | // the arguments array. Cannot be nil. 24 | // arguments - The arguments with which to invoke the block. `RACTupleNil`s will 25 | // be passed as nils. 26 | // 27 | // Returns the return value of invoking the block. 28 | + (id)invokeBlock:(id)block withArguments:(RACTuple *)arguments; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACCompoundDisposableProvider.d: -------------------------------------------------------------------------------- 1 | provider RACCompoundDisposable { 2 | probe added(char *compoundDisposable, char *disposable, long newTotal); 3 | probe removed(char *compoundDisposable, char *disposable, long newTotal); 4 | }; 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACDelegateProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACDelegateProxy.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Cody Krieger on 5/19/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | // A private delegate object suitable for using 14 | // -rac_signalForSelector:fromProtocol: upon. 15 | @interface RACDelegateProxy : NSObject 16 | 17 | // The delegate to which messages should be forwarded if not handled by 18 | // any -signalForSelector: applications. 19 | @property (nonatomic, unsafe_unretained) id rac_proxiedDelegate; 20 | 21 | // Creates a delegate proxy capable of responding to selectors from `protocol`. 22 | - (instancetype)initWithProtocol:(Protocol *)protocol; 23 | 24 | // Calls -rac_signalForSelector:fromProtocol: using the `protocol` specified 25 | // during initialization. 26 | - (RACSignal *)signalForSelector:(SEL)selector; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACDisposable.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACDisposable.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/16/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACScopedDisposable; 12 | 13 | /// A disposable encapsulates the work necessary to tear down and cleanup a 14 | /// subscription. 15 | @interface RACDisposable : NSObject 16 | 17 | /// Whether the receiver has been disposed. 18 | /// 19 | /// Use of this property is discouraged, since it may be set to `YES` 20 | /// concurrently at any time. 21 | /// 22 | /// This property is not KVO-compliant. 23 | @property (atomic, assign, getter = isDisposed, readonly) BOOL disposed; 24 | 25 | + (instancetype)disposableWithBlock:(void (^)(void))block; 26 | 27 | /// Performs the disposal work. Can be called multiple times, though subsequent 28 | /// calls won't do anything. 29 | - (void)dispose; 30 | 31 | /// Returns a new disposable which will dispose of this disposable when it gets 32 | /// dealloc'd. 33 | - (RACScopedDisposable *)asScopedDisposable; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACDynamicSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACDynamicSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class that implements a sequence dynamically using blocks. 12 | @interface RACDynamicSequence : RACSequence 13 | 14 | // Returns a sequence which evaluates `dependencyBlock` only once, the first 15 | // time either `headBlock` or `tailBlock` is evaluated. The result of 16 | // `dependencyBlock` will be passed into `headBlock` and `tailBlock` when 17 | // invoked. 18 | + (RACSequence *)sequenceWithLazyDependency:(id (^)(void))dependencyBlock headBlock:(id (^)(id dependency))headBlock tailBlock:(RACSequence *(^)(id dependency))tailBlock; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACDynamicSignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACDynamicSignal.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSignal.h" 10 | 11 | // A private `RACSignal` subclasses that implements its subscription behavior 12 | // using a block. 13 | @interface RACDynamicSignal : RACSignal 14 | 15 | + (RACSignal *)createSignal:(RACDisposable * (^)(id subscriber))didSubscribe; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACEagerSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACEagerSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 02/01/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACArraySequence.h" 10 | 11 | // Private class that implements an eager sequence. 12 | @interface RACEagerSequence : RACArraySequence 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACEmptySequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACEmptySequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class representing an empty sequence. 12 | @interface RACEmptySequence : RACSequence 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACEmptySequence.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACEmptySequence.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "RACEmptySequence.h" 10 | 11 | @implementation RACEmptySequence 12 | 13 | #pragma mark Lifecycle 14 | 15 | + (instancetype)empty { 16 | static id singleton; 17 | static dispatch_once_t pred; 18 | 19 | dispatch_once(&pred, ^{ 20 | singleton = [[self alloc] init]; 21 | }); 22 | 23 | return singleton; 24 | } 25 | 26 | #pragma mark RACSequence 27 | 28 | - (id)head { 29 | return nil; 30 | } 31 | 32 | - (RACSequence *)tail { 33 | return nil; 34 | } 35 | 36 | - (RACSequence *)bind:(RACStreamBindBlock)bindBlock passingThroughValuesFromSequence:(RACSequence *)passthroughSequence { 37 | return passthroughSequence ?: self; 38 | } 39 | 40 | #pragma mark NSCoding 41 | 42 | - (Class)classForCoder { 43 | // Empty sequences should be encoded as themselves, not array sequences. 44 | return self.class; 45 | } 46 | 47 | - (id)initWithCoder:(NSCoder *)coder { 48 | // Return the singleton. 49 | return self.class.empty; 50 | } 51 | 52 | - (void)encodeWithCoder:(NSCoder *)coder { 53 | } 54 | 55 | #pragma mark NSObject 56 | 57 | - (NSString *)description { 58 | return [NSString stringWithFormat:@"<%@: %p>{ name = %@ }", self.class, self, self.name]; 59 | } 60 | 61 | - (NSUInteger)hash { 62 | // This hash isn't ideal, but it's better than -[RACSequence hash], which 63 | // would just be zero because we have no head. 64 | return (NSUInteger)(__bridge void *)self; 65 | } 66 | 67 | - (BOOL)isEqual:(RACSequence *)seq { 68 | return (self == seq); 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACEmptySignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACEmptySignal.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSignal.h" 10 | 11 | // A private `RACSignal` subclasses that synchronously sends completed to any 12 | // subscribers. 13 | @interface RACEmptySignal : RACSignal 14 | 15 | + (RACSignal *)empty; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACEmptySignal.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACEmptySignal.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACEmptySignal.h" 10 | #import "RACScheduler+Private.h" 11 | #import "RACSubscriber.h" 12 | 13 | @implementation RACEmptySignal 14 | 15 | #pragma mark Properties 16 | 17 | // Only allow this signal's name to be customized in DEBUG, since it's 18 | // a singleton in release builds (see +empty). 19 | - (void)setName:(NSString *)name { 20 | #ifdef DEBUG 21 | [super setName:name]; 22 | #endif 23 | } 24 | 25 | - (NSString *)name { 26 | #ifdef DEBUG 27 | return super.name; 28 | #else 29 | return @"+empty"; 30 | #endif 31 | } 32 | 33 | #pragma mark Lifecycle 34 | 35 | + (RACSignal *)empty { 36 | #ifdef DEBUG 37 | // Create multiple instances of this class in DEBUG so users can set custom 38 | // names on each. 39 | return [[[self alloc] init] setNameWithFormat:@"+empty"]; 40 | #else 41 | static id singleton; 42 | static dispatch_once_t pred; 43 | 44 | dispatch_once(&pred, ^{ 45 | singleton = [[self alloc] init]; 46 | }); 47 | 48 | return singleton; 49 | #endif 50 | } 51 | 52 | #pragma mark Subscription 53 | 54 | - (RACDisposable *)subscribe:(id)subscriber { 55 | NSCParameterAssert(subscriber != nil); 56 | 57 | return [RACScheduler.subscriptionScheduler schedule:^{ 58 | [subscriber sendCompleted]; 59 | }]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACErrorSignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACErrorSignal.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSignal.h" 10 | 11 | // A private `RACSignal` subclasses that synchronously sends an error to any 12 | // subscribers. 13 | @interface RACErrorSignal : RACSignal 14 | 15 | + (RACSignal *)error:(NSError *)error; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACErrorSignal.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACErrorSignal.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACErrorSignal.h" 10 | #import "RACScheduler+Private.h" 11 | #import "RACSubscriber.h" 12 | 13 | @interface RACErrorSignal () 14 | 15 | // The error to send upon subscription. 16 | @property (nonatomic, strong, readonly) NSError *error; 17 | 18 | @end 19 | 20 | @implementation RACErrorSignal 21 | 22 | #pragma mark Lifecycle 23 | 24 | + (RACSignal *)error:(NSError *)error { 25 | RACErrorSignal *signal = [[self alloc] init]; 26 | signal->_error = error; 27 | 28 | #ifdef DEBUG 29 | [signal setNameWithFormat:@"+error: %@", error]; 30 | #else 31 | signal.name = @"+error:"; 32 | #endif 33 | 34 | return signal; 35 | } 36 | 37 | #pragma mark Subscription 38 | 39 | - (RACDisposable *)subscribe:(id)subscriber { 40 | NSCParameterAssert(subscriber != nil); 41 | 42 | return [RACScheduler.subscriptionScheduler schedule:^{ 43 | [subscriber sendError:self.error]; 44 | }]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACGroupedSignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACGroupedSignal.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/2/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubject.h" 10 | 11 | /// A grouped signal is used by -[RACSignal groupBy:transform:]. 12 | @interface RACGroupedSignal : RACSubject 13 | 14 | /// The key shared by the group. 15 | @property (nonatomic, readonly, copy) id key; 16 | 17 | + (instancetype)signalWithKey:(id)key; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACGroupedSignal.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACGroupedSignal.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 5/2/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACGroupedSignal.h" 10 | 11 | @interface RACGroupedSignal () 12 | @property (nonatomic, copy) id key; 13 | @end 14 | 15 | @implementation RACGroupedSignal 16 | 17 | #pragma mark API 18 | 19 | + (instancetype)signalWithKey:(id)key { 20 | RACGroupedSignal *subject = [self subject]; 21 | subject.key = key; 22 | return subject; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACImmediateScheduler.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACImmediateScheduler.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/30/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScheduler.h" 10 | 11 | // A private scheduler which immediately executes its scheduled blocks. 12 | @interface RACImmediateScheduler : RACScheduler 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACImmediateScheduler.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACImmediateScheduler.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/30/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACImmediateScheduler.h" 10 | #import "RACScheduler+Private.h" 11 | 12 | @implementation RACImmediateScheduler 13 | 14 | #pragma mark Lifecycle 15 | 16 | - (id)init { 17 | return [super initWithName:@"com.ReactiveCocoa.RACScheduler.immediateScheduler"]; 18 | } 19 | 20 | #pragma mark RACScheduler 21 | 22 | - (RACDisposable *)schedule:(void (^)(void))block { 23 | NSCParameterAssert(block != NULL); 24 | 25 | block(); 26 | return nil; 27 | } 28 | 29 | - (RACDisposable *)after:(NSDate *)date schedule:(void (^)(void))block { 30 | NSCParameterAssert(date != nil); 31 | NSCParameterAssert(block != NULL); 32 | 33 | [NSThread sleepUntilDate:date]; 34 | block(); 35 | 36 | return nil; 37 | } 38 | 39 | - (RACDisposable *)after:(NSDate *)date repeatingEvery:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway schedule:(void (^)(void))block { 40 | NSCAssert(NO, @"+[RACScheduler immediateScheduler] does not support %@.", NSStringFromSelector(_cmd)); 41 | return nil; 42 | } 43 | 44 | - (RACDisposable *)scheduleRecursiveBlock:(RACSchedulerRecursiveBlock)recursiveBlock { 45 | for (__block NSUInteger remaining = 1; remaining > 0; remaining--) { 46 | recursiveBlock(^{ 47 | remaining++; 48 | }); 49 | } 50 | 51 | return nil; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACIndexSetSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACIndexSetSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Sergey Gavrilyuk on 12/18/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class that adapts an array to the RACSequence interface. 12 | @interface RACIndexSetSequence : RACSequence 13 | 14 | + (instancetype)sequenceWithIndexSet:(NSIndexSet *)indexSet; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACKVOProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACKVOProxy.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Richard Speyer on 4/10/14. 6 | // Copyright (c) 2014 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /// A singleton that can act as a proxy between a KVO observation and a RAC 12 | /// subscriber, in order to protect against KVO lifetime issues. 13 | @interface RACKVOProxy : NSObject 14 | 15 | /// Returns the singleton KVO proxy object. 16 | + (instancetype)sharedProxy; 17 | 18 | /// Registers an observer with the proxy, such that when the proxy receives a 19 | /// KVO change with the given context, it forwards it to the observer. 20 | /// 21 | /// observer - True observer of the KVO change. Must not be nil. 22 | /// context - Arbitrary context object used to differentiate multiple 23 | /// observations of the same keypath. Must be unique, cannot be nil. 24 | - (void)addObserver:(__weak NSObject *)observer forContext:(void *)context; 25 | 26 | /// Removes an observer from the proxy. Parameters must match those passed to 27 | /// addObserver:forContext:. 28 | /// 29 | /// observer - True observer of the KVO change. Must not be nil. 30 | /// context - Arbitrary context object used to differentiate multiple 31 | /// observations of the same keypath. Must be unique, cannot be nil. 32 | - (void)removeObserver:(NSObject *)observer forContext:(void *)context; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACKVOTrampoline.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACKVOTrampoline.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 1/15/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "NSObject+RACKVOWrapper.h" 11 | #import "RACDisposable.h" 12 | 13 | // A private trampoline object that represents a KVO observation. 14 | // 15 | // Disposing of the trampoline will stop observation. 16 | @interface RACKVOTrampoline : RACDisposable 17 | 18 | // Initializes the receiver with the given parameters. 19 | // 20 | // target - The object whose key path should be observed. Cannot be nil. 21 | // observer - The object that gets notified when the value at the key path 22 | // changes. Can be nil. 23 | // keyPath - The key path on `target` to observe. Cannot be nil. 24 | // options - Any key value observing options to use in the observation. 25 | // block - The block to call when the value at the observed key path changes. 26 | // Cannot be nil. 27 | // 28 | // Returns the initialized object. 29 | - (id)initWithTarget:(__weak NSObject *)target observer:(__weak NSObject *)observer keyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options block:(RACKVOBlock)block; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACMulticastConnection+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACMulticastConnection+Private.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 4/11/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACMulticastConnection.h" 10 | 11 | @class RACSubject; 12 | 13 | @interface RACMulticastConnection () 14 | 15 | - (id)initWithSourceSignal:(RACSignal *)source subject:(RACSubject *)subject; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACObjCRuntime.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACObjCRuntime.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Cody Krieger on 5/19/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // A private class containing wrappers to runtime functions. 12 | @interface RACObjCRuntime : NSObject 13 | 14 | // Invokes objc_allocateClassPair(). Can be called from ARC code. 15 | + (Class)createClass:(const char *)className inheritingFromClass:(Class)superclass; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACObjCRuntime.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACObjCRuntime.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Cody Krieger on 5/19/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACObjCRuntime.h" 10 | #import 11 | 12 | #if __has_feature(objc_arc) 13 | #error "This file must be compiled without ARC." 14 | #endif 15 | 16 | @implementation RACObjCRuntime 17 | 18 | + (Class)createClass:(const char *)className inheritingFromClass:(Class)superclass { 19 | return objc_allocateClassPair(superclass, className, 0); 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACPassthroughSubscriber.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACPassthroughSubscriber.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-06-13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RACSubscriber.h" 11 | 12 | @class RACCompoundDisposable; 13 | @class RACSignal; 14 | 15 | // A private subscriber that passes through all events to another subscriber 16 | // while not disposed. 17 | @interface RACPassthroughSubscriber : NSObject 18 | 19 | // Initializes the receiver to pass through events until disposed. 20 | // 21 | // subscriber - The subscriber to forward events to. This must not be nil. 22 | // signal - The signal that will be sending events to the receiver. 23 | // disposable - When this disposable is disposed, no more events will be 24 | // forwarded. This must not be nil. 25 | // 26 | // Returns an initialized passthrough subscriber. 27 | - (instancetype)initWithSubscriber:(id)subscriber signal:(RACSignal *)signal disposable:(RACCompoundDisposable *)disposable; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACQueueScheduler+Subclass.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACQueueScheduler+Subclass.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 6/6/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACQueueScheduler.h" 10 | #import "RACScheduler+Subclass.h" 11 | 12 | /// An interface for use by GCD queue-based subclasses. 13 | /// 14 | /// See RACScheduler+Subclass.h for subclassing notes. 15 | @interface RACQueueScheduler () 16 | 17 | /// The queue on which blocks are enqueued. 18 | #if OS_OBJECT_HAVE_OBJC_SUPPORT 19 | @property (nonatomic, strong, readonly) dispatch_queue_t queue; 20 | #else 21 | // Swift builds with OS_OBJECT_HAVE_OBJC_SUPPORT=0 for Playgrounds and LLDB :( 22 | @property (nonatomic, assign, readonly) dispatch_queue_t queue; 23 | #endif 24 | 25 | /// Initializes the receiver with the name of the scheduler and the queue which 26 | /// the scheduler should use. 27 | /// 28 | /// name - The name of the scheduler. If nil, a default name will be used. 29 | /// queue - The queue upon which the receiver should enqueue scheduled blocks. 30 | /// This argument must not be NULL. 31 | /// 32 | /// Returns the initialized object. 33 | - (id)initWithName:(NSString *)name queue:(dispatch_queue_t)queue; 34 | 35 | /// Converts a date into a GCD time using dispatch_walltime(). 36 | /// 37 | /// date - The date to convert. This must not be nil. 38 | + (dispatch_time_t)wallTimeWithDate:(NSDate *)date; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACQueueScheduler.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACQueueScheduler.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/30/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScheduler.h" 10 | 11 | /// An abstract scheduler which asynchronously enqueues all its work to a Grand 12 | /// Central Dispatch queue. 13 | /// 14 | /// Because RACQueueScheduler is abstract, it should not be instantiated 15 | /// directly. Create a subclass using the `RACQueueScheduler+Subclass.h` 16 | /// interface and use that instead. 17 | @interface RACQueueScheduler : RACScheduler 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACReplaySubject.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACReplaySubject.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/14/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubject.h" 10 | 11 | extern const NSUInteger RACReplaySubjectUnlimitedCapacity; 12 | 13 | /// A replay subject saves the values it is sent (up to its defined capacity) 14 | /// and resends those to new subscribers. It will also replay an error or 15 | /// completion. 16 | @interface RACReplaySubject : RACSubject 17 | 18 | /// Creates a new replay subject with the given capacity. A capacity of 19 | /// RACReplaySubjectUnlimitedCapacity means values are never trimmed. 20 | + (instancetype)replaySubjectWithCapacity:(NSUInteger)capacity; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACReturnSignal.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACReturnSignal.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-10-10. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSignal.h" 10 | 11 | // A private `RACSignal` subclasses that synchronously sends a value to any 12 | // subscribers, then completes. 13 | @interface RACReturnSignal : RACSignal 14 | 15 | + (RACSignal *)return:(id)value; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACScheduler+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACScheduler+Private.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/29/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScheduler.h" 10 | 11 | // The thread-specific current scheduler key. 12 | extern NSString * const RACSchedulerCurrentSchedulerKey; 13 | 14 | // A private interface for internal RAC use only. 15 | @interface RACScheduler () 16 | 17 | // A dedicated scheduler that fills two requirements: 18 | // 19 | // 1. By the time subscription happens, we need a valid +currentScheduler. 20 | // 2. Subscription should happen as soon as possible. 21 | // 22 | // To fulfill those two, if we already have a valid +currentScheduler, it 23 | // immediately executes scheduled blocks. If we don't, it will execute scheduled 24 | // blocks with a private background scheduler. 25 | + (instancetype)subscriptionScheduler; 26 | 27 | // Initializes the receiver with the given name. 28 | // 29 | // name - The name of the scheduler. If nil, a default name will be used. 30 | // 31 | // Returns the initialized object. 32 | - (id)initWithName:(NSString *)name; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACScheduler+Subclass.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACScheduler.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Miķelis Vindavs on 5/27/14. 6 | // Copyright (c) 2014 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RACScheduler.h" 11 | 12 | /// An interface for use by subclasses. 13 | /// 14 | /// Subclasses should use `-performAsCurrentScheduler:` to do the actual block 15 | /// invocation so that +[RACScheduler currentScheduler] behaves as expected. 16 | /// 17 | /// **Note that RACSchedulers are expected to be serial**. Subclasses must honor 18 | /// that contract. See `RACTargetQueueScheduler` for a queue-based scheduler 19 | /// which will enforce the serialization guarantee. 20 | @interface RACScheduler () 21 | 22 | /// Performs the given block with the receiver as the current scheduler for 23 | /// its thread. This should only be called by subclasses to perform their 24 | /// scheduled blocks. 25 | /// 26 | /// block - The block to execute. Cannot be NULL. 27 | - (void)performAsCurrentScheduler:(void (^)(void))block; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACScopedDisposable.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACScopedDisposable.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/28/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACDisposable.h" 10 | 11 | /// A disposable that calls its own -dispose when it is dealloc'd. 12 | @interface RACScopedDisposable : RACDisposable 13 | 14 | /// Creates a new scoped disposable that will also dispose of the given 15 | /// disposable when it is dealloc'd. 16 | + (instancetype)scopedDisposableWithDisposable:(RACDisposable *)disposable; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACScopedDisposable.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACScopedDisposable.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/28/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScopedDisposable.h" 10 | 11 | @implementation RACScopedDisposable 12 | 13 | #pragma mark Lifecycle 14 | 15 | + (instancetype)scopedDisposableWithDisposable:(RACDisposable *)disposable { 16 | return [self disposableWithBlock:^{ 17 | [disposable dispose]; 18 | }]; 19 | } 20 | 21 | - (void)dealloc { 22 | [self dispose]; 23 | } 24 | 25 | #pragma mark RACDisposable 26 | 27 | - (RACScopedDisposable *)asScopedDisposable { 28 | // totally already are 29 | return self; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSignalProvider.d: -------------------------------------------------------------------------------- 1 | provider RACSignal { 2 | probe next(char *signal, char *subscriber, char *valueDescription); 3 | probe completed(char *signal, char *subscriber); 4 | probe error(char *signal, char *subscriber, char *errorDescription); 5 | }; 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSignalSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACSignalSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-11-09. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | @class RACSignal; 12 | 13 | // Private class that adapts a RACSignal to the RACSequence interface. 14 | @interface RACSignalSequence : RACSequence 15 | 16 | // Returns a sequence for enumerating over the given signal. 17 | + (RACSequence *)sequenceWithSignal:(RACSignal *)signal; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACStream+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACStream+Private.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-07-22. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACStream.h" 10 | 11 | @interface RACStream () 12 | 13 | // Combines a list of streams using the logic of the given block. 14 | // 15 | // streams - The streams to combine. 16 | // block - An operator that combines two streams and returns a new one. The 17 | // returned stream should contain 2-tuples of the streams' combined 18 | // values. 19 | // 20 | // Returns a combined stream. 21 | + (instancetype)join:(id)streams block:(RACStream * (^)(id, id))block; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACStringSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACStringSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2012-10-29. 6 | // Copyright (c) 2012 GitHub. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class that adapts a string to the RACSequence interface. 12 | @interface RACStringSequence : RACSequence 13 | 14 | // Returns a sequence for enumerating over the given string, starting from the 15 | // given character offset. The string will be copied to prevent mutation. 16 | + (RACSequence *)sequenceWithString:(NSString *)string offset:(NSUInteger)offset; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSubject.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACSubject.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/9/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSignal.h" 10 | #import "RACSubscriber.h" 11 | 12 | /// A subject can be thought of as a signal that you can manually control by 13 | /// sending next, completed, and error. 14 | /// 15 | /// They're most helpful in bridging the non-RAC world to RAC, since they let you 16 | /// manually control the sending of events. 17 | @interface RACSubject : RACSignal 18 | 19 | /// Returns a new subject. 20 | + (instancetype)subject; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSubscriber+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACSubscriber+Private.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-06-13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubscriber.h" 10 | 11 | // A simple block-based subscriber. 12 | @interface RACSubscriber : NSObject 13 | 14 | // Creates a new subscriber with the given blocks. 15 | + (instancetype)subscriberWithNext:(void (^)(id x))next error:(void (^)(NSError *error))error completed:(void (^)(void))completed; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSubscriptingAssignmentTrampoline.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACSubscriptingAssignmentTrampoline.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 9/24/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubscriptingAssignmentTrampoline.h" 10 | #import "RACSignal+Operations.h" 11 | 12 | @interface RACSubscriptingAssignmentTrampoline () 13 | 14 | // The object to bind to. 15 | @property (nonatomic, strong, readonly) id target; 16 | 17 | // A value to use when `nil` is sent on the bound signal. 18 | @property (nonatomic, strong, readonly) id nilValue; 19 | 20 | @end 21 | 22 | @implementation RACSubscriptingAssignmentTrampoline 23 | 24 | - (id)initWithTarget:(id)target nilValue:(id)nilValue { 25 | // This is often a programmer error, but this prevents crashes if the target 26 | // object has unexpectedly deallocated. 27 | if (target == nil) return nil; 28 | 29 | self = [super init]; 30 | if (self == nil) return nil; 31 | 32 | _target = target; 33 | _nilValue = nilValue; 34 | 35 | return self; 36 | } 37 | 38 | - (void)setObject:(RACSignal *)signal forKeyedSubscript:(NSString *)keyPath { 39 | [signal setKeyPath:keyPath onObject:self.target nilValue:self.nilValue]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSubscriptionScheduler.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACSubscriptionScheduler.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/30/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScheduler.h" 10 | 11 | // A private scheduler used only for subscriptions. See the private 12 | // +[RACScheduler subscriptionScheduler] method for more information. 13 | @interface RACSubscriptionScheduler : RACScheduler 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACSubscriptionScheduler.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACSubscriptionScheduler.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 11/30/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSubscriptionScheduler.h" 10 | #import "RACScheduler+Private.h" 11 | 12 | @interface RACSubscriptionScheduler () 13 | 14 | // A private background scheduler on which to subscribe if the +currentScheduler 15 | // is unknown. 16 | @property (nonatomic, strong, readonly) RACScheduler *backgroundScheduler; 17 | 18 | @end 19 | 20 | @implementation RACSubscriptionScheduler 21 | 22 | #pragma mark Lifecycle 23 | 24 | - (id)init { 25 | self = [super initWithName:@"com.ReactiveCocoa.RACScheduler.subscriptionScheduler"]; 26 | if (self == nil) return nil; 27 | 28 | _backgroundScheduler = [RACScheduler scheduler]; 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark RACScheduler 34 | 35 | - (RACDisposable *)schedule:(void (^)(void))block { 36 | NSCParameterAssert(block != NULL); 37 | 38 | if (RACScheduler.currentScheduler == nil) return [self.backgroundScheduler schedule:block]; 39 | 40 | block(); 41 | return nil; 42 | } 43 | 44 | - (RACDisposable *)after:(NSDate *)date schedule:(void (^)(void))block { 45 | RACScheduler *scheduler = RACScheduler.currentScheduler ?: self.backgroundScheduler; 46 | return [scheduler after:date schedule:block]; 47 | } 48 | 49 | - (RACDisposable *)after:(NSDate *)date repeatingEvery:(NSTimeInterval)interval withLeeway:(NSTimeInterval)leeway schedule:(void (^)(void))block { 50 | RACScheduler *scheduler = RACScheduler.currentScheduler ?: self.backgroundScheduler; 51 | return [scheduler after:date repeatingEvery:interval withLeeway:leeway schedule:block]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACTargetQueueScheduler.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACTargetQueueScheduler.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 6/6/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACQueueScheduler.h" 10 | 11 | /// A scheduler that enqueues blocks on a private serial queue, targeting an 12 | /// arbitrary GCD queue. 13 | @interface RACTargetQueueScheduler : RACQueueScheduler 14 | 15 | /// Initializes the receiver with a serial queue that will target the given 16 | /// `targetQueue`. 17 | /// 18 | /// name - The name of the scheduler. If nil, a default name will be used. 19 | /// targetQueue - The queue to target. Cannot be NULL. 20 | /// 21 | /// Returns the initialized object. 22 | - (id)initWithName:(NSString *)name targetQueue:(dispatch_queue_t)targetQueue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACTargetQueueScheduler.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACTargetQueueScheduler.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 6/6/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACTargetQueueScheduler.h" 10 | #import "RACQueueScheduler+Subclass.h" 11 | 12 | @implementation RACTargetQueueScheduler 13 | 14 | #pragma mark Lifecycle 15 | 16 | - (id)initWithName:(NSString *)name targetQueue:(dispatch_queue_t)targetQueue { 17 | NSCParameterAssert(targetQueue != NULL); 18 | 19 | if (name == nil) { 20 | name = [NSString stringWithFormat:@"com.ReactiveCocoa.RACTargetQueueScheduler(%s)", dispatch_queue_get_label(targetQueue)]; 21 | } 22 | 23 | dispatch_queue_t queue = dispatch_queue_create(name.UTF8String, DISPATCH_QUEUE_SERIAL); 24 | if (queue == NULL) return nil; 25 | 26 | dispatch_set_target_queue(queue, targetQueue); 27 | 28 | return [super initWithName:name queue:queue]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACTestScheduler.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACTestScheduler.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-07-06. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACScheduler.h" 10 | 11 | /// A special kind of scheduler that steps through virtualized time. 12 | /// 13 | /// This scheduler class can be used in unit tests to verify asynchronous 14 | /// behaviors without spending significant time waiting. 15 | /// 16 | /// This class can be used from multiple threads, but only one thread can `step` 17 | /// through the enqueued actions at a time. Other threads will wait while the 18 | /// scheduled blocks are being executed. 19 | @interface RACTestScheduler : RACScheduler 20 | 21 | /// Initializes a new test scheduler. 22 | - (instancetype)init; 23 | 24 | /// Executes the next scheduled block, if any. 25 | /// 26 | /// This method will block until the scheduled action has completed. 27 | - (void)step; 28 | 29 | /// Executes up to the next `ticks` scheduled blocks. 30 | /// 31 | /// This method will block until the scheduled actions have completed. 32 | /// 33 | /// ticks - The number of scheduled blocks to execute. If there aren't this many 34 | /// blocks enqueued, all scheduled blocks are executed. 35 | - (void)step:(NSUInteger)ticks; 36 | 37 | /// Executes all of the scheduled blocks on the receiver. 38 | /// 39 | /// This method will block until the scheduled actions have completed. 40 | - (void)stepAll; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACTupleSequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACTupleSequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-01. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class that adapts a RACTuple to the RACSequence interface. 12 | @interface RACTupleSequence : RACSequence 13 | 14 | // Returns a sequence for enumerating over the given backing array (from a 15 | // RACTuple), starting from the given offset. 16 | + (instancetype)sequenceWithTupleBackingArray:(NSArray *)backingArray offset:(NSUInteger)offset; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACUnarySequence.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACUnarySequence.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-05-01. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACSequence.h" 10 | 11 | // Private class representing a sequence of exactly one value. 12 | @interface RACUnarySequence : RACSequence 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACUnit.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACUnit.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/27/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /// A unit represents an empty value. 12 | /// 13 | /// It should never be necessary to create a unit yourself. Just use +defaultUnit. 14 | @interface RACUnit : NSObject 15 | 16 | /// A singleton instance. 17 | + (RACUnit *)defaultUnit; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACUnit.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACUnit.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/27/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACUnit.h" 10 | 11 | @implementation RACUnit 12 | 13 | #pragma mark API 14 | 15 | + (RACUnit *)defaultUnit { 16 | static dispatch_once_t onceToken; 17 | static RACUnit *defaultUnit = nil; 18 | dispatch_once(&onceToken, ^{ 19 | defaultUnit = [[self alloc] init]; 20 | }); 21 | 22 | return defaultUnit; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACValueTransformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // RACValueTransformer.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/6/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // A private block based transformer. 12 | @interface RACValueTransformer : NSValueTransformer 13 | 14 | + (instancetype)transformerWithBlock:(id (^)(id value))block; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/RACValueTransformer.m: -------------------------------------------------------------------------------- 1 | // 2 | // RACValueTransformer.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 3/6/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "RACValueTransformer.h" 10 | 11 | @interface RACValueTransformer () 12 | @property (nonatomic, copy) id (^transformBlock)(id value); 13 | @end 14 | 15 | 16 | @implementation RACValueTransformer 17 | 18 | 19 | #pragma mark NSValueTransformer 20 | 21 | + (BOOL)allowsReverseTransformation { 22 | return NO; 23 | } 24 | 25 | - (id)transformedValue:(id)value { 26 | return self.transformBlock(value); 27 | } 28 | 29 | 30 | #pragma mark API 31 | 32 | @synthesize transformBlock; 33 | 34 | + (instancetype)transformerWithBlock:(id (^)(id value))block { 35 | NSCParameterAssert(block != NULL); 36 | 37 | RACValueTransformer *transformer = [[self alloc] init]; 38 | transformer.transformBlock = block; 39 | return transformer; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIActionSheet+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Dave Lee on 2013-06-22. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACDelegateProxy; 12 | @class RACSignal; 13 | 14 | @interface UIActionSheet (RACSignalSupport) 15 | 16 | /// A delegate proxy which will be set as the receiver's delegate when any of the 17 | /// methods in this category are used. 18 | @property (nonatomic, strong, readonly) RACDelegateProxy *rac_delegateProxy; 19 | 20 | /// Creates a signal for button clicks on the receiver. 21 | /// 22 | /// When this method is invoked, the `rac_delegateProxy` will become the 23 | /// receiver's delegate. Any previous delegate will become the -[RACDelegateProxy 24 | /// rac_proxiedDelegate], so that it receives any messages that the proxy doesn't 25 | /// know how to handle. Setting the receiver's `delegate` afterward is 26 | /// considered undefined behavior. 27 | /// 28 | /// Returns a signal which will send the index of the specific button clicked. 29 | /// The signal will complete when the receiver is deallocated. 30 | - (RACSignal *)rac_buttonClickedSignal; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIActionSheet+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Dave Lee on 2013-06-22. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UIActionSheet+RACSignalSupport.h" 10 | #import "RACDelegateProxy.h" 11 | #import "RACSignal+Operations.h" 12 | #import "NSObject+RACDeallocating.h" 13 | #import "NSObject+RACDescription.h" 14 | #import 15 | 16 | @implementation UIActionSheet (RACSignalSupport) 17 | 18 | static void RACUseDelegateProxy(UIActionSheet *self) { 19 | if (self.delegate == self.rac_delegateProxy) return; 20 | 21 | self.rac_delegateProxy.rac_proxiedDelegate = self.delegate; 22 | self.delegate = (id)self.rac_delegateProxy; 23 | } 24 | 25 | - (RACDelegateProxy *)rac_delegateProxy { 26 | RACDelegateProxy *proxy = objc_getAssociatedObject(self, _cmd); 27 | if (proxy == nil) { 28 | proxy = [[RACDelegateProxy alloc] initWithProtocol:@protocol(UIActionSheetDelegate)]; 29 | objc_setAssociatedObject(self, _cmd, proxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 30 | } 31 | 32 | return proxy; 33 | } 34 | 35 | - (RACSignal *)rac_buttonClickedSignal { 36 | RACSignal *signal = [[[[self.rac_delegateProxy 37 | signalForSelector:@selector(actionSheet:clickedButtonAtIndex:)] 38 | reduceEach:^(UIActionSheet *actionSheet, NSNumber *buttonIndex) { 39 | return buttonIndex; 40 | }] 41 | takeUntil:self.rac_willDeallocSignal] 42 | setNameWithFormat:@"%@ -rac_buttonClickedSignal", self.rac_description]; 43 | 44 | RACUseDelegateProxy(self); 45 | 46 | return signal; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIBarButtonItem+RACCommandSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIBarButtonItem+RACCommandSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Kyle LeNeau on 3/27/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACCommand; 12 | 13 | @interface UIBarButtonItem (RACCommandSupport) 14 | 15 | /// Sets the control's command. When the control is clicked, the command is 16 | /// executed with the sender of the event. The control's enabledness is bound 17 | /// to the command's `canExecute`. 18 | /// 19 | /// Note: this will reset the control's target and action. 20 | @property (nonatomic, strong) RACCommand *rac_command; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIButton+RACCommandSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+RACCommandSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Ash Furrow on 2013-06-06. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACCommand; 12 | 13 | @interface UIButton (RACCommandSupport) 14 | 15 | /// Sets the button's command. When the button is clicked, the command is 16 | /// executed with the sender of the event. The button's enabledness is bound 17 | /// to the command's `canExecute`. 18 | @property (nonatomic, strong) RACCommand *rac_command; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UICollectionReusableView+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionReusableView+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Kent Wong on 2013-10-04. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | // This category is only applicable to iOS >= 6.0. 14 | @interface UICollectionReusableView (RACSignalSupport) 15 | 16 | /// A signal which will send a RACUnit whenever -prepareForReuse is invoked upon 17 | /// the receiver. 18 | /// 19 | /// Examples 20 | /// 21 | /// [[[self.cancelButton 22 | /// rac_signalForControlEvents:UIControlEventTouchUpInside] 23 | /// takeUntil:self.rac_prepareForReuseSignal] 24 | /// subscribeNext:^(UIButton *x) { 25 | /// // do other things 26 | /// }]; 27 | @property (nonatomic, strong, readonly) RACSignal *rac_prepareForReuseSignal; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UICollectionReusableView+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UICollectionReusableView+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Kent Wong on 2013-10-04. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UICollectionReusableView+RACSignalSupport.h" 10 | #import "NSObject+RACDescription.h" 11 | #import "NSObject+RACSelectorSignal.h" 12 | #import "RACSignal+Operations.h" 13 | #import "RACUnit.h" 14 | #import 15 | 16 | @implementation UICollectionReusableView (RACSignalSupport) 17 | 18 | - (RACSignal *)rac_prepareForReuseSignal { 19 | RACSignal *signal = objc_getAssociatedObject(self, _cmd); 20 | if (signal != nil) return signal; 21 | 22 | signal = [[[self 23 | rac_signalForSelector:@selector(prepareForReuse)] 24 | mapReplace:RACUnit.defaultUnit] 25 | setNameWithFormat:@"%@ -rac_prepareForReuseSignal", self.rac_description]; 26 | 27 | objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return signal; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIControl+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 4/17/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface UIControl (RACSignalSupport) 14 | 15 | /// Creates and returns a signal that sends the sender of the control event 16 | /// whenever one of the control events is triggered. 17 | - (RACSignal *)rac_signalForControlEvents:(UIControlEvents)controlEvents; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIControl+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 4/17/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UIControl+RACSignalSupport.h" 10 | #import "RACEXTScope.h" 11 | #import "RACCompoundDisposable.h" 12 | #import "RACDisposable.h" 13 | #import "RACSignal.h" 14 | #import "RACSubscriber.h" 15 | #import "NSObject+RACDeallocating.h" 16 | #import "NSObject+RACDescription.h" 17 | 18 | @implementation UIControl (RACSignalSupport) 19 | 20 | - (RACSignal *)rac_signalForControlEvents:(UIControlEvents)controlEvents { 21 | @weakify(self); 22 | 23 | return [[RACSignal 24 | createSignal:^(id subscriber) { 25 | @strongify(self); 26 | 27 | [self addTarget:subscriber action:@selector(sendNext:) forControlEvents:controlEvents]; 28 | [self.rac_deallocDisposable addDisposable:[RACDisposable disposableWithBlock:^{ 29 | [subscriber sendCompleted]; 30 | }]]; 31 | 32 | return [RACDisposable disposableWithBlock:^{ 33 | @strongify(self); 34 | [self removeTarget:subscriber action:@selector(sendNext:) forControlEvents:controlEvents]; 35 | }]; 36 | }] 37 | setNameWithFormat:@"%@ -rac_signalForControlEvents: %lx", self.rac_description, (unsigned long)controlEvents]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIControl+RACSignalSupportPrivate.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+RACSignalSupportPrivate.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 06/08/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UIControl (RACSignalSupportPrivate) 14 | 15 | // Adds a RACChannel-based interface to the receiver for the given 16 | // UIControlEvents and exposes it. 17 | // 18 | // controlEvents - A mask of UIControlEvents on which to send new values. 19 | // key - The key whose value should be read and set when a control 20 | // event fires and when a value is sent to the 21 | // RACChannelTerminal respectively. 22 | // nilValue - The value to be assigned to the key when `nil` is sent to the 23 | // RACChannelTerminal. 24 | // 25 | // Returns a RACChannelTerminal which will send future values from the receiver, 26 | // and update the receiver when values are sent to the terminal. 27 | - (RACChannelTerminal *)rac_channelForControlEvents:(UIControlEvents)controlEvents key:(NSString *)key nilValue:(id)nilValue; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIControl+RACSignalSupportPrivate.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIControl+RACSignalSupportPrivate.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 06/08/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UIControl+RACSignalSupportPrivate.h" 10 | #import "NSObject+RACDeallocating.h" 11 | #import "NSObject+RACLifting.h" 12 | #import "RACChannel.h" 13 | #import "RACCompoundDisposable.h" 14 | #import "RACDisposable.h" 15 | #import "RACSignal+Operations.h" 16 | #import "UIControl+RACSignalSupport.h" 17 | 18 | @implementation UIControl (RACSignalSupportPrivate) 19 | 20 | - (RACChannelTerminal *)rac_channelForControlEvents:(UIControlEvents)controlEvents key:(NSString *)key nilValue:(id)nilValue { 21 | NSCParameterAssert(key.length > 0); 22 | key = [key copy]; 23 | RACChannel *channel = [[RACChannel alloc] init]; 24 | 25 | [self.rac_deallocDisposable addDisposable:[RACDisposable disposableWithBlock:^{ 26 | [channel.followingTerminal sendCompleted]; 27 | }]]; 28 | 29 | RACSignal *eventSignal = [[[self 30 | rac_signalForControlEvents:controlEvents] 31 | mapReplace:key] 32 | takeUntil:[[channel.followingTerminal 33 | ignoreValues] 34 | catchTo:RACSignal.empty]]; 35 | [[self 36 | rac_liftSelector:@selector(valueForKey:) withSignals:eventSignal, nil] 37 | subscribe:channel.followingTerminal]; 38 | 39 | RACSignal *valuesSignal = [channel.followingTerminal 40 | map:^(id value) { 41 | return value ?: nilValue; 42 | }]; 43 | [self rac_liftSelector:@selector(setValue:forKey:) withSignals:valuesSignal, [RACSignal return:key], nil]; 44 | 45 | return channel.leadingTerminal; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIDatePicker+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIDatePicker+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UIDatePicker (RACSignalSupport) 14 | 15 | /// Creates a new RACChannel-based binding to the receiver. 16 | /// 17 | /// nilValue - The date to set when the terminal receives `nil`. 18 | /// 19 | /// Returns a RACChannelTerminal that sends the receiver's date whenever the 20 | /// UIControlEventValueChanged control event is fired, and sets the date to the 21 | /// values it receives. 22 | - (RACChannelTerminal *)rac_newDateChannelWithNilValue:(NSDate *)nilValue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIDatePicker+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIDatePicker+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UIDatePicker+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "UIControl+RACSignalSupportPrivate.h" 12 | 13 | @implementation UIDatePicker (RACSignalSupport) 14 | 15 | - (RACChannelTerminal *)rac_newDateChannelWithNilValue:(NSDate *)nilValue { 16 | return [self rac_channelForControlEvents:UIControlEventValueChanged key:@keypath(self.date) nilValue:nilValue]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIGestureRecognizer+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Vera on 5/5/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface UIGestureRecognizer (RACSignalSupport) 14 | 15 | /// Returns a signal that sends the receiver when its gesture occurs. 16 | - (RACSignal *)rac_gestureSignal; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIGestureRecognizer+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIGestureRecognizer+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Vera on 5/5/13. 6 | // Copyright (c) 2013 GitHub. All rights reserved. 7 | // 8 | 9 | #import "UIGestureRecognizer+RACSignalSupport.h" 10 | #import "RACEXTScope.h" 11 | #import "NSObject+RACDeallocating.h" 12 | #import "NSObject+RACDescription.h" 13 | #import "RACCompoundDisposable.h" 14 | #import "RACDisposable.h" 15 | #import "RACSignal.h" 16 | #import "RACSubscriber.h" 17 | 18 | @implementation UIGestureRecognizer (RACSignalSupport) 19 | 20 | - (RACSignal *)rac_gestureSignal { 21 | @weakify(self); 22 | 23 | return [[RACSignal 24 | createSignal:^(id subscriber) { 25 | @strongify(self); 26 | 27 | [self addTarget:subscriber action:@selector(sendNext:)]; 28 | [self.rac_deallocDisposable addDisposable:[RACDisposable disposableWithBlock:^{ 29 | [subscriber sendCompleted]; 30 | }]]; 31 | 32 | return [RACDisposable disposableWithBlock:^{ 33 | @strongify(self); 34 | [self removeTarget:subscriber action:@selector(sendNext:)]; 35 | }]; 36 | }] 37 | setNameWithFormat:@"%@ -rac_gestureSignal", self.rac_description]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIImagePickerController+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImagePickerController+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Timur Kuchkarov on 28.03.14. 6 | // Copyright (c) 2014 GitHub. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACDelegateProxy; 12 | @class RACSignal; 13 | 14 | @interface UIImagePickerController (RACSignalSupport) 15 | 16 | /// A delegate proxy which will be set as the receiver's delegate when any of the 17 | /// methods in this category are used. 18 | @property (nonatomic, strong, readonly) RACDelegateProxy *rac_delegateProxy; 19 | 20 | /// Creates a signal for every new selected image. 21 | /// 22 | /// When this method is invoked, the `rac_delegateProxy` will become the 23 | /// receiver's delegate. Any previous delegate will become the -[RACDelegateProxy 24 | /// rac_proxiedDelegate], so that it receives any messages that the proxy doesn't 25 | /// know how to handle. Setting the receiver's `delegate` afterward is considered 26 | /// undefined behavior. 27 | /// 28 | /// Returns a signal which will send the dictionary with info for the selected image. 29 | /// Caller is responsible for picker controller dismissal. The signal will complete 30 | /// itself when the receiver is deallocated or when user cancels selection. 31 | - (RACSignal *)rac_imageSelectedSignal; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIRefreshControl+RACCommandSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIRefreshControl+RACCommandSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Dave Lee on 2013-10-17. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACCommand; 12 | 13 | @interface UIRefreshControl (RACCommandSupport) 14 | 15 | /// Manipulate the RACCommand property associated with this refresh control. 16 | /// 17 | /// When this refresh control is activated by the user, the command will be 18 | /// executed. Upon completion or error of the execution signal, -endRefreshing 19 | /// will be invoked. 20 | @property (nonatomic, strong) RACCommand *rac_command; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISegmentedControl+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControl+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UISegmentedControl (RACSignalSupport) 14 | 15 | /// Creates a new RACChannel-based binding to the receiver. 16 | /// 17 | /// nilValue - The segment to select when the terminal receives `nil`. 18 | /// 19 | /// Returns a RACChannelTerminal that sends the receiver's currently selected 20 | /// segment's index whenever the UIControlEventValueChanged control event is 21 | /// fired, and sets the selected segment index to the values it receives. 22 | - (RACChannelTerminal *)rac_newSelectedSegmentIndexChannelWithNilValue:(NSNumber *)nilValue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISegmentedControl+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISegmentedControl+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UISegmentedControl+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "UIControl+RACSignalSupportPrivate.h" 12 | 13 | @implementation UISegmentedControl (RACSignalSupport) 14 | 15 | - (RACChannelTerminal *)rac_newSelectedSegmentIndexChannelWithNilValue:(NSNumber *)nilValue { 16 | return [self rac_channelForControlEvents:UIControlEventValueChanged key:@keypath(self.selectedSegmentIndex) nilValue:nilValue]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISlider+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISlider+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UISlider (RACSignalSupport) 14 | 15 | /// Creates a new RACChannel-based binding to the receiver. 16 | /// 17 | /// nilValue - The value to set when the terminal receives `nil`. 18 | /// 19 | /// Returns a RACChannelTerminal that sends the receiver's value whenever the 20 | /// UIControlEventValueChanged control event is fired, and sets the value to the 21 | /// values it receives. 22 | - (RACChannelTerminal *)rac_newValueChannelWithNilValue:(NSNumber *)nilValue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISlider+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISlider+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UISlider+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "UIControl+RACSignalSupportPrivate.h" 12 | 13 | @implementation UISlider (RACSignalSupport) 14 | 15 | - (RACChannelTerminal *)rac_newValueChannelWithNilValue:(NSNumber *)nilValue { 16 | return [self rac_channelForControlEvents:UIControlEventValueChanged key:@keypath(self.value) nilValue:nilValue]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIStepper+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIStepper+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UIStepper (RACSignalSupport) 14 | 15 | /// Creates a new RACChannel-based binding to the receiver. 16 | /// 17 | /// nilValue - The value to set when the terminal receives `nil`. 18 | /// 19 | /// Returns a RACChannelTerminal that sends the receiver's value whenever the 20 | /// UIControlEventValueChanged control event is fired, and sets the value to the 21 | /// values it receives. 22 | - (RACChannelTerminal *)rac_newValueChannelWithNilValue:(NSNumber *)nilValue; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UIStepper+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIStepper+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UIStepper+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "UIControl+RACSignalSupportPrivate.h" 12 | 13 | @implementation UIStepper (RACSignalSupport) 14 | 15 | - (RACChannelTerminal *)rac_newValueChannelWithNilValue:(NSNumber *)nilValue { 16 | return [self rac_channelForControlEvents:UIControlEventValueChanged key:@keypath(self.value) nilValue:nilValue]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISwitch+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UISwitch+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | 13 | @interface UISwitch (RACSignalSupport) 14 | 15 | /// Creates a new RACChannel-based binding to the receiver. 16 | /// 17 | /// Returns a RACChannelTerminal that sends whether the receiver is on whenever 18 | /// the UIControlEventValueChanged control event is fired, and sets it on or off 19 | /// when it receives @YES or @NO respectively. 20 | - (RACChannelTerminal *)rac_newOnChannel; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UISwitch+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UISwitch+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Uri Baghin on 20/07/2013. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UISwitch+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "UIControl+RACSignalSupportPrivate.h" 12 | 13 | @implementation UISwitch (RACSignalSupport) 14 | 15 | - (RACChannelTerminal *)rac_newOnChannel { 16 | return [self rac_channelForControlEvents:UIControlEventValueChanged key:@keypath(self.on) nilValue:@NO]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITableViewCell+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-07-22. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | @interface UITableViewCell (RACSignalSupport) 14 | 15 | /// A signal which will send a RACUnit whenever -prepareForReuse is invoked upon 16 | /// the receiver. 17 | /// 18 | /// Examples 19 | /// 20 | /// [[[self.cancelButton 21 | /// rac_signalForControlEvents:UIControlEventTouchUpInside] 22 | /// takeUntil:self.rac_prepareForReuseSignal] 23 | /// subscribeNext:^(UIButton *x) { 24 | /// // do other things 25 | /// }]; 26 | @property (nonatomic, strong, readonly) RACSignal *rac_prepareForReuseSignal; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITableViewCell+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewCell+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Justin Spahr-Summers on 2013-07-22. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UITableViewCell+RACSignalSupport.h" 10 | #import "NSObject+RACDescription.h" 11 | #import "NSObject+RACSelectorSignal.h" 12 | #import "RACSignal+Operations.h" 13 | #import "RACUnit.h" 14 | #import 15 | 16 | @implementation UITableViewCell (RACSignalSupport) 17 | 18 | - (RACSignal *)rac_prepareForReuseSignal { 19 | RACSignal *signal = objc_getAssociatedObject(self, _cmd); 20 | if (signal != nil) return signal; 21 | 22 | signal = [[[self 23 | rac_signalForSelector:@selector(prepareForReuse)] 24 | mapReplace:RACUnit.defaultUnit] 25 | setNameWithFormat:@"%@ -rac_prepareForReuseSignal", self.rac_description]; 26 | 27 | objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return signal; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITableViewHeaderFooterView+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewHeaderFooterView+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Syo Ikeda on 12/30/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACSignal; 12 | 13 | // This category is only applicable to iOS >= 6.0. 14 | @interface UITableViewHeaderFooterView (RACSignalSupport) 15 | 16 | /// A signal which will send a RACUnit whenever -prepareForReuse is invoked upon 17 | /// the receiver. 18 | /// 19 | /// Examples 20 | /// 21 | /// [[[self.cancelButton 22 | /// rac_signalForControlEvents:UIControlEventTouchUpInside] 23 | /// takeUntil:self.rac_prepareForReuseSignal] 24 | /// subscribeNext:^(UIButton *x) { 25 | /// // do other things 26 | /// }]; 27 | @property (nonatomic, strong, readonly) RACSignal *rac_prepareForReuseSignal; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITableViewHeaderFooterView+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITableViewHeaderFooterView+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Syo Ikeda on 12/30/13. 6 | // Copyright (c) 2013 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UITableViewHeaderFooterView+RACSignalSupport.h" 10 | #import "NSObject+RACDescription.h" 11 | #import "NSObject+RACSelectorSignal.h" 12 | #import "RACSignal+Operations.h" 13 | #import "RACUnit.h" 14 | #import 15 | 16 | @implementation UITableViewHeaderFooterView (RACSignalSupport) 17 | 18 | - (RACSignal *)rac_prepareForReuseSignal { 19 | RACSignal *signal = objc_getAssociatedObject(self, _cmd); 20 | if (signal != nil) return signal; 21 | 22 | signal = [[[self 23 | rac_signalForSelector:@selector(prepareForReuse)] 24 | mapReplace:RACUnit.defaultUnit] 25 | setNameWithFormat:@"%@ -rac_prepareForReuseSignal", self.rac_description]; 26 | 27 | objc_setAssociatedObject(self, _cmd, signal, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return signal; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITextField+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 4/17/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACChannelTerminal; 12 | @class RACSignal; 13 | 14 | @interface UITextField (RACSignalSupport) 15 | 16 | /// Creates and returns a signal for the text of the field. It always starts with 17 | /// the current text. The signal sends next when the UIControlEventAllEditingEvents 18 | /// control event is fired on the control. 19 | - (RACSignal *)rac_textSignal; 20 | 21 | /// Creates a new RACChannel-based binding to the receiver. 22 | /// 23 | /// Returns a RACChannelTerminal that sends the receiver's text whenever the 24 | /// UIControlEventAllEditingEvents control event is fired, and sets the text 25 | /// to the values it receives. 26 | - (RACChannelTerminal *)rac_newTextChannel; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITextField+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Josh Abernathy on 4/17/12. 6 | // Copyright (c) 2012 GitHub, Inc. All rights reserved. 7 | // 8 | 9 | #import "UITextField+RACSignalSupport.h" 10 | #import "RACEXTKeyPathCoding.h" 11 | #import "RACEXTScope.h" 12 | #import "NSObject+RACDeallocating.h" 13 | #import "NSObject+RACDescription.h" 14 | #import "RACSignal+Operations.h" 15 | #import "UIControl+RACSignalSupport.h" 16 | #import "UIControl+RACSignalSupportPrivate.h" 17 | 18 | @implementation UITextField (RACSignalSupport) 19 | 20 | - (RACSignal *)rac_textSignal { 21 | @weakify(self); 22 | return [[[[[RACSignal 23 | defer:^{ 24 | @strongify(self); 25 | return [RACSignal return:self]; 26 | }] 27 | concat:[self rac_signalForControlEvents:UIControlEventAllEditingEvents]] 28 | map:^(UITextField *x) { 29 | return x.text; 30 | }] 31 | takeUntil:self.rac_willDeallocSignal] 32 | setNameWithFormat:@"%@ -rac_textSignal", self.rac_description]; 33 | } 34 | 35 | - (RACChannelTerminal *)rac_newTextChannel { 36 | return [self rac_channelForControlEvents:UIControlEventAllEditingEvents key:@keypath(self.text) nilValue:@""]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITextView+RACSignalSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextView+RACSignalSupport.h 3 | // ReactiveCocoa 4 | // 5 | // Created by Cody Krieger on 5/18/12. 6 | // Copyright (c) 2012 Cody Krieger. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class RACDelegateProxy; 12 | @class RACSignal; 13 | 14 | @interface UITextView (RACSignalSupport) 15 | 16 | /// A delegate proxy which will be set as the receiver's delegate when any of the 17 | /// methods in this category are used. 18 | @property (nonatomic, strong, readonly) RACDelegateProxy *rac_delegateProxy; 19 | 20 | /// Creates a signal for the text of the receiver. 21 | /// 22 | /// When this method is invoked, the `rac_delegateProxy` will become the 23 | /// receiver's delegate. Any previous delegate will become the -[RACDelegateProxy 24 | /// rac_proxiedDelegate], so that it receives any messages that the proxy doesn't 25 | /// know how to handle. Setting the receiver's `delegate` afterward is 26 | /// considered undefined behavior. 27 | /// 28 | /// Returns a signal which will send the current text upon subscription, then 29 | /// again whenever the receiver's text is changed. The signal will complete when 30 | /// the receiver is deallocated. 31 | - (RACSignal *)rac_textSignal; 32 | 33 | @end 34 | 35 | @interface UITextView (RACSignalSupportUnavailable) 36 | 37 | - (RACSignal *)rac_signalForDelegateMethod:(SEL)method __attribute__((unavailable("Use -rac_signalForSelector:fromProtocol: instead"))); 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /CodeExamples/Pods/ReactiveCocoa/ReactiveCocoa/UITextView+RACSignalSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextView+RACSignalSupport.m 3 | // ReactiveCocoa 4 | // 5 | // Created by Cody Krieger on 5/18/12. 6 | // Copyright (c) 2012 Cody Krieger. All rights reserved. 7 | // 8 | 9 | #import "UITextView+RACSignalSupport.h" 10 | #import "RACEXTScope.h" 11 | #import "NSObject+RACDeallocating.h" 12 | #import "NSObject+RACDescription.h" 13 | #import "RACDelegateProxy.h" 14 | #import "RACSignal+Operations.h" 15 | #import "RACTuple.h" 16 | #import 17 | 18 | @implementation UITextView (RACSignalSupport) 19 | 20 | static void RACUseDelegateProxy(UITextView *self) { 21 | if (self.delegate == self.rac_delegateProxy) return; 22 | 23 | self.rac_delegateProxy.rac_proxiedDelegate = self.delegate; 24 | self.delegate = (id)self.rac_delegateProxy; 25 | } 26 | 27 | - (RACDelegateProxy *)rac_delegateProxy { 28 | RACDelegateProxy *proxy = objc_getAssociatedObject(self, _cmd); 29 | if (proxy == nil) { 30 | proxy = [[RACDelegateProxy alloc] initWithProtocol:@protocol(UITextViewDelegate)]; 31 | objc_setAssociatedObject(self, _cmd, proxy, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 32 | } 33 | 34 | return proxy; 35 | } 36 | 37 | - (RACSignal *)rac_textSignal { 38 | @weakify(self); 39 | RACSignal *signal = [[[[[RACSignal 40 | defer:^{ 41 | @strongify(self); 42 | return [RACSignal return:RACTuplePack(self)]; 43 | }] 44 | concat:[self.rac_delegateProxy signalForSelector:@selector(textViewDidChange:)]] 45 | reduceEach:^(UITextView *x) { 46 | return x.text; 47 | }] 48 | takeUntil:self.rac_willDeallocSignal] 49 | setNameWithFormat:@"%@ -rac_textSignal", self.rac_description]; 50 | 51 | RACUseDelegateProxy(self); 52 | 53 | return signal; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com 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 furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | 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. 20 | 21 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSData (ImageContentType) 9 | 10 | /** 11 | * Compute the content type for an image data 12 | * 13 | * @param data the input data 14 | * 15 | * @return the content type as string (i.e. image/jpeg, image/gif) 16 | */ 17 | + (NSString *)sd_contentTypeForImageData:(NSData *)data; 18 | 19 | @end 20 | 21 | 22 | @interface NSData (ImageContentTypeDeprecated) 23 | 24 | + (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import "NSData+ImageContentType.h" 7 | 8 | 9 | @implementation NSData (ImageContentType) 10 | 11 | + (NSString *)sd_contentTypeForImageData:(NSData *)data { 12 | uint8_t c; 13 | [data getBytes:&c length:1]; 14 | switch (c) { 15 | case 0xFF: 16 | return @"image/jpeg"; 17 | case 0x89: 18 | return @"image/png"; 19 | case 0x47: 20 | return @"image/gif"; 21 | case 0x49: 22 | case 0x4D: 23 | return @"image/tiff"; 24 | case 0x52: 25 | // R as RIFF for WEBP 26 | if ([data length] < 12) { 27 | return nil; 28 | } 29 | 30 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 31 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 32 | return @"image/webp"; 33 | } 34 | 35 | return nil; 36 | } 37 | return nil; 38 | } 39 | 40 | @end 41 | 42 | 43 | @implementation NSData (ImageContentTypeDeprecated) 44 | 45 | + (NSString *)contentTypeForImageData:(NSData *)data { 46 | return [self sd_contentTypeForImageData:data]; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ForceDecode) 15 | 16 | + (UIImage *)decodedImageWithImage:(UIImage *)image; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.h 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GIF) 12 | 13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name; 14 | 15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 16 | 17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (MultiFormat) 12 | 13 | + (UIImage *)sd_imageWithData:(NSData *)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /CodeExamples/Pods/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @interface UIView (WebCacheOperation) 13 | 14 | /** 15 | * Set the image load operation (storage in a UIView based dictionary) 16 | * 17 | * @param operation the operation 18 | * @param key key for storing the operation 19 | */ 20 | - (void)sd_setImageLoadOperation:(id)operation forKey:(NSString *)key; 21 | 22 | /** 23 | * Cancel all operations for the current UIView and key 24 | * 25 | * @param key key for identifying the operations 26 | */ 27 | - (void)sd_cancelImageLoadOperationWithKey:(NSString *)key; 28 | 29 | /** 30 | * Just remove the operations corresponding to the current UIView and key without cancelling them 31 | * 32 | * @param key key for identifying the operations 33 | */ 34 | - (void)sd_removeImageLoadOperationWithKey:(NSString *)key; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/BlocksKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_BlocksKit : NSObject 3 | @end 4 | @implementation PodsDummy_BlocksKit 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/BlocksKit-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/BlocksKit-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "BlocksKit.h" 6 | #import "BKMacros.h" 7 | #import "NSArray+BlocksKit.h" 8 | #import "NSDictionary+BlocksKit.h" 9 | #import "NSIndexSet+BlocksKit.h" 10 | #import "NSInvocation+BlocksKit.h" 11 | #import "NSMutableArray+BlocksKit.h" 12 | #import "NSMutableDictionary+BlocksKit.h" 13 | #import "NSMutableIndexSet+BlocksKit.h" 14 | #import "NSMutableOrderedSet+BlocksKit.h" 15 | #import "NSMutableSet+BlocksKit.h" 16 | #import "NSObject+BKAssociatedObjects.h" 17 | #import "NSObject+BKBlockExecution.h" 18 | #import "NSObject+BKBlockObservation.h" 19 | #import "NSOrderedSet+BlocksKit.h" 20 | #import "NSSet+BlocksKit.h" 21 | #import "NSTimer+BlocksKit.h" 22 | #import "A2BlockInvocation.h" 23 | #import "A2DynamicDelegate.h" 24 | #import "NSObject+A2BlockDelegate.h" 25 | #import "NSObject+A2DynamicDelegate.h" 26 | #import "NSCache+BlocksKit.h" 27 | #import "NSURLConnection+BlocksKit.h" 28 | #import "BlocksKit+MessageUI.h" 29 | #import "MFMailComposeViewController+BlocksKit.h" 30 | #import "MFMessageComposeViewController+BlocksKit.h" 31 | #import "BlocksKit+UIKit.h" 32 | #import "UIActionSheet+BlocksKit.h" 33 | #import "UIAlertView+BlocksKit.h" 34 | #import "UIBarButtonItem+BlocksKit.h" 35 | #import "UIControl+BlocksKit.h" 36 | #import "UIGestureRecognizer+BlocksKit.h" 37 | #import "UIImagePickerController+BlocksKit.h" 38 | #import "UIPopoverController+BlocksKit.h" 39 | #import "UITextField+BlocksKit.h" 40 | #import "UIView+BlocksKit.h" 41 | #import "UIWebView+BlocksKit.h" 42 | 43 | FOUNDATION_EXPORT double BlocksKitVersionNumber; 44 | FOUNDATION_EXPORT const unsigned char BlocksKitVersionString[]; 45 | 46 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/BlocksKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module BlocksKit { 2 | umbrella header "BlocksKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/BlocksKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/BlocksKit 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_LDFLAGS = -framework "MessageUI" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/BlocksKit/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 | 2.2.5 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeExamples/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.0.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Masonry/Masonry-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Masonry/Masonry-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "MASCompositeConstraint.h" 6 | #import "MASConstraint+Private.h" 7 | #import "MASConstraint.h" 8 | #import "MASConstraintMaker.h" 9 | #import "MASLayoutConstraint.h" 10 | #import "Masonry.h" 11 | #import "MASUtilities.h" 12 | #import "MASViewAttribute.h" 13 | #import "MASViewConstraint.h" 14 | #import "NSArray+MASAdditions.h" 15 | #import "NSArray+MASShorthandAdditions.h" 16 | #import "NSLayoutConstraint+MASDebugAdditions.h" 17 | #import "View+MASAdditions.h" 18 | #import "View+MASShorthandAdditions.h" 19 | #import "ViewController+MASAdditions.h" 20 | 21 | FOUNDATION_EXPORT double MasonryVersionNumber; 22 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 23 | 24 | -------------------------------------------------------------------------------- /CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/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 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/Pods-CodeExamples-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CodeExamples : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CodeExamples 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/Pods-CodeExamples-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | 6 | FOUNDATION_EXPORT double Pods_CodeExamplesVersionNumber; 7 | FOUNDATION_EXPORT const unsigned char Pods_CodeExamplesVersionString[]; 8 | 9 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/Pods-CodeExamples.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/BlocksKit" "$PODS_CONFIGURATION_BUILD_DIR/Masonry" "$PODS_CONFIGURATION_BUILD_DIR/ReactiveCocoa" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/BlocksKit/BlocksKit.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Masonry/Masonry.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/ReactiveCocoa/ReactiveCocoa.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "BlocksKit" -framework "Masonry" -framework "ReactiveCocoa" -framework "SDWebImage" -framework "UITableView_FDTemplateLayoutCell" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/Pods-CodeExamples.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_CodeExamples { 2 | umbrella header "Pods-CodeExamples-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/Pods-CodeExamples/Pods-CodeExamples.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/BlocksKit" "$PODS_CONFIGURATION_BUILD_DIR/Masonry" "$PODS_CONFIGURATION_BUILD_DIR/ReactiveCocoa" "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage" "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/BlocksKit/BlocksKit.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Masonry/Masonry.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/ReactiveCocoa/ReactiveCocoa.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDWebImage/SDWebImage.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "BlocksKit" -framework "Masonry" -framework "ReactiveCocoa" -framework "SDWebImage" -framework "UITableView_FDTemplateLayoutCell" 7 | PODS_BUILD_DIR = $BUILD_DIR 8 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/ReactiveCocoa/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 | 2.5.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/ReactiveCocoa/ReactiveCocoa-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_ReactiveCocoa : NSObject 3 | @end 4 | @implementation PodsDummy_ReactiveCocoa 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/ReactiveCocoa/ReactiveCocoa-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/ReactiveCocoa/ReactiveCocoa.modulemap: -------------------------------------------------------------------------------- 1 | framework module ReactiveCocoa { 2 | umbrella header "ReactiveCocoa-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/ReactiveCocoa/ReactiveCocoa.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/ReactiveCocoa 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/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 | 3.8.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SDWebImage : NSObject 3 | @end 4 | @implementation PodsDummy_SDWebImage 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "NSData+ImageContentType.h" 6 | #import "SDImageCache.h" 7 | #import "SDWebImageCompat.h" 8 | #import "SDWebImageDecoder.h" 9 | #import "SDWebImageDownloader.h" 10 | #import "SDWebImageDownloaderOperation.h" 11 | #import "SDWebImageManager.h" 12 | #import "SDWebImageOperation.h" 13 | #import "SDWebImagePrefetcher.h" 14 | #import "UIButton+WebCache.h" 15 | #import "UIImage+GIF.h" 16 | #import "UIImage+MultiFormat.h" 17 | #import "UIImageView+HighlightedWebCache.h" 18 | #import "UIImageView+WebCache.h" 19 | #import "UIView+WebCacheOperation.h" 20 | 21 | FOUNDATION_EXPORT double SDWebImageVersionNumber; 22 | FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; 23 | 24 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap: -------------------------------------------------------------------------------- 1 | framework module SDWebImage { 2 | umbrella header "SDWebImage-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/SDWebImage/SDWebImage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SDWebImage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | OTHER_LDFLAGS = -framework "ImageIO" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/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.5.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_UITableView_FDTemplateLayoutCell : NSObject 3 | @end 4 | @implementation PodsDummy_UITableView_FDTemplateLayoutCell 5 | @end 6 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "UITableView+FDIndexPathHeightCache.h" 6 | #import "UITableView+FDKeyedHeightCache.h" 7 | #import "UITableView+FDTemplateLayoutCell.h" 8 | #import "UITableView+FDTemplateLayoutCellDebug.h" 9 | 10 | FOUNDATION_EXPORT double UITableView_FDTemplateLayoutCellVersionNumber; 11 | FOUNDATION_EXPORT const unsigned char UITableView_FDTemplateLayoutCellVersionString[]; 12 | 13 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.modulemap: -------------------------------------------------------------------------------- 1 | framework module UITableView_FDTemplateLayoutCell { 2 | umbrella header "UITableView+FDTemplateLayoutCell-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /CodeExamples/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/UITableView+FDTemplateLayoutCell 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | -------------------------------------------------------------------------------- /CodeExamples/Pods/UITableView+FDTemplateLayoutCell/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CodeExamples 2 | masonry,FDTemplateLayoutCell,RAC示例集合, masonry等间距,适应父View,多图片展示,比九宫格更加节省性能。 FDTemplateLayoutCell 简易版朋友圈 自动应动态cell,一句代码搞定,rac的常规使用。 3 | --------------------------------------------------------------------------------