From 4b0a70ba5bc676f72505caea65b840391b89efff Mon Sep 17 00:00:00 2001 From: Mohamed Afifi Date: Fri, 26 Jan 2024 21:02:22 -0500 Subject: [PATCH] Migrate Translation Content to SwiftUI --- .github/workflows/ci.yml | 2 +- .../xcschemes/AnnotationsService.xcscheme | 2 +- .../xcschemes/AppStructureFeature.xcscheme | 2 +- .../xcschemes/BatchDownloader.xcscheme | 2 +- .../xcschemes/BookmarksFeature.xcscheme | 2 +- .../xcshareddata/xcschemes/Caching.xcscheme | 2 +- .../xcshareddata/xcschemes/Crashing.xcscheme | 2 +- .../xcschemes/HomeFeature.xcscheme | 2 +- .../xcschemes/LastPagePersistence.xcscheme | 2 +- .../xcschemes/Localization.xcscheme | 2 +- .../xcshareddata/xcschemes/NoorUI.xcscheme | 2 +- .../xcschemes/NotePersistence.xcscheme | 2 +- .../xcschemes/NotesFeature.xcscheme | 2 +- .../PageBookmarkPersistence.xcscheme | 2 +- .../xcschemes/Preferences.xcscheme | 2 +- .../xcschemes/QuranAudioKit.xcscheme | 2 +- .../xcschemes/QuranEngine-Package.xcscheme | 2 +- .../xcshareddata/xcschemes/QuranKit.xcscheme | 2 +- .../xcschemes/QuranPagesFeature.xcscheme | 2 +- .../xcschemes/QuranTextKit.xcscheme | 2 +- .../xcschemes/QuranTextKitTests.xcscheme | 2 +- .../QuranTranslationFeature.xcscheme | 2 +- .../xcschemes/ReadingSelectorFeature.xcscheme | 2 +- .../xcschemes/ReadingService.xcscheme | 2 +- .../xcschemes/ReciterListFeature.xcscheme | 2 +- .../xcschemes/SearchFeature.xcscheme | 2 +- .../xcschemes/SettingsFeature.xcscheme | 2 +- .../xcschemes/SystemDependencies.xcscheme | 2 +- .../xcschemes/SystemDependenciesFake.xcscheme | 2 +- .../xcshareddata/xcschemes/Timing.xcscheme | 2 +- .../xcschemes/TranslationService.xcscheme | 2 +- .../xcschemes/TranslationsFeature.xcscheme | 2 +- .../xcode/xcshareddata/xcschemes/UIx.xcscheme | 2 +- .../xcshareddata/xcschemes/Utilities.xcscheme | 2 +- .../xcschemes/UtilitiesTests.xcscheme | 2 +- .../xcshareddata/xcschemes/VLogging.xcscheme | 2 +- .../xcschemes/VersionUpdater.xcscheme | 2 +- .../Resources/en.lproj/Localizable.strings | 3 + .../Sources/Extensions/String+Chunking.swift | 6 +- Core/Utilities/Sources/Features/Pair.swift | 21 + Core/VLogging/Logger.swift | 2 +- .../Sources/NoteService.swift | 3 +- .../QuranTextDataService.swift | 13 +- .../Tests/QuranTextDataServiceTests.swift | 10 +- .../ShareableVerseTextRetrieverTests.swift | 2 +- .../SelectedTranslationsPreferences.swift | 28 +- .../Sources/TranslationsRepository.swift | 2 +- .../Sources/TranslationsVersionUpdater.swift | 4 +- ...SelectedTranslationsPreferencesTests.swift | 6 +- .../Tests/TranslationDeleterTests.swift | 12 +- .../LocalTranslationsFake.swift | 2 +- Example/Pods/Manifest.lock | 56 - Example/Pods/PINCache/LICENSE.txt | 201 - Example/Pods/PINCache/README.md | 98 - Example/Pods/PINCache/Source/PINCache.h | 164 - Example/Pods/PINCache/Source/PINCache.m | 420 -- Example/Pods/PINCache/Source/PINCacheMacros.h | 23 - .../Source/PINCacheObjectSubscripting.h | 35 - Example/Pods/PINCache/Source/PINCaching.h | 264 -- Example/Pods/PINCache/Source/PINDiskCache.h | 592 --- Example/Pods/PINCache/Source/PINDiskCache.m | 1727 -------- Example/Pods/PINCache/Source/PINMemoryCache.h | 245 -- Example/Pods/PINCache/Source/PINMemoryCache.m | 932 ---- Example/Pods/PINOperation/LICENSE.txt | 176 - Example/Pods/PINOperation/README.md | 47 - .../Pods/PINOperation/Source/PINOperation.h | 12 - .../PINOperation/Source/PINOperationGroup.h | 38 - .../PINOperation/Source/PINOperationGroup.m | 187 - .../PINOperation/Source/PINOperationMacros.h | 15 - .../PINOperation/Source/PINOperationQueue.h | 141 - .../PINOperation/Source/PINOperationQueue.m | 471 -- .../PINOperation/Source/PINOperationTypes.h | 15 - Example/Pods/PINRemoteImage/LICENSE | 176 - Example/Pods/PINRemoteImage/README.md | 252 -- .../Classes/AnimatedImages/PINAnimatedImage.m | 126 - .../AnimatedImages/PINAnimatedImageView.m | 443 -- .../AnimatedImages/PINCachedAnimatedImage.m | 528 --- .../AnimatedImages/PINGIFAnimatedImage.m | 166 - .../AnimatedImages/PINWebPAnimatedImage.m | 403 -- .../Categories/NSData+ImageDetectors.m | 139 - .../Categories/NSHTTPURLResponse+MaxAge.h | 14 - .../Categories/NSHTTPURLResponse+MaxAge.m | 71 - .../Categories/PINImage+DecodedImage.h | 44 - .../Categories/PINImage+DecodedImage.m | 325 -- .../Classes/Categories/PINImage+ScaledImage.h | 24 - .../Classes/Categories/PINImage+ScaledImage.m | 56 - .../Source/Classes/Categories/PINImage+WebP.h | 25 - .../Source/Classes/Categories/PINImage+WebP.m | 87 - .../PINRemoteImageTask+Subclassing.h | 20 - .../PINAnimatedImageView+PINRemoteImage.m | 119 - .../PINButton+PINRemoteImage.m | 131 - .../PINImageView+PINRemoteImage.m | 127 - .../PINAlternateRepresentationProvider.m | 30 - .../PINCache/PINCache+PINRemoteImageCaching.m | 113 - .../Source/Classes/PINDisplayLink.h | 25 - .../Source/Classes/PINDisplayLink.m | 133 - .../Source/Classes/PINProgressiveImage.m | 464 -- .../Source/Classes/PINRemoteImageBasicCache.h | 19 - .../Source/Classes/PINRemoteImageBasicCache.m | 99 - .../Source/Classes/PINRemoteImageCallbacks.h | 20 - .../Source/Classes/PINRemoteImageCallbacks.m | 21 - .../Classes/PINRemoteImageCategoryManager.m | 268 -- .../Classes/PINRemoteImageDownloadQueue.h | 47 - .../Classes/PINRemoteImageDownloadQueue.m | 177 - .../Classes/PINRemoteImageDownloadTask.h | 37 - .../Classes/PINRemoteImageDownloadTask.m | 380 -- .../Classes/PINRemoteImageManager+Private.h | 30 - .../Source/Classes/PINRemoteImageManager.m | 1651 ------- .../PINRemoteImageManagerConfiguration.h | 46 - .../PINRemoteImageManagerConfiguration.m | 36 - .../Classes/PINRemoteImageManagerResult.m | 118 - .../Classes/PINRemoteImageMemoryContainer.h | 22 - .../Classes/PINRemoteImageMemoryContainer.m | 21 - .../Classes/PINRemoteImageProcessorTask.h | 15 - .../Classes/PINRemoteImageProcessorTask.m | 44 - .../Source/Classes/PINRemoteImageTask.h | 65 - .../Source/Classes/PINRemoteImageTask.m | 160 - .../Source/Classes/PINRemoteLock.h | 28 - .../Source/Classes/PINRemoteLock.m | 112 - .../Source/Classes/PINRemoteWeakProxy.h | 16 - .../Source/Classes/PINRemoteWeakProxy.m | 59 - .../Source/Classes/PINRequestRetryStrategy.m | 69 - .../PINRemoteImage/Source/Classes/PINResume.h | 24 - .../PINRemoteImage/Source/Classes/PINResume.m | 51 - .../Source/Classes/PINSpeedRecorder.h | 51 - .../Source/Classes/PINSpeedRecorder.m | 265 -- .../Source/Classes/PINURLSessionManager.m | 263 -- .../Classes/include/NSData+ImageDetectors.h | 22 - .../PINAlternateRepresentationProvider.h | 25 - .../Source/Classes/include/PINAnimatedImage.h | 165 - .../PINAnimatedImageView+PINRemoteImage.h | 14 - .../Classes/include/PINAnimatedImageView.h | 28 - .../include/PINButton+PINRemoteImage.h | 22 - .../include/PINCache+PINRemoteImageCaching.h | 26 - .../Classes/include/PINCachedAnimatedImage.h | 83 - .../Classes/include/PINGIFAnimatedImage.h | 18 - .../include/PINImageView+PINRemoteImage.h | 22 - .../Classes/include/PINProgressiveImage.h | 52 - .../Source/Classes/include/PINRemoteImage.h | 25 - .../Classes/include/PINRemoteImageCaching.h | 52 - .../include/PINRemoteImageCategoryManager.h | 230 - .../Classes/include/PINRemoteImageMacros.h | 70 - .../Classes/include/PINRemoteImageManager.h | 703 --- .../include/PINRemoteImageManagerResult.h | 71 - .../Classes/include/PINRequestRetryStrategy.h | 28 - .../Classes/include/PINURLSessionManager.h | 51 - .../Classes/include/PINWebPAnimatedImage.h | 19 - Example/Pods/Pods.xcodeproj/project.pbxproj | 3219 -------------- .../PINCache/PINCache-Info.plist | 26 - .../PINCache/PINCache-dummy.m | 5 - .../PINCache/PINCache-prefix.pch | 15 - .../PINCache/PINCache-umbrella.h | 22 - .../PINCache/PINCache.debug.xcconfig | 14 - .../PINCache/PINCache.modulemap | 6 - .../PINCache/PINCache.release.xcconfig | 14 - .../PINOperation/PINOperation-Info.plist | 26 - .../PINOperation/PINOperation-dummy.m | 5 - .../PINOperation/PINOperation-prefix.pch | 15 - .../PINOperation/PINOperation-umbrella.h | 21 - .../PINOperation/PINOperation.debug.xcconfig | 13 - .../PINOperation/PINOperation.modulemap | 6 - .../PINOperation.release.xcconfig | 13 - .../PINRemoteImage/PINRemoteImage-Info.plist | 26 - .../PINRemoteImage/PINRemoteImage-dummy.m | 5 - .../PINRemoteImage/PINRemoteImage-umbrella.h | 55 - .../PINRemoteImage.debug.xcconfig | 14 - .../PINRemoteImage/PINRemoteImage.modulemap | 6 - .../PINRemoteImage.release.xcconfig | 14 - .../Pods-QuranEngineApp-Info.plist | 26 - ...s-QuranEngineApp-acknowledgements.markdown | 753 ---- ...Pods-QuranEngineApp-acknowledgements.plist | 803 ---- .../Pods-QuranEngineApp-dummy.m | 5 - ...pp-frameworks-Debug-input-files.xcfilelist | 5 - ...p-frameworks-Debug-output-files.xcfilelist | 4 - ...-frameworks-Release-input-files.xcfilelist | 5 - ...frameworks-Release-output-files.xcfilelist | 4 - .../Pods-QuranEngineApp-frameworks.sh | 192 - .../Pods-QuranEngineApp-umbrella.h | 16 - .../Pods-QuranEngineApp.debug.xcconfig | 13 - .../Pods-QuranEngineApp.modulemap | 6 - .../Pods-QuranEngineApp.release.xcconfig | 13 - .../Texture/Texture-Info.plist | 26 - .../Texture/Texture-dummy.m | 5 - .../Texture/Texture-prefix.pch | 12 - .../Texture/Texture-umbrella.h | 174 - .../Texture/Texture.debug.xcconfig | 16 - .../Texture/Texture.modulemap | 6 - .../Texture/Texture.release.xcconfig | 16 - Example/Pods/Texture/LICENSE | 181 - Example/Pods/Texture/README.md | 51 - Example/Pods/Texture/Source/ASBlockTypes.h | 20 - .../Texture/Source/ASButtonNode+Private.h | 45 - .../Pods/Texture/Source/ASButtonNode+Yoga.h | 20 - .../Pods/Texture/Source/ASButtonNode+Yoga.mm | 105 - Example/Pods/Texture/Source/ASButtonNode.h | 130 - Example/Pods/Texture/Source/ASButtonNode.mm | 575 --- Example/Pods/Texture/Source/ASCellNode.h | 259 -- Example/Pods/Texture/Source/ASCellNode.mm | 489 --- .../Texture/Source/ASCollectionNode+Beta.h | 79 - .../Pods/Texture/Source/ASCollectionNode.h | 956 ----- .../Pods/Texture/Source/ASCollectionNode.mm | 1236 ------ .../Pods/Texture/Source/ASCollectionView.h | 492 --- .../Pods/Texture/Source/ASCollectionView.mm | 2554 ----------- ...SCollectionViewLayoutFacilitatorProtocol.h | 44 - .../Source/ASCollectionViewProtocols.h | 107 - Example/Pods/Texture/Source/ASCollections.h | 38 - Example/Pods/Texture/Source/ASCollections.mm | 61 - Example/Pods/Texture/Source/ASConfiguration.h | 58 - .../Pods/Texture/Source/ASConfiguration.mm | 63 - .../Texture/Source/ASConfigurationDelegate.h | 37 - .../Texture/Source/ASConfigurationInternal.h | 57 - .../Texture/Source/ASConfigurationInternal.mm | 110 - .../Texture/Source/ASContextTransitioning.h | 72 - .../Texture/Source/ASControlNode+Subclasses.h | 68 - Example/Pods/Texture/Source/ASControlNode.h | 149 - Example/Pods/Texture/Source/ASControlNode.mm | 516 --- .../Texture/Source/ASDKNavigationController.h | 30 - .../Source/ASDKNavigationController.mm | 113 - .../Pods/Texture/Source/ASDKViewController.h | 101 - .../Pods/Texture/Source/ASDKViewController.mm | 358 -- .../Pods/Texture/Source/ASDisplayNode+Beta.h | 171 - .../Source/ASDisplayNode+Convenience.h | 28 - .../Source/ASDisplayNode+Convenience.mm | 38 - .../Source/ASDisplayNode+InterfaceState.h | 148 - .../Texture/Source/ASDisplayNode+Layout.mm | 1098 ----- .../Texture/Source/ASDisplayNode+LayoutSpec.h | 66 - .../Source/ASDisplayNode+LayoutSpec.mm | 162 - .../Texture/Source/ASDisplayNode+Subclasses.h | 502 --- .../Pods/Texture/Source/ASDisplayNode+Yoga.h | 103 - .../Pods/Texture/Source/ASDisplayNode+Yoga.mm | 489 --- Example/Pods/Texture/Source/ASDisplayNode.h | 995 ----- Example/Pods/Texture/Source/ASDisplayNode.mm | 3789 ----------------- .../Pods/Texture/Source/ASDisplayNodeExtras.h | 213 - .../Texture/Source/ASDisplayNodeExtras.mm | 337 -- .../Pods/Texture/Source/ASEditableTextNode.h | 203 - .../Pods/Texture/Source/ASEditableTextNode.mm | 880 ---- .../Texture/Source/ASExperimentalFeatures.h | 43 - .../Texture/Source/ASExperimentalFeatures.mm | 52 - .../Source/ASImageNode+AnimatedImage.mm | 400 -- Example/Pods/Texture/Source/ASImageNode.h | 212 - Example/Pods/Texture/Source/ASImageNode.mm | 837 ---- Example/Pods/Texture/Source/ASLocking.h | 158 - .../Texture/Source/ASMainThreadDeallocation.h | 56 - .../Source/ASMainThreadDeallocation.mm | 202 - Example/Pods/Texture/Source/ASMapNode.h | 92 - Example/Pods/Texture/Source/ASMapNode.mm | 440 -- .../Texture/Source/ASMultiplexImageNode.h | 288 -- .../Texture/Source/ASMultiplexImageNode.mm | 943 ---- .../Texture/Source/ASNetworkImageLoadInfo.h | 39 - .../Texture/Source/ASNetworkImageLoadInfo.mm | 31 - .../Pods/Texture/Source/ASNetworkImageNode.h | 259 -- .../Pods/Texture/Source/ASNetworkImageNode.mm | 947 ---- .../Texture/Source/ASNodeController+Beta.h | 62 - .../Texture/Source/ASNodeController+Beta.mm | 136 - .../Pods/Texture/Source/ASPagerFlowLayout.h | 18 - .../Pods/Texture/Source/ASPagerFlowLayout.mm | 110 - .../Pods/Texture/Source/ASPagerNode+Beta.h | 15 - Example/Pods/Texture/Source/ASPagerNode.h | 133 - Example/Pods/Texture/Source/ASPagerNode.mm | 230 - .../Pods/Texture/Source/ASRangeManagingNode.h | 31 - Example/Pods/Texture/Source/ASRunLoopQueue.h | 80 - Example/Pods/Texture/Source/ASRunLoopQueue.mm | 430 -- Example/Pods/Texture/Source/ASScrollNode.h | 50 - Example/Pods/Texture/Source/ASScrollNode.mm | 187 - .../Pods/Texture/Source/ASSectionController.h | 86 - .../Source/ASSupplementaryNodeSource.h | 51 - .../Pods/Texture/Source/ASTabBarController.h | 28 - .../Pods/Texture/Source/ASTabBarController.mm | 84 - .../Pods/Texture/Source/ASTableNode+Beta.h | 21 - Example/Pods/Texture/Source/ASTableNode.h | 763 ---- Example/Pods/Texture/Source/ASTableNode.mm | 894 ---- Example/Pods/Texture/Source/ASTableView.h | 245 -- Example/Pods/Texture/Source/ASTableView.mm | 2043 --------- .../Pods/Texture/Source/ASTableViewInternal.h | 62 - .../Texture/Source/ASTableViewProtocols.h | 101 - Example/Pods/Texture/Source/ASTextNode+Beta.h | 45 - Example/Pods/Texture/Source/ASTextNode.h | 278 -- Example/Pods/Texture/Source/ASTextNode.mm | 1561 ------- Example/Pods/Texture/Source/ASTextNode2.h | 256 -- Example/Pods/Texture/Source/ASTextNode2.mm | 1512 ------- .../Pods/Texture/Source/ASTextNodeCommon.h | 91 - Example/Pods/Texture/Source/ASVideoNode.h | 171 - Example/Pods/Texture/Source/ASVideoNode.mm | 861 ---- .../Pods/Texture/Source/ASVideoPlayerNode.h | 225 - .../Pods/Texture/Source/ASVideoPlayerNode.mm | 1017 ----- .../Texture/Source/ASVisibilityProtocols.h | 145 - .../Texture/Source/ASVisibilityProtocols.mm | 22 - .../Source/AsyncDisplayKit+IGListKitMethods.h | 64 - .../AsyncDisplayKit+IGListKitMethods.mm | 53 - Example/Pods/Texture/Source/AsyncDisplayKit.h | 134 - Example/Pods/Texture/Source/Base/ASAssert.h | 101 - Example/Pods/Texture/Source/Base/ASAssert.mm | 58 - .../Pods/Texture/Source/Base/ASAvailability.h | 95 - .../Pods/Texture/Source/Base/ASBaseDefines.h | 237 -- .../Source/Base/ASDisplayNode+Ancestry.h | 55 - .../Source/Base/ASDisplayNode+Ancestry.mm | 90 - .../Texture/Source/Base/ASEqualityHelpers.h | 21 - Example/Pods/Texture/Source/Base/ASLog.h | 131 - Example/Pods/Texture/Source/Base/ASLog.mm | 61 - Example/Pods/Texture/Source/Base/ASSignpost.h | 106 - .../Source/Debug/AsyncDisplayKit+Debug.h | 53 - .../Source/Debug/AsyncDisplayKit+Debug.mm | 753 ---- .../Source/Debug/AsyncDisplayKit+Tips.h | 43 - .../Source/Debug/AsyncDisplayKit+Tips.mm | 48 - .../Details/ASAbstractLayoutController.h | 33 - .../Details/ASAbstractLayoutController.mm | 185 - .../Source/Details/ASBasicImageDownloader.h | 36 - .../Source/Details/ASBasicImageDownloader.mm | 355 -- .../Texture/Source/Details/ASBatchContext.h | 65 - .../Texture/Source/Details/ASBatchContext.mm | 61 - .../Source/Details/ASBatchFetchingDelegate.h | 23 - .../Source/Details/ASCollectionElement.h | 47 - .../Source/Details/ASCollectionElement.mm | 87 - .../Details/ASCollectionFlowLayoutDelegate.h | 28 - .../Details/ASCollectionFlowLayoutDelegate.mm | 78 - .../ASCollectionGalleryLayoutDelegate.h | 106 - .../ASCollectionGalleryLayoutDelegate.mm | 135 - .../Source/Details/ASCollectionInternal.h | 64 - .../Details/ASCollectionLayoutContext.h | 31 - .../Details/ASCollectionLayoutContext.mm | 102 - .../Details/ASCollectionLayoutDelegate.h | 59 - .../Source/Details/ASCollectionLayoutState.h | 111 - .../Source/Details/ASCollectionLayoutState.mm | 253 -- .../ASCollectionViewLayoutController.h | 23 - .../ASCollectionViewLayoutController.mm | 126 - .../Details/ASCollectionViewLayoutInspector.h | 83 - .../ASCollectionViewLayoutInspector.mm | 76 - .../Texture/Source/Details/ASDataController.h | 275 -- .../Source/Details/ASDataController.mm | 973 ----- .../Texture/Source/Details/ASDelegateProxy.h | 56 - .../Texture/Source/Details/ASDelegateProxy.mm | 268 -- .../Texture/Source/Details/ASElementMap.h | 133 - .../Texture/Source/Details/ASElementMap.mm | 275 -- .../Source/Details/ASGraphicsContext.h | 65 - .../Source/Details/ASGraphicsContext.mm | 136 - .../Pods/Texture/Source/Details/ASHashing.h | 40 - .../Pods/Texture/Source/Details/ASHashing.mm | 38 - .../Source/Details/ASHighlightOverlayLayer.h | 51 - .../Source/Details/ASHighlightOverlayLayer.mm | 134 - .../ASImageContainerProtocolCategories.h | 19 - .../ASImageContainerProtocolCategories.mm | 38 - .../Texture/Source/Details/ASImageProtocols.h | 249 -- .../Texture/Source/Details/ASIntegerMap.h | 68 - .../Texture/Source/Details/ASIntegerMap.mm | 184 - .../Source/Details/ASLayoutController.h | 40 - .../Source/Details/ASLayoutRangeType.h | 68 - .../Source/Details/ASMainSerialQueue.h | 19 - .../Source/Details/ASMainSerialQueue.mm | 76 - .../ASMutableAttributedStringBuilder.h | 65 - .../ASMutableAttributedStringBuilder.mm | 254 -- .../Details/ASObjectDescriptionHelpers.h | 65 - .../Details/ASObjectDescriptionHelpers.mm | 104 - .../Details/ASPINRemoteImageDownloader.h | 80 - .../Details/ASPINRemoteImageDownloader.mm | 398 -- .../Pods/Texture/Source/Details/ASPageTable.h | 120 - .../Texture/Source/Details/ASPageTable.mm | 147 - .../Details/ASPhotosFrameworkImageRequest.h | 73 - .../Details/ASPhotosFrameworkImageRequest.mm | 157 - .../Source/Details/ASRangeController.h | 202 - .../Source/Details/ASRangeController.mm | 663 --- ...SRangeControllerUpdateRangeProtocol+Beta.h | 21 - .../Source/Details/ASRecursiveUnfairLock.h | 47 - .../Source/Details/ASRecursiveUnfairLock.mm | 87 - .../Source/Details/ASScrollDirection.h | 37 - .../Source/Details/ASScrollDirection.mm | 64 - .../Texture/Source/Details/ASSectionContext.h | 22 - .../Source/Details/ASTableLayoutController.h | 29 - .../Source/Details/ASTableLayoutController.mm | 54 - .../Pods/Texture/Source/Details/ASThread.h | 333 -- .../Source/Details/ASTraitCollection.h | 179 - .../Source/Details/ASTraitCollection.mm | 366 -- .../Pods/Texture/Source/Details/ASWeakProxy.h | 32 - .../Texture/Source/Details/ASWeakProxy.mm | 72 - .../Pods/Texture/Source/Details/ASWeakSet.h | 50 - .../Pods/Texture/Source/Details/ASWeakSet.mm | 84 - .../Details/CoreGraphics+ASConvenience.h | 48 - .../Texture/Source/Details/NSArray+Diffing.h | 92 - .../Texture/Source/Details/NSArray+Diffing.mm | 177 - .../Source/Details/NSIndexSet+ASHelpers.h | 29 - .../Source/Details/NSIndexSet+ASHelpers.mm | 91 - ...MutableAttributedString+TextKitAdditions.h | 26 - ...utableAttributedString+TextKitAdditions.mm | 49 - .../Transactions/_ASAsyncTransaction.h | 119 - .../Transactions/_ASAsyncTransaction.mm | 461 -- .../_ASAsyncTransactionContainer+Private.h | 24 - .../_ASAsyncTransactionContainer.h | 81 - .../_ASAsyncTransactionContainer.mm | 126 - .../Transactions/_ASAsyncTransactionGroup.h | 36 - .../Transactions/_ASAsyncTransactionGroup.mm | 87 - .../UICollectionViewLayout+ASConvenience.h | 28 - .../UICollectionViewLayout+ASConvenience.mm | 28 - .../Source/Details/UIView+ASConvenience.h | 101 - .../Details/_ASCollectionReusableView.h | 26 - .../Details/_ASCollectionReusableView.mm | 89 - .../Source/Details/_ASCollectionViewCell.h | 35 - .../Source/Details/_ASCollectionViewCell.mm | 151 - .../Texture/Source/Details/_ASDisplayLayer.h | 149 - .../Texture/Source/Details/_ASDisplayLayer.mm | 197 - .../Texture/Source/Details/_ASDisplayView.h | 36 - .../Texture/Source/Details/_ASDisplayView.mm | 532 --- .../Details/_ASDisplayViewAccessiblity.h | 30 - .../Details/_ASDisplayViewAccessiblity.mm | 398 -- .../Source/IGListAdapter+AsyncDisplayKit.h | 37 - .../Source/IGListAdapter+AsyncDisplayKit.mm | 51 - .../Source/Layout/ASAbsoluteLayoutElement.h | 26 - .../Source/Layout/ASAbsoluteLayoutSpec.h | 45 - .../Source/Layout/ASAbsoluteLayoutSpec.mm | 103 - .../Source/Layout/ASAsciiArtBoxCreator.h | 60 - .../Source/Layout/ASAsciiArtBoxCreator.mm | 185 - .../Source/Layout/ASBackgroundLayoutSpec.h | 34 - .../Source/Layout/ASBackgroundLayoutSpec.mm | 91 - .../Source/Layout/ASCenterLayoutSpec.h | 70 - .../Source/Layout/ASCenterLayoutSpec.mm | 74 - .../Source/Layout/ASCornerLayoutSpec.h | 75 - .../Source/Layout/ASCornerLayoutSpec.mm | 164 - .../Pods/Texture/Source/Layout/ASDimension.h | 315 -- .../Pods/Texture/Source/Layout/ASDimension.mm | 123 - .../Source/Layout/ASDimensionInternal.h | 101 - .../Source/Layout/ASDimensionInternal.mm | 65 - .../Texture/Source/Layout/ASInsetLayoutSpec.h | 43 - .../Source/Layout/ASInsetLayoutSpec.mm | 122 - .../Source/Layout/ASLayout+IGListDiffKit.h | 15 - .../Source/Layout/ASLayout+IGListDiffKit.mm | 30 - Example/Pods/Texture/Source/Layout/ASLayout.h | 157 - .../Pods/Texture/Source/Layout/ASLayout.mm | 376 -- .../Texture/Source/Layout/ASLayoutElement.h | 306 -- .../Texture/Source/Layout/ASLayoutElement.mm | 884 ---- .../Layout/ASLayoutElementExtensibility.h | 106 - .../Source/Layout/ASLayoutElementPrivate.h | 106 - .../Source/Layout/ASLayoutSpec+Subclasses.h | 59 - .../Source/Layout/ASLayoutSpec+Subclasses.mm | 86 - .../Pods/Texture/Source/Layout/ASLayoutSpec.h | 100 - .../Texture/Source/Layout/ASLayoutSpec.mm | 342 -- .../Source/Layout/ASOverlayLayoutSpec.h | 34 - .../Source/Layout/ASOverlayLayoutSpec.mm | 87 - .../Texture/Source/Layout/ASRatioLayoutSpec.h | 42 - .../Source/Layout/ASRatioLayoutSpec.mm | 102 - .../Source/Layout/ASRelativeLayoutSpec.h | 87 - .../Source/Layout/ASRelativeLayoutSpec.mm | 104 - .../Source/Layout/ASStackLayoutDefines.h | 148 - .../Source/Layout/ASStackLayoutElement.h | 73 - .../Texture/Source/Layout/ASStackLayoutSpec.h | 133 - .../Source/Layout/ASStackLayoutSpec.mm | 216 - .../Texture/Source/Layout/ASYogaUtilities.h | 78 - .../Texture/Source/Layout/ASYogaUtilities.mm | 249 -- ...bstractLayoutController+FrameworkPrivate.h | 21 - .../Private/ASBasicImageDownloaderInternal.h | 20 - .../Texture/Source/Private/ASBatchFetching.h | 80 - .../Texture/Source/Private/ASBatchFetching.mm | 108 - .../Source/Private/ASCellNode+Internal.h | 74 - .../Source/Private/ASCollectionLayout.h | 50 - .../Source/Private/ASCollectionLayout.mm | 396 -- .../Source/Private/ASCollectionLayoutCache.h | 30 - .../Source/Private/ASCollectionLayoutCache.mm | 88 - .../ASCollectionLayoutContext+Private.h | 32 - .../Private/ASCollectionLayoutDefines.h | 19 - .../Private/ASCollectionLayoutDefines.mm | 23 - .../Private/ASCollectionLayoutState+Private.h | 25 - .../Private/ASCollectionView+Undeprecated.h | 300 -- .../ASCollectionViewFlowLayoutInspector.h | 30 - .../ASCollectionViewFlowLayoutInspector.mm | 156 - .../Source/Private/ASControlNode+Private.h | 18 - .../Source/Private/ASControlTargetAction.h | 32 - .../Source/Private/ASControlTargetAction.mm | 65 - .../Source/Private/ASDefaultPlayButton.h | 14 - .../Source/Private/ASDefaultPlayButton.mm | 66 - .../Source/Private/ASDefaultPlaybackButton.h | 19 - .../Source/Private/ASDefaultPlaybackButton.mm | 84 - .../Pods/Texture/Source/Private/ASDispatch.h | 27 - .../Pods/Texture/Source/Private/ASDispatch.mm | 47 - .../Private/ASDisplayNode+AsyncDisplay.mm | 494 --- .../Private/ASDisplayNode+DebugTiming.h | 21 - .../Private/ASDisplayNode+DebugTiming.mm | 85 - .../Private/ASDisplayNode+FrameworkPrivate.h | 335 -- .../Private/ASDisplayNode+UIViewBridge.mm | 1446 ------- .../ASDisplayNodeCornerLayerDelegate.h | 13 - .../ASDisplayNodeCornerLayerDelegate.mm | 19 - .../Source/Private/ASDisplayNodeInternal.h | 404 -- .../Source/Private/ASDisplayNodeLayout.h | 58 - .../Source/Private/ASDisplayNodeTipState.h | 32 - .../Source/Private/ASDisplayNodeTipState.mm | 25 - .../Private/ASIGListAdapterBasedDataSource.h | 29 - .../Private/ASIGListAdapterBasedDataSource.mm | 405 -- .../ASImageNode+AnimatedImagePrivate.h | 50 - .../Source/Private/ASImageNode+CGExtras.h | 31 - .../Source/Private/ASImageNode+CGExtras.mm | 122 - .../Source/Private/ASImageNode+Private.h | 17 - .../Source/Private/ASInternalHelpers.h | 126 - .../Source/Private/ASInternalHelpers.mm | 261 -- .../Private/ASLayerBackingTipProvider.h | 24 - .../Private/ASLayerBackingTipProvider.mm | 45 - .../Source/Private/ASLayoutTransition.h | 93 - .../Source/Private/ASLayoutTransition.mm | 298 -- .../Source/Private/ASMutableElementMap.h | 62 - .../Source/Private/ASMutableElementMap.mm | 143 - .../Private/ASNetworkImageLoadInfo+Private.h | 22 - .../Source/Private/ASPendingStateController.h | 50 - .../Private/ASPendingStateController.mm | 102 - .../Private/ASResponderChainEnumerator.h | 29 - .../Private/ASResponderChainEnumerator.mm | 45 - .../Pods/Texture/Source/Private/ASSection.h | 36 - .../Pods/Texture/Source/Private/ASSection.mm | 25 - .../Source/Private/ASTableView+Undeprecated.h | 298 -- Example/Pods/Texture/Source/Private/ASTip.h | 49 - Example/Pods/Texture/Source/Private/ASTip.mm | 35 - .../Pods/Texture/Source/Private/ASTipNode.h | 39 - .../Pods/Texture/Source/Private/ASTipNode.mm | 28 - .../Texture/Source/Private/ASTipProvider.h | 42 - .../Texture/Source/Private/ASTipProvider.mm | 43 - .../Texture/Source/Private/ASTipsController.h | 40 - .../Source/Private/ASTipsController.mm | 185 - .../Texture/Source/Private/ASTipsWindow.h | 36 - .../Texture/Source/Private/ASTipsWindow.mm | 98 - .../Private/ASTwoDimensionalArrayUtils.h | 46 - .../Private/ASTwoDimensionalArrayUtils.mm | 121 - .../Pods/Texture/Source/Private/ASWeakMap.h | 59 - .../Pods/Texture/Source/Private/ASWeakMap.mm | 78 - .../Layout/ASLayoutElementStylePrivate.h | 31 - .../Private/Layout/ASLayoutSpecPrivate.h | 37 - .../Private/Layout/ASLayoutSpecUtilities.h | 101 - .../Layout/ASStackLayoutSpecUtilities.h | 135 - .../Private/Layout/ASStackPositionedLayout.h | 24 - .../Private/Layout/ASStackPositionedLayout.mm | 185 - .../Layout/ASStackUnpositionedLayout.h | 73 - .../Layout/ASStackUnpositionedLayout.mm | 758 ---- .../Private/_ASCollectionGalleryLayoutInfo.h | 26 - .../Private/_ASCollectionGalleryLayoutInfo.mm | 68 - .../Private/_ASCollectionGalleryLayoutItem.h | 34 - .../Private/_ASCollectionGalleryLayoutItem.mm | 82 - .../Source/Private/_ASCoreAnimationExtras.h | 84 - .../Source/Private/_ASCoreAnimationExtras.mm | 186 - .../Source/Private/_ASHierarchyChangeSet.h | 214 - .../Source/Private/_ASHierarchyChangeSet.mm | 1009 ----- .../Texture/Source/Private/_ASPendingState.h | 41 - .../Texture/Source/Private/_ASPendingState.mm | 1423 ------- .../Texture/Source/Private/_ASScopeTimer.h | 56 - .../Component/ASTextDebugOption.h | 92 - .../Component/ASTextDebugOption.mm | 135 - .../TextExperiment/Component/ASTextInput.h | 85 - .../TextExperiment/Component/ASTextInput.mm | 150 - .../TextExperiment/Component/ASTextLayout.h | 547 --- .../TextExperiment/Component/ASTextLayout.mm | 3483 --------------- .../TextExperiment/Component/ASTextLine.h | 77 - .../TextExperiment/Component/ASTextLine.mm | 169 - .../TextExperiment/String/ASTextAttribute.h | 346 -- .../TextExperiment/String/ASTextAttribute.mm | 487 --- .../TextExperiment/String/ASTextRunDelegate.h | 65 - .../String/ASTextRunDelegate.mm | 68 - .../TextExperiment/Utility/ASTextUtilities.h | 315 -- .../TextExperiment/Utility/ASTextUtilities.mm | 142 - .../Utility/NSAttributedString+ASText.h | 1375 ------ .../Utility/NSAttributedString+ASText.mm | 1208 ------ .../Utility/NSParagraphStyle+ASText.h | 34 - .../Utility/NSParagraphStyle+ASText.mm | 219 - .../Texture/Source/TextKit/ASLayoutManager.h | 16 - .../Texture/Source/TextKit/ASLayoutManager.mm | 42 - .../Source/TextKit/ASTextKitAttributes.h | 134 - .../Source/TextKit/ASTextKitAttributes.mm | 50 - .../Source/TextKit/ASTextKitComponents.h | 64 - .../Source/TextKit/ASTextKitComponents.mm | 193 - .../Texture/Source/TextKit/ASTextKitContext.h | 54 - .../Source/TextKit/ASTextKitContext.mm | 102 - .../TextKit/ASTextKitCoreTextAdditions.h | 89 - .../TextKit/ASTextKitCoreTextAdditions.mm | 330 -- .../Source/TextKit/ASTextKitEntityAttribute.h | 36 - .../TextKit/ASTextKitEntityAttribute.mm | 43 - .../TextKit/ASTextKitFontSizeAdjuster.h | 58 - .../TextKit/ASTextKitFontSizeAdjuster.mm | 240 -- .../TextKit/ASTextKitRenderer+Positioning.h | 106 - .../TextKit/ASTextKitRenderer+Positioning.mm | 386 -- .../TextKit/ASTextKitRenderer+TextChecking.h | 32 - .../TextKit/ASTextKitRenderer+TextChecking.mm | 104 - .../Source/TextKit/ASTextKitRenderer.h | 108 - .../Source/TextKit/ASTextKitRenderer.mm | 294 -- .../Source/TextKit/ASTextKitShadower.h | 78 - .../Source/TextKit/ASTextKitShadower.mm | 177 - .../Source/TextKit/ASTextKitTailTruncater.h | 21 - .../Source/TextKit/ASTextKitTailTruncater.mm | 197 - .../Source/TextKit/ASTextKitTruncating.h | 61 - .../Texture/Source/TextKit/ASTextNodeTypes.h | 13 - .../Source/TextKit/ASTextNodeWordKerner.h | 37 - .../Source/TextKit/ASTextNodeWordKerner.mm | 130 - .../Texture/Source/UIImage+ASConvenience.h | 162 - .../Texture/Source/UIImage+ASConvenience.mm | 225 - .../Source/UIResponder+AsyncDisplayKit.h | 25 - .../Source/UIResponder+AsyncDisplayKit.mm | 31 - .../Texture/Source/_ASTransitionContext.h | 49 - .../Texture/Source/_ASTransitionContext.mm | 104 - .../Texture/Source/tvOS/ASControlNode+tvOS.mm | 92 - .../Texture/Source/tvOS/ASImageNode+tvOS.mm | 191 - .../QuranEngineApp.xcodeproj/project.pbxproj | 78 +- .../xcshareddata/swiftpm/Package.resolved | 30 +- .../xcschemes/QuranEngineApp.xcscheme | 2 +- .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcshareddata/swiftpm/Package.resolved | 131 - .../QuranEngineApp/Classes/AppDelegate.swift | 1 - .../Classes/AsyncTextLabelImplmentation.swift | 14 - .../QuranEngineApp/Classes/Container.swift | 1 + .../QuranEngineApp/Classes/FixedTextNode.h | 21 - .../QuranEngineApp/Classes/FixedTextNode.m | 68 - .../Classes/QuranEngineApp-Bridging-Header.h | 2 - Features/HomeFeature/HomeViewModel.swift | 2 +- .../ContentViewController.swift | 9 +- .../ContentViewModel.swift | 9 +- .../QuranPagesFeature/Page+Localization.swift | 22 + .../ContentTranslationBuilder.swift | 57 +- .../ContentTranslationView.swift | 144 +- .../ContentTranslationViewController.swift | 73 +- .../ContentTranslationViewModel.swift | 293 ++ .../QuranTranslationDiffableDataSource.swift | 155 - .../SelectedTranslationsMonitor.swift | 25 - .../TranslatedPage.swift | 57 - .../Translation+UI.swift | 24 +- .../TranslationCellProvider.swift | 178 - .../TranslationExpansionHandler.swift | 49 - .../TranslationFootnote.swift | 105 + .../TranslationItem+View.swift | 300 ++ .../TranslationItem.swift | 140 + .../TranslationReadableInsets.swift | 53 + .../TranslationURL.swift | 63 + ...nslationArabicTextCollectionViewCell.swift | 50 - ...ranTranslationBaseCollectionViewCell.swift | 124 - ...nTranslationFooterCollectionViewCell.swift | 48 - ...nTranslationHeaderCollectionViewCell.swift | 66 - ...ranslationSuraNameCollectionViewCell.swift | 112 - ...ranTranslationTextCollectionViewCell.swift | 234 - ...tionVerseSeparatorCollectionViewCell.swift | 69 - .../QuranViewFeature/QuranInteractor.swift | 2 +- Features/SearchFeature/SearchViewModel.swift | 4 +- .../TranslationVerseBuilder.swift | 8 +- .../TranslationVerseDataSource.swift | 68 - .../TranslationVerseView.swift | 17 + .../TranslationVerseViewController.swift | 57 +- .../TranslationVerseViewModel.swift | 55 +- .../TranslationsFeature/TranslationItem.swift | 11 - .../TranslationsListViewModel.swift | 6 +- Model/QuranText/FontSize.swift | 16 + Model/QuranText/TranslatedVerses.swift | 1 + UI/NoorFont/FontName.swift | 14 - UI/NoorFont/Resources/AbyssinicaSIL-R.ttf | Bin 602664 -> 0 bytes UI/NoorUI/Components/MultipartText.swift | 30 +- .../QuranTranslation/AsyncTextLabel.swift | 49 - .../QuranTranslation/ExpandableLabel.swift | 170 - UI/NoorUI/Font/FontName++.swift | 46 +- .../inner-shadow.imageset/Contents.json | 21 - .../inner-shadow.imageset/inner-shadow.png | Bin 844 -> 0 bytes .../Contents.json | 24 - .../sura-decoration-left.png | Bin 15763 -> 0 bytes .../Contents.json | 24 - .../sura-decoration-middle.png | Bin 528 -> 0 bytes .../Contents.json | 24 - .../sura-decoration-right.png | Bin 15749 -> 0 bytes UI/NoorUI/Images/NoorImage.swift | 4 - UI/UIx/SwiftUI/Miscellaneous/View+URL.swift | 14 + UI/UIx/SwiftUI/Mutate.swift | 2 +- UI/UIx/SwiftUI/ViewModel/ValueViewModel.swift | 22 - .../ViewModel/ViewModelContainer.swift | 35 - UI/UIx/SwiftUI/Views/AttributedString++.swift | 28 + UI/UIx/SwiftUI/Views/CollectionTracker.swift | 107 + .../Views/InvertInDarkModeModifier.swift | 26 + ...referredContentSizeMatchesScrollView.swift | 6 +- .../Views/SheetPresentationDetents.swift | 48 + .../SwiftUI/Views/TextAlignmentModifier.swift | 26 + ...ndowSafeAreaInsetsReaderViewModifier.swift | 91 + .../UIKit/Extensions/UIView+Extension.swift | 26 + 666 files changed, 1675 insertions(+), 105177 deletions(-) create mode 100644 Core/Utilities/Sources/Features/Pair.swift delete mode 100644 Example/Pods/Manifest.lock delete mode 100644 Example/Pods/PINCache/LICENSE.txt delete mode 100644 Example/Pods/PINCache/README.md delete mode 100644 Example/Pods/PINCache/Source/PINCache.h delete mode 100644 Example/Pods/PINCache/Source/PINCache.m delete mode 100644 Example/Pods/PINCache/Source/PINCacheMacros.h delete mode 100644 Example/Pods/PINCache/Source/PINCacheObjectSubscripting.h delete mode 100644 Example/Pods/PINCache/Source/PINCaching.h delete mode 100644 Example/Pods/PINCache/Source/PINDiskCache.h delete mode 100644 Example/Pods/PINCache/Source/PINDiskCache.m delete mode 100644 Example/Pods/PINCache/Source/PINMemoryCache.h delete mode 100644 Example/Pods/PINCache/Source/PINMemoryCache.m delete mode 100644 Example/Pods/PINOperation/LICENSE.txt delete mode 100644 Example/Pods/PINOperation/README.md delete mode 100644 Example/Pods/PINOperation/Source/PINOperation.h delete mode 100644 Example/Pods/PINOperation/Source/PINOperationGroup.h delete mode 100644 Example/Pods/PINOperation/Source/PINOperationGroup.m delete mode 100644 Example/Pods/PINOperation/Source/PINOperationMacros.h delete mode 100644 Example/Pods/PINOperation/Source/PINOperationQueue.h delete mode 100644 Example/Pods/PINOperation/Source/PINOperationQueue.m delete mode 100644 Example/Pods/PINOperation/Source/PINOperationTypes.h delete mode 100644 Example/Pods/PINRemoteImage/LICENSE delete mode 100644 Example/Pods/PINRemoteImage/README.md delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImageView.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINCachedAnimatedImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINGIFAnimatedImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINWebPAnimatedImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/NSData+ImageDetectors.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/Categories/PINRemoteImageTask+Subclassing.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINAnimatedImageView+PINRemoteImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINButton+PINRemoteImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINImageView+PINRemoteImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINAlternateRepresentationProvider.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINCache/PINCache+PINRemoteImageCaching.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINProgressiveImage.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCategoryManager.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager+Private.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerResult.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINRequestRetryStrategy.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINResume.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINResume.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/PINURLSessionManager.m delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/NSData+ImageDetectors.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINAlternateRepresentationProvider.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView+PINRemoteImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINButton+PINRemoteImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINCache+PINRemoteImageCaching.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINCachedAnimatedImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINGIFAnimatedImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINImageView+PINRemoteImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINProgressiveImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImage.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCaching.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCategoryManager.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageMacros.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManager.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManagerResult.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINRequestRetryStrategy.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINURLSessionManager.h delete mode 100644 Example/Pods/PINRemoteImage/Source/Classes/include/PINWebPAnimatedImage.h delete mode 100644 Example/Pods/Pods.xcodeproj/project.pbxproj delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache-Info.plist delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache-dummy.m delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache-prefix.pch delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache-umbrella.h delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache.debug.xcconfig delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache.modulemap delete mode 100644 Example/Pods/Target Support Files/PINCache/PINCache.release.xcconfig delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation-Info.plist delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation-dummy.m delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation-prefix.pch delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation-umbrella.h delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation.debug.xcconfig delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation.modulemap delete mode 100644 Example/Pods/Target Support Files/PINOperation/PINOperation.release.xcconfig delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-dummy.m delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-umbrella.h delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.debug.xcconfig delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.modulemap delete mode 100644 Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.release.xcconfig delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.markdown delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.plist delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-dummy.m delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-input-files.xcfilelist delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-output-files.xcfilelist delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-input-files.xcfilelist delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-output-files.xcfilelist delete mode 100755 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-umbrella.h delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.debug.xcconfig delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap delete mode 100644 Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.release.xcconfig delete mode 100644 Example/Pods/Target Support Files/Texture/Texture-Info.plist delete mode 100644 Example/Pods/Target Support Files/Texture/Texture-dummy.m delete mode 100644 Example/Pods/Target Support Files/Texture/Texture-prefix.pch delete mode 100644 Example/Pods/Target Support Files/Texture/Texture-umbrella.h delete mode 100644 Example/Pods/Target Support Files/Texture/Texture.debug.xcconfig delete mode 100644 Example/Pods/Target Support Files/Texture/Texture.modulemap delete mode 100644 Example/Pods/Target Support Files/Texture/Texture.release.xcconfig delete mode 100644 Example/Pods/Texture/LICENSE delete mode 100644 Example/Pods/Texture/README.md delete mode 100644 Example/Pods/Texture/Source/ASBlockTypes.h delete mode 100644 Example/Pods/Texture/Source/ASButtonNode+Private.h delete mode 100644 Example/Pods/Texture/Source/ASButtonNode+Yoga.h delete mode 100644 Example/Pods/Texture/Source/ASButtonNode+Yoga.mm delete mode 100644 Example/Pods/Texture/Source/ASButtonNode.h delete mode 100644 Example/Pods/Texture/Source/ASButtonNode.mm delete mode 100644 Example/Pods/Texture/Source/ASCellNode.h delete mode 100644 Example/Pods/Texture/Source/ASCellNode.mm delete mode 100644 Example/Pods/Texture/Source/ASCollectionNode+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASCollectionNode.h delete mode 100644 Example/Pods/Texture/Source/ASCollectionNode.mm delete mode 100644 Example/Pods/Texture/Source/ASCollectionView.h delete mode 100644 Example/Pods/Texture/Source/ASCollectionView.mm delete mode 100644 Example/Pods/Texture/Source/ASCollectionViewLayoutFacilitatorProtocol.h delete mode 100644 Example/Pods/Texture/Source/ASCollectionViewProtocols.h delete mode 100644 Example/Pods/Texture/Source/ASCollections.h delete mode 100644 Example/Pods/Texture/Source/ASCollections.mm delete mode 100644 Example/Pods/Texture/Source/ASConfiguration.h delete mode 100644 Example/Pods/Texture/Source/ASConfiguration.mm delete mode 100644 Example/Pods/Texture/Source/ASConfigurationDelegate.h delete mode 100644 Example/Pods/Texture/Source/ASConfigurationInternal.h delete mode 100644 Example/Pods/Texture/Source/ASConfigurationInternal.mm delete mode 100644 Example/Pods/Texture/Source/ASContextTransitioning.h delete mode 100644 Example/Pods/Texture/Source/ASControlNode+Subclasses.h delete mode 100644 Example/Pods/Texture/Source/ASControlNode.h delete mode 100644 Example/Pods/Texture/Source/ASControlNode.mm delete mode 100644 Example/Pods/Texture/Source/ASDKNavigationController.h delete mode 100644 Example/Pods/Texture/Source/ASDKNavigationController.mm delete mode 100644 Example/Pods/Texture/Source/ASDKViewController.h delete mode 100644 Example/Pods/Texture/Source/ASDKViewController.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Convenience.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Convenience.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+InterfaceState.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Layout.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Subclasses.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Yoga.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode+Yoga.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNode.mm delete mode 100644 Example/Pods/Texture/Source/ASDisplayNodeExtras.h delete mode 100644 Example/Pods/Texture/Source/ASDisplayNodeExtras.mm delete mode 100644 Example/Pods/Texture/Source/ASEditableTextNode.h delete mode 100644 Example/Pods/Texture/Source/ASEditableTextNode.mm delete mode 100644 Example/Pods/Texture/Source/ASExperimentalFeatures.h delete mode 100644 Example/Pods/Texture/Source/ASExperimentalFeatures.mm delete mode 100644 Example/Pods/Texture/Source/ASImageNode+AnimatedImage.mm delete mode 100644 Example/Pods/Texture/Source/ASImageNode.h delete mode 100644 Example/Pods/Texture/Source/ASImageNode.mm delete mode 100644 Example/Pods/Texture/Source/ASLocking.h delete mode 100644 Example/Pods/Texture/Source/ASMainThreadDeallocation.h delete mode 100644 Example/Pods/Texture/Source/ASMainThreadDeallocation.mm delete mode 100644 Example/Pods/Texture/Source/ASMapNode.h delete mode 100644 Example/Pods/Texture/Source/ASMapNode.mm delete mode 100644 Example/Pods/Texture/Source/ASMultiplexImageNode.h delete mode 100644 Example/Pods/Texture/Source/ASMultiplexImageNode.mm delete mode 100644 Example/Pods/Texture/Source/ASNetworkImageLoadInfo.h delete mode 100644 Example/Pods/Texture/Source/ASNetworkImageLoadInfo.mm delete mode 100644 Example/Pods/Texture/Source/ASNetworkImageNode.h delete mode 100644 Example/Pods/Texture/Source/ASNetworkImageNode.mm delete mode 100644 Example/Pods/Texture/Source/ASNodeController+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASNodeController+Beta.mm delete mode 100644 Example/Pods/Texture/Source/ASPagerFlowLayout.h delete mode 100644 Example/Pods/Texture/Source/ASPagerFlowLayout.mm delete mode 100644 Example/Pods/Texture/Source/ASPagerNode+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASPagerNode.h delete mode 100644 Example/Pods/Texture/Source/ASPagerNode.mm delete mode 100644 Example/Pods/Texture/Source/ASRangeManagingNode.h delete mode 100644 Example/Pods/Texture/Source/ASRunLoopQueue.h delete mode 100644 Example/Pods/Texture/Source/ASRunLoopQueue.mm delete mode 100644 Example/Pods/Texture/Source/ASScrollNode.h delete mode 100644 Example/Pods/Texture/Source/ASScrollNode.mm delete mode 100644 Example/Pods/Texture/Source/ASSectionController.h delete mode 100644 Example/Pods/Texture/Source/ASSupplementaryNodeSource.h delete mode 100644 Example/Pods/Texture/Source/ASTabBarController.h delete mode 100644 Example/Pods/Texture/Source/ASTabBarController.mm delete mode 100644 Example/Pods/Texture/Source/ASTableNode+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASTableNode.h delete mode 100644 Example/Pods/Texture/Source/ASTableNode.mm delete mode 100644 Example/Pods/Texture/Source/ASTableView.h delete mode 100644 Example/Pods/Texture/Source/ASTableView.mm delete mode 100644 Example/Pods/Texture/Source/ASTableViewInternal.h delete mode 100644 Example/Pods/Texture/Source/ASTableViewProtocols.h delete mode 100644 Example/Pods/Texture/Source/ASTextNode+Beta.h delete mode 100644 Example/Pods/Texture/Source/ASTextNode.h delete mode 100644 Example/Pods/Texture/Source/ASTextNode.mm delete mode 100644 Example/Pods/Texture/Source/ASTextNode2.h delete mode 100644 Example/Pods/Texture/Source/ASTextNode2.mm delete mode 100644 Example/Pods/Texture/Source/ASTextNodeCommon.h delete mode 100644 Example/Pods/Texture/Source/ASVideoNode.h delete mode 100644 Example/Pods/Texture/Source/ASVideoNode.mm delete mode 100644 Example/Pods/Texture/Source/ASVideoPlayerNode.h delete mode 100644 Example/Pods/Texture/Source/ASVideoPlayerNode.mm delete mode 100644 Example/Pods/Texture/Source/ASVisibilityProtocols.h delete mode 100644 Example/Pods/Texture/Source/ASVisibilityProtocols.mm delete mode 100644 Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.h delete mode 100644 Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.mm delete mode 100644 Example/Pods/Texture/Source/AsyncDisplayKit.h delete mode 100644 Example/Pods/Texture/Source/Base/ASAssert.h delete mode 100644 Example/Pods/Texture/Source/Base/ASAssert.mm delete mode 100644 Example/Pods/Texture/Source/Base/ASAvailability.h delete mode 100644 Example/Pods/Texture/Source/Base/ASBaseDefines.h delete mode 100644 Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.h delete mode 100644 Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.mm delete mode 100644 Example/Pods/Texture/Source/Base/ASEqualityHelpers.h delete mode 100644 Example/Pods/Texture/Source/Base/ASLog.h delete mode 100644 Example/Pods/Texture/Source/Base/ASLog.mm delete mode 100644 Example/Pods/Texture/Source/Base/ASSignpost.h delete mode 100644 Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.h delete mode 100644 Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.mm delete mode 100644 Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.h delete mode 100644 Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASAbstractLayoutController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASAbstractLayoutController.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASBasicImageDownloader.h delete mode 100644 Example/Pods/Texture/Source/Details/ASBasicImageDownloader.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASBatchContext.h delete mode 100644 Example/Pods/Texture/Source/Details/ASBatchContext.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASBatchFetchingDelegate.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionElement.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionElement.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionInternal.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionLayoutDelegate.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionLayoutState.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionLayoutState.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.h delete mode 100644 Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASDataController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASDataController.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASDelegateProxy.h delete mode 100644 Example/Pods/Texture/Source/Details/ASDelegateProxy.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASElementMap.h delete mode 100644 Example/Pods/Texture/Source/Details/ASElementMap.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASGraphicsContext.h delete mode 100644 Example/Pods/Texture/Source/Details/ASGraphicsContext.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASHashing.h delete mode 100644 Example/Pods/Texture/Source/Details/ASHashing.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.h delete mode 100644 Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.h delete mode 100644 Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASImageProtocols.h delete mode 100644 Example/Pods/Texture/Source/Details/ASIntegerMap.h delete mode 100644 Example/Pods/Texture/Source/Details/ASIntegerMap.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASLayoutController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASLayoutRangeType.h delete mode 100644 Example/Pods/Texture/Source/Details/ASMainSerialQueue.h delete mode 100644 Example/Pods/Texture/Source/Details/ASMainSerialQueue.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.h delete mode 100644 Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.h delete mode 100644 Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.h delete mode 100644 Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASPageTable.h delete mode 100644 Example/Pods/Texture/Source/Details/ASPageTable.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.h delete mode 100644 Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASRangeController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASRangeController.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h delete mode 100644 Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.h delete mode 100644 Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASScrollDirection.h delete mode 100644 Example/Pods/Texture/Source/Details/ASScrollDirection.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASSectionContext.h delete mode 100644 Example/Pods/Texture/Source/Details/ASTableLayoutController.h delete mode 100644 Example/Pods/Texture/Source/Details/ASTableLayoutController.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASThread.h delete mode 100644 Example/Pods/Texture/Source/Details/ASTraitCollection.h delete mode 100644 Example/Pods/Texture/Source/Details/ASTraitCollection.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASWeakProxy.h delete mode 100644 Example/Pods/Texture/Source/Details/ASWeakProxy.mm delete mode 100644 Example/Pods/Texture/Source/Details/ASWeakSet.h delete mode 100644 Example/Pods/Texture/Source/Details/ASWeakSet.mm delete mode 100644 Example/Pods/Texture/Source/Details/CoreGraphics+ASConvenience.h delete mode 100644 Example/Pods/Texture/Source/Details/NSArray+Diffing.h delete mode 100644 Example/Pods/Texture/Source/Details/NSArray+Diffing.mm delete mode 100644 Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.h delete mode 100644 Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.mm delete mode 100644 Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.h delete mode 100644 Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.mm delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.h delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.mm delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.h delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.mm delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.h delete mode 100644 Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.mm delete mode 100644 Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.h delete mode 100644 Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.mm delete mode 100644 Example/Pods/Texture/Source/Details/UIView+ASConvenience.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASCollectionReusableView.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASCollectionReusableView.mm delete mode 100644 Example/Pods/Texture/Source/Details/_ASCollectionViewCell.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASCollectionViewCell.mm delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayLayer.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayLayer.mm delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayView.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayView.mm delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.h delete mode 100644 Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.mm delete mode 100644 Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.h delete mode 100644 Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutElement.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASDimension.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASDimension.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASDimensionInternal.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASDimensionInternal.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayout.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayout.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutElement.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutElement.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutElementExtensibility.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutElementPrivate.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASStackLayoutDefines.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASStackLayoutElement.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.mm delete mode 100644 Example/Pods/Texture/Source/Layout/ASYogaUtilities.h delete mode 100644 Example/Pods/Texture/Source/Layout/ASYogaUtilities.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASAbstractLayoutController+FrameworkPrivate.h delete mode 100644 Example/Pods/Texture/Source/Private/ASBasicImageDownloaderInternal.h delete mode 100644 Example/Pods/Texture/Source/Private/ASBatchFetching.h delete mode 100644 Example/Pods/Texture/Source/Private/ASBatchFetching.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASCellNode+Internal.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayout.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayout.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutContext+Private.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionLayoutState+Private.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionView+Undeprecated.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.h delete mode 100644 Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASControlNode+Private.h delete mode 100644 Example/Pods/Texture/Source/Private/ASControlTargetAction.h delete mode 100644 Example/Pods/Texture/Source/Private/ASControlTargetAction.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDefaultPlayButton.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDefaultPlayButton.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDispatch.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDispatch.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNode+AsyncDisplay.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNode+FrameworkPrivate.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNode+UIViewBridge.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeInternal.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeLayout.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.h delete mode 100644 Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.h delete mode 100644 Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASImageNode+AnimatedImagePrivate.h delete mode 100644 Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.h delete mode 100644 Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASImageNode+Private.h delete mode 100644 Example/Pods/Texture/Source/Private/ASInternalHelpers.h delete mode 100644 Example/Pods/Texture/Source/Private/ASInternalHelpers.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.h delete mode 100644 Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASLayoutTransition.h delete mode 100644 Example/Pods/Texture/Source/Private/ASLayoutTransition.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASMutableElementMap.h delete mode 100644 Example/Pods/Texture/Source/Private/ASMutableElementMap.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASNetworkImageLoadInfo+Private.h delete mode 100644 Example/Pods/Texture/Source/Private/ASPendingStateController.h delete mode 100644 Example/Pods/Texture/Source/Private/ASPendingStateController.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.h delete mode 100644 Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASSection.h delete mode 100644 Example/Pods/Texture/Source/Private/ASSection.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTableView+Undeprecated.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTip.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTip.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTipNode.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTipNode.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTipProvider.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTipProvider.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTipsController.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTipsController.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTipsWindow.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTipsWindow.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.h delete mode 100644 Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.mm delete mode 100644 Example/Pods/Texture/Source/Private/ASWeakMap.h delete mode 100644 Example/Pods/Texture/Source/Private/ASWeakMap.mm delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASLayoutElementStylePrivate.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecPrivate.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecUtilities.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASStackLayoutSpecUtilities.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.mm delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.h delete mode 100644 Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.h delete mode 100644 Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.h delete mode 100644 Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.h delete mode 100644 Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.h delete mode 100644 Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASPendingState.h delete mode 100644 Example/Pods/Texture/Source/Private/_ASPendingState.mm delete mode 100644 Example/Pods/Texture/Source/Private/_ASScopeTimer.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.mm delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.h delete mode 100644 Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASLayoutManager.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASLayoutManager.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitComponents.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitComponents.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitContext.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitContext.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitShadower.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitShadower.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.mm delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextKitTruncating.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextNodeTypes.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.h delete mode 100644 Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.mm delete mode 100644 Example/Pods/Texture/Source/UIImage+ASConvenience.h delete mode 100644 Example/Pods/Texture/Source/UIImage+ASConvenience.mm delete mode 100644 Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.h delete mode 100644 Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.mm delete mode 100644 Example/Pods/Texture/Source/_ASTransitionContext.h delete mode 100644 Example/Pods/Texture/Source/_ASTransitionContext.mm delete mode 100644 Example/Pods/Texture/Source/tvOS/ASControlNode+tvOS.mm delete mode 100644 Example/Pods/Texture/Source/tvOS/ASImageNode+tvOS.mm delete mode 100644 Example/QuranEngineApp.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/QuranEngineApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Example/QuranEngineApp.xcworkspace/xcshareddata/swiftpm/Package.resolved delete mode 100644 Example/QuranEngineApp/Classes/AsyncTextLabelImplmentation.swift delete mode 100644 Example/QuranEngineApp/Classes/FixedTextNode.h delete mode 100644 Example/QuranEngineApp/Classes/FixedTextNode.m create mode 100644 Features/QuranTranslationFeature/ContentTranslationViewModel.swift delete mode 100644 Features/QuranTranslationFeature/QuranTranslationDiffableDataSource.swift delete mode 100644 Features/QuranTranslationFeature/SelectedTranslationsMonitor.swift delete mode 100644 Features/QuranTranslationFeature/TranslatedPage.swift delete mode 100644 Features/QuranTranslationFeature/TranslationCellProvider.swift delete mode 100644 Features/QuranTranslationFeature/TranslationExpansionHandler.swift create mode 100644 Features/QuranTranslationFeature/TranslationFootnote.swift create mode 100644 Features/QuranTranslationFeature/TranslationItem+View.swift create mode 100644 Features/QuranTranslationFeature/TranslationItem.swift create mode 100644 Features/QuranTranslationFeature/TranslationReadableInsets.swift create mode 100644 Features/QuranTranslationFeature/TranslationURL.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationArabicTextCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationBaseCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationFooterCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationHeaderCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationSuraNameCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationTextCollectionViewCell.swift delete mode 100644 Features/QuranTranslationFeature/cells/QuranTranslationVerseSeparatorCollectionViewCell.swift delete mode 100644 Features/TranslationVerseFeature/TranslationVerseDataSource.swift create mode 100644 Features/TranslationVerseFeature/TranslationVerseView.swift delete mode 100755 UI/NoorFont/Resources/AbyssinicaSIL-R.ttf delete mode 100644 UI/NoorUI/Features/QuranTranslation/AsyncTextLabel.swift delete mode 100644 UI/NoorUI/Features/QuranTranslation/ExpandableLabel.swift delete mode 100644 UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/Contents.json delete mode 100644 UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/inner-shadow.png delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/Contents.json delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/sura-decoration-left.png delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/Contents.json delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/sura-decoration-middle.png delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/Contents.json delete mode 100644 UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/sura-decoration-right.png create mode 100644 UI/UIx/SwiftUI/Miscellaneous/View+URL.swift delete mode 100644 UI/UIx/SwiftUI/ViewModel/ValueViewModel.swift delete mode 100644 UI/UIx/SwiftUI/ViewModel/ViewModelContainer.swift create mode 100644 UI/UIx/SwiftUI/Views/AttributedString++.swift create mode 100644 UI/UIx/SwiftUI/Views/CollectionTracker.swift create mode 100644 UI/UIx/SwiftUI/Views/InvertInDarkModeModifier.swift create mode 100644 UI/UIx/SwiftUI/Views/SheetPresentationDetents.swift create mode 100644 UI/UIx/SwiftUI/Views/TextAlignmentModifier.swift create mode 100644 UI/UIx/SwiftUI/Views/WindowSafeAreaInsetsReaderViewModifier.swift diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 290ff2fe..cd7e235e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,4 +33,4 @@ jobs: run: sudo xcode-select -s "/Applications/Xcode_15.1.app" - name: Build - run: set -o pipefail && xcrun xcodebuild build -workspace Example/QuranEngineApp.xcworkspace -scheme QuranEngineApp -sdk "iphonesimulator" -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty + run: set -o pipefail && xcrun xcodebuild build -project Example/QuranEngineApp.xcodeproj -scheme QuranEngineApp -sdk "iphonesimulator" -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/AnnotationsService.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/AnnotationsService.xcscheme index 2c97561a..6091d3aa 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/AnnotationsService.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/AnnotationsService.xcscheme @@ -1,6 +1,6 @@ [Range] { + chunkRanges(range: startIndex ..< endIndex, maxChunkSize: maxChunkSize) + } + + public func chunkRanges(range: Range, maxChunkSize: Int) -> [Range] { var chunks: [Range] = [] - chunkText(self, range: startIndex ..< endIndex, maxChunkSize: maxChunkSize, strategy: .paragraph, chunks: &chunks) + chunkText(self, range: range, maxChunkSize: maxChunkSize, strategy: .paragraph, chunks: &chunks) return chunks } } diff --git a/Core/Utilities/Sources/Features/Pair.swift b/Core/Utilities/Sources/Features/Pair.swift new file mode 100644 index 00000000..b60f7db3 --- /dev/null +++ b/Core/Utilities/Sources/Features/Pair.swift @@ -0,0 +1,21 @@ +// +// Pair.swift +// +// +// Created by Mohamed Afifi on 2024-02-02. +// + +import Foundation + +public struct Pair { + public var first: First + public var second: Second + + public init(_ first: First, _ second: Second) { + self.first = first + self.second = second + } +} + +extension Pair: Equatable where First: Equatable, Second: Equatable { } +extension Pair: Hashable where First: Hashable, Second: Hashable { } diff --git a/Core/VLogging/Logger.swift b/Core/VLogging/Logger.swift index 993cd6b9..3088e636 100644 --- a/Core/VLogging/Logger.swift +++ b/Core/VLogging/Logger.swift @@ -7,4 +7,4 @@ import Logging -public let logger = Logger(label: "default") +public let logger = Logger(label: "quran-ios") diff --git a/Domain/AnnotationsService/Sources/NoteService.swift b/Domain/AnnotationsService/Sources/NoteService.swift index 9fe9a552..1bdc8e73 100644 --- a/Domain/AnnotationsService/Sources/NoteService.swift +++ b/Domain/AnnotationsService/Sources/NoteService.swift @@ -14,6 +14,7 @@ import NotePersistence import Preferences import QuranAnnotations import QuranKit +import QuranText import QuranTextKit public struct NoteService { @@ -89,7 +90,7 @@ public struct NoteService { private var lastUsedHighlightColor: Note.Color private func textDictionaryForVerses(_ verses: [AyahNumber]) async throws -> [AyahNumber: String] { - let translatedVerses = try await textService.textForVerses(verses, translations: []) + let translatedVerses: TranslatedVerses = try await textService.textForVerses(verses, translations: []) return Dictionary(zip(verses, translatedVerses.verses).map { ($0, $1.arabicText) }, uniquingKeysWith: { x, _ in x }) } } diff --git a/Domain/QuranTextKit/Sources/TranslationText/QuranTextDataService.swift b/Domain/QuranTextKit/Sources/TranslationText/QuranTextDataService.swift index 6563b82d..df471a51 100644 --- a/Domain/QuranTextKit/Sources/TranslationText/QuranTextDataService.swift +++ b/Domain/QuranTextKit/Sources/TranslationText/QuranTextDataService.swift @@ -42,10 +42,19 @@ public struct QuranTextDataService { // MARK: Public + public func textForVerses(_ verses: [AyahNumber], translations: [Translation]) async throws -> [AyahNumber: VerseText] { + let translatedVerses: TranslatedVerses = try await textForVerses(verses, translations: translations) + return Dictionary(uniqueKeysWithValues: (0 ..< verses.count).map { i in (verses[i], translatedVerses.verses[i]) }) + } + + // TODO: Remove + @available(*, deprecated, message: "Use textForVerses(:translations:)") public func textForVerses(_ verses: [AyahNumber]) async throws -> TranslatedVerses { try await textForVerses(verses, translations: { try await localTranslations() }) } + // TODO: Remove + @available(*, deprecated, message: "Use textForVerses(:translations:)") public func textForVerses(_ verses: [AyahNumber], translations: [Translation]) async throws -> TranslatedVerses { try await textForVerses(verses, translations: { translations }) } @@ -107,7 +116,7 @@ public struct QuranTextDataService { } private func selectedTranslations(allTranslations: [Translation]) -> [Translation] { - let selected = selectedTranslationsPreferences.selectedTranslations + let selected = selectedTranslationsPreferences.selectedTranslationIds let translationsById = allTranslations.flatGroup { $0.id } return selected.compactMap { translationsById[$0] } } @@ -179,7 +188,7 @@ public struct QuranTextDataService { let (string, footnoteRanges) = originalString.replacing( sortedRanges: footnoteTextRanges) { _, index -> String in - NumberFormatter.shared.format(index + 1) + lFormat("translation.text.footnote-number", index + 1) } let quranRanges = string.ranges(of: Self.quranRegex) diff --git a/Domain/QuranTextKit/Tests/QuranTextDataServiceTests.swift b/Domain/QuranTextKit/Tests/QuranTextDataServiceTests.swift index b5bf3b1e..89bb5f32 100644 --- a/Domain/QuranTextKit/Tests/QuranTextDataServiceTests.swift +++ b/Domain/QuranTextKit/Tests/QuranTextDataServiceTests.swift @@ -30,7 +30,7 @@ final class QuranTextDataServiceTests: XCTestCase { ) let selectedTranslationsPreferences = SelectedTranslationsPreferences.shared - selectedTranslationsPreferences.selectedTranslations = translations.map(\.id) + selectedTranslationsPreferences.selectedTranslationIds = translations.map(\.id) try await localTranslationsFake.setTranslations(translations) } @@ -50,7 +50,7 @@ final class QuranTextDataServiceTests: XCTestCase { [quran.suras[1].verses[0]], ] for verses in tests { - let versesText = try await textService.textForVerses(verses, translations: []) + let versesText: TranslatedVerses = try await textService.textForVerses(verses, translations: []) let expectedVerses = verses.map { VerseText( @@ -96,7 +96,7 @@ final class QuranTextDataServiceTests: XCTestCase { let versesText = try await textService.textForVerses([verse]) let translationText = TestData.translationTextAt(translations[0], verse) - let textWithoutFootnotes = "Guide us to the Straight Way. {ABC} 1 {DE} 2 FG" + let textWithoutFootnotes = "Guide us to the Straight Way. {ABC} [1] {DE} [2] FG" let string = TranslationString( text: textWithoutFootnotes, quranRanges: [ @@ -104,8 +104,8 @@ final class QuranTextDataServiceTests: XCTestCase { textWithoutFootnotes.range(of: "{DE}"), ].compactMap { $0 }, footnoteRanges: [ - textWithoutFootnotes.range(of: "1"), - textWithoutFootnotes.range(of: "2"), + textWithoutFootnotes.range(of: "[1]"), + textWithoutFootnotes.range(of: "[2]"), ].compactMap { $0 }, footnotes: [ translationText.range(of: "[[Footer1]]"), diff --git a/Domain/QuranTextKit/Tests/ShareableVerseTextRetrieverTests.swift b/Domain/QuranTextKit/Tests/ShareableVerseTextRetrieverTests.swift index b3e001d1..e3a76068 100644 --- a/Domain/QuranTextKit/Tests/ShareableVerseTextRetrieverTests.swift +++ b/Domain/QuranTextKit/Tests/ShareableVerseTextRetrieverTests.swift @@ -33,7 +33,7 @@ final class ShareableVerseTextRetrieverTests: XCTestCase { ) let selectedTranslationsPreferences = SelectedTranslationsPreferences.shared - selectedTranslationsPreferences.selectedTranslations = translations.map(\.id) + selectedTranslationsPreferences.selectedTranslationIds = translations.map(\.id) try await localTranslationsFake.setTranslations(translations) } diff --git a/Domain/TranslationService/Sources/SelectedTranslationsPreferences.swift b/Domain/TranslationService/Sources/SelectedTranslationsPreferences.swift index 18e09fc1..654e3055 100644 --- a/Domain/TranslationService/Sources/SelectedTranslationsPreferences.swift +++ b/Domain/TranslationService/Sources/SelectedTranslationsPreferences.swift @@ -19,38 +19,44 @@ public class SelectedTranslationsPreferences { public static let shared = SelectedTranslationsPreferences() @Preference(selectedTranslations) - public var selectedTranslations: [Translation.ID] + public var selectedTranslationIds: [Translation.ID] public func remove(_ translationId: Int) { - if let index = selectedTranslations.firstIndex(of: translationId) { - selectedTranslations.remove(at: index) + if let index = selectedTranslationIds.firstIndex(of: translationId) { + selectedTranslationIds.remove(at: index) } } public func isSelected(_ translationId: Translation.ID) -> Bool { - selectedTranslations.contains(translationId) + selectedTranslationIds.contains(translationId) } public func toggleSelection(_ translationId: Translation.ID) { - if let index = selectedTranslations.firstIndex(of: translationId) { - selectedTranslations.remove(at: index) + if let index = selectedTranslationIds.firstIndex(of: translationId) { + selectedTranslationIds.remove(at: index) } else { - selectedTranslations.append(translationId) + selectedTranslationIds.append(translationId) } } public func select(_ id: Translation.ID) { - if !selectedTranslations.contains(id) { - selectedTranslations.append(id) + if !selectedTranslationIds.contains(id) { + selectedTranslationIds.append(id) } } public func deselect(_ id: Translation.ID) { - if let index = selectedTranslations.firstIndex(of: id) { - selectedTranslations.remove(at: index) + if let index = selectedTranslationIds.firstIndex(of: id) { + selectedTranslationIds.remove(at: index) } } + public func selectedTranslations(from localTranslations: [Translation]) -> [Translation] { + let selected = selectedTranslationIds + let translationsById = Dictionary(uniqueKeysWithValues: localTranslations.map { ($0.id, $0) }) + return selected.compactMap { translationsById[$0] } + } + // MARK: Internal func reset() { diff --git a/Domain/TranslationService/Sources/TranslationsRepository.swift b/Domain/TranslationService/Sources/TranslationsRepository.swift index 18000955..d4fad2e2 100644 --- a/Domain/TranslationService/Sources/TranslationsRepository.swift +++ b/Domain/TranslationService/Sources/TranslationsRepository.swift @@ -53,7 +53,7 @@ public struct TranslationsRepository { // MARK: Private private func combine(local: [Translation], remote: [Translation]) -> ([Translation], [String: Translation]) { - let localMapConstant = local.flatGroup { $0.fileName } + let localMapConstant = Dictionary(uniqueKeysWithValues: local.map { ($0.fileName, $0) }) var localMap = localMapConstant var combinedList: [Translation] = [] diff --git a/Domain/TranslationService/Sources/TranslationsVersionUpdater.swift b/Domain/TranslationService/Sources/TranslationsVersionUpdater.swift index a92ea176..d6775223 100644 --- a/Domain/TranslationService/Sources/TranslationsVersionUpdater.swift +++ b/Domain/TranslationService/Sources/TranslationsVersionUpdater.swift @@ -67,10 +67,10 @@ struct TranslationsVersionUpdater { // remove the translation from selected translations if translation.installedVersion == nil { - var selectedTranslations = selectedTranslationsPreferences.selectedTranslations + var selectedTranslations = selectedTranslationsPreferences.selectedTranslationIds if let index = selectedTranslations.firstIndex(of: translation.id) { selectedTranslations.remove(at: index) - selectedTranslationsPreferences.selectedTranslations = selectedTranslations + selectedTranslationsPreferences.selectedTranslationIds = selectedTranslations } } } diff --git a/Domain/TranslationService/Tests/SelectedTranslationsPreferencesTests.swift b/Domain/TranslationService/Tests/SelectedTranslationsPreferencesTests.swift index 1fb6dcae..26c6b2f8 100644 --- a/Domain/TranslationService/Tests/SelectedTranslationsPreferencesTests.swift +++ b/Domain/TranslationService/Tests/SelectedTranslationsPreferencesTests.swift @@ -17,16 +17,16 @@ class SelectedTranslationsPreferencesTests: XCTestCase { } func testPreferences() { - XCTAssertEqual(preferences.selectedTranslations, []) + XCTAssertEqual(preferences.selectedTranslationIds, []) preferences.toggleSelection(45) preferences.toggleSelection(10) preferences.toggleSelection(20) - XCTAssertEqual(preferences.selectedTranslations, [45, 10, 20]) + XCTAssertEqual(preferences.selectedTranslationIds, [45, 10, 20]) XCTAssertTrue(preferences.isSelected(10)) preferences.toggleSelection(10) - XCTAssertEqual(preferences.selectedTranslations, [45, 20]) + XCTAssertEqual(preferences.selectedTranslationIds, [45, 20]) XCTAssertFalse(preferences.isSelected(10)) } diff --git a/Domain/TranslationService/Tests/TranslationDeleterTests.swift b/Domain/TranslationService/Tests/TranslationDeleterTests.swift index bf9dbd46..6d75b5f2 100644 --- a/Domain/TranslationService/Tests/TranslationDeleterTests.swift +++ b/Domain/TranslationService/Tests/TranslationDeleterTests.swift @@ -34,7 +34,7 @@ class TranslationDeleterTests: XCTestCase { let translation = TranslationTestData.khanTranslation XCTAssertNotNil(translation.installedVersion) try await localTranslationsFake.setTranslations([translation]) - XCTAssertEqual(preferences.selectedTranslations, [translation.id]) + XCTAssertEqual(preferences.selectedTranslationIds, [translation.id]) let initialLocalTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(initialLocalTranslations, [translation]) @@ -45,7 +45,7 @@ class TranslationDeleterTests: XCTestCase { expected.installedVersion = nil XCTAssertEqual(expected, deletedTranslation) XCTAssertEqual(fileSystem.removedItems, [expected.localPath.url]) - XCTAssertEqual(preferences.selectedTranslations, []) + XCTAssertEqual(preferences.selectedTranslationIds, []) let localTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(localTranslations, [expected]) @@ -55,7 +55,7 @@ class TranslationDeleterTests: XCTestCase { let translation = TranslationTestData.sahihTranslation XCTAssertNotNil(translation.installedVersion) try await localTranslationsFake.setTranslations([translation]) - XCTAssertEqual(preferences.selectedTranslations, [translation.id]) + XCTAssertEqual(preferences.selectedTranslationIds, [translation.id]) let initialLocalTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(initialLocalTranslations, [translation]) @@ -67,7 +67,7 @@ class TranslationDeleterTests: XCTestCase { XCTAssertEqual(expected, deletedTranslation) let zipURL = expected.localPath.deletingPathExtension().appendingPathExtension("zip") XCTAssertEqual(fileSystem.removedItems, [expected.localPath, zipURL].map(\.url)) - XCTAssertEqual(preferences.selectedTranslations, []) + XCTAssertEqual(preferences.selectedTranslationIds, []) let localTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(localTranslations, [expected]) @@ -78,7 +78,7 @@ class TranslationDeleterTests: XCTestCase { translation.installedVersion = nil try await localTranslationsFake.insertTranslation(translation, installedVersion: nil, downloaded: false) - XCTAssertEqual(preferences.selectedTranslations, []) + XCTAssertEqual(preferences.selectedTranslationIds, []) let initialLocalTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(initialLocalTranslations, [translation]) @@ -87,7 +87,7 @@ class TranslationDeleterTests: XCTestCase { XCTAssertEqual(translation, deletedTranslation) XCTAssertEqual(fileSystem.removedItems, [translation.localPath.url]) - XCTAssertEqual(preferences.selectedTranslations, []) + XCTAssertEqual(preferences.selectedTranslationIds, []) let localTranslations = try await retriever.getLocalTranslations() XCTAssertEqual(localTranslations, [translation]) diff --git a/Domain/TranslationServiceFake/LocalTranslationsFake.swift b/Domain/TranslationServiceFake/LocalTranslationsFake.swift index c86d0062..2811172d 100644 --- a/Domain/TranslationServiceFake/LocalTranslationsFake.swift +++ b/Domain/TranslationServiceFake/LocalTranslationsFake.swift @@ -50,7 +50,7 @@ public struct LocalTranslationsFake { for translation in translations { try await persistence.insert(translation) } - preferences.selectedTranslations = translations.map(\.id) + preferences.selectedTranslationIds = translations.map(\.id) fileSystem.files = Set(translations.map(\.localPath.url)) } diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock deleted file mode 100644 index cc3920d8..00000000 --- a/Example/Pods/Manifest.lock +++ /dev/null @@ -1,56 +0,0 @@ -PODS: - - PINCache (3.0.3): - - PINCache/Arc-exception-safe (= 3.0.3) - - PINCache/Core (= 3.0.3) - - PINCache/Arc-exception-safe (3.0.3): - - PINCache/Core - - PINCache/Core (3.0.3): - - PINOperation (~> 1.2.1) - - PINOperation (1.2.2) - - PINRemoteImage/Core (3.0.3): - - PINOperation - - PINRemoteImage/iOS (3.0.3): - - PINRemoteImage/Core - - PINRemoteImage/PINCache (3.0.3): - - PINCache (~> 3.0.3) - - PINRemoteImage/Core - - Texture (3.1.0): - - Texture/AssetsLibrary (= 3.1.0) - - Texture/Core (= 3.1.0) - - Texture/MapKit (= 3.1.0) - - Texture/Photos (= 3.1.0) - - Texture/PINRemoteImage (= 3.1.0) - - Texture/Video (= 3.1.0) - - Texture/AssetsLibrary (3.1.0): - - Texture/Core - - Texture/Core (3.1.0) - - Texture/MapKit (3.1.0): - - Texture/Core - - Texture/Photos (3.1.0): - - Texture/Core - - Texture/PINRemoteImage (3.1.0): - - PINRemoteImage/iOS (~> 3.0.0) - - PINRemoteImage/PINCache - - Texture/Core - - Texture/Video (3.1.0): - - Texture/Core - -DEPENDENCIES: - - Texture - -SPEC REPOS: - trunk: - - PINCache - - PINOperation - - PINRemoteImage - - Texture - -SPEC CHECKSUMS: - PINCache: 7a8fc1a691173d21dbddbf86cd515de6efa55086 - PINOperation: daa34d4aa1d8449089be7d405b9d974abc4724c6 - PINRemoteImage: f1295b29f8c5e640e25335a1b2bd9d805171bd01 - Texture: 2e8ab2519452515f7f5a520f5a8f7e0a413abfa3 - -PODFILE CHECKSUM: 7856639dd096a63bbd8da8f9371780430db95e6d - -COCOAPODS: 1.12.1 diff --git a/Example/Pods/PINCache/LICENSE.txt b/Example/Pods/PINCache/LICENSE.txt deleted file mode 100644 index 3af296ea..00000000 --- a/Example/Pods/PINCache/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [2013] [Tumblr, Inc.] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/Example/Pods/PINCache/README.md b/Example/Pods/PINCache/README.md deleted file mode 100644 index aa81564a..00000000 --- a/Example/Pods/PINCache/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# PINCache - -[![CocoaPods](https://img.shields.io/cocoapods/v/PINCache.svg)](http://cocoadocs.org/docsets/PINCache/) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Build status](https://github.com/pinterest/PINCache/workflows/CI/badge.svg)](https://github.com/pinterest/PINCache/actions?query=workflow%3ACI+branch%3Amaster) - -## Fast, non-deadlocking parallel object cache for iOS and OS X. - -[PINCache](Source/PINCache.h) is a fork of [TMCache](https://github.com/tumblr/TMCache) re-architected to fix issues with deadlocking caused by heavy use. It is a key/value store designed for persisting temporary objects that are expensive to reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar stores, one in memory ([PINMemoryCache](Source/PINMemoryCache.h)) and one on disk ([PINDiskCache](Source/PINDiskCache.h)), all backed by GCD and safe to access from multiple threads simultaneously. On iOS, `PINMemoryCache` will clear itself when the app receives a memory warning or goes into the background. Objects stored in `PINDiskCache` remain until you trim the cache yourself, either manually or by setting a byte or age limit. - -`PINCache` and `PINDiskCache` accept any object conforming to [NSCoding](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html). Put things in like this: - -**Objective-C** -```objective-c -UIImage *img = [[UIImage alloc] initWithData:data scale:[[UIScreen mainScreen] scale]]; -[[PINCache sharedCache] setObject:img forKey:@"image" block:nil]; // returns immediately -``` -**Swift** -```swift -let img = UIImage(data: data, scale:UIScreen.main.scale) -PINCache.shared().setObject(img, forKey: "img") -``` - -Get them back out like this: - -**Objective-C** -```objc -[[PINCache sharedCache] objectForKeyAsync:@"image" block:^(PINCache *cache, NSString *key, id object) { - UIImage *image = (UIImage *)object; - NSLog(@"image scale: %f", image.scale); -}]; -``` -**Swift** -```swift -PINCache.shared().object(forKey: "image") { (cache, key, object) in - if let image = object as? UIImage { - print("image scale: %f", image.scale) - } -} -``` - -Both `PINMemoryCache` and `PINDiskCache` use locks to protect reads and writes. `PINCache` coordinates them so that objects added to memory are available immediately to other threads while being written to disk safely in the background. Both caches are public properties of `PINCache`, so it's easy to manipulate one or the other separately if necessary. - -Collections work too. Thanks to the magic of `NSKeyedArchiver`, objects repeated in a collection only occupy the space of one on disk: - -**Objective-C** -```objective-c -NSArray *images = @[ image, image, image ]; -[[PINCache sharedCache] setObject:images forKey:@"images"]; -NSLog(@"3 for the price of 1: %d", [[[PINCache sharedCache] diskCache] byteCount]); -``` -**Swift** -```swift -// In Swift, Array, String, and Dictionary are all value types. -let images = [image, image, image] as NSArray // Cast to NSArray -PINCache.shared.setObject(images, forKey: "images") -print("3 for the prices of 1: %d", PINCache.shared.diskCache.byteCount) -``` - -## Installation - -### Manually - -[Download the latest tag](https://github.com/pinterest/PINCache/tags) and drag the `PINCache` folder into your Xcode project. - -Install the docs by double clicking the `.docset` file under `docs/`, or view them online at [cocoadocs.org](http://cocoadocs.org/docsets/PINCache/) - -### Git Submodule - - git submodule add https://github.com/pinterest/PINCache.git - git submodule update --init - -### CocoaPods - -Add [PINCache](http://cocoapods.org/?q=name%3APINCache) to your `Podfile` and run `pod install`. - -### Carthage - -Add the following line to your `Cartfile` and run `carthage update --platform ios`. Then follow [this instruction of Carthage](https://github.com/carthage/carthage#adding-frameworks-to-unit-tests-or-a-framework) to embed the framework. - -```github "pinterest/PINCache"``` - -## Requirements - -__PINCache__ requires iOS 8.0, tvOS 9.0, watchOS 2.0 or macOS 10.8 and greater. - -## Contact - -[Garrett Moon](mailto:garrett@pinterest.com) - -## License - -Copyright 2013 Tumblr, Inc. -Copyright 2015 Pinterest, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. [See the License](LICENSE.txt) for the specific language governing permissions and limitations under the License. diff --git a/Example/Pods/PINCache/Source/PINCache.h b/Example/Pods/PINCache/Source/PINCache.h deleted file mode 100644 index bfc9d850..00000000 --- a/Example/Pods/PINCache/Source/PINCache.h +++ /dev/null @@ -1,164 +0,0 @@ -// PINCache is a modified version of TMCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import - -#import "PINCacheMacros.h" -#import "PINCaching.h" -#import "PINDiskCache.h" -#import "PINMemoryCache.h" - -NS_ASSUME_NONNULL_BEGIN - -@class PINCache; - - -/** - `PINCache` is a thread safe key/value store designed for persisting temporary objects that are expensive to - reproduce, such as downloaded data or the results of slow processing. It is comprised of two self-similar - stores, one in memory () and one on disk (). - - `PINCache` itself actually does very little; its main function is providing a front end for a common use case: - a small, fast memory cache that asynchronously persists itself to a large, slow disk cache. When objects are - removed from the memory cache in response to an "apocalyptic" event they remain in the disk cache and are - repopulated in memory the next time they are accessed. `PINCache` also does the tedious work of creating a - dispatch group to wait for both caches to finish their operations without blocking each other. - - The parallel caches are accessible as public properties ( and ) and can be manipulated - separately if necessary. See the docs for and for more details. - - @warning when using in extension or watch extension, define PIN_APP_EXTENSIONS=1 - */ - -PIN_SUBCLASSING_RESTRICTED -@interface PINCache : NSObject - -#pragma mark - -/// @name Core - -/** - Synchronously retrieves the total byte count of the on the shared disk queue. - */ -@property (readonly) NSUInteger diskByteCount; - -/** - The underlying disk cache, see for additional configuration and trimming options. - */ -@property (readonly) PINDiskCache *diskCache; - -/** - The underlying memory cache, see for additional configuration and trimming options. - */ -@property (readonly) PINMemoryCache *memoryCache; - -#pragma mark - Lifecycle -/// @name Initialization - -/** - A shared cache. - - @result The shared singleton cache instance. - */ -@property (class, strong, readonly) PINCache *sharedCache; - -- (instancetype)init NS_UNAVAILABLE; - -/** - Multiple instances with the same name are *not* allowed and can *not* safely - access the same data on disk. Also used to create the . - - @see name - @param name The name of the cache. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name; - -/** - Multiple instances with the same name are *not* allowed and can *not* safely - access the same data on disk. Also used to create the . - - @see name - @param name The name of the cache. - @param rootPath The path of the cache on disk. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath; - -/** - Multiple instances with the same name are *not* allowed and can *not* safely - access the same data on disk.. Also used to create the . - Initializer allows you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization for . - You must provide both serializer and deserializer, or opt-out to default implementation providing nil values. - - @see name - @param name The name of the cache. - @param rootPath The path of the cache on disk. - @param serializer A block used to serialize object before writing to disk. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object read from disk. If nil provided, default NSKeyedUnarchiver serialized will be used. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(NSString *)name - rootPath:(NSString *)rootPath - serializer:(nullable PINDiskCacheSerializerBlock)serializer - deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer; - -/** - Multiple instances with the same name are *not* allowed and can *not* safely - access the same data on disk. Also used to create the . - Initializer allows you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization for . - You must provide both serializer and deserializer, or opt-out to default implementation providing nil values. - - @see name - @param name The name of the cache. - @param rootPath The path of the cache on disk. - @param serializer A block used to serialize object before writing to disk. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object read from disk. If nil provided, default NSKeyedUnarchiver serialized will be used. - @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used - @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name - rootPath:(nonnull NSString *)rootPath - serializer:(nullable PINDiskCacheSerializerBlock)serializer - deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder; - -/** - Multiple instances with the same name are *not* allowed and can *not* safely - access the same data on disk. Also used to create the . - Initializer allows you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization for . - You must provide both serializer and deserializer, or opt-out to default implementation providing nil values. - - @see name - @param name The name of the cache. - @param rootPath The path of the cache on disk. - @param serializer A block used to serialize object before writing to disk. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object read from disk. If nil provided, default NSKeyedUnarchiver serialized will be used. - @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used - @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used - @param ttlCache Whether or not the cache should behave as a TTL cache. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name - rootPath:(nonnull NSString *)rootPath - serializer:(nullable PINDiskCacheSerializerBlock)serializer - deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder - ttlCache:(BOOL)ttlCache NS_DESIGNATED_INITIALIZER; - -@end - -@interface PINCache (Deprecated) -- (void)containsObjectForKey:(NSString *)key block:(PINCacheObjectContainmentBlock)block __attribute__((deprecated)); -- (void)objectForKey:(NSString *)key block:(PINCacheObjectBlock)block __attribute__((deprecated)); -- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); -- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); -- (void)removeObjectForKey:(NSString *)key block:(nullable PINCacheObjectBlock)block __attribute__((deprecated)); -- (void)trimToDate:(NSDate *)date block:(nullable PINCacheBlock)block __attribute__((deprecated)); -- (void)removeAllObjects:(nullable PINCacheBlock)block __attribute__((deprecated)); -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINCache/Source/PINCache.m b/Example/Pods/PINCache/Source/PINCache.m deleted file mode 100644 index b52f1f63..00000000 --- a/Example/Pods/PINCache/Source/PINCache.m +++ /dev/null @@ -1,420 +0,0 @@ -// PINCache is a modified version of PINCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import "PINCache.h" - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -static NSString * const PINCachePrefix = @"com.pinterest.PINCache"; -static NSString * const PINCacheSharedName = @"PINCacheShared"; - -@interface PINCache () -@property (copy, nonatomic) NSString *name; -@property (strong, nonatomic) PINOperationQueue *operationQueue; -@end - -@implementation PINCache - -#pragma mark - Initialization - - -- (instancetype)init -{ - @throw [NSException exceptionWithName:@"Must initialize with a name" reason:@"PINCache must be initialized with a name. Call initWithName: instead." userInfo:nil]; - return [self initWithName:@""]; -} - -- (instancetype)initWithName:(NSString *)name -{ - return [self initWithName:name rootPath:[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]]; -} - -- (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath -{ - return [self initWithName:name rootPath:rootPath serializer:nil deserializer:nil]; -} - -- (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath serializer:(PINDiskCacheSerializerBlock)serializer deserializer:(PINDiskCacheDeserializerBlock)deserializer { - return [self initWithName:name rootPath:rootPath serializer:serializer deserializer:deserializer keyEncoder:nil keyDecoder:nil]; -} - -- (instancetype)initWithName:(NSString *)name - rootPath:(NSString *)rootPath - serializer:(PINDiskCacheSerializerBlock)serializer - deserializer:(PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(PINDiskCacheKeyDecoderBlock)keyDecoder -{ - return [self initWithName:name rootPath:rootPath serializer:serializer deserializer:deserializer keyEncoder:keyEncoder keyDecoder:keyDecoder ttlCache:NO]; -} - -- (instancetype)initWithName:(NSString *)name - rootPath:(NSString *)rootPath - serializer:(PINDiskCacheSerializerBlock)serializer - deserializer:(PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(PINDiskCacheKeyDecoderBlock)keyDecoder - ttlCache:(BOOL)ttlCache -{ - if (!name) - return nil; - - if (self = [super init]) { - _name = [name copy]; - - //10 may actually be a bit high, but currently much of our threads are blocked on empyting the trash. Until we can resolve that, lets bump this up. - _operationQueue = [[PINOperationQueue alloc] initWithMaxConcurrentOperations:10]; - _diskCache = [[PINDiskCache alloc] initWithName:_name - prefix:PINDiskCachePrefix - rootPath:rootPath - serializer:serializer - deserializer:deserializer - keyEncoder:keyEncoder - keyDecoder:keyDecoder - operationQueue:_operationQueue - ttlCache:ttlCache]; - _memoryCache = [[PINMemoryCache alloc] initWithName:_name operationQueue:_operationQueue ttlCache:ttlCache]; - } - return self; -} - -- (NSString *)description -{ - return [[NSString alloc] initWithFormat:@"%@.%@.%p", PINCachePrefix, _name, (void *)self]; -} - -+ (PINCache *)sharedCache -{ - static PINCache *cache; - static dispatch_once_t predicate; - - dispatch_once(&predicate, ^{ - cache = [[PINCache alloc] initWithName:PINCacheSharedName]; - }); - - return cache; -} - -#pragma mark - Public Asynchronous Methods - - -- (void)containsObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectContainmentBlock)block -{ - if (!key || !block) { - return; - } - - [self.operationQueue scheduleOperation:^{ - BOOL containsObject = [self containsObjectForKey:key]; - block(containsObject); - }]; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wshadow" - -- (void)objectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block -{ - if (!key || !block) - return; - - [self.operationQueue scheduleOperation:^{ - [self->_memoryCache objectForKeyAsync:key completion:^(id memoryCache, NSString *memoryCacheKey, id memoryCacheObject) { - if (memoryCacheObject) { - // Update file modification date. TODO: make this a separate method? - [self->_diskCache fileURLForKeyAsync:memoryCacheKey completion:^(NSString * _Nonnull key, NSURL * _Nullable fileURL) {}]; - [self->_operationQueue scheduleOperation:^{ - block(self, memoryCacheKey, memoryCacheObject); - }]; - } else { - [self->_diskCache objectForKeyAsync:memoryCacheKey completion:^(PINDiskCache *diskCache, NSString *diskCacheKey, id diskCacheObject) { - - [self->_memoryCache setObjectAsync:diskCacheObject forKey:diskCacheKey completion:nil]; - - [self->_operationQueue scheduleOperation:^{ - block(self, diskCacheKey, diskCacheObject); - }]; - }]; - } - }]; - }]; -} - -#pragma clang diagnostic pop - -- (void)setObjectAsync:(id )object forKey:(NSString *)key completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:0 completion:block]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:0 ageLimit:ageLimit completion:block]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:cost ageLimit:0.0 completion:block]; -} - -- (void)setObjectAsync:(nonnull id)object forKey:(nonnull NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit completion:(nullable PINCacheObjectBlock)block -{ - if (!key || !object) - return; - - PINOperationGroup *group = [PINOperationGroup asyncOperationGroupWithQueue:_operationQueue]; - - [group addOperation:^{ - [self->_memoryCache setObject:object forKey:key withCost:cost ageLimit:ageLimit]; - }]; - [group addOperation:^{ - [self->_diskCache setObject:object forKey:key withAgeLimit:ageLimit]; - }]; - - if (block) { - [group setCompletion:^{ - block(self, key, object); - }]; - } - - [group start]; -} - -- (void)removeObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block -{ - if (!key) - return; - - PINOperationGroup *group = [PINOperationGroup asyncOperationGroupWithQueue:_operationQueue]; - - [group addOperation:^{ - [self->_memoryCache removeObjectForKey:key]; - }]; - [group addOperation:^{ - [self->_diskCache removeObjectForKey:key]; - }]; - - if (block) { - [group setCompletion:^{ - block(self, key, nil); - }]; - } - - [group start]; -} - -- (void)removeAllObjectsAsync:(PINCacheBlock)block -{ - PINOperationGroup *group = [PINOperationGroup asyncOperationGroupWithQueue:_operationQueue]; - - [group addOperation:^{ - [self->_memoryCache removeAllObjects]; - }]; - [group addOperation:^{ - [self->_diskCache removeAllObjects]; - }]; - - if (block) { - [group setCompletion:^{ - block(self); - }]; - } - - [group start]; -} - -- (void)trimToDateAsync:(NSDate *)date completion:(PINCacheBlock)block -{ - if (!date) - return; - - PINOperationGroup *group = [PINOperationGroup asyncOperationGroupWithQueue:_operationQueue]; - - [group addOperation:^{ - [self->_memoryCache trimToDate:date]; - }]; - [group addOperation:^{ - [self->_diskCache trimToDate:date]; - }]; - - if (block) { - [group setCompletion:^{ - block(self); - }]; - } - - [group start]; -} - -- (void)removeExpiredObjectsAsync:(PINCacheBlock)block -{ - PINOperationGroup *group = [PINOperationGroup asyncOperationGroupWithQueue:_operationQueue]; - - [group addOperation:^{ - [self->_memoryCache removeExpiredObjects]; - }]; - [group addOperation:^{ - [self->_diskCache removeExpiredObjects]; - }]; - - if (block) { - [group setCompletion:^{ - block(self); - }]; - } - - [group start]; -} - -#pragma mark - Public Synchronous Accessors - - -- (NSUInteger)diskByteCount -{ - __block NSUInteger byteCount = 0; - - [_diskCache synchronouslyLockFileAccessWhileExecutingBlock:^(id diskCache) { - byteCount = ((PINDiskCache *)diskCache).byteCount; - }]; - - return byteCount; -} - -- (BOOL)containsObjectForKey:(NSString *)key -{ - if (!key) - return NO; - - return [_memoryCache containsObjectForKey:key] || [_diskCache containsObjectForKey:key]; -} - -- (nullable id)objectForKey:(NSString *)key -{ - if (!key) - return nil; - - __block id object = nil; - - object = [_memoryCache objectForKey:key]; - - if (object) { - // Update file modification date. TODO: make this a separate method? - [_diskCache fileURLForKeyAsync:key completion:^(NSString * _Nonnull key, NSURL * _Nullable fileURL) {}]; - } else { - object = [_diskCache objectForKey:key]; - [_memoryCache setObject:object forKey:key]; - } - - return object; -} - -- (void)setObject:(id )object forKey:(NSString *)key -{ - [self setObject:object forKey:key withCost:0]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit -{ - [self setObject:object forKey:key withCost:0 ageLimit:ageLimit]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost -{ - [self setObject:object forKey:key withCost:cost ageLimit:0.0]; -} - -- (void)setObject:(nullable id)object forKey:(nonnull NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit -{ - if (!key || !object) - return; - - [_memoryCache setObject:object forKey:key withCost:cost ageLimit:ageLimit]; - [_diskCache setObject:object forKey:key withAgeLimit:ageLimit]; -} - -- (nullable id)objectForKeyedSubscript:(NSString *)key -{ - return [self objectForKey:key]; -} - -- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key -{ - if (obj == nil) { - [self removeObjectForKey:key]; - } else { - [self setObject:obj forKey:key]; - } -} - -- (void)removeObjectForKey:(NSString *)key -{ - if (!key) - return; - - [_memoryCache removeObjectForKey:key]; - [_diskCache removeObjectForKey:key]; -} - -- (void)trimToDate:(NSDate *)date -{ - if (!date) - return; - - [_memoryCache trimToDate:date]; - [_diskCache trimToDate:date]; -} - -- (void)removeExpiredObjects -{ - [_memoryCache removeExpiredObjects]; - [_diskCache removeExpiredObjects]; -} - -- (void)removeAllObjects -{ - [_memoryCache removeAllObjects]; - [_diskCache removeAllObjects]; -} - -@end - -@implementation PINCache (Deprecated) - -- (void)containsObjectForKey:(NSString *)key block:(PINCacheObjectContainmentBlock)block -{ - [self containsObjectForKeyAsync:key completion:block]; -} - -- (void)objectForKey:(NSString *)key block:(PINCacheObjectBlock)block -{ - [self objectForKeyAsync:key completion:block]; -} - -- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key completion:block]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:cost completion:block]; -} - -- (void)removeObjectForKey:(NSString *)key block:(nullable PINCacheObjectBlock)block -{ - [self removeObjectForKeyAsync:key completion:block]; -} - -- (void)trimToDate:(NSDate *)date block:(nullable PINCacheBlock)block -{ - [self trimToDateAsync:date completion:block]; -} - -- (void)removeAllObjects:(nullable PINCacheBlock)block -{ - [self removeAllObjectsAsync:block]; -} - -@end diff --git a/Example/Pods/PINCache/Source/PINCacheMacros.h b/Example/Pods/PINCache/Source/PINCacheMacros.h deleted file mode 100644 index e7179a17..00000000 --- a/Example/Pods/PINCache/Source/PINCacheMacros.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// PINCacheMacros.h -// PINCache -// -// Created by Adlai Holler on 1/31/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#ifndef PIN_SUBCLASSING_RESTRICTED -#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -#define PIN_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted)) -#else -#define PIN_SUBCLASSING_RESTRICTED -#endif // #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -#endif // #ifndef PIN_SUBCLASSING_RESTRICTED - -#ifndef PIN_NOESCAPE -#if defined(__has_attribute) && __has_attribute(noescape) -#define PIN_NOESCAPE __attribute__((noescape)) -#else -#define PIN_NOESCAPE -#endif // #if defined(__has_attribute) && __has_attribute(noescape) -#endif // #ifndef PIN_NOESCAPE diff --git a/Example/Pods/PINCache/Source/PINCacheObjectSubscripting.h b/Example/Pods/PINCache/Source/PINCacheObjectSubscripting.h deleted file mode 100644 index a7bd20b4..00000000 --- a/Example/Pods/PINCache/Source/PINCacheObjectSubscripting.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// PINCacheObjectSubscripting.h -// PINCache -// -// Created by Rocir Marcos Leite Santiago on 4/2/16. -// Copyright © 2016 Pinterest. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol PINCacheObjectSubscripting - -@required - -/** - This method enables using literals on the receiving object, such as `id object = cache[@"key"];`. - - @param key The key associated with the object. - @result The object for the specified key. - */ -- (nullable id)objectForKeyedSubscript:(NSString *)key; - -/** - This method enables using literals on the receiving object, such as `cache[@"key"] = object;`. - - @param object An object to be assigned for the key. Pass `nil` to remove the existing object for this key. - @param key A key to associate with the object. This string will be copied. - */ -- (void)setObject:(nullable id)object forKeyedSubscript:(NSString *)key; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINCache/Source/PINCaching.h b/Example/Pods/PINCache/Source/PINCaching.h deleted file mode 100644 index 326cd456..00000000 --- a/Example/Pods/PINCache/Source/PINCaching.h +++ /dev/null @@ -1,264 +0,0 @@ -// -// PINCaching.h -// PINCache -// -// Created by Michael Schneider on 1/31/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#pragma once -#import - - -NS_ASSUME_NONNULL_BEGIN - -@protocol PINCaching; - -/** - A callback block which provides only the cache as an argument - */ -typedef void (^PINCacheBlock)(__kindof id cache); - -/** - A callback block which provides the cache, key and object as arguments - */ -typedef void (^PINCacheObjectBlock)(__kindof id cache, NSString *key, id _Nullable object); - -/** - A callback block used for enumeration which provides the cache, key and object as arguments plus a stop flag that - may be flipped by the caller. - */ -typedef void (^PINCacheObjectEnumerationBlock)(__kindof id cache, NSString *key, id _Nullable object, BOOL *stop); - -/** - A callback block which provides a BOOL value as argument - */ -typedef void (^PINCacheObjectContainmentBlock)(BOOL containsObject); - -@protocol PINCaching - -#pragma mark - Core - -/** - The name of this cache, used to create a directory under Library/Caches and also appearing in stack traces. - */ -@property (readonly) NSString *name; - -#pragma mark - Asynchronous Methods - -/// @name Asynchronous Methods - -/** - This method determines whether an object is present for the given key in the cache. This method returns immediately - and executes the passed block after the object is available, potentially in parallel with other blocks on the - . - - @see containsObjectForKey: - @param key The key associated with the object. - @param block A block to be executed concurrently after the containment check happened - */ -- (void)containsObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectContainmentBlock)block; - -/** - Retrieves the object for the specified key. This method returns immediately and executes the passed - block after the object is available, potentially in parallel with other blocks on the . - - @param key The key associated with the requested object. - @param block A block to be executed concurrently when the object is available. - */ -- (void)objectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key. This method returns immediately and executes the - passed block after the object has been stored, potentially in parallel with other blocks on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id)object forKey:(NSString *)key completion:(nullable PINCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and the specified age limit. This method returns immediately - and executes the passed block after the object has been stored, potentially in parallel with other blocks - on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no object-level age limit and the - cache-level TTL will be used for this object. - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit completion:(nullable PINCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method returns immediately - and executes the passed block after the object has been stored, potentially in parallel with other blocks - on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(nullable PINCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and the specified memory cost and age limit. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method returns immediately - and executes the passed block after the object has been stored, potentially in parallel with other blocks - on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no object-level age limit and the cache-level TTL will be - used for this object. - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit completion:(nullable PINCacheObjectBlock)block; - -/** - Removes the object for the specified key. This method returns immediately and executes the passed - block after the object has been removed, potentially in parallel with other blocks on the . - - @param key The key associated with the object to be removed. - @param block A block to be executed concurrently after the object has been removed, or nil. - */ -- (void)removeObjectForKeyAsync:(NSString *)key completion:(nullable PINCacheObjectBlock)block; - -/** - Removes all objects from the cache that have not been used since the specified date. This method returns immediately and - executes the passed block after the cache has been trimmed, potentially in parallel with other blocks on the . - - @param date Objects that haven't been accessed since this date are removed from the cache. - @param block A block to be executed concurrently after the cache has been trimmed, or nil. - */ -- (void)trimToDateAsync:(NSDate *)date completion:(nullable PINCacheBlock)block; - -/** - Removes all expired objects from the cache. This includes objects that are considered expired due to the cache-level ageLimit - as well as object-level ageLimits. This method returns immediately and executes the passed block after the objects have been removed, - potentially in parallel with other blocks on the . - - @param block A block to be executed concurrently after the objects have been removed, or nil. - */ -- (void)removeExpiredObjectsAsync:(nullable PINCacheBlock)block; - -/** - Removes all objects from the cache.This method returns immediately and executes the passed block after the - cache has been cleared, potentially in parallel with other blocks on the . - - @param block A block to be executed concurrently after the cache has been cleared, or nil. - */ -- (void)removeAllObjectsAsync:(nullable PINCacheBlock)block; - - -#pragma mark - Synchronous Methods -/// @name Synchronous Methods - -/** - This method determines whether an object is present for the given key in the cache. - - @see containsObjectForKeyAsync:completion: - @param key The key associated with the object. - @result YES if an object is present for the given key in the cache, otherwise NO. - */ -- (BOOL)containsObjectForKey:(NSString *)key; - -/** - Retrieves the object for the specified key. This method blocks the calling thread until the object is available. - Uses a lock to achieve synchronicity on the disk cache. - - @see objectForKeyAsync:completion: - @param key The key associated with the object. - @result The object for the specified key. - */ -- (nullable id)objectForKey:(NSString *)key; - -/** - Stores an object in the cache for the specified key. This method blocks the calling thread until the object has been set. - Uses a lock to achieve synchronicity on the disk cache. - - @see setObjectAsync:forKey:completion: - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - */ -- (void)setObject:(nullable id)object forKey:(NSString *)key; - -/** - Stores an object in the cache for the specified key and age limit. This method blocks the calling thread until the - object has been set. Uses a lock to achieve synchronicity on the disk cache. - - @see setObjectAsync:forKey:completion: - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no - object-level age limit and the cache-level TTL will be used for this object. - */ -- (void)setObject:(nullable id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit; - -/** - Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method blocks the calling thread - until the object has been stored. - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - */ -- (void)setObject:(nullable id)object forKey:(NSString *)key withCost:(NSUInteger)cost; - -/** - Stores an object in the cache for the specified key and the specified memory cost and age limit. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method blocks the calling thread - until the object has been stored. - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no object-level age - limit and the cache-level TTL will be used for this object. - */ -- (void)setObject:(nullable id)object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit; - -/** - Removes the object for the specified key. This method blocks the calling thread until the object - has been removed. - Uses a lock to achieve synchronicity on the disk cache. - - @see removeObjectForKeyAsync:completion: - @param key The key associated with the object to be removed. - */ -- (void)removeObjectForKey:(NSString *)key; - -/** - Removes all objects from the cache that have not been used since the specified date. - This method blocks the calling thread until the cache has been trimmed. - Uses a lock to achieve synchronicity on the disk cache. - - @see trimToDateAsync:completion: - @param date Objects that haven't been accessed since this date are removed from the cache. - */ -- (void)trimToDate:(NSDate *)date; - -/** - Removes all expired objects from the cache. This includes objects that are considered expired due to the cache-level ageLimit - as well as object-level ageLimits. This method blocks the calling thread until the objects have been removed. - Uses a lock to achieve synchronicity on the disk cache. - */ -- (void)removeExpiredObjects; - -/** - Removes all objects from the cache. This method blocks the calling thread until the cache has been cleared. - Uses a lock to achieve synchronicity on the disk cache. - - @see removeAllObjectsAsync: - */ -- (void)removeAllObjects; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/Example/Pods/PINCache/Source/PINDiskCache.h b/Example/Pods/PINCache/Source/PINDiskCache.h deleted file mode 100644 index 81bb26a4..00000000 --- a/Example/Pods/PINCache/Source/PINDiskCache.h +++ /dev/null @@ -1,592 +0,0 @@ -// PINCache is a modified version of TMCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import - -#import "PINCacheMacros.h" -#import "PINCaching.h" -#import "PINCacheObjectSubscripting.h" - -NS_ASSUME_NONNULL_BEGIN - -@class PINDiskCache; -@class PINOperationQueue; - -extern NSString * const PINDiskCacheErrorDomain; -extern NSErrorUserInfoKey const PINDiskCacheErrorReadFailureCodeKey; -extern NSErrorUserInfoKey const PINDiskCacheErrorWriteFailureCodeKey; -extern NSString * const PINDiskCachePrefix; - -typedef NS_ENUM(NSInteger, PINDiskCacheError) { - PINDiskCacheErrorReadFailure = -1000, - PINDiskCacheErrorWriteFailure = -1001, -}; - -/** - A callback block which provides the cache, key and object as arguments - */ -typedef void (^PINDiskCacheObjectBlock)(PINDiskCache *cache, NSString *key, id _Nullable object); - -/** - A callback block which provides the key and fileURL of the object - */ -typedef void (^PINDiskCacheFileURLBlock)(NSString *key, NSURL * _Nullable fileURL); - -/** - A callback block used for enumeration which provides the key and fileURL of the object plus a stop flag that - may be flipped by the caller. - */ -typedef void (^PINDiskCacheFileURLEnumerationBlock)(NSString *key, NSURL * _Nullable fileURL, BOOL *stop); - -/** - A callback block which provides a BOOL value as argument - */ -typedef void (^PINDiskCacheContainsBlock)(BOOL containsObject); - -/** - * A block used to serialize object before writing to disk - * - * @param object Object to serialize - * @param key The key associated with the object - * - * @return Serialized object representation - */ -typedef NSData* _Nonnull(^PINDiskCacheSerializerBlock)(id object, NSString *key); - -/** - * A block used to deserialize objects - * - * @param data Serialized object data - * @param key The key associated with the object - * - * @return Deserialized object - */ -typedef id _Nonnull(^PINDiskCacheDeserializerBlock)(NSData* data, NSString *key); - -/** - * A block used to encode keys - * - * @param decodedKey Original/decoded key - * - * @return encoded key - */ -typedef NSString *_Nonnull(^PINDiskCacheKeyEncoderBlock)(NSString *decodedKey); - -/** - * A block used to decode keys - * - * @param encodedKey An encoded key - * - * @return decoded key - */ -typedef NSString *_Nonnull(^PINDiskCacheKeyDecoderBlock)(NSString *encodedKey); - - -/** - `PINDiskCache` is a thread safe key/value store backed by the file system. It accepts any object conforming - to the `NSCoding` protocol, which includes the basic Foundation data types and collection classes and also - many UIKit classes, notably `UIImage`. All work is performed on a serial queue shared by all instances in - the app, and archiving is handled by `NSKeyedArchiver`. This is a particular advantage for `UIImage` because - it skips `UIImagePNGRepresentation()` and retains information like scale and orientation. - - The designated initializer for `PINDiskCache` is . The string is used to create a directory - under Library/Caches that scopes disk access for this instance. Multiple instances with the same name are *not* - allowed as they would conflict with each other. - - Unless otherwise noted, all properties and methods are safe to access from any thread at any time. All blocks - will cause the queue to wait, making it safe to access and manipulate the actual cache files on disk for the - duration of the block. - - Because this cache is bound by disk I/O it can be much slower than , although values stored in - `PINDiskCache` persist after application relaunch. Using is recommended over using `PINDiskCache` - by itself, as it adds a fast layer of additional memory caching while still writing to disk. - - All access to the cache is dated so the that the least-used objects can be trimmed first. Setting an optional - will trigger a GCD timer to periodically to trim the cache with . - */ - -PIN_SUBCLASSING_RESTRICTED -@interface PINDiskCache : NSObject - -#pragma mark - Class - -/** - @param rootPath The path for where the cache should be stored. - @param prefix The prefix for the cache name. - @param name The name of the cache. - @result The full URL of the cache. - */ -+ (NSURL *)cacheURLWithRootPath:(NSString *)rootPath prefix:(NSString *)prefix name:(NSString *)name; - -#pragma mark - Properties -/// @name Core - -/** - The prefix to the name of this cache, used to create a directory under Library/Caches and also appearing in stack traces. - */ -@property (readonly) NSString *prefix; - -/** - The URL of the directory used by this cache, usually `Library/Caches/com.pinterest.PINDiskCache.(name)` - - @warning Do not interact with files under this URL except in or - . - */ -@property (readonly) NSURL *cacheURL; - -/** - The total number of bytes used on disk, as reported by `NSURLTotalFileAllocatedSizeKey`. - - @warning This property should only be read from a call to or - its asynchronous equivalent - - For example: - - // some background thread - - __block NSUInteger byteCount = 0; - - [_diskCache synchronouslyLockFileAccessWhileExecutingBlock:^(PINDiskCache *diskCache) { - byteCount = diskCache.byteCount; - }]; - */ -@property (readonly) NSUInteger byteCount; - -/** - The maximum number of bytes allowed on disk. This value is checked every time an object is set, if the written - size exceeds the limit a trim call is queued. Defaults to 50MB. - - */ -@property (assign) NSUInteger byteLimit; - -/** - The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value - greater than `0.0` will start a recurring GCD timer with the same period that calls . - Setting it back to `0.0` will stop the timer. Defaults to 30 days. - - */ -@property (assign) NSTimeInterval ageLimit; - -/** - The writing protection option used when writing a file on disk. This value is used every time an object is set. - NSDataWritingAtomic and NSDataWritingWithoutOverwriting are ignored if set - Defaults to NSDataWritingFileProtectionNone. - - @warning Only new files are affected by the new writing protection. If you need all files to be affected, - you'll have to purge and set the objects back to the cache - - Only available on iOS - */ -#if TARGET_OS_IPHONE -@property (assign) NSDataWritingOptions writingProtectionOption; -#endif - -/** - If ttlCache is YES, the cache behaves like a ttlCache. This means that once an object enters the - cache, it only lives as long as self.ageLimit. This has the following implications: - - Accessing an object in the cache does not extend that object's lifetime in the cache - - When attempting to access an object in the cache that has lived longer than self.ageLimit, - the cache will behave as if the object does not exist - - @note If an object-level age limit is set via one of the @c -setObject:forKey:withAgeLimit methods, - that age limit overrides self.ageLimit. The overridden object age limit could be greater or less - than self.agelimit but must be greater than zero. - - */ -@property (nonatomic, readonly, getter=isTTLCache) BOOL ttlCache; - -#pragma mark - Event Blocks -/// @name Event Blocks - -/** - A block to be executed just before an object is added to the cache. The queue waits during execution. - */ -@property (nullable, copy) PINDiskCacheObjectBlock willAddObjectBlock; - -/** - A block to be executed just before an object is removed from the cache. The queue waits during execution. - */ -@property (nullable, copy) PINDiskCacheObjectBlock willRemoveObjectBlock; - -/** - A block to be executed just before all objects are removed from the cache as a result of . - The queue waits during execution. - */ -@property (nullable, copy) PINCacheBlock willRemoveAllObjectsBlock; - -/** - A block to be executed just after an object is added to the cache. The queue waits during execution. - */ -@property (nullable, copy) PINDiskCacheObjectBlock didAddObjectBlock; - -/** - A block to be executed just after an object is removed from the cache. The queue waits during execution. - */ -@property (nullable, copy) PINDiskCacheObjectBlock didRemoveObjectBlock; - -/** - A block to be executed just after all objects are removed from the cache as a result of . - The queue waits during execution. - */ -@property (nullable, copy) PINCacheBlock didRemoveAllObjectsBlock; - -#pragma mark - Lifecycle -/// @name Initialization - -/** - A shared cache. - - @result The shared singleton cache instance. - */ -@property (class, readonly, strong) PINDiskCache *sharedCache; - -/** - Empties the trash with `DISPATCH_QUEUE_PRIORITY_BACKGROUND`. Does not use lock. - */ -+ (void)emptyTrash; - -- (instancetype)init NS_UNAVAILABLE; - -/** - Multiple instances with the same name are *not* allowed as they would conflict - with each other. - - @see name - @param name The name of the cache. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name; - -/** - Multiple instances with the same name are *not* allowed as they would conflict - with each other. - - @see name - @param name The name of the cache. - @param rootPath The path of the cache. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath; - -/** - @see name - @param name The name of the cache. - @param rootPath The path of the cache. - @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath serializer:(nullable PINDiskCacheSerializerBlock)serializer deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer; - -/** - @see name - @param name The name of the cache. - @param rootPath The path of the cache. - @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. - @param operationQueue A PINOperationQueue to run asynchronous operations - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath serializer:(nullable PINDiskCacheSerializerBlock)serializer deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer operationQueue:(nonnull PINOperationQueue *)operationQueue __attribute__((deprecated)); - -/** - @see name - @param name The name of the cache. - @param prefix The prefix for the cache name. Defaults to com.pinterest.PINDiskCache - @param rootPath The path of the cache. - @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. - @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used - @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used - @param operationQueue A PINOperationQueue to run asynchronous operations - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name - prefix:(nonnull NSString *)prefix - rootPath:(nonnull NSString *)rootPath - serializer:(nullable PINDiskCacheSerializerBlock)serializer - deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder - operationQueue:(nonnull PINOperationQueue *)operationQueue; - -/** - The designated initializer allowing you to override default NSKeyedArchiver/NSKeyedUnarchiver serialization. - - @see name - @param name The name of the cache. - @param prefix The prefix for the cache name. Defaults to com.pinterest.PINDiskCache - @param rootPath The path of the cache. - @param serializer A block used to serialize object. If nil provided, default NSKeyedArchiver serialized will be used. - @param deserializer A block used to deserialize object. If nil provided, default NSKeyedUnarchiver serialized will be used. - @param keyEncoder A block used to encode key(filename). If nil provided, default url encoder will be used - @param keyDecoder A block used to decode key(filename). If nil provided, default url decoder will be used - @param operationQueue A PINOperationQueue to run asynchronous operations - @param ttlCache Whether or not the cache should behave as a TTL cache. - @result A new cache with the specified name. - */ -- (instancetype)initWithName:(nonnull NSString *)name - prefix:(nonnull NSString *)prefix - rootPath:(nonnull NSString *)rootPath - serializer:(nullable PINDiskCacheSerializerBlock)serializer - deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder - operationQueue:(nonnull PINOperationQueue *)operationQueue - ttlCache:(BOOL)ttlCache NS_DESIGNATED_INITIALIZER; - -#pragma mark - Asynchronous Methods -/// @name Asynchronous Methods -/** - Locks access to ivars and allows safe interaction with files on disk. This method returns immediately. - - @warning Calling synchronous methods on the diskCache inside this block will likely cause a deadlock. - - @param block A block to be executed when a lock is available. - */ -- (void)lockFileAccessWhileExecutingBlockAsync:(PINCacheBlock)block; - -/** - Retrieves the object for the specified key. This method returns immediately and executes the passed - block as soon as the object is available. - - @param key The key associated with the requested object. - @param block A block to be executed serially when the object is available. - */ -- (void)objectForKeyAsync:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; - -/** - Retrieves the fileURL for the specified key without actually reading the data from disk. This method - returns immediately and executes the passed block as soon as the object is available. - - @warning Access is protected for the duration of the block, but to maintain safe disk access do not - access this fileURL after the block has ended. - - @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache - or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is - *not* passed the instance of the disk cache. You should also avoid doing extensive work while this - lock is held. - - @param key The key associated with the requested object. - @param block A block to be executed serially when the file URL is available. - */ -- (void)fileURLForKeyAsync:(NSString *)key completion:(PINDiskCacheFileURLBlock)block; - -/** - Stores an object in the cache for the specified key. This method returns immediately and executes the - passed block as soon as the object has been stored. - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param block A block to be executed serially after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id )object forKey:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and age limit. This method returns immediately and executes the - passed block as soon as the object has been stored. - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no object-level age limit and the cache-level TTL - will be used for this object. - @param block A block to be executed serially after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit completion:(nullable PINDiskCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and the specified memory cost. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method returns immediately - and executes the passed block after the object has been stored, potentially in parallel with other blocks - on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(nullable PINCacheObjectBlock)block; - -/** - Stores an object in the cache for the specified key and the specified memory cost and age limit. If the cost causes the total - to go over the the cache is trimmed (oldest objects first). This method returns immediately - and executes the passed block after the object has been stored, potentially in parallel with other blocks - on the . - - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param cost An amount to add to the . - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is no object-level age limit and the cache-level TTL will be used for - this object. - @param block A block to be executed concurrently after the object has been stored, or nil. - */ -- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit completion:(nullable PINCacheObjectBlock)block; - -/** - Removes the object for the specified key. This method returns immediately and executes the passed block - as soon as the object has been removed. - - @param key The key associated with the object to be removed. - @param block A block to be executed serially after the object has been removed, or nil. - */ -- (void)removeObjectForKeyAsync:(NSString *)key completion:(nullable PINDiskCacheObjectBlock)block; - -/** - Removes objects from the cache, largest first, until the cache is equal to or smaller than the specified byteCount. - This method returns immediately and executes the passed block as soon as the cache has been trimmed. - - @param byteCount The cache will be trimmed equal to or smaller than this size. - @param block A block to be executed serially after the cache has been trimmed, or nil. - */ -- (void)trimToSizeAsync:(NSUInteger)byteCount completion:(nullable PINCacheBlock)block; - -/** - Removes objects from the cache, ordered by date (least recently used first), until the cache is equal to or smaller - than the specified byteCount. This method returns immediately and executes the passed block as soon as the cache has - been trimmed. - - @param byteCount The cache will be trimmed equal to or smaller than this size. - @param block A block to be executed serially after the cache has been trimmed, or nil. - - @note This will not remove objects that have been added via one of the @c -setObject:forKey:withAgeLimit methods. - */ -- (void)trimToSizeByDateAsync:(NSUInteger)byteCount completion:(nullable PINCacheBlock)block; - -/** - Loops through all objects in the cache (reads and writes are suspended during the enumeration). Data is not actually - read from disk, the `object` parameter of the block will be `nil` but the `fileURL` will be available. - This method returns immediately. - - @param block A block to be executed for every object in the cache. - @param completionBlock An optional block to be executed after the enumeration is complete. - - @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache - or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is - *not* passed the instance of the disk cache. You should also avoid doing extensive work while this - lock is held. - - */ -- (void)enumerateObjectsWithBlockAsync:(PINDiskCacheFileURLEnumerationBlock)block completionBlock:(nullable PINCacheBlock)completionBlock; - -#pragma mark - Synchronous Methods -/// @name Synchronous Methods - -/** - Locks access to ivars and allows safe interaction with files on disk. This method only returns once the block - has been run. - - @warning Calling synchronous methods on the diskCache inside this block will likely cause a deadlock. - - @param block A block to be executed when a lock is available. - */ -- (void)synchronouslyLockFileAccessWhileExecutingBlock:(PIN_NOESCAPE PINCacheBlock)block; - -/** - Retrieves the object for the specified key. This method blocks the calling thread until the - object is available. - - @see objectForKeyAsync:completion: - @param key The key associated with the object. - @result The object for the specified key. - */ -- (nullable id )objectForKey:(NSString *)key; - -/** - Retrieves the file URL for the specified key. This method blocks the calling thread until the - url is available. Do not use this URL anywhere except with . This method probably - shouldn't even exist, just use the asynchronous one. - - @see fileURLForKeyAsync:completion: - @param key The key associated with the object. - @result The file URL for the specified key. - */ -- (nullable NSURL *)fileURLForKey:(nullable NSString *)key; - -/** - Stores an object in the cache for the specified key. This method blocks the calling thread until - the object has been stored. - - @see setObjectAsync:forKey:completion: - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - */ -- (void)setObject:(nullable id )object forKey:(NSString *)key; - -/** - Stores an object in the cache for the specified key and age limit. This method blocks the calling thread until - the object has been stored. - - @see setObjectAsync:forKey:completion: - @param object An object to store in the cache. - @param key A key to associate with the object. This string will be copied. - @param ageLimit The age limit (in seconds) to associate with the object. An age limit <= 0 means there is - no object-level age limit and the cache-level TTL will be used for this object. - */ -- (void)setObject:(nullable id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit; - -/** - Removes objects from the cache, largest first, until the cache is equal to or smaller than the - specified byteCount. This method blocks the calling thread until the cache has been trimmed. - - @see trimToSizeAsync: - @param byteCount The cache will be trimmed equal to or smaller than this size. - */ -- (void)trimToSize:(NSUInteger)byteCount; - -/** - Removes objects from the cache, ordered by date (least recently used first), until the cache is equal to or - smaller than the specified byteCount. This method blocks the calling thread until the cache has been trimmed. - - @see trimToSizeByDateAsync: - @param byteCount The cache will be trimmed equal to or smaller than this size. - - @note This will not remove objects that have been added via one of the @c -setObject:forKey:withAgeLimit methods. - */ -- (void)trimToSizeByDate:(NSUInteger)byteCount; - -/** - Loops through all objects in the cache (reads and writes are suspended during the enumeration). Data is not actually - read from disk, the `object` parameter of the block will be `nil` but the `fileURL` will be available. - This method blocks the calling thread until all objects have been enumerated. - - @see enumerateObjectsWithBlockAsync:completionBlock - @param block A block to be executed for every object in the cache. - - @warning Do not call this method within the event blocks (, etc.) - Instead use the asynchronous version, . - - @warning The PINDiskCache lock is held while block is executed. Any synchronous calls to the diskcache - or a cache which owns the instance of the disk cache are likely to cause a deadlock. This is why the block is - *not* passed the instance of the disk cache. You should also avoid doing extensive work while this - lock is held. - - */ -- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINDiskCacheFileURLEnumerationBlock)block; - -@end - - -#pragma mark - Deprecated - -/** - A callback block which provides only the cache as an argument - */ -typedef void (^PINDiskCacheBlock)(PINDiskCache *cache); - -@interface PINDiskCache (Deprecated) -- (void)lockFileAccessWhileExecutingBlock:(nullable PINCacheBlock)block __attribute__((deprecated)); -- (void)containsObjectForKey:(NSString *)key block:(PINDiskCacheContainsBlock)block __attribute__((deprecated)); -- (void)objectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); -- (void)fileURLForKey:(NSString *)key block:(nullable PINDiskCacheFileURLBlock)block __attribute__((deprecated)); -- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); -- (void)removeObjectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block __attribute__((deprecated)); -- (void)trimToDate:(NSDate *)date block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); -- (void)trimToSize:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); -- (void)trimToSizeByDate:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); -- (void)removeAllObjects:(nullable PINDiskCacheBlock)block __attribute__((deprecated)); -- (void)enumerateObjectsWithBlock:(PINDiskCacheFileURLBlock)block completionBlock:(nullable PINDiskCacheBlock)completionBlock __attribute__((deprecated)); -- (void)setTtlCache:(BOOL)ttlCache DEPRECATED_MSG_ATTRIBUTE("ttlCache is no longer a settable property and must now be set via initializer."); -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINCache/Source/PINDiskCache.m b/Example/Pods/PINCache/Source/PINDiskCache.m deleted file mode 100644 index f30a5ad7..00000000 --- a/Example/Pods/PINCache/Source/PINDiskCache.m +++ /dev/null @@ -1,1727 +0,0 @@ -// PINCache is a modified version of TMCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import "PINDiskCache.h" - -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0 -#import -#endif - -#import -#import - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#define PINDiskCacheError(error) if (error) { NSLog(@"%@ (%d) ERROR: %@", \ -[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \ -__LINE__, [error localizedDescription]); } - -#define PINDiskCacheException(exception) if (exception) { NSAssert(NO, [exception reason]); } - -const char * PINDiskCacheAgeLimitAttributeName = "com.pinterest.PINDiskCache.ageLimit"; -NSString * const PINDiskCacheErrorDomain = @"com.pinterest.PINDiskCache"; -NSErrorUserInfoKey const PINDiskCacheErrorReadFailureCodeKey = @"PINDiskCacheErrorReadFailureCodeKey"; -NSErrorUserInfoKey const PINDiskCacheErrorWriteFailureCodeKey = @"PINDiskCacheErrorWriteFailureCodeKey"; -NSString * const PINDiskCachePrefix = @"com.pinterest.PINDiskCache"; -static NSString * const PINDiskCacheSharedName = @"PINDiskCacheShared"; - -static NSString * const PINDiskCacheOperationIdentifierTrimToDate = @"PINDiskCacheOperationIdentifierTrimToDate"; -static NSString * const PINDiskCacheOperationIdentifierTrimToSize = @"PINDiskCacheOperationIdentifierTrimToSize"; -static NSString * const PINDiskCacheOperationIdentifierTrimToSizeByDate = @"PINDiskCacheOperationIdentifierTrimToSizeByDate"; - -typedef NS_ENUM(NSUInteger, PINDiskCacheCondition) { - PINDiskCacheConditionNotReady = 0, - PINDiskCacheConditionReady = 1, -}; - -static PINOperationDataCoalescingBlock PINDiskTrimmingSizeCoalescingBlock = ^id(NSNumber *existingSize, NSNumber *newSize) { - NSComparisonResult result = [existingSize compare:newSize]; - return (result == NSOrderedDescending) ? newSize : existingSize; -}; - -static PINOperationDataCoalescingBlock PINDiskTrimmingDateCoalescingBlock = ^id(NSDate *existingDate, NSDate *newDate) { - NSComparisonResult result = [existingDate compare:newDate]; - return (result == NSOrderedDescending) ? newDate : existingDate; -}; - -const char * PINDiskCacheFileSystemRepresentation(NSURL *url) -{ -#ifdef __MAC_10_13 // Xcode >= 9 - // -fileSystemRepresentation is available on macOS >= 10.9 - if (@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)) { - return url.fileSystemRepresentation; - } -#endif - return [url.path cStringUsingEncoding:NSUTF8StringEncoding]; -} - -@interface PINDiskCacheMetadata : NSObject -// When the object was added to the disk cache -@property (nonatomic, strong) NSDate *createdDate; -// Last time the object was accessed -@property (nonatomic, strong) NSDate *lastModifiedDate; -@property (nonatomic, strong) NSNumber *size; -// Age limit is used in conjuction with ttl -@property (nonatomic) NSTimeInterval ageLimit; -@end - -@interface PINDiskCache () { - PINDiskCacheSerializerBlock _serializer; - PINDiskCacheDeserializerBlock _deserializer; - - PINDiskCacheKeyEncoderBlock _keyEncoder; - PINDiskCacheKeyDecoderBlock _keyDecoder; -} - -@property (assign, nonatomic) pthread_mutex_t mutex; -@property (copy, nonatomic) NSString *name; -@property (assign) NSUInteger byteCount; -@property (strong, nonatomic) NSURL *cacheURL; -@property (strong, nonatomic) PINOperationQueue *operationQueue; -@property (strong, nonatomic) NSMutableDictionary *metadata; -@property (assign, nonatomic) pthread_cond_t diskWritableCondition; -@property (assign, nonatomic) BOOL diskWritable; -@property (assign, nonatomic) pthread_cond_t diskStateKnownCondition; -@property (assign, nonatomic) BOOL diskStateKnown; -@property (assign, nonatomic) BOOL writingProtectionOptionSet; -@end - -@implementation PINDiskCache - -static NSURL *_sharedTrashURL; - -@synthesize willAddObjectBlock = _willAddObjectBlock; -@synthesize willRemoveObjectBlock = _willRemoveObjectBlock; -@synthesize willRemoveAllObjectsBlock = _willRemoveAllObjectsBlock; -@synthesize didAddObjectBlock = _didAddObjectBlock; -@synthesize didRemoveObjectBlock = _didRemoveObjectBlock; -@synthesize didRemoveAllObjectsBlock = _didRemoveAllObjectsBlock; -@synthesize byteLimit = _byteLimit; -@synthesize ageLimit = _ageLimit; -@synthesize ttlCache = _ttlCache; - -#if TARGET_OS_IPHONE -@synthesize writingProtectionOption = _writingProtectionOption; -@synthesize writingProtectionOptionSet = _writingProtectionOptionSet; -#endif - -#pragma mark - Initialization - - -- (void)dealloc -{ - __unused int result = pthread_mutex_destroy(&_mutex); - NSCAssert(result == 0, @"Failed to destroy lock in PINDiskCache %p. Code: %d", (void *)self, result); - pthread_cond_destroy(&_diskWritableCondition); - pthread_cond_destroy(&_diskStateKnownCondition); -} - -- (instancetype)init -{ - @throw [NSException exceptionWithName:@"Must initialize with a name" reason:@"PINDiskCache must be initialized with a name. Call initWithName: instead." userInfo:nil]; - return [self initWithName:@""]; -} - -- (instancetype)initWithName:(NSString *)name -{ - return [self initWithName:name rootPath:[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]]; -} - -- (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath -{ - return [self initWithName:name rootPath:rootPath serializer:nil deserializer:nil]; -} - -- (instancetype)initWithName:(NSString *)name rootPath:(NSString *)rootPath serializer:(PINDiskCacheSerializerBlock)serializer deserializer:(PINDiskCacheDeserializerBlock)deserializer -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [self initWithName:name rootPath:rootPath serializer:serializer deserializer:deserializer operationQueue:[PINOperationQueue sharedOperationQueue]]; -#pragma clang diagnostic pop -} - -- (instancetype)initWithName:(NSString *)name - rootPath:(NSString *)rootPath - serializer:(PINDiskCacheSerializerBlock)serializer - deserializer:(PINDiskCacheDeserializerBlock)deserializer - operationQueue:(PINOperationQueue *)operationQueue -{ - return [self initWithName:name - prefix:PINDiskCachePrefix - rootPath:rootPath - serializer:serializer - deserializer:deserializer - keyEncoder:nil - keyDecoder:nil - operationQueue:operationQueue]; -} - -- (instancetype)initWithName:(NSString *)name - prefix:(NSString *)prefix - rootPath:(NSString *)rootPath - serializer:(PINDiskCacheSerializerBlock)serializer - deserializer:(PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(PINDiskCacheKeyDecoderBlock)keyDecoder - operationQueue:(PINOperationQueue *)operationQueue -{ - return [self initWithName:name prefix:prefix - rootPath:rootPath - serializer:serializer - deserializer:deserializer - keyEncoder:keyEncoder - keyDecoder:keyDecoder - operationQueue:operationQueue - ttlCache:NO]; -} - -- (instancetype)initWithName:(NSString *)name - prefix:(NSString *)prefix - rootPath:(NSString *)rootPath - serializer:(PINDiskCacheSerializerBlock)serializer - deserializer:(PINDiskCacheDeserializerBlock)deserializer - keyEncoder:(PINDiskCacheKeyEncoderBlock)keyEncoder - keyDecoder:(PINDiskCacheKeyDecoderBlock)keyDecoder - operationQueue:(PINOperationQueue *)operationQueue - ttlCache:(BOOL)ttlCache -{ - if (!name) { - return nil; - } - - NSAssert(((!serializer && !deserializer) || (serializer && deserializer)), - @"PINDiskCache must be initialized with a serializer AND deserializer."); - - NSAssert(((!keyEncoder && !keyDecoder) || (keyEncoder && keyDecoder)), - @"PINDiskCache must be initialized with an encoder AND decoder."); - - if (self = [super init]) { - __unused int result = pthread_mutex_init(&_mutex, NULL); - NSAssert(result == 0, @"Failed to init lock in PINDiskCache %@. Code: %d", self, result); - - _name = [name copy]; - _prefix = [prefix copy]; - _operationQueue = operationQueue; - _ttlCache = ttlCache; - _willAddObjectBlock = nil; - _willRemoveObjectBlock = nil; - _willRemoveAllObjectsBlock = nil; - _didAddObjectBlock = nil; - _didRemoveObjectBlock = nil; - _didRemoveAllObjectsBlock = nil; - - _byteCount = 0; - - // 50 MB by default - _byteLimit = 50 * 1024 * 1024; - // 30 days by default - _ageLimit = 60 * 60 * 24 * 30; - -#if TARGET_OS_IPHONE - _writingProtectionOptionSet = NO; - // This is currently the default for files, but we'd rather not write it if it's unspecified. - _writingProtectionOption = NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication; -#endif - - _metadata = [[NSMutableDictionary alloc] init]; - _diskStateKnown = NO; - - _cacheURL = [[self class] cacheURLWithRootPath:rootPath prefix:_prefix name:_name]; - - //setup serializers - if(serializer) { - _serializer = [serializer copy]; - } else { - _serializer = self.defaultSerializer; - } - - if(deserializer) { - _deserializer = [deserializer copy]; - } else { - _deserializer = self.defaultDeserializer; - } - - //setup key encoder/decoder - if(keyEncoder) { - _keyEncoder = [keyEncoder copy]; - } else { - _keyEncoder = self.defaultKeyEncoder; - } - - if(keyDecoder) { - _keyDecoder = [keyDecoder copy]; - } else { - _keyDecoder = self.defaultKeyDecoder; - } - - pthread_cond_init(&_diskWritableCondition, NULL); - pthread_cond_init(&_diskStateKnownCondition, NULL); - - //we don't want to do anything without setting up the disk cache, but we also don't want to block init, it can take a while to initialize. This must *not* be done on _operationQueue because other operations added may hold the lock and fill up the queue. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [self lock]; - [self _locked_createCacheDirectory]; - [self unlock]; - [self initializeDiskProperties]; - }); - } - return self; -} - -- (NSString *)description -{ - return [[NSString alloc] initWithFormat:@"%@.%@.%p", PINDiskCachePrefix, _name, (__bridge void *)self]; -} - -+ (PINDiskCache *)sharedCache -{ - static PINDiskCache *cache; - static dispatch_once_t predicate; - - dispatch_once(&predicate, ^{ - cache = [[PINDiskCache alloc] initWithName:PINDiskCacheSharedName]; - }); - - return cache; -} - -+ (NSURL *)cacheURLWithRootPath:(NSString *)rootPath prefix:(NSString *)prefix name:(NSString *)name -{ - NSString *pathComponent = [[NSString alloc] initWithFormat:@"%@.%@", prefix, name]; - return [NSURL fileURLWithPathComponents:@[ rootPath, pathComponent ]]; -} - -#pragma mark - Private Methods - - -- (NSURL *)encodedFileURLForKey:(NSString *)key -{ - if (![key length]) - return nil; - - //Significantly improve performance by indicating that the URL will *not* result in a directory. - //Also note that accessing _cacheURL is safe without the lock because it is only set on init. - return [_cacheURL URLByAppendingPathComponent:[self encodedString:key] isDirectory:NO]; -} - -- (NSString *)keyForEncodedFileURL:(NSURL *)url -{ - NSString *fileName = [url lastPathComponent]; - if (!fileName) - return nil; - - return [self decodedString:fileName]; -} - -- (NSString *)encodedString:(NSString *)string -{ - return _keyEncoder(string); -} - -- (NSString *)decodedString:(NSString *)string -{ - return _keyDecoder(string); -} - -- (PINDiskCacheSerializerBlock)defaultSerializer -{ - return ^NSData*(id object, NSString *key){ - if (@available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { - NSError *error = nil; - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object requiringSecureCoding:NO error:&error]; - PINDiskCacheError(error); - return data; - } else { - return [NSKeyedArchiver archivedDataWithRootObject:object]; - } - }; -} - -- (PINDiskCacheDeserializerBlock)defaultDeserializer -{ - return ^id(NSData * data, NSString *key){ - return [NSKeyedUnarchiver unarchiveObjectWithData:data]; - }; -} - -- (PINDiskCacheKeyEncoderBlock)defaultKeyEncoder -{ - return ^NSString *(NSString *decodedKey) { - if (![decodedKey length]) { - return @""; - } - - if (@available(macOS 10.9, iOS 7.0, tvOS 9.0, watchOS 2.0, *)) { - NSString *encodedString = [decodedKey stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@".:/%"] invertedSet]]; - return encodedString; - } else { - CFStringRef static const charsToEscape = CFSTR(".:/%"); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CFStringRef escapedString = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, - (__bridge CFStringRef)decodedKey, - NULL, - charsToEscape, - kCFStringEncodingUTF8); -#pragma clang diagnostic pop - - return (__bridge_transfer NSString *)escapedString; - } - }; -} - -- (PINDiskCacheKeyEncoderBlock)defaultKeyDecoder -{ - return ^NSString *(NSString *encodedKey) { - if (![encodedKey length]) { - return @""; - } - - if (@available(macOS 10.9, iOS 7.0, tvOS 9.0, watchOS 2.0, *)) { - return [encodedKey stringByRemovingPercentEncoding]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CFStringRef unescapedString = CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault, - (__bridge CFStringRef)encodedKey, - CFSTR(""), - kCFStringEncodingUTF8); -#pragma clang diagnostic pop - return (__bridge_transfer NSString *)unescapedString; - } - }; -} - - -#pragma mark - Private Trash Methods - - -+ (dispatch_queue_t)sharedTrashQueue -{ - static dispatch_queue_t trashQueue; - static dispatch_once_t predicate; - - dispatch_once(&predicate, ^{ - NSString *queueName = [[NSString alloc] initWithFormat:@"%@.trash", PINDiskCachePrefix]; - trashQueue = dispatch_queue_create([queueName UTF8String], DISPATCH_QUEUE_SERIAL); - dispatch_set_target_queue(trashQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)); - }); - - return trashQueue; -} - -+ (NSLock *)sharedLock -{ - static NSLock *sharedLock; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedLock = [NSLock new]; - }); - return sharedLock; -} - -+ (NSURL *)sharedTrashURL -{ - NSURL *trashURL = nil; - - [[PINDiskCache sharedLock] lock]; - if (_sharedTrashURL == nil) { - NSString *uniqueString = [[NSProcessInfo processInfo] globallyUniqueString]; - _sharedTrashURL = [[[NSURL alloc] initFileURLWithPath:NSTemporaryDirectory()] URLByAppendingPathComponent:uniqueString isDirectory:YES]; - - NSError *error = nil; - [[NSFileManager defaultManager] createDirectoryAtURL:_sharedTrashURL - withIntermediateDirectories:YES - attributes:nil - error:&error]; - PINDiskCacheError(error); - } - trashURL = _sharedTrashURL; - [[PINDiskCache sharedLock] unlock]; - - return trashURL; -} - -+ (BOOL)moveItemAtURLToTrash:(NSURL *)itemURL -{ - if (![[NSFileManager defaultManager] fileExistsAtPath:[itemURL path]]) - return NO; - - NSError *error = nil; - NSString *uniqueString = [[NSProcessInfo processInfo] globallyUniqueString]; - NSURL *uniqueTrashURL = [[PINDiskCache sharedTrashURL] URLByAppendingPathComponent:uniqueString isDirectory:NO]; - BOOL moved = [[NSFileManager defaultManager] moveItemAtURL:itemURL toURL:uniqueTrashURL error:&error]; - PINDiskCacheError(error); - return moved; -} - -+ (void)emptyTrash -{ - dispatch_async([PINDiskCache sharedTrashQueue], ^{ - NSURL *trashURL = nil; - - // If _sharedTrashURL is unset, there's nothing left to do because it hasn't been accessed and therefore items haven't been added to it. - // If it is set, we can just remove it. - // We also need to nil out _sharedTrashURL so that a new one will be created if there's an attempt to move a new file to the trash. - [[PINDiskCache sharedLock] lock]; - if (_sharedTrashURL != nil) { - trashURL = _sharedTrashURL; - _sharedTrashURL = nil; - } - [[PINDiskCache sharedLock] unlock]; - - if (trashURL != nil) { - NSError *removeTrashedItemError = nil; - [[NSFileManager defaultManager] removeItemAtURL:trashURL error:&removeTrashedItemError]; - PINDiskCacheError(removeTrashedItemError); - } - }); -} - -#pragma mark - Private Queue Methods - - -- (BOOL)_locked_createCacheDirectory -{ - BOOL created = NO; - if ([[NSFileManager defaultManager] fileExistsAtPath:[_cacheURL path]] == NO) { - NSError *error = nil; - created = [[NSFileManager defaultManager] createDirectoryAtURL:_cacheURL - withIntermediateDirectories:YES - attributes:nil - error:&error]; - PINDiskCacheError(error); - } - - - - // while this may not be true if success is false, it's better than deadlocking later. - _diskWritable = YES; - pthread_cond_broadcast(&_diskWritableCondition); - - return created; -} - -+ (NSArray *)resourceKeys -{ - static NSArray *resourceKeys = nil; - static dispatch_once_t predicate; - - dispatch_once(&predicate, ^{ - resourceKeys = @[ NSURLCreationDateKey, NSURLContentModificationDateKey, NSURLTotalFileAllocatedSizeKey ]; - }); - - return resourceKeys; -} - -/** - * @return File size in bytes. - */ -- (NSUInteger)_locked_initializeDiskPropertiesForFile:(NSURL *)fileURL fileKey:(NSString *)fileKey -{ - NSError *error = nil; - - NSDictionary *dictionary = [fileURL resourceValuesForKeys:[PINDiskCache resourceKeys] error:&error]; - PINDiskCacheError(error); - - if (_metadata[fileKey] == nil) { - _metadata[fileKey] = [[PINDiskCacheMetadata alloc] init]; - } - - NSDate *createdDate = dictionary[NSURLCreationDateKey]; - if (createdDate && fileKey) - _metadata[fileKey].createdDate = createdDate; - - NSDate *lastModifiedDate = dictionary[NSURLContentModificationDateKey]; - if (lastModifiedDate && fileKey) - _metadata[fileKey].lastModifiedDate = lastModifiedDate; - - NSNumber *fileSize = dictionary[NSURLTotalFileAllocatedSizeKey]; - if (fileSize) { - _metadata[fileKey].size = fileSize; - } - - if (_ttlCache) { - NSTimeInterval ageLimit; - ssize_t res = getxattr(PINDiskCacheFileSystemRepresentation(fileURL), PINDiskCacheAgeLimitAttributeName, &ageLimit, sizeof(NSTimeInterval), 0, 0); - if(res > 0) { - _metadata[fileKey].ageLimit = ageLimit; - } else if (res == -1) { - // Ignore if the extended attribute was never recorded for this file. - if (errno != ENOATTR) { - NSDictionary *userInfo = @{ PINDiskCacheErrorReadFailureCodeKey : @(errno)}; - error = [NSError errorWithDomain:PINDiskCacheErrorDomain code:PINDiskCacheErrorReadFailure userInfo:userInfo]; - PINDiskCacheError(error); - } - } - } - - return [fileSize unsignedIntegerValue]; -} - -- (void)initializeDiskProperties -{ - NSUInteger byteCount = 0; - - NSError *error = nil; - - [self lock]; - NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:_cacheURL - includingPropertiesForKeys:[PINDiskCache resourceKeys] - options:NSDirectoryEnumerationSkipsHiddenFiles - error:&error]; - [self unlock]; - - PINDiskCacheError(error); - - for (NSURL *fileURL in files) { - NSString *fileKey = [self keyForEncodedFileURL:fileURL]; - // Continually grab and release lock while processing files to avoid contention - [self lock]; - if (_metadata[fileKey] == nil) { - byteCount += [self _locked_initializeDiskPropertiesForFile:fileURL fileKey:fileKey]; - } - [self unlock]; - } - - [self lock]; - if (byteCount > 0) - _byteCount = byteCount; - - if (self->_byteLimit > 0 && self->_byteCount > self->_byteLimit) - [self trimToSizeByDateAsync:self->_byteLimit completion:nil]; - - if (self->_ttlCache) - [self removeExpiredObjectsAsync:nil]; - - _diskStateKnown = YES; - pthread_cond_broadcast(&_diskStateKnownCondition); - [self unlock]; -} - -- (void)asynchronouslySetFileModificationDate:(NSDate *)date forURL:(NSURL *)fileURL -{ - [self.operationQueue scheduleOperation:^{ - [self lockForWriting]; - [self _locked_setFileModificationDate:date forURL:fileURL]; - [self unlock]; - } withPriority:PINOperationQueuePriorityLow]; -} - -- (BOOL)_locked_setFileModificationDate:(NSDate *)date forURL:(NSURL *)fileURL -{ - if (!date || !fileURL) { - return NO; - } - - NSError *error = nil; - BOOL success = [[NSFileManager defaultManager] setAttributes:@{ NSFileModificationDate: date } - ofItemAtPath:[fileURL path] - error:&error]; - PINDiskCacheError(error); - - return success; -} - -- (void)asynchronouslySetAgeLimit:(NSTimeInterval)ageLimit forURL:(NSURL *)fileURL -{ - [self.operationQueue scheduleOperation:^{ - [self lockForWriting]; - [self _locked_setAgeLimit:ageLimit forURL:fileURL]; - [self unlock]; - } withPriority:PINOperationQueuePriorityLow]; -} - -- (BOOL)_locked_setAgeLimit:(NSTimeInterval)ageLimit forURL:(NSURL *)fileURL -{ - if (!fileURL) { - return NO; - } - - NSError *error = nil; - if (ageLimit <= 0.0) { - if (removexattr(PINDiskCacheFileSystemRepresentation(fileURL), PINDiskCacheAgeLimitAttributeName, 0) != 0) { - // Ignore if the extended attribute was never recorded for this file. - if (errno != ENOATTR) { - NSDictionary *userInfo = @{ PINDiskCacheErrorWriteFailureCodeKey : @(errno)}; - error = [NSError errorWithDomain:PINDiskCacheErrorDomain code:PINDiskCacheErrorWriteFailure userInfo:userInfo]; - PINDiskCacheError(error); - } - } - } else { - if (setxattr(PINDiskCacheFileSystemRepresentation(fileURL), PINDiskCacheAgeLimitAttributeName, &ageLimit, sizeof(NSTimeInterval), 0, 0) != 0) { - NSDictionary *userInfo = @{ PINDiskCacheErrorWriteFailureCodeKey : @(errno)}; - error = [NSError errorWithDomain:PINDiskCacheErrorDomain code:PINDiskCacheErrorWriteFailure userInfo:userInfo]; - PINDiskCacheError(error); - } - } - - if (!error) { - NSString *key = [self keyForEncodedFileURL:fileURL]; - if (key) { - _metadata[key].ageLimit = ageLimit; - } - } - - return !error; -} - -- (BOOL)removeFileAndExecuteBlocksForKey:(NSString *)key -{ - NSURL *fileURL = [self encodedFileURLForKey:key]; - if (!fileURL) { - return NO; - } - - // We only need to lock until writable at the top because once writable, always writable - [self lockForWriting]; - if (![[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) { - [self unlock]; - return NO; - } - - PINDiskCacheObjectBlock willRemoveObjectBlock = _willRemoveObjectBlock; - if (willRemoveObjectBlock) { - [self unlock]; - willRemoveObjectBlock(self, key, nil); - [self lock]; - } - - BOOL trashed = [PINDiskCache moveItemAtURLToTrash:fileURL]; - if (!trashed) { - [self unlock]; - return NO; - } - - [PINDiskCache emptyTrash]; - - NSNumber *byteSize = _metadata[key].size; - if (byteSize) - self.byteCount = _byteCount - [byteSize unsignedIntegerValue]; // atomic - - [_metadata removeObjectForKey:key]; - - PINDiskCacheObjectBlock didRemoveObjectBlock = _didRemoveObjectBlock; - if (didRemoveObjectBlock) { - [self unlock]; - _didRemoveObjectBlock(self, key, nil); - [self lock]; - } - - [self unlock]; - - return YES; -} - -- (void)trimDiskToSize:(NSUInteger)trimByteCount -{ - NSMutableArray *keysToRemove = nil; - - [self lockForWriting]; - if (_byteCount > trimByteCount) { - keysToRemove = [[NSMutableArray alloc] init]; - - NSArray *keysSortedBySize = [_metadata keysSortedByValueUsingComparator:^NSComparisonResult(PINDiskCacheMetadata * _Nonnull obj1, PINDiskCacheMetadata * _Nonnull obj2) { - return [obj1.size compare:obj2.size]; - }]; - - NSUInteger bytesSaved = 0; - for (NSString *key in [keysSortedBySize reverseObjectEnumerator]) { // largest objects first - [keysToRemove addObject:key]; - NSNumber *byteSize = _metadata[key].size; - if (byteSize) { - bytesSaved += [byteSize unsignedIntegerValue]; - } - if (_byteCount - bytesSaved <= trimByteCount) { - break; - } - } - } - [self unlock]; - - for (NSString *key in keysToRemove) { - [self removeFileAndExecuteBlocksForKey:key]; - } -} - -// This is the default trimming method which happens automatically -- (void)trimDiskToSizeByDate:(NSUInteger)trimByteCount -{ - if (self.isTTLCache) { - [self removeExpiredObjects]; - } - - NSMutableArray *keysToRemove = nil; - - [self lockForWriting]; - if (_byteCount > trimByteCount) { - keysToRemove = [[NSMutableArray alloc] init]; - - // last modified represents last access. - NSArray *keysSortedByLastModifiedDate = [_metadata keysSortedByValueUsingComparator:^NSComparisonResult(PINDiskCacheMetadata * _Nonnull obj1, PINDiskCacheMetadata * _Nonnull obj2) { - return [obj1.lastModifiedDate compare:obj2.lastModifiedDate]; - }]; - - NSUInteger bytesSaved = 0; - // objects accessed last first. - for (NSString *key in keysSortedByLastModifiedDate) { - [keysToRemove addObject:key]; - NSNumber *byteSize = _metadata[key].size; - if (byteSize) { - bytesSaved += [byteSize unsignedIntegerValue]; - } - if (_byteCount - bytesSaved <= trimByteCount) { - break; - } - } - } - [self unlock]; - - for (NSString *key in keysToRemove) { - [self removeFileAndExecuteBlocksForKey:key]; - } -} - -- (void)trimDiskToDate:(NSDate *)trimDate -{ - [self lockForWriting]; - NSArray *keysSortedByCreatedDate = [_metadata keysSortedByValueUsingComparator:^NSComparisonResult(PINDiskCacheMetadata * _Nonnull obj1, PINDiskCacheMetadata * _Nonnull obj2) { - return [obj1.createdDate compare:obj2.createdDate]; - }]; - - NSMutableArray *keysToRemove = [[NSMutableArray alloc] init]; - - for (NSString *key in keysSortedByCreatedDate) { // oldest files first - NSDate *createdDate = _metadata[key].createdDate; - if (!createdDate || _metadata[key].ageLimit > 0.0) - continue; - - if ([createdDate compare:trimDate] == NSOrderedAscending) { // older than trim date - [keysToRemove addObject:key]; - } else { - break; - } - } - [self unlock]; - - for (NSString *key in keysToRemove) { - [self removeFileAndExecuteBlocksForKey:key]; - } -} - -- (void)trimToAgeLimitRecursively -{ - [self lock]; - NSTimeInterval ageLimit = _ageLimit; - [self unlock]; - if (ageLimit == 0.0) - return; - - NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:-ageLimit]; - [self trimToDateAsync:date completion:nil]; - - dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ageLimit * NSEC_PER_SEC)); - dispatch_after(time, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { - // Ensure that ageLimit is the same as when we were scheduled, otherwise, we've been - // rescheduled (another dispatch_after was issued) and should cancel. - BOOL shouldReschedule = YES; - [self lock]; - if (ageLimit != self->_ageLimit) { - shouldReschedule = NO; - } - [self unlock]; - - if (shouldReschedule) { - [self.operationQueue scheduleOperation:^{ - [self trimToAgeLimitRecursively]; - } withPriority:PINOperationQueuePriorityLow]; - } - }); -} - -#pragma mark - Public Asynchronous Methods - - -- (void)lockFileAccessWhileExecutingBlockAsync:(PINCacheBlock)block -{ - if (block == nil) { - return; - } - - [self.operationQueue scheduleOperation:^{ - [self lockForWriting]; - block(self); - [self unlock]; - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)containsObjectForKeyAsync:(NSString *)key completion:(PINDiskCacheContainsBlock)block -{ - if (!key || !block) - return; - - [self.operationQueue scheduleOperation:^{ - block([self containsObjectForKey:key]); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)objectForKeyAsync:(NSString *)key completion:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - NSURL *fileURL = nil; - id object = [self objectForKey:key fileURL:&fileURL]; - - block(self, key, object); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)fileURLForKeyAsync:(NSString *)key completion:(PINDiskCacheFileURLBlock)block -{ - if (block == nil) { - return; - } - - [self.operationQueue scheduleOperation:^{ - NSURL *fileURL = [self fileURLForKey:key]; - - [self lockForWriting]; - block(key, fileURL); - [self unlock]; - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key completion:(PINDiskCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withAgeLimit:0.0 completion:(PINDiskCacheObjectBlock)block]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit completion:(nullable PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - NSURL *fileURL = nil; - [self setObject:object forKey:key withAgeLimit:ageLimit fileURL:&fileURL]; - - if (block) { - block(self, key, object); - } - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(nullable PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key completion:(PINDiskCacheObjectBlock)block]; -} - -- (void)setObjectAsync:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit completion:(nullable PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withAgeLimit:ageLimit completion:(PINDiskCacheObjectBlock)block]; -} - -- (void)removeObjectForKeyAsync:(NSString *)key completion:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - NSURL *fileURL = nil; - [self removeObjectForKey:key fileURL:&fileURL]; - - if (block) { - block(self, key, nil); - } - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)trimToSizeAsync:(NSUInteger)trimByteCount completion:(PINCacheBlock)block -{ - PINOperationBlock operation = ^(id data) { - [self trimToSize:((NSNumber *)data).unsignedIntegerValue]; - }; - - dispatch_block_t completion = nil; - if (block) { - completion = ^{ - block(self); - }; - } - - [self.operationQueue scheduleOperation:operation - withPriority:PINOperationQueuePriorityLow - identifier:PINDiskCacheOperationIdentifierTrimToSize - coalescingData:[NSNumber numberWithUnsignedInteger:trimByteCount] - dataCoalescingBlock:PINDiskTrimmingSizeCoalescingBlock - completion:completion]; -} - -- (void)trimToDateAsync:(NSDate *)trimDate completion:(PINCacheBlock)block -{ - PINOperationBlock operation = ^(id data){ - [self trimToDate:(NSDate *)data]; - }; - - dispatch_block_t completion = nil; - if (block) { - completion = ^{ - block(self); - }; - } - - [self.operationQueue scheduleOperation:operation - withPriority:PINOperationQueuePriorityLow - identifier:PINDiskCacheOperationIdentifierTrimToDate - coalescingData:trimDate - dataCoalescingBlock:PINDiskTrimmingDateCoalescingBlock - completion:completion]; -} - -- (void)trimToSizeByDateAsync:(NSUInteger)trimByteCount completion:(PINCacheBlock)block -{ - PINOperationBlock operation = ^(id data){ - [self trimToSizeByDate:((NSNumber *)data).unsignedIntegerValue]; - }; - - dispatch_block_t completion = nil; - if (block) { - completion = ^{ - block(self); - }; - } - - [self.operationQueue scheduleOperation:operation - withPriority:PINOperationQueuePriorityLow - identifier:PINDiskCacheOperationIdentifierTrimToSizeByDate - coalescingData:[NSNumber numberWithUnsignedInteger:trimByteCount] - dataCoalescingBlock:PINDiskTrimmingSizeCoalescingBlock - completion:completion]; -} - -- (void)removeExpiredObjectsAsync:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self removeExpiredObjects]; - - if (block) { - block(self); - } - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)removeAllObjectsAsync:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self removeAllObjects]; - - if (block) { - block(self); - } - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)enumerateObjectsWithBlockAsync:(PINDiskCacheFileURLEnumerationBlock)block completionBlock:(PINCacheBlock)completionBlock -{ - [self.operationQueue scheduleOperation:^{ - [self enumerateObjectsWithBlock:block]; - - if (completionBlock) { - completionBlock(self); - } - } withPriority:PINOperationQueuePriorityLow]; -} - -#pragma mark - Public Synchronous Methods - - -- (void)synchronouslyLockFileAccessWhileExecutingBlock:(PIN_NOESCAPE PINCacheBlock)block -{ - if (block) { - [self lockForWriting]; - block(self); - [self unlock]; - } -} - -- (BOOL)containsObjectForKey:(NSString *)key -{ - [self lock]; - if (_metadata[key] != nil || _diskStateKnown == NO) { - BOOL objectExpired = NO; - if (self->_ttlCache && _metadata[key].createdDate != nil) { - NSTimeInterval ageLimit = _metadata[key].ageLimit > 0.0 ? _metadata[key].ageLimit : self->_ageLimit; - objectExpired = ageLimit > 0 && fabs([_metadata[key].createdDate timeIntervalSinceDate:[NSDate date]]) > ageLimit; - } - [self unlock]; - return (!objectExpired && [self fileURLForKey:key updateFileModificationDate:NO] != nil); - } - [self unlock]; - return NO; -} - -- (nullable id)objectForKey:(NSString *)key -{ - return [self objectForKey:key fileURL:nil]; -} - -- (id)objectForKeyedSubscript:(NSString *)key -{ - return [self objectForKey:key]; -} - -- (nullable id )objectForKey:(NSString *)key fileURL:(NSURL **)outFileURL -{ - [self lock]; - BOOL containsKey = _metadata[key] != nil || _diskStateKnown == NO; - [self unlock]; - - if (!key || !containsKey) - return nil; - - id object = nil; - NSURL *fileURL = [self encodedFileURLForKey:key]; - - NSDate *now = [NSDate date]; - [self lock]; - if (self->_ttlCache) { - if (!_diskStateKnown) { - if (_metadata[key] == nil) { - NSString *fileKey = [self keyForEncodedFileURL:fileURL]; - [self _locked_initializeDiskPropertiesForFile:fileURL fileKey:fileKey]; - } - } - } - - NSTimeInterval ageLimit = _metadata[key].ageLimit > 0.0 ? _metadata[key].ageLimit : self->_ageLimit; - if (!self->_ttlCache || ageLimit <= 0 || fabs([_metadata[key].createdDate timeIntervalSinceDate:now]) < ageLimit) { - // If the cache should behave like a TTL cache, then only fetch the object if there's a valid ageLimit and the object is still alive - - NSData *objectData = [[NSData alloc] initWithContentsOfFile:[fileURL path]]; - - if (objectData) { - //Be careful with locking below. We unlock here so that we're not locked while deserializing, we re-lock after. - [self unlock]; - @try { - object = _deserializer(objectData, key); - } - @catch (NSException *exception) { - NSError *error = nil; - [self lock]; - [[NSFileManager defaultManager] removeItemAtPath:[fileURL path] error:&error]; - [self unlock]; - PINDiskCacheError(error) - PINDiskCacheException(exception); - } - [self lock]; - } - if (object) { - _metadata[key].lastModifiedDate = now; - [self asynchronouslySetFileModificationDate:now forURL:fileURL]; - } - } - [self unlock]; - - if (outFileURL) { - *outFileURL = fileURL; - } - - return object; -} - -/// Helper function to call fileURLForKey:updateFileModificationDate: -- (NSURL *)fileURLForKey:(NSString *)key -{ - // Don't update the file modification time, if self is a ttlCache - return [self fileURLForKey:key updateFileModificationDate:!self->_ttlCache]; -} - -- (NSURL *)fileURLForKey:(NSString *)key updateFileModificationDate:(BOOL)updateFileModificationDate -{ - if (!key) { - return nil; - } - - NSDate *now = [NSDate date]; - NSURL *fileURL = [self encodedFileURLForKey:key]; - - [self lockForWriting]; - if (fileURL.path && [[NSFileManager defaultManager] fileExistsAtPath:fileURL.path]) { - if (updateFileModificationDate) { - _metadata[key].lastModifiedDate = now; - [self asynchronouslySetFileModificationDate:now forURL:fileURL]; - } - } else { - fileURL = nil; - } - [self unlock]; - return fileURL; -} - -- (void)setObject:(id )object forKey:(NSString *)key -{ - [self setObject:object forKey:key withAgeLimit:0.0]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit -{ - [self setObject:object forKey:key withAgeLimit:ageLimit fileURL:nil]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit -{ - [self setObject:object forKey:key withAgeLimit:ageLimit]; -} - -- (void)setObject:(id )object forKey:(NSString *)key withCost:(NSUInteger)cost -{ - [self setObject:object forKey:key]; -} - -- (void)setObject:(id)object forKeyedSubscript:(NSString *)key -{ - if (object == nil) { - [self removeObjectForKey:key]; - } else { - [self setObject:object forKey:key]; - } -} - -- (void)setObject:(id )object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit fileURL:(NSURL **)outFileURL -{ - NSAssert(ageLimit <= 0.0 || (ageLimit > 0.0 && _ttlCache), @"ttlCache must be set to YES if setting an object-level age limit."); - - if (!key || !object) - return; - - NSDataWritingOptions writeOptions = NSDataWritingAtomic; - #if TARGET_OS_IPHONE - if (self.writingProtectionOptionSet) { - writeOptions |= self.writingProtectionOption; - } - #endif - - // Remain unlocked here so that we're not locked while serializing. - NSData *data = _serializer(object, key); - NSURL *fileURL = nil; - - NSUInteger byteLimit = self.byteLimit; - if (data.length <= byteLimit || byteLimit == 0) { - // The cache is large enough to fit this object (although we may need to evict others). - fileURL = [self encodedFileURLForKey:key]; - } else { - // The cache isn't large enough to fit this object (even if all others were evicted). - // We should not write it to disk because it will be deleted immediately after. - if (outFileURL) { - *outFileURL = nil; - } - return; - } - - [self lockForWriting]; - PINDiskCacheObjectBlock willAddObjectBlock = self->_willAddObjectBlock; - if (willAddObjectBlock) { - [self unlock]; - willAddObjectBlock(self, key, object); - [self lock]; - } - - NSError *writeError = nil; - BOOL written = [data writeToURL:fileURL options:writeOptions error:&writeError]; - PINDiskCacheError(writeError); - - if (written) { - if (_metadata[key] == nil) { - _metadata[key] = [[PINDiskCacheMetadata alloc] init]; - } - - NSError *error = nil; - NSDictionary *values = [fileURL resourceValuesForKeys:@[ NSURLCreationDateKey, NSURLContentModificationDateKey, NSURLTotalFileAllocatedSizeKey ] error:&error]; - PINDiskCacheError(error); - - NSNumber *diskFileSize = [values objectForKey:NSURLTotalFileAllocatedSizeKey]; - if (diskFileSize) { - NSNumber *prevDiskFileSize = self->_metadata[key].size; - if (prevDiskFileSize) { - self.byteCount = self->_byteCount - [prevDiskFileSize unsignedIntegerValue]; - } - self->_metadata[key].size = diskFileSize; - self.byteCount = self->_byteCount + [diskFileSize unsignedIntegerValue]; // atomic - } - NSDate *createdDate = [values objectForKey:NSURLCreationDateKey]; - if (createdDate) { - self->_metadata[key].createdDate = createdDate; - } - NSDate *lastModifiedDate = [values objectForKey:NSURLContentModificationDateKey]; - if (lastModifiedDate) { - self->_metadata[key].lastModifiedDate = lastModifiedDate; - } - [self asynchronouslySetAgeLimit:ageLimit forURL:fileURL]; - if (self->_byteLimit > 0 && self->_byteCount > self->_byteLimit) - [self trimToSizeByDateAsync:self->_byteLimit completion:nil]; - } else { - fileURL = nil; - } - - PINDiskCacheObjectBlock didAddObjectBlock = self->_didAddObjectBlock; - if (didAddObjectBlock) { - [self unlock]; - didAddObjectBlock(self, key, object); - [self lock]; - } - [self unlock]; - - if (outFileURL) { - *outFileURL = fileURL; - } -} - -- (void)removeObjectForKey:(NSString *)key -{ - [self removeObjectForKey:key fileURL:nil]; -} - -- (void)removeObjectForKey:(NSString *)key fileURL:(NSURL **)outFileURL -{ - if (!key) - return; - - NSURL *fileURL = nil; - - fileURL = [self encodedFileURLForKey:key]; - - [self removeFileAndExecuteBlocksForKey:key]; - - if (outFileURL) { - *outFileURL = fileURL; - } -} - -- (void)trimToSize:(NSUInteger)trimByteCount -{ - if (trimByteCount == 0) { - [self removeAllObjects]; - return; - } - - [self trimDiskToSize:trimByteCount]; -} - -- (void)trimToDate:(NSDate *)trimDate -{ - if (!trimDate) - return; - - if ([trimDate isEqualToDate:[NSDate distantPast]]) { - [self removeAllObjects]; - return; - } - - [self trimDiskToDate:trimDate]; -} - -- (void)trimToSizeByDate:(NSUInteger)trimByteCount -{ - if (trimByteCount == 0) { - [self removeAllObjects]; - return; - } - - [self trimDiskToSizeByDate:trimByteCount]; -} - -- (void)removeExpiredObjects -{ - [self lockForWriting]; - NSDate *now = [NSDate date]; - NSMutableArray *expiredObjectKeys = [NSMutableArray array]; - [_metadata enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, PINDiskCacheMetadata * _Nonnull obj, BOOL * _Nonnull stop) { - NSTimeInterval ageLimit = obj.ageLimit > 0.0 ? obj.ageLimit : self->_ageLimit; - NSDate *expirationDate = [obj.createdDate dateByAddingTimeInterval:ageLimit]; - if ([expirationDate compare:now] == NSOrderedAscending) { // Expiration date has passed - [expiredObjectKeys addObject:key]; - } - }]; - [self unlock]; - - for (NSString *key in expiredObjectKeys) { - //unlock, removeFileAndExecuteBlocksForKey handles locking itself - [self removeFileAndExecuteBlocksForKey:key]; - } -} - -- (void)removeAllObjects -{ - // We don't need to know the disk state since we're just going to remove everything. - [self lockForWriting]; - PINCacheBlock willRemoveAllObjectsBlock = self->_willRemoveAllObjectsBlock; - if (willRemoveAllObjectsBlock) { - [self unlock]; - willRemoveAllObjectsBlock(self); - [self lock]; - } - - [PINDiskCache moveItemAtURLToTrash:self->_cacheURL]; - [PINDiskCache emptyTrash]; - - [self _locked_createCacheDirectory]; - - [self->_metadata removeAllObjects]; - self.byteCount = 0; // atomic - - PINCacheBlock didRemoveAllObjectsBlock = self->_didRemoveAllObjectsBlock; - if (didRemoveAllObjectsBlock) { - [self unlock]; - didRemoveAllObjectsBlock(self); - [self lock]; - } - - [self unlock]; -} - -- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINDiskCacheFileURLEnumerationBlock)block -{ - if (!block) - return; - - [self lockAndWaitForKnownState]; - NSDate *now = [NSDate date]; - - for (NSString *key in _metadata) { - NSURL *fileURL = [self encodedFileURLForKey:key]; - // If the cache should behave like a TTL cache, then only fetch the object if there's a valid ageLimit and the object is still alive - NSDate *createdDate = _metadata[key].createdDate; - NSTimeInterval ageLimit = _metadata[key].ageLimit > 0.0 ? _metadata[key].ageLimit : self->_ageLimit; - if (!self->_ttlCache || ageLimit <= 0 || (createdDate && fabs([createdDate timeIntervalSinceDate:now]) < ageLimit)) { - BOOL stop = NO; - block(key, fileURL, &stop); - if (stop) - break; - } - } - [self unlock]; -} - -#pragma mark - Public Thread Safe Accessors - - -- (PINDiskCacheObjectBlock)willAddObjectBlock -{ - PINDiskCacheObjectBlock block = nil; - - [self lock]; - block = _willAddObjectBlock; - [self unlock]; - - return block; -} - -- (void)setWillAddObjectBlock:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_willAddObjectBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (PINDiskCacheObjectBlock)willRemoveObjectBlock -{ - PINDiskCacheObjectBlock block = nil; - - [self lock]; - block = _willRemoveObjectBlock; - [self unlock]; - - return block; -} - -- (void)setWillRemoveObjectBlock:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_willRemoveObjectBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (PINCacheBlock)willRemoveAllObjectsBlock -{ - PINCacheBlock block = nil; - - [self lock]; - block = _willRemoveAllObjectsBlock; - [self unlock]; - - return block; -} - -- (void)setWillRemoveAllObjectsBlock:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_willRemoveAllObjectsBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (PINDiskCacheObjectBlock)didAddObjectBlock -{ - PINDiskCacheObjectBlock block = nil; - - [self lock]; - block = _didAddObjectBlock; - [self unlock]; - - return block; -} - -- (void)setDidAddObjectBlock:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_didAddObjectBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (PINDiskCacheObjectBlock)didRemoveObjectBlock -{ - PINDiskCacheObjectBlock block = nil; - - [self lock]; - block = _didRemoveObjectBlock; - [self unlock]; - - return block; -} - -- (void)setDidRemoveObjectBlock:(PINDiskCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_didRemoveObjectBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (PINCacheBlock)didRemoveAllObjectsBlock -{ - PINCacheBlock block = nil; - - [self lock]; - block = _didRemoveAllObjectsBlock; - [self unlock]; - - return block; -} - -- (void)setDidRemoveAllObjectsBlock:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_didRemoveAllObjectsBlock = [block copy]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (NSUInteger)byteLimit -{ - NSUInteger byteLimit; - - [self lock]; - byteLimit = _byteLimit; - [self unlock]; - - return byteLimit; -} - -- (void)setByteLimit:(NSUInteger)byteLimit -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_byteLimit = byteLimit; - [self unlock]; - - if (byteLimit > 0) - [self trimDiskToSizeByDate:byteLimit]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (NSTimeInterval)ageLimit -{ - NSTimeInterval ageLimit; - - [self lock]; - ageLimit = _ageLimit; - [self unlock]; - - return ageLimit; -} - -- (void)setAgeLimit:(NSTimeInterval)ageLimit -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_ageLimit = ageLimit; - [self unlock]; - - [self.operationQueue scheduleOperation:^{ - [self trimToAgeLimitRecursively]; - } withPriority:PINOperationQueuePriorityLow]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (BOOL)isTTLCache -{ - BOOL isTTLCache; - - [self lock]; - isTTLCache = _ttlCache; - [self unlock]; - - return isTTLCache; -} - -#if TARGET_OS_IPHONE -- (NSDataWritingOptions)writingProtectionOption -{ - NSDataWritingOptions option; - - [self lock]; - option = _writingProtectionOption; - [self unlock]; - - return option; -} - -- (void)setWritingProtectionOption:(NSDataWritingOptions)writingProtectionOption -{ - [self.operationQueue scheduleOperation:^{ - NSDataWritingOptions option = NSDataWritingFileProtectionMask & writingProtectionOption; - - [self lock]; - self->_writingProtectionOptionSet = YES; - self->_writingProtectionOption = option; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} -#endif - -- (void)lockForWriting -{ - [self lock]; - - // Lock if the disk isn't writable. - if (_diskWritable == NO) { - pthread_cond_wait(&_diskWritableCondition, &_mutex); - } -} - -- (void)lockAndWaitForKnownState -{ - [self lock]; - - // Lock if the disk state isn't known. - if (_diskStateKnown == NO) { - pthread_cond_wait(&_diskStateKnownCondition, &_mutex); - } -} - -- (void)lock -{ - __unused int result = pthread_mutex_lock(&_mutex); - NSAssert(result == 0, @"Failed to lock PINDiskCache %@. Code: %d", self, result); -} - -- (void)unlock -{ - __unused int result = pthread_mutex_unlock(&_mutex); - NSAssert(result == 0, @"Failed to unlock PINDiskCache %@. Code: %d", self, result); -} - -@end - -@implementation PINDiskCache (Deprecated) - -- (void)lockFileAccessWhileExecutingBlock:(nullable PINCacheBlock)block -{ - [self lockFileAccessWhileExecutingBlockAsync:block]; -} - -- (void)containsObjectForKey:(NSString *)key block:(PINDiskCacheContainsBlock)block -{ - [self containsObjectForKeyAsync:key completion:block]; -} - -- (void)objectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block -{ - [self objectForKeyAsync:key completion:block]; -} - -- (void)fileURLForKey:(NSString *)key block:(nullable PINDiskCacheFileURLBlock)block -{ - [self fileURLForKeyAsync:key completion:block]; -} - -- (void)setObject:(id )object forKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key completion:block]; -} - -- (void)removeObjectForKey:(NSString *)key block:(nullable PINDiskCacheObjectBlock)block -{ - [self removeObjectForKeyAsync:key completion:block]; -} - -- (void)trimToDate:(NSDate *)date block:(nullable PINDiskCacheBlock)block -{ - [self trimToDateAsync:date completion:^(id diskCache) { - if (block) { - block((PINDiskCache *)diskCache); - } - }]; -} - -- (void)trimToSize:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block -{ - [self trimToSizeAsync:byteCount completion:^(id diskCache) { - if (block) { - block((PINDiskCache *)diskCache); - } - }]; -} - -- (void)trimToSizeByDate:(NSUInteger)byteCount block:(nullable PINDiskCacheBlock)block -{ - [self trimToSizeAsync:byteCount completion:^(id diskCache) { - if (block) { - block((PINDiskCache *)diskCache); - } - }]; -} - -- (void)removeAllObjects:(nullable PINDiskCacheBlock)block -{ - [self removeAllObjectsAsync:^(id diskCache) { - if (block) { - block((PINDiskCache *)diskCache); - } - }]; -} - -- (void)enumerateObjectsWithBlock:(PINDiskCacheFileURLBlock)block completionBlock:(nullable PINDiskCacheBlock)completionBlock -{ - [self enumerateObjectsWithBlockAsync:^(NSString * _Nonnull key, NSURL * _Nullable fileURL, BOOL * _Nonnull stop) { - block(key, fileURL); - } completionBlock:^(id diskCache) { - if (completionBlock) { - completionBlock((PINDiskCache *)diskCache); - } - }]; -} - -- (void)setTtlCache:(BOOL)ttlCache -{ - [self.operationQueue scheduleOperation:^{ - [self lock]; - self->_ttlCache = ttlCache; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -@end - -@implementation PINDiskCacheMetadata -@end diff --git a/Example/Pods/PINCache/Source/PINMemoryCache.h b/Example/Pods/PINCache/Source/PINMemoryCache.h deleted file mode 100644 index 1cf9ff88..00000000 --- a/Example/Pods/PINCache/Source/PINMemoryCache.h +++ /dev/null @@ -1,245 +0,0 @@ -// PINCache is a modified version of TMCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import - -#import "PINCacheMacros.h" -#import "PINCaching.h" -#import "PINCacheObjectSubscripting.h" - -NS_ASSUME_NONNULL_BEGIN - -@class PINMemoryCache; -@class PINOperationQueue; - - -/** - `PINMemoryCache` is a fast, thread safe key/value store similar to `NSCache`. On iOS it will clear itself - automatically to reduce memory usage when the app receives a memory warning or goes into the background. - - Access is natively synchronous. Asynchronous variations are provided. Every asynchronous method accepts a - callback block that runs on a concurrent , with cache reads and writes protected by a lock. - - All access to the cache is dated so the that the least-used objects can be trimmed first. Setting an - optional will trigger a GCD timer to periodically to trim the cache to that age. - - Objects can optionally be set with a "cost", which could be a byte count or any other meaningful integer. - Setting a will automatically keep the cache below that value with . - - Values will not persist after application relaunch or returning from the background. See for - a memory cache backed by a disk cache. - */ - -PIN_SUBCLASSING_RESTRICTED -@interface PINMemoryCache : NSObject - -#pragma mark - Properties -/// @name Core - -/** - The total accumulated cost. - */ -@property (readonly) NSUInteger totalCost; - -/** - The maximum cost allowed to accumulate before objects begin to be removed with . - */ -@property (assign) NSUInteger costLimit; - -/** - The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value - greater than `0.0` will start a recurring GCD timer with the same period that calls . - Setting it back to `0.0` will stop the timer. Defaults to `0.0`. - */ -@property (assign) NSTimeInterval ageLimit; - -/** - If ttlCache is YES, the cache behaves like a ttlCache. This means that once an object enters the - cache, it only lives as long as self.ageLimit. This has the following implications: - - Accessing an object in the cache does not extend that object's lifetime in the cache - - When attempting to access an object in the cache that has lived longer than self.ageLimit, - the cache will behave as if the object does not exist - - @note If an object-level age limit is set via one of the @c -setObject:forKey:withAgeLimit methods, - that age limit overrides self.ageLimit. The overridden object age limit could be greater or - less than self.agelimit but must be greater than zero. - */ -@property (nonatomic, readonly, getter=isTTLCache) BOOL ttlCache; - -/** - When `YES` on iOS the cache will remove all objects when the app receives a memory warning. - Defaults to `YES`. - */ -@property (assign) BOOL removeAllObjectsOnMemoryWarning; - -/** - When `YES` on iOS the cache will remove all objects when the app enters the background. - Defaults to `YES`. - */ -@property (assign) BOOL removeAllObjectsOnEnteringBackground; - -#pragma mark - Event Blocks -/// @name Event Blocks - -/** - A block to be executed just before an object is added to the cache. This block will be excuted within - a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheObjectBlock willAddObjectBlock; - -/** - A block to be executed just before an object is removed from the cache. This block will be excuted - within a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheObjectBlock willRemoveObjectBlock; - -/** - A block to be executed just before all objects are removed from the cache as a result of . - This block will be excuted within a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheBlock willRemoveAllObjectsBlock; - -/** - A block to be executed just after an object is added to the cache. This block will be excuted within - a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheObjectBlock didAddObjectBlock; - -/** - A block to be executed just after an object is removed from the cache. This block will be excuted - within a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheObjectBlock didRemoveObjectBlock; - -/** - A block to be executed just after all objects are removed from the cache as a result of . - This block will be excuted within a lock, i.e. all reads and writes are suspended for the duration of the block. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - */ -@property (nullable, copy) PINCacheBlock didRemoveAllObjectsBlock; - -/** - A block to be executed upon receiving a memory warning (iOS only) potentially in parallel with other blocks on the . - This block will be executed regardless of the value of . Defaults to `nil`. - */ -@property (nullable, copy) PINCacheBlock didReceiveMemoryWarningBlock; - -/** - A block to be executed when the app enters the background (iOS only) potentially in parallel with other blocks on the . - This block will be executed regardless of the value of . Defaults to `nil`. - */ -@property (nullable, copy) PINCacheBlock didEnterBackgroundBlock; - -#pragma mark - Lifecycle -/// @name Shared Cache - -/** - A shared cache. - - @result The shared singleton cache instance. - */ -@property (class, strong, readonly) PINMemoryCache *sharedCache; - -- (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue; - -- (instancetype)initWithName:(NSString *)name operationQueue:(PINOperationQueue *)operationQueue; - -- (instancetype)initWithName:(NSString *)name operationQueue:(PINOperationQueue *)operationQueue ttlCache:(BOOL)ttlCache NS_DESIGNATED_INITIALIZER; - -#pragma mark - Asynchronous Methods -/// @name Asynchronous Methods - -/** - Removes objects from the cache, costliest objects first, until the is below the specified - value. This method returns immediately and executes the passed block after the cache has been trimmed, - potentially in parallel with other blocks on the . - - @param cost The total accumulation allowed to remain after the cache has been trimmed. - @param block A block to be executed concurrently after the cache has been trimmed, or nil. - */ -- (void)trimToCostAsync:(NSUInteger)cost completion:(nullable PINCacheBlock)block; - -/** - Removes objects from the cache, ordered by date (least recently used first), until the is below - the specified value. This method returns immediately and executes the passed block after the cache has been - trimmed, potentially in parallel with other blocks on the . - - @param cost The total accumulation allowed to remain after the cache has been trimmed. - @param block A block to be executed concurrently after the cache has been trimmed, or nil. - */ -- (void)trimToCostByDateAsync:(NSUInteger)cost completion:(nullable PINCacheBlock)block; - -/** - Loops through all objects in the cache with reads and writes suspended. Calling serial methods which - write to the cache inside block may be unsafe and may result in a deadlock. This method returns immediately. - - @param block A block to be executed for every object in the cache. - @param completionBlock An optional block to be executed concurrently when the enumeration is complete. - */ -- (void)enumerateObjectsWithBlockAsync:(PINCacheObjectEnumerationBlock)block completionBlock:(nullable PINCacheBlock)completionBlock; - -#pragma mark - Synchronous Methods -/// @name Synchronous Methods - -/** - Removes objects from the cache, costliest objects first, until the is below the specified - value. This method blocks the calling thread until the cache has been trimmed. - - @see trimToCostAsync: - @param cost The total accumulation allowed to remain after the cache has been trimmed. - */ -- (void)trimToCost:(NSUInteger)cost; - -/** - Removes objects from the cache, ordered by date (least recently used first), until the is below - the specified value. This method blocks the calling thread until the cache has been trimmed. - - @see trimToCostByDateAsync: - @param cost The total accumulation allowed to remain after the cache has been trimmed. - */ -- (void)trimToCostByDate:(NSUInteger)cost; - -/** - Loops through all objects in the cache within a memory lock (reads and writes are suspended during the enumeration). - This method blocks the calling thread until all objects have been enumerated. - Calling synchronous methods on the cache within this callback will likely cause a deadlock. - - @see enumerateObjectsWithBlockAsync:completionBlock: - @param block A block to be executed for every object in the cache. - - @warning Do not call this method within the event blocks (, etc.) - Instead use the asynchronous version, . - - */ -- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINCacheObjectEnumerationBlock)block; - -@end - - -#pragma mark - Deprecated - -typedef void (^PINMemoryCacheBlock)(PINMemoryCache *cache); -typedef void (^PINMemoryCacheObjectBlock)(PINMemoryCache *cache, NSString *key, id _Nullable object); -typedef void (^PINMemoryCacheContainmentBlock)(BOOL containsObject); - -@interface PINMemoryCache (Deprecated) -- (void)containsObjectForKey:(NSString *)key block:(PINMemoryCacheContainmentBlock)block __attribute__((deprecated)); -- (void)objectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); -- (void)setObject:(id)object forKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); -- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); -- (void)removeObjectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block __attribute__((deprecated)); -- (void)trimToDate:(NSDate *)date block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); -- (void)trimToCost:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); -- (void)trimToCostByDate:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); -- (void)removeAllObjects:(nullable PINMemoryCacheBlock)block __attribute__((deprecated)); -- (void)enumerateObjectsWithBlock:(PINMemoryCacheObjectBlock)block completionBlock:(nullable PINMemoryCacheBlock)completionBlock __attribute__((deprecated)); -- (void)setTtlCache:(BOOL)ttlCache DEPRECATED_MSG_ATTRIBUTE("ttlCache is no longer a settable property and must now be set via initializer."); -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINCache/Source/PINMemoryCache.m b/Example/Pods/PINCache/Source/PINMemoryCache.m deleted file mode 100644 index 85c45f5f..00000000 --- a/Example/Pods/PINCache/Source/PINMemoryCache.m +++ /dev/null @@ -1,932 +0,0 @@ -// PINCache is a modified version of TMCache -// Modifications by Garrett Moon -// Copyright (c) 2015 Pinterest. All rights reserved. - -#import "PINMemoryCache.h" - -#import - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0 -#import -#endif - -static NSString * const PINMemoryCachePrefix = @"com.pinterest.PINMemoryCache"; -static NSString * const PINMemoryCacheSharedName = @"PINMemoryCacheSharedName"; - -@interface PINMemoryCache () -@property (copy, nonatomic) NSString *name; -@property (strong, nonatomic) PINOperationQueue *operationQueue; -@property (assign, nonatomic) pthread_mutex_t mutex; -@property (strong, nonatomic) NSMutableDictionary *dictionary; -@property (strong, nonatomic) NSMutableDictionary *createdDates; -@property (strong, nonatomic) NSMutableDictionary *accessDates; -@property (strong, nonatomic) NSMutableDictionary *costs; -@property (strong, nonatomic) NSMutableDictionary *ageLimits; -@end - -@implementation PINMemoryCache - -@synthesize name = _name; -@synthesize ageLimit = _ageLimit; -@synthesize costLimit = _costLimit; -@synthesize totalCost = _totalCost; -@synthesize ttlCache = _ttlCache; -@synthesize willAddObjectBlock = _willAddObjectBlock; -@synthesize willRemoveObjectBlock = _willRemoveObjectBlock; -@synthesize willRemoveAllObjectsBlock = _willRemoveAllObjectsBlock; -@synthesize didAddObjectBlock = _didAddObjectBlock; -@synthesize didRemoveObjectBlock = _didRemoveObjectBlock; -@synthesize didRemoveAllObjectsBlock = _didRemoveAllObjectsBlock; -@synthesize didReceiveMemoryWarningBlock = _didReceiveMemoryWarningBlock; -@synthesize didEnterBackgroundBlock = _didEnterBackgroundBlock; - -#pragma mark - Initialization - - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - __unused int result = pthread_mutex_destroy(&_mutex); - NSCAssert(result == 0, @"Failed to destroy lock in PINMemoryCache %p. Code: %d", (void *)self, result); -} - -- (instancetype)init -{ - return [self initWithOperationQueue:[PINOperationQueue sharedOperationQueue]]; -} - -- (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue -{ - return [self initWithName:PINMemoryCacheSharedName operationQueue:operationQueue]; -} - -- (instancetype)initWithName:(NSString *)name operationQueue:(PINOperationQueue *)operationQueue -{ - return [self initWithName:name operationQueue:operationQueue ttlCache:NO]; -} - -- (instancetype)initWithName:(NSString *)name operationQueue:(PINOperationQueue *)operationQueue ttlCache:(BOOL)ttlCache -{ - if (self = [super init]) { - __unused int result = pthread_mutex_init(&_mutex, NULL); - NSAssert(result == 0, @"Failed to init lock in PINMemoryCache %@. Code: %d", self, result); - - _name = [name copy]; - _operationQueue = operationQueue; - _ttlCache = ttlCache; - - _dictionary = [[NSMutableDictionary alloc] init]; - _createdDates = [[NSMutableDictionary alloc] init]; - _accessDates = [[NSMutableDictionary alloc] init]; - _costs = [[NSMutableDictionary alloc] init]; - _ageLimits = [[NSMutableDictionary alloc] init]; - - _willAddObjectBlock = nil; - _willRemoveObjectBlock = nil; - _willRemoveAllObjectsBlock = nil; - - _didAddObjectBlock = nil; - _didRemoveObjectBlock = nil; - _didRemoveAllObjectsBlock = nil; - - _didReceiveMemoryWarningBlock = nil; - _didEnterBackgroundBlock = nil; - - _ageLimit = 0.0; - _costLimit = 0; - _totalCost = 0; - - _removeAllObjectsOnMemoryWarning = YES; - _removeAllObjectsOnEnteringBackground = YES; - -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0 && !TARGET_OS_WATCH - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveEnterBackgroundNotification:) - name:UIApplicationDidEnterBackgroundNotification - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveMemoryWarningNotification:) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; - -#endif - } - return self; -} - -+ (PINMemoryCache *)sharedCache -{ - static PINMemoryCache *cache; - static dispatch_once_t predicate; - - dispatch_once(&predicate, ^{ - cache = [[PINMemoryCache alloc] init]; - }); - - return cache; -} - -#pragma mark - Private Methods - - -- (void)didReceiveMemoryWarningNotification:(NSNotification *)notification { - if (self.removeAllObjectsOnMemoryWarning) { - [self removeAllObjectsAsync:nil]; - } else { - [self removeExpiredObjects]; - } - - [self.operationQueue scheduleOperation:^{ - [self lock]; - PINCacheBlock didReceiveMemoryWarningBlock = self->_didReceiveMemoryWarningBlock; - [self unlock]; - - if (didReceiveMemoryWarningBlock) - didReceiveMemoryWarningBlock(self); - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)didReceiveEnterBackgroundNotification:(NSNotification *)notification -{ - if (self.removeAllObjectsOnEnteringBackground) - [self removeAllObjectsAsync:nil]; - - [self.operationQueue scheduleOperation:^{ - [self lock]; - PINCacheBlock didEnterBackgroundBlock = self->_didEnterBackgroundBlock; - [self unlock]; - - if (didEnterBackgroundBlock) - didEnterBackgroundBlock(self); - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)removeObjectAndExecuteBlocksForKey:(NSString *)key -{ - [self lock]; - id object = _dictionary[key]; - NSNumber *cost = _costs[key]; - PINCacheObjectBlock willRemoveObjectBlock = _willRemoveObjectBlock; - PINCacheObjectBlock didRemoveObjectBlock = _didRemoveObjectBlock; - [self unlock]; - - if (willRemoveObjectBlock) - willRemoveObjectBlock(self, key, object); - - [self lock]; - if (cost) - _totalCost -= [cost unsignedIntegerValue]; - - [_dictionary removeObjectForKey:key]; - [_createdDates removeObjectForKey:key]; - [_accessDates removeObjectForKey:key]; - [_costs removeObjectForKey:key]; - [_ageLimits removeObjectForKey:key]; - [self unlock]; - - if (didRemoveObjectBlock) - didRemoveObjectBlock(self, key, nil); -} - -- (void)trimMemoryToDate:(NSDate *)trimDate -{ - [self lock]; - NSDictionary *createdDates = [_createdDates copy]; - NSDictionary *ageLimits = [_ageLimits copy]; - [self unlock]; - - [createdDates enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSDate * _Nonnull createdDate, BOOL * _Nonnull stop) { - NSTimeInterval ageLimit = [ageLimits[key] doubleValue]; - if (!createdDate || ageLimit > 0.0) { - return; - } - if ([createdDate compare:trimDate] == NSOrderedAscending) { // older than trim date - [self removeObjectAndExecuteBlocksForKey:key]; - } - }]; -} - -- (void)removeExpiredObjects -{ - [self lock]; - NSDictionary *createdDates = [_createdDates copy]; - NSDictionary *ageLimits = [_ageLimits copy]; - NSTimeInterval globalAgeLimit = self->_ageLimit; - [self unlock]; - - NSDate *now = [NSDate date]; - for (NSString *key in ageLimits) { - NSDate *createdDate = createdDates[key]; - NSTimeInterval ageLimit = [ageLimits[key] doubleValue] ?: globalAgeLimit; - if (!createdDate) - continue; - - NSDate *expirationDate = [createdDate dateByAddingTimeInterval:ageLimit]; - if ([expirationDate compare:now] == NSOrderedAscending) { // Expiration date has passed - [self removeObjectAndExecuteBlocksForKey:key]; - } - } -} - -- (void)trimToCostLimit:(NSUInteger)limit -{ - NSUInteger totalCost = 0; - - [self lock]; - totalCost = _totalCost; - NSArray *keysSortedByCost = [_costs keysSortedByValueUsingSelector:@selector(compare:)]; - [self unlock]; - - if (totalCost <= limit) { - return; - } - - for (NSString *key in [keysSortedByCost reverseObjectEnumerator]) { // costliest objects first - [self removeObjectAndExecuteBlocksForKey:key]; - - [self lock]; - totalCost = _totalCost; - [self unlock]; - - if (totalCost <= limit) - break; - } -} - -- (void)trimToCostLimitByDate:(NSUInteger)limit -{ - if (self.isTTLCache) { - [self removeExpiredObjects]; - } - - NSUInteger totalCost = 0; - - [self lock]; - totalCost = _totalCost; - NSArray *keysSortedByAccessDate = [_accessDates keysSortedByValueUsingSelector:@selector(compare:)]; - [self unlock]; - - if (totalCost <= limit) - return; - - for (NSString *key in keysSortedByAccessDate) { // oldest objects first - [self removeObjectAndExecuteBlocksForKey:key]; - - [self lock]; - totalCost = _totalCost; - [self unlock]; - if (totalCost <= limit) - break; - } -} - -- (void)trimToAgeLimitRecursively -{ - [self lock]; - NSTimeInterval ageLimit = _ageLimit; - [self unlock]; - - if (ageLimit == 0.0) - return; - - NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:-ageLimit]; - - [self trimMemoryToDate:date]; - - dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ageLimit * NSEC_PER_SEC)); - dispatch_after(time, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ - // Ensure that ageLimit is the same as when we were scheduled, otherwise, we've been - // rescheduled (another dispatch_after was issued) and should cancel. - BOOL shouldReschedule = YES; - [self lock]; - if (ageLimit != self->_ageLimit) { - shouldReschedule = NO; - } - [self unlock]; - - if (shouldReschedule) { - [self.operationQueue scheduleOperation:^{ - [self trimToAgeLimitRecursively]; - } withPriority:PINOperationQueuePriorityLow]; - } - }); -} - -#pragma mark - Public Asynchronous Methods - - -- (void)containsObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectContainmentBlock)block -{ - if (!key || !block) - return; - - [self.operationQueue scheduleOperation:^{ - BOOL containsObject = [self containsObjectForKey:key]; - - block(containsObject); - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)objectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block -{ - if (block == nil) { - return; - } - - [self.operationQueue scheduleOperation:^{ - id object = [self objectForKey:key]; - - block(self, key, object); - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)setObjectAsync:(id)object forKey:(NSString *)key completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:0 completion:block]; -} - -- (void)setObjectAsync:(id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:0 ageLimit:ageLimit completion:block]; -} - -- (void)setObjectAsync:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost completion:(PINCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:cost ageLimit:0.0 completion:block]; -} - -- (void)setObjectAsync:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit completion:(PINCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self setObject:object forKey:key withCost:cost ageLimit:ageLimit]; - - if (block) - block(self, key, object); - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)removeObjectForKeyAsync:(NSString *)key completion:(PINCacheObjectBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self removeObjectForKey:key]; - - if (block) - block(self, key, nil); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)trimToDateAsync:(NSDate *)trimDate completion:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self trimToDate:trimDate]; - - if (block) - block(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)trimToCostAsync:(NSUInteger)cost completion:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self trimToCost:cost]; - - if (block) - block(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)trimToCostByDateAsync:(NSUInteger)cost completion:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self trimToCostByDate:cost]; - - if (block) - block(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)removeExpiredObjectsAsync:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self removeExpiredObjects]; - - if (block) - block(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)removeAllObjectsAsync:(PINCacheBlock)block -{ - [self.operationQueue scheduleOperation:^{ - [self removeAllObjects]; - - if (block) - block(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -- (void)enumerateObjectsWithBlockAsync:(PINCacheObjectEnumerationBlock)block completionBlock:(PINCacheBlock)completionBlock -{ - [self.operationQueue scheduleOperation:^{ - [self enumerateObjectsWithBlock:block]; - - if (completionBlock) - completionBlock(self); - } withPriority:PINOperationQueuePriorityLow]; -} - -#pragma mark - Public Synchronous Methods - - -- (BOOL)containsObjectForKey:(NSString *)key -{ - if (!key) - return NO; - - [self lock]; - BOOL containsObject = (_dictionary[key] != nil); - [self unlock]; - return containsObject; -} - -- (nullable id)objectForKey:(NSString *)key -{ - if (!key) - return nil; - - NSDate *now = [NSDate date]; - [self lock]; - id object = nil; - // If the cache should behave like a TTL cache, then only fetch the object if there's a valid ageLimit and the object is still alive - NSTimeInterval ageLimit = [_ageLimits[key] doubleValue] ?: self->_ageLimit; - if (!self->_ttlCache || ageLimit <= 0 || fabs([[_createdDates objectForKey:key] timeIntervalSinceDate:now]) < ageLimit) { - object = _dictionary[key]; - } - [self unlock]; - - if (object) { - [self lock]; - _accessDates[key] = now; - [self unlock]; - } - - return object; -} - -- (id)objectForKeyedSubscript:(NSString *)key -{ - return [self objectForKey:key]; -} - -- (void)setObject:(id)object forKey:(NSString *)key -{ - [self setObject:object forKey:key withCost:0]; -} - -- (void)setObject:(id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit -{ - [self setObject:object forKey:key withCost:0 ageLimit:ageLimit]; -} - -- (void)setObject:(id)object forKeyedSubscript:(NSString *)key -{ - if (object == nil) { - [self removeObjectForKey:key]; - } else { - [self setObject:object forKey:key]; - } -} - -- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost -{ - [self setObject:object forKey:key withCost:cost ageLimit:0.0]; -} - -- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost ageLimit:(NSTimeInterval)ageLimit -{ - NSAssert(ageLimit <= 0.0 || (ageLimit > 0.0 && _ttlCache), @"ttlCache must be set to YES if setting an object-level age limit."); - - if (!key || !object) - return; - - [self lock]; - PINCacheObjectBlock willAddObjectBlock = _willAddObjectBlock; - PINCacheObjectBlock didAddObjectBlock = _didAddObjectBlock; - NSUInteger costLimit = _costLimit; - [self unlock]; - - if (willAddObjectBlock) - willAddObjectBlock(self, key, object); - - [self lock]; - NSNumber* oldCost = _costs[key]; - if (oldCost) - _totalCost -= [oldCost unsignedIntegerValue]; - - NSDate *now = [NSDate date]; - _dictionary[key] = object; - _createdDates[key] = now; - _accessDates[key] = now; - _costs[key] = @(cost); - - if (ageLimit > 0.0) { - _ageLimits[key] = @(ageLimit); - } else { - [_ageLimits removeObjectForKey:key]; - } - - _totalCost += cost; - [self unlock]; - - if (didAddObjectBlock) - didAddObjectBlock(self, key, object); - - if (costLimit > 0) - [self trimToCostByDate:costLimit]; -} - -- (void)removeObjectForKey:(NSString *)key -{ - if (!key) - return; - - [self removeObjectAndExecuteBlocksForKey:key]; -} - -- (void)trimToDate:(NSDate *)trimDate -{ - if (!trimDate) - return; - - if ([trimDate isEqualToDate:[NSDate distantPast]]) { - [self removeAllObjects]; - return; - } - - [self trimMemoryToDate:trimDate]; -} - -- (void)trimToCost:(NSUInteger)cost -{ - [self trimToCostLimit:cost]; -} - -- (void)trimToCostByDate:(NSUInteger)cost -{ - [self trimToCostLimitByDate:cost]; -} - -- (void)removeAllObjects -{ - [self lock]; - PINCacheBlock willRemoveAllObjectsBlock = _willRemoveAllObjectsBlock; - PINCacheBlock didRemoveAllObjectsBlock = _didRemoveAllObjectsBlock; - [self unlock]; - - if (willRemoveAllObjectsBlock) - willRemoveAllObjectsBlock(self); - - [self lock]; - [_dictionary removeAllObjects]; - [_createdDates removeAllObjects]; - [_accessDates removeAllObjects]; - [_costs removeAllObjects]; - [_ageLimits removeAllObjects]; - - _totalCost = 0; - [self unlock]; - - if (didRemoveAllObjectsBlock) - didRemoveAllObjectsBlock(self); - -} - -- (void)enumerateObjectsWithBlock:(PIN_NOESCAPE PINCacheObjectEnumerationBlock)block -{ - if (!block) - return; - - [self lock]; - NSDate *now = [NSDate date]; - NSArray *keysSortedByCreatedDate = [_createdDates keysSortedByValueUsingSelector:@selector(compare:)]; - - for (NSString *key in keysSortedByCreatedDate) { - // If the cache should behave like a TTL cache, then only fetch the object if there's a valid ageLimit and the object is still alive - NSTimeInterval ageLimit = [_ageLimits[key] doubleValue] ?: self->_ageLimit; - if (!self->_ttlCache || ageLimit <= 0 || fabs([[_createdDates objectForKey:key] timeIntervalSinceDate:now]) < ageLimit) { - BOOL stop = NO; - block(self, key, _dictionary[key], &stop); - if (stop) - break; - } - } - [self unlock]; -} - -#pragma mark - Public Thread Safe Accessors - - -- (PINCacheObjectBlock)willAddObjectBlock -{ - [self lock]; - PINCacheObjectBlock block = _willAddObjectBlock; - [self unlock]; - - return block; -} - -- (void)setWillAddObjectBlock:(PINCacheObjectBlock)block -{ - [self lock]; - _willAddObjectBlock = [block copy]; - [self unlock]; -} - -- (PINCacheObjectBlock)willRemoveObjectBlock -{ - [self lock]; - PINCacheObjectBlock block = _willRemoveObjectBlock; - [self unlock]; - - return block; -} - -- (void)setWillRemoveObjectBlock:(PINCacheObjectBlock)block -{ - [self lock]; - _willRemoveObjectBlock = [block copy]; - [self unlock]; -} - -- (PINCacheBlock)willRemoveAllObjectsBlock -{ - [self lock]; - PINCacheBlock block = _willRemoveAllObjectsBlock; - [self unlock]; - - return block; -} - -- (void)setWillRemoveAllObjectsBlock:(PINCacheBlock)block -{ - [self lock]; - _willRemoveAllObjectsBlock = [block copy]; - [self unlock]; -} - -- (PINCacheObjectBlock)didAddObjectBlock -{ - [self lock]; - PINCacheObjectBlock block = _didAddObjectBlock; - [self unlock]; - - return block; -} - -- (void)setDidAddObjectBlock:(PINCacheObjectBlock)block -{ - [self lock]; - _didAddObjectBlock = [block copy]; - [self unlock]; -} - -- (PINCacheObjectBlock)didRemoveObjectBlock -{ - [self lock]; - PINCacheObjectBlock block = _didRemoveObjectBlock; - [self unlock]; - - return block; -} - -- (void)setDidRemoveObjectBlock:(PINCacheObjectBlock)block -{ - [self lock]; - _didRemoveObjectBlock = [block copy]; - [self unlock]; -} - -- (PINCacheBlock)didRemoveAllObjectsBlock -{ - [self lock]; - PINCacheBlock block = _didRemoveAllObjectsBlock; - [self unlock]; - - return block; -} - -- (void)setDidRemoveAllObjectsBlock:(PINCacheBlock)block -{ - [self lock]; - _didRemoveAllObjectsBlock = [block copy]; - [self unlock]; -} - -- (PINCacheBlock)didReceiveMemoryWarningBlock -{ - [self lock]; - PINCacheBlock block = _didReceiveMemoryWarningBlock; - [self unlock]; - - return block; -} - -- (void)setDidReceiveMemoryWarningBlock:(PINCacheBlock)block -{ - [self lock]; - _didReceiveMemoryWarningBlock = [block copy]; - [self unlock]; -} - -- (PINCacheBlock)didEnterBackgroundBlock -{ - [self lock]; - PINCacheBlock block = _didEnterBackgroundBlock; - [self unlock]; - - return block; -} - -- (void)setDidEnterBackgroundBlock:(PINCacheBlock)block -{ - [self lock]; - _didEnterBackgroundBlock = [block copy]; - [self unlock]; -} - -- (NSTimeInterval)ageLimit -{ - [self lock]; - NSTimeInterval ageLimit = _ageLimit; - [self unlock]; - - return ageLimit; -} - -- (void)setAgeLimit:(NSTimeInterval)ageLimit -{ - [self lock]; - _ageLimit = ageLimit; - [self unlock]; - - [self trimToAgeLimitRecursively]; -} - -- (NSUInteger)costLimit -{ - [self lock]; - NSUInteger costLimit = _costLimit; - [self unlock]; - - return costLimit; -} - -- (void)setCostLimit:(NSUInteger)costLimit -{ - [self lock]; - _costLimit = costLimit; - [self unlock]; - - if (costLimit > 0) - [self trimToCostLimitByDate:costLimit]; -} - -- (NSUInteger)totalCost -{ - [self lock]; - NSUInteger cost = _totalCost; - [self unlock]; - - return cost; -} - -- (BOOL)isTTLCache { - BOOL isTTLCache; - - [self lock]; - isTTLCache = _ttlCache; - [self unlock]; - - return isTTLCache; -} - -- (void)lock -{ - __unused int result = pthread_mutex_lock(&_mutex); - NSAssert(result == 0, @"Failed to lock PINMemoryCache %@. Code: %d", self, result); -} - -- (void)unlock -{ - __unused int result = pthread_mutex_unlock(&_mutex); - NSAssert(result == 0, @"Failed to unlock PINMemoryCache %@. Code: %d", self, result); -} - -@end - - -#pragma mark - Deprecated - -@implementation PINMemoryCache (Deprecated) - -- (void)containsObjectForKey:(NSString *)key block:(PINMemoryCacheContainmentBlock)block -{ - [self containsObjectForKeyAsync:key completion:block]; -} - -- (void)objectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block -{ - [self objectForKeyAsync:key completion:^(id memoryCache, NSString *memoryCacheKey, id memoryCacheObject) { - if (block) { - block((PINMemoryCache *)memoryCache, memoryCacheKey, memoryCacheObject); - } - }]; -} - -- (void)setObject:(id)object forKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key completion:^(id memoryCache, NSString *memoryCacheKey, id memoryCacheObject) { - if (block) { - block((PINMemoryCache *)memoryCache, memoryCacheKey, memoryCacheObject); - } - }]; -} - -- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINMemoryCacheObjectBlock)block -{ - [self setObjectAsync:object forKey:key withCost:cost completion:^(id memoryCache, NSString *memoryCacheKey, id memoryCacheObject) { - if (block) { - block((PINMemoryCache *)memoryCache, memoryCacheKey, memoryCacheObject); - } - }]; -} - -- (void)removeObjectForKey:(NSString *)key block:(nullable PINMemoryCacheObjectBlock)block -{ - [self removeObjectForKeyAsync:key completion:^(id memoryCache, NSString *memoryCacheKey, id memoryCacheObject) { - if (block) { - block((PINMemoryCache *)memoryCache, memoryCacheKey, memoryCacheObject); - } - }]; -} - -- (void)trimToDate:(NSDate *)date block:(nullable PINMemoryCacheBlock)block -{ - [self trimToDateAsync:date completion:^(id memoryCache) { - if (block) { - block((PINMemoryCache *)memoryCache); - } - }]; -} - -- (void)trimToCost:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block -{ - [self trimToCostAsync:cost completion:^(id memoryCache) { - if (block) { - block((PINMemoryCache *)memoryCache); - } - }]; -} - -- (void)trimToCostByDate:(NSUInteger)cost block:(nullable PINMemoryCacheBlock)block -{ - [self trimToCostByDateAsync:cost completion:^(id memoryCache) { - if (block) { - block((PINMemoryCache *)memoryCache); - } - }]; -} - -- (void)removeAllObjects:(nullable PINMemoryCacheBlock)block -{ - [self removeAllObjectsAsync:^(id memoryCache) { - if (block) { - block((PINMemoryCache *)memoryCache); - } - }]; -} - -- (void)enumerateObjectsWithBlock:(PINMemoryCacheObjectBlock)block completionBlock:(nullable PINMemoryCacheBlock)completionBlock -{ - [self enumerateObjectsWithBlockAsync:^(id _Nonnull cache, NSString * _Nonnull key, id _Nullable object, BOOL * _Nonnull stop) { - if ([cache isKindOfClass:[PINMemoryCache class]]) { - PINMemoryCache *memoryCache = (PINMemoryCache *)cache; - block(memoryCache, key, object); - } - } completionBlock:^(id memoryCache) { - if (completionBlock) { - completionBlock((PINMemoryCache *)memoryCache); - } - }]; -} - -- (void)setTtlCache:(BOOL)ttlCache -{ - [self lock]; - _ttlCache = ttlCache; - [self unlock]; -} - -@end diff --git a/Example/Pods/PINOperation/LICENSE.txt b/Example/Pods/PINOperation/LICENSE.txt deleted file mode 100644 index d0381d6d..00000000 --- a/Example/Pods/PINOperation/LICENSE.txt +++ /dev/null @@ -1,176 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/Example/Pods/PINOperation/README.md b/Example/Pods/PINOperation/README.md deleted file mode 100644 index c7ac84ec..00000000 --- a/Example/Pods/PINOperation/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# PINOperation - -[![CocoaPods](https://img.shields.io/cocoapods/v/PINOperation.svg)](http://cocoadocs.org/docsets/PINOperation/) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Build status](https://github.com/pinterest/PINOperation/workflows/CI/badge.svg)](https://github.com/pinterest/PINOperation/actions?query=workflow%3ACI+branch%3Amaster) - -## Fast, concurrency-limited task queue for iOS and macOS. - -## Installation - -### Manually - -[Download the latest tag](https://github.com/pinterest/PINOperation/tags) and drag the `PINOperation` folder into your Xcode project. - -Install the docs by double clicking the `.docset` file under `docs/`, or view them online at [cocoadocs.org](http://cocoadocs.org/docsets/PINOperation/) - -### Git Submodule - - git submodule add https://github.com/pinterest/PINOperation.git - git submodule update --init - -### CocoaPods - -Add [PINOperation](http://cocoapods.org/?q=name%3APINOperation) to your `Podfile` and run `pod install`. - -### Carthage - -Add the following line to your `Cartfile` and run `carthage update --platform ios`. Then follow [this instruction of Carthage](https://github.com/carthage/carthage#adding-frameworks-to-unit-tests-or-a-framework) to embed the framework. - -```github "pinterest/PINOperation"``` - -## Requirements - -__PINOperation__ requires iOS 8.0, tvOS 9.0, macOS 10.8 or watchOS 2.0 and greater. - -## Contact - -[Garrett Moon](mailto:garrett@pinterest.com) - -## License - -Copyright 2013 Tumblr, Inc. -Copyright 2015 Pinterest, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. [See the License](LICENSE.txt) for the specific language governing permissions and limitations under the License. diff --git a/Example/Pods/PINOperation/Source/PINOperation.h b/Example/Pods/PINOperation/Source/PINOperation.h deleted file mode 100644 index 68b074d2..00000000 --- a/Example/Pods/PINOperation/Source/PINOperation.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// PINOperation.h -// PINOperation -// -// Created by Adlai Holler on 1/10/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINOperationMacros.h" -#import "PINOperationTypes.h" -#import "PINOperationQueue.h" -#import "PINOperationGroup.h" diff --git a/Example/Pods/PINOperation/Source/PINOperationGroup.h b/Example/Pods/PINOperation/Source/PINOperationGroup.h deleted file mode 100644 index 0ae7dbac..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationGroup.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// PINOperationGroup.h -// PINQueue -// -// Created by Garrett Moon on 10/8/16. -// Copyright © 2016 Pinterest. All rights reserved. -// - -#import -#import "PINOperationTypes.h" -#import "PINOperationMacros.h" - -@class PINOperationQueue; - -NS_ASSUME_NONNULL_BEGIN - -@protocol PINGroupOperationReference; - -PINOP_SUBCLASSING_RESTRICTED -@interface PINOperationGroup : NSObject - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)asyncOperationGroupWithQueue:(PINOperationQueue *)operationQueue; - -- (nullable id )addOperation:(dispatch_block_t)operation; -- (nullable id )addOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority; -- (void)start; -- (void)cancel; -- (void)setCompletion:(dispatch_block_t)completion; -- (void)waitUntilComplete; - -@end - -@protocol PINGroupOperationReference - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINOperation/Source/PINOperationGroup.m b/Example/Pods/PINOperation/Source/PINOperationGroup.m deleted file mode 100644 index ddd2ed01..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationGroup.m +++ /dev/null @@ -1,187 +0,0 @@ -// -// PINOperationGroup.m -// PINQueue -// -// Created by Garrett Moon on 10/8/16. -// Copyright © 2016 Pinterest. All rights reserved. -// - -#import "PINOperationGroup.h" -#import "PINOperation.h" -#import - -@interface NSNumber (PINGroupOperationQueue) -@end - -@interface PINOperationGroup () -{ - pthread_mutex_t _lock; - - PINOperationQueue *_operationQueue; - NSMutableArray *_operations; - NSMutableArray *_operationPriorities; - NSMutableArray > *_operationReferences; - NSMapTable , id > *_groupToOperationReferences; - NSUInteger _operationReferenceCount; - - dispatch_group_t _group; - - dispatch_block_t _completion; - - BOOL _started; - BOOL _canceled; -} - -- (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue NS_DESIGNATED_INITIALIZER; - -@end - -@implementation PINOperationGroup - -- (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue -{ - if (self = [super init]) { - pthread_mutex_init(&_lock, NULL); - - _operationQueue = operationQueue; - - _operations = [[NSMutableArray alloc] init]; - _operationReferences = [[NSMutableArray alloc] init]; - _operationPriorities = [[NSMutableArray alloc] init]; - - _groupToOperationReferences = [NSMapTable weakToStrongObjectsMapTable]; - _group = dispatch_group_create(); - } - return self; -} - -- (void)dealloc -{ - pthread_mutex_destroy(&_lock); -} - -+ (instancetype)asyncOperationGroupWithQueue:(PINOperationQueue *)operationQueue -{ - return [[self alloc] initWithOperationQueue:operationQueue]; -} - -- (id )locked_nextOperationReference -{ - id reference = [NSNumber numberWithUnsignedInteger:++_operationReferenceCount]; - return reference; -} - -- (void)start -{ - [self lock]; - NSAssert(_canceled == NO, @"Operation group canceled."); - if (_started == NO && _canceled == NO) { - for (NSUInteger idx = 0; idx < _operations.count; idx++) { - dispatch_group_enter(_group); - dispatch_block_t originalOperation = _operations[idx]; - dispatch_block_t groupBlock = ^{ - originalOperation(); - dispatch_group_leave(self->_group); - }; - - id operationReference = [_operationQueue scheduleOperation:groupBlock withPriority:[_operationPriorities[idx] unsignedIntegerValue]]; - [_groupToOperationReferences setObject:operationReference forKey:_operationReferences[idx]]; - } - - if (_completion) { - dispatch_queue_t completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - dispatch_group_notify(_group, completionQueue, ^{ - [self runCompletionIfNeeded]; - }); - } - - _operations = nil; - _operationPriorities = nil; - _operationReferences = nil; - } - [self unlock]; -} - -- (void)cancel -{ - [self lock]; - _canceled = YES; - - for (id operationReference in [_groupToOperationReferences objectEnumerator]) { - if ([_operationQueue cancelOperation:operationReference]) { - dispatch_group_leave(_group); - } - } - - //TODO just nil out instead? Does it make sense to support adding operations after cancelation? - [_groupToOperationReferences removeAllObjects]; - [_operations removeAllObjects]; - [_operationPriorities removeAllObjects]; - [_operationReferences removeAllObjects]; - - _completion = nil; - [self unlock]; -} - -- (id )addOperation:(dispatch_block_t)operation -{ - return [self addOperation:operation withPriority:PINOperationQueuePriorityDefault]; -} - -- (id )addOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority -{ - [self lock]; - id reference = nil; - NSAssert(_started == NO && _canceled == NO, @"Operation group already started or canceled."); - if (_started == NO && _canceled == NO) { - reference = [self locked_nextOperationReference]; - [_operations addObject:operation]; - [_operationPriorities addObject:@(priority)]; - [_operationReferences addObject:reference]; - } - [self unlock]; - - return reference; -} - -- (void)setCompletion:(dispatch_block_t)completion -{ - [self lock]; - NSAssert(_started == NO && _canceled == NO, @"Operation group already started or canceled."); - if (_started == NO && _canceled == NO) { - _completion = completion; - } - [self unlock]; -} - -- (void)waitUntilComplete -{ - [self start]; - dispatch_group_wait(_group, DISPATCH_TIME_FOREVER); - [self runCompletionIfNeeded]; -} - -- (void)runCompletionIfNeeded -{ - dispatch_block_t completion; - [self lock]; - completion = _completion; - _completion = nil; - [self unlock]; - - if (completion) { - completion(); - } -} - -- (void)lock -{ - pthread_mutex_lock(&_lock); -} - -- (void)unlock -{ - pthread_mutex_unlock(&_lock); -} - -@end diff --git a/Example/Pods/PINOperation/Source/PINOperationMacros.h b/Example/Pods/PINOperation/Source/PINOperationMacros.h deleted file mode 100644 index 5be3a216..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationMacros.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PINOperationMacros.h -// PINOperation -// -// Created by Adlai Holler on 1/10/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#ifndef PINOP_SUBCLASSING_RESTRICTED -#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -#define PINOP_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted)) -#else -#define PINOP_SUBCLASSING_RESTRICTED -#endif // #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) -#endif // #ifndef PINOP_SUBCLASSING_RESTRICTED diff --git a/Example/Pods/PINOperation/Source/PINOperationQueue.h b/Example/Pods/PINOperation/Source/PINOperationQueue.h deleted file mode 100644 index 07eacbeb..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationQueue.h +++ /dev/null @@ -1,141 +0,0 @@ -// -// PINOperationQueue.h -// Pods -// -// Created by Garrett Moon on 8/23/16. -// -// - -#import -#import "PINOperationTypes.h" -#import "PINOperationMacros.h" - -NS_ASSUME_NONNULL_BEGIN - -typedef void(^PINOperationBlock)(id _Nullable data); -typedef _Nullable id(^PINOperationDataCoalescingBlock)(id _Nullable existingData, id _Nullable newData); - -@protocol PINOperationReference; - -PINOP_SUBCLASSING_RESTRICTED -@interface PINOperationQueue : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Initializes and returns a newly allocated operation queue with the specified number of maximum concurrent operations. - * - * @param maxConcurrentOperations The maximum number of queued operations that can execute at the same time. - * - */ -- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations; - -/** - * Initializes and returns a newly allocated operation queue with the specified number of maximum concurrent operations and the concurrent queue they will be scheduled on. - * - * @param maxConcurrentOperations The maximum number of queued operations that can execute at the same time. - * @param concurrentQueue The operation queue to schedule concurrent operations - * - */ -- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations concurrentQueue:(dispatch_queue_t)concurrentQueue NS_DESIGNATED_INITIALIZER; - -/** - * Returns the shared instance of the PINOperationQueue class. - */ -+ (instancetype)sharedOperationQueue; - -/** - * Adds the specified operation object to the receiver. - * - * @param operation The operation object to be added to the queue. - * - */ -- (id )scheduleOperation:(dispatch_block_t)operation; - -/** - * Adds the specified operation object to the receiver. - * - * @param operation The operation object to be added to the queue. - * @param priority The execution priority of the operation in an operation queue. - */ -- (id )scheduleOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority; - -/** - * Adds the specified operation object to the receiver. - * - * @param operation The operation object to be added to the queue. - * @param priority The execution priority of the operation in an operation queue. - * @param identifier A string that identifies the operations that can be coalesced. - * @param coalescingData The optional data consumed by this operation that needs to be updated/coalesced with data of a new operation when coalescing the two operations happens. - * @param dataCoalescingBlock The optional block called to update/coalesce the data of this operation with data of a new operation when coalescing the two operations happens. - * @param completion The block to execute after the operation finished. - */ -- (id )scheduleOperation:(PINOperationBlock)operation - withPriority:(PINOperationQueuePriority)priority - identifier:(nullable NSString *)identifier - coalescingData:(nullable id)coalescingData - dataCoalescingBlock:(nullable PINOperationDataCoalescingBlock)dataCoalescingBlock - completion:(nullable dispatch_block_t)completion; - -/** - * The maximum number of queued operations that can execute at the same time. - * - * @discussion The value in this property affects only the operations that the current queue has executing at the same time. Other operation queues can also execute their maximum number of operations in parallel. - * Reducing the number of concurrent operations does not affect any operations that are currently executing. - * - * Setting this value to 1 the operations will not be processed by priority as the operations will processed in a FIFO order to prevent deadlocks if operations depend on certain other operations to run in order. - * - */ -@property (assign) NSUInteger maxConcurrentOperations; - -/** - * Marks the operation as cancelled - */ -- (BOOL)cancelOperation:(id )operationReference; - -/** - * Cancels all queued operations - */ -- (void)cancelAllOperations; - -/** - * Blocks the current thread until all of the receiver’s queued and executing operations finish executing. - * - * @discussion When called, this method blocks the current thread and waits for the receiver’s current and queued - * operations to finish executing. While the current thread is blocked, the receiver continues to launch already - * queued operations and monitor those that are executing. - * - * @warning This should never be called from within an operation submitted to the PINOperationQueue as this will result - * in a deadlock. - */ -- (void)waitUntilAllOperationsAreFinished; - -/** - * Sets the priority for a operation via it's reference - * - * @param priority The new priority for the operation - * @param reference The reference for the operation - * - */ -- (void)setOperationPriority:(PINOperationQueuePriority)priority withReference:(id )reference; - -#pragma mark - Deprecated - -- (id )addOperation:(dispatch_block_t)operation __deprecated_msg("Use scheduleOperation: instead."); - -- (id )addOperation:(dispatch_block_t)operation withPriority:(PINOperationQueuePriority)priority __deprecated_msg("Use scheduleOperation:withPriority: instead."); - -- (id )addOperation:(PINOperationBlock)operation - withPriority:(PINOperationQueuePriority)priority - identifier:(nullable NSString *)identifier - coalescingData:(nullable id)coalescingData - dataCoalescingBlock:(nullable PINOperationDataCoalescingBlock)dataCoalescingBlock - completion:(nullable dispatch_block_t)completion __deprecated_msg("Use scheduleOperation:withPriority:identifier:coalescingData:dataCoalescingBlock:completion: instead."); - -@end - -@protocol PINOperationReference - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINOperation/Source/PINOperationQueue.m b/Example/Pods/PINOperation/Source/PINOperationQueue.m deleted file mode 100644 index 5d0a38fe..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationQueue.m +++ /dev/null @@ -1,471 +0,0 @@ -// -// PINOperationQueue.m -// Pods -// -// Created by Garrett Moon on 8/23/16. -// -// - -#import "PINOperationQueue.h" -#import - -@class PINOperation; - -@interface NSNumber (PINOperationQueue) - -@end - -@interface PINOperationQueue () { - pthread_mutex_t _lock; - //increments with every operation to allow cancelation - NSUInteger _operationReferenceCount; - NSUInteger _maxConcurrentOperations; - - dispatch_group_t _group; - - dispatch_queue_t _serialQueue; - BOOL _serialQueueBusy; - - dispatch_semaphore_t _concurrentSemaphore; - dispatch_queue_t _concurrentQueue; - dispatch_queue_t _semaphoreQueue; - - NSMutableOrderedSet *_queuedOperations; - NSMutableOrderedSet *_lowPriorityOperations; - NSMutableOrderedSet *_defaultPriorityOperations; - NSMutableOrderedSet *_highPriorityOperations; - - NSMapTable, PINOperation *> *_referenceToOperations; - NSMapTable *_identifierToOperations; -} - -@end - -@interface PINOperation : NSObject - -@property (nonatomic, strong) PINOperationBlock block; -@property (nonatomic, strong) id reference; -@property (nonatomic, assign) PINOperationQueuePriority priority; -@property (nonatomic, strong) NSMutableArray *completions; -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, strong) id data; - -+ (instancetype)operationWithBlock:(PINOperationBlock)block reference:(id )reference priority:(PINOperationQueuePriority)priority identifier:(nullable NSString *)identifier data:(nullable id)data completion:(nullable dispatch_block_t)completion; - -- (void)addCompletion:(nullable dispatch_block_t)completion; - -@end - -@implementation PINOperation - -+ (instancetype)operationWithBlock:(PINOperationBlock)block reference:(id)reference priority:(PINOperationQueuePriority)priority identifier:(NSString *)identifier data:(id)data completion:(dispatch_block_t)completion -{ - PINOperation *operation = [[self alloc] init]; - operation.block = block; - operation.reference = reference; - operation.priority = priority; - operation.identifier = identifier; - operation.data = data; - [operation addCompletion:completion]; - - return operation; -} - -- (void)addCompletion:(dispatch_block_t)completion -{ - if (completion == nil) { - return; - } - if (_completions == nil) { - _completions = [NSMutableArray array]; - } - [_completions addObject:completion]; -} - -@end - -@implementation PINOperationQueue - -- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations -{ - return [self initWithMaxConcurrentOperations:maxConcurrentOperations concurrentQueue:dispatch_queue_create("PINOperationQueue Concurrent Queue", DISPATCH_QUEUE_CONCURRENT)]; -} - -- (instancetype)initWithMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations concurrentQueue:(dispatch_queue_t)concurrentQueue -{ - if (self = [super init]) { - NSAssert(maxConcurrentOperations > 0, @"Max concurrent operations must be greater than 0."); - _maxConcurrentOperations = maxConcurrentOperations; - _operationReferenceCount = 0; - - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - //mutex must be recursive to allow scheduling of operations from within operations - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&_lock, &attr); - - _group = dispatch_group_create(); - - _serialQueue = dispatch_queue_create("PINOperationQueue Serial Queue", DISPATCH_QUEUE_SERIAL); - - _concurrentQueue = concurrentQueue; - - //Create a queue with max - 1 because this plus the serial queue add up to max. - _concurrentSemaphore = dispatch_semaphore_create(_maxConcurrentOperations - 1); - _semaphoreQueue = dispatch_queue_create("PINOperationQueue Serial Semaphore Queue", DISPATCH_QUEUE_SERIAL); - - _queuedOperations = [[NSMutableOrderedSet alloc] init]; - _lowPriorityOperations = [[NSMutableOrderedSet alloc] init]; - _defaultPriorityOperations = [[NSMutableOrderedSet alloc] init]; - _highPriorityOperations = [[NSMutableOrderedSet alloc] init]; - - _referenceToOperations = [NSMapTable weakToWeakObjectsMapTable]; - _identifierToOperations = [NSMapTable weakToWeakObjectsMapTable]; - } - return self; -} - -- (void)dealloc -{ - pthread_mutex_destroy(&_lock); -} - -+ (instancetype)sharedOperationQueue -{ - static PINOperationQueue *sharedOperationQueue = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedOperationQueue = [[PINOperationQueue alloc] initWithMaxConcurrentOperations:MAX([[NSProcessInfo processInfo] activeProcessorCount], 2)]; - }); - return sharedOperationQueue; -} - -- (id )nextOperationReference -{ - [self lock]; - id reference = [NSNumber numberWithUnsignedInteger:++_operationReferenceCount]; - [self unlock]; - return reference; -} - -// Deprecated -- (id )addOperation:(dispatch_block_t)block -{ - return [self scheduleOperation:block]; -} - -- (id )scheduleOperation:(dispatch_block_t)block -{ - return [self scheduleOperation:block withPriority:PINOperationQueuePriorityDefault]; -} - -// Deprecated -- (id )addOperation:(dispatch_block_t)block withPriority:(PINOperationQueuePriority)priority -{ - return [self scheduleOperation:block withPriority:priority]; -} - -- (id )scheduleOperation:(dispatch_block_t)block withPriority:(PINOperationQueuePriority)priority -{ - PINOperation *operation = [PINOperation operationWithBlock:^(id data) { block(); } - reference:[self nextOperationReference] - priority:priority - identifier:nil - data:nil - completion:nil]; - [self lock]; - [self locked_addOperation:operation]; - [self unlock]; - - [self scheduleNextOperations:NO]; - - return operation.reference; -} - -// Deprecated -- (id)addOperation:(PINOperationBlock)block - withPriority:(PINOperationQueuePriority)priority - identifier:(NSString *)identifier - coalescingData:(id)coalescingData - dataCoalescingBlock:(PINOperationDataCoalescingBlock)dataCoalescingBlock - completion:(dispatch_block_t)completion -{ - return [self scheduleOperation:block - withPriority:priority - identifier:identifier - coalescingData:coalescingData - dataCoalescingBlock:dataCoalescingBlock - completion:completion]; -} - -- (id)scheduleOperation:(PINOperationBlock)block - withPriority:(PINOperationQueuePriority)priority - identifier:(NSString *)identifier - coalescingData:(id)coalescingData - dataCoalescingBlock:(PINOperationDataCoalescingBlock)dataCoalescingBlock - completion:(dispatch_block_t)completion -{ - id reference = nil; - BOOL isNewOperation = NO; - - [self lock]; - PINOperation *operation = nil; - if (identifier != nil && (operation = [_identifierToOperations objectForKey:identifier]) != nil) { - // There is an exisiting operation with the provided identifier, let's coalesce these operations - if (dataCoalescingBlock != nil) { - operation.data = dataCoalescingBlock(operation.data, coalescingData); - } - - [operation addCompletion:completion]; - } else { - isNewOperation = YES; - operation = [PINOperation operationWithBlock:block - reference:[self nextOperationReference] - priority:priority - identifier:identifier - data:coalescingData - completion:completion]; - [self locked_addOperation:operation]; - } - reference = operation.reference; - [self unlock]; - - if (isNewOperation) { - [self scheduleNextOperations:NO]; - } - - return reference; -} - -- (void)locked_addOperation:(PINOperation *)operation -{ - NSMutableOrderedSet *queue = [self operationQueueWithPriority:operation.priority]; - - dispatch_group_enter(_group); - [queue addObject:operation]; - [_queuedOperations addObject:operation]; - [_referenceToOperations setObject:operation forKey:operation.reference]; - if (operation.identifier != nil) { - [_identifierToOperations setObject:operation forKey:operation.identifier]; - } -} - -- (void)cancelAllOperations -{ - [self lock]; - for (PINOperation *operation in [[_referenceToOperations copy] objectEnumerator]) { - [self locked_cancelOperation:operation.reference]; - } - [self unlock]; -} - - -- (BOOL)cancelOperation:(id )operationReference -{ - [self lock]; - BOOL success = [self locked_cancelOperation:operationReference]; - [self unlock]; - return success; -} - -- (NSUInteger)maxConcurrentOperations -{ - [self lock]; - NSUInteger maxConcurrentOperations = _maxConcurrentOperations; - [self unlock]; - return maxConcurrentOperations; -} - -- (void)setMaxConcurrentOperations:(NSUInteger)maxConcurrentOperations -{ - NSAssert(maxConcurrentOperations > 0, @"Max concurrent operations must be greater than 0."); - [self lock]; - __block NSInteger difference = maxConcurrentOperations - _maxConcurrentOperations; - _maxConcurrentOperations = maxConcurrentOperations; - [self unlock]; - - if (difference == 0) { - return; - } - - dispatch_async(_semaphoreQueue, ^{ - while (difference != 0) { - if (difference > 0) { - dispatch_semaphore_signal(self->_concurrentSemaphore); - difference--; - } else { - dispatch_semaphore_wait(self->_concurrentSemaphore, DISPATCH_TIME_FOREVER); - difference++; - } - } - }); -} - -#pragma mark - private methods - -- (BOOL)locked_cancelOperation:(id )operationReference -{ - PINOperation *operation = [_referenceToOperations objectForKey:operationReference]; - BOOL success = [self locked_removeOperation:operation]; - if (success) { - dispatch_group_leave(_group); - } - return success; -} - -- (void)setOperationPriority:(PINOperationQueuePriority)priority withReference:(id )operationReference -{ - [self lock]; - PINOperation *operation = [_referenceToOperations objectForKey:operationReference]; - if (operation && operation.priority != priority) { - NSMutableOrderedSet *oldQueue = [self operationQueueWithPriority:operation.priority]; - [oldQueue removeObject:operation]; - - operation.priority = priority; - - NSMutableOrderedSet *queue = [self operationQueueWithPriority:priority]; - [queue addObject:operation]; - } - [self unlock]; -} - -/** - Schedule next operations schedules the next operation by queue order onto the serial queue if - it's available and one operation by priority order onto the concurrent queue. - */ -- (void)scheduleNextOperations:(BOOL)onlyCheckSerial -{ - [self lock]; - - //get next available operation in order, ignoring priority and run it on the serial queue - if (_serialQueueBusy == NO) { - PINOperation *operation = [self locked_nextOperationByQueue]; - if (operation) { - _serialQueueBusy = YES; - dispatch_async(_serialQueue, ^{ - operation.block(operation.data); - for (dispatch_block_t completion in operation.completions) { - completion(); - } - dispatch_group_leave(self->_group); - - [self lock]; - self->_serialQueueBusy = NO; - [self unlock]; - - //see if there are any other operations - [self scheduleNextOperations:YES]; - }); - } - } - - NSInteger maxConcurrentOperations = _maxConcurrentOperations; - - [self unlock]; - - if (onlyCheckSerial) { - return; - } - - //if only one concurrent operation is set, let's just use the serial queue for executing it - if (maxConcurrentOperations < 2) { - return; - } - - dispatch_async(_semaphoreQueue, ^{ - dispatch_semaphore_wait(self->_concurrentSemaphore, DISPATCH_TIME_FOREVER); - [self lock]; - PINOperation *operation = [self locked_nextOperationByPriority]; - [self unlock]; - - if (operation) { - dispatch_async(self->_concurrentQueue, ^{ - operation.block(operation.data); - for (dispatch_block_t completion in operation.completions) { - completion(); - } - dispatch_group_leave(self->_group); - dispatch_semaphore_signal(self->_concurrentSemaphore); - }); - } else { - dispatch_semaphore_signal(self->_concurrentSemaphore); - } - }); -} - -- (NSMutableOrderedSet *)operationQueueWithPriority:(PINOperationQueuePriority)priority -{ - switch (priority) { - case PINOperationQueuePriorityLow: - return _lowPriorityOperations; - - case PINOperationQueuePriorityDefault: - return _defaultPriorityOperations; - - case PINOperationQueuePriorityHigh: - return _highPriorityOperations; - - default: - NSAssert(NO, @"Invalid priority set"); - return _defaultPriorityOperations; - } -} - -//Call with lock held -- (PINOperation *)locked_nextOperationByPriority -{ - PINOperation *operation = [_highPriorityOperations firstObject]; - if (operation == nil) { - operation = [_defaultPriorityOperations firstObject]; - } - if (operation == nil) { - operation = [_lowPriorityOperations firstObject]; - } - if (operation) { - [self locked_removeOperation:operation]; - } - return operation; -} - -//Call with lock held -- (PINOperation *)locked_nextOperationByQueue -{ - PINOperation *operation = [_queuedOperations firstObject]; - [self locked_removeOperation:operation]; - return operation; -} - -- (void)waitUntilAllOperationsAreFinished -{ - [self scheduleNextOperations:NO]; - dispatch_group_wait(_group, DISPATCH_TIME_FOREVER); -} - -//Call with lock held -- (BOOL)locked_removeOperation:(PINOperation *)operation -{ - if (operation) { - NSMutableOrderedSet *priorityQueue = [self operationQueueWithPriority:operation.priority]; - if ([priorityQueue containsObject:operation]) { - [priorityQueue removeObject:operation]; - [_queuedOperations removeObject:operation]; - if (operation.identifier) { - [_identifierToOperations removeObjectForKey:operation.identifier]; - } - return YES; - } - } - return NO; -} - -- (void)lock -{ - pthread_mutex_lock(&_lock); -} - -- (void)unlock -{ - pthread_mutex_unlock(&_lock); -} - -@end diff --git a/Example/Pods/PINOperation/Source/PINOperationTypes.h b/Example/Pods/PINOperation/Source/PINOperationTypes.h deleted file mode 100644 index be7293db..00000000 --- a/Example/Pods/PINOperation/Source/PINOperationTypes.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PINOperationTypes.h -// PINOperation -// -// Created by Adlai Holler on 1/10/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -typedef NS_ENUM(NSUInteger, PINOperationQueuePriority) { - PINOperationQueuePriorityLow, - PINOperationQueuePriorityDefault, - PINOperationQueuePriorityHigh, -}; diff --git a/Example/Pods/PINRemoteImage/LICENSE b/Example/Pods/PINRemoteImage/LICENSE deleted file mode 100644 index d0381d6d..00000000 --- a/Example/Pods/PINRemoteImage/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/Example/Pods/PINRemoteImage/README.md b/Example/Pods/PINRemoteImage/README.md deleted file mode 100644 index d1928210..00000000 --- a/Example/Pods/PINRemoteImage/README.md +++ /dev/null @@ -1,252 +0,0 @@ -# PINRemoteImage - -## Fast, non-deadlocking parallel image downloader and cache for iOS - -[![CocoaPods compatible](https://img.shields.io/cocoapods/v/PINRemoteImage.svg?style=flat)](https://cocoapods.org/pods/PINRemoteImage) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Build status](https://github.com/pinterest/PINRemoteImage/workflows/CI/badge.svg)](https://github.com/pinterest/PINRemoteImage/actions?query=workflow%3ACI+branch%3Amaster) - -[PINRemoteImageManager](Source/Classes/PINRemoteImageManager.h) is an image downloading, processing and caching manager. It uses the concept of download and processing tasks to ensure that even if multiple calls to download or process an image are made, it only occurs one time (unless an item is no longer in the cache). PINRemoteImageManager is backed by **GCD** and safe to **access** from **multiple threads** simultaneously. It ensures that images are decoded off the main thread so that animation performance isn't affected. None of its exposed methods allow for synchronous access. However, it is optimized to call completions on the calling thread if an item is in its memory cache. - -PINRemoteImage supports downloading many types of files. It, of course, **supports** both **PNGs** and **JPGs**. It also supports decoding **WebP** images if Google's library is available. It even supports **GIFs** and **Animated WebP** via PINAnimatedImageView. - -PINRemoteImage also has two methods to improve the experience of downloading images on slow network connections. The first is support for **progressive JPGs**. This isn't any old support for progressive JPGs though: PINRemoteImage adds an attractive blur to progressive scans before returning them. - -![Progressive JPG with Blur](/progressive.gif "Looks better on device.") - -[PINRemoteImageCategoryManager](Pod/Classes/PINRemoteImageCategoryManager.h) defines a protocol which UIView subclasses can implement and provide easy access to -PINRemoteImageManager's methods. There are **built-in categories** on **UIImageView**, **PINAnimatedImageView** and **UIButton**, and it's very easy to implement a new category. See [UIImageView+PINRemoteImage](/Pod/Classes/Image Categories/UIImageView+PINRemoteImage.h) of the existing categories for reference. - - -### Download an image and set it on an image view: - -**Objective-C** -```objc -UIImageView *imageView = [[UIImageView alloc] init]; -[imageView pin_setImageFromURL:[NSURL URLWithString:@"http://pinterest.com/kitten.jpg"]]; -``` - -**Swift** -```swift -let imageView = UIImageView() -imageView.pin_setImage(from: URL(string: "https://pinterest.com/kitten.jpg")!) -``` - -### Download a progressive jpeg and get attractive blurred updates: - -**Objective-C** -```objc -UIImageView *imageView = [[UIImageView alloc] init]; -[imageView setPin_updateWithProgress:YES]; -[imageView pin_setImageFromURL:[NSURL URLWithString:@"http://pinterest.com/progressiveKitten.jpg"]]; -``` - -**Swift** -```swift -let imageView = UIImageView() -imageView.pin_updateWithProgress = true -imageView.pin_setImage(from: URL(string: "https://pinterest.com/progressiveKitten.jpg")!) -``` - -### Download a WebP file - -**Objective-C** -```objc -UIImageView *imageView = [[UIImageView alloc] init]; -[imageView pin_setImageFromURL:[NSURL URLWithString:@"http://pinterest.com/googleKitten.webp"]]; -``` - -**Swift** -```swift -let imageView = UIImageView() -imageView.pin_setImage(from: URL(string: "https://pinterest.com/googleKitten.webp")!) -``` - -### Download a GIF and display with PINAnimatedImageView - -**Objective-C** -```objc -PINAnimatedImageView *animatedImageView = [[PINAnimatedImageView alloc] init]; -[animatedImageView pin_setImageFromURL:[NSURL URLWithString:@"http://pinterest.com/flyingKitten.gif"]]; -``` - -**Swift** -```swift -let animatedImageView = PINAnimatedImageView() -animatedImageView.pin_setImage(from: URL(string: "http://pinterest.com/flyingKitten.gif")!) -``` - -### Download and process an image - -**Objective-C** -```objc -UIImageView *imageView = [[UIImageView alloc] init]; -[self.imageView pin_setImageFromURL:[NSURL URLWithString:@"https://i.pinimg.com/736x/5b/c6/c5/5bc6c5387ff6f104fd642f2b375efba3.jpg"] processorKey:@"rounded" processor:^UIImage *(PINRemoteImageManagerResult *result, NSUInteger *cost) - { - CGSize targetSize = CGSizeMake(200, 300); - CGRect imageRect = CGRectMake(0, 0, targetSize.width, targetSize.height); - UIGraphicsBeginImageContext(imageRect.size); - UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:imageRect cornerRadius:7.0]; - [bezierPath addClip]; - - CGFloat sizeMultiplier = MAX(targetSize.width / result.image.size.width, targetSize.height / result.image.size.height); - - CGRect drawRect = CGRectMake(0, 0, result.image.size.width * sizeMultiplier, result.image.size.height * sizeMultiplier); - if (CGRectGetMaxX(drawRect) > CGRectGetMaxX(imageRect)) { - drawRect.origin.x -= (CGRectGetMaxX(drawRect) - CGRectGetMaxX(imageRect)) / 2.0; - } - if (CGRectGetMaxY(drawRect) > CGRectGetMaxY(imageRect)) { - drawRect.origin.y -= (CGRectGetMaxY(drawRect) - CGRectGetMaxY(imageRect)) / 2.0; - } - - [result.image drawInRect:drawRect]; - - UIImage *processedImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return processedImage; - }]; -``` - -**Swift** -```swift -let imageView = FLAnimatedImageView() -imageView.pin_setImage(from: URL(string: "https://i.pinimg.com/736x/5b/c6/c5/5bc6c5387ff6f104fd642f2b375efba3.jpg")!, processorKey: "rounded") { (result, unsafePointer) -> UIImage? in - - guard let image = result.image else { return nil } - - let radius : CGFloat = 7.0 - let targetSize = CGSize(width: 200, height: 300) - let imageRect = CGRect(x: 0, y: 0, width: targetSize.width, height: targetSize.height) - - UIGraphicsBeginImageContext(imageRect.size) - - let bezierPath = UIBezierPath(roundedRect: imageRect, cornerRadius: radius) - bezierPath.addClip() - - let widthMultiplier : CGFloat = targetSize.width / image.size.width - let heightMultiplier : CGFloat = targetSize.height / image.size.height - let sizeMultiplier = max(widthMultiplier, heightMultiplier) - - var drawRect = CGRect(x: 0, y: 0, width: image.size.width * sizeMultiplier, height: image.size.height * sizeMultiplier) - if (drawRect.maxX > imageRect.maxX) { - drawRect.origin.x -= (drawRect.maxX - imageRect.maxX) / 2 - } - if (drawRect.maxY > imageRect.maxY) { - drawRect.origin.y -= (drawRect.maxY - imageRect.maxY) / 2 - } - - image.draw(in: drawRect) - - UIColor.red.setStroke() - bezierPath.lineWidth = 5.0 - bezierPath.stroke() - - let ctx = UIGraphicsGetCurrentContext() - ctx?.setBlendMode(CGBlendMode.overlay) - ctx?.setAlpha(0.5) - - let logo = UIImage(named: "white-pinterest-logo") - ctx?.scaleBy(x: 1.0, y: -1.0) - ctx?.translateBy(x: 0.0, y: -drawRect.size.height) - - if let coreGraphicsImage = logo?.cgImage { - ctx?.draw(coreGraphicsImage, in: CGRect(x: 90, y: 10, width: logo!.size.width, height: logo!.size.height)) - } - - let processedImage = UIGraphicsGetImageFromCurrentImageContext() - UIGraphicsEndImageContext() - - return processedImage - -} -``` - -### Handle Authentication - -**Objective-C** -```objc -[[PINRemoteImageManager sharedImageManager] setAuthenticationChallenge:^(NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, PINRemoteImageManagerAuthenticationChallengeCompletionHandler aCompletion) { -aCompletion(NSURLSessionAuthChallengePerformDefaultHandling, nil)]; -``` - -**Swift** -```swift -PINRemoteImageManager.shared().setAuthenticationChallenge { (task, challenge, completion) in - completion?(.performDefaultHandling, nil) -} -``` - -### Support for high resolution images -Currently there are two ways PINRemoteImage is supporting high resolution images: -1. If the URL contains an `_2x.` or an `_3x.` postfix it will be automatically handled by PINRemoteImage and the resulting image will be returned at the right scale. -2. If it's not possible to provide an URL with an `_2x.` or `_3x.` postfix, you can also handle it with a completion handler: -```objc -NSURL *url = ...; -__weak UIImageView *weakImageView = self.imageView; -[self.imageView pin_setImageFromURL:url completion:^(PINRemoteImageManagerResult * _Nonnull result) { - CGFloat scale = UIScreen.mainScreen.scale; - if (scale > 1.0) { - UIImage *image = result.image; - weakImageView.image = [UIImage imageWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; - } -}]; -``` - -### Set some limits -``` -// cache is an instance of PINCache as long as you haven't overridden defaultImageCache -PINCache *cache = (PINCache *)[[PINRemoteImageManager sharedImageManager] cache]; -// Max memory cost is based on number of pixels, we estimate the size of one hundred 600x600 images as our max memory image cache. -[[cache memoryCache] setCostLimit:600 * [[UIScreen mainScreen] scale] * 600 * [[UIScreen mainScreen] scale] * 100]; - -// ~50 MB -[[cache diskCache] setByteLimit:50 * 1024 * 1024]; -// 30 days -[[cache diskCache] setAgeLimit:60 * 60 * 24 * 30]; -``` - -## Installation - -### CocoaPods - -Add [PINRemoteImage](http://cocoapods.org/?q=name%3APINRemoteImage) to your `Podfile` and run `pod install`. - -If you'd like to use WebP images, add [PINRemoteImage/WebP](http://cocoapods.org/?q=name%3APINRemoteImage) to your `Podfile` and run `pod install`. - - -### Carthage - -Add `github "pinterest/PINRemoteImage"` to your Cartfile . See [Carthage's readme](https://github.com/Carthage/Carthage) for more information on integrating Carthage-built frameworks into your project. - -### Manually - -[Download the latest tag](https://github.com/Pinterest/PINRemoteImage/tags) and drag the `Pod/Classes` folder into your Xcode project. You must also manually link against [PINCache](https://github.com/pinterest/PINCache). - -Install the docs by double clicking the `.docset` file under `docs/`, or view them online at [cocoadocs.org](http://cocoadocs.org/docsets/PINRemoteImage/) - -### Git Submodule - -You can set up PINRemoteImage as a submodule of your repo instead of cloning and copying all the files into your repo. Add the submodule using the commands below and then follow the manual instructions above. - - git submodule add https://github.com/pinterest/PINRemoteImage.git - git submodule update --init - - - -## Requirements - -__PINRemoteImage__ requires iOS 7.0 or greater. - -## Contact - -[Garrett Moon](mailto:garrett@pinterest.com) -[@garrettmoon](https://twitter.com/garrettmoon) -[Pinterest](https://www.pinterest.com/garrettlunar/) - -## License - -Copyright 2015 Pinterest, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. [See the License](LICENSE.txt) for the specific language governing permissions and limitations under the License. diff --git a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImage.m b/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImage.m deleted file mode 100644 index 9204b4e5..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImage.m +++ /dev/null @@ -1,126 +0,0 @@ -// -// PINAnimatedImage.m -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINAnimatedImage.h" - -NSErrorDomain const kPINAnimatedImageErrorDomain = @"kPINAnimatedImageErrorDomain"; - -//http://nullsleep.tumblr.com/post/16524517190/animated-gif-minimum-frame-delay-browser -const Float32 kPINAnimatedImageDefaultDuration = 0.1; - -@interface PINAnimatedImage () -{ - CFTimeInterval _totalDuration; -} -@end - -@implementation PINAnimatedImage - -+ (NSInteger)maximumFramesPerSecond -{ - static dispatch_once_t onceToken; - static NSInteger maximumFramesPerSecond = 60; - - dispatch_once(&onceToken, ^{ -#if PIN_TARGET_IOS - if (@available(iOS 10.3, tvOS 10.3, *)) { - maximumFramesPerSecond = 0; - for (UIScreen *screen in [UIScreen screens]) { - if ([screen maximumFramesPerSecond] > maximumFramesPerSecond) { - maximumFramesPerSecond = [screen maximumFramesPerSecond]; - } - } - } -#endif - }); - return maximumFramesPerSecond; -} - -- (instancetype)init -{ - if (self = [super init]) { - _totalDuration = -1; - } - return self; -} - -- (CFTimeInterval)durationAtIndex:(NSUInteger)index -{ - NSAssert(NO, @"Must be overridden by subclass"); - return 0; -} - -- (size_t)frameCount -{ - NSAssert(NO, @"Must be overridden by subclass"); - return 0; -} - - -- (CFTimeInterval)totalDuration -{ - if (_totalDuration == -1) { - _totalDuration = 0; - for (NSUInteger idx = 0; idx < self.frameCount; idx++) { - _totalDuration += [self durationAtIndex:idx]; - } - } - - return _totalDuration; -} - -- (NSUInteger)frameInterval -{ - return MAX(self.minimumFrameInterval * [PINAnimatedImage maximumFramesPerSecond], 1); -} - -//Credit to FLAnimatedImage ( https://github.com/Flipboard/FLAnimatedImage ) for display link interval calculations -- (NSTimeInterval)minimumFrameInterval -{ - static dispatch_once_t onceToken; - static NSTimeInterval kGreatestCommonDivisorPrecision; - dispatch_once(&onceToken, ^{ - kGreatestCommonDivisorPrecision = 2.0 / (1.0 / [PINAnimatedImage maximumFramesPerSecond]); - }); - - // Scales the frame delays by `kGreatestCommonDivisorPrecision` - // then converts it to an UInteger for in order to calculate the GCD. - NSUInteger scaledGCD = lrint([self durationAtIndex:0] * kGreatestCommonDivisorPrecision); - for (NSUInteger durationIdx = 1; durationIdx < self.frameCount; durationIdx++) { - CFTimeInterval duration = [self durationAtIndex:durationIdx]; - scaledGCD = gcd(lrint(duration * kGreatestCommonDivisorPrecision), scaledGCD); - } - - // Reverse to scale to get the value back into seconds. - return (scaledGCD / kGreatestCommonDivisorPrecision); -} - -// This likely isn't the most efficient but it's easy to reason about and we don't call it -// with super large numbers. -static NSUInteger gcd(NSUInteger a, NSUInteger b) -{ - // http://en.wikipedia.org/wiki/Greatest_common_divisor - NSCAssert(a > 0 && b > 0, @"A and B must be greater than 0"); - - while (a != b) { - if (a > b) { - a = a - b; - } else { - b = b - a; - } - } - return a; -} - -// Used only in testing -+ (NSUInteger)greatestCommonDivisorOfA:(NSUInteger)a andB:(NSUInteger)b -{ - return gcd(a, b); -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImageView.m b/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImageView.m deleted file mode 100644 index e54fa7ea..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINAnimatedImageView.m +++ /dev/null @@ -1,443 +0,0 @@ -// -// PINAnimatedImageView.m -// Pods -// -// Created by Garrett Moon on 4/17/18. -// - -#import "PINAnimatedImageView.h" - -#import "PINRemoteLock.h" -#import "PINDisplayLink.h" -#import "PINImage+DecodedImage.h" -#import "PINRemoteWeakProxy.h" - -@interface PINAnimatedImageView () -{ - CFTimeInterval _playHead; - NSUInteger _playedLoops; - NSUInteger _lastSuccessfulFrameIndex; - CFTimeInterval *_durations; -} - -@property (nonatomic, assign) CGImageRef frameImage; -@property (nonatomic, strong) PINDisplayLink *displayLink; - -@property (nonatomic, assign) CFTimeInterval lastDisplayLinkFire; - -@end - -@implementation PINAnimatedImageView - -@synthesize animatedImage = _animatedImage; -@synthesize displayLink = _displayLink; -@synthesize playbackPaused = _playbackPaused; -@synthesize animatedImageRunLoopMode = _animatedImageRunLoopMode; - -- (instancetype)initWithAnimatedImage:(PINCachedAnimatedImage *)animatedImage -{ - if (self = [super initWithFrame:CGRectZero]) { - [self commonInit:animatedImage]; - } - return self; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - [self commonInit:nil]; - } - return self; -} - -- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if (self = [super initWithCoder:aDecoder]) { - [self commonInit:nil]; - } - return self; -} - -- (void)commonInit:(PINCachedAnimatedImage *)animatedImage -{ - _animatedImage = animatedImage; - _animatedImageRunLoopMode = NSRunLoopCommonModes; - _durations = NULL; - - if (animatedImage) { - [self initializeAnimatedImage:animatedImage]; - } -} - -- (void)initializeAnimatedImage:(nonnull PINCachedAnimatedImage *)animatedImage -{ - PINWeakify(self); - animatedImage.coverImageReadyCallback = ^(PINImage *coverImage) { - dispatch_async(dispatch_get_main_queue(), ^{ - PINStrongify(self); - // In this case the lock is already gone we have to call the unlocked version therefore - [self coverImageCompleted:coverImage]; - }); - }; - - animatedImage.playbackReadyCallback = ^{ - dispatch_async(dispatch_get_main_queue(), ^{ - // In this case the lock is already gone we have to call the unlocked version therefore - PINStrongify(self); - [self checkIfShouldAnimate]; - }); - }; - if (animatedImage.playbackReady) { - [self checkIfShouldAnimate]; - } - - [self resetDurationsWithAnimatedImage:animatedImage]; -} - -- (void)dealloc -{ - if (_frameImage) { - CGImageRelease(_frameImage); - } - if (_durations) { - free(_durations); - } -} - -#pragma mark - Public - -- (void)setAnimatedImage:(PINCachedAnimatedImage *)animatedImage -{ - PINAssertMain(); - if (_animatedImage == animatedImage && animatedImage.playbackReady) { - return; - } - - PINCachedAnimatedImage *previousAnimatedImage = _animatedImage; - - _animatedImage = animatedImage; - - if (animatedImage != nil) { - [self initializeAnimatedImage:animatedImage]; - } else { - // Clean up after ourselves. - self.layer.contents = nil; - [self setCoverImage:nil]; - } - - // Animated Image can take a while to dealloc, let's try and do it off main. - __block PINCachedAnimatedImage *strongAnimatedImage = previousAnimatedImage; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - strongAnimatedImage = nil; - }); -} - -- (PINCachedAnimatedImage *)animatedImage -{ - PINAssertMain(); - return _animatedImage; -} - -- (NSString *)animatedImageRunLoopMode -{ - PINAssertMain(); - return _animatedImageRunLoopMode; -} - -- (void)setAnimatedImageRunLoopMode:(NSString *)newRunLoopMode -{ - PINAssertMain(); - - NSString *runLoopMode = newRunLoopMode ?: NSRunLoopCommonModes; - - if (_displayLink != nil) { - [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_animatedImageRunLoopMode]; - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode]; - } - _animatedImageRunLoopMode = runLoopMode; -} - -- (BOOL)isPlaybackPaused -{ - PINAssertMain(); - return _playbackPaused; -} - -- (void)setPlaybackPaused:(BOOL)playbackPaused -{ - PINAssertMain(); - - _playbackPaused = playbackPaused; - [self checkIfShouldAnimate]; -} - -- (void)coverImageCompleted:(PINImage *)coverImage -{ - PINAssertMain(); - BOOL setCoverImage = (_displayLink == nil) || _displayLink.paused; - - if (setCoverImage) { - [self setCoverImage:coverImage]; - } -} - -- (void)setCoverImage:(PINImage *)coverImage -{ - PINAssertMain(); - if (_frameImage) { - CGImageRelease(_frameImage); - } - _frameImage = CGImageRetain([coverImage CGImage]); -} - -#pragma mark - Animating - -- (void)checkIfShouldAnimate -{ - PINAssertMain(); - BOOL shouldAnimate = _playbackPaused == NO && _animatedImage.playbackReady && [self canBeVisible]; - if (shouldAnimate) { - [self startAnimating]; - } else { - [self stopAnimating]; - } -} - -- (void)startAnimating -{ - PINAssertMain(); - - if (_playbackPaused) { - return; - } - - if (_animatedImage.playbackReady == NO) { - return; - } - - if ([self canBeVisible] == NO) { - return; - } - - NSUInteger frameInterval = self.animatedImage.frameInterval; - - if (_displayLink == nil) { - _playHead = 0; - _displayLink = [PINDisplayLink displayLinkWithTarget:[PINRemoteWeakProxy weakProxyWithTarget:self] selector:@selector(displayLinkFired:)]; -#if PIN_TARGET_IOS - if (@available(iOS 10.0, tvOS 10.0, *)) { - // Convert from display link fractional value to fps (note: frameInterval is always at least 1) - NSInteger frameRate = ceil([PINAnimatedImage maximumFramesPerSecond] / ((double) frameInterval)); - _displayLink.preferredFramesPerSecond = frameRate; - } else { -#endif - _displayLink.frameInterval = frameInterval; -#if PIN_TARGET_IOS - } -#endif - _lastSuccessfulFrameIndex = NSUIntegerMax; - - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.animatedImageRunLoopMode]; - } else { - _displayLink.paused = NO; - } -} - -- (void)stopAnimating -{ - PINAssertMain(); - - _displayLink.paused = YES; - _lastDisplayLinkFire = 0; - - [_animatedImage clearAnimatedImageCache]; -} - -#pragma mark - Overrides - -- (PINImage *)image -{ - PINAssertMain(); - if (_animatedImage) { - return [PINImage imageWithCGImage:_frameImage]; - } - return [super image]; -} - -- (CGImageRef)imageRef -{ - PINAssertMain(); - PINImage *underlyingImage = nil; - if (_animatedImage) { - return _frameImage; - } else if ((underlyingImage = [super image])) { - return (CGImageRef)CFAutorelease(CFRetain([underlyingImage CGImage])); - } - return nil; -} - -- (void)setImage:(PINImage *)image -{ - PINAssertMain(); - if (image) { - self.animatedImage = nil; - } - - super.image = image; -} - -- (void)displayLayer:(CALayer *)layer -{ - PINAssertMain(); - layer.contents = (__bridge id)[self imageRef]; -} - -#if PIN_TARGET_MAC - -- (void)_setImage:(PINImage *)image -{ - super.image = image; -} - -- (void)setAlphaValue:(CGFloat)alphaValue -{ - [super setAlphaValue:alphaValue]; - [self updateAnimationForPossibleVisibility]; -} - -- (void)viewDidMoveToWindow -{ - [super viewDidMoveToWindow]; - [self updateAnimationForPossibleVisibility]; -} - -- (void)viewDidMoveToSuperview -{ - [super viewDidMoveToSuperview]; - [self updateAnimationForPossibleVisibility]; -} -#else -- (void)setAlpha:(CGFloat)alpha -{ - [super setAlpha:alpha]; - [self updateAnimationForPossibleVisibility]; -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; - [self updateAnimationForPossibleVisibility]; -} - -- (void)didMoveToSuperview -{ - [super didMoveToSuperview]; - [self updateAnimationForPossibleVisibility]; -} -#endif - -- (void)setHidden:(BOOL)hidden -{ - [super setHidden:hidden]; - [self updateAnimationForPossibleVisibility]; -} - -#pragma mark - Display Link Callbacks - -- (BOOL)canBeVisible -{ -#if PIN_TARGET_MAC - return self.window && self.superview && self.isHidden == NO && self.alphaValue > 0.0; -#else - return self.window && self.superview && self.isHidden == NO && self.alpha > 0.0; -#endif -} - -- (void)updateAnimationForPossibleVisibility -{ - [self checkIfShouldAnimate]; -} - -- (void)displayLinkFired:(PINDisplayLink *)displayLink -{ - PINAssertMain(); - CFTimeInterval timeBetweenLastFire; - if (_lastDisplayLinkFire == 0) { - timeBetweenLastFire = 0; - } else { - timeBetweenLastFire = CACurrentMediaTime() - self.lastDisplayLinkFire; - } - - self.lastDisplayLinkFire = CACurrentMediaTime(); - - _playHead += timeBetweenLastFire; - - while (_playHead > self.animatedImage.totalDuration) { - // Set playhead to zero to keep from showing different frames on different playthroughs - _playHead = 0; - _playedLoops++; - } - - if (self.animatedImage.loopCount > 0 && _playedLoops >= self.animatedImage.loopCount) { - [self stopAnimating]; - return; - } - - NSUInteger frameIndex = [self frameIndexAtPlayHeadPosition:_playHead]; - if (frameIndex == _lastSuccessfulFrameIndex) { - return; - } - CGImageRef frameImage = [self.animatedImage imageAtIndex:frameIndex]; - - if (frameImage == nil) { - //Pause the display link until we get a file ready notification - displayLink.paused = YES; - self.lastDisplayLinkFire = 0; - } else { - if (_frameImage) { - CGImageRelease(_frameImage); - } - _frameImage = CGImageRetain(frameImage); - _lastSuccessfulFrameIndex = frameIndex; -#if PIN_TARGET_MAC - [self _setImage:[NSImage imageWithCGImage:_frameImage]]; -#else - [self.layer setNeedsDisplay]; -#endif - } -} - -- (void)resetDurationsWithAnimatedImage:(PINCachedAnimatedImage *)animatedImage -{ - PINAssertMain(); - if (!animatedImage) { - return; - } - if (_durations) { - free(_durations); - } - _durations = malloc(sizeof(CFTimeInterval) * animatedImage.frameCount); - CFTimeInterval sum = 0.0f; - for (int i = 0; i < animatedImage.frameCount; i++) { - sum += [animatedImage durationAtIndex:i]; - _durations[i] = sum; - } -} - -- (NSUInteger)frameIndexAtPlayHeadPosition:(CFTimeInterval)playHead -{ - PINAssertMain(); - int low = 0, high = (int)_animatedImage.frameCount - 1; - - while (low <= high) { - int mid = low + (high - low) / 2; - if (_durations[mid] < playHead) { - low = mid + 1; - } else { - high = mid - 1; - } - } - return MAX(MIN(low, (int)_animatedImage.frameCount - 1), 0); -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINCachedAnimatedImage.m b/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINCachedAnimatedImage.m deleted file mode 100644 index 8f410639..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINCachedAnimatedImage.m +++ /dev/null @@ -1,528 +0,0 @@ -// -// PINCachedAnimatedImage.m -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINCachedAnimatedImage.h" - -#import "PINRemoteLock.h" -#import "PINGIFAnimatedImage.h" -#if PIN_WEBP -#import "PINWebPAnimatedImage.h" -#endif - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#import "NSData+ImageDetectors.h" - -static const NSUInteger kFramesToRenderForLargeFrames = 4; -static const NSUInteger kFramesToRenderMinimum = 2; - -static const CFTimeInterval kSecondsAfterMemWarningToMinimumCache = 1; -static const CFTimeInterval kSecondsAfterMemWarningToLargeCache = 5; -static const CFTimeInterval kSecondsAfterMemWarningToAllCache = 10; -#if PIN_TARGET_IOS -static const CFTimeInterval kSecondsBetweenMemoryWarnings = 15; -#endif - -@interface PINCachedAnimatedImage () -{ - // Since _animatedImage is set on init it is thread-safe. - id _animatedImage; - - PINImage *_coverImage; - PINAnimatedImageInfoReady _coverImageReadyCallback; - dispatch_block_t _playbackReadyCallback; - NSMutableDictionary *_frameCache; - NSInteger _frameRenderCount; // Number of frames to cache until playback is ready. - BOOL _playbackReady; - PINOperationQueue *_operationQueue; - dispatch_queue_t _cachingQueue; - - NSUInteger _playhead; - BOOL _notifyOnReady; - NSMutableIndexSet *_cachedOrCachingFrames; - PINRemoteLock *_lock; - BOOL _cacheCleared; // Flag used to cancel any caching operations after clear cache is called. -} - -@property (atomic, strong) NSDate *lastMemoryWarning; - -// Set to YES if we continually see memory warnings after ramping up the number of cached frames. -@property (atomic, assign) BOOL cachingFramesCausingMemoryWarnings; - -@end - -@implementation PINCachedAnimatedImage - -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData -{ - if ([animatedImageData pin_isAnimatedGIF]) { - return [self initWithAnimatedImage:[[PINGIFAnimatedImage alloc] initWithAnimatedImageData:animatedImageData]]; - } -#if PIN_WEBP - if ([animatedImageData pin_isAnimatedWebP]) { - return [self initWithAnimatedImage:[[PINWebPAnimatedImage alloc] initWithAnimatedImageData:animatedImageData]]; - } -#endif - return nil; -} - -- (instancetype)initWithAnimatedImage:(id )animatedImage -{ - if (self = [super init]) { - _animatedImage = animatedImage; - _frameCache = [[NSMutableDictionary alloc] init]; - _frameRenderCount = 0; - _playhead = 0; - _notifyOnReady = YES; - _cachedOrCachingFrames = [[NSMutableIndexSet alloc] init]; - _lock = [[PINRemoteLock alloc] initWithName:@"PINCachedAnimatedImage Lock"]; - -#if PIN_TARGET_IOS - _lastMemoryWarning = [NSDate distantPast]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(didReceiveMemoryWarningNotification:) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; -#endif - - _operationQueue = [[PINOperationQueue alloc] initWithMaxConcurrentOperations:kFramesToRenderForLargeFrames]; - _cachingQueue = dispatch_queue_create("Caching Queue", DISPATCH_QUEUE_SERIAL); - - // dispatch later so that blocks can be set after init this runloop - PINWeakify(self); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - PINStrongify(self); - [self imageAtIndex:0]; - }); - } - return self; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -#if PIN_TARGET_IOS -- (void)didReceiveMemoryWarningNotification:(NSNotification *)notification -{ - NSDate *now = [NSDate date]; - if (-[self.lastMemoryWarning timeIntervalSinceDate:now] < kSecondsBetweenMemoryWarnings) { - self.cachingFramesCausingMemoryWarnings = YES; - } - self.lastMemoryWarning = now; - [self cleanupFrames]; -} -#endif - -- (PINImage *)coverImage -{ - __block PINImage *coverImage = nil; - __block PINAnimatedImageInfoReady coverImageReadyCallback = nil; - [_lock lockWithBlock:^{ - if (self->_coverImage == nil) { - CGImageRef coverImageRef = [self->_animatedImage imageAtIndex:0 cacheProvider:self]; - BOOL notifyCallback = [self _locked_updateCoverImage:coverImageRef]; - coverImageReadyCallback = notifyCallback ? self->_coverImageReadyCallback : nil; - } - coverImage = self->_coverImage; - }]; - if (coverImageReadyCallback) { - coverImageReadyCallback(coverImage); - } - return coverImage; -} - -// Update _coverImage property and return if it should notify the callback -- (BOOL)_locked_updateCoverImage:(CGImageRef)coverImageRef -{ - BOOL notifyCallback = NO; - if (coverImageRef) { - notifyCallback = (_coverImage == nil && coverImageRef != nil); -#if PIN_TARGET_IOS - _coverImage = [UIImage imageWithCGImage:coverImageRef]; -#elif PIN_TARGET_MAC - _coverImage = [[NSImage alloc] initWithCGImage:coverImageRef size:CGSizeMake(_animatedImage.width, _animatedImage.height)]; -#endif - } else { - _coverImage = nil; - } - return notifyCallback; -} - -- (BOOL)coverImageReady -{ - __block PINImage *coverImage = nil; - __block PINAnimatedImageInfoReady coverImageReadyCallback = nil; - [_lock lockWithBlock:^{ - if (self->_coverImage == nil) { - CGImageRef coverImageRef = (__bridge CGImageRef)[self->_frameCache objectForKey:@(0)]; - if (coverImageRef) { - BOOL notifyCallback = [self _locked_updateCoverImage:coverImageRef]; - coverImageReadyCallback = notifyCallback ? self->_coverImageReadyCallback : nil; - } - } - - coverImage = self->_coverImage; - }]; - if (coverImageReadyCallback) { - coverImageReadyCallback(coverImage); - } - return (coverImage != nil); -} - -#pragma mark - passthrough -- (CGSize)size -{ - return CGSizeMake(_animatedImage.width, _animatedImage.height); -} - -- (NSData *)data -{ - return _animatedImage.data; -} - -- (CFTimeInterval)totalDuration -{ - return _animatedImage.totalDuration; -} - -- (NSUInteger)frameInterval -{ - return _animatedImage.frameInterval; -} - -- (size_t)loopCount -{ - return _animatedImage.loopCount; -} - -- (size_t)frameCount -{ - return _animatedImage.frameCount; -} - -- (NSError *)error -{ - return _animatedImage.error; -} - -- (CGImageRef)imageAtIndex:(NSUInteger)index -{ - __block CGImageRef imageRef; - __block BOOL cachingDisabled = NO; - [_lock lockWithBlock:^{ - // Reset cache cleared flag if it's been set. - self->_cacheCleared = NO; - imageRef = (__bridge CGImageRef)[self->_frameCache objectForKey:@(index)]; - - self->_playhead = index; - if (imageRef == NULL) { - if ([self framesToCache] == 0) { - // We're not caching so we should just generate the frame. - cachingDisabled = YES; - } else { - PINLog(@"cache miss, aww."); - self->_notifyOnReady = YES; - } - } - - // Retain and autorelease while we have the lock, another thread could remove it from the cache - // and allow it to be released. - if (imageRef) { - CGImageRetain(imageRef); - CFAutorelease(imageRef); - } - }]; - - if (cachingDisabled && imageRef == NULL) { - imageRef = [_animatedImage imageAtIndex:index cacheProvider:self]; - } else { - PINWeakify(self); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - PINStrongify(self); - [self updateCache]; - }); - } - - return imageRef; -} - -- (void)_updateCacheOnQueue -{ - // Kick off, in order, caching frames which need to be cached - NSRange endKeepRange; - NSRange beginningKeepRange; - - [self getKeepRanges:&endKeepRange beginningKeepRange:&beginningKeepRange]; - - [self->_lock lockWithBlock:^{ - for (NSUInteger idx = endKeepRange.location; idx < NSMaxRange(endKeepRange); idx++) { - if ([self->_cachedOrCachingFrames containsIndex:idx] == NO) { - [self _locked_cacheFrame:idx]; - } - } - - if (beginningKeepRange.location != NSNotFound) { - for (NSUInteger idx = beginningKeepRange.location; idx < NSMaxRange(beginningKeepRange); idx++) { - if ([self->_cachedOrCachingFrames containsIndex:idx] == NO) { - [self _locked_cacheFrame:idx]; - } - } - } - }]; -} - -- (void)updateCache -{ - PINWeakify(self); - // skip if we don't have any frames to cache - if ([self framesToCache] > 0) { - [_operationQueue scheduleOperation:^{ - PINStrongify(self); - [self _updateCacheOnQueue]; - }]; - } - - [_operationQueue scheduleOperation:^{ - PINStrongify(self); - [self cleanupFrames]; - }]; -} - -- (void)getKeepRanges:(nonnull out NSRange *)endKeepRangeIn beginningKeepRange:(nonnull out NSRange *)beginningKeepRangeIn -{ - __block NSRange endKeepRange; - __block NSRange beginningKeepRange; - - NSUInteger framesToCache = [self framesToCache]; - - [self->_lock lockWithBlock:^{ - // find the range of frames we want to keep - endKeepRange = NSMakeRange(self->_playhead, framesToCache); - beginningKeepRange = NSMakeRange(NSNotFound, 0); - if (NSMaxRange(endKeepRange) > self->_animatedImage.frameCount) { - beginningKeepRange = NSMakeRange(0, NSMaxRange(endKeepRange) - self->_animatedImage.frameCount); - endKeepRange.length = self->_animatedImage.frameCount - self->_playhead; - } - }]; - - if (endKeepRangeIn) { - *endKeepRangeIn = endKeepRange; - } - if (beginningKeepRangeIn) { - *beginningKeepRangeIn = beginningKeepRange; - } -} - -- (void)cleanupFrames -{ - NSRange endKeepRange; - NSRange beginningKeepRange; - [self getKeepRanges:&endKeepRange beginningKeepRange:&beginningKeepRange]; - - [_lock lockWithBlock:^{ - NSMutableIndexSet *removedFrames = [[NSMutableIndexSet alloc] init]; - PINLog(@"Checking if frames need removing: %lu", _cachedOrCachingFrames.count); - [self->_cachedOrCachingFrames enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - BOOL shouldKeepFrame = NSLocationInRange(idx, endKeepRange); - if (beginningKeepRange.location != NSNotFound) { - shouldKeepFrame |= NSLocationInRange(idx, beginningKeepRange); - } - if (shouldKeepFrame == NO) { - [removedFrames addIndex:idx]; - [self->_frameCache removeObjectForKey:@(idx)]; - PINLog(@"Removing: %lu", (unsigned long)idx); - } - }]; - [self->_cachedOrCachingFrames removeIndexes:removedFrames]; - }]; -} - -- (void)_cacheWithFrameIndex:(NSUInteger)frameIndex -{ - CGImageRef imageRef = [self->_animatedImage imageAtIndex:frameIndex cacheProvider:self]; - PINLog(@"Generating: %lu", (unsigned long)frameIndex); - - if (imageRef) { - __block PINImage *coverImage = nil; - __block PINAnimatedImageInfoReady coverImageReadyCallback = nil; - [self->_lock lockWithBlock:^{ - [self->_frameCache setObject:(__bridge id _Nonnull)(imageRef) forKey:@(frameIndex)]; - - // Update the cover image - if (frameIndex == 0) { - BOOL notifyCallback = [self _locked_updateCoverImage:imageRef]; - coverImageReadyCallback = notifyCallback ? self->_coverImageReadyCallback : nil; - coverImage = self->_coverImage; - } - - self->_frameRenderCount--; - NSAssert(self->_frameRenderCount >= 0, @"playback ready is less than zero, something is wrong :("); - - PINLog(@"Frames left: %ld", (long)_frameRenderCount); - - dispatch_block_t notify = nil; - if (self->_frameRenderCount == 0 && self->_notifyOnReady) { - self->_notifyOnReady = NO; - if (self->_playbackReadyCallback) { - notify = self->_playbackReadyCallback; - [self->_operationQueue scheduleOperation:^{ - notify(); - }]; - } - } - }]; - if (coverImageReadyCallback) { - coverImageReadyCallback(coverImage); - } - } -} - -- (void)_locked_cacheFrame:(NSUInteger)frameIndex -{ - if ([_cachedOrCachingFrames containsIndex:frameIndex] == NO && _cacheCleared == NO) { - PINLog(@"Requesting: %lu", (unsigned long)frameIndex); - [_cachedOrCachingFrames addIndex:frameIndex]; - _frameRenderCount++; - - PINWeakify(self); - dispatch_async(_cachingQueue, ^{ - PINStrongify(self); - [self _cacheWithFrameIndex:frameIndex]; - }); - } -} - -// Returns the number of frames that should be cached -- (NSUInteger)framesToCache -{ - unsigned long long totalBytes = [NSProcessInfo processInfo].physicalMemory; - NSUInteger framesToCache = 0; - - NSUInteger frameCost = _animatedImage.bytesPerFrame; - if (frameCost * _animatedImage.frameCount < totalBytes / 250) { - // If the total number of bytes takes up less than a 250th of total memory, lets just cache 'em all. - framesToCache = _animatedImage.frameCount; - } else if (frameCost < totalBytes / 1000) { - // If the cost of a frame is less than 1000th of physical memory, cache 4 frames to smooth animation. - framesToCache = kFramesToRenderForLargeFrames; - } else if (frameCost < totalBytes / 500) { - // Oooph, lets just try to get ahead of things by one. - framesToCache = kFramesToRenderMinimum; - } else { - // No caching :( - framesToCache = 0; - } - - // If it's been less than 5 seconds, we're not caching - CFTimeInterval timeSinceLastWarning = -[self.lastMemoryWarning timeIntervalSinceNow]; - if (self.cachingFramesCausingMemoryWarnings || timeSinceLastWarning < kSecondsAfterMemWarningToMinimumCache) { - framesToCache = 0; - } else if (timeSinceLastWarning < kSecondsAfterMemWarningToLargeCache) { - framesToCache = MIN(framesToCache, kFramesToRenderMinimum); - } else if (timeSinceLastWarning < kSecondsAfterMemWarningToAllCache) { - framesToCache = MIN(framesToCache, kFramesToRenderForLargeFrames); - } - - return framesToCache; -} - -- (CFTimeInterval)durationAtIndex:(NSUInteger)index -{ - return [_animatedImage durationAtIndex:index]; -} - -- (BOOL)playbackReady -{ - __block BOOL playbackReady = NO; - [_lock lockWithBlock:^{ - if (self->_playbackReady == NO) { - self->_playbackReady = self->_frameRenderCount == 0; - } - playbackReady = self->_playbackReady; - }]; - return playbackReady; -} - -- (dispatch_block_t)playbackReadyCallback -{ - __block dispatch_block_t playbackReadyCallback = nil; - [_lock lockWithBlock:^{ - playbackReadyCallback = self->_playbackReadyCallback; - }]; - return playbackReadyCallback; -} - -- (void)setPlaybackReadyCallback:(dispatch_block_t)playbackReadyCallback -{ - [_lock lockWithBlock:^{ - self->_playbackReadyCallback = playbackReadyCallback; - }]; -} - -- (PINAnimatedImageInfoReady)coverImageReadyCallback -{ - __block PINAnimatedImageInfoReady coverImageReadyCallback; - [_lock lockWithBlock:^{ - coverImageReadyCallback = self->_coverImageReadyCallback; - }]; - return coverImageReadyCallback; -} - -- (void)setCoverImageReadyCallback:(PINAnimatedImageInfoReady)coverImageReadyCallback -{ - [_lock lockWithBlock:^{ - self->_coverImageReadyCallback = coverImageReadyCallback; - }]; -} - -- (void)_clearAnimatedImageCache -{ - [self->_lock lockWithBlock:^{ - self->_cacheCleared = YES; - self->_coverImage = nil; - [self->_cachedOrCachingFrames enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - [self->_frameCache removeObjectForKey:@(idx)]; - }]; - [self->_cachedOrCachingFrames removeAllIndexes]; - }]; -} - -/** - @abstract Clear any cached data. Called when playback is paused. - */ -- (void)clearAnimatedImageCache -{ - PINWeakify(self); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - PINStrongify(self); - [self _clearAnimatedImageCache]; - }); -} - -# pragma mark - PINCachedAnimatedFrameProvider - -- (CGImageRef)cachedFrameImageAtIndex:(NSUInteger)index -{ - __block CGImageRef imageRef; - [_lock lockWithBlock:^{ - imageRef = (__bridge CGImageRef)[self->_frameCache objectForKey:@(index)]; - if (imageRef) { - CGImageRetain(imageRef); - CFAutorelease(imageRef); - } - }]; - return imageRef; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINGIFAnimatedImage.m b/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINGIFAnimatedImage.m deleted file mode 100644 index 2b5016f9..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINGIFAnimatedImage.m +++ /dev/null @@ -1,166 +0,0 @@ -// -// PINGIFAnimatedImage.m -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINGIFAnimatedImage.h" - -#import -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINImage+DecodedImage.h" -#import "NSData+ImageDetectors.h" - -@interface PINGIFAnimatedImage () -{ - NSData *_animatedImageData; - CGImageSourceRef _imageSource; - uint32_t _width; - uint32_t _height; - BOOL _hasAlpha; - size_t _frameCount; - size_t _loopCount; - CFTimeInterval *_durations; - NSError *_error; -} -@end - -@implementation PINGIFAnimatedImage - -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData -{ - if (self = [super init]) { - _animatedImageData = animatedImageData; - _imageSource = - CGImageSourceCreateWithData((CFDataRef)animatedImageData, - (CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint: - (__bridge NSString *)kUTTypeGIF, - (__bridge NSString *)kCGImageSourceShouldCache: - (__bridge NSNumber *)kCFBooleanFalse}); - if (_imageSource && [animatedImageData pin_isGIF]) { - _frameCount = (uint32_t)CGImageSourceGetCount(_imageSource); - NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(_imageSource, nil); - _loopCount = (uint32_t)[[[imageProperties objectForKey:(__bridge NSString *)kCGImagePropertyGIFDictionary] - objectForKey:(__bridge NSString *)kCGImagePropertyGIFLoopCount] unsignedLongValue]; - _durations = malloc(sizeof(CFTimeInterval) * _frameCount); - imageProperties = (__bridge_transfer NSDictionary *) - CGImageSourceCopyPropertiesAtIndex(_imageSource, - 0, - (CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceShouldCache: - (__bridge NSNumber *)kCFBooleanFalse}); - _width = (uint32_t)[(NSNumber *)imageProperties[(__bridge NSString *)kCGImagePropertyPixelWidth] unsignedIntegerValue]; - _height = (uint32_t)[(NSNumber *)imageProperties[(__bridge NSString *)kCGImagePropertyPixelHeight] unsignedIntegerValue]; - - for (NSUInteger frameIdx = 0; frameIdx < _frameCount; frameIdx++) { - _durations[frameIdx] = [PINGIFAnimatedImage frameDurationAtIndex:frameIdx source:_imageSource]; - } - } else { - return nil; - } - } - return self; -} - -+ (Float32)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source -{ - Float32 frameDuration = kPINAnimatedImageDefaultDuration; - NSDictionary *frameProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, nil); - // use unclamped delay time before delay time before default - NSNumber *unclamedDelayTime = frameProperties[(__bridge NSString *)kCGImagePropertyGIFDictionary][(__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime]; - if (unclamedDelayTime != nil) { - frameDuration = [unclamedDelayTime floatValue]; - } else { - NSNumber *delayTime = frameProperties[(__bridge NSString *)kCGImagePropertyGIFDictionary][(__bridge NSString *)kCGImagePropertyGIFDelayTime]; - if (delayTime != nil) { - frameDuration = [delayTime floatValue]; - } - } - - static dispatch_once_t onceToken; - static Float32 maximumFrameDuration; - dispatch_once(&onceToken, ^{ - maximumFrameDuration = 1.0 / [PINAnimatedImage maximumFramesPerSecond]; - }); - - if (frameDuration < maximumFrameDuration) { - frameDuration = kPINAnimatedImageDefaultDuration; - } - - return frameDuration; -} - -- (void)dealloc -{ - if (_imageSource) { - CFRelease(_imageSource); - } - if (_durations) { - free(_durations); - } -} - -- (NSData *)data -{ - return _animatedImageData; -} - -- (size_t)frameCount -{ - return _frameCount; -} - -- (size_t)loopCount -{ - return _loopCount; -} - -- (uint32_t)width -{ - return _width; -} - -- (uint32_t)height -{ - return _height; -} - -- (uint32_t)bytesPerFrame -{ - return _width * _height * 4; -} - -- (NSError *)error -{ - return _error; -} - -- (CFTimeInterval)durationAtIndex:(NSUInteger)index -{ - return _durations[index]; -} - -- (CGImageRef)imageAtIndex:(NSUInteger)index cacheProvider:(nullable id)cacheProvider -{ - // I believe this is threadsafe as CGImageSource *seems* immutable… - CGImageRef imageRef = - CGImageSourceCreateImageAtIndex(_imageSource, - index, - (CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceShouldCache: - (__bridge NSNumber *)kCFBooleanFalse}); - if (imageRef) { - CGImageRef decodedImageRef = [PINImage pin_decodedImageRefWithCGImageRef:imageRef]; - CGImageRelease(imageRef); - imageRef = decodedImageRef; - } - - return imageRef; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINWebPAnimatedImage.m b/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINWebPAnimatedImage.m deleted file mode 100644 index da13aa4d..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/AnimatedImages/PINWebPAnimatedImage.m +++ /dev/null @@ -1,403 +0,0 @@ -// -// PINWebPAnimatedImage.m -// PINRemoteImage -// -// Created by Garrett Moon on 9/14/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#if PIN_WEBP - -#import "PINWebPAnimatedImage.h" - -#import "NSData+ImageDetectors.h" - -#if SWIFT_PACKAGE -@import libwebp; -#else -#import "webp/demux.h" -#endif - -@interface PINWebPAnimatedImage () -{ - NSData *_animatedImageData; - WebPData _underlyingData; - WebPDemuxer *_demux; - CGImageRef previousFrame; - uint32_t _width; - uint32_t _height; - BOOL _hasAlpha; - size_t _frameCount; - size_t _loopCount; - CGColorRef _backgroundColor; - CFTimeInterval *_durations; - NSError *_error; -} - -@end - -static void releaseData(void *info, const void *data, size_t size) -{ - WebPFree((void *)data); -} - -@implementation PINWebPAnimatedImage - -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData -{ - if (self = [super init]) { - _animatedImageData = animatedImageData; - _underlyingData.bytes = [animatedImageData bytes]; - _underlyingData.size = [animatedImageData length]; - _demux = WebPDemux(&_underlyingData); - - if (_demux != NULL) { - _width = WebPDemuxGetI(_demux, WEBP_FF_CANVAS_WIDTH); - _height = WebPDemuxGetI(_demux, WEBP_FF_CANVAS_HEIGHT); - _frameCount = WebPDemuxGetI(_demux, WEBP_FF_FRAME_COUNT); - _loopCount = WebPDemuxGetI(_demux, WEBP_FF_LOOP_COUNT); - uint32_t flags = WebPDemuxGetI(_demux, WEBP_FF_FORMAT_FLAGS); - _hasAlpha = flags & ALPHA_FLAG; - _durations = malloc(sizeof(CFTimeInterval) * _frameCount); - - uint32_t backgroundColorInt = WebPDemuxGetI(_demux, WEBP_FF_BACKGROUND_COLOR); - CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); - CGFloat components[4]; - components[0] = (CGFloat)(((backgroundColorInt & 0xFF000000) >> 24)/255.0); - components[1] = (CGFloat)(((backgroundColorInt & 0x00FF0000) >> 16)/255.0); - components[2] = (CGFloat)(((backgroundColorInt & 0x0000FF00) >> 8)/255.0); - components[3] = (CGFloat)((backgroundColorInt & 0x000000FF)/255.0); - _backgroundColor = CGColorCreate(rgbColorSpace, components); - CGColorSpaceRelease(rgbColorSpace); - - // Iterate over the frames to gather duration - WebPIterator iter; - if (WebPDemuxGetFrame(_demux, 1, &iter)) { - do { - CFTimeInterval duration = iter.duration / 1000.0; - static dispatch_once_t onceToken; - static CFTimeInterval maximumDuration; - dispatch_once(&onceToken, ^{ - maximumDuration = 1.0 / [PINAnimatedImage maximumFramesPerSecond]; - }); - if (duration < maximumDuration) { - duration = kPINAnimatedImageDefaultDuration; - } - _durations[iter.frame_num - 1] = duration; - } while (WebPDemuxNextFrame(&iter)); - WebPDemuxReleaseIterator(&iter); - } - } else { - return nil; - } - } - return self; -} - -- (void)dealloc -{ - if (_demux) { - WebPDemuxDelete(_demux); - } - if (_durations) { - free(_durations); - } - if (_backgroundColor) { - CGColorRelease(_backgroundColor); - } -} - -- (NSData *)data -{ - return _animatedImageData; -} - -- (size_t)frameCount -{ - return _frameCount; -} - -- (size_t)loopCount -{ - return _loopCount; -} - -- (uint32_t)width -{ - return _width; -} - -- (uint32_t)height -{ - return _height; -} - -- (uint32_t)bytesPerFrame -{ - return _width * _height * (_hasAlpha ? 4 : 3); -} - -- (NSError *)error -{ - return _error; -} - -- (CFTimeInterval)durationAtIndex:(NSUInteger)index -{ - return _durations[index]; -} - -- (CGImageRef)canvasWithPreviousFrame:(CGImageRef)previousFrame - previousFrameRect:(CGRect)previousFrameRect - clearPreviousFrame:(BOOL)clearPreviousFrame - backgroundColor:(CGColorRef)backgroundColor - image:(CGImageRef)image - clearCurrentFrame:(BOOL)clearCurrentFrame - atRect:(CGRect)rect -{ - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, - _width, - _height, - 8, - 0, - colorSpaceRef, - _hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNone); - if (backgroundColor) { - CGContextSetFillColorWithColor(context, backgroundColor); - } - - if (previousFrame) { - CGContextDrawImage(context, CGRectMake(0, 0, _width, _height), previousFrame); - if (clearPreviousFrame) { - CGContextFillRect(context, previousFrameRect); - } - } - - if (image) { - CGRect currentRect = CGRectMake(rect.origin.x, _height - rect.size.height - rect.origin.y, rect.size.width, rect.size.height); - if (clearCurrentFrame) { - CGContextFillRect(context, currentRect); - } - CGContextDrawImage(context, currentRect, image); - } - - CGImageRef canvas = CGBitmapContextCreateImage(context); - if (canvas) { - CFAutorelease(canvas); - } - CGContextRelease(context); - CGColorSpaceRelease(colorSpaceRef); - - return canvas; -} - -- (CGImageRef)rawImageWithIterator:(WebPIterator)iterator -{ - CGImageRef imageRef = NULL; - uint8_t *data = NULL; - int pixelLength = 0; - - if (iterator.has_alpha) { - data = WebPDecodeRGBA(iterator.fragment.bytes, iterator.fragment.size, NULL, NULL); - pixelLength = 4; - } else { - data = WebPDecodeRGB(iterator.fragment.bytes, iterator.fragment.size, NULL, NULL); - pixelLength = 3; - } - - if (data) { - CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, data, iterator.width * iterator.height * pixelLength, releaseData); - - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; - - if (iterator.has_alpha) { - bitmapInfo |= kCGImageAlphaLast; - } else { - bitmapInfo |= kCGImageAlphaNone; - } - - CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; - imageRef = CGImageCreate(iterator.width, - iterator.height, - 8, - 8 * pixelLength, - pixelLength * iterator.width, - colorSpaceRef, - bitmapInfo, - provider, - NULL, - NO, - renderingIntent); - - CGColorSpaceRelease(colorSpaceRef); - CGDataProviderRelease(provider); - } - - if (imageRef) { - CFAutorelease(imageRef); - } - - return imageRef; -} - -- (CGImageRef)imageAtIndex:(NSUInteger)index cacheProvider:(nullable id)cacheProvider -{ - PINLog(@"Drawing webp image at index: %lu", (unsigned long)index); - // This all *appears* to be threadsafe as I believe demux is immutable… - WebPIterator iterator, previousIterator; - - if (index > 0) { - if (WebPDemuxGetFrame(_demux, (int)index, &previousIterator) == NO) { - return nil; - } - } - if (WebPDemuxGetFrame(_demux, (int)index + 1, &iterator) == NO) { - return nil; - } - - BOOL isKeyFrame = [self isKeyFrame:&iterator previousIterator:(index > 0) ? &previousIterator : nil]; - - CGImageRef imageRef = [self rawImageWithIterator:iterator]; - CGImageRef canvas = NULL; - - if (imageRef) { - if (isKeyFrame) { - // If the current frame is a keyframe, we can just copy it into a blank - // canvas. - if (iterator.x_offset == 0 && iterator.y_offset == 0 && iterator.width == _width && iterator.height == _height) { - // Output will be the same size as the canvas, just return it directly. - canvas = imageRef; - } else { - canvas = [self canvasWithPreviousFrame:nil - previousFrameRect:CGRectZero - clearPreviousFrame:NO - backgroundColor:_backgroundColor - image:imageRef - clearCurrentFrame:iterator.blend_method == WEBP_MUX_NO_BLEND - atRect:CGRectMake(iterator.x_offset, iterator.y_offset, iterator.width, iterator.height)]; - } - } else { - // If we have a cached image provider, try to get the last frame from them - CGImageRef previousFrame = [cacheProvider cachedFrameImageAtIndex:index - 1]; - if (previousFrame) { - // We need an iterator from the previous frame to dispose to background if - // necessary. - WebPDemuxReleaseIterator(&previousIterator); - WebPDemuxGetFrame(_demux, (int)index, &previousIterator); - CGRect previousFrameRect = CGRectMake(previousIterator.x_offset, _height - previousIterator.height - previousIterator.y_offset, previousIterator.width, previousIterator.height); - canvas = [self canvasWithPreviousFrame:previousFrame - previousFrameRect:previousFrameRect - clearPreviousFrame:previousIterator.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND - backgroundColor:_backgroundColor - image:imageRef - clearCurrentFrame:iterator.blend_method == WEBP_MUX_NO_BLEND - atRect:CGRectMake(iterator.x_offset, iterator.y_offset, iterator.width, iterator.height)]; - } else if (index > 0) { - // Sadly, we need to draw *all* the frames from the previous key frame previousIterator to the current one :( - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, - _width, - _height, - 8, - 0, - colorSpaceRef, - _hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNone); - CGContextSetFillColorWithColor(context, _backgroundColor); - - while (previousIterator.frame_num <= iterator.frame_num) { - CGImageRef previousFrame = [self rawImageWithIterator:previousIterator]; - if (previousFrame) { - CGRect previousFrameRect = CGRectMake(previousIterator.x_offset, _height - previousIterator.height - previousIterator.y_offset, previousIterator.width, previousIterator.height); - if (previousIterator.blend_method == WEBP_MUX_NO_BLEND) { - CGContextFillRect(context, previousFrameRect); - } - - if (previousIterator.frame_num == iterator.frame_num) { - CGContextDrawImage(context, previousFrameRect, previousFrame); - // We have to break here because we're not getting the next frame! Basically - // the while loop is a sham and only here to illustrate what we want to iterate. - break; - } else { - if (previousIterator.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { - CGContextFillRect(context, previousFrameRect); - } else { - CGContextDrawImage(context, previousFrameRect, previousFrame); - } - WebPDemuxNextFrame(&previousIterator); - } - } - } - - canvas = CGBitmapContextCreateImage(context); - if (canvas) { - CFAutorelease(canvas); - } - CGContextRelease(context); - CGColorSpaceRelease(colorSpaceRef); - } - } - } - - WebPDemuxReleaseIterator(&iterator); - if (index > 0) { - WebPDemuxReleaseIterator(&previousIterator); - } - - return canvas; -} - -// Checks to see if the iterator is a 'key frame' without taking previous frames into -// account. -- (BOOL)helperIsKeyFrame:(WebPIterator *)iterator -{ - if (iterator->frame_num == 1) { - //The first frame is always a key frame - return YES; - } else if ((iterator->has_alpha == NO || iterator->blend_method == WEBP_MUX_NO_BLEND) && iterator->width == _width && iterator->height == _height) { - //If the current frame has no alpha, or we're instructed not to blend, just make sure this fills the canvas. - return YES; - } - return NO; -} - -// Checks if the iterator is at a 'key frame' and rewinds previousIterator back to the last -// key frame if it's not. If this frame *is* a keyframe, the previousIterator's position is undefined. -// This takes previous frames into account to determine if the current frame is key. -- (BOOL)isKeyFrame:(WebPIterator *)iterator previousIterator:(WebPIterator *)previousIterator -{ - if ([self helperIsKeyFrame:iterator]) { - // Check if we're a key frame regardless of previous frame. - return YES; - } - - if (previousIterator == nil) { - return NO; - } - - BOOL previousFrameMadeThisKeyFrame = previousIterator->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND; - BOOL foundKeyframe = NO; - while (foundKeyframe == NO) { - if ([self helperIsKeyFrame:previousIterator] || - (previousIterator->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND && previousIterator->width == _width && previousIterator->height == _height)) { - foundKeyframe = YES; - } else { - // we need to rewind previous back to see if it was a keyframe - WebPDemuxPrevFrame(previousIterator); - if (previousIterator->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { - // need to check previous frame - continue; - } else { - previousFrameMadeThisKeyFrame = NO; - continue; - } - } - } - - return previousFrameMadeThisKeyFrame; -} - -@end - -#endif diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSData+ImageDetectors.m b/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSData+ImageDetectors.m deleted file mode 100644 index f58f5571..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSData+ImageDetectors.m +++ /dev/null @@ -1,139 +0,0 @@ -// -// NSData+ImageDetectors.m -// Pods -// -// Created by Garrett Moon on 11/19/14. -// -// - -#import "NSData+ImageDetectors.h" - -#if PIN_WEBP - #if SWIFT_PACKAGE - @import libwebp; - #else - #import "webp/demux.h" - #endif -#endif - -@implementation NSData (PINImageDetectors) - -- (BOOL)pin_isGIF -{ - const NSInteger length = 3; - Byte firstBytes[length]; - if ([self length] >= length) { - [self getBytes:&firstBytes length:length]; - //G, I, F - if (firstBytes[0] == 0x47 && firstBytes[1] == 0x49 && firstBytes[2] == 0x46) { - return YES; - } - } - return NO; -} - -#define BREAK_IF_INVALID(position) if (position >= length) break; - -static inline BOOL advancePositionWithCount(NSUInteger *position, NSUInteger length, NSUInteger count) -{ - if (*position + count >= length) { - return NO; - } - *position = *position + count; - - return YES; -} - -static inline BOOL advancePositionWithBytes(NSUInteger *position, Byte *bytes, NSUInteger length, NSUInteger count) -{ - BOOL readAgain; - do { - readAgain = NO; - if (*position + count >= length ) { - return NO; - } - *position = *position + count; - NSUInteger bytesToAdvance = *(bytes + *position); - if (bytesToAdvance == 0xFF) { - readAgain = YES; - count = 0; - } - // Advance the byte read as well. - bytesToAdvance++; - - if (*position + bytesToAdvance >= length) { - return NO; - } - *position = *position + bytesToAdvance; - } while (readAgain); - - return YES; -} - -- (BOOL)pin_isAnimatedGIF -{ - if ([self pin_isGIF] == NO) { - return NO; - } - - Byte *bytes = (Byte *)self.bytes; - NSUInteger length = self.length; - NSUInteger position = 0; - NSUInteger GCECount = 0; - - while (bytes && position < length) { - // Look for Graphic Control Extension - if (*(bytes + position) == 0x21) { - if (!advancePositionWithCount(&position, length, 1)) break; - if (*(bytes + position) == 0xF9) { - GCECount++; - if (GCECount > 1) { - break; - } - // Found GCE, advance to image. Next byte is size of GCE - if (!advancePositionWithBytes(&position, bytes, length, 1)) break; - // Advance 1 for 00 at the end of GCE - if (!advancePositionWithCount(&position, length, 1)) break; - // Advance image descriptor - if (!advancePositionWithCount(&position, length, 11)) break; - // Advance image - if (!advancePositionWithBytes(&position, bytes, length, 0)) break; - // Advance 1 for 00 at the end of image - if (!advancePositionWithCount(&position, length, 1)) break; - } - continue; - } - if (!advancePositionWithCount(&position, length, 1)) break; - } - - return GCECount > 1; -} - -#if PIN_WEBP -- (BOOL)pin_isWebP -{ - const NSInteger length = 12; - Byte firstBytes[length]; - if ([self length] >= length) { - [self getBytes:&firstBytes length:length]; - //R, I, F, F, -, -, -, -, W, E, B, P - if (firstBytes[0] == 0x52 && firstBytes[1] == 0x49 && firstBytes[2] == 0x46 && firstBytes[3] == 0x46 && firstBytes[8] == 0x57 && firstBytes[9] == 0x45 && firstBytes[10] == 0x42 && firstBytes[11] == 0x50) { - return YES; - } - } - return NO; -} - -- (BOOL)pin_isAnimatedWebP -{ - WebPBitstreamFeatures features; - if (WebPGetFeatures([self bytes], [self length], &features) == VP8_STATUS_OK) { - return features.has_animation; - } - - return NO; -} - -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.h b/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.h deleted file mode 100644 index a1453726..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// NSHTTPURLResponse+MaxAge.m -// -// Created by Kevin Smith on 6/15/18. -// -// - -#import - -@interface NSHTTPURLResponse (MaxAge) - -- (NSNumber *)findMaxAge; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.m b/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.m deleted file mode 100644 index 6acdcc95..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/NSHTTPURLResponse+MaxAge.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// NSHTTPURLResponse+MaxAge.m -// -// Created by Kevin Smith on 6/15/18. -// -// - -#import "NSHTTPURLResponse+MaxAge.h" - -@implementation NSHTTPURLResponse (MaxAge) - -static NSDateFormatter *sharedFormatter; -static dispatch_once_t sharedFormatterToken; - -+ (NSDateFormatter *)RFC7231PreferredDateFormatter -{ - dispatch_once(&sharedFormatterToken, ^{ - NSLocale *enUSPOSIXLocale; - - sharedFormatter = [[NSDateFormatter alloc] init]; - - enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]; - - [sharedFormatter setLocale:enUSPOSIXLocale]; - [sharedFormatter setDateFormat:@"E, d MMM yyyy HH:mm:ss Z"]; - - }); - return sharedFormatter; -} - -- (NSNumber *)findMaxAge -{ - NSDictionary * headerFields = [self allHeaderFields]; - NSNumber *maxAge = nil; - - for (NSString * component in [headerFields[@"Cache-Control"] componentsSeparatedByString:@","]) { - NSString * trimmed = [[component stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] lowercaseString]; - - if ([trimmed isEqualToString:@"no-store"] || [trimmed isEqualToString:@"must-revalidate"] || [trimmed isEqualToString:@"no-cache"]) { - maxAge = @(0); - break; - } else { - // max-age - NSArray * split = [trimmed componentsSeparatedByString:@"max-age="]; - if ([split count] == 2) { - // if the max-age provided is invalid (does not parse into an - // int), we wind up with 0 which will be treated as do-not-cache. - // This is the RFC defined behavior for a malformed "expires" header, - // and while I cannot find any explicit instruction of how to behave - // with a malformed "max-age" header, it seems like a reasonable approach. - maxAge = @([split[1] integerValue]); - } else if ([split count] > 2) { - // very weird case "maxage=maxage=123" - maxAge = @(0); - } - } - } - - // If there is a Cache-Control header with the "max-age" directive in the response, the Expires header is ignored. - if (!maxAge && headerFields[@"Expires"]) { - NSString * expires = headerFields[@"Expires"]; - NSDate * date = [[NSHTTPURLResponse RFC7231PreferredDateFormatter] dateFromString:expires]; - - // Invalid dates (notably "0") or dates in the past must not be cached (RFC7231 5.3) - maxAge = @((NSInteger) MAX(([date timeIntervalSinceNow]), 0)); - } - - return maxAge; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.h b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.h deleted file mode 100644 index 08d0e5a0..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// UIImage+DecodedImage.h -// Pods -// -// Created by Garrett Moon on 11/19/14. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#if !PIN_TARGET_IOS -@interface NSImage (PINiOSMapping) - -@property(nonatomic, readonly, nullable) CGImageRef CGImage; - -+ (nullable NSImage *)imageWithData:(nonnull NSData *)imageData; -+ (nullable NSImage *)imageWithContentsOfFile:(nonnull NSString *)path; -+ (nonnull NSImage *)imageWithCGImage:(nonnull CGImageRef)imageRef; - -@end -#endif - -NSData * __nullable PINImageJPEGRepresentation(PINImage * __nonnull image, CGFloat compressionQuality); -NSData * __nullable PINImagePNGRepresentation(PINImage * __nonnull image); - -@interface PINImage (PINDecodedImage) - -+ (nullable PINImage *)pin_decodedImageWithData:(nonnull NSData *)data; -+ (nullable PINImage *)pin_decodedImageWithData:(nonnull NSData *)data skipDecodeIfPossible:(BOOL)skipDecodeIfPossible; -+ (nullable PINImage *)pin_decodedImageWithCGImageRef:(nonnull CGImageRef)imageRef; -#if PIN_TARGET_IOS -+ (nullable PINImage *)pin_decodedImageWithCGImageRef:(nonnull CGImageRef)imageRef orientation:(UIImageOrientation) orientation; -#endif -+ (nullable CGImageRef)pin_decodedImageRefWithCGImageRef:(nonnull CGImageRef)imageRef; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.m b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.m deleted file mode 100644 index da75e5bc..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+DecodedImage.m +++ /dev/null @@ -1,325 +0,0 @@ -// -// UIImage+DecodedImage.m -// Pods -// -// Created by Garrett Moon on 11/19/14. -// -// - -#import "PINImage+DecodedImage.h" - -#import - -#ifdef PIN_WEBP -#import "PINImage+WebP.h" -#endif - -#import "NSData+ImageDetectors.h" - -NS_INLINE BOOL pin_CGImageRefIsOpaque(CGImageRef imageRef) { - CGImageAlphaInfo alpha = CGImageGetAlphaInfo(imageRef); - switch (alpha) { - case kCGImageAlphaNone: - case kCGImageAlphaNoneSkipLast: - case kCGImageAlphaNoneSkipFirst: - return YES; - default: - return NO; - } -} - -#if PIN_TARGET_IOS -NS_INLINE void pin_degreesFromOrientation(UIImageOrientation orientation, void (^completion)(CGFloat degrees, BOOL horizontalFlip, BOOL verticalFlip)) { - switch (orientation) { - case UIImageOrientationUp: // default orientation - completion(0.0, NO, NO); - break; - case UIImageOrientationDown: // 180 deg rotation - completion(180.0, NO, NO); - break; - case UIImageOrientationLeft: - completion(270.0, NO, NO); // 90 deg CCW - break; - case UIImageOrientationRight: - completion(90.0, NO, NO); // 90 deg CW - break; - case UIImageOrientationUpMirrored: // as above but image mirrored along other axis. horizontal flip - completion(0.0, YES, NO); - break; - case UIImageOrientationDownMirrored: // horizontal flip - completion(180.0, YES, NO); - break; - case UIImageOrientationLeftMirrored: // vertical flip - completion(270.0, NO, YES); - break; - case UIImageOrientationRightMirrored: // vertical flip - completion(90.0, NO, YES); - break; - } -} -#endif - -#if !PIN_TARGET_IOS -@implementation NSImage (PINiOSMapping) - -- (CGImageRef)CGImage -{ - NSGraphicsContext *context = [NSGraphicsContext currentContext]; - NSRect rect = NSMakeRect(0.0, 0.0, self.size.width, self.size.height); - return [self CGImageForProposedRect:&rect context:context hints:NULL]; -} - -+ (NSImage *)imageWithData:(NSData *)imageData; -{ - return [[self alloc] initWithData:imageData]; -} - -+ (NSImage *)imageWithContentsOfFile:(NSString *)path -{ - return path ? [[self alloc] initWithContentsOfFile:path] : nil; -} - -+ (NSImage *)imageWithCGImage:(CGImageRef)imageRef -{ - return [[self alloc] initWithCGImage:imageRef size:CGSizeZero]; -} - -@end -#endif - -NSData * __nullable PINImageJPEGRepresentation(PINImage * __nonnull image, CGFloat compressionQuality) -{ -#if PIN_TARGET_IOS - return UIImageJPEGRepresentation(image, compressionQuality); -#elif PIN_TARGET_MAC - NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; - NSDictionary *imageProperties = @{NSImageCompressionFactor : @(compressionQuality)}; - return [imageRep representationUsingType:NSJPEGFileType properties:imageProperties]; -#endif -} - -NSData * __nullable PINImagePNGRepresentation(PINImage * __nonnull image) { -#if PIN_TARGET_IOS - return UIImagePNGRepresentation(image); -#elif PIN_TARGET_MAC - NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; - NSDictionary *imageProperties = @{NSImageCompressionFactor : @1}; - return [imageRep representationUsingType:NSPNGFileType properties:imageProperties]; -#endif -} - - -@implementation PINImage (PINDecodedImage) - -+ (PINImage *)pin_decodedImageWithData:(NSData *)data -{ - return [self pin_decodedImageWithData:data skipDecodeIfPossible:NO]; -} - -+ (PINImage *)pin_decodedImageWithData:(NSData *)data skipDecodeIfPossible:(BOOL)skipDecodeIfPossible -{ - if (data == nil) { - return nil; - } - -#if PIN_WEBP - if ([data pin_isWebP]) { - return [PINImage pin_imageWithWebPData:data]; - } -#endif - - PINImage *decodedImage = nil; - - CGImageSourceRef imageSourceRef = CGImageSourceCreateWithData((CFDataRef)data, NULL); - - if (imageSourceRef) { - CGImageRef imageRef = CGImageSourceCreateImageAtIndex(imageSourceRef, 0, (CFDictionaryRef)@{(NSString *)kCGImageSourceShouldCache : (NSNumber *)kCFBooleanFalse}); - if (imageRef) { -#if PIN_TARGET_IOS - UIImageOrientation orientation = pin_UIImageOrientationFromImageSource(imageSourceRef); - if (skipDecodeIfPossible) { - decodedImage = [PINImage imageWithCGImage:imageRef scale:1.0 orientation:orientation]; - } else { - decodedImage = [self pin_decodedImageWithCGImageRef:imageRef orientation:orientation]; - } -#elif PIN_TARGET_MAC - if (skipDecodeIfPossible) { - CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); - decodedImage = [[NSImage alloc] initWithCGImage:imageRef size:imageSize]; - } else { - decodedImage = [self pin_decodedImageWithCGImageRef:imageRef]; - } -#endif - CGImageRelease(imageRef); - } - - CFRelease(imageSourceRef); - } - - return decodedImage; -} - -+ (PINImage *)pin_decodedImageWithCGImageRef:(CGImageRef)imageRef -{ -#if PIN_TARGET_IOS - return [self pin_decodedImageWithCGImageRef:imageRef orientation:UIImageOrientationUp]; -} - -+ (PINImage *)pin_decodedImageWithCGImageRef:(CGImageRef)imageRef orientation:(UIImageOrientation)orientation -{ -#endif -#if PIN_TARGET_IOS - if (@available(iOS 10.0, tvOS 10.0, *)) { - return [self pin_decodedImageUsingGraphicsImageRendererRefWithCGImageRef:imageRef scale:1.0 orientation:orientation]; - } else { - return [UIImage imageWithCGImage:[self pin_decodedImageRefWithCGImageRef:imageRef] scale:1.0 orientation:orientation]; - } -#elif PIN_TARGET_MAC - return [[NSImage alloc] initWithCGImage:[self pin_decodedImageRefWithCGImageRef:imageRef] size:NSZeroSize]; -#endif -} - -#if PIN_TARGET_IOS -+ (PINImage *)pin_decodedImageUsingGraphicsImageRendererRefWithCGImageRef:(CGImageRef)imageRef - scale:(CGFloat)scale - orientation:(UIImageOrientation)orientation API_AVAILABLE(ios(10.0), tvos(10.0)) { - UIGraphicsImageRendererFormat *format = nil; - if (@available(iOS 11.0, tvOS 11.0, *)) { - format = [UIGraphicsImageRendererFormat preferredFormat]; - } else { - format = [UIGraphicsImageRendererFormat defaultFormat]; - } - - format.scale = scale; - format.opaque = pin_CGImageRefIsOpaque(imageRef); - - __block CGFloat radians = 0.0; - __block BOOL doHorizontalFlip = NO; - __block BOOL doVerticalFlip = NO; - - pin_degreesFromOrientation(orientation, ^(CGFloat degrees, BOOL horizontalFlip, BOOL verticalFlip) { - // Convert degrees to radians - radians = [[[NSMeasurement alloc] initWithDoubleValue:degrees - unit:[NSUnitAngle degrees]] - measurementByConvertingToUnit:[NSUnitAngle radians]].doubleValue; - doHorizontalFlip = horizontalFlip; - doVerticalFlip = verticalFlip; - }); - - // Create rotation out of radians - CGAffineTransform transform = CGAffineTransformMakeRotation(radians); - - // Grab image size - CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); - - // Rotate rect by transformation - CGRect rotatedRect = CGRectApplyAffineTransform(CGRectMake(0.0, 0.0, imageSize.width, imageSize.height), transform); - - // Use graphics renderer to render image - UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:rotatedRect.size format:format]; - - return [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { - CGContextRef ctx = rendererContext.CGContext; - - // Flip the default coordinate system for iOS/tvOS: https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GraphicsDrawingOverview/GraphicsDrawingOverview.html#//apple_ref/doc/uid/TP40010156-CH14-SW4 - CGContextTranslateCTM(ctx, rotatedRect.size.width / 2.0, rotatedRect.size.height / 2.0); - CGContextScaleCTM(ctx, (doHorizontalFlip ? -1.0 : 1.0), (doVerticalFlip ? 1.0 : -1.0)); - - // Apply transformation - CGContextConcatCTM(ctx, transform); - - // Draw image - CGContextDrawImage(ctx, CGRectMake(-(imageSize.width / 2.0), -(imageSize.height / 2.0), imageSize.width, imageSize.height), imageRef); - }]; -} -#endif - -+ (CGImageRef)pin_decodedImageRefWithCGImageRef:(CGImageRef)imageRef -{ - CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); - - CGBitmapInfo info = pin_CGImageRefIsOpaque(imageRef) ? (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host) : (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); - CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); - - //Use UIGraphicsBeginImageContext parameters from docs: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIGraphicsBeginImageContextWithOptions - CGContextRef ctx = CGBitmapContextCreate(NULL, imageSize.width, imageSize.height, - 8, - 0, - colorspace, - info); - - CGColorSpaceRelease(colorspace); - - if (ctx) { - CGContextSetBlendMode(ctx, kCGBlendModeCopy); - CGContextDrawImage(ctx, CGRectMake(0, 0, imageSize.width, imageSize.height), imageRef); - - CGImageRef decodedImageRef = CGBitmapContextCreateImage(ctx); - if (decodedImageRef) { - CFAutorelease(decodedImageRef); - } - CGContextRelease(ctx); - return decodedImageRef; - - } - - return imageRef; -} - -#if PIN_TARGET_IOS -UIImageOrientation pin_UIImageOrientationFromImageSource(CGImageSourceRef imageSourceRef) { - UIImageOrientation orientation = UIImageOrientationUp; - - if (imageSourceRef != nil) { - NSDictionary *dict = (NSDictionary *)CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(imageSourceRef, 0, NULL)); - - if (dict != nil) { - - NSNumber* exifOrientation = dict[(id)kCGImagePropertyOrientation]; - if (exifOrientation != nil) { - - switch (exifOrientation.intValue) { - case 1: /*kCGImagePropertyOrientationUp*/ - orientation = UIImageOrientationUp; - break; - - case 2: /*kCGImagePropertyOrientationUpMirrored*/ - orientation = UIImageOrientationUpMirrored; - break; - - case 3: /*kCGImagePropertyOrientationDown*/ - orientation = UIImageOrientationDown; - break; - - case 4: /*kCGImagePropertyOrientationDownMirrored*/ - orientation = UIImageOrientationDownMirrored; - break; - case 5: /*kCGImagePropertyOrientationLeftMirrored*/ - orientation = UIImageOrientationLeftMirrored; - break; - - case 6: /*kCGImagePropertyOrientationRight*/ - orientation = UIImageOrientationRight; - break; - - case 7: /*kCGImagePropertyOrientationRightMirrored*/ - orientation = UIImageOrientationRightMirrored; - break; - - case 8: /*kCGImagePropertyOrientationLeft*/ - orientation = UIImageOrientationLeft; - break; - - default: - break; - } - } - } - } - - return orientation; -} - -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.h b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.h deleted file mode 100644 index b82f9313..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// UIImage+ScaledImage.h -// Pods -// -// Created by Michael Schneider on 2/9/17. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -@interface PINImage (PINScaledImage) - -- (PINImage *)pin_scaledImageForKey:(NSString *)key; -+ (PINImage *)pin_scaledImageForImage:(PINImage *)image withKey:(NSString *)key; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.m b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.m deleted file mode 100644 index 9c4326ef..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+ScaledImage.m +++ /dev/null @@ -1,56 +0,0 @@ -// -// UIImage+ScaledImage.m -// Pods -// -// Created by Michael Schneider on 2/9/17. -// -// - -#import "PINImage+ScaledImage.h" - -static inline PINImage *PINScaledImageForKey(NSString * __nullable key, PINImage * __nullable image) { - if (image == nil) { - return nil; - } - -#if PIN_TARGET_IOS - - NSCAssert(image.CGImage != NULL, @"CGImage should not be NULL"); - - CGFloat scale = 1.0; - if (key.length >= 8) { - if ([key rangeOfString:@"_2x."].location != NSNotFound || - [key rangeOfString:@"@2x."].location != NSNotFound) { - scale = 2.0; - } - - if ([key rangeOfString:@"_3x."].location != NSNotFound || - [key rangeOfString:@"@3x."].location != NSNotFound) { - scale = 3.0; - } - } - - if (scale != image.scale) { - return [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; - } - - return image; - -#elif PIN_TARGET_MAC - return image; -#endif -} - -@implementation PINImage (ScaledImage) - -- (PINImage *)pin_scaledImageForKey:(NSString *)key -{ - return PINScaledImageForKey(key, self); -} - -+ (PINImage *)pin_scaledImageForImage:(PINImage *)image withKey:(NSString *)key -{ - return PINScaledImageForKey(key, image); -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.h b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.h deleted file mode 100644 index 8c384076..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// UIImage+WebP.h -// Pods -// -// Created by Garrett Moon on 11/18/14. -// -// - -#import "PINRemoteImageMacros.h" - -#if PIN_WEBP - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -@interface PINImage (PINWebP) - -+ (PINImage *)pin_imageWithWebPData:(NSData *)webPData; - -@end - -#endif diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.m b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.m deleted file mode 100644 index d2021d3a..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINImage+WebP.m +++ /dev/null @@ -1,87 +0,0 @@ -// -// UIImage+WebP.m -// Pods -// -// Created by Garrett Moon on 11/18/14. -// -// - -#import "PINImage+WebP.h" - -#if PIN_WEBP - -#if SWIFT_PACKAGE -@import libwebp; -#else -#import "webp/decode.h" -#endif - -static void releaseData(void *info, const void *data, size_t size) -{ - WebPFree((void *)data); -} - -@implementation PINImage (PINWebP) - -+ (PINImage *)pin_imageWithWebPData:(NSData *)webPData -{ - WebPBitstreamFeatures features; - if (WebPGetFeatures([webPData bytes], [webPData length], &features) == VP8_STATUS_OK) { - // Decode the WebP image data into a RGBA value array - int height, width; - uint8_t *data = NULL; - int pixelLength = 0; - - if (features.has_alpha) { - data = WebPDecodeRGBA([webPData bytes], [webPData length], &width, &height); - pixelLength = 4; - } else { - data = WebPDecodeRGB([webPData bytes], [webPData length], &width, &height); - pixelLength = 3; - } - - if (data) { - CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, data, width * height * pixelLength, releaseData); - - CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); - CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; - - if (features.has_alpha) { - bitmapInfo |= kCGImageAlphaLast; - } else { - bitmapInfo |= kCGImageAlphaNone; - } - - CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; - CGImageRef imageRef = CGImageCreate(width, - height, - 8, - 8 * pixelLength, - pixelLength * width, - colorSpaceRef, - bitmapInfo, - provider, - NULL, - NO, - renderingIntent); - - PINImage *image = nil; -#if PIN_TARGET_IOS - image = [UIImage imageWithCGImage:imageRef]; -#elif PIN_TARGET_MAC - image = [[self alloc] initWithCGImage:imageRef size:CGSizeZero]; -#endif - - CGImageRelease(imageRef); - CGColorSpaceRelease(colorSpaceRef); - CGDataProviderRelease(provider); - - return image; - } - } - return nil; -} - -@end - -#endif diff --git a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINRemoteImageTask+Subclassing.h b/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINRemoteImageTask+Subclassing.h deleted file mode 100644 index 8e0c6005..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/Categories/PINRemoteImageTask+Subclassing.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// PINRemoteImageTask+Subclassing.h -// PINRemoteImage -// -// Created by Garrett Moon on 5/22/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINRemoteImageTask.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface PINRemoteImageTask (Subclassing) - -- (NSMutableDictionary *)l_callbackBlocks; -- (BOOL)l_cancelWithUUID:(NSUUID *)UUID; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINAnimatedImageView+PINRemoteImage.m b/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINAnimatedImageView+PINRemoteImage.m deleted file mode 100644 index 34edd842..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINAnimatedImageView+PINRemoteImage.m +++ /dev/null @@ -1,119 +0,0 @@ -// -// PINAnimatedImageView+PINRemoteImage.m -// Pods -// -// Created by Garrett Moon on 4/19/18. -// - -#import "PINAnimatedImageView+PINRemoteImage.h" - -#import "PINAnimatedImage.h" - -@implementation PINAnimatedImageView (PINRemoteImage) - -- (void)pin_setImageFromURL:(NSURL *)url -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURL:(NSURL *)url completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:@[url] placeholderImage:placeholderImage processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_cancelImageDownload -{ - [PINRemoteImageCategoryManager cancelImageDownloadOnView:self]; -} - -- (NSUUID *)pin_downloadImageOperationUUID -{ - return [PINRemoteImageCategoryManager downloadImageOperationUUIDOnView:self]; -} - -- (void)pin_setDownloadImageOperationUUID:(NSUUID *)downloadImageOperationUUID -{ - [PINRemoteImageCategoryManager setDownloadImageOperationUUID:downloadImageOperationUUID onView:self]; -} - -- (BOOL)pin_updateWithProgress -{ - return [PINRemoteImageCategoryManager updateWithProgressOnView:self]; -} - -- (void)setPin_updateWithProgress:(BOOL)updateWithProgress -{ - [PINRemoteImageCategoryManager setUpdateWithProgressOnView:updateWithProgress onView:self]; -} - -- (void)pin_setPlaceholderWithImage:(PINImage *)image -{ - self.image = image; -} - -- (void)pin_updateUIWithRemoteImageManagerResult:(PINRemoteImageManagerResult *)result -{ - if (result.alternativeRepresentation && [result.alternativeRepresentation isKindOfClass:[PINCachedAnimatedImage class]]) { - self.animatedImage = (PINCachedAnimatedImage *)result.alternativeRepresentation; - } else if (result.image) { - self.image = result.image; - } -} - -- (void)pin_clearImages -{ - self.animatedImage = nil; - self.image = nil; -} - -- (BOOL)pin_ignoreGIFs -{ - return NO; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINButton+PINRemoteImage.m b/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINButton+PINRemoteImage.m deleted file mode 100644 index 50f5d802..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINButton+PINRemoteImage.m +++ /dev/null @@ -1,131 +0,0 @@ -// -// UIButton+PINRemoteImage.m -// Pods -// -// Created by Garrett Moon on 8/18/14. -// -// - -#import "PINButton+PINRemoteImage.h" - -@implementation PINButton (PINRemoteImage) - -- (void)pin_setImageFromURL:(NSURL *)url -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURL:(NSURL *)url completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:url?@[url]:nil placeholderImage:placeholderImage processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_cancelImageDownload -{ - [PINRemoteImageCategoryManager cancelImageDownloadOnView:self]; -} - -- (NSUUID *)pin_downloadImageOperationUUID -{ - return [PINRemoteImageCategoryManager downloadImageOperationUUIDOnView:self]; -} - -- (void)pin_setDownloadImageOperationUUID:(NSUUID *)downloadImageOperationUUID -{ - [PINRemoteImageCategoryManager setDownloadImageOperationUUID:downloadImageOperationUUID onView:self]; -} - -- (BOOL)pin_updateWithProgress -{ - return [PINRemoteImageCategoryManager updateWithProgressOnView:self]; -} - -- (void)setPin_updateWithProgress:(BOOL)updateWithProgress -{ - [PINRemoteImageCategoryManager setUpdateWithProgressOnView:updateWithProgress onView:self]; -} - -- (void)pin_setPlaceholderWithImage:(PINImage *)image -{ -#if PIN_TARGET_IOS - [self setImage:image forState:UIControlStateNormal]; -#elif PIN_TARGET_MAC - [self setImage:image]; -#endif -} - -- (void)pin_updateUIWithRemoteImageManagerResult:(PINRemoteImageManagerResult *)result -{ - if (result.image) { -#if PIN_TARGET_IOS - [self setImage:result.image forState:UIControlStateNormal]; - [self setNeedsLayout]; -#elif PIN_TARGET_MAC - [self setImage:result.image]; - [self setNeedsLayout:YES]; -#endif - } -} - -- (void)pin_clearImages -{ -#if PIN_TARGET_IOS - [self setImage:nil forState:UIControlStateNormal]; - [self setNeedsLayout]; -#elif PIN_TARGET_MAC - [self setImage:nil]; - [self setNeedsLayout:YES]; -#endif -} - -- (BOOL)pin_ignoreGIFs -{ - return YES; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINImageView+PINRemoteImage.m b/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINImageView+PINRemoteImage.m deleted file mode 100644 index 1e6a6ab2..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/ImageCategories/PINImageView+PINRemoteImage.m +++ /dev/null @@ -1,127 +0,0 @@ -// -// UIImageView+PINRemoteImage.m -// Pods -// -// Created by Garrett Moon on 8/17/14. -// -// - -#import "PINImageView+PINRemoteImage.h" - -@implementation PINImageView (PINRemoteImage) - -- (void)pin_setImageFromURL:(NSURL *)url -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURL:(NSURL *)url completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url placeholderImage:placeholderImage processorKey:processorKey processor:processor]; -} - -- (void)pin_setImageFromURL:(NSURL *)url processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURL:url processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURL:(NSURL *)url placeholderImage:(PINImage *)placeholderImage processorKey:(NSString *)processorKey processor:(PINRemoteImageManagerImageProcessor)processor completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:url?@[url]:nil placeholderImage:placeholderImage processorKey:processorKey processor:processor completion:completion]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage]; -} - -- (void)pin_setImageFromURLs:(NSArray *)urls placeholderImage:(PINImage *)placeholderImage completion:(PINRemoteImageManagerImageCompletion)completion -{ - [PINRemoteImageCategoryManager setImageOnView:self fromURLs:urls placeholderImage:placeholderImage completion:completion]; -} - -- (void)pin_cancelImageDownload -{ - [PINRemoteImageCategoryManager cancelImageDownloadOnView:self]; -} - -- (NSUUID *)pin_downloadImageOperationUUID -{ - return [PINRemoteImageCategoryManager downloadImageOperationUUIDOnView:self]; -} - -- (void)pin_setDownloadImageOperationUUID:(NSUUID *)downloadImageOperationUUID -{ - [PINRemoteImageCategoryManager setDownloadImageOperationUUID:downloadImageOperationUUID onView:self]; -} - -- (BOOL)pin_updateWithProgress -{ - return [PINRemoteImageCategoryManager updateWithProgressOnView:self]; -} - -- (void)setPin_updateWithProgress:(BOOL)updateWithProgress -{ - [PINRemoteImageCategoryManager setUpdateWithProgressOnView:updateWithProgress onView:self]; -} - -- (void)pin_setPlaceholderWithImage:(PINImage *)image -{ - self.image = image; -} - -- (void)pin_updateUIWithRemoteImageManagerResult:(PINRemoteImageManagerResult *)result -{ - if (result.image) { - self.image = result.image; - -#if PIN_TARGET_IOS - [self setNeedsLayout]; -#elif PIN_TARGET_MAC - [self setNeedsLayout:YES]; -#endif - } -} - -- (void)pin_clearImages -{ - self.image = nil; - -#if PIN_TARGET_IOS - [self setNeedsLayout]; -#elif PIN_TARGET_MAC - [self setNeedsLayout:YES]; -#endif -} - -- (BOOL)pin_ignoreGIFs -{ - return YES; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINAlternateRepresentationProvider.m b/Example/Pods/PINRemoteImage/Source/Classes/PINAlternateRepresentationProvider.m deleted file mode 100644 index ea87911e..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINAlternateRepresentationProvider.m +++ /dev/null @@ -1,30 +0,0 @@ -// -// PINAlternateRepresentationProvider.m -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import "PINAlternateRepresentationProvider.h" - -#import "PINCachedAnimatedImage.h" -#import "NSData+ImageDetectors.h" - -@implementation PINAlternateRepresentationProvider - -- (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageManagerDownloadOptions)options -{ -#if PIN_WEBP - if ([data pin_isAnimatedGIF] || [data pin_isAnimatedWebP]) { - return [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:data]; - } -#else - if ([data pin_isAnimatedGIF]) { - return [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:data]; - } -#endif - return nil; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINCache/PINCache+PINRemoteImageCaching.m b/Example/Pods/PINRemoteImage/Source/Classes/PINCache/PINCache+PINRemoteImageCaching.m deleted file mode 100644 index 5641d784..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINCache/PINCache+PINRemoteImageCaching.m +++ /dev/null @@ -1,113 +0,0 @@ -// -// PINCache+PINRemoteImageCaching.m -// Pods -// -// Created by Aleksei Shevchenko on 7/28/16. -// -// - -#import "PINCache+PINRemoteImageCaching.h" - -@implementation PINCache (PINRemoteImageCaching) - -//****************************************************************************************************** -// Memory cache methods -//****************************************************************************************************** -- (nullable id)objectFromMemoryForKey:(NSString *)key -{ - return [self.memoryCache objectForKey:key]; -} - -- (void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost withAgeLimit:(NSTimeInterval)ageLimit -{ - [self.memoryCache setObject:object forKey:key withCost:cost ageLimit:ageLimit]; -} - -- (void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost -{ - [self.memoryCache setObject:object forKey:key withCost:cost]; -} - -- (void)removeObjectForKeyFromMemory:(NSString *)key -{ - [self.memoryCache removeObjectForKey:key]; -} - -//****************************************************************************************************** -// Disk cache methods -//****************************************************************************************************** -- (nullable id)objectFromDiskForKey:(NSString *)key -{ - return [self.diskCache objectForKey:key]; -} - -- (void)objectFromDiskForKey:(NSString *)key completion:(PINRemoteImageCachingObjectBlock)completion -{ - __weak typeof(self) weakSelf = self; - [self.diskCache objectForKeyAsync:key completion:^(PINDiskCache * _Nonnull cache, NSString * _Nonnull key, id _Nullable object) { - if(completion) { - typeof(self) strongSelf = weakSelf; - completion(strongSelf, key, object); - } - }]; -} - -- (void)setObjectOnDisk:(id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit -{ - [self.diskCache setObject:object forKey:key withAgeLimit:ageLimit]; -} - -- (void)setObjectOnDisk:(id)object forKey:(NSString *)key -{ - [self.diskCache setObject:object forKey:key withAgeLimit:0]; -} - -- (BOOL)objectExistsForKey:(NSString *)key -{ - return [self containsObjectForKey:key]; -} - -//****************************************************************************************************** -// Common cache methods -//****************************************************************************************************** -- (void)removeObjectForKey:(NSString *)key completion:(PINRemoteImageCachingObjectBlock)completion -{ - if (completion) { - __weak typeof(self) weakSelf = self; - [self removeObjectForKeyAsync:key completion:^(id _Nonnull cache, NSString * _Nonnull key, id _Nullable object) { - typeof(self) strongSelf = weakSelf; - completion(strongSelf, key, object); - }]; - } else { - [self removeObjectForKeyAsync:key completion:nil]; - } -} - -- (BOOL)diskCacheIsTTLCache -{ - return self.diskCache.isTTLCache; -} - -- (BOOL)memoryCacheIsTTLCache -{ - return self.memoryCache.isTTLCache; -} - -@end - -@implementation PINRemoteImageManager (PINCache) - -- (PINCache *)pinCache -{ - static BOOL isCachePINCache = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - isCachePINCache = [self.cache isKindOfClass:[PINCache class]]; - }); - if (isCachePINCache) { - return (PINCache *)self.cache; - } - return nil; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.h b/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.h deleted file mode 100644 index 0b43e7bf..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// PINDisplayLink.h -// Pods -// -// Created by Garrett Moon on 4/23/18. -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#define PINDisplayLink CADisplayLink -#elif PIN_TARGET_MAC -@interface PINDisplayLink : NSObject - -+ (PINDisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel; -- (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode; -- (void)removeFromRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode; - -@property(getter=isPaused, nonatomic) BOOL paused; -@property(nonatomic) NSInteger frameInterval; - -@end -#endif diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.m b/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.m deleted file mode 100644 index 8235265f..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINDisplayLink.m +++ /dev/null @@ -1,133 +0,0 @@ -// -// PINDisplayLink.m -// Pods -// -// Created by Garrett Moon on 4/23/18. -// - -#import "PINDisplayLink.h" - -#if PIN_TARGET_MAC - -#if SWIFT_PACKAGE -@import CoreVideo.CVDisplayLink; -#else -#import -#endif - -@interface PINDisplayLink () - -@property (nonatomic, readonly) id target; -@property (nonatomic, readonly) SEL selector; -@property (nonatomic, readonly) NSRunLoop *runloop; -@property (nonatomic, readonly) NSRunLoopMode mode; - -- (void)displayLinkFired; - -@end - -static CVReturn displayLinkFired (CVDisplayLinkRef displayLink, - const CVTimeStamp *inNow, - const CVTimeStamp *inOutputTime, - CVOptionFlags flagsIn, - CVOptionFlags *flagsOut, - void *displayLinkContext) -{ - PINDisplayLink *link = (__bridge PINDisplayLink *)displayLinkContext; - [link displayLinkFired]; - return kCVReturnSuccess; -} - -@implementation PINDisplayLink -{ - CVDisplayLinkRef _displayLinkRef; - - BOOL _paused; - NSInteger _frameInterval; -} - -+ (PINDisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel -{ - return [[PINDisplayLink alloc] initWithTarget:target selector:sel]; -} - -- (PINDisplayLink *)initWithTarget:(id)target selector:(SEL)sel -{ - if (self = [super init]) { - _target = target; - _selector = sel; - CVDisplayLinkCreateWithActiveCGDisplays(&_displayLinkRef); - CVDisplayLinkSetOutputCallback(_displayLinkRef, &displayLinkFired, (__bridge void * _Nullable)(self)); - } - return self; -} - -- (void)dealloc -{ - if (_displayLinkRef) { - CVDisplayLinkRelease(_displayLinkRef); - } -} - -- (void)displayLinkFired -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [self.runloop performSelector:self.selector target:self.target argument:self order:NSUIntegerMax modes:@[self.mode]]; - }); -} - -- (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode -{ - PINAssertMain(); - NSAssert(runloop && mode, @"Must set a runloop and a mode."); - _runloop = runloop; - _mode = mode; - if (_paused == NO) { - CVDisplayLinkStart(_displayLinkRef); - } -} - -- (void)removeFromRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode -{ - _runloop = nil; - _mode = nil; - if (_paused == NO) { - CVDisplayLinkStop(_displayLinkRef); - } -} - -- (BOOL)isPaused -{ - PINAssertMain(); - return _paused; -} - -- (void)setPaused:(BOOL)paused -{ - PINAssertMain(); - if (_paused == paused) { - return; - } - - _paused = paused; - if (paused) { - CVDisplayLinkStop(_displayLinkRef); - } else { - CVDisplayLinkStart(_displayLinkRef); - } -} - -- (NSInteger)frameInterval -{ - PINAssertMain(); - return _frameInterval; -} - -- (void)setFrameInterval:(NSInteger)frameInterval -{ - PINAssertMain(); - _frameInterval = frameInterval; -} - -@end -#endif diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINProgressiveImage.m b/Example/Pods/PINRemoteImage/Source/Classes/PINProgressiveImage.m deleted file mode 100644 index 8d530b98..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINProgressiveImage.m +++ /dev/null @@ -1,464 +0,0 @@ -// -// PINProgressiveImage.m -// Pods -// -// Created by Garrett Moon on 2/9/15. -// -// - -#import "PINProgressiveImage.h" - -#import -#import - -#import "PINRemoteImage.h" -#import "PINImage+DecodedImage.h" -#import "PINRemoteImageDownloadTask.h" -#import "PINSpeedRecorder.h" - -@interface PINProgressiveImage () - -@property (nonatomic, strong) NSURLSessionDataTask *dataTask; -@property (nonatomic, strong) NSMutableData *mutableData; -@property (nonatomic, assign) int64_t expectedNumberOfBytes; -@property (nonatomic, assign) CGImageSourceRef imageSource; -@property (nonatomic, assign) CGSize size; -@property (nonatomic, assign) BOOL isProgressiveJPEG; -@property (nonatomic, assign) NSUInteger currentThreshold; -@property (nonatomic, assign) NSUInteger startingBytes; -@property (nonatomic, assign) NSUInteger scannedByte; -@property (nonatomic, assign) NSInteger sosCount; -@property (nonatomic, strong) PINRemoteLock *lock; -#if DEBUG -@property (nonatomic, assign) CFTimeInterval scanTime; -#endif - -@end - -@implementation PINProgressiveImage - -@synthesize progressThresholds = _progressThresholds; -@synthesize estimatedRemainingTimeThreshold = _estimatedRemainingTimeThreshold; - -- (nonnull instancetype)initWithDataTask:(nonnull NSURLSessionDataTask *)dataTask -{ - if (self = [super init]) { - self.lock = [[PINRemoteLock alloc] initWithName:@"PINProgressiveImage"]; - - _dataTask = dataTask; - _imageSource = CGImageSourceCreateIncremental(NULL);; - self.size = CGSizeZero; - self.isProgressiveJPEG = NO; - self.currentThreshold = 0; - self.progressThresholds = @[@0.00, @0.35, @0.65]; - self.estimatedRemainingTimeThreshold = -1; - self.sosCount = 0; - self.scannedByte = 0; -#if DEBUG - self.scanTime = 0; -#endif - } - return self; -} - -- (void)dealloc -{ - [self.lock lock]; - if (self.imageSource) { - CFRelease(_imageSource); - } - [self.lock unlock]; -} - -#pragma mark - public - -- (void)setProgressThresholds:(NSArray *)progressThresholds -{ - // There's no reason to set an empty progress thresholds array, instead don't use the progressive feature - if (progressThresholds.count > 0) { - [self.lock lock]; - _progressThresholds = [progressThresholds copy]; - [self.lock unlock]; - } -} - -- (NSArray *)progressThresholds -{ - [self.lock lock]; - NSArray *progressThresholds = _progressThresholds; - [self.lock unlock]; - return progressThresholds; -} - -- (void)setEstimatedRemainingTimeThreshold:(CFTimeInterval)estimatedRemainingTimeThreshold -{ - [self.lock lock]; - _estimatedRemainingTimeThreshold = estimatedRemainingTimeThreshold; - [self.lock unlock]; -} - -- (CFTimeInterval)estimatedRemainingTimeThreshold -{ - [self.lock lock]; - CFTimeInterval estimatedRemainingTimeThreshold = _estimatedRemainingTimeThreshold; - [self.lock unlock]; - return estimatedRemainingTimeThreshold; -} - -- (CFTimeInterval)estimatedRemainingTime -{ - __block CFTimeInterval estimatedRemainingTime; - [self.lock lockWithBlock:^{ - estimatedRemainingTime = [self l_estimatedRemainingTime]; - }]; - return estimatedRemainingTime; -} - -- (CFTimeInterval)l_estimatedRemainingTime -{ - if (_dataTask.countOfBytesExpectedToReceive == NSURLSessionTransferSizeUnknown) { - return MAXFLOAT; - } - NSUInteger remainingBytes = (NSUInteger)_dataTask.countOfBytesExpectedToReceive - (NSUInteger)_dataTask.countOfBytesReceived; - if (remainingBytes == 0) { - return 0; - } - - float bytesPerSecond = [[PINSpeedRecorder sharedRecorder] weightedAdjustedBytesPerSecondForHost:[_dataTask.currentRequest.URL host]]; - if (bytesPerSecond == -1) { - return MAXFLOAT; - } - return remainingBytes / bytesPerSecond; -} - -- (void)updateProgressiveImageWithData:(nonnull NSData *)data expectedNumberOfBytes:(int64_t)expectedNumberOfBytes isResume:(BOOL)isResume -{ - [self.lock lock]; - if (isResume) { - NSAssert(self.mutableData == nil, @"If we're resuming, data shouldn't be setup yet."); - self.startingBytes = data.length; - } - - if (self.mutableData == nil) { - NSUInteger bytesToAlloc = 0; - if (expectedNumberOfBytes > 0) { - bytesToAlloc = (NSUInteger)expectedNumberOfBytes; - } - self.mutableData = [[NSMutableData alloc] initWithCapacity:bytesToAlloc]; - self.expectedNumberOfBytes = expectedNumberOfBytes; - } - [self.mutableData appendData:data]; - - while ([self l_hasCompletedFirstScan] == NO && self.scannedByte < self.mutableData.length) { - #if DEBUG - CFTimeInterval start = CACurrentMediaTime(); - #endif - NSUInteger startByte = self.scannedByte; - if (startByte > 0) { - startByte--; - } - if ([self l_scanForSOSinData:self.mutableData startByte:startByte scannedByte:&_scannedByte]) { - self.sosCount++; - } - #if DEBUG - CFTimeInterval total = CACurrentMediaTime() - start; - self.scanTime += total; - #endif - } - - if (self.imageSource) { - CGImageSourceUpdateData(self.imageSource, (CFDataRef)self.mutableData, NO); - } - [self.lock unlock]; -} - -- (PINImage *)currentImageBlurred:(BOOL)blurred maxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize renderedImageQuality:(out CGFloat *)renderedImageQuality -{ - [self.lock lock]; - if (self.imageSource == nil) { - [self.lock unlock]; - return nil; - } - - if (self.currentThreshold == _progressThresholds.count) { - [self.lock unlock]; - return nil; - } - - if (_estimatedRemainingTimeThreshold > 0 && [self l_estimatedRemainingTime] < _estimatedRemainingTimeThreshold) { - [self.lock unlock]; - return nil; - } - - if ([self l_hasCompletedFirstScan] == NO) { - [self.lock unlock]; - return nil; - } - - #if DEBUG - if (self.scanTime > 0) { - PINLog(@"scan time: %f", self.scanTime); - self.scanTime = 0; - } - #endif - - PINImage *currentImage = nil; - - //Size information comes after JFIF so jpeg properties should be available at or before size? - if (self.size.width <= 0 || self.size.height <= 0) { - //attempt to get size info - NSDictionary *imageProperties = (NSDictionary *)CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(self.imageSource, 0, NULL)); - CGSize size = self.size; - if (size.width <= 0 && imageProperties[(NSString *)kCGImagePropertyPixelWidth]) { - size.width = [imageProperties[(NSString *)kCGImagePropertyPixelWidth] floatValue]; - } - - if (size.height <= 0 && imageProperties[(NSString *)kCGImagePropertyPixelHeight]) { - size.height = [imageProperties[(NSString *)kCGImagePropertyPixelHeight] floatValue]; - } - - self.size = size; - - NSDictionary *jpegProperties = imageProperties[(NSString *)kCGImagePropertyJFIFDictionary]; - NSNumber *isProgressive = jpegProperties[(NSString *)kCGImagePropertyJFIFIsProgressive]; - self.isProgressiveJPEG = jpegProperties && [isProgressive boolValue]; - } - - if (self.size.width > maxProgressiveRenderSize.width || self.size.height > maxProgressiveRenderSize.height) { - [self.lock unlock]; - return nil; - } - - float progress = 0; - if (self.expectedNumberOfBytes > 0) { - progress = (float)self.mutableData.length / (float)self.expectedNumberOfBytes; - } - - //Don't bother if we're basically done - if (progress >= 0.99) { - [self.lock unlock]; - return nil; - } - - if (self.isProgressiveJPEG && self.size.width > 0 && self.size.height > 0 && progress > [_progressThresholds[self.currentThreshold] floatValue]) { - while (self.currentThreshold < _progressThresholds.count && progress > [_progressThresholds[self.currentThreshold] floatValue]) { - self.currentThreshold++; - } - PINLog(@"Generating preview image"); - CGImageRef image = CGImageSourceCreateImageAtIndex(self.imageSource, 0, NULL); - if (image) { - if (blurred) { - currentImage = [self l_postProcessImage:[PINImage imageWithCGImage:image] withProgress:progress]; - } else { - currentImage = [PINImage imageWithCGImage:image]; - } - CGImageRelease(image); - if (renderedImageQuality) { - *renderedImageQuality = progress; - } - } - } - - [self.lock unlock]; - return currentImage; -} - -- (NSData *)data -{ - [self.lock lock]; - NSData *data = [self.mutableData copy]; - [self.lock unlock]; - return data; -} - -#pragma mark - private - -- (BOOL)l_scanForSOSinData:(NSData *)data startByte:(NSUInteger)startByte scannedByte:(NSUInteger *)scannedByte -{ - //check if we have a complete scan - Byte scanMarker[2]; - //SOS marker - scanMarker[0] = 0xFF; - scanMarker[1] = 0xDA; - - //scan one byte back in case we only got half the SOS on the last data append - NSRange scanRange; - scanRange.location = startByte; - scanRange.length = data.length - scanRange.location; - NSRange sosRange = [data rangeOfData:[NSData dataWithBytes:scanMarker length:2] options:0 range:scanRange]; - if (sosRange.location != NSNotFound) { - if (scannedByte) { - *scannedByte = NSMaxRange(sosRange); - } - return YES; - } - if (scannedByte) { - *scannedByte = NSMaxRange(scanRange); - } - return NO; -} - -- (BOOL)l_hasCompletedFirstScan -{ - return self.sosCount >= 2; -} - -//Heavily cribbed from https://developer.apple.com/library/ios/samplecode/UIImageEffects/Listings/UIImageEffects_UIImageEffects_m.html#//apple_ref/doc/uid/DTS40013396-UIImageEffects_UIImageEffects_m-DontLinkElementID_9 -- (PINImage *)l_postProcessImage:(PINImage *)inputImage withProgress:(float)progress -{ - PINImage *outputImage = nil; - CGImageRef inputImageRef = CGImageRetain(inputImage.CGImage); - if (inputImageRef == nil) { - return nil; - } - - CGSize inputSize = inputImage.size; - if (inputSize.width < 1 || - inputSize.height < 1) { - CGImageRelease(inputImageRef); - return nil; - } - -#if PIN_TARGET_IOS - CGFloat imageScale = inputImage.scale; -#elif PIN_TARGET_MAC - // TODO: What scale factor should be used here? - CGFloat imageScale = [[NSScreen mainScreen] backingScaleFactor]; -#endif - - CGFloat radius = (inputImage.size.width / 25.0) * MAX(0, 1.0 - progress); - radius *= imageScale; - - //we'll round the radius to a whole number below anyway, - if (radius < FLT_EPSILON) { - CGImageRelease(inputImageRef); - return inputImage; - } - - CGContextRef ctx; -#if PIN_TARGET_IOS - UIGraphicsBeginImageContextWithOptions(inputSize, YES, imageScale); - ctx = UIGraphicsGetCurrentContext(); -#elif PIN_TARGET_MAC - ctx = CGBitmapContextCreate(0, inputSize.width, inputSize.height, 8, 0, [NSColorSpace genericRGBColorSpace].CGColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little); -#endif - - if (ctx) { -#if PIN_TARGET_IOS - CGContextScaleCTM(ctx, 1.0, -1.0); - CGContextTranslateCTM(ctx, 0, -inputSize.height); -#endif - - vImage_Buffer effectInBuffer; - vImage_Buffer scratchBuffer; - - vImage_Buffer *inputBuffer; - vImage_Buffer *outputBuffer; - - vImage_CGImageFormat format = { - .bitsPerComponent = 8, - .bitsPerPixel = 32, - .colorSpace = NULL, - // (kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little) - // requests a BGRA buffer. - .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little, - .version = 0, - .decode = NULL, - .renderingIntent = kCGRenderingIntentDefault - }; - - vImage_Error e = vImageBuffer_InitWithCGImage(&effectInBuffer, &format, NULL, inputImage.CGImage, kvImagePrintDiagnosticsToConsole); - if (e == kvImageNoError) - { - e = vImageBuffer_Init(&scratchBuffer, effectInBuffer.height, effectInBuffer.width, format.bitsPerPixel, kvImageNoFlags); - if (e == kvImageNoError) { - inputBuffer = &effectInBuffer; - outputBuffer = &scratchBuffer; - - // A description of how to compute the box kernel width from the Gaussian - // radius (aka standard deviation) appears in the SVG spec: - // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement - // - // For larger values of 's' (s >= 2.0), an approximation can be used: Three - // successive box-blurs build a piece-wise quadratic convolution kernel, which - // approximates the Gaussian kernel to within roughly 3%. - // - // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) - // - // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. - // - if (radius - 2. < __FLT_EPSILON__) - radius = 2.; - uint32_t wholeRadius = floor((radius * 3. * sqrt(2 * M_PI) / 4 + 0.5) / 2); - - wholeRadius |= 1; // force wholeRadius to be odd so that the three box-blur methodology works. - - //calculate the size necessary for vImageBoxConvolve_ARGB8888, this does not actually do any operations. - NSInteger tempBufferSize = vImageBoxConvolve_ARGB8888(inputBuffer, outputBuffer, NULL, 0, 0, wholeRadius, wholeRadius, NULL, kvImageGetTempBufferSize | kvImageEdgeExtend); - void *tempBuffer = malloc(tempBufferSize); - - if (tempBuffer) { - //errors can be ignored because we've passed in allocated memory - vImageBoxConvolve_ARGB8888(inputBuffer, outputBuffer, tempBuffer, 0, 0, wholeRadius, wholeRadius, NULL, kvImageEdgeExtend); - vImageBoxConvolve_ARGB8888(outputBuffer, inputBuffer, tempBuffer, 0, 0, wholeRadius, wholeRadius, NULL, kvImageEdgeExtend); - vImageBoxConvolve_ARGB8888(inputBuffer, outputBuffer, tempBuffer, 0, 0, wholeRadius, wholeRadius, NULL, kvImageEdgeExtend); - - free(tempBuffer); - - //switch input and output - vImage_Buffer *temp = inputBuffer; - inputBuffer = outputBuffer; - outputBuffer = temp; - - CGImageRef effectCGImage = vImageCreateCGImageFromBuffer(inputBuffer, &format, &cleanupBuffer, NULL, kvImageNoAllocate, NULL); - if (effectCGImage == NULL) { - //if creating the cgimage failed, the cleanup buffer on input buffer will not be called, we must dealloc ourselves - free(inputBuffer->data); - } else { - // draw effect image - CGContextSaveGState(ctx); - CGContextDrawImage(ctx, CGRectMake(0, 0, inputSize.width, inputSize.height), effectCGImage); - CGContextRestoreGState(ctx); - CGImageRelease(effectCGImage); - } - - // Cleanup - free(outputBuffer->data); -#if PIN_TARGET_IOS - outputImage = UIGraphicsGetImageFromCurrentImageContext(); -#elif PIN_TARGET_MAC - CGImageRef outputImageRef = CGBitmapContextCreateImage(ctx); - outputImage = [[NSImage alloc] initWithCGImage:outputImageRef size:inputSize]; - CFRelease(outputImageRef); -#endif - - } - } else { - if (scratchBuffer.data) { - free(scratchBuffer.data); - } - free(effectInBuffer.data); - } - } else { - if (effectInBuffer.data) { - free(effectInBuffer.data); - } - } - } - -#if PIN_TARGET_IOS - UIGraphicsEndImageContext(); -#endif - - CGImageRelease(inputImageRef); - - return outputImage; -} - -// Helper function to handle deferred cleanup of a buffer. -static void cleanupBuffer(void *userData, void *buf_data) -{ - free(buf_data); -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.h deleted file mode 100644 index c669c3c3..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// PINRemoteImageBasicCache.h -// Pods -// -// Created by Aleksei Shevchenko on 7/28/16. -// -// - -#import -#import "PINRemoteImageCaching.h" - -/** - * Simplistic wrapper based on NSCache. - * - * No data is persisted on disk. The disk cache methods are no-op. - */ -@interface PINRemoteImageBasicCache : NSObject - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.m deleted file mode 100644 index a3953ce8..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageBasicCache.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// PINRemoteImageBasicCache.m -// Pods -// -// Created by Aleksei Shevchenko on 7/28/16. -// -// - -#import "PINRemoteImageBasicCache.h" - -@interface PINRemoteImageBasicCache() -@property (nonatomic, strong) NSCache *cache; -@end - -@implementation PINRemoteImageBasicCache - -- (instancetype)init -{ - self = [super init]; - if (self) { - self.cache = [[NSCache alloc] init]; - } - return self; -} - -//****************************************************************************************************** -// Memory cache methods -//****************************************************************************************************** --(nullable id)objectFromMemoryForKey:(NSString *)key -{ - return [self.cache objectForKey:key]; -} - --(void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost -{ - [self.cache setObject:object forKey:key cost:cost]; -} - -- (void)removeObjectForKeyFromMemory:(NSString *)key -{ - [self.cache removeObjectForKey:key]; -} - -//****************************************************************************************************** -// Disk cache methods -//****************************************************************************************************** --(nullable id)objectFromDiskForKey:(NSString *)key -{ - return nil; -} - --(void)objectFromDiskForKey:(NSString *)key completion:(PINRemoteImageCachingObjectBlock)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - if (completion) { - typeof(self) strongSelf = weakSelf; - completion(strongSelf, key, nil); - } - }); -} - --(void)setObjectOnDisk:(id)object forKey:(NSString *)key -{ - -} - -//****************************************************************************************************** -// Common methods, should apply to both in-memory and disk storage -//****************************************************************************************************** -- (BOOL)objectExistsForKey:(NSString *)key -{ - return [self.cache objectForKey:key] != nil; -} - -- (void)removeObjectForKey:(NSString *)key -{ - [self.cache removeObjectForKey:key]; -} - -- (void)removeObjectForKey:(NSString *)key completion:(PINRemoteImageCachingObjectBlock)completion -{ - __weak typeof(self) weakSelf = self; - id object = [self.cache objectForKey:key]; - [self.cache removeObjectForKey:key]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - if (completion) { - typeof(self) strongSelf = weakSelf; - completion(strongSelf, key, object); - } - }); -} - -- (void)removeAllObjects -{ - [self.cache removeAllObjects]; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.h deleted file mode 100644 index ebfbfc2d..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// PINRemoteImageCallbacks.h -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import - -#import "PINRemoteImageManager.h" - -@interface PINRemoteImageCallbacks : NSObject - -@property (atomic, strong, nullable) PINRemoteImageManagerImageCompletion completionBlock; -@property (atomic, strong, nullable) PINRemoteImageManagerImageCompletion progressImageBlock; -@property (atomic, strong, nullable) PINRemoteImageManagerProgressDownload progressDownloadBlock; -@property (assign, readonly) CFTimeInterval requestTime; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.m deleted file mode 100644 index f64795bc..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCallbacks.m +++ /dev/null @@ -1,21 +0,0 @@ -// -// PINRemoteImageCallbacks.m -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageCallbacks.h" - -@implementation PINRemoteImageCallbacks - -- (instancetype)init -{ - if (self = [super init]) { - _requestTime = CACurrentMediaTime(); - } - return self; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCategoryManager.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCategoryManager.m deleted file mode 100644 index 54635d6c..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageCategoryManager.m +++ /dev/null @@ -1,268 +0,0 @@ -// -// PINRemoteImageCategory.m -// Pods -// -// Created by Garrett Moon on 11/4/14. -// -// - -#import "PINRemoteImageCategoryManager.h" - -#import - -@implementation PINRemoteImageCategoryManager - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url -{ - [self setImageOnView:view fromURL:url placeholderImage:nil]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - placeholderImage:(PINImage *)placeholderImage -{ - [self setImageOnView:view fromURL:url placeholderImage:placeholderImage completion:nil]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - completion:(PINRemoteImageManagerImageCompletion)completion -{ - [self setImageOnView:view fromURL:url placeholderImage:nil completion:completion]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - placeholderImage:(PINImage *)placeholderImage - completion:(PINRemoteImageManagerImageCompletion)completion -{ - [self setImageOnView:view - fromURLs:url?@[url]:nil - placeholderImage:placeholderImage - processorKey:nil - processor:nil - completion:completion]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor -{ - [self setImageOnView:view - fromURL:url - processorKey:processorKey - processor:processor - completion:nil]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - placeholderImage:(PINImage *)placeholderImage - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor -{ - [self setImageOnView:view - fromURLs:url?@[url]:nil - placeholderImage:placeholderImage - processorKey:processorKey - processor:processor - completion:nil]; -} - -+ (void)setImageOnView:(id )view - fromURL:(NSURL *)url - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor - completion:(PINRemoteImageManagerImageCompletion)completion -{ - [self setImageOnView:view - fromURLs:url?@[url]:nil - placeholderImage:nil - processorKey:processorKey - processor:processor - completion:completion]; -} - -+ (void)setImageOnView:(id )view - fromURLs:(NSArray *)urls -{ - [self setImageOnView:view - fromURLs:urls - placeholderImage:nil]; -} - -+ (void)setImageOnView:(id )view - fromURLs:(NSArray *)urls - placeholderImage:(PINImage *)placeholderImage -{ - [self setImageOnView:view - fromURLs:urls - placeholderImage:placeholderImage - completion:nil]; -} - -+ (void)setImageOnView:(id )view - fromURLs:(NSArray *)urls - placeholderImage:(PINImage *)placeholderImage - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self setImageOnView:view - fromURLs:urls - placeholderImage:placeholderImage - processorKey:nil - processor:nil - completion:completion]; -} - -+ (NSUUID *)downloadImageOperationUUIDOnView:(id )view -{ - return (NSUUID *)objc_getAssociatedObject(view, @selector(downloadImageOperationUUIDOnView:)); -} - -+ (void)setDownloadImageOperationUUID:(NSUUID *)downloadImageOperationUUID onView:(id )view -{ - objc_setAssociatedObject(view, @selector(downloadImageOperationUUIDOnView:), downloadImageOperationUUID, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -+ (BOOL)updateWithProgressOnView:(id )view -{ - return [(NSNumber *)objc_getAssociatedObject(view, @selector(updateWithProgressOnView:)) boolValue]; -} - -+ (void)setUpdateWithProgressOnView:(BOOL)updateWithProgress onView:(id )view -{ - objc_setAssociatedObject(view, @selector(updateWithProgressOnView:), [NSNumber numberWithBool:updateWithProgress], OBJC_ASSOCIATION_RETAIN); -} - -+ (void)cancelImageDownloadOnView:(id )view -{ - if ([self downloadImageOperationUUIDOnView:view]) { - [[PINRemoteImageManager sharedImageManager] cancelTaskWithUUID:[self downloadImageOperationUUIDOnView:view]]; - [self setDownloadImageOperationUUID:nil onView:view]; - } -} - -+ (void)setImageOnView:(id )view - fromURLs:(NSArray *)urls - placeholderImage:(PINImage *)placeholderImage - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor - completion:(PINRemoteImageManagerImageCompletion)completion -{ - if (![NSThread isMainThread]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self setImageOnView:view - fromURLs:urls - placeholderImage:placeholderImage - processorKey:processorKey - processor:processor - completion:completion]; - }); - return; - } - - [self cancelImageDownloadOnView:view]; - - if (placeholderImage) { - [view pin_setPlaceholderWithImage:placeholderImage]; - } - - if (urls == nil || urls.count == 0) { - if (!placeholderImage) { - [view pin_clearImages]; - } - return; - } - - PINRemoteImageManagerDownloadOptions options; - if([view respondsToSelector:@selector(pin_defaultOptions)]) { - options = [view pin_defaultOptions]; - } else { - options = PINRemoteImageManagerDownloadOptionsNone; - } - - if ([view pin_ignoreGIFs]) { - options |= PINRemoteImageManagerDisallowAlternateRepresentations; - } - - PINRemoteImageManagerImageCompletion internalProgress = nil; - if ([self updateWithProgressOnView:view] && processorKey.length <= 0 && processor == nil) { - internalProgress = ^(PINRemoteImageManagerResult *result) - { - void (^mainQueue)(void) = ^{ - //if result.UUID is nil, we returned immediately and want this result - NSUUID *currentUUID = [self downloadImageOperationUUIDOnView:view]; - if (![currentUUID isEqual:result.UUID] && result.UUID != nil) { - return; - } - if (result.image) { - [view pin_updateUIWithRemoteImageManagerResult:result]; - - } - }; - if ([NSThread isMainThread]) { - mainQueue(); - } else { - dispatch_async(dispatch_get_main_queue(), ^{ - mainQueue(); - }); - } - }; - } - - PINRemoteImageManagerImageCompletion internalCompletion = ^(PINRemoteImageManagerResult *result) - { - void (^mainQueue)(void) = ^{ - //if result.UUID is nil, we returned immediately and want this result - NSUUID *currentUUID = [self downloadImageOperationUUIDOnView:view]; - if (![currentUUID isEqual:result.UUID] && result.UUID != nil) { - return; - } - [self setDownloadImageOperationUUID:nil onView:view]; - if (result.error) { - if (completion) { - completion(result); - } - return; - } - - [view pin_updateUIWithRemoteImageManagerResult:result]; - - if (completion) { - completion(result); - } - }; - if ([NSThread isMainThread]) { - mainQueue(); - } else { - dispatch_async(dispatch_get_main_queue(), ^{ - mainQueue(); - }); - } - }; - - NSUUID *downloadImageOperationUUID = nil; - if (urls.count > 1) { - downloadImageOperationUUID = [[PINRemoteImageManager sharedImageManager] downloadImageWithURLs:urls - options:options - progressImage:internalProgress - completion:internalCompletion]; - } else if (processorKey.length > 0 && processor) { - downloadImageOperationUUID = [[PINRemoteImageManager sharedImageManager] downloadImageWithURL:urls[0] - options:options - processorKey:processorKey - processor:processor - completion:internalCompletion]; - } else { - downloadImageOperationUUID = [[PINRemoteImageManager sharedImageManager] downloadImageWithURL:urls[0] - options:options - progressImage:internalProgress - completion:internalCompletion]; - } - - [self setDownloadImageOperationUUID:downloadImageOperationUUID onView:view]; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.h deleted file mode 100644 index 574a2800..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// PINRemoteImageDownloadQueue.h -// PINRemoteImage -// -// Created by Garrett Moon on 3/1/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -#import "PINRemoteImageManager.h" - -@class PINURLSessionManager; - -NS_ASSUME_NONNULL_BEGIN - -typedef void (^PINRemoteImageDownloadCompletion)(NSURLResponse * _Nullable response, NSError *error); - -@interface PINRemoteImageDownloadQueue : NSObject - -@property (atomic, assign) NSUInteger maxNumberOfConcurrentDownloads; - -- (instancetype)init NS_UNAVAILABLE; -+ (PINRemoteImageDownloadQueue *)queueWithMaxConcurrentDownloads:(NSUInteger)maxNumberOfConcurrentDownloads; - -- (NSURLSessionDataTask *)addDownloadWithSessionManager:(PINURLSessionManager *)sessionManager - request:(NSURLRequest *)request - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(PINRemoteImageDownloadCompletion)completionHandler; - -/*** - This prevents a task from being run if it hasn't already started yet. It is the caller's responsibility to cancel - the task if it has already been started. - - @return BOOL Returns YES if the task was in the queue. - */ -- (BOOL)removeDownloadTaskFromQueue:(NSURLSessionDataTask *)downloadTask; - -/* - This sets the tasks priority of execution. It is the caller's responsibility to set the priority on the task itself - for NSURLSessionManager. - */ -- (void)setQueuePriority:(PINRemoteImageManagerPriority)priority forTask:(NSURLSessionDataTask *)downloadTask; - -NS_ASSUME_NONNULL_END - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.m deleted file mode 100644 index 07e70f2e..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadQueue.m +++ /dev/null @@ -1,177 +0,0 @@ -// -// PINRemoteImageDownloadQueue.m -// PINRemoteImage -// -// Created by Garrett Moon on 3/1/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINRemoteImageDownloadQueue.h" - -#import "PINURLSessionManager.h" -#import "PINRemoteLock.h" - -@interface PINRemoteImageDownloadQueue () -{ - PINRemoteLock *_lock; - - NSMutableOrderedSet *_highPriorityQueuedOperations; - NSMutableOrderedSet *_defaultPriorityQueuedOperations; - NSMutableOrderedSet *_lowPriorityQueuedOperations; - NSMutableSet *_runningTasks; -} - -@end - -@implementation PINRemoteImageDownloadQueue - -@synthesize maxNumberOfConcurrentDownloads = _maxNumberOfConcurrentDownloads; - -+ (PINRemoteImageDownloadQueue *)queueWithMaxConcurrentDownloads:(NSUInteger)maxNumberOfConcurrentDownloads -{ - return [[PINRemoteImageDownloadQueue alloc] initWithMaxConcurrentDownloads:maxNumberOfConcurrentDownloads]; -} - -- (PINRemoteImageDownloadQueue *)initWithMaxConcurrentDownloads:(NSUInteger)maxNumberOfConcurrentDownloads -{ - if (self = [super init]) { - _maxNumberOfConcurrentDownloads = maxNumberOfConcurrentDownloads; - - _lock = [[PINRemoteLock alloc] initWithName:@"PINRemoteImageDownloadQueue Lock"]; - _highPriorityQueuedOperations = [[NSMutableOrderedSet alloc] init]; - _defaultPriorityQueuedOperations = [[NSMutableOrderedSet alloc] init]; - _lowPriorityQueuedOperations = [[NSMutableOrderedSet alloc] init]; - _runningTasks = [[NSMutableSet alloc] init]; - } - return self; -} - -- (NSUInteger)maxNumberOfConcurrentDownloads -{ - [self lock]; - NSUInteger maxNumberOfConcurrentDownloads = _maxNumberOfConcurrentDownloads; - [self unlock]; - return maxNumberOfConcurrentDownloads; -} - -- (void)setMaxNumberOfConcurrentDownloads:(NSUInteger)maxNumberOfConcurrentDownloads -{ - [self lock]; - _maxNumberOfConcurrentDownloads = maxNumberOfConcurrentDownloads; - [self unlock]; - - [self scheduleDownloadsIfNeeded]; -} - -- (NSURLSessionDataTask *)addDownloadWithSessionManager:(PINURLSessionManager *)sessionManager - request:(NSURLRequest *)request - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(PINRemoteImageDownloadCompletion)completionHandler -{ - NSURLSessionDataTask *dataTask = [sessionManager dataTaskWithRequest:request - priority:priority - completionHandler:^(NSURLSessionTask *task, NSError *error) { - completionHandler(task.response, error); - [self lock]; - [self->_runningTasks removeObject:task]; - [self unlock]; - - [self scheduleDownloadsIfNeeded]; - }]; - - [self setQueuePriority:priority forTask:dataTask addIfNecessary:YES]; - - [self scheduleDownloadsIfNeeded]; - - return dataTask; -} - -- (void)scheduleDownloadsIfNeeded -{ - [self lock]; - while (_runningTasks.count < _maxNumberOfConcurrentDownloads) { - NSMutableOrderedSet *queue = nil; - if (_highPriorityQueuedOperations.count > 0) { - queue = _highPriorityQueuedOperations; - } else if (_defaultPriorityQueuedOperations.count > 0) { - queue = _defaultPriorityQueuedOperations; - } else if (_lowPriorityQueuedOperations.count > 0) { - queue = _lowPriorityQueuedOperations; - } - - if (!queue) { - break; - } - - NSURLSessionDataTask *task = [queue firstObject]; - [queue removeObjectAtIndex:0]; - [task resume]; - - [_runningTasks addObject:task]; - } - [self unlock]; -} - -- (BOOL)removeDownloadTaskFromQueue:(NSURLSessionDataTask *)downloadTask -{ - BOOL containsTask = NO; - [self lock]; - if ([_highPriorityQueuedOperations containsObject:downloadTask]) { - containsTask = YES; - [_highPriorityQueuedOperations removeObject:downloadTask]; - } else if ([_defaultPriorityQueuedOperations containsObject:downloadTask]) { - containsTask = YES; - [_defaultPriorityQueuedOperations removeObject:downloadTask]; - } else if ([_lowPriorityQueuedOperations containsObject:downloadTask]) { - containsTask = YES; - [_lowPriorityQueuedOperations removeObject:downloadTask]; - } - [self unlock]; - return containsTask; -} - -- (void)setQueuePriority:(PINRemoteImageManagerPriority)priority forTask:(NSURLSessionDataTask *)downloadTask -{ - [self setQueuePriority:priority forTask:downloadTask addIfNecessary:NO]; -} - -- (void)setQueuePriority:(PINRemoteImageManagerPriority)priority forTask:(NSURLSessionDataTask *)downloadTask addIfNecessary:(BOOL)addIfNecessary -{ - BOOL containsTask = [self removeDownloadTaskFromQueue:downloadTask]; - - if (containsTask || addIfNecessary) { - NSMutableOrderedSet *queue = nil; - [self lock]; - switch (priority) { - case PINRemoteImageManagerPriorityLow: - queue = _lowPriorityQueuedOperations; - break; - - case PINRemoteImageManagerPriorityDefault: - queue = _defaultPriorityQueuedOperations; - break; - - case PINRemoteImageManagerPriorityHigh: - queue = _highPriorityQueuedOperations; - break; - - default: - NSAssert(NO, @"invalid priority: %tu", priority); - break; - } - [queue addObject:downloadTask]; - [self unlock]; - } -} - -- (void)lock -{ - [_lock lock]; -} - -- (void)unlock -{ - [_lock unlock]; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.h deleted file mode 100644 index bcd434d4..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// PINRemoteImageDownloadTask.h -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#import "PINRemoteImageManager+Private.h" -#import "PINRemoteImageTask.h" -#import "PINProgressiveImage.h" -#import "PINResume.h" - -@interface PINRemoteImageDownloadTask : PINRemoteImageTask - -@property (nonatomic, strong, nullable, readonly) NSURL *URL; -@property (nonatomic, copy, nullable) NSString *ifRange; -@property (nonatomic, copy, readonly, nullable) NSData *data; - -@property (nonatomic, readonly) CFTimeInterval estimatedRemainingTime; - -- (void)scheduleDownloadWithRequest:(nonnull NSURLRequest *)request - resume:(nullable PINResume *)resume - skipRetry:(BOOL)skipRetry - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(nonnull PINRemoteImageManagerDataCompletion)completionHandler; - -- (void)didReceiveData:(nonnull NSData *)data; -- (void)didReceiveResponse:(nonnull NSURLResponse *)response; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.m deleted file mode 100644 index b1b261dc..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageDownloadTask.m +++ /dev/null @@ -1,380 +0,0 @@ -// -// PINRemoteImageDownloadTask.m -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageDownloadTask.h" - -#import "PINRemoteImageTask+Subclassing.h" -#import "PINRemoteImage.h" -#import "PINRemoteImageCallbacks.h" -#import "PINRemoteLock.h" -#import "PINSpeedRecorder.h" - -@interface PINRemoteImageDownloadTask () -{ - PINProgressiveImage *_progressImage; - PINResume *_resume; - id _retryStrategy; -} - -@end - -@implementation PINRemoteImageDownloadTask - -- (instancetype)initWithManager:(PINRemoteImageManager *)manager -{ - if (self = [super initWithManager:manager]) { - _retryStrategy = manager.retryStrategyCreationBlock(); - } - return self; -} - -- (void)callProgressDownload -{ - NSDictionary *callbackBlocks = self.callbackBlocks; - #if PINRemoteImageLogging - NSString *key = self.key; - #endif - - __block int64_t completedBytes; - __block int64_t totalBytes; - - [self.lock lockWithBlock:^{ - completedBytes = self->_progressImage.dataTask.countOfBytesReceived; - totalBytes = self->_progressImage.dataTask.countOfBytesExpectedToReceive; - }]; - - [callbackBlocks enumerateKeysAndObjectsUsingBlock:^(NSUUID *UUID, PINRemoteImageCallbacks *callback, BOOL *stop) { - PINRemoteImageManagerProgressDownload progressDownloadBlock = callback.progressDownloadBlock; - if (progressDownloadBlock != nil) { - PINLog(@"calling progress for UUID: %@ key: %@", UUID, key); - dispatch_async(self.manager.callbackQueue, ^ - { - progressDownloadBlock(completedBytes, totalBytes); - }); - } - }]; -} - -- (void)callProgressImageWithImage:(nonnull PINImage *)image renderedImageQuality:(CGFloat)renderedImageQuality -{ - NSDictionary *callbackBlocks = self.callbackBlocks; -#if PINRemoteImageLogging - NSString *key = self.key; -#endif - - - [callbackBlocks enumerateKeysAndObjectsUsingBlock:^(NSUUID *UUID, PINRemoteImageCallbacks *callback, BOOL *stop) { - PINRemoteImageManagerImageCompletion progressImageBlock = callback.progressImageBlock; - if (progressImageBlock != nil) { - PINLog(@"calling progress for UUID: %@ key: %@", UUID, key); - CFTimeInterval requestTime = callback.requestTime; - - dispatch_async(self.manager.callbackQueue, ^ - { - progressImageBlock([PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:nil - requestLength:CACurrentMediaTime() - requestTime - resultType:PINRemoteImageResultTypeProgress - UUID:UUID - response:nil - error:nil - renderedImageQuality:renderedImageQuality]); - }); - } - }]; -} - -- (BOOL)cancelWithUUID:(NSUUID *)UUID resume:(PINResume **)resume -{ - __block BOOL noMoreCompletions; - __block PINResume *strongResume; - BOOL hasResume = resume != nil; - [self.lock lockWithBlock:^{ - if (hasResume) { - //consider skipping cancellation if there's a request for resume data and the time to start the connection is greater than - //the time remaining to download. - NSTimeInterval timeToFirstByte = [[PINSpeedRecorder sharedRecorder] weightedTimeToFirstByteForHost:self->_progressImage.dataTask.currentRequest.URL.host]; - if (self->_progressImage.estimatedRemainingTime <= timeToFirstByte) { - noMoreCompletions = NO; - return; - } - } - - noMoreCompletions = [super l_cancelWithUUID:UUID]; - - if (noMoreCompletions) { - [self.manager.urlSessionTaskQueue removeDownloadTaskFromQueue:self->_progressImage.dataTask]; - [self->_progressImage.dataTask cancel]; - - if (hasResume && self->_ifRange && self->_progressImage.dataTask.countOfBytesExpectedToReceive > 0 && self->_progressImage.dataTask.countOfBytesExpectedToReceive != NSURLSessionTransferSizeUnknown) { - NSData *progressData = self->_progressImage.data; - if (progressData.length > 0) { - strongResume = [PINResume resumeData:progressData ifRange:self->_ifRange totalBytes:self->_progressImage.dataTask.countOfBytesExpectedToReceive]; - } - } - - PINLog(@"Canceling download of URL: %@, UUID: %@", _progressImage.dataTask.originalRequest.URL, UUID); - } -#if PINRemoteImageLogging - else { - PINLog(@"Decrementing download of URL: %@, UUID: %@", _progressImage.dataTask.originalRequest.URL, UUID); - } -#endif - }]; - - if (hasResume) { - *resume = strongResume; - } - - return noMoreCompletions; -} - -- (void)setPriority:(PINRemoteImageManagerPriority)priority -{ - [super setPriority:priority]; - if (@available(iOS 8.0, macOS 10.10, tvOS 9.0, watchOS 2.0, *)) { - [self.lock lockWithBlock:^{ - NSURLSessionDataTask *dataTask = self->_progressImage.dataTask; - if (dataTask) { - dataTask.priority = dataTaskPriorityWithImageManagerPriority(priority); - [self.manager.urlSessionTaskQueue setQueuePriority:priority forTask:dataTask]; - } - }]; - } -} - -- (NSURL *)URL -{ - __block NSURL *url; - [self.lock lockWithBlock:^{ - url = self->_progressImage.dataTask.originalRequest.URL; - }]; - return url; -} - -- (nonnull PINRemoteImageManagerResult *)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - error:(nullable NSError *)error - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)UUID - response:(nonnull NSURLResponse *)response -{ - __block NSUInteger bytesSavedByResuming; - [self.lock lockWithBlock:^{ - bytesSavedByResuming = self->_resume.resumeData.length; - }]; - return [PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:requestLength - resultType:resultType - UUID:UUID - response:response - error:error - bytesSavedByResuming:bytesSavedByResuming]; -} - -- (void)didReceiveData:(NSData *_Nonnull)data -{ - [self callProgressDownload]; - - __block int64_t expectedNumberOfBytes; - [self.lock lockWithBlock:^{ - expectedNumberOfBytes = self->_progressImage.dataTask.countOfBytesExpectedToReceive; - }]; - - [self updateData:data isResume:NO expectedBytes:expectedNumberOfBytes]; -} - -- (void)updateData:(NSData *)data isResume:(BOOL)isResume expectedBytes:(int64_t)expectedBytes -{ - __block PINProgressiveImage *progressImage; - __block BOOL hasProgressBlocks = NO; - [self.lock lockWithBlock:^{ - progressImage = self->_progressImage; - [[self l_callbackBlocks] enumerateKeysAndObjectsUsingBlock:^(NSUUID *UUID, PINRemoteImageCallbacks *callback, BOOL *stop) { - if (callback.progressImageBlock) { - hasProgressBlocks = YES; - *stop = YES; - } - }]; - }]; - - [progressImage updateProgressiveImageWithData:data expectedNumberOfBytes:expectedBytes isResume:isResume]; - - if (hasProgressBlocks) { - if (PINNSOperationSupportsBlur) { - [self.manager.concurrentOperationQueue scheduleOperation:^{ - CGFloat renderedImageQuality = 1.0; - PINImage *image = [progressImage currentImageBlurred:self.manager.shouldBlurProgressive maxProgressiveRenderSize:self.manager.maxProgressiveRenderSize renderedImageQuality:&renderedImageQuality]; - if (image) { - [self callProgressImageWithImage:image renderedImageQuality:renderedImageQuality]; - } - } withPriority:PINOperationQueuePriorityLow]; - } - } -} - -- (void)didReceiveResponse:(nonnull NSURLResponse *)response -{ - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - - // Got partial data back for a resume - if (httpResponse.statusCode == 206) { - __block PINResume *resume; - [self.lock lockWithBlock:^{ - resume = self->_resume; - }]; - - [self updateData:resume.resumeData isResume:YES expectedBytes:resume.totalBytes]; - } else { - //Check if there's resume data and we didn't get back a 206, get rid of it - [self.lock lockWithBlock:^{ - self->_resume = nil; - }]; - } - - // Check to see if the server supports resume - if ([[httpResponse allHeaderFields][@"Accept-Ranges"] isEqualToString:@"bytes"]) { - NSString *ifRange = nil; - NSString *etag = nil; - - if ((etag = [httpResponse allHeaderFields][@"ETag"])) { - if ([etag hasPrefix:@"W/"] == NO) { - ifRange = etag; - } - } else { - ifRange = [httpResponse allHeaderFields][@"Last-Modified"]; - } - - if (ifRange.length > 0) { - [self.lock lockWithBlock:^{ - self->_ifRange = ifRange; - }]; - } - } - } -} - -- (void)scheduleDownloadWithRequest:(nonnull NSURLRequest *)request - resume:(nullable PINResume *)resume - skipRetry:(BOOL)skipRetry - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(nonnull PINRemoteImageManagerDataCompletion)completionHandler -{ - [self scheduleDownloadWithRequest:request resume:resume skipRetry:skipRetry priority:priority isRetry:NO completionHandler:completionHandler]; -} - -- (void)scheduleDownloadWithRequest:(NSURLRequest *)request - resume:(PINResume *)resume - skipRetry:(BOOL)skipRetry - priority:(PINRemoteImageManagerPriority)priority - isRetry:(BOOL)isRetry - completionHandler:(PINRemoteImageManagerDataCompletion)completionHandler -{ - [self.lock lockWithBlock:^{ - if (self->_progressImage != nil || [self l_callbackBlocks].count == 0 || (isRetry == NO && self->_retryStrategy.numberOfRetries > 0)) { - return; - } - self->_resume = resume; - - NSURLRequest *adjustedRequest = request; - if (self->_resume) { - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - NSMutableDictionary *headers = [[mutableRequest allHTTPHeaderFields] mutableCopy]; - headers[@"If-Range"] = self->_resume.ifRange; - headers[@"Range"] = [NSString stringWithFormat:@"bytes=%tu-", self->_resume.resumeData.length]; - mutableRequest.allHTTPHeaderFields = headers; - adjustedRequest = mutableRequest; - } - - self->_progressImage = [[PINProgressiveImage alloc] initWithDataTask:[self.manager.urlSessionTaskQueue addDownloadWithSessionManager:self.manager.sessionManager - request:adjustedRequest - priority:priority - completionHandler:^(NSURLResponse * _Nonnull response, NSError * _Nonnull remoteError) - { - [self.manager.concurrentOperationQueue scheduleOperation:^{ - NSError *error = remoteError; -#if PINRemoteImageLogging - if (error && error.code != NSURLErrorCancelled) { - PINLog(@"Failed downloading image: %@ with error: %@", request.URL, error); - } else if (error == nil && response.expectedContentLength == 0) { - PINLog(@"image is empty at URL: %@", request.URL); - } else { - PINLog(@"Finished downloading image: %@", request.URL); - } -#endif - - if (error.code != NSURLErrorCancelled) { - NSData *data = self.progressImage.data; - - if (error == nil && data == nil) { - error = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorImageEmpty - userInfo:nil]; - } - - __block BOOL retry = NO; - __block int64_t delay = 0; - [self.lock lockWithBlock:^{ - retry = skipRetry == NO && [self->_retryStrategy shouldRetryWithError:error]; - if (retry) { - // Clear out the existing progress image or else new data from retry will be appended - self->_progressImage = nil; - [self->_retryStrategy incrementRetryCount]; - delay = [self->_retryStrategy nextDelay]; - } - }]; - if (retry) { - PINLog(@"Retrying download of %@ in %lld seconds.", request.URL, delay); - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [self scheduleDownloadWithRequest:request resume:nil skipRetry:skipRetry priority:priority isRetry:YES completionHandler:completionHandler]; - }); - return; - } - - completionHandler(data, response, error); - } - }]; - }]]; - }]; -} - -- (PINProgressiveImage *)progressImage -{ - __block PINProgressiveImage *progressImage = nil; - [self.lock lockWithBlock:^{ - progressImage = self->_progressImage; - }]; - return progressImage; -} - -+ (BOOL)retriableError:(NSError *)remoteImageError -{ - if ([remoteImageError.domain isEqualToString:PINURLErrorDomain]) { - return remoteImageError.code >= 500; - } else if ([remoteImageError.domain isEqualToString:NSURLErrorDomain] && remoteImageError.code == NSURLErrorUnsupportedURL) { - return NO; - } else if ([remoteImageError.domain isEqualToString:PINRemoteImageManagerErrorDomain]) { - return NO; - } - return YES; -} - -- (CFTimeInterval)estimatedRemainingTime -{ - return self.progressImage.estimatedRemainingTime; -} - -- (NSData *)data -{ - return self.progressImage.data; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager+Private.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager+Private.h deleted file mode 100644 index 39550e32..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager+Private.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// PINRemoteImageManager+Private.h -// PINRemoteImage -// -// Created by Garrett Moon on 5/18/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#ifndef PINRemoteImageManager_Private_h -#define PINRemoteImageManager_Private_h - -#import "PINRemoteImageDownloadQueue.h" - -typedef void (^PINRemoteImageManagerDataCompletion)(NSData *data, NSURLResponse *response, NSError *error); - -@interface PINRemoteImageManager (PrivateExtension) - -@property (nonatomic, strong, readonly) dispatch_queue_t callbackQueue; -@property (nonatomic, strong, readonly) PINOperationQueue *concurrentOperationQueue; -@property (nonatomic, strong, readonly) PINRemoteImageDownloadQueue *urlSessionTaskQueue; -@property (nonatomic, strong, readonly) PINURLSessionManager *sessionManager; - -@property (nonatomic, readonly) NSArray *progressThresholds; -@property (nonatomic, readonly) NSTimeInterval estimatedRemainingTimeThreshold; -@property (nonatomic, readonly) BOOL shouldBlurProgressive; -@property (nonatomic, readonly) CGSize maxProgressiveRenderSize; - -@end - -#endif /* PINRemoteImageManager_Private_h */ diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager.m deleted file mode 100644 index 5ef8ac17..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManager.m +++ /dev/null @@ -1,1651 +0,0 @@ -// -// PINRemoteImageManager.m -// Pods -// -// Created by Garrett Moon on 8/17/14. -// -// - -#import "PINRemoteImageManager.h" - -#import - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#import - -#import "PINAlternateRepresentationProvider.h" -#import "PINRemoteImage.h" -#import "PINRemoteImageManagerConfiguration.h" -#import "PINRemoteLock.h" -#import "PINProgressiveImage.h" -#import "PINRemoteImageCallbacks.h" -#import "PINRemoteImageTask.h" -#import "PINRemoteImageProcessorTask.h" -#import "PINRemoteImageDownloadTask.h" -#import "PINResume.h" -#import "PINRemoteImageMemoryContainer.h" -#import "PINRemoteImageCaching.h" -#import "PINRequestRetryStrategy.h" -#import "PINRemoteImageDownloadQueue.h" -#import "PINRequestRetryStrategy.h" -#import "PINSpeedRecorder.h" -#import "PINURLSessionManager.h" - -#import "NSData+ImageDetectors.h" -#import "PINImage+DecodedImage.h" -#import "PINImage+ScaledImage.h" -#import "PINRemoteImageManager+Private.h" -#import "NSHTTPURLResponse+MaxAge.h" - -#if USE_PINCACHE -#import "PINCache+PINRemoteImageCaching.h" -#else -#import "PINRemoteImageBasicCache.h" -#endif - - -#define PINRemoteImageManagerDefaultTimeout 30.0 -//A limit of 200 characters is chosen because PINDiskCache -//may expand the length by encoding certain characters -#define PINRemoteImageManagerCacheKeyMaxLength 200 - -PINOperationQueuePriority operationPriorityWithImageManagerPriority(PINRemoteImageManagerPriority priority); -PINOperationQueuePriority operationPriorityWithImageManagerPriority(PINRemoteImageManagerPriority priority) { - switch (priority) { - case PINRemoteImageManagerPriorityLow: - return PINOperationQueuePriorityLow; - break; - - case PINRemoteImageManagerPriorityDefault: - return PINOperationQueuePriorityDefault; - break; - - case PINRemoteImageManagerPriorityHigh: - return PINOperationQueuePriorityHigh; - break; - } -} - -float dataTaskPriorityWithImageManagerPriority(PINRemoteImageManagerPriority priority) { - switch (priority) { - case PINRemoteImageManagerPriorityLow: - return 0.0; - break; - - case PINRemoteImageManagerPriorityDefault: - return 0.5; - break; - - case PINRemoteImageManagerPriorityHigh: - return 1.0; - break; - } -} - -// Reference: https://github.com/TextureGroup/Texture/blob/5dd5611/Source/Private/ASInternalHelpers.m#L60 -BOOL PINRemoteImageManagerSubclassOverridesSelector(Class subclass, SEL selector) -{ - Class superclass = [PINRemoteImageManager class]; - if (superclass == subclass) return NO; // Even if the class implements the selector, it doesn't override itself. - Method superclassMethod = class_getInstanceMethod(superclass, selector); - Method subclassMethod = class_getInstanceMethod(subclass, selector); - return (superclassMethod != subclassMethod); -} - -NSErrorDomain const PINRemoteImageManagerErrorDomain = @"PINRemoteImageManagerErrorDomain"; -NSString * const PINRemoteImageWeakTaskKey = @"PINRemoteImageWeakTaskKey"; -NSString * const PINRemoteImageCacheKeyResumePrefix = @"R-"; -typedef void (^PINRemoteImageManagerDataCompletion)(NSData *data, NSURLResponse *response, NSError *error); - -@interface PINRemoteImageWeakTask : NSObject - -@property (nonatomic, readonly, weak) PINRemoteImageTask *task; - -- (instancetype)initWithTask:(PINRemoteImageTask *)task; - -@end - -@implementation PINRemoteImageWeakTask - -- (instancetype)initWithTask:(PINRemoteImageTask *)task -{ - if (self = [super init]) { - _task = task; - } - return self; -} - -@end - -@interface PINRemoteImageManager () -{ - dispatch_queue_t _callbackQueue; - PINRemoteLock *_lock; - PINOperationQueue *_concurrentOperationQueue; - PINRemoteImageDownloadQueue *_urlSessionTaskQueue; - - // Necessary to have a strong reference to _defaultAlternateRepresentationProvider because _alternateRepProvider is __weak - PINAlternateRepresentationProvider *_defaultAlternateRepresentationProvider; - __weak PINAlternateRepresentationProvider *_alternateRepProvider; - NSURLSessionConfiguration *_sessionConfiguration; - -} - -@property (nonatomic, strong) id cache; -@property (nonatomic, strong) PINURLSessionManager *sessionManager; -@property (nonatomic, strong) NSMutableDictionary *tasks; -@property (nonatomic, strong) NSHashTable *canceledTasks; -@property (nonatomic, strong) NSMapTable *UUIDToTask; -@property (nonatomic, strong) NSArray *progressThresholds; -@property (nonatomic, assign) BOOL shouldBlurProgressive; -@property (nonatomic, assign) CGSize maxProgressiveRenderSize; -@property (nonatomic, assign) NSTimeInterval estimatedRemainingTimeThreshold; -@property (nonatomic, strong) dispatch_queue_t callbackQueue; -@property (nonatomic, strong) PINOperationQueue *concurrentOperationQueue; -@property (nonatomic, strong) PINRemoteImageDownloadQueue *urlSessionTaskQueue; -@property (nonatomic, assign) float highQualityBPSThreshold; -@property (nonatomic, assign) float lowQualityBPSThreshold; -@property (nonatomic, assign) BOOL shouldUpgradeLowQualityImages; -@property (nonatomic, strong) PINRemoteImageManagerMetrics metricsCallback API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); -@property (nonatomic, copy) PINRemoteImageManagerAuthenticationChallenge authenticationChallengeHandler; -@property (nonatomic, copy) id (^retryStrategyCreationBlock)(void); -@property (nonatomic, copy) PINRemoteImageManagerRequestConfigurationHandler requestConfigurationHandler; -@property (nonatomic, strong) NSMutableDictionary *httpHeaderFields; -@property (nonatomic, readonly) BOOL diskCacheTTLIsEnabled; -@property (nonatomic, readonly) BOOL memoryCacheTTLIsEnabled; -#if DEBUG -@property (nonatomic, assign) NSUInteger totalDownloads; -#endif - -@end - -#pragma mark PINRemoteImageManager - -@implementation PINRemoteImageManager - -static PINRemoteImageManager *sharedImageManager = nil; -static dispatch_once_t sharedDispatchToken; - -+ (instancetype)sharedImageManager -{ - dispatch_once(&sharedDispatchToken, ^{ - sharedImageManager = [[[self class] alloc] init]; - }); - return sharedImageManager; -} - -+ (void)setSharedImageManagerWithConfiguration:(NSURLSessionConfiguration *)configuration -{ - NSAssert(sharedImageManager == nil, @"sharedImageManager singleton is already configured"); - - dispatch_once(&sharedDispatchToken, ^{ - sharedImageManager = [[[self class] alloc] initWithSessionConfiguration:configuration]; - }); -} - -- (instancetype)init -{ - return [self initWithSessionConfiguration:nil]; -} - -- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)sessionConfiguration -{ - return [self initWithSessionConfiguration:sessionConfiguration alternativeRepresentationProvider:nil]; -} - -- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)sessionConfiguration alternativeRepresentationProvider:(id )alternateRepProvider -{ - return [self initWithSessionConfiguration:sessionConfiguration alternativeRepresentationProvider:alternateRepProvider imageCache:nil managerConfiguration:nil]; -} - -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration - alternativeRepresentationProvider:(nullable id )alternateRepDelegate - imageCache:(nullable id)imageCache { - return [self initWithSessionConfiguration:sessionConfiguration alternativeRepresentationProvider:alternateRepDelegate imageCache:imageCache managerConfiguration:nil]; -} - --(nonnull instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)sessionConfiguration - alternativeRepresentationProvider:(id)alternateRepProvider - imageCache:(id)imageCache - managerConfiguration:(nullable PINRemoteImageManagerConfiguration *)managerConfiguration -{ - if (self = [super init]) { - PINRemoteImageManagerConfiguration *configuration = managerConfiguration; - if (!configuration) { - configuration = [[PINRemoteImageManagerConfiguration alloc] init]; - } - - if (imageCache) { - self.cache = imageCache; - } else if (PINRemoteImageManagerSubclassOverridesSelector([self class], @selector(defaultImageCache))) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.cache = [self defaultImageCache]; -#pragma clang diagnostic pop - } else { - self.cache = [[self class] defaultImageCache]; - } - - if ([self.cache respondsToSelector:@selector(setObjectOnDisk:forKey:withAgeLimit:)] && - [self.cache respondsToSelector:@selector(setObjectInMemory:forKey:withCost:withAgeLimit:)] && - [self.cache respondsToSelector:@selector(diskCacheIsTTLCache)] && - [self.cache respondsToSelector:@selector(memoryCacheIsTTLCache)]) { - _diskCacheTTLIsEnabled = [self.cache diskCacheIsTTLCache]; - _memoryCacheTTLIsEnabled = [self.cache memoryCacheIsTTLCache]; - } - - _sessionConfiguration = [sessionConfiguration copy]; - if (!_sessionConfiguration) { - _sessionConfiguration = [NSURLSessionConfiguration ephemeralSessionConfiguration]; - _sessionConfiguration.timeoutIntervalForRequest = PINRemoteImageManagerDefaultTimeout; - _sessionConfiguration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData; - _sessionConfiguration.URLCache = nil; - _sessionConfiguration.HTTPMaximumConnectionsPerHost = PINRemoteImageHTTPMaximumConnectionsPerHost; - } - - _callbackQueue = dispatch_queue_create("PINRemoteImageManagerCallbackQueue", DISPATCH_QUEUE_CONCURRENT); - _lock = [[PINRemoteLock alloc] initWithName:@"PINRemoteImageManager"]; - - _concurrentOperationQueue = [[PINOperationQueue alloc] initWithMaxConcurrentOperations: configuration.maxConcurrentOperations]; - _urlSessionTaskQueue = [PINRemoteImageDownloadQueue queueWithMaxConcurrentDownloads:configuration.maxConcurrentDownloads]; - - self.sessionManager = [[PINURLSessionManager alloc] initWithSessionConfiguration:_sessionConfiguration]; - self.sessionManager.delegate = self; - - self.estimatedRemainingTimeThreshold = configuration.estimatedRemainingTimeThreshold; - - _highQualityBPSThreshold = configuration.highQualityBPSThreshold; - _lowQualityBPSThreshold = configuration.lowQualityBPSThreshold; - _shouldUpgradeLowQualityImages = configuration.shouldUpgradeLowQualityImages; - _shouldBlurProgressive = configuration.shouldBlurProgressive; - _maxProgressiveRenderSize = configuration.maxProgressiveRenderSize; - self.tasks = [[NSMutableDictionary alloc] init]; - self.canceledTasks = [[NSHashTable alloc] initWithOptions:NSHashTableWeakMemory capacity:5]; - self.UUIDToTask = [NSMapTable weakToWeakObjectsMapTable]; - - if (alternateRepProvider == nil) { - _defaultAlternateRepresentationProvider = [[PINAlternateRepresentationProvider alloc] init]; - alternateRepProvider = _defaultAlternateRepresentationProvider; - } - _alternateRepProvider = alternateRepProvider; - __weak typeof(self) weakSelf = self; - _retryStrategyCreationBlock = ^id{ - return [weakSelf defaultRetryStrategy]; - }; - _httpHeaderFields = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (id)defaultRetryStrategy { - return [[PINRequestExponentialRetryStrategy alloc] initWithRetryMaxCount:3 delayBase:4]; -} - -- (void)dealloc -{ - [self.sessionManager invalidateSessionAndCancelTasks]; -} - -- (id)defaultImageCache { - return [PINRemoteImageManager defaultImageCache]; -} - -+ (id)defaultImageCache { - return [PINRemoteImageManager defaultImageCacheEnablingTtl:NO]; -} - -+ (id)defaultImageTtlCache { - return [PINRemoteImageManager defaultImageCacheEnablingTtl:YES]; -} - -+ (id)defaultImageCacheEnablingTtl:(BOOL)enableTtl -{ -#if USE_PINCACHE - NSString * const kPINRemoteImageDiskCacheName = @"PINRemoteImageManagerCache"; - NSString * const kPINRemoteImageDiskCacheVersionKey = @"kPINRemoteImageDiskCacheVersionKey"; - const NSInteger kPINRemoteImageDiskCacheVersion = 1; - NSUserDefaults *pinDefaults = [[NSUserDefaults alloc] init]; - - NSString *cacheURLRoot = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - - if ([pinDefaults integerForKey:kPINRemoteImageDiskCacheVersionKey] != kPINRemoteImageDiskCacheVersion) { - //remove the old version of the disk cache - NSURL *diskCacheURL = [PINDiskCache cacheURLWithRootPath:cacheURLRoot prefix:PINDiskCachePrefix name:kPINRemoteImageDiskCacheName]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSURL *dstURL = [[[NSURL alloc] initFileURLWithPath:NSTemporaryDirectory()] URLByAppendingPathComponent:kPINRemoteImageDiskCacheName]; - [fileManager moveItemAtURL:diskCacheURL toURL:dstURL error:nil]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - [fileManager removeItemAtURL:dstURL error:nil]; - }); - [pinDefaults setInteger:kPINRemoteImageDiskCacheVersion forKey:kPINRemoteImageDiskCacheVersionKey]; - } - - PINCache *pinCache = [[PINCache alloc] initWithName:kPINRemoteImageDiskCacheName rootPath:cacheURLRoot serializer:^NSData * _Nonnull(id _Nonnull object, NSString * _Nonnull key) { - id obj = (id )object; - if ([key hasPrefix:PINRemoteImageCacheKeyResumePrefix]) { - return [NSKeyedArchiver archivedDataWithRootObject:obj]; - } - return (NSData *)object; - } deserializer:^id _Nonnull(NSData * _Nonnull data, NSString * _Nonnull key) { - if ([key hasPrefix:PINRemoteImageCacheKeyResumePrefix]) { - return [NSKeyedUnarchiver unarchiveObjectWithData:data]; - } - return data; - } keyEncoder:nil keyDecoder:nil ttlCache:enableTtl]; - - return pinCache; -#else - return [[PINRemoteImageBasicCache alloc] init]; -#endif -} - -- (void)lockOnMainThread -{ -#if !DEBUG - NSAssert(NO, @"lockOnMainThread should only be called for testing on debug builds!"); -#endif - [_lock lock]; -} - -- (void)lock -{ - NSAssert([NSThread isMainThread] == NO, @"lock should not be called from the main thread!"); - [_lock lock]; -} - -- (void)unlock -{ - [_lock unlock]; -} - -- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)header { - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.httpHeaderFields[[header copy]] = [value copy]; - [strongSelf unlock]; - }); -} - -- (void)setRequestConfiguration:(PINRemoteImageManagerRequestConfigurationHandler)configurationBlock { - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.requestConfigurationHandler = configurationBlock; - [strongSelf unlock]; - }); -} - -- (void)setAuthenticationChallenge:(PINRemoteImageManagerAuthenticationChallenge)challengeBlock { - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.authenticationChallengeHandler = challengeBlock; - [strongSelf unlock]; - }); -} - -- (void)setMaxNumberOfConcurrentOperations:(NSInteger)maxNumberOfConcurrentOperations completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.concurrentOperationQueue.maxConcurrentOperations = maxNumberOfConcurrentOperations; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setMaxNumberOfConcurrentDownloads:(NSInteger)maxNumberOfConcurrentDownloads completion:(dispatch_block_t)completion -{ - NSAssert(maxNumberOfConcurrentDownloads <= PINRemoteImageHTTPMaximumConnectionsPerHost, @"maxNumberOfConcurrentDownloads must be less than or equal to %d", PINRemoteImageHTTPMaximumConnectionsPerHost); - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.urlSessionTaskQueue.maxNumberOfConcurrentDownloads = maxNumberOfConcurrentDownloads; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setEstimatedRemainingTimeThresholdForProgressiveDownloads:(NSTimeInterval)estimatedRemainingTimeThreshold completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.estimatedRemainingTimeThreshold = estimatedRemainingTimeThreshold; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setProgressThresholds:(NSArray *)progressThresholds completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.progressThresholds = progressThresholds; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setProgressiveRendersShouldBlur:(BOOL)shouldBlur completion:(nullable dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.shouldBlurProgressive = shouldBlur; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setProgressiveRendersMaxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize completion:(nullable dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.maxProgressiveRenderSize = maxProgressiveRenderSize; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setHighQualityBPSThreshold:(float)highQualityBPSThreshold completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.highQualityBPSThreshold = highQualityBPSThreshold; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setLowQualityBPSThreshold:(float)lowQualityBPSThreshold completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.lowQualityBPSThreshold = lowQualityBPSThreshold; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setShouldUpgradeLowQualityImages:(BOOL)shouldUpgradeLowQualityImages completion:(dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf lock]; - strongSelf.shouldUpgradeLowQualityImages = shouldUpgradeLowQualityImages; - [strongSelf unlock]; - if (completion) { - completion(); - } - }); -} - -- (void)setMetricsCallback:(nullable PINRemoteImageManagerMetrics)metricsCallback completion:(nullable dispatch_block_t)completion -{ - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - typeof(self) strongSelf = weakSelf; - [self lock]; - strongSelf.metricsCallback = metricsCallback; - [self unlock]; - if (completion) { - completion(); - } - }); -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:PINRemoteImageManagerDownloadOptionsNone - completion:completion]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - progressImage:nil - completion:completion]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - progressImage:progressImage - progressDownload:nil - completion:completion]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressDownload:(PINRemoteImageManagerProgressDownload)progressDownload - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - progressImage:nil - progressDownload:progressDownload - completion:completion]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(PINRemoteImageManagerProgressDownload)progressDownload - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - priority:PINRemoteImageManagerPriorityDefault - progressImage:progressImage - progressDownload:progressDownload - completion:completion]; -} - -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - priority:(PINRemoteImageManagerPriority)priority - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; -{ - return [self downloadImageWithURL:url - options:options - priority:priority - processorKey:nil - processor:nil - progressImage:progressImage - progressDownload:progressDownload - completion:completion - inputUUID:nil]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - priority:PINRemoteImageManagerPriorityDefault - processorKey:processorKey - processor:processor - progressImage:nil - progressDownload:nil - completion:completion - inputUUID:nil]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor - progressDownload:(PINRemoteImageManagerProgressDownload)progressDownload - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURL:url - options:options - priority:PINRemoteImageManagerPriorityDefault - processorKey:processorKey - processor:processor - progressImage:nil - progressDownload:progressDownload - completion:completion - inputUUID:nil]; -} - -- (NSUUID *)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - priority:(PINRemoteImageManagerPriority)priority - processorKey:(NSString *)processorKey - processor:(PINRemoteImageManagerImageProcessor)processor - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(PINRemoteImageManagerProgressDownload)progressDownload - completion:(PINRemoteImageManagerImageCompletion)completion - inputUUID:(NSUUID *)UUID -{ - NSAssert((processor != nil && processorKey.length > 0) || (processor == nil && processorKey == nil), @"processor must not be nil and processorKey length must be greater than zero OR processor must be nil and processorKey must be nil"); - - Class taskClass; - if (processor && processorKey.length > 0) { - taskClass = [PINRemoteImageProcessorTask class]; - } else { - taskClass = [PINRemoteImageDownloadTask class]; - } - - NSString *key = [self cacheKeyForURL:url processorKey:processorKey]; - - if (url == nil) { - [self earlyReturnWithOptions:options url:nil key:key object:nil completion:completion]; - return nil; - } - - NSAssert([url isKindOfClass:[NSURL class]], @"url must be of type NSURL, if it's an NSString, we'll try to correct"); - if ([url isKindOfClass:[NSString class]]) { - url = [NSURL URLWithString:(NSString *)url]; - } - - if (UUID == nil) { - UUID = [NSUUID UUID]; - } - - if ((options & PINRemoteImageManagerDownloadOptionsIgnoreCache) == 0) { - //Check to see if the image is in memory cache and we're on the main thread. - //If so, special case this to avoid flashing the UI - id object = [self.cache objectFromMemoryForKey:key]; - if (object) { - if ([self earlyReturnWithOptions:options url:url key:key object:object completion:completion]) { - return nil; - } - } - } - - if ([url.scheme isEqualToString:@"data"]) { - NSData *data = [NSData dataWithContentsOfURL:url]; - if (data) { - if ([self earlyReturnWithOptions:options url:url key:key object:data completion:completion]) { - return nil; - } - } - } - - [_concurrentOperationQueue scheduleOperation:^ - { - [self lock]; - //check canceled tasks first - if ([self.canceledTasks containsObject:UUID]) { - PINLog(@"skipping starting %@ because it was canceled.", UUID); - [self unlock]; - return; - } - - PINRemoteImageTask *task = [self.tasks objectForKey:key]; - BOOL taskExisted = NO; - if (task == nil) { - task = [[taskClass alloc] initWithManager:self]; - PINLog(@"Task does not exist creating with key: %@, URL: %@, UUID: %@, task: %p", key, url, UUID, task); - task.key = key; - } else { - taskExisted = YES; - PINLog(@"Task exists, attaching with key: %@, URL: %@, UUID: %@, task: %@", key, url, UUID, task); - } - [task addCallbacksWithCompletionBlock:completion progressImageBlock:progressImage progressDownloadBlock:progressDownload withUUID:UUID]; - [self.tasks setObject:task forKey:key]; - // Relax :), task retain the UUID for us, it's ok to have a weak reference to UUID here. - [self.UUIDToTask setObject:task forKey:UUID]; - - NSAssert(taskClass == [task class], @"Task class should be the same!"); - [self unlock]; - - if (taskExisted == NO) { - [self.concurrentOperationQueue scheduleOperation:^ - { - [self objectForKey:key options:options completion:^(BOOL found, BOOL valid, PINImage *image, id alternativeRepresentation) { - if (found) { - if (valid) { - [self callCompletionsWithKey:key image:image alternativeRepresentation:alternativeRepresentation cached:YES response:nil error:nil finalized:YES]; - } else { - //Remove completion and try again - [self lock]; - PINRemoteImageTask *task = [self.tasks objectForKey:key]; - [task removeCallbackWithUUID:UUID]; - if (task.callbackBlocks.count == 0) { - [self.tasks removeObjectForKey:key]; - } - [self unlock]; - - //Skip early check - [self downloadImageWithURL:url - options:options | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck - priority:priority - processorKey:processorKey - processor:processor - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - progressDownload:nil - completion:completion - inputUUID:UUID]; - } - } else { - if ([taskClass isSubclassOfClass:[PINRemoteImageProcessorTask class]]) { - //continue processing - [self downloadImageWithURL:url - options:options - priority:priority - key:key - processor:processor - UUID:UUID]; - } else if ([taskClass isSubclassOfClass:[PINRemoteImageDownloadTask class]]) { - //continue downloading - [self downloadImageWithURL:url - options:options - priority:priority - key:key - progressImage:progressImage - UUID:UUID]; - } - } - }]; - } withPriority:operationPriorityWithImageManagerPriority(priority)]; - } - } withPriority:operationPriorityWithImageManagerPriority(priority)]; - - return UUID; -} - -- (void)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - priority:(PINRemoteImageManagerPriority)priority - key:(NSString *)key - processor:(PINRemoteImageManagerImageProcessor)processor - UUID:(NSUUID *)UUID -{ - PINRemoteImageProcessorTask *task = nil; - [self lock]; - task = [self.tasks objectForKey:key]; - //check processing task still exists and download hasn't been started for another task - if (task == nil || task.downloadTaskUUID != nil) { - [self unlock]; - return; - } - - __weak typeof(self) weakSelf = self; - NSUUID *downloadTaskUUID = [self downloadImageWithURL:url - options:options | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck - completion:^(PINRemoteImageManagerResult *result) - { - typeof(self) strongSelf = weakSelf; - NSUInteger processCost = 0; - NSError *error = result.error; - PINRemoteImageProcessorTask *task = nil; - [strongSelf lock]; - task = [strongSelf.tasks objectForKey:key]; - [strongSelf unlock]; - //check processing task still exists - if (task == nil) { - return; - } - if (result.image && error == nil) { - //If completionBlocks.count == 0, we've canceled before we were even able to start. - PINImage *image = processor(result, &processCost); - - if (image == nil) { - error = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorFailedToProcessImage - userInfo:nil]; - } - [strongSelf callCompletionsWithKey:key image:image alternativeRepresentation:nil cached:NO response:result.response error:error finalized:NO]; - - if (error == nil && image != nil) { - BOOL saveAsJPEG = (options & PINRemoteImageManagerSaveProcessedImageAsJPEG) != 0; - NSData *diskData = nil; - if (saveAsJPEG) { - diskData = PINImageJPEGRepresentation(image, 1.0); - } else { - diskData = PINImagePNGRepresentation(image); - } - - [strongSelf materializeAndCacheObject:image cacheInDisk:diskData additionalCost:processCost url:url key:key options:options outImage:nil outAltRep:nil]; - } - - [strongSelf callCompletionsWithKey:key image:image alternativeRepresentation:nil cached:NO response:result.response error:error finalized:YES]; - } else { - if (error == nil) { - error = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorFailedToFetchImageForProcessing - userInfo:nil]; - } - - [strongSelf callCompletionsWithKey:key image:nil alternativeRepresentation:nil cached:NO response:result.response error:error finalized:YES]; - } - }]; - task.downloadTaskUUID = downloadTaskUUID; - [self unlock]; -} - -- (void)downloadImageWithURL:(NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - priority:(PINRemoteImageManagerPriority)priority - key:(NSString *)key - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - UUID:(NSUUID *)UUID -{ - PINResume *resume = nil; - if ((options & PINRemoteImageManagerDownloadOptionsIgnoreCache) == NO) { - NSString *resumeKey = [self resumeCacheKeyForURL:url]; - resume = [self.cache objectFromDiskForKey:resumeKey]; - [self.cache removeObjectForKey:resumeKey completion:nil]; - } - - [self lock]; - PINRemoteImageDownloadTask *task = [self.tasks objectForKey:key]; - [self unlock]; - - [task scheduleDownloadWithRequest:[self requestWithURL:url task:task] - resume:resume - skipRetry:(options & PINRemoteImageManagerDownloadOptionsSkipRetry) - priority:priority - completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) - { - [self->_concurrentOperationQueue scheduleOperation:^ - { - NSError *remoteImageError = error; - PINImage *image = nil; - id alternativeRepresentation = nil; - NSNumber *maxAge = nil; - if (remoteImageError == nil) { - BOOL ignoreHeaders = (options & PINRemoteImageManagerDownloadOptionsIgnoreCacheControlHeaders) != 0; - if ((self.diskCacheTTLIsEnabled || self.memoryCacheTTLIsEnabled) && !ignoreHeaders) { - // examine Cache-Control headers (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; - maxAge = [httpResponse findMaxAge]; - } - } - // Stores the object in the cache. - [self materializeAndCacheObject:data cacheInDisk:data additionalCost:0 maxAge:maxAge url:url key:key options:options outImage:&image outAltRep:&alternativeRepresentation]; - } - - if (error == nil && image == nil && alternativeRepresentation == nil) { - remoteImageError = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorFailedToDecodeImage - userInfo:nil]; - } - - [self callCompletionsWithKey:key image:image alternativeRepresentation:alternativeRepresentation cached:NO response:response error:remoteImageError finalized:YES]; - } withPriority:operationPriorityWithImageManagerPriority(priority)]; - }]; -} - --(BOOL)insertImageDataIntoCache:(nonnull NSData*)data - withURL:(nonnull NSURL *)url - processorKey:(nullable NSString *)processorKey - additionalCost:(NSUInteger)additionalCost -{ - - if (url != nil) { - NSString *key = [self cacheKeyForURL:url processorKey:processorKey]; - - PINRemoteImageManagerDownloadOptions options = PINRemoteImageManagerDownloadOptionsSkipDecode | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck; - PINRemoteImageMemoryContainer *container = [[PINRemoteImageMemoryContainer alloc] init]; - container.data = data; - - return [self materializeAndCacheObject:container cacheInDisk:data additionalCost:additionalCost url:url key:key options:options outImage: nil outAltRep: nil]; - } - - return NO; -} - -- (BOOL)earlyReturnWithOptions:(PINRemoteImageManagerDownloadOptions)options url:(NSURL *)url key:(NSString *)key object:(id)object completion:(PINRemoteImageManagerImageCompletion)completion -{ - PINImage *image = nil; - id alternativeRepresentation = nil; - PINRemoteImageResultType resultType = PINRemoteImageResultTypeNone; - - BOOL allowEarlyReturn = !(PINRemoteImageManagerDownloadOptionsSkipEarlyCheck & options); - - if (url != nil && object != nil) { - resultType = PINRemoteImageResultTypeMemoryCache; - [self materializeAndCacheObject:object url:url key:key options:options outImage:&image outAltRep:&alternativeRepresentation]; - } - - if (completion && ((image || alternativeRepresentation) || (url == nil))) { - //If we're on the main thread, special case to call completion immediately - NSError *error = nil; - if (!url) { - error = [NSError errorWithDomain:NSURLErrorDomain - code:NSURLErrorUnsupportedURL - userInfo:@{ NSLocalizedDescriptionKey : @"unsupported URL" }]; - } - PINRemoteImageManagerResult *result = [PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:0 - resultType:resultType - UUID:nil - response:nil - error:error]; - if (allowEarlyReturn && [NSThread isMainThread]) { - completion(result); - } else { - dispatch_async(self.callbackQueue, ^{ - completion(result); - }); - } - return YES; - } - return NO; -} - -- (NSURLRequest *)requestWithURL:(NSURL *)url task:(PINRemoteImageTask *)task -{ - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - - NSMutableDictionary *headers = [self.httpHeaderFields mutableCopy]; - - if (headers.count > 0) { - request.allHTTPHeaderFields = headers; - } - - if (_requestConfigurationHandler) { - request = [_requestConfigurationHandler(request) mutableCopy]; - } - - PINRemoteImageWeakTask *weakTask = [[PINRemoteImageWeakTask alloc] initWithTask:task]; - [NSURLProtocol setProperty:weakTask forKey:PINRemoteImageWeakTaskKey inRequest:request]; - - return request; -} - -- (void)callCompletionsWithKey:(NSString *)key - image:(PINImage *)image - alternativeRepresentation:(id)alternativeRepresentation - cached:(BOOL)cached - response:(NSURLResponse *)response - error:(NSError *)error - finalized:(BOOL)finalized -{ - [self lock]; - PINRemoteImageDownloadTask *task = [self.tasks objectForKey:key]; - [task callCompletionsWithImage:image alternativeRepresentation:alternativeRepresentation cached:cached response:response error:error remove:!finalized]; - if (finalized) { - [self.tasks removeObjectForKey:key]; - } - [self unlock]; -} - -#pragma mark - Prefetching - -- (NSArray *)prefetchImagesWithURLs:(NSArray *)urls -{ - return [self prefetchImagesWithURLs:urls options:PINRemoteImageManagerDownloadOptionsNone | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck]; -} - -- (NSArray *)prefetchImagesWithURLs:(NSArray *)urls options:(PINRemoteImageManagerDownloadOptions)options -{ - return [self prefetchImagesWithURLs:urls options:options priority:PINRemoteImageManagerPriorityLow]; -} - -- (NSArray *)prefetchImagesWithURLs:(NSArray *)urls options:(PINRemoteImageManagerDownloadOptions)options priority:(PINRemoteImageManagerPriority)priority -{ - NSMutableArray *tasks = [NSMutableArray arrayWithCapacity:urls.count]; - for (NSURL *url in urls) { - NSUUID *task = [self prefetchImageWithURL:url options:options priority:priority]; - if (task != nil) { - [tasks addObject:task]; - } - } - return tasks; -} - -- (NSUUID *)prefetchImageWithURL:(NSURL *)url -{ - return [self prefetchImageWithURL:url options:PINRemoteImageManagerDownloadOptionsNone | PINRemoteImageManagerDownloadOptionsSkipEarlyCheck]; -} - -- (NSUUID *)prefetchImageWithURL:(NSURL *)url options:(PINRemoteImageManagerDownloadOptions)options -{ - return [self prefetchImageWithURL:url options:options priority:PINRemoteImageManagerPriorityLow]; -} - -- (NSUUID *)prefetchImageWithURL:(NSURL *)url options:(PINRemoteImageManagerDownloadOptions)options priority:(PINRemoteImageManagerPriority)priority -{ - return [self downloadImageWithURL:url - options:options - priority:priority - processorKey:nil - processor:nil - progressImage:nil - progressDownload:nil - completion:nil - inputUUID:nil]; -} - -#pragma mark - Cancellation & Priority - -- (void)cancelTaskWithUUID:(NSUUID *)UUID -{ - [self cancelTaskWithUUID:UUID storeResumeData:NO]; -} - -- (void)cancelTaskWithUUID:(nonnull NSUUID *)UUID storeResumeData:(BOOL)storeResumeData -{ - if (UUID == nil) { - return; - } - PINLog(@"Attempting to cancel UUID: %@", UUID); - [_concurrentOperationQueue scheduleOperation:^{ - PINResume *resume = nil; - [self lock]; - PINRemoteImageTask *taskToEvaluate = [self.UUIDToTask objectForKey:UUID]; - if (taskToEvaluate == nil) { - //maybe task hasn't been added to task list yet, add it to canceled tasks. - //there's no need to ever remove a UUID from canceledTasks because it is weak. - [self.canceledTasks addObject:UUID]; - } - - if ([taskToEvaluate cancelWithUUID:UUID resume:storeResumeData ? &resume : NULL]) { - [self.tasks removeObjectForKey:taskToEvaluate.key]; - } - [self unlock]; - - if (resume) { - //store resume data away, only download tasks currently return resume data - [self storeResumeData:resume forURL:[(PINRemoteImageDownloadTask *)taskToEvaluate URL]]; - } - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)cancelAllTasks -{ - [self cancelAllTasksAndStoreResumeData:NO]; -} - -- (void)cancelAllTasksAndStoreResumeData:(BOOL)storeResumeData -{ - [_concurrentOperationQueue scheduleOperation:^{ - [self lock]; - NSMapTable *uuidToTask = [self.UUIDToTask copy]; - [self unlock]; - - for (NSUUID *uuid in uuidToTask) { - [self cancelTaskWithUUID:uuid storeResumeData:storeResumeData]; - } - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)setPriority:(PINRemoteImageManagerPriority)priority ofTaskWithUUID:(NSUUID *)UUID -{ - if (UUID == nil) { - return; - } - PINLog(@"Setting priority of UUID: %@ priority: %lu", UUID, (unsigned long)priority); - [_concurrentOperationQueue scheduleOperation:^{ - [self lock]; - PINRemoteImageTask *task = [self.UUIDToTask objectForKey:UUID]; - [task setPriority:priority]; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)setProgressImageCallback:(nullable PINRemoteImageManagerImageCompletion)progressImageCallback ofTaskWithUUID:(nonnull NSUUID *)UUID -{ - if (UUID == nil) { - return; - } - - PINLog(@"setting progress block of UUID: %@ progressBlock: %@", UUID, progressImageCallback); - [_concurrentOperationQueue scheduleOperation:^{ - [self lock]; - PINRemoteImageTask *task = [self.UUIDToTask objectForKey:UUID]; - if ([task isKindOfClass:[PINRemoteImageDownloadTask class]]) { - PINRemoteImageCallbacks *callbacks = task.callbackBlocks[UUID]; - callbacks.progressImageBlock = progressImageCallback; - } - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -- (void)setRetryStrategyCreationBlock:(id (^)(void))retryStrategyCreationBlock { - [_concurrentOperationQueue scheduleOperation:^{ - [self lock]; - self->_retryStrategyCreationBlock = retryStrategyCreationBlock; - [self unlock]; - } withPriority:PINOperationQueuePriorityHigh]; -} - -#pragma mark - Caching - -- (void)imageFromCacheWithCacheKey:(NSString *)cacheKey - completion:(PINRemoteImageManagerImageCompletion)completion -{ - [self imageFromCacheWithCacheKey:cacheKey options:PINRemoteImageManagerDownloadOptionsNone completion:completion]; -} - -- (void)imageFromCacheWithCacheKey:(NSString *)cacheKey - options:(PINRemoteImageManagerDownloadOptions)options - completion:(PINRemoteImageManagerImageCompletion)completion -{ - [self imageFromCacheWithURL:nil processorKey:nil cacheKey:cacheKey options:options completion:completion]; -} - -- (void)imageFromCacheWithURL:(nonnull NSURL *)url - processorKey:(nullable NSString *)processorKey - options:(PINRemoteImageManagerDownloadOptions)options - completion:(nonnull PINRemoteImageManagerImageCompletion)completion -{ - [self imageFromCacheWithURL:url processorKey:processorKey cacheKey:nil options:options completion:completion]; -} - -- (void)imageFromCacheWithURL:(NSURL *)url - processorKey:(NSString *)processorKey - cacheKey:(NSString *)cacheKey - options:(PINRemoteImageManagerDownloadOptions)options - completion:(PINRemoteImageManagerImageCompletion)completion -{ - CFTimeInterval requestTime = CACurrentMediaTime(); - - if ((PINRemoteImageManagerDownloadOptionsSkipEarlyCheck & options) == NO && [NSThread isMainThread]) { - PINRemoteImageManagerResult *result = [self synchronousImageFromCacheWithURL:url processorKey:processorKey cacheKey:cacheKey options:options]; - if (result.image && result.error == nil) { - completion((result)); - return; - } - } - - [self objectForURL:url processorKey:processorKey key:cacheKey options:options completion:^(BOOL found, BOOL valid, PINImage *image, id alternativeRepresentation) { - NSError *error = nil; - if (valid == NO) { - error = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorInvalidItemInCache - userInfo:nil]; - } - - dispatch_async(self.callbackQueue, ^{ - completion([PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:CACurrentMediaTime() - requestTime - resultType:PINRemoteImageResultTypeCache - UUID:nil - response:nil - error:error]); - }); - }]; -} - -- (PINRemoteImageManagerResult *)synchronousImageFromCacheWithCacheKey:(NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options -{ - return [self synchronousImageFromCacheWithURL:nil processorKey:nil cacheKey:cacheKey options:options]; -} - -- (nonnull PINRemoteImageManagerResult *)synchronousImageFromCacheWithURL:(NSURL *)url processorKey:(nullable NSString *)processorKey options:(PINRemoteImageManagerDownloadOptions)options -{ - return [self synchronousImageFromCacheWithURL:url processorKey:processorKey cacheKey:nil options:options]; -} - -- (PINRemoteImageManagerResult *)synchronousImageFromCacheWithURL:(NSURL *)url processorKey:(NSString *)processorKey cacheKey:(NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options -{ - CFTimeInterval requestTime = CACurrentMediaTime(); - - if (cacheKey == nil && url == nil) { - return nil; - } - - cacheKey = cacheKey ?: [self cacheKeyForURL:url processorKey:processorKey]; - - id object = [self.cache objectFromMemoryForKey:cacheKey]; - PINImage *image; - id alternativeRepresentation; - NSError *error = nil; - if (object == nil) { - image = nil; - alternativeRepresentation = nil; - } else if ([self materializeAndCacheObject:object url:url key:cacheKey options:options outImage:&image outAltRep:&alternativeRepresentation] == NO) { - error = [NSError errorWithDomain:PINRemoteImageManagerErrorDomain - code:PINRemoteImageManagerErrorInvalidItemInCache - userInfo:nil]; - } - - return [PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:CACurrentMediaTime() - requestTime - resultType:PINRemoteImageResultTypeMemoryCache - UUID:nil - response:nil - error:error]; -} - -#pragma mark - Session Task Blocks - -- (void)didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge forTask:(NSURLSessionTask *)dataTask completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { - [self lock]; - if (self.authenticationChallengeHandler) { - self.authenticationChallengeHandler(dataTask, challenge, completionHandler); - } else { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); - } - [self unlock]; -} - -- (void)didReceiveResponse:(nonnull NSURLResponse *)response forTask:(nonnull NSURLSessionTask *)dataTask -{ - [self lock]; - PINRemoteImageWeakTask *weakTask = [NSURLProtocol propertyForKey:PINRemoteImageWeakTaskKey inRequest:dataTask.originalRequest]; - PINRemoteImageDownloadTask *task = (PINRemoteImageDownloadTask *)weakTask.task; - [self unlock]; - [task didReceiveResponse:response]; -} - -- (void)didReceiveData:(NSData *)data forTask:(NSURLSessionTask *)dataTask -{ - [self lock]; - PINRemoteImageWeakTask *weakTask = [NSURLProtocol propertyForKey:PINRemoteImageWeakTaskKey inRequest:dataTask.originalRequest]; - PINRemoteImageDownloadTask *task = (PINRemoteImageDownloadTask *)weakTask.task; - [self unlock]; - [task didReceiveData:data]; -} - -- (void)didCollectMetrics:(nonnull NSURLSessionTaskMetrics *)metrics forURL:(nonnull NSURL *)url API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) -{ - [self lock]; - if (self.metricsCallback) { - self.metricsCallback(url, metrics); - } - [self unlock]; -} - -#pragma mark - QOS - -- (NSUUID *)downloadImageWithURLs:(NSArray *)urls - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(PINRemoteImageManagerImageCompletion)progressImage - completion:(PINRemoteImageManagerImageCompletion)completion -{ - return [self downloadImageWithURLs:urls - options:options - progressImage:progressImage - progressDownload:nil - completion:completion]; -} - -- (nullable NSUUID *)downloadImageWithURLs:(nonnull NSArray *)urls - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion -{ - NSUUID *UUID = [NSUUID UUID]; - if (urls.count <= 1) { - NSURL *url = [urls firstObject]; - [self downloadImageWithURL:url - options:options - priority:PINRemoteImageManagerPriorityDefault - processorKey:nil - processor:nil - progressImage:progressImage - progressDownload:progressDownload - completion:completion - inputUUID:UUID]; - return UUID; - } - - [self.concurrentOperationQueue scheduleOperation:^{ - __block NSInteger highestQualityDownloadedIdx = -1; - - //check for the highest quality image already in cache. It's possible that an image is in the process of being - //cached when this is being run. In which case two things could happen: - // - If network conditions dictate that a lower quality image should be downloaded than the one that is currently - // being cached, it will be downloaded in addition. This is not ideal behavior, worst case scenario and unlikely. - // - If network conditions dictate that the same quality image should be downloaded as the one being cached, no - // new image will be downloaded as either the caching will have finished by the time we actually request it or - // the task will still exist and our callback will be attached. In this case, no detrimental behavior will have - // occurred. - [urls enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(NSURL *url, NSUInteger idx, BOOL *stop) { - NSAssert([url isKindOfClass:[NSURL class]], @"url must be of type URL"); - NSString *cacheKey = [self cacheKeyForURL:url processorKey:nil]; - - //we don't actually need the object, just need to know it exists so that we can request it later - BOOL hasObject = [self.cache objectExistsForKey:cacheKey]; - - if (hasObject) { - highestQualityDownloadedIdx = idx; - *stop = YES; - } - }]; - - [self lock]; - float highQualityQPSThreshold = [self highQualityBPSThreshold]; - float lowQualityQPSThreshold = [self lowQualityBPSThreshold]; - BOOL shouldUpgradeLowQualityImages = [self shouldUpgradeLowQualityImages]; - [self unlock]; - - NSUInteger desiredImageURLIdx = [PINSpeedRecorder appropriateImageIdxForURLsGivenHistoricalNetworkConditions:urls - lowQualityQPSThreshold:lowQualityQPSThreshold - highQualityQPSThreshold:highQualityQPSThreshold]; - - NSUInteger downloadIdx; - //if the highest quality already downloaded is less than what currentBPS would dictate and shouldUpgrade is - //set, download the new higher quality image. If no image has been cached, download the image dictated by - //current bps - - if ((highestQualityDownloadedIdx < desiredImageURLIdx && shouldUpgradeLowQualityImages) || highestQualityDownloadedIdx == -1) { - downloadIdx = desiredImageURLIdx; - } else { - downloadIdx = highestQualityDownloadedIdx; - } - - NSURL *downloadURL = [urls objectAtIndex:downloadIdx]; - - [self downloadImageWithURL:downloadURL - options:options - priority:PINRemoteImageManagerPriorityDefault - processorKey:nil - processor:nil - progressImage:progressImage - progressDownload:progressDownload - completion:^(PINRemoteImageManagerResult *result) { - //clean out any lower quality images from the cache - for (NSInteger idx = downloadIdx - 1; idx >= 0; idx--) { - [[self cache] removeObjectForKey:[self cacheKeyForURL:[urls objectAtIndex:idx] processorKey:nil]]; - } - - if (completion) { - completion(result); - } - } - inputUUID:UUID]; - } withPriority:PINOperationQueuePriorityDefault]; - return UUID; -} - -#pragma mark - Caching - -- (BOOL)materializeAndCacheObject:(id)object - url:(NSURL *)url - key:(NSString *)key - options:(PINRemoteImageManagerDownloadOptions)options - outImage:(PINImage **)outImage - outAltRep:(id *)outAlternateRepresentation -{ - return [self materializeAndCacheObject:object cacheInDisk:nil additionalCost:0 url:url key:key options:options outImage:outImage outAltRep:outAlternateRepresentation]; -} - -- (BOOL)materializeAndCacheObject:(id)object - cacheInDisk:(NSData *)diskData - additionalCost:(NSUInteger)additionalCost - url:(NSURL *)url - key:(NSString *)key - options:(PINRemoteImageManagerDownloadOptions)options - outImage:(PINImage **)outImage - outAltRep:(id *)outAlternateRepresentation { - return [self materializeAndCacheObject:object cacheInDisk:diskData additionalCost:additionalCost maxAge:nil url:url key:key options:options outImage:outImage outAltRep:outAlternateRepresentation]; -} - -//takes the object from the cache and returns an image or animated image. -//if it's a non-alternative representation and skipDecode is not set it also decompresses the image. -- (BOOL)materializeAndCacheObject:(id)object - cacheInDisk:(NSData *)diskData - additionalCost:(NSUInteger)additionalCost - maxAge:(NSNumber *)maxAge - url:(NSURL *)url - key:(NSString *)key - options:(PINRemoteImageManagerDownloadOptions)options - outImage:(PINImage **)outImage - outAltRep:(id *)outAlternateRepresentation -{ - NSAssert(object != nil, @"Object should not be nil."); - if (object == nil) { - return NO; - } - BOOL alternateRepresentationsAllowed = (PINRemoteImageManagerDisallowAlternateRepresentations & options) == 0; - BOOL skipDecode = (options & PINRemoteImageManagerDownloadOptionsSkipDecode) != 0; - __block id alternateRepresentation = nil; - __block PINImage *image = nil; - __block NSData *data = nil; - __block BOOL updateMemoryCache = NO; - - PINRemoteImageMemoryContainer *container = nil; - if ([object isKindOfClass:[PINRemoteImageMemoryContainer class]]) { - container = (PINRemoteImageMemoryContainer *)object; - [container.lock lockWithBlock:^{ - data = container.data; - }]; - } else { - updateMemoryCache = YES; - - // don't need to lock the container here because we just init it. - container = [[PINRemoteImageMemoryContainer alloc] init]; - - if ([object isKindOfClass:[PINImage class]]) { - data = diskData; - container.image = (PINImage *)object; - } else if ([object isKindOfClass:[NSData class]]) { - data = (NSData *)object; - } else { - //invalid item in cache - updateMemoryCache = NO; - data = nil; - container = nil; - } - - container.data = data; - } - - if (alternateRepresentationsAllowed) { - alternateRepresentation = [_alternateRepProvider alternateRepresentationWithData:data options:options]; - } - - if (alternateRepresentation == nil) { - //we need the image - [container.lock lockWithBlock:^{ - image = container.image; - }]; - if (image == nil && container.data) { - image = [PINImage pin_decodedImageWithData:container.data skipDecodeIfPossible:skipDecode]; - - if (url != nil) { - image = [PINImage pin_scaledImageForImage:image withKey:key]; - } - - if (skipDecode == NO) { - [container.lock lockWithBlock:^{ - updateMemoryCache = YES; - container.image = image; - }]; - } - } - } - - // maxAge set to 0 means that images should not be stored at all. - BOOL doNotCache = (maxAge != nil && [maxAge integerValue] == 0); - - // There is no HTTP header that can be sent to indicate "infinite". However not setting a value at all, which in - // our case is represented by maxAge == nil, effectively means that. - BOOL cacheIndefinitely = (maxAge == nil); - - if (!doNotCache) { - if (updateMemoryCache) { - [container.lock lockWithBlock:^{ - NSUInteger cacheCost = additionalCost; - cacheCost += [container.data length]; - CGImageRef imageRef = container.image.CGImage; - NSAssert(container.image == nil || imageRef != NULL, @"We only cache a decompressed image if we decompressed it ourselves. In that case, it should be backed by a CGImageRef."); - if (imageRef) { - cacheCost += CGImageGetHeight(imageRef) * CGImageGetBytesPerRow(imageRef); - } - if (!self.memoryCacheTTLIsEnabled || cacheIndefinitely) { - [self.cache setObjectInMemory:container forKey:key withCost:cacheCost]; - } else { - [self.cache setObjectInMemory:container forKey:key withCost:cacheCost withAgeLimit:[maxAge integerValue]]; - } - }]; - } - - if (diskData) { - if (!self.diskCacheTTLIsEnabled || cacheIndefinitely) { - // with an unset (nil) maxAge, or a cache that is not _isTtlCache, behave as before (will use cache global behavior) - [self.cache setObjectOnDisk:diskData forKey:key]; - } else { - [self.cache setObjectOnDisk:diskData forKey:key withAgeLimit:[maxAge integerValue]]; - } - } - } - - if (outImage) { - *outImage = image; - } - - if (outAlternateRepresentation) { - *outAlternateRepresentation = alternateRepresentation; - } - - if (image == nil && alternateRepresentation == nil) { - PINLog(@"Invalid item in cache"); - [self.cache removeObjectForKey:key completion:nil]; - return NO; - } - return YES; -} - -- (NSString *)cacheKeyForURL:(NSURL *)url processorKey:(NSString *)processorKey -{ - return [self cacheKeyForURL:url processorKey:processorKey resume:NO]; -} - -- (NSString *)cacheKeyForURL:(NSURL *)url processorKey:(NSString *)processorKey resume:(BOOL)resume -{ - NSString *cacheKey = [url absoluteString]; - NSAssert((processorKey.length == 0 && resume == YES) || resume == NO, @"It doesn't make sense to use resume with processing."); - if (processorKey.length > 0) { - cacheKey = [cacheKey stringByAppendingFormat:@"-<%@>", processorKey]; - } - - //PINDiskCache uses this key as the filename of the file written to disk - //Due to the current filesystem used in Darwin, this name must be limited to 255 chars. - //In case the generated key exceeds PINRemoteImageManagerCacheKeyMaxLength characters, - //we return the hash of it instead. - if (cacheKey.length > PINRemoteImageManagerCacheKeyMaxLength) { - __block CC_MD5_CTX ctx; - CC_MD5_Init(&ctx); - NSData *data = [cacheKey dataUsingEncoding:NSUTF8StringEncoding]; - [data enumerateByteRangesUsingBlock:^(const void * _Nonnull bytes, NSRange byteRange, BOOL * _Nonnull stop) { - CC_MD5_Update(&ctx, bytes, (CC_LONG)byteRange.length); - }]; - - unsigned char digest[CC_MD5_DIGEST_LENGTH]; - CC_MD5_Final(digest, &ctx); - - NSMutableString *hexString = [NSMutableString stringWithCapacity:(CC_MD5_DIGEST_LENGTH * 2)]; - for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { - [hexString appendFormat:@"%02lx", (unsigned long)digest[i]]; - } - cacheKey = [hexString copy]; - } - //The resume key must not be hashed, it is used to decide whether or not to decode from the disk cache. - if (resume) { - cacheKey = [PINRemoteImageCacheKeyResumePrefix stringByAppendingString:cacheKey]; - } - - return cacheKey; -} - -- (void)objectForKey:(NSString *)key options:(PINRemoteImageManagerDownloadOptions)options completion:(void (^)(BOOL found, BOOL valid, PINImage *image, id alternativeRepresentation))completion -{ - return [self objectForURL:nil processorKey:nil key:key options:options completion:completion]; -} - -- (void)objectForURL:(NSURL *)url processorKey:(NSString *)processorKey key:(NSString *)key options:(PINRemoteImageManagerDownloadOptions)options completion:(void (^)(BOOL found, BOOL valid, PINImage *image, id alternativeRepresentation))completion -{ - if ((options & PINRemoteImageManagerDownloadOptionsIgnoreCache) != 0) { - completion(NO, YES, nil, nil); - return; - } - - if (key == nil && url == nil) { - completion(NO, YES, nil, nil); - return; - } - - key = key ?: [self cacheKeyForURL:url processorKey:processorKey]; - - void (^materialize)(id object) = ^(id object) { - PINImage *image = nil; - id alternativeRepresentation = nil; - BOOL valid = [self materializeAndCacheObject:object - url:nil - key:key - options:options - outImage:&image - outAltRep:&alternativeRepresentation]; - - completion(YES, valid, image, alternativeRepresentation); - }; - - PINRemoteImageMemoryContainer *container = [self.cache objectFromMemoryForKey:key]; - if (container) { - materialize(container); - } else { - [self.cache objectFromDiskForKey:key completion:^(id _Nonnull cache, - NSString *_Nonnull key, - id _Nullable object) { - if (object) { - materialize(object); - } else { - completion(NO, YES, nil, nil); - } - }]; - } -} - -#pragma mark - Resume support - -- (NSString *)resumeCacheKeyForURL:(NSURL *)url -{ - return [self cacheKeyForURL:url processorKey:nil resume:YES]; -} - -- (void)storeResumeData:(PINResume *)resume forURL:(NSURL *)URL -{ - NSString *resumeKey = [self resumeCacheKeyForURL:URL]; - [self.cache setObjectOnDisk:resume forKey:resumeKey]; -} - -#if DEBUG -- (NSUInteger)totalDownloads -{ - //hack to avoid main thread assertion since these are only used in testing - [_lock lock]; - NSUInteger totalDownloads = _totalDownloads; - [_lock unlock]; - return totalDownloads; -} -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.h deleted file mode 100644 index b1509038..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// PINRemoteImageManagerConfiguration.h -// Pods -// -// Created by Ryan Quan on 2/22/19. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -/** A configuration object used to customize a PINRemoteImageManager instance **/ -@interface PINRemoteImageManagerConfiguration : NSObject - -/** The maximum number of concurrent operations. Defaults to NSOperationQueueDefaultMaxConcurrentOperationCount. */ -@property (nonatomic, readwrite, assign) NSUInteger maxConcurrentOperations; - -/** The maximum number of concurrent downloads. Defaults to 10, maximum 65535. */ -@property (nonatomic, readwrite, assign) NSUInteger maxConcurrentDownloads; - -/** The estimated remaining time threshold used to decide to skip progressive rendering. Defaults to 0.1. */ -@property (nonatomic, readwrite, assign) NSTimeInterval estimatedRemainingTimeThreshold; - -/** A bool value indicating whether PINRemoteImage should blur progressive render results */ -@property (nonatomic, readwrite, assign) BOOL shouldBlurProgressive; - -/** A CGSize which indicates the max size PINRemoteImage will render a progressive image. If an image is larger in either dimension, progressive rendering will be skipped */ -@property (nonatomic, readwrite, assign) CGSize maxProgressiveRenderSize; - -/** The minimum BPS to download the highest quality image in a set. */ -@property (nonatomic, readwrite, assign) float highQualityBPSThreshold; - -/** The maximum BPS to download the lowest quality image in a set. */ -@property (nonatomic, readwrite, assign) float lowQualityBPSThreshold; - -/** Whether high quality images should be downloaded when a low quality image is cached if network connectivity has improved. */ -@property (nonatomic, readwrite, assign) BOOL shouldUpgradeLowQualityImages; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.m deleted file mode 100644 index ecdad946..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerConfiguration.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// PINRemoteImageManagerConfiguration.m -// Pods -// -// Created by Ryan Quan on 2/22/19. -// -// - -#import "PINRemoteImageManagerConfiguration.h" - -#import "PINRemoteImageManager.h" - -@implementation PINRemoteImageManagerConfiguration - -- (nonnull instancetype)init { - if (self = [super init]) { - _maxConcurrentOperations = [[NSProcessInfo processInfo] activeProcessorCount] * 2; - _maxConcurrentDownloads = 10; - _estimatedRemainingTimeThreshold = 0.1; - _shouldBlurProgressive = YES; - _maxProgressiveRenderSize = CGSizeMake(1024, 1024); - _highQualityBPSThreshold = 500000; - _lowQualityBPSThreshold = 50000; // approximately edge speed - _shouldUpgradeLowQualityImages = NO; - } - return self; -} - -#pragma mark - Setters - -- (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads { - NSAssert(maxConcurrentDownloads <= PINRemoteImageHTTPMaximumConnectionsPerHost, @"maxNumberOfConcurrentDownloads must be less than or equal to %d", PINRemoteImageHTTPMaximumConnectionsPerHost); - _maxConcurrentDownloads = maxConcurrentDownloads; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerResult.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerResult.m deleted file mode 100644 index 8076abd5..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageManagerResult.m +++ /dev/null @@ -1,118 +0,0 @@ -// -// PINRemoteImageManagerResult.m -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageManagerResult.h" - -@implementation PINRemoteImageManagerResult - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error -{ - return [self imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:requestLength - resultType:resultType - UUID:uuid - response:response - error:error - renderedImageQuality:1.0]; -} - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error - bytesSavedByResuming:(NSUInteger)bytesSavedByResuming -{ - return [[self alloc] initWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:requestLength - error:error - resultType:resultType - UUID:uuid - response:response - renderedImageQuality:1.0 - bytesSavedByResuming:bytesSavedByResuming]; -} - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error - renderedImageQuality:(CGFloat)renderedImageQuality -{ - return [[self alloc] initWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:requestLength - error:error - resultType:resultType - UUID:uuid - response:response - renderedImageQuality:renderedImageQuality - bytesSavedByResuming:0]; -} - -- (instancetype)initWithImage:(PINImage *)image - alternativeRepresentation:(id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - error:(NSError *)error - resultType:(PINRemoteImageResultType)resultType - UUID:(NSUUID *)uuid - response:(NSURLResponse *)response - renderedImageQuality:(CGFloat)renderedImageQuality - bytesSavedByResuming:(NSUInteger)bytesSavedByResuming; -{ - if (self = [super init]) { - _image = image; - _alternativeRepresentation = alternativeRepresentation; - _requestDuration = requestLength; - _error = error; - _resultType = resultType; - _UUID = uuid; - _response = response; - _renderedImageQuality = renderedImageQuality; - _bytesSavedByResuming = bytesSavedByResuming; - } - return self; -} - -- (NSString *)description -{ - NSString *description = [super description]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"image: %@", self.image]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"alternativeRepresentation: %@", self.alternativeRepresentation]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"requestDuration: %f", self.requestDuration]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"error: %@", self.error]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"resultType: %lu", (unsigned long)self.resultType]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"UUID: %@", self.UUID]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"response: %@", self.response]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"renderedImageQuality: %f", self.renderedImageQuality]]; - description = [description stringByAppendingString:@"\n"]; - description = [description stringByAppendingString:[NSString stringWithFormat:@"bytesSavedByResuming: %lu", (unsigned long)self.bytesSavedByResuming]]; - return description; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.h deleted file mode 100644 index 2d1d62bf..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// PINRemoteImageMemoryContainer.h -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import - -#import "PINRemoteImageMacros.h" -#import "PINRemoteLock.h" - -@class PINImage; - -@interface PINRemoteImageMemoryContainer : NSObject - -@property (nonatomic, strong) PINImage *image; -@property (nonatomic, strong) NSData *data; -@property (nonatomic, strong) PINRemoteLock *lock; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.m deleted file mode 100644 index 3da6b27a..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageMemoryContainer.m +++ /dev/null @@ -1,21 +0,0 @@ -// -// PINRemoteImageMemoryContainer.m -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import "PINRemoteImageMemoryContainer.h" - -@implementation PINRemoteImageMemoryContainer - -- (instancetype)init -{ - if (self = [super init]) { - _lock = [[PINRemoteLock alloc] initWithName:@"PINRemoteImageMemoryContainer" lockType:PINRemoteLockTypeNonRecursive]; - } - return self; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.h deleted file mode 100644 index a36fe3ac..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// PINRemoteImageProcessorTask.h -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageTask.h" - -@interface PINRemoteImageProcessorTask : PINRemoteImageTask - -@property (nonatomic, strong, nullable) NSUUID *downloadTaskUUID; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.m deleted file mode 100644 index 2f950227..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageProcessorTask.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// PINRemoteImageProcessorTask.m -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageProcessorTask.h" - -@implementation PINRemoteImageProcessorTask - -@synthesize downloadTaskUUID = _downloadTaskUUID; - -- (BOOL)cancelWithUUID:(NSUUID *)UUID resume:(PINResume **)resume -{ - BOOL noMoreCompletions = [super cancelWithUUID:UUID resume:resume]; - [self.lock lockWithBlock:^{ - if (noMoreCompletions && self->_downloadTaskUUID) { - [self.manager cancelTaskWithUUID:self->_downloadTaskUUID]; - self->_downloadTaskUUID = nil; - } - }]; - return noMoreCompletions; -} - -- (void)setDownloadTaskUUID:(NSUUID *)downloadTaskUUID -{ - [self.lock lockWithBlock:^{ - NSAssert(self->_downloadTaskUUID == nil, @"downloadTaskUUID should be nil"); - self->_downloadTaskUUID = downloadTaskUUID; - }]; -} - -- (NSUUID *)downloadTaskUUID -{ - __block NSUUID *downloadTaskUUID; - [self.lock lockWithBlock:^{ - downloadTaskUUID = self->_downloadTaskUUID; - }]; - return downloadTaskUUID; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.h deleted file mode 100644 index 8026bfdf..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// PINRemoteImageTask.h -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import - -#if SWIFT_PACKAGE -@import PINOperation; -#else -#import -#endif - -#import "PINRemoteImageCallbacks.h" -#import "PINRemoteImageManager.h" -#import "PINRemoteImageMacros.h" -#import "PINRemoteLock.h" -#import "PINResume.h" - -@interface PINRemoteImageTask : NSObject - -@property (nonatomic, strong, readonly, nonnull) PINRemoteLock *lock; - -@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackBlocks; - -@property (nonatomic, weak, nullable) PINRemoteImageManager *manager; - -@property (nonatomic, strong, nullable) id retryStrategy; - -@property (nonatomic, copy, nullable) NSString *key; - -- (_Nonnull instancetype)init NS_UNAVAILABLE; -- (_Nonnull instancetype)initWithManager:(nonnull PINRemoteImageManager *)manager NS_DESIGNATED_INITIALIZER; - -- (void)addCallbacksWithCompletionBlock:(nonnull PINRemoteImageManagerImageCompletion)completionBlock - progressImageBlock:(nullable PINRemoteImageManagerImageCompletion)progressImageBlock - progressDownloadBlock:(nullable PINRemoteImageManagerProgressDownload)progressDownloadBlock - withUUID:(nonnull NSUUID *)UUID; - -- (void)removeCallbackWithUUID:(nonnull NSUUID *)UUID; - -- (void)callCompletionsWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - cached:(BOOL)cached - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error - remove:(BOOL)remove; - -//returns YES if no more attached completionBlocks -- (BOOL)cancelWithUUID:(nonnull NSUUID *)UUID resume:(PINResume * _Nullable * _Nullable)resume; - -- (void)setPriority:(PINRemoteImageManagerPriority)priority; - -- (nonnull PINRemoteImageManagerResult *)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.m deleted file mode 100644 index 043a6280..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteImageTask.m +++ /dev/null @@ -1,160 +0,0 @@ -// -// PINRemoteImageTask.m -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import "PINRemoteImageTask.h" - -#import "PINRemoteImageCallbacks.h" -#import "PINRemoteImageManager+Private.h" - -@interface PINRemoteImageTask () -{ - NSMutableDictionary *_callbackBlocks; // We need to copy/retain `NSUUID`, because `PINRemoteImageManager` has a weak table `UUIDs` to store all UUIDs. -} - -@end - -@implementation PINRemoteImageTask - -@synthesize lock = _lock; - -- (instancetype)initWithManager:(PINRemoteImageManager *)manager -{ - if (self = [super init]) { - _lock = [[PINRemoteLock alloc] initWithName:@"Task Lock"]; - _manager = manager; - _callbackBlocks = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<%@: %p> completionBlocks: %lu", NSStringFromClass([self class]), self, (unsigned long)self.callbackBlocks.count]; -} - -- (void)addCallbacksWithCompletionBlock:(PINRemoteImageManagerImageCompletion)completionBlock - progressImageBlock:(PINRemoteImageManagerImageCompletion)progressImageBlock - progressDownloadBlock:(PINRemoteImageManagerProgressDownload)progressDownloadBlock - withUUID:(NSUUID *)UUID -{ - PINRemoteImageCallbacks *completion = [[PINRemoteImageCallbacks alloc] init]; - completion.completionBlock = completionBlock; - completion.progressImageBlock = progressImageBlock; - completion.progressDownloadBlock = progressDownloadBlock; - - [self.lock lockWithBlock:^{ - [self->_callbackBlocks setObject:completion forKey:UUID]; - }]; -} - -- (void)removeCallbackWithUUID:(NSUUID *)UUID -{ - [self.lock lockWithBlock:^{ - [self l_removeCallbackWithUUID:UUID]; - }]; -} - -- (void)l_removeCallbackWithUUID:(NSUUID *)UUID -{ - [_callbackBlocks removeObjectForKey:UUID]; -} - -- (NSDictionary *)callbackBlocks -{ - __block NSDictionary *callbackBlocks; - [self.lock lockWithBlock:^{ - callbackBlocks = [self->_callbackBlocks copy]; - }]; - return callbackBlocks; -} - -- (void)callCompletionsWithImage:(PINImage *)image - alternativeRepresentation:(id)alternativeRepresentation - cached:(BOOL)cached - response:(NSURLResponse *)response - error:(NSError *)error - remove:(BOOL)remove; -{ - __weak typeof(self) weakSelf = self; - [self.callbackBlocks enumerateKeysAndObjectsUsingBlock:^(NSUUID *UUID, PINRemoteImageCallbacks *callback, BOOL *stop) { - typeof(self) strongSelf = weakSelf; - PINRemoteImageManagerImageCompletion completionBlock = callback.completionBlock; - if (completionBlock != nil) { - PINLog(@"calling completion for UUID: %@ key: %@", UUID, strongSelf.key); - CFTimeInterval requestTime = callback.requestTime; - - dispatch_async(self.manager.callbackQueue, ^ - { - PINRemoteImageResultType result; - if (image || alternativeRepresentation) { - result = cached ? PINRemoteImageResultTypeCache : PINRemoteImageResultTypeDownload; - } else { - result = PINRemoteImageResultTypeNone; - } - completionBlock([self imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:CACurrentMediaTime() - requestTime - resultType:result - UUID:UUID - response:response - error:error]); - }); - } - if (remove) { - [strongSelf removeCallbackWithUUID:UUID]; - } - }]; -} - -- (BOOL)cancelWithUUID:(NSUUID *)UUID resume:(PINResume **)resume -{ - __block BOOL noMoreCompletions; - [self.lock lockWithBlock:^{ - noMoreCompletions = [self l_cancelWithUUID:UUID]; - }]; - return noMoreCompletions; -} - -- (BOOL)l_cancelWithUUID:(NSUUID *)UUID -{ - BOOL noMoreCompletions = NO; - [self l_removeCallbackWithUUID:UUID]; - if ([_callbackBlocks count] == 0) { - noMoreCompletions = YES; - } - return noMoreCompletions; -} - -- (void)setPriority:(PINRemoteImageManagerPriority)priority -{ - -} - -- (nonnull PINRemoteImageManagerResult *)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)UUID - response:(NSURLResponse *)response - error:(nullable NSError *)error -{ - return [PINRemoteImageManagerResult imageResultWithImage:image - alternativeRepresentation:alternativeRepresentation - requestLength:requestLength - resultType:resultType - UUID:UUID - response:response - error:error]; -} - -- (NSMutableDictionary *)l_callbackBlocks -{ - return _callbackBlocks; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.h deleted file mode 100644 index 1ca84889..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PINRemoteLock.h -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import - -/** The type of lock, either recursive or non-recursive */ -typedef NS_ENUM(NSUInteger, PINRemoteLockType) { - /** A non-recursive version of the lock. The default. */ - PINRemoteLockTypeNonRecursive = 0, - /** A recursive version of the lock. More expensive. */ - PINRemoteLockTypeRecursive, -}; - -@interface PINRemoteLock : NSObject - -- (instancetype)initWithName:(NSString *)lockName lockType:(PINRemoteLockType)lockType NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithName:(NSString *)lockName; -- (void)lockWithBlock:(dispatch_block_t)block; - -- (void)lock; -- (void)unlock; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.m deleted file mode 100644 index 6cf74d62..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteLock.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// PINRemoteLock.m -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import "PINRemoteLock.h" - -#import - -#if !defined(PINREMOTELOCK_DEBUG) && defined(DEBUG) -#define PINREMOTELOCK_DEBUG DEBUG -#endif - -@interface PINRemoteLock () -{ -#if PINREMOTELOCK_DEBUG - NSLock *_lock; - NSRecursiveLock *_recursiveLock; -#else - pthread_mutex_t _lock; -#endif -} - -@end - -@implementation PINRemoteLock - -- (instancetype)init -{ - return [self initWithName:nil]; -} - -- (instancetype)initWithName:(NSString *)lockName lockType:(PINRemoteLockType)lockType -{ - if (self = [super init]) { -#if PINREMOTELOCK_DEBUG - if (lockType == PINRemoteLockTypeNonRecursive) { - _lock = [[NSLock alloc] init]; - } else { - _recursiveLock = [[NSRecursiveLock alloc] init]; - } - - if (lockName) { - [_lock setName:lockName]; - [_recursiveLock setName:lockName]; - } -#else - pthread_mutexattr_t attr; - - pthread_mutexattr_init(&attr); - if (lockType == PINRemoteLockTypeRecursive) { - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - } - pthread_mutex_init(&_lock, &attr); -#endif - } - return self; -} - -- (instancetype)initWithName:(NSString *)lockName -{ - return [self initWithName:lockName lockType:PINRemoteLockTypeNonRecursive]; -} - -#if ! PINREMOTELOCK_DEBUG -- (void)dealloc -{ - pthread_mutex_destroy(&_lock); -} -#endif - -- (void)lockWithBlock:(dispatch_block_t)block -{ -#if PINREMOTELOCK_DEBUG - [_lock lock]; - [_recursiveLock lock]; -#else - pthread_mutex_lock(&_lock); -#endif - block(); -#if PINREMOTELOCK_DEBUG - [_lock unlock]; - [_recursiveLock unlock]; -#else - pthread_mutex_unlock(&_lock); -#endif -} - -- (void)lock -{ -#if PINREMOTELOCK_DEBUG - [_lock lock]; - [_recursiveLock lock]; -#else - pthread_mutex_lock(&_lock); -#endif -} - -- (void)unlock -{ -#if PINREMOTELOCK_DEBUG - [_lock unlock]; - [_recursiveLock unlock]; -#else - pthread_mutex_unlock(&_lock); -#endif -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.h b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.h deleted file mode 100644 index b0abc22e..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// PINRemoteWeakProxy.h -// PINRemoteImage -// -// Created by Garrett Moon on 4/24/18. -// Copyright © 2018 Pinterest. All rights reserved. -// - -#import - -@interface PINRemoteWeakProxy : NSProxy - -+ (PINRemoteWeakProxy *)weakProxyWithTarget:(id)target; -- (instancetype)initWithTarget:(id)target; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.m deleted file mode 100644 index a7049328..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRemoteWeakProxy.m +++ /dev/null @@ -1,59 +0,0 @@ -// -// PINRemoteWeakProxy.m -// PINRemoteImage -// -// Created by Garrett Moon on 4/24/18. -// Copyright © 2018 Pinterest. All rights reserved. -// - -#import "PINRemoteWeakProxy.h" - -@interface PINRemoteWeakProxy () -{ - __weak id _target; - Class _targetClass; -} -@end - -@implementation PINRemoteWeakProxy - -+ (PINRemoteWeakProxy *)weakProxyWithTarget:(id)target -{ - return [[PINRemoteWeakProxy alloc] initWithTarget:target]; -} - -- (instancetype)initWithTarget:(id)target -{ - if (self) { - _target = target; - _targetClass = [target class]; - } - return self; -} - -- (BOOL)respondsToSelector:(SEL)aSelector -{ - return [_target respondsToSelector:aSelector]; -} - -- (BOOL)conformsToProtocol:(Protocol *)aProtocol -{ - return [_target conformsToProtocol:aProtocol]; -} - -- (id)forwardingTargetForSelector:(SEL)aSelector -{ - return _target; -} - -- (void)forwardInvocation:(NSInvocation *)invocation -{ - // Drop it since we shouldn't get here if _target is nil -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel -{ - return _target ? [_target methodSignatureForSelector:sel] : [_targetClass instanceMethodSignatureForSelector:sel]; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINRequestRetryStrategy.m b/Example/Pods/PINRemoteImage/Source/Classes/PINRequestRetryStrategy.m deleted file mode 100644 index 92d6ecf5..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINRequestRetryStrategy.m +++ /dev/null @@ -1,69 +0,0 @@ -// -// PINRequestRetryStrategy.m -// Pods -// -// Created by Hovhannes Safaryan on 9/24/16. -// -// - -#import "PINRequestRetryStrategy.h" -#import "PINURLSessionManager.h" -#import "PINRemoteImageManager.h" - -@interface PINRequestExponentialRetryStrategy () - -@property (nonatomic, assign) int retryMaxCount; -@property (nonatomic, assign) int retryCount; -@property (nonatomic, assign) int delayBase; - -@end - -@implementation PINRequestExponentialRetryStrategy - -- (instancetype)initWithRetryMaxCount:(int)retryMaxCount delayBase:(int)delayBase -{ - if (self = [super init]) { - _retryCount = 0; - _retryMaxCount = retryMaxCount; - _delayBase = delayBase; - } - return self; -} - -- (int)numberOfRetries -{ - return self.retryCount; -} - -- (BOOL)shouldRetryWithError:(NSError *)error -{ - if (error == nil || ![[self class] retriableError:error] || - self.retryCount >= self.retryMaxCount) { - return NO; - } - return YES; -} - -- (int)nextDelay -{ - return powf(self.delayBase, self.retryCount); -} - -- (void)incrementRetryCount -{ - self.retryCount++; -} - -+ (BOOL)retriableError:(NSError *)remoteImageError -{ - if ([remoteImageError.domain isEqualToString:PINURLErrorDomain]) { - return remoteImageError.code >= 500; - } else if ([remoteImageError.domain isEqualToString:NSURLErrorDomain] && remoteImageError.code == NSURLErrorUnsupportedURL) { - return NO; - } else if ([remoteImageError.domain isEqualToString:PINRemoteImageManagerErrorDomain]) { - return NO; - } - return YES; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINResume.h b/Example/Pods/PINRemoteImage/Source/Classes/PINResume.h deleted file mode 100644 index 7ff2b53b..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINResume.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// PINResume.h -// PINRemoteImage -// -// Created by Garrett Moon on 3/10/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface PINResume : NSObject - -- (id)init NS_UNAVAILABLE; -+ (PINResume *)resumeData:(NSData *)resumeData ifRange:(NSString *)ifRange totalBytes:(long long)totalBytes; - -@property (nonatomic, strong, readonly) NSData *resumeData; -@property (nonatomic, copy, readonly) NSString *ifRange; -@property (nonatomic, assign, readonly) long long totalBytes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINResume.m b/Example/Pods/PINRemoteImage/Source/Classes/PINResume.m deleted file mode 100644 index cfcbd165..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINResume.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// PINResume.m -// PINRemoteImage -// -// Created by Garrett Moon on 3/10/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINResume.h" - -@implementation PINResume - -NSString * const kResumeDataKey = @"kResumeDataKey"; -NSString * const kIfRangeKey = @"kIfRangeKey"; -NSString * const kTotalBytesKey = @"kTotalBytesKey"; - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if (self = [super init]) { - _resumeData = [aDecoder decodeObjectForKey:kResumeDataKey]; - _ifRange = [aDecoder decodeObjectForKey:kIfRangeKey]; - _totalBytes = [aDecoder decodeInt64ForKey:kTotalBytesKey]; - } - return self; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:_resumeData forKey:kResumeDataKey]; - [aCoder encodeObject:_ifRange forKey:kIfRangeKey]; - [aCoder encodeInt64:_totalBytes forKey:kTotalBytesKey]; -} - -+ (PINResume *)resumeData:(NSData *)resumeData ifRange:(NSString *)ifRange totalBytes:(long long)totalBytes -{ - PINResume *resume = [[PINResume alloc] initWithResumeData:resumeData ifRange:ifRange totalBytes:totalBytes]; - return resume; -} - -- (PINResume *)initWithResumeData:(NSData *)resumeData ifRange:(NSString *)ifRange totalBytes:(long long)totalBytes -{ - if (self = [super init]) { - NSAssert(resumeData.length > 0 && ifRange.length > 0 && totalBytes > 0, @"PINResume must have all fields non-nil and non-zero length."); - _resumeData = resumeData; - _ifRange = ifRange; - _totalBytes = totalBytes; - } - return self; -} - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.h b/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.h deleted file mode 100644 index bee58138..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// PINSpeedRecorder.h -// PINRemoteImage -// -// Created by Garrett Moon on 8/30/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -typedef enum : NSUInteger { - PINSpeedRecorderConnectionStatusNotReachable, - PINSpeedRecorderConnectionStatusWWAN, - PINSpeedRecorderConnectionStatusWiFi -} PINSpeedRecorderConnectionStatus; - -@interface PINSpeedRecorder : NSObject - -+ (PINSpeedRecorder *)sharedRecorder; -+ (NSUInteger)appropriateImageIdxForURLsGivenHistoricalNetworkConditions:(NSArray *)urls - lowQualityQPSThreshold:(float)lowQualityQPSThreshold - highQualityQPSThreshold:(float)highQualityQPSThreshold; - -- (void)processMetrics:(NSURLSessionTaskMetrics *)metrics forTask:(NSURLSessionTask *)task API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); - -/* - Returns a weighted average of the bytes per second of a transfer with the time to first byte subtracted. - More specifically, we get the time to first byte for every task that completes, - subtract it from the total transfer time, calculate bytes per second - and add it to an existing average using exponential weighted average and adjusting - for starting bias. - This is all done on a per host basis. - */ -- (float)weightedAdjustedBytesPerSecondForHost:(NSString *)host; - -/* - Returns a weighted average of time to first byte for the specified host. - More specifically, we get the time to first byte for every task that completes - and add it to an existing average using exponential weighted average and adjusting - for starting bias. - This is all done on a per host basis. - */ -- (NSTimeInterval)weightedTimeToFirstByteForHost:(NSString *)host; - -- (PINSpeedRecorderConnectionStatus)connectionStatus; - -#if DEBUG -- (void)setCurrentBytesPerSecond:(float)currentBPS; -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.m b/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.m deleted file mode 100644 index 8e02fb26..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINSpeedRecorder.m +++ /dev/null @@ -1,265 +0,0 @@ -// -// PINSpeedRecorder.m -// PINRemoteImage -// -// Created by Garrett Moon on 8/30/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import "PINSpeedRecorder.h" - -#import -#import - -#import "PINRemoteLock.h" - -@interface PINSpeedMeasurement : NSObject - -// Storing the count of each measurement allows for bias adjustment in exponentially -// weighted average. -@property (nonatomic, assign) NSUInteger count; -@property (nonatomic, assign) float bytesPerSecond; -@property (nonatomic, assign) float startAdjustedBytesPerSecond; -@property (nonatomic, assign) CFTimeInterval timeToFirstByte; - -@end - -@interface PINSpeedRecorder () -{ - NSCache *_speedMeasurements; - SCNetworkReachabilityRef _reachability; -#if DEBUG - BOOL _overrideBPS; - float _currentBPS; -#endif -} - -@property (nonatomic, strong) PINRemoteLock *lock; - -@end - -@implementation PINSpeedRecorder - -+ (PINSpeedRecorder *)sharedRecorder -{ - static dispatch_once_t onceToken; - static PINSpeedRecorder *sharedRecorder; - dispatch_once(&onceToken, ^{ - sharedRecorder = [[self alloc] init]; - }); - - return sharedRecorder; -} - -- (instancetype)init -{ - if (self = [super init]) { - _lock = [[PINRemoteLock alloc] initWithName:@"PINSpeedRecorder lock"]; - _speedMeasurements = [[NSCache alloc] init]; - _speedMeasurements.countLimit = 25; - - struct sockaddr_in zeroAddress; - bzero(&zeroAddress, sizeof(zeroAddress)); - zeroAddress.sin_len = sizeof(zeroAddress); - zeroAddress.sin_family = AF_INET; - _reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)&zeroAddress); - } - return self; -} - -- (void)processMetrics:(NSURLSessionTaskMetrics *)metrics forTask:(NSURLSessionTask *)task -{ - NSDate *requestStart = [NSDate distantFuture]; - NSDate *firstByte = [NSDate distantFuture]; - NSDate *requestEnd = [NSDate distantPast]; - int64_t contentLength = task.countOfBytesReceived; - - for (NSURLSessionTaskTransactionMetrics *metric in metrics.transactionMetrics) { - if (metric.requestStartDate == nil || metric.responseStartDate == nil) { - //Only evaluate requests which completed their first byte. - return; - } - - requestStart = [requestStart earlierDate:metric.requestStartDate]; - firstByte = [firstByte earlierDate:metric.responseStartDate]; - requestEnd = [requestEnd laterDate:metric.responseEndDate]; - } - - if ([requestStart isEqual:[NSDate distantFuture]] || [firstByte isEqual:[NSDate distantFuture]] || [requestEnd isEqual:[NSDate distantPast]] || contentLength == 0) { - return; - } - - [self updateSpeedsForHost:task.currentRequest.URL.host - bytesPerSecond:contentLength / [requestEnd timeIntervalSinceDate:requestStart] - startAdjustedBytesPerSecond:contentLength / [requestEnd timeIntervalSinceDate:firstByte] - timeToFirstByte:[firstByte timeIntervalSinceDate:requestStart]]; -} - -- (void)resetMeasurements -{ - [self.lock lockWithBlock:^{ - [self->_speedMeasurements removeAllObjects]; - }]; -} - -- (void)updateSpeedsForHost:(NSString *)host bytesPerSecond:(float)bytesPerSecond startAdjustedBytesPerSecond:(float)startAdjustedBytesPerSecond timeToFirstByte:(float)timeToFirstByte -{ - [self.lock lockWithBlock:^{ - PINSpeedMeasurement *measurement = [self->_speedMeasurements objectForKey:host]; - if (measurement == nil) { - measurement = [[PINSpeedMeasurement alloc] init]; - measurement.count = 0; - measurement.bytesPerSecond = bytesPerSecond; - measurement.startAdjustedBytesPerSecond = startAdjustedBytesPerSecond; - measurement.timeToFirstByte = timeToFirstByte; - [self->_speedMeasurements setObject:measurement forKey:host]; - } else { - const double bpsBeta = 0.8; - const double ttfbBeta = 0.8; - measurement.count++; - measurement.bytesPerSecond = (measurement.bytesPerSecond * bpsBeta) + ((1.0 - bpsBeta) * bytesPerSecond); - measurement.startAdjustedBytesPerSecond = (measurement.startAdjustedBytesPerSecond * bpsBeta) + ((1.0 - bpsBeta) * startAdjustedBytesPerSecond); - measurement.timeToFirstByte = (measurement.timeToFirstByte * ttfbBeta) + ((1.0 - ttfbBeta) * timeToFirstByte); - } - }]; -} - -- (float)weightedAdjustedBytesPerSecondForHost:(NSString *)host -{ - __block float startAdjustedBytesPerSecond = -1; - [self.lock lockWithBlock:^{ -#if DEBUG - if (self->_overrideBPS) { - startAdjustedBytesPerSecond = self->_currentBPS; - return; - } -#endif - PINSpeedMeasurement *measurement = [self->_speedMeasurements objectForKey:host]; - if (measurement == 0) { - startAdjustedBytesPerSecond = -1; - return; - } - startAdjustedBytesPerSecond = measurement.startAdjustedBytesPerSecond; - }]; - return startAdjustedBytesPerSecond; -} - -- (NSTimeInterval)weightedTimeToFirstByteForHost:(NSString *)host -{ - __block NSTimeInterval timeToFirstByte = 0; - [self.lock lockWithBlock:^{ - PINSpeedMeasurement *measurement = [self->_speedMeasurements objectForKey:host]; - timeToFirstByte = measurement.timeToFirstByte; - }]; - return timeToFirstByte; -} - -#if DEBUG -- (void)setCurrentBytesPerSecond:(float)currentBPS -{ - [self.lock lockWithBlock:^{ - if (currentBPS == -1) { - self->_overrideBPS = NO; - } else { - self->_overrideBPS = YES; - } - self->_currentBPS = currentBPS; - }]; -} -#endif - -// Cribbed from Apple's reachability: https://developer.apple.com/library/content/samplecode/Reachability/Listings/Reachability_Reachability_m.html#//apple_ref/doc/uid/DTS40007324-Reachability_Reachability_m-DontLinkElementID_9 - -- (PINSpeedRecorderConnectionStatus)connectionStatus -{ - PINSpeedRecorderConnectionStatus status = PINSpeedRecorderConnectionStatusNotReachable; - SCNetworkReachabilityFlags flags; - - // _reachability is set on init and therefore safe to access outside the lock - if (SCNetworkReachabilityGetFlags(_reachability, &flags)) { - return [self networkStatusForFlags:flags]; - } - return status; -} - -- (PINSpeedRecorderConnectionStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags -{ - if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) { - // The target host is not reachable. - return PINSpeedRecorderConnectionStatusNotReachable; - } - - PINSpeedRecorderConnectionStatus connectionStatus = PINSpeedRecorderConnectionStatusNotReachable; - - if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) { - /* - If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi... - */ - connectionStatus = PINSpeedRecorderConnectionStatusWiFi; - } - - if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)) { - /* - ... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs... - */ - - if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) { - /* - ... and no [user] intervention is needed... - */ - connectionStatus = PINSpeedRecorderConnectionStatusWiFi; - } - } - -#if PIN_TARGET_IOS - if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) { - /* - ... but WWAN connections are OK if the calling application is using the CFNetwork APIs. - */ - connectionStatus = PINSpeedRecorderConnectionStatusWWAN; - } -#endif - - return connectionStatus; -} - -+ (NSUInteger)appropriateImageIdxForURLsGivenHistoricalNetworkConditions:(NSArray *)urls - lowQualityQPSThreshold:(float)lowQualityQPSThreshold - highQualityQPSThreshold:(float)highQualityQPSThreshold -{ - float currentBytesPerSecond = [[PINSpeedRecorder sharedRecorder] weightedAdjustedBytesPerSecondForHost:[[urls firstObject] host]]; - - NSUInteger desiredImageURLIdx; - - if (currentBytesPerSecond == -1) { - // Base it on reachability - switch ([[PINSpeedRecorder sharedRecorder] connectionStatus]) { - case PINSpeedRecorderConnectionStatusWiFi: - desiredImageURLIdx = urls.count - 1; - break; - - case PINSpeedRecorderConnectionStatusWWAN: - case PINSpeedRecorderConnectionStatusNotReachable: - desiredImageURLIdx = 0; - break; - } - } else { - if (currentBytesPerSecond >= highQualityQPSThreshold) { - desiredImageURLIdx = urls.count - 1; - } else if (currentBytesPerSecond <= lowQualityQPSThreshold) { - desiredImageURLIdx = 0; - } else if (urls.count == 2) { - desiredImageURLIdx = roundf((currentBytesPerSecond - lowQualityQPSThreshold) / ((highQualityQPSThreshold - lowQualityQPSThreshold) / (float)(urls.count - 1))); - } else { - desiredImageURLIdx = ceilf((currentBytesPerSecond - lowQualityQPSThreshold) / ((highQualityQPSThreshold - lowQualityQPSThreshold) / (float)(urls.count - 2))); - } - } - - return desiredImageURLIdx; -} - -@end - -@implementation PINSpeedMeasurement - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/PINURLSessionManager.m b/Example/Pods/PINRemoteImage/Source/Classes/PINURLSessionManager.m deleted file mode 100644 index e83601cb..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/PINURLSessionManager.m +++ /dev/null @@ -1,263 +0,0 @@ -// -// PINURLSessionManager.m -// Pods -// -// Created by Garrett Moon on 6/26/15. -// -// - -#import "PINURLSessionManager.h" - -#import "PINSpeedRecorder.h" - -NSErrorDomain const PINURLErrorDomain = @"PINURLErrorDomain"; - -@interface PINURLSessionManager () - -@property (nonatomic, strong) NSLock *sessionManagerLock; -@property (nonatomic, strong) NSURLSession *session; -@property (nonatomic, strong) NSOperationQueue *operationQueue; -@property (nonatomic, strong) NSMutableDictionary *delegateQueues; -@property (nonatomic, strong) NSMutableDictionary *completions; - -@end - -@implementation PINURLSessionManager - -- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration -{ - if (self = [super init]) { - self.sessionManagerLock = [[NSLock alloc] init]; - self.sessionManagerLock.name = @"PINURLSessionManager"; - self.operationQueue = [[NSOperationQueue alloc] init]; - self.operationQueue.name = @"PINURLSessionManager Operation Queue"; - - //queue must be serial to ensure proper ordering - [self.operationQueue setMaxConcurrentOperationCount:1]; - self.session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:self.operationQueue]; - self.completions = [[NSMutableDictionary alloc] init]; - self.delegateQueues = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (void)invalidateSessionAndCancelTasks -{ - [self lock]; - [self.session invalidateAndCancel]; - [self unlock]; -} - -- (nonnull NSURLSessionDataTask *)dataTaskWithRequest:(nonnull NSURLRequest *)request - completionHandler:(nonnull PINURLSessionDataTaskCompletion)completionHandler -{ - return [self dataTaskWithRequest:request - priority:PINRemoteImageManagerPriorityDefault - completionHandler:completionHandler]; -} - -- (nonnull NSURLSessionDataTask *)dataTaskWithRequest:(nonnull NSURLRequest *)request - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(nonnull PINURLSessionDataTaskCompletion)completionHandler -{ - [self lock]; - NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:request]; - if (@available(iOS 8.0, macOS 10.10, tvOS 9.0, watchOS 2.0, *)) { - dataTask.priority = dataTaskPriorityWithImageManagerPriority(priority); - } - if (completionHandler) { - [self.completions setObject:completionHandler forKey:@(dataTask.taskIdentifier)]; - } - NSString *queueName = [NSString stringWithFormat:@"PINURLSessionManager delegate queue - %ld", (unsigned long)dataTask.taskIdentifier]; - dispatch_queue_t delegateQueue = dispatch_queue_create([queueName UTF8String], DISPATCH_QUEUE_SERIAL); - [self.delegateQueues setObject:delegateQueue forKey:@(dataTask.taskIdentifier)]; - [self unlock]; - return dataTask; -} - -- (void)lock -{ - [self.sessionManagerLock lock]; -} - -- (void)unlock -{ - [self.sessionManagerLock unlock]; -} - -#pragma mark NSURLSessionDataDelegate - -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)task didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler -{ - [self lock]; - dispatch_queue_t delegateQueue = self.delegateQueues[@(task.taskIdentifier)]; - [self unlock]; - - NSAssert(delegateQueue != nil, @"There seems to be an issue in iOS 9 where this can be nil. If you can reliably reproduce hitting this, *please* open an issue: https://github.com/pinterest/PINRemoteImage/issues"); - if (delegateQueue == nil) { - return; - } - - __weak typeof(self) weakSelf = self; - dispatch_async(delegateQueue, ^{ - typeof(self) strongSelf = weakSelf; - if ([strongSelf.delegate respondsToSelector:@selector(didReceiveResponse:forTask:)]) { - [strongSelf.delegate didReceiveResponse:response forTask:task]; - } - }); - //Even though this is documented to be non-nil, in the wild it sometimes is. - if (completionHandler) { - completionHandler(NSURLSessionResponseAllow); - } -} - -- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler -{ - if ([self.delegate respondsToSelector:@selector(didReceiveAuthenticationChallenge:forTask:completionHandler:)]) { - [self.delegate didReceiveAuthenticationChallenge:challenge forTask:nil completionHandler:completionHandler]; - } else { - //Even though this is documented to be non-nil, in the wild it sometimes is. - if (completionHandler) { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); - } - } -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler -{ - [self lock]; - dispatch_queue_t delegateQueue = self.delegateQueues[@(task.taskIdentifier)]; - [self unlock]; - - NSAssert(delegateQueue != nil, @"There seems to be an issue in iOS 9 where this can be nil. If you can reliably reproduce hitting this, *please* open an issue: https://github.com/pinterest/PINRemoteImage/issues"); - if (delegateQueue == nil) { - return; - } - - __weak typeof(self) weakSelf = self; - dispatch_async(delegateQueue, ^{ - typeof(self) strongSelf = weakSelf; - if ([strongSelf.delegate respondsToSelector:@selector(didReceiveAuthenticationChallenge:forTask:completionHandler:)]) { - [strongSelf.delegate didReceiveAuthenticationChallenge:challenge forTask:task completionHandler:completionHandler]; - } else { - //Even though this is documented to be non-nil, in the wild it sometimes is - if (completionHandler) { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); - } - } - }); -} - -- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)task didReceiveData:(NSData *)data -{ - [self lock]; - dispatch_queue_t delegateQueue = self.delegateQueues[@(task.taskIdentifier)]; - [self unlock]; - - NSAssert(delegateQueue != nil, @"There seems to be an issue in iOS 9 where this can be nil. If you can reliably reproduce hitting this, *please* open an issue: https://github.com/pinterest/PINRemoteImage/issues"); - if (delegateQueue == nil) { - return; - } - - __weak typeof(self) weakSelf = self; - dispatch_async(delegateQueue, ^{ - typeof(self) strongSelf = weakSelf; - [strongSelf.delegate didReceiveData:data forTask:task]; - }); -} - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error -{ - [self lock]; - dispatch_queue_t delegateQueue = self.delegateQueues[@(task.taskIdentifier)]; - [self unlock]; - - NSAssert(delegateQueue != nil, @"There seems to be an issue in iOS 9 where this can be nil. If you can reliably reproduce hitting this, *please* open an issue: https://github.com/pinterest/PINRemoteImage/issues"); - if (delegateQueue == nil) { - return; - } - - if (!error && [task.response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; - NSInteger statusCode = [response statusCode]; - //If a 404 response contains an image, we treat it as a successful request and return the image - BOOL recoverable = [self responseRecoverableFrom404:response]; - if (statusCode >= 400 && recoverable == NO) { - error = [NSError errorWithDomain:PINURLErrorDomain - code:statusCode - userInfo:@{NSLocalizedDescriptionKey : @"HTTP Error Response."}]; - } - } - __weak typeof(self) weakSelf = self; - dispatch_async(delegateQueue, ^{ - typeof(self) strongSelf = weakSelf; - - [strongSelf lock]; - PINURLSessionDataTaskCompletion completionHandler = strongSelf.completions[@(task.taskIdentifier)]; - [strongSelf.completions removeObjectForKey:@(task.taskIdentifier)]; - [strongSelf.delegateQueues removeObjectForKey:@(task.taskIdentifier)]; - [strongSelf unlock]; - - if (completionHandler) { - completionHandler(task, error); - } - - if ([strongSelf.delegate respondsToSelector:@selector(didCompleteTask:withError:)]) { - [strongSelf.delegate didCompleteTask:task withError:error]; - } - }); -} - -#pragma mark - session statistics - -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics -{ - if (@available(iOS 10.0, macOS 10.12, *)) { - [[PINSpeedRecorder sharedRecorder] processMetrics:metrics forTask:task]; - - [self lock]; - dispatch_queue_t delegateQueue = self.delegateQueues[@(task.taskIdentifier)]; - [self unlock]; - - NSAssert(delegateQueue != nil, @"There seems to be an issue in iOS 9 where this can be nil. If you can reliably reproduce hitting this, *please* open an issue: https://github.com/pinterest/PINRemoteImage/issues"); - if (delegateQueue == nil) { - return; - } - - __weak typeof(self) weakSelf = self; - dispatch_async(delegateQueue, ^{ - typeof(self) strongSelf = weakSelf; - if ([strongSelf.delegate respondsToSelector:@selector(didCollectMetrics:forURL:)]) { - [strongSelf.delegate didCollectMetrics:metrics forURL:task.originalRequest.URL]; - } - }); - } -} - -- (BOOL)responseRecoverableFrom404:(NSHTTPURLResponse*)response -{ - return response.statusCode == 404 - && [response.allHeaderFields[@"content-type"] rangeOfString:@"image"].location != NSNotFound; -} - -#if DEBUG -- (void)concurrentDownloads:(void (^_Nullable)(NSUInteger concurrentDownloads))concurrentDownloadsCompletion -{ - if (@available(macos 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)) { - [self.session getAllTasksWithCompletionHandler:^(NSArray<__kindof NSURLSessionTask *> * _Nonnull tasks) { - concurrentDownloadsCompletion(tasks.count); - }]; - } else { - [self.session getTasksWithCompletionHandler:^(NSArray * _Nonnull dataTasks, - NSArray * _Nonnull uploadTasks, - NSArray * _Nonnull downloadTasks) { - NSUInteger total = dataTasks.count + uploadTasks.count + downloadTasks.count; - concurrentDownloadsCompletion(total); - }]; - } -} - -#endif - -@end - diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/NSData+ImageDetectors.h b/Example/Pods/PINRemoteImage/Source/Classes/include/NSData+ImageDetectors.h deleted file mode 100644 index b5d91d9f..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/NSData+ImageDetectors.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// NSData+ImageDetectors.h -// Pods -// -// Created by Garrett Moon on 11/19/14. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -@interface NSData (PINImageDetectors) - -- (BOOL)pin_isGIF; -- (BOOL)pin_isAnimatedGIF; -#if PIN_WEBP -- (BOOL)pin_isWebP; -- (BOOL)pin_isAnimatedWebP; -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAlternateRepresentationProvider.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINAlternateRepresentationProvider.h deleted file mode 100644 index d3506096..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAlternateRepresentationProvider.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// PINAlternateRepresentationProvider.h -// Pods -// -// Created by Garrett Moon on 3/17/16. -// -// - -#import - -#import "PINRemoteImageManager.h" - -@protocol PINRemoteImageManagerAlternateRepresentationProvider -@required - -/** - @discussion This method will be called with data off the wire or stored in the cache. Return an object to have it returned as the alternativeRepresentation object in the PINRemoteImageManagerResult. @warning this method can be called on the main thread, be careful of doing expensive work. - */ -- (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageManagerDownloadOptions)options; - -@end - -@interface PINAlternateRepresentationProvider : NSObject - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImage.h deleted file mode 100644 index 4f96b154..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImage.h +++ /dev/null @@ -1,165 +0,0 @@ -// -// PINAnimatedImage.h -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -extern NSErrorDomain const kPINAnimatedImageErrorDomain; - -/** - PINAnimatedImage decoding and processing errors. - */ -typedef NS_ERROR_ENUM(kPINAnimatedImageErrorDomain, PINAnimatedImageErrorCode) { - /** No error, yay! */ - PINAnimatedImageErrorNoError = 0, - /** Could not create a necessary file. */ - PINAnimatedImageErrorFileCreationError, - /** Could not get a file handle to the necessary file. */ - PINAnimatedImageErrorFileHandleError, - /** Could not decode the image. */ - PINAnimatedImageErrorImageFrameError, - /** Could not memory map the file. */ - PINAnimatedImageErrorMappingError, - /** File write error */ - PINAnimatedImageErrorFileWrite, -}; - -/** - The processing status of the animated image. - */ -typedef NS_ENUM(NSUInteger, PINAnimatedImageStatus) { - /** No work has been done. */ - PINAnimatedImageStatusUnprocessed = 0, - /** Info about the animated image and the cover image are available. */ - PINAnimatedImageStatusInfoProcessed, - /** At least one set of frames has been decoded to a file. It's safe to start playback. */ - PINAnimatedImageStatusFirstFileProcessed, - /** The entire animated image has been processed. */ - PINAnimatedImageStatusProcessed, - /** Processing was canceled. */ - PINAnimatedImageStatusCanceled, - /** There was an error in processing. */ - PINAnimatedImageStatusError, -}; - -extern const Float32 kPINAnimatedImageDefaultDuration; - -/** - Called when the cover image of an animatedImage is ready. - */ -typedef void(^PINAnimatedImageInfoReady)(PINImage * _Nonnull coverImage); - -@protocol PINAnimatedImage; - -@interface PINAnimatedImage : NSObject - -/** - @abstract The maximum number of frames per second supported. - */ -+ (NSInteger)maximumFramesPerSecond; - -/** - @abstract Return the duration at a given index. - - @warning *Must be overridden by subclass - */ -- (CFTimeInterval)durationAtIndex:(NSUInteger)index; - -/** - @abstract Return the total number of frames in the animated image. - - @warning *Must be overridden by subclass - */ -@property (nonatomic, readonly) size_t frameCount; - -/** - @abstract Return the total duration of the animated image's playback. - */ -@property (nonatomic, readonly) CFTimeInterval totalDuration; - -/** - The number of frames to play per second * display refresh rate (defined as 60 which appears to be true on iOS). You probably want to - set this value on a displayLink. - @warning Access to this property before status == PINAnimatedImageStatusInfoProcessed is undefined. - */ -@property (nonatomic, readonly) NSUInteger frameInterval; - -@end - -@protocol PINCachedAnimatedFrameProvider - -@required - -- (nullable CGImageRef)cachedFrameImageAtIndex:(NSUInteger)index; - -@end - -@protocol PINAnimatedImage - -/** - @abstract the underlying data of the animated image if available. - */ -@property (nonatomic, readonly) NSData *data; - -/** - @abstract the native width of the animated image. - */ -@property (nonatomic, readonly) uint32_t width; - -/** - @abstract the native height of the animated image. - */ -@property (nonatomic, readonly) uint32_t height; - -/** - @abstract number of bytes per frame. - */ -@property (nonatomic, readonly) uint32_t bytesPerFrame; - -/** - @abstract Return the total duration of the animated image's playback. - */ -@property (nonatomic, readonly) CFTimeInterval totalDuration; -/** - @abstract Return the interval at which playback should occur. Will be set to a CADisplayLink's frame interval. - */ -@property (nonatomic, readonly) NSUInteger frameInterval; -/** - @abstract Return the total number of loops the animated image should play or 0 to loop infinitely. - */ -@property (nonatomic, readonly) size_t loopCount; -/** - @abstract Return the total number of frames in the animated image. - */ -@property (nonatomic, readonly) size_t frameCount; -/** - @abstract Return any error that has occurred. Playback will be paused if this returns non-nil. - */ -@property (nonatomic, readonly, nullable) NSError *error; - -/** - @abstract Return the image at a given index. - */ -- (nullable CGImageRef)imageAtIndex:(NSUInteger)index cacheProvider:(nullable id)cacheProvider; -/** - - @abstract Return the duration at a given index. - */ -- (CFTimeInterval)durationAtIndex:(NSUInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView+PINRemoteImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView+PINRemoteImage.h deleted file mode 100644 index 9dbfbc96..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView+PINRemoteImage.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// PINAnimatedImageView+PINRemoteImage.h -// Pods -// -// Created by Garrett Moon on 4/19/18. -// - -#import "PINAnimatedImageView.h" - -#import "PINRemoteImageCategoryManager.h" - -@interface PINAnimatedImageView (PINRemoteImage) - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView.h deleted file mode 100644 index b224f025..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINAnimatedImageView.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PINAnimatedImageView.h -// Pods -// -// Created by Garrett Moon on 4/17/18. -// - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINCachedAnimatedImage.h" - -@interface PINAnimatedImageView : PINImageView - -- (nonnull instancetype)initWithAnimatedImage:(nonnull PINCachedAnimatedImage *)animatedImage NS_DESIGNATED_INITIALIZER; -- (nonnull instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER; -- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER; - -@property (nullable, nonatomic, strong) PINCachedAnimatedImage *animatedImage; -@property (nullable, nonatomic, strong) NSString *animatedImageRunLoopMode; -@property (nonatomic, assign, getter=isPlaybackPaused) BOOL playbackPaused; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINButton+PINRemoteImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINButton+PINRemoteImage.h deleted file mode 100644 index 1659db95..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINButton+PINRemoteImage.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// UIButton+PINRemoteImage.h -// Pods -// -// Created by Garrett Moon on 8/18/14. -// -// - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINRemoteImageManager.h" -#import "PINRemoteImageCategoryManager.h" - -@interface PINButton (PINRemoteImage) - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINCache+PINRemoteImageCaching.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINCache+PINRemoteImageCaching.h deleted file mode 100644 index f8a5eb13..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINCache+PINRemoteImageCaching.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// PINCache+PINRemoteImageCaching.h -// Pods -// -// Created by Aleksei Shevchenko on 7/28/16. -// -// - -#if SWIFT_PACKAGE -@import PINCache; -#else -#import -#endif - -#import "PINRemoteImageCaching.h" -#import "PINRemoteImageManager.h" - -@interface PINCache (PINRemoteImageCaching) - -@end - -@interface PINRemoteImageManager (PINCache) - -@property (nonatomic, nullable, readonly) PINCache *pinCache; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINCachedAnimatedImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINCachedAnimatedImage.h deleted file mode 100644 index b3b66815..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINCachedAnimatedImage.h +++ /dev/null @@ -1,83 +0,0 @@ -// -// PINCachedAnimatedImage.h -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -#import "PINRemoteImageMacros.h" -#import "PINAnimatedImage.h" - -@interface PINCachedAnimatedImage : NSObject - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithAnimatedImage:(id )animatedImage NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData; - -/** - @abstract A block which receives the cover image. Should be called when the objects cover image is ready. - */ -@property (nonatomic, readwrite) PINAnimatedImageInfoReady coverImageReadyCallback; - -/** - @abstract Return the objects's cover image. - */ -@property (nonatomic, readonly) PINImage *coverImage; -/** - @abstract Return a boolean to indicate that the cover image is ready. - */ -@property (nonatomic, readonly) BOOL coverImageReady; -/** - @abstract Return the total duration of the animated image's playback. - */ -@property (nonatomic, readonly) CFTimeInterval totalDuration; -/** - @abstract Return the interval at which playback should occur. Will be set to a CADisplayLink's frame interval. - */ -@property (nonatomic, readonly) NSUInteger frameInterval; -/** - @abstract Return the size of the underlying animated image. - */ -@property (nonatomic, readonly) CGSize size; -/** - @abstract Return the total number of loops the animated image should play or 0 to loop infinitely. - */ -@property (nonatomic, readonly) size_t loopCount; -/** - @abstract Return the total number of frames in the animated image. - */ -@property (nonatomic, readonly) size_t frameCount; -/** - @abstract Return the underlying data if available; - */ -@property (nonatomic, readonly) NSData *data; -/** - @abstract Return YES when playback is ready to occur. - */ -@property (nonatomic, readonly) BOOL playbackReady; -/** - @abstract Return any error that has occurred. Playback will be paused if this returns non-nil. - */ -@property (nonatomic, readonly) NSError *error; -/** - @abstract Should be called when playback is ready. - */ -@property (nonatomic, readwrite) dispatch_block_t playbackReadyCallback; - -/** - @abstract Return the image at a given index. - */ -- (CGImageRef)imageAtIndex:(NSUInteger)index; -/** - @abstract Return the duration at a given index. - */ -- (CFTimeInterval)durationAtIndex:(NSUInteger)index; -/** - @abstract Clear any cached data. Called when playback is paused. - */ -- (void)clearAnimatedImageCache; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINGIFAnimatedImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINGIFAnimatedImage.h deleted file mode 100644 index e106f9e4..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINGIFAnimatedImage.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// PINGIFAnimatedImage.h -// PINRemoteImage -// -// Created by Garrett Moon on 9/17/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import - -#import "PINAnimatedImage.h" - -@interface PINGIFAnimatedImage : PINAnimatedImage - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData NS_DESIGNATED_INITIALIZER; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINImageView+PINRemoteImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINImageView+PINRemoteImage.h deleted file mode 100644 index f5c4b7ed..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINImageView+PINRemoteImage.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// UIImageView+PINRemoteImage.h -// Pods -// -// Created by Garrett Moon on 8/17/14. -// -// - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINRemoteImageManager.h" -#import "PINRemoteImageCategoryManager.h" - -@interface PINImageView (PINRemoteImage) - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINProgressiveImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINProgressiveImage.h deleted file mode 100644 index 1c68b1a1..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINProgressiveImage.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// PINProgressiveImage.h -// Pods -// -// Created by Garrett Moon on 2/9/15. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -@class PINRemoteImageDownloadTask; - -/** An object which store the data of a downloading image and vends progressive scans **/ -@interface PINProgressiveImage : NSObject - -@property (atomic, copy, nonnull) NSArray *progressThresholds; -@property (atomic, assign) CFTimeInterval estimatedRemainingTimeThreshold; -@property (nonatomic, strong, readonly, nonnull) NSURLSessionDataTask * dataTask; -@property (nonatomic, readonly) CFTimeInterval estimatedRemainingTime; - -- (nonnull instancetype)init NS_UNAVAILABLE; -- (nonnull instancetype)initWithDataTask:(nonnull NSURLSessionDataTask *)dataTask; - -- (void)updateProgressiveImageWithData:(nonnull NSData *)data expectedNumberOfBytes:(int64_t)expectedNumberOfBytes isResume:(BOOL)isResume; - -/** - Returns the latest image based on thresholds, returns nil if no new image is generated. - - @param blurred A boolean to indicate if the image should be blurred. - @param maxProgressiveRenderSize The maximum dimensions at which to apply a blur. If an image exceeds either the height. - or width of this dimension, the image will *not* be blurred regardless of the blurred parameter. - @param renderedImageQuality Value between 0 and 1. Computed by dividing the received number of bytes by the expected number of bytes. - @return PINImage A progressive scan of the image or nil if a new one has not been generated. - */ -- (nullable PINImage *)currentImageBlurred:(BOOL)blurred maxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize renderedImageQuality:(nonnull out CGFloat *)renderedImageQuality; - -/** - Returns the current data for the image. - - @return NSData The current data for the image. - */ -- (nullable NSData *)data; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImage.h deleted file mode 100644 index 140e1430..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImage.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// PINRemoteImage.h -// -// Created by Garrett Moon on 8/17/14. -// -// - -#import "PINRemoteImageMacros.h" - -#if USE_PINCACHE - #import "PINCache+PINRemoteImageCaching.h" -#endif - -#import "NSData+ImageDetectors.h" -#import "PINAlternateRepresentationProvider.h" -#import "PINCachedAnimatedImage.h" -#import "PINGIFAnimatedImage.h" -#import "PINWebPAnimatedImage.h" -#import "PINRemoteImageManager.h" -#import "PINRemoteImageCategoryManager.h" -#import "PINRemoteImageManagerResult.h" -#import "PINRemoteImageCaching.h" -#import "PINProgressiveImage.h" -#import "PINURLSessionManager.h" -#import "PINRequestRetryStrategy.h" diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCaching.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCaching.h deleted file mode 100644 index bfafbdfc..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCaching.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// PINRemoteImageCaching.h -// Pods -// -// Created by Aleksei Shevchenko on 7/25/16. -// -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol PINRemoteImageCaching; -typedef void (^PINRemoteImageCachingObjectBlock)(id cache, NSString *key, id __nullable object); - -/** - * Image Cache is responsible for actual image caching. - */ -@protocol PINRemoteImageCaching - -//****************************************************************************************************** -// Memory cache methods -//****************************************************************************************************** -- (nullable id)objectFromMemoryForKey:(NSString *)key; -- (void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost; - -//****************************************************************************************************** -// Disk cache methods -//****************************************************************************************************** -- (nullable id)objectFromDiskForKey:(NSString *)key; -- (void)objectFromDiskForKey:(NSString *)key completion:(nullable PINRemoteImageCachingObjectBlock)completion; -- (void)setObjectOnDisk:(id)object forKey:(NSString *)key; - - -- (BOOL)objectExistsForKey:(NSString *)key; - -- (void)removeObjectForKey:(NSString *)key; -- (void)removeObjectForKey:(NSString *)key completion:(nullable PINRemoteImageCachingObjectBlock)completion; -- (void)removeAllObjects; - -@optional - -- (void)removeObjectForKeyFromMemory:(NSString *)key; -- (void)setObjectInMemory:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost withAgeLimit:(NSTimeInterval)ageLimit; -- (void)setObjectOnDisk:(id)object forKey:(NSString *)key withAgeLimit:(NSTimeInterval)ageLimit; -- (BOOL)memoryCacheIsTTLCache; -- (BOOL)diskCacheIsTTLCache; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCategoryManager.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCategoryManager.h deleted file mode 100644 index ec941242..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageCategoryManager.h +++ /dev/null @@ -1,230 +0,0 @@ -// -// PINRemoteImageCategory.h -// Pods -// -// Created by Garrett Moon on 11/4/14. -// -// - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINRemoteImageManager.h" - -@protocol PINRemoteImageCategory; - -/** - PINRemoteImageCategoryManager is a class that handles subclassing image display classes. PINImageView+PINRemoteImage, UIButton+PINRemoteImage, etc, all delegate their work to this class. If you'd like to create a category to display an image on a view, you should mimic one of the above categories. - */ - -@interface PINRemoteImageCategoryManager : NSObject - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - placeholderImage:(nullable PINImage *)placeholderImage; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - placeholderImage:(nullable PINImage *)placeholderImage - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - placeholderImage:(nullable PINImage *)placeholderImage - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor; - -+ (void)setImageOnView:(nonnull id )view - fromURL:(nullable NSURL *)url - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -+ (void)setImageOnView:(nonnull id )view - fromURLs:(nullable NSArray *)urls - placeholderImage:(nullable PINImage *)placeholderImage - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -+ (void)setImageOnView:(nonnull id )view - fromURLs:(nullable NSArray *)urls; - -+ (void)setImageOnView:(nonnull id )view - fromURLs:(nullable NSArray *)urls - placeholderImage:(nullable PINImage *)placeholderImage; - -+ (void)setImageOnView:(nonnull id )view - fromURLs:(nullable NSArray *)urls - placeholderImage:(nullable PINImage *)placeholderImage - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -+ (void)cancelImageDownloadOnView:(nonnull id )view; - -+ (nullable NSUUID *)downloadImageOperationUUIDOnView:(nonnull id )view; - -+ (void)setDownloadImageOperationUUID:(nullable NSUUID *)downloadImageOperationUUID onView:(nonnull id )view; - -+ (BOOL)updateWithProgressOnView:(nonnull id )view; - -+ (void)setUpdateWithProgressOnView:(BOOL)updateWithProgress onView:(nonnull id )view; - -@end - -/** - Protocol to implement on UIView subclasses to support PINRemoteImage - */ -@protocol PINRemoteImageCategory - -//Call manager - -/** - Set the image from the given URL. - - @param url NSURL to fetch from. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url; - -/** - Set the image from the given URL and set placeholder image while image at URL is being retrieved. - - @param url NSURL to fetch from. - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage; - -/** - Set the image from the given URL and call completion when finished. - - @param url NSURL to fetch from. - @param completion Called when url has been retrieved and set on view. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Set the image from the given URL, set placeholder while image at url is being retrieved and call completion when finished. - - @param url NSURL to fetch from. - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - @param completion Called when url has been retrieved and set on view. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Retrieve the image from the given URL, process it using the passed in processor block and set result on view. - - @param url NSURL to fetch from. - @param processorKey NSString key to uniquely identify processor. Used in caching. - @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor; - -/** - Set placeholder on view and retrieve the image from the given URL, process it using the passed in processor block and set result on view. - - @param url NSURL to fetch from. - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - @param processorKey NSString key to uniquely identify processor. Used in caching. - @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor; - -/** - Retrieve the image from the given URL, process it using the passed in processor block and set result on view. Call completion after image has been fetched, processed and set on view. - - @param url NSURL to fetch from. - @param processorKey NSString key to uniquely identify processor. Used in caching. - @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. - @param completion Called when url has been retrieved and set on view. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Set placeholder on view and retrieve the image from the given URL, process it using the passed in processor block and set result on view. Call completion after image has been fetched, processed and set on view. - - @param url NSURL to fetch from. - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - @param processorKey NSString key to uniquely identify processor. Used in caching. - @param processor PINRemoteImageManagerImageProcessor processor block which should return the processed image. - @param completion Called when url has been retrieved and set on view. - */ -- (void)pin_setImageFromURL:(nullable NSURL *)url placeholderImage:(nullable PINImage *)placeholderImage processorKey:(nullable NSString *)processorKey processor:(nullable PINRemoteImageManagerImageProcessor)processor completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. - - @param urls NSArray of NSURLs sorted in increasing quality - */ -- (void)pin_setImageFromURLs:(nullable NSArray *)urls; - -/** - Set placeholder on view and retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. - - @param urls NSArray of NSURLs sorted in increasing quality - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - */ -- (void)pin_setImageFromURLs:(nullable NSArray *)urls placeholderImage:(nullable PINImage *)placeholderImage; - -/** - Set placeholder on view and retrieve one of the images at the passed in URLs depending on previous network performance and set result on view. Call completion after image has been fetched and set on view. - - @param urls NSArray of NSURLs sorted in increasing quality - @param placeholderImage PINImage to set on the view while the image at URL is being retrieved. - @param completion Called when url has been retrieved and set on view. - */ -- (void)pin_setImageFromURLs:(nullable NSArray *)urls placeholderImage:(nullable PINImage *)placeholderImage completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Cancels the image download. Guarantees that previous setImage calls will *not* have their results set on the image view after calling this (as opposed to PINRemoteImageManager which does not guarantee cancellation). - */ -- (void)pin_cancelImageDownload; - -/** - Returns the NSUUID associated with any PINRemoteImage task currently running on the view. - - @return NSUUID associated with any PINRemoteImage task currently running on the view. - */ -- (nullable NSUUID *)pin_downloadImageOperationUUID; - -/** - Set the current NSUUID associated with a PINRemoteImage task running on the view. - - @param downloadImageOperationUUID NSUUID associated with a PINRemoteImage task. - */ -- (void)pin_setDownloadImageOperationUUID:(nullable NSUUID *)downloadImageOperationUUID; - -/** - Whether the view should update with progress images (such as those provided by progressive JPEG images). - - @return BOOL value indicating whether the view should update with progress images - */ -@property (nonatomic, assign) BOOL pin_updateWithProgress; - -//Handle -- (void)pin_setPlaceholderWithImage:(nullable PINImage *)image; -- (void)pin_updateUIWithRemoteImageManagerResult:(nonnull PINRemoteImageManagerResult *)result; -- (void)pin_clearImages; -- (BOOL)pin_ignoreGIFs; - -@optional - -- (PINRemoteImageManagerDownloadOptions)pin_defaultOptions; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageMacros.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageMacros.h deleted file mode 100644 index 5f5dd8ea..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageMacros.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// PINRemoteImageMacros.h -// PINRemoteImage -// - -#import - -#ifndef PINRemoteImageMacros_h -#define PINRemoteImageMacros_h - -#define PIN_TARGET_IOS (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_TV) -#define PIN_TARGET_MAC TARGET_OS_OSX - -#define PINRemoteImageLogging 0 -#if PINRemoteImageLogging -#define PINLog(args...) NSLog(args) -#else -#define PINLog(args...) -#endif - -#ifndef USE_PINCACHE - #if __has_include() || __has_include("PINCache.h") - #define USE_PINCACHE 1 - #else - #define USE_PINCACHE 0 - #endif -#endif - -#ifndef PIN_WEBP - #if __has_include() || __has_include() - #define PIN_WEBP 1 - #else - #define PIN_WEBP 0 - #endif -#endif - -#if PIN_TARGET_IOS -#define PINImage UIImage -#define PINImageView UIImageView -#define PINButton UIButton -#define PINNSOperationSupportsBlur (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) -#elif PIN_TARGET_MAC -#define PINImage NSImage -#define PINImageView NSImageView -#define PINButton NSButton -#define PINNSOperationSupportsBlur (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10) -#define PINNSURLSessionTaskSupportsPriority (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10) -#endif - -#define PINWeakify(var) __weak typeof(var) PINWeak_##var = var; - -#define PINStrongify(var) \ -_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") __strong typeof(var) var = \ -PINWeak_##var; \ -_Pragma("clang diagnostic pop") - -#define BlockAssert(condition, desc, ...) \ -do { \ -__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ -if (!(condition)) { \ -[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ -object:strongSelf file:[NSString stringWithUTF8String:__FILE__] \ -lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \ -} \ -__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ -} while(0); - -#define PINAssertMain() NSAssert([NSThread isMainThread], @"Expected to be on the main thread."); - -#endif /* PINRemoteImageMacros_h */ diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManager.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManager.h deleted file mode 100644 index 83907078..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManager.h +++ /dev/null @@ -1,703 +0,0 @@ -// -// PINRemoteImageManager.h -// Pods -// -// Created by Garrett Moon on 8/17/14. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -#import "PINRemoteImageManagerResult.h" - -#define PINRemoteImageHTTPMaximumConnectionsPerHost UINT16_MAX - -@protocol PINRemoteImageManagerAlternateRepresentationProvider; -@protocol PINRemoteImageCaching; -@protocol PINRequestRetryStrategy; - -@class PINRemoteImageManagerConfiguration; -@class PINRemoteImageManagerResult; - -extern NSErrorDomain _Nonnull const PINRemoteImageManagerErrorDomain; - -/** - Error codes returned by PINRemoteImage - */ -typedef NS_ERROR_ENUM(PINRemoteImageManagerErrorDomain, PINRemoteImageManagerError) { - /** The image failed to decode */ - PINRemoteImageManagerErrorFailedToDecodeImage = 1, - /** The image could not be downloaded and therefore could not be processed */ - PINRemoteImageManagerErrorFailedToFetchImageForProcessing = 2, - /** The image returned by the processor block was nil */ - PINRemoteImageManagerErrorFailedToProcessImage = 3, - /** The image in the cache was invalid */ - PINRemoteImageManagerErrorInvalidItemInCache = 4, - /** The image at the URL was empty */ - PINRemoteImageManagerErrorImageEmpty = 5, -}; - -/** - Options with which to download and process images - */ -typedef NS_OPTIONS(NSUInteger, PINRemoteImageManagerDownloadOptions) { - /** Download and process with default options (no other options set) */ - PINRemoteImageManagerDownloadOptionsNone = 0, - /** Set to disallow any alternate representations such as Animated Images */ - PINRemoteImageManagerDisallowAlternateRepresentations = 1, - /** Skip decoding the image before returning. This means smaller images returned, but images will be decoded on the main thread when set on an image view */ - PINRemoteImageManagerDownloadOptionsSkipDecode = 1 << 1, - /** Skip the early check of the memory cache */ - PINRemoteImageManagerDownloadOptionsSkipEarlyCheck = 1 << 2, - /** Save processed images as JPEGs in the cache. The default is PNG to support transparency */ - PINRemoteImageManagerSaveProcessedImageAsJPEG = 1 << 3, - /** Ignore cache and force download */ - PINRemoteImageManagerDownloadOptionsIgnoreCache = 1 << 4, - /** Skip download retry */ - PINRemoteImageManagerDownloadOptionsSkipRetry = 1 << 5, - /** - * Do not honor HTTP Cache-Control headers - * By default, PINRemoteImage will by default respect 'no-store', 'no-cache', 'max-age', - * 'Expires', and 'must-revalidate'. Set this flag to ignore those headers. - * TODO: Currently PINRemoteImage will re-download images that only must be re-validated. In the - * future this could be improved with revalidation behavior that stores ETag or Last-Modified - * values and only makes HEAD requests to see if these headers are unchanged. - * see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control and - * https://tools.ietf.org/html/rfc7234*/ - PINRemoteImageManagerDownloadOptionsIgnoreCacheControlHeaders = 1 << 6 -}; - -/** - Priority to download and process image at. - */ -typedef NS_ENUM(NSUInteger, PINRemoteImageManagerPriority) { - /** Low priority */ - PINRemoteImageManagerPriorityLow = 0, - /** Default priority */ - PINRemoteImageManagerPriorityDefault, - /** High priority */ - PINRemoteImageManagerPriorityHigh, - PINRemoteImageManagerPriorityVeryHigh DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityHigh, - PINRemoteImageManagerPriorityVeryLow DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityLow, - PINRemoteImageManagerPriorityMedium DEPRECATED_ATTRIBUTE = PINRemoteImageManagerPriorityDefault, -}; - -float dataTaskPriorityWithImageManagerPriority(PINRemoteImageManagerPriority priority); - -/** - Completion called for many PINRemoteImage tasks as well as progress updates. Passed in a PINRemoteImageManagerResult. - - @param result PINRemoteImageManagerResult which contains the downloaded image. - */ -typedef void (^PINRemoteImageManagerImageCompletion)(PINRemoteImageManagerResult * __nonnull result); - -/** - Processor block to post-process a downloaded image. Passed in a PINRemoteImageManagerResult and a pointer to an NSUInteger which can be updated to indicate the cost of processing the image. - - @param result PINRemoteImageManagerResult which contains the downloaded image. - @param cost NSUInteger point which can be modified to indicate the cost of processing the image. This is used when determining which cache objects to evict on memory pressure. - - @return return the processed UIImage - */ -typedef PINImage * _Nullable(^PINRemoteImageManagerImageProcessor)(PINRemoteImageManagerResult * __nonnull result, NSUInteger * __nonnull cost); - -/** - PINRemoteImageManager is the main workhorse of PINRemoteImage. It is unnecessary to access directly if you simply - wish to download images and have them rendered in a UIImageView, UIButton or PINAnimatedImageView. - - However, if you wish to download images directly, this class is your guy / gal. - - You can use this class to download images, postprocess downloaded images, prefetch images, download images progressively, or download one image in a set of images depending on network performance. - */ - -/** - Completion Handler block which will be forwarded to NSURLSessionTaskDelegate's completion handler - - @param disposition One of several constants that describes how the challenge should be handled. - @param credential The credential that should be used for authentication if disposition is NSURLSessionAuthChallengeUseCredential; otherwise, NULL. - */ -typedef void(^PINRemoteImageManagerAuthenticationChallengeCompletionHandler)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * __nullable credential); - -/** - Authentication challenge handler - - @param task The task whose request requires authentication. - @param challenge An object that contains the request for authentication. - @param aHandler A PINRemoteImageManagerAuthenticationChallengeCompletionHandler, see example for further details. - */ -typedef void(^PINRemoteImageManagerAuthenticationChallenge)(NSURLSessionTask * __nullable task, NSURLAuthenticationChallenge * __nonnull challenge, PINRemoteImageManagerAuthenticationChallengeCompletionHandler __nullable aHandler); - - -/** - Request configuration handler. Used to modify a network request before it is executed. - Useful for adding custom, per-request headers. - - @param request The request about to be executed - */ -typedef NSURLRequest * _Nonnull(^PINRemoteImageManagerRequestConfigurationHandler)(NSURLRequest * __nonnull request); - - -/** - Handler called for many PINRemoteImage tasks providing the progress of the download. - - @param completedBytes Amount of bytes that have been downloaded so far. - @param totalBytes Total amount of bytes in the image being downloaded. - */ -typedef void(^PINRemoteImageManagerProgressDownload)(int64_t completedBytes, int64_t totalBytes); - -/** - Reports NSURLSessionTaskMetrics for download requests - - */ -typedef void(^PINRemoteImageManagerMetrics)(NSURL * __nonnull url, NSURLSessionTaskMetrics * __nonnull metrics) API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); - -/** An image downloading, processing and caching manager. It uses the concept of download and processing tasks to ensure that even if multiple calls to download or process an image are made, it only occurs one time (unless an item is no longer in the cache). PINRemoteImageManager is backed by GCD and safe to access from multiple threads simultaneously. It ensures that images are decoded off the main thread so that animation performance isn't affected. None of its exposed methods allow for synchronous access. However, it is optimized to call completions on the calling thread if an item is in its memory cache. **/ -@interface PINRemoteImageManager : NSObject - -@property (nonatomic, readonly, nonnull) id cache; - -/** - Create and return a PINRemoteImageManager created with the specified configuration. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. - @param sessionConfiguration The session configuration used to create the PINRemoteImageManager. - @return A PINRemoteImageManager with the specified configuration. - @note If you provide your own `sessionConfiguration`, please attention `HTTPMaximumConnectionsPerHost` property, it may causes timeout when in conjunction with `maxNumberOfConcurrentDownloads` if you set a larger number to `maxNumberOfConcurrentDownloads` but smaller number to `HTTPMaximumConnectionsPerHost`. - */ -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration; - -/** - Create and return a PINRemoteImageManager with the specified configuration and alternative representation delegate. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. If alternativeRepresentationProvider is nil, the default is used (and supports PINAnimatedImageView). - @param sessionConfiguration The session configuration used to create the PINRemoteImageManager. - @param alternativeRepresentationProvider a delegate which conforms to the PINRemoteImageManagerAlternateRepresentationProvider protocol. Provide a delegate if you want to have non image results. The manager maintains a weak reference to the delegate. @see PINRemoteImageManagerAlternateRepresentationProvider for an example. - @return A PINRemoteImageManager with the specified configuration. - @note If you provide your own `sessionConfiguration`, please attention `HTTPMaximumConnectionsPerHost` property, it may causes timeout when in conjunction with `maxNumberOfConcurrentDownloads` if you set a larger number to `maxNumberOfConcurrentDownloads` but smaller number to `HTTPMaximumConnectionsPerHost`. - */ -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration - alternativeRepresentationProvider:(nullable id )alternativeRepresentationProvider; - -/** - Create and return a PINRemoteImageManager with the specified configuration and alternative representation delegate. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. If alternativeRepresentationProvider is nil, the default is used (and supports PINAnimatedImageView). - @param sessionConfiguration The session configuration used to create the PINRemoteImageManager. - @param alternateRepDelegate a delegate which conforms to the PINRemoteImageManagerAlternateRepresentationProvider protocol. Provide a delegate if you want to have non image results. The manager maintains a weak reference to the delegate. @see PINRemoteImageManagerAlternateRepresentationProvider for an example. - @param imageCache Optional delegate which conforms to the PINRemoteImageCaching protocol. Provide a delegate if you want to control image caching. By default, image manager will use most appropriate implementation available (based on PINCache or NSCache, depending on subspec)@see PINRemoteImageBasicCache for an example. - @return A PINRemoteImageManager with the specified configuration. - @note If you provide your own `sessionConfiguration`, please attention `HTTPMaximumConnectionsPerHost` property, it may causes timeout when in conjunction with `maxNumberOfConcurrentDownloads` if you set a larger number to `maxNumberOfConcurrentDownloads` but smaller number to `HTTPMaximumConnectionsPerHost`. - */ -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration - alternativeRepresentationProvider:(nullable id )alternateRepDelegate - imageCache:(nullable id)imageCache; - -/** - Create and return a PINRemoteImageManager with the specified configuration and alternative representation delegate. If configuration is nil, [NSURLSessionConfiguration defaultConfiguration] is used. Specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. If alternativeRepresentationProvider is nil, the default is used (and supports PINAnimatedImageView). - @param sessionConfiguration The session configuration used to create the PINRemoteImageManager. - @param alternateRepDelegate a delegate which conforms to the PINRemoteImageManagerAlternateRepresentationProvider protocol. Provide a delegate if you want to have non image results. The manager maintains a weak reference to the delegate. @see PINRemoteImageManagerAlternateRepresentationProvider for an example. - @param imageCache Optional delegate which conforms to the PINRemoteImageCaching protocol. Provide a delegate if you want to control image caching. By default, image manager will use most appropriate implementation available (based on PINCache or NSCache, depending on subspec)@see PINRemoteImageBasicCache for an example. - @param managerConfiguration The configuration used to create the PINRemoteImageManager. - @return A PINRemoteImageManager with the specified configuration. - @note If you provide your own `sessionConfiguration`, please attention `HTTPMaximumConnectionsPerHost` property, it may causes timeout when in conjunction with `maxNumberOfConcurrentDownloads` if you set a larger number to `maxNumberOfConcurrentDownloads` but smaller number to `HTTPMaximumConnectionsPerHost`. - */ -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)sessionConfiguration - alternativeRepresentationProvider:(nullable id )alternateRepDelegate - imageCache:(nullable id)imageCache - managerConfiguration:(nullable PINRemoteImageManagerConfiguration *)managerConfiguration NS_DESIGNATED_INITIALIZER; - -/** - Get the shared instance of PINRemoteImageManager - - @return Shared instance of PINRemoteImageManager - */ -+ (nonnull instancetype)sharedImageManager; - -/** - Sets the shared instance of PINRemoteImageManager to an instance with the supplied configuration. If configuration is nil, [NSURLSessionConfiguration ephemeralSessionConfiguration] is used. You specify a custom configuration if you need to configure timeout values, cookie policies, additional HTTP headers, etc. This method should not be used if the shared instance has already been created. - - @param configuration The configuration used to create the PINRemoteImageManager. - @note If you provide your own `sessionConfiguration`, please attention `HTTPMaximumConnectionsPerHost` property, it may causes timeout when in conjunction with `maxNumberOfConcurrentDownloads` if you set a larger number to `maxNumberOfConcurrentDownloads` but smaller number to `HTTPMaximumConnectionsPerHost`. - */ -+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration; - - -/** - The result of this method is assigned to self.cache in init. If you wish to provide a customized cache to the manager you can subclass PINRemoteImageManager and return a custom object, implementing PINRemoteImageCaching protocol from this method. Same effect could be achieved by using initWithSessionConfiguration:alternativeRepresentationProvider:imageCache: initializer. - @deprecated Use the class method +defaultImageCache - @warning This method is meant only for override. It will be called *once* by an instance of PINRemoteImageManager. The default implementation creates a new cache on every call. If you're looking to access the cache being used by an instance of PINRemoteImageManager, @c cache. - @return An instance of a object, implementing PINRemoteImageCaching protocol. - */ -- (nonnull id)defaultImageCache __attribute__((deprecated)); - -/** - The result of this method is assigned to self.cache in init. If you wish to provide a customized cache to the manager you can subclass PINRemoteImageManager and return a custom object, implementing PINRemoteImageCaching protocol from this method. Same effect could be achieved by using initWithSessionConfiguration:alternativeRepresentationProvider:imageCache: initializer. - @warning This method is meant only for override. It will be called *once* by an instance of PINRemoteImageManager. The default implementation creates a new cache on every call. If you're looking to access the cache being used by an instance of PINRemoteImageManager, @c cache. - @return An instance of a object, implementing PINRemoteImageCaching protocol. - */ -+ (nonnull id)defaultImageCache; - -/** - * If you want a Ttl (maxAge) image cache, you can pass the result of this method explicitly into the initWithSessionConfiguration:alternativeRepresentationProvider:imageCache: initializer. - * @return An instance of a object, implementing PINRemoteImageCaching protocol. - */ -+ (nonnull id)defaultImageTtlCache; - -/** - * Sets a custom header to be included in every request. Headers set from this method will override any header from NSURLSessionConfiguration. - * - * @deprecated Use NSURLSessionConfiguration.HTTPAdditionalHeaders instead - * @param value A value for the header. Pass in nil to remove a previously set value. - * @param header A string field for header. - - */ -- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)header __attribute__((deprecated)); - -/** - Sets the Request Configuration Block. - - @param configurationBlock A PINRemoteImageManagerRequestConfigurationHandler block. - */ -- (void)setRequestConfiguration:(nullable PINRemoteImageManagerRequestConfigurationHandler)configurationBlock; - -/** - Set the Authentication Challenge Block. - - @param challengeBlock A PINRemoteImageManagerAuthenticationChallenge block. - */ -- (void)setAuthenticationChallenge:(nullable PINRemoteImageManagerAuthenticationChallenge)challengeBlock; - -/** - Set the minimum BPS to download the highest quality image in a set. - @see downloadImageWithURLs:options:progressImage:completion: - - @param highQualityBPSThreshold bytes per second minimum. Defaults to 500000. - @param completion Completion to be called once highQualityBPSThreshold has been set. - */ -- (void)setHighQualityBPSThreshold:(float)highQualityBPSThreshold completion:(nullable dispatch_block_t)completion; - -/** - Set the maximum BPS to download the lowest quality image in a set. - @see downloadImageWithURLs:options:progressImage:completion: - - @param lowQualityBPSThreshold bytes per second maximum. Defaults to 50000. - @param completion Completion to be called once lowQualityBPSThreshold has been set. - */ -- (void)setLowQualityBPSThreshold:(float)lowQualityBPSThreshold - completion:(nullable dispatch_block_t)completion; - -/** - Set whether high quality images should be downloaded when a low quality image is cached if network connectivity has improved. - @see downloadImageWithURLs:options:progressImage:completion: - - @param shouldUpgradeLowQualityImages if YES, low quality images will be 'upgraded'. - @param completion Completion to be called once shouldUpgradeLowQualityImages has been set. - */ -- (void)setShouldUpgradeLowQualityImages:(BOOL)shouldUpgradeLowQualityImages - completion:(nullable dispatch_block_t)completion; - -/** - Set the maximum number of concurrent operations (decompressing images, creating gifs, etc). - - @param maxNumberOfConcurrentOperations The maximum number of concurrent operations. Defaults to NSOperationQueueDefaultMaxConcurrentOperationCount. - @param completion Completion to be called once maxNumberOfConcurrentOperations is set. - */ -- (void)setMaxNumberOfConcurrentOperations:(NSInteger)maxNumberOfConcurrentOperations - completion:(nullable dispatch_block_t)completion; - -/** - Set the maximum number of concurrent downloads. - - @param maxNumberOfConcurrentDownloads The maximum number of concurrent downloads. Defaults to 10, maximum 65535. - @param completion Completion to be called once maxNumberOfConcurrentDownloads is set. - */ -- (void)setMaxNumberOfConcurrentDownloads:(NSInteger)maxNumberOfConcurrentDownloads - completion:(nullable dispatch_block_t)completion; - -/** - Set the estimated time remaining to download threshold at which to generate progressive images. Progressive images previews will only be generated if the estimated remaining time on a download is greater than estimatedTimeRemainingThreshold. If estimatedTimeRemainingThreshold is less than or equal to zero, this check is skipped. - - @param estimatedRemainingTimeThreshold The estimated remaining time threshold used to decide to skip progressive rendering. Defaults to 0.1. - @param completion Completion to be called once estimatedTimeRemainingTimeThreshold is set. - */ -- (void)setEstimatedRemainingTimeThresholdForProgressiveDownloads:(NSTimeInterval)estimatedRemainingTimeThreshold - completion:(nullable dispatch_block_t)completion; - -/** - Sets the progress at which progressive images are generated. By default this is @[@0.00, @0.35, @0.65] which generates at most, 3 progressive images. The first progressive image will only be generated when at least one scan has been completed (so you never see half an image). - - @param progressThresholds an array of progress thresholds at which to generate progressive images. progress thresholds should range from 0.00 - 1.00. Defaults to @[@0.00, @0.35, @0.65] - @param completion Completion to be called once progressThresholds is set. - */ -- (void)setProgressThresholds:(nonnull NSArray *)progressThresholds - completion:(nullable dispatch_block_t)completion; - -/** - Sets whether PINRemoteImage should blur progressive render results - - @param shouldBlur A bool value indicating whether PINRemoteImage should blur progressive render results - @param completion Completion to be called once progressThresholds is set. - */ -- (void)setProgressiveRendersShouldBlur:(BOOL)shouldBlur - completion:(nullable dispatch_block_t)completion; - -/** - Sets the maximum size of an image that PINRemoteImage will render progessively. If the image is too large, progressive rendering is skipped. - - @param maxProgressiveRenderSize A CGSize which indicates the max size PINRemoteImage will render a progressive image. If an image is larger in either dimension, progressive rendering will be skipped - @param completion Completion to be called once maxProgressiveRenderSize is set. - */ -- (void)setProgressiveRendersMaxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize - completion:(nullable dispatch_block_t)completion; - -/** - Sets a metrics callback block to be called when NSURLSessionTaskMetrics are reported for downloads. - - @warning PINRemoteImageManager will hold a strong reference to metricsCallback. Avoid retain cycles by using weak references in the block! - */ -- (void)setMetricsCallback:(nullable PINRemoteImageManagerMetrics)metricsCallback - completion:(nullable dispatch_block_t)completion API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); - -/** - Prefetch an image at the given URL. - - @param url NSURL where the image to prefetch resides. - */ -- (nullable NSUUID *)prefetchImageWithURL:(nonnull NSURL *)url; - -/** - Prefetch an image at the given URL with given options. - - @param url NSURL where the image to prefetch resides. - @param options PINRemoteImageManagerDownloadOptions options with which to pefetch the image. - */ -- (nullable NSUUID *)prefetchImageWithURL:(nonnull NSURL *)url options:(PINRemoteImageManagerDownloadOptions)options; - -/** - Prefetch an image at the given URL with given options. - - @param url NSURL where the image to prefetch resides. - @param options PINRemoteImageManagerDownloadOptions options with which to prefetch the image. - @param priority PINRemoteImageManagerPriority priority of the operation when to prefetch the image. - */ -- (nullable NSUUID *)prefetchImageWithURL:(nonnull NSURL *)url options:(PINRemoteImageManagerDownloadOptions)options priority:(PINRemoteImageManagerPriority)priority; - -/** - Prefetch images at the given URLs. - - @param urls An array of NSURLs where the images to prefetch reside. - */ -- (nonnull NSArray *)prefetchImagesWithURLs:(nonnull NSArray *)urls; - -/** - Prefetch images at the given URLs with given options. - - @param urls An array of NSURLs where the images to prefetch reside. - @param options PINRemoteImageManagerDownloadOptions options with which to pefetch the image. - */ -- (nonnull NSArray *)prefetchImagesWithURLs:(nonnull NSArray *)urls options:(PINRemoteImageManagerDownloadOptions)options; - -/** - Prefetch images at the given URLs with given options. - - @param urls An array of NSURLs where the images to prefetch reside. - @param options PINRemoteImageManagerDownloadOptions options with which to pefetch the image. - @param priority PINRemoteImageManagerPriority priority of the operation to prefetch the image. - */ -- (nonnull NSArray *)prefetchImagesWithURLs:(nonnull NSArray *)urls options:(PINRemoteImageManagerDownloadOptions)options priority:(PINRemoteImageManagerPriority)priority; - -/** - Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. - @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url and process it before calling completion. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param priority PINRemoteImageManagerPriority which indicates the priority of the download task. - @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. - @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - priority:(PINRemoteImageManagerPriority)priority - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url and process it before calling completion. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. - @param processor PINRemoteImageManagerImageProcessor block which will be called to post-process downloaded image. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache the image found at the url and process it before calling completion. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - @param url NSURL where the image to download resides. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. - @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. - @param processor PINRemoteImageManagerImageProcessor block which will be called to post-process downloaded image. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURL:(nonnull NSURL *)url - options:(PINRemoteImageManagerDownloadOptions)options - processorKey:(nullable NSString *)processorKey - processor:(nullable PINRemoteImageManagerImageProcessor)processor - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache one of the images found at the urls in the passed in array based on current network performance. URLs should be sorted from lowest quality image URL to highest. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - Unless setShouldUpgradeLowQualityImages is set to YES, this method checks the cache for all URLs and returns the highest quality version stored. It is possible though unlikely for a cached image to not be returned if it is still being cached while a call is made to this method and if network conditions have changed. See source for more details. - - @param urls An array of NSURLs of increasing cost to download. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURLs:(nonnull NSArray *)urls - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - -/** - Download or retrieve from cache one of the images found at the urls in the passed in array based on current network performance. URLs should be sorted from lowest quality image URL to highest. All completions are called on an arbitrary callback queue unless called on the main thread and the result is in the memory cache (this is an optimization to allow synchronous results for the UI when an object is cached in memory). - - Unless setShouldUpgradeLowQualityImages is set to YES, this method checks the cache for all URLs and returns the highest quality version stored. It is possible though unlikely for a cached image to not be returned if it is still being cached while a call is made to this method and if network conditions have changed. See source for more details. - - @param urls An array of NSURLs of increasing cost to download. - @param options PINRemoteImageManagerDownloadOptions options with which to fetch the image. - @param progressImage PINRemoteImageManagerImageCompletion block which will be called to update progress of the image download. - @param progressDownload PINRemoteImageManagerDownloadProgress block which will be called to update progress in bytes of the image download. NOTE: For performance reasons, this block is not called on the main thread every time, if you need to update your UI ensure that you dispatch to the main thread first. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache or downloaded. - - @return An NSUUID which uniquely identifies this request. To be used for canceling requests and verifying that the callback is for the request you expect (see categories for example). - */ -- (nullable NSUUID *)downloadImageWithURLs:(nonnull NSArray *)urls - options:(PINRemoteImageManagerDownloadOptions)options - progressImage:(nullable PINRemoteImageManagerImageCompletion)progressImage - progressDownload:(nullable PINRemoteImageManagerProgressDownload)progressDownload - completion:(nullable PINRemoteImageManagerImageCompletion)completion; - - -/** - Adds an image manually into the memory and disk cache. - - @param data NSData with the raw image data. - @param url NSURL where the image resides. - @param processorKey NSString key to uniquely identify processor and process. Will be used for caching processed images. - @param additionalCost NSUInteger the additional cost (for cache eviction purposes) to generate the processed image - - @return A BOOL indicating if the image was successfully added to the cache. - */ -- (BOOL) insertImageDataIntoCache:(nonnull NSData*)data - withURL:(nonnull NSURL *)url - processorKey:(nullable NSString *)processorKey - additionalCost:(NSUInteger)additionalCost; - -/** - Returns the cacheKey for a given URL and processorKey. Exposed to be overridden if necessary or to be used with imageFromCacheWithCacheKey - @see imageFromCacheWithCacheKey:completion: - - @param url NSURL that was used to download image - @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. - - @return returns an NSString which is the key used for caching. - */ -- (nonnull NSString *)cacheKeyForURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey; - -/** - @see imageFromCacheWithURL:processorKey:options:completion: - @deprecated - - @param cacheKey NSString key to look up image in the cache. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. - */ -- (void)imageFromCacheWithCacheKey:(nonnull NSString *)cacheKey completion:(nonnull PINRemoteImageManagerImageCompletion)completion __attribute__((deprecated)); - -/** - @see imageFromCacheWithURL:processorKey:options:completion: - @deprecated - - @param cacheKey NSString key to look up image in the cache. - @param options options will be used to determine if the cached image should be decompressed or PINCachedAnimatedImages should be returned. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. - */ -- (void)imageFromCacheWithCacheKey:(nonnull NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options completion:(nonnull PINRemoteImageManagerImageCompletion)completion __attribute__((deprecated)); - -/** - Directly get an image from the underlying cache. - - @param url NSURL that was used to download image - @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. - @param options options will be used to determine if the cached image should be decompressed or PINCachedAnimatedImages should be returned. - @param completion PINRemoteImageManagerImageCompletion block to call when image has been fetched from the cache. - */ -- (void)imageFromCacheWithURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey options:(PINRemoteImageManagerDownloadOptions)options completion:(nonnull PINRemoteImageManagerImageCompletion)completion; - -/** - @deprecated - @see synchronousImageFromCacheWithURL:processorKey:options: - - @param cacheKey NSString obtained from @c cacheKeyForURL:processorKey - @param options options will be used to determine if the cached image should be decompressed or PINCachedAnimatedImages should be returned. - - @return A PINRemoteImageManagerResult - */ -- (nonnull PINRemoteImageManagerResult *)synchronousImageFromCacheWithCacheKey:(nonnull NSString *)cacheKey options:(PINRemoteImageManagerDownloadOptions)options __attribute__((deprecated)); - -/** - Directly get an image from the underlying memory cache synchronously. - - @param url NSURL that was used to download image - @param processorKey An optional key to uniquely identify the processor used to post-process the downloaded image. - @param options options will be used to determine if the cached image should be decompressed or PINCachedAnimatedImages should be returned. - - @return A PINRemoteImageManagerResult - */ -- (nonnull PINRemoteImageManagerResult *)synchronousImageFromCacheWithURL:(nonnull NSURL *)url processorKey:(nullable NSString *)processorKey options:(PINRemoteImageManagerDownloadOptions)options; - -/** - Cancel a download. Canceling will only cancel the download if all other downloads are also canceled with their associated UUIDs. - Canceling *does not* guarantee that your completion will not be called. You can use the UUID provided on the result object to verify - the completion you want called is being called. - @see PINRemoteImageCategoryManager - - @param UUID NSUUID of the task to cancel. - */ -- (void)cancelTaskWithUUID:(nonnull NSUUID *)UUID; - -/** - Cancel a download. Canceling will only cancel the download if all other downloads are also canceled with their associated UUIDs. - Canceling *does not* guarantee that your completion will not be called. You can use the UUID provided on the result object to verify - the completion you want called is being called. - @param storeResumeData if YES and the server indicates it supports resuming downloads, downloaded data will be stored in the disk - cache and used to resume the download if the same URL is attempted to be downloaded in the future. - PINRemoteImageBasicCache does not support disk caching, use PINCache. - */ -- (void)cancelTaskWithUUID:(nonnull NSUUID *)UUID storeResumeData:(BOOL)storeResumeData; - -/** - Cancel all tasks. - */ -- (void)cancelAllTasks; - -/** - Cancel all tasks and store resume data if any task has. - */ -- (void)cancelAllTasksAndStoreResumeData:(BOOL)storeResumeData; - -/** - Set the priority of a download task. Since there is only one task per download, the priority of the download task will always be the last priority this method was called with. - - @param priority priority to set on the task. - @param UUID NSUUID of the task to set the priority on. - */ -- (void)setPriority:(PINRemoteImageManagerPriority)priority ofTaskWithUUID:(nonnull NSUUID *)UUID; - -/** - * @abstract set the progress callback on a download task. You can use this to add progress callbacks or remove them for in flight downloads - * - * @param progressImageCallback a PINRemoteImageManagerImageCompletion block to be called with a progress update - * @param UUID NSUUID of the task to set the priority on. - */ -- (void)setProgressImageCallback:(nullable PINRemoteImageManagerImageCompletion)progressImageCallback ofTaskWithUUID:(nonnull NSUUID *)UUID; - -/** - Set retry strategy for all requests - - @param retryStrategyCreationBlock a block which should create new instance of PINRequestRetryStrategy when called. - */ -- (void)setRetryStrategyCreationBlock:(_Nonnull id (^_Nonnull)(void))retryStrategyCreationBlock; - -@property (nonatomic, readonly) _Nonnull id (^_Nonnull retryStrategyCreationBlock)(void); - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManagerResult.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManagerResult.h deleted file mode 100644 index 41ff8c5a..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRemoteImageManagerResult.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// PINRemoteImageManagerResult.h -// Pods -// -// Created by Garrett Moon on 3/9/15. -// -// - -#import - -#import "PINRemoteImageMacros.h" - -#if PIN_TARGET_IOS -#import -#elif PIN_TARGET_MAC -#import -#endif - -/** How the image was fetched. */ -typedef NS_ENUM(NSUInteger, PINRemoteImageResultType) { - /** Returned if no image is returned */ - PINRemoteImageResultTypeNone = 0, - /** Image was fetched from the memory cache */ - PINRemoteImageResultTypeMemoryCache, - /** Image was fetched from the disk cache */ - PINRemoteImageResultTypeCache, - /** Image was downloaded */ - PINRemoteImageResultTypeDownload, - /** Image is progress */ - PINRemoteImageResultTypeProgress, -}; - -@interface PINRemoteImageManagerResult : NSObject - -@property (nonatomic, readonly, strong, nullable) PINImage *image; -@property (nonatomic, readonly, strong, nullable) id alternativeRepresentation; -@property (nonatomic, readonly, assign) NSTimeInterval requestDuration; -@property (nonatomic, readonly, strong, nullable) NSError *error; -@property (nonatomic, readonly, assign) PINRemoteImageResultType resultType; -@property (nonatomic, readonly, strong, nullable) NSUUID *UUID; -@property (nonatomic, readonly, assign) CGFloat renderedImageQuality; -@property (nonatomic, readonly, assign) NSUInteger bytesSavedByResuming; -@property (nonatomic, readonly, strong, nullable) NSURLResponse *response; - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error; - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error - bytesSavedByResuming:(NSUInteger)bytesSavedByResuming; - -+ (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image - alternativeRepresentation:(nullable id)alternativeRepresentation - requestLength:(NSTimeInterval)requestLength - resultType:(PINRemoteImageResultType)resultType - UUID:(nullable NSUUID *)uuid - response:(nullable NSURLResponse *)response - error:(nullable NSError *)error - renderedImageQuality:(CGFloat)renderedImageQuality; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRequestRetryStrategy.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINRequestRetryStrategy.h deleted file mode 100644 index 448ec8d5..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINRequestRetryStrategy.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PINRequestRetryStrategy.h -// Pods -// -// Created by Hovhannes Safaryan on 9/24/16. -// -// - -#import - -/* - Decide whether request should be retried based on the error. - **/ - -@protocol PINRequestRetryStrategy - -- (BOOL)shouldRetryWithError:(NSError *)error; -- (int)nextDelay; -- (void)incrementRetryCount; -- (int)numberOfRetries; - -@end - -@interface PINRequestExponentialRetryStrategy : NSObject - -- (instancetype)initWithRetryMaxCount:(int)retryMaxCount delayBase:(int)delayBase; - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINURLSessionManager.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINURLSessionManager.h deleted file mode 100644 index 5b25ff17..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINURLSessionManager.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// PINURLSessionManager.h -// Pods -// -// Created by Garrett Moon on 6/26/15. -// -// - -#import - -#import "PINRemoteImageManager.h" - -extern NSErrorDomain _Nonnull const PINURLErrorDomain; - -@protocol PINURLSessionManagerDelegate - -@required -- (void)didReceiveData:(nonnull NSData *)data forTask:(nonnull NSURLSessionTask *)task; - -@optional -- (void)didCollectMetrics:(nonnull NSURLSessionTaskMetrics *)metrics forURL:(nonnull NSURL *)url API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); -- (void)didReceiveResponse:(nonnull NSURLResponse *)response forTask:(nonnull NSURLSessionTask *)task; -- (void)didReceiveAuthenticationChallenge:(nonnull NSURLAuthenticationChallenge *)challenge forTask:(nullable NSURLSessionTask *)task completionHandler:(nonnull void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler; -- (void)didCompleteTask:(nonnull NSURLSessionTask *)task withError:(nullable NSError *)error; - -@end - -typedef void (^PINURLSessionDataTaskCompletion)(NSURLSessionTask * _Nonnull task, NSError * _Nullable error); - -@interface PINURLSessionManager : NSObject - -- (nonnull instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration; - -- (nonnull NSURLSessionDataTask *)dataTaskWithRequest:(nonnull NSURLRequest *)request - completionHandler:(nonnull PINURLSessionDataTaskCompletion)completionHandler; - -- (nonnull NSURLSessionDataTask *)dataTaskWithRequest:(nonnull NSURLRequest *)request - priority:(PINRemoteImageManagerPriority)priority - completionHandler:(nonnull PINURLSessionDataTaskCompletion)completionHandler; - -- (void)invalidateSessionAndCancelTasks; - -- (void)URLSession:(nonnull NSURLSession *)session task:(nonnull NSURLSessionTask *)task didFinishCollectingMetrics:(nonnull NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); - -@property (atomic, weak, nullable) id delegate; - -#if DEBUG -- (void)concurrentDownloads:(void (^_Nullable)(NSUInteger concurrentDownloads))concurrentDownloadsCompletion; -#endif - -@end diff --git a/Example/Pods/PINRemoteImage/Source/Classes/include/PINWebPAnimatedImage.h b/Example/Pods/PINRemoteImage/Source/Classes/include/PINWebPAnimatedImage.h deleted file mode 100644 index 6bad969e..00000000 --- a/Example/Pods/PINRemoteImage/Source/Classes/include/PINWebPAnimatedImage.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// PINWebPAnimatedImage.h -// PINRemoteImage -// -// Created by Garrett Moon on 9/14/17. -// Copyright © 2017 Pinterest. All rights reserved. -// - -#import -#import - -#import "PINAnimatedImage.h" - -@interface PINWebPAnimatedImage : PINAnimatedImage - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithAnimatedImageData:(NSData *)animatedImageData NS_DESIGNATED_INITIALIZER; - -@end diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj deleted file mode 100644 index 2a56e51c..00000000 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ /dev/null @@ -1,3219 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - 0014843AC7E3985DA8ECAE4FDFE3C127 /* ASLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C4A9F045E36CC5F5D32E599F990EBE48 /* ASLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 0183C04F357F7F265B176AFEF79A1DD7 /* ASDisplayNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82ECF9FD014DC7DC70D03A43F919AEDA /* ASDisplayNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 022C815272DD4143C0B90531CCFB2F90 /* ASRunLoopQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = C1F23A80ED06BAAE78D795707CD9F171 /* ASRunLoopQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 02AF397365C7CB3B1F57028188D0B68F /* PINDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 442AD1A685AA2C1A7EDB840685B29CCB /* PINDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 02F9F03BEEF8DB158F0F7F5432280B7F /* ASBaseDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 806A602520013A28DE6D7D35CC850A9A /* ASBaseDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 02FE2CF250A25007FD38EA6B9B341AF3 /* PINURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4828747ABF0F4B0D5210073FD2269 /* PINURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 03596E31265B0BD67663A468EC4DC960 /* PINCacheMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = D55B5D9D10346E310CC066CE345EF883 /* PINCacheMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 03ED27F0ED8958D2BF825D85D4CB8095 /* ASCornerLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = B8DBE2295DDB184590E04463D26D83C1 /* ASCornerLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0440B6E9A5BA41F99CA6FD68647D8C65 /* ASBatchContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 30135D721A505FFF41C404E5409E5A72 /* ASBatchContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 04DFE2322D051BFE816D9393B1065085 /* ASScrollNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB8E5D62AE644B54AF5D74697C539AD /* ASScrollNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 055A8C8E7C182E1B657AFA5719AA369A /* PINRequestRetryStrategy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1394E4E8CCCBB0C8068E295304334637 /* PINRequestRetryStrategy.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 05BA21B4C09B5837CE756BA99FA86E69 /* ASTipProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F85E4431EED137A7DC4C195693DD2EE /* ASTipProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 067FED52D0F9F73A07581458118667F2 /* ASYogaUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = B4A0E4898C9F75644D4095FDD6A5686A /* ASYogaUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 073F6DAE0FF4B297DCCFEA1FE6815F2C /* PINRemoteImageManagerConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = D7AEF2BB9296AC6AD078D6A403286D8F /* PINRemoteImageManagerConfiguration.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 08D5F121C7501009292220E6FBBB43AC /* UIResponder+AsyncDisplayKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9E80E5CE90F93687CC3256CE5C94CFB9 /* UIResponder+AsyncDisplayKit.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 091F20AE918F799224E0788185B91BC5 /* ASTextKitRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 377649CF33B79386CD1F8EF21FB631EB /* ASTextKitRenderer.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0984F9D71EBB47018708630E7790DBBC /* PINRemoteImageCallbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 1722A238A2D68ECA7C85A592D48C54E5 /* PINRemoteImageCallbacks.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 09B549E0955014624F185FC3D4B69035 /* ASCollectionNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 91BF1D9B193231ED07914B8F4F34F425 /* ASCollectionNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 09D280114A91ABE91D0AB79E67897CD1 /* ASWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CE5902148A0250A2BEB4005867E04B /* ASWeakProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 09F2CB6C3D0AECB7010A87488F76F355 /* ASConfigurationInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E1083F610781F72D8F15A82DBFEE569 /* ASConfigurationInternal.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0AC4F9E2A2CD9B6505D4B72DED36FD44 /* ASTextKitShadower.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0BCC06D05C16D5C36D3FB6838DE3FD3B /* ASTextKitShadower.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0B749BA401C93FCC9A512230E4D83588 /* PINRemoteWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DA8213BEA83150926293674AE1852A9 /* PINRemoteWeakProxy.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0B7AD8F6E4E1B2FF88F24481569A8499 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */; }; - 0BAEDE696084F83BE6B1BBEBEA5FB7C0 /* ASCollectionFlowLayoutDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = C43B7A3FF5E569EC9E098D866B971B54 /* ASCollectionFlowLayoutDelegate.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0BB3DF7F0E06C74BA5FC99E26F5781D5 /* ASPagerFlowLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A360C0E00F5E499E17868877A51886 /* ASPagerFlowLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0C086EA76A8368627F1E994E995040C7 /* ASTextNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = CB1DB9B8DE10D97B44C0298FC7259C6D /* ASTextNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0C63FFE943421EC6B4CA4B9390E24FD4 /* AsyncDisplayKit+Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 54068F4ABB2F3C303CD1FD89B41B928A /* AsyncDisplayKit+Debug.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 0E51F8D52D9740D767C4396FA97002B6 /* PINAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = C0F24E93C735911A21D52FCA96DE90EF /* PINAnimatedImageView.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0E5F509E5D60FCFF1C2F3EC497794E71 /* _ASPendingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 464DA86594E87233E4D9CCD47A021814 /* _ASPendingState.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 0F6CBF54EF02296066EE92C08157BE57 /* PINRemoteImageBasicCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 85DC3A0BDC8F3003550567F705BC3C4A /* PINRemoteImageBasicCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 10C3355B14CB833940BBBC2FA701D32E /* ASTextKitRenderer+Positioning.h in Headers */ = {isa = PBXBuildFile; fileRef = 01C895A2B1D6476DD066F590185AE34F /* ASTextKitRenderer+Positioning.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 112ECFC5978DE0D86CD887CDEF945A50 /* ASRecursiveUnfairLock.mm in Sources */ = {isa = PBXBuildFile; fileRef = B556BB1204DCAA72C25E523036778DA2 /* ASRecursiveUnfairLock.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 129EA387250D977AEDA0664D4D6F5BFB /* PINOperationMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FA8B88434F89A38DB5CEC77891BEAC7 /* PINOperationMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 13B3FE7D46AD7CC11B7FB391AFEF7B65 /* ASLayoutElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = ACF5296A699D89AAF16566B12DE7E1EE /* ASLayoutElement.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 13BC0DDB5F98E74836848B220143A2E6 /* ASTableLayoutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F7CACC3E144BE1342B0D96A643D2ABB0 /* ASTableLayoutController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 143AA12848BCF837C22930E646F08BC2 /* _ASAsyncTransactionGroup.mm in Sources */ = {isa = PBXBuildFile; fileRef = E36AB6427AB8AFE90BA1816236BDC846 /* _ASAsyncTransactionGroup.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 153FD8A5FA694ADEEEDEA6F6FB09AA92 /* PINRemoteImageManagerConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DBBE6C78D2A10AE3C8E91AC0E6C3244 /* PINRemoteImageManagerConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 15B155C96E460AFC8F9983D2DC755B19 /* _ASCoreAnimationExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC8FC899C1BEDB7E0862C985002B497E /* _ASCoreAnimationExtras.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 17533F39BB3633CDB147A9C6FC372448 /* ASCollectionLayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 502A1AF0D1162A604BFAE562084D2650 /* ASCollectionLayoutState.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 17A1B36B15B4C21C6CE11A6631BE6606 /* ASTextKitRenderer+Positioning.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8D4C00AC723920417390E546F4E464E6 /* ASTextKitRenderer+Positioning.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 17A689609254FAAACA24F5350F4962DB /* ASMutableElementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = B4F53DB28E010E86FA0EDECD5051E75A /* ASMutableElementMap.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 17FDC2875E326C4E65AC4D77C85856FD /* ASWeakSet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 047819DAA49AED990E600441C28AEE1B /* ASWeakSet.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1886B41B35B563AEB43F1FC7F52B1283 /* ASBatchFetchingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EA7DAC38C29B1FF9F337C51862E4B184 /* ASBatchFetchingDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1B0915994232EBC1F0211C9B2328E812 /* PINImageView+PINRemoteImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 790FD97BCBD0110961780552C759DF98 /* PINImageView+PINRemoteImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1B7A0875FFEA00A06C6C12E6B670A061 /* PINRemoteLock.m in Sources */ = {isa = PBXBuildFile; fileRef = 70907139FDD30DCEEA7A9190BA24A9D8 /* PINRemoteLock.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1BA73AA56A592ED697232186BF26AF1A /* _ASScopeTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = D9BED88789F8E23CBD186A5FFF9AD1C4 /* _ASScopeTimer.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 1BF8C950BFAD0105558F4B4804898B13 /* PINAlternateRepresentationProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F1876604918F7E85C8C8C00692D7E31 /* PINAlternateRepresentationProvider.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1D69F0B779E7324AB82C46D96C8D1537 /* ASButtonNode+Yoga.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E9292AB0D65D0A517746350324A78C5 /* ASButtonNode+Yoga.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1D90080D7C805F8537D32B4166FE115E /* Texture-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 805F38459176CFBF7BFE070EAE17FF09 /* Texture-dummy.m */; }; - 1E2BC3AF9294242EBEFC14AEBFCAA1F3 /* ASBatchFetching.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3DC9D2EA3165B8465B514EF7D984DD1 /* ASBatchFetching.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1E7C7A4276194966E633743A8CB8BF93 /* _ASCollectionGalleryLayoutItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 74809872EF01A2A8B9F326A491E24F33 /* _ASCollectionGalleryLayoutItem.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 1E93E6B30BA2021C04BD704E2F81EA06 /* _ASCollectionGalleryLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DC35E054D23A653239FDC4A37E212446 /* _ASCollectionGalleryLayoutInfo.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 1ED4F0EFF82AF1304608D543EBC7A929 /* _ASTransitionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 97B4639DBD12842C797C250B09C796AD /* _ASTransitionContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F3513723AD45A09DCFCAB4F9143F9DB /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 365E24AE7E774D0386BE4163F202EB5F /* Photos.framework */; }; - 1F6426A21426373D76CE7D35AFCB64A8 /* ASVisibilityProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = 3023FD70567259A9709DB6D08DB58E7B /* ASVisibilityProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1FD04E33CE7414D425403DFD95CAA16F /* ASThread.h in Headers */ = {isa = PBXBuildFile; fileRef = D87EBB50A055D11007023EBFE713E8FB /* ASThread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1FEB04E0C70CDADAB2B3D04D9D233235 /* ASOverlayLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = B8E3A022D1EA37E90ECB5F32EBE79C88 /* ASOverlayLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 200666742C2F87661389D7E166275114 /* ASTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9550256F4E7B4C72A87110B2650EEE12 /* ASTextLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 20071ECFB0EA1DB3FC4FBAC7D2772E0F /* NSIndexSet+ASHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 60461860653D726EFE44A0FFBAAF8ED5 /* NSIndexSet+ASHelpers.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 202E197EE4A60E6797BFC70B2AFC8EDB /* ASDisplayNode+DebugTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 5066030CB479AECAC177DC4DA00EA437 /* ASDisplayNode+DebugTiming.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2050E8C117104D143409D9C629864209 /* ASTextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E1FF80D8DFD98C50DC0CDBD4035A7D1 /* ASTextInput.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 21DCBBD78D526AB9297D3707AFC77623 /* PINRemoteImageManager+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D7429861868D4103F11B9E94C19522A9 /* PINRemoteImageManager+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 21FBFB72534277246F629CC90F3D7F29 /* PINRemoteImageDownloadQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = D9C64EBA02032F27282C40FD7220273C /* PINRemoteImageDownloadQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 22757D179A0FC91345F4BE12AE95551D /* CoreGraphics+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 74C846C2AC2B4F5854716D659394AAFD /* CoreGraphics+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 230F639E6AA5319BE5D6025EFDDACE3B /* UIImage+ASConvenience.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D2D1D6444B898D1B0C87B8603DD4677 /* UIImage+ASConvenience.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 232BF71F53BFBB27B61D054C75253D7A /* ASCollectionViewLayoutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CC8EE9EAC1AE60B0E2514B1E0BCF82DB /* ASCollectionViewLayoutController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2353ADFCCC130FF5449A380EFBC025CD /* ASCollectionLayoutState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 878DA4740C063E90987A13B56DEA7DDA /* ASCollectionLayoutState.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2412D4ACF526125BC89031C6BA0EDEB4 /* PINRequestRetryStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = BDBDCD408FDA7E7CFEE56C22BE3A64D4 /* PINRequestRetryStrategy.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 243ED155F0B8165345AB00415235A1C2 /* IGListAdapter+AsyncDisplayKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 596D151CD704967A068249BD31633252 /* IGListAdapter+AsyncDisplayKit.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 247E56FF8D9DF6549843D24F631749D1 /* PINImage+WebP.h in Headers */ = {isa = PBXBuildFile; fileRef = E2BF0999ECBBCF0288C66B2D84F59B64 /* PINImage+WebP.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 26491DA316A1B202673E03EC5BD0C5A9 /* ASLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = F141172D7AE453678F5CC49C5E6BB3F3 /* ASLayout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 26D13B5B478ECA3863AC486AA9135B54 /* ASContextTransitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = 09AF3FB906584131B9B0C1DFFE6AE6C5 /* ASContextTransitioning.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2708562E31F325E354724490B0992384 /* PINOperation-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = A74625036C72AB1D11BF828EF40AF42E /* PINOperation-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2735C083AC4BB73708BCAE189B61F7D3 /* ASBackgroundLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = ACFD0C138282EAC8935945A49DE4A106 /* ASBackgroundLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2757C80335983AFB56046AAD2DFAA6D3 /* PINMemoryCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 0964567655AE549BDF757E8DF816FBFF /* PINMemoryCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2A2D9741BC06256DC66C82090B40D185 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E023121733B6B77E3E893B9457AEBF9 /* ImageIO.framework */; }; - 2A51500CE214FC46459164535C2D2EE3 /* ASTextKitAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 882CAD5BB4DD023A743916D277E7A9F8 /* ASTextKitAttributes.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2AA41D578774DF06B8681D32063E7172 /* PINImage+ScaledImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C5A6AEC41EFC3AD25534536494FF0B1 /* PINImage+ScaledImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2AE8F85900058E8D6C665C032FAC616F /* PINOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = EECCA4A8A8683035F019428C5499815C /* PINOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2B89FE1841E770F9E9D80255B8570C7D /* ASTextKitEntityAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3044A0A84359FF4C21226519C51C96C4 /* ASTextKitEntityAttribute.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2BBF7A97306CB4348C2FCA8CBD7CE9CC /* ASDisplayNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AF25474D038B80B74719983CAD8C47FD /* ASDisplayNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2C3923EA6EB546B7694EE1CD765AC124 /* ASTextNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 052ACD33F3EB3D4D07945E4DD3817043 /* ASTextNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2C9C4577BB31751058E66003DFBFCD97 /* ASCollectionLayoutState+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4669024F2BF886C67DA02F1EADDD4B34 /* ASCollectionLayoutState+Private.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2D62747B055B8A221BB1F1B36F8A8E4F /* ASCollections.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A3946BBDD543EEDC30603027F06A40F /* ASCollections.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2DA6D9432627BC4F4783E85A98946FA8 /* ASTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 040CEEE0430AE231C0862DE080AAD426 /* ASTableView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2DDF273EB30C7696F97EB631805FC3B2 /* ASElementMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DF8B304DBA0CBC598EE18B439A1C212 /* ASElementMap.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2EA4BBB10FC2BDD88F4F5D06293CA43F /* _ASCoreAnimationExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 459480ACA012E8B711EC651102EE9B97 /* _ASCoreAnimationExtras.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2EE0A372ABB0C0F4B55845A7E8CCBDDC /* PINProgressiveImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FE8339B40FB00918941FBCDC5F30D28 /* PINProgressiveImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2F43BFDC9DB7C47CD6714933CD7DB5C6 /* ASDisplayNode+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = E62E3DBD8B5880BF142A0D8E9F2E61F6 /* ASDisplayNode+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2F671E18B872674AE84A6FEBF65C94A2 /* ASImageNode+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B7C9640E43C059034779C6065951B3F2 /* ASImageNode+Private.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2F8CDDC6D5E10B47806A9049EB13F359 /* ASWeakMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 726CEC415E5A334A863F7AEF7DE44DED /* ASWeakMap.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 2FAF8A9C25013162572ABD5AF1D9CB46 /* ASTableLayoutController.h in Headers */ = {isa = PBXBuildFile; fileRef = 647F606801780C21B7C5F64B1DEEE95B /* ASTableLayoutController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2FD9D1D74E48B80E64B860F77F721DF3 /* ASNetworkImageLoadInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1516A83197769FFC3107D5C31B19F920 /* ASNetworkImageLoadInfo.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 305FC2FC6EF268A3873D5B163E535812 /* PINCache+PINRemoteImageCaching.m in Sources */ = {isa = PBXBuildFile; fileRef = 09018DF2292D2A0DB7CD1AE16D80E0C5 /* PINCache+PINRemoteImageCaching.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3079909A1DF2B173524E27ED0E69DB58 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C805681D63BCD8F052201D2C42F84546 /* CoreMedia.framework */; }; - 30CC114897A879B1BC44FFF8279EF636 /* ASImageNode+CGExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B7B1CC63BD296A46ED1CEB0FA607516 /* ASImageNode+CGExtras.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 310B79A294E275234A745F832E2ADA1C /* ASAbstractLayoutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C39D8BE53E4EB378D9709E4D02131DA6 /* ASAbstractLayoutController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 31B5F61D67A24F8B110B680A9FAEBF6A /* ASCollectionLayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B9A841D4A633463A87F2726AEA7BBBB1 /* ASCollectionLayoutContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3225ABCDAAF00205452576CAEB706993 /* ASLayerBackingTipProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = AF566014C397ACC6CFD312D70B47824C /* ASLayerBackingTipProvider.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 32EC02441401AC8D2FCFFB98CA48FA0D /* ASCellNode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA630CD4C006172E413D222AC52D6AE0 /* ASCellNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 332E9E32EA25C369B340F2F1E9C92F45 /* PINButton+PINRemoteImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CD84E09F5FA855D090FB8AA27C039C2 /* PINButton+PINRemoteImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 33421381D895BF98FF18C4F5AC9F8261 /* ASCollectionLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DACFBEE5DA1C0933127FB5EF46FC022 /* ASCollectionLayout.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 336ECD967AFD589ABB99ADAF2E1609BE /* ASRelativeLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EB9B106DEE047870AA875F49ACC645D /* ASRelativeLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 34FB17C9B04F7A2A366360A26BFB9E46 /* ASRangeController.h in Headers */ = {isa = PBXBuildFile; fileRef = EE30FEB1172C0A805A0E58C9490B20FC /* ASRangeController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3548C035DDD95264F898907A666D2D8E /* ASLog.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B8715D6A274E204E86D6D00E36A455F /* ASLog.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 35EB6F18A0581FE6AC5EB7BE814D0EC3 /* ASScrollDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = FB325ECFF5088C8A0231289BA25C2D61 /* ASScrollDirection.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 376EE8977BD7AA21AC0749A6BAB86A03 /* ASImageNode+AnimatedImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD461E9F85A2684EAFA505483E701C5D /* ASImageNode+AnimatedImage.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 379D13D6CDA4425D7AF88658A82F5C9C /* ASSupplementaryNodeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C549603871128C7159E07743161A91B /* ASSupplementaryNodeSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 37B46407FC145A4F89B77237CD84E506 /* ASStackPositionedLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = FADB5C34DF5FEF16078DA67F7E6D9BBE /* ASStackPositionedLayout.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 38FCCB7A11298ACC61908968CFEE73F0 /* PINCacheObjectSubscripting.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD14C8259CFDAA23540FB84371A8C91 /* PINCacheObjectSubscripting.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 39CE826B80050AE373EEE39088C717AA /* ASRatioLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 96AF0974FDA6B82D477930BEC2DCA738 /* ASRatioLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3A451E35850AF1D566121DDE3C9EC57C /* ASTextRunDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61736478ADD34089F46F34DE790B9E /* ASTextRunDelegate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 3A5AD9AF1060F98191DF336EC4D59DFF /* ASMutableElementMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = E9D325D76876A8CB3D8E24335C5D30CD /* ASMutableElementMap.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3AA4306F65C828C27F4AEDBF56EA74A8 /* ASDisplayNode+LayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = C77CFBEE928E3FD8078618DB70807807 /* ASDisplayNode+LayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3ACBA510D18E183E97F33ED3C04CE329 /* ASCellNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = EE90C57504EDCB6C61F365BFCB914D08 /* ASCellNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3AE6124C547B0B0192F223327A95A100 /* ASControlNode+Subclasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EDE95498912E240C229AB97E34256D /* ASControlNode+Subclasses.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3AE955B7D903DB932626F94E543281A7 /* PINGIFAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 736C046DCA265EE81A58FD5F89BF6102 /* PINGIFAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3BB1A5BD2659C364B9D42758F19C5F54 /* ASTip.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8A206C21E309D2E76C118AD86D8E0D /* ASTip.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 3D10B00B2E6420E9B30563ADA261C7A4 /* ASSection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3A7371016C02C4F31AFC5DD262420436 /* ASSection.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3D767CEF251D577756B2E26ADA5E6F2E /* PINCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 189BBBEF314F5632F32DEBAB3119AA42 /* PINCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3DA32C06C69E44358439BB8DC62E1690 /* UICollectionViewLayout+ASConvenience.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71FF5DE9C308C4D21300343B8F095CBA /* UICollectionViewLayout+ASConvenience.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3DCB3D40986E000A5D81C97B25A4D2CF /* ASTextNodeCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 85E8D418CD5EF412149D67FE44FF73E7 /* ASTextNodeCommon.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3E3670EDDCF318105CB5AA967075CFA7 /* ASLayerBackingTipProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FFE5D2088D4421C38D2717F2F24F55D1 /* ASLayerBackingTipProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 3EA002181C74D81D26B76D634EDD1927 /* ASTipsWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = FFCAFE70FF95518A9551A2E731236083 /* ASTipsWindow.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3F502C25B3288372106379339143B1E4 /* PINRemoteImageBasicCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 25241914808C5FF6BE5F927F84792A40 /* PINRemoteImageBasicCache.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3FE76E344934971A2F6CA65FF2534829 /* _ASAsyncTransactionContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = E79D1941FE284CBC756DA419C25EC6A8 /* _ASAsyncTransactionContainer.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 40D81799A451A9C2170036BF195EED93 /* ASDimension.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C3081E402EC8789804799F6CEBE2AF8 /* ASDimension.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 410BF96FBCD0D957DD41B34008C73247 /* ASPageTable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7844B6D7C43F9083C5F8A6E086FC6A5 /* ASPageTable.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 41BB9F1ADF7F55BABFF72441B1270C48 /* ASCollectionNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 32829D76BB23477EA25503BE715219D9 /* ASCollectionNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4285FD8482B20CF2600202B10A1D4A62 /* ASLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CAF3AC46F7A1841E56DA5B95393B2DA /* ASLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 42FB573DA5B5B6B8994246AD37161864 /* ASCollectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5FC31CE875CC6172C8C3812D71F911F6 /* ASCollectionView.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4366515756053D4491DE95EC4F754833 /* PINWebPAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D673E12DB0B97C4702DCA57BD907DCD /* PINWebPAnimatedImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 43B9A6C4D13BDB7D052D9B7739BABEA4 /* ASCollectionViewFlowLayoutInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 236CAD7DBD07AD95D58777EA01ACADFC /* ASCollectionViewFlowLayoutInspector.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 43BBA3D287D8C9BF085A5AE359A44A9D /* ASCollectionLayoutContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 63A327AEF7214DE08274E6B39CA93EE6 /* ASCollectionLayoutContext+Private.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 43F2FE95830B896F6AA572C016545FB7 /* ASLayoutSpec+Subclasses.mm in Sources */ = {isa = PBXBuildFile; fileRef = E3B0F0BCC8C45B12D129D8BF9014AEFF /* ASLayoutSpec+Subclasses.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 43FE1063A859162DFA9AC2906B044CA3 /* ASCollectionViewLayoutInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 028E56AF7A62935C94B50BC7C45971CC /* ASCollectionViewLayoutInspector.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4453A05D3292C1217DA759E119A19608 /* ASMutableAttributedStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1193740D5D4555A1D1F327B2384D05D /* ASMutableAttributedStringBuilder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 44706A185FFAAC34A68D0517785EF515 /* ASCollections.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7FF465C9ADCAFB14070247CEB14E08B3 /* ASCollections.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 448401ADF182384C57B402FD81108E0A /* UIResponder+AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D63C6386D47750008C137AFC5A3B96AC /* UIResponder+AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 449A817232A104C9DAE898773E9F60E5 /* ASDisplayNode+Subclasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 2009D523A913800A6346404BF1079895 /* ASDisplayNode+Subclasses.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4594B00991232E1F640B65B5D8E7ACAF /* ASDelegateProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 192F1DF391ED1337AA49D079013BB4CB /* ASDelegateProxy.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 45F31C777B73ABCDBBE1C80181E2425F /* ASSectionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1893D93D4FF6D2E7AB3D1FA8B39C79A6 /* ASSectionContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4645649AAC3567A4BEF13968AD70A445 /* ASDisplayNode+DebugTiming.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D2AECAEFF21A26F4089B4E9E11C31AC /* ASDisplayNode+DebugTiming.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 48090993817DDAFE78F8AE9AA9F1E93B /* PINDiskCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CA8AEF5A3D9FB6C2D3EDA71FC15F7D74 /* PINDiskCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4829A857045A0F970C4565048C9093F4 /* ASMainSerialQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 950AC8879AB1BF309B91C8294F6C560D /* ASMainSerialQueue.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4897A039926DAB1D33EBACE2AE1DF9FB /* PINRemoteImageDownloadTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C0A55D5092394CDBE41B7565F27BD76 /* PINRemoteImageDownloadTask.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 48C5D35046BA0018BB3669C223DE1396 /* AsyncDisplayKit+Tips.h in Headers */ = {isa = PBXBuildFile; fileRef = 045CCCDAC2A4B5ACA485FD439DFC79C7 /* AsyncDisplayKit+Tips.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 48E59BF2D8DCCFAA3BB8DE31311B9032 /* PINSpeedRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = F12B84DDA3761BCCFFC101F6185D46A9 /* PINSpeedRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 494178AF88FF25C80B97DFE9E8D6788B /* ASLocking.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CD3D1C0D4D8CBF5CA28CA219F540B6F /* ASLocking.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 49459B0233DCA49CE68D56E0295F8129 /* ASDispatch.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7DD4634BD8153FE183A214BA8F59088A /* ASDispatch.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 49CF6C61824A0C4A54F0914EF7CF94C7 /* PINImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AEE11DDE18165E6A0EE511B797F4CD4 /* PINImage+WebP.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 49DE8C38BE482FB041B09C9C154A3C33 /* PINOperationGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = ABC2257CCA051191378319330151F0D4 /* PINOperationGroup.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 49F6DD0EF3FBADA4AC23EB2AF0CA1A92 /* ASTextDebugOption.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2832BD3A89507CE25C0F68DDCCEECD2B /* ASTextDebugOption.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4A3531D80BA489BA5E5A5874DA7C63C2 /* ASTextKitRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 40BDB2BBE7BEFFBD7F245B28C4E6C701 /* ASTextKitRenderer.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 4C873AEF892AD7E5899D1EAB600153C1 /* ASLayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E6C9422BAA0455B9F51AEB52C13E7476 /* ASLayoutManager.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 4D1986D07CAFCA3727F5EB275EF99C7F /* PINRemoteImageManagerResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 39469547584715DC15C17FD3249DB5F3 /* PINRemoteImageManagerResult.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4D527C08432C35A9D8400A4C214700C3 /* PINRemoteImageMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = B804EAE3C4FD585B6054924F31638531 /* PINRemoteImageMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4EC7884A54FE8E160CF700F04E01EB9E /* ASDefaultPlayButton.h in Headers */ = {isa = PBXBuildFile; fileRef = EE810DADECD7053ECB23F61D49A4E8B7 /* ASDefaultPlayButton.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 4F8017B01700F8D961FD98192BA21733 /* ASTipNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 12C98099C804EEAE8C9E018B386A93C1 /* ASTipNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 503788C0776007A939778870A5C4827A /* _ASCollectionViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0B764945CCA297AA516A9FE164EFF572 /* _ASCollectionViewCell.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5109827CE8ED278BA6E5DCADE6C3CE7E /* ASDisplayNode+InterfaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = 30AAE7A11260BD7F39C310127D106EFD /* ASDisplayNode+InterfaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5162B1D1DB3D56E32F68E1FD54E0D204 /* ASTextUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 79222AC676D15A57DFFB0F575D6E86F4 /* ASTextUtilities.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 517BED845B5FE0C1578ACE863FA6DC3A /* ASElementMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97C1E2EFBFB3460820319BB67DE7E9A8 /* ASElementMap.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5203B181780B2916D8A119B366CCDD0F /* NSHTTPURLResponse+MaxAge.m in Sources */ = {isa = PBXBuildFile; fileRef = D643AB237A68D3EA33E130BE941C23A2 /* NSHTTPURLResponse+MaxAge.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 522D68C238ADD2E4BB0EDC6E7E789375 /* PINRemoteImageCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 930163D057DF4C17CDACDDB653AD3C46 /* PINRemoteImageCallbacks.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 527EEDE5BEBF380277ADA24BBC62CC17 /* ASTextNodeWordKerner.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2C3B9DD9DB1D1CEAB6AAB8F90ACB0114 /* ASTextNodeWordKerner.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 52B265FB546CD7043F0A27A109845282 /* UICollectionViewLayout+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 740E73D5D26B9B72C2F6662218F80E8E /* UICollectionViewLayout+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 52CF30B3607392D1F903039AF569EA11 /* ASCellNode+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C828909B34438BE5193B32873EA167D /* ASCellNode+Internal.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 5345FD9EBEA158D5C233476EE9BECFFD /* ASDisplayNode+LayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 76686F482DAB3F96891D68B0BFEF3CA5 /* ASDisplayNode+LayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 536AF88BDA9236398E3EA899F337FC1F /* ASConfigurationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 253A7E0B2BCFBBED7CC995B5E8404245 /* ASConfigurationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 53E0B4B9A8A2CD3D9B735CB70131E46E /* PINProgressiveImage.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EDFDD960862C423CFEE9683653342B /* PINProgressiveImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5423021536AE2E8F5A8AB6D3F3C5ACAC /* ASCollectionLayoutCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83322ED18928634D7E65D89AA24CB5AC /* ASCollectionLayoutCache.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 54A705C02111891D4538BF0C9C112BDB /* PINSpeedRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 76660865DC7BA0803ED5AF36FA8E6ECA /* PINSpeedRecorder.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 56B54254BA7E9CFE40DEFD206019E289 /* ASMapNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 387CB21D415B12F060C1F1855FC1AC1F /* ASMapNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 574A09D4A04DE9D25C44E1ACD4029F1B /* ASDisplayNodeTipState.h in Headers */ = {isa = PBXBuildFile; fileRef = EADF7E9F19FA7D9031B097472C4C5AFB /* ASDisplayNodeTipState.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 57A7B6FF1FDC99819EC2CF63B48CE55D /* ASLayout+IGListDiffKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3541CF1CA219182BE21D65B61E860DD6 /* ASLayout+IGListDiffKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 57FB54AD00A60B36AD5C95B4C25378B4 /* ASDisplayNode+UIViewBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2F0577D80BE46EEF43F1895FBA8971D7 /* ASDisplayNode+UIViewBridge.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 58017441EEF699930A62EDA6164B031B /* PINRemoteImageTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA06CB098370189C1103854CA5077F /* PINRemoteImageTask.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5962C73914D2B5ACC4AD03D26B87E507 /* ASDefaultPlayButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = B90985288EA00C8C9B7207E4FD9F2D26 /* ASDefaultPlayButton.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 59D7A46CD1F9D4EAF09641131AEA39B5 /* ASDisplayNode+Convenience.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6E6AF2C7E319D3349B43F473AB518D7D /* ASDisplayNode+Convenience.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5A0A3A31D8CA0381B383ABA8515B47EF /* ASDisplayNodeTipState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C7CB66DC3DADF06304DCD664B39A8CC /* ASDisplayNodeTipState.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5A7A83090ED90EFFF26754EF11B4B78B /* ASDKNavigationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D07DA51F20E2AE45BECE7B5E0467AF4 /* ASDKNavigationController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5B5E8E61D2986F8A39419F5024064E2B /* ASDisplayNode+Convenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 38E37DA2E14FA769C25B5D00F8363628 /* ASDisplayNode+Convenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5B7C64C3F6D34D23C4902EB2260F7E22 /* ASDefaultPlaybackButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE3DC1DA67783BE1B13060B88E3A2401 /* ASDefaultPlaybackButton.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5BACFB09090617C1EC2850E60424347A /* ASConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = DC1BD8A1AC9F3DBC07F80A1B227A0A16 /* ASConfiguration.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5BBC7CD3E30972B311E43A623ABA5338 /* ASCollectionLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = E75E0331E8BF3A3D2AB02E328A968A54 /* ASCollectionLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5BEEAF52CBC1F73391BB2A26324EFDEE /* ASTextRunDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = F965B11EE046F80AEBC05314B1022295 /* ASTextRunDelegate.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5C7CA8C03F079342E28B35E1F5926C3C /* ASTraitCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 753ECF455589A055CD627680B98CBFB5 /* ASTraitCollection.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5CCF06C3D92DC92D31FA5EE6B2598271 /* ASWeakProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6E85211C3E73669751A40E002713DD16 /* ASWeakProxy.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5D3E4F78297EC2FF6662C80567B3AD2B /* ASAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 21AAE48CBF0A7AABEB9289F00693D8E4 /* ASAssert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5D5D1CF6778C0EFEF0A0378E3DB8C089 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7302265D1F954C78B31920D3B049E09A /* Accelerate.framework */; }; - 5DA45BE6BA966BB836870370A5DE5A46 /* PINCache-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F1D0CDE40B7ADECFF3A55527DA6DDC0 /* PINCache-dummy.m */; }; - 5DAEA00A887FFD1662E0C1D7902C8655 /* _ASAsyncTransactionContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = DB4C14FFBED15D2ABBEFEB8E5F3455D2 /* _ASAsyncTransactionContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5EA5BC4D445A9909A13CDCC7DC7E59E8 /* ASVideoPlayerNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE20F261835124BBA4069930FFF8AF32 /* ASVideoPlayerNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5ECF8533A2198F1B0844789FFB3F78A1 /* ASLayoutElementExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = F060D89B1311E95BA6901C3DACB2D91F /* ASLayoutElementExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5FAE049E96087E200404A018B38E17C5 /* ASCollectionView+Undeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 0DD9F794407A27FE05F69DF6B83317D4 /* ASCollectionView+Undeprecated.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 5FE16C7CC896ACF76BBCF97080C6FE99 /* ASRatioLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 710255221831EECED77AD74713D6CB3F /* ASRatioLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 60D932BDEE130F5089E086106CF8343E /* ASInternalHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CE7BBCB41E46A58DC8E7488324FD50F /* ASInternalHelpers.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 60F36B18D923D00F2135B9CEB72CC334 /* PINImageView+PINRemoteImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 72097EDC568749414EDF3AC657BB07C3 /* PINImageView+PINRemoteImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 60F95E25C14B956BD76AAA8C68BA2B01 /* ASBlockTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C1438B16C14D44EF0751DA9D54E159B /* ASBlockTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 61249AE105A2DD348B4AEC9A77933AE6 /* ASControlNode+tvOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 32D6B40B4029E043B124DADB7A6990F1 /* ASControlNode+tvOS.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 617831E33B571265F3B31C6826FE7793 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */; }; - 619B54F1CCC0816A62CE8F795546A68C /* PINRemoteImageProcessorTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 033CCEDAB42EDF1F79E201309B0557B6 /* PINRemoteImageProcessorTask.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 62CAF25406ABD0035880FBBDBB42FE14 /* ASExperimentalFeatures.mm in Sources */ = {isa = PBXBuildFile; fileRef = 12F50B842C34A7191176C055E2575D56 /* ASExperimentalFeatures.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 63F6A1FEE80F3F57401CD498BB90F793 /* ASTextKitEntityAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = D5DE9D47DF05D8D01A6F3A2E097BE5E9 /* ASTextKitEntityAttribute.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 640D13F47A7675ACDDBD92F5AECBE301 /* _ASCollectionGalleryLayoutInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = F178D21112CFAC1542B9BB0038FE9F2C /* _ASCollectionGalleryLayoutInfo.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 65E0D173BC2EF8D98C376595403720A6 /* ASAbsoluteLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 84210CC8E02259CC956E981CF30F7212 /* ASAbsoluteLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 67F445409E9EE49C0FC4BF71E15CD623 /* ASTableNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D4826F2BC6F23F0D1D5D7C2B56F609A /* ASTableNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6887845662C4DEC8009B8A6745CB27FF /* ASNetworkImageLoadInfo+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 5FADC7F093D717EE9BECA3901F55F5E8 /* ASNetworkImageLoadInfo+Private.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 694E98B3A84974A4718392BDE673457C /* ASBatchContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = BEAA64D5D3E620B73A84473368D8A9E6 /* ASBatchContext.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 69A0C835E4931BE8AC803E990807F9A3 /* ASImageNode+AnimatedImagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1893C4BD7BA621726AB5154CD30D6CAA /* ASImageNode+AnimatedImagePrivate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 6A817D9278D063B55D0967762B2CF2B0 /* _ASAsyncTransaction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 783DD2ED522F17F620CC784D424E66E7 /* _ASAsyncTransaction.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6A96DBB57F234BAE22D0901E3653F317 /* ASRangeManagingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 83ED1253C1093BA48C0223F4832BA2EB /* ASRangeManagingNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6B2AC611FA344BCC9DF26C6B8AF214F2 /* ASMainThreadDeallocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DD728FA61B8E8979926DBCECF64BFC /* ASMainThreadDeallocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6C99CB0546A67C92946A261F3FA77C4C /* PINRemoteImage-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B6ED2BB64A6A7DA8BC93530E3F55366 /* PINRemoteImage-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6D297544083B567E651219F6250A382F /* ASImageProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FC3074532017641CE4C1CCC8CD8C8E9 /* ASImageProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6D5A3EC9780D298CE8A9BB6D075BCED7 /* ASCollectionFlowLayoutDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5115C643F8FBE97D808B961FCDAE9FAA /* ASCollectionFlowLayoutDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 6DCC4CE0C5D92838A277ADC672F4390E /* ASControlTargetAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 696B1E4E1E531979AE43F3DC2B69451D /* ASControlTargetAction.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6FDA6368A35DA4353DF0DCD402CF0A58 /* ASHighlightOverlayLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5B4C160BB1D1EAFFEB4F75A0CF1EA928 /* ASHighlightOverlayLayer.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 712511C3C02BE4DEF1C0BE1885C7B1D8 /* ASTwoDimensionalArrayUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 082886C0D61122680C638DC1C2DF110E /* ASTwoDimensionalArrayUtils.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 7129D301FF3CB0450EB23A82AD91DD33 /* ASPageTable.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E469CBD7D7AB5AB0A7A4DBF776B412C /* ASPageTable.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 717D032A675503B28E1215187F1007AF /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62F113024ED798469066EFDFED7CBAFD /* MapKit.framework */; }; - 725B70B6B1C0703295B335E75DD9A2EC /* ASCollectionLayoutDefines.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6120F7F3A61BE1757F9D2DFCEFE4A6F /* ASCollectionLayoutDefines.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 72B700A78DF99ABCE27CE090B81C3F2A /* _ASDisplayViewAccessiblity.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAB6173A99700DB3D1C523EA49615F /* _ASDisplayViewAccessiblity.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 745645073EC6090F6243660F88904B86 /* ASTextLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA534DB810678A4DFC3E81CC864DBB82 /* ASTextLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 74A02A1FE2623D7B1EAC47BEC653267E /* ASDisplayNodeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = B86736BB77351EAC83A3564E6D726BF8 /* ASDisplayNodeExtras.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7517E9B14979B340E646786F61633295 /* PINRemoteImageMemoryContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C4E917C6DD24E5A1A14EF3D1471B07 /* PINRemoteImageMemoryContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 76F7232A3717A0CF978B4B8FECA10D21 /* ASDisplayNode+Ancestry.h in Headers */ = {isa = PBXBuildFile; fileRef = B1B70DE67F8B7DFB939B289F52B0D47A /* ASDisplayNode+Ancestry.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 77647211A3F949A6B897849A24C4AE45 /* ASTextLine.h in Headers */ = {isa = PBXBuildFile; fileRef = A72891F2EAA5FB673964DECE56723702 /* ASTextLine.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7780252C5C183D5B51B32254A2681DD6 /* ASTextNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B29341AF11942A1CF41CA21A3FF4E5E /* ASTextNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7786E21F8F8B8A0A4A11B660FBB1D60C /* PINRemoteImageCategoryManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2138392302088734C71C953F6E8BE31F /* PINRemoteImageCategoryManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 780D8E62DFDEF764176F995026DBBDBC /* ASBasicImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F33F5C8DDECA132574B0DB8D48E5DFF /* ASBasicImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 78FFEC04843BC1B6F612B9A052151052 /* ASDisplayNode+AsyncDisplay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0B75C700B8131603E12F188D1B8106A9 /* ASDisplayNode+AsyncDisplay.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7A14ACE26973FF95A725654BEF22D327 /* ASCollectionLayoutCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 2FBAAA96983188539E41341E456234CA /* ASCollectionLayoutCache.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 7A38BD9EE4AAC3A8DCAB216875FFC33F /* ASIntegerMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 754A82109BC04437A4A65082E1DF2C78 /* ASIntegerMap.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7ACEE223B650FEB22EC012E88BEE712C /* ASTextKitCoreTextAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 873CCB70C10B3A495FBDB6B5F685373B /* ASTextKitCoreTextAdditions.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 7B8AC92FFE9F62CA3E123A6DFF7207D3 /* UIImage+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B67743FDFF4DCC72D2196FDC564AF55 /* UIImage+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7D18768C638CA93F11A2F82E48B64C47 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9485C16107E619D52DEDDC8F0811F67 /* UIKit.framework */; }; - 7DCD43AD5867E91FBC8F2523C53CF122 /* ASBackgroundLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 861441F3E07BBB5D4745883502DFA89F /* ASBackgroundLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7E0392769206C8F0A61B778AF3BB2355 /* ASRunLoopQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85B3D35BE281415FC47A0D237EC47AC0 /* ASRunLoopQueue.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7EE1914288E0F4FCA402F76993A147CF /* ASStackLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = B8319F072AAB973DC11851036AFCAFAE /* ASStackLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7F6FA8AE1DEB3D8A4CEF508EC45ADEBD /* ASNodeController+Beta.mm in Sources */ = {isa = PBXBuildFile; fileRef = 906F6ED5B2CAD7271CCE7BD09B2BE010 /* ASNodeController+Beta.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8040C8E3F0B97BE513DCCDEA3AFE5EF9 /* ASTextDebugOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FF622BC541C8BD3E08AED356B586CC7 /* ASTextDebugOption.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 815F4388DD8721AFE267216CD1722C52 /* ASSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 644886BA7CFC1053B9A6C8A36B219C36 /* ASSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 81B9711E3EF95B8BE0B14760D3C60AA3 /* Pods-QuranEngineApp-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B0E52C5629031EF1A914D0B9BBF6D541 /* Pods-QuranEngineApp-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 81DD61DE882A55A05ACDD730515A74F4 /* NSIndexSet+ASHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 02E7624EE1E7C22E2B5F9924253845CC /* NSIndexSet+ASHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 820B2435B19530C70FAEED0645FFE483 /* ASBatchFetching.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C142AE69390BD4A73E53965CAE19F6C /* ASBatchFetching.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 83436179D9FA924E0C35077251F7432A /* _ASDisplayLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = D16FA73D18624C08889ABA04585BD2A0 /* _ASDisplayLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 83AA1BBD171373B001CE53C7895543DD /* ASRecursiveUnfairLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 133150BCC7C51D98F898F52AC0F3C45F /* ASRecursiveUnfairLock.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8459EA80A572F6D488C9262E2C408FD4 /* _ASTransitionContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 003AF6C9A23EF05B30AB638FB18BE436 /* _ASTransitionContext.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 85568C683FA164E6145931C05BCE1E63 /* ASPINRemoteImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A81686966FE14D546FC1B2752C1DA3 /* ASPINRemoteImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 85BA73ACD2FB979A72B1DB563F02EFD2 /* ASAsciiArtBoxCreator.h in Headers */ = {isa = PBXBuildFile; fileRef = D1E3D31A59F94D5CD8D4B03A2E367E99 /* ASAsciiArtBoxCreator.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 870CDA44782B103CDA29E0A9E0263B4B /* ASNetworkImageLoadInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 697D7E44BDE5BE4A0ACDE3DCC1A75DF9 /* ASNetworkImageLoadInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 898401A9D2A6DC70342A804CA5755C7D /* PINRemoteImageCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C8BC130248DB0AD806FA743C70A99B4 /* PINRemoteImageCaching.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 899B49673E2F1A53979C7A5DAD753057 /* IGListAdapter+AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 4196799D492FD6012BE48E0B05F5AE84 /* IGListAdapter+AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8A2274DC30D6C37EAA2E6C8E27E626E0 /* ASImageContainerProtocolCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0F07FBE2B0199D42A94420D767D13 /* ASImageContainerProtocolCategories.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8B1F4B0E49CAEB02A6A24CB36EDD11F6 /* ASPendingStateController.h in Headers */ = {isa = PBXBuildFile; fileRef = F03D532B340045CA733767D5359BDD90 /* ASPendingStateController.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 8B7E587D7C98AC7B411A16E2667BB304 /* ASCornerLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = D67CD4BDAFB96C6EA854C5120BFAB68F /* ASCornerLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8BCA752CBAF9A2406699121544EF220F /* ASLog.h in Headers */ = {isa = PBXBuildFile; fileRef = BD255BBA6F90EDA06E919B775FC21FF0 /* ASLog.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8BCD1D5EB6B812254575B2DA11A57E11 /* PINRemoteImageManagerResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 013E1DDF851F0FD096C42D0EAC0480E2 /* PINRemoteImageManagerResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8BCF3E2F0B3B8967169BA828B84391F9 /* ASTextKitContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 654D1E21BE6823C591A608C6EC9D313B /* ASTextKitContext.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8BF5DE28605FB25B1770327FBA085466 /* ASMapNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0703C968276AB054A49286C28AD9B0D /* ASMapNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8C29167F780848C24920974CA0941E9D /* ASPhotosFrameworkImageRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 47A6422944ED734522F40BD5F558F965 /* ASPhotosFrameworkImageRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8C2C7365E2D7E2FD4DE5B26CE9784389 /* ASNetworkImageNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 101C500CB65E313FEADB35BA37C18652 /* ASNetworkImageNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8D82A2DD69C91231AD68FAFFEB979F34 /* ASTextKitRenderer+TextChecking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 291BC2B0BD8A4752A19BB5073AAE4CFB /* ASTextKitRenderer+TextChecking.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8DB8ECA06803338D9189B0ADE0A56B3C /* NSArray+Diffing.h in Headers */ = {isa = PBXBuildFile; fileRef = 59B418A0524261ACCF5B3790959575D0 /* NSArray+Diffing.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8DCC8A574883B09CDB99B302621DE573 /* ASTextKitComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = 00FBB068C0ECF1D2860189FAA30D01A9 /* ASTextKitComponents.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8DFFD05261AB9D9C9F98D0CC710871D0 /* PINButton+PINRemoteImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FAB346055C63B3162B59F5DE8235DF0 /* PINButton+PINRemoteImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8E553E958248D0FD8A278FD861D95369 /* ASDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DFDAF1C61430DC7560FD8398184E746 /* ASDataController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8E77158232AE5E76BB2041A76BC4861B /* ASTextKitContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C6957DFA7DC3711E2FE0F5E9C8209F7 /* ASTextKitContext.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 8EB09A67D439738D0B9A09A84CED052E /* ASPagerFlowLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 70B768A05FD334709DCA17525D948B79 /* ASPagerFlowLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8EE4067364BC2F4D7AD001622268ADBE /* ASCenterLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = DF72C292E3F736A58344AC0C6C065427 /* ASCenterLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 900710D85F33D2D0E8E425A8ED8F4084 /* ASResponderChainEnumerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 653B60B3AE6439CBED7A8CCF420C9F23 /* ASResponderChainEnumerator.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 91334370E024433FE87890E064C60376 /* ASTextAttribute.mm in Sources */ = {isa = PBXBuildFile; fileRef = C941257A333D4CB849553DD8D2872A14 /* ASTextAttribute.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 917898C105D22B951ECC1F7A84C4C2E1 /* ASDimensionInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FECF0B1CB87C301963988E2A0901EBA /* ASDimensionInternal.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 918D807803E50B6D18CDC4CC0B4F3C0C /* ASEqualityHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B3B2D807DDE9140D13F1BED76A34345 /* ASEqualityHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 91956B7066244CBAB5ED5308508B7499 /* ASTextLine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 914D85B5ED811D235D138C46FCE03CF3 /* ASTextLine.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 92E136803004CBC8E955955C5909756E /* ASStackUnpositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9EF7DBD8CB9800A8D8BBD73E557F1149 /* ASStackUnpositionedLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9366DB3A51F479935993EC390C119CE1 /* ASPagerNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 611F6E0CC80F30ACC082D9A680BB117D /* ASPagerNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9449784C9363892167DF1451E110DAD3 /* ASTraitCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = B161397BFD4312F3CE0EDD244D8BB6E7 /* ASTraitCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 949F87119151FBF62C45AE770073106B /* ASTableNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = F2BDADA0E85A73A6C9A29FBA4A48B38F /* ASTableNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 94FDBF7A9ECE5A7C8836EF94E6C8D3F3 /* ASDisplayNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 302B87C2A12CAA6C0D44495FD98EE635 /* ASDisplayNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9568AE899C92AB354CBBF89047BF51CB /* ASControlNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E0960532BDBC2B75DEFB2E46474DFB5 /* ASControlNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 961DE130A9E4DD57A6F25B062255283A /* PINAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = D13CF7125B69CA994A1A19ADF69164F8 /* PINAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 96E4A9710A48427E39969E053602903B /* ASVideoPlayerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D7599FEDA20FCED7D1C989F0027DD87C /* ASVideoPlayerNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97569722D2B87260D45847D3D33447EB /* PINRemoteImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 510DCE3B48F67D693EF6D5292014D927 /* PINRemoteImage-dummy.m */; }; - 98637BFE2011843AB7CB09DC423EC47F /* ASButtonNode+Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 16EE851C878CEB4F785858F098300737 /* ASButtonNode+Yoga.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 98FF43535D57223C5AD89BDE3AF3A164 /* PINGIFAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 5446BF8F6EE5445BB8095CED507BA6E0 /* PINGIFAnimatedImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9A2AAC0E6F15D2FA5196E93B48F3D6B5 /* PINAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F590A258A736639A4D10C302391831 /* PINAnimatedImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9B612730DE921279BC07425CFA183A69 /* ASTipsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AA8CC49BB4D6612039D682B21F71C346 /* ASTipsController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9D2768D725DFF89826A4CD3BB24968A9 /* _ASHierarchyChangeSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B670732A96332078390FB8FB43C1DB3 /* _ASHierarchyChangeSet.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 9D2F676FBEBA7ADB5E3EF9916195F5B7 /* ASNodeController+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E34A7732DD6E306B133286A39E05A97 /* ASNodeController+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9EDFB28C07911C3364A5A19C45C45274 /* ASTextInput.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0A8C0A69A44F45DE13A4D7B103530C5D /* ASTextInput.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9F275DA64CC73A8CBF503779C60625B3 /* NSData+ImageDetectors.h in Headers */ = {isa = PBXBuildFile; fileRef = DF03059CFC2CF8C308FEB24EB69C2BC1 /* NSData+ImageDetectors.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9F435C3DB166750531C94A86D5093BE8 /* ASTipsWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 4104FF64ECC788CAAF748ED3F714E463 /* ASTipsWindow.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A007A9CCE045C77A875CC7C4AF51E9A0 /* NSHTTPURLResponse+MaxAge.h in Headers */ = {isa = PBXBuildFile; fileRef = FB32E2461EA09ADDAA167B8226BF68A2 /* NSHTTPURLResponse+MaxAge.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A058E2193E83663AE154E4D8099BBE8C /* PINCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = F3A05A320A0B5986D46D8E46AB8F56DB /* PINCaching.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A07A372022EF724EADE54A9E563C73C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */; }; - A09B3A7234F9DE1F4D3FE3BE0C1C4F40 /* ASMainThreadDeallocation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3060F659804F1C8C5BA9D2F576868572 /* ASMainThreadDeallocation.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A0A3B06508FDAA2C062AE6AE0A9B2B04 /* ASInternalHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 64AE383F5557C4EB6C02982624E9A40C /* ASInternalHelpers.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A0C8B4C53003A17916B959A6E1C238A2 /* ASConfigurationInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4D3A5F35BD16C5D09F616CC28AA5F5A /* ASConfigurationInternal.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A1579C9F1A992305C808FA681FAEFB79 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */; }; - A1D2EED21F512EB9A460CC3A0E7BE42E /* ASEditableTextNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 50CF5283C029686E560F1AB090D8EE09 /* ASEditableTextNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A21EBFDC274B405BD0267CC0D353C782 /* ASDisplayNodeLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 925FD0BF66B4EC011652ECA71B268CFF /* ASDisplayNodeLayout.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A30C193CD62905ADF6FFE8790AF6C3B1 /* ASAbsoluteLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 25E33343D6010BA94E0C4D026FFB4684 /* ASAbsoluteLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A378EE7BB406EF0F62D0CC3F3FBFE4F1 /* _ASDisplayViewAccessiblity.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17C24742A99023F4B3A9592799A2774C /* _ASDisplayViewAccessiblity.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A3ED713567B7681A31A01054E5DE473D /* ASLayoutElement.h in Headers */ = {isa = PBXBuildFile; fileRef = CB3C4D97C4EAAEE5F19DA33A45F004EB /* ASLayoutElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A4BF35DA86E1252EDF11B091026CA6DD /* ASLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = A9819E1E6DBCF77BA7D94CAF9BDFD8BE /* ASLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A578183B8067A79D9C81BC2031F539B0 /* PINOperationQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F786D2FE67301111EA52EC486B239B2B /* PINOperationQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A5C0C6A881B94BB6C0C53C5A999ADE14 /* ASPINRemoteImageDownloader.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3D10282C45C079174CAE1AF5363443C /* ASPINRemoteImageDownloader.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A626E598BE18A8711252323FB3CA3E48 /* ASStackLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 75D035E21022C7914A95EFF5FC065FF3 /* ASStackLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A662BC683008DE9C18F0428B1E583A7C /* PINImage+DecodedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 451F8219FEECBEF1D8D5576A706A6259 /* PINImage+DecodedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A6B55651D1E6DFB32F76E62054BEE2E5 /* _ASDisplayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 33752E15A6BDBC7CB622AEC88A8975D1 /* _ASDisplayView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A6F1239A1F724934246A7C17A6AF264E /* ASDKViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E462ACDBC86CD675CE08DD475DEECCBF /* ASDKViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A733272A56850D38635CFB88A87CFD9F /* ASLayoutSpecPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = FEED8B10C97A4562E338EF79AFA40380 /* ASLayoutSpecPrivate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A7A45457326B6C571CF584EAAA728E24 /* ASControlNode+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B49E783B53B765BCB0C1362D80B5CECD /* ASControlNode+Private.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A8617D66E859E2B92ADE411D46DF33EA /* ASStackPositionedLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 86AE0C19AA9B74C4099C440F051BE944 /* ASStackPositionedLayout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A871039DB72DFA1BEB7C8389D0EDBB92 /* ASTextKitTailTruncater.h in Headers */ = {isa = PBXBuildFile; fileRef = FE196E1C1DB53904E672423E7172D01A /* ASTextKitTailTruncater.h */; settings = {ATTRIBUTES = (Project, ); }; }; - A9AF7D7DBA14C22AFB30D5C5E5E15A56 /* ASButtonNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F3A86DEEB320345B5AE7AB565A3CC8A /* ASButtonNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA374094233A70E44789B62A3911B180 /* AsyncDisplayKit+Debug.mm in Sources */ = {isa = PBXBuildFile; fileRef = 468C6B00497AF557588B204F60C36995 /* AsyncDisplayKit+Debug.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - AB26BCBA2B7EE2DE6BEE0B957A0A66F8 /* ASTextKitRenderer+TextChecking.h in Headers */ = {isa = PBXBuildFile; fileRef = 009A9A4B1869BC413991B31E58E2E649 /* ASTextKitRenderer+TextChecking.h */; settings = {ATTRIBUTES = (Project, ); }; }; - ABB87AA1BB30B36A0C3F5F8416013437 /* PINImage+DecodedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E77840DF764C7052517CF2ED7FF71A3 /* PINImage+DecodedImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - AC1B918B3480D98ED20ED4117FB3B861 /* ASStackUnpositionedLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 0925F2EB13A379945B242CCCF61B7332 /* ASStackUnpositionedLayout.h */; settings = {ATTRIBUTES = (Project, ); }; }; - AC6639FF45B6C82B32CB3ABBFF131241 /* ASTextAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = AB3EEF472E6ED923217C52007B9753F9 /* ASTextAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AC7843FC93D2886CDADCAEBD5373C694 /* AsyncDisplayKit.h in Headers */ = {isa = PBXBuildFile; fileRef = EAF41E45B6FB22BC0F50FF4DD6125E04 /* AsyncDisplayKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AC8EDD0737474E0F6C4782C1164E1EAE /* PINOperation-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 741BAE82F2A2B69F81AE5008435BADE3 /* PINOperation-dummy.m */; }; - AD25D2B276DE382874F908C11FBE883E /* ASInsetLayoutSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4724F74EA5D82E9E84275D106EA514D7 /* ASInsetLayoutSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AD7E38625E562BDF24EDFD0E088A3DD8 /* ASCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1562DF358D6FE1C861DB5005E7283585 /* ASCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AE3B21A548D745407E311C25C6D91CA5 /* ASCollectionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 66CD319551B9DF30B551A822C17C5AD3 /* ASCollectionInternal.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AED2720FAED323B13AFAE5476CF5A8C5 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF76734BAC07F62141ADA88F036045A0 /* AVFoundation.framework */; }; - AEE5258EA7BD79A0038A30C2A80C5521 /* ASDisplayNodeCornerLayerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 83AD28EA07735189D61CB5EE3C0E0099 /* ASDisplayNodeCornerLayerDelegate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - AF5238F352E06EA036054700A200F684 /* ASWeakSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 249FEB5204659B4680675FC93469BA90 /* ASWeakSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AFA128BCAFA40EF0FBC37D20C2BFCFF3 /* _ASAsyncTransactionContainer+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EEE77614CD48971135593DDA52F6FFA /* _ASAsyncTransactionContainer+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B02023FAD20B390AA8ED1011F5661ED4 /* ASYogaUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = D44D1BEF5EDC1B3EA09C985D75290E19 /* ASYogaUtilities.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B0FF984BC02C96D5C68E49FDAE4BE267 /* ASTableView+Undeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FD39AB697A115622B17BFABEDA432DA /* ASTableView+Undeprecated.h */; settings = {ATTRIBUTES = (Project, ); }; }; - B11E09D1D92C68809B20A879628E268B /* ASTextNodeWordKerner.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D9A1BD9C0606FBED915D19AC8603AA4 /* ASTextNodeWordKerner.h */; settings = {ATTRIBUTES = (Project, ); }; }; - B1274A8BC2301074A193505C3A9478D0 /* ASDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 779F44EDEC0EBFE936BA493AAAB6A213 /* ASDispatch.h */; settings = {ATTRIBUTES = (Project, ); }; }; - B18D99569D49850D42CDC9FB96C9819F /* _ASCollectionReusableView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 020C5C020F02F0ABD517833A44B2CDE6 /* _ASCollectionReusableView.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B1CD1C9A5B59E59F9278D0919B43B462 /* ASVisibilityProtocols.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8FE59BBB92CE6E1B7353A77C79ECB02E /* ASVisibilityProtocols.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B20F6134C47D51F46DBDF1976FB8277E /* ASEditableTextNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 287BBF3D32636FA2D987970181E18429 /* ASEditableTextNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B235B8CD8E044F70BBEE882E24A27BA2 /* ASMultiplexImageNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C0F40B2FE9CE8B3D3D151D7E694F267 /* ASMultiplexImageNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B2A2A1F87CFACCF53D2773F04FE4F020 /* UIView+ASConvenience.h in Headers */ = {isa = PBXBuildFile; fileRef = 12A41184DB2B2A269071BD7D628084C8 /* UIView+ASConvenience.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B2E4B4B63A664B211988CB88B362AB94 /* ASIGListAdapterBasedDataSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5B0C09D2E89A3BCA3B0821E9BB6D98E /* ASIGListAdapterBasedDataSource.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B31048E93CA764C684D4EDB0A2198BAC /* ASPagerNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D24933F7568B4D81C493B4A737BDE668 /* ASPagerNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B3A4C55106443AC5AFA31DB111D773DC /* ASVideoNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 19E4953D755D412B0A70DAC890BD7A73 /* ASVideoNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B45746D8589CAD7BB170F4EA58941C0F /* ASTextKitAttributes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 407FB4E16539D50C5FC805D4654328C0 /* ASTextKitAttributes.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B4898FFC7091EDAD8B9AB4AE27659FD2 /* PINRemoteWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 474F334721D6E818D56CC8B9B8BD4076 /* PINRemoteWeakProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B4C40FC629F0F9603B31BA7C750046DE /* PINAnimatedImageView+PINRemoteImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0DBC478814C98DC8DF9A700BA2AFB12E /* PINAnimatedImageView+PINRemoteImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B53F7D76E80F1DC85E8C54179B2EFE72 /* _ASCollectionGalleryLayoutItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = B104D7A63AC584DAC07CB2200B4C56AA /* _ASCollectionGalleryLayoutItem.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B61ACAE4410689955A2D9A454CF947A0 /* PINRemoteImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = EE2940E42584F168B39AE1ADCDAF32AA /* PINRemoteImageManager.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B63D049EE73655B4BEFF4F791A6BF8C1 /* ASDisplayNodeCornerLayerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = B1E71903E154DAAC430A3B7606FF98D2 /* ASDisplayNodeCornerLayerDelegate.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B65665196485392E6A7F6F30675EF150 /* ASImageNode+tvOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F909C9B313C017B8F8C74DCBAF5248EA /* ASImageNode+tvOS.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B6F512E7659E8D2380CD7DB7AAEAA0AF /* NSAttributedString+ASText.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EF90F143854BBC6B24900383ABD3946 /* NSAttributedString+ASText.h */; settings = {ATTRIBUTES = (Project, ); }; }; - B763F51374A9455C0A87931065B198D4 /* ASTextKitComponents.mm in Sources */ = {isa = PBXBuildFile; fileRef = EF46DEB85571C6940172D8D85BD97843 /* ASTextKitComponents.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B77B1A328E66A47CEB371F6ED7009921 /* ASCenterLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = B66528C017ED924294842CDD7A14862F /* ASCenterLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B79923F21DF85E4A00C39BA40B78CF18 /* ASDataController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AEE4871FA31A368E57679CAB4E80B535 /* ASDataController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B83B925F9EF0540482F3518F9BAC28F9 /* NSData+ImageDetectors.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F5D034DB1ED346FED8B825B2C4FACAE /* NSData+ImageDetectors.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B926A6A544EEE4BFCBAFD1FB1A5685D4 /* ASTextKitCoreTextAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC3B699548AA59BEC2E5B6A99B34C470 /* ASTextKitCoreTextAdditions.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - B9F5845CDBE00D1113010F1E522D6F6E /* ASIntegerMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 382FCE39DC2EEBB085E6958DDCBDA1C0 /* ASIntegerMap.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B9FD3A97BED996A95425219B486EFB8E /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = E37ADB2E0B6835C8DDC1275D46DE9F62 /* ASRangeControllerUpdateRangeProtocol+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BAFE939EDA1F0526BE5FC0ADF9908639 /* ASVideoNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3DB3136FB4DF801A4F8F0B460DA384F /* ASVideoNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BB296CBC415CF6CBCDE3A30E62CC77D7 /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = DAE68C840112A828E8AF0D70EC467A8D /* ASCollectionViewLayoutFacilitatorProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BC08B770693C2C472CDD4816C2794F6F /* ASCollectionNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A418CA8EA31332CF2E82E3D634DA6F8 /* ASCollectionNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BC0F27D90C4DFD8D56FD71DFFF057FE2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */; }; - BC38ABF29281E009B90EF70FBB8A9D54 /* ASAbsoluteLayoutElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 97A13556C3ADEA829B9D9A76611A7DF2 /* ASAbsoluteLayoutElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BC4CF7C751F566D1C1ADDD9333BC87A9 /* ASCollectionViewLayoutController.h in Headers */ = {isa = PBXBuildFile; fileRef = 02242241196FCCC749EE6C5466DFA63A /* ASCollectionViewLayoutController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BC853B6F48802BADEE404AB54027458D /* ASConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C584AA9A3914BF339E0DB00EC5F3B3B /* ASConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BD68272E87015A93284F5B0183F4C6E0 /* PINRemoteImageTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E57E56ED96B01EFFB474D13F8F2E736 /* PINRemoteImageTask.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BE22F30BB7CE5810F6FC9C98201A4E50 /* ASDisplayNodeExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17B19882D4F6EF49F20CF532907FA357 /* ASDisplayNodeExtras.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BE720438A60C4A81EC92A355EB137C22 /* PINRemoteImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8FA479C38E875642DC6D0F70C22C53E2 /* PINRemoteImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BE9C6136BD8CB2FB59220D56EAD02A5F /* ASNetworkImageNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 59BD0CDED5ED108B0885BE7DFC4A68E8 /* ASNetworkImageNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BEA2AFDBE8D7453B8C29CA5927396063 /* ASImageNode+CGExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 570D139FC142DE14276857D5A821A0FF /* ASImageNode+CGExtras.h */; settings = {ATTRIBUTES = (Project, ); }; }; - BFB38297439E240E69C45D08D020C07E /* ASImageNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 99BE0A92BBFFC7CFFB222E56AE7FB11A /* ASImageNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BFC09521412E36D2DEEB7C45F1C18998 /* ASDimensionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E5A4D3649B59C33ED66C8E10E9AA64C /* ASDimensionInternal.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C0427800BE10B11608AAF6532C1652FE /* PINRemoteImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5688A739BB7B10A17AF1E41094FBDD6B /* PINRemoteImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C111E3851EB7DFC7FBDDD0E112818630 /* ASLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9DE875FB3167EB0F5F0F4E3005267918 /* ASLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C1193F51D0E6ADBEBC8E46FFAB06658E /* ASHashing.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9E4160A7B13943F81260704B0E61C80B /* ASHashing.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C163D850EA71BEEB316BE5BBD1781214 /* ASHighlightOverlayLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = F16E6F7D9B6576B8DD6D16C43758DEEB /* ASHighlightOverlayLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C1FF168E31D41F8EC7807790A26610FF /* ASTableViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 698E06A587E68956D375DE4DDE77643D /* ASTableViewInternal.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C2395036EBABE7F014B56929F69A338A /* PINAlternateRepresentationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5316B79F60F907878E80E6789410C62C /* PINAlternateRepresentationProvider.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C24D1C24DFA308B01F2488C7152C20DD /* ASLayoutTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = C5B834B7F2407602DC9A088127331270 /* ASLayoutTransition.h */; settings = {ATTRIBUTES = (Project, ); }; }; - C2B5575E0E6CA4C0519DBEBEA8F6E717 /* ASPagerNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 6D9A2760AB1BED75D27EFE6C00D733F5 /* ASPagerNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C2E6EAABDABDA8E64152ED7B37FDCFB0 /* ASAsciiArtBoxCreator.mm in Sources */ = {isa = PBXBuildFile; fileRef = DE3F8C835229C4E6A90180CC99192EAD /* ASAsciiArtBoxCreator.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C32D9A6744D0BEA03E243464084BB9FB /* ASImageContainerProtocolCategories.mm in Sources */ = {isa = PBXBuildFile; fileRef = A36DF931FF1FDB789757102295C80518 /* ASImageContainerProtocolCategories.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C32F66168DF516D4512BCF6DAE044EB8 /* ASStackLayoutSpecUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = DDC2B4BC2A286B87EB8E2802C9EF4154 /* ASStackLayoutSpecUtilities.h */; settings = {ATTRIBUTES = (Project, ); }; }; - C33BDEBA3BE262BF66551A494C8277FE /* PINRemoteImageDownloadQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C8F71BC92C3939CC05FD410E84FF05C /* PINRemoteImageDownloadQueue.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C34069831F109F63B95786E80A2ABEF5 /* Texture-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FEDA9949DABCA4821DDDD0414408B22 /* Texture-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C34D92040ED61872006D607E0F84BDF9 /* ASAssert.mm in Sources */ = {isa = PBXBuildFile; fileRef = EBF4BDADC6F612DDF408F9FC751CE8B5 /* ASAssert.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C3A0D403E6E915C25A370E30075E193D /* ASDisplayNode+Layout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 70F6544304C7BD9E41434910024503C7 /* ASDisplayNode+Layout.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C3B39791D22B051C151BF5805BD28EC6 /* ASDimension.mm in Sources */ = {isa = PBXBuildFile; fileRef = 48611848109A2670480AB38B56828E63 /* ASDimension.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C3C800DA13015BB6B658CFF4B72963CA /* ASDefaultPlaybackButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD9DD2E4BB46C40D56BA707F879069C /* ASDefaultPlaybackButton.h */; settings = {ATTRIBUTES = (Project, ); }; }; - C3F455D49AA09EB5CA60BE378E43F1A1 /* PINRemoteImageDownloadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A77A2AEAA733E58FDCD4CAA0922B1A8 /* PINRemoteImageDownloadTask.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C43A67080923BE90B06E211A697E17D3 /* ASCollectionLayoutDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B17C38B1411972578AA0BDB846A1D26 /* ASCollectionLayoutDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C4859A7373223CDF469DE5AC3963720C /* ASLayoutElementPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F13A8EEFA730581AB0FEAF5FE9DC341B /* ASLayoutElementPrivate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C59FD71C071642E37FBE6FA11098B5B0 /* ASCollectionLayoutDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = D01844FA3473F75ADC6CB29105B8137A /* ASCollectionLayoutDefines.h */; settings = {ATTRIBUTES = (Project, ); }; }; - C6DC0F02C5A319E940AA974391B3A9C4 /* PINRemoteImageProcessorTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D08D914160D3368A237E541232421E1 /* PINRemoteImageProcessorTask.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C737265488C0E61AB0B79DCC440AE314 /* ASHashing.h in Headers */ = {isa = PBXBuildFile; fileRef = C59ADB9EF4AC76011254D2D19D104F55 /* ASHashing.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C826F1DA99739261AD1D5152875ACE88 /* ASSignpost.h in Headers */ = {isa = PBXBuildFile; fileRef = B7556CF8542973F3D63B298D04F57C1D /* ASSignpost.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C9BEEA1607960BC18D0002A5851FA827 /* ASTextKitTailTruncater.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F0580A279490FD0D3405F3A050FE99F /* ASTextKitTailTruncater.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C9C8883EDF3E5D8E6381477B89B6382B /* ASLayout+IGListDiffKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = E57AD3FF0813DE17EB8AA040263EC3F6 /* ASLayout+IGListDiffKit.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C9C8CBD69EF3ACE42D411F6B9843E740 /* ASTipsController.h in Headers */ = {isa = PBXBuildFile; fileRef = EC46695BEA92F2E006258673E7BCCF46 /* ASTipsController.h */; settings = {ATTRIBUTES = (Project, ); }; }; - CA657E7649834C65EAD30D1294612DEC /* ASObjectDescriptionHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8A0FAC9D991DDA33677FE7889A04F6BB /* ASObjectDescriptionHelpers.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CB9622514E039BA270EF647705469471 /* ASRangeController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1EB92AB630AF9172AC5AF3D3E63BE08 /* ASRangeController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CBCF3D05C2B36063DEAA78C6E99D8248 /* ASBasicImageDownloaderInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F7DA777C38E96B00111DFE0BEFE7913 /* ASBasicImageDownloaderInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; - CD33208D240AFD67BFDF1099B88994FE /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41164F15B6082BB9672F7AE39D3A0BC2 /* CoreLocation.framework */; }; - CDC3C40C0AFB4434E83C91EAD23BB2C9 /* ASScrollDirection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A96F08376C80F962F4D6BD677FD6FF2C /* ASScrollDirection.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CE44B1445110CC699E10CE9603CE78F3 /* _ASCollectionReusableView.h in Headers */ = {isa = PBXBuildFile; fileRef = EDB1275CA81BC64C3B30E724EEC5934F /* _ASCollectionReusableView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CE5EEE5536CDA987508DB2507B71B7CC /* ASDKNavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 653C571887BCC0FD884AF442FC1DC0B3 /* ASDKNavigationController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CEC50FE5AE2A049F5DA45348937CAF4E /* PINDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = BB800E39017591858E237D0FF17509B6 /* PINDisplayLink.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CFE2EABD409551C55B8DD6F16B14AA7D /* PINCache-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 274269F974F0098D974E13CADE4FC16A /* PINCache-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D04EAC57D7BE6540E960C1EAE948423A /* _ASDisplayView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 22203E746785DBF3D34302CC70EF9704 /* _ASDisplayView.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D1BF64D194C4D385D34836D907917AA7 /* ASCollectionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D0624EFAFE782393194072E17D64812 /* ASCollectionElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D256C2724BB100190B995A5909146850 /* ASInsetLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AA919FCE8CBF48395B99617BEC1A794 /* ASInsetLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D307A2C86A507FE30D4C56DF6AE18B20 /* _ASDisplayLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97572917EE326DA1D1BCB834CA128711 /* _ASDisplayLayer.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D3432BB8BB34875039B8A3C271336E05 /* PINCache+PINRemoteImageCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = 60E2A9C368D8B4DB87B8786A1150005A /* PINCache+PINRemoteImageCaching.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D40AA499C6B65BB9FA230E90BFD688CF /* PINOperationTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 556D557F23FCD191B665690B58AC0B95 /* PINOperationTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D448E6A90BD279B7798EF64BFF80A3A2 /* PINOperationQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = E4A4E77985D62E4AE0F17F553E7EB919 /* PINOperationQueue.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D44CBE287F09591E60AA277BF3290088 /* PINAnimatedImageView+PINRemoteImage.m in Sources */ = {isa = PBXBuildFile; fileRef = F6E67D14993A7B56B97A9C6D49B944FC /* PINAnimatedImageView+PINRemoteImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D514FA842155B72AE180DDBBF45F49E3 /* PINCachedAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C69FF5E87A081B57AFD9CF41C19BC10 /* PINCachedAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D552E784F637B1A1D2CCF7BE323FA74B /* ASOverlayLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 03C2A4303A708600A0DC262AD6293446 /* ASOverlayLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D6094B773441E6CE8ECE3C83088F4313 /* ASCollectionLayoutContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3B1845C0E5332B989F16FD7C9CF5E002 /* ASCollectionLayoutContext.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D60B9224D2E216EA5D4D931EC1DBAE11 /* ASTextUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C168477E2A45EC9CDDD9B24747C1207 /* ASTextUtilities.h */; settings = {ATTRIBUTES = (Project, ); }; }; - D62DAA17D8259ACF8955ACCB83AAAE5B /* ASLayoutElementStylePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 66E1BC9CB957444098D7B71E55F09C0A /* ASLayoutElementStylePrivate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - D6DE2E166A1E984F470A50D36ACD29D5 /* PINResume.m in Sources */ = {isa = PBXBuildFile; fileRef = 73AA3A23C9F3D8C94C70E9CD5CAB902C /* PINResume.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D71A0DB1A6DADD1248F49AD42C11BEEB /* PINOperationGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = A6648655AE61CC658E7AE86A6804AD60 /* PINOperationGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D754F73221A18552F9A4BDC7DDC66B6C /* ASMutableAttributedStringBuilder.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8AA7778D9D328FB1753D7CA65EEE518 /* ASMutableAttributedStringBuilder.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D82054D345ADCC514231A87E42635A5E /* ASMultiplexImageNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9A753BCFC4165E6B697BA59DD40FAAE9 /* ASMultiplexImageNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D84CE019F865736E975597CE2F70DC2E /* ASLayoutController.h in Headers */ = {isa = PBXBuildFile; fileRef = B598C187B5C33F76B1294510F6620F5F /* ASLayoutController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D9CF42E418A7978B906A9FA3BB2BF40F /* ASTextKitFontSizeAdjuster.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7ED705D4E8F55EAC73E817A7B629980F /* ASTextKitFontSizeAdjuster.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - DA7097BCB97C52BA4AB798D5B9AC178B /* ASStackLayoutDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = DAD8839EFD4702B7A2E4E0EACD091FB2 /* ASStackLayoutDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DAD62FF1977C610AE98B85F18C303582 /* ASCollectionViewFlowLayoutInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3D3EC5A1E888BF898E584B2A68DDD1E /* ASCollectionViewFlowLayoutInspector.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - DB7FA8C10EBCEC4481E4E5003BAEBA36 /* PINResume.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B540D3D7D6A9543C97F678E925A099 /* PINResume.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB8464432BFD715B3E54BF83FB200113 /* ASTextKitShadower.h in Headers */ = {isa = PBXBuildFile; fileRef = 6129268C2516319929891120A1E27FC2 /* ASTextKitShadower.h */; settings = {ATTRIBUTES = (Project, ); }; }; - DBA37FC33A41853DCFD72B16AAFE06B2 /* ASGraphicsContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 54CFBE333F65B7EDA509A152520B2FE8 /* ASGraphicsContext.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - DDC4808AC994A6D068DF4F9BEFEEDF3C /* ASCollectionViewProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = F1090FE0DD646DC6D0850E0BA36405F3 /* ASCollectionViewProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DE1B1E6AF130C2857664BD02A6144CF0 /* _ASAsyncTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5004C451718460F7D56C8FF16F8302DC /* _ASAsyncTransaction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DFD2EC908B5D436DA5B81FCFB94C5EA5 /* ASAbstractLayoutController.h in Headers */ = {isa = PBXBuildFile; fileRef = ED11FFE0882E190170933C027E98F707 /* ASAbstractLayoutController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E032626252DBC96E3F6C291B166BF9E7 /* ASLayoutManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B1F7C4E0D9921A6C8C1EA3BEE4BFBDA /* ASLayoutManager.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E060F2BF057FC11A9DA623F3A7672E2D /* ASTipNode.h in Headers */ = {isa = PBXBuildFile; fileRef = EADCD92C54DE941C661292CB7A72E1E4 /* ASTipNode.h */; settings = {ATTRIBUTES = (Project, ); }; }; - E07B0F3D3BD004165C05F2A4B040C35C /* ASImageNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 499BEB74B775484B70F1E00E8A3A16F5 /* ASImageNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E09828E84EBA149DAAB8E06F4AD2A034 /* ASTip.mm in Sources */ = {isa = PBXBuildFile; fileRef = AD282AED7973E1FEA2DDE88DEEB1A7BA /* ASTip.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E1721361E4D468E357BD15F14E780BC1 /* ASIGListAdapterBasedDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E12BEC428AAE3E8C28DF57765812CED5 /* ASIGListAdapterBasedDataSource.h */; settings = {ATTRIBUTES = (Project, ); }; }; - E1CF6EDDF990EDB044D6543102B4E7C7 /* ASObjectDescriptionHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = FCC931E977AF8361D6564D04989E3EAB /* ASObjectDescriptionHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2ED3116609CBFC82B326899BF6BBF79 /* ASGraphicsContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C0BBAD824311F04F106FFD4EB44BF55 /* ASGraphicsContext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E3549CC0B621E5CE36CE411B7C11700E /* ASTableNode+Beta.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AA9420294B8B16F8BCB961F354D779D /* ASTableNode+Beta.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E3A179F6B09B2A4F812B6BF97005C0CF /* PINRemoteLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 28C3E95F4439C05AD7DD1B694E01B06F /* PINRemoteLock.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E3E2AE0BDA79295454E23890F23F726B /* ASDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = B5040986A9F8A4B3F2AEC00A1D1A95DE /* ASDelegateProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E52D136C23DC7CC095282B4181C351AD /* _ASCollectionViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CAF14F93450E6B59675C2FB7FEA56B8 /* _ASCollectionViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E583554E4D4DE122517637E8C63FC6E6 /* _ASAsyncTransactionGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 5893347DA4277D44FB96AB464F7CF90F /* _ASAsyncTransactionGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E6570476F53C68DD321F50E66DC05D29 /* NSMutableAttributedString+TextKitAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = F53E57B3ECEF0075F1FFFC7710A04639 /* NSMutableAttributedString+TextKitAdditions.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E69AC2587551B4E1501B2F63537E1077 /* PINRemoteImageCategoryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 42F1BDB74A174F9531FB779E45BC1D50 /* PINRemoteImageCategoryManager.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E75852AAEC8EDC07F2AC2669DE434074 /* ASScrollNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = B460B941AE3263A75BCBD37F1340602E /* ASScrollNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E7B4ACA08801E462B7DF6752368C9123 /* ASTwoDimensionalArrayUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 79B1CEDE11B0A34B5F18968527A72ECA /* ASTwoDimensionalArrayUtils.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E7C00E2D3ABFD3900D0B356032999366 /* ASBasicImageDownloader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 04CF94985EB26286103BEC323633CFC4 /* ASBasicImageDownloader.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E7D0F963C59A22F73248464F172A170A /* ASMainSerialQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C8F01CDCDCE46D2A23006B20D5CA9D6 /* ASMainSerialQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E898D44AA456F58B458840545A3B7CD1 /* AsyncDisplayKit+Tips.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5794D63296580A82E5E7C507426C095A /* AsyncDisplayKit+Tips.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E8AAF30FAD524BC3C46579F8B7600424 /* Pods-QuranEngineApp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4344BE434739CB35CB35BD2CBC0F28C8 /* Pods-QuranEngineApp-dummy.m */; }; - E8CB30D9ED40DB88D8728C34F9644F04 /* ASCollectionGalleryLayoutDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A4C88D12EBBBE880327EE34EB681C0E6 /* ASCollectionGalleryLayoutDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E9795B0210AB46391DEE56163688871D /* PINCachedAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 130371D9D979BBE4A21D3985FF5C0CBA /* PINCachedAnimatedImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E98BF98F1AF165D8BFD982942B3BAAE5 /* ASLayoutRangeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 343547A19426C36360D10F65273D1B44 /* ASLayoutRangeType.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E9B2D48A761DDCA74EDC1566F24F8076 /* ASDisplayNode+Yoga.mm in Sources */ = {isa = PBXBuildFile; fileRef = 634E28B24436274FC8F31C3B6675E408 /* ASDisplayNode+Yoga.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EA02D0638232299C599630D67D56C881 /* ASSection.h in Headers */ = {isa = PBXBuildFile; fileRef = C47C32B24C4785F3C2352F86885C8A40 /* ASSection.h */; settings = {ATTRIBUTES = (Project, ); }; }; - EAAF18F6D01A57B4F38A89AF20DD8121 /* ASControlNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00B6EFE7BA64F6C89AE19C682766010B /* ASControlNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EB1E7A396960EEAB9EB30DB17685B19C /* ASResponderChainEnumerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 23FF327FB28BCDDDA79E921498BD12CC /* ASResponderChainEnumerator.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EB9D04C0CCB099487204F2FE53E92A8C /* ASCollectionGalleryLayoutDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 32EB6C106FA09F467D5200E9137E7077 /* ASCollectionGalleryLayoutDelegate.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EC71B8DC723A2C067AD54DA0F9862B3A /* ASTextNode2.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4FDB5D100D95E852ACB475039D799BAA /* ASTextNode2.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - ECBF8FF8DB66E246CA11FD908B2C19F2 /* ASPendingStateController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6EE68909B7765A77F72DBD6656DED504 /* ASPendingStateController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EE8206826ADBFFAA2714CE741BA06BD6 /* NSParagraphStyle+ASText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1208FD056F60C358052344C12BCD1400 /* NSParagraphStyle+ASText.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EED99CE1FF7377E0C9F8A1CD264929B8 /* ASTextKitFontSizeAdjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EB6C3115CB64B623A1D3679B1EAFE /* ASTextKitFontSizeAdjuster.h */; settings = {ATTRIBUTES = (Project, ); }; }; - EEECD37F7E520A41002C96742CAC8924 /* ASTextNodeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D3B7C494DBBC77452128797B437E9E1 /* ASTextNodeTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EEFC416107BE906C985D42870B73A599 /* NSMutableAttributedString+TextKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 304DB8B9A1950B22EE250D24711D2241 /* NSMutableAttributedString+TextKitAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EF53394A8DC67B728363BC4E7383F548 /* AsyncDisplayKit+IGListKitMethods.mm in Sources */ = {isa = PBXBuildFile; fileRef = AED0F60EAE75B20DC8B1DDCE763D458C /* AsyncDisplayKit+IGListKitMethods.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - EF8559752F0DEB5F3EBAB8B33A292442 /* ASAbstractLayoutController+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = B69E0F6D2BE6B08846D0243666B148D1 /* ASAbstractLayoutController+FrameworkPrivate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - EF8D23C9C0A8BC119680FA7F5A5BD04C /* ASDisplayNode+FrameworkPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF4F7B0BA067B961678630F5F60E673 /* ASDisplayNode+FrameworkPrivate.h */; settings = {ATTRIBUTES = (Project, ); }; }; - EFB5D23B32606111DC9A151866BB8EAA /* PINCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CEA150E52F46238642DC87EC38BD0E6D /* PINCache.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F003003FDDCB41315690148BA38233BC /* ASDisplayNode+Ancestry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC70814CD0F1C79D7DE05E6FFF8488 /* ASDisplayNode+Ancestry.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F0590E746579F4828947DD30524302F6 /* ASAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = A86C4FB796F859422DFF64AD581BBAE0 /* ASAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F05B82F3E35CD5A5537D2464E9E6F63C /* PINRemoteImageTask+Subclassing.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E6AFB718C24B2377E5DF0CCDA306C55 /* PINRemoteImageTask+Subclassing.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F07576D3FCE89ACDC01C3E7CD570F7C5 /* ASTabBarController.h in Headers */ = {isa = PBXBuildFile; fileRef = BBF774808D26E537AA4D7EF0C64653DA /* ASTabBarController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F10E61A45452411F5C361031058432B6 /* ASCollectionElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7BF99DF1F99AF5F8AD7D64AAF2BA1E44 /* ASCollectionElement.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F11E2820E58035A651FA87B03752167C /* ASPhotosFrameworkImageRequest.mm in Sources */ = {isa = PBXBuildFile; fileRef = C512F56D7309F8BBBD1184D118681725 /* ASPhotosFrameworkImageRequest.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F27317ECB1C23078AE3A7A802F020819 /* ASLayoutSpec+Subclasses.h in Headers */ = {isa = PBXBuildFile; fileRef = E58D323E91EB2896C1EDADABA33E1ED7 /* ASLayoutSpec+Subclasses.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F29A467A3E3E6AF766C8FD41671CA68D /* ASButtonNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 05B335B6147A6FE1EADA2848C7EF1937 /* ASButtonNode.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F29D1FF78B0BB8F822F50E119A173642 /* ASLayoutTransition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0E5AE839317B3000199724623D4D2E78 /* ASLayoutTransition.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F3025A2139AF32BBE05B0DF3C5E008F2 /* ASCollectionViewLayoutInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 27966D9EBA4F95DD90B5A40173787561 /* ASCollectionViewLayoutInspector.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F31C9170DC7ACFD117683ED212694363 /* PINDiskCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CDB9905DE100C45E321FF681B0BE5D74 /* PINDiskCache.m */; settings = {COMPILER_FLAGS = "-fobjc-arc-exceptions -w -Xanalyzer -analyzer-disable-all-checks -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F31EE734BB964AA97F5A677ACB4B3D72 /* PINURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B20999B345220EA81A18684BC483B2D /* PINURLSessionManager.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F3592E9092F025DEB18BC8C0CBA00087 /* AsyncDisplayKit+IGListKitMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 0690DE4860D3474C3B51AAD12F5DFFFE /* AsyncDisplayKit+IGListKitMethods.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F4984F1FD1DF7360FBD0B3448DDDCAB2 /* ASExperimentalFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = D1442C49B60F16C7023EB46328D280D7 /* ASExperimentalFeatures.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F4A4E40C3B31DAAF8019DA0062ECCFBF /* NSParagraphStyle+ASText.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EEB0F6514E0083BC82D21EDB4E525C9 /* NSParagraphStyle+ASText.h */; settings = {ATTRIBUTES = (Project, ); }; }; - F561F494B5C51276E96B4423BE448605 /* PINImage+ScaledImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B7B3467E387075BB087F9DF9D8EDF5 /* PINImage+ScaledImage.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F5693738A170350414BAE23C37102A12 /* _ASHierarchyChangeSet.mm in Sources */ = {isa = PBXBuildFile; fileRef = BFB557CD6B237ED4B0DB24D1F4677091 /* _ASHierarchyChangeSet.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F57758CA8101A8AC81C7FF144087ADAE /* NSAttributedString+ASText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41D390D3B3D39D7288BF1633D2578E1E /* NSAttributedString+ASText.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F5DBFC4793E3685BAED26AA4E5701F6C /* ASTabBarController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 754964278CA439B0C3D6B289E044C695 /* ASTabBarController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F6843E805E495E80C92C9211A77E8732 /* PINRemoteImageMemoryContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B76C13871113610B790E5634FD8E4B7 /* PINRemoteImageMemoryContainer.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F7113A95CB5292F20D610693D8E57D31 /* PINWebPAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 626548E82C01FE272CD114C9F7F07556 /* PINWebPAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F76FBF7D27355B7696587E4F7E2DC806 /* ASControlTargetAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F8706501F3AA12900089CACFE9D2890 /* ASControlTargetAction.h */; settings = {ATTRIBUTES = (Project, ); }; }; - F8C79940DBAE9186CB61B6D83D20EA1E /* _ASPendingState.mm in Sources */ = {isa = PBXBuildFile; fileRef = 821F71FB345332F044B54F24ABFD0C0E /* _ASPendingState.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F9381196E6721F227B6CEB1A507B7A9C /* ASTextNode2.h in Headers */ = {isa = PBXBuildFile; fileRef = F8627D5B8CF030A2C803DF3FEA7726D7 /* ASTextNode2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F9BDE1D515C10B944AB7981FE5623A16 /* ASDKViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1971780E236A6D3739D0E6B97B69EA18 /* ASDKViewController.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F9D7EE340DF175B84B85658B3BB8CF71 /* ASButtonNode+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C62661EAE971113323BF22A316997B /* ASButtonNode+Private.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FA4A7F21BB2F93953F66B35CEBA3FF14 /* PINMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E12D4B3FB7683F25D5A629A2F5CF4F5 /* PINMemoryCache.m */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FA713FEE1840C794CA1DFB89E9820F99 /* ASTableView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 080181EDB8F556DDB67ED000C5692CC2 /* ASTableView.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FA9FD3B4F0C19F8D230ED785BA4C7C48 /* ASWeakMap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BE37DED04CFA8DBDAFA0E035F0BC0A4 /* ASWeakMap.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FBAF8F1CFA96822646C57FCD393D9AA7 /* ASStackLayoutElement.h in Headers */ = {isa = PBXBuildFile; fileRef = C1FCC0F80EEB9E87D75AB09C5803CEA4 /* ASStackLayoutElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FC39095B7B6E321B58F9BFA29B44B28B /* NSArray+Diffing.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8674F0C2D71763F78FA0E363967943D0 /* NSArray+Diffing.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FC8D9F6E6DE4C67A9FE8B3A8F11F729D /* PINAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 966FD881395FF4683060BDF1A2C1AFE7 /* PINAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FDE332E188A06EF83F39B0277106C4FB /* ASRelativeLayoutSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53C048263488DB6D71F9D8AE1C46CA2E /* ASRelativeLayoutSpec.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FE3CBAD197E7F9084120F8731B13FA62 /* ASDisplayNodeInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 85139CFD68B377D012901915804EE19F /* ASDisplayNodeInternal.h */; settings = {ATTRIBUTES = (Project, ); }; }; - FE53B166B713AC4BAA696CE90D6BF852 /* ASTextKitTruncating.h in Headers */ = {isa = PBXBuildFile; fileRef = 5F931D5FCD505A1EC8D4200499DD5F5D /* ASTextKitTruncating.h */; settings = {ATTRIBUTES = (Project, ); }; }; - FE8272C0D8E46E8BF14DB9F132793058 /* ASTipProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 707AD0C30453447CAB84AF3E8B2B3061 /* ASTipProvider.mm */; settings = {COMPILER_FLAGS = "-fno-exceptions -w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FFF62918E6E0B04390D58B16695046FF /* ASTableViewProtocols.h in Headers */ = {isa = PBXBuildFile; fileRef = BA2E3D91593000ED94F506DC5F930887 /* ASTableViewProtocols.h */; settings = {ATTRIBUTES = (Public, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 0F55C107D8303AA7BB48248A569C6B04 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57310B016450E63387C9D64F4933E995; - remoteInfo = PINOperation; - }; - 11B9C74BD4D0AF9A583F908B53172DBF /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57310B016450E63387C9D64F4933E995; - remoteInfo = PINOperation; - }; - 40D949C5B43B0931FBDE03CBC3E503E0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E2A8B2A28D2EAB2E4CCF3B69E6792851; - remoteInfo = PINRemoteImage; - }; - 6C9FCF71DF9E3E4E0B6B5D83C3BBACA0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E2A8B2A28D2EAB2E4CCF3B69E6792851; - remoteInfo = PINRemoteImage; - }; - 8230CF134F6D89120EB745C2783BC72B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 57310B016450E63387C9D64F4933E995; - remoteInfo = PINOperation; - }; - D1E93115AFD16A719980879D082D69D7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB66E43BC980D741F3C7C5CF3ACEEFA4; - remoteInfo = Texture; - }; - EFE03B8434A5F743848E7A4A8152D4D9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = A927C3CD51C30012080D6CA07959B246; - remoteInfo = PINCache; - }; - F16C7DBDC9A12B9DEEBF63B5BABCFAB9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = A927C3CD51C30012080D6CA07959B246; - remoteInfo = PINCache; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 003AF6C9A23EF05B30AB638FB18BE436 /* _ASTransitionContext.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASTransitionContext.mm; path = Source/_ASTransitionContext.mm; sourceTree = ""; }; - 009A9A4B1869BC413991B31E58E2E649 /* ASTextKitRenderer+TextChecking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASTextKitRenderer+TextChecking.h"; path = "Source/TextKit/ASTextKitRenderer+TextChecking.h"; sourceTree = ""; }; - 00B6EFE7BA64F6C89AE19C682766010B /* ASControlNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASControlNode.mm; path = Source/ASControlNode.mm; sourceTree = ""; }; - 00FBB068C0ECF1D2860189FAA30D01A9 /* ASTextKitComponents.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitComponents.h; path = Source/TextKit/ASTextKitComponents.h; sourceTree = ""; }; - 013E1DDF851F0FD096C42D0EAC0480E2 /* PINRemoteImageManagerResult.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageManagerResult.h; path = Source/Classes/include/PINRemoteImageManagerResult.h; sourceTree = ""; }; - 01C895A2B1D6476DD066F590185AE34F /* ASTextKitRenderer+Positioning.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASTextKitRenderer+Positioning.h"; path = "Source/TextKit/ASTextKitRenderer+Positioning.h"; sourceTree = ""; }; - 020C5C020F02F0ABD517833A44B2CDE6 /* _ASCollectionReusableView.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASCollectionReusableView.mm; path = Source/Details/_ASCollectionReusableView.mm; sourceTree = ""; }; - 02242241196FCCC749EE6C5466DFA63A /* ASCollectionViewLayoutController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionViewLayoutController.h; path = Source/Details/ASCollectionViewLayoutController.h; sourceTree = ""; }; - 028E56AF7A62935C94B50BC7C45971CC /* ASCollectionViewLayoutInspector.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionViewLayoutInspector.mm; path = Source/Details/ASCollectionViewLayoutInspector.mm; sourceTree = ""; }; - 02E7624EE1E7C22E2B5F9924253845CC /* NSIndexSet+ASHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSIndexSet+ASHelpers.h"; path = "Source/Details/NSIndexSet+ASHelpers.h"; sourceTree = ""; }; - 033CCEDAB42EDF1F79E201309B0557B6 /* PINRemoteImageProcessorTask.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageProcessorTask.m; path = Source/Classes/PINRemoteImageProcessorTask.m; sourceTree = ""; }; - 03C2A4303A708600A0DC262AD6293446 /* ASOverlayLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASOverlayLayoutSpec.mm; path = Source/Layout/ASOverlayLayoutSpec.mm; sourceTree = ""; }; - 040CEEE0430AE231C0862DE080AAD426 /* ASTableView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTableView.h; path = Source/ASTableView.h; sourceTree = ""; }; - 045CCCDAC2A4B5ACA485FD439DFC79C7 /* AsyncDisplayKit+Tips.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "AsyncDisplayKit+Tips.h"; path = "Source/Debug/AsyncDisplayKit+Tips.h"; sourceTree = ""; }; - 047819DAA49AED990E600441C28AEE1B /* ASWeakSet.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASWeakSet.mm; path = Source/Details/ASWeakSet.mm; sourceTree = ""; }; - 04CF94985EB26286103BEC323633CFC4 /* ASBasicImageDownloader.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASBasicImageDownloader.mm; path = Source/Details/ASBasicImageDownloader.mm; sourceTree = ""; }; - 052ACD33F3EB3D4D07945E4DD3817043 /* ASTextNode+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASTextNode+Beta.h"; path = "Source/ASTextNode+Beta.h"; sourceTree = ""; }; - 05B335B6147A6FE1EADA2848C7EF1937 /* ASButtonNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASButtonNode.mm; path = Source/ASButtonNode.mm; sourceTree = ""; }; - 0690DE4860D3474C3B51AAD12F5DFFFE /* AsyncDisplayKit+IGListKitMethods.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "AsyncDisplayKit+IGListKitMethods.h"; path = "Source/AsyncDisplayKit+IGListKitMethods.h"; sourceTree = ""; }; - 080181EDB8F556DDB67ED000C5692CC2 /* ASTableView.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTableView.mm; path = Source/ASTableView.mm; sourceTree = ""; }; - 082886C0D61122680C638DC1C2DF110E /* ASTwoDimensionalArrayUtils.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTwoDimensionalArrayUtils.h; path = Source/Private/ASTwoDimensionalArrayUtils.h; sourceTree = ""; }; - 09018DF2292D2A0DB7CD1AE16D80E0C5 /* PINCache+PINRemoteImageCaching.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINCache+PINRemoteImageCaching.m"; path = "Source/Classes/PINCache/PINCache+PINRemoteImageCaching.m"; sourceTree = ""; }; - 0925F2EB13A379945B242CCCF61B7332 /* ASStackUnpositionedLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackUnpositionedLayout.h; path = Source/Private/Layout/ASStackUnpositionedLayout.h; sourceTree = ""; }; - 0964567655AE549BDF757E8DF816FBFF /* PINMemoryCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINMemoryCache.h; path = Source/PINMemoryCache.h; sourceTree = ""; }; - 09AF3FB906584131B9B0C1DFFE6AE6C5 /* ASContextTransitioning.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASContextTransitioning.h; path = Source/ASContextTransitioning.h; sourceTree = ""; }; - 0A8C0A69A44F45DE13A4D7B103530C5D /* ASTextInput.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextInput.mm; path = Source/TextExperiment/Component/ASTextInput.mm; sourceTree = ""; }; - 0AA919FCE8CBF48395B99617BEC1A794 /* ASInsetLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASInsetLayoutSpec.mm; path = Source/Layout/ASInsetLayoutSpec.mm; sourceTree = ""; }; - 0B6ED2BB64A6A7DA8BC93530E3F55366 /* PINRemoteImage-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PINRemoteImage-umbrella.h"; sourceTree = ""; }; - 0B75C700B8131603E12F188D1B8106A9 /* ASDisplayNode+AsyncDisplay.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+AsyncDisplay.mm"; path = "Source/Private/ASDisplayNode+AsyncDisplay.mm"; sourceTree = ""; }; - 0B764945CCA297AA516A9FE164EFF572 /* _ASCollectionViewCell.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASCollectionViewCell.mm; path = Source/Details/_ASCollectionViewCell.mm; sourceTree = ""; }; - 0BCC06D05C16D5C36D3FB6838DE3FD3B /* ASTextKitShadower.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitShadower.mm; path = Source/TextKit/ASTextKitShadower.mm; sourceTree = ""; }; - 0C168477E2A45EC9CDDD9B24747C1207 /* ASTextUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextUtilities.h; path = Source/TextExperiment/Utility/ASTextUtilities.h; sourceTree = ""; }; - 0C2BF8A59FA951CF59C6FA88A1A8895D /* PINOperation.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = PINOperation.modulemap; sourceTree = ""; }; - 0C8F01CDCDCE46D2A23006B20D5CA9D6 /* ASMainSerialQueue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMainSerialQueue.h; path = Source/Details/ASMainSerialQueue.h; sourceTree = ""; }; - 0DBC478814C98DC8DF9A700BA2AFB12E /* PINAnimatedImageView+PINRemoteImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINAnimatedImageView+PINRemoteImage.h"; path = "Source/Classes/include/PINAnimatedImageView+PINRemoteImage.h"; sourceTree = ""; }; - 0DD9F794407A27FE05F69DF6B83317D4 /* ASCollectionView+Undeprecated.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASCollectionView+Undeprecated.h"; path = "Source/Private/ASCollectionView+Undeprecated.h"; sourceTree = ""; }; - 0E023121733B6B77E3E893B9457AEBF9 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; }; - 0E0960532BDBC2B75DEFB2E46474DFB5 /* ASControlNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASControlNode.h; path = Source/ASControlNode.h; sourceTree = ""; }; - 0E5AE839317B3000199724623D4D2E78 /* ASLayoutTransition.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayoutTransition.mm; path = Source/Private/ASLayoutTransition.mm; sourceTree = ""; }; - 0ECB2E92B3BD6B8EF0C554FFB94D06B1 /* PINCache.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINCache.release.xcconfig; sourceTree = ""; }; - 0F0580A279490FD0D3405F3A050FE99F /* ASTextKitTailTruncater.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitTailTruncater.mm; path = Source/TextKit/ASTextKitTailTruncater.mm; sourceTree = ""; }; - 0FEA06CB098370189C1103854CA5077F /* PINRemoteImageTask.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageTask.m; path = Source/Classes/PINRemoteImageTask.m; sourceTree = ""; }; - 0FEC70814CD0F1C79D7DE05E6FFF8488 /* ASDisplayNode+Ancestry.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+Ancestry.mm"; path = "Source/Base/ASDisplayNode+Ancestry.mm"; sourceTree = ""; }; - 101C500CB65E313FEADB35BA37C18652 /* ASNetworkImageNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASNetworkImageNode.mm; path = Source/ASNetworkImageNode.mm; sourceTree = ""; }; - 115A4FCB2A03922EC10B633F15359653 /* PINRemoteImage */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = PINRemoteImage; path = PINRemoteImage.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1208FD056F60C358052344C12BCD1400 /* NSParagraphStyle+ASText.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "NSParagraphStyle+ASText.mm"; path = "Source/TextExperiment/Utility/NSParagraphStyle+ASText.mm"; sourceTree = ""; }; - 12A41184DB2B2A269071BD7D628084C8 /* UIView+ASConvenience.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+ASConvenience.h"; path = "Source/Details/UIView+ASConvenience.h"; sourceTree = ""; }; - 12C98099C804EEAE8C9E018B386A93C1 /* ASTipNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTipNode.mm; path = Source/Private/ASTipNode.mm; sourceTree = ""; }; - 12F50B842C34A7191176C055E2575D56 /* ASExperimentalFeatures.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASExperimentalFeatures.mm; path = Source/ASExperimentalFeatures.mm; sourceTree = ""; }; - 130371D9D979BBE4A21D3985FF5C0CBA /* PINCachedAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINCachedAnimatedImage.m; path = Source/Classes/AnimatedImages/PINCachedAnimatedImage.m; sourceTree = ""; }; - 133150BCC7C51D98F898F52AC0F3C45F /* ASRecursiveUnfairLock.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRecursiveUnfairLock.h; path = Source/Details/ASRecursiveUnfairLock.h; sourceTree = ""; }; - 1394E4E8CCCBB0C8068E295304334637 /* PINRequestRetryStrategy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRequestRetryStrategy.m; path = Source/Classes/PINRequestRetryStrategy.m; sourceTree = ""; }; - 14D1789AFF19612903A6DEC3719662F3 /* Texture.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Texture.debug.xcconfig; sourceTree = ""; }; - 1516A83197769FFC3107D5C31B19F920 /* ASNetworkImageLoadInfo.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASNetworkImageLoadInfo.mm; path = Source/ASNetworkImageLoadInfo.mm; sourceTree = ""; }; - 1562DF358D6FE1C861DB5005E7283585 /* ASCollectionView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionView.h; path = Source/ASCollectionView.h; sourceTree = ""; }; - 16EE851C878CEB4F785858F098300737 /* ASButtonNode+Yoga.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASButtonNode+Yoga.h"; path = "Source/ASButtonNode+Yoga.h"; sourceTree = ""; }; - 1722A238A2D68ECA7C85A592D48C54E5 /* PINRemoteImageCallbacks.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageCallbacks.m; path = Source/Classes/PINRemoteImageCallbacks.m; sourceTree = ""; }; - 17B19882D4F6EF49F20CF532907FA357 /* ASDisplayNodeExtras.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDisplayNodeExtras.mm; path = Source/ASDisplayNodeExtras.mm; sourceTree = ""; }; - 17C24742A99023F4B3A9592799A2774C /* _ASDisplayViewAccessiblity.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASDisplayViewAccessiblity.mm; path = Source/Details/_ASDisplayViewAccessiblity.mm; sourceTree = ""; }; - 1893C4BD7BA621726AB5154CD30D6CAA /* ASImageNode+AnimatedImagePrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASImageNode+AnimatedImagePrivate.h"; path = "Source/Private/ASImageNode+AnimatedImagePrivate.h"; sourceTree = ""; }; - 1893D93D4FF6D2E7AB3D1FA8B39C79A6 /* ASSectionContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASSectionContext.h; path = Source/Details/ASSectionContext.h; sourceTree = ""; }; - 189BBBEF314F5632F32DEBAB3119AA42 /* PINCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINCache.h; path = Source/PINCache.h; sourceTree = ""; }; - 192F1DF391ED1337AA49D079013BB4CB /* ASDelegateProxy.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDelegateProxy.mm; path = Source/Details/ASDelegateProxy.mm; sourceTree = ""; }; - 1971780E236A6D3739D0E6B97B69EA18 /* ASDKViewController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDKViewController.mm; path = Source/ASDKViewController.mm; sourceTree = ""; }; - 19E4953D755D412B0A70DAC890BD7A73 /* ASVideoNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASVideoNode.h; path = Source/ASVideoNode.h; sourceTree = ""; }; - 1A418CA8EA31332CF2E82E3D634DA6F8 /* ASCollectionNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionNode.mm; path = Source/ASCollectionNode.mm; sourceTree = ""; }; - 1A77A2AEAA733E58FDCD4CAA0922B1A8 /* PINRemoteImageDownloadTask.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageDownloadTask.h; path = Source/Classes/PINRemoteImageDownloadTask.h; sourceTree = ""; }; - 1AB8E5D62AE644B54AF5D74697C539AD /* ASScrollNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASScrollNode.h; path = Source/ASScrollNode.h; sourceTree = ""; }; - 1B17C38B1411972578AA0BDB846A1D26 /* ASCollectionLayoutDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayoutDelegate.h; path = Source/Details/ASCollectionLayoutDelegate.h; sourceTree = ""; }; - 1B1F7C4E0D9921A6C8C1EA3BEE4BFBDA /* ASLayoutManager.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayoutManager.mm; path = Source/TextKit/ASLayoutManager.mm; sourceTree = ""; }; - 1C549603871128C7159E07743161A91B /* ASSupplementaryNodeSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASSupplementaryNodeSource.h; path = Source/ASSupplementaryNodeSource.h; sourceTree = ""; }; - 1C828909B34438BE5193B32873EA167D /* ASCellNode+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASCellNode+Internal.h"; path = "Source/Private/ASCellNode+Internal.h"; sourceTree = ""; }; - 1CD84E09F5FA855D090FB8AA27C039C2 /* PINButton+PINRemoteImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINButton+PINRemoteImage.h"; path = "Source/Classes/include/PINButton+PINRemoteImage.h"; sourceTree = ""; }; - 1CE7BBCB41E46A58DC8E7488324FD50F /* ASInternalHelpers.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASInternalHelpers.mm; path = Source/Private/ASInternalHelpers.mm; sourceTree = ""; }; - 1D0624EFAFE782393194072E17D64812 /* ASCollectionElement.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionElement.h; path = Source/Details/ASCollectionElement.h; sourceTree = ""; }; - 1DBBE6C78D2A10AE3C8E91AC0E6C3244 /* PINRemoteImageManagerConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageManagerConfiguration.h; path = Source/Classes/PINRemoteImageManagerConfiguration.h; sourceTree = ""; }; - 1E1083F610781F72D8F15A82DBFEE569 /* ASConfigurationInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASConfigurationInternal.h; path = Source/ASConfigurationInternal.h; sourceTree = ""; }; - 1E6AFB718C24B2377E5DF0CCDA306C55 /* PINRemoteImageTask+Subclassing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINRemoteImageTask+Subclassing.h"; path = "Source/Classes/Categories/PINRemoteImageTask+Subclassing.h"; sourceTree = ""; }; - 1FB59CB082AC334B86A93F5C8EE3CE76 /* Pods-QuranEngineApp.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-QuranEngineApp.modulemap"; sourceTree = ""; }; - 2009D523A913800A6346404BF1079895 /* ASDisplayNode+Subclasses.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+Subclasses.h"; path = "Source/ASDisplayNode+Subclasses.h"; sourceTree = ""; }; - 2138392302088734C71C953F6E8BE31F /* PINRemoteImageCategoryManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageCategoryManager.h; path = Source/Classes/include/PINRemoteImageCategoryManager.h; sourceTree = ""; }; - 21AAE48CBF0A7AABEB9289F00693D8E4 /* ASAssert.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAssert.h; path = Source/Base/ASAssert.h; sourceTree = ""; }; - 22203E746785DBF3D34302CC70EF9704 /* _ASDisplayView.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASDisplayView.mm; path = Source/Details/_ASDisplayView.mm; sourceTree = ""; }; - 22C347595B1851A1E5B0A3762BB18EC9 /* PINOperation */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = PINOperation; path = PINOperation.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 236CAD7DBD07AD95D58777EA01ACADFC /* ASCollectionViewFlowLayoutInspector.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionViewFlowLayoutInspector.h; path = Source/Private/ASCollectionViewFlowLayoutInspector.h; sourceTree = ""; }; - 23B7B3467E387075BB087F9DF9D8EDF5 /* PINImage+ScaledImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINImage+ScaledImage.m"; path = "Source/Classes/Categories/PINImage+ScaledImage.m"; sourceTree = ""; }; - 23FF327FB28BCDDDA79E921498BD12CC /* ASResponderChainEnumerator.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASResponderChainEnumerator.mm; path = Source/Private/ASResponderChainEnumerator.mm; sourceTree = ""; }; - 249FEB5204659B4680675FC93469BA90 /* ASWeakSet.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASWeakSet.h; path = Source/Details/ASWeakSet.h; sourceTree = ""; }; - 25241914808C5FF6BE5F927F84792A40 /* PINRemoteImageBasicCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageBasicCache.m; path = Source/Classes/PINRemoteImageBasicCache.m; sourceTree = ""; }; - 253A7E0B2BCFBBED7CC995B5E8404245 /* ASConfigurationDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASConfigurationDelegate.h; path = Source/ASConfigurationDelegate.h; sourceTree = ""; }; - 25E33343D6010BA94E0C4D026FFB4684 /* ASAbsoluteLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASAbsoluteLayoutSpec.mm; path = Source/Layout/ASAbsoluteLayoutSpec.mm; sourceTree = ""; }; - 26FAB6173A99700DB3D1C523EA49615F /* _ASDisplayViewAccessiblity.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASDisplayViewAccessiblity.h; path = Source/Details/_ASDisplayViewAccessiblity.h; sourceTree = ""; }; - 274269F974F0098D974E13CADE4FC16A /* PINCache-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PINCache-umbrella.h"; sourceTree = ""; }; - 27966D9EBA4F95DD90B5A40173787561 /* ASCollectionViewLayoutInspector.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionViewLayoutInspector.h; path = Source/Details/ASCollectionViewLayoutInspector.h; sourceTree = ""; }; - 27C34214EA6C1A77DC683F03DC1EBA4A /* Pods-QuranEngineApp-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-QuranEngineApp-Info.plist"; sourceTree = ""; }; - 2832BD3A89507CE25C0F68DDCCEECD2B /* ASTextDebugOption.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextDebugOption.mm; path = Source/TextExperiment/Component/ASTextDebugOption.mm; sourceTree = ""; }; - 287BBF3D32636FA2D987970181E18429 /* ASEditableTextNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASEditableTextNode.mm; path = Source/ASEditableTextNode.mm; sourceTree = ""; }; - 28C3E95F4439C05AD7DD1B694E01B06F /* PINRemoteLock.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteLock.h; path = Source/Classes/PINRemoteLock.h; sourceTree = ""; }; - 291BC2B0BD8A4752A19BB5073AAE4CFB /* ASTextKitRenderer+TextChecking.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASTextKitRenderer+TextChecking.mm"; path = "Source/TextKit/ASTextKitRenderer+TextChecking.mm"; sourceTree = ""; }; - 29F590A258A736639A4D10C302391831 /* PINAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINAnimatedImage.m; path = Source/Classes/AnimatedImages/PINAnimatedImage.m; sourceTree = ""; }; - 2AA9420294B8B16F8BCB961F354D779D /* ASTableNode+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASTableNode+Beta.h"; path = "Source/ASTableNode+Beta.h"; sourceTree = ""; }; - 2AEE11DDE18165E6A0EE511B797F4CD4 /* PINImage+WebP.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINImage+WebP.m"; path = "Source/Classes/Categories/PINImage+WebP.m"; sourceTree = ""; }; - 2B67743FDFF4DCC72D2196FDC564AF55 /* UIImage+ASConvenience.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+ASConvenience.h"; path = "Source/UIImage+ASConvenience.h"; sourceTree = ""; }; - 2C0A55D5092394CDBE41B7565F27BD76 /* PINRemoteImageDownloadTask.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageDownloadTask.m; path = Source/Classes/PINRemoteImageDownloadTask.m; sourceTree = ""; }; - 2C3B9DD9DB1D1CEAB6AAB8F90ACB0114 /* ASTextNodeWordKerner.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextNodeWordKerner.mm; path = Source/TextKit/ASTextNodeWordKerner.mm; sourceTree = ""; }; - 2C41CB510A0394AE786A47727010CFF4 /* PINOperation.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINOperation.release.xcconfig; sourceTree = ""; }; - 2D08D914160D3368A237E541232421E1 /* PINRemoteImageProcessorTask.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageProcessorTask.h; path = Source/Classes/PINRemoteImageProcessorTask.h; sourceTree = ""; }; - 2D4826F2BC6F23F0D1D5D7C2B56F609A /* ASTableNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTableNode.h; path = Source/ASTableNode.h; sourceTree = ""; }; - 2F0577D80BE46EEF43F1895FBA8971D7 /* ASDisplayNode+UIViewBridge.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+UIViewBridge.mm"; path = "Source/Private/ASDisplayNode+UIViewBridge.mm"; sourceTree = ""; }; - 2F1876604918F7E85C8C8C00692D7E31 /* PINAlternateRepresentationProvider.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINAlternateRepresentationProvider.m; path = Source/Classes/PINAlternateRepresentationProvider.m; sourceTree = ""; }; - 2FBAAA96983188539E41341E456234CA /* ASCollectionLayoutCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayoutCache.h; path = Source/Private/ASCollectionLayoutCache.h; sourceTree = ""; }; - 30135D721A505FFF41C404E5409E5A72 /* ASBatchContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBatchContext.h; path = Source/Details/ASBatchContext.h; sourceTree = ""; }; - 3023FD70567259A9709DB6D08DB58E7B /* ASVisibilityProtocols.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASVisibilityProtocols.h; path = Source/ASVisibilityProtocols.h; sourceTree = ""; }; - 302B87C2A12CAA6C0D44495FD98EE635 /* ASDisplayNode+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+Beta.h"; path = "Source/ASDisplayNode+Beta.h"; sourceTree = ""; }; - 3044A0A84359FF4C21226519C51C96C4 /* ASTextKitEntityAttribute.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitEntityAttribute.mm; path = Source/TextKit/ASTextKitEntityAttribute.mm; sourceTree = ""; }; - 304DB8B9A1950B22EE250D24711D2241 /* NSMutableAttributedString+TextKitAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSMutableAttributedString+TextKitAdditions.h"; path = "Source/Details/NSMutableAttributedString+TextKitAdditions.h"; sourceTree = ""; }; - 3060F659804F1C8C5BA9D2F576868572 /* ASMainThreadDeallocation.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMainThreadDeallocation.mm; path = Source/ASMainThreadDeallocation.mm; sourceTree = ""; }; - 30AAE7A11260BD7F39C310127D106EFD /* ASDisplayNode+InterfaceState.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+InterfaceState.h"; path = "Source/ASDisplayNode+InterfaceState.h"; sourceTree = ""; }; - 31C0F07FBE2B0199D42A94420D767D13 /* ASImageContainerProtocolCategories.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASImageContainerProtocolCategories.h; path = Source/Details/ASImageContainerProtocolCategories.h; sourceTree = ""; }; - 32829D76BB23477EA25503BE715219D9 /* ASCollectionNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionNode.h; path = Source/ASCollectionNode.h; sourceTree = ""; }; - 32D6B40B4029E043B124DADB7A6990F1 /* ASControlNode+tvOS.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASControlNode+tvOS.mm"; path = "Source/tvOS/ASControlNode+tvOS.mm"; sourceTree = ""; }; - 32EB6C106FA09F467D5200E9137E7077 /* ASCollectionGalleryLayoutDelegate.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionGalleryLayoutDelegate.mm; path = Source/Details/ASCollectionGalleryLayoutDelegate.mm; sourceTree = ""; }; - 33752E15A6BDBC7CB622AEC88A8975D1 /* _ASDisplayView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASDisplayView.h; path = Source/Details/_ASDisplayView.h; sourceTree = ""; }; - 343547A19426C36360D10F65273D1B44 /* ASLayoutRangeType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutRangeType.h; path = Source/Details/ASLayoutRangeType.h; sourceTree = ""; }; - 3541CF1CA219182BE21D65B61E860DD6 /* ASLayout+IGListDiffKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASLayout+IGListDiffKit.h"; path = "Source/Layout/ASLayout+IGListDiffKit.h"; sourceTree = ""; }; - 365E24AE7E774D0386BE4163F202EB5F /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Photos.framework; sourceTree = DEVELOPER_DIR; }; - 377649CF33B79386CD1F8EF21FB631EB /* ASTextKitRenderer.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitRenderer.mm; path = Source/TextKit/ASTextKitRenderer.mm; sourceTree = ""; }; - 382FCE39DC2EEBB085E6958DDCBDA1C0 /* ASIntegerMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASIntegerMap.h; path = Source/Details/ASIntegerMap.h; sourceTree = ""; }; - 387CB21D415B12F060C1F1855FC1AC1F /* ASMapNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMapNode.h; path = Source/ASMapNode.h; sourceTree = ""; }; - 38E37DA2E14FA769C25B5D00F8363628 /* ASDisplayNode+Convenience.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+Convenience.h"; path = "Source/ASDisplayNode+Convenience.h"; sourceTree = ""; }; - 39469547584715DC15C17FD3249DB5F3 /* PINRemoteImageManagerResult.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageManagerResult.m; path = Source/Classes/PINRemoteImageManagerResult.m; sourceTree = ""; }; - 3A7371016C02C4F31AFC5DD262420436 /* ASSection.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASSection.mm; path = Source/Private/ASSection.mm; sourceTree = ""; }; - 3B1845C0E5332B989F16FD7C9CF5E002 /* ASCollectionLayoutContext.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionLayoutContext.mm; path = Source/Details/ASCollectionLayoutContext.mm; sourceTree = ""; }; - 3B76C13871113610B790E5634FD8E4B7 /* PINRemoteImageMemoryContainer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageMemoryContainer.m; path = Source/Classes/PINRemoteImageMemoryContainer.m; sourceTree = ""; }; - 3C0F40B2FE9CE8B3D3D151D7E694F267 /* ASMultiplexImageNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMultiplexImageNode.h; path = Source/ASMultiplexImageNode.h; sourceTree = ""; }; - 3C142AE69390BD4A73E53965CAE19F6C /* ASBatchFetching.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBatchFetching.h; path = Source/Private/ASBatchFetching.h; sourceTree = ""; }; - 3C5A6AEC41EFC3AD25534536494FF0B1 /* PINImage+ScaledImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINImage+ScaledImage.h"; path = "Source/Classes/Categories/PINImage+ScaledImage.h"; sourceTree = ""; }; - 3C69FF5E87A081B57AFD9CF41C19BC10 /* PINCachedAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINCachedAnimatedImage.h; path = Source/Classes/include/PINCachedAnimatedImage.h; sourceTree = ""; }; - 3C7CB66DC3DADF06304DCD664B39A8CC /* ASDisplayNodeTipState.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDisplayNodeTipState.mm; path = Source/Private/ASDisplayNodeTipState.mm; sourceTree = ""; }; - 3C8F71BC92C3939CC05FD410E84FF05C /* PINRemoteImageDownloadQueue.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageDownloadQueue.m; path = Source/Classes/PINRemoteImageDownloadQueue.m; sourceTree = ""; }; - 3CAF3AC46F7A1841E56DA5B95393B2DA /* ASLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayout.mm; path = Source/Layout/ASLayout.mm; sourceTree = ""; }; - 3D673E12DB0B97C4702DCA57BD907DCD /* PINWebPAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINWebPAnimatedImage.m; path = Source/Classes/AnimatedImages/PINWebPAnimatedImage.m; sourceTree = ""; }; - 3DFDAF1C61430DC7560FD8398184E746 /* ASDataController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDataController.h; path = Source/Details/ASDataController.h; sourceTree = ""; }; - 3E469CBD7D7AB5AB0A7A4DBF776B412C /* ASPageTable.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPageTable.mm; path = Source/Details/ASPageTable.mm; sourceTree = ""; }; - 3F7DA777C38E96B00111DFE0BEFE7913 /* ASBasicImageDownloaderInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBasicImageDownloaderInternal.h; path = Source/Private/ASBasicImageDownloaderInternal.h; sourceTree = ""; }; - 3FD39AB697A115622B17BFABEDA432DA /* ASTableView+Undeprecated.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASTableView+Undeprecated.h"; path = "Source/Private/ASTableView+Undeprecated.h"; sourceTree = ""; }; - 3FECF0B1CB87C301963988E2A0901EBA /* ASDimensionInternal.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDimensionInternal.mm; path = Source/Layout/ASDimensionInternal.mm; sourceTree = ""; }; - 407FB4E16539D50C5FC805D4654328C0 /* ASTextKitAttributes.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitAttributes.mm; path = Source/TextKit/ASTextKitAttributes.mm; sourceTree = ""; }; - 40BDB2BBE7BEFFBD7F245B28C4E6C701 /* ASTextKitRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitRenderer.h; path = Source/TextKit/ASTextKitRenderer.h; sourceTree = ""; }; - 4104FF64ECC788CAAF748ED3F714E463 /* ASTipsWindow.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTipsWindow.h; path = Source/Private/ASTipsWindow.h; sourceTree = ""; }; - 41164F15B6082BB9672F7AE39D3A0BC2 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreLocation.framework; sourceTree = DEVELOPER_DIR; }; - 4196799D492FD6012BE48E0B05F5AE84 /* IGListAdapter+AsyncDisplayKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "IGListAdapter+AsyncDisplayKit.h"; path = "Source/IGListAdapter+AsyncDisplayKit.h"; sourceTree = ""; }; - 41D390D3B3D39D7288BF1633D2578E1E /* NSAttributedString+ASText.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "NSAttributedString+ASText.mm"; path = "Source/TextExperiment/Utility/NSAttributedString+ASText.mm"; sourceTree = ""; }; - 42F1BDB74A174F9531FB779E45BC1D50 /* PINRemoteImageCategoryManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageCategoryManager.m; path = Source/Classes/PINRemoteImageCategoryManager.m; sourceTree = ""; }; - 4344BE434739CB35CB35BD2CBC0F28C8 /* Pods-QuranEngineApp-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-QuranEngineApp-dummy.m"; sourceTree = ""; }; - 442AD1A685AA2C1A7EDB840685B29CCB /* PINDisplayLink.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINDisplayLink.h; path = Source/Classes/PINDisplayLink.h; sourceTree = ""; }; - 451F8219FEECBEF1D8D5576A706A6259 /* PINImage+DecodedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINImage+DecodedImage.h"; path = "Source/Classes/Categories/PINImage+DecodedImage.h"; sourceTree = ""; }; - 459480ACA012E8B711EC651102EE9B97 /* _ASCoreAnimationExtras.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASCoreAnimationExtras.h; path = Source/Private/_ASCoreAnimationExtras.h; sourceTree = ""; }; - 464DA86594E87233E4D9CCD47A021814 /* _ASPendingState.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASPendingState.h; path = Source/Private/_ASPendingState.h; sourceTree = ""; }; - 4669024F2BF886C67DA02F1EADDD4B34 /* ASCollectionLayoutState+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASCollectionLayoutState+Private.h"; path = "Source/Private/ASCollectionLayoutState+Private.h"; sourceTree = ""; }; - 468C6B00497AF557588B204F60C36995 /* AsyncDisplayKit+Debug.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "AsyncDisplayKit+Debug.mm"; path = "Source/Debug/AsyncDisplayKit+Debug.mm"; sourceTree = ""; }; - 46A81686966FE14D546FC1B2752C1DA3 /* ASPINRemoteImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPINRemoteImageDownloader.h; path = Source/Details/ASPINRemoteImageDownloader.h; sourceTree = ""; }; - 4724F74EA5D82E9E84275D106EA514D7 /* ASInsetLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASInsetLayoutSpec.h; path = Source/Layout/ASInsetLayoutSpec.h; sourceTree = ""; }; - 474F334721D6E818D56CC8B9B8BD4076 /* PINRemoteWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteWeakProxy.h; path = Source/Classes/PINRemoteWeakProxy.h; sourceTree = ""; }; - 47A6422944ED734522F40BD5F558F965 /* ASPhotosFrameworkImageRequest.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPhotosFrameworkImageRequest.h; path = Source/Details/ASPhotosFrameworkImageRequest.h; sourceTree = ""; }; - 48611848109A2670480AB38B56828E63 /* ASDimension.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDimension.mm; path = Source/Layout/ASDimension.mm; sourceTree = ""; }; - 499BEB74B775484B70F1E00E8A3A16F5 /* ASImageNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASImageNode.mm; path = Source/ASImageNode.mm; sourceTree = ""; }; - 49EC90EF95A2BAABAA44D24EA9E6115B /* PINCache.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINCache.debug.xcconfig; sourceTree = ""; }; - 4A3946BBDD543EEDC30603027F06A40F /* ASCollections.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollections.h; path = Source/ASCollections.h; sourceTree = ""; }; - 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 4AD14C8259CFDAA23540FB84371A8C91 /* PINCacheObjectSubscripting.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINCacheObjectSubscripting.h; path = Source/PINCacheObjectSubscripting.h; sourceTree = ""; }; - 4B7B1CC63BD296A46ED1CEB0FA607516 /* ASImageNode+CGExtras.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASImageNode+CGExtras.mm"; path = "Source/Private/ASImageNode+CGExtras.mm"; sourceTree = ""; }; - 4B8715D6A274E204E86D6D00E36A455F /* ASLog.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLog.mm; path = Source/Base/ASLog.mm; sourceTree = ""; }; - 4BD9DD2E4BB46C40D56BA707F879069C /* ASDefaultPlaybackButton.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDefaultPlaybackButton.h; path = Source/Private/ASDefaultPlaybackButton.h; sourceTree = ""; }; - 4BE37DED04CFA8DBDAFA0E035F0BC0A4 /* ASWeakMap.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASWeakMap.mm; path = Source/Private/ASWeakMap.mm; sourceTree = ""; }; - 4C1438B16C14D44EF0751DA9D54E159B /* ASBlockTypes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBlockTypes.h; path = Source/ASBlockTypes.h; sourceTree = ""; }; - 4C584AA9A3914BF339E0DB00EC5F3B3B /* ASConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASConfiguration.h; path = Source/ASConfiguration.h; sourceTree = ""; }; - 4C6957DFA7DC3711E2FE0F5E9C8209F7 /* ASTextKitContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitContext.h; path = Source/TextKit/ASTextKitContext.h; sourceTree = ""; }; - 4C8BC130248DB0AD806FA743C70A99B4 /* PINRemoteImageCaching.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageCaching.h; path = Source/Classes/include/PINRemoteImageCaching.h; sourceTree = ""; }; - 4D07DA51F20E2AE45BECE7B5E0467AF4 /* ASDKNavigationController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDKNavigationController.h; path = Source/ASDKNavigationController.h; sourceTree = ""; }; - 4FC3074532017641CE4C1CCC8CD8C8E9 /* ASImageProtocols.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASImageProtocols.h; path = Source/Details/ASImageProtocols.h; sourceTree = ""; }; - 4FDB5D100D95E852ACB475039D799BAA /* ASTextNode2.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextNode2.mm; path = Source/ASTextNode2.mm; sourceTree = ""; }; - 4FE8339B40FB00918941FBCDC5F30D28 /* PINProgressiveImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINProgressiveImage.m; path = Source/Classes/PINProgressiveImage.m; sourceTree = ""; }; - 4FF622BC541C8BD3E08AED356B586CC7 /* ASTextDebugOption.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextDebugOption.h; path = Source/TextExperiment/Component/ASTextDebugOption.h; sourceTree = ""; }; - 5004C451718460F7D56C8FF16F8302DC /* _ASAsyncTransaction.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASAsyncTransaction.h; path = Source/Details/Transactions/_ASAsyncTransaction.h; sourceTree = ""; }; - 502A1AF0D1162A604BFAE562084D2650 /* ASCollectionLayoutState.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayoutState.h; path = Source/Details/ASCollectionLayoutState.h; sourceTree = ""; }; - 5066030CB479AECAC177DC4DA00EA437 /* ASDisplayNode+DebugTiming.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+DebugTiming.h"; path = "Source/Private/ASDisplayNode+DebugTiming.h"; sourceTree = ""; }; - 50A360C0E00F5E499E17868877A51886 /* ASPagerFlowLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPagerFlowLayout.h; path = Source/ASPagerFlowLayout.h; sourceTree = ""; }; - 50CF5283C029686E560F1AB090D8EE09 /* ASEditableTextNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASEditableTextNode.h; path = Source/ASEditableTextNode.h; sourceTree = ""; }; - 510DCE3B48F67D693EF6D5292014D927 /* PINRemoteImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PINRemoteImage-dummy.m"; sourceTree = ""; }; - 5115C643F8FBE97D808B961FCDAE9FAA /* ASCollectionFlowLayoutDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionFlowLayoutDelegate.h; path = Source/Details/ASCollectionFlowLayoutDelegate.h; sourceTree = ""; }; - 51E4828747ABF0F4B0D5210073FD2269 /* PINURLSessionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINURLSessionManager.h; path = Source/Classes/include/PINURLSessionManager.h; sourceTree = ""; }; - 5316B79F60F907878E80E6789410C62C /* PINAlternateRepresentationProvider.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINAlternateRepresentationProvider.h; path = Source/Classes/include/PINAlternateRepresentationProvider.h; sourceTree = ""; }; - 53C048263488DB6D71F9D8AE1C46CA2E /* ASRelativeLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASRelativeLayoutSpec.mm; path = Source/Layout/ASRelativeLayoutSpec.mm; sourceTree = ""; }; - 54068F4ABB2F3C303CD1FD89B41B928A /* AsyncDisplayKit+Debug.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "AsyncDisplayKit+Debug.h"; path = "Source/Debug/AsyncDisplayKit+Debug.h"; sourceTree = ""; }; - 5446BF8F6EE5445BB8095CED507BA6E0 /* PINGIFAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINGIFAnimatedImage.m; path = Source/Classes/AnimatedImages/PINGIFAnimatedImage.m; sourceTree = ""; }; - 54CFBE333F65B7EDA509A152520B2FE8 /* ASGraphicsContext.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASGraphicsContext.mm; path = Source/Details/ASGraphicsContext.mm; sourceTree = ""; }; - 556D557F23FCD191B665690B58AC0B95 /* PINOperationTypes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINOperationTypes.h; path = Source/PINOperationTypes.h; sourceTree = ""; }; - 5688A739BB7B10A17AF1E41094FBDD6B /* PINRemoteImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImage.h; path = Source/Classes/include/PINRemoteImage.h; sourceTree = ""; }; - 570D139FC142DE14276857D5A821A0FF /* ASImageNode+CGExtras.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASImageNode+CGExtras.h"; path = "Source/Private/ASImageNode+CGExtras.h"; sourceTree = ""; }; - 5794D63296580A82E5E7C507426C095A /* AsyncDisplayKit+Tips.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "AsyncDisplayKit+Tips.mm"; path = "Source/Debug/AsyncDisplayKit+Tips.mm"; sourceTree = ""; }; - 57CE5902148A0250A2BEB4005867E04B /* ASWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASWeakProxy.h; path = Source/Details/ASWeakProxy.h; sourceTree = ""; }; - 5893347DA4277D44FB96AB464F7CF90F /* _ASAsyncTransactionGroup.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASAsyncTransactionGroup.h; path = Source/Details/Transactions/_ASAsyncTransactionGroup.h; sourceTree = ""; }; - 596D151CD704967A068249BD31633252 /* IGListAdapter+AsyncDisplayKit.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "IGListAdapter+AsyncDisplayKit.mm"; path = "Source/IGListAdapter+AsyncDisplayKit.mm"; sourceTree = ""; }; - 59B418A0524261ACCF5B3790959575D0 /* NSArray+Diffing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSArray+Diffing.h"; path = "Source/Details/NSArray+Diffing.h"; sourceTree = ""; }; - 59BD0CDED5ED108B0885BE7DFC4A68E8 /* ASNetworkImageNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASNetworkImageNode.h; path = Source/ASNetworkImageNode.h; sourceTree = ""; }; - 5B3B2D807DDE9140D13F1BED76A34345 /* ASEqualityHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASEqualityHelpers.h; path = Source/Base/ASEqualityHelpers.h; sourceTree = ""; }; - 5B4C160BB1D1EAFFEB4F75A0CF1EA928 /* ASHighlightOverlayLayer.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASHighlightOverlayLayer.mm; path = Source/Details/ASHighlightOverlayLayer.mm; sourceTree = ""; }; - 5C3081E402EC8789804799F6CEBE2AF8 /* ASDimension.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDimension.h; path = Source/Layout/ASDimension.h; sourceTree = ""; }; - 5C4AA3335C622751A32A744499AF7CE2 /* Texture.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Texture.modulemap; sourceTree = ""; }; - 5D3B7C494DBBC77452128797B437E9E1 /* ASTextNodeTypes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextNodeTypes.h; path = Source/TextKit/ASTextNodeTypes.h; sourceTree = ""; }; - 5D61736478ADD34089F46F34DE790B9E /* ASTextRunDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextRunDelegate.h; path = Source/TextExperiment/String/ASTextRunDelegate.h; sourceTree = ""; }; - 5D9A1BD9C0606FBED915D19AC8603AA4 /* ASTextNodeWordKerner.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextNodeWordKerner.h; path = Source/TextKit/ASTextNodeWordKerner.h; sourceTree = ""; }; - 5DF8B304DBA0CBC598EE18B439A1C212 /* ASElementMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASElementMap.h; path = Source/Details/ASElementMap.h; sourceTree = ""; }; - 5E9292AB0D65D0A517746350324A78C5 /* ASButtonNode+Yoga.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASButtonNode+Yoga.mm"; path = "Source/ASButtonNode+Yoga.mm"; sourceTree = ""; }; - 5F5D034DB1ED346FED8B825B2C4FACAE /* NSData+ImageDetectors.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSData+ImageDetectors.m"; path = "Source/Classes/Categories/NSData+ImageDetectors.m"; sourceTree = ""; }; - 5F931D5FCD505A1EC8D4200499DD5F5D /* ASTextKitTruncating.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitTruncating.h; path = Source/TextKit/ASTextKitTruncating.h; sourceTree = ""; }; - 5FADC7F093D717EE9BECA3901F55F5E8 /* ASNetworkImageLoadInfo+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASNetworkImageLoadInfo+Private.h"; path = "Source/Private/ASNetworkImageLoadInfo+Private.h"; sourceTree = ""; }; - 5FC31CE875CC6172C8C3812D71F911F6 /* ASCollectionView.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionView.mm; path = Source/ASCollectionView.mm; sourceTree = ""; }; - 60461860653D726EFE44A0FFBAAF8ED5 /* NSIndexSet+ASHelpers.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "NSIndexSet+ASHelpers.mm"; path = "Source/Details/NSIndexSet+ASHelpers.mm"; sourceTree = ""; }; - 60E2A9C368D8B4DB87B8786A1150005A /* PINCache+PINRemoteImageCaching.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINCache+PINRemoteImageCaching.h"; path = "Source/Classes/include/PINCache+PINRemoteImageCaching.h"; sourceTree = ""; }; - 611F6E0CC80F30ACC082D9A680BB117D /* ASPagerNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPagerNode.mm; path = Source/ASPagerNode.mm; sourceTree = ""; }; - 6129268C2516319929891120A1E27FC2 /* ASTextKitShadower.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitShadower.h; path = Source/TextKit/ASTextKitShadower.h; sourceTree = ""; }; - 61EDE95498912E240C229AB97E34256D /* ASControlNode+Subclasses.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASControlNode+Subclasses.h"; path = "Source/ASControlNode+Subclasses.h"; sourceTree = ""; }; - 626548E82C01FE272CD114C9F7F07556 /* PINWebPAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINWebPAnimatedImage.h; path = Source/Classes/include/PINWebPAnimatedImage.h; sourceTree = ""; }; - 62F113024ED798469066EFDFED7CBAFD /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/MapKit.framework; sourceTree = DEVELOPER_DIR; }; - 6320170E5A5A268B11CAE15D4EF6A9E3 /* PINCache */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = PINCache; path = PINCache.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 634E28B24436274FC8F31C3B6675E408 /* ASDisplayNode+Yoga.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+Yoga.mm"; path = "Source/ASDisplayNode+Yoga.mm"; sourceTree = ""; }; - 635A8DB9ABD3EE0FFC5E3308011CDF36 /* Texture-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Texture-prefix.pch"; sourceTree = ""; }; - 63A327AEF7214DE08274E6B39CA93EE6 /* ASCollectionLayoutContext+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASCollectionLayoutContext+Private.h"; path = "Source/Private/ASCollectionLayoutContext+Private.h"; sourceTree = ""; }; - 64116DD37F68B07B3B0DE77751C883F1 /* PINOperation-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PINOperation-prefix.pch"; sourceTree = ""; }; - 644886BA7CFC1053B9A6C8A36B219C36 /* ASSectionController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASSectionController.h; path = Source/ASSectionController.h; sourceTree = ""; }; - 647F606801780C21B7C5F64B1DEEE95B /* ASTableLayoutController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTableLayoutController.h; path = Source/Details/ASTableLayoutController.h; sourceTree = ""; }; - 64AE383F5557C4EB6C02982624E9A40C /* ASInternalHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASInternalHelpers.h; path = Source/Private/ASInternalHelpers.h; sourceTree = ""; }; - 653B60B3AE6439CBED7A8CCF420C9F23 /* ASResponderChainEnumerator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASResponderChainEnumerator.h; path = Source/Private/ASResponderChainEnumerator.h; sourceTree = ""; }; - 653C571887BCC0FD884AF442FC1DC0B3 /* ASDKNavigationController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDKNavigationController.mm; path = Source/ASDKNavigationController.mm; sourceTree = ""; }; - 654D1E21BE6823C591A608C6EC9D313B /* ASTextKitContext.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitContext.mm; path = Source/TextKit/ASTextKitContext.mm; sourceTree = ""; }; - 66CD319551B9DF30B551A822C17C5AD3 /* ASCollectionInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionInternal.h; path = Source/Details/ASCollectionInternal.h; sourceTree = ""; }; - 66E1BC9CB957444098D7B71E55F09C0A /* ASLayoutElementStylePrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutElementStylePrivate.h; path = Source/Private/Layout/ASLayoutElementStylePrivate.h; sourceTree = ""; }; - 6721E5BEB6FCC93087D899B00F020D5A /* PINRemoteImage-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "PINRemoteImage-Info.plist"; sourceTree = ""; }; - 696B1E4E1E531979AE43F3DC2B69451D /* ASControlTargetAction.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASControlTargetAction.mm; path = Source/Private/ASControlTargetAction.mm; sourceTree = ""; }; - 697D7E44BDE5BE4A0ACDE3DCC1A75DF9 /* ASNetworkImageLoadInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASNetworkImageLoadInfo.h; path = Source/ASNetworkImageLoadInfo.h; sourceTree = ""; }; - 698E06A587E68956D375DE4DDE77643D /* ASTableViewInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTableViewInternal.h; path = Source/ASTableViewInternal.h; sourceTree = ""; }; - 6B20999B345220EA81A18684BC483B2D /* PINURLSessionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINURLSessionManager.m; path = Source/Classes/PINURLSessionManager.m; sourceTree = ""; }; - 6B29341AF11942A1CF41CA21A3FF4E5E /* ASTextNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextNode.h; path = Source/ASTextNode.h; sourceTree = ""; }; - 6CD3D1C0D4D8CBF5CA28CA219F540B6F /* ASLocking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLocking.h; path = Source/ASLocking.h; sourceTree = ""; }; - 6D2AECAEFF21A26F4089B4E9E11C31AC /* ASDisplayNode+DebugTiming.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+DebugTiming.mm"; path = "Source/Private/ASDisplayNode+DebugTiming.mm"; sourceTree = ""; }; - 6D2D1D6444B898D1B0C87B8603DD4677 /* UIImage+ASConvenience.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "UIImage+ASConvenience.mm"; path = "Source/UIImage+ASConvenience.mm"; sourceTree = ""; }; - 6D9A2760AB1BED75D27EFE6C00D733F5 /* ASPagerNode+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASPagerNode+Beta.h"; path = "Source/ASPagerNode+Beta.h"; sourceTree = ""; }; - 6E1FF80D8DFD98C50DC0CDBD4035A7D1 /* ASTextInput.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextInput.h; path = Source/TextExperiment/Component/ASTextInput.h; sourceTree = ""; }; - 6E6AF2C7E319D3349B43F473AB518D7D /* ASDisplayNode+Convenience.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+Convenience.mm"; path = "Source/ASDisplayNode+Convenience.mm"; sourceTree = ""; }; - 6E85211C3E73669751A40E002713DD16 /* ASWeakProxy.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASWeakProxy.mm; path = Source/Details/ASWeakProxy.mm; sourceTree = ""; }; - 6EB9B106DEE047870AA875F49ACC645D /* ASRelativeLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRelativeLayoutSpec.h; path = Source/Layout/ASRelativeLayoutSpec.h; sourceTree = ""; }; - 6EE68909B7765A77F72DBD6656DED504 /* ASPendingStateController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPendingStateController.mm; path = Source/Private/ASPendingStateController.mm; sourceTree = ""; }; - 6F1D0CDE40B7ADECFF3A55527DA6DDC0 /* PINCache-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PINCache-dummy.m"; sourceTree = ""; }; - 6F33F5C8DDECA132574B0DB8D48E5DFF /* ASBasicImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBasicImageDownloader.h; path = Source/Details/ASBasicImageDownloader.h; sourceTree = ""; }; - 6FA8B88434F89A38DB5CEC77891BEAC7 /* PINOperationMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINOperationMacros.h; path = Source/PINOperationMacros.h; sourceTree = ""; }; - 6FEDA9949DABCA4821DDDD0414408B22 /* Texture-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Texture-umbrella.h"; sourceTree = ""; }; - 707AD0C30453447CAB84AF3E8B2B3061 /* ASTipProvider.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTipProvider.mm; path = Source/Private/ASTipProvider.mm; sourceTree = ""; }; - 70907139FDD30DCEEA7A9190BA24A9D8 /* PINRemoteLock.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteLock.m; path = Source/Classes/PINRemoteLock.m; sourceTree = ""; }; - 70B768A05FD334709DCA17525D948B79 /* ASPagerFlowLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPagerFlowLayout.mm; path = Source/ASPagerFlowLayout.mm; sourceTree = ""; }; - 70F6544304C7BD9E41434910024503C7 /* ASDisplayNode+Layout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+Layout.mm"; path = "Source/ASDisplayNode+Layout.mm"; sourceTree = ""; }; - 710255221831EECED77AD74713D6CB3F /* ASRatioLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRatioLayoutSpec.h; path = Source/Layout/ASRatioLayoutSpec.h; sourceTree = ""; }; - 71FF5DE9C308C4D21300343B8F095CBA /* UICollectionViewLayout+ASConvenience.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "UICollectionViewLayout+ASConvenience.mm"; path = "Source/Details/UICollectionViewLayout+ASConvenience.mm"; sourceTree = ""; }; - 72097EDC568749414EDF3AC657BB07C3 /* PINImageView+PINRemoteImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINImageView+PINRemoteImage.h"; path = "Source/Classes/include/PINImageView+PINRemoteImage.h"; sourceTree = ""; }; - 724EB6C3115CB64B623A1D3679B1EAFE /* ASTextKitFontSizeAdjuster.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitFontSizeAdjuster.h; path = Source/TextKit/ASTextKitFontSizeAdjuster.h; sourceTree = ""; }; - 726CEC415E5A334A863F7AEF7DE44DED /* ASWeakMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASWeakMap.h; path = Source/Private/ASWeakMap.h; sourceTree = ""; }; - 7302265D1F954C78B31920D3B049E09A /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; - 736C046DCA265EE81A58FD5F89BF6102 /* PINGIFAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINGIFAnimatedImage.h; path = Source/Classes/include/PINGIFAnimatedImage.h; sourceTree = ""; }; - 73AA3A23C9F3D8C94C70E9CD5CAB902C /* PINResume.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINResume.m; path = Source/Classes/PINResume.m; sourceTree = ""; }; - 740E73D5D26B9B72C2F6662218F80E8E /* UICollectionViewLayout+ASConvenience.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UICollectionViewLayout+ASConvenience.h"; path = "Source/Details/UICollectionViewLayout+ASConvenience.h"; sourceTree = ""; }; - 741BAE82F2A2B69F81AE5008435BADE3 /* PINOperation-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "PINOperation-dummy.m"; sourceTree = ""; }; - 7428C524EFC7D50242D9CF71007C0A93 /* PINCache-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PINCache-prefix.pch"; sourceTree = ""; }; - 74809872EF01A2A8B9F326A491E24F33 /* _ASCollectionGalleryLayoutItem.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASCollectionGalleryLayoutItem.h; path = Source/Private/_ASCollectionGalleryLayoutItem.h; sourceTree = ""; }; - 74C846C2AC2B4F5854716D659394AAFD /* CoreGraphics+ASConvenience.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "CoreGraphics+ASConvenience.h"; path = "Source/Details/CoreGraphics+ASConvenience.h"; sourceTree = ""; }; - 753ECF455589A055CD627680B98CBFB5 /* ASTraitCollection.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTraitCollection.mm; path = Source/Details/ASTraitCollection.mm; sourceTree = ""; }; - 754964278CA439B0C3D6B289E044C695 /* ASTabBarController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTabBarController.mm; path = Source/ASTabBarController.mm; sourceTree = ""; }; - 754A82109BC04437A4A65082E1DF2C78 /* ASIntegerMap.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASIntegerMap.mm; path = Source/Details/ASIntegerMap.mm; sourceTree = ""; }; - 75D035E21022C7914A95EFF5FC065FF3 /* ASStackLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutSpec.h; path = Source/Layout/ASStackLayoutSpec.h; sourceTree = ""; }; - 76660865DC7BA0803ED5AF36FA8E6ECA /* PINSpeedRecorder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINSpeedRecorder.m; path = Source/Classes/PINSpeedRecorder.m; sourceTree = ""; }; - 76686F482DAB3F96891D68B0BFEF3CA5 /* ASDisplayNode+LayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+LayoutSpec.h"; path = "Source/ASDisplayNode+LayoutSpec.h"; sourceTree = ""; }; - 773FC3074F118DBE19C9C2A18699AB84 /* PINRemoteImage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINRemoteImage.release.xcconfig; sourceTree = ""; }; - 779F44EDEC0EBFE936BA493AAAB6A213 /* ASDispatch.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDispatch.h; path = Source/Private/ASDispatch.h; sourceTree = ""; }; - 783DD2ED522F17F620CC784D424E66E7 /* _ASAsyncTransaction.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASAsyncTransaction.mm; path = Source/Details/Transactions/_ASAsyncTransaction.mm; sourceTree = ""; }; - 790FD97BCBD0110961780552C759DF98 /* PINImageView+PINRemoteImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINImageView+PINRemoteImage.m"; path = "Source/Classes/ImageCategories/PINImageView+PINRemoteImage.m"; sourceTree = ""; }; - 79222AC676D15A57DFFB0F575D6E86F4 /* ASTextUtilities.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextUtilities.mm; path = Source/TextExperiment/Utility/ASTextUtilities.mm; sourceTree = ""; }; - 79B1CEDE11B0A34B5F18968527A72ECA /* ASTwoDimensionalArrayUtils.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTwoDimensionalArrayUtils.mm; path = Source/Private/ASTwoDimensionalArrayUtils.mm; sourceTree = ""; }; - 7BF99DF1F99AF5F8AD7D64AAF2BA1E44 /* ASCollectionElement.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionElement.mm; path = Source/Details/ASCollectionElement.mm; sourceTree = ""; }; - 7DBE419CB2F290B559A7011979017C7D /* Texture.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Texture.release.xcconfig; sourceTree = ""; }; - 7DD4634BD8153FE183A214BA8F59088A /* ASDispatch.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDispatch.mm; path = Source/Private/ASDispatch.mm; sourceTree = ""; }; - 7DF4F7B0BA067B961678630F5F60E673 /* ASDisplayNode+FrameworkPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+FrameworkPrivate.h"; path = "Source/Private/ASDisplayNode+FrameworkPrivate.h"; sourceTree = ""; }; - 7E34A7732DD6E306B133286A39E05A97 /* ASNodeController+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASNodeController+Beta.h"; path = "Source/ASNodeController+Beta.h"; sourceTree = ""; }; - 7E77840DF764C7052517CF2ED7FF71A3 /* PINImage+DecodedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINImage+DecodedImage.m"; path = "Source/Classes/Categories/PINImage+DecodedImage.m"; sourceTree = ""; }; - 7ED705D4E8F55EAC73E817A7B629980F /* ASTextKitFontSizeAdjuster.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitFontSizeAdjuster.mm; path = Source/TextKit/ASTextKitFontSizeAdjuster.mm; sourceTree = ""; }; - 7EEB0F6514E0083BC82D21EDB4E525C9 /* NSParagraphStyle+ASText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSParagraphStyle+ASText.h"; path = "Source/TextExperiment/Utility/NSParagraphStyle+ASText.h"; sourceTree = ""; }; - 7EEE77614CD48971135593DDA52F6FFA /* _ASAsyncTransactionContainer+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "_ASAsyncTransactionContainer+Private.h"; path = "Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h"; sourceTree = ""; }; - 7FF465C9ADCAFB14070247CEB14E08B3 /* ASCollections.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollections.mm; path = Source/ASCollections.mm; sourceTree = ""; }; - 804E6E9F0BDB52D537D3FD57ADE50A87 /* Pods-QuranEngineApp-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-QuranEngineApp-frameworks.sh"; sourceTree = ""; }; - 805F38459176CFBF7BFE070EAE17FF09 /* Texture-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Texture-dummy.m"; sourceTree = ""; }; - 806A602520013A28DE6D7D35CC850A9A /* ASBaseDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBaseDefines.h; path = Source/Base/ASBaseDefines.h; sourceTree = ""; }; - 821F71FB345332F044B54F24ABFD0C0E /* _ASPendingState.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASPendingState.mm; path = Source/Private/_ASPendingState.mm; sourceTree = ""; }; - 82ECF9FD014DC7DC70D03A43F919AEDA /* ASDisplayNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDisplayNode.mm; path = Source/ASDisplayNode.mm; sourceTree = ""; }; - 83322ED18928634D7E65D89AA24CB5AC /* ASCollectionLayoutCache.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionLayoutCache.mm; path = Source/Private/ASCollectionLayoutCache.mm; sourceTree = ""; }; - 83AD28EA07735189D61CB5EE3C0E0099 /* ASDisplayNodeCornerLayerDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNodeCornerLayerDelegate.h; path = Source/Private/ASDisplayNodeCornerLayerDelegate.h; sourceTree = ""; }; - 83ED1253C1093BA48C0223F4832BA2EB /* ASRangeManagingNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRangeManagingNode.h; path = Source/ASRangeManagingNode.h; sourceTree = ""; }; - 84210CC8E02259CC956E981CF30F7212 /* ASAbsoluteLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAbsoluteLayoutSpec.h; path = Source/Layout/ASAbsoluteLayoutSpec.h; sourceTree = ""; }; - 85139CFD68B377D012901915804EE19F /* ASDisplayNodeInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNodeInternal.h; path = Source/Private/ASDisplayNodeInternal.h; sourceTree = ""; }; - 85B3D35BE281415FC47A0D237EC47AC0 /* ASRunLoopQueue.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASRunLoopQueue.mm; path = Source/ASRunLoopQueue.mm; sourceTree = ""; }; - 85DC3A0BDC8F3003550567F705BC3C4A /* PINRemoteImageBasicCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageBasicCache.h; path = Source/Classes/PINRemoteImageBasicCache.h; sourceTree = ""; }; - 85E8D418CD5EF412149D67FE44FF73E7 /* ASTextNodeCommon.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextNodeCommon.h; path = Source/ASTextNodeCommon.h; sourceTree = ""; }; - 861441F3E07BBB5D4745883502DFA89F /* ASBackgroundLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASBackgroundLayoutSpec.mm; path = Source/Layout/ASBackgroundLayoutSpec.mm; sourceTree = ""; }; - 8674F0C2D71763F78FA0E363967943D0 /* NSArray+Diffing.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "NSArray+Diffing.mm"; path = "Source/Details/NSArray+Diffing.mm"; sourceTree = ""; }; - 86AE0C19AA9B74C4099C440F051BE944 /* ASStackPositionedLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASStackPositionedLayout.mm; path = Source/Private/Layout/ASStackPositionedLayout.mm; sourceTree = ""; }; - 873CCB70C10B3A495FBDB6B5F685373B /* ASTextKitCoreTextAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitCoreTextAdditions.h; path = Source/TextKit/ASTextKitCoreTextAdditions.h; sourceTree = ""; }; - 878DA4740C063E90987A13B56DEA7DDA /* ASCollectionLayoutState.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionLayoutState.mm; path = Source/Details/ASCollectionLayoutState.mm; sourceTree = ""; }; - 882CAD5BB4DD023A743916D277E7A9F8 /* ASTextKitAttributes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitAttributes.h; path = Source/TextKit/ASTextKitAttributes.h; sourceTree = ""; }; - 8A0FAC9D991DDA33677FE7889A04F6BB /* ASObjectDescriptionHelpers.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASObjectDescriptionHelpers.mm; path = Source/Details/ASObjectDescriptionHelpers.mm; sourceTree = ""; }; - 8B670732A96332078390FB8FB43C1DB3 /* _ASHierarchyChangeSet.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASHierarchyChangeSet.h; path = Source/Private/_ASHierarchyChangeSet.h; sourceTree = ""; }; - 8C0BBAD824311F04F106FFD4EB44BF55 /* ASGraphicsContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASGraphicsContext.h; path = Source/Details/ASGraphicsContext.h; sourceTree = ""; }; - 8D4C00AC723920417390E546F4E464E6 /* ASTextKitRenderer+Positioning.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASTextKitRenderer+Positioning.mm"; path = "Source/TextKit/ASTextKitRenderer+Positioning.mm"; sourceTree = ""; }; - 8F3A86DEEB320345B5AE7AB565A3CC8A /* ASButtonNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASButtonNode.h; path = Source/ASButtonNode.h; sourceTree = ""; }; - 8F85E4431EED137A7DC4C195693DD2EE /* ASTipProvider.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTipProvider.h; path = Source/Private/ASTipProvider.h; sourceTree = ""; }; - 8FA479C38E875642DC6D0F70C22C53E2 /* PINRemoteImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageManager.h; path = Source/Classes/include/PINRemoteImageManager.h; sourceTree = ""; }; - 8FE59BBB92CE6E1B7353A77C79ECB02E /* ASVisibilityProtocols.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASVisibilityProtocols.mm; path = Source/ASVisibilityProtocols.mm; sourceTree = ""; }; - 906F6ED5B2CAD7271CCE7BD09B2BE010 /* ASNodeController+Beta.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASNodeController+Beta.mm"; path = "Source/ASNodeController+Beta.mm"; sourceTree = ""; }; - 90D1B54DABB36946B78848BB58EA41DF /* PINOperation-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "PINOperation-Info.plist"; sourceTree = ""; }; - 914D85B5ED811D235D138C46FCE03CF3 /* ASTextLine.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextLine.mm; path = Source/TextExperiment/Component/ASTextLine.mm; sourceTree = ""; }; - 91BF1D9B193231ED07914B8F4F34F425 /* ASCollectionNode+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASCollectionNode+Beta.h"; path = "Source/ASCollectionNode+Beta.h"; sourceTree = ""; }; - 925FD0BF66B4EC011652ECA71B268CFF /* ASDisplayNodeLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNodeLayout.h; path = Source/Private/ASDisplayNodeLayout.h; sourceTree = ""; }; - 92D1ABB868F070AF10E82FC0EF2D1E50 /* Pods-QuranEngineApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-QuranEngineApp.release.xcconfig"; sourceTree = ""; }; - 930163D057DF4C17CDACDDB653AD3C46 /* PINRemoteImageCallbacks.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageCallbacks.h; path = Source/Classes/PINRemoteImageCallbacks.h; sourceTree = ""; }; - 950AC8879AB1BF309B91C8294F6C560D /* ASMainSerialQueue.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMainSerialQueue.mm; path = Source/Details/ASMainSerialQueue.mm; sourceTree = ""; }; - 9550256F4E7B4C72A87110B2650EEE12 /* ASTextLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextLayout.h; path = Source/TextExperiment/Component/ASTextLayout.h; sourceTree = ""; }; - 966FD881395FF4683060BDF1A2C1AFE7 /* PINAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINAnimatedImage.h; path = Source/Classes/include/PINAnimatedImage.h; sourceTree = ""; }; - 96AF0974FDA6B82D477930BEC2DCA738 /* ASRatioLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASRatioLayoutSpec.mm; path = Source/Layout/ASRatioLayoutSpec.mm; sourceTree = ""; }; - 97572917EE326DA1D1BCB834CA128711 /* _ASDisplayLayer.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASDisplayLayer.mm; path = Source/Details/_ASDisplayLayer.mm; sourceTree = ""; }; - 97A13556C3ADEA829B9D9A76611A7DF2 /* ASAbsoluteLayoutElement.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAbsoluteLayoutElement.h; path = Source/Layout/ASAbsoluteLayoutElement.h; sourceTree = ""; }; - 97B4639DBD12842C797C250B09C796AD /* _ASTransitionContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASTransitionContext.h; path = Source/_ASTransitionContext.h; sourceTree = ""; }; - 97C1E2EFBFB3460820319BB67DE7E9A8 /* ASElementMap.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASElementMap.mm; path = Source/Details/ASElementMap.mm; sourceTree = ""; }; - 99BE0A92BBFFC7CFFB222E56AE7FB11A /* ASImageNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASImageNode.h; path = Source/ASImageNode.h; sourceTree = ""; }; - 9A753BCFC4165E6B697BA59DD40FAAE9 /* ASMultiplexImageNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMultiplexImageNode.mm; path = Source/ASMultiplexImageNode.mm; sourceTree = ""; }; - 9CAF14F93450E6B59675C2FB7FEA56B8 /* _ASCollectionViewCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASCollectionViewCell.h; path = Source/Details/_ASCollectionViewCell.h; sourceTree = ""; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 9DA8213BEA83150926293674AE1852A9 /* PINRemoteWeakProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteWeakProxy.m; path = Source/Classes/PINRemoteWeakProxy.m; sourceTree = ""; }; - 9DACFBEE5DA1C0933127FB5EF46FC022 /* ASCollectionLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayout.h; path = Source/Private/ASCollectionLayout.h; sourceTree = ""; }; - 9DE875FB3167EB0F5F0F4E3005267918 /* ASLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayoutSpec.mm; path = Source/Layout/ASLayoutSpec.mm; sourceTree = ""; }; - 9E12D4B3FB7683F25D5A629A2F5CF4F5 /* PINMemoryCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINMemoryCache.m; path = Source/PINMemoryCache.m; sourceTree = ""; }; - 9E4160A7B13943F81260704B0E61C80B /* ASHashing.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASHashing.mm; path = Source/Details/ASHashing.mm; sourceTree = ""; }; - 9E57E56ED96B01EFFB474D13F8F2E736 /* PINRemoteImageTask.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageTask.h; path = Source/Classes/PINRemoteImageTask.h; sourceTree = ""; }; - 9E58BB59C555149FC5454F49E4376996 /* Pods-QuranEngineApp */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-QuranEngineApp"; path = Pods_QuranEngineApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9E5A4D3649B59C33ED66C8E10E9AA64C /* ASDimensionInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDimensionInternal.h; path = Source/Layout/ASDimensionInternal.h; sourceTree = ""; }; - 9E80E5CE90F93687CC3256CE5C94CFB9 /* UIResponder+AsyncDisplayKit.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "UIResponder+AsyncDisplayKit.mm"; path = "Source/UIResponder+AsyncDisplayKit.mm"; sourceTree = ""; }; - 9EF7DBD8CB9800A8D8BBD73E557F1149 /* ASStackUnpositionedLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASStackUnpositionedLayout.mm; path = Source/Private/Layout/ASStackUnpositionedLayout.mm; sourceTree = ""; }; - 9EF90F143854BBC6B24900383ABD3946 /* NSAttributedString+ASText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSAttributedString+ASText.h"; path = "Source/TextExperiment/Utility/NSAttributedString+ASText.h"; sourceTree = ""; }; - 9F8706501F3AA12900089CACFE9D2890 /* ASControlTargetAction.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASControlTargetAction.h; path = Source/Private/ASControlTargetAction.h; sourceTree = ""; }; - 9FAB346055C63B3162B59F5DE8235DF0 /* PINButton+PINRemoteImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINButton+PINRemoteImage.m"; path = "Source/Classes/ImageCategories/PINButton+PINRemoteImage.m"; sourceTree = ""; }; - A0703C968276AB054A49286C28AD9B0D /* ASMapNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMapNode.mm; path = Source/ASMapNode.mm; sourceTree = ""; }; - A123CBF5C788F8269D38573F83735141 /* Pods-QuranEngineApp-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-QuranEngineApp-acknowledgements.plist"; sourceTree = ""; }; - A36DF931FF1FDB789757102295C80518 /* ASImageContainerProtocolCategories.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASImageContainerProtocolCategories.mm; path = Source/Details/ASImageContainerProtocolCategories.mm; sourceTree = ""; }; - A3D10282C45C079174CAE1AF5363443C /* ASPINRemoteImageDownloader.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPINRemoteImageDownloader.mm; path = Source/Details/ASPINRemoteImageDownloader.mm; sourceTree = ""; }; - A3DB3136FB4DF801A4F8F0B460DA384F /* ASVideoNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASVideoNode.mm; path = Source/ASVideoNode.mm; sourceTree = ""; }; - A43F626612EAF6E6960627B69535B850 /* PINRemoteImage.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = PINRemoteImage.modulemap; sourceTree = ""; }; - A4C88D12EBBBE880327EE34EB681C0E6 /* ASCollectionGalleryLayoutDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionGalleryLayoutDelegate.h; path = Source/Details/ASCollectionGalleryLayoutDelegate.h; sourceTree = ""; }; - A6648655AE61CC658E7AE86A6804AD60 /* PINOperationGroup.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINOperationGroup.h; path = Source/PINOperationGroup.h; sourceTree = ""; }; - A72891F2EAA5FB673964DECE56723702 /* ASTextLine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextLine.h; path = Source/TextExperiment/Component/ASTextLine.h; sourceTree = ""; }; - A74625036C72AB1D11BF828EF40AF42E /* PINOperation-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "PINOperation-umbrella.h"; sourceTree = ""; }; - A7844B6D7C43F9083C5F8A6E086FC6A5 /* ASPageTable.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPageTable.h; path = Source/Details/ASPageTable.h; sourceTree = ""; }; - A7B540D3D7D6A9543C97F678E925A099 /* PINResume.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINResume.h; path = Source/Classes/PINResume.h; sourceTree = ""; }; - A7DD728FA61B8E8979926DBCECF64BFC /* ASMainThreadDeallocation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMainThreadDeallocation.h; path = Source/ASMainThreadDeallocation.h; sourceTree = ""; }; - A86C4FB796F859422DFF64AD581BBAE0 /* ASAvailability.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAvailability.h; path = Source/Base/ASAvailability.h; sourceTree = ""; }; - A8AA7778D9D328FB1753D7CA65EEE518 /* ASMutableAttributedStringBuilder.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMutableAttributedStringBuilder.mm; path = Source/Details/ASMutableAttributedStringBuilder.mm; sourceTree = ""; }; - A96F08376C80F962F4D6BD677FD6FF2C /* ASScrollDirection.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASScrollDirection.mm; path = Source/Details/ASScrollDirection.mm; sourceTree = ""; }; - A9819E1E6DBCF77BA7D94CAF9BDFD8BE /* ASLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutSpec.h; path = Source/Layout/ASLayoutSpec.h; sourceTree = ""; }; - AA630CD4C006172E413D222AC52D6AE0 /* ASCellNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCellNode.h; path = Source/ASCellNode.h; sourceTree = ""; }; - AA8CC49BB4D6612039D682B21F71C346 /* ASTipsController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTipsController.mm; path = Source/Private/ASTipsController.mm; sourceTree = ""; }; - AB3EEF472E6ED923217C52007B9753F9 /* ASTextAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextAttribute.h; path = Source/TextExperiment/String/ASTextAttribute.h; sourceTree = ""; }; - ABC2257CCA051191378319330151F0D4 /* PINOperationGroup.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINOperationGroup.m; path = Source/PINOperationGroup.m; sourceTree = ""; }; - ACF5296A699D89AAF16566B12DE7E1EE /* ASLayoutElement.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayoutElement.mm; path = Source/Layout/ASLayoutElement.mm; sourceTree = ""; }; - ACFD0C138282EAC8935945A49DE4A106 /* ASBackgroundLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBackgroundLayoutSpec.h; path = Source/Layout/ASBackgroundLayoutSpec.h; sourceTree = ""; }; - AD282AED7973E1FEA2DDE88DEEB1A7BA /* ASTip.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTip.mm; path = Source/Private/ASTip.mm; sourceTree = ""; }; - AE482408FCFD063EC12E94BA06BA5CD4 /* PINCache.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = PINCache.modulemap; sourceTree = ""; }; - AED0F60EAE75B20DC8B1DDCE763D458C /* AsyncDisplayKit+IGListKitMethods.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "AsyncDisplayKit+IGListKitMethods.mm"; path = "Source/AsyncDisplayKit+IGListKitMethods.mm"; sourceTree = ""; }; - AEE4871FA31A368E57679CAB4E80B535 /* ASDataController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDataController.mm; path = Source/Details/ASDataController.mm; sourceTree = ""; }; - AF25474D038B80B74719983CAD8C47FD /* ASDisplayNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNode.h; path = Source/ASDisplayNode.h; sourceTree = ""; }; - AF566014C397ACC6CFD312D70B47824C /* ASLayerBackingTipProvider.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASLayerBackingTipProvider.mm; path = Source/Private/ASLayerBackingTipProvider.mm; sourceTree = ""; }; - AF76734BAC07F62141ADA88F036045A0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; - B0E52C5629031EF1A914D0B9BBF6D541 /* Pods-QuranEngineApp-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-QuranEngineApp-umbrella.h"; sourceTree = ""; }; - B104D7A63AC584DAC07CB2200B4C56AA /* _ASCollectionGalleryLayoutItem.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASCollectionGalleryLayoutItem.mm; path = Source/Private/_ASCollectionGalleryLayoutItem.mm; sourceTree = ""; }; - B161397BFD4312F3CE0EDD244D8BB6E7 /* ASTraitCollection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTraitCollection.h; path = Source/Details/ASTraitCollection.h; sourceTree = ""; }; - B1B70DE67F8B7DFB939B289F52B0D47A /* ASDisplayNode+Ancestry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+Ancestry.h"; path = "Source/Base/ASDisplayNode+Ancestry.h"; sourceTree = ""; }; - B1E71903E154DAAC430A3B7606FF98D2 /* ASDisplayNodeCornerLayerDelegate.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDisplayNodeCornerLayerDelegate.mm; path = Source/Private/ASDisplayNodeCornerLayerDelegate.mm; sourceTree = ""; }; - B2C62661EAE971113323BF22A316997B /* ASButtonNode+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASButtonNode+Private.h"; path = "Source/ASButtonNode+Private.h"; sourceTree = ""; }; - B460B941AE3263A75BCBD37F1340602E /* ASScrollNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASScrollNode.mm; path = Source/ASScrollNode.mm; sourceTree = ""; }; - B49E783B53B765BCB0C1362D80B5CECD /* ASControlNode+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASControlNode+Private.h"; path = "Source/Private/ASControlNode+Private.h"; sourceTree = ""; }; - B4A0E4898C9F75644D4095FDD6A5686A /* ASYogaUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASYogaUtilities.h; path = Source/Layout/ASYogaUtilities.h; sourceTree = ""; }; - B4F53DB28E010E86FA0EDECD5051E75A /* ASMutableElementMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMutableElementMap.h; path = Source/Private/ASMutableElementMap.h; sourceTree = ""; }; - B5040986A9F8A4B3F2AEC00A1D1A95DE /* ASDelegateProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDelegateProxy.h; path = Source/Details/ASDelegateProxy.h; sourceTree = ""; }; - B556BB1204DCAA72C25E523036778DA2 /* ASRecursiveUnfairLock.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASRecursiveUnfairLock.mm; path = Source/Details/ASRecursiveUnfairLock.mm; sourceTree = ""; }; - B598C187B5C33F76B1294510F6620F5F /* ASLayoutController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutController.h; path = Source/Details/ASLayoutController.h; sourceTree = ""; }; - B66528C017ED924294842CDD7A14862F /* ASCenterLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCenterLayoutSpec.mm; path = Source/Layout/ASCenterLayoutSpec.mm; sourceTree = ""; }; - B69E0F6D2BE6B08846D0243666B148D1 /* ASAbstractLayoutController+FrameworkPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASAbstractLayoutController+FrameworkPrivate.h"; path = "Source/Private/ASAbstractLayoutController+FrameworkPrivate.h"; sourceTree = ""; }; - B7556CF8542973F3D63B298D04F57C1D /* ASSignpost.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASSignpost.h; path = Source/Base/ASSignpost.h; sourceTree = ""; }; - B7C9640E43C059034779C6065951B3F2 /* ASImageNode+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASImageNode+Private.h"; path = "Source/Private/ASImageNode+Private.h"; sourceTree = ""; }; - B804EAE3C4FD585B6054924F31638531 /* PINRemoteImageMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageMacros.h; path = Source/Classes/include/PINRemoteImageMacros.h; sourceTree = ""; }; - B8319F072AAB973DC11851036AFCAFAE /* ASStackLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASStackLayoutSpec.mm; path = Source/Layout/ASStackLayoutSpec.mm; sourceTree = ""; }; - B86736BB77351EAC83A3564E6D726BF8 /* ASDisplayNodeExtras.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNodeExtras.h; path = Source/ASDisplayNodeExtras.h; sourceTree = ""; }; - B8DBE2295DDB184590E04463D26D83C1 /* ASCornerLayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCornerLayoutSpec.mm; path = Source/Layout/ASCornerLayoutSpec.mm; sourceTree = ""; }; - B8E3A022D1EA37E90ECB5F32EBE79C88 /* ASOverlayLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASOverlayLayoutSpec.h; path = Source/Layout/ASOverlayLayoutSpec.h; sourceTree = ""; }; - B90985288EA00C8C9B7207E4FD9F2D26 /* ASDefaultPlayButton.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDefaultPlayButton.mm; path = Source/Private/ASDefaultPlayButton.mm; sourceTree = ""; }; - B9485C16107E619D52DEDDC8F0811F67 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - B9A841D4A633463A87F2726AEA7BBBB1 /* ASCollectionLayoutContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayoutContext.h; path = Source/Details/ASCollectionLayoutContext.h; sourceTree = ""; }; - BA2E3D91593000ED94F506DC5F930887 /* ASTableViewProtocols.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTableViewProtocols.h; path = Source/ASTableViewProtocols.h; sourceTree = ""; }; - BAB31548FC8D5AB50A8EB7217A7712E4 /* PINRemoteImage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINRemoteImage.debug.xcconfig; sourceTree = ""; }; - BB800E39017591858E237D0FF17509B6 /* PINDisplayLink.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINDisplayLink.m; path = Source/Classes/PINDisplayLink.m; sourceTree = ""; }; - BBF774808D26E537AA4D7EF0C64653DA /* ASTabBarController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTabBarController.h; path = Source/ASTabBarController.h; sourceTree = ""; }; - BC3B699548AA59BEC2E5B6A99B34C470 /* ASTextKitCoreTextAdditions.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitCoreTextAdditions.mm; path = Source/TextKit/ASTextKitCoreTextAdditions.mm; sourceTree = ""; }; - BD255BBA6F90EDA06E919B775FC21FF0 /* ASLog.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLog.h; path = Source/Base/ASLog.h; sourceTree = ""; }; - BDBDCD408FDA7E7CFEE56C22BE3A64D4 /* PINRequestRetryStrategy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRequestRetryStrategy.h; path = Source/Classes/include/PINRequestRetryStrategy.h; sourceTree = ""; }; - BE11BB4291FF4EC28259ED221EAED215 /* PINCache-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "PINCache-Info.plist"; sourceTree = ""; }; - BE492B86F41B5899AFF47ACDB4126D06 /* Pods-QuranEngineApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-QuranEngineApp.debug.xcconfig"; sourceTree = ""; }; - BEAA64D5D3E620B73A84473368D8A9E6 /* ASBatchContext.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASBatchContext.mm; path = Source/Details/ASBatchContext.mm; sourceTree = ""; }; - BFB557CD6B237ED4B0DB24D1F4677091 /* _ASHierarchyChangeSet.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASHierarchyChangeSet.mm; path = Source/Private/_ASHierarchyChangeSet.mm; sourceTree = ""; }; - C0F24E93C735911A21D52FCA96DE90EF /* PINAnimatedImageView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINAnimatedImageView.m; path = Source/Classes/AnimatedImages/PINAnimatedImageView.m; sourceTree = ""; }; - C1EB92AB630AF9172AC5AF3D3E63BE08 /* ASRangeController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASRangeController.mm; path = Source/Details/ASRangeController.mm; sourceTree = ""; }; - C1F23A80ED06BAAE78D795707CD9F171 /* ASRunLoopQueue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRunLoopQueue.h; path = Source/ASRunLoopQueue.h; sourceTree = ""; }; - C1FCC0F80EEB9E87D75AB09C5803CEA4 /* ASStackLayoutElement.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutElement.h; path = Source/Layout/ASStackLayoutElement.h; sourceTree = ""; }; - C39D8BE53E4EB378D9709E4D02131DA6 /* ASAbstractLayoutController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASAbstractLayoutController.mm; path = Source/Details/ASAbstractLayoutController.mm; sourceTree = ""; }; - C43B7A3FF5E569EC9E098D866B971B54 /* ASCollectionFlowLayoutDelegate.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionFlowLayoutDelegate.mm; path = Source/Details/ASCollectionFlowLayoutDelegate.mm; sourceTree = ""; }; - C47C32B24C4785F3C2352F86885C8A40 /* ASSection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASSection.h; path = Source/Private/ASSection.h; sourceTree = ""; }; - C4A9F045E36CC5F5D32E599F990EBE48 /* ASLayoutSpecUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutSpecUtilities.h; path = Source/Private/Layout/ASLayoutSpecUtilities.h; sourceTree = ""; }; - C512F56D7309F8BBBD1184D118681725 /* ASPhotosFrameworkImageRequest.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASPhotosFrameworkImageRequest.mm; path = Source/Details/ASPhotosFrameworkImageRequest.mm; sourceTree = ""; }; - C59ADB9EF4AC76011254D2D19D104F55 /* ASHashing.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASHashing.h; path = Source/Details/ASHashing.h; sourceTree = ""; }; - C5B834B7F2407602DC9A088127331270 /* ASLayoutTransition.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutTransition.h; path = Source/Private/ASLayoutTransition.h; sourceTree = ""; }; - C77CFBEE928E3FD8078618DB70807807 /* ASDisplayNode+LayoutSpec.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASDisplayNode+LayoutSpec.mm"; path = "Source/ASDisplayNode+LayoutSpec.mm"; sourceTree = ""; }; - C805681D63BCD8F052201D2C42F84546 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreMedia.framework; sourceTree = DEVELOPER_DIR; }; - C941257A333D4CB849553DD8D2872A14 /* ASTextAttribute.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextAttribute.mm; path = Source/TextExperiment/String/ASTextAttribute.mm; sourceTree = ""; }; - C9C467665994B887574F02A84A9F4800 /* Texture-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Texture-Info.plist"; sourceTree = ""; }; - C9C4E917C6DD24E5A1A14EF3D1471B07 /* PINRemoteImageMemoryContainer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageMemoryContainer.h; path = Source/Classes/PINRemoteImageMemoryContainer.h; sourceTree = ""; }; - CA8AEF5A3D9FB6C2D3EDA71FC15F7D74 /* PINDiskCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINDiskCache.h; path = Source/PINDiskCache.h; sourceTree = ""; }; - CB1DB9B8DE10D97B44C0298FC7259C6D /* ASTextNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextNode.mm; path = Source/ASTextNode.mm; sourceTree = ""; }; - CB3C4D97C4EAAEE5F19DA33A45F004EB /* ASLayoutElement.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutElement.h; path = Source/Layout/ASLayoutElement.h; sourceTree = ""; }; - CC8EE9EAC1AE60B0E2514B1E0BCF82DB /* ASCollectionViewLayoutController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionViewLayoutController.mm; path = Source/Details/ASCollectionViewLayoutController.mm; sourceTree = ""; }; - CC8FC899C1BEDB7E0862C985002B497E /* _ASCoreAnimationExtras.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASCoreAnimationExtras.mm; path = Source/Private/_ASCoreAnimationExtras.mm; sourceTree = ""; }; - CDB9905DE100C45E321FF681B0BE5D74 /* PINDiskCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINDiskCache.m; path = Source/PINDiskCache.m; sourceTree = ""; }; - CE20F261835124BBA4069930FFF8AF32 /* ASVideoPlayerNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASVideoPlayerNode.mm; path = Source/ASVideoPlayerNode.mm; sourceTree = ""; }; - CEA150E52F46238642DC87EC38BD0E6D /* PINCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINCache.m; path = Source/PINCache.m; sourceTree = ""; }; - D01844FA3473F75ADC6CB29105B8137A /* ASCollectionLayoutDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionLayoutDefines.h; path = Source/Private/ASCollectionLayoutDefines.h; sourceTree = ""; }; - D13CF7125B69CA994A1A19ADF69164F8 /* PINAnimatedImageView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINAnimatedImageView.h; path = Source/Classes/include/PINAnimatedImageView.h; sourceTree = ""; }; - D1442C49B60F16C7023EB46328D280D7 /* ASExperimentalFeatures.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASExperimentalFeatures.h; path = Source/ASExperimentalFeatures.h; sourceTree = ""; }; - D16FA73D18624C08889ABA04585BD2A0 /* _ASDisplayLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASDisplayLayer.h; path = Source/Details/_ASDisplayLayer.h; sourceTree = ""; }; - D1E3D31A59F94D5CD8D4B03A2E367E99 /* ASAsciiArtBoxCreator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAsciiArtBoxCreator.h; path = Source/Layout/ASAsciiArtBoxCreator.h; sourceTree = ""; }; - D24933F7568B4D81C493B4A737BDE668 /* ASPagerNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPagerNode.h; path = Source/ASPagerNode.h; sourceTree = ""; }; - D3D3EC5A1E888BF898E584B2A68DDD1E /* ASCollectionViewFlowLayoutInspector.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionViewFlowLayoutInspector.mm; path = Source/Private/ASCollectionViewFlowLayoutInspector.mm; sourceTree = ""; }; - D44D1BEF5EDC1B3EA09C985D75290E19 /* ASYogaUtilities.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASYogaUtilities.mm; path = Source/Layout/ASYogaUtilities.mm; sourceTree = ""; }; - D55B5D9D10346E310CC066CE345EF883 /* PINCacheMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINCacheMacros.h; path = Source/PINCacheMacros.h; sourceTree = ""; }; - D5DE9D47DF05D8D01A6F3A2E097BE5E9 /* ASTextKitEntityAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitEntityAttribute.h; path = Source/TextKit/ASTextKitEntityAttribute.h; sourceTree = ""; }; - D63C6386D47750008C137AFC5A3B96AC /* UIResponder+AsyncDisplayKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIResponder+AsyncDisplayKit.h"; path = "Source/UIResponder+AsyncDisplayKit.h"; sourceTree = ""; }; - D643AB237A68D3EA33E130BE941C23A2 /* NSHTTPURLResponse+MaxAge.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSHTTPURLResponse+MaxAge.m"; path = "Source/Classes/Categories/NSHTTPURLResponse+MaxAge.m"; sourceTree = ""; }; - D67CD4BDAFB96C6EA854C5120BFAB68F /* ASCornerLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCornerLayoutSpec.h; path = Source/Layout/ASCornerLayoutSpec.h; sourceTree = ""; }; - D7429861868D4103F11B9E94C19522A9 /* PINRemoteImageManager+Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINRemoteImageManager+Private.h"; path = "Source/Classes/PINRemoteImageManager+Private.h"; sourceTree = ""; }; - D7599FEDA20FCED7D1C989F0027DD87C /* ASVideoPlayerNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASVideoPlayerNode.h; path = Source/ASVideoPlayerNode.h; sourceTree = ""; }; - D7AEF2BB9296AC6AD078D6A403286D8F /* PINRemoteImageManagerConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageManagerConfiguration.m; path = Source/Classes/PINRemoteImageManagerConfiguration.m; sourceTree = ""; }; - D87EBB50A055D11007023EBFE713E8FB /* ASThread.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASThread.h; path = Source/Details/ASThread.h; sourceTree = ""; }; - D9BED88789F8E23CBD186A5FFF9AD1C4 /* _ASScopeTimer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASScopeTimer.h; path = Source/Private/_ASScopeTimer.h; sourceTree = ""; }; - D9C64EBA02032F27282C40FD7220273C /* PINRemoteImageDownloadQueue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINRemoteImageDownloadQueue.h; path = Source/Classes/PINRemoteImageDownloadQueue.h; sourceTree = ""; }; - DA534DB810678A4DFC3E81CC864DBB82 /* ASTextLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextLayout.mm; path = Source/TextExperiment/Component/ASTextLayout.mm; sourceTree = ""; }; - DAD8839EFD4702B7A2E4E0EACD091FB2 /* ASStackLayoutDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutDefines.h; path = Source/Layout/ASStackLayoutDefines.h; sourceTree = ""; }; - DAE68C840112A828E8AF0D70EC467A8D /* ASCollectionViewLayoutFacilitatorProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionViewLayoutFacilitatorProtocol.h; path = Source/ASCollectionViewLayoutFacilitatorProtocol.h; sourceTree = ""; }; - DB4C14FFBED15D2ABBEFEB8E5F3455D2 /* _ASAsyncTransactionContainer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASAsyncTransactionContainer.h; path = Source/Details/Transactions/_ASAsyncTransactionContainer.h; sourceTree = ""; }; - DC1BD8A1AC9F3DBC07F80A1B227A0A16 /* ASConfiguration.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASConfiguration.mm; path = Source/ASConfiguration.mm; sourceTree = ""; }; - DC35E054D23A653239FDC4A37E212446 /* _ASCollectionGalleryLayoutInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASCollectionGalleryLayoutInfo.h; path = Source/Private/_ASCollectionGalleryLayoutInfo.h; sourceTree = ""; }; - DDC2B4BC2A286B87EB8E2802C9EF4154 /* ASStackLayoutSpecUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackLayoutSpecUtilities.h; path = Source/Private/Layout/ASStackLayoutSpecUtilities.h; sourceTree = ""; }; - DE3F8C835229C4E6A90180CC99192EAD /* ASAsciiArtBoxCreator.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASAsciiArtBoxCreator.mm; path = Source/Layout/ASAsciiArtBoxCreator.mm; sourceTree = ""; }; - DF03059CFC2CF8C308FEB24EB69C2BC1 /* NSData+ImageDetectors.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSData+ImageDetectors.h"; path = "Source/Classes/include/NSData+ImageDetectors.h"; sourceTree = ""; }; - DF72C292E3F736A58344AC0C6C065427 /* ASCenterLayoutSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCenterLayoutSpec.h; path = Source/Layout/ASCenterLayoutSpec.h; sourceTree = ""; }; - E1193740D5D4555A1D1F327B2384D05D /* ASMutableAttributedStringBuilder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASMutableAttributedStringBuilder.h; path = Source/Details/ASMutableAttributedStringBuilder.h; sourceTree = ""; }; - E12BEC428AAE3E8C28DF57765812CED5 /* ASIGListAdapterBasedDataSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASIGListAdapterBasedDataSource.h; path = Source/Private/ASIGListAdapterBasedDataSource.h; sourceTree = ""; }; - E2BF0999ECBBCF0288C66B2D84F59B64 /* PINImage+WebP.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "PINImage+WebP.h"; path = "Source/Classes/Categories/PINImage+WebP.h"; sourceTree = ""; }; - E36AB6427AB8AFE90BA1816236BDC846 /* _ASAsyncTransactionGroup.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASAsyncTransactionGroup.mm; path = Source/Details/Transactions/_ASAsyncTransactionGroup.mm; sourceTree = ""; }; - E37ADB2E0B6835C8DDC1275D46DE9F62 /* ASRangeControllerUpdateRangeProtocol+Beta.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASRangeControllerUpdateRangeProtocol+Beta.h"; path = "Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h"; sourceTree = ""; }; - E3B0F0BCC8C45B12D129D8BF9014AEFF /* ASLayoutSpec+Subclasses.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASLayoutSpec+Subclasses.mm"; path = "Source/Layout/ASLayoutSpec+Subclasses.mm"; sourceTree = ""; }; - E3DC9D2EA3165B8465B514EF7D984DD1 /* ASBatchFetching.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASBatchFetching.mm; path = Source/Private/ASBatchFetching.mm; sourceTree = ""; }; - E462ACDBC86CD675CE08DD475DEECCBF /* ASDKViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDKViewController.h; path = Source/ASDKViewController.h; sourceTree = ""; }; - E4A4E77985D62E4AE0F17F553E7EB919 /* PINOperationQueue.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINOperationQueue.m; path = Source/PINOperationQueue.m; sourceTree = ""; }; - E57AD3FF0813DE17EB8AA040263EC3F6 /* ASLayout+IGListDiffKit.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASLayout+IGListDiffKit.mm"; path = "Source/Layout/ASLayout+IGListDiffKit.mm"; sourceTree = ""; }; - E58D323E91EB2896C1EDADABA33E1ED7 /* ASLayoutSpec+Subclasses.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASLayoutSpec+Subclasses.h"; path = "Source/Layout/ASLayoutSpec+Subclasses.h"; sourceTree = ""; }; - E5B0C09D2E89A3BCA3B0821E9BB6D98E /* ASIGListAdapterBasedDataSource.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASIGListAdapterBasedDataSource.mm; path = Source/Private/ASIGListAdapterBasedDataSource.mm; sourceTree = ""; }; - E62E3DBD8B5880BF142A0D8E9F2E61F6 /* ASDisplayNode+Yoga.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "ASDisplayNode+Yoga.h"; path = "Source/ASDisplayNode+Yoga.h"; sourceTree = ""; }; - E6C9422BAA0455B9F51AEB52C13E7476 /* ASLayoutManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutManager.h; path = Source/TextKit/ASLayoutManager.h; sourceTree = ""; }; - E75E0331E8BF3A3D2AB02E328A968A54 /* ASCollectionLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionLayout.mm; path = Source/Private/ASCollectionLayout.mm; sourceTree = ""; }; - E79D1941FE284CBC756DA419C25EC6A8 /* _ASAsyncTransactionContainer.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASAsyncTransactionContainer.mm; path = Source/Details/Transactions/_ASAsyncTransactionContainer.mm; sourceTree = ""; }; - E9D325D76876A8CB3D8E24335C5D30CD /* ASMutableElementMap.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASMutableElementMap.mm; path = Source/Private/ASMutableElementMap.mm; sourceTree = ""; }; - EA7DAC38C29B1FF9F337C51862E4B184 /* ASBatchFetchingDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASBatchFetchingDelegate.h; path = Source/Details/ASBatchFetchingDelegate.h; sourceTree = ""; }; - EADCD92C54DE941C661292CB7A72E1E4 /* ASTipNode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTipNode.h; path = Source/Private/ASTipNode.h; sourceTree = ""; }; - EADF7E9F19FA7D9031B097472C4C5AFB /* ASDisplayNodeTipState.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDisplayNodeTipState.h; path = Source/Private/ASDisplayNodeTipState.h; sourceTree = ""; }; - EAF41E45B6FB22BC0F50FF4DD6125E04 /* AsyncDisplayKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AsyncDisplayKit.h; path = Source/AsyncDisplayKit.h; sourceTree = ""; }; - EBF4BDADC6F612DDF408F9FC751CE8B5 /* ASAssert.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASAssert.mm; path = Source/Base/ASAssert.mm; sourceTree = ""; }; - EC46695BEA92F2E006258673E7BCCF46 /* ASTipsController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTipsController.h; path = Source/Private/ASTipsController.h; sourceTree = ""; }; - ED11FFE0882E190170933C027E98F707 /* ASAbstractLayoutController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASAbstractLayoutController.h; path = Source/Details/ASAbstractLayoutController.h; sourceTree = ""; }; - ED201A924E0BC9468579E76F2F2FE7AD /* PINOperation.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = PINOperation.debug.xcconfig; sourceTree = ""; }; - EDB1275CA81BC64C3B30E724EEC5934F /* _ASCollectionReusableView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _ASCollectionReusableView.h; path = Source/Details/_ASCollectionReusableView.h; sourceTree = ""; }; - EE2940E42584F168B39AE1ADCDAF32AA /* PINRemoteImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = PINRemoteImageManager.m; path = Source/Classes/PINRemoteImageManager.m; sourceTree = ""; }; - EE30FEB1172C0A805A0E58C9490B20FC /* ASRangeController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASRangeController.h; path = Source/Details/ASRangeController.h; sourceTree = ""; }; - EE810DADECD7053ECB23F61D49A4E8B7 /* ASDefaultPlayButton.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASDefaultPlayButton.h; path = Source/Private/ASDefaultPlayButton.h; sourceTree = ""; }; - EE90C57504EDCB6C61F365BFCB914D08 /* ASCellNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCellNode.mm; path = Source/ASCellNode.mm; sourceTree = ""; }; - EECCA4A8A8683035F019428C5499815C /* PINOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINOperation.h; path = Source/PINOperation.h; sourceTree = ""; }; - EF46DEB85571C6940172D8D85BD97843 /* ASTextKitComponents.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextKitComponents.mm; path = Source/TextKit/ASTextKitComponents.mm; sourceTree = ""; }; - EF89D4D6DDB0837C88D15871AB9DDA90 /* Pods-QuranEngineApp-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-QuranEngineApp-acknowledgements.markdown"; sourceTree = ""; }; - F03D532B340045CA733767D5359BDD90 /* ASPendingStateController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASPendingStateController.h; path = Source/Private/ASPendingStateController.h; sourceTree = ""; }; - F060D89B1311E95BA6901C3DACB2D91F /* ASLayoutElementExtensibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutElementExtensibility.h; path = Source/Layout/ASLayoutElementExtensibility.h; sourceTree = ""; }; - F1090FE0DD646DC6D0850E0BA36405F3 /* ASCollectionViewProtocols.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASCollectionViewProtocols.h; path = Source/ASCollectionViewProtocols.h; sourceTree = ""; }; - F12B84DDA3761BCCFFC101F6185D46A9 /* PINSpeedRecorder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINSpeedRecorder.h; path = Source/Classes/PINSpeedRecorder.h; sourceTree = ""; }; - F13A8EEFA730581AB0FEAF5FE9DC341B /* ASLayoutElementPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutElementPrivate.h; path = Source/Layout/ASLayoutElementPrivate.h; sourceTree = ""; }; - F141172D7AE453678F5CC49C5E6BB3F3 /* ASLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayout.h; path = Source/Layout/ASLayout.h; sourceTree = ""; }; - F16E6F7D9B6576B8DD6D16C43758DEEB /* ASHighlightOverlayLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASHighlightOverlayLayer.h; path = Source/Details/ASHighlightOverlayLayer.h; sourceTree = ""; }; - F178D21112CFAC1542B9BB0038FE9F2C /* _ASCollectionGalleryLayoutInfo.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = _ASCollectionGalleryLayoutInfo.mm; path = Source/Private/_ASCollectionGalleryLayoutInfo.mm; sourceTree = ""; }; - F2BDADA0E85A73A6C9A29FBA4A48B38F /* ASTableNode.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTableNode.mm; path = Source/ASTableNode.mm; sourceTree = ""; }; - F3A05A320A0B5986D46D8E46AB8F56DB /* PINCaching.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINCaching.h; path = Source/PINCaching.h; sourceTree = ""; }; - F46831F4FCE3AB140F12577CE0C2AAB3 /* Texture */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Texture; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F4D3A5F35BD16C5D09F616CC28AA5F5A /* ASConfigurationInternal.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASConfigurationInternal.mm; path = Source/ASConfigurationInternal.mm; sourceTree = ""; }; - F4EDFDD960862C423CFEE9683653342B /* PINProgressiveImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINProgressiveImage.h; path = Source/Classes/include/PINProgressiveImage.h; sourceTree = ""; }; - F53E57B3ECEF0075F1FFFC7710A04639 /* NSMutableAttributedString+TextKitAdditions.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "NSMutableAttributedString+TextKitAdditions.mm"; path = "Source/Details/NSMutableAttributedString+TextKitAdditions.mm"; sourceTree = ""; }; - F6120F7F3A61BE1757F9D2DFCEFE4A6F /* ASCollectionLayoutDefines.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASCollectionLayoutDefines.mm; path = Source/Private/ASCollectionLayoutDefines.mm; sourceTree = ""; }; - F6E67D14993A7B56B97A9C6D49B944FC /* PINAnimatedImageView+PINRemoteImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "PINAnimatedImageView+PINRemoteImage.m"; path = "Source/Classes/ImageCategories/PINAnimatedImageView+PINRemoteImage.m"; sourceTree = ""; }; - F786D2FE67301111EA52EC486B239B2B /* PINOperationQueue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = PINOperationQueue.h; path = Source/PINOperationQueue.h; sourceTree = ""; }; - F7CACC3E144BE1342B0D96A643D2ABB0 /* ASTableLayoutController.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTableLayoutController.mm; path = Source/Details/ASTableLayoutController.mm; sourceTree = ""; }; - F8627D5B8CF030A2C803DF3FEA7726D7 /* ASTextNode2.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextNode2.h; path = Source/ASTextNode2.h; sourceTree = ""; }; - F909C9B313C017B8F8C74DCBAF5248EA /* ASImageNode+tvOS.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASImageNode+tvOS.mm"; path = "Source/tvOS/ASImageNode+tvOS.mm"; sourceTree = ""; }; - F965B11EE046F80AEBC05314B1022295 /* ASTextRunDelegate.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTextRunDelegate.mm; path = Source/TextExperiment/String/ASTextRunDelegate.mm; sourceTree = ""; }; - FADB5C34DF5FEF16078DA67F7E6D9BBE /* ASStackPositionedLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASStackPositionedLayout.h; path = Source/Private/Layout/ASStackPositionedLayout.h; sourceTree = ""; }; - FB325ECFF5088C8A0231289BA25C2D61 /* ASScrollDirection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASScrollDirection.h; path = Source/Details/ASScrollDirection.h; sourceTree = ""; }; - FB32E2461EA09ADDAA167B8226BF68A2 /* NSHTTPURLResponse+MaxAge.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSHTTPURLResponse+MaxAge.h"; path = "Source/Classes/Categories/NSHTTPURLResponse+MaxAge.h"; sourceTree = ""; }; - FCC931E977AF8361D6564D04989E3EAB /* ASObjectDescriptionHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASObjectDescriptionHelpers.h; path = Source/Details/ASObjectDescriptionHelpers.h; sourceTree = ""; }; - FD461E9F85A2684EAFA505483E701C5D /* ASImageNode+AnimatedImage.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "ASImageNode+AnimatedImage.mm"; path = "Source/ASImageNode+AnimatedImage.mm"; sourceTree = ""; }; - FE196E1C1DB53904E672423E7172D01A /* ASTextKitTailTruncater.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTextKitTailTruncater.h; path = Source/TextKit/ASTextKitTailTruncater.h; sourceTree = ""; }; - FE3DC1DA67783BE1B13060B88E3A2401 /* ASDefaultPlaybackButton.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASDefaultPlaybackButton.mm; path = Source/Private/ASDefaultPlaybackButton.mm; sourceTree = ""; }; - FE8A206C21E309D2E76C118AD86D8E0D /* ASTip.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASTip.h; path = Source/Private/ASTip.h; sourceTree = ""; }; - FEED8B10C97A4562E338EF79AFA40380 /* ASLayoutSpecPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayoutSpecPrivate.h; path = Source/Private/Layout/ASLayoutSpecPrivate.h; sourceTree = ""; }; - FFCAFE70FF95518A9551A2E731236083 /* ASTipsWindow.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = ASTipsWindow.mm; path = Source/Private/ASTipsWindow.mm; sourceTree = ""; }; - FFE5D2088D4421C38D2717F2F24F55D1 /* ASLayerBackingTipProvider.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ASLayerBackingTipProvider.h; path = Source/Private/ASLayerBackingTipProvider.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1A38949BF4B503096C6F3EE1849A151C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5D5D1CF6778C0EFEF0A0378E3DB8C089 /* Accelerate.framework in Frameworks */, - A07A372022EF724EADE54A9E563C73C5 /* Foundation.framework in Frameworks */, - 2A2D9741BC06256DC66C82090B40D185 /* ImageIO.framework in Frameworks */, - 7D18768C638CA93F11A2F82E48B64C47 /* UIKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 39DC470CF95DAC0AEA2704A9A049F371 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BC0F27D90C4DFD8D56FD71DFFF057FE2 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - ABF9C7363A70B42F45C54EA3811D6299 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0B7AD8F6E4E1B2FF88F24481569A8499 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C2D20B91A26EC160D557C119C3D598F8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A1579C9F1A992305C808FA681FAEFB79 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FFED23876596969F72969E80BEC2E2DF /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AED2720FAED323B13AFAE5476CF5A8C5 /* AVFoundation.framework in Frameworks */, - CD33208D240AFD67BFDF1099B88994FE /* CoreLocation.framework in Frameworks */, - 3079909A1DF2B173524E27ED0E69DB58 /* CoreMedia.framework in Frameworks */, - 617831E33B571265F3B31C6826FE7793 /* Foundation.framework in Frameworks */, - 717D032A675503B28E1215187F1007AF /* MapKit.framework in Frameworks */, - 1F3513723AD45A09DCFCAB4F9143F9DB /* Photos.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 009DF648D2F57CDF9D0B11036729F25E /* Products */ = { - isa = PBXGroup; - children = ( - 6320170E5A5A268B11CAE15D4EF6A9E3 /* PINCache */, - 22C347595B1851A1E5B0A3762BB18EC9 /* PINOperation */, - 115A4FCB2A03922EC10B633F15359653 /* PINRemoteImage */, - 9E58BB59C555149FC5454F49E4376996 /* Pods-QuranEngineApp */, - F46831F4FCE3AB140F12577CE0C2AAB3 /* Texture */, - ); - name = Products; - sourceTree = ""; - }; - 03B215D9E8443D196213673C760E8EF2 /* Core */ = { - isa = PBXGroup; - children = ( - 5004C451718460F7D56C8FF16F8302DC /* _ASAsyncTransaction.h */, - 783DD2ED522F17F620CC784D424E66E7 /* _ASAsyncTransaction.mm */, - DB4C14FFBED15D2ABBEFEB8E5F3455D2 /* _ASAsyncTransactionContainer.h */, - E79D1941FE284CBC756DA419C25EC6A8 /* _ASAsyncTransactionContainer.mm */, - 7EEE77614CD48971135593DDA52F6FFA /* _ASAsyncTransactionContainer+Private.h */, - 5893347DA4277D44FB96AB464F7CF90F /* _ASAsyncTransactionGroup.h */, - E36AB6427AB8AFE90BA1816236BDC846 /* _ASAsyncTransactionGroup.mm */, - DC35E054D23A653239FDC4A37E212446 /* _ASCollectionGalleryLayoutInfo.h */, - F178D21112CFAC1542B9BB0038FE9F2C /* _ASCollectionGalleryLayoutInfo.mm */, - 74809872EF01A2A8B9F326A491E24F33 /* _ASCollectionGalleryLayoutItem.h */, - B104D7A63AC584DAC07CB2200B4C56AA /* _ASCollectionGalleryLayoutItem.mm */, - EDB1275CA81BC64C3B30E724EEC5934F /* _ASCollectionReusableView.h */, - 020C5C020F02F0ABD517833A44B2CDE6 /* _ASCollectionReusableView.mm */, - 9CAF14F93450E6B59675C2FB7FEA56B8 /* _ASCollectionViewCell.h */, - 0B764945CCA297AA516A9FE164EFF572 /* _ASCollectionViewCell.mm */, - 459480ACA012E8B711EC651102EE9B97 /* _ASCoreAnimationExtras.h */, - CC8FC899C1BEDB7E0862C985002B497E /* _ASCoreAnimationExtras.mm */, - D16FA73D18624C08889ABA04585BD2A0 /* _ASDisplayLayer.h */, - 97572917EE326DA1D1BCB834CA128711 /* _ASDisplayLayer.mm */, - 33752E15A6BDBC7CB622AEC88A8975D1 /* _ASDisplayView.h */, - 22203E746785DBF3D34302CC70EF9704 /* _ASDisplayView.mm */, - 26FAB6173A99700DB3D1C523EA49615F /* _ASDisplayViewAccessiblity.h */, - 17C24742A99023F4B3A9592799A2774C /* _ASDisplayViewAccessiblity.mm */, - 8B670732A96332078390FB8FB43C1DB3 /* _ASHierarchyChangeSet.h */, - BFB557CD6B237ED4B0DB24D1F4677091 /* _ASHierarchyChangeSet.mm */, - 464DA86594E87233E4D9CCD47A021814 /* _ASPendingState.h */, - 821F71FB345332F044B54F24ABFD0C0E /* _ASPendingState.mm */, - D9BED88789F8E23CBD186A5FFF9AD1C4 /* _ASScopeTimer.h */, - 97B4639DBD12842C797C250B09C796AD /* _ASTransitionContext.h */, - 003AF6C9A23EF05B30AB638FB18BE436 /* _ASTransitionContext.mm */, - 97A13556C3ADEA829B9D9A76611A7DF2 /* ASAbsoluteLayoutElement.h */, - 84210CC8E02259CC956E981CF30F7212 /* ASAbsoluteLayoutSpec.h */, - 25E33343D6010BA94E0C4D026FFB4684 /* ASAbsoluteLayoutSpec.mm */, - ED11FFE0882E190170933C027E98F707 /* ASAbstractLayoutController.h */, - C39D8BE53E4EB378D9709E4D02131DA6 /* ASAbstractLayoutController.mm */, - B69E0F6D2BE6B08846D0243666B148D1 /* ASAbstractLayoutController+FrameworkPrivate.h */, - D1E3D31A59F94D5CD8D4B03A2E367E99 /* ASAsciiArtBoxCreator.h */, - DE3F8C835229C4E6A90180CC99192EAD /* ASAsciiArtBoxCreator.mm */, - 21AAE48CBF0A7AABEB9289F00693D8E4 /* ASAssert.h */, - EBF4BDADC6F612DDF408F9FC751CE8B5 /* ASAssert.mm */, - A86C4FB796F859422DFF64AD581BBAE0 /* ASAvailability.h */, - ACFD0C138282EAC8935945A49DE4A106 /* ASBackgroundLayoutSpec.h */, - 861441F3E07BBB5D4745883502DFA89F /* ASBackgroundLayoutSpec.mm */, - 806A602520013A28DE6D7D35CC850A9A /* ASBaseDefines.h */, - 6F33F5C8DDECA132574B0DB8D48E5DFF /* ASBasicImageDownloader.h */, - 04CF94985EB26286103BEC323633CFC4 /* ASBasicImageDownloader.mm */, - 3F7DA777C38E96B00111DFE0BEFE7913 /* ASBasicImageDownloaderInternal.h */, - 30135D721A505FFF41C404E5409E5A72 /* ASBatchContext.h */, - BEAA64D5D3E620B73A84473368D8A9E6 /* ASBatchContext.mm */, - 3C142AE69390BD4A73E53965CAE19F6C /* ASBatchFetching.h */, - E3DC9D2EA3165B8465B514EF7D984DD1 /* ASBatchFetching.mm */, - EA7DAC38C29B1FF9F337C51862E4B184 /* ASBatchFetchingDelegate.h */, - 4C1438B16C14D44EF0751DA9D54E159B /* ASBlockTypes.h */, - 8F3A86DEEB320345B5AE7AB565A3CC8A /* ASButtonNode.h */, - 05B335B6147A6FE1EADA2848C7EF1937 /* ASButtonNode.mm */, - B2C62661EAE971113323BF22A316997B /* ASButtonNode+Private.h */, - 16EE851C878CEB4F785858F098300737 /* ASButtonNode+Yoga.h */, - 5E9292AB0D65D0A517746350324A78C5 /* ASButtonNode+Yoga.mm */, - AA630CD4C006172E413D222AC52D6AE0 /* ASCellNode.h */, - EE90C57504EDCB6C61F365BFCB914D08 /* ASCellNode.mm */, - 1C828909B34438BE5193B32873EA167D /* ASCellNode+Internal.h */, - DF72C292E3F736A58344AC0C6C065427 /* ASCenterLayoutSpec.h */, - B66528C017ED924294842CDD7A14862F /* ASCenterLayoutSpec.mm */, - 1D0624EFAFE782393194072E17D64812 /* ASCollectionElement.h */, - 7BF99DF1F99AF5F8AD7D64AAF2BA1E44 /* ASCollectionElement.mm */, - 5115C643F8FBE97D808B961FCDAE9FAA /* ASCollectionFlowLayoutDelegate.h */, - C43B7A3FF5E569EC9E098D866B971B54 /* ASCollectionFlowLayoutDelegate.mm */, - A4C88D12EBBBE880327EE34EB681C0E6 /* ASCollectionGalleryLayoutDelegate.h */, - 32EB6C106FA09F467D5200E9137E7077 /* ASCollectionGalleryLayoutDelegate.mm */, - 66CD319551B9DF30B551A822C17C5AD3 /* ASCollectionInternal.h */, - 9DACFBEE5DA1C0933127FB5EF46FC022 /* ASCollectionLayout.h */, - E75E0331E8BF3A3D2AB02E328A968A54 /* ASCollectionLayout.mm */, - 2FBAAA96983188539E41341E456234CA /* ASCollectionLayoutCache.h */, - 83322ED18928634D7E65D89AA24CB5AC /* ASCollectionLayoutCache.mm */, - B9A841D4A633463A87F2726AEA7BBBB1 /* ASCollectionLayoutContext.h */, - 3B1845C0E5332B989F16FD7C9CF5E002 /* ASCollectionLayoutContext.mm */, - 63A327AEF7214DE08274E6B39CA93EE6 /* ASCollectionLayoutContext+Private.h */, - D01844FA3473F75ADC6CB29105B8137A /* ASCollectionLayoutDefines.h */, - F6120F7F3A61BE1757F9D2DFCEFE4A6F /* ASCollectionLayoutDefines.mm */, - 1B17C38B1411972578AA0BDB846A1D26 /* ASCollectionLayoutDelegate.h */, - 502A1AF0D1162A604BFAE562084D2650 /* ASCollectionLayoutState.h */, - 878DA4740C063E90987A13B56DEA7DDA /* ASCollectionLayoutState.mm */, - 4669024F2BF886C67DA02F1EADDD4B34 /* ASCollectionLayoutState+Private.h */, - 32829D76BB23477EA25503BE715219D9 /* ASCollectionNode.h */, - 1A418CA8EA31332CF2E82E3D634DA6F8 /* ASCollectionNode.mm */, - 91BF1D9B193231ED07914B8F4F34F425 /* ASCollectionNode+Beta.h */, - 4A3946BBDD543EEDC30603027F06A40F /* ASCollections.h */, - 7FF465C9ADCAFB14070247CEB14E08B3 /* ASCollections.mm */, - 1562DF358D6FE1C861DB5005E7283585 /* ASCollectionView.h */, - 5FC31CE875CC6172C8C3812D71F911F6 /* ASCollectionView.mm */, - 0DD9F794407A27FE05F69DF6B83317D4 /* ASCollectionView+Undeprecated.h */, - 236CAD7DBD07AD95D58777EA01ACADFC /* ASCollectionViewFlowLayoutInspector.h */, - D3D3EC5A1E888BF898E584B2A68DDD1E /* ASCollectionViewFlowLayoutInspector.mm */, - 02242241196FCCC749EE6C5466DFA63A /* ASCollectionViewLayoutController.h */, - CC8EE9EAC1AE60B0E2514B1E0BCF82DB /* ASCollectionViewLayoutController.mm */, - DAE68C840112A828E8AF0D70EC467A8D /* ASCollectionViewLayoutFacilitatorProtocol.h */, - 27966D9EBA4F95DD90B5A40173787561 /* ASCollectionViewLayoutInspector.h */, - 028E56AF7A62935C94B50BC7C45971CC /* ASCollectionViewLayoutInspector.mm */, - F1090FE0DD646DC6D0850E0BA36405F3 /* ASCollectionViewProtocols.h */, - 4C584AA9A3914BF339E0DB00EC5F3B3B /* ASConfiguration.h */, - DC1BD8A1AC9F3DBC07F80A1B227A0A16 /* ASConfiguration.mm */, - 253A7E0B2BCFBBED7CC995B5E8404245 /* ASConfigurationDelegate.h */, - 1E1083F610781F72D8F15A82DBFEE569 /* ASConfigurationInternal.h */, - F4D3A5F35BD16C5D09F616CC28AA5F5A /* ASConfigurationInternal.mm */, - 09AF3FB906584131B9B0C1DFFE6AE6C5 /* ASContextTransitioning.h */, - 0E0960532BDBC2B75DEFB2E46474DFB5 /* ASControlNode.h */, - 00B6EFE7BA64F6C89AE19C682766010B /* ASControlNode.mm */, - B49E783B53B765BCB0C1362D80B5CECD /* ASControlNode+Private.h */, - 61EDE95498912E240C229AB97E34256D /* ASControlNode+Subclasses.h */, - 32D6B40B4029E043B124DADB7A6990F1 /* ASControlNode+tvOS.mm */, - 9F8706501F3AA12900089CACFE9D2890 /* ASControlTargetAction.h */, - 696B1E4E1E531979AE43F3DC2B69451D /* ASControlTargetAction.mm */, - D67CD4BDAFB96C6EA854C5120BFAB68F /* ASCornerLayoutSpec.h */, - B8DBE2295DDB184590E04463D26D83C1 /* ASCornerLayoutSpec.mm */, - 3DFDAF1C61430DC7560FD8398184E746 /* ASDataController.h */, - AEE4871FA31A368E57679CAB4E80B535 /* ASDataController.mm */, - 4BD9DD2E4BB46C40D56BA707F879069C /* ASDefaultPlaybackButton.h */, - FE3DC1DA67783BE1B13060B88E3A2401 /* ASDefaultPlaybackButton.mm */, - EE810DADECD7053ECB23F61D49A4E8B7 /* ASDefaultPlayButton.h */, - B90985288EA00C8C9B7207E4FD9F2D26 /* ASDefaultPlayButton.mm */, - B5040986A9F8A4B3F2AEC00A1D1A95DE /* ASDelegateProxy.h */, - 192F1DF391ED1337AA49D079013BB4CB /* ASDelegateProxy.mm */, - 5C3081E402EC8789804799F6CEBE2AF8 /* ASDimension.h */, - 48611848109A2670480AB38B56828E63 /* ASDimension.mm */, - 9E5A4D3649B59C33ED66C8E10E9AA64C /* ASDimensionInternal.h */, - 3FECF0B1CB87C301963988E2A0901EBA /* ASDimensionInternal.mm */, - 779F44EDEC0EBFE936BA493AAAB6A213 /* ASDispatch.h */, - 7DD4634BD8153FE183A214BA8F59088A /* ASDispatch.mm */, - AF25474D038B80B74719983CAD8C47FD /* ASDisplayNode.h */, - 82ECF9FD014DC7DC70D03A43F919AEDA /* ASDisplayNode.mm */, - B1B70DE67F8B7DFB939B289F52B0D47A /* ASDisplayNode+Ancestry.h */, - 0FEC70814CD0F1C79D7DE05E6FFF8488 /* ASDisplayNode+Ancestry.mm */, - 0B75C700B8131603E12F188D1B8106A9 /* ASDisplayNode+AsyncDisplay.mm */, - 302B87C2A12CAA6C0D44495FD98EE635 /* ASDisplayNode+Beta.h */, - 38E37DA2E14FA769C25B5D00F8363628 /* ASDisplayNode+Convenience.h */, - 6E6AF2C7E319D3349B43F473AB518D7D /* ASDisplayNode+Convenience.mm */, - 5066030CB479AECAC177DC4DA00EA437 /* ASDisplayNode+DebugTiming.h */, - 6D2AECAEFF21A26F4089B4E9E11C31AC /* ASDisplayNode+DebugTiming.mm */, - 7DF4F7B0BA067B961678630F5F60E673 /* ASDisplayNode+FrameworkPrivate.h */, - 30AAE7A11260BD7F39C310127D106EFD /* ASDisplayNode+InterfaceState.h */, - 70F6544304C7BD9E41434910024503C7 /* ASDisplayNode+Layout.mm */, - 76686F482DAB3F96891D68B0BFEF3CA5 /* ASDisplayNode+LayoutSpec.h */, - C77CFBEE928E3FD8078618DB70807807 /* ASDisplayNode+LayoutSpec.mm */, - 2009D523A913800A6346404BF1079895 /* ASDisplayNode+Subclasses.h */, - 2F0577D80BE46EEF43F1895FBA8971D7 /* ASDisplayNode+UIViewBridge.mm */, - E62E3DBD8B5880BF142A0D8E9F2E61F6 /* ASDisplayNode+Yoga.h */, - 634E28B24436274FC8F31C3B6675E408 /* ASDisplayNode+Yoga.mm */, - 83AD28EA07735189D61CB5EE3C0E0099 /* ASDisplayNodeCornerLayerDelegate.h */, - B1E71903E154DAAC430A3B7606FF98D2 /* ASDisplayNodeCornerLayerDelegate.mm */, - B86736BB77351EAC83A3564E6D726BF8 /* ASDisplayNodeExtras.h */, - 17B19882D4F6EF49F20CF532907FA357 /* ASDisplayNodeExtras.mm */, - 85139CFD68B377D012901915804EE19F /* ASDisplayNodeInternal.h */, - 925FD0BF66B4EC011652ECA71B268CFF /* ASDisplayNodeLayout.h */, - EADF7E9F19FA7D9031B097472C4C5AFB /* ASDisplayNodeTipState.h */, - 3C7CB66DC3DADF06304DCD664B39A8CC /* ASDisplayNodeTipState.mm */, - 4D07DA51F20E2AE45BECE7B5E0467AF4 /* ASDKNavigationController.h */, - 653C571887BCC0FD884AF442FC1DC0B3 /* ASDKNavigationController.mm */, - E462ACDBC86CD675CE08DD475DEECCBF /* ASDKViewController.h */, - 1971780E236A6D3739D0E6B97B69EA18 /* ASDKViewController.mm */, - 50CF5283C029686E560F1AB090D8EE09 /* ASEditableTextNode.h */, - 287BBF3D32636FA2D987970181E18429 /* ASEditableTextNode.mm */, - 5DF8B304DBA0CBC598EE18B439A1C212 /* ASElementMap.h */, - 97C1E2EFBFB3460820319BB67DE7E9A8 /* ASElementMap.mm */, - 5B3B2D807DDE9140D13F1BED76A34345 /* ASEqualityHelpers.h */, - D1442C49B60F16C7023EB46328D280D7 /* ASExperimentalFeatures.h */, - 12F50B842C34A7191176C055E2575D56 /* ASExperimentalFeatures.mm */, - 8C0BBAD824311F04F106FFD4EB44BF55 /* ASGraphicsContext.h */, - 54CFBE333F65B7EDA509A152520B2FE8 /* ASGraphicsContext.mm */, - C59ADB9EF4AC76011254D2D19D104F55 /* ASHashing.h */, - 9E4160A7B13943F81260704B0E61C80B /* ASHashing.mm */, - F16E6F7D9B6576B8DD6D16C43758DEEB /* ASHighlightOverlayLayer.h */, - 5B4C160BB1D1EAFFEB4F75A0CF1EA928 /* ASHighlightOverlayLayer.mm */, - E12BEC428AAE3E8C28DF57765812CED5 /* ASIGListAdapterBasedDataSource.h */, - E5B0C09D2E89A3BCA3B0821E9BB6D98E /* ASIGListAdapterBasedDataSource.mm */, - 31C0F07FBE2B0199D42A94420D767D13 /* ASImageContainerProtocolCategories.h */, - A36DF931FF1FDB789757102295C80518 /* ASImageContainerProtocolCategories.mm */, - 99BE0A92BBFFC7CFFB222E56AE7FB11A /* ASImageNode.h */, - 499BEB74B775484B70F1E00E8A3A16F5 /* ASImageNode.mm */, - FD461E9F85A2684EAFA505483E701C5D /* ASImageNode+AnimatedImage.mm */, - 1893C4BD7BA621726AB5154CD30D6CAA /* ASImageNode+AnimatedImagePrivate.h */, - 570D139FC142DE14276857D5A821A0FF /* ASImageNode+CGExtras.h */, - 4B7B1CC63BD296A46ED1CEB0FA607516 /* ASImageNode+CGExtras.mm */, - B7C9640E43C059034779C6065951B3F2 /* ASImageNode+Private.h */, - F909C9B313C017B8F8C74DCBAF5248EA /* ASImageNode+tvOS.mm */, - 4FC3074532017641CE4C1CCC8CD8C8E9 /* ASImageProtocols.h */, - 4724F74EA5D82E9E84275D106EA514D7 /* ASInsetLayoutSpec.h */, - 0AA919FCE8CBF48395B99617BEC1A794 /* ASInsetLayoutSpec.mm */, - 382FCE39DC2EEBB085E6958DDCBDA1C0 /* ASIntegerMap.h */, - 754A82109BC04437A4A65082E1DF2C78 /* ASIntegerMap.mm */, - 64AE383F5557C4EB6C02982624E9A40C /* ASInternalHelpers.h */, - 1CE7BBCB41E46A58DC8E7488324FD50F /* ASInternalHelpers.mm */, - FFE5D2088D4421C38D2717F2F24F55D1 /* ASLayerBackingTipProvider.h */, - AF566014C397ACC6CFD312D70B47824C /* ASLayerBackingTipProvider.mm */, - F141172D7AE453678F5CC49C5E6BB3F3 /* ASLayout.h */, - 3CAF3AC46F7A1841E56DA5B95393B2DA /* ASLayout.mm */, - 3541CF1CA219182BE21D65B61E860DD6 /* ASLayout+IGListDiffKit.h */, - E57AD3FF0813DE17EB8AA040263EC3F6 /* ASLayout+IGListDiffKit.mm */, - B598C187B5C33F76B1294510F6620F5F /* ASLayoutController.h */, - CB3C4D97C4EAAEE5F19DA33A45F004EB /* ASLayoutElement.h */, - ACF5296A699D89AAF16566B12DE7E1EE /* ASLayoutElement.mm */, - F060D89B1311E95BA6901C3DACB2D91F /* ASLayoutElementExtensibility.h */, - F13A8EEFA730581AB0FEAF5FE9DC341B /* ASLayoutElementPrivate.h */, - 66E1BC9CB957444098D7B71E55F09C0A /* ASLayoutElementStylePrivate.h */, - E6C9422BAA0455B9F51AEB52C13E7476 /* ASLayoutManager.h */, - 1B1F7C4E0D9921A6C8C1EA3BEE4BFBDA /* ASLayoutManager.mm */, - 343547A19426C36360D10F65273D1B44 /* ASLayoutRangeType.h */, - A9819E1E6DBCF77BA7D94CAF9BDFD8BE /* ASLayoutSpec.h */, - 9DE875FB3167EB0F5F0F4E3005267918 /* ASLayoutSpec.mm */, - E58D323E91EB2896C1EDADABA33E1ED7 /* ASLayoutSpec+Subclasses.h */, - E3B0F0BCC8C45B12D129D8BF9014AEFF /* ASLayoutSpec+Subclasses.mm */, - FEED8B10C97A4562E338EF79AFA40380 /* ASLayoutSpecPrivate.h */, - C4A9F045E36CC5F5D32E599F990EBE48 /* ASLayoutSpecUtilities.h */, - C5B834B7F2407602DC9A088127331270 /* ASLayoutTransition.h */, - 0E5AE839317B3000199724623D4D2E78 /* ASLayoutTransition.mm */, - 6CD3D1C0D4D8CBF5CA28CA219F540B6F /* ASLocking.h */, - BD255BBA6F90EDA06E919B775FC21FF0 /* ASLog.h */, - 4B8715D6A274E204E86D6D00E36A455F /* ASLog.mm */, - 0C8F01CDCDCE46D2A23006B20D5CA9D6 /* ASMainSerialQueue.h */, - 950AC8879AB1BF309B91C8294F6C560D /* ASMainSerialQueue.mm */, - A7DD728FA61B8E8979926DBCECF64BFC /* ASMainThreadDeallocation.h */, - 3060F659804F1C8C5BA9D2F576868572 /* ASMainThreadDeallocation.mm */, - 387CB21D415B12F060C1F1855FC1AC1F /* ASMapNode.h */, - A0703C968276AB054A49286C28AD9B0D /* ASMapNode.mm */, - 3C0F40B2FE9CE8B3D3D151D7E694F267 /* ASMultiplexImageNode.h */, - 9A753BCFC4165E6B697BA59DD40FAAE9 /* ASMultiplexImageNode.mm */, - E1193740D5D4555A1D1F327B2384D05D /* ASMutableAttributedStringBuilder.h */, - A8AA7778D9D328FB1753D7CA65EEE518 /* ASMutableAttributedStringBuilder.mm */, - B4F53DB28E010E86FA0EDECD5051E75A /* ASMutableElementMap.h */, - E9D325D76876A8CB3D8E24335C5D30CD /* ASMutableElementMap.mm */, - 697D7E44BDE5BE4A0ACDE3DCC1A75DF9 /* ASNetworkImageLoadInfo.h */, - 1516A83197769FFC3107D5C31B19F920 /* ASNetworkImageLoadInfo.mm */, - 5FADC7F093D717EE9BECA3901F55F5E8 /* ASNetworkImageLoadInfo+Private.h */, - 59BD0CDED5ED108B0885BE7DFC4A68E8 /* ASNetworkImageNode.h */, - 101C500CB65E313FEADB35BA37C18652 /* ASNetworkImageNode.mm */, - 7E34A7732DD6E306B133286A39E05A97 /* ASNodeController+Beta.h */, - 906F6ED5B2CAD7271CCE7BD09B2BE010 /* ASNodeController+Beta.mm */, - FCC931E977AF8361D6564D04989E3EAB /* ASObjectDescriptionHelpers.h */, - 8A0FAC9D991DDA33677FE7889A04F6BB /* ASObjectDescriptionHelpers.mm */, - B8E3A022D1EA37E90ECB5F32EBE79C88 /* ASOverlayLayoutSpec.h */, - 03C2A4303A708600A0DC262AD6293446 /* ASOverlayLayoutSpec.mm */, - 50A360C0E00F5E499E17868877A51886 /* ASPagerFlowLayout.h */, - 70B768A05FD334709DCA17525D948B79 /* ASPagerFlowLayout.mm */, - D24933F7568B4D81C493B4A737BDE668 /* ASPagerNode.h */, - 611F6E0CC80F30ACC082D9A680BB117D /* ASPagerNode.mm */, - 6D9A2760AB1BED75D27EFE6C00D733F5 /* ASPagerNode+Beta.h */, - A7844B6D7C43F9083C5F8A6E086FC6A5 /* ASPageTable.h */, - 3E469CBD7D7AB5AB0A7A4DBF776B412C /* ASPageTable.mm */, - F03D532B340045CA733767D5359BDD90 /* ASPendingStateController.h */, - 6EE68909B7765A77F72DBD6656DED504 /* ASPendingStateController.mm */, - 47A6422944ED734522F40BD5F558F965 /* ASPhotosFrameworkImageRequest.h */, - C512F56D7309F8BBBD1184D118681725 /* ASPhotosFrameworkImageRequest.mm */, - 46A81686966FE14D546FC1B2752C1DA3 /* ASPINRemoteImageDownloader.h */, - A3D10282C45C079174CAE1AF5363443C /* ASPINRemoteImageDownloader.mm */, - EE30FEB1172C0A805A0E58C9490B20FC /* ASRangeController.h */, - C1EB92AB630AF9172AC5AF3D3E63BE08 /* ASRangeController.mm */, - E37ADB2E0B6835C8DDC1275D46DE9F62 /* ASRangeControllerUpdateRangeProtocol+Beta.h */, - 83ED1253C1093BA48C0223F4832BA2EB /* ASRangeManagingNode.h */, - 710255221831EECED77AD74713D6CB3F /* ASRatioLayoutSpec.h */, - 96AF0974FDA6B82D477930BEC2DCA738 /* ASRatioLayoutSpec.mm */, - 133150BCC7C51D98F898F52AC0F3C45F /* ASRecursiveUnfairLock.h */, - B556BB1204DCAA72C25E523036778DA2 /* ASRecursiveUnfairLock.mm */, - 6EB9B106DEE047870AA875F49ACC645D /* ASRelativeLayoutSpec.h */, - 53C048263488DB6D71F9D8AE1C46CA2E /* ASRelativeLayoutSpec.mm */, - 653B60B3AE6439CBED7A8CCF420C9F23 /* ASResponderChainEnumerator.h */, - 23FF327FB28BCDDDA79E921498BD12CC /* ASResponderChainEnumerator.mm */, - C1F23A80ED06BAAE78D795707CD9F171 /* ASRunLoopQueue.h */, - 85B3D35BE281415FC47A0D237EC47AC0 /* ASRunLoopQueue.mm */, - FB325ECFF5088C8A0231289BA25C2D61 /* ASScrollDirection.h */, - A96F08376C80F962F4D6BD677FD6FF2C /* ASScrollDirection.mm */, - 1AB8E5D62AE644B54AF5D74697C539AD /* ASScrollNode.h */, - B460B941AE3263A75BCBD37F1340602E /* ASScrollNode.mm */, - C47C32B24C4785F3C2352F86885C8A40 /* ASSection.h */, - 3A7371016C02C4F31AFC5DD262420436 /* ASSection.mm */, - 1893D93D4FF6D2E7AB3D1FA8B39C79A6 /* ASSectionContext.h */, - 644886BA7CFC1053B9A6C8A36B219C36 /* ASSectionController.h */, - B7556CF8542973F3D63B298D04F57C1D /* ASSignpost.h */, - DAD8839EFD4702B7A2E4E0EACD091FB2 /* ASStackLayoutDefines.h */, - C1FCC0F80EEB9E87D75AB09C5803CEA4 /* ASStackLayoutElement.h */, - 75D035E21022C7914A95EFF5FC065FF3 /* ASStackLayoutSpec.h */, - B8319F072AAB973DC11851036AFCAFAE /* ASStackLayoutSpec.mm */, - DDC2B4BC2A286B87EB8E2802C9EF4154 /* ASStackLayoutSpecUtilities.h */, - FADB5C34DF5FEF16078DA67F7E6D9BBE /* ASStackPositionedLayout.h */, - 86AE0C19AA9B74C4099C440F051BE944 /* ASStackPositionedLayout.mm */, - 0925F2EB13A379945B242CCCF61B7332 /* ASStackUnpositionedLayout.h */, - 9EF7DBD8CB9800A8D8BBD73E557F1149 /* ASStackUnpositionedLayout.mm */, - 1C549603871128C7159E07743161A91B /* ASSupplementaryNodeSource.h */, - BBF774808D26E537AA4D7EF0C64653DA /* ASTabBarController.h */, - 754964278CA439B0C3D6B289E044C695 /* ASTabBarController.mm */, - 647F606801780C21B7C5F64B1DEEE95B /* ASTableLayoutController.h */, - F7CACC3E144BE1342B0D96A643D2ABB0 /* ASTableLayoutController.mm */, - 2D4826F2BC6F23F0D1D5D7C2B56F609A /* ASTableNode.h */, - F2BDADA0E85A73A6C9A29FBA4A48B38F /* ASTableNode.mm */, - 2AA9420294B8B16F8BCB961F354D779D /* ASTableNode+Beta.h */, - 040CEEE0430AE231C0862DE080AAD426 /* ASTableView.h */, - 080181EDB8F556DDB67ED000C5692CC2 /* ASTableView.mm */, - 3FD39AB697A115622B17BFABEDA432DA /* ASTableView+Undeprecated.h */, - 698E06A587E68956D375DE4DDE77643D /* ASTableViewInternal.h */, - BA2E3D91593000ED94F506DC5F930887 /* ASTableViewProtocols.h */, - AB3EEF472E6ED923217C52007B9753F9 /* ASTextAttribute.h */, - C941257A333D4CB849553DD8D2872A14 /* ASTextAttribute.mm */, - 4FF622BC541C8BD3E08AED356B586CC7 /* ASTextDebugOption.h */, - 2832BD3A89507CE25C0F68DDCCEECD2B /* ASTextDebugOption.mm */, - 6E1FF80D8DFD98C50DC0CDBD4035A7D1 /* ASTextInput.h */, - 0A8C0A69A44F45DE13A4D7B103530C5D /* ASTextInput.mm */, - 882CAD5BB4DD023A743916D277E7A9F8 /* ASTextKitAttributes.h */, - 407FB4E16539D50C5FC805D4654328C0 /* ASTextKitAttributes.mm */, - 00FBB068C0ECF1D2860189FAA30D01A9 /* ASTextKitComponents.h */, - EF46DEB85571C6940172D8D85BD97843 /* ASTextKitComponents.mm */, - 4C6957DFA7DC3711E2FE0F5E9C8209F7 /* ASTextKitContext.h */, - 654D1E21BE6823C591A608C6EC9D313B /* ASTextKitContext.mm */, - 873CCB70C10B3A495FBDB6B5F685373B /* ASTextKitCoreTextAdditions.h */, - BC3B699548AA59BEC2E5B6A99B34C470 /* ASTextKitCoreTextAdditions.mm */, - D5DE9D47DF05D8D01A6F3A2E097BE5E9 /* ASTextKitEntityAttribute.h */, - 3044A0A84359FF4C21226519C51C96C4 /* ASTextKitEntityAttribute.mm */, - 724EB6C3115CB64B623A1D3679B1EAFE /* ASTextKitFontSizeAdjuster.h */, - 7ED705D4E8F55EAC73E817A7B629980F /* ASTextKitFontSizeAdjuster.mm */, - 40BDB2BBE7BEFFBD7F245B28C4E6C701 /* ASTextKitRenderer.h */, - 377649CF33B79386CD1F8EF21FB631EB /* ASTextKitRenderer.mm */, - 01C895A2B1D6476DD066F590185AE34F /* ASTextKitRenderer+Positioning.h */, - 8D4C00AC723920417390E546F4E464E6 /* ASTextKitRenderer+Positioning.mm */, - 009A9A4B1869BC413991B31E58E2E649 /* ASTextKitRenderer+TextChecking.h */, - 291BC2B0BD8A4752A19BB5073AAE4CFB /* ASTextKitRenderer+TextChecking.mm */, - 6129268C2516319929891120A1E27FC2 /* ASTextKitShadower.h */, - 0BCC06D05C16D5C36D3FB6838DE3FD3B /* ASTextKitShadower.mm */, - FE196E1C1DB53904E672423E7172D01A /* ASTextKitTailTruncater.h */, - 0F0580A279490FD0D3405F3A050FE99F /* ASTextKitTailTruncater.mm */, - 5F931D5FCD505A1EC8D4200499DD5F5D /* ASTextKitTruncating.h */, - 9550256F4E7B4C72A87110B2650EEE12 /* ASTextLayout.h */, - DA534DB810678A4DFC3E81CC864DBB82 /* ASTextLayout.mm */, - A72891F2EAA5FB673964DECE56723702 /* ASTextLine.h */, - 914D85B5ED811D235D138C46FCE03CF3 /* ASTextLine.mm */, - 6B29341AF11942A1CF41CA21A3FF4E5E /* ASTextNode.h */, - CB1DB9B8DE10D97B44C0298FC7259C6D /* ASTextNode.mm */, - 052ACD33F3EB3D4D07945E4DD3817043 /* ASTextNode+Beta.h */, - F8627D5B8CF030A2C803DF3FEA7726D7 /* ASTextNode2.h */, - 4FDB5D100D95E852ACB475039D799BAA /* ASTextNode2.mm */, - 85E8D418CD5EF412149D67FE44FF73E7 /* ASTextNodeCommon.h */, - 5D3B7C494DBBC77452128797B437E9E1 /* ASTextNodeTypes.h */, - 5D9A1BD9C0606FBED915D19AC8603AA4 /* ASTextNodeWordKerner.h */, - 2C3B9DD9DB1D1CEAB6AAB8F90ACB0114 /* ASTextNodeWordKerner.mm */, - 5D61736478ADD34089F46F34DE790B9E /* ASTextRunDelegate.h */, - F965B11EE046F80AEBC05314B1022295 /* ASTextRunDelegate.mm */, - 0C168477E2A45EC9CDDD9B24747C1207 /* ASTextUtilities.h */, - 79222AC676D15A57DFFB0F575D6E86F4 /* ASTextUtilities.mm */, - D87EBB50A055D11007023EBFE713E8FB /* ASThread.h */, - FE8A206C21E309D2E76C118AD86D8E0D /* ASTip.h */, - AD282AED7973E1FEA2DDE88DEEB1A7BA /* ASTip.mm */, - EADCD92C54DE941C661292CB7A72E1E4 /* ASTipNode.h */, - 12C98099C804EEAE8C9E018B386A93C1 /* ASTipNode.mm */, - 8F85E4431EED137A7DC4C195693DD2EE /* ASTipProvider.h */, - 707AD0C30453447CAB84AF3E8B2B3061 /* ASTipProvider.mm */, - EC46695BEA92F2E006258673E7BCCF46 /* ASTipsController.h */, - AA8CC49BB4D6612039D682B21F71C346 /* ASTipsController.mm */, - 4104FF64ECC788CAAF748ED3F714E463 /* ASTipsWindow.h */, - FFCAFE70FF95518A9551A2E731236083 /* ASTipsWindow.mm */, - B161397BFD4312F3CE0EDD244D8BB6E7 /* ASTraitCollection.h */, - 753ECF455589A055CD627680B98CBFB5 /* ASTraitCollection.mm */, - 082886C0D61122680C638DC1C2DF110E /* ASTwoDimensionalArrayUtils.h */, - 79B1CEDE11B0A34B5F18968527A72ECA /* ASTwoDimensionalArrayUtils.mm */, - 19E4953D755D412B0A70DAC890BD7A73 /* ASVideoNode.h */, - A3DB3136FB4DF801A4F8F0B460DA384F /* ASVideoNode.mm */, - D7599FEDA20FCED7D1C989F0027DD87C /* ASVideoPlayerNode.h */, - CE20F261835124BBA4069930FFF8AF32 /* ASVideoPlayerNode.mm */, - 3023FD70567259A9709DB6D08DB58E7B /* ASVisibilityProtocols.h */, - 8FE59BBB92CE6E1B7353A77C79ECB02E /* ASVisibilityProtocols.mm */, - 726CEC415E5A334A863F7AEF7DE44DED /* ASWeakMap.h */, - 4BE37DED04CFA8DBDAFA0E035F0BC0A4 /* ASWeakMap.mm */, - 57CE5902148A0250A2BEB4005867E04B /* ASWeakProxy.h */, - 6E85211C3E73669751A40E002713DD16 /* ASWeakProxy.mm */, - 249FEB5204659B4680675FC93469BA90 /* ASWeakSet.h */, - 047819DAA49AED990E600441C28AEE1B /* ASWeakSet.mm */, - EAF41E45B6FB22BC0F50FF4DD6125E04 /* AsyncDisplayKit.h */, - 54068F4ABB2F3C303CD1FD89B41B928A /* AsyncDisplayKit+Debug.h */, - 468C6B00497AF557588B204F60C36995 /* AsyncDisplayKit+Debug.mm */, - 0690DE4860D3474C3B51AAD12F5DFFFE /* AsyncDisplayKit+IGListKitMethods.h */, - AED0F60EAE75B20DC8B1DDCE763D458C /* AsyncDisplayKit+IGListKitMethods.mm */, - 045CCCDAC2A4B5ACA485FD439DFC79C7 /* AsyncDisplayKit+Tips.h */, - 5794D63296580A82E5E7C507426C095A /* AsyncDisplayKit+Tips.mm */, - B4A0E4898C9F75644D4095FDD6A5686A /* ASYogaUtilities.h */, - D44D1BEF5EDC1B3EA09C985D75290E19 /* ASYogaUtilities.mm */, - 74C846C2AC2B4F5854716D659394AAFD /* CoreGraphics+ASConvenience.h */, - 4196799D492FD6012BE48E0B05F5AE84 /* IGListAdapter+AsyncDisplayKit.h */, - 596D151CD704967A068249BD31633252 /* IGListAdapter+AsyncDisplayKit.mm */, - 59B418A0524261ACCF5B3790959575D0 /* NSArray+Diffing.h */, - 8674F0C2D71763F78FA0E363967943D0 /* NSArray+Diffing.mm */, - 9EF90F143854BBC6B24900383ABD3946 /* NSAttributedString+ASText.h */, - 41D390D3B3D39D7288BF1633D2578E1E /* NSAttributedString+ASText.mm */, - 02E7624EE1E7C22E2B5F9924253845CC /* NSIndexSet+ASHelpers.h */, - 60461860653D726EFE44A0FFBAAF8ED5 /* NSIndexSet+ASHelpers.mm */, - 304DB8B9A1950B22EE250D24711D2241 /* NSMutableAttributedString+TextKitAdditions.h */, - F53E57B3ECEF0075F1FFFC7710A04639 /* NSMutableAttributedString+TextKitAdditions.mm */, - 7EEB0F6514E0083BC82D21EDB4E525C9 /* NSParagraphStyle+ASText.h */, - 1208FD056F60C358052344C12BCD1400 /* NSParagraphStyle+ASText.mm */, - 740E73D5D26B9B72C2F6662218F80E8E /* UICollectionViewLayout+ASConvenience.h */, - 71FF5DE9C308C4D21300343B8F095CBA /* UICollectionViewLayout+ASConvenience.mm */, - 2B67743FDFF4DCC72D2196FDC564AF55 /* UIImage+ASConvenience.h */, - 6D2D1D6444B898D1B0C87B8603DD4677 /* UIImage+ASConvenience.mm */, - D63C6386D47750008C137AFC5A3B96AC /* UIResponder+AsyncDisplayKit.h */, - 9E80E5CE90F93687CC3256CE5C94CFB9 /* UIResponder+AsyncDisplayKit.mm */, - 12A41184DB2B2A269071BD7D628084C8 /* UIView+ASConvenience.h */, - ); - name = Core; - sourceTree = ""; - }; - 0A3D2ABC3AD80561D335EF3444F18408 /* Support Files */ = { - isa = PBXGroup; - children = ( - A43F626612EAF6E6960627B69535B850 /* PINRemoteImage.modulemap */, - 510DCE3B48F67D693EF6D5292014D927 /* PINRemoteImage-dummy.m */, - 6721E5BEB6FCC93087D899B00F020D5A /* PINRemoteImage-Info.plist */, - 0B6ED2BB64A6A7DA8BC93530E3F55366 /* PINRemoteImage-umbrella.h */, - BAB31548FC8D5AB50A8EB7217A7712E4 /* PINRemoteImage.debug.xcconfig */, - 773FC3074F118DBE19C9C2A18699AB84 /* PINRemoteImage.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/PINRemoteImage"; - sourceTree = ""; - }; - 0D5E7BF27B539B0913146F9F9E012151 /* PINCache */ = { - isa = PBXGroup; - children = ( - 33AA14BD89980AFD2BBC18731D53D264 /* Arc-exception-safe */, - AF01054A076C894E59C4EAC9EF1D23C7 /* Core */, - 7D9B71082E14B346BD914A790DA23BF3 /* Support Files */, - ); - name = PINCache; - path = PINCache; - sourceTree = ""; - }; - 1474FF1EBA82D7FE6BF324B273C79700 /* Pods-QuranEngineApp */ = { - isa = PBXGroup; - children = ( - 1FB59CB082AC334B86A93F5C8EE3CE76 /* Pods-QuranEngineApp.modulemap */, - EF89D4D6DDB0837C88D15871AB9DDA90 /* Pods-QuranEngineApp-acknowledgements.markdown */, - A123CBF5C788F8269D38573F83735141 /* Pods-QuranEngineApp-acknowledgements.plist */, - 4344BE434739CB35CB35BD2CBC0F28C8 /* Pods-QuranEngineApp-dummy.m */, - 804E6E9F0BDB52D537D3FD57ADE50A87 /* Pods-QuranEngineApp-frameworks.sh */, - 27C34214EA6C1A77DC683F03DC1EBA4A /* Pods-QuranEngineApp-Info.plist */, - B0E52C5629031EF1A914D0B9BBF6D541 /* Pods-QuranEngineApp-umbrella.h */, - BE492B86F41B5899AFF47ACDB4126D06 /* Pods-QuranEngineApp.debug.xcconfig */, - 92D1ABB868F070AF10E82FC0EF2D1E50 /* Pods-QuranEngineApp.release.xcconfig */, - ); - name = "Pods-QuranEngineApp"; - path = "Target Support Files/Pods-QuranEngineApp"; - sourceTree = ""; - }; - 2FE445AD883B9ABD3E0241A05A5B79FD /* Frameworks */ = { - isa = PBXGroup; - children = ( - DA95714556EDE631ED40398A135EC625 /* iOS */, - ); - name = Frameworks; - sourceTree = ""; - }; - 33AA14BD89980AFD2BBC18731D53D264 /* Arc-exception-safe */ = { - isa = PBXGroup; - children = ( - CDB9905DE100C45E321FF681B0BE5D74 /* PINDiskCache.m */, - ); - name = "Arc-exception-safe"; - sourceTree = ""; - }; - 4943E861C9E9B41168E44698FBDDC1F3 /* Texture */ = { - isa = PBXGroup; - children = ( - 03B215D9E8443D196213673C760E8EF2 /* Core */, - 5791E39C24AEAEC8AC6C161D7091624D /* Support Files */, - ); - name = Texture; - path = Texture; - sourceTree = ""; - }; - 5791E39C24AEAEC8AC6C161D7091624D /* Support Files */ = { - isa = PBXGroup; - children = ( - 5C4AA3335C622751A32A744499AF7CE2 /* Texture.modulemap */, - 805F38459176CFBF7BFE070EAE17FF09 /* Texture-dummy.m */, - C9C467665994B887574F02A84A9F4800 /* Texture-Info.plist */, - 635A8DB9ABD3EE0FFC5E3308011CDF36 /* Texture-prefix.pch */, - 6FEDA9949DABCA4821DDDD0414408B22 /* Texture-umbrella.h */, - 14D1789AFF19612903A6DEC3719662F3 /* Texture.debug.xcconfig */, - 7DBE419CB2F290B559A7011979017C7D /* Texture.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/Texture"; - sourceTree = ""; - }; - 7D9B71082E14B346BD914A790DA23BF3 /* Support Files */ = { - isa = PBXGroup; - children = ( - AE482408FCFD063EC12E94BA06BA5CD4 /* PINCache.modulemap */, - 6F1D0CDE40B7ADECFF3A55527DA6DDC0 /* PINCache-dummy.m */, - BE11BB4291FF4EC28259ED221EAED215 /* PINCache-Info.plist */, - 7428C524EFC7D50242D9CF71007C0A93 /* PINCache-prefix.pch */, - 274269F974F0098D974E13CADE4FC16A /* PINCache-umbrella.h */, - 49EC90EF95A2BAABAA44D24EA9E6115B /* PINCache.debug.xcconfig */, - 0ECB2E92B3BD6B8EF0C554FFB94D06B1 /* PINCache.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/PINCache"; - sourceTree = ""; - }; - 88A0DD5433BF494A46E50E31F6C6A20B /* PINRemoteImage */ = { - isa = PBXGroup; - children = ( - D0C8620CB5D7EE3AF126DA59CE4392D7 /* Core */, - C1E8A3DCAAE3BFCC36929031CC045756 /* PINCache */, - 0A3D2ABC3AD80561D335EF3444F18408 /* Support Files */, - ); - name = PINRemoteImage; - path = PINRemoteImage; - sourceTree = ""; - }; - 9D6AB999CF94FAE72B2E5C5F7C60A29F /* PINOperation */ = { - isa = PBXGroup; - children = ( - EECCA4A8A8683035F019428C5499815C /* PINOperation.h */, - A6648655AE61CC658E7AE86A6804AD60 /* PINOperationGroup.h */, - ABC2257CCA051191378319330151F0D4 /* PINOperationGroup.m */, - 6FA8B88434F89A38DB5CEC77891BEAC7 /* PINOperationMacros.h */, - F786D2FE67301111EA52EC486B239B2B /* PINOperationQueue.h */, - E4A4E77985D62E4AE0F17F553E7EB919 /* PINOperationQueue.m */, - 556D557F23FCD191B665690B58AC0B95 /* PINOperationTypes.h */, - DB2E41F787B23A6D94DD0E8BEE86D3DD /* Support Files */, - ); - name = PINOperation; - path = PINOperation; - sourceTree = ""; - }; - AF01054A076C894E59C4EAC9EF1D23C7 /* Core */ = { - isa = PBXGroup; - children = ( - 189BBBEF314F5632F32DEBAB3119AA42 /* PINCache.h */, - CEA150E52F46238642DC87EC38BD0E6D /* PINCache.m */, - D55B5D9D10346E310CC066CE345EF883 /* PINCacheMacros.h */, - 4AD14C8259CFDAA23540FB84371A8C91 /* PINCacheObjectSubscripting.h */, - F3A05A320A0B5986D46D8E46AB8F56DB /* PINCaching.h */, - CA8AEF5A3D9FB6C2D3EDA71FC15F7D74 /* PINDiskCache.h */, - 0964567655AE549BDF757E8DF816FBFF /* PINMemoryCache.h */, - 9E12D4B3FB7683F25D5A629A2F5CF4F5 /* PINMemoryCache.m */, - ); - name = Core; - sourceTree = ""; - }; - C1E8A3DCAAE3BFCC36929031CC045756 /* PINCache */ = { - isa = PBXGroup; - children = ( - 60E2A9C368D8B4DB87B8786A1150005A /* PINCache+PINRemoteImageCaching.h */, - 09018DF2292D2A0DB7CD1AE16D80E0C5 /* PINCache+PINRemoteImageCaching.m */, - ); - name = PINCache; - sourceTree = ""; - }; - CF1408CF629C7361332E53B88F7BD30C = { - isa = PBXGroup; - children = ( - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, - 2FE445AD883B9ABD3E0241A05A5B79FD /* Frameworks */, - FFA46F15410013C35249535D7CB49C7F /* Pods */, - 009DF648D2F57CDF9D0B11036729F25E /* Products */, - F5A19CF480C9E536432ACDA2EB423734 /* Targets Support Files */, - ); - sourceTree = ""; - }; - D0C8620CB5D7EE3AF126DA59CE4392D7 /* Core */ = { - isa = PBXGroup; - children = ( - DF03059CFC2CF8C308FEB24EB69C2BC1 /* NSData+ImageDetectors.h */, - 5F5D034DB1ED346FED8B825B2C4FACAE /* NSData+ImageDetectors.m */, - FB32E2461EA09ADDAA167B8226BF68A2 /* NSHTTPURLResponse+MaxAge.h */, - D643AB237A68D3EA33E130BE941C23A2 /* NSHTTPURLResponse+MaxAge.m */, - 5316B79F60F907878E80E6789410C62C /* PINAlternateRepresentationProvider.h */, - 2F1876604918F7E85C8C8C00692D7E31 /* PINAlternateRepresentationProvider.m */, - 966FD881395FF4683060BDF1A2C1AFE7 /* PINAnimatedImage.h */, - 29F590A258A736639A4D10C302391831 /* PINAnimatedImage.m */, - D13CF7125B69CA994A1A19ADF69164F8 /* PINAnimatedImageView.h */, - C0F24E93C735911A21D52FCA96DE90EF /* PINAnimatedImageView.m */, - 0DBC478814C98DC8DF9A700BA2AFB12E /* PINAnimatedImageView+PINRemoteImage.h */, - F6E67D14993A7B56B97A9C6D49B944FC /* PINAnimatedImageView+PINRemoteImage.m */, - 1CD84E09F5FA855D090FB8AA27C039C2 /* PINButton+PINRemoteImage.h */, - 9FAB346055C63B3162B59F5DE8235DF0 /* PINButton+PINRemoteImage.m */, - 3C69FF5E87A081B57AFD9CF41C19BC10 /* PINCachedAnimatedImage.h */, - 130371D9D979BBE4A21D3985FF5C0CBA /* PINCachedAnimatedImage.m */, - 442AD1A685AA2C1A7EDB840685B29CCB /* PINDisplayLink.h */, - BB800E39017591858E237D0FF17509B6 /* PINDisplayLink.m */, - 736C046DCA265EE81A58FD5F89BF6102 /* PINGIFAnimatedImage.h */, - 5446BF8F6EE5445BB8095CED507BA6E0 /* PINGIFAnimatedImage.m */, - 451F8219FEECBEF1D8D5576A706A6259 /* PINImage+DecodedImage.h */, - 7E77840DF764C7052517CF2ED7FF71A3 /* PINImage+DecodedImage.m */, - 3C5A6AEC41EFC3AD25534536494FF0B1 /* PINImage+ScaledImage.h */, - 23B7B3467E387075BB087F9DF9D8EDF5 /* PINImage+ScaledImage.m */, - E2BF0999ECBBCF0288C66B2D84F59B64 /* PINImage+WebP.h */, - 2AEE11DDE18165E6A0EE511B797F4CD4 /* PINImage+WebP.m */, - 72097EDC568749414EDF3AC657BB07C3 /* PINImageView+PINRemoteImage.h */, - 790FD97BCBD0110961780552C759DF98 /* PINImageView+PINRemoteImage.m */, - F4EDFDD960862C423CFEE9683653342B /* PINProgressiveImage.h */, - 4FE8339B40FB00918941FBCDC5F30D28 /* PINProgressiveImage.m */, - 5688A739BB7B10A17AF1E41094FBDD6B /* PINRemoteImage.h */, - 85DC3A0BDC8F3003550567F705BC3C4A /* PINRemoteImageBasicCache.h */, - 25241914808C5FF6BE5F927F84792A40 /* PINRemoteImageBasicCache.m */, - 4C8BC130248DB0AD806FA743C70A99B4 /* PINRemoteImageCaching.h */, - 930163D057DF4C17CDACDDB653AD3C46 /* PINRemoteImageCallbacks.h */, - 1722A238A2D68ECA7C85A592D48C54E5 /* PINRemoteImageCallbacks.m */, - 2138392302088734C71C953F6E8BE31F /* PINRemoteImageCategoryManager.h */, - 42F1BDB74A174F9531FB779E45BC1D50 /* PINRemoteImageCategoryManager.m */, - D9C64EBA02032F27282C40FD7220273C /* PINRemoteImageDownloadQueue.h */, - 3C8F71BC92C3939CC05FD410E84FF05C /* PINRemoteImageDownloadQueue.m */, - 1A77A2AEAA733E58FDCD4CAA0922B1A8 /* PINRemoteImageDownloadTask.h */, - 2C0A55D5092394CDBE41B7565F27BD76 /* PINRemoteImageDownloadTask.m */, - B804EAE3C4FD585B6054924F31638531 /* PINRemoteImageMacros.h */, - 8FA479C38E875642DC6D0F70C22C53E2 /* PINRemoteImageManager.h */, - EE2940E42584F168B39AE1ADCDAF32AA /* PINRemoteImageManager.m */, - D7429861868D4103F11B9E94C19522A9 /* PINRemoteImageManager+Private.h */, - 1DBBE6C78D2A10AE3C8E91AC0E6C3244 /* PINRemoteImageManagerConfiguration.h */, - D7AEF2BB9296AC6AD078D6A403286D8F /* PINRemoteImageManagerConfiguration.m */, - 013E1DDF851F0FD096C42D0EAC0480E2 /* PINRemoteImageManagerResult.h */, - 39469547584715DC15C17FD3249DB5F3 /* PINRemoteImageManagerResult.m */, - C9C4E917C6DD24E5A1A14EF3D1471B07 /* PINRemoteImageMemoryContainer.h */, - 3B76C13871113610B790E5634FD8E4B7 /* PINRemoteImageMemoryContainer.m */, - 2D08D914160D3368A237E541232421E1 /* PINRemoteImageProcessorTask.h */, - 033CCEDAB42EDF1F79E201309B0557B6 /* PINRemoteImageProcessorTask.m */, - 9E57E56ED96B01EFFB474D13F8F2E736 /* PINRemoteImageTask.h */, - 0FEA06CB098370189C1103854CA5077F /* PINRemoteImageTask.m */, - 1E6AFB718C24B2377E5DF0CCDA306C55 /* PINRemoteImageTask+Subclassing.h */, - 28C3E95F4439C05AD7DD1B694E01B06F /* PINRemoteLock.h */, - 70907139FDD30DCEEA7A9190BA24A9D8 /* PINRemoteLock.m */, - 474F334721D6E818D56CC8B9B8BD4076 /* PINRemoteWeakProxy.h */, - 9DA8213BEA83150926293674AE1852A9 /* PINRemoteWeakProxy.m */, - BDBDCD408FDA7E7CFEE56C22BE3A64D4 /* PINRequestRetryStrategy.h */, - 1394E4E8CCCBB0C8068E295304334637 /* PINRequestRetryStrategy.m */, - A7B540D3D7D6A9543C97F678E925A099 /* PINResume.h */, - 73AA3A23C9F3D8C94C70E9CD5CAB902C /* PINResume.m */, - F12B84DDA3761BCCFFC101F6185D46A9 /* PINSpeedRecorder.h */, - 76660865DC7BA0803ED5AF36FA8E6ECA /* PINSpeedRecorder.m */, - 51E4828747ABF0F4B0D5210073FD2269 /* PINURLSessionManager.h */, - 6B20999B345220EA81A18684BC483B2D /* PINURLSessionManager.m */, - 626548E82C01FE272CD114C9F7F07556 /* PINWebPAnimatedImage.h */, - 3D673E12DB0B97C4702DCA57BD907DCD /* PINWebPAnimatedImage.m */, - ); - name = Core; - sourceTree = ""; - }; - DA95714556EDE631ED40398A135EC625 /* iOS */ = { - isa = PBXGroup; - children = ( - 7302265D1F954C78B31920D3B049E09A /* Accelerate.framework */, - AF76734BAC07F62141ADA88F036045A0 /* AVFoundation.framework */, - 41164F15B6082BB9672F7AE39D3A0BC2 /* CoreLocation.framework */, - C805681D63BCD8F052201D2C42F84546 /* CoreMedia.framework */, - 4A5364016259E6CB2444653E04A14B28 /* Foundation.framework */, - 0E023121733B6B77E3E893B9457AEBF9 /* ImageIO.framework */, - 62F113024ED798469066EFDFED7CBAFD /* MapKit.framework */, - 365E24AE7E774D0386BE4163F202EB5F /* Photos.framework */, - B9485C16107E619D52DEDDC8F0811F67 /* UIKit.framework */, - ); - name = iOS; - sourceTree = ""; - }; - DB2E41F787B23A6D94DD0E8BEE86D3DD /* Support Files */ = { - isa = PBXGroup; - children = ( - 0C2BF8A59FA951CF59C6FA88A1A8895D /* PINOperation.modulemap */, - 741BAE82F2A2B69F81AE5008435BADE3 /* PINOperation-dummy.m */, - 90D1B54DABB36946B78848BB58EA41DF /* PINOperation-Info.plist */, - 64116DD37F68B07B3B0DE77751C883F1 /* PINOperation-prefix.pch */, - A74625036C72AB1D11BF828EF40AF42E /* PINOperation-umbrella.h */, - ED201A924E0BC9468579E76F2F2FE7AD /* PINOperation.debug.xcconfig */, - 2C41CB510A0394AE786A47727010CFF4 /* PINOperation.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/PINOperation"; - sourceTree = ""; - }; - F5A19CF480C9E536432ACDA2EB423734 /* Targets Support Files */ = { - isa = PBXGroup; - children = ( - 1474FF1EBA82D7FE6BF324B273C79700 /* Pods-QuranEngineApp */, - ); - name = "Targets Support Files"; - sourceTree = ""; - }; - FFA46F15410013C35249535D7CB49C7F /* Pods */ = { - isa = PBXGroup; - children = ( - 0D5E7BF27B539B0913146F9F9E012151 /* PINCache */, - 9D6AB999CF94FAE72B2E5C5F7C60A29F /* PINOperation */, - 88A0DD5433BF494A46E50E31F6C6A20B /* PINRemoteImage */, - 4943E861C9E9B41168E44698FBDDC1F3 /* Texture */, - ); - name = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 47155CF8AE150135F6F39FCB3DCA18CA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9F275DA64CC73A8CBF503779C60625B3 /* NSData+ImageDetectors.h in Headers */, - A007A9CCE045C77A875CC7C4AF51E9A0 /* NSHTTPURLResponse+MaxAge.h in Headers */, - C2395036EBABE7F014B56929F69A338A /* PINAlternateRepresentationProvider.h in Headers */, - FC8D9F6E6DE4C67A9FE8B3A8F11F729D /* PINAnimatedImage.h in Headers */, - 961DE130A9E4DD57A6F25B062255283A /* PINAnimatedImageView.h in Headers */, - B4C40FC629F0F9603B31BA7C750046DE /* PINAnimatedImageView+PINRemoteImage.h in Headers */, - 332E9E32EA25C369B340F2F1E9C92F45 /* PINButton+PINRemoteImage.h in Headers */, - D3432BB8BB34875039B8A3C271336E05 /* PINCache+PINRemoteImageCaching.h in Headers */, - D514FA842155B72AE180DDBBF45F49E3 /* PINCachedAnimatedImage.h in Headers */, - 02AF397365C7CB3B1F57028188D0B68F /* PINDisplayLink.h in Headers */, - 3AE955B7D903DB932626F94E543281A7 /* PINGIFAnimatedImage.h in Headers */, - A662BC683008DE9C18F0428B1E583A7C /* PINImage+DecodedImage.h in Headers */, - 2AA41D578774DF06B8681D32063E7172 /* PINImage+ScaledImage.h in Headers */, - 247E56FF8D9DF6549843D24F631749D1 /* PINImage+WebP.h in Headers */, - 60F36B18D923D00F2135B9CEB72CC334 /* PINImageView+PINRemoteImage.h in Headers */, - 53E0B4B9A8A2CD3D9B735CB70131E46E /* PINProgressiveImage.h in Headers */, - C0427800BE10B11608AAF6532C1652FE /* PINRemoteImage.h in Headers */, - 6C99CB0546A67C92946A261F3FA77C4C /* PINRemoteImage-umbrella.h in Headers */, - 0F6CBF54EF02296066EE92C08157BE57 /* PINRemoteImageBasicCache.h in Headers */, - 898401A9D2A6DC70342A804CA5755C7D /* PINRemoteImageCaching.h in Headers */, - 522D68C238ADD2E4BB0EDC6E7E789375 /* PINRemoteImageCallbacks.h in Headers */, - 7786E21F8F8B8A0A4A11B660FBB1D60C /* PINRemoteImageCategoryManager.h in Headers */, - 21FBFB72534277246F629CC90F3D7F29 /* PINRemoteImageDownloadQueue.h in Headers */, - C3F455D49AA09EB5CA60BE378E43F1A1 /* PINRemoteImageDownloadTask.h in Headers */, - 4D527C08432C35A9D8400A4C214700C3 /* PINRemoteImageMacros.h in Headers */, - BE720438A60C4A81EC92A355EB137C22 /* PINRemoteImageManager.h in Headers */, - 21DCBBD78D526AB9297D3707AFC77623 /* PINRemoteImageManager+Private.h in Headers */, - 153FD8A5FA694ADEEEDEA6F6FB09AA92 /* PINRemoteImageManagerConfiguration.h in Headers */, - 8BCD1D5EB6B812254575B2DA11A57E11 /* PINRemoteImageManagerResult.h in Headers */, - 7517E9B14979B340E646786F61633295 /* PINRemoteImageMemoryContainer.h in Headers */, - C6DC0F02C5A319E940AA974391B3A9C4 /* PINRemoteImageProcessorTask.h in Headers */, - BD68272E87015A93284F5B0183F4C6E0 /* PINRemoteImageTask.h in Headers */, - F05B82F3E35CD5A5537D2464E9E6F63C /* PINRemoteImageTask+Subclassing.h in Headers */, - E3A179F6B09B2A4F812B6BF97005C0CF /* PINRemoteLock.h in Headers */, - B4898FFC7091EDAD8B9AB4AE27659FD2 /* PINRemoteWeakProxy.h in Headers */, - 2412D4ACF526125BC89031C6BA0EDEB4 /* PINRequestRetryStrategy.h in Headers */, - DB7FA8C10EBCEC4481E4E5003BAEBA36 /* PINResume.h in Headers */, - 48E59BF2D8DCCFAA3BB8DE31311B9032 /* PINSpeedRecorder.h in Headers */, - 02FE2CF250A25007FD38EA6B9B341AF3 /* PINURLSessionManager.h in Headers */, - F7113A95CB5292F20D610693D8E57D31 /* PINWebPAnimatedImage.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4EE408C9977B8EDFC754EAB14E9FCEAE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 81B9711E3EF95B8BE0B14760D3C60AA3 /* Pods-QuranEngineApp-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 673976BF5A6B856289F6D7375897B086 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DE1B1E6AF130C2857664BD02A6144CF0 /* _ASAsyncTransaction.h in Headers */, - 5DAEA00A887FFD1662E0C1D7902C8655 /* _ASAsyncTransactionContainer.h in Headers */, - AFA128BCAFA40EF0FBC37D20C2BFCFF3 /* _ASAsyncTransactionContainer+Private.h in Headers */, - E583554E4D4DE122517637E8C63FC6E6 /* _ASAsyncTransactionGroup.h in Headers */, - 1E93E6B30BA2021C04BD704E2F81EA06 /* _ASCollectionGalleryLayoutInfo.h in Headers */, - 1E7C7A4276194966E633743A8CB8BF93 /* _ASCollectionGalleryLayoutItem.h in Headers */, - CE44B1445110CC699E10CE9603CE78F3 /* _ASCollectionReusableView.h in Headers */, - E52D136C23DC7CC095282B4181C351AD /* _ASCollectionViewCell.h in Headers */, - 2EA4BBB10FC2BDD88F4F5D06293CA43F /* _ASCoreAnimationExtras.h in Headers */, - 83436179D9FA924E0C35077251F7432A /* _ASDisplayLayer.h in Headers */, - A6B55651D1E6DFB32F76E62054BEE2E5 /* _ASDisplayView.h in Headers */, - 72B700A78DF99ABCE27CE090B81C3F2A /* _ASDisplayViewAccessiblity.h in Headers */, - 9D2768D725DFF89826A4CD3BB24968A9 /* _ASHierarchyChangeSet.h in Headers */, - 0E5F509E5D60FCFF1C2F3EC497794E71 /* _ASPendingState.h in Headers */, - 1BA73AA56A592ED697232186BF26AF1A /* _ASScopeTimer.h in Headers */, - 1ED4F0EFF82AF1304608D543EBC7A929 /* _ASTransitionContext.h in Headers */, - BC38ABF29281E009B90EF70FBB8A9D54 /* ASAbsoluteLayoutElement.h in Headers */, - 65E0D173BC2EF8D98C376595403720A6 /* ASAbsoluteLayoutSpec.h in Headers */, - DFD2EC908B5D436DA5B81FCFB94C5EA5 /* ASAbstractLayoutController.h in Headers */, - EF8559752F0DEB5F3EBAB8B33A292442 /* ASAbstractLayoutController+FrameworkPrivate.h in Headers */, - 85BA73ACD2FB979A72B1DB563F02EFD2 /* ASAsciiArtBoxCreator.h in Headers */, - 5D3E4F78297EC2FF6662C80567B3AD2B /* ASAssert.h in Headers */, - F0590E746579F4828947DD30524302F6 /* ASAvailability.h in Headers */, - 2735C083AC4BB73708BCAE189B61F7D3 /* ASBackgroundLayoutSpec.h in Headers */, - 02F9F03BEEF8DB158F0F7F5432280B7F /* ASBaseDefines.h in Headers */, - 780D8E62DFDEF764176F995026DBBDBC /* ASBasicImageDownloader.h in Headers */, - CBCF3D05C2B36063DEAA78C6E99D8248 /* ASBasicImageDownloaderInternal.h in Headers */, - 0440B6E9A5BA41F99CA6FD68647D8C65 /* ASBatchContext.h in Headers */, - 820B2435B19530C70FAEED0645FFE483 /* ASBatchFetching.h in Headers */, - 1886B41B35B563AEB43F1FC7F52B1283 /* ASBatchFetchingDelegate.h in Headers */, - 60F95E25C14B956BD76AAA8C68BA2B01 /* ASBlockTypes.h in Headers */, - A9AF7D7DBA14C22AFB30D5C5E5E15A56 /* ASButtonNode.h in Headers */, - F9D7EE340DF175B84B85658B3BB8CF71 /* ASButtonNode+Private.h in Headers */, - 98637BFE2011843AB7CB09DC423EC47F /* ASButtonNode+Yoga.h in Headers */, - 32EC02441401AC8D2FCFFB98CA48FA0D /* ASCellNode.h in Headers */, - 52CF30B3607392D1F903039AF569EA11 /* ASCellNode+Internal.h in Headers */, - 8EE4067364BC2F4D7AD001622268ADBE /* ASCenterLayoutSpec.h in Headers */, - D1BF64D194C4D385D34836D907917AA7 /* ASCollectionElement.h in Headers */, - 6D5A3EC9780D298CE8A9BB6D075BCED7 /* ASCollectionFlowLayoutDelegate.h in Headers */, - E8CB30D9ED40DB88D8728C34F9644F04 /* ASCollectionGalleryLayoutDelegate.h in Headers */, - AE3B21A548D745407E311C25C6D91CA5 /* ASCollectionInternal.h in Headers */, - 33421381D895BF98FF18C4F5AC9F8261 /* ASCollectionLayout.h in Headers */, - 7A14ACE26973FF95A725654BEF22D327 /* ASCollectionLayoutCache.h in Headers */, - 31B5F61D67A24F8B110B680A9FAEBF6A /* ASCollectionLayoutContext.h in Headers */, - 43BBA3D287D8C9BF085A5AE359A44A9D /* ASCollectionLayoutContext+Private.h in Headers */, - C59FD71C071642E37FBE6FA11098B5B0 /* ASCollectionLayoutDefines.h in Headers */, - C43A67080923BE90B06E211A697E17D3 /* ASCollectionLayoutDelegate.h in Headers */, - 17533F39BB3633CDB147A9C6FC372448 /* ASCollectionLayoutState.h in Headers */, - 2C9C4577BB31751058E66003DFBFCD97 /* ASCollectionLayoutState+Private.h in Headers */, - 41BB9F1ADF7F55BABFF72441B1270C48 /* ASCollectionNode.h in Headers */, - 09B549E0955014624F185FC3D4B69035 /* ASCollectionNode+Beta.h in Headers */, - 2D62747B055B8A221BB1F1B36F8A8E4F /* ASCollections.h in Headers */, - AD7E38625E562BDF24EDFD0E088A3DD8 /* ASCollectionView.h in Headers */, - 5FAE049E96087E200404A018B38E17C5 /* ASCollectionView+Undeprecated.h in Headers */, - 43B9A6C4D13BDB7D052D9B7739BABEA4 /* ASCollectionViewFlowLayoutInspector.h in Headers */, - BC4CF7C751F566D1C1ADDD9333BC87A9 /* ASCollectionViewLayoutController.h in Headers */, - BB296CBC415CF6CBCDE3A30E62CC77D7 /* ASCollectionViewLayoutFacilitatorProtocol.h in Headers */, - F3025A2139AF32BBE05B0DF3C5E008F2 /* ASCollectionViewLayoutInspector.h in Headers */, - DDC4808AC994A6D068DF4F9BEFEEDF3C /* ASCollectionViewProtocols.h in Headers */, - BC853B6F48802BADEE404AB54027458D /* ASConfiguration.h in Headers */, - 536AF88BDA9236398E3EA899F337FC1F /* ASConfigurationDelegate.h in Headers */, - 09F2CB6C3D0AECB7010A87488F76F355 /* ASConfigurationInternal.h in Headers */, - 26D13B5B478ECA3863AC486AA9135B54 /* ASContextTransitioning.h in Headers */, - 9568AE899C92AB354CBBF89047BF51CB /* ASControlNode.h in Headers */, - A7A45457326B6C571CF584EAAA728E24 /* ASControlNode+Private.h in Headers */, - 3AE6124C547B0B0192F223327A95A100 /* ASControlNode+Subclasses.h in Headers */, - F76FBF7D27355B7696587E4F7E2DC806 /* ASControlTargetAction.h in Headers */, - 8B7E587D7C98AC7B411A16E2667BB304 /* ASCornerLayoutSpec.h in Headers */, - 8E553E958248D0FD8A278FD861D95369 /* ASDataController.h in Headers */, - C3C800DA13015BB6B658CFF4B72963CA /* ASDefaultPlaybackButton.h in Headers */, - 4EC7884A54FE8E160CF700F04E01EB9E /* ASDefaultPlayButton.h in Headers */, - E3E2AE0BDA79295454E23890F23F726B /* ASDelegateProxy.h in Headers */, - 40D81799A451A9C2170036BF195EED93 /* ASDimension.h in Headers */, - BFC09521412E36D2DEEB7C45F1C18998 /* ASDimensionInternal.h in Headers */, - B1274A8BC2301074A193505C3A9478D0 /* ASDispatch.h in Headers */, - 2BBF7A97306CB4348C2FCA8CBD7CE9CC /* ASDisplayNode.h in Headers */, - 76F7232A3717A0CF978B4B8FECA10D21 /* ASDisplayNode+Ancestry.h in Headers */, - 94FDBF7A9ECE5A7C8836EF94E6C8D3F3 /* ASDisplayNode+Beta.h in Headers */, - 5B5E8E61D2986F8A39419F5024064E2B /* ASDisplayNode+Convenience.h in Headers */, - 202E197EE4A60E6797BFC70B2AFC8EDB /* ASDisplayNode+DebugTiming.h in Headers */, - EF8D23C9C0A8BC119680FA7F5A5BD04C /* ASDisplayNode+FrameworkPrivate.h in Headers */, - 5109827CE8ED278BA6E5DCADE6C3CE7E /* ASDisplayNode+InterfaceState.h in Headers */, - 5345FD9EBEA158D5C233476EE9BECFFD /* ASDisplayNode+LayoutSpec.h in Headers */, - 449A817232A104C9DAE898773E9F60E5 /* ASDisplayNode+Subclasses.h in Headers */, - 2F43BFDC9DB7C47CD6714933CD7DB5C6 /* ASDisplayNode+Yoga.h in Headers */, - AEE5258EA7BD79A0038A30C2A80C5521 /* ASDisplayNodeCornerLayerDelegate.h in Headers */, - 74A02A1FE2623D7B1EAC47BEC653267E /* ASDisplayNodeExtras.h in Headers */, - FE3CBAD197E7F9084120F8731B13FA62 /* ASDisplayNodeInternal.h in Headers */, - A21EBFDC274B405BD0267CC0D353C782 /* ASDisplayNodeLayout.h in Headers */, - 574A09D4A04DE9D25C44E1ACD4029F1B /* ASDisplayNodeTipState.h in Headers */, - 5A7A83090ED90EFFF26754EF11B4B78B /* ASDKNavigationController.h in Headers */, - A6F1239A1F724934246A7C17A6AF264E /* ASDKViewController.h in Headers */, - A1D2EED21F512EB9A460CC3A0E7BE42E /* ASEditableTextNode.h in Headers */, - 2DDF273EB30C7696F97EB631805FC3B2 /* ASElementMap.h in Headers */, - 918D807803E50B6D18CDC4CC0B4F3C0C /* ASEqualityHelpers.h in Headers */, - F4984F1FD1DF7360FBD0B3448DDDCAB2 /* ASExperimentalFeatures.h in Headers */, - E2ED3116609CBFC82B326899BF6BBF79 /* ASGraphicsContext.h in Headers */, - C737265488C0E61AB0B79DCC440AE314 /* ASHashing.h in Headers */, - C163D850EA71BEEB316BE5BBD1781214 /* ASHighlightOverlayLayer.h in Headers */, - E1721361E4D468E357BD15F14E780BC1 /* ASIGListAdapterBasedDataSource.h in Headers */, - 8A2274DC30D6C37EAA2E6C8E27E626E0 /* ASImageContainerProtocolCategories.h in Headers */, - BFB38297439E240E69C45D08D020C07E /* ASImageNode.h in Headers */, - 69A0C835E4931BE8AC803E990807F9A3 /* ASImageNode+AnimatedImagePrivate.h in Headers */, - BEA2AFDBE8D7453B8C29CA5927396063 /* ASImageNode+CGExtras.h in Headers */, - 2F671E18B872674AE84A6FEBF65C94A2 /* ASImageNode+Private.h in Headers */, - 6D297544083B567E651219F6250A382F /* ASImageProtocols.h in Headers */, - AD25D2B276DE382874F908C11FBE883E /* ASInsetLayoutSpec.h in Headers */, - B9F5845CDBE00D1113010F1E522D6F6E /* ASIntegerMap.h in Headers */, - A0A3B06508FDAA2C062AE6AE0A9B2B04 /* ASInternalHelpers.h in Headers */, - 3E3670EDDCF318105CB5AA967075CFA7 /* ASLayerBackingTipProvider.h in Headers */, - 26491DA316A1B202673E03EC5BD0C5A9 /* ASLayout.h in Headers */, - 57A7B6FF1FDC99819EC2CF63B48CE55D /* ASLayout+IGListDiffKit.h in Headers */, - D84CE019F865736E975597CE2F70DC2E /* ASLayoutController.h in Headers */, - A3ED713567B7681A31A01054E5DE473D /* ASLayoutElement.h in Headers */, - 5ECF8533A2198F1B0844789FFB3F78A1 /* ASLayoutElementExtensibility.h in Headers */, - C4859A7373223CDF469DE5AC3963720C /* ASLayoutElementPrivate.h in Headers */, - D62DAA17D8259ACF8955ACCB83AAAE5B /* ASLayoutElementStylePrivate.h in Headers */, - 4C873AEF892AD7E5899D1EAB600153C1 /* ASLayoutManager.h in Headers */, - E98BF98F1AF165D8BFD982942B3BAAE5 /* ASLayoutRangeType.h in Headers */, - A4BF35DA86E1252EDF11B091026CA6DD /* ASLayoutSpec.h in Headers */, - F27317ECB1C23078AE3A7A802F020819 /* ASLayoutSpec+Subclasses.h in Headers */, - A733272A56850D38635CFB88A87CFD9F /* ASLayoutSpecPrivate.h in Headers */, - 0014843AC7E3985DA8ECAE4FDFE3C127 /* ASLayoutSpecUtilities.h in Headers */, - C24D1C24DFA308B01F2488C7152C20DD /* ASLayoutTransition.h in Headers */, - 494178AF88FF25C80B97DFE9E8D6788B /* ASLocking.h in Headers */, - 8BCA752CBAF9A2406699121544EF220F /* ASLog.h in Headers */, - E7D0F963C59A22F73248464F172A170A /* ASMainSerialQueue.h in Headers */, - 6B2AC611FA344BCC9DF26C6B8AF214F2 /* ASMainThreadDeallocation.h in Headers */, - 56B54254BA7E9CFE40DEFD206019E289 /* ASMapNode.h in Headers */, - B235B8CD8E044F70BBEE882E24A27BA2 /* ASMultiplexImageNode.h in Headers */, - 4453A05D3292C1217DA759E119A19608 /* ASMutableAttributedStringBuilder.h in Headers */, - 17A689609254FAAACA24F5350F4962DB /* ASMutableElementMap.h in Headers */, - 870CDA44782B103CDA29E0A9E0263B4B /* ASNetworkImageLoadInfo.h in Headers */, - 6887845662C4DEC8009B8A6745CB27FF /* ASNetworkImageLoadInfo+Private.h in Headers */, - BE9C6136BD8CB2FB59220D56EAD02A5F /* ASNetworkImageNode.h in Headers */, - 9D2F676FBEBA7ADB5E3EF9916195F5B7 /* ASNodeController+Beta.h in Headers */, - E1CF6EDDF990EDB044D6543102B4E7C7 /* ASObjectDescriptionHelpers.h in Headers */, - 1FEB04E0C70CDADAB2B3D04D9D233235 /* ASOverlayLayoutSpec.h in Headers */, - 0BB3DF7F0E06C74BA5FC99E26F5781D5 /* ASPagerFlowLayout.h in Headers */, - B31048E93CA764C684D4EDB0A2198BAC /* ASPagerNode.h in Headers */, - C2B5575E0E6CA4C0519DBEBEA8F6E717 /* ASPagerNode+Beta.h in Headers */, - 410BF96FBCD0D957DD41B34008C73247 /* ASPageTable.h in Headers */, - 8B1F4B0E49CAEB02A6A24CB36EDD11F6 /* ASPendingStateController.h in Headers */, - 8C29167F780848C24920974CA0941E9D /* ASPhotosFrameworkImageRequest.h in Headers */, - 85568C683FA164E6145931C05BCE1E63 /* ASPINRemoteImageDownloader.h in Headers */, - 34FB17C9B04F7A2A366360A26BFB9E46 /* ASRangeController.h in Headers */, - B9FD3A97BED996A95425219B486EFB8E /* ASRangeControllerUpdateRangeProtocol+Beta.h in Headers */, - 6A96DBB57F234BAE22D0901E3653F317 /* ASRangeManagingNode.h in Headers */, - 5FE16C7CC896ACF76BBCF97080C6FE99 /* ASRatioLayoutSpec.h in Headers */, - 83AA1BBD171373B001CE53C7895543DD /* ASRecursiveUnfairLock.h in Headers */, - 336ECD967AFD589ABB99ADAF2E1609BE /* ASRelativeLayoutSpec.h in Headers */, - 900710D85F33D2D0E8E425A8ED8F4084 /* ASResponderChainEnumerator.h in Headers */, - 022C815272DD4143C0B90531CCFB2F90 /* ASRunLoopQueue.h in Headers */, - 35EB6F18A0581FE6AC5EB7BE814D0EC3 /* ASScrollDirection.h in Headers */, - 04DFE2322D051BFE816D9393B1065085 /* ASScrollNode.h in Headers */, - EA02D0638232299C599630D67D56C881 /* ASSection.h in Headers */, - 45F31C777B73ABCDBBE1C80181E2425F /* ASSectionContext.h in Headers */, - 815F4388DD8721AFE267216CD1722C52 /* ASSectionController.h in Headers */, - C826F1DA99739261AD1D5152875ACE88 /* ASSignpost.h in Headers */, - DA7097BCB97C52BA4AB798D5B9AC178B /* ASStackLayoutDefines.h in Headers */, - FBAF8F1CFA96822646C57FCD393D9AA7 /* ASStackLayoutElement.h in Headers */, - A626E598BE18A8711252323FB3CA3E48 /* ASStackLayoutSpec.h in Headers */, - C32F66168DF516D4512BCF6DAE044EB8 /* ASStackLayoutSpecUtilities.h in Headers */, - 37B46407FC145A4F89B77237CD84E506 /* ASStackPositionedLayout.h in Headers */, - AC1B918B3480D98ED20ED4117FB3B861 /* ASStackUnpositionedLayout.h in Headers */, - 379D13D6CDA4425D7AF88658A82F5C9C /* ASSupplementaryNodeSource.h in Headers */, - F07576D3FCE89ACDC01C3E7CD570F7C5 /* ASTabBarController.h in Headers */, - 2FAF8A9C25013162572ABD5AF1D9CB46 /* ASTableLayoutController.h in Headers */, - 67F445409E9EE49C0FC4BF71E15CD623 /* ASTableNode.h in Headers */, - E3549CC0B621E5CE36CE411B7C11700E /* ASTableNode+Beta.h in Headers */, - 2DA6D9432627BC4F4783E85A98946FA8 /* ASTableView.h in Headers */, - B0FF984BC02C96D5C68E49FDAE4BE267 /* ASTableView+Undeprecated.h in Headers */, - C1FF168E31D41F8EC7807790A26610FF /* ASTableViewInternal.h in Headers */, - FFF62918E6E0B04390D58B16695046FF /* ASTableViewProtocols.h in Headers */, - AC6639FF45B6C82B32CB3ABBFF131241 /* ASTextAttribute.h in Headers */, - 8040C8E3F0B97BE513DCCDEA3AFE5EF9 /* ASTextDebugOption.h in Headers */, - 2050E8C117104D143409D9C629864209 /* ASTextInput.h in Headers */, - 2A51500CE214FC46459164535C2D2EE3 /* ASTextKitAttributes.h in Headers */, - 8DCC8A574883B09CDB99B302621DE573 /* ASTextKitComponents.h in Headers */, - 8E77158232AE5E76BB2041A76BC4861B /* ASTextKitContext.h in Headers */, - 7ACEE223B650FEB22EC012E88BEE712C /* ASTextKitCoreTextAdditions.h in Headers */, - 63F6A1FEE80F3F57401CD498BB90F793 /* ASTextKitEntityAttribute.h in Headers */, - EED99CE1FF7377E0C9F8A1CD264929B8 /* ASTextKitFontSizeAdjuster.h in Headers */, - 4A3531D80BA489BA5E5A5874DA7C63C2 /* ASTextKitRenderer.h in Headers */, - 10C3355B14CB833940BBBC2FA701D32E /* ASTextKitRenderer+Positioning.h in Headers */, - AB26BCBA2B7EE2DE6BEE0B957A0A66F8 /* ASTextKitRenderer+TextChecking.h in Headers */, - DB8464432BFD715B3E54BF83FB200113 /* ASTextKitShadower.h in Headers */, - A871039DB72DFA1BEB7C8389D0EDBB92 /* ASTextKitTailTruncater.h in Headers */, - FE53B166B713AC4BAA696CE90D6BF852 /* ASTextKitTruncating.h in Headers */, - 200666742C2F87661389D7E166275114 /* ASTextLayout.h in Headers */, - 77647211A3F949A6B897849A24C4AE45 /* ASTextLine.h in Headers */, - 7780252C5C183D5B51B32254A2681DD6 /* ASTextNode.h in Headers */, - 2C3923EA6EB546B7694EE1CD765AC124 /* ASTextNode+Beta.h in Headers */, - F9381196E6721F227B6CEB1A507B7A9C /* ASTextNode2.h in Headers */, - 3DCB3D40986E000A5D81C97B25A4D2CF /* ASTextNodeCommon.h in Headers */, - EEECD37F7E520A41002C96742CAC8924 /* ASTextNodeTypes.h in Headers */, - B11E09D1D92C68809B20A879628E268B /* ASTextNodeWordKerner.h in Headers */, - 3A451E35850AF1D566121DDE3C9EC57C /* ASTextRunDelegate.h in Headers */, - D60B9224D2E216EA5D4D931EC1DBAE11 /* ASTextUtilities.h in Headers */, - 1FD04E33CE7414D425403DFD95CAA16F /* ASThread.h in Headers */, - 3BB1A5BD2659C364B9D42758F19C5F54 /* ASTip.h in Headers */, - E060F2BF057FC11A9DA623F3A7672E2D /* ASTipNode.h in Headers */, - 05BA21B4C09B5837CE756BA99FA86E69 /* ASTipProvider.h in Headers */, - C9C8CBD69EF3ACE42D411F6B9843E740 /* ASTipsController.h in Headers */, - 9F435C3DB166750531C94A86D5093BE8 /* ASTipsWindow.h in Headers */, - 9449784C9363892167DF1451E110DAD3 /* ASTraitCollection.h in Headers */, - 712511C3C02BE4DEF1C0BE1885C7B1D8 /* ASTwoDimensionalArrayUtils.h in Headers */, - B3A4C55106443AC5AFA31DB111D773DC /* ASVideoNode.h in Headers */, - 96E4A9710A48427E39969E053602903B /* ASVideoPlayerNode.h in Headers */, - 1F6426A21426373D76CE7D35AFCB64A8 /* ASVisibilityProtocols.h in Headers */, - 2F8CDDC6D5E10B47806A9049EB13F359 /* ASWeakMap.h in Headers */, - 09D280114A91ABE91D0AB79E67897CD1 /* ASWeakProxy.h in Headers */, - AF5238F352E06EA036054700A200F684 /* ASWeakSet.h in Headers */, - AC7843FC93D2886CDADCAEBD5373C694 /* AsyncDisplayKit.h in Headers */, - 0C63FFE943421EC6B4CA4B9390E24FD4 /* AsyncDisplayKit+Debug.h in Headers */, - F3592E9092F025DEB18BC8C0CBA00087 /* AsyncDisplayKit+IGListKitMethods.h in Headers */, - 48C5D35046BA0018BB3669C223DE1396 /* AsyncDisplayKit+Tips.h in Headers */, - 067FED52D0F9F73A07581458118667F2 /* ASYogaUtilities.h in Headers */, - 22757D179A0FC91345F4BE12AE95551D /* CoreGraphics+ASConvenience.h in Headers */, - 899B49673E2F1A53979C7A5DAD753057 /* IGListAdapter+AsyncDisplayKit.h in Headers */, - 8DB8ECA06803338D9189B0ADE0A56B3C /* NSArray+Diffing.h in Headers */, - B6F512E7659E8D2380CD7DB7AAEAA0AF /* NSAttributedString+ASText.h in Headers */, - 81DD61DE882A55A05ACDD730515A74F4 /* NSIndexSet+ASHelpers.h in Headers */, - EEFC416107BE906C985D42870B73A599 /* NSMutableAttributedString+TextKitAdditions.h in Headers */, - F4A4E40C3B31DAAF8019DA0062ECCFBF /* NSParagraphStyle+ASText.h in Headers */, - C34069831F109F63B95786E80A2ABEF5 /* Texture-umbrella.h in Headers */, - 52B265FB546CD7043F0A27A109845282 /* UICollectionViewLayout+ASConvenience.h in Headers */, - 7B8AC92FFE9F62CA3E123A6DFF7207D3 /* UIImage+ASConvenience.h in Headers */, - 448401ADF182384C57B402FD81108E0A /* UIResponder+AsyncDisplayKit.h in Headers */, - B2A2A1F87CFACCF53D2773F04FE4F020 /* UIView+ASConvenience.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6BB4C48F9D2B2324E4964270091B7445 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D767CEF251D577756B2E26ADA5E6F2E /* PINCache.h in Headers */, - CFE2EABD409551C55B8DD6F16B14AA7D /* PINCache-umbrella.h in Headers */, - 03596E31265B0BD67663A468EC4DC960 /* PINCacheMacros.h in Headers */, - 38FCCB7A11298ACC61908968CFEE73F0 /* PINCacheObjectSubscripting.h in Headers */, - A058E2193E83663AE154E4D8099BBE8C /* PINCaching.h in Headers */, - 48090993817DDAFE78F8AE9AA9F1E93B /* PINDiskCache.h in Headers */, - 2757C80335983AFB56046AAD2DFAA6D3 /* PINMemoryCache.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F10EA842B4EF281AF0144F6F457CF5E8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 2AE8F85900058E8D6C665C032FAC616F /* PINOperation.h in Headers */, - 2708562E31F325E354724490B0992384 /* PINOperation-umbrella.h in Headers */, - D71A0DB1A6DADD1248F49AD42C11BEEB /* PINOperationGroup.h in Headers */, - 129EA387250D977AEDA0664D4D6F5BFB /* PINOperationMacros.h in Headers */, - A578183B8067A79D9C81BC2031F539B0 /* PINOperationQueue.h in Headers */, - D40AA499C6B65BB9FA230E90BFD688CF /* PINOperationTypes.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 57310B016450E63387C9D64F4933E995 /* PINOperation */ = { - isa = PBXNativeTarget; - buildConfigurationList = CD41CAEBDDE6389E5AB1FA636489A72A /* Build configuration list for PBXNativeTarget "PINOperation" */; - buildPhases = ( - F10EA842B4EF281AF0144F6F457CF5E8 /* Headers */, - 53243C8F84BC21BEC79226736DB7F30B /* Sources */, - C2D20B91A26EC160D557C119C3D598F8 /* Frameworks */, - 0DA7D1DFF82C834C47B26223E77467C8 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PINOperation; - productName = PINOperation; - productReference = 22C347595B1851A1E5B0A3762BB18EC9 /* PINOperation */; - productType = "com.apple.product-type.framework"; - }; - A927C3CD51C30012080D6CA07959B246 /* PINCache */ = { - isa = PBXNativeTarget; - buildConfigurationList = 551CDE90C654945689477AD1FD37759B /* Build configuration list for PBXNativeTarget "PINCache" */; - buildPhases = ( - 6BB4C48F9D2B2324E4964270091B7445 /* Headers */, - 3178A0B3807C3AA0C374F2E098CCB895 /* Sources */, - ABF9C7363A70B42F45C54EA3811D6299 /* Frameworks */, - C937E361C78FE28A2A8C617AD7B1C35E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 95610259DEA4CB3375C7D70CB805118C /* PBXTargetDependency */, - ); - name = PINCache; - productName = PINCache; - productReference = 6320170E5A5A268B11CAE15D4EF6A9E3 /* PINCache */; - productType = "com.apple.product-type.framework"; - }; - DB66E43BC980D741F3C7C5CF3ACEEFA4 /* Texture */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3156553CCC2E49BFFA1A857C1959E526 /* Build configuration list for PBXNativeTarget "Texture" */; - buildPhases = ( - 673976BF5A6B856289F6D7375897B086 /* Headers */, - 68CD3A808FF46D4A6278F842195907BF /* Sources */, - FFED23876596969F72969E80BEC2E2DF /* Frameworks */, - 63E917817D3C0301EAEF9F9B2D609583 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F569926E50BEC301094B67D7E9110BD8 /* PBXTargetDependency */, - ); - name = Texture; - productName = AsyncDisplayKit; - productReference = F46831F4FCE3AB140F12577CE0C2AAB3 /* Texture */; - productType = "com.apple.product-type.framework"; - }; - E2A8B2A28D2EAB2E4CCF3B69E6792851 /* PINRemoteImage */ = { - isa = PBXNativeTarget; - buildConfigurationList = AE1AE58B237FE442E89D8979366EF6EF /* Build configuration list for PBXNativeTarget "PINRemoteImage" */; - buildPhases = ( - 47155CF8AE150135F6F39FCB3DCA18CA /* Headers */, - 689435FBA7BA8F2D4CD76F1A03668724 /* Sources */, - 1A38949BF4B503096C6F3EE1849A151C /* Frameworks */, - 97D38E94263EA6C14FBC24954E3FBE44 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DB364F68DCB844DC940FC74B0854C975 /* PBXTargetDependency */, - DD3678A384BA801AE18B219DD8A3AC69 /* PBXTargetDependency */, - ); - name = PINRemoteImage; - productName = PINRemoteImage; - productReference = 115A4FCB2A03922EC10B633F15359653 /* PINRemoteImage */; - productType = "com.apple.product-type.framework"; - }; - EEBB4F1AD367D5D2D158D4A00B396823 /* Pods-QuranEngineApp */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3719BE920EBA1849AE3E372162076E74 /* Build configuration list for PBXNativeTarget "Pods-QuranEngineApp" */; - buildPhases = ( - 4EE408C9977B8EDFC754EAB14E9FCEAE /* Headers */, - 06A17EF00B138DFD87B43FE2F50E284D /* Sources */, - 39DC470CF95DAC0AEA2704A9A049F371 /* Frameworks */, - E8CF456CA94464D1BD7EBB9BAEF558ED /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DBCFA05D4B4879174329D4A7D46B4B7A /* PBXTargetDependency */, - 121B8901B8E5E717BBC30A14F1756EC9 /* PBXTargetDependency */, - EBE850AB1EA9FA9608BAEB5C87ABA5BF /* PBXTargetDependency */, - 3A7138293463C134F43AF00721E97C67 /* PBXTargetDependency */, - ); - name = "Pods-QuranEngineApp"; - productName = Pods_QuranEngineApp; - productReference = 9E58BB59C555149FC5454F49E4376996 /* Pods-QuranEngineApp */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - BFDFE7DC352907FC980B868725387E98 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1300; - LastUpgradeCheck = 1300; - }; - buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - Base, - en, - ); - mainGroup = CF1408CF629C7361332E53B88F7BD30C; - productRefGroup = 009DF648D2F57CDF9D0B11036729F25E /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - A927C3CD51C30012080D6CA07959B246 /* PINCache */, - 57310B016450E63387C9D64F4933E995 /* PINOperation */, - E2A8B2A28D2EAB2E4CCF3B69E6792851 /* PINRemoteImage */, - EEBB4F1AD367D5D2D158D4A00B396823 /* Pods-QuranEngineApp */, - DB66E43BC980D741F3C7C5CF3ACEEFA4 /* Texture */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 0DA7D1DFF82C834C47B26223E77467C8 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 63E917817D3C0301EAEF9F9B2D609583 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 97D38E94263EA6C14FBC24954E3FBE44 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C937E361C78FE28A2A8C617AD7B1C35E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E8CF456CA94464D1BD7EBB9BAEF558ED /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 06A17EF00B138DFD87B43FE2F50E284D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E8AAF30FAD524BC3C46579F8B7600424 /* Pods-QuranEngineApp-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3178A0B3807C3AA0C374F2E098CCB895 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EFB5D23B32606111DC9A151866BB8EAA /* PINCache.m in Sources */, - 5DA45BE6BA966BB836870370A5DE5A46 /* PINCache-dummy.m in Sources */, - F31C9170DC7ACFD117683ED212694363 /* PINDiskCache.m in Sources */, - FA4A7F21BB2F93953F66B35CEBA3FF14 /* PINMemoryCache.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 53243C8F84BC21BEC79226736DB7F30B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AC8EDD0737474E0F6C4782C1164E1EAE /* PINOperation-dummy.m in Sources */, - 49DE8C38BE482FB041B09C9C154A3C33 /* PINOperationGroup.m in Sources */, - D448E6A90BD279B7798EF64BFF80A3A2 /* PINOperationQueue.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 689435FBA7BA8F2D4CD76F1A03668724 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - B83B925F9EF0540482F3518F9BAC28F9 /* NSData+ImageDetectors.m in Sources */, - 5203B181780B2916D8A119B366CCDD0F /* NSHTTPURLResponse+MaxAge.m in Sources */, - 1BF8C950BFAD0105558F4B4804898B13 /* PINAlternateRepresentationProvider.m in Sources */, - 9A2AAC0E6F15D2FA5196E93B48F3D6B5 /* PINAnimatedImage.m in Sources */, - 0E51F8D52D9740D767C4396FA97002B6 /* PINAnimatedImageView.m in Sources */, - D44CBE287F09591E60AA277BF3290088 /* PINAnimatedImageView+PINRemoteImage.m in Sources */, - 8DFFD05261AB9D9C9F98D0CC710871D0 /* PINButton+PINRemoteImage.m in Sources */, - 305FC2FC6EF268A3873D5B163E535812 /* PINCache+PINRemoteImageCaching.m in Sources */, - E9795B0210AB46391DEE56163688871D /* PINCachedAnimatedImage.m in Sources */, - CEC50FE5AE2A049F5DA45348937CAF4E /* PINDisplayLink.m in Sources */, - 98FF43535D57223C5AD89BDE3AF3A164 /* PINGIFAnimatedImage.m in Sources */, - ABB87AA1BB30B36A0C3F5F8416013437 /* PINImage+DecodedImage.m in Sources */, - F561F494B5C51276E96B4423BE448605 /* PINImage+ScaledImage.m in Sources */, - 49CF6C61824A0C4A54F0914EF7CF94C7 /* PINImage+WebP.m in Sources */, - 1B0915994232EBC1F0211C9B2328E812 /* PINImageView+PINRemoteImage.m in Sources */, - 2EE0A372ABB0C0F4B55845A7E8CCBDDC /* PINProgressiveImage.m in Sources */, - 97569722D2B87260D45847D3D33447EB /* PINRemoteImage-dummy.m in Sources */, - 3F502C25B3288372106379339143B1E4 /* PINRemoteImageBasicCache.m in Sources */, - 0984F9D71EBB47018708630E7790DBBC /* PINRemoteImageCallbacks.m in Sources */, - E69AC2587551B4E1501B2F63537E1077 /* PINRemoteImageCategoryManager.m in Sources */, - C33BDEBA3BE262BF66551A494C8277FE /* PINRemoteImageDownloadQueue.m in Sources */, - 4897A039926DAB1D33EBACE2AE1DF9FB /* PINRemoteImageDownloadTask.m in Sources */, - B61ACAE4410689955A2D9A454CF947A0 /* PINRemoteImageManager.m in Sources */, - 073F6DAE0FF4B297DCCFEA1FE6815F2C /* PINRemoteImageManagerConfiguration.m in Sources */, - 4D1986D07CAFCA3727F5EB275EF99C7F /* PINRemoteImageManagerResult.m in Sources */, - F6843E805E495E80C92C9211A77E8732 /* PINRemoteImageMemoryContainer.m in Sources */, - 619B54F1CCC0816A62CE8F795546A68C /* PINRemoteImageProcessorTask.m in Sources */, - 58017441EEF699930A62EDA6164B031B /* PINRemoteImageTask.m in Sources */, - 1B7A0875FFEA00A06C6C12E6B670A061 /* PINRemoteLock.m in Sources */, - 0B749BA401C93FCC9A512230E4D83588 /* PINRemoteWeakProxy.m in Sources */, - 055A8C8E7C182E1B657AFA5719AA369A /* PINRequestRetryStrategy.m in Sources */, - D6DE2E166A1E984F470A50D36ACD29D5 /* PINResume.m in Sources */, - 54A705C02111891D4538BF0C9C112BDB /* PINSpeedRecorder.m in Sources */, - F31EE734BB964AA97F5A677ACB4B3D72 /* PINURLSessionManager.m in Sources */, - 4366515756053D4491DE95EC4F754833 /* PINWebPAnimatedImage.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 68CD3A808FF46D4A6278F842195907BF /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6A817D9278D063B55D0967762B2CF2B0 /* _ASAsyncTransaction.mm in Sources */, - 3FE76E344934971A2F6CA65FF2534829 /* _ASAsyncTransactionContainer.mm in Sources */, - 143AA12848BCF837C22930E646F08BC2 /* _ASAsyncTransactionGroup.mm in Sources */, - 640D13F47A7675ACDDBD92F5AECBE301 /* _ASCollectionGalleryLayoutInfo.mm in Sources */, - B53F7D76E80F1DC85E8C54179B2EFE72 /* _ASCollectionGalleryLayoutItem.mm in Sources */, - B18D99569D49850D42CDC9FB96C9819F /* _ASCollectionReusableView.mm in Sources */, - 503788C0776007A939778870A5C4827A /* _ASCollectionViewCell.mm in Sources */, - 15B155C96E460AFC8F9983D2DC755B19 /* _ASCoreAnimationExtras.mm in Sources */, - D307A2C86A507FE30D4C56DF6AE18B20 /* _ASDisplayLayer.mm in Sources */, - D04EAC57D7BE6540E960C1EAE948423A /* _ASDisplayView.mm in Sources */, - A378EE7BB406EF0F62D0CC3F3FBFE4F1 /* _ASDisplayViewAccessiblity.mm in Sources */, - F5693738A170350414BAE23C37102A12 /* _ASHierarchyChangeSet.mm in Sources */, - F8C79940DBAE9186CB61B6D83D20EA1E /* _ASPendingState.mm in Sources */, - 8459EA80A572F6D488C9262E2C408FD4 /* _ASTransitionContext.mm in Sources */, - A30C193CD62905ADF6FFE8790AF6C3B1 /* ASAbsoluteLayoutSpec.mm in Sources */, - 310B79A294E275234A745F832E2ADA1C /* ASAbstractLayoutController.mm in Sources */, - C2E6EAABDABDA8E64152ED7B37FDCFB0 /* ASAsciiArtBoxCreator.mm in Sources */, - C34D92040ED61872006D607E0F84BDF9 /* ASAssert.mm in Sources */, - 7DCD43AD5867E91FBC8F2523C53CF122 /* ASBackgroundLayoutSpec.mm in Sources */, - E7C00E2D3ABFD3900D0B356032999366 /* ASBasicImageDownloader.mm in Sources */, - 694E98B3A84974A4718392BDE673457C /* ASBatchContext.mm in Sources */, - 1E2BC3AF9294242EBEFC14AEBFCAA1F3 /* ASBatchFetching.mm in Sources */, - F29A467A3E3E6AF766C8FD41671CA68D /* ASButtonNode.mm in Sources */, - 1D69F0B779E7324AB82C46D96C8D1537 /* ASButtonNode+Yoga.mm in Sources */, - 3ACBA510D18E183E97F33ED3C04CE329 /* ASCellNode.mm in Sources */, - B77B1A328E66A47CEB371F6ED7009921 /* ASCenterLayoutSpec.mm in Sources */, - F10E61A45452411F5C361031058432B6 /* ASCollectionElement.mm in Sources */, - 0BAEDE696084F83BE6B1BBEBEA5FB7C0 /* ASCollectionFlowLayoutDelegate.mm in Sources */, - EB9D04C0CCB099487204F2FE53E92A8C /* ASCollectionGalleryLayoutDelegate.mm in Sources */, - 5BBC7CD3E30972B311E43A623ABA5338 /* ASCollectionLayout.mm in Sources */, - 5423021536AE2E8F5A8AB6D3F3C5ACAC /* ASCollectionLayoutCache.mm in Sources */, - D6094B773441E6CE8ECE3C83088F4313 /* ASCollectionLayoutContext.mm in Sources */, - 725B70B6B1C0703295B335E75DD9A2EC /* ASCollectionLayoutDefines.mm in Sources */, - 2353ADFCCC130FF5449A380EFBC025CD /* ASCollectionLayoutState.mm in Sources */, - BC08B770693C2C472CDD4816C2794F6F /* ASCollectionNode.mm in Sources */, - 44706A185FFAAC34A68D0517785EF515 /* ASCollections.mm in Sources */, - 42FB573DA5B5B6B8994246AD37161864 /* ASCollectionView.mm in Sources */, - DAD62FF1977C610AE98B85F18C303582 /* ASCollectionViewFlowLayoutInspector.mm in Sources */, - 232BF71F53BFBB27B61D054C75253D7A /* ASCollectionViewLayoutController.mm in Sources */, - 43FE1063A859162DFA9AC2906B044CA3 /* ASCollectionViewLayoutInspector.mm in Sources */, - 5BACFB09090617C1EC2850E60424347A /* ASConfiguration.mm in Sources */, - A0C8B4C53003A17916B959A6E1C238A2 /* ASConfigurationInternal.mm in Sources */, - EAAF18F6D01A57B4F38A89AF20DD8121 /* ASControlNode.mm in Sources */, - 61249AE105A2DD348B4AEC9A77933AE6 /* ASControlNode+tvOS.mm in Sources */, - 6DCC4CE0C5D92838A277ADC672F4390E /* ASControlTargetAction.mm in Sources */, - 03ED27F0ED8958D2BF825D85D4CB8095 /* ASCornerLayoutSpec.mm in Sources */, - B79923F21DF85E4A00C39BA40B78CF18 /* ASDataController.mm in Sources */, - 5B7C64C3F6D34D23C4902EB2260F7E22 /* ASDefaultPlaybackButton.mm in Sources */, - 5962C73914D2B5ACC4AD03D26B87E507 /* ASDefaultPlayButton.mm in Sources */, - 4594B00991232E1F640B65B5D8E7ACAF /* ASDelegateProxy.mm in Sources */, - C3B39791D22B051C151BF5805BD28EC6 /* ASDimension.mm in Sources */, - 917898C105D22B951ECC1F7A84C4C2E1 /* ASDimensionInternal.mm in Sources */, - 49459B0233DCA49CE68D56E0295F8129 /* ASDispatch.mm in Sources */, - 0183C04F357F7F265B176AFEF79A1DD7 /* ASDisplayNode.mm in Sources */, - F003003FDDCB41315690148BA38233BC /* ASDisplayNode+Ancestry.mm in Sources */, - 78FFEC04843BC1B6F612B9A052151052 /* ASDisplayNode+AsyncDisplay.mm in Sources */, - 59D7A46CD1F9D4EAF09641131AEA39B5 /* ASDisplayNode+Convenience.mm in Sources */, - 4645649AAC3567A4BEF13968AD70A445 /* ASDisplayNode+DebugTiming.mm in Sources */, - C3A0D403E6E915C25A370E30075E193D /* ASDisplayNode+Layout.mm in Sources */, - 3AA4306F65C828C27F4AEDBF56EA74A8 /* ASDisplayNode+LayoutSpec.mm in Sources */, - 57FB54AD00A60B36AD5C95B4C25378B4 /* ASDisplayNode+UIViewBridge.mm in Sources */, - E9B2D48A761DDCA74EDC1566F24F8076 /* ASDisplayNode+Yoga.mm in Sources */, - B63D049EE73655B4BEFF4F791A6BF8C1 /* ASDisplayNodeCornerLayerDelegate.mm in Sources */, - BE22F30BB7CE5810F6FC9C98201A4E50 /* ASDisplayNodeExtras.mm in Sources */, - 5A0A3A31D8CA0381B383ABA8515B47EF /* ASDisplayNodeTipState.mm in Sources */, - CE5EEE5536CDA987508DB2507B71B7CC /* ASDKNavigationController.mm in Sources */, - F9BDE1D515C10B944AB7981FE5623A16 /* ASDKViewController.mm in Sources */, - B20F6134C47D51F46DBDF1976FB8277E /* ASEditableTextNode.mm in Sources */, - 517BED845B5FE0C1578ACE863FA6DC3A /* ASElementMap.mm in Sources */, - 62CAF25406ABD0035880FBBDBB42FE14 /* ASExperimentalFeatures.mm in Sources */, - DBA37FC33A41853DCFD72B16AAFE06B2 /* ASGraphicsContext.mm in Sources */, - C1193F51D0E6ADBEBC8E46FFAB06658E /* ASHashing.mm in Sources */, - 6FDA6368A35DA4353DF0DCD402CF0A58 /* ASHighlightOverlayLayer.mm in Sources */, - B2E4B4B63A664B211988CB88B362AB94 /* ASIGListAdapterBasedDataSource.mm in Sources */, - C32D9A6744D0BEA03E243464084BB9FB /* ASImageContainerProtocolCategories.mm in Sources */, - E07B0F3D3BD004165C05F2A4B040C35C /* ASImageNode.mm in Sources */, - 376EE8977BD7AA21AC0749A6BAB86A03 /* ASImageNode+AnimatedImage.mm in Sources */, - 30CC114897A879B1BC44FFF8279EF636 /* ASImageNode+CGExtras.mm in Sources */, - B65665196485392E6A7F6F30675EF150 /* ASImageNode+tvOS.mm in Sources */, - D256C2724BB100190B995A5909146850 /* ASInsetLayoutSpec.mm in Sources */, - 7A38BD9EE4AAC3A8DCAB216875FFC33F /* ASIntegerMap.mm in Sources */, - 60D932BDEE130F5089E086106CF8343E /* ASInternalHelpers.mm in Sources */, - 3225ABCDAAF00205452576CAEB706993 /* ASLayerBackingTipProvider.mm in Sources */, - 4285FD8482B20CF2600202B10A1D4A62 /* ASLayout.mm in Sources */, - C9C8883EDF3E5D8E6381477B89B6382B /* ASLayout+IGListDiffKit.mm in Sources */, - 13B3FE7D46AD7CC11B7FB391AFEF7B65 /* ASLayoutElement.mm in Sources */, - E032626252DBC96E3F6C291B166BF9E7 /* ASLayoutManager.mm in Sources */, - C111E3851EB7DFC7FBDDD0E112818630 /* ASLayoutSpec.mm in Sources */, - 43F2FE95830B896F6AA572C016545FB7 /* ASLayoutSpec+Subclasses.mm in Sources */, - F29D1FF78B0BB8F822F50E119A173642 /* ASLayoutTransition.mm in Sources */, - 3548C035DDD95264F898907A666D2D8E /* ASLog.mm in Sources */, - 4829A857045A0F970C4565048C9093F4 /* ASMainSerialQueue.mm in Sources */, - A09B3A7234F9DE1F4D3FE3BE0C1C4F40 /* ASMainThreadDeallocation.mm in Sources */, - 8BF5DE28605FB25B1770327FBA085466 /* ASMapNode.mm in Sources */, - D82054D345ADCC514231A87E42635A5E /* ASMultiplexImageNode.mm in Sources */, - D754F73221A18552F9A4BDC7DDC66B6C /* ASMutableAttributedStringBuilder.mm in Sources */, - 3A5AD9AF1060F98191DF336EC4D59DFF /* ASMutableElementMap.mm in Sources */, - 2FD9D1D74E48B80E64B860F77F721DF3 /* ASNetworkImageLoadInfo.mm in Sources */, - 8C2C7365E2D7E2FD4DE5B26CE9784389 /* ASNetworkImageNode.mm in Sources */, - 7F6FA8AE1DEB3D8A4CEF508EC45ADEBD /* ASNodeController+Beta.mm in Sources */, - CA657E7649834C65EAD30D1294612DEC /* ASObjectDescriptionHelpers.mm in Sources */, - D552E784F637B1A1D2CCF7BE323FA74B /* ASOverlayLayoutSpec.mm in Sources */, - 8EB09A67D439738D0B9A09A84CED052E /* ASPagerFlowLayout.mm in Sources */, - 9366DB3A51F479935993EC390C119CE1 /* ASPagerNode.mm in Sources */, - 7129D301FF3CB0450EB23A82AD91DD33 /* ASPageTable.mm in Sources */, - ECBF8FF8DB66E246CA11FD908B2C19F2 /* ASPendingStateController.mm in Sources */, - F11E2820E58035A651FA87B03752167C /* ASPhotosFrameworkImageRequest.mm in Sources */, - A5C0C6A881B94BB6C0C53C5A999ADE14 /* ASPINRemoteImageDownloader.mm in Sources */, - CB9622514E039BA270EF647705469471 /* ASRangeController.mm in Sources */, - 39CE826B80050AE373EEE39088C717AA /* ASRatioLayoutSpec.mm in Sources */, - 112ECFC5978DE0D86CD887CDEF945A50 /* ASRecursiveUnfairLock.mm in Sources */, - FDE332E188A06EF83F39B0277106C4FB /* ASRelativeLayoutSpec.mm in Sources */, - EB1E7A396960EEAB9EB30DB17685B19C /* ASResponderChainEnumerator.mm in Sources */, - 7E0392769206C8F0A61B778AF3BB2355 /* ASRunLoopQueue.mm in Sources */, - CDC3C40C0AFB4434E83C91EAD23BB2C9 /* ASScrollDirection.mm in Sources */, - E75852AAEC8EDC07F2AC2669DE434074 /* ASScrollNode.mm in Sources */, - 3D10B00B2E6420E9B30563ADA261C7A4 /* ASSection.mm in Sources */, - 7EE1914288E0F4FCA402F76993A147CF /* ASStackLayoutSpec.mm in Sources */, - A8617D66E859E2B92ADE411D46DF33EA /* ASStackPositionedLayout.mm in Sources */, - 92E136803004CBC8E955955C5909756E /* ASStackUnpositionedLayout.mm in Sources */, - F5DBFC4793E3685BAED26AA4E5701F6C /* ASTabBarController.mm in Sources */, - 13BC0DDB5F98E74836848B220143A2E6 /* ASTableLayoutController.mm in Sources */, - 949F87119151FBF62C45AE770073106B /* ASTableNode.mm in Sources */, - FA713FEE1840C794CA1DFB89E9820F99 /* ASTableView.mm in Sources */, - 91334370E024433FE87890E064C60376 /* ASTextAttribute.mm in Sources */, - 49F6DD0EF3FBADA4AC23EB2AF0CA1A92 /* ASTextDebugOption.mm in Sources */, - 9EDFB28C07911C3364A5A19C45C45274 /* ASTextInput.mm in Sources */, - B45746D8589CAD7BB170F4EA58941C0F /* ASTextKitAttributes.mm in Sources */, - B763F51374A9455C0A87931065B198D4 /* ASTextKitComponents.mm in Sources */, - 8BCF3E2F0B3B8967169BA828B84391F9 /* ASTextKitContext.mm in Sources */, - B926A6A544EEE4BFCBAFD1FB1A5685D4 /* ASTextKitCoreTextAdditions.mm in Sources */, - 2B89FE1841E770F9E9D80255B8570C7D /* ASTextKitEntityAttribute.mm in Sources */, - D9CF42E418A7978B906A9FA3BB2BF40F /* ASTextKitFontSizeAdjuster.mm in Sources */, - 091F20AE918F799224E0788185B91BC5 /* ASTextKitRenderer.mm in Sources */, - 17A1B36B15B4C21C6CE11A6631BE6606 /* ASTextKitRenderer+Positioning.mm in Sources */, - 8D82A2DD69C91231AD68FAFFEB979F34 /* ASTextKitRenderer+TextChecking.mm in Sources */, - 0AC4F9E2A2CD9B6505D4B72DED36FD44 /* ASTextKitShadower.mm in Sources */, - C9BEEA1607960BC18D0002A5851FA827 /* ASTextKitTailTruncater.mm in Sources */, - 745645073EC6090F6243660F88904B86 /* ASTextLayout.mm in Sources */, - 91956B7066244CBAB5ED5308508B7499 /* ASTextLine.mm in Sources */, - 0C086EA76A8368627F1E994E995040C7 /* ASTextNode.mm in Sources */, - EC71B8DC723A2C067AD54DA0F9862B3A /* ASTextNode2.mm in Sources */, - 527EEDE5BEBF380277ADA24BBC62CC17 /* ASTextNodeWordKerner.mm in Sources */, - 5BEEAF52CBC1F73391BB2A26324EFDEE /* ASTextRunDelegate.mm in Sources */, - 5162B1D1DB3D56E32F68E1FD54E0D204 /* ASTextUtilities.mm in Sources */, - E09828E84EBA149DAAB8E06F4AD2A034 /* ASTip.mm in Sources */, - 4F8017B01700F8D961FD98192BA21733 /* ASTipNode.mm in Sources */, - FE8272C0D8E46E8BF14DB9F132793058 /* ASTipProvider.mm in Sources */, - 9B612730DE921279BC07425CFA183A69 /* ASTipsController.mm in Sources */, - 3EA002181C74D81D26B76D634EDD1927 /* ASTipsWindow.mm in Sources */, - 5C7CA8C03F079342E28B35E1F5926C3C /* ASTraitCollection.mm in Sources */, - E7B4ACA08801E462B7DF6752368C9123 /* ASTwoDimensionalArrayUtils.mm in Sources */, - BAFE939EDA1F0526BE5FC0ADF9908639 /* ASVideoNode.mm in Sources */, - 5EA5BC4D445A9909A13CDCC7DC7E59E8 /* ASVideoPlayerNode.mm in Sources */, - B1CD1C9A5B59E59F9278D0919B43B462 /* ASVisibilityProtocols.mm in Sources */, - FA9FD3B4F0C19F8D230ED785BA4C7C48 /* ASWeakMap.mm in Sources */, - 5CCF06C3D92DC92D31FA5EE6B2598271 /* ASWeakProxy.mm in Sources */, - 17FDC2875E326C4E65AC4D77C85856FD /* ASWeakSet.mm in Sources */, - AA374094233A70E44789B62A3911B180 /* AsyncDisplayKit+Debug.mm in Sources */, - EF53394A8DC67B728363BC4E7383F548 /* AsyncDisplayKit+IGListKitMethods.mm in Sources */, - E898D44AA456F58B458840545A3B7CD1 /* AsyncDisplayKit+Tips.mm in Sources */, - B02023FAD20B390AA8ED1011F5661ED4 /* ASYogaUtilities.mm in Sources */, - 243ED155F0B8165345AB00415235A1C2 /* IGListAdapter+AsyncDisplayKit.mm in Sources */, - FC39095B7B6E321B58F9BFA29B44B28B /* NSArray+Diffing.mm in Sources */, - F57758CA8101A8AC81C7FF144087ADAE /* NSAttributedString+ASText.mm in Sources */, - 20071ECFB0EA1DB3FC4FBAC7D2772E0F /* NSIndexSet+ASHelpers.mm in Sources */, - E6570476F53C68DD321F50E66DC05D29 /* NSMutableAttributedString+TextKitAdditions.mm in Sources */, - EE8206826ADBFFAA2714CE741BA06BD6 /* NSParagraphStyle+ASText.mm in Sources */, - 1D90080D7C805F8537D32B4166FE115E /* Texture-dummy.m in Sources */, - 3DA32C06C69E44358439BB8DC62E1690 /* UICollectionViewLayout+ASConvenience.mm in Sources */, - 230F639E6AA5319BE5D6025EFDDACE3B /* UIImage+ASConvenience.mm in Sources */, - 08D5F121C7501009292220E6FBBB43AC /* UIResponder+AsyncDisplayKit.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 121B8901B8E5E717BBC30A14F1756EC9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINOperation; - target = 57310B016450E63387C9D64F4933E995 /* PINOperation */; - targetProxy = 0F55C107D8303AA7BB48248A569C6B04 /* PBXContainerItemProxy */; - }; - 3A7138293463C134F43AF00721E97C67 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Texture; - target = DB66E43BC980D741F3C7C5CF3ACEEFA4 /* Texture */; - targetProxy = D1E93115AFD16A719980879D082D69D7 /* PBXContainerItemProxy */; - }; - 95610259DEA4CB3375C7D70CB805118C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINOperation; - target = 57310B016450E63387C9D64F4933E995 /* PINOperation */; - targetProxy = 8230CF134F6D89120EB745C2783BC72B /* PBXContainerItemProxy */; - }; - DB364F68DCB844DC940FC74B0854C975 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINCache; - target = A927C3CD51C30012080D6CA07959B246 /* PINCache */; - targetProxy = F16C7DBDC9A12B9DEEBF63B5BABCFAB9 /* PBXContainerItemProxy */; - }; - DBCFA05D4B4879174329D4A7D46B4B7A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINCache; - target = A927C3CD51C30012080D6CA07959B246 /* PINCache */; - targetProxy = EFE03B8434A5F743848E7A4A8152D4D9 /* PBXContainerItemProxy */; - }; - DD3678A384BA801AE18B219DD8A3AC69 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINOperation; - target = 57310B016450E63387C9D64F4933E995 /* PINOperation */; - targetProxy = 11B9C74BD4D0AF9A583F908B53172DBF /* PBXContainerItemProxy */; - }; - EBE850AB1EA9FA9608BAEB5C87ABA5BF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINRemoteImage; - target = E2A8B2A28D2EAB2E4CCF3B69E6792851 /* PINRemoteImage */; - targetProxy = 6C9FCF71DF9E3E4E0B6B5D83C3BBACA0 /* PBXContainerItemProxy */; - }; - F569926E50BEC301094B67D7E9110BD8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = PINRemoteImage; - target = E2A8B2A28D2EAB2E4CCF3B69E6792851 /* PINRemoteImage */; - targetProxy = 40D949C5B43B0931FBDE03CBC3E503E0 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 0359AD9883667ABAE66B0D6E0ECBE22D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 773FC3074F118DBE19C9C2A18699AB84 /* PINRemoteImage.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINRemoteImage/PINRemoteImage.modulemap"; - PRODUCT_MODULE_NAME = PINRemoteImage; - PRODUCT_NAME = PINRemoteImage; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 0AE3A273702148038FE8C1D5E4684CFE /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = ED201A924E0BC9468579E76F2F2FE7AD /* PINOperation.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/PINOperation/PINOperation-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PINOperation/PINOperation-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINOperation/PINOperation.modulemap"; - PRODUCT_MODULE_NAME = PINOperation; - PRODUCT_NAME = PINOperation; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 181242A80AA630546C3C595675DB28AE /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7DBE419CB2F290B559A7011979017C7D /* Texture.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Texture/Texture-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Texture/Texture-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/Texture/Texture.modulemap"; - PRODUCT_MODULE_NAME = AsyncDisplayKit; - PRODUCT_NAME = AsyncDisplayKit; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 242D823A805B2678F72C3DCB440F8AC4 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 49EC90EF95A2BAABAA44D24EA9E6115B /* PINCache.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/PINCache/PINCache-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PINCache/PINCache-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINCache/PINCache.modulemap"; - PRODUCT_MODULE_NAME = PINCache; - PRODUCT_NAME = PINCache; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 3F51FA8DF1F7B83F02FE8CB464E8CC76 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0ECB2E92B3BD6B8EF0C554FFB94D06B1 /* PINCache.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/PINCache/PINCache-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PINCache/PINCache-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINCache/PINCache.modulemap"; - PRODUCT_MODULE_NAME = PINCache; - PRODUCT_NAME = PINCache; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 5B67AB59931AB2DB5DD5E3D6B03D21BC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BE492B86F41B5899AFF47ACDB4126D06 /* Pods-QuranEngineApp.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 6D5B69287F189CB9FE2BB178FB034492 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 14D1789AFF19612903A6DEC3719662F3 /* Texture.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Texture/Texture-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Texture/Texture-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/Texture/Texture.modulemap"; - PRODUCT_MODULE_NAME = AsyncDisplayKit; - PRODUCT_NAME = AsyncDisplayKit; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 7A8AE34B4945C771686C434F7700CDC9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 92D1ABB868F070AF10E82FC0EF2D1E50 /* Pods-QuranEngineApp.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - STRIP_INSTALLED_PRODUCT = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - 9553C89E183877A5CB2F3C6801BEC129 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - STRIP_INSTALLED_PRODUCT = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Release; - }; - F0420371B5BA3DBD3115BC5CDC529EC6 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2C41CB510A0394AE786A47727010CFF4 /* PINOperation.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/PINOperation/PINOperation-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/PINOperation/PINOperation-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINOperation/PINOperation.modulemap"; - PRODUCT_MODULE_NAME = PINOperation; - PRODUCT_NAME = PINOperation; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - F5A383BB970E100B84A0514184975BE2 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BAB31548FC8D5AB50A8EB7217A7712E4 /* PINRemoteImage.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/PINRemoteImage/PINRemoteImage.modulemap"; - PRODUCT_MODULE_NAME = PINRemoteImage; - PRODUCT_NAME = PINRemoteImage; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3156553CCC2E49BFFA1A857C1959E526 /* Build configuration list for PBXNativeTarget "Texture" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6D5B69287F189CB9FE2BB178FB034492 /* Debug */, - 181242A80AA630546C3C595675DB28AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3719BE920EBA1849AE3E372162076E74 /* Build configuration list for PBXNativeTarget "Pods-QuranEngineApp" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5B67AB59931AB2DB5DD5E3D6B03D21BC /* Debug */, - 7A8AE34B4945C771686C434F7700CDC9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */, - 9553C89E183877A5CB2F3C6801BEC129 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 551CDE90C654945689477AD1FD37759B /* Build configuration list for PBXNativeTarget "PINCache" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 242D823A805B2678F72C3DCB440F8AC4 /* Debug */, - 3F51FA8DF1F7B83F02FE8CB464E8CC76 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - AE1AE58B237FE442E89D8979366EF6EF /* Build configuration list for PBXNativeTarget "PINRemoteImage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F5A383BB970E100B84A0514184975BE2 /* Debug */, - 0359AD9883667ABAE66B0D6E0ECBE22D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - CD41CAEBDDE6389E5AB1FA636489A72A /* Build configuration list for PBXNativeTarget "PINOperation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0AE3A273702148038FE8C1D5E4684CFE /* Debug */, - F0420371B5BA3DBD3115BC5CDC529EC6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; -} diff --git a/Example/Pods/Target Support Files/PINCache/PINCache-Info.plist b/Example/Pods/Target Support Files/PINCache/PINCache-Info.plist deleted file mode 100644 index a32f9ac3..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - ${PODS_DEVELOPMENT_LANGUAGE} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 3.0.3 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/PINCache/PINCache-dummy.m b/Example/Pods/Target Support Files/PINCache/PINCache-dummy.m deleted file mode 100644 index 717c2b75..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_PINCache : NSObject -@end -@implementation PodsDummy_PINCache -@end diff --git a/Example/Pods/Target Support Files/PINCache/PINCache-prefix.pch b/Example/Pods/Target Support Files/PINCache/PINCache-prefix.pch deleted file mode 100644 index 2b29dbc8..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache-prefix.pch +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#ifndef TARGET_OS_WATCH - #define TARGET_OS_WATCH 0 -#endif diff --git a/Example/Pods/Target Support Files/PINCache/PINCache-umbrella.h b/Example/Pods/Target Support Files/PINCache/PINCache-umbrella.h deleted file mode 100644 index 8c5b2c03..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache-umbrella.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#import "PINCache.h" -#import "PINCacheMacros.h" -#import "PINCacheObjectSubscripting.h" -#import "PINCaching.h" -#import "PINDiskCache.h" -#import "PINMemoryCache.h" - -FOUNDATION_EXPORT double PINCacheVersionNumber; -FOUNDATION_EXPORT const unsigned char PINCacheVersionString[]; - diff --git a/Example/Pods/Target Support Files/PINCache/PINCache.debug.xcconfig b/Example/Pods/Target Support Files/PINCache/PINCache.debug.xcconfig deleted file mode 100644 index f738bd20..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache.debug.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINCache -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "PINOperation" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINCache -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/PINCache/PINCache.modulemap b/Example/Pods/Target Support Files/PINCache/PINCache.modulemap deleted file mode 100644 index d6699efb..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module PINCache { - umbrella header "PINCache-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/PINCache/PINCache.release.xcconfig b/Example/Pods/Target Support Files/PINCache/PINCache.release.xcconfig deleted file mode 100644 index f738bd20..00000000 --- a/Example/Pods/Target Support Files/PINCache/PINCache.release.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINCache -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "PINOperation" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINCache -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation-Info.plist b/Example/Pods/Target Support Files/PINOperation/PINOperation-Info.plist deleted file mode 100644 index 957b090a..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - ${PODS_DEVELOPMENT_LANGUAGE} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.2.2 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation-dummy.m b/Example/Pods/Target Support Files/PINOperation/PINOperation-dummy.m deleted file mode 100644 index 209943f3..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_PINOperation : NSObject -@end -@implementation PodsDummy_PINOperation -@end diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation-prefix.pch b/Example/Pods/Target Support Files/PINOperation/PINOperation-prefix.pch deleted file mode 100644 index 2b29dbc8..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation-prefix.pch +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#ifndef TARGET_OS_WATCH - #define TARGET_OS_WATCH 0 -#endif diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation-umbrella.h b/Example/Pods/Target Support Files/PINOperation/PINOperation-umbrella.h deleted file mode 100644 index ea9f6aeb..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation-umbrella.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#import "PINOperation.h" -#import "PINOperationGroup.h" -#import "PINOperationMacros.h" -#import "PINOperationQueue.h" -#import "PINOperationTypes.h" - -FOUNDATION_EXPORT double PINOperationVersionNumber; -FOUNDATION_EXPORT const unsigned char PINOperationVersionString[]; - diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation.debug.xcconfig b/Example/Pods/Target Support Files/PINOperation/PINOperation.debug.xcconfig deleted file mode 100644 index 9fdb5c9b..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation.debug.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINOperation -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Foundation" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINOperation -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation.modulemap b/Example/Pods/Target Support Files/PINOperation/PINOperation.modulemap deleted file mode 100644 index 653b58fe..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module PINOperation { - umbrella header "PINOperation-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/PINOperation/PINOperation.release.xcconfig b/Example/Pods/Target Support Files/PINOperation/PINOperation.release.xcconfig deleted file mode 100644 index 9fdb5c9b..00000000 --- a/Example/Pods/Target Support Files/PINOperation/PINOperation.release.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINOperation -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Foundation" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINOperation -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist deleted file mode 100644 index a32f9ac3..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - ${PODS_DEVELOPMENT_LANGUAGE} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 3.0.3 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-dummy.m b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-dummy.m deleted file mode 100644 index d1225222..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_PINRemoteImage : NSObject -@end -@implementation PodsDummy_PINRemoteImage -@end diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-umbrella.h b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-umbrella.h deleted file mode 100644 index 9fd0f73d..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage-umbrella.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#import "NSHTTPURLResponse+MaxAge.h" -#import "PINImage+DecodedImage.h" -#import "PINImage+ScaledImage.h" -#import "PINImage+WebP.h" -#import "PINRemoteImageTask+Subclassing.h" -#import "NSData+ImageDetectors.h" -#import "PINAlternateRepresentationProvider.h" -#import "PINAnimatedImage.h" -#import "PINAnimatedImageView+PINRemoteImage.h" -#import "PINAnimatedImageView.h" -#import "PINButton+PINRemoteImage.h" -#import "PINCachedAnimatedImage.h" -#import "PINGIFAnimatedImage.h" -#import "PINImageView+PINRemoteImage.h" -#import "PINProgressiveImage.h" -#import "PINRemoteImage.h" -#import "PINRemoteImageCaching.h" -#import "PINRemoteImageCategoryManager.h" -#import "PINRemoteImageMacros.h" -#import "PINRemoteImageManager.h" -#import "PINRemoteImageManagerResult.h" -#import "PINRequestRetryStrategy.h" -#import "PINURLSessionManager.h" -#import "PINWebPAnimatedImage.h" -#import "PINDisplayLink.h" -#import "PINRemoteImageBasicCache.h" -#import "PINRemoteImageCallbacks.h" -#import "PINRemoteImageDownloadQueue.h" -#import "PINRemoteImageDownloadTask.h" -#import "PINRemoteImageManager+Private.h" -#import "PINRemoteImageManagerConfiguration.h" -#import "PINRemoteImageMemoryContainer.h" -#import "PINRemoteImageProcessorTask.h" -#import "PINRemoteImageTask.h" -#import "PINRemoteLock.h" -#import "PINRemoteWeakProxy.h" -#import "PINResume.h" -#import "PINSpeedRecorder.h" -#import "PINCache+PINRemoteImageCaching.h" - -FOUNDATION_EXPORT double PINRemoteImageVersionNumber; -FOUNDATION_EXPORT const unsigned char PINRemoteImageVersionString[]; - diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.debug.xcconfig b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.debug.xcconfig deleted file mode 100644 index fc3032bc..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.debug.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "Foundation" -framework "ImageIO" -framework "PINCache" -framework "PINOperation" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINRemoteImage -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.modulemap b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.modulemap deleted file mode 100644 index d37f76b8..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module PINRemoteImage { - umbrella header "PINRemoteImage-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.release.xcconfig b/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.release.xcconfig deleted file mode 100644 index fc3032bc..00000000 --- a/Example/Pods/Target Support Files/PINRemoteImage/PINRemoteImage.release.xcconfig +++ /dev/null @@ -1,14 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "Foundation" -framework "ImageIO" -framework "PINCache" -framework "PINOperation" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/PINRemoteImage -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist deleted file mode 100644 index 19cf209d..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - ${PODS_DEVELOPMENT_LANGUAGE} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.markdown b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.markdown deleted file mode 100644 index 3c53a2ff..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.markdown +++ /dev/null @@ -1,753 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## PINCache - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [2013] [Tumblr, Inc.] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -## PINOperation - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - -## PINRemoteImage - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - -## Texture - -The Texture project was created by Pinterest as a continuation, under a different -name and license, of the AsyncDisplayKit codebase originally developed by Facebook. - -All code in Texture is covered by the Apache License, Version 2.0. - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - -Generated by CocoaPods - https://cocoapods.org diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.plist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.plist deleted file mode 100644 index 4d48ec8d..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-acknowledgements.plist +++ /dev/null @@ -1,803 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [2013] [Tumblr, Inc.] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - License - Apache 2.0 - Title - PINCache - Type - PSGroupSpecifier - - - FooterText - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - License - Apache 2.0 - Title - PINOperation - Type - PSGroupSpecifier - - - FooterText - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - License - Apache 2.0 - Title - PINRemoteImage - Type - PSGroupSpecifier - - - FooterText - The Texture project was created by Pinterest as a continuation, under a different -name and license, of the AsyncDisplayKit codebase originally developed by Facebook. - -All code in Texture is covered by the Apache License, Version 2.0. - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - License - Apache 2 - Title - Texture - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - https://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-dummy.m b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-dummy.m deleted file mode 100644 index 4fae43a7..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_QuranEngineApp : NSObject -@end -@implementation PodsDummy_Pods_QuranEngineApp -@end diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-input-files.xcfilelist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-input-files.xcfilelist deleted file mode 100644 index eb0bb898..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-input-files.xcfilelist +++ /dev/null @@ -1,5 +0,0 @@ -${PODS_ROOT}/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh -${BUILT_PRODUCTS_DIR}/PINCache/PINCache.framework -${BUILT_PRODUCTS_DIR}/PINOperation/PINOperation.framework -${BUILT_PRODUCTS_DIR}/PINRemoteImage/PINRemoteImage.framework -${BUILT_PRODUCTS_DIR}/Texture/AsyncDisplayKit.framework \ No newline at end of file diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-output-files.xcfilelist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-output-files.xcfilelist deleted file mode 100644 index 82515667..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Debug-output-files.xcfilelist +++ /dev/null @@ -1,4 +0,0 @@ -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINCache.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINOperation.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINRemoteImage.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AsyncDisplayKit.framework \ No newline at end of file diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-input-files.xcfilelist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-input-files.xcfilelist deleted file mode 100644 index eb0bb898..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-input-files.xcfilelist +++ /dev/null @@ -1,5 +0,0 @@ -${PODS_ROOT}/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh -${BUILT_PRODUCTS_DIR}/PINCache/PINCache.framework -${BUILT_PRODUCTS_DIR}/PINOperation/PINOperation.framework -${BUILT_PRODUCTS_DIR}/PINRemoteImage/PINRemoteImage.framework -${BUILT_PRODUCTS_DIR}/Texture/AsyncDisplayKit.framework \ No newline at end of file diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-output-files.xcfilelist b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-output-files.xcfilelist deleted file mode 100644 index 82515667..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-Release-output-files.xcfilelist +++ /dev/null @@ -1,4 +0,0 @@ -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINCache.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINOperation.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PINRemoteImage.framework -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AsyncDisplayKit.framework \ No newline at end of file diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh deleted file mode 100755 index ee3321c3..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/sh -set -e -set -u -set -o pipefail - -function on_error { - echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" -} -trap 'on_error $LINENO' ERR - -if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then - # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy - # frameworks to, so exit 0 (signalling the script phase was successful). - exit 0 -fi - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" -BCSYMBOLMAP_DIR="BCSymbolMaps" - - -# This protects against multiple targets copying the same framework dependency at the same time. The solution -# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html -RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") - -# Copies and strips a vendored framework -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink -f "${source}")" - fi - - if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then - # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied - find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do - echo "Installing $f" - install_bcsymbolmap "$f" "$destination" - rm "$f" - done - rmdir "${source}/${BCSYMBOLMAP_DIR}" - fi - - # Use filter instead of exclude so missing patterns don't throw errors. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - elif [ -L "${binary}" ]; then - echo "Destination binary is symlinked..." - dirname="$(dirname "${binary}")" - binary="${dirname}/$(readlink "${binary}")" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} -# Copies and strips a vendored dSYM -install_dsym() { - local source="$1" - warn_missing_arch=${2:-true} - if [ -r "$source" ]; then - # Copy the dSYM into the targets temp dir. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" - - local basename - basename="$(basename -s .dSYM "$source")" - binary_name="$(ls "$source/Contents/Resources/DWARF")" - binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" - - # Strip invalid architectures from the dSYM. - if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then - strip_invalid_archs "$binary" "$warn_missing_arch" - fi - if [[ $STRIP_BINARY_RETVAL == 0 ]]; then - # Move the stripped file into its final destination. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" - else - # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. - mkdir -p "${DWARF_DSYM_FOLDER_PATH}" - touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" - fi - fi -} - -# Used as a return value for each invocation of `strip_invalid_archs` function. -STRIP_BINARY_RETVAL=0 - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - warn_missing_arch=${2:-true} - # Get architectures for current target binary - binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" - # Intersect them with the architectures we are building for - intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" - # If there are no archs supported by this binary then warn the user - if [[ -z "$intersected_archs" ]]; then - if [[ "$warn_missing_arch" == "true" ]]; then - echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." - fi - STRIP_BINARY_RETVAL=1 - return - fi - stripped="" - for arch in $binary_archs; do - if ! [[ "${ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi - STRIP_BINARY_RETVAL=0 -} - -# Copies the bcsymbolmap files of a vendored framework -install_bcsymbolmap() { - local bcsymbolmap_path="$1" - local destination="${BUILT_PRODUCTS_DIR}" - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identity - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" - - if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then - code_sign_cmd="$code_sign_cmd &" - fi - echo "$code_sign_cmd" - eval "$code_sign_cmd" - fi -} - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "${BUILT_PRODUCTS_DIR}/PINCache/PINCache.framework" - install_framework "${BUILT_PRODUCTS_DIR}/PINOperation/PINOperation.framework" - install_framework "${BUILT_PRODUCTS_DIR}/PINRemoteImage/PINRemoteImage.framework" - install_framework "${BUILT_PRODUCTS_DIR}/Texture/AsyncDisplayKit.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "${BUILT_PRODUCTS_DIR}/PINCache/PINCache.framework" - install_framework "${BUILT_PRODUCTS_DIR}/PINOperation/PINOperation.framework" - install_framework "${BUILT_PRODUCTS_DIR}/PINRemoteImage/PINRemoteImage.framework" - install_framework "${BUILT_PRODUCTS_DIR}/Texture/AsyncDisplayKit.framework" -fi -if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then - wait -fi diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-umbrella.h b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-umbrella.h deleted file mode 100644 index ad9e61f7..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-umbrella.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - - -FOUNDATION_EXPORT double Pods_QuranEngineAppVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_QuranEngineAppVersionString[]; - diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.debug.xcconfig b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.debug.xcconfig deleted file mode 100644 index cf4bf0a5..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.debug.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" "${PODS_CONFIGURATION_BUILD_DIR}/Texture" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) AS_USE_ASSETS_LIBRARY=1 $(inherited) AS_USE_MAPKIT=1 $(inherited) AS_USE_PHOTOS=1 $(inherited) AS_USE_VIDEO=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache/PINCache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation/PINOperation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage/PINRemoteImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Texture/AsyncDisplayKit.framework/Headers" -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINCache/PINCache.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation/PINOperation.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage/PINRemoteImage.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Texture/AsyncDisplayKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Texture" -OTHER_LDFLAGS = $(inherited) -l"c++" -framework "AVFoundation" -framework "Accelerate" -framework "AssetsLibrary" -framework "AsyncDisplayKit" -framework "CoreLocation" -framework "CoreMedia" -framework "Foundation" -framework "ImageIO" -framework "MapKit" -framework "PINCache" -framework "PINOperation" -framework "PINRemoteImage" -framework "Photos" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_PODFILE_DIR_PATH = ${SRCROOT}/. -PODS_ROOT = ${SRCROOT}/Pods -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap deleted file mode 100644 index eea526dc..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_QuranEngineApp { - umbrella header "Pods-QuranEngineApp-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.release.xcconfig b/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.release.xcconfig deleted file mode 100644 index cf4bf0a5..00000000 --- a/Example/Pods/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.release.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" "${PODS_CONFIGURATION_BUILD_DIR}/Texture" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) AS_USE_ASSETS_LIBRARY=1 $(inherited) AS_USE_MAPKIT=1 $(inherited) AS_USE_PHOTOS=1 $(inherited) AS_USE_VIDEO=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache/PINCache.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation/PINOperation.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage/PINRemoteImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Texture/AsyncDisplayKit.framework/Headers" -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINCache/PINCache.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation/PINOperation.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage/PINRemoteImage.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Texture/AsyncDisplayKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Texture" -OTHER_LDFLAGS = $(inherited) -l"c++" -framework "AVFoundation" -framework "Accelerate" -framework "AssetsLibrary" -framework "AsyncDisplayKit" -framework "CoreLocation" -framework "CoreMedia" -framework "Foundation" -framework "ImageIO" -framework "MapKit" -framework "PINCache" -framework "PINOperation" -framework "PINRemoteImage" -framework "Photos" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_PODFILE_DIR_PATH = ${SRCROOT}/. -PODS_ROOT = ${SRCROOT}/Pods -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/Texture/Texture-Info.plist b/Example/Pods/Target Support Files/Texture/Texture-Info.plist deleted file mode 100644 index 362a435d..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - ${PODS_DEVELOPMENT_LANGUAGE} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 3.1.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Texture/Texture-dummy.m b/Example/Pods/Target Support Files/Texture/Texture-dummy.m deleted file mode 100644 index da713fe3..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Texture : NSObject -@end -@implementation PodsDummy_Texture -@end diff --git a/Example/Pods/Target Support Files/Texture/Texture-prefix.pch b/Example/Pods/Target Support Files/Texture/Texture-prefix.pch deleted file mode 100644 index beb2a244..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture-prefix.pch +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - diff --git a/Example/Pods/Target Support Files/Texture/Texture-umbrella.h b/Example/Pods/Target Support Files/Texture/Texture-umbrella.h deleted file mode 100644 index bacae2a8..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture-umbrella.h +++ /dev/null @@ -1,174 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - -#import "ASBlockTypes.h" -#import "ASButtonNode+Private.h" -#import "ASButtonNode+Yoga.h" -#import "ASButtonNode.h" -#import "ASCellNode.h" -#import "ASCollectionNode+Beta.h" -#import "ASCollectionNode.h" -#import "ASCollections.h" -#import "ASCollectionView.h" -#import "ASCollectionViewLayoutFacilitatorProtocol.h" -#import "ASCollectionViewProtocols.h" -#import "ASConfiguration.h" -#import "ASConfigurationDelegate.h" -#import "ASConfigurationInternal.h" -#import "ASContextTransitioning.h" -#import "ASControlNode+Subclasses.h" -#import "ASControlNode.h" -#import "ASDisplayNode+Beta.h" -#import "ASDisplayNode+Convenience.h" -#import "ASDisplayNode+InterfaceState.h" -#import "ASDisplayNode+LayoutSpec.h" -#import "ASDisplayNode+Subclasses.h" -#import "ASDisplayNode+Yoga.h" -#import "ASDisplayNode.h" -#import "ASDisplayNodeExtras.h" -#import "ASDKNavigationController.h" -#import "ASDKViewController.h" -#import "ASEditableTextNode.h" -#import "ASExperimentalFeatures.h" -#import "ASImageNode.h" -#import "ASLocking.h" -#import "ASMainThreadDeallocation.h" -#import "ASMapNode.h" -#import "ASMultiplexImageNode.h" -#import "ASNetworkImageLoadInfo.h" -#import "ASNetworkImageNode.h" -#import "ASNodeController+Beta.h" -#import "ASPagerFlowLayout.h" -#import "ASPagerNode+Beta.h" -#import "ASPagerNode.h" -#import "ASRangeManagingNode.h" -#import "ASRunLoopQueue.h" -#import "ASScrollNode.h" -#import "ASSectionController.h" -#import "ASSupplementaryNodeSource.h" -#import "ASTabBarController.h" -#import "ASTableNode+Beta.h" -#import "ASTableNode.h" -#import "ASTableView.h" -#import "ASTableViewInternal.h" -#import "ASTableViewProtocols.h" -#import "ASTextNode+Beta.h" -#import "ASTextNode.h" -#import "ASTextNode2.h" -#import "ASTextNodeCommon.h" -#import "ASVideoNode.h" -#import "ASVideoPlayerNode.h" -#import "ASVisibilityProtocols.h" -#import "AsyncDisplayKit+IGListKitMethods.h" -#import "AsyncDisplayKit.h" -#import "IGListAdapter+AsyncDisplayKit.h" -#import "UIImage+ASConvenience.h" -#import "UIResponder+AsyncDisplayKit.h" -#import "_ASTransitionContext.h" -#import "ASAbstractLayoutController.h" -#import "ASBasicImageDownloader.h" -#import "ASBatchContext.h" -#import "ASBatchFetchingDelegate.h" -#import "ASCollectionElement.h" -#import "ASCollectionFlowLayoutDelegate.h" -#import "ASCollectionGalleryLayoutDelegate.h" -#import "ASCollectionInternal.h" -#import "ASCollectionLayoutContext.h" -#import "ASCollectionLayoutDelegate.h" -#import "ASCollectionLayoutState.h" -#import "ASCollectionViewLayoutController.h" -#import "ASCollectionViewLayoutInspector.h" -#import "ASDataController.h" -#import "ASDelegateProxy.h" -#import "ASElementMap.h" -#import "ASGraphicsContext.h" -#import "ASHashing.h" -#import "ASHighlightOverlayLayer.h" -#import "ASImageContainerProtocolCategories.h" -#import "ASImageProtocols.h" -#import "ASIntegerMap.h" -#import "ASLayoutController.h" -#import "ASLayoutRangeType.h" -#import "ASMainSerialQueue.h" -#import "ASMutableAttributedStringBuilder.h" -#import "ASObjectDescriptionHelpers.h" -#import "ASPageTable.h" -#import "ASPhotosFrameworkImageRequest.h" -#import "ASPINRemoteImageDownloader.h" -#import "ASRangeController.h" -#import "ASRangeControllerUpdateRangeProtocol+Beta.h" -#import "ASRecursiveUnfairLock.h" -#import "ASScrollDirection.h" -#import "ASSectionContext.h" -#import "ASTableLayoutController.h" -#import "ASThread.h" -#import "ASTraitCollection.h" -#import "ASWeakProxy.h" -#import "ASWeakSet.h" -#import "CoreGraphics+ASConvenience.h" -#import "NSArray+Diffing.h" -#import "NSIndexSet+ASHelpers.h" -#import "NSMutableAttributedString+TextKitAdditions.h" -#import "_ASAsyncTransaction.h" -#import "_ASAsyncTransactionContainer+Private.h" -#import "_ASAsyncTransactionContainer.h" -#import "_ASAsyncTransactionGroup.h" -#import "UICollectionViewLayout+ASConvenience.h" -#import "UIView+ASConvenience.h" -#import "_ASCollectionReusableView.h" -#import "_ASCollectionViewCell.h" -#import "_ASDisplayLayer.h" -#import "_ASDisplayView.h" -#import "_ASDisplayViewAccessiblity.h" -#import "ASAbsoluteLayoutElement.h" -#import "ASAbsoluteLayoutSpec.h" -#import "ASAsciiArtBoxCreator.h" -#import "ASBackgroundLayoutSpec.h" -#import "ASCenterLayoutSpec.h" -#import "ASCornerLayoutSpec.h" -#import "ASDimension.h" -#import "ASDimensionInternal.h" -#import "ASInsetLayoutSpec.h" -#import "ASLayout+IGListDiffKit.h" -#import "ASLayout.h" -#import "ASLayoutElement.h" -#import "ASLayoutElementExtensibility.h" -#import "ASLayoutElementPrivate.h" -#import "ASLayoutSpec+Subclasses.h" -#import "ASLayoutSpec.h" -#import "ASOverlayLayoutSpec.h" -#import "ASRatioLayoutSpec.h" -#import "ASRelativeLayoutSpec.h" -#import "ASStackLayoutDefines.h" -#import "ASStackLayoutElement.h" -#import "ASStackLayoutSpec.h" -#import "ASYogaUtilities.h" -#import "ASAssert.h" -#import "ASAvailability.h" -#import "ASBaseDefines.h" -#import "ASDisplayNode+Ancestry.h" -#import "ASEqualityHelpers.h" -#import "ASLog.h" -#import "ASSignpost.h" -#import "AsyncDisplayKit+Debug.h" -#import "AsyncDisplayKit+Tips.h" -#import "ASTextNodeTypes.h" -#import "ASTextKitComponents.h" -#import "ASTextDebugOption.h" -#import "ASTextInput.h" -#import "ASTextLayout.h" -#import "ASTextLine.h" -#import "ASTextAttribute.h" - -FOUNDATION_EXPORT double AsyncDisplayKitVersionNumber; -FOUNDATION_EXPORT const unsigned char AsyncDisplayKitVersionString[]; - diff --git a/Example/Pods/Target Support Files/Texture/Texture.debug.xcconfig b/Example/Pods/Target Support Files/Texture/Texture.debug.xcconfig deleted file mode 100644 index a962c705..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture.debug.xcconfig +++ /dev/null @@ -1,16 +0,0 @@ -CLANG_CXX_LANGUAGE_STANDARD = c++11 -CLANG_CXX_LIBRARY = libc++ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Texture -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) AS_USE_ASSETS_LIBRARY=1 $(inherited) AS_USE_MAPKIT=1 $(inherited) AS_USE_PHOTOS=1 $(inherited) AS_USE_VIDEO=1 -OTHER_LDFLAGS = $(inherited) -l"c++" -framework "AVFoundation" -framework "Accelerate" -framework "AssetsLibrary" -framework "CoreLocation" -framework "CoreMedia" -framework "ImageIO" -framework "MapKit" -framework "PINRemoteImage" -framework "Photos" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/Texture -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Target Support Files/Texture/Texture.modulemap b/Example/Pods/Target Support Files/Texture/Texture.modulemap deleted file mode 100644 index b1552f62..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module AsyncDisplayKit { - umbrella header "Texture-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Texture/Texture.release.xcconfig b/Example/Pods/Target Support Files/Texture/Texture.release.xcconfig deleted file mode 100644 index a962c705..00000000 --- a/Example/Pods/Target Support Files/Texture/Texture.release.xcconfig +++ /dev/null @@ -1,16 +0,0 @@ -CLANG_CXX_LANGUAGE_STANDARD = c++11 -CLANG_CXX_LIBRARY = libc++ -CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Texture -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PINCache" "${PODS_CONFIGURATION_BUILD_DIR}/PINOperation" "${PODS_CONFIGURATION_BUILD_DIR}/PINRemoteImage" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) AS_USE_ASSETS_LIBRARY=1 $(inherited) AS_USE_MAPKIT=1 $(inherited) AS_USE_PHOTOS=1 $(inherited) AS_USE_VIDEO=1 -OTHER_LDFLAGS = $(inherited) -l"c++" -framework "AVFoundation" -framework "Accelerate" -framework "AssetsLibrary" -framework "CoreLocation" -framework "CoreMedia" -framework "ImageIO" -framework "MapKit" -framework "PINRemoteImage" -framework "Photos" -framework "UIKit" -weak_framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE} -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/Texture -PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Example/Pods/Texture/LICENSE b/Example/Pods/Texture/LICENSE deleted file mode 100644 index c63a7c0a..00000000 --- a/Example/Pods/Texture/LICENSE +++ /dev/null @@ -1,181 +0,0 @@ -The Texture project was created by Pinterest as a continuation, under a different -name and license, of the AsyncDisplayKit codebase originally developed by Facebook. - -All code in Texture is covered by the Apache License, Version 2.0. - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/Example/Pods/Texture/README.md b/Example/Pods/Texture/README.md deleted file mode 100644 index 28feb6eb..00000000 --- a/Example/Pods/Texture/README.md +++ /dev/null @@ -1,51 +0,0 @@ -## Coming from AsyncDisplayKit? Learn more [here](https://medium.com/@Pinterest_Engineering/introducing-texture-a-new-home-for-asyncdisplaykit-e7c003308f50) - -![Texture](https://github.com/texturegroup/texture/raw/master/docs/static/images/logo.png) - -[![Apps Using](https://img.shields.io/cocoapods/at/Texture.svg?label=Apps%20Using%20Texture&colorB=28B9FE)](http://cocoapods.org/pods/Texture) -[![Downloads](https://img.shields.io/cocoapods/dt/Texture.svg?label=Total%20Downloads&colorB=28B9FE)](http://cocoapods.org/pods/Texture) - -[![Platform](https://img.shields.io/badge/platforms-iOS%20%7C%20tvOS-orange.svg)](http://texturegroup.org) -[![Languages](https://img.shields.io/badge/languages-ObjC%20%7C%20Swift-orange.svg)](http://texturegroup.org) - -[![Version](https://img.shields.io/cocoapods/v/Texture.svg)](http://cocoapods.org/pods/Texture) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-59C939.svg?style=flat)](https://github.com/Carthage/Carthage) -[![License](https://img.shields.io/cocoapods/l/Texture.svg)](https://github.com/texturegroup/texture/blob/master/LICENSE) - -## Installation - -Texture is available via CocoaPods or Carthage. See our [Installation](http://texturegroup.org/docs/installation.html) guide for instructions. - -## Performance Gains - -Texture's basic unit is the `node`. An ASDisplayNode is an abstraction over `UIView`, which in turn is an abstraction over `CALayer`. Unlike views, which can only be used on the main thread, nodes are thread-safe: you can instantiate and configure entire hierarchies of them in parallel on background threads. - -To keep its user interface smooth and responsive, your app should render at 60 frames per second — the gold standard on iOS. This means the main thread has one-sixtieth of a second to push each frame. That's 16 milliseconds to execute all layout and drawing code! And because of system overhead, your code usually has less than ten milliseconds to run before it causes a frame drop. - -Texture lets you move image decoding, text sizing and rendering, layout, and other expensive UI operations off the main thread, to keep the main thread available to respond to user interaction. - -## Advanced Developer Features - -As the framework has grown, many features have been added that can save developers tons of time by eliminating common boilerplate style structures common in modern iOS apps. If you've ever dealt with cell reuse bugs, tried to performantly preload data for a page or scroll style interface or even just tried to keep your app from dropping too many frames you can benefit from integrating Texture. - -## Learn More - -* Read the our [Getting Started](http://texturegroup.org/docs/getting-started.html) guide -* Get the [sample projects](https://github.com/texturegroup/texture/tree/master/examples) -* Browse the [API reference](http://texturegroup.org/appledocs.html) - -## Getting Help - -We use Slack for real-time debugging, community updates, and general talk about Texture. [Signup](https://asdk-slack-auto-invite.herokuapp.com) yourself or email textureframework@gmail.com to get an invite. - -## Release process - -For the release process see the [RELEASE](https://github.com/texturegroup/texture/blob/master/RELEASE.md) file. - -## Contributing - -We welcome any contributions. See the [CONTRIBUTING](https://github.com/texturegroup/texture/blob/master/CONTRIBUTING.md) file for how to get involved. - -## License - -The Texture project is available for free use, as described by the [LICENSE](https://github.com/texturegroup/texture/blob/master/LICENSE) (Apache 2.0). diff --git a/Example/Pods/Texture/Source/ASBlockTypes.h b/Example/Pods/Texture/Source/ASBlockTypes.h deleted file mode 100644 index e1c74560..00000000 --- a/Example/Pods/Texture/Source/ASBlockTypes.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ASBlockTypes.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASCellNode; - -/** - * ASCellNode creation block. Used to lazily create the ASCellNode instance for a specified indexPath. - */ -typedef ASCellNode * _Nonnull(^ASCellNodeBlock)(void); - -// Type for the cancellation checker block passed into the async display blocks. YES means the operation has been cancelled, NO means continue. -typedef BOOL(^asdisplaynode_iscancelled_block_t)(void); diff --git a/Example/Pods/Texture/Source/ASButtonNode+Private.h b/Example/Pods/Texture/Source/ASButtonNode+Private.h deleted file mode 100644 index 22ca4eb7..00000000 --- a/Example/Pods/Texture/Source/ASButtonNode+Private.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASButtonNode+Private.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@interface ASButtonNode () { - NSAttributedString *_normalAttributedTitle; - NSAttributedString *_highlightedAttributedTitle; - NSAttributedString *_selectedAttributedTitle; - NSAttributedString *_selectedHighlightedAttributedTitle; - NSAttributedString *_disabledAttributedTitle; - - UIImage *_normalImage; - UIImage *_highlightedImage; - UIImage *_selectedImage; - UIImage *_selectedHighlightedImage; - UIImage *_disabledImage; - - UIImage *_normalBackgroundImage; - UIImage *_highlightedBackgroundImage; - UIImage *_selectedBackgroundImage; - UIImage *_selectedHighlightedBackgroundImage; - UIImage *_disabledBackgroundImage; - - CGFloat _contentSpacing; - UIEdgeInsets _contentEdgeInsets; - ASTextNode *_titleNode; - ASImageNode *_imageNode; - ASImageNode *_backgroundImageNode; - - BOOL _laysOutHorizontally; - ASVerticalAlignment _contentVerticalAlignment; - ASHorizontalAlignment _contentHorizontalAlignment; - ASButtonNodeImageAlignment _imageAlignment; -} - -@end diff --git a/Example/Pods/Texture/Source/ASButtonNode+Yoga.h b/Example/Pods/Texture/Source/ASButtonNode+Yoga.h deleted file mode 100644 index 4fddc9df..00000000 --- a/Example/Pods/Texture/Source/ASButtonNode+Yoga.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ASButtonNode+Yoga.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASButtonNode (Yoga) - -- (void)updateYogaLayoutIfNeeded; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASButtonNode+Yoga.mm b/Example/Pods/Texture/Source/ASButtonNode+Yoga.mm deleted file mode 100644 index f4493bc4..00000000 --- a/Example/Pods/Texture/Source/ASButtonNode+Yoga.mm +++ /dev/null @@ -1,105 +0,0 @@ -// -// ASButtonNode+Yoga.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import "ASButtonNode+Yoga.h" -#import -#import -#import - -#if YOGA -static void ASButtonNodeResolveHorizontalAlignmentForStyle(ASLayoutElementStyle *style, ASStackLayoutDirection _direction, ASHorizontalAlignment _horizontalAlignment, ASStackLayoutJustifyContent _justifyContent, ASStackLayoutAlignItems _alignItems) { - if (_direction == ASStackLayoutDirectionHorizontal) { - style.justifyContent = justifyContent(_horizontalAlignment, _justifyContent); - } else { - style.alignItems = alignment(_horizontalAlignment, _alignItems); - } -} - -static void ASButtonNodeResolveVerticalAlignmentForStyle(ASLayoutElementStyle *style, ASStackLayoutDirection _direction, ASVerticalAlignment _verticalAlignment, ASStackLayoutJustifyContent _justifyContent, ASStackLayoutAlignItems _alignItems) { - if (_direction == ASStackLayoutDirectionHorizontal) { - style.alignItems = alignment(_verticalAlignment, _alignItems); - } else { - style.justifyContent = justifyContent(_verticalAlignment, _justifyContent); - } -} - -@implementation ASButtonNode (Yoga) - -- (void)updateYogaLayoutIfNeeded -{ - NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2]; - { - ASLockScopeSelf(); - - // Build up yoga children for button node again - unowned ASLayoutElementStyle *style = [self _locked_style]; - [style yogaNodeCreateIfNeeded]; - - // Setup stack layout values - style.flexDirection = _laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical; - - // Resolve horizontal and vertical alignment - ASButtonNodeResolveHorizontalAlignmentForStyle(style, style.flexDirection, _contentHorizontalAlignment, style.justifyContent, style.alignItems); - ASButtonNodeResolveVerticalAlignmentForStyle(style, style.flexDirection, _contentVerticalAlignment, style.justifyContent, style.alignItems); - - // Setup new yoga children - if (_imageNode.image != nil) { - [_imageNode.style yogaNodeCreateIfNeeded]; - [children addObject:_imageNode]; - } - - if (_titleNode.attributedText.length > 0) { - [_titleNode.style yogaNodeCreateIfNeeded]; - if (_imageAlignment == ASButtonNodeImageAlignmentBeginning) { - [children addObject:_titleNode]; - } else { - [children insertObject:_titleNode atIndex:0]; - } - } - - // Add spacing between title and button - if (children.count == 2) { - unowned ASLayoutElementStyle *firstChildStyle = children.firstObject.style; - if (_laysOutHorizontally) { - firstChildStyle.margin = ASEdgeInsetsMake(UIEdgeInsetsMake(0, 0, 0, _contentSpacing)); - } else { - firstChildStyle.margin = ASEdgeInsetsMake(UIEdgeInsetsMake(0, 0, _contentSpacing, 0)); - } - } - - // Add padding to button - if (UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, _contentEdgeInsets) == NO) { - style.padding = ASEdgeInsetsMake(_contentEdgeInsets); - } - - // Add background node - if (_backgroundImageNode.image) { - [_backgroundImageNode.style yogaNodeCreateIfNeeded]; - [children insertObject:_backgroundImageNode atIndex:0]; - - _backgroundImageNode.style.positionType = YGPositionTypeAbsolute; - _backgroundImageNode.style.position = ASEdgeInsetsMake(UIEdgeInsetsZero); - } - } - - // Update new children - [self setYogaChildren:children]; -} - -@end - -#else - -@implementation ASButtonNode (Yoga) - -- (void)updateYogaLayoutIfNeeded {} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/ASButtonNode.h b/Example/Pods/Texture/Source/ASButtonNode.h deleted file mode 100644 index 3963fb1b..00000000 --- a/Example/Pods/Texture/Source/ASButtonNode.h +++ /dev/null @@ -1,130 +0,0 @@ -// -// ASButtonNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASImageNode, ASTextNode; - -/** - Image alignment defines where the image will be placed relative to the text. - */ -typedef NS_ENUM(unsigned char, ASButtonNodeImageAlignment) { - /** Places the image before the text. */ - ASButtonNodeImageAlignmentBeginning, - /** Places the image after the text. */ - ASButtonNodeImageAlignmentEnd -}; - -@interface ASButtonNode : ASControlNode - -@property (readonly) ASTextNode * titleNode; -@property (readonly) ASImageNode * imageNode; -@property (readonly) ASImageNode * backgroundImageNode; - -/** - Spacing between image and title. Defaults to 8.0. - */ -@property CGFloat contentSpacing; - -/** - Whether button should be laid out vertically (image on top of text) or horizontally (image to the left of text). - ASButton node does not yet support RTL but it should be fairly easy to implement. - Defaults to YES. - */ -@property BOOL laysOutHorizontally; - -/** Horizontally align content (text or image). - Defaults to ASHorizontalAlignmentMiddle. - */ -@property ASHorizontalAlignment contentHorizontalAlignment; - -/** Vertically align content (text or image). - Defaults to ASVerticalAlignmentCenter. - */ -@property ASVerticalAlignment contentVerticalAlignment; - -/** - * @discussion The insets used around the title and image node - */ -@property UIEdgeInsets contentEdgeInsets; - -/** - * @discusstion Whether the image should be aligned at the beginning or at the end of node. Default is `ASButtonNodeImageAlignmentBeginning`. - */ -@property ASButtonNodeImageAlignment imageAlignment; - -/** - * Returns the styled title associated with the specified state. - * - * @param state The control state that uses the styled title. - * - * @return The title for the specified state. - */ -- (nullable NSAttributedString *)attributedTitleForState:(UIControlState)state AS_WARN_UNUSED_RESULT; - -/** - * Sets the styled title to use for the specified state. This will reset styled title previously set with -setTitle:withFont:withColor:forState. - * - * @param title The styled text string to use for the title. - * @param state The control state that uses the specified title. - */ -- (void)setAttributedTitle:(nullable NSAttributedString *)title forState:(UIControlState)state; - -#if TARGET_OS_IOS -/** - * Sets the title to use for the specified state. This will reset styled title previously set with -setAttributedTitle:forState. - * - * @param title The styled text string to use for the title. - * @param font The font to use for the title. - * @param color The color to use for the title. - * @param state The control state that uses the specified title. - */ -- (void)setTitle:(NSString *)title withFont:(nullable UIFont *)font withColor:(nullable UIColor *)color forState:(UIControlState)state; -#endif -/** - * Returns the image used for a button state. - * - * @param state The control state that uses the image. - * - * @return The image used for the specified state. - */ -- (nullable UIImage *)imageForState:(UIControlState)state AS_WARN_UNUSED_RESULT; - -/** - * Sets the image to use for the specified state. - * - * @param image The image to use for the specified state. - * @param state The control state that uses the specified title. - */ -- (void)setImage:(nullable UIImage *)image forState:(UIControlState)state; - -/** - * Sets the background image to use for the specified state. - * - * @param image The image to use for the specified state. - * @param state The control state that uses the specified title. - */ -- (void)setBackgroundImage:(nullable UIImage *)image forState:(UIControlState)state; - - -/** - * Returns the background image used for a button state. - * - * @param state The control state that uses the image. - * - * @return The background image used for the specified state. - */ -- (nullable UIImage *)backgroundImageForState:(UIControlState)state AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASButtonNode.mm b/Example/Pods/Texture/Source/ASButtonNode.mm deleted file mode 100644 index 66b9cd33..00000000 --- a/Example/Pods/Texture/Source/ASButtonNode.mm +++ /dev/null @@ -1,575 +0,0 @@ -// -// ASButtonNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -@implementation ASButtonNode - -@synthesize contentSpacing = _contentSpacing; -@synthesize laysOutHorizontally = _laysOutHorizontally; -@synthesize contentVerticalAlignment = _contentVerticalAlignment; -@synthesize contentHorizontalAlignment = _contentHorizontalAlignment; -@synthesize contentEdgeInsets = _contentEdgeInsets; -@synthesize imageAlignment = _imageAlignment; -@synthesize titleNode = _titleNode; -@synthesize imageNode = _imageNode; -@synthesize backgroundImageNode = _backgroundImageNode; - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (self = [super init]) { - self.automaticallyManagesSubnodes = YES; - - _contentSpacing = 8.0; - _laysOutHorizontally = YES; - _contentHorizontalAlignment = ASHorizontalAlignmentMiddle; - _contentVerticalAlignment = ASVerticalAlignmentCenter; - _contentEdgeInsets = UIEdgeInsetsZero; - _imageAlignment = ASButtonNodeImageAlignmentBeginning; - self.accessibilityTraits = self.defaultAccessibilityTraits; - - [self updateYogaLayoutIfNeeded]; - } - return self; -} - -- (ASTextNode *)titleNode -{ - ASLockScopeSelf(); - if (!_titleNode) { - _titleNode = [[ASTextNode alloc] init]; - #if TARGET_OS_TV - // tvOS needs access to the underlying view - // of the button node to add a touch handler. - [_titleNode setLayerBacked:NO]; - #else - [_titleNode setLayerBacked:YES]; - #endif - _titleNode.style.flexShrink = 1.0; - _titleNode.textColorFollowsTintColor = YES; - } - return _titleNode; -} - -#pragma mark - Public Getter - -- (ASImageNode *)imageNode -{ - ASLockScopeSelf(); - if (!_imageNode) { - _imageNode = [[ASImageNode alloc] init]; - [_imageNode setLayerBacked:YES]; - } - return _imageNode; -} - -- (ASImageNode *)backgroundImageNode -{ - ASLockScopeSelf(); - if (!_backgroundImageNode) { - _backgroundImageNode = [[ASImageNode alloc] init]; - [_backgroundImageNode setLayerBacked:YES]; - [_backgroundImageNode setContentMode:UIViewContentModeScaleToFill]; - } - return _backgroundImageNode; -} - -- (void)setLayerBacked:(BOOL)layerBacked -{ - ASDisplayNodeAssert(!layerBacked, @"ASButtonNode must not be layer backed!"); - [super setLayerBacked:layerBacked]; -} - -- (void)setEnabled:(BOOL)enabled -{ - if (self.enabled != enabled) { - [super setEnabled:enabled]; - self.accessibilityTraits = self.defaultAccessibilityTraits; - [self updateButtonContent]; - } -} - -- (void)setHighlighted:(BOOL)highlighted -{ - if (self.highlighted != highlighted) { - [super setHighlighted:highlighted]; - [self updateButtonContent]; - } -} - -- (void)setSelected:(BOOL)selected -{ - if (self.selected != selected) { - [super setSelected:selected]; - [self updateButtonContent]; - } -} - -- (void)updateButtonContent -{ - [self updateBackgroundImage]; - [self updateImage]; - [self updateTitle]; -} - -- (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously -{ - [super setDisplaysAsynchronously:displaysAsynchronously]; - [self.backgroundImageNode setDisplaysAsynchronously:displaysAsynchronously]; - [self.imageNode setDisplaysAsynchronously:displaysAsynchronously]; - [self.titleNode setDisplaysAsynchronously:displaysAsynchronously]; -} - --(void)tintColorDidChange -{ - [super tintColorDidChange]; - // UIButton documentation states that it tints the image and title of buttons when tintColor is set. - // | "The tint color to apply to the button title and image." - // | From: https://developer.apple.com/documentation/uikit/uibutton/1624025-tintcolor - [self lock]; - UIColor *tintColor = self.tintColor; - self.imageNode.tintColor = tintColor; - self.titleNode.tintColor = tintColor; - [self unlock]; - [self setNeedsDisplay]; -} - -- (void)updateImage -{ - [self lock]; - - UIImage *newImage; - if (self.enabled == NO && _disabledImage) { - newImage = _disabledImage; - } else if (self.highlighted && self.selected && _selectedHighlightedImage) { - newImage = _selectedHighlightedImage; - } else if (self.highlighted && _highlightedImage) { - newImage = _highlightedImage; - } else if (self.selected && _selectedImage) { - newImage = _selectedImage; - } else { - newImage = _normalImage; - } - - if ((_imageNode != nil || newImage != nil) && newImage != self.imageNode.image) { - _imageNode.image = newImage; - [self unlock]; - - [self updateYogaLayoutIfNeeded]; - [self setNeedsLayout]; - return; - } - - [self unlock]; -} - -- (void)updateTitle -{ - [self lock]; - - NSAttributedString *newTitle; - if (self.enabled == NO && _disabledAttributedTitle) { - newTitle = _disabledAttributedTitle; - } else if (self.highlighted && self.selected && _selectedHighlightedAttributedTitle) { - newTitle = _selectedHighlightedAttributedTitle; - } else if (self.highlighted && _highlightedAttributedTitle) { - newTitle = _highlightedAttributedTitle; - } else if (self.selected && _selectedAttributedTitle) { - newTitle = _selectedAttributedTitle; - } else { - newTitle = _normalAttributedTitle; - } - - NSAttributedString *attributedString = _titleNode.attributedText; - if ((attributedString.length > 0 || newTitle.length > 0) && [attributedString isEqualToAttributedString:newTitle] == NO) { - // Calling self.titleNode is essential here because _titleNode is lazily created by the getter. - self.titleNode.attributedText = newTitle; - [self unlock]; - - self.accessibilityLabel = self.defaultAccessibilityLabel; - [self updateYogaLayoutIfNeeded]; - [self setNeedsLayout]; - return; - } - - [self unlock]; -} - -- (void)updateBackgroundImage -{ - [self lock]; - - UIImage *newImage; - if (self.enabled == NO && _disabledBackgroundImage) { - newImage = _disabledBackgroundImage; - } else if (self.highlighted && self.selected && _selectedHighlightedBackgroundImage) { - newImage = _selectedHighlightedBackgroundImage; - } else if (self.highlighted && _highlightedBackgroundImage) { - newImage = _highlightedBackgroundImage; - } else if (self.selected && _selectedBackgroundImage) { - newImage = _selectedBackgroundImage; - } else { - newImage = _normalBackgroundImage; - } - - if ((_backgroundImageNode != nil || newImage != nil) && newImage != self.backgroundImageNode.image) { - _backgroundImageNode.image = newImage; - [self unlock]; - - [self updateYogaLayoutIfNeeded]; - [self setNeedsLayout]; - return; - } - - [self unlock]; -} - -- (CGFloat)contentSpacing -{ - ASLockScopeSelf(); - return _contentSpacing; -} - -- (void)setContentSpacing:(CGFloat)contentSpacing -{ - if (ASLockedSelfCompareAssign(_contentSpacing, contentSpacing)) { - [self updateYogaLayoutIfNeeded]; - [self setNeedsLayout]; - } -} - -- (BOOL)laysOutHorizontally -{ - ASLockScopeSelf(); - return _laysOutHorizontally; -} - -- (void)setLaysOutHorizontally:(BOOL)laysOutHorizontally -{ - if (ASLockedSelfCompareAssign(_laysOutHorizontally, laysOutHorizontally)) { - [self updateYogaLayoutIfNeeded]; - [self setNeedsLayout]; - } -} - -- (ASVerticalAlignment)contentVerticalAlignment -{ - ASLockScopeSelf(); - return _contentVerticalAlignment; -} - -- (void)setContentVerticalAlignment:(ASVerticalAlignment)contentVerticalAlignment -{ - ASLockScopeSelf(); - _contentVerticalAlignment = contentVerticalAlignment; -} - -- (ASHorizontalAlignment)contentHorizontalAlignment -{ - ASLockScopeSelf(); - return _contentHorizontalAlignment; -} - -- (void)setContentHorizontalAlignment:(ASHorizontalAlignment)contentHorizontalAlignment -{ - ASLockScopeSelf(); - _contentHorizontalAlignment = contentHorizontalAlignment; -} - -- (UIEdgeInsets)contentEdgeInsets -{ - ASLockScopeSelf(); - return _contentEdgeInsets; -} - -- (void)setContentEdgeInsets:(UIEdgeInsets)contentEdgeInsets -{ - ASLockScopeSelf(); - _contentEdgeInsets = contentEdgeInsets; -} - -- (ASButtonNodeImageAlignment)imageAlignment -{ - ASLockScopeSelf(); - return _imageAlignment; -} - -- (void)setImageAlignment:(ASButtonNodeImageAlignment)imageAlignment -{ - ASLockScopeSelf(); - _imageAlignment = imageAlignment; -} - - -#if TARGET_OS_IOS -- (void)setTitle:(NSString *)title withFont:(UIFont *)font withColor:(UIColor *)color forState:(UIControlState)state -{ - NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; - attributes[NSFontAttributeName] = font ? : [UIFont systemFontOfSize:[UIFont buttonFontSize]]; - if (color != nil) { - // From apple's documentation: If color is not specified, NSForegroundColorAttributeName will fallback to black - // Only set if the color is nonnull - attributes[NSForegroundColorAttributeName] = color; - } - NSAttributedString *string = [[NSAttributedString alloc] initWithString:title attributes:[attributes copy]]; - [self setAttributedTitle:string forState:state]; -} -#endif - -- (NSAttributedString *)attributedTitleForState:(UIControlState)state -{ - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - return _normalAttributedTitle; - - case UIControlStateHighlighted: - return _highlightedAttributedTitle; - - case UIControlStateSelected: - return _selectedAttributedTitle; - - case UIControlStateSelected | UIControlStateHighlighted: - return _selectedHighlightedAttributedTitle; - - case UIControlStateDisabled: - return _disabledAttributedTitle; - - default: - return _normalAttributedTitle; - } -} - -- (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)state -{ - { - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - _normalAttributedTitle = [title copy]; - break; - - case UIControlStateHighlighted: - _highlightedAttributedTitle = [title copy]; - break; - - case UIControlStateSelected: - _selectedAttributedTitle = [title copy]; - break; - - case UIControlStateSelected | UIControlStateHighlighted: - _selectedHighlightedAttributedTitle = [title copy]; - break; - - case UIControlStateDisabled: - _disabledAttributedTitle = [title copy]; - break; - - default: - break; - } - } - - [self updateTitle]; -} - -- (UIImage *)imageForState:(UIControlState)state -{ - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - return _normalImage; - - case UIControlStateHighlighted: - return _highlightedImage; - - case UIControlStateSelected: - return _selectedImage; - - case UIControlStateSelected | UIControlStateHighlighted: - return _selectedHighlightedImage; - - case UIControlStateDisabled: - return _disabledImage; - - default: - return _normalImage; - } -} - -- (void)setImage:(UIImage *)image forState:(UIControlState)state -{ - { - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - _normalImage = image; - break; - - case UIControlStateHighlighted: - _highlightedImage = image; - break; - - case UIControlStateSelected: - _selectedImage = image; - break; - - case UIControlStateSelected | UIControlStateHighlighted: - _selectedHighlightedImage = image; - break; - - case UIControlStateDisabled: - _disabledImage = image; - break; - - default: - break; - } - } - - [self updateImage]; -} - -- (UIImage *)backgroundImageForState:(UIControlState)state -{ - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - return _normalBackgroundImage; - - case UIControlStateHighlighted: - return _highlightedBackgroundImage; - - case UIControlStateSelected: - return _selectedBackgroundImage; - - case UIControlStateSelected | UIControlStateHighlighted: - return _selectedHighlightedBackgroundImage; - - case UIControlStateDisabled: - return _disabledBackgroundImage; - - default: - return _normalBackgroundImage; - } -} - -- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state -{ - { - ASLockScopeSelf(); - switch (state) { - case UIControlStateNormal: - _normalBackgroundImage = image; - break; - - case UIControlStateHighlighted: - _highlightedBackgroundImage = image; - break; - - case UIControlStateSelected: - _selectedBackgroundImage = image; - break; - - case UIControlStateSelected | UIControlStateHighlighted: - _selectedHighlightedBackgroundImage = image; - break; - - case UIControlStateDisabled: - _disabledBackgroundImage = image; - break; - - default: - break; - } - } - - [self updateBackgroundImage]; -} - - -- (NSString *)defaultAccessibilityLabel -{ - ASLockScopeSelf(); - return _titleNode.defaultAccessibilityLabel; -} - -- (UIAccessibilityTraits)defaultAccessibilityTraits -{ - return self.enabled ? UIAccessibilityTraitButton - : (UIAccessibilityTraitButton | UIAccessibilityTraitNotEnabled); -} - -#pragma mark - Layout - -#if !YOGA -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - UIEdgeInsets contentEdgeInsets; - ASButtonNodeImageAlignment imageAlignment; - ASLayoutSpec *spec; - ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init]; - { - ASLockScopeSelf(); - stack.direction = _laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical; - stack.spacing = _contentSpacing; - stack.horizontalAlignment = _contentHorizontalAlignment; - stack.verticalAlignment = _contentVerticalAlignment; - - contentEdgeInsets = _contentEdgeInsets; - imageAlignment = _imageAlignment; - } - - NSMutableArray *children = [[NSMutableArray alloc] initWithCapacity:2]; - if (_imageNode.image) { - [children addObject:_imageNode]; - } - - if (_titleNode.attributedText.length > 0) { - if (imageAlignment == ASButtonNodeImageAlignmentBeginning) { - [children addObject:_titleNode]; - } else { - [children insertObject:_titleNode atIndex:0]; - } - } - - stack.children = children; - - spec = stack; - - if (UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, contentEdgeInsets) == NO) { - spec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:contentEdgeInsets child:spec]; - } - - if (_backgroundImageNode.image) { - spec = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:spec background:_backgroundImageNode]; - } - - return spec; -} -#endif - -- (void)layout -{ - [super layout]; - - _backgroundImageNode.hidden = (_backgroundImageNode.image == nil); - _imageNode.hidden = (_imageNode.image == nil); - _titleNode.hidden = (_titleNode.attributedText.length == 0); -} - -@end diff --git a/Example/Pods/Texture/Source/ASCellNode.h b/Example/Pods/Texture/Source/ASCellNode.h deleted file mode 100644 index c09becc4..00000000 --- a/Example/Pods/Texture/Source/ASCellNode.h +++ /dev/null @@ -1,259 +0,0 @@ -// -// ASCellNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCellNode, ASTextNode; -@protocol ASRangeManagingNode; - -typedef NSUInteger ASCellNodeAnimation; - -typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { - /** - * Indicates a cell has just became visible - */ - ASCellNodeVisibilityEventVisible, - /** - * Its position (determined by scrollView.contentOffset) has changed while at least 1px remains visible. - * It is possible that 100% of the cell is visible both before and after and only its position has changed, - * or that the position change has resulted in more or less of the cell being visible. - * Use CGRectIntersect between cellFrame and scrollView.bounds to get this rectangle - */ - ASCellNodeVisibilityEventVisibleRectChanged, - /** - * Indicates a cell is no longer visible - */ - ASCellNodeVisibilityEventInvisible, - /** - * Indicates user has started dragging the visible cell - */ - ASCellNodeVisibilityEventWillBeginDragging, - /** - * Indicates user has ended dragging the visible cell - */ - ASCellNodeVisibilityEventDidEndDragging, -}; - -/** - * Generic cell node. Subclass this instead of `ASDisplayNode` to use with `ASTableView` and `ASCollectionView`. - - * @note When a cell node is contained inside a collection view (or table view), - * calling `-setNeedsLayout` will also notify the collection on the main thread - * so that the collection can update its item layout if the cell's size changed. - */ -@interface ASCellNode : ASDisplayNode - -/** - * @abstract When enabled, ensures that the cell is completely displayed before allowed onscreen. - * - * @default NO - * @discussion Normally, ASCellNodes are preloaded and have finished display before they are onscreen. - * However, if the Table or Collection's rangeTuningParameters are set to small values (or 0), - * or if the user is scrolling rapidly on a slow device, it is possible for a cell's display to - * be incomplete when it becomes visible. - * - * In this case, normally placeholder states are shown and scrolling continues uninterrupted. - * The finished, drawn content is then shown as soon as it is ready. - * - * With this property set to YES, the main thread will be blocked until display is complete for - * the cell. This is more similar to UIKit, and in fact makes AsyncDisplayKit scrolling visually - * indistinguishable from UIKit's, except being faster. - * - * Using this option does not eliminate all of the performance advantages of AsyncDisplayKit. - * Normally, a cell has been preloading and is almost done when it reaches the screen, so the - * blocking time is very short. If the rangeTuningParameters are set to 0, still this option - * outperforms UIKit: while the main thread is waiting, subnode display executes concurrently. - */ -@property BOOL neverShowPlaceholders; - -/* - * The kind of supplementary element this node represents, if any. - * - * @return The supplementary element kind, or @c nil if this node does not represent a supplementary element. - */ -@property (nullable, copy, readonly) NSString *supplementaryElementKind; - -/* - * The layout attributes currently assigned to this node, if any. - * - * @discussion This property is useful because it is set before @c collectionView:willDisplayNode:forItemAtIndexPath: - * is called, when the node is not yet in the hierarchy and its frame cannot be converted to/from other nodes. Instead - * you can use the layout attributes object to learn where and how the cell will be displayed. - */ -@property (nullable, copy, readonly) UICollectionViewLayoutAttributes *layoutAttributes; - -/** - * A Boolean value that is synchronized with the underlying collection or tableView cell property. - * Setting this value is equivalent to calling selectItem / deselectItem on the collection or table. - */ -@property (getter=isSelected) BOOL selected; - -/** - * A Boolean value that is synchronized with the underlying collection or tableView cell property. - * Setting this value is equivalent to calling highlightItem / unHighlightItem on the collection or table. - */ -@property (getter=isHighlighted) BOOL highlighted; - -/** - * The current index path of this cell node, or @c nil if this node is - * not a valid item inside a table node or collection node. - */ -@property (nullable, copy, readonly) NSIndexPath *indexPath; - -/** - * BETA: API is under development. We will attempt to provide an easy migration pathway for any changes. - * - * The view-model currently assigned to this node, if any. - * - * This property may be set off the main thread, but this method will never be invoked concurrently on the - */ -@property (nullable) id nodeModel; - -/** - * Asks the node whether it can be updated to the given node model. - * - * The default implementation returns YES if the class matches that of the current view-model. - */ -- (BOOL)canUpdateToNodeModel:(id)nodeModel; - -/** - * The backing view controller, or @c nil if the node wasn't initialized with backing view controller - * @note This property must be accessed on the main thread. - */ -@property (nullable, nonatomic, readonly) UIViewController *viewController; - - -/** - * The table- or collection-node that this cell is a member of, if any. - */ -@property (nullable, weak, readonly) id owningNode; - -/* - * ASCellNode must forward touch events in order for UITableView and UICollectionView tap handling to work. Overriding - * these methods (e.g. for highlighting) requires the super method be called. - */ -- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; -- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * Called by the system when ASCellNode is used with an ASCollectionNode. It will not be called by ASTableNode. - * When the UICollectionViewLayout object returns a new UICollectionViewLayoutAttributes object, the corresponding ASCellNode will be updated. - * See UICollectionViewCell's applyLayoutAttributes: for a full description. -*/ -- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes; - -/** - * @abstract Initializes a cell with a given view controller block. - * - * @param viewControllerBlock The block that will be used to create the backing view controller. - * @param didLoadBlock The block that will be called after the view controller's view is loaded. - * - * @return An ASCellNode created using the root view of the view controller provided by the viewControllerBlock. - * The view controller's root view is resized to match the calculated size produced during layout. - * - */ -- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; - -/** - * @abstract Notifies the cell node of certain visibility events, such as changing visible rect. - * - * @warning In cases where an ASCellNode is used as a plain node – i.e. not returned from the - * nodeBlockForItemAtIndexPath/nodeForItemAtIndexPath data source methods – this method will - * deliver only the `Visible` and `Invisible` events, `scrollView` will be nil, and - * `cellFrame` will be the zero rect. - */ -- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(nullable UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame; - -#pragma mark - UITableViewCell specific passthrough properties - -/* @abstract The selection style when a tap on a cell occurs - * @default UITableViewCellSelectionStyleDefault - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - */ -@property UITableViewCellSelectionStyle selectionStyle; - -/* @abstract The focus style when a cell is focused - * @default UITableViewCellFocusStyleDefault - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - */ -@property UITableViewCellFocusStyle focusStyle; - -/* @abstract The view used as the background of the cell when it is selected. - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - * ASCollectionView uses these properties when configuring UICollectionViewCells that host ASCellNodes. - */ -@property (nullable) UIView *selectedBackgroundView; - -/* @abstract The view used as the background of the cell. - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - * ASCollectionView uses these properties when configuring UICollectionViewCells that host ASCellNodes. - */ -@property (nullable) UIView *backgroundView; - -/* @abstract The accessory type view on the right side of the cell. Please take care of your ASLayoutSpec so that doesn't overlay the accessoryView - * @default UITableViewCellAccessoryNone - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - */ -@property UITableViewCellAccessoryType accessoryType; - -/* @abstract The inset of the cell separator line - * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. - */ -@property UIEdgeInsets separatorInset; - -@end - -@interface ASCellNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (void)setLayerBacked:(BOOL)layerBacked AS_UNAVAILABLE("ASCellNode does not support layer-backing, although subnodes may be layer-backed."); - -@end - - -/** - * Simple label-style cell node. Read its source for an example of custom s. - */ -@interface ASTextCellNode : ASCellNode - -/** - * Initializes a text cell with given text attributes and text insets - */ -- (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets; - -/** - * Text to display. - */ -@property (nullable, copy) NSString *text; - -/** - * A dictionary containing key-value pairs for text attributes. You can specify the font, text color, text shadow color, and text shadow offset using the keys listed in NSString UIKit Additions Reference. - */ -@property (copy) NSDictionary *textAttributes; - -/** - * The text inset or outset for each edge. The default value is 15.0 horizontal and 11.0 vertical padding. - */ -@property UIEdgeInsets textInsets; - -/** - * The text node used by this cell node. - */ -@property (readonly) ASTextNode *textNode; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCellNode.mm b/Example/Pods/Texture/Source/ASCellNode.mm deleted file mode 100644 index 5c745119..00000000 --- a/Example/Pods/Texture/Source/ASCellNode.mm +++ /dev/null @@ -1,489 +0,0 @@ -// -// ASCellNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import - -#pragma mark - -#pragma mark ASCellNode - -@interface ASCellNode () -{ - ASDisplayNodeViewControllerBlock _viewControllerBlock; - ASDisplayNodeDidLoadBlock _viewControllerDidLoadBlock; - ASDisplayNode *_viewControllerNode; - UIViewController *_viewController; - UICollectionViewLayoutAttributes *_layoutAttributes; - BOOL _suspendInteractionDelegate; - BOOL _selected; - BOOL _highlighted; - BOOL _neverShowPlaceholders; -} - -@end - -@implementation ASCellNode -@synthesize interactionDelegate = _interactionDelegate; - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // Use UITableViewCell defaults - _selectionStyle = UITableViewCellSelectionStyleDefault; - _focusStyle = UITableViewCellFocusStyleDefault; - self.clipsToBounds = YES; - - return self; -} - -- (instancetype)initWithViewControllerBlock:(ASDisplayNodeViewControllerBlock)viewControllerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock -{ - if (!(self = [super init])) - return nil; - - ASDisplayNodeAssertNotNil(viewControllerBlock, @"should initialize with a valid block that returns a UIViewController"); - _viewControllerBlock = viewControllerBlock; - _viewControllerDidLoadBlock = didLoadBlock; - - return self; -} - -- (void)didLoad -{ - [super didLoad]; - - if (_viewControllerBlock != nil) { - - _viewController = _viewControllerBlock(); - _viewControllerBlock = nil; - - if ([_viewController isKindOfClass:[ASDKViewController class]]) { - ASDKViewController *asViewController = (ASDKViewController *)_viewController; - _viewControllerNode = asViewController.node; - [_viewController loadViewIfNeeded]; - } else { - // Careful to avoid retain cycle - UIViewController *viewController = _viewController; - _viewControllerNode = [[ASDisplayNode alloc] initWithViewBlock:^{ - return viewController.view; - }]; - } - [self addSubnode:_viewControllerNode]; - - // Since we just loaded our node, and added _viewControllerNode as a subnode, - // _viewControllerNode must have just loaded its view, so now is an appropriate - // time to execute our didLoadBlock, if we were given one. - if (_viewControllerDidLoadBlock != nil) { - _viewControllerDidLoadBlock(self); - _viewControllerDidLoadBlock = nil; - } - } -} - -- (void)layout -{ - [super layout]; - - _viewControllerNode.frame = self.bounds; -} - -- (void)_rootNodeDidInvalidateSize -{ - if (_interactionDelegate != nil) { - [_interactionDelegate nodeDidInvalidateSize:self]; - } else { - [super _rootNodeDidInvalidateSize]; - } -} - -- (void)_layoutTransitionMeasurementDidFinish -{ - if (_interactionDelegate != nil) { - [_interactionDelegate nodeDidInvalidateSize:self]; - } else { - [super _layoutTransitionMeasurementDidFinish]; - } -} - -- (BOOL)isSelected -{ - return ASLockedSelf(_selected); -} - -- (void)setSelected:(BOOL)selected -{ - if (ASLockedSelfCompareAssign(_selected, selected)) { - if (!_suspendInteractionDelegate) { - ASPerformBlockOnMainThread(^{ - [self->_interactionDelegate nodeSelectedStateDidChange:self]; - }); - } - } -} - -- (BOOL)isHighlighted -{ - return ASLockedSelf(_highlighted); -} - -- (void)setHighlighted:(BOOL)highlighted -{ - if (ASLockedSelfCompareAssign(_highlighted, highlighted)) { - if (!_suspendInteractionDelegate) { - ASPerformBlockOnMainThread(^{ - [self->_interactionDelegate nodeHighlightedStateDidChange:self]; - }); - } - } -} - -- (void)__setSelectedFromUIKit:(BOOL)selected -{ - // Note: Race condition could mean redundant sets. Risk is low. - if (ASLockedSelf(_selected != selected)) { - _suspendInteractionDelegate = YES; - self.selected = selected; - _suspendInteractionDelegate = NO; - } -} - -- (void)__setHighlightedFromUIKit:(BOOL)highlighted -{ - // Note: Race condition could mean redundant sets. Risk is low. - if (ASLockedSelf(_highlighted != highlighted)) { - _suspendInteractionDelegate = YES; - self.highlighted = highlighted; - _suspendInteractionDelegate = NO; - } -} - -- (BOOL)canUpdateToNodeModel:(id)nodeModel -{ - return [self.nodeModel class] == [nodeModel class]; -} - -- (NSIndexPath *)indexPath -{ - return [self.owningNode indexPathForNode:self]; -} - -- (UIViewController *)viewController -{ - ASDisplayNodeAssertMainThread(); - // Force the view to load so that we will create the - // view controller if we haven't already. - if (self.isNodeLoaded == NO) { - [self view]; - } - return _viewController; -} - -- (id)owningNode -{ - return self.collectionElement.owningNode; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert([self.view isKindOfClass:_ASDisplayView.class], @"ASCellNode views must be of type _ASDisplayView"); - [(_ASDisplayView *)self.view __forwardTouchesBegan:touches withEvent:event]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert([self.view isKindOfClass:_ASDisplayView.class], @"ASCellNode views must be of type _ASDisplayView"); - [(_ASDisplayView *)self.view __forwardTouchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert([self.view isKindOfClass:_ASDisplayView.class], @"ASCellNode views must be of type _ASDisplayView"); - [(_ASDisplayView *)self.view __forwardTouchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert([self.view isKindOfClass:_ASDisplayView.class], @"ASCellNode views must be of type _ASDisplayView"); - [(_ASDisplayView *)self.view __forwardTouchesCancelled:touches withEvent:event]; -} - -#pragma clang diagnostic pop - -- (UICollectionViewLayoutAttributes *)layoutAttributes -{ - return ASLockedSelf(_layoutAttributes); -} - -- (void)setLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - ASDisplayNodeAssertMainThread(); - if (ASLockedSelfCompareAssignObjects(_layoutAttributes, layoutAttributes)) { - if (layoutAttributes != nil) { - [self applyLayoutAttributes:layoutAttributes]; - } - } -} - -- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - // To be overriden by subclasses -} - -- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(UIScrollView *)scrollView withCellFrame:(CGRect)cellFrame -{ - // To be overriden by subclasses -} - -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - if (self.neverShowPlaceholders) { - [self recursivelyEnsureDisplaySynchronously:YES]; - } - [self handleVisibilityChange:YES]; -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - [self handleVisibilityChange:NO]; -} - -+ (BOOL)requestsVisibilityNotifications -{ - static NSCache *cache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - cache = [[NSCache alloc] init]; - }); - NSNumber *result = [cache objectForKey:self]; - if (result == nil) { - BOOL overrides = ASSubclassOverridesSelector([ASCellNode class], self, @selector(cellNodeVisibilityEvent:inScrollView:withCellFrame:)); - result = overrides ? (NSNumber *)kCFBooleanTrue : (NSNumber *)kCFBooleanFalse; - [cache setObject:result forKey:self]; - } - return (result == (NSNumber *)kCFBooleanTrue); -} - -- (void)handleVisibilityChange:(BOOL)isVisible -{ - if ([self.class requestsVisibilityNotifications] == NO) { - return; // The work below is expensive, and only valuable for subclasses watching visibility events. - } - - // NOTE: This assertion is failing in some apps and will be enabled soon. - // ASDisplayNodeAssert(self.isNodeLoaded, @"Node should be loaded in order for it to become visible or invisible. If not in this situation, we shouldn't trigger creating the view."); - - UIView *view = self.view; - CGRect cellFrame = CGRectZero; - - // Ensure our _scrollView is still valid before converting. It's also possible that we have already been removed from the _scrollView, - // in which case it is not valid to perform a convertRect (this actually crashes on iOS 8). - UIScrollView *scrollView = (_scrollView != nil && view.superview != nil && [view isDescendantOfView:_scrollView]) ? _scrollView : nil; - if (scrollView) { - cellFrame = [view convertRect:view.bounds toView:scrollView]; - } - - // If we did not convert, we'll pass along CGRectZero and a nil scrollView. The EventInvisible call is thus equivalent to - // didExitVisibileState, but is more convenient for the developer than implementing multiple methods. - [self cellNodeVisibilityEvent:isVisible ? ASCellNodeVisibilityEventVisible - : ASCellNodeVisibilityEventInvisible - inScrollView:scrollView - withCellFrame:cellFrame]; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [super propertiesForDebugDescription]; - - UIScrollView *scrollView = self.scrollView; - - id owningNode = self.owningNode; - if ([owningNode isKindOfClass:[ASCollectionNode class]]) { - NSIndexPath *ip = [(ASCollectionNode *)owningNode indexPathForNode:self]; - if (ip != nil) { - [result addObject:@{ @"indexPath" : ip }]; - } - [result addObject:@{ @"collectionNode" : owningNode }]; - } else if ([owningNode isKindOfClass:[ASTableNode class]]) { - NSIndexPath *ip = [(ASTableNode *)owningNode indexPathForNode:self]; - if (ip != nil) { - [result addObject:@{ @"indexPath" : ip }]; - } - [result addObject:@{ @"tableNode" : owningNode }]; - - } else if ([scrollView isKindOfClass:[ASCollectionView class]]) { - NSIndexPath *ip = [(ASCollectionView *)scrollView indexPathForNode:self]; - if (ip != nil) { - [result addObject:@{ @"indexPath" : ip }]; - } - [result addObject:@{ @"collectionView" : ASObjectDescriptionMakeTiny(scrollView) }]; - - } else if ([scrollView isKindOfClass:[ASTableView class]]) { - NSIndexPath *ip = [(ASTableView *)scrollView indexPathForNode:self]; - if (ip != nil) { - [result addObject:@{ @"indexPath" : ip }]; - } - [result addObject:@{ @"tableView" : ASObjectDescriptionMakeTiny(scrollView) }]; - } - - return result; -} - -- (NSString *)supplementaryElementKind -{ - return self.collectionElement.supplementaryElementKind; -} - -- (BOOL)supportsLayerBacking -{ - return NO; -} - -- (BOOL)shouldUseUIKitCell -{ - return NO; -} - -@end - - -#pragma mark - -#pragma mark ASWrapperCellNode - -// TODO: Consider if other calls, such as willDisplayCell, should be bridged to this class. -@implementation ASWrapperCellNode : ASCellNode - -- (BOOL)shouldUseUIKitCell -{ - return YES; -} - -@end - - -#pragma mark - -#pragma mark ASTextCellNode - -@implementation ASTextCellNode { - NSDictionary *_textAttributes; - UIEdgeInsets _textInsets; - NSString *_text; -} - -static const CGFloat kASTextCellNodeDefaultFontSize = 18.0f; -static const CGFloat kASTextCellNodeDefaultHorizontalPadding = 15.0f; -static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; - -- (instancetype)init -{ - return [self initWithAttributes:[ASTextCellNode defaultTextAttributes] insets:[ASTextCellNode defaultTextInsets]]; -} - -- (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets -{ - self = [super init]; - if (self) { - _textInsets = textInsets; - _textAttributes = [textAttributes copy]; - _textNode = [[ASTextNode alloc] init]; - self.automaticallyManagesSubnodes = YES; - } - return self; -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - return [ASInsetLayoutSpec insetLayoutSpecWithInsets:self.textInsets child:self.textNode]; -} - -+ (NSDictionary *)defaultTextAttributes -{ - return @{NSFontAttributeName : [UIFont systemFontOfSize:kASTextCellNodeDefaultFontSize]}; -} - -+ (UIEdgeInsets)defaultTextInsets -{ - return UIEdgeInsetsMake(kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding, kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding); -} - -- (NSDictionary *)textAttributes -{ - return ASLockedSelf(_textAttributes); -} - -- (void)setTextAttributes:(NSDictionary *)textAttributes -{ - ASDisplayNodeAssertNotNil(textAttributes, @"Invalid text attributes"); - ASLockScopeSelf(); - if (ASCompareAssignCopy(_textAttributes, textAttributes)) { - [self locked_updateAttributedText]; - } -} - -- (UIEdgeInsets)textInsets -{ - return ASLockedSelf(_textInsets); -} - -- (void)setTextInsets:(UIEdgeInsets)textInsets -{ - if (ASLockedSelfCompareAssignCustom(_textInsets, textInsets, UIEdgeInsetsEqualToEdgeInsets)) { - [self setNeedsLayout]; - } -} - -- (NSString *)text -{ - return ASLockedSelf(_text); -} - -- (void)setText:(NSString *)text -{ - ASLockScopeSelf(); - if (ASCompareAssignCopy(_text, text)) { - [self locked_updateAttributedText]; - } -} - -- (void)locked_updateAttributedText -{ - if (_text == nil) { - _textNode.attributedText = nil; - return; - } - - _textNode.attributedText = [[NSAttributedString alloc] initWithString:_text attributes:_textAttributes]; - [self setNeedsLayout]; -} - -@end diff --git a/Example/Pods/Texture/Source/ASCollectionNode+Beta.h b/Example/Pods/Texture/Source/ASCollectionNode+Beta.h deleted file mode 100644 index feb485ba..00000000 --- a/Example/Pods/Texture/Source/ASCollectionNode+Beta.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// ASCollectionNode+Beta.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@protocol ASCollectionViewLayoutFacilitatorProtocol, ASCollectionLayoutDelegate, ASBatchFetchingDelegate; -@class ASElementMap; - -NS_ASSUME_NONNULL_BEGIN - -@interface ASCollectionNode (Beta) - -/** - * Allows providing a custom subclass of ASCollectionView to be managed by ASCollectionNode. - * - * @default [ASCollectionView class] is used whenever this property is unset or nil. - */ -@property (nullable, nonatomic) Class collectionViewClass; - -/** - * The elements that are currently displayed. The "UIKit index space". Must be accessed on main thread. - */ -@property (nonatomic, readonly) ASElementMap *visibleElements; - -@property (nullable, readonly) id layoutDelegate; - -@property (nullable, nonatomic, weak) id batchFetchingDelegate; - -/** - * When this mode is enabled, ASCollectionView matches the timing of UICollectionView as closely as - * possible, ensuring that all reload and edit operations are performed on the main thread as - * blocking calls. - * - * This mode is useful for applications that are debugging issues with their collection view - * implementation. In particular, some applications do not properly conform to the API requirement - * of UICollectionView, and these applications may experience difficulties with ASCollectionView. - * Providing this mode allows for developers to work towards resolving technical debt in their - * collection view data source, while ramping up asynchronous collection layout. - * - * NOTE: Because this mode results in expensive operations like cell layout being performed on the - * main thread, it should be used as a tool to resolve data source conformance issues with Apple - * collection view API. - * - * @default defaults to ASCellLayoutModeNone. - */ -@property (nonatomic) ASCellLayoutMode cellLayoutMode; - -/** - * Returns YES if the ASCollectionNode contents are completely synchronized with the underlying collection-view layout. - */ -@property (nonatomic, readonly, getter=isSynchronized) BOOL synchronized; - -/** - * Schedules a block to be performed (on the main thread) as soon as the completion block is called - * on performBatchUpdates:. - * - * When isSynchronized == YES, the block is run block immediately (before the method returns). - */ -- (void)onDidFinishSynchronizing:(void (^)(void))didFinishSynchronizing; - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id)layoutFacilitator; - -- (instancetype)initWithLayoutDelegate:(id)layoutDelegate layoutFacilitator:(nullable id)layoutFacilitator; - -- (void)beginUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); - -- (void)endUpdatesAnimated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); - -- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion ASDISPLAYNODE_DEPRECATED_MSG("Use -performBatchUpdates:completion: instead."); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCollectionNode.h b/Example/Pods/Texture/Source/ASCollectionNode.h deleted file mode 100644 index fde5a130..00000000 --- a/Example/Pods/Texture/Source/ASCollectionNode.h +++ /dev/null @@ -1,956 +0,0 @@ -// -// ASCollectionNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import - -@protocol ASCollectionViewLayoutFacilitatorProtocol; -@protocol ASCollectionDelegate; -@protocol ASCollectionDataSource; -@class ASCollectionView; - -NS_ASSUME_NONNULL_BEGIN - -/** - * ASCollectionNode is a node based class that wraps an ASCollectionView. It can be used - * as a subnode of another node, and provide room for many (great) features and improvements later on. - */ -@interface ASCollectionNode : ASDisplayNode - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Initializes an ASCollectionNode - * - * @discussion Initializes and returns a newly allocated collection node object with the specified layout. - * - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout; - -/** - * Initializes an ASCollectionNode - * - * @discussion Initializes and returns a newly allocated collection node object with the specified frame and layout. - * - * @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization. - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout; - -/** - * Returns the corresponding ASCollectionView - * - * @return view The corresponding ASCollectionView. - */ -@property (readonly) ASCollectionView *view; - -/** - * The object that acts as the asynchronous delegate of the collection view - * - * @discussion The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object. - * - * The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin. - * @note This is a convenience method which sets the asyncDelegate on the collection node's collection view. - */ -@property (nullable, weak) id delegate; - -/** - * The object that acts as the asynchronous data source of the collection view - * - * @discussion The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object. - * - * The datasource object is responsible for providing nodes or node creation blocks to the collection view. - * @note This is a convenience method which sets the asyncDatasource on the collection node's collection view. - */ -@property (nullable, weak) id dataSource; - -/** - * The number of screens left to scroll before the delegate -collectionNode:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic) CGFloat leadingScreensForBatching; - -/* - * A Boolean value that determines whether the collection node will be flipped. - * If the value of this property is YES, the first cell node will be at the bottom of the collection node (as opposed to the top by default). This is useful for chat/messaging apps. The default value is NO. - */ -@property (nonatomic) BOOL inverted; - -/** - * A Boolean value that indicates whether users can select items in the collection node. - * If the value of this property is YES (the default), users can select items. If you want more fine-grained control over the selection of items, you must provide a delegate object and implement the appropriate methods of the UICollectionNodeDelegate protocol. - */ -@property (nonatomic) BOOL allowsSelection; - -/** - * A Boolean value that determines whether users can select more than one item in the collection node. - * This property controls whether multiple items can be selected simultaneously. The default value of this property is NO. - * When the value of this property is YES, tapping a cell adds it to the current selection (assuming the delegate permits the cell to be selected). Tapping the cell again removes it from the selection. - */ -@property (nonatomic) BOOL allowsMultipleSelection; - -/** - * A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content. - * The default value of this property is NO. - */ -@property (nonatomic) BOOL alwaysBounceVertical; - -/** - * A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the content view. - * The default value of this property is NO. - */ -@property (nonatomic) BOOL alwaysBounceHorizontal; - -/** - * A Boolean value that controls whether the vertical scroll indicator is visible. - * The default value of this property is YES. - */ -@property (nonatomic) BOOL showsVerticalScrollIndicator; - -/** - * A Boolean value that controls whether the horizontal scroll indicator is visible. - * The default value of this property is YES. - */ -@property (nonatomic) BOOL showsHorizontalScrollIndicator; - -/** - * A Boolean value that determines whether paging is enabled for the scroll view. - * The default value of this property is NO. - */ -@property (nonatomic, getter=isPagingEnabled) BOOL pagingEnabled __TVOS_PROHIBITED; - -/** - * The layout used to organize the node's items. - * - * @discussion Assigning a new layout object to this property causes the new layout to be applied (without animations) to the node’s items. - */ -@property (nonatomic) UICollectionViewLayout *collectionViewLayout; - -/** - * Optional introspection object for the collection node's layout. - * - * @discussion Since supplementary and decoration nodes are controlled by the layout, this object - * is used as a bridge to provide information to the internal data controller about the existence of these views and - * their associated index paths. For collections using `UICollectionViewFlowLayout`, a default inspector - * implementation `ASCollectionViewFlowLayoutInspector` is created and set on this property by default. Custom - * collection layout subclasses will need to provide their own implementation of an inspector object for their - * supplementary elements to be compatible with `ASCollectionNode`'s supplementary node support. - */ -@property (nonatomic, weak) id layoutInspector; - -/** - * The distance that the content view is inset from the collection node edges. Defaults to UIEdgeInsetsZero. - */ -@property (nonatomic) UIEdgeInsets contentInset; - -/** - * The offset of the content view's origin from the collection node's origin. Defaults to CGPointZero. - */ -@property (nonatomic) CGPoint contentOffset; - -/** - * Sets the offset from the content node’s origin to the collection node’s origin. - * - * @param contentOffset The offset - * - * @param animated YES to animate to this new offset at a constant velocity, NO to not aniamte and immediately make the transition. - */ -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType; - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -/** - * Scrolls the collection to the given item. - * - * @param indexPath The index path of the item. - * @param scrollPosition Where the item should end up after the scroll. - * @param animated Whether the scroll should be animated or not. - * - * This method must be called on the main thread. - */ -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated; - -/** - * Determines collection node's current scroll direction. Supports 2-axis collection nodes. - * - * @return a bitmask of ASScrollDirection values. - */ -@property (nonatomic, readonly) ASScrollDirection scrollDirection; - -/** - * Determines collection node's scrollable directions. - * - * @return a bitmask of ASScrollDirection values. - */ -@property (nonatomic, readonly) ASScrollDirection scrollableDirections; - -#pragma mark - Editing - -/** - * Registers the given kind of supplementary node for use in creating node-backed supplementary elements. - * - * @param elementKind The kind of supplementary node that will be requested through the data source. - * - * @discussion Use this method to register support for the use of supplementary nodes in place of the default - * `registerClass:forSupplementaryViewOfKind:withReuseIdentifier:` and `registerNib:forSupplementaryViewOfKind:withReuseIdentifier:` - * methods. This method will register an internal backing view that will host the contents of the supplementary nodes - * returned from the data source. - */ -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind; - -/** - * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. - * The data source must be updated to reflect the changes before the update block completes. - * - * @param animated NO to disable animations for this batch - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. - * The data source must be updated to reflect the changes before the update block completes. - * - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Returns YES if the ASCollectionNode is still processing changes from performBatchUpdates:. - * This is typically the concurrent allocation (calling nodeBlocks) and layout of newly inserted - * ASCellNodes. If YES is returned, then calling -waitUntilAllUpdatesAreProcessed may take tens of - * milliseconds to return as it blocks on these concurrent operations. - * - * Returns NO if ASCollectionNode is fully synchronized with the underlying UICollectionView. This - * means that until the next performBatchUpdates: is called, it is safe to compare UIKit values - * (such as from UICollectionViewLayout) with your app's data source. - * - * This method will always return NO if called immediately after -waitUntilAllUpdatesAreProcessed. - */ -@property (nonatomic, readonly) BOOL isProcessingUpdates; - -/** - * Schedules a block to be performed (on the main thread) after processing of performBatchUpdates: - * is finished (completely synchronized to UIKit). The blocks will be run at the moment that - * -isProcessingUpdates changes from YES to NO; - * - * When isProcessingUpdates == NO, the block is run block immediately (before the method returns). - * - * Blocks scheduled by this mechanism are NOT guaranteed to run in the order they are scheduled. - * They may also be delayed if performBatchUpdates continues to be called; the blocks will wait until - * all running updates are finished. - * - * Calling -waitUntilAllUpdatesAreProcessed is one way to flush any pending update completion blocks. - */ -- (void)onDidFinishProcessingUpdates:(void (^)(void))didFinishProcessingUpdates; - -/** - * Blocks execution of the main thread until all section and item updates are committed to the view. This method must be called from the main thread. - */ -- (void)waitUntilAllUpdatesAreProcessed; - -/** - * Inserts one or more sections. - * - * @param sections An index set that specifies the sections to insert. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)insertSections:(NSIndexSet *)sections; - -/** - * Deletes one or more sections. - * - * @param sections An index set that specifies the sections to delete. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteSections:(NSIndexSet *)sections; - -/** - * Reloads the specified sections. - * - * @param sections An index set that specifies the sections to reload. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadSections:(NSIndexSet *)sections; - -/** - * Moves a section to a new location. - * - * @param section The index of the section to move. - * - * @param newSection The index that is the destination of the move for the section. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; - -/** - * Inserts items at the locations identified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects, each representing an item index and section index that together identify an item. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Deletes the items specified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to delete. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Reloads the specified items. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to reload. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Moves the item at a specified location to a destination location. - * - * @param indexPath The index path identifying the item to move. - * - * @param newIndexPath The index path that is the destination of the move for the item. - * - * @discussion This method must be called from the main thread. The data source must be updated to reflect the changes - * before this method is called. - */ -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on - * the main thread. - * @warning This method is substantially more expensive than UICollectionView's version. - */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion; - - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @warning This method is substantially more expensive than UICollectionView's version. - */ -- (void)reloadData; - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the collection view. - */ -- (void)relayoutItems; - -#pragma mark - Selection - -/** - * The index paths of the selected items, or @c nil if no items are selected. - */ -@property (nullable, nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems; - -/** - * Selects the item at the specified index path and optionally scrolls it into view. - * If the `allowsSelection` property is NO, calling this method has no effect. If there is an existing selection with a different index path and the `allowsMultipleSelection` property is NO, calling this method replaces the previous selection. - * This method does not cause any selection-related delegate methods to be called. - * - * @param indexPath The index path of the item to select. Specifying nil for this parameter clears the current selection. - * - * @param animated Specify YES to animate the change in the selection or NO to make the change without animating it. - * - * @param scrollPosition An option that specifies where the item should be positioned when scrolling finishes. For a list of possible values, see `UICollectionViewScrollPosition`. - * - * @discussion This method must be called from the main thread. - */ -- (void)selectItemAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition; - -/** - * Deselects the item at the specified index. - * If the allowsSelection property is NO, calling this method has no effect. - * This method does not cause any selection-related delegate methods to be called. - * - * @param indexPath The index path of the item to select. Specifying nil for this parameter clears the current selection. - * - * @param animated Specify YES to animate the change in the selection or NO to make the change without animating it. - * - * @discussion This method must be called from the main thread. - */ -- (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; - -#pragma mark - Querying Data - -/** - * Retrieves the number of items in the given section. - * - * @param section The section. - * - * @return The number of items. - */ -- (NSInteger)numberOfItemsInSection:(NSInteger)section AS_WARN_UNUSED_RESULT; - -/** - * The number of sections. - */ -@property (nonatomic, readonly) NSInteger numberOfSections; - -/** - * Similar to -visibleCells. - * - * @return an array containing the nodes being displayed on screen. This must be called on the main thread. - */ -@property (nonatomic, readonly) NSArray<__kindof ASCellNode *> *visibleNodes; - -/** - * Retrieves the node for the item at the given index path. - * - * @param indexPath The index path of the requested item. - * - * @return The node for the given item, or @c nil if no item exists at the specified path. - */ -- (nullable __kindof ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Retrieves the node-model for the item at the given index path, if any. - * - * @param indexPath The index path of the requested item. - * - * @return The node-model for the given item, or @c nil if no item exists at the specified path or no node-model was provided. - * - * @warning This API is beta and subject to change. We'll try to provide an easy migration path. - */ -- (nullable id)nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Retrieve the index path for the item with the given node. - * - * @param cellNode A node for an item in the collection node. - * - * @return The indexPath for this item. - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; - -/** - * Retrieve the index paths of all visible items. - * - * @return an array containing the index paths of all visible items. This must be called on the main thread. - */ -@property (nonatomic, readonly) NSArray *indexPathsForVisibleItems; - -/** - * Retrieve the index path of the item at the given point. - * - * @param point The point of the requested item. - * - * @return The indexPath for the item at the given point. This must be called on the main thread. - */ -- (nullable NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point AS_WARN_UNUSED_RESULT; - -/** - * Retrieve the cell at the given index path. - * - * @param indexPath The index path of the requested item. - * - * @return The cell for the given index path. This must be called on the main thread. - */ -- (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Retrieves the context object for the given section, as provided by the data source in - * the @c collectionNode:contextForSection: method. - * - * @param section The section to get the context for. - * - * @return The context object, or @c nil if no context was provided. - * - * TODO: This method currently accepts @c section in the _view_ index space, but it should - * be in the node index space. To get the context in the view index space (e.g. for subclasses - * of @c UICollectionViewLayout, the user will call the same method on @c ASCollectionView. - */ -- (nullable id)contextForSection:(NSInteger)section AS_WARN_UNUSED_RESULT; - -@end - -@interface ASCollectionNode (Deprecated) - -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); - -@end - -/** - * This is a node-based UICollectionViewDataSource. - */ -@protocol ASCollectionDataSource - -@optional - -/** - * Asks the data source for the number of items in the given section of the collection node. - * - * @see @c collectionView:numberOfItemsInSection: - */ -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section; - -/** - * Asks the data source for the number of sections in the collection node. - * - * @see @c numberOfSectionsInCollectionView: - */ -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode; - -/** - * --BETA-- - * Asks the data source for a view-model for the item at the given index path. - * - * @param collectionNode The sender. - * @param indexPath The index path of the item. - * - * @return An object that contains all the data for this item. - */ -- (nullable id)collectionNode:(ASCollectionNode *)collectionNode nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Similar to -collectionNode:nodeForItemAtIndexPath: - * This method takes precedence over collectionNode:nodeForItemAtIndexPath: if implemented. - * - * @param collectionNode The sender. - * @param indexPath The index path of the item. - * - * @return a block that creates the node for display for this item. - * Must be thread-safe (can be called on the main thread or a background - * queue) and should not implement reuse (it will be called once per row). - */ -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Similar to -collectionView:cellForItemAtIndexPath:. - * - * @param collectionNode The sender. - * @param indexPath The index path of the item. - * - * @return A node to display for the given item. This will be called on the main thread and should - * not implement reuse (it will be called once per item). Unlike UICollectionView's version, - * this method is not called when the item is about to display. - */ -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Asks the data source to provide a node-block to display for the given supplementary element in the collection view. - * - * @param collectionNode The sender. - * @param kind The kind of supplementary element. - * @param indexPath The index path of the supplementary element. - */ -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - -/** - * Asks the data source to provide a node to display for the given supplementary element in the collection view. - * - * @param collectionNode The sender. - * @param kind The kind of supplementary element. - * @param indexPath The index path of the supplementary element. - */ -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - -/** - * Asks the data source to provide a context object for the given section. This object - * can later be retrieved by calling @c contextForSection: and is useful when implementing - * custom @c UICollectionViewLayout subclasses. The context object is ret - * - * @param collectionNode The sender. - * @param section The index of the section to provide context for. - * - * @return A context object to assign to the given section, or @c nil. - */ -- (nullable id)collectionNode:(ASCollectionNode *)collectionNode contextForSection:(NSInteger)section; - -/** - * Asks the data source to provide an array of supplementary element kinds that exist in a given section. - * - * @param collectionNode The sender. - * @param section The index of the section to provide supplementary kinds for. - * - * @return The supplementary element kinds that exist in the given section, if any. - */ -- (NSArray *)collectionNode:(ASCollectionNode *)collectionNode supplementaryElementKindsInSection:(NSInteger)section; - -/** - * Asks the data source if it's possible to move the specified item interactively. - * - * See @p -[UICollectionViewDataSource collectionView:canMoveItemAtIndexPath:] @c. - * - * @param collectionNode The sender. - * @param node The display node for the item that may be moved. - * - * @return Whether the item represented by @p node may be moved. - */ -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode canMoveItemWithNode:(ASCellNode *)node; - -/** - * Called when the user has interactively moved an item. The data source - * should update its internal data store to reflect the move. Note that you - * should not call [collectionNode moveItemAtIndexPath:toIndexPath:] – the - * collection node's internal state will be updated automatically. - * - * * See @p -[UICollectionViewDataSource collectionView:moveItemAtIndexPath:toIndexPath:] @c. - * - * @param collectionNode The sender. - * @param sourceIndexPath The original item index path. - * @param destinationIndexPath The new item index path. - */ -- (void)collectionNode:(ASCollectionNode *)collectionNode moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath; - -/** - * Generate a unique identifier for an element in a collection. This helps state restoration persist the scroll position - * of a collection view even when the data in that table changes. See the documentation for UIDataSourceModelAssociation for more information. - * - * @param indexPath The index path of the requested node. - * - * @param collectionNode The sender. - * - * @return a unique identifier for the element at the given path. Return nil if the index path does not exist in the collection. - */ -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inNode:(ASCollectionNode *)collectionNode; - -/** - * Similar to -collectionView:cellForItemAtIndexPath:. See the documentation for UIDataSourceModelAssociation for more information. - * - * @param identifier The model identifier of the element, previously generated by a call to modelIdentifierForElementAtIndexPath - * - * @param collectionNode The sender. - * - * @return the index path to the current position of the matching element in the collection. Return nil if the element is not found. - */ -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inNode:(ASCollectionNode *)collectionNode; - -/** - * Similar to -collectionView:cellForItemAtIndexPath:. - * - * @param collectionView The sender. - * - * @param indexPath The index path of the requested node. - * - * @return a node for display at this indexpath. This will be called on the main thread and should - * not implement reuse (it will be called once per row). Unlike UICollectionView's version, - * this method is not called when the row is about to display. - */ -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Similar to -collectionView:nodeForItemAtIndexPath: - * This method takes precedence over collectionView:nodeForItemAtIndexPath: if implemented. - * - * @param collectionView The sender. - * - * @param indexPath The index path of the requested node. - * - * @return a block that creates the node for display at this indexpath. - * Must be thread-safe (can be called on the main thread or a background - * queue) and should not implement reuse (it will be called once per row). - */ -- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Asks the collection view to provide a supplementary node to display in the collection view. - * - * @param collectionView An object representing the collection view requesting this information. - * @param kind The kind of supplementary node to provide. - * @param indexPath The index path that specifies the location of the new supplementary node. - */ -- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Indicator to lock the data source for data fetching in async mode. - * We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception - * due to the data access in async mode. - * - * @param collectionView The sender. - * @deprecated The data source is always accessed on the main thread, and this method will not be called. - */ -- (void)collectionViewLockDataSource:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); - -/** - * Indicator to unlock the data source for data fetching in async mode. - * We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception - * due to the data access in async mode. - * - * @param collectionView The sender. - * @deprecated The data source is always accessed on the main thread, and this method will not be called. - */ -- (void)collectionViewUnlockDataSource:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); - -@end - -/** - * This is a node-based UICollectionViewDelegate. - */ -@protocol ASCollectionDelegate - -@optional - -/** - * Provides the constrained size range for measuring the given item. - * - * @param collectionNode The sender. - * - * @param indexPath The index path of the item. - * - * @return A constrained size range for layout for the item at this index path. - */ -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath; - -- (void)collectionNode:(ASCollectionNode *)collectionNode willDisplayItemWithNode:(ASCellNode *)node; - -- (void)collectionNode:(ASCollectionNode *)collectionNode didEndDisplayingItemWithNode:(ASCellNode *)node; - -- (void)collectionNode:(ASCollectionNode *)collectionNode willDisplaySupplementaryElementWithNode:(ASCellNode *)node NS_AVAILABLE_IOS(8_0); -- (void)collectionNode:(ASCollectionNode *)collectionNode didEndDisplayingSupplementaryElementWithNode:(ASCellNode *)node; - -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionNode:(ASCollectionNode *)collectionNode didHighlightItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionNode:(ASCollectionNode *)collectionNode didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionNode:(ASCollectionNode *)collectionNode didSelectItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionNode:(ASCollectionNode *)collectionNode didDeselectItemAtIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)collectionNode:(ASCollectionNode *)collectionNode canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath sender:(nullable id)sender; -- (void)collectionNode:(ASCollectionNode *)collectionNode performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath sender:(nullable id)sender; - -/** - * Receive a message that the collection node is near the end of its data set and more data should be fetched if - * necessary. - * - * @param collectionNode The sender. - * @param context A context object that must be notified when the batch fetch is completed. - * - * @discussion You must eventually call -completeBatchFetching: with an argument of YES in order to receive future - * notifications to do batch fetches. This method is called on a background queue. - * - * ASCollectionNode currently only supports batch events for tail loads. If you require a head load, consider - * implementing a UIRefreshControl. - */ -- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context; - -/** - * Tell the collection node if batch fetching should begin. - * - * @param collectionNode The sender. - * - * @discussion Use this method to conditionally fetch batches. Example use cases are: limiting the total number of - * objects that can be fetched or no network connection. - * - * If not implemented, the collection node assumes that it should notify its asyncDelegate when batch fetching - * should occur. - */ -- (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode; - -/** - * Provides the constrained size range for measuring the node at the index path. - * - * @param collectionView The sender. - * - * @param indexPath The index path of the node. - * - * @return A constrained size range for layout the node at this index path. - */ -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's constrainedSizeForItemAtIndexPath: instead. PLEASE NOTE the very subtle method name change."); - -/** - * Informs the delegate that the collection view will add the given node - * at the given index path to the view hierarchy. - * - * @param collectionView The sender. - * @param node The node that will be displayed. - * @param indexPath The index path of the item that will be displayed. - * - * @warning AsyncDisplayKit processes collection view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - */ -- (void)collectionView:(ASCollectionView *)collectionView willDisplayNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Informs the delegate that the collection view did remove the provided node from the view hierarchy. - * This may be caused by the node scrolling out of view, or by deleting the item - * or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: . - * - * @param collectionView The sender. - * @param node The node which was removed from the view hierarchy. - * @param indexPath The index path at which the node was located before it was removed. - * - * @warning AsyncDisplayKit processes collection view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - */ -- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNode:(ASCellNode *)node forItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -- (void)collectionView:(ASCollectionView *)collectionView willBeginBatchFetchWithContext:(ASBatchContext *)context ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Tell the collectionView if batch fetching should begin. - * - * @param collectionView The sender. - * - * @discussion Use this method to conditionally fetch batches. Example use cases are: limiting the total number of - * objects that can be fetched or no network connection. - * - * If not implemented, the collectionView assumes that it should notify its asyncDelegate when batch fetching - * should occur. - */ -- (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -/** - * Informs the delegate that the collection view will add the node - * at the given index path to the view hierarchy. - * - * @param collectionView The sender. - * @param indexPath The index path of the item that will be displayed. - * - * @warning AsyncDisplayKit processes collection view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - * - * This method is deprecated. Use @c collectionView:willDisplayNode:forItemAtIndexPath: instead. - */ -- (void)collectionView:(ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -@end - -@protocol ASCollectionDataSourceInterop - -/** - * This method offers compatibility with synchronous, standard UICollectionViewCell objects. - * These cells will **not** have the performance benefits of ASCellNodes (like preloading, async layout, and - * async drawing) - even when mixed within the same ASCollectionNode. - * - * In order to use this method, you must: - * 1. Implement it on your ASCollectionDataSource object. - * 2. Call registerCellClass: on the collectionNode.view (in viewDidLoad, or register an onDidLoad: block). - * 3. Return nil from the nodeBlockForItem...: or nodeForItem...: method. NOTE: it is an error to return - * nil from within a nodeBlock, if you have returned a nodeBlock object. - * 4. Lastly, you must implement a method to provide the size for the cell. There are two ways this is done: - * 4a. UICollectionViewFlowLayout (incl. ASPagerNode). Implement - collectionNode:constrainedSizeForItemAtIndexPath:. - * 4b. Custom collection layouts. Set .layoutInspector and have it implement - collectionView:constrainedSizeForNodeAtIndexPath:. - * - * For an example of using this method with all steps above (including a custom layout, 4b.), - * see the app in examples/CustomCollectionView and enable kShowUICollectionViewCells = YES. - */ -- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; - -@optional - -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - -/** - * Implement this property and return YES if you want your interop data source to be - * used when dequeuing cells for node-backed items. - * - * If NO (the default), the interop data source will only be consulted in cases - * where no ASCellNode was provided to AsyncDisplayKit. - * - * If YES, the interop data source will always be consulted to dequeue cells, and - * will be expected to return _ASCollectionViewCells in cases where a node was provided. - * - * The default value is NO. - */ -@property (class, nonatomic, readonly) BOOL dequeuesCellsForNodeBackedItems; - -@end - -@protocol ASCollectionDelegateInterop - -@optional - -- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath; - -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath; - -- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath; - -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCollectionNode.mm b/Example/Pods/Texture/Source/ASCollectionNode.mm deleted file mode 100644 index 77ac1fa1..00000000 --- a/Example/Pods/Texture/Source/ASCollectionNode.mm +++ /dev/null @@ -1,1236 +0,0 @@ -// -// ASCollectionNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#pragma mark - _ASCollectionPendingState - -@interface _ASCollectionPendingState : NSObject { -@public - std::vector> _tuningParameters; - - // Keep these enums by the bitfield struct to save memory. - ASLayoutRangeMode _rangeMode; - ASCellLayoutMode _cellLayoutMode; - struct { - unsigned int allowsSelection:1; // default is YES - unsigned int allowsMultipleSelection:1; // default is NO - unsigned int inverted:1; //default is NO - unsigned int alwaysBounceVertical:1; - unsigned int alwaysBounceHorizontal:1; - unsigned int animatesContentOffset:1; - unsigned int showsVerticalScrollIndicator:1; - unsigned int showsHorizontalScrollIndicator:1; - unsigned int pagingEnabled:1; - } _flags; -} -@property (nonatomic, weak) id delegate; -@property (nonatomic, weak) id dataSource; -@property (nonatomic) UICollectionViewLayout *collectionViewLayout; -@property (nonatomic) ASLayoutRangeMode rangeMode; -@property (nonatomic) BOOL allowsSelection; // default is YES -@property (nonatomic) BOOL allowsMultipleSelection; // default is NO -@property (nonatomic) BOOL inverted; //default is NO -@property (nonatomic) ASCellLayoutMode cellLayoutMode; -@property (nonatomic) CGFloat leadingScreensForBatching; -@property (nonatomic, weak) id layoutInspector; -@property (nonatomic) BOOL alwaysBounceVertical; -@property (nonatomic) BOOL alwaysBounceHorizontal; -@property (nonatomic) UIEdgeInsets contentInset; -@property (nonatomic) CGPoint contentOffset; -@property (nonatomic) BOOL animatesContentOffset; -@property (nonatomic) BOOL showsVerticalScrollIndicator; -@property (nonatomic) BOOL showsHorizontalScrollIndicator; -@property (nonatomic) BOOL pagingEnabled; -@end - -@implementation _ASCollectionPendingState - -#pragma mark Lifecycle - -- (instancetype)init -{ - self = [super init]; - if (self) { - _rangeMode = ASLayoutRangeModeUnspecified; - _tuningParameters = [ASAbstractLayoutController defaultTuningParameters]; - _flags.allowsSelection = YES; - _flags.allowsMultipleSelection = NO; - _flags.inverted = NO; - _contentInset = UIEdgeInsetsZero; - _contentOffset = CGPointZero; - _flags.animatesContentOffset = NO; - _flags.showsVerticalScrollIndicator = YES; - _flags.showsHorizontalScrollIndicator = YES; - _flags.pagingEnabled = NO; - } - return self; -} - -#pragma mark Properties - -- (ASLayoutRangeMode)rangeMode -{ - return _rangeMode; -} - -- (void)setRangeMode:(ASLayoutRangeMode)rangeMode -{ - _rangeMode = rangeMode; -} - -- (ASCellLayoutMode)cellLayoutMode -{ - return _cellLayoutMode; -} - -- (void)setCellLayoutMode:(ASCellLayoutMode)cellLayoutMode -{ - _cellLayoutMode = cellLayoutMode; -} - -- (BOOL)allowsSelection -{ - return _flags.allowsSelection; -} - -- (void)setAllowsSelection:(BOOL)allowsSelection -{ - _flags.allowsSelection = allowsSelection; -} - -- (BOOL)allowsMultipleSelection -{ - return _flags.allowsMultipleSelection; -} - -- (void)setAllowsMultipleSelection:(BOOL)allowsMultipleSelection -{ - _flags.allowsMultipleSelection = allowsMultipleSelection; -} - -- (BOOL)inverted -{ - return _flags.inverted; -} - --(void)setInverted:(BOOL)inverted -{ - _flags.inverted = inverted; -} - --(BOOL)alwaysBounceVertical -{ - return _flags.alwaysBounceVertical; -} - --(void)setAlwaysBounceVertical:(BOOL)alwaysBounceVertical -{ - _flags.alwaysBounceVertical = alwaysBounceVertical; -} - --(BOOL)alwaysBounceHorizontal -{ - return _flags.alwaysBounceHorizontal; -} - --(void)setAlwaysBounceHorizontal:(BOOL)alwaysBounceHorizontal -{ - _flags.alwaysBounceHorizontal = alwaysBounceHorizontal; -} - -- (BOOL)animatesContentOffset -{ - return _flags.animatesContentOffset; -} - --(void)setAnimatesContentOffset:(BOOL)animatesContentOffset -{ - _flags.animatesContentOffset = animatesContentOffset; -} - -- (BOOL)showsVerticalScrollIndicator -{ - return _flags.showsVerticalScrollIndicator; -} - -- (void)setShowsVerticalScrollIndicator:(BOOL)showsVerticalScrollIndicator -{ - _flags.showsVerticalScrollIndicator = showsVerticalScrollIndicator; -} - --(BOOL)showsHorizontalScrollIndicator -{ - return _flags.showsHorizontalScrollIndicator; -} - -- (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator -{ - _flags.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator; -} - --(BOOL)pagingEnabled -{ - return _flags.pagingEnabled; -} - -- (void)setPagingEnabled:(BOOL)pagingEnabled -{ - _flags.pagingEnabled = pagingEnabled; -} - -#pragma mark Tuning Parameters - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - return [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Requesting a range that is OOB for the configured tuning parameters"); - return _tuningParameters[rangeMode][rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Setting a range that is OOB for the configured tuning parameters"); - _tuningParameters[rangeMode][rangeType] = tuningParameters; -} - -@end - -#pragma mark - ASCollectionNode - -@interface ASCollectionNode () -{ - AS::RecursiveMutex _environmentStateLock; - Class _collectionViewClass; - id _batchFetchingDelegate; -} -@property (nonatomic) _ASCollectionPendingState *pendingState; -@property (nonatomic, weak) ASRangeController *rangeController; -@end - -@implementation ASCollectionNode - -#pragma mark Lifecycle - -- (Class)collectionViewClass -{ - return _collectionViewClass ? : [ASCollectionView class]; -} - -- (void)setCollectionViewClass:(Class)collectionViewClass -{ - if (_collectionViewClass != collectionViewClass) { - ASDisplayNodeAssert([collectionViewClass isSubclassOfClass:[ASCollectionView class]] || collectionViewClass == Nil, @"ASCollectionNode requires that .collectionViewClass is an ASCollectionView subclass"); - ASDisplayNodeAssert([self isNodeLoaded] == NO, @"ASCollectionNode's .collectionViewClass cannot be changed after the view is loaded"); - _collectionViewClass = collectionViewClass; - } -} - -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout -{ - return [self initWithFrame:CGRectZero collectionViewLayout:layout layoutFacilitator:nil]; -} - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout -{ - return [self initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil]; -} - -- (instancetype)initWithLayoutDelegate:(id)layoutDelegate layoutFacilitator:(id)layoutFacilitator -{ - return [self initWithFrame:CGRectZero collectionViewLayout:[[ASCollectionLayout alloc] initWithLayoutDelegate:layoutDelegate] layoutFacilitator:layoutFacilitator]; -} - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id)layoutFacilitator -{ - if (self = [super init]) { - // Must call the setter here to make sure pendingState is created and the layout is configured. - [self setCollectionViewLayout:layout]; - - __weak __typeof__(self) weakSelf = self; - [self setViewBlock:^{ - __typeof__(self) strongSelf = weakSelf; - return [[[strongSelf collectionViewClass] alloc] _initWithFrame:frame collectionViewLayout:strongSelf->_pendingState.collectionViewLayout layoutFacilitator:layoutFacilitator owningNode:strongSelf]; - }]; - } - return self; -} - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED -- (void)dealloc -{ - if (self.nodeLoaded) { - __weak UIView *view = self.view; - ASPerformBlockOnMainThread(^{ - ASDisplayNodeCAssertNil(view.superview, @"Node's view should be removed from hierarchy."); - }); - } -} -#endif - -#pragma mark ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - ASCollectionView *view = self.view; - view.collectionNode = self; - - _rangeController = view.rangeController; - - if (_pendingState) { - _ASCollectionPendingState *pendingState = _pendingState; - self.pendingState = nil; - view.asyncDelegate = pendingState.delegate; - view.asyncDataSource = pendingState.dataSource; - view.inverted = pendingState.inverted; - view.allowsSelection = pendingState.allowsSelection; - view.allowsMultipleSelection = pendingState.allowsMultipleSelection; - view.cellLayoutMode = pendingState.cellLayoutMode; - view.layoutInspector = pendingState.layoutInspector; - view.showsVerticalScrollIndicator = pendingState.showsVerticalScrollIndicator; - view.showsHorizontalScrollIndicator = pendingState.showsHorizontalScrollIndicator; -#if !TARGET_OS_TV - view.pagingEnabled = pendingState.pagingEnabled; -#endif - - // Only apply these flags if they're enabled; the view might come with them turned on. - if (pendingState.alwaysBounceVertical) { - view.alwaysBounceVertical = YES; - } - if (pendingState.alwaysBounceHorizontal) { - view.alwaysBounceHorizontal = YES; - } - - UIEdgeInsets contentInset = pendingState.contentInset; - if (!UIEdgeInsetsEqualToEdgeInsets(contentInset, UIEdgeInsetsZero)) { - view.contentInset = contentInset; - } - - CGPoint contentOffset = pendingState.contentOffset; - if (!CGPointEqualToPoint(contentOffset, CGPointZero)) { - [view setContentOffset:contentOffset animated:pendingState.animatesContentOffset]; - } - - const auto tuningParametersVector = pendingState->_tuningParameters; - const auto tuningParametersVectorSize = tuningParametersVector.size(); - for (NSInteger rangeMode = 0; rangeMode < tuningParametersVectorSize; rangeMode++) { - const auto tuningparametersRangeModeVector = tuningParametersVector[rangeMode]; - const auto tuningParametersVectorRangeModeSize = tuningparametersRangeModeVector.size(); - for (NSInteger rangeType = 0; rangeType < tuningParametersVectorRangeModeSize; rangeType++) { - ASRangeTuningParameters tuningParameters = tuningparametersRangeModeVector[rangeType]; - [_rangeController setTuningParameters:tuningParameters - forRangeMode:(ASLayoutRangeMode)rangeMode - rangeType:(ASLayoutRangeType)rangeType]; - } - } - - if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { - [_rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; - } - - // Don't need to set collectionViewLayout to the view as the layout was already used to init the view in view block. - } -} - -- (ASCollectionView *)view -{ - return (ASCollectionView *)[super view]; -} - -- (void)clearContents -{ - [super clearContents]; - [self.rangeController clearContents]; -} - -- (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState -{ - [super interfaceStateDidChange:newState fromState:oldState]; - [ASRangeController layoutDebugOverlayIfNeeded]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - // ASCollectionNode is often nested inside of other collections. In this case, ASHierarchyState's RangeManaged bit will be set. - // Intentionally allocate the view here and trigger a layout pass on it, which in turn will trigger the intial data load. - // We can get rid of this call later when ASDataController, ASRangeController and ASCollectionLayout can operate without the view. - // TODO (ASCL) If this node supports async layout, kick off the initial data load without allocating the view - if (ASHierarchyStateIncludesRangeManaged(self.hierarchyState) && CGRectEqualToRect(self.bounds, CGRectZero) == NO) { - [self.view layoutIfNeeded]; - } -} - -#if ASRangeControllerLoggingEnabled -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - NSLog(@"%@ - visible: YES", self); -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - NSLog(@"%@ - visible: NO", self); -} -#endif - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - [self.rangeController clearPreloadedData]; -} - -#pragma mark Setter / Getter - -// TODO: Implement this without the view. Then revisit ASLayoutElementCollectionTableSetTraitCollection -- (ASDataController *)dataController -{ - return self.view.dataController; -} - -- (_ASCollectionPendingState *)pendingState -{ - if (!_pendingState && ![self isNodeLoaded]) { - self.pendingState = [[_ASCollectionPendingState alloc] init]; - } - ASDisplayNodeAssert(![self isNodeLoaded] || !_pendingState, @"ASCollectionNode should not have a pendingState once it is loaded"); - return _pendingState; -} - -- (void)setInverted:(BOOL)inverted -{ - self.transform = inverted ? CATransform3DMakeScale(1, -1, 1) : CATransform3DIdentity; - if ([self pendingState]) { - _pendingState.inverted = inverted; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.inverted = inverted; - } -} - -- (BOOL)inverted -{ - if ([self pendingState]) { - return _pendingState.inverted; - } else { - return self.view.inverted; - } -} - -- (void)setLayoutInspector:(id)layoutInspector -{ - if ([self pendingState]) { - _pendingState.layoutInspector = layoutInspector; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.layoutInspector = layoutInspector; - } -} - -- (id)layoutInspector -{ - if ([self pendingState]) { - return _pendingState.layoutInspector; - } else { - return self.view.layoutInspector; - } -} - -- (void)setLeadingScreensForBatching:(CGFloat)leadingScreensForBatching -{ - if ([self pendingState]) { - _pendingState.leadingScreensForBatching = leadingScreensForBatching; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.leadingScreensForBatching = leadingScreensForBatching; - } -} - -- (CGFloat)leadingScreensForBatching -{ - if ([self pendingState]) { - return _pendingState.leadingScreensForBatching; - } else { - return self.view.leadingScreensForBatching; - } -} - -- (void)setDelegate:(id )delegate -{ - if ([self pendingState]) { - _pendingState.delegate = delegate; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - - // Manually trampoline to the main thread. The view requires this be called on main - // and asserting here isn't an option – it is a common pattern for users to clear - // the delegate/dataSource in dealloc, which may be running on a background thread. - // It is important that we avoid retaining self in this block, so that this method is dealloc-safe. - ASCollectionView *view = self.view; - ASPerformBlockOnMainThread(^{ - view.asyncDelegate = delegate; - }); - } -} - -- (id )delegate -{ - if ([self pendingState]) { - return _pendingState.delegate; - } else { - return self.view.asyncDelegate; - } -} - -- (void)setDataSource:(id )dataSource -{ - if ([self pendingState]) { - _pendingState.dataSource = dataSource; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - // Manually trampoline to the main thread. The view requires this be called on main - // and asserting here isn't an option – it is a common pattern for users to clear - // the delegate/dataSource in dealloc, which may be running on a background thread. - // It is important that we avoid retaining self in this block, so that this method is dealloc-safe. - ASCollectionView *view = self.view; - ASPerformBlockOnMainThread(^{ - view.asyncDataSource = dataSource; - }); - } -} - -- (id )dataSource -{ - if ([self pendingState]) { - return _pendingState.dataSource; - } else { - return self.view.asyncDataSource; - } -} - -- (void)setAllowsSelection:(BOOL)allowsSelection -{ - if ([self pendingState]) { - _pendingState.allowsSelection = allowsSelection; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.allowsSelection = allowsSelection; - } -} - -- (BOOL)allowsSelection -{ - if ([self pendingState]) { - return _pendingState.allowsSelection; - } else { - return self.view.allowsSelection; - } -} - -- (void)setAllowsMultipleSelection:(BOOL)allowsMultipleSelection -{ - if ([self pendingState]) { - _pendingState.allowsMultipleSelection = allowsMultipleSelection; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.allowsMultipleSelection = allowsMultipleSelection; - } -} - -- (BOOL)allowsMultipleSelection -{ - if ([self pendingState]) { - return _pendingState.allowsMultipleSelection; - } else { - return self.view.allowsMultipleSelection; - } -} - -- (void)setAlwaysBounceVertical:(BOOL)alwaysBounceVertical -{ - if ([self pendingState]) { - _pendingState.alwaysBounceVertical = alwaysBounceVertical; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.alwaysBounceVertical = alwaysBounceVertical; - } -} - -- (BOOL)alwaysBounceVertical -{ - if ([self pendingState]) { - return _pendingState.alwaysBounceVertical; - } else { - return self.view.alwaysBounceVertical; - } -} - -- (void)setAlwaysBounceHorizontal:(BOOL)alwaysBounceHorizontal -{ - if ([self pendingState]) { - _pendingState.alwaysBounceHorizontal = alwaysBounceHorizontal; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.alwaysBounceHorizontal = alwaysBounceHorizontal; - } -} - -- (BOOL)alwaysBounceHorizontal -{ - if ([self pendingState]) { - return _pendingState.alwaysBounceHorizontal; - } else { - return self.view.alwaysBounceHorizontal; - } -} - -- (void)setShowsVerticalScrollIndicator:(BOOL)showsVerticalScrollIndicator -{ - if ([self pendingState]) { - _pendingState.showsVerticalScrollIndicator = showsVerticalScrollIndicator; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.showsVerticalScrollIndicator = showsVerticalScrollIndicator; - } -} - -- (BOOL)showsVerticalScrollIndicator -{ - if ([self pendingState]) { - return _pendingState.showsVerticalScrollIndicator; - } else { - return self.view.showsVerticalScrollIndicator; - } -} - -- (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator -{ - if ([self pendingState]) { - _pendingState.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator; - } -} - -- (BOOL)showsHorizontalScrollIndicator -{ - if ([self pendingState]) { - return _pendingState.showsHorizontalScrollIndicator; - } else { - return self.view.showsHorizontalScrollIndicator; - } -} - -#if !TARGET_OS_TV -- (void)setPagingEnabled:(BOOL)pagingEnabled -{ - if ([self pendingState]) { - _pendingState.pagingEnabled = pagingEnabled; - } else { - ASDisplayNodeAssert([self isNodeLoaded], - @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.pagingEnabled = pagingEnabled; - } -} - -- (BOOL)isPagingEnabled -{ - if ([self pendingState]) { - return _pendingState.pagingEnabled; - } else { - return self.view.isPagingEnabled; - } -} -#endif - -- (void)setCollectionViewLayout:(UICollectionViewLayout *)layout -{ - if ([self pendingState]) { - [self _configureCollectionViewLayout:layout]; - _pendingState.collectionViewLayout = layout; - } else { - [self _configureCollectionViewLayout:layout]; - self.view.collectionViewLayout = layout; - } -} - -- (UICollectionViewLayout *)collectionViewLayout -{ - if ([self pendingState]) { - return _pendingState.collectionViewLayout; - } else { - return self.view.collectionViewLayout; - } -} - -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - if ([self pendingState]) { - _pendingState.contentInset = contentInset; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.contentInset = contentInset; - } -} - -- (UIEdgeInsets)contentInset -{ - if ([self pendingState]) { - return _pendingState.contentInset; - } else { - return self.view.contentInset; - } -} - -- (void)setContentOffset:(CGPoint)contentOffset -{ - [self setContentOffset:contentOffset animated:NO]; -} - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated -{ - if ([self pendingState]) { - _pendingState.contentOffset = contentOffset; - _pendingState.animatesContentOffset = animated; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASCollectionNode should be loaded if pendingState doesn't exist"); - [self.view setContentOffset:contentOffset animated:animated]; - } -} - -- (CGPoint)contentOffset -{ - if ([self pendingState]) { - return _pendingState.contentOffset; - } else { - return self.view.contentOffset; - } -} - -- (ASScrollDirection)scrollDirection -{ - return [self isNodeLoaded] ? self.view.scrollDirection : ASScrollDirectionNone; -} - -- (ASScrollDirection)scrollableDirections -{ - return [self isNodeLoaded] ? self.view.scrollableDirections : ASScrollDirectionNone; -} - -- (ASElementMap *)visibleElements -{ - ASDisplayNodeAssertMainThread(); - // TODO Own the data controller when view is not yet loaded - return self.dataController.visibleMap; -} - -- (id)layoutDelegate -{ - UICollectionViewLayout *layout = self.collectionViewLayout; - if ([layout isKindOfClass:[ASCollectionLayout class]]) { - return ((ASCollectionLayout *)layout).layoutDelegate; - } - return nil; -} - -- (void)setBatchFetchingDelegate:(id)batchFetchingDelegate -{ - _batchFetchingDelegate = batchFetchingDelegate; -} - -- (id)batchFetchingDelegate -{ - return _batchFetchingDelegate; -} - -- (ASCellLayoutMode)cellLayoutMode -{ - if ([self pendingState]) { - return _pendingState.cellLayoutMode; - } else { - return self.view.cellLayoutMode; - } -} - -- (void)setCellLayoutMode:(ASCellLayoutMode)cellLayoutMode -{ - if ([self pendingState]) { - _pendingState.cellLayoutMode = cellLayoutMode; - } else { - self.view.cellLayoutMode = cellLayoutMode; - } -} - -#pragma mark - Range Tuning - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - if ([self pendingState]) { - return [_pendingState tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - } else { - return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - } -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - if ([self pendingState]) { - [_pendingState setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; - } else { - return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; - } -} - -#pragma mark - Selection - -- (NSArray *)indexPathsForSelectedItems -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *view = self.view; - return [view convertIndexPathsToCollectionNode:view.indexPathsForSelectedItems]; -} - -- (void)selectItemAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *collectionView = self.view; - - indexPath = [collectionView convertIndexPathFromCollectionNode:indexPath waitingIfNeeded:YES]; - - if (indexPath != nil) { - [collectionView selectItemAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition]; - } else { - NSLog(@"Failed to select item at index path %@ because the item never reached the view.", indexPath); - } -} - -- (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *collectionView = self.view; - - indexPath = [collectionView convertIndexPathFromCollectionNode:indexPath waitingIfNeeded:YES]; - - if (indexPath != nil) { - [collectionView deselectItemAtIndexPath:indexPath animated:animated]; - } else { - NSLog(@"Failed to deselect item at index path %@ because the item never reached the view.", indexPath); - } -} - -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *collectionView = self.view; - - indexPath = [collectionView convertIndexPathFromCollectionNode:indexPath waitingIfNeeded:YES]; - - if (indexPath != nil) { - [collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; - } else { - NSLog(@"Failed to scroll to item at index path %@ because the item never reached the view.", indexPath); - } -} - -#pragma mark - Querying Data - -- (void)reloadDataInitiallyIfNeeded -{ - if (!self.dataController.initialReloadDataHasBeenCalled) { - [self reloadData]; - } -} - -- (NSInteger)numberOfItemsInSection:(NSInteger)section -{ - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap numberOfItemsInSection:section]; -} - -- (NSInteger)numberOfSections -{ - [self reloadDataInitiallyIfNeeded]; - return self.dataController.pendingMap.numberOfSections; -} - -- (NSArray<__kindof ASCellNode *> *)visibleNodes -{ - ASDisplayNodeAssertMainThread(); - return self.isNodeLoaded ? [self.view visibleNodes] : @[]; -} - -- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap elementForItemAtIndexPath:indexPath].node; -} - -- (id)nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap elementForItemAtIndexPath:indexPath].nodeModel; -} - -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode -{ - return [self.dataController.pendingMap indexPathForElement:cellNode.collectionElement]; -} - -- (NSArray *)indexPathsForVisibleItems -{ - ASDisplayNodeAssertMainThread(); - NSMutableArray *indexPathsArray = [NSMutableArray new]; - for (ASCellNode *cell in [self visibleNodes]) { - NSIndexPath *indexPath = [self indexPathForNode:cell]; - if (indexPath) { - [indexPathsArray addObject:indexPath]; - } - } - return indexPathsArray; -} - -- (nullable NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *collectionView = self.view; - - NSIndexPath *indexPath = [collectionView indexPathForItemAtPoint:point]; - if (indexPath != nil) { - return [collectionView convertIndexPathToCollectionNode:indexPath]; - } - return indexPath; -} - -- (nullable UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - ASCollectionView *collectionView = self.view; - - indexPath = [collectionView convertIndexPathFromCollectionNode:indexPath waitingIfNeeded:YES]; - if (indexPath == nil) { - return nil; - } - return [collectionView cellForItemAtIndexPath:indexPath]; -} - -- (id)contextForSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - return [self.dataController.pendingMap contextForSection:section]; -} - -#pragma mark - Editing - -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind -{ - [self.view registerSupplementaryNodeOfKind:elementKind]; -} - -- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view performBatchAnimated:animated updates:updates completion:completion]; - } else { - if (updates) { - updates(); - } - if (completion) { - completion(YES); - } - } -} - -- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - [self performBatchAnimated:UIView.areAnimationsEnabled updates:updates completion:completion]; -} - -- (BOOL)isProcessingUpdates -{ - return (self.nodeLoaded ? [self.view isProcessingUpdates] : NO); -} - -- (void)onDidFinishProcessingUpdates:(void (^)())completion -{ - if (!completion) { - return; - } - if (!self.nodeLoaded) { - completion(); - } else { - [self.view onDidFinishProcessingUpdates:completion]; - } -} - -- (BOOL)isSynchronized -{ - return (self.nodeLoaded ? [self.view isSynchronized] : YES); -} - -- (void)onDidFinishSynchronizing:(void (^)())completion -{ - if (!completion) { - return; - } - if (!self.nodeLoaded) { - completion(); - } else { - [self.view onDidFinishSynchronizing:completion]; - } -} - -- (void)waitUntilAllUpdatesAreProcessed -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view waitUntilAllUpdatesAreCommitted]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)waitUntilAllUpdatesAreCommitted -{ - [self waitUntilAllUpdatesAreProcessed]; -} -#pragma clang diagnostic pop - -- (void)reloadDataWithCompletion:(void (^)())completion -{ - ASDisplayNodeAssertMainThread(); - if (!self.nodeLoaded) { - return; - } - - [self performBatchUpdates:^{ - [self.view.changeSet reloadData]; - } completion:^(BOOL finished){ - if (completion) { - completion(); - } - }]; -} - -- (void)reloadData -{ - [self reloadDataWithCompletion:nil]; -} - -- (void)relayoutItems -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view relayoutItems]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)beginUpdates -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view beginUpdates]; - } -} - -- (void)endUpdatesAnimated:(BOOL)animated -{ - [self endUpdatesAnimated:animated completion:nil]; -} - -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view endUpdatesAnimated:animated completion:completion]; - } -} -#pragma clang diagnostic pop - -- (void)invalidateFlowLayoutDelegateMetrics { - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view invalidateFlowLayoutDelegateMetrics]; - } -} - -- (void)insertSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view insertSections:sections]; - } -} - -- (void)deleteSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view deleteSections:sections]; - } -} - -- (void)reloadSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view reloadSections:sections]; - } -} - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view moveSection:section toSection:newSection]; - } -} - -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view insertItemsAtIndexPaths:indexPaths]; - } -} - -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view deleteItemsAtIndexPaths:indexPaths]; - } -} - -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view reloadItemsAtIndexPaths:indexPaths]; - } -} - -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view moveItemAtIndexPath:indexPath toIndexPath:newIndexPath]; - } -} - -#pragma mark - ASRangeControllerUpdateRangeProtocol - -- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode -{ - if ([self pendingState]) { - _pendingState.rangeMode = rangeMode; - } else { - [self.rangeController updateCurrentRangeWithMode:rangeMode]; - } -} - -#pragma mark - ASPrimitiveTraitCollection - -ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) - -#pragma mark - Debugging (Private) - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [super propertiesForDebugDescription]; - [result addObject:@{ @"dataSource" : ASObjectDescriptionMakeTiny(self.dataSource) }]; - [result addObject:@{ @"delegate" : ASObjectDescriptionMakeTiny(self.delegate) }]; - return result; -} - -#pragma mark - UIGestureRecognizerDelegate Methods -// The value returned below are default implementation of UIKit's UIGestureRecognizerDelegate -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - return YES; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch -{ - return YES; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceivePress:(UIPress *)press -{ - return YES; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return NO; -} - -#pragma mark - Private methods - -- (void)_configureCollectionViewLayout:(UICollectionViewLayout *)layout -{ - if ([layout isKindOfClass:[ASCollectionLayout class]]) { - ASCollectionLayout *collectionLayout = (ASCollectionLayout *)layout; - collectionLayout.collectionNode = self; - } -} - -@end diff --git a/Example/Pods/Texture/Source/ASCollectionView.h b/Example/Pods/Texture/Source/ASCollectionView.h deleted file mode 100644 index 1b250a21..00000000 --- a/Example/Pods/Texture/Source/ASCollectionView.h +++ /dev/null @@ -1,492 +0,0 @@ -// -// ASCollectionView.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import - -@class ASCellNode; -@class ASCollectionNode; -@protocol ASCollectionDataSource; -@protocol ASCollectionDelegate; -@protocol ASCollectionViewLayoutInspecting; -@protocol ASSectionContext; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Asynchronous UICollectionView with Intelligent Preloading capabilities. - * - * @note ASCollectionNode is strongly recommended over ASCollectionView. This class exists for adoption convenience. - */ -@interface ASCollectionView : UICollectionView - -/** - * Returns the corresponding ASCollectionNode - * - * @return collectionNode The corresponding ASCollectionNode, if one exists. - */ -@property (nonatomic, weak, readonly) ASCollectionNode *collectionNode; - -/** - * Retrieves the node for the item at the given index path. - * - * @param indexPath The index path of the requested node. - * @return The node at the given index path, or @c nil if no item exists at the specified path. - */ -- (nullable ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Similar to -indexPathForCell:. - * - * @param cellNode a cellNode in the collection view - * - * @return The index path for this cell node. - * - * @discussion This index path returned by this method is in the _view's_ index space - * and should only be used with @c ASCollectionView directly. To get an index path suitable - * for use with your data source and @c ASCollectionNode, call @c indexPathForNode: on the - * collection node instead. - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; - -/** - * Similar to -supplementaryViewForElementKind:atIndexPath: - * - * @param elementKind The kind of supplementary node to locate. - * @param indexPath The index path of the requested supplementary node. - * - * @return The specified supplementary node or @c nil. - */ -- (nullable ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Retrieves the context object for the given section, as provided by the data source in - * the @c collectionNode:contextForSection: method. This method must be called on the main thread. - * - * @param section The section to get the context for. - * - * @return The context object, or @c nil if no context was provided. - */ -- (nullable id)contextForSection:(NSInteger)section AS_WARN_UNUSED_RESULT; - -@end - -@interface ASCollectionView (Deprecated) - -/* - * A Boolean value that determines whether the nodes that the data source renders will be flipped. - */ -@property (nonatomic) BOOL inverted ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * The number of screens left to scroll before the delegate -collectionView:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic) CGFloat leadingScreensForBatching ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * Optional introspection object for the collection view's layout. - * - * @discussion Since supplementary and decoration views are controlled by the collection view's layout, this object - * is used as a bridge to provide information to the internal data controller about the existence of these views and - * their associated index paths. For collection views using `UICollectionViewFlowLayout`, a default inspector - * implementation `ASCollectionViewFlowLayoutInspector` is created and set on this property by default. Custom - * collection view layout subclasses will need to provide their own implementation of an inspector object for their - * supplementary views to be compatible with `ASCollectionView`'s supplementary node support. - */ -@property (nonatomic, weak) id layoutInspector ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * Determines collection view's current scroll direction. Supports 2-axis collection views. - * - * @return a bitmask of ASScrollDirection values. - */ -@property (nonatomic, readonly) ASScrollDirection scrollDirection ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * Determines collection view's scrollable directions. - * - * @return a bitmask of ASScrollDirection values. - */ -@property (nonatomic, readonly) ASScrollDirection scrollableDirections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * Forces the .contentInset to be UIEdgeInsetsZero. - * - * @discussion By default, UIKit sets the top inset to the navigation bar height, even for horizontally - * scrolling views. This can only be disabled by setting a property on the containing UIViewController, - * automaticallyAdjustsScrollViewInsets, which may not be accessible. ASPagerNode uses this to ensure - * its flow layout behaves predictably and does not log undefined layout warnings. - */ -@property (nonatomic) BOOL zeroContentInsets ASDISPLAYNODE_DEPRECATED_MSG("Set automaticallyAdjustsScrollViewInsets=NO on your view controller instead."); - -/** - * The distance that the content view is inset from the collection view edges. Defaults to UIEdgeInsetsZero. - */ -@property (nonatomic) UIEdgeInsets contentInset ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead"); - -/** - * The point at which the origin of the content view is offset from the origin of the collection view. - */ -@property (nonatomic) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * The object that acts as the asynchronous delegate of the collection view - * - * @discussion The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object. - * - * The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin. - */ -@property (nonatomic, weak) id asyncDelegate ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode's .delegate property instead."); - -/** - * The object that acts as the asynchronous data source of the collection view - * - * @discussion The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object. - * - * The datasource object is responsible for providing nodes or node creation blocks to the collection view. - */ -@property (nonatomic, weak) id asyncDataSource ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode's .dataSource property instead."); - -/** - * Initializes an ASCollectionView - * - * @discussion Initializes and returns a newly allocated collection view object with the specified layout. - * - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); - -/** - * Initializes an ASCollectionView - * - * @discussion Initializes and returns a newly allocated collection view object with the specified frame and layout. - * - * @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization. - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout ASDISPLAYNODE_DEPRECATED_MSG("Please use ASCollectionNode instead of ASCollectionView."); - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -- (nullable __kindof UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -@property (nonatomic, copy, readonly) NSArray *indexPathsForVisibleItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -@property (nullable, nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode property instead."); - -/** - * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. - * The asyncDataSource must be updated to reflect the changes before the update block completes. - * - * @param animated NO to disable animations for this batch - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Perform a batch of updates asynchronously. This method must be called from the main thread. - * The asyncDataSource must be updated to reflect the changes before update block completes. - * - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on - * the main thread. - * @warning This method is substantially more expensive than UICollectionView's version. - */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion AS_UNAVAILABLE("Use ASCollectionNode method instead."); - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @warning This method is substantially more expensive than UICollectionView's version. - */ -- (void)reloadData AS_UNAVAILABLE("Use ASCollectionNode method instead."); - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the collection. - */ -- (void)relayoutItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * See ASCollectionNode.h for full documentation of these methods. - */ -@property (nonatomic, readonly) BOOL isProcessingUpdates; -- (void)onDidFinishProcessingUpdates:(void (^)(void))completion; -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("Use -[ASCollectionNode waitUntilAllUpdatesAreProcessed] instead."); - -/** - * See ASCollectionNode.h for full documentation of these methods. - */ -@property (nonatomic, readonly, getter=isSynchronized) BOOL synchronized; -- (void)onDidFinishSynchronizing:(void (^)(void))completion; - -/** - * Registers the given kind of supplementary node for use in creating node-backed supplementary views. - * - * @param elementKind The kind of supplementary node that will be requested through the data source. - * - * @discussion Use this method to register support for the use of supplementary nodes in place of the default - * `registerClass:forSupplementaryViewOfKind:withReuseIdentifier:` and `registerNib:forSupplementaryViewOfKind:withReuseIdentifier:` - * methods. This method will register an internal backing view that will host the contents of the supplementary nodes - * returned from the data source. - */ -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Inserts one or more sections. - * - * @param sections An index set that specifies the sections to insert. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Deletes one or more sections. - * - * @param sections An index set that specifies the sections to delete. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Reloads the specified sections. - * - * @param sections An index set that specifies the sections to reload. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadSections:(NSIndexSet *)sections ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Moves a section to a new location. - * - * @param section The index of the section to move. - * - * @param newSection The index that is the destination of the move for the section. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Inserts items at the locations identified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects, each representing an item index and section index that together identify an item. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Deletes the items specified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to delete. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Reloads the specified items. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to reload. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Moves the item at a specified location to a destination location. - * - * @param indexPath The index path identifying the item to move. - * - * @param newIndexPath The index path that is the destination of the move for the item. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -/** - * Query the sized node at @c indexPath for its calculatedSize. - * - * @param indexPath The index path for the node of interest. - * - * This method is deprecated. Call @c calculatedSize on the node of interest instead. First deprecated in version 2.0. - */ -- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Call -calculatedSize on the node of interest instead."); - -/** - * Similar to -visibleCells. - * - * @return an array containing the nodes being displayed on screen. - */ -- (NSArray<__kindof ASCellNode *> *)visibleNodes AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode method instead."); - -@end - -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDataSource.") -@protocol ASCollectionViewDataSource -@end - -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDelegate.") -@protocol ASCollectionViewDelegate -@end - -/** - * Defines methods that let you coordinate a `UICollectionViewFlowLayout` in combination with an `ASCollectionNode`. - */ -@protocol ASCollectionDelegateFlowLayout - -@optional - -/** - * Asks the delegate for the inset that should be applied to the given section. - * - * @see the same method in UICollectionViewDelegate. - */ -- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section; - -/** - * Asks the delegate for the size range that should be used to measure the header in the given flow layout section. - * - * @param collectionNode The sender. - * @param section The section. - * - * @return The size range for the header, or @c ASSizeRangeZero if there is no header in this section. - * - * If you want the header to completely determine its own size, return @c ASSizeRangeUnconstrained. - * - * @note Only the scrollable dimension of the returned size range will be used. In a vertical flow, - * only the height will be used. In a horizontal flow, only the width will be used. The other dimension - * will be constrained to fill the collection node. - * - * @discussion If you do not implement this method, ASDK will fall back to calling @c collectionView:layout:referenceSizeForHeaderInSection: - * and using that as the exact constrained size. If you don't implement that method, ASDK will read the @c headerReferenceSize from the layout. - */ -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForHeaderInSection:(NSInteger)section; - -/** - * Asks the delegate for the size range that should be used to measure the footer in the given flow layout section. - * - * @param collectionNode The sender. - * @param section The section. - * - * @return The size range for the footer, or @c ASSizeRangeZero if there is no footer in this section. - * - * If you want the footer to completely determine its own size, return @c ASSizeRangeUnconstrained. - * - * @note Only the scrollable dimension of the returned size range will be used. In a vertical flow, - * only the height will be used. In a horizontal flow, only the width will be used. The other dimension - * will be constrained to fill the collection node. - * - * @discussion If you do not implement this method, ASDK will fall back to calling @c collectionView:layout:referenceSizeForFooterInSection: - * and using that as the exact constrained size. If you don't implement that method, ASDK will read the @c footerReferenceSize from the layout. - */ -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForFooterInSection:(NSInteger)section; - -/** - * Asks the delegate for the size of the header in the specified section. - */ -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:sizeRangeForHeaderInSection: instead."); - -/** - * Asks the delegate for the size of the footer in the specified section. - */ -- (CGSize)collectionView:(ASCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:sizeRangeForFooterInSection: instead."); - -@end - -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASCollectionDelegateFlowLayout.") -@protocol ASCollectionViewDelegateFlowLayout -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCollectionView.mm b/Example/Pods/Texture/Source/ASCollectionView.mm deleted file mode 100644 index e08c55f9..00000000 --- a/Example/Pods/Texture/Source/ASCollectionView.mm +++ /dev/null @@ -1,2554 +0,0 @@ -// -// ASCollectionView.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -/** - * A macro to get self.collectionNode and assign it to a local variable, or return - * the given value if nil. - * - * Previously we would set ASCollectionNode's dataSource & delegate to nil - * during dealloc. However, our asyncDelegate & asyncDataSource must be set on the - * main thread, so if the node is deallocated off-main, we won't learn about the change - * until later on. Since our @c collectionNode parameter to delegate methods (e.g. - * collectionNode:didEndDisplayingItemWithNode:) is nonnull, it's important that we never - * unintentionally pass nil (this will crash in Swift, in production). So we can use - * this macro to ensure that our node is still alive before calling out to the user - * on its behalf. - */ -#define GET_COLLECTIONNODE_OR_RETURN(__var, __val) \ - ASCollectionNode *__var = self.collectionNode; \ - if (__var == nil) { \ - return __val; \ - } - -#define ASFlowLayoutDefault(layout, property, default) \ -({ \ - UICollectionViewFlowLayout *flowLayout = ASDynamicCast(layout, UICollectionViewFlowLayout); \ - flowLayout ? flowLayout.property : default; \ -}) - -// ASCellLayoutMode is an NSUInteger-based NS_OPTIONS field. Be careful with BOOL handling on the -// 32-bit Objective-C runtime, and pattern after ASInterfaceStateIncludesVisible() & friends. -#define ASCellLayoutModeIncludes(layoutMode) ((self->_cellLayoutMode & layoutMode) == layoutMode) - -/// What, if any, invalidation should we perform during the next -layoutSubviews. -typedef NS_ENUM(NSUInteger, ASCollectionViewInvalidationStyle) { - /// Perform no invalidation. - ASCollectionViewInvalidationStyleNone, - /// Perform invalidation with animation (use an empty batch update). - ASCollectionViewInvalidationStyleWithoutAnimation, - /// Perform invalidation without animation (use -invalidateLayout). - ASCollectionViewInvalidationStyleWithAnimation, -}; - -static const NSUInteger kASCollectionViewAnimationNone = UITableViewRowAnimationNone; - -/// Used for all cells and supplementaries. UICV keys by supp-kind+reuseID so this is plenty. -static NSString * const kReuseIdentifier = @"_ASCollectionReuseIdentifier"; - -#pragma mark - -#pragma mark ASCollectionView. - -@interface ASCollectionView () { - ASCollectionViewProxy *_proxyDataSource; - ASCollectionViewProxy *_proxyDelegate; - - ASDataController *_dataController; - ASRangeController *_rangeController; - ASCollectionViewLayoutController *_layoutController; - id _defaultLayoutInspector; - __weak id _layoutInspector; - NSHashTable<_ASCollectionViewCell *> *_cellsForVisibilityUpdates; - NSHashTable *_cellsForLayoutUpdates; - id _layoutFacilitator; - CGFloat _leadingScreensForBatching; - - // When we update our data controller in response to an interactive move, - // we don't want to tell the collection view about the change (it knows!) - BOOL _updatingInResponseToInteractiveMove; - BOOL _inverted; - - NSUInteger _superBatchUpdateCount; - BOOL _isDeallocating; - - ASBatchContext *_batchContext; - - CGSize _lastBoundsSizeUsedForMeasuringNodes; - - NSMutableSet *_registeredSupplementaryKinds; - - // CountedSet because UIKit may display the same element in multiple cells e.g. during animations. - NSCountedSet *_visibleElements; - - CGPoint _deceleratingVelocity; - - BOOL _zeroContentInsets; - - ASCollectionViewInvalidationStyle _nextLayoutInvalidationStyle; - - /** - * If YES, the `UICollectionView` will reload its data on next layout pass so we should not forward any updates to it. - - * Rationale: - * In `reloadData`, a collection view invalidates its data and marks itself as needing reload, and waits until `layoutSubviews` to requery its data source. - * This can lead to data inconsistency problems. - * Say you have an empty collection view. You call `reloadData`, then immediately insert an item into your data source and call `insertItemsAtIndexPaths:[0,0]`. - * You will get an assertion failure saying `Invalid number of items in section 0. - * The number of items after the update (1) must be equal to the number of items before the update (1) plus or minus the items added and removed (1 added, 0 removed).` - * The collection view never queried your data source before the update to see that it actually had 0 items. - */ - BOOL _superIsPendingDataLoad; - - /** - * It's important that we always check for batch fetching at least once, but also - * that we do not check for batch fetching for empty updates (as that may cause an infinite - * loop of batch fetching, where the batch completes and performBatchUpdates: is called without - * actually making any changes.) So to handle the case where a collection is completely empty - * (0 sections) we always check at least once after each update (initial reload is the first update.) - */ - BOOL _hasEverCheckedForBatchFetchingDueToUpdate; - - /** - * Set during beginInteractiveMovementForItemAtIndexPath and UIGestureRecognizerStateEnded - * (or UIGestureRecognizerStateFailed, UIGestureRecognizerStateCancelled. - */ - BOOL _reordering; - - /** - * Counter used to keep track of nested batch updates. - */ - NSInteger _batchUpdateCount; - - /** - * Keep a strong reference to node till view is ready to release. - */ - ASCollectionNode *_keepalive_node; - - struct { - unsigned int scrollViewDidScroll:1; - unsigned int scrollViewWillBeginDragging:1; - unsigned int scrollViewDidEndDragging:1; - unsigned int scrollViewWillEndDragging:1; - unsigned int scrollViewDidEndDecelerating:1; - unsigned int collectionViewWillDisplayNodeForItem:1; - unsigned int collectionViewWillDisplayNodeForItemDeprecated:1; - unsigned int collectionViewDidEndDisplayingNodeForItem:1; - unsigned int collectionViewShouldSelectItem:1; - unsigned int collectionViewDidSelectItem:1; - unsigned int collectionViewShouldDeselectItem:1; - unsigned int collectionViewDidDeselectItem:1; - unsigned int collectionViewShouldHighlightItem:1; - unsigned int collectionViewDidHighlightItem:1; - unsigned int collectionViewDidUnhighlightItem:1; - unsigned int collectionViewShouldShowMenuForItem:1; - unsigned int collectionViewCanPerformActionForItem:1; - unsigned int collectionViewPerformActionForItem:1; - unsigned int collectionViewWillBeginBatchFetch:1; - unsigned int shouldBatchFetchForCollectionView:1; - unsigned int collectionNodeWillDisplayItem:1; - unsigned int collectionNodeDidEndDisplayingItem:1; - unsigned int collectionNodeShouldSelectItem:1; - unsigned int collectionNodeDidSelectItem:1; - unsigned int collectionNodeShouldDeselectItem:1; - unsigned int collectionNodeDidDeselectItem:1; - unsigned int collectionNodeShouldHighlightItem:1; - unsigned int collectionNodeDidHighlightItem:1; - unsigned int collectionNodeDidUnhighlightItem:1; - unsigned int collectionNodeShouldShowMenuForItem:1; - unsigned int collectionNodeCanPerformActionForItem:1; - unsigned int collectionNodePerformActionForItem:1; - unsigned int collectionNodeWillBeginBatchFetch:1; - unsigned int collectionNodeWillDisplaySupplementaryElement:1; - unsigned int collectionNodeDidEndDisplayingSupplementaryElement:1; - unsigned int shouldBatchFetchForCollectionNode:1; - - // Interop flags - unsigned int interop:1; - unsigned int interopWillDisplayCell:1; - unsigned int interopDidEndDisplayingCell:1; - unsigned int interopWillDisplaySupplementaryView:1; - unsigned int interopdidEndDisplayingSupplementaryView:1; - } _asyncDelegateFlags; - - struct { - unsigned int collectionViewNodeForItem:1; - unsigned int collectionViewNodeBlockForItem:1; - unsigned int collectionViewNodeForSupplementaryElement:1; - unsigned int numberOfSectionsInCollectionView:1; - unsigned int collectionViewNumberOfItemsInSection:1; - unsigned int collectionNodeNodeForItem:1; - unsigned int collectionNodeNodeBlockForItem:1; - unsigned int nodeModelForItem:1; - unsigned int collectionNodeNodeForSupplementaryElement:1; - unsigned int collectionNodeNodeBlockForSupplementaryElement:1; - unsigned int collectionNodeSupplementaryElementKindsInSection:1; - unsigned int numberOfSectionsInCollectionNode:1; - unsigned int collectionNodeNumberOfItemsInSection:1; - unsigned int collectionNodeContextForSection:1; - unsigned int collectionNodeCanMoveItem:1; - unsigned int collectionNodeMoveItem:1; - - // Whether this data source conforms to ASCollectionDataSourceInterop - unsigned int interop:1; - // Whether this interop data source returns YES from +dequeuesCellsForNodeBackedItems - unsigned int interopAlwaysDequeue:1; - // Whether this interop data source implements viewForSupplementaryElementOfKind: - unsigned int interopViewForSupplementaryElement:1; - unsigned int modelIdentifierMethods:1; // if both modelIdentifierForElementAtIndexPath and indexPathForElementWithModelIdentifier are implemented - } _asyncDataSourceFlags; - - struct { - unsigned int constrainedSizeForSupplementaryNodeOfKindAtIndexPath:1; - unsigned int supplementaryNodesOfKindInSection:1; - unsigned int didChangeCollectionViewDataSource:1; - unsigned int didChangeCollectionViewDelegate:1; - } _layoutInspectorFlags; - - BOOL _hasDataControllerLayoutDelegate; -} - -@end - -@implementation ASCollectionView -{ - __weak id _asyncDelegate; - __weak id _asyncDataSource; -} - -// Using _ASDisplayLayer ensures things like -layout are properly forwarded to ASCollectionNode. -+ (Class)layerClass -{ - return [_ASDisplayLayer class]; -} - -#pragma mark - -#pragma mark Lifecycle. - -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout -{ - return [self initWithFrame:CGRectZero collectionViewLayout:layout]; -} - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout -{ - return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil owningNode:nil]; -} - -- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id)layoutFacilitator owningNode:(ASCollectionNode *)owningNode -{ - if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) - return nil; - - // Disable UICollectionView prefetching. Use super, because self disables this method. - // Experiments done by Instagram show that this option being YES (default) - // when unused causes a significant hit to scroll performance. - // https://github.com/Instagram/IGListKit/issues/318 - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - super.prefetchingEnabled = NO; - } - - _layoutController = [[ASCollectionViewLayoutController alloc] initWithCollectionView:self]; - - _rangeController = [[ASRangeController alloc] init]; - _rangeController.dataSource = self; - _rangeController.delegate = self; - _rangeController.layoutController = _layoutController; - - _dataController = [[ASDataController alloc] initWithDataSource:self node:owningNode]; - _dataController.delegate = _rangeController; - - _batchContext = [[ASBatchContext alloc] init]; - - _leadingScreensForBatching = 2.0; - - _lastBoundsSizeUsedForMeasuringNodes = self.bounds.size; - - _layoutFacilitator = layoutFacilitator; - - _proxyDelegate = [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self]; - super.delegate = (id)_proxyDelegate; - - _proxyDataSource = [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self]; - super.dataSource = (id)_proxyDataSource; - - _registeredSupplementaryKinds = [[NSMutableSet alloc] init]; - _visibleElements = [[NSCountedSet alloc] init]; - - _cellsForVisibilityUpdates = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - _cellsForLayoutUpdates = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - self.backgroundColor = [UIColor whiteColor]; - - [self registerClass:[_ASCollectionViewCell class] forCellWithReuseIdentifier:kReuseIdentifier]; - - [self _configureCollectionViewLayout:layout]; - - self.panGestureRecognizer.delegate = self; - return self; -} - -- (void)dealloc -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeCAssert(_batchUpdateCount == 0, @"ASCollectionView deallocated in the middle of a batch update."); - - // Sometimes the UIKit classes can call back to their delegate even during deallocation, due to animation completion blocks etc. - _isDeallocating = YES; - if (!ASActivateExperimentalFeature(ASExperimentalCollectionTeardown)) { - [self setAsyncDelegate:nil]; - [self setAsyncDataSource:nil]; - } -} - -#pragma mark - -#pragma mark Overrides. - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -/** - * This method is not available to be called by the public i.e. - * it should only be called by UICollectionView itself. UICollectionView - * does this e.g. during the first layout pass, or if you call -numberOfSections - * before its content is loaded. - */ -- (void)reloadData -{ - [self _superReloadData:nil completion:nil]; - - // UICollectionView calls -reloadData during first layoutSubviews and when the data source changes. - // This fires off the first load of cell nodes. - if (_asyncDataSource != nil && !self.dataController.initialReloadDataHasBeenCalled) { - [self performBatchUpdates:^{ - [_changeSet reloadData]; - } completion:nil]; - } -} -#pragma clang diagnostic pop - -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated -{ - if ([self validateIndexPath:indexPath]) { - [super scrollToItemAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; - } -} - -- (void)relayoutItems -{ - [_dataController relayoutAllNodesWithInvalidationBlock:^{ - [self.collectionViewLayout invalidateLayout]; - [self invalidateFlowLayoutDelegateMetrics]; - }]; -} - -- (BOOL)isProcessingUpdates -{ - return [_dataController isProcessingUpdates]; -} - -- (void)onDidFinishProcessingUpdates:(void (^)())completion -{ - [_dataController onDidFinishProcessingUpdates:completion]; -} - -- (void)waitUntilAllUpdatesAreCommitted -{ - ASDisplayNodeAssertMainThread(); - if (_batchUpdateCount > 0) { - // This assertion will be enabled soon. - // ASDisplayNodeFailAssert(@"Should not call %@ during batch update", NSStringFromSelector(_cmd)); - return; - } - - [_dataController waitUntilAllUpdatesAreProcessed]; -} - -- (BOOL)isSynchronized -{ - return [_dataController isSynchronized]; -} - -- (void)onDidFinishSynchronizing:(void (^)())completion -{ - [_dataController onDidFinishSynchronizing:completion]; -} - -- (void)setDataSource:(id)dataSource -{ - // UIKit can internally generate a call to this method upon changing the asyncDataSource; only assert for non-nil. We also allow this when we're doing interop. - ASDisplayNodeAssert(_asyncDelegateFlags.interop || dataSource == nil, @"ASCollectionView uses asyncDataSource, not UICollectionView's dataSource property."); -} - -- (void)setDelegate:(id)delegate -{ - // Our UIScrollView superclass sets its delegate to nil on dealloc. Only assert if we get a non-nil value here. We also allow this when we're doing interop. - ASDisplayNodeAssert(_asyncDelegateFlags.interop || delegate == nil, @"ASCollectionView uses asyncDelegate, not UICollectionView's delegate property."); -} - -- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy -{ - if (proxy == _proxyDelegate) { - [self setAsyncDelegate:nil]; - } else if (proxy == _proxyDataSource) { - [self setAsyncDataSource:nil]; - } -} - -- (id)asyncDataSource -{ - return _asyncDataSource; -} - -- (void)setAsyncDataSource:(id)asyncDataSource -{ - // Changing super.dataSource will trigger a setNeedsLayout, so this must happen on the main thread. - ASDisplayNodeAssertMainThread(); - - // Note: It's common to check if the value hasn't changed and short-circuit but we aren't doing that here to handle - // the (common) case of nilling the asyncDataSource in the ViewController's dealloc. In this case our _asyncDataSource - // will return as nil (ARC magic) even though the _proxyDataSource still exists. It's really important to hold a strong - // reference to the old dataSource in this case because calls to ASCollectionViewProxy will start failing and cause crashes. - NS_VALID_UNTIL_END_OF_SCOPE id oldDataSource = super.dataSource; - - if (asyncDataSource == nil) { - _asyncDataSource = nil; - _proxyDataSource = _isDeallocating ? nil : [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self]; - _asyncDataSourceFlags = {}; - - } else { - _asyncDataSource = asyncDataSource; - _proxyDataSource = [[ASCollectionViewProxy alloc] initWithTarget:_asyncDataSource interceptor:self]; - - _asyncDataSourceFlags.collectionViewNodeForItem = [_asyncDataSource respondsToSelector:@selector(collectionView:nodeForItemAtIndexPath:)]; - _asyncDataSourceFlags.collectionViewNodeBlockForItem = [_asyncDataSource respondsToSelector:@selector(collectionView:nodeBlockForItemAtIndexPath:)]; - _asyncDataSourceFlags.numberOfSectionsInCollectionView = [_asyncDataSource respondsToSelector:@selector(numberOfSectionsInCollectionView:)]; - _asyncDataSourceFlags.collectionViewNumberOfItemsInSection = [_asyncDataSource respondsToSelector:@selector(collectionView:numberOfItemsInSection:)]; - _asyncDataSourceFlags.collectionViewNodeForSupplementaryElement = [_asyncDataSource respondsToSelector:@selector(collectionView:nodeForSupplementaryElementOfKind:atIndexPath:)]; - - _asyncDataSourceFlags.collectionNodeNodeForItem = [_asyncDataSource respondsToSelector:@selector(collectionNode:nodeForItemAtIndexPath:)]; - _asyncDataSourceFlags.collectionNodeNodeBlockForItem = [_asyncDataSource respondsToSelector:@selector(collectionNode:nodeBlockForItemAtIndexPath:)]; - _asyncDataSourceFlags.numberOfSectionsInCollectionNode = [_asyncDataSource respondsToSelector:@selector(numberOfSectionsInCollectionNode:)]; - _asyncDataSourceFlags.collectionNodeNumberOfItemsInSection = [_asyncDataSource respondsToSelector:@selector(collectionNode:numberOfItemsInSection:)]; - _asyncDataSourceFlags.collectionNodeContextForSection = [_asyncDataSource respondsToSelector:@selector(collectionNode:contextForSection:)]; - _asyncDataSourceFlags.collectionNodeNodeForSupplementaryElement = [_asyncDataSource respondsToSelector:@selector(collectionNode:nodeForSupplementaryElementOfKind:atIndexPath:)]; - _asyncDataSourceFlags.collectionNodeNodeBlockForSupplementaryElement = [_asyncDataSource respondsToSelector:@selector(collectionNode:nodeBlockForSupplementaryElementOfKind:atIndexPath:)]; - _asyncDataSourceFlags.collectionNodeSupplementaryElementKindsInSection = [_asyncDataSource respondsToSelector:@selector(collectionNode:supplementaryElementKindsInSection:)]; - _asyncDataSourceFlags.nodeModelForItem = [_asyncDataSource respondsToSelector:@selector(collectionNode:nodeModelForItemAtIndexPath:)]; - _asyncDataSourceFlags.collectionNodeCanMoveItem = [_asyncDataSource respondsToSelector:@selector(collectionNode:canMoveItemWithNode:)]; - _asyncDataSourceFlags.collectionNodeMoveItem = [_asyncDataSource respondsToSelector:@selector(collectionNode:moveItemAtIndexPath:toIndexPath:)]; - - _asyncDataSourceFlags.interop = [_asyncDataSource conformsToProtocol:@protocol(ASCollectionDataSourceInterop)]; - if (_asyncDataSourceFlags.interop) { - id interopDataSource = (id)_asyncDataSource; - _asyncDataSourceFlags.interopAlwaysDequeue = [[interopDataSource class] respondsToSelector:@selector(dequeuesCellsForNodeBackedItems)] && [[interopDataSource class] dequeuesCellsForNodeBackedItems]; - _asyncDataSourceFlags.interopViewForSupplementaryElement = [interopDataSource respondsToSelector:@selector(collectionView:viewForSupplementaryElementOfKind:atIndexPath:)]; - } - - _asyncDataSourceFlags.modelIdentifierMethods = [_asyncDataSource respondsToSelector:@selector(modelIdentifierForElementAtIndexPath:inNode:)] && [_asyncDataSource respondsToSelector:@selector(indexPathForElementWithModelIdentifier:inNode:)]; - - - ASDisplayNodeAssert(_asyncDataSourceFlags.collectionNodeNumberOfItemsInSection || _asyncDataSourceFlags.collectionViewNumberOfItemsInSection, @"Data source must implement collectionNode:numberOfItemsInSection:"); - ASDisplayNodeAssert(_asyncDataSourceFlags.collectionNodeNodeBlockForItem - || _asyncDataSourceFlags.collectionNodeNodeForItem - || _asyncDataSourceFlags.collectionViewNodeBlockForItem - || _asyncDataSourceFlags.collectionViewNodeForItem, @"Data source must implement collectionNode:nodeBlockForItemAtIndexPath: or collectionNode:nodeForItemAtIndexPath:"); - } - - _dataController.validationErrorSource = asyncDataSource; - super.dataSource = (id)_proxyDataSource; - - //Cache results of layoutInspector to ensure flags are up to date if getter lazily loads a new one. - id layoutInspector = self.layoutInspector; - if (_layoutInspectorFlags.didChangeCollectionViewDataSource) { - [layoutInspector didChangeCollectionViewDataSource:asyncDataSource]; - } - [self _asyncDelegateOrDataSourceDidChange]; -} - -- (id)asyncDelegate -{ - return _asyncDelegate; -} - -- (void)setAsyncDelegate:(id)asyncDelegate -{ - // Changing super.delegate will trigger a setNeedsLayout, so this must happen on the main thread. - ASDisplayNodeAssertMainThread(); - - // Note: It's common to check if the value hasn't changed and short-circuit but we aren't doing that here to handle - // the (common) case of nilling the asyncDelegate in the ViewController's dealloc. In this case our _asyncDelegate - // will return as nil (ARC magic) even though the _proxyDataSource still exists. It's really important to hold a strong - // reference to the old delegate in this case because calls to ASCollectionViewProxy will start failing and cause crashes. - NS_VALID_UNTIL_END_OF_SCOPE id oldDelegate = super.delegate; - - if (asyncDelegate == nil) { - _asyncDelegate = nil; - _proxyDelegate = _isDeallocating ? nil : [[ASCollectionViewProxy alloc] initWithTarget:nil interceptor:self]; - _asyncDelegateFlags = {}; - } else { - _asyncDelegate = asyncDelegate; - _proxyDelegate = [[ASCollectionViewProxy alloc] initWithTarget:_asyncDelegate interceptor:self]; - - _asyncDelegateFlags.scrollViewDidScroll = [_asyncDelegate respondsToSelector:@selector(scrollViewDidScroll:)]; - _asyncDelegateFlags.scrollViewWillEndDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]; - _asyncDelegateFlags.scrollViewDidEndDecelerating = [_asyncDelegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]; - _asyncDelegateFlags.scrollViewWillBeginDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]; - _asyncDelegateFlags.scrollViewDidEndDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]; - _asyncDelegateFlags.collectionViewWillDisplayNodeForItem = [_asyncDelegate respondsToSelector:@selector(collectionView:willDisplayNode:forItemAtIndexPath:)]; - if (_asyncDelegateFlags.collectionViewWillDisplayNodeForItem == NO) { - _asyncDelegateFlags.collectionViewWillDisplayNodeForItemDeprecated = [_asyncDelegate respondsToSelector:@selector(collectionView:willDisplayNodeForItemAtIndexPath:)]; - } - _asyncDelegateFlags.collectionViewDidEndDisplayingNodeForItem = [_asyncDelegate respondsToSelector:@selector(collectionView:didEndDisplayingNode:forItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(collectionView:willBeginBatchFetchWithContext:)]; - _asyncDelegateFlags.shouldBatchFetchForCollectionView = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]; - _asyncDelegateFlags.collectionViewShouldSelectItem = [_asyncDelegate respondsToSelector:@selector(collectionView:shouldSelectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewDidSelectItem = [_asyncDelegate respondsToSelector:@selector(collectionView:didSelectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewShouldDeselectItem = [_asyncDelegate respondsToSelector:@selector(collectionView:shouldDeselectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewDidDeselectItem = [_asyncDelegate respondsToSelector:@selector(collectionView:didDeselectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewShouldHighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionView:shouldHighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewDidHighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionView:didHighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewDidUnhighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionView:didUnhighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewShouldShowMenuForItem = [_asyncDelegate respondsToSelector:@selector(collectionView:shouldShowMenuForItemAtIndexPath:)]; - _asyncDelegateFlags.collectionViewCanPerformActionForItem = [_asyncDelegate respondsToSelector:@selector(collectionView:canPerformAction:forItemAtIndexPath:withSender:)]; - _asyncDelegateFlags.collectionViewPerformActionForItem = [_asyncDelegate respondsToSelector:@selector(collectionView:performAction:forItemAtIndexPath:withSender:)]; - _asyncDelegateFlags.collectionNodeWillDisplayItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:willDisplayItemWithNode:)]; - _asyncDelegateFlags.collectionNodeDidEndDisplayingItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:didEndDisplayingItemWithNode:)]; - _asyncDelegateFlags.collectionNodeWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(collectionNode:willBeginBatchFetchWithContext:)]; - _asyncDelegateFlags.shouldBatchFetchForCollectionNode = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionNode:)]; - _asyncDelegateFlags.collectionNodeShouldSelectItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:shouldSelectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeDidSelectItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:didSelectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeShouldDeselectItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:shouldDeselectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeDidDeselectItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:didDeselectItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeShouldHighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:shouldHighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeDidHighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:didHighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeDidUnhighlightItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:didUnhighlightItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeShouldShowMenuForItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:shouldShowMenuForItemAtIndexPath:)]; - _asyncDelegateFlags.collectionNodeCanPerformActionForItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:canPerformAction:forItemAtIndexPath:sender:)]; - _asyncDelegateFlags.collectionNodePerformActionForItem = [_asyncDelegate respondsToSelector:@selector(collectionNode:performAction:forItemAtIndexPath:sender:)]; - _asyncDelegateFlags.collectionNodeWillDisplaySupplementaryElement = [_asyncDelegate respondsToSelector:@selector(collectionNode:willDisplaySupplementaryElementWithNode:)]; - _asyncDelegateFlags.collectionNodeDidEndDisplayingSupplementaryElement = [_asyncDelegate respondsToSelector:@selector(collectionNode:didEndDisplayingSupplementaryElementWithNode:)]; - _asyncDelegateFlags.interop = [_asyncDelegate conformsToProtocol:@protocol(ASCollectionDelegateInterop)]; - if (_asyncDelegateFlags.interop) { - id interopDelegate = (id)_asyncDelegate; - _asyncDelegateFlags.interopWillDisplayCell = [interopDelegate respondsToSelector:@selector(collectionView:willDisplayCell:forItemAtIndexPath:)]; - _asyncDelegateFlags.interopDidEndDisplayingCell = [interopDelegate respondsToSelector:@selector(collectionView:didEndDisplayingCell:forItemAtIndexPath:)]; - _asyncDelegateFlags.interopWillDisplaySupplementaryView = [interopDelegate respondsToSelector:@selector(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:)]; - _asyncDelegateFlags.interopdidEndDisplayingSupplementaryView = [interopDelegate respondsToSelector:@selector(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)]; - } - } - - super.delegate = (id)_proxyDelegate; - - //Cache results of layoutInspector to ensure flags are up to date if getter lazily loads a new one. - id layoutInspector = self.layoutInspector; - if (_layoutInspectorFlags.didChangeCollectionViewDelegate) { - [layoutInspector didChangeCollectionViewDelegate:asyncDelegate]; - } - [self _asyncDelegateOrDataSourceDidChange]; -} - -- (void)_asyncDelegateOrDataSourceDidChange -{ - ASDisplayNodeAssertMainThread(); - - if (_asyncDataSource == nil && _asyncDelegate == nil && !ASActivateExperimentalFeature(ASExperimentalSkipClearData)) { - [_dataController clearData]; - } -} - -- (void)setCollectionViewLayout:(nonnull UICollectionViewLayout *)collectionViewLayout -{ - ASDisplayNodeAssertMainThread(); - [super setCollectionViewLayout:collectionViewLayout]; - - [self _configureCollectionViewLayout:collectionViewLayout]; - - // Trigger recreation of layout inspector with new collection view layout - if (_layoutInspector != nil) { - _layoutInspector = nil; - [self layoutInspector]; - } -} - -- (id)layoutInspector -{ - if (_layoutInspector == nil) { - UICollectionViewLayout *layout = self.collectionViewLayout; - if (layout == nil) { - // Layout hasn't been set yet, we're still init'ing - return nil; - } - - _defaultLayoutInspector = [layout asdk_layoutInspector]; - ASDisplayNodeAssertNotNil(_defaultLayoutInspector, @"You must not return nil from -asdk_layoutInspector. Return [super asdk_layoutInspector] if you have to! Layout: %@", layout); - - // Explicitly call the setter to wire up the _layoutInspectorFlags - self.layoutInspector = _defaultLayoutInspector; - } - - return _layoutInspector; -} - -- (void)setLayoutInspector:(id)layoutInspector -{ - _layoutInspector = layoutInspector; - - _layoutInspectorFlags.constrainedSizeForSupplementaryNodeOfKindAtIndexPath = [_layoutInspector respondsToSelector:@selector(collectionView:constrainedSizeForSupplementaryNodeOfKind:atIndexPath:)]; - _layoutInspectorFlags.supplementaryNodesOfKindInSection = [_layoutInspector respondsToSelector:@selector(collectionView:supplementaryNodesOfKind:inSection:)]; - _layoutInspectorFlags.didChangeCollectionViewDataSource = [_layoutInspector respondsToSelector:@selector(didChangeCollectionViewDataSource:)]; - _layoutInspectorFlags.didChangeCollectionViewDelegate = [_layoutInspector respondsToSelector:@selector(didChangeCollectionViewDelegate:)]; - - if (_layoutInspectorFlags.didChangeCollectionViewDataSource) { - [_layoutInspector didChangeCollectionViewDataSource:self.asyncDataSource]; - } - if (_layoutInspectorFlags.didChangeCollectionViewDelegate) { - [_layoutInspector didChangeCollectionViewDelegate:self.asyncDelegate]; - } -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - [_rangeController setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [_rangeController tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - [_rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - return [_rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)setZeroContentInsets:(BOOL)zeroContentInsets -{ - _zeroContentInsets = zeroContentInsets; -} - -- (BOOL)zeroContentInsets -{ - return _zeroContentInsets; -} -#pragma clang diagnostic pop - -/// Uses latest size range from data source and -layoutThatFits:. -- (CGSize)sizeForElement:(ASCollectionElement *)element -{ - ASDisplayNodeAssertMainThread(); - if (element == nil) { - return CGSizeZero; - } - - ASCellNode *node = element.node; - ASDisplayNodeAssertNotNil(node, @"Node must not be nil!"); - - BOOL useUIKitCell = node.shouldUseUIKitCell; - if (useUIKitCell) { - ASWrapperCellNode *wrapperNode = (ASWrapperCellNode *)node; - if (wrapperNode.sizeForItemBlock) { - return wrapperNode.sizeForItemBlock(wrapperNode, element.constrainedSize.max); - } else { - // In this case, it is possible the model indexPath for this element will be nil. Attempt to convert it, - // and call out to the delegate directly. If it has been deleted from the model, the size returned will be the layout's default. - NSIndexPath *indexPath = [_dataController.visibleMap indexPathForElement:element]; - return [self _sizeForUIKitCellWithKind:element.supplementaryElementKind atIndexPath:indexPath]; - } - } else { - return [node layoutThatFits:element.constrainedSize].size; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (CGSize)calculatedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - - ASCollectionElement *e = [_dataController.visibleMap elementForItemAtIndexPath:indexPath]; - return [self sizeForElement:e]; -} -#pragma clang diagnostic pop - -- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return [_dataController.visibleMap elementForItemAtIndexPath:indexPath].node; -} - -- (NSIndexPath *)convertIndexPathFromCollectionNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait -{ - if (indexPath == nil) { - return nil; - } - - NSIndexPath *viewIndexPath = [_dataController.visibleMap convertIndexPath:indexPath fromMap:_dataController.pendingMap]; - if (viewIndexPath == nil && wait) { - [self waitUntilAllUpdatesAreCommitted]; - return [self convertIndexPathFromCollectionNode:indexPath waitingIfNeeded:NO]; - } - return viewIndexPath; -} - -/** - * Asserts that the index path is a valid view-index-path, and returns it if so, nil otherwise. - */ -- (nullable NSIndexPath *)validateIndexPath:(nullable NSIndexPath *)indexPath -{ - if (indexPath == nil) { - return nil; - } - - NSInteger section = indexPath.section; - if (section >= self.numberOfSections) { - ASDisplayNodeFailAssert(@"Collection view index path has invalid section %lu, section count = %lu", (unsigned long)section, (unsigned long)self.numberOfSections); - return nil; - } - - NSInteger item = indexPath.item; - // item == NSNotFound means e.g. "scroll to this section" and is acceptable - if (item != NSNotFound && item >= [self numberOfItemsInSection:section]) { - ASDisplayNodeFailAssert(@"Collection view index path has invalid item %lu in section %lu, item count = %lu", (unsigned long)indexPath.item, (unsigned long)section, (unsigned long)[self numberOfItemsInSection:section]); - return nil; - } - - return indexPath; -} - -- (NSIndexPath *)convertIndexPathToCollectionNode:(NSIndexPath *)indexPath -{ - if ([self validateIndexPath:indexPath] == nil) { - return nil; - } - - return [_dataController.pendingMap convertIndexPath:indexPath fromMap:_dataController.visibleMap]; -} - -- (NSArray *)convertIndexPathsToCollectionNode:(NSArray *)indexPaths -{ - return ASArrayByFlatMapping(indexPaths, NSIndexPath *viewIndexPath, [self convertIndexPathToCollectionNode:viewIndexPath]); -} - -- (ASCellNode *)supplementaryNodeForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath -{ - return [_dataController.visibleMap supplementaryElementOfKind:elementKind atIndexPath:indexPath].node; -} - -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode -{ - return [_dataController.visibleMap indexPathForElement:cellNode.collectionElement]; -} - -- (NSArray *)visibleNodes -{ - NSArray *indexPaths = [self indexPathsForVisibleItems]; - NSMutableArray *visibleNodes = [[NSMutableArray alloc] init]; - - for (NSIndexPath *indexPath in indexPaths) { - ASCellNode *node = [self nodeForItemAtIndexPath:indexPath]; - if (node) { - // It is possible for UICollectionView to return indexPaths before the node is completed. - [visibleNodes addObject:node]; - } - } - - return visibleNodes; -} - -- (void)invalidateFlowLayoutDelegateMetrics -{ - // Subclass hook -} - -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view { - if (_asyncDataSourceFlags.modelIdentifierMethods) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, nil); - NSIndexPath *convertedPath = [self convertIndexPathToCollectionNode:indexPath]; - if (convertedPath == nil) { - return nil; - } else { - return [_asyncDataSource modelIdentifierForElementAtIndexPath:convertedPath inNode:collectionNode]; - } - } else { - return nil; - } -} - -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view { - if (_asyncDataSourceFlags.modelIdentifierMethods) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, nil); - return [_asyncDataSource indexPathForElementWithModelIdentifier:identifier inNode:collectionNode]; - } else { - return nil; - } -} - -#pragma mark Internal - -- (void)_configureCollectionViewLayout:(nonnull UICollectionViewLayout *)layout -{ - _hasDataControllerLayoutDelegate = [layout conformsToProtocol:@protocol(ASDataControllerLayoutDelegate)]; - if (_hasDataControllerLayoutDelegate) { - _dataController.layoutDelegate = (id)layout; - } -} - -/** - This method is called only for UIKit Passthrough cells - either regular Items or Supplementary elements. - It checks if the delegate implements the UICollectionViewFlowLayout methods that provide sizes, and if not, - uses the default values set on the flow layout. If a flow layout is not in use, UICollectionView Passthrough - cells must be sized by logic in the Layout object, and Texture does not participate in these paths. -*/ -- (CGSize)_sizeForUIKitCellWithKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - CGSize size = CGSizeZero; - UICollectionViewLayout *l = self.collectionViewLayout; - - if (kind == nil) { - ASDisplayNodeAssert(_asyncDataSourceFlags.interop, @"This code should not be called except for UIKit passthrough compatibility"); - SEL sizeForItem = @selector(collectionView:layout:sizeForItemAtIndexPath:); - if (indexPath && [_asyncDelegate respondsToSelector:sizeForItem]) { - size = [(id)_asyncDelegate collectionView:self layout:l sizeForItemAtIndexPath:indexPath]; - } else { - size = ASFlowLayoutDefault(l, itemSize, CGSizeZero); - } - } else if ([kind isEqualToString:UICollectionElementKindSectionHeader]) { - ASDisplayNodeAssert(_asyncDataSourceFlags.interopViewForSupplementaryElement, @"This code should not be called except for UIKit passthrough compatibility"); - SEL sizeForHeader = @selector(collectionView:layout:referenceSizeForHeaderInSection:); - if (indexPath && [_asyncDelegate respondsToSelector:sizeForHeader]) { - size = [(id)_asyncDelegate collectionView:self layout:l referenceSizeForHeaderInSection:indexPath.section]; - } else { - size = ASFlowLayoutDefault(l, headerReferenceSize, CGSizeZero); - } - } else if ([kind isEqualToString:UICollectionElementKindSectionFooter]) { - ASDisplayNodeAssert(_asyncDataSourceFlags.interopViewForSupplementaryElement, @"This code should not be called except for UIKit passthrough compatibility"); - SEL sizeForFooter = @selector(collectionView:layout:referenceSizeForFooterInSection:); - if (indexPath && [_asyncDelegate respondsToSelector:sizeForFooter]) { - size = [(id)_asyncDelegate collectionView:self layout:l referenceSizeForFooterInSection:indexPath.section]; - } else { - size = ASFlowLayoutDefault(l, footerReferenceSize, CGSizeZero); - } - } - - return size; -} - -- (void)_superReloadData:(void(^)())updates completion:(void(^)(BOOL finished))completion -{ - if (updates) { - updates(); - } - [super reloadData]; - if (completion) { - completion(YES); - } -} - -/** - * Performing nested batch updates with super (e.g. resizing a cell node & updating collection view - * during same frame) can cause super to throw data integrity exceptions because it checks the data - * source counts before the update is complete. - * - * Always call [self _superPerform:] rather than [super performBatch:] so that we can keep our - * `superPerformingBatchUpdates` flag updated. -*/ -- (void)_superPerformBatchUpdates:(void(^)())updates completion:(void(^)(BOOL finished))completion -{ - ASDisplayNodeAssertMainThread(); - - _superBatchUpdateCount++; - [super performBatchUpdates:updates completion:completion]; - _superBatchUpdateCount--; -} - -#pragma mark Assertions. - -- (ASDataController *)dataController -{ - return _dataController; -} - -- (void)beginUpdates -{ - ASDisplayNodeAssertMainThread(); - // _changeSet must be available during batch update - ASDisplayNodeAssertTrue((_batchUpdateCount > 0) == (_changeSet != nil)); - - if (_batchUpdateCount == 0) { - _changeSet = [[_ASHierarchyChangeSet alloc] initWithOldData:[_dataController itemCountsFromDataSource]]; - _changeSet.rootActivity = as_activity_create("Perform async collection update", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); - _changeSet.submitActivity = as_activity_create("Submit changes for collection update", _changeSet.rootActivity, OS_ACTIVITY_FLAG_DEFAULT); - } - _batchUpdateCount++; -} - -- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertNotNil(_changeSet, @"_changeSet must be available when batch update ends"); - - _batchUpdateCount--; - // Prevent calling endUpdatesAnimated:completion: in an unbalanced way - NSAssert(_batchUpdateCount >= 0, @"endUpdatesAnimated:completion: called without having a balanced beginUpdates call"); - - [_changeSet addCompletionHandler:completion]; - - if (_batchUpdateCount == 0) { - _ASHierarchyChangeSet *changeSet = _changeSet; - - // Nil out _changeSet before forwarding to _dataController to allow the change set to cause subsequent batch updates on the same run loop - _changeSet = nil; - changeSet.animated = animated; - [_dataController updateWithChangeSet:changeSet]; - } -} - -- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - ASDisplayNodeAssertMainThread(); - [self beginUpdates]; - as_activity_scope(_changeSet.rootActivity); - { - // Only include client code in the submit activity, the rest just lives in the root activity. - as_activity_scope(_changeSet.submitActivity); - if (updates) { - updates(); - } - } - [self endUpdatesAnimated:animated completion:completion]; -} - -- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - // We capture the current state of whether animations are enabled if they don't provide us with one. - [self performBatchAnimated:[UIView areAnimationsEnabled] updates:updates completion:completion]; -} - -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind -{ - ASDisplayNodeAssert(elementKind != nil, @"A kind is needed for supplementary node registration"); - [_registeredSupplementaryKinds addObject:elementKind]; - [self registerClass:[_ASCollectionReusableView class] forSupplementaryViewOfKind:elementKind withReuseIdentifier:kReuseIdentifier]; -} - -- (void)insertSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet insertSections:sections animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)deleteSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet deleteSections:sections animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)reloadSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet reloadSections:sections animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection -{ - ASDisplayNodeAssertMainThread(); - [self performBatchUpdates:^{ - [_changeSet moveSection:section toSection:newSection animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (id)contextForSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - return [_dataController.visibleMap contextForSection:section]; -} - -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet insertItems:indexPaths animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet deleteItems:indexPaths animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self performBatchUpdates:^{ - [_changeSet reloadItems:indexPaths animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; -} - -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath -{ - ASDisplayNodeAssertMainThread(); - if (!_reordering) { - [self performBatchUpdates:^{ - [_changeSet moveItemAtIndexPath:indexPath toIndexPath:newIndexPath animationOptions:kASCollectionViewAnimationNone]; - } completion:nil]; - } else { - [super moveItemAtIndexPath:indexPath toIndexPath:newIndexPath]; - } -} - -- (BOOL)beginInteractiveMovementForItemAtIndexPath:(NSIndexPath *)indexPath { - BOOL success = [super beginInteractiveMovementForItemAtIndexPath:indexPath]; - _reordering = success; - return success; -} - -- (void)endInteractiveMovement { - _reordering = NO; - [super endInteractiveMovement]; -} - -- (void)cancelInteractiveMovement { - _reordering = NO; - [super cancelInteractiveMovement]; -} - -#pragma mark - -#pragma mark Intercepted selectors. - -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView -{ - if (_superIsPendingDataLoad) { - [_rangeController setNeedsUpdate]; - [self _scheduleCheckForBatchFetchingForNumberOfChanges:1]; - _superIsPendingDataLoad = NO; - } - return _dataController.visibleMap.numberOfSections; -} - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section -{ - return [_dataController.visibleMap numberOfItemsInSection:section]; -} - -- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)layout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - ASCollectionElement *e = [_dataController.visibleMap elementForItemAtIndexPath:indexPath]; - return e ? [self sizeForElement:e] : ASFlowLayoutDefault(layout, itemSize, CGSizeZero); -} - -- (CGSize)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout *)l - referenceSizeForHeaderInSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - ASElementMap *map = _dataController.visibleMap; - ASCollectionElement *e = [map supplementaryElementOfKind:UICollectionElementKindSectionHeader - atIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]; - return e ? [self sizeForElement:e] : ASFlowLayoutDefault(l, headerReferenceSize, CGSizeZero); -} - -- (CGSize)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout *)l - referenceSizeForFooterInSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - ASElementMap *map = _dataController.visibleMap; - ASCollectionElement *e = [map supplementaryElementOfKind:UICollectionElementKindSectionFooter - atIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]; - return e ? [self sizeForElement:e] : ASFlowLayoutDefault(l, footerReferenceSize, CGSizeZero); -} - -// For the methods that call delegateIndexPathForSection:withSelector:, translate the section from -// visibleMap to pendingMap. If the section no longer exists, or the delegate doesn't implement -// the selector, we will return NSNotFound (and then use the ASFlowLayoutDefault). -- (NSInteger)delegateIndexForSection:(NSInteger)section withSelector:(SEL)selector -{ - if ([_asyncDelegate respondsToSelector:selector]) { - return [_dataController.pendingMap convertSection:section fromMap:_dataController.visibleMap]; - } else { - return NSNotFound; - } -} - -- (UIEdgeInsets)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout *)l - insetForSectionAtIndex:(NSInteger)section -{ - section = [self delegateIndexForSection:section withSelector:_cmd]; - if (section != NSNotFound) { - return [(id)_asyncDelegate collectionView:cv layout:l insetForSectionAtIndex:section]; - } - return ASFlowLayoutDefault(l, sectionInset, UIEdgeInsetsZero); -} - -- (CGFloat)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout *)l - minimumInteritemSpacingForSectionAtIndex:(NSInteger)section -{ - section = [self delegateIndexForSection:section withSelector:_cmd]; - if (section != NSNotFound) { - return [(id)_asyncDelegate collectionView:cv layout:l - minimumInteritemSpacingForSectionAtIndex:section]; - } - return ASFlowLayoutDefault(l, minimumInteritemSpacing, 10.0); // Default is documented as 10.0 -} - -- (CGFloat)collectionView:(UICollectionView *)cv layout:(UICollectionViewLayout *)l - minimumLineSpacingForSectionAtIndex:(NSInteger)section -{ - section = [self delegateIndexForSection:section withSelector:_cmd]; - if (section != NSNotFound) { - return [(id)_asyncDelegate collectionView:cv layout:l - minimumLineSpacingForSectionAtIndex:section]; - } - return ASFlowLayoutDefault(l, minimumLineSpacing, 10.0); // Default is documented as 10.0 -} - -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - if ([_registeredSupplementaryKinds containsObject:kind] == NO) { - [self registerSupplementaryNodeOfKind:kind]; - } - - UICollectionReusableView *view = nil; - ASCollectionElement *element = [_dataController.visibleMap supplementaryElementOfKind:kind atIndexPath:indexPath]; - ASCellNode *node = element.node; - ASWrapperCellNode *wrapperNode = (node.shouldUseUIKitCell ? (ASWrapperCellNode *)node : nil); - BOOL shouldDequeueExternally = _asyncDataSourceFlags.interopAlwaysDequeue || (_asyncDataSourceFlags.interopViewForSupplementaryElement && wrapperNode); - - if (wrapperNode.viewForSupplementaryBlock) { - view = wrapperNode.viewForSupplementaryBlock(wrapperNode); - } else if (shouldDequeueExternally) { - // This codepath is used for both IGListKit mode, and app-level UICollectionView interop. - view = [(id)_asyncDataSource collectionView:collectionView viewForSupplementaryElementOfKind:kind atIndexPath:indexPath]; - } else { - ASDisplayNodeAssert(node != nil, @"Supplementary node should exist. Kind = %@, indexPath = %@, collectionDataSource = %@", kind, indexPath, self); - view = [self dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:kReuseIdentifier forIndexPath:indexPath]; - } - - if (_ASCollectionReusableView *reusableView = ASDynamicCastStrict(view, _ASCollectionReusableView)) { - reusableView.element = element; - } - - if (node) { - [_rangeController configureContentView:view forCellNode:node]; - } - - return view; -} - -- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath -{ - UICollectionViewCell *cell = nil; - ASCollectionElement *element = [_dataController.visibleMap elementForItemAtIndexPath:indexPath]; - ASCellNode *node = element.node; - ASWrapperCellNode *wrapperNode = (node.shouldUseUIKitCell ? (ASWrapperCellNode *)node : nil); - BOOL shouldDequeueExternally = _asyncDataSourceFlags.interopAlwaysDequeue || (_asyncDataSourceFlags.interop && wrapperNode); - - if (wrapperNode.cellForItemBlock) { - cell = wrapperNode.cellForItemBlock(wrapperNode); - } else if (shouldDequeueExternally) { - cell = [(id)_asyncDataSource collectionView:collectionView cellForItemAtIndexPath:indexPath]; - } else { - cell = [self dequeueReusableCellWithReuseIdentifier:kReuseIdentifier forIndexPath:indexPath]; - } - - ASDisplayNodeAssert(element != nil, @"Element should exist. indexPath = %@, collectionDataSource = %@", indexPath, self); - ASDisplayNodeAssert(cell != nil, @"UICollectionViewCell must not be nil. indexPath = %@, collectionDataSource = %@", indexPath, self); - - if (_ASCollectionViewCell *asCell = ASDynamicCastStrict(cell, _ASCollectionViewCell)) { - asCell.element = element; - [_rangeController configureContentView:cell.contentView forCellNode:node]; - } - - return cell; -} - -- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)rawCell forItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.interopWillDisplayCell) { - ASCellNode *node = [self nodeForItemAtIndexPath:indexPath]; - if (node.shouldUseUIKitCell) { - [(id )_asyncDelegate collectionView:collectionView willDisplayCell:rawCell forItemAtIndexPath:indexPath]; - } - } - - _ASCollectionViewCell *cell = ASDynamicCastStrict(rawCell, _ASCollectionViewCell); - if (cell == nil) { - [_rangeController setNeedsUpdate]; - return; - } - - ASCollectionElement *element = cell.element; - if (element) { - ASDisplayNodeAssertTrue([_dataController.visibleMap elementForItemAtIndexPath:indexPath] == element); - [_visibleElements addObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for willDisplayCell: %@, %@, %@", rawCell, self, indexPath); - return; - } - - ASCellNode *cellNode = element.node; - cellNode.scrollView = collectionView; - - // Update the selected background view in collectionView:willDisplayCell:forItemAtIndexPath: otherwise it could be too - // early e.g. if the selectedBackgroundView was set in didLoad() - cell.selectedBackgroundView = cellNode.selectedBackgroundView; - cell.backgroundView = cellNode.backgroundView; - - // Under iOS 10+, cells may be removed/re-added to the collection view without - // receiving prepareForReuse/applyLayoutAttributes, as an optimization for e.g. - // if the user is scrolling back and forth across a small set of items. - // In this case, we have to fetch the layout attributes manually. - // This may be possible under iOS < 10 but it has not been observed yet. - if (cell.layoutAttributes == nil) { - cell.layoutAttributes = [collectionView layoutAttributesForItemAtIndexPath:indexPath]; - } - - ASDisplayNodeAssertNotNil(cellNode, @"Expected node associated with cell that will be displayed not to be nil. indexPath: %@", indexPath); - - if (_asyncDelegateFlags.collectionNodeWillDisplayItem && self.collectionNode != nil) { - [_asyncDelegate collectionNode:self.collectionNode willDisplayItemWithNode:cellNode]; - } else if (_asyncDelegateFlags.collectionViewWillDisplayNodeForItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self willDisplayNode:cellNode forItemAtIndexPath:indexPath]; - } else if (_asyncDelegateFlags.collectionViewWillDisplayNodeForItemDeprecated) { - [_asyncDelegate collectionView:self willDisplayNodeForItemAtIndexPath:indexPath]; - } -#pragma clang diagnostic pop - - [_rangeController setNeedsUpdate]; - - if ([cell consumesCellNodeVisibilityEvents]) { - [_cellsForVisibilityUpdates addObject:cell]; - } -} - -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)rawCell forItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.interopDidEndDisplayingCell) { - ASCellNode *node = [self nodeForItemAtIndexPath:indexPath]; - if (node.shouldUseUIKitCell) { - [(id )_asyncDelegate collectionView:collectionView didEndDisplayingCell:rawCell forItemAtIndexPath:indexPath]; - } - } - - _ASCollectionViewCell *cell = ASDynamicCastStrict(rawCell, _ASCollectionViewCell); - if (cell == nil) { - [_rangeController setNeedsUpdate]; - return; - } - - // Retrieve the element from cell instead of visible map because at this point visible map could have been updated and no longer holds the element. - ASCollectionElement *element = cell.element; - if (element) { - [_visibleElements removeObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for didEndDisplayingCell: %@, %@, %@", rawCell, self, indexPath); - return; - } - - ASCellNode *cellNode = element.node; - - if (_asyncDelegateFlags.collectionNodeDidEndDisplayingItem) { - if (ASCollectionNode *collectionNode = self.collectionNode) { - [_asyncDelegate collectionNode:collectionNode didEndDisplayingItemWithNode:cellNode]; - } - } else if (_asyncDelegateFlags.collectionViewDidEndDisplayingNodeForItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self didEndDisplayingNode:cellNode forItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - - [_rangeController setNeedsUpdate]; - - [_cellsForVisibilityUpdates removeObject:cell]; - - cellNode.scrollView = nil; - cell.layoutAttributes = nil; -} - -- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)rawView forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.interopWillDisplaySupplementaryView) { - ASCellNode *node = [self supplementaryNodeForElementKind:elementKind atIndexPath:indexPath]; - if (node.shouldUseUIKitCell) { - [(id )_asyncDelegate collectionView:collectionView willDisplaySupplementaryView:rawView forElementKind:elementKind atIndexPath:indexPath]; - } - } - - _ASCollectionReusableView *view = ASDynamicCastStrict(rawView, _ASCollectionReusableView); - if (view == nil) { - return; - } - - ASCollectionElement *element = view.element; - if (element) { - ASDisplayNodeAssertTrue([_dataController.visibleMap supplementaryElementOfKind:elementKind atIndexPath:indexPath] == view.element); - [_visibleElements addObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for willDisplaySupplementaryView: %@, %@, %@", rawView, self, indexPath); - return; - } - - // Under iOS 10+, cells may be removed/re-added to the collection view without - // receiving prepareForReuse/applyLayoutAttributes, as an optimization for e.g. - // if the user is scrolling back and forth across a small set of items. - // In this case, we have to fetch the layout attributes manually. - // This may be possible under iOS < 10 but it has not been observed yet. - if (view.layoutAttributes == nil) { - view.layoutAttributes = [collectionView layoutAttributesForSupplementaryElementOfKind:elementKind atIndexPath:indexPath]; - } - - if (_asyncDelegateFlags.collectionNodeWillDisplaySupplementaryElement) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - ASCellNode *node = element.node; - ASDisplayNodeAssert([node.supplementaryElementKind isEqualToString:elementKind], @"Expected node for supplementary element to have kind '%@', got '%@'.", elementKind, node.supplementaryElementKind); - [_asyncDelegate collectionNode:collectionNode willDisplaySupplementaryElementWithNode:node]; - } -} - -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)rawView forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.interopdidEndDisplayingSupplementaryView) { - ASCellNode *node = [self supplementaryNodeForElementKind:elementKind atIndexPath:indexPath]; - if (node.shouldUseUIKitCell) { - [(id )_asyncDelegate collectionView:collectionView didEndDisplayingSupplementaryView:rawView forElementOfKind:elementKind atIndexPath:indexPath]; - } - } - - _ASCollectionReusableView *view = ASDynamicCastStrict(rawView, _ASCollectionReusableView); - if (view == nil) { - return; - } - - // Retrieve the element from cell instead of visible map because at this point visible map could have been updated and no longer holds the element. - ASCollectionElement *element = view.element; - if (element) { - [_visibleElements removeObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for didEndDisplayingSupplementaryView: %@, %@, %@", rawView, self, indexPath); - return; - } - - if (_asyncDelegateFlags.collectionNodeDidEndDisplayingSupplementaryElement) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - ASCellNode *node = element.node; - ASDisplayNodeAssert([node.supplementaryElementKind isEqualToString:elementKind], @"Expected node for supplementary element to have kind '%@', got '%@'.", elementKind, node.supplementaryElementKind); - [_asyncDelegate collectionNode:collectionNode didEndDisplayingSupplementaryElementWithNode:node]; - } -} - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeShouldSelectItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate collectionNode:collectionNode shouldSelectItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewShouldSelectItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate collectionView:self shouldSelectItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return YES; -} - -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeDidSelectItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate collectionNode:collectionNode didSelectItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewDidSelectItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self didSelectItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeShouldDeselectItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate collectionNode:collectionNode shouldDeselectItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewShouldDeselectItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate collectionView:self shouldDeselectItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return YES; -} - -- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeDidDeselectItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate collectionNode:collectionNode didDeselectItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewDidDeselectItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self didDeselectItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeShouldHighlightItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate collectionNode:collectionNode shouldHighlightItemAtIndexPath:indexPath]; - } else { - return YES; - } - } else if (_asyncDelegateFlags.collectionViewShouldHighlightItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate collectionView:self shouldHighlightItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return YES; -} - -- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeDidHighlightItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate collectionNode:collectionNode didHighlightItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewDidHighlightItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self didHighlightItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeDidUnhighlightItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate collectionNode:collectionNode didUnhighlightItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewDidUnhighlightItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self didUnhighlightItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.collectionNodeShouldShowMenuForItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate collectionNode:collectionNode shouldShowMenuForItemAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.collectionViewShouldShowMenuForItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate collectionView:self shouldShowMenuForItemAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return NO; -} - -- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(nonnull SEL)action forItemAtIndexPath:(nonnull NSIndexPath *)indexPath withSender:(nullable id)sender -{ - if (_asyncDelegateFlags.collectionNodeCanPerformActionForItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate collectionNode:collectionNode canPerformAction:action forItemAtIndexPath:indexPath sender:sender]; - } - } else if (_asyncDelegateFlags.collectionViewCanPerformActionForItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate collectionView:self canPerformAction:action forItemAtIndexPath:indexPath withSender:sender]; -#pragma clang diagnostic pop - } - return NO; -} - -- (void)collectionView:(UICollectionView *)collectionView performAction:(nonnull SEL)action forItemAtIndexPath:(nonnull NSIndexPath *)indexPath withSender:(nullable id)sender -{ - if (_asyncDelegateFlags.collectionNodePerformActionForItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - indexPath = [self convertIndexPathToCollectionNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate collectionNode:collectionNode performAction:action forItemAtIndexPath:indexPath sender:sender]; - } - } else if (_asyncDelegateFlags.collectionViewPerformActionForItem) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate collectionView:self performAction:action forItemAtIndexPath:indexPath withSender:sender]; -#pragma clang diagnostic pop - } -} - -- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath -{ - // Mimic UIKit's gating logic. - // If the data source doesn't support moving, then all bets are off. - if (!_asyncDataSourceFlags.collectionNodeMoveItem) { - return NO; - } - - // Currently we do not support interactive moves when using async layout. The reason is, we do not have a mechanism - // to propagate the "presentation data" element map (containing the speculative in-progress moves) to the layout delegate, - // and this can cause exceptions to be thrown from UICV. For example, if you drag an item out of a section, - // the element map will still contain N items in that section, even though there's only N-1 shown, and UICV will - // throw an exception that you specified an element that doesn't exist. - // - // In iOS >= 11, this is made much easier by the UIDataSourceTranslating API. In previous versions of iOS our best bet - // would be to capture the invalidation contexts that are sent during interactive moves and make our own data source translator. - if ([self.collectionViewLayout isKindOfClass:[ASCollectionLayout class]]) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - os_log_debug(ASCollectionLog(), "Collection node item interactive movement is not supported when using a layout delegate. This message will only be logged once. Node: %@", ASObjectDescriptionMakeTiny(self)); - }); - return NO; - } - - // If the data source implements canMoveItem, let them decide. - if (_asyncDataSourceFlags.collectionNodeCanMoveItem) { - if (ASCellNode *cellNode = [self nodeForItemAtIndexPath:indexPath]) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - return [_asyncDataSource collectionNode:collectionNode canMoveItemWithNode:cellNode]; - } - } - - // Otherwise allow the move for all items. - return YES; -} - -- (void)collectionView:(UICollectionView *)collectionView moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath -{ - ASDisplayNodeAssert(_asyncDataSourceFlags.collectionNodeMoveItem, @"Should not allow interactive collection item movement if data source does not support it."); - - // Inform the data source first, in case they call nodeForItemAtIndexPath:. - // We want to make sure we return them the node for the item they have in mind. - if (ASCollectionNode *collectionNode = self.collectionNode) { - [_asyncDataSource collectionNode:collectionNode moveItemAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; - } - - // Now we update our data controller's store. - // Get up to date - [self waitUntilAllUpdatesAreCommitted]; - // Set our flag to suppress informing super about the change. - ASDisplayNodeAssertFalse(_updatingInResponseToInteractiveMove); - _updatingInResponseToInteractiveMove = YES; - // Submit the move - [self moveItemAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; - // Wait for it to finish – should be fast! - [self waitUntilAllUpdatesAreCommitted]; - // Clear the flag - _updatingInResponseToInteractiveMove = NO; -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - ASInterfaceState interfaceState = [self interfaceStateForRangeController:_rangeController]; - if (ASInterfaceStateIncludesVisible(interfaceState)) { - [self _checkForBatchFetching]; - } - for (_ASCollectionViewCell *cell in _cellsForVisibilityUpdates) { - // _cellsForVisibilityUpdates only includes cells for ASCellNode subclasses with overrides of the visibility method. - [cell cellNodeVisibilityEvent:ASCellNodeVisibilityEventVisibleRectChanged inScrollView:scrollView]; - } - if (_asyncDelegateFlags.scrollViewDidScroll) { - [_asyncDelegate scrollViewDidScroll:scrollView]; - } -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset -{ - CGPoint contentOffset = scrollView.contentOffset; - _deceleratingVelocity = CGPointMake( - contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0), - contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0) - ); - - if (targetContentOffset != NULL) { - ASDisplayNodeAssert(_batchContext != nil, @"Batch context should exist"); - [self _beginBatchFetchingIfNeededWithContentOffset:*targetContentOffset velocity:velocity]; - } - - if (_asyncDelegateFlags.scrollViewWillEndDragging) { - [_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:(targetContentOffset ? : &contentOffset)]; - } -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView -{ - _deceleratingVelocity = CGPointZero; - - if (_asyncDelegateFlags.scrollViewDidEndDecelerating) { - [_asyncDelegate scrollViewDidEndDecelerating:scrollView]; - } -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - // If a scroll happens the current range mode needs to go to full - _rangeController.contentHasBeenScrolled = YES; - [_rangeController updateCurrentRangeWithMode:ASLayoutRangeModeFull]; - - for (_ASCollectionViewCell *cell in _cellsForVisibilityUpdates) { - [cell cellNodeVisibilityEvent:ASCellNodeVisibilityEventWillBeginDragging inScrollView:scrollView]; - } - if (_asyncDelegateFlags.scrollViewWillBeginDragging) { - [_asyncDelegate scrollViewWillBeginDragging:scrollView]; - } -} - -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate -{ - for (_ASCollectionViewCell *cell in _cellsForVisibilityUpdates) { - [cell cellNodeVisibilityEvent:ASCellNodeVisibilityEventDidEndDragging inScrollView:scrollView]; - } - if (_asyncDelegateFlags.scrollViewDidEndDragging) { - [_asyncDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; - } -} - -#pragma mark - Scroll Direction. - -- (BOOL)inverted -{ - return _inverted; -} - -- (void)setInverted:(BOOL)inverted -{ - _inverted = inverted; -} - -- (void)setLeadingScreensForBatching:(CGFloat)leadingScreensForBatching -{ - if (_leadingScreensForBatching != leadingScreensForBatching) { - _leadingScreensForBatching = leadingScreensForBatching; - // Push this to the next runloop to be sure the scroll view has the right content size - dispatch_async(dispatch_get_main_queue(), ^{ - [self _checkForBatchFetching]; - }); - } -} - -- (CGFloat)leadingScreensForBatching -{ - return _leadingScreensForBatching; -} - -- (ASScrollDirection)scrollDirection -{ - CGPoint scrollVelocity; - if (self.isTracking) { - scrollVelocity = [self.panGestureRecognizer velocityInView:self.superview]; - } else { - scrollVelocity = _deceleratingVelocity; - } - - ASScrollDirection scrollDirection = [self _scrollDirectionForVelocity:scrollVelocity]; - return ASScrollDirectionApplyTransform(scrollDirection, self.transform); -} - -- (ASScrollDirection)_scrollDirectionForVelocity:(CGPoint)scrollVelocity -{ - ASScrollDirection direction = ASScrollDirectionNone; - ASScrollDirection scrollableDirections = [self scrollableDirections]; - - if (ASScrollDirectionContainsHorizontalDirection(scrollableDirections)) { // Can scroll horizontally. - if (scrollVelocity.x < 0.0) { - direction |= ASScrollDirectionRight; - } else if (scrollVelocity.x > 0.0) { - direction |= ASScrollDirectionLeft; - } - } - if (ASScrollDirectionContainsVerticalDirection(scrollableDirections)) { // Can scroll vertically. - if (scrollVelocity.y < 0.0) { - direction |= ASScrollDirectionDown; - } else if (scrollVelocity.y > 0.0) { - direction |= ASScrollDirectionUp; - } - } - - return direction; -} - -- (ASScrollDirection)scrollableDirections -{ - ASDisplayNodeAssertNotNil(self.layoutInspector, @"Layout inspector should be assigned."); - return [self.layoutInspector scrollableDirections]; -} - -- (void)layoutSubviews -{ - if (_cellsForLayoutUpdates.count > 0) { - NSArray *nodes = [_cellsForLayoutUpdates allObjects]; - [_cellsForLayoutUpdates removeAllObjects]; - - NSMutableArray *nodesSizeChanged = [[NSMutableArray alloc] init]; - - [_dataController relayoutNodes:nodes nodesSizeChanged:nodesSizeChanged]; - [self nodesDidRelayout:nodesSizeChanged]; - } - - // Flush any pending invalidation action if needed. - ASCollectionViewInvalidationStyle invalidationStyle = _nextLayoutInvalidationStyle; - _nextLayoutInvalidationStyle = ASCollectionViewInvalidationStyleNone; - switch (invalidationStyle) { - case ASCollectionViewInvalidationStyleWithAnimation: - if (0 == _superBatchUpdateCount) { - if (ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysReloadData)) { - [self _superReloadData:nil completion:nil]; - } else { - [self _superPerformBatchUpdates:nil completion:nil]; - } - } - break; - case ASCollectionViewInvalidationStyleWithoutAnimation: - [self.collectionViewLayout invalidateLayout]; - break; - default: - break; - } - - // To ensure _maxSizeForNodesConstrainedSize is up-to-date for every usage, this call to super must be done last - [super layoutSubviews]; - - if (_zeroContentInsets) { - self.contentInset = UIEdgeInsetsZero; - } - - // Update range controller immediately if possible & needed. - // Calling -updateIfNeeded in here with self.window == nil (early in the collection view's life) - // may cause UICollectionView data related crashes. We'll update in -didMoveToWindow anyway. - if (self.window != nil) { - [_rangeController updateIfNeeded]; - } -} - - -#pragma mark - Batch Fetching - -- (ASBatchContext *)batchContext -{ - return _batchContext; -} - -- (BOOL)canBatchFetch -{ - // if the delegate does not respond to this method, there is no point in starting to fetch - BOOL canFetch = _asyncDelegateFlags.collectionNodeWillBeginBatchFetch || _asyncDelegateFlags.collectionViewWillBeginBatchFetch; - if (canFetch && _asyncDelegateFlags.shouldBatchFetchForCollectionNode) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, NO); - return [_asyncDelegate shouldBatchFetchForCollectionNode:collectionNode]; - } else if (canFetch && _asyncDelegateFlags.shouldBatchFetchForCollectionView) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate shouldBatchFetchForCollectionView:self]; -#pragma clang diagnostic pop - } else { - return canFetch; - } -} - -- (id)batchFetchingDelegate{ - return self.collectionNode.batchFetchingDelegate; -} - -- (void)_scheduleCheckForBatchFetchingForNumberOfChanges:(NSUInteger)changes -{ - // Prevent fetching will continually trigger in a loop after reaching end of content and no new content was provided - if (changes == 0 && _hasEverCheckedForBatchFetchingDueToUpdate) { - return; - } - _hasEverCheckedForBatchFetchingDueToUpdate = YES; - - // Push this to the next runloop to be sure the scroll view has the right content size - dispatch_async(dispatch_get_main_queue(), ^{ - [self _checkForBatchFetching]; - }); -} - -- (void)_checkForBatchFetching -{ - // Dragging will be handled in scrollViewWillEndDragging:withVelocity:targetContentOffset: - if (self.isDragging || self.isTracking) { - return; - } - - [self _beginBatchFetchingIfNeededWithContentOffset:self.contentOffset velocity:CGPointZero]; -} - -- (void)_beginBatchFetchingIfNeededWithContentOffset:(CGPoint)contentOffset velocity:(CGPoint)velocity -{ - // Since we are accessing self.collectionViewLayout, we should make sure we are on main - ASDisplayNodeAssertMainThread(); - BOOL flipsHorizontallyInOppositeLayoutDirection = NO; - if (AS_AVAILABLE_IOS(11.0)) { - flipsHorizontallyInOppositeLayoutDirection = self.collectionViewLayout.flipsHorizontallyInOppositeLayoutDirection; - } - if (ASDisplayShouldFetchBatchForScrollView(self, self.scrollDirection, self.scrollableDirections, contentOffset, velocity, flipsHorizontallyInOppositeLayoutDirection)) { - [self _beginBatchFetching]; - } -} - -- (void)_beginBatchFetching -{ - as_activity_create_for_scope("Batch fetch for collection node"); - [_batchContext beginBatchFetching]; - if (_asyncDelegateFlags.collectionNodeWillBeginBatchFetch) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - GET_COLLECTIONNODE_OR_RETURN(collectionNode, (void)0); - os_log_debug(ASCollectionLog(), "Beginning batch fetch for %@ with context %@", collectionNode, self->_batchContext); - [self->_asyncDelegate collectionNode:collectionNode willBeginBatchFetchWithContext:self->_batchContext]; - }); - } else if (_asyncDelegateFlags.collectionViewWillBeginBatchFetch) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self->_asyncDelegate collectionView:self willBeginBatchFetchWithContext:self->_batchContext]; -#pragma clang diagnostic pop - }); - } -} - -#pragma mark - ASDataControllerSource - -- (BOOL)dataController:(ASDataController *)dataController shouldEagerlyLayoutNode:(ASCellNode *)node -{ - NSAssert(!ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysLazy), - @"ASCellLayoutModeAlwaysLazy flag is no longer supported"); - return !node.shouldUseUIKitCell; -} - -- (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyProcessChangeSet:(_ASHierarchyChangeSet *)changeSet -{ - // If we have AlwaysSync set, block and donate main priority. - if (ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysSync)) { - return YES; - } - // Prioritize AlwaysAsync over the remaining heuristics for the Default mode. - if (ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysAsync)) { - return NO; - } - // Reload data is expensive, don't block main while doing so. - if (changeSet.includesReloadData) { - return NO; - } - // If we have very few ASCellNodes (besides UIKit passthrough ones), match UIKit by blocking. - if (changeSet.countForAsyncLayout < 2) { - return YES; - } - CGSize contentSize = self.contentSize; - CGSize boundsSize = self.bounds.size; - if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { - return YES; - } - return NO; // ASCellLayoutModeNone -} - -- (BOOL)dataControllerShouldSerializeNodeCreation:(ASDataController *)dataController -{ - return ASCellLayoutModeIncludes(ASCellLayoutModeSerializeNodeCreation); -} - -- (id)dataController:(ASDataController *)dataController nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (!_asyncDataSourceFlags.nodeModelForItem) { - return nil; - } - - GET_COLLECTIONNODE_OR_RETURN(collectionNode, nil); - return [_asyncDataSource collectionNode:collectionNode nodeModelForItemAtIndexPath:indexPath]; -} - -- (ASCellNodeBlock)dataController:(ASDataController *)dataController nodeBlockAtIndexPath:(NSIndexPath *)indexPath shouldAsyncLayout:(BOOL *)shouldAsyncLayout -{ - ASDisplayNodeAssertMainThread(); - ASCellNodeBlock block = nil; - ASCellNode *cell = nil; - - if (_asyncDataSourceFlags.collectionNodeNodeBlockForItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, ^{ return [[ASCellNode alloc] init]; }); - block = [_asyncDataSource collectionNode:collectionNode nodeBlockForItemAtIndexPath:indexPath]; - } - if (!block && !cell && _asyncDataSourceFlags.collectionNodeNodeForItem) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, ^{ return [[ASCellNode alloc] init]; }); - cell = [_asyncDataSource collectionNode:collectionNode nodeForItemAtIndexPath:indexPath]; - } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (!block && !cell && _asyncDataSourceFlags.collectionViewNodeBlockForItem) { - block = [_asyncDataSource collectionView:self nodeBlockForItemAtIndexPath:indexPath]; - } - if (!block && !cell && _asyncDataSourceFlags.collectionViewNodeForItem) { - cell = [_asyncDataSource collectionView:self nodeForItemAtIndexPath:indexPath]; - } -#pragma clang diagnostic pop - - if (block == nil) { - if (cell == nil || ASDynamicCast(cell, ASCellNode) == nil) { - // In this case, either the client is expecting a UIKit passthrough cell to be created automatically, - // or it is an error. - if (_asyncDataSourceFlags.interop) { - cell = [[ASWrapperCellNode alloc] init]; - } else { - ASDisplayNodeFailAssert(@"ASCollection could not get a node block for item at index path %@: %@, %@. If you are trying to display a UICollectionViewCell, make sure your dataSource conforms to the protocol!", indexPath, cell, block); - cell = [[ASCellNode alloc] init]; - } - } - - // This condition is intended to run for either cells received from the datasource, or created just above. - if (cell.shouldUseUIKitCell) { - *shouldAsyncLayout = NO; - } - } - - // Wrap the node block - BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); - __weak __typeof__(self) weakSelf = self; - return ^{ - __typeof__(self) strongSelf = weakSelf; - ASCellNode *node = (block ? block() : cell); - ASDisplayNodeAssert([node isKindOfClass:[ASCellNode class]], @"ASCollectionNode provided a non-ASCellNode! %@, %@", node, strongSelf); - - if (!disableRangeController) { - [node enterHierarchyState:ASHierarchyStateRangeManaged]; - } - if (node.interactionDelegate == nil) { - node.interactionDelegate = strongSelf; - } - if (strongSelf.inverted) { - node.transform = CATransform3DMakeScale(1, -1, 1); - } - return node; - }; -} - -- (NSUInteger)dataController:(ASDataController *)dataController rowsInSection:(NSUInteger)section -{ - if (_asyncDataSourceFlags.collectionNodeNumberOfItemsInSection) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, 0); - return [_asyncDataSource collectionNode:collectionNode numberOfItemsInSection:section]; - } else if (_asyncDataSourceFlags.collectionViewNumberOfItemsInSection) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDataSource collectionView:self numberOfItemsInSection:section]; -#pragma clang diagnostic pop - } else { - return 0; - } -} - -- (NSUInteger)numberOfSectionsInDataController:(ASDataController *)dataController { - if (_asyncDataSourceFlags.numberOfSectionsInCollectionNode) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, 0); - return [_asyncDataSource numberOfSectionsInCollectionNode:collectionNode]; - } else if (_asyncDataSourceFlags.numberOfSectionsInCollectionView) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDataSource numberOfSectionsInCollectionView:self]; -#pragma clang diagnostic pop - } else { - return 1; - } -} - -- (BOOL)dataController:(ASDataController *)dataController presentedSizeForElement:(ASCollectionElement *)element matchesSize:(CGSize)size -{ - NSIndexPath *indexPath = [self indexPathForNode:element.node]; - if (indexPath == nil) { - ASDisplayNodeFailAssert(@"Data controller should not ask for presented size for element that is not presented."); - return YES; - } - - UICollectionViewLayoutAttributes *attributes; - if (element.supplementaryElementKind == nil) { - attributes = [self layoutAttributesForItemAtIndexPath:indexPath]; - } else { - attributes = [self layoutAttributesForSupplementaryElementOfKind:element.supplementaryElementKind atIndexPath:indexPath]; - } - return CGSizeEqualToSizeWithIn(attributes.size, size, FLT_EPSILON); -} - -#pragma mark - ASDataControllerSource optional methods - -- (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementaryNodeBlockOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath shouldAsyncLayout:(BOOL *)shouldAsyncLayout -{ - ASDisplayNodeAssertMainThread(); - ASCellNodeBlock block = nil; - ASCellNode *cell = nil; - if (_asyncDataSourceFlags.collectionNodeNodeBlockForSupplementaryElement) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, ^{ return [[ASCellNode alloc] init]; }); - block = [_asyncDataSource collectionNode:collectionNode nodeBlockForSupplementaryElementOfKind:kind atIndexPath:indexPath]; - } - if (!block && !cell && _asyncDataSourceFlags.collectionNodeNodeForSupplementaryElement) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, ^{ return [[ASCellNode alloc] init]; }); - cell = [_asyncDataSource collectionNode:collectionNode nodeForSupplementaryElementOfKind:kind atIndexPath:indexPath]; - } - if (!block && !cell && _asyncDataSourceFlags.collectionViewNodeForSupplementaryElement) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - cell = [_asyncDataSource collectionView:self nodeForSupplementaryElementOfKind:kind atIndexPath:indexPath]; -#pragma clang diagnostic pop - } - - if (block == nil) { - if (cell == nil || ASDynamicCast(cell, ASCellNode) == nil) { - // In this case, the app code returned nil for the node and the nodeBlock. - // If the UIKit method is implemented, then we should use a passthrough cell. - // Otherwise the CGSizeZero default will cause UIKit to not show it (so this isn't an error like the cellForItem case). - - BOOL useUIKitCell = _asyncDataSourceFlags.interopViewForSupplementaryElement; - if (useUIKitCell) { - cell = [[ASWrapperCellNode alloc] init]; - } else { - cell = [[ASCellNode alloc] init]; - } - } - - // This condition is intended to run for either cells received from the datasource, or created just above. - if (cell.shouldUseUIKitCell) { - *shouldAsyncLayout = NO; - } - - block = ^{ return cell; }; - } - - // Wrap the node block - // BOOL disableRangeController = ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); - __weak __typeof__(self) weakSelf = self; - return ^{ - __typeof__(self) strongSelf = weakSelf; - ASCellNode *node = block(); - ASDisplayNodeAssert([node isKindOfClass:[ASCellNode class]], - @"ASCollectionNode provided a non-ASCellNode! %@, %@", node, strongSelf); - - // TODO: ASRangeController doesn't currently support managing interfaceState for supplementary nodes. - // For now, we allow the standard ASInterfaceStateInHierarchy behavior by ensuring we do not inform - // the node that it should expect external management of interfaceState. - /* - if (!disableRangeController) { - [node enterHierarchyState:ASHierarchyStateRangeManaged]; - } - */ - - if (node.interactionDelegate == nil) { - node.interactionDelegate = strongSelf; - } - if (strongSelf.inverted) { - node.transform = CATransform3DMakeScale(1, -1, 1); - } - return node; - }; -} - -- (NSArray *)dataController:(ASDataController *)dataController supplementaryNodeKindsInSections:(NSIndexSet *)sections -{ - if (_asyncDataSourceFlags.collectionNodeSupplementaryElementKindsInSection) { - const auto kinds = [[NSMutableSet alloc] init]; - GET_COLLECTIONNODE_OR_RETURN(collectionNode, @[]); - [sections enumerateIndexesUsingBlock:^(NSUInteger section, BOOL * _Nonnull stop) { - NSArray *kindsForSection = [_asyncDataSource collectionNode:collectionNode supplementaryElementKindsInSection:section]; - [kinds addObjectsFromArray:kindsForSection]; - }]; - return [kinds allObjects]; - } else { - // TODO: Lock this - return [_registeredSupplementaryKinds allObjects]; - } -} - -- (ASSizeRange)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - return [self.layoutInspector collectionView:self constrainedSizeForNodeAtIndexPath:indexPath]; -} - -- (ASSizeRange)dataController:(ASDataController *)dataController constrainedSizeForSupplementaryNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - if (_layoutInspectorFlags.constrainedSizeForSupplementaryNodeOfKindAtIndexPath) { - return [self.layoutInspector collectionView:self constrainedSizeForSupplementaryNodeOfKind:kind atIndexPath:indexPath]; - } - - ASDisplayNodeAssert(NO, @"To support supplementary nodes in ASCollectionView, it must have a layoutInspector for layout inspection. (See ASCollectionViewFlowLayoutInspector for an example.)"); - return ASSizeRangeMake(CGSizeZero, CGSizeZero); -} - -- (NSUInteger)dataController:(ASDataController *)dataController supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section -{ - if (_asyncDataSource == nil) { - return 0; - } - - if (_layoutInspectorFlags.supplementaryNodesOfKindInSection) { - return [self.layoutInspector collectionView:self supplementaryNodesOfKind:kind inSection:section]; - } - - ASDisplayNodeAssert(NO, @"To support supplementary nodes in ASCollectionView, it must have a layoutInspector for layout inspection. (See ASCollectionViewFlowLayoutInspector for an example.)"); - return 0; -} - -- (id)dataController:(ASDataController *)dataController contextForSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - id context = nil; - - if (_asyncDataSourceFlags.collectionNodeContextForSection) { - GET_COLLECTIONNODE_OR_RETURN(collectionNode, nil); - context = [_asyncDataSource collectionNode:collectionNode contextForSection:section]; - } - - if (context != nil) { - context.collectionView = self; - } - return context; -} - -#pragma mark - ASRangeControllerDataSource - -- (ASRangeController *)rangeController -{ - return _rangeController; -} - -- (NSHashTable *)visibleElementsForRangeController:(ASRangeController *)rangeController -{ - return ASPointerTableByFlatMapping(_visibleElements, id element, element); -} - -- (ASElementMap *)elementMapForRangeController:(ASRangeController *)rangeController -{ - return _dataController.visibleMap; -} - -- (ASScrollDirection)scrollDirectionForRangeController:(ASRangeController *)rangeController -{ - return self.scrollDirection; -} - -- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController -{ - return ASInterfaceStateForDisplayNode(self.collectionNode, self.window); -} - -- (NSString *)nameForRangeControllerDataSource -{ - return self.asyncDataSource ? NSStringFromClass([self.asyncDataSource class]) : NSStringFromClass([self class]); -} - -#pragma mark - ASRangeControllerDelegate - -- (BOOL)rangeControllerShouldUpdateRanges:(ASRangeController *)rangeController -{ - return !ASCellLayoutModeIncludes(ASCellLayoutModeDisableRangeController); -} - -- (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates -{ - ASDisplayNodeAssertMainThread(); - if (!self.asyncDataSource || _superIsPendingDataLoad || _updatingInResponseToInteractiveMove) { - updates(); - [changeSet executeCompletionHandlerWithFinished:NO]; - return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes - } - - //TODO Do we need to notify _layoutFacilitator before reloadData? - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeDelete]) { - [_layoutFacilitator collectionViewWillEditCellsAtIndexPaths:change.indexPaths batched:YES]; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeDelete]) { - [_layoutFacilitator collectionViewWillEditSectionsAtIndexSet:change.indexSet batched:YES]; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeInsert]) { - [_layoutFacilitator collectionViewWillEditSectionsAtIndexSet:change.indexSet batched:YES]; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeInsert]) { - [_layoutFacilitator collectionViewWillEditCellsAtIndexPaths:change.indexPaths batched:YES]; - } - - ASPerformBlockWithoutAnimation(!changeSet.animated, ^{ - as_activity_scope(as_activity_create("Commit collection update", changeSet.rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - if (changeSet.includesReloadData) { - self->_superIsPendingDataLoad = YES; - updates(); - [self _superReloadData:nil completion:nil]; - os_log_debug(ASCollectionLog(), "Did reloadData %@", self.collectionNode); - [changeSet executeCompletionHandlerWithFinished:YES]; - } else { - [self->_layoutFacilitator collectionViewWillPerformBatchUpdates]; - - __block NSUInteger numberOfUpdates = 0; - const auto completion = ^(BOOL finished) { - as_activity_scope(as_activity_create("Handle collection update completion", changeSet.rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - as_log_verbose(ASCollectionLog(), "Update animation finished %{public}@", self.collectionNode); - // Flush any range changes that happened as part of the update animations ending. - [self->_rangeController updateIfNeeded]; - [self _scheduleCheckForBatchFetchingForNumberOfChanges:numberOfUpdates]; - [changeSet executeCompletionHandlerWithFinished:finished]; - }; - - BOOL shouldReloadData = ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysReloadData); - // TODO: Consider adding !changeSet.isEmpty as a check to also disable shouldReloadData. - if (ASCellLayoutModeIncludes(ASCellLayoutModeAlwaysBatchUpdateSectionReload) && - [changeSet sectionChangesOfType:_ASHierarchyChangeTypeReload].count > 0) { - shouldReloadData = NO; - } - - if (shouldReloadData) { - // When doing a reloadData, the insert / delete calls are not necessary. - // Calling updates() is enough, as it commits .pendingMap to .visibleMap. - [self _superReloadData:updates completion:completion]; - } else { - [self _superPerformBatchUpdates:^{ - updates(); - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeReload]) { - [super reloadItemsAtIndexPaths:change.indexPaths]; - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeReload]) { - [super reloadSections:change.indexSet]; - numberOfUpdates++; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeOriginalDelete]) { - [super deleteItemsAtIndexPaths:change.indexPaths]; - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeOriginalDelete]) { - [super deleteSections:change.indexSet]; - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeOriginalInsert]) { - [super insertSections:change.indexSet]; - numberOfUpdates++; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeOriginalInsert]) { - [super insertItemsAtIndexPaths:change.indexPaths]; - numberOfUpdates++; - } - } completion:completion]; - } - - os_log_debug(ASCollectionLog(), "Completed batch update %{public}@", self.collectionNode); - - // Flush any range changes that happened as part of submitting the update. - as_activity_scope(changeSet.rootActivity); - if (numberOfUpdates > 0 && ASActivateExperimentalFeature(ASExperimentalRangeUpdateOnChangesetUpdate)) { - [self->_rangeController setNeedsUpdate]; - } - [self->_rangeController updateIfNeeded]; - } - }); -} - -#pragma mark - ASCellNodeDelegate - -- (void)nodeSelectedStateDidChange:(ASCellNode *)node -{ - NSIndexPath *indexPath = [self indexPathForNode:node]; - if (indexPath) { - if (node.isSelected) { - [super selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone]; - } else { - [super deselectItemAtIndexPath:indexPath animated:NO]; - } - } -} - -- (void)nodeHighlightedStateDidChange:(ASCellNode *)node -{ - NSIndexPath *indexPath = [self indexPathForNode:node]; - if (indexPath) { - [self cellForItemAtIndexPath:indexPath].highlighted = node.isHighlighted; - } -} - -- (void)nodeDidInvalidateSize:(ASCellNode *)node -{ - [_cellsForLayoutUpdates addObject:node]; - [self setNeedsLayout]; -} - -- (void)nodesDidRelayout:(NSArray *)nodes -{ - ASDisplayNodeAssertMainThread(); - - if (nodes.count == 0) { - return; - } - - const auto uikitIndexPaths = ASArrayByFlatMapping(nodes, ASCellNode *node, [self indexPathForNode:node]); - - [_layoutFacilitator collectionViewWillEditCellsAtIndexPaths:uikitIndexPaths batched:NO]; - - ASCollectionViewInvalidationStyle invalidationStyle = _nextLayoutInvalidationStyle; - for (ASCellNode *node in nodes) { - if (invalidationStyle == ASCollectionViewInvalidationStyleNone) { - // We nodesDidRelayout also while we are in layoutSubviews. This should be no problem as CA will ignore this - // call while be in a layout pass - [self setNeedsLayout]; - invalidationStyle = ASCollectionViewInvalidationStyleWithAnimation; - } - - // If we think we're going to animate, check if this node will prevent it. - if (invalidationStyle == ASCollectionViewInvalidationStyleWithAnimation) { - // TODO: Incorporate `shouldAnimateSizeChanges` into ASEnvironmentState for performance benefit. - static dispatch_once_t onceToken; - static BOOL (^shouldNotAnimateBlock)(ASDisplayNode *); - dispatch_once(&onceToken, ^{ - shouldNotAnimateBlock = ^BOOL(ASDisplayNode * _Nonnull node) { - return (node.shouldAnimateSizeChanges == NO); - }; - }); - if (ASDisplayNodeFindFirstNode(node, shouldNotAnimateBlock) != nil) { - // One single non-animated node causes the whole layout update to be non-animated - invalidationStyle = ASCollectionViewInvalidationStyleWithoutAnimation; - break; - } - } - } - _nextLayoutInvalidationStyle = invalidationStyle; -} - -#pragma mark - _ASDisplayView behavior substitutions -// Need these to drive interfaceState so we know when we are visible, if not nested in another range-managing element. -// Because our superclass is a true UIKit class, we cannot also subclass _ASDisplayView. -- (void)willMoveToWindow:(UIWindow *)newWindow -{ - BOOL visible = (newWindow != nil); - ASDisplayNode *node = self.collectionNode; - if (visible && !node.inHierarchy) { - [node __enterHierarchy]; - } -} - -- (void)didMoveToWindow -{ - BOOL visible = (self.window != nil); - ASDisplayNode *node = self.collectionNode; - BOOL rangeControllerNeedsUpdate = ![node supportsRangeManagedInterfaceState];; - - if (!visible && node.inHierarchy) { - if (rangeControllerNeedsUpdate) { - rangeControllerNeedsUpdate = NO; - // Exit CellNodes first before Collection to match UIKit behaviors (tear down bottom up). - // Although we have not yet cleared the interfaceState's Visible bit (this happens in __exitHierarchy), - // the ASRangeController will get the correct value from -interfaceStateForRangeController:. - [_rangeController updateRanges]; - } - [node __exitHierarchy]; - } - - // Updating the visible node index paths only for not range managed nodes. Range managed nodes will get their - // their update in the layout pass - if (rangeControllerNeedsUpdate) { - [_rangeController updateRanges]; - } - - // When we aren't visible, we will only fetch up to the visible area. Now that we are visible, - // we will fetch visible area + leading screens, so we need to check. - if (visible) { - [self _checkForBatchFetching]; - } -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - if (self.superview == nil && newSuperview != nil) { - _keepalive_node = self.collectionNode; - } -} - -- (void)didMoveToSuperview -{ - if (self.superview == nil) { - _keepalive_node = nil; - } -} - -#pragma mark ASCALayerExtendedDelegate - -/** - * TODO: This code was added when we used @c calculatedSize as the size for - * items (e.g. collectionView:layout:sizeForItemAtIndexPath:) and so it - * was critical that we remeasured all nodes at this time. - * - * The assumption was that cv-bounds-size-change -> constrained-size-change, so - * this was the time when we get new constrained sizes for all items and remeasure - * them. However, the constrained sizes for items can be invalidated for many other - * reasons, hence why we never reuse the old constrained size anymore. - * - * UICollectionView inadvertently triggers a -prepareLayout call to its layout object - * between [super setFrame:] and [self layoutSubviews] during size changes. So we need - * to get in there and re-measure our nodes before that -prepareLayout call. - * We can't wait until -layoutSubviews or the end of -setFrame:. - * - * @see @p testThatNodeCalculatedSizesAreUpdatedBeforeFirstPrepareLayoutAfterRotation - */ -- (void)layer:(CALayer *)layer didChangeBoundsWithOldValue:(CGRect)oldBounds newValue:(CGRect)newBounds -{ - CGSize newSize = newBounds.size; - CGSize lastUsedSize = _lastBoundsSizeUsedForMeasuringNodes; - if (CGSizeEqualToSize(lastUsedSize, newSize)) { - return; - } - if (_hasDataControllerLayoutDelegate || self.collectionViewLayout == nil) { - // Let the layout delegate handle bounds changes if it's available. If no layout, it will init in the new state. - return; - } - - _lastBoundsSizeUsedForMeasuringNodes = newSize; - - // Laying out all nodes is expensive. - // We only need to do this if the bounds changed in the non-scrollable direction. - // If, for example, a vertical flow layout has its height changed due to a status bar - // appearance update, we do not need to relayout all nodes. - // For a more permanent fix to the unsafety mentioned above, see https://github.com/facebook/AsyncDisplayKit/pull/2182 - ASScrollDirection scrollDirection = self.scrollableDirections; - BOOL fixedVertically = (ASScrollDirectionContainsVerticalDirection (scrollDirection) == NO); - BOOL fixedHorizontally = (ASScrollDirectionContainsHorizontalDirection(scrollDirection) == NO); - - BOOL changedInNonScrollingDirection = (fixedHorizontally && newSize.width != lastUsedSize.width) || - (fixedVertically && newSize.height != lastUsedSize.height); - - if (changedInNonScrollingDirection) { - [self relayoutItems]; - } -} - -#pragma mark - UICollectionView dead-end intercepts - -- (void)setPrefetchDataSource:(id)prefetchDataSource -{ - return; -} - -- (void)setPrefetchingEnabled:(BOOL)prefetchingEnabled -{ - return; -} - -#pragma mark - Accessibility overrides - -- (NSArray *)accessibilityElements -{ - [self waitUntilAllUpdatesAreCommitted]; - return [super accessibilityElements]; -} - -#pragma mark - UIGestureRecognizerDelegate Method -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - return [self.collectionNode gestureRecognizerShouldBegin:gestureRecognizer]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch -{ - return [self.collectionNode gestureRecognizer:gestureRecognizer shouldReceiveTouch:touch]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceivePress:(UIPress *)press -{ - return [self.collectionNode gestureRecognizer:gestureRecognizer shouldReceivePress:press]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return [self.collectionNode gestureRecognizer:gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return [self.collectionNode gestureRecognizer:gestureRecognizer shouldRequireFailureOfGestureRecognizer:otherGestureRecognizer]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return [self.collectionNode gestureRecognizer:gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:otherGestureRecognizer]; -} - -@end diff --git a/Example/Pods/Texture/Source/ASCollectionViewLayoutFacilitatorProtocol.h b/Example/Pods/Texture/Source/ASCollectionViewLayoutFacilitatorProtocol.h deleted file mode 100644 index 3db2dc99..00000000 --- a/Example/Pods/Texture/Source/ASCollectionViewLayoutFacilitatorProtocol.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// ASCollectionViewLayoutFacilitatorProtocol.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once -#import - -/** - * This facilitator protocol is intended to help Layout to better - * gel with the CollectionView - */ -@protocol ASCollectionViewLayoutFacilitatorProtocol - -/** - * Inform that the collectionView is editing the cells at a list of indexPaths - * - * @param indexPaths an array of NSIndexPath objects of cells being/will be edited. - * @param isBatched indicates whether the editing operation will be batched by the collectionView - * - * NOTE: when isBatched, used in combination with -collectionViewWillPerformBatchUpdates - */ -- (void)collectionViewWillEditCellsAtIndexPaths:(NSArray *)indexPaths batched:(BOOL)isBatched; - -/** - * Inform that the collectionView is editing the sections at a set of indexes - * - * @param indexes an NSIndexSet of section indexes being/will be edited. - * @param batched indicates whether the editing operation will be batched by the collectionView - * - * NOTE: when batched, used in combination with -collectionViewWillPerformBatchUpdates - */ -- (void)collectionViewWillEditSectionsAtIndexSet:(NSIndexSet *)indexes batched:(BOOL)batched; - -/** - * Informs the delegate that the collectionView is about to call performBatchUpdates - */ -- (void)collectionViewWillPerformBatchUpdates; - -@end diff --git a/Example/Pods/Texture/Source/ASCollectionViewProtocols.h b/Example/Pods/Texture/Source/ASCollectionViewProtocols.h deleted file mode 100644 index ec1b8d57..00000000 --- a/Example/Pods/Texture/Source/ASCollectionViewProtocols.h +++ /dev/null @@ -1,107 +0,0 @@ -// -// ASCollectionViewProtocols.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -typedef NS_OPTIONS(unsigned short, ASCellLayoutMode) { - /** - * No options set. If cell layout mode is set to ASCellLayoutModeNone, the default values for - * each flag listed below is used. - */ - ASCellLayoutModeNone = 0, - /** - * If ASCellLayoutModeAlwaysSync is enabled it will cause the ASDataController to wait on the - * background queue, and this ensures that any new / changed cells are in the hierarchy by the - * very next CATransaction / frame draw. - * - * Note: Sync & Async flags force the behavior to be always one or the other, regardless of the - * items. Default: If neither ASCellLayoutModeAlwaysSync or ASCellLayoutModeAlwaysAsync is set, - * default behavior is synchronous when there are 0 or 1 ASCellNodes in the data source, and - * asynchronous when there are 2 or more. - */ - ASCellLayoutModeAlwaysSync = 1 << 1, // Default OFF - ASCellLayoutModeAlwaysAsync = 1 << 2, // Default OFF - ASCellLayoutModeForceIfNeeded = 1 << 3, // Deprecated, default OFF. - ASCellLayoutModeAlwaysPassthroughDelegate = 1 << 4, // Deprecated, default ON. - /** Instead of using performBatchUpdates: prefer using reloadData for changes for collection view */ - ASCellLayoutModeAlwaysReloadData = 1 << 5, // Default OFF - /** If flag is enabled nodes are *not* gonna be range managed. */ - ASCellLayoutModeDisableRangeController = 1 << 6, // Default OFF - ASCellLayoutModeAlwaysLazy = 1 << 7, // Deprecated, default OFF. - /** - * Defines if the node creation should happen serialized and not in parallel within the - * data controller - */ - ASCellLayoutModeSerializeNodeCreation = 1 << 8, // Default OFF - /** - * When set, the performBatchUpdates: API (including animation) is used when handling Section - * Reload operations. This is useful only when ASCellLayoutModeAlwaysReloadData is enabled and - * cell height animations are desired. - */ - ASCellLayoutModeAlwaysBatchUpdateSectionReload = 1 << 9, // Default OFF -}; - -NS_ASSUME_NONNULL_BEGIN - -/** - * This is a subset of UICollectionViewDataSource. - * - * @see ASCollectionDataSource - */ -@protocol ASCommonCollectionDataSource - -@optional - -- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:numberOfItemsInSection: instead."); - -- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView ASDISPLAYNODE_DEPRECATED_MSG("Implement -numberOfSectionsInCollectionNode: instead."); - -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement - collectionNode:nodeForSupplementaryElementOfKind:atIndexPath: instead."); - -@end - - -/** - * This is a subset of UICollectionViewDelegate. - * - * @see ASCollectionDelegate - */ -@protocol ASCommonCollectionDelegate - -@optional - -- (UICollectionViewTransitionLayout *)collectionView:(UICollectionView *)collectionView transitionLayoutForOldLayout:(UICollectionViewLayout *)fromLayout newLayout:(UICollectionViewLayout *)toLayout; - -- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:willDisplaySupplementaryView:forElementKind:atIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -collectionNode:didEndDisplayingSupplementaryView:forElementKind:atIndexPath: instead."); - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldHighlightItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didHighlightItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didUnhighlightItemAtIndexPath: instead."); - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldSelectItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didSelectItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldDeselectItemAtIndexPath: instead."); -- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:didDeselectItemAtIndexPath: instead."); - -- (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:shouldShowMenuForItemAtIndexPath: instead."); -- (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:canPerformAction:forItemAtIndexPath:withSender: instead."); -- (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement collectionNode:performAction:forItemAtIndexPath:withSender: instead."); - -- (nullable UIContextMenuConfiguration *)collectionView:(UICollectionView *)collectionView contextMenuConfigurationForItemAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos); - -- (nullable UITargetedPreview *)collectionView:(UICollectionView *)collectionView previewForHighlightingContextMenuWithConfiguration:(UIContextMenuConfiguration *)configuration API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos); - -- (nullable UITargetedPreview *)collectionView:(UICollectionView *)collectionView previewForDismissingContextMenuWithConfiguration:(UIContextMenuConfiguration *)configuration API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos); - -- (void)collectionView:(UICollectionView *)collectionView willPerformPreviewActionForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration animator:(id)animator API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, tvos); -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCollections.h b/Example/Pods/Texture/Source/ASCollections.h deleted file mode 100644 index ca3b31c6..00000000 --- a/Example/Pods/Texture/Source/ASCollections.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASCollections.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSArray<__covariant ObjectType> (ASCollections) - -/** - * Create an immutable NSArray from a C-array of strong pointers. - * - * Note: The memory for the array you pass in will be zero'd (to prevent ARC from releasing - * the references when the array goes out of scope.) - * - * Can be combined with vector like: - * vector vec; - * vec.push_back(@"foo"); - * vec.push_back(@"bar"); - * NSArray *arr = [NSArray arrayTransferring:vec.data() count:vec.size()] - * ** vec is now { nil, nil } ** - * - * Unfortunately making a convenience method to do this is currently impossible because - * vector can't be converted to vector by the compiler (silly). - * - * See the private __CFArrayCreateTransfer function. - */ -+ (NSArray *)arrayByTransferring:(ObjectType _Nonnull __strong * _Nonnull)pointers - count:(NSUInteger)count NS_RETURNS_RETAINED; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASCollections.mm b/Example/Pods/Texture/Source/ASCollections.mm deleted file mode 100644 index 592dee2e..00000000 --- a/Example/Pods/Texture/Source/ASCollections.mm +++ /dev/null @@ -1,61 +0,0 @@ -// -// ASCollections.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * A private allocator that signals to our retain callback to skip the retain. - * It behaves the same as the default allocator, but acts as a signal that we - * are creating a transfer array so we should skip the retain. - */ -static CFAllocatorRef gTransferAllocator; - -static const void *ASTransferRetain(CFAllocatorRef allocator, const void *val) { - if (allocator == gTransferAllocator) { - // Transfer allocator. Ignore retain and pass through. - return val; - } else { - // Other allocator. Retain like normal. - // This happens when they make a mutable copy. - return (&kCFTypeArrayCallBacks)->retain(allocator, val); - } -} - -@implementation NSArray (ASCollections) - -+ (NSArray *)arrayByTransferring:(__strong id *)pointers count:(NSUInteger)count NS_RETURNS_RETAINED -{ - // Custom callbacks that point to our ASTransferRetain callback. - static CFArrayCallBacks callbacks; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - callbacks = kCFTypeArrayCallBacks; - callbacks.retain = ASTransferRetain; - CFAllocatorContext ctx; - CFAllocatorGetContext(NULL, &ctx); - gTransferAllocator = CFAllocatorCreate(NULL, &ctx); - }); - - // NSZeroArray fast path. - if (count == 0) { - return @[]; // Does not actually call +array when optimized. - } - - // NSSingleObjectArray fast path. Retain/release here is worth it. - if (count == 1) { - NSArray *result = [[NSArray alloc] initWithObjects:pointers count:1]; - pointers[0] = nil; - return result; - } - - NSArray *result = (__bridge_transfer NSArray *)CFArrayCreate(gTransferAllocator, (const void **)(void *)pointers, count, &callbacks); - memset(pointers, 0, count * sizeof(id)); - return result; -} - -@end diff --git a/Example/Pods/Texture/Source/ASConfiguration.h b/Example/Pods/Texture/Source/ASConfiguration.h deleted file mode 100644 index c529dad8..00000000 --- a/Example/Pods/Texture/Source/ASConfiguration.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// ASConfiguration.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@protocol ASConfigurationDelegate; - -NS_ASSUME_NONNULL_BEGIN - -static NSInteger const ASConfigurationSchemaCurrentVersion = 1; - -AS_SUBCLASSING_RESTRICTED -@interface ASConfiguration : NSObject - -/** - * Initialize this configuration with the provided dictionary, - * or nil to create an empty configuration. - * - * The schema is located in `schemas/configuration.json`. - */ -- (instancetype)initWithDictionary:(nullable NSDictionary *)dictionary; - -/** - * The delegate for configuration-related events. - * Delegate methods are called from a serial queue. - */ -@property (nonatomic, nullable) id delegate; - -/** - * The experimental features to enable in Texture. - * See ASExperimentalFeatures for functions to convert to/from a string array. - */ -@property (nonatomic) ASExperimentalFeatures experimentalFeatures; - -@end - -/** - * Implement this method in a category to make your - * configuration available to Texture. It will be read - * only once and copied. - * - * NOTE: To specify your configuration at compile-time, you can - * define AS_FIXED_CONFIG_JSON as a C-string of JSON. This method - * will then be implemented to parse that string and generate - * a configuration. - */ -@interface ASConfiguration (UserProvided) -+ (ASConfiguration *)textureConfiguration NS_RETURNS_RETAINED; -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASConfiguration.mm b/Example/Pods/Texture/Source/ASConfiguration.mm deleted file mode 100644 index a201dc21..00000000 --- a/Example/Pods/Texture/Source/ASConfiguration.mm +++ /dev/null @@ -1,63 +0,0 @@ -// -// ASConfiguration.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/// Not too performance-sensitive here. - -@implementation ASConfiguration - -- (instancetype)initWithDictionary:(NSDictionary *)dictionary -{ - if (self = [super init]) { - if (dictionary != nil) { - const auto featureStrings = ASDynamicCast(dictionary[@"experimental_features"], NSArray); - const auto version = ASDynamicCast(dictionary[@"version"], NSNumber).integerValue; - if (version != ASConfigurationSchemaCurrentVersion) { - NSLog(@"Texture warning: configuration schema is old version (%ld vs %ld)", (long)version, (long)ASConfigurationSchemaCurrentVersion); - } - self.experimentalFeatures = ASExperimentalFeaturesFromArray(featureStrings); - } else { - self.experimentalFeatures = kNilOptions; - } - } - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - ASConfiguration *config = [[ASConfiguration alloc] initWithDictionary:nil]; - config.experimentalFeatures = self.experimentalFeatures; - config.delegate = self.delegate; - return config; -} - -@end - -//#define AS_FIXED_CONFIG_JSON "{ \"version\" : 1, \"experimental_features\": [ \"exp_text_node\" ] }" - -#ifdef AS_FIXED_CONFIG_JSON - -@implementation ASConfiguration (UserProvided) - -+ (ASConfiguration *)textureConfiguration NS_RETURNS_RETAINED -{ - NSData *data = [@AS_FIXED_CONFIG_JSON dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - NSDictionary *d = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; - if (!d) { - NSAssert(NO, @"Error parsing fixed config string '%s': %@", AS_FIXED_CONFIG_JSON, error); - return nil; - } else { - return [[ASConfiguration alloc] initWithDictionary:d]; - } -} - -@end - -#endif // AS_FIXED_CONFIG_JSON diff --git a/Example/Pods/Texture/Source/ASConfigurationDelegate.h b/Example/Pods/Texture/Source/ASConfigurationDelegate.h deleted file mode 100644 index fde3950c..00000000 --- a/Example/Pods/Texture/Source/ASConfigurationDelegate.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ASConfigurationDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Used to communicate configuration-related events to the client. - */ -@protocol ASConfigurationDelegate - -/** - * Texture performed its first behavior related to the feature(s). - * This can be useful for tracking the impact of the behavior (A/B testing). - */ -- (void)textureDidActivateExperimentalFeatures:(ASExperimentalFeatures)features; - -@optional - -/** - * Texture framework initialized. This method is called synchronously - * on the main thread from ASInitializeFrameworkMainThread if you defined - * AS_INITIALIZE_FRAMEWORK_MANUALLY or otherwise from the default initialization point - * (currently a static constructor, called before main()). - */ -- (void)textureDidInitialize; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASConfigurationInternal.h b/Example/Pods/Texture/Source/ASConfigurationInternal.h deleted file mode 100644 index fa694962..00000000 --- a/Example/Pods/Texture/Source/ASConfigurationInternal.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// ASConfigurationInternal.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -/// Note this has to be public because it's imported by public header ASThread.h =/ -/// It will be private again after exp_unfair_lock ends. - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Quickly check if an experiment is enabled and notify the delegate - * that it's been activated. - * - * The delegate will be notified asynchronously. - */ -#if DEBUG -#define ASActivateExperimentalFeature(opt) _ASActivateExperimentalFeature(opt) -#else -#define ASActivateExperimentalFeature(opt) ({\ - static BOOL result;\ - static dispatch_once_t onceToken;\ - dispatch_once(&onceToken, ^{ result = _ASActivateExperimentalFeature(opt); });\ - result;\ -}) -#endif - -/** - * Internal function. Use the macro without the underbar. - */ -ASDK_EXTERN BOOL _ASActivateExperimentalFeature(ASExperimentalFeatures option); - -/** - * Notify the configuration delegate that the framework initialized, if needed. - */ -ASDK_EXTERN void ASNotifyInitialized(void); - -AS_SUBCLASSING_RESTRICTED -@interface ASConfigurationManager : NSObject - -/** - * No API for now. - * Just use ASActivateExperimentalFeature to access this efficiently. - */ - -/* Exposed for testing purposes only */ -+ (void)test_resetWithConfiguration:(nullable ASConfiguration *)configuration; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASConfigurationInternal.mm b/Example/Pods/Texture/Source/ASConfigurationInternal.mm deleted file mode 100644 index 4bcc1ffd..00000000 --- a/Example/Pods/Texture/Source/ASConfigurationInternal.mm +++ /dev/null @@ -1,110 +0,0 @@ -// -// ASConfigurationInternal.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASConfigurationInternal.h" -#import -#import -#import - -static ASConfigurationManager *ASSharedConfigurationManager; -static dispatch_once_t ASSharedConfigurationManagerOnceToken; - -NS_INLINE ASConfigurationManager *ASConfigurationManagerGet() { - dispatch_once(&ASSharedConfigurationManagerOnceToken, ^{ - ASSharedConfigurationManager = [[ASConfigurationManager alloc] init]; - }); - return ASSharedConfigurationManager; -} - -@implementation ASConfigurationManager { - ASConfiguration *_config; - dispatch_queue_t _delegateQueue; - BOOL _frameworkInitialized; - _Atomic(ASExperimentalFeatures) _activatedExperiments; -} - -+ (ASConfiguration *)defaultConfiguration NS_RETURNS_RETAINED -{ - ASConfiguration *config = [[ASConfiguration alloc] init]; - // TODO(wsdwsd0829): Fix #788 before enabling it. - // config.experimentalFeatures = ASExperimentalInterfaceStateCoalescing; - return config; -} - -- (instancetype)init -{ - if (self = [super init]) { - _delegateQueue = dispatch_queue_create("org.TextureGroup.Texture.ConfigNotifyQueue", DISPATCH_QUEUE_SERIAL); - if ([ASConfiguration respondsToSelector:@selector(textureConfiguration)]) { - _config = [[ASConfiguration textureConfiguration] copy]; - } else { - _config = [ASConfigurationManager defaultConfiguration]; - } - } - return self; -} - -- (void)frameworkDidInitialize -{ - ASDisplayNodeAssertMainThread(); - if (_frameworkInitialized) { - ASDisplayNodeFailAssert(@"Framework initialized twice."); - return; - } - _frameworkInitialized = YES; - - const auto delegate = _config.delegate; - if ([delegate respondsToSelector:@selector(textureDidInitialize)]) { - [delegate textureDidInitialize]; - } -} - -- (BOOL)activateExperimentalFeature:(ASExperimentalFeatures)requested -{ - if (_config == nil) { - return NO; - } - - NSAssert(__builtin_popcountl(requested) == 1, @"Cannot activate multiple features at once with this method."); - - // We need to call out, whether it's enabled or not. - // A/B testing requires even "control" users to be activated. - ASExperimentalFeatures enabled = requested & _config.experimentalFeatures; - ASExperimentalFeatures prevTriggered = atomic_fetch_or(&_activatedExperiments, requested); - ASExperimentalFeatures newlyTriggered = requested & ~prevTriggered; - - // Notify delegate if needed. - if (newlyTriggered != 0) { - unowned id del = _config.delegate; - dispatch_async(_delegateQueue, ^{ - [del textureDidActivateExperimentalFeatures:newlyTriggered]; - }); - } - - return (enabled != 0); -} - -// Define this even when !DEBUG, since we may run our tests in release mode. -+ (void)test_resetWithConfiguration:(ASConfiguration *)configuration -{ - ASConfigurationManager *inst = ASConfigurationManagerGet(); - inst->_config = configuration ?: [self defaultConfiguration]; - atomic_store(&inst->_activatedExperiments, 0); -} - -@end - -BOOL _ASActivateExperimentalFeature(ASExperimentalFeatures feature) -{ - return [ASConfigurationManagerGet() activateExperimentalFeature:feature]; -} - -void ASNotifyInitialized() -{ - [ASConfigurationManagerGet() frameworkDidInitialize]; -} diff --git a/Example/Pods/Texture/Source/ASContextTransitioning.h b/Example/Pods/Texture/Source/ASContextTransitioning.h deleted file mode 100644 index aea3501b..00000000 --- a/Example/Pods/Texture/Source/ASContextTransitioning.h +++ /dev/null @@ -1,72 +0,0 @@ -// -// ASContextTransitioning.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASDisplayNode; -@class ASLayout; - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN NSString * const ASTransitionContextFromLayoutKey; -ASDK_EXTERN NSString * const ASTransitionContextToLayoutKey; - -@protocol ASContextTransitioning - -/** - @abstract Defines if the given transition is animated - */ -- (BOOL)isAnimated; - -/** - * @abstract Retrieve either the "from" or "to" layout - */ -- (nullable ASLayout *)layoutForKey:(NSString *)key; - -/** - * @abstract Retrieve either the "from" or "to" constrainedSize - */ -- (ASSizeRange)constrainedSizeForKey:(NSString *)key; - -/** - * @abstract Retrieve the subnodes from either the "from" or "to" layout - */ -- (NSArray *)subnodesForKey:(NSString *)key; - -/** - * @abstract Subnodes that have been inserted in the layout transition - */ -- (NSArray *)insertedSubnodes; - -/** - * @abstract Subnodes that will be removed in the layout transition - */ -- (NSArray *)removedSubnodes; - -/** - @abstract The frame for the given node before the transition began. - @discussion Returns CGRectNull if the node was not in the hierarchy before the transition. - */ -- (CGRect)initialFrameForNode:(ASDisplayNode *)node; - -/** - @abstract The frame for the given node when the transition completes. - @discussion Returns CGRectNull if the node is no longer in the hierarchy after the transition. - */ -- (CGRect)finalFrameForNode:(ASDisplayNode *)node; - -/** - @abstract Invoke this method when the transition is completed in `animateLayoutTransition:` - @discussion Passing NO to `didComplete` will set the original layout as the new layout. - */ -- (void)completeTransition:(BOOL)didComplete; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASControlNode+Subclasses.h b/Example/Pods/Texture/Source/ASControlNode+Subclasses.h deleted file mode 100644 index 2e9cdb28..00000000 --- a/Example/Pods/Texture/Source/ASControlNode+Subclasses.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// ASControlNode+Subclasses.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * The subclass header _ASControlNode+Subclasses_ defines methods to be - * overridden by custom nodes that subclass ASControlNode. - * - * These methods should never be called directly by other classes. - */ - -@interface ASControlNode (Subclassing) - -/** - @abstract Sends action messages for the given control events. - @param controlEvents A bitmask whose set flags specify the control events for which action messages are sent. See "Control Events" in ASControlNode.h for bitmask constants. - @param touchEvent An event object encapsulating the information specific to the user event. - @discussion ASControlNode implements this method to send all action messages associated with controlEvents. The list of targets is constructed from prior invocations of addTarget:action:forControlEvents:. - */ -- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)touchEvent; - -/** - @abstract Sent to the control when tracking begins. - @param touch The touch on the receiving control. - @param touchEvent An event object encapsulating the information specific to the user event. - @result YES if the receiver should respond continuously (respond when touch is dragged); NO otherwise. - */ -- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; - -/** - @abstract Sent continuously to the control as it tracks a touch within the control's bounds. - @param touch The touch on the receiving control. - @param touchEvent An event object encapsulating the information specific to the user event. - @result YES if touch tracking should continue; NO otherwise. - */ -- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; - -/** - @abstract Sent to the control when tracking should be cancelled. - @param touchEvent An event object encapsulating the information specific to the user event. This parameter may be nil, indicating that the cancelation was caused by something other than an event, such as the display node being removed from its supernode. - */ -- (void)cancelTrackingWithEvent:(nullable UIEvent *)touchEvent; - -/** - @abstract Sent to the control when the last touch completely ends, telling it to stop tracking. - @param touch The touch that ended. - @param touchEvent An event object encapsulating the information specific to the user event. - */ -- (void)endTrackingWithTouch:(nullable UITouch *)touch withEvent:(nullable UIEvent *)touchEvent; - -/** - @abstract Settable version of highlighted property. - */ -@property (getter=isHighlighted) BOOL highlighted; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASControlNode.h b/Example/Pods/Texture/Source/ASControlNode.h deleted file mode 100644 index 0918fdb0..00000000 --- a/Example/Pods/Texture/Source/ASControlNode.h +++ /dev/null @@ -1,149 +0,0 @@ -// -// ASControlNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#pragma once - -NS_ASSUME_NONNULL_BEGIN - -/** - @abstract Kinds of events possible for control nodes. - @discussion These events are identical to their UIControl counterparts. - */ -typedef NS_OPTIONS(NSUInteger, ASControlNodeEvent) -{ - /** A touch-down event in the control node. */ - ASControlNodeEventTouchDown = 1 << 0, - /** A repeated touch-down event in the control node; for this event the value of the UITouch tapCount method is greater than one. */ - ASControlNodeEventTouchDownRepeat = 1 << 1, - /** An event where a finger is dragged inside the bounds of the control node. */ - ASControlNodeEventTouchDragInside = 1 << 2, - /** An event where a finger is dragged just outside the bounds of the control. */ - ASControlNodeEventTouchDragOutside = 1 << 3, - /** A touch-up event in the control node where the finger is inside the bounds of the node. */ - ASControlNodeEventTouchUpInside = 1 << 4, - /** A touch-up event in the control node where the finger is outside the bounds of the node. */ - ASControlNodeEventTouchUpOutside = 1 << 5, - /** A system event canceling the current touches for the control node. */ - ASControlNodeEventTouchCancel = 1 << 6, - /** A system event triggered when controls like switches, slides, etc change state. */ - ASControlNodeEventValueChanged = 1 << 12, - /** A system event when the Play/Pause button on the Apple TV remote is pressed. */ - ASControlNodeEventPrimaryActionTriggered = 1 << 13, - - /** All events, including system events. */ - ASControlNodeEventAllEvents = 0xFFFFFFFF -}; - -/** - * Compatibility aliases for @c ASControlState enum. - * We previously provided our own enum, but when it was imported - * into Swift, the @c normal (0) option disappeared. - * - * Apple's UIControlState enum gets special treatment here, and - * UIControlStateNormal is available in Swift. - */ -typedef UIControlState ASControlState ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlState."); -static UIControlState const ASControlStateNormal ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateNormal.") = UIControlStateNormal; -static UIControlState const ASControlStateDisabled ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateDisabled.") = UIControlStateDisabled; -static UIControlState const ASControlStateHighlighted ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateHighlighted.") = UIControlStateHighlighted; -static UIControlState const ASControlStateSelected ASDISPLAYNODE_DEPRECATED_MSG("Use UIControlStateSelected.") = UIControlStateSelected; - -/** - @abstract ASControlNode is the base class for control nodes (such as buttons), or nodes that track touches to invoke targets with action messages. - @discussion ASControlNode cannot be used directly. It instead defines the common interface and behavior structure for all its subclasses. Subclasses should import "ASControlNode+Subclasses.h" for information on methods intended to be overriden. - */ -@interface ASControlNode : ASDisplayNode - -#pragma mark - Control State - -/** - @abstract Indicates whether or not the receiver is enabled. - @discussion Specify YES to make the control enabled; otherwise, specify NO to make it disabled. The default value is YES. If the enabled state is NO, the control ignores touch events and subclasses may draw differently. - */ -@property (getter=isEnabled) BOOL enabled; - -/** - @abstract Indicates whether or not the receiver is highlighted. - @discussion This is set automatically when the there is a touch inside the control and removed on exit or touch up. This is different from touchInside in that it includes an area around the control, rather than just for touches inside the control. - */ -@property (getter=isHighlighted) BOOL highlighted; - -/** - @abstract Indicates whether or not the receiver is highlighted. - @discussion This is set automatically when the receiver is tapped. - */ -@property (getter=isSelected) BOOL selected; - -#pragma mark - Tracking Touches -/** - @abstract Indicates whether or not the receiver is currently tracking touches related to an event. - @discussion YES if the receiver is tracking touches; NO otherwise. - */ -@property (readonly, getter=isTracking) BOOL tracking; - -/** - @abstract Indicates whether or not a touch is inside the bounds of the receiver. - @discussion YES if a touch is inside the receiver's bounds; NO otherwise. - */ -@property (readonly, getter=isTouchInside) BOOL touchInside; - -#pragma mark - Action Messages -/** - @abstract Adds a target-action pair for a particular event (or events). - @param target The object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message. target is not retained. - @param action A selector identifying an action message. May optionally include the sender and the event as parameters, in that order. May not be NULL. - @param controlEvents A bitmask specifying the control events for which the action message is sent. May not be 0. See "Control Events" for bitmask constants. - @discussion You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. Targets are held weakly. - */ -- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; - -/** - @abstract Returns the actions that are associated with a target and a particular control event. - @param target The target object. May not be nil. - @param controlEvent A single constant of type ASControlNodeEvent that specifies a particular user action on the control; for a list of these constants, see "Control Events". May not be 0 or ASControlNodeEventAllEvents. - @result An array of selector names as NSString objects, or nil if there are no action selectors associated with controlEvent. - */ -- (nullable NSArray *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns all target objects associated with the receiver. - @result A set of all targets for the receiver. The set may include NSNull to indicate at least one nil target (meaning, the responder chain is searched for a target.) - */ -- (NSSet *)allTargets AS_WARN_UNUSED_RESULT; - -/** - @abstract Removes a target-action pair for a particular event. - @param target The target object. Pass nil to remove all targets paired with action and the specified control events. - @param action A selector identifying an action message. Pass NULL to remove all action messages paired with target. - @param controlEvents A bitmask specifying the control events associated with target and action. See "Control Events" for bitmask constants. May not be 0. - */ -- (void)removeTarget:(nullable id)target action:(nullable SEL)action forControlEvents:(ASControlNodeEvent)controlEvents; - -/** - @abstract Sends the actions for the control events for a particular event. - @param controlEvents A bitmask specifying the control events for which to send actions. See "Control Events" for bitmask constants. May not be 0. - @param event The event which triggered these control actions. May be nil. - */ -- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event; -@end - -#if TARGET_OS_TV -@interface ASControlNode (tvOS) - -/** - @abstract How the node looks when it isn't focused. Exposed here so that subclasses can override. - */ -- (void)setDefaultFocusAppearance; - -@end -#endif - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASControlNode.mm b/Example/Pods/Texture/Source/ASControlNode.mm deleted file mode 100644 index 4bc0ae60..00000000 --- a/Example/Pods/Texture/Source/ASControlNode.mm +++ /dev/null @@ -1,516 +0,0 @@ -// -// ASControlNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#if TARGET_OS_TV -#import -#endif - -// UIControl allows dragging some distance outside of the control itself during -// tracking. This value depends on the device idiom (25 or 70 points), so -// so replicate that effect with the same values here for our own controls. -#define kASControlNodeExpandedInset (([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? -25.0f : -70.0f) - -// Initial capacities for dispatch tables. -#define kASControlNodeEventDispatchTableInitialCapacity 4 - -@interface ASControlNode () -{ -@private - // Control Attributes - BOOL _enabled; - BOOL _highlighted; - - // Tracking - BOOL _tracking; - BOOL _touchInside; - - // Target action pairs stored in an array for each event type - // ASControlEvent -> [ASTargetAction0, ASTargetAction1] - NSMutableDictionary, NSMutableArray *> *_controlEventDispatchTable; -} - -// Read-write overrides. -@property (getter=isTracking) BOOL tracking; -@property (getter=isTouchInside) BOOL touchInside; - -/** - @abstract Returns a key to be used in _controlEventDispatchTable that identifies the control event. - @param controlEvent A control event. - @result A key for use in _controlEventDispatchTable. - */ -id _ASControlNodeEventKeyForControlEvent(ASControlNodeEvent controlEvent); - -/** - @abstract Enumerates the ASControlNode events included mask, invoking the block for each event. - @param mask An ASControlNodeEvent mask. - @param block The block to be invoked for each ASControlNodeEvent included in mask. - */ -void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, void (^block)(ASControlNodeEvent anEvent)); - -/** - @abstract Returns the expanded bounds used to determine if a touch is considered 'inside' during tracking. - @param controlNode A control node. - @result The expanded bounds of the node. - */ -CGRect _ASControlNodeGetExpandedBounds(ASControlNode *controlNode); - - -@end - -@implementation ASControlNode -{ - ASImageNode *_debugHighlightOverlay; -} - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - _enabled = YES; - - // As we have no targets yet, we start off with user interaction off. When a target is added, it'll get turned back on. - self.userInteractionEnabled = NO; - - return self; -} - -#if TARGET_OS_TV -- (void)didLoad -{ - [super didLoad]; - - // On tvOS all controls, such as buttons, interact with the focus system even if they don't have a target set on them. - // Here we add our own internal tap gesture to handle this behaviour. - self.userInteractionEnabled = YES; - UITapGestureRecognizer *tapGestureRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_pressDown)]; - tapGestureRec.allowedPressTypes = @[@(UIPressTypeSelect)]; - [self.view addGestureRecognizer:tapGestureRec]; -} -#endif - -- (void)setUserInteractionEnabled:(BOOL)userInteractionEnabled -{ - [super setUserInteractionEnabled:userInteractionEnabled]; - self.isAccessibilityElement = userInteractionEnabled; -} - -- (void)__exitHierarchy -{ - [super __exitHierarchy]; - - // If a control node is exit the hierarchy and is tracking we have to cancel it - if (self.tracking) { - [self _cancelTrackingWithEvent:nil]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" - -#pragma mark - ASDisplayNode Overrides - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - // If we're not interested in touches, we have nothing to do. - if (!self.enabled) { - return; - } - - // Check if the tracking should start - UITouch *theTouch = [touches anyObject]; - if (![self beginTrackingWithTouch:theTouch withEvent:event]) { - return; - } - - // If we get more than one touch down on us, cancel. - // Additionally, if we're already tracking a touch, a second touch beginning is cause for cancellation. - if (touches.count > 1 || self.tracking) { - [self _cancelTrackingWithEvent:event]; - } else { - // Otherwise, begin tracking. - self.tracking = YES; - - // No need to check bounds on touchesBegan as we wouldn't get the call if it wasn't in our bounds. - self.touchInside = YES; - self.highlighted = YES; - - // Send the appropriate touch-down control event depending on how many times we've been tapped. - ASControlNodeEvent controlEventMask = (theTouch.tapCount == 1) ? ASControlNodeEventTouchDown : ASControlNodeEventTouchDownRepeat; - [self sendActionsForControlEvents:controlEventMask withEvent:event]; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - // If we're not interested in touches, we have nothing to do. - if (!self.enabled) { - return; - } - - NSParameterAssert(touches.count == 1); - UITouch *theTouch = [touches anyObject]; - - // Check if tracking should continue - if (!self.tracking || ![self continueTrackingWithTouch:theTouch withEvent:event]) { - self.tracking = NO; - return; - } - - CGPoint touchLocation = [theTouch locationInView:self.view]; - - // Update our touchInside state. - BOOL dragIsInsideBounds = [self pointInside:touchLocation withEvent:nil]; - - // Update our highlighted state. - CGRect expandedBounds = _ASControlNodeGetExpandedBounds(self); - BOOL dragIsInsideExpandedBounds = CGRectContainsPoint(expandedBounds, touchLocation); - self.touchInside = dragIsInsideExpandedBounds; - self.highlighted = dragIsInsideExpandedBounds; - - [self sendActionsForControlEvents:(dragIsInsideBounds ? ASControlNodeEventTouchDragInside : ASControlNodeEventTouchDragOutside) - withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - // If we're not interested in touches, we have nothing to do. - if (!self.enabled) { - return; - } - - // Note that we've cancelled tracking. - [self _cancelTrackingWithEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - // If we're not interested in touches, we have nothing to do. - if (!self.enabled) { - return; - } - - // On iPhone 6s, iOS 9.2 (and maybe other versions) sometimes calls -touchesEnded:withEvent: - // twice on the view for one call to -touchesBegan:withEvent:. On ASControlNode, it used to - // trigger an action twice unintentionally. Now, we ignore that event if we're not in a tracking - // state in order to have a correct behavior. - // It might be related to that issue: http://www.openradar.me/22910171 - if (!self.tracking) { - return; - } - - NSParameterAssert([touches count] == 1); - UITouch *theTouch = [touches anyObject]; - CGPoint touchLocation = [theTouch locationInView:self.view]; - - // Update state. - self.tracking = NO; - self.touchInside = NO; - self.highlighted = NO; - - // Note that we've ended tracking. - [self endTrackingWithTouch:theTouch withEvent:event]; - - // Send the appropriate touch-up control event. - CGRect expandedBounds = _ASControlNodeGetExpandedBounds(self); - BOOL touchUpIsInsideExpandedBounds = CGRectContainsPoint(expandedBounds, touchLocation); - - [self sendActionsForControlEvents:(touchUpIsInsideExpandedBounds ? ASControlNodeEventTouchUpInside : ASControlNodeEventTouchUpOutside) - withEvent:event]; -} - -- (void)_cancelTrackingWithEvent:(UIEvent *)event -{ - // We're no longer tracking and there is no touch to be inside. - self.tracking = NO; - self.touchInside = NO; - self.highlighted = NO; - - // Send the cancel event. - [self sendActionsForControlEvents:ASControlNodeEventTouchCancel withEvent:event]; -} - -#pragma clang diagnostic pop - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - - // If not enabled we should not care about receving touches - if (! self.enabled) { - return nil; - } - - return [super hitTest:point withEvent:event]; -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - // If we're interested in touches, this is a tap (the only gesture we care about) and passed -hitTest for us, then no, you may not begin. Sir. - if (self.enabled && [gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] && gestureRecognizer.view != self.view) { - UITapGestureRecognizer *tapRecognizer = (UITapGestureRecognizer *)gestureRecognizer; - // Allow double-tap gestures - return tapRecognizer.numberOfTapsRequired != 1; - } - - // Otherwise, go ahead. :] - return YES; -} - -- (BOOL)supportsLayerBacking -{ - return super.supportsLayerBacking && !self.userInteractionEnabled; -} - -#pragma mark - Action Messages - -- (void)addTarget:(id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEventMask -{ - NSParameterAssert(action); - NSParameterAssert(controlEventMask != 0); - - // ASControlNode cannot be layer backed if adding a target - ASDisplayNodeAssert(!self.isLayerBacked, @"ASControlNode is layer backed, will never be able to call target in target:action: pair."); - - ASLockScopeSelf(); - - if (!_controlEventDispatchTable) { - _controlEventDispatchTable = [[NSMutableDictionary alloc] initWithCapacity:kASControlNodeEventDispatchTableInitialCapacity]; // enough to handle common types without re-hashing the dictionary when adding entries. - - // only show tap-able areas for views with 1 or more addTarget:action: pairs - if ([ASControlNode enableHitTestDebug] && _debugHighlightOverlay == nil) { - // do not use ASPerformBlockOnMainThread here, if it performs the block synchronously it will continue - // holding the lock while calling addSubnode. - dispatch_async(dispatch_get_main_queue(), ^{ - // add a highlight overlay node with area of ASControlNode + UIEdgeInsets - self.clipsToBounds = NO; - self->_debugHighlightOverlay = [[ASImageNode alloc] init]; - self->_debugHighlightOverlay.zPosition = 1000; // ensure we're over the top of any siblings - self->_debugHighlightOverlay.layerBacked = YES; - [self addSubnode:self->_debugHighlightOverlay]; - }); - } - } - - // Create new target action pair - ASControlTargetAction *targetAction = [[ASControlTargetAction alloc] init]; - targetAction.action = action; - targetAction.target = target; - - // Enumerate the events in the mask, adding the target-action pair for each control event included in controlEventMask - _ASEnumerateControlEventsIncludedInMaskWithBlock(controlEventMask, ^ - (ASControlNodeEvent controlEvent) - { - // Do we already have an event table for this control event? - id eventKey = _ASControlNodeEventKeyForControlEvent(controlEvent); - NSMutableArray *eventTargetActionArray = self->_controlEventDispatchTable[eventKey]; - - if (!eventTargetActionArray) { - eventTargetActionArray = [[NSMutableArray alloc] init]; - } - - // Remove any prior target-action pair for this event, as UIKit does. - [eventTargetActionArray removeObject:targetAction]; - - // Register the new target-action as the last one to be sent. - [eventTargetActionArray addObject:targetAction]; - - if (eventKey) { - [self->_controlEventDispatchTable setObject:eventTargetActionArray forKey:eventKey]; - } - }); - - self.userInteractionEnabled = YES; -} - -- (NSArray *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent -{ - NSParameterAssert(target); - NSParameterAssert(controlEvent != 0 && controlEvent != ASControlNodeEventAllEvents); - - ASLockScopeSelf(); - - // Grab the event target action array for this event. - NSMutableArray *eventTargetActionArray = _controlEventDispatchTable[_ASControlNodeEventKeyForControlEvent(controlEvent)]; - if (!eventTargetActionArray) { - return nil; - } - - NSMutableArray *actions = [[NSMutableArray alloc] init]; - - // Collect all actions for this target. - for (ASControlTargetAction *targetAction in eventTargetActionArray) { - if ((target == nil && targetAction.createdWithNoTarget) || (target != nil && target == targetAction.target)) { - [actions addObject:NSStringFromSelector(targetAction.action)]; - } - } - - return actions; -} - -- (NSSet *)allTargets -{ - ASLockScopeSelf(); - - NSMutableSet *targets = [[NSMutableSet alloc] init]; - - // Look at each event... - for (NSMutableArray *eventTargetActionArray in [_controlEventDispatchTable objectEnumerator]) { - // and each event's targets... - for (ASControlTargetAction *targetAction in eventTargetActionArray) { - [targets addObject:targetAction.target]; - } - } - - return targets; -} - -- (void)removeTarget:(id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEventMask -{ - NSParameterAssert(controlEventMask != 0); - - ASLockScopeSelf(); - - // Enumerate the events in the mask, removing the target-action pair for each control event included in controlEventMask. - _ASEnumerateControlEventsIncludedInMaskWithBlock(controlEventMask, ^ - (ASControlNodeEvent controlEvent) - { - // Grab the dispatch table for this event (if we have it). - id eventKey = _ASControlNodeEventKeyForControlEvent(controlEvent); - NSMutableArray *eventTargetActionArray = self->_controlEventDispatchTable[eventKey]; - if (!eventTargetActionArray) { - return; - } - - NSPredicate *filterPredicate = [NSPredicate predicateWithBlock:^BOOL(ASControlTargetAction *_Nullable evaluatedObject, NSDictionary * _Nullable bindings) { - if (!target || evaluatedObject.target == target) { - if (!action) { - return NO; - } else if (evaluatedObject.action == action) { - return NO; - } - } - - return YES; - }]; - [eventTargetActionArray filterUsingPredicate:filterPredicate]; - - if (eventTargetActionArray.count == 0) { - // If there are no targets for this event anymore, remove it. - [self->_controlEventDispatchTable removeObjectForKey:eventKey]; - } - }); -} - -#pragma mark - - -- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); //We access self.view below, it's not safe to call this off of main. - NSParameterAssert(controlEvents != 0); - - NSMutableArray *resolvedEventTargetActionArray = [[NSMutableArray alloc] init]; - - { - ASLockScopeSelf(); - - // Enumerate the events in the mask, invoking the target-action pairs for each. - _ASEnumerateControlEventsIncludedInMaskWithBlock(controlEvents, ^ - (ASControlNodeEvent controlEvent) - { - // Iterate on each target action pair - for (ASControlTargetAction *targetAction in self->_controlEventDispatchTable[_ASControlNodeEventKeyForControlEvent(controlEvent)]) { - ASControlTargetAction *resolvedTargetAction = [[ASControlTargetAction alloc] init]; - resolvedTargetAction.action = targetAction.action; - resolvedTargetAction.target = targetAction.target; - - // NSNull means that a nil target was set, so start at self and travel the responder chain - if (!resolvedTargetAction.target && targetAction.createdWithNoTarget) { - // if the target cannot perform the action, travel the responder chain to try to find something that does - resolvedTargetAction.target = [self.view targetForAction:resolvedTargetAction.action withSender:self]; - } - - if (resolvedTargetAction.target) { - [resolvedEventTargetActionArray addObject:resolvedTargetAction]; - } - } - }); - } - - //We don't want to hold the lock while calling out, we could potentially walk up the ownership tree causing a deadlock. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - for (ASControlTargetAction *targetAction in resolvedEventTargetActionArray) { - [targetAction.target performSelector:targetAction.action withObject:self withObject:event]; - } -#pragma clang diagnostic pop -} - -#pragma mark - Convenience - -id _ASControlNodeEventKeyForControlEvent(ASControlNodeEvent controlEvent) -{ - return @(controlEvent); -} - -void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, void (^block)(ASControlNodeEvent anEvent)) -{ - if (block == nil) { - return; - } - // Start with our first event (touch down) and work our way up to the last event (PrimaryActionTriggered) - for (ASControlNodeEvent thisEvent = ASControlNodeEventTouchDown; thisEvent <= ASControlNodeEventPrimaryActionTriggered; thisEvent <<= 1) { - // If it's included in the mask, invoke the block. - if ((mask & thisEvent) == thisEvent) - block(thisEvent); - } -} - -CGRect _ASControlNodeGetExpandedBounds(ASControlNode *controlNode) { - return CGRectInset(UIEdgeInsetsInsetRect(controlNode.view.bounds, controlNode.hitTestSlop), kASControlNodeExpandedInset, kASControlNodeExpandedInset); -} - -#pragma mark - For Subclasses - -- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent -{ - return YES; -} - -- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent -{ - return YES; -} - -- (void)cancelTrackingWithEvent:(UIEvent *)touchEvent -{ - // Subclass hook -} - -- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)touchEvent -{ - // Subclass hook -} - -#pragma mark - Debug -- (ASImageNode *)debugHighlightOverlay -{ - return _debugHighlightOverlay; -} -@end diff --git a/Example/Pods/Texture/Source/ASDKNavigationController.h b/Example/Pods/Texture/Source/ASDKNavigationController.h deleted file mode 100644 index aefcccdd..00000000 --- a/Example/Pods/Texture/Source/ASDKNavigationController.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ASDKNavigationController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * ASDKNavigationController - * - * @discussion ASDKNavigationController is a drop in replacement for UINavigationController - * which improves memory efficiency by implementing the @c ASManagesChildVisibilityDepth protocol. - * You can use ASDKNavigationController with regular UIViewControllers, as well as ASDKViewControllers. - * It is safe to subclass or use even where AsyncDisplayKit is not adopted. - * - * @see ASManagesChildVisibilityDepth - */ -@interface ASDKNavigationController : UINavigationController - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDKNavigationController.mm b/Example/Pods/Texture/Source/ASDKNavigationController.mm deleted file mode 100644 index fcda885a..00000000 --- a/Example/Pods/Texture/Source/ASDKNavigationController.mm +++ /dev/null @@ -1,113 +0,0 @@ -// -// ASDKNavigationController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@implementation ASDKNavigationController -{ - BOOL _parentManagesVisibilityDepth; - NSInteger _visibilityDepth; -} - -ASVisibilityDidMoveToParentViewController; - -ASVisibilityViewWillAppear; - -ASVisibilityViewDidDisappearImplementation; - -ASVisibilitySetVisibilityDepth; - -ASVisibilityDepthImplementation; - -- (void)visibilityDepthDidChange -{ - for (UIViewController *viewController in self.viewControllers) { - if ([viewController conformsToProtocol:@protocol(ASVisibilityDepth)]) { - [(id )viewController visibilityDepthDidChange]; - } - } -} - -- (NSInteger)visibilityDepthOfChildViewController:(UIViewController *)childViewController -{ - NSUInteger viewControllerIndex = [self.viewControllers indexOfObjectIdenticalTo:childViewController]; - if (viewControllerIndex == NSNotFound) { - //If childViewController is not actually a child, return NSNotFound which is also a really large number. - return NSNotFound; - } - - if (viewControllerIndex == self.viewControllers.count - 1) { - //view controller is at the top, just return our own visibility depth. - return [self visibilityDepth]; - } else if (viewControllerIndex == 0) { - //view controller is the root view controller. Can be accessed by holding the back button. - return [self visibilityDepth] + 1; - } - - return [self visibilityDepth] + self.viewControllers.count - 1 - viewControllerIndex; -} - -#pragma mark - UIKit overrides - -- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated -{ - as_activity_create_for_scope("Pop multiple from ASDKNavigationController"); - NSArray *viewControllers = [super popToViewController:viewController animated:animated]; - os_log_info(ASNodeLog(), "Popped %@ to %@, removing %@", self, viewController, ASGetDescriptionValueString(viewControllers)); - - [self visibilityDepthDidChange]; - return viewControllers; -} - -- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated -{ - as_activity_create_for_scope("Pop to root of ASDKNavigationController"); - NSArray *viewControllers = [super popToRootViewControllerAnimated:animated]; - os_log_info(ASNodeLog(), "Popped view controllers %@ from %@", ASGetDescriptionValueString(viewControllers), self); - - [self visibilityDepthDidChange]; - return viewControllers; -} - -- (void)setViewControllers:(NSArray *)viewControllers -{ - // NOTE: As of now this method calls through to setViewControllers:animated: so no need to log/activity here. - - [super setViewControllers:viewControllers]; - [self visibilityDepthDidChange]; -} - -- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated -{ - as_activity_create_for_scope("Set view controllers of ASDKNavigationController"); - os_log_info(ASNodeLog(), "Set view controllers of %@ to %@ animated: %d", self, ASGetDescriptionValueString(viewControllers), animated); - [super setViewControllers:viewControllers animated:animated]; - [self visibilityDepthDidChange]; -} - -- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated -{ - as_activity_create_for_scope("Push view controller on ASDKNavigationController"); - os_log_info(ASNodeLog(), "Pushing %@ onto %@", viewController, self); - [super pushViewController:viewController animated:animated]; - [self visibilityDepthDidChange]; -} - -- (UIViewController *)popViewControllerAnimated:(BOOL)animated -{ - as_activity_create_for_scope("Pop view controller from ASDKNavigationController"); - UIViewController *viewController = [super popViewControllerAnimated:animated]; - os_log_info(ASNodeLog(), "Popped %@ from %@", viewController, self); - [self visibilityDepthDidChange]; - return viewController; -} - -@end diff --git a/Example/Pods/Texture/Source/ASDKViewController.h b/Example/Pods/Texture/Source/ASDKViewController.h deleted file mode 100644 index 035b09e1..00000000 --- a/Example/Pods/Texture/Source/ASDKViewController.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// ASDKViewController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASTraitCollection; - -NS_ASSUME_NONNULL_BEGIN - -typedef ASTraitCollection * _Nonnull (^ASDisplayTraitsForTraitCollectionBlock)(UITraitCollection *traitCollection); -typedef ASTraitCollection * _Nonnull (^ASDisplayTraitsForTraitWindowSizeBlock)(CGSize windowSize); - -/** - * ASDKViewController allows you to have a completely node backed hierarchy. It automatically - * handles @c ASVisibilityDepth, automatic range mode and propogating @c ASDisplayTraits to contained nodes. - * - * You can opt-out of node backed hierarchy and use it like a normal UIViewController. - * More importantly, you can use it as a base class for all of your view controllers among which some use a node hierarchy and some don't. - * See examples/ASDKgram project for actual implementation. - */ -@interface ASDKViewController<__covariant DisplayNodeType : ASDisplayNode *> : UIViewController - -/** - * ASDKViewController initializer. - * - * @param node An ASDisplayNode which will provide the root view (self.view) - * @return An ASDKViewController instance whose root view will be backed by the provided ASDisplayNode. - * - * @see ASVisibilityDepth - */ -- (instancetype)initWithNode:(DisplayNodeType)node NS_DESIGNATED_INITIALIZER; - -/** -* ASDKViewController initializer. Useful for interoperability with normal UIViewControllers. -* -* @return An ASDKViewController instance with a nil node whose root view will be backed by a standard UIView as with a normal UIViewController. -* -* @see ASVisibilityDepth -*/ -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -NS_ASSUME_NONNULL_END - -/** - * @return node Returns the ASDisplayNode which provides the backing view to the view controller. - */ -@property (nonatomic, readonly, null_unspecified) DisplayNodeType node; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Set this block to customize the ASDisplayTraits returned when the VC transitions to the given traitCollection. - */ -@property (nonatomic, copy) ASDisplayTraitsForTraitCollectionBlock overrideDisplayTraitsWithTraitCollection; - -/** - * Set this block to customize the ASDisplayTraits returned when the VC transitions to the given window size. - */ -@property (nonatomic, copy) ASDisplayTraitsForTraitWindowSizeBlock overrideDisplayTraitsWithWindowSize ASDISPLAYNODE_DEPRECATED_MSG("This property is actually never accessed inside the framework"); - -/** - * @abstract Passthrough property to the the .interfaceState of the node. - * @return The current ASInterfaceState of the node, indicating whether it is visible and other situational properties. - * @see ASInterfaceState - */ -@property (nonatomic, readonly) ASInterfaceState interfaceState; - - -// AsyncDisplayKit 2.0 BETA: This property is still being tested, but it allows -// blocking as a view controller becomes visible to ensure no placeholders flash onscreen. -// Refer to examples/SynchronousConcurrency, AsyncViewController.m -@property (nonatomic) BOOL neverShowPlaceholders; - -/* Custom container UIViewController subclasses can use this property to add to the overlay - that UIViewController calculates for the safeAreaInsets for contained view controllers. - */ -@property(nonatomic) UIEdgeInsets additionalSafeAreaInsets; - -@end - -@interface ASDKViewController (ASRangeControllerUpdateRangeProtocol) - -/** - * Automatically adjust range mode based on view events. If you set this to YES, the view controller or its node - * must conform to the ASRangeControllerUpdateRangeProtocol. - * - * Default value is YES *if* node or view controller conform to ASRangeControllerUpdateRangeProtocol otherwise it is NO. - */ -@property (nonatomic) BOOL automaticallyAdjustRangeModeBasedOnViewEvents; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDKViewController.mm b/Example/Pods/Texture/Source/ASDKViewController.mm deleted file mode 100644 index da4a19e8..00000000 --- a/Example/Pods/Texture/Source/ASDKViewController.mm +++ /dev/null @@ -1,358 +0,0 @@ -// -// ASDKViewController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import - -@implementation ASDKViewController -{ - BOOL _ensureDisplayed; - BOOL _automaticallyAdjustRangeModeBasedOnViewEvents; - BOOL _parentManagesVisibilityDepth; - NSInteger _visibilityDepth; - BOOL _selfConformsToRangeModeProtocol; - BOOL _nodeConformsToRangeModeProtocol; - UIEdgeInsets _fallbackAdditionalSafeAreaInsets; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" - -- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - if (!(self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { - return nil; - } - - [self _initializeInstance]; - - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if (!(self = [super initWithCoder:aDecoder])) { - return nil; - } - - [self _initializeInstance]; - - return self; -} - -#pragma clang diagnostic pop - -- (instancetype)initWithNode:(ASDisplayNode *)node -{ - if (!(self = [super initWithNibName:nil bundle:nil])) { - return nil; - } - - _node = node; - [self _initializeInstance]; - - return self; -} - -- (instancetype)init -{ - if (!(self = [super initWithNibName:nil bundle:nil])) { - return nil; - } - - [self _initializeInstance]; - - return self; -} - -- (void)_initializeInstance -{ - if (_node == nil) { - return; - } - - _node.viewControllerRoot = YES; - - _selfConformsToRangeModeProtocol = [self conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]; - _nodeConformsToRangeModeProtocol = [_node conformsToProtocol:@protocol(ASRangeControllerUpdateRangeProtocol)]; - _automaticallyAdjustRangeModeBasedOnViewEvents = _selfConformsToRangeModeProtocol || _nodeConformsToRangeModeProtocol; - - _fallbackAdditionalSafeAreaInsets = UIEdgeInsetsZero; - - // In case the node will get loaded - if (_node.nodeLoaded) { - // Node already loaded the view - [self view]; - } else { - // If the node didn't load yet add ourselves as on did load observer to load the view in case the node gets loaded - // before the view controller - __weak __typeof__(self) weakSelf = self; - [_node onDidLoad:^(__kindof ASDisplayNode * _Nonnull node) { - if ([weakSelf isViewLoaded] == NO) { - [weakSelf view]; - } - }]; - } -} - -- (void)loadView -{ - // Apple applies a frame and autoresizing masks we need. Allocating a view is not - // nearly as expensive as adding and removing it from a hierarchy, and fortunately - // we can avoid that here. Enabling layerBacking on a single node in the hierarchy - // will have a greater performance benefit than the impact of this transient view. - [super loadView]; - - if (_node == nil) { - return; - } - - ASDisplayNodeAssertTrue(!_node.layerBacked); - - UIView *view = self.view; - CGRect frame = view.frame; - UIViewAutoresizing autoresizingMask = view.autoresizingMask; - - // We have what we need, so now create and assign the view we actually want. - view = _node.view; - _node.frame = frame; - _node.autoresizingMask = autoresizingMask; - self.view = view; - - // ensure that self.node has a valid trait collection before a subclass's implementation of viewDidLoad. - // Any subnodes added in viewDidLoad will then inherit the proper environment. - ASPrimitiveTraitCollection traitCollection = [self primitiveTraitCollectionForUITraitCollection:self.traitCollection]; - [self propagateNewTraitCollection:traitCollection]; -} - -- (void)viewWillLayoutSubviews -{ - [super viewWillLayoutSubviews]; - - // Before layout, make sure that our trait collection containerSize actually matches the size of our bounds. - // If not, we need to update the traits and propagate them. - - CGSize boundsSize = self.view.bounds.size; - if (CGSizeEqualToSize(self.node.primitiveTraitCollection.containerSize, boundsSize) == NO) { - [UIView performWithoutAnimation:^{ - ASPrimitiveTraitCollection traitCollection = [self primitiveTraitCollectionForUITraitCollection:self.traitCollection]; - traitCollection.containerSize = boundsSize; - - // this method will call measure - [self propagateNewTraitCollection:traitCollection]; - }]; - } else { - // Call layoutThatFits: to let the node prepare for a layout that will happen shortly in the layout pass of the view. - // If the node's constrained size didn't change between the last layout pass it's a no-op - [_node layoutThatFits:[self nodeConstrainedSize]]; - } -} - -- (void)viewDidLayoutSubviews -{ - if (_ensureDisplayed && self.neverShowPlaceholders) { - _ensureDisplayed = NO; - [_node recursivelyEnsureDisplaySynchronously:YES]; - } - [super viewDidLayoutSubviews]; - - if (!AS_AT_LEAST_IOS11) { - [self _updateNodeFallbackSafeArea]; - } -} - -- (void)_updateNodeFallbackSafeArea -{ - UIEdgeInsets safeArea = UIEdgeInsetsMake(self.topLayoutGuide.length, 0, self.bottomLayoutGuide.length, 0); - UIEdgeInsets additionalInsets = self.additionalSafeAreaInsets; - - safeArea = ASConcatInsets(safeArea, additionalInsets); - - _node.fallbackSafeAreaInsets = safeArea; -} - -ASVisibilityDidMoveToParentViewController; - -- (void)viewWillAppear:(BOOL)animated -{ - as_activity_create_for_scope("ASDKViewController will appear"); - os_log_debug(ASNodeLog(), "View controller %@ will appear", self); - - [super viewWillAppear:animated]; - - _ensureDisplayed = YES; - - // A layout pass is forced this early to get nodes like ASCollectionNode, ASTableNode etc. - // into the hierarchy before UIKit applies the scroll view inset adjustments, if automatic subnode management - // is enabled. Otherwise the insets would not be applied. - [_node.view layoutIfNeeded]; - - if (_parentManagesVisibilityDepth == NO) { - [self setVisibilityDepth:0]; - } -} - -ASVisibilitySetVisibilityDepth; - -ASVisibilityViewDidDisappearImplementation; - -ASVisibilityDepthImplementation; - -- (void)visibilityDepthDidChange -{ - ASLayoutRangeMode rangeMode = ASLayoutRangeModeForVisibilityDepth(self.visibilityDepth); -#if ASEnableVerboseLogging - NSString *rangeModeString; - switch (rangeMode) { - case ASLayoutRangeModeMinimum: - rangeModeString = @"Minimum"; - break; - - case ASLayoutRangeModeFull: - rangeModeString = @"Full"; - break; - - case ASLayoutRangeModeVisibleOnly: - rangeModeString = @"Visible Only"; - break; - - case ASLayoutRangeModeLowMemory: - rangeModeString = @"Low Memory"; - break; - - default: - break; - } - as_log_verbose(ASNodeLog(), "Updating visibility of %@ to: %@ (visibility depth: %zd)", self, rangeModeString, self.visibilityDepth); -#endif - [self updateCurrentRangeModeWithModeIfPossible:rangeMode]; -} - -#pragma mark - Automatic range mode - -- (BOOL)automaticallyAdjustRangeModeBasedOnViewEvents -{ - return _automaticallyAdjustRangeModeBasedOnViewEvents; -} - -- (void)setAutomaticallyAdjustRangeModeBasedOnViewEvents:(BOOL)automaticallyAdjustRangeModeBasedOnViewEvents -{ - if (automaticallyAdjustRangeModeBasedOnViewEvents != _automaticallyAdjustRangeModeBasedOnViewEvents) { - if (automaticallyAdjustRangeModeBasedOnViewEvents && _selfConformsToRangeModeProtocol == NO && _nodeConformsToRangeModeProtocol == NO) { - NSLog(@"Warning: automaticallyAdjustRangeModeBasedOnViewEvents set to YES in %@, but range mode updating is not possible because neither view controller nor node %@ conform to ASRangeControllerUpdateRangeProtocol.", self, _node); - } - _automaticallyAdjustRangeModeBasedOnViewEvents = automaticallyAdjustRangeModeBasedOnViewEvents; - } -} - -- (void)updateCurrentRangeModeWithModeIfPossible:(ASLayoutRangeMode)rangeMode -{ - if (!_automaticallyAdjustRangeModeBasedOnViewEvents) { - return; - } - - if (_selfConformsToRangeModeProtocol) { - id rangeUpdater = (id)self; - [rangeUpdater updateCurrentRangeWithMode:rangeMode]; - } - - if (_nodeConformsToRangeModeProtocol) { - id rangeUpdater = (id)_node; - [rangeUpdater updateCurrentRangeWithMode:rangeMode]; - } -} - -#pragma mark - Layout Helpers - -- (ASSizeRange)nodeConstrainedSize -{ - return ASSizeRangeMake(self.view.bounds.size); -} - -- (ASInterfaceState)interfaceState -{ - return _node.interfaceState; -} - -- (UIEdgeInsets)additionalSafeAreaInsets -{ - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - return super.additionalSafeAreaInsets; - } - - return _fallbackAdditionalSafeAreaInsets; -} - -- (void)setAdditionalSafeAreaInsets:(UIEdgeInsets)additionalSafeAreaInsets -{ - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - [super setAdditionalSafeAreaInsets:additionalSafeAreaInsets]; - } else { - _fallbackAdditionalSafeAreaInsets = additionalSafeAreaInsets; - [self _updateNodeFallbackSafeArea]; - } -} - -#pragma mark - ASTraitEnvironment - -- (ASPrimitiveTraitCollection)primitiveTraitCollectionForUITraitCollection:(UITraitCollection *)traitCollection -{ - if (self.overrideDisplayTraitsWithTraitCollection) { - ASTraitCollection *asyncTraitCollection = self.overrideDisplayTraitsWithTraitCollection(traitCollection); - return [asyncTraitCollection primitiveTraitCollection]; - } - - ASDisplayNodeAssertMainThread(); - ASPrimitiveTraitCollection asyncTraitCollection = ASPrimitiveTraitCollectionFromUITraitCollection(traitCollection); - asyncTraitCollection.containerSize = self.view.frame.size; - return asyncTraitCollection; -} - -- (void)propagateNewTraitCollection:(ASPrimitiveTraitCollection)traitCollection -{ - ASPrimitiveTraitCollection oldTraitCollection = self.node.primitiveTraitCollection; - - if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, oldTraitCollection) == NO) { - as_activity_scope_verbose(as_activity_create("Propagate ASDKViewController trait collection", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - os_log_debug(ASNodeLog(), "Propagating new traits for %@: %@", self, NSStringFromASPrimitiveTraitCollection(traitCollection)); - ASTraitCollectionPropagateDown(self.node, traitCollection); - - // Once we've propagated all the traits, layout this node. - // Remeasure the node with the latest constrained size – old constrained size may be incorrect. - as_activity_scope_verbose(as_activity_create("Layout ASDKViewController node with new traits", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - [_node layoutThatFits:[self nodeConstrainedSize]]; - } -} - -- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection -{ - [super traitCollectionDidChange:previousTraitCollection]; - - ASPrimitiveTraitCollection traitCollection = [self primitiveTraitCollectionForUITraitCollection:self.traitCollection]; - traitCollection.containerSize = self.view.bounds.size; - [self propagateNewTraitCollection:traitCollection]; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation -{ - [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - - ASPrimitiveTraitCollection traitCollection = _node.primitiveTraitCollection; - traitCollection.containerSize = self.view.bounds.size; - [self propagateNewTraitCollection:traitCollection]; -} -#pragma clang diagnostic pop - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Beta.h b/Example/Pods/Texture/Source/ASDisplayNode+Beta.h deleted file mode 100644 index 882042a9..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Beta.h +++ /dev/null @@ -1,171 +0,0 @@ -// -// ASDisplayNode+Beta.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -#if YOGA - #import YOGA_HEADER_PATH - #import - #import -#endif - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); -ASDK_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT - -/** - * Bitmask to indicate what performance measurements the cell should record. - */ -typedef NS_OPTIONS(unsigned char, ASDisplayNodePerformanceMeasurementOptions) { - ASDisplayNodePerformanceMeasurementOptionLayoutSpec = 1 << 0, - ASDisplayNodePerformanceMeasurementOptionLayoutComputation = 1 << 1 -}; - -typedef struct { - CFTimeInterval layoutSpecTotalTime; - NSInteger layoutSpecNumberOfPasses; - CFTimeInterval layoutComputationTotalTime; - NSInteger layoutComputationNumberOfPasses; -} ASDisplayNodePerformanceMeasurements; - -@interface ASDisplayNode (Beta) - -/** - * ASTableView and ASCollectionView now throw exceptions on invalid updates - * like their UIKit counterparts. If YES, these classes will log messages - * on invalid updates rather than throwing exceptions. - * - * Note that even if AsyncDisplayKit's exception is suppressed, the app may still crash - * as it proceeds with an invalid update. - * - * This property defaults to NO. It will be removed in a future release. - */ -+ (BOOL)suppressesInvalidCollectionUpdateExceptions AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Collection update exceptions are thrown if assertions are enabled."); -+ (void)setSuppressesInvalidCollectionUpdateExceptions:(BOOL)suppresses; - -/** - * @abstract Recursively ensures node and all subnodes are displayed. - * @see Full documentation in ASDisplayNode+FrameworkPrivate.h - */ -- (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously; - -/** - * @abstract allow modification of a context before the node's content is drawn - * - * @discussion Set the block to be called after the context has been created and before the node's content is drawn. - * You can override this to modify the context before the content is drawn. You are responsible for saving and - * restoring context if necessary. Restoring can be done in contextDidDisplayNodeContent - * This block can be called from *any* thread and it is unsafe to access any UIKit main thread properties from it. - */ -@property (nullable) ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext; - -/** - * @abstract allow modification of a context after the node's content is drawn - */ -@property (nullable) ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext; - -/** - * @abstract A bitmask representing which actions (layout spec, layout generation) should be measured. - */ -@property ASDisplayNodePerformanceMeasurementOptions measurementOptions; - -/** - * @abstract A simple struct representing performance measurements collected. - */ -@property (readonly) ASDisplayNodePerformanceMeasurements performanceMeasurements; - -/** - * @abstract Whether this node acts as an accessibility container. If set to YES, then this node's accessibility label will represent - * an aggregation of all child nodes' accessibility labels. Nodes in this node's subtree that are also accessibility containers will - * not be included in this aggregation, and will be exposed as separate accessibility elements to UIKit. - */ -@property BOOL isAccessibilityContainer; - -/** - * @abstract Returns the default accessibility property values set by Texture on this node. For - * example, the default accessibility label for a text node may be its text content, while most - * other nodes would have nil default labels. - */ -@property (nullable, readonly, copy) NSString *defaultAccessibilityLabel; -@property (nullable, readonly, copy) NSString *defaultAccessibilityHint; -@property (nullable, readonly, copy) NSString *defaultAccessibilityValue; -@property (nullable, readonly, copy) NSString *defaultAccessibilityIdentifier; -@property (readonly) UIAccessibilityTraits defaultAccessibilityTraits; - -/** - * @abstract Invoked when a user performs a custom action on an accessible node. Nodes that are children of accessibility containers, have - * an accessibity label and have an interactive UIAccessibilityTrait will automatically receive custom-action handling. - * - * @return Return a boolean value that determine whether to propagate through the responder chain. - * To halt propagation, return YES; otherwise, return NO. - */ -- (BOOL)performAccessibilityCustomAction:(UIAccessibilityCustomAction *)action; - -/** - * @abstract Currently used by ASNetworkImageNode and ASMultiplexImageNode to allow their placeholders to stay if they are loading an image from the network. - * Otherwise, a display pass is scheduled and completes, but does not actually draw anything - and ASDisplayNode considers the element finished. - */ -- (BOOL)placeholderShouldPersist AS_WARN_UNUSED_RESULT; - -/** - * @abstract Indicates that the receiver and all subnodes have finished displaying. May be called more than once, for example if the receiver has - * a network image node. This is called after the first display pass even if network image nodes have not downloaded anything (text would be done, - * and other nodes that are ready to do their final display). Each render of every progressive jpeg network node would cause this to be called, so - * this hook could be called up to 1 + (pJPEGcount * pJPEGrenderCount) times. The render count depends on how many times the downloader calls the - * progressImage block. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)hierarchyDisplayDidFinish NS_REQUIRES_SUPER; - -/** - * Only called on the root during yoga layout. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)willCalculateLayout:(ASSizeRange)constrainedSize NS_REQUIRES_SUPER; - -/** - * Only ASLayoutRangeModeVisibleOnly or ASLayoutRangeModeLowMemory are recommended. Default is ASLayoutRangeModeVisibleOnly, - * because this is the only way to ensure an application will not have blank / flashing views as the user navigates back after - * a memory warning. Apps that wish to use the more effective / aggressive ASLayoutRangeModeLowMemory may need to take steps - * to mitigate this behavior, including: restoring a larger range mode to the next controller before the user navigates there, - * enabling .neverShowPlaceholders on ASCellNodes so that the navigation operation is blocked on redisplay completing, etc. - */ -+ (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode; - -/** - * @abstract Whether to draw all descendent nodes' contents into this node's layer's backing store. - * - * @discussion - * When called, causes all descendent nodes' contents to be drawn directly into this node's layer's backing - * store. - * - * If a node's descendants are static (never animated or never change attributes after creation) then that node is a - * good candidate for rasterization. Rasterizing descendants has two main benefits: - * 1) Backing stores for descendant layers are not created. Instead the layers are drawn directly into the rasterized - * container. This can save a great deal of memory. - * 2) Since the entire subtree is drawn into one backing store, compositing and blending are eliminated in that subtree - * which can help improve animation/scrolling/etc performance. - * - * Rasterization does not currently support descendants with transform, sublayerTransform, or alpha. Those properties - * will be ignored when rasterizing descendants. - * - * Note: this has nothing to do with -[CALayer shouldRasterize], which doesn't work with ASDisplayNode's asynchronous - * rendering model. - * - * Note: You cannot add subnodes whose layers/views are already loaded to a rasterized node. - * Note: You cannot call this method after the receiver's layer/view is loaded. - */ -- (void)enableSubtreeRasterization; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Convenience.h b/Example/Pods/Texture/Source/ASDisplayNode+Convenience.h deleted file mode 100644 index 3c00f672..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Convenience.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ASDisplayNode+Convenience.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class UIViewController; - -@interface ASDisplayNode (Convenience) - -/** - * @abstract Returns the view controller nearest to this node in the view hierarchy. - * - * @warning This property may only be accessed on the main thread. This property may - * be @c nil until the node's view is actually hosted in the view hierarchy. - */ -@property (nonatomic, nullable, readonly) __kindof UIViewController *closestViewController; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Convenience.mm b/Example/Pods/Texture/Source/ASDisplayNode+Convenience.mm deleted file mode 100644 index c441290b..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Convenience.mm +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASDisplayNode+Convenience.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASDisplayNode+Convenience.h" - -#import -#import - -@implementation ASDisplayNode (Convenience) - -- (__kindof UIViewController *)closestViewController -{ - ASDisplayNodeAssertMainThread(); - - // Careful not to trigger node loading here. - if (!self.nodeLoaded) { - return nil; - } - - // Get the closest view. - UIView *view = ASFindClosestViewOfLayer(self.layer); - // Travel up the responder chain to find a view controller. - for (UIResponder *responder in [view asdk_responderChainEnumerator]) { - UIViewController *vc = ASDynamicCast(responder, UIViewController); - if (vc != nil) { - return vc; - } - } - return nil; -} - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNode+InterfaceState.h b/Example/Pods/Texture/Source/ASDisplayNode+InterfaceState.h deleted file mode 100644 index 96ff7032..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+InterfaceState.h +++ /dev/null @@ -1,148 +0,0 @@ -// -// ASDisplayNode+InterfaceState.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * Interface state is available on ASDisplayNode and ASDKViewController, and - * allows checking whether a node is in an interface situation where it is prudent to trigger certain - * actions: measurement, data loading, display, and visibility (the latter for animations or other onscreen-only effects). - * - * The defualt state, ASInterfaceStateNone, means that the element is not predicted to be onscreen soon and - * preloading should not be performed. Swift: use [] for the default behavior. - */ -typedef NS_OPTIONS(unsigned char, ASInterfaceState) -{ - /** The element is not predicted to be onscreen soon and preloading should not be performed */ - ASInterfaceStateNone = 0, - /** The element may be added to a view soon that could become visible. Measure the layout, including size calculation. */ - ASInterfaceStateMeasureLayout = 1 << 0, - /** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */ - ASInterfaceStatePreload = 1 << 1, - /** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */ - ASInterfaceStateDisplay = 1 << 2, - /** The element is physically onscreen by at least 1 pixel. - In practice, all other bit fields should also be set when this flag is set. */ - ASInterfaceStateVisible = 1 << 3, - - /** - * The node is not contained in a cell but it is in a window. - * - * Currently we only set `interfaceState` to other values for - * nodes contained in table views or collection views. - */ - ASInterfaceStateInHierarchy = ASInterfaceStateMeasureLayout | ASInterfaceStatePreload | ASInterfaceStateDisplay | ASInterfaceStateVisible, -}; - -@protocol ASInterfaceStateDelegate - -/** - * @abstract Called whenever any bit in the ASInterfaceState bitfield is changed. - * @discussion Subclasses may use this to monitor when they become visible, should free cached data, and much more. - * @see ASInterfaceState - */ -- (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState; - -/** - * @abstract Called whenever the node becomes visible. - * @discussion Subclasses may use this to monitor when they become visible. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterVisibleState; - -/** - * @abstract Called whenever the node is no longer visible. - * @discussion Subclasses may use this to monitor when they are no longer visible. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitVisibleState; - -/** - * @abstract Called whenever the the node has entered the display state. - * @discussion Subclasses may use this to monitor when a node should be rendering its content. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterDisplayState; - -/** - * @abstract Called whenever the the node has exited the display state. - * @discussion Subclasses may use this to monitor when a node should no longer be rendering its content. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitDisplayState; - -/** - * @abstract Called whenever the the node has entered the preload state. - * @discussion Subclasses may use this to monitor data for a node should be preloaded, either from a local or remote source. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterPreloadState; - -/** - * @abstract Called whenever the the node has exited the preload state. - * @discussion Subclasses may use this to monitor whether preloading data for a node should be canceled. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitPreloadState; - -/** - * @abstract Called when the node has completed applying the layout. - * @discussion Can be used for operations that are performed after layout has completed. - * @note This method is guaranteed to be called on main. - */ -- (void)nodeDidLayout; - -/** - * @abstract Called when the node loads. - * @discussion Can be used for operations that are performed after the node's view is available. - * @note This method is guaranteed to be called on main. - */ -- (void)nodeDidLoad; - -/** - * @abstract Indicates that the receiver and all subnodes have finished displaying. - * @discussion May be called more than once, for example if the receiver has a network image node. - * This is called after the first display pass even if network image nodes have not downloaded anything - * (text would be done, and other nodes that are ready to do their final display). Each render of - * every progressive jpeg network node would cause this to be called, so this hook could be called up to - * 1 + (pJPEGcount * pJPEGrenderCount) times. The render count depends on how many times the downloader calls - * the progressImage block. - * @note This method is guaranteed to be called on main. - */ -- (void)hierarchyDisplayDidFinish; - -@optional -/** - * @abstract Called when the node is about to calculate layout. This is only called before - * Yoga-driven layouts. - * @discussion Can be used for operations that are performed after the node's view is available. - * @note This method is guaranteed to be called on main, but implementations should be careful not - * to attempt to ascend the node tree when handling this, as the root node is locked when this is - * called. - */ -- (void)nodeWillCalculateLayout:(ASSizeRange)constrainedSize; - -/** - * @abstract Called when the node's layer is about to enter the hierarchy. - * @discussion May be called more than once if the layer is participating in a higher-level - * animation, such as a UIViewController transition. These animations can cause the layer to get - * re-parented multiple times, and each time will trigger this call. - * @note This method is guaranteed to be called on main. - */ -- (void)didEnterHierarchy; - -/** - * @abstract Called when the node's layer has exited the hierarchy. - * @discussion May be called more than once if the layer is participating in a higher-level - * animation, such as a UIViewController transition. These animations can cause the layer to get - * re-parented multiple times, and each time will trigger this call. - * @note This method is guaranteed to be called on main. - */ -- (void)didExitHierarchy; - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Layout.mm b/Example/Pods/Texture/Source/ASDisplayNode+Layout.mm deleted file mode 100644 index ab99d3ae..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Layout.mm +++ /dev/null @@ -1,1098 +0,0 @@ -// -// ASDisplayNode+Layout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -using AS::MutexLocker; - -@interface ASDisplayNode (ASLayoutElementStyleDelegate) -@end - -@implementation ASDisplayNode (ASLayoutElementStyleDelegate) - -#pragma mark - -- (void)style:(ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName { - [self setNeedsLayout]; -} - -@end - -#pragma mark - ASDisplayNode (ASLayoutElement) - -@implementation ASDisplayNode (ASLayoutElement) - -#pragma mark - -- (BOOL)implementsLayoutMethod -{ - MutexLocker l(__instanceLock__); - return (_methodOverrides & (ASDisplayNodeMethodOverrideLayoutSpecThatFits | - ASDisplayNodeMethodOverrideCalcLayoutThatFits | - ASDisplayNodeMethodOverrideCalcSizeThatFits)) != 0 || _layoutSpecBlock != nil; -} - - -- (ASLayoutElementStyle *)style -{ - MutexLocker l(__instanceLock__); - return [self _locked_style]; -} - -- (ASLayoutElementStyle *)_locked_style -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (_style == nil) { -#if YOGA - // In Yoga mode we use the delegate to inform the tree if properties changes - _style = [[ASLayoutElementStyle alloc] initWithDelegate:self]; -#else - _style = [[ASLayoutElementStyle alloc] init]; -#endif - } - return _style; -} - -- (ASLayoutElementType)layoutElementType -{ - return ASLayoutElementTypeDisplayNode; -} - -- (NSArray> *)sublayoutElements -{ - return self.subnodes; -} - -#pragma mark Measurement Pass - -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize -{ - return [self layoutThatFits:constrainedSize parentSize:constrainedSize.max]; -} - -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize -{ - ASScopedLockSelfOrToRoot(); - - // If one or multiple layout transitions are in flight it still can happen that layout information is requested - // on other threads. As the pending and calculated layout to be updated in the layout transition in here just a - // layout calculation wil be performed without side effect - if ([self _isLayoutTransitionInvalid]) { - return [self calculateLayoutThatFits:constrainedSize restrictedToSize:self.style.size relativeToParentSize:parentSize]; - } - - ASLayout *layout = nil; - NSUInteger version = _layoutVersion; - if (_calculatedDisplayNodeLayout.isValid(constrainedSize, parentSize, version)) { - ASDisplayNodeAssertNotNil(_calculatedDisplayNodeLayout.layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _calculatedDisplayNodeLayout.layout should not be nil! %@", self); - layout = _calculatedDisplayNodeLayout.layout; - } else if (_pendingDisplayNodeLayout.isValid(constrainedSize, parentSize, version)) { - ASDisplayNodeAssertNotNil(_pendingDisplayNodeLayout.layout, @"-[ASDisplayNode layoutThatFits:parentSize:] _pendingDisplayNodeLayout.layout should not be nil! %@", self); - layout = _pendingDisplayNodeLayout.layout; - } else { - // Create a pending display node layout for the layout pass - layout = [self calculateLayoutThatFits:constrainedSize - restrictedToSize:self.style.size - relativeToParentSize:parentSize]; - as_log_verbose(ASLayoutLog(), "Established pending layout for %@ in %s", self, sel_getName(_cmd)); - _pendingDisplayNodeLayout = ASDisplayNodeLayout(layout, constrainedSize, parentSize,version); - ASDisplayNodeAssertNotNil(layout, @"-[ASDisplayNode layoutThatFits:parentSize:] newly calculated layout should not be nil! %@", self); - } - - return layout ?: [ASLayout layoutWithLayoutElement:self size:{0, 0}]; -} - -#pragma mark ASLayoutElementStyleExtensibility - -ASLayoutElementStyleExtensibilityForwarding - -#pragma mark ASPrimitiveTraitCollection - -- (ASPrimitiveTraitCollection)primitiveTraitCollection -{ - AS::MutexLocker l(__instanceLock__); - return _primitiveTraitCollection; -} - -- (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection -{ - AS::UniqueLock l(__instanceLock__); - if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(traitCollection, _primitiveTraitCollection) == NO) { - ASPrimitiveTraitCollection previousTraitCollection = _primitiveTraitCollection; - _primitiveTraitCollection = traitCollection; - - l.unlock(); - [self asyncTraitCollectionDidChangeWithPreviousTraitCollection:previousTraitCollection]; - } -} - -- (ASTraitCollection *)asyncTraitCollection -{ - return [ASTraitCollection traitCollectionWithASPrimitiveTraitCollection:self.primitiveTraitCollection]; -} - -#pragma mark - ASLayoutElementAsciiArtProtocol - -- (NSString *)asciiArtString -{ - return [ASLayoutSpec asciiArtStringForChildren:@[] parentName:[self asciiArtName]]; -} - -- (NSString *)asciiArtName -{ - NSMutableString *result = [NSMutableString stringWithCString:object_getClassName(self) encoding:NSASCIIStringEncoding]; - if (_debugName) { - [result appendFormat:@" (%@)", _debugName]; - } - return result; -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (ASLayout) - -@implementation ASDisplayNode (ASLayout) - -- (ASLayoutEngineType)layoutEngineType -{ -#if YOGA - MutexLocker l(__instanceLock__); - YGNodeRef yogaNode = _style.yogaNode; - BOOL hasYogaParent = (_yogaParent != nil); - BOOL hasYogaChildren = (_yogaChildren.count > 0); - if (yogaNode != NULL && (hasYogaParent || hasYogaChildren)) { - return ASLayoutEngineTypeYoga; - } -#endif - - return ASLayoutEngineTypeLayoutSpec; -} - -- (ASLayout *)calculatedLayout -{ - MutexLocker l(__instanceLock__); - return _calculatedDisplayNodeLayout.layout; -} - -- (CGSize)calculatedSize -{ - MutexLocker l(__instanceLock__); - if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { - return _pendingDisplayNodeLayout.layout.size; - } - return _calculatedDisplayNodeLayout.layout.size; -} - -- (ASSizeRange)constrainedSizeForCalculatedLayout -{ - MutexLocker l(__instanceLock__); - return [self _locked_constrainedSizeForCalculatedLayout]; -} - -- (ASSizeRange)_locked_constrainedSizeForCalculatedLayout -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { - return _pendingDisplayNodeLayout.constrainedSize; - } - return _calculatedDisplayNodeLayout.constrainedSize; -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (ASLayoutElementStylability) - -@implementation ASDisplayNode (ASLayoutElementStylability) - -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock -{ - styleBlock(self.style); - return self; -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (ASLayoutInternal) - -@implementation ASDisplayNode (ASLayoutInternal) - -/** - * @abstract Informs the root node that the intrinsic size of the receiver is no longer valid. - * - * @discussion The size of a root node is determined by each subnode. Calling invalidateSize will let the root node know - * that the intrinsic size of the receiver node is no longer valid and a resizing of the root node needs to happen. - */ -- (void)_u_setNeedsLayoutFromAbove -{ - ASDisplayNodeAssertThreadAffinity(self); - DISABLED_ASAssertUnlocked(__instanceLock__); - - as_activity_create_for_scope("Set needs layout from above"); - - // Mark the node for layout in the next layout pass - [self setNeedsLayout]; - - __instanceLock__.lock(); - // Escalate to the root; entire tree must allow adjustments so the layout fits the new child. - // Much of the layout will be re-used as cached (e.g. other items in an unconstrained stack) - ASDisplayNode *supernode = _supernode; - __instanceLock__.unlock(); - - if (supernode) { - // Threading model requires that we unlock before calling a method on our parent. - [supernode _u_setNeedsLayoutFromAbove]; - } else { - // Let the root node method know that the size was invalidated - [self _rootNodeDidInvalidateSize]; - } -} - -// TODO It would be easier to work with if we could `ASAssertUnlocked` here, but we -// cannot due to locking to root in `_u_measureNodeWithBoundsIfNecessary`. -- (void)_rootNodeDidInvalidateSize -{ - ASDisplayNodeAssertThreadAffinity(self); - __instanceLock__.lock(); - - // We are the root node and need to re-flow the layout; at least one child needs a new size. - CGSize boundsSizeForLayout = ASCeilSizeValues(self.bounds.size); - - // Figure out constrainedSize to use - ASSizeRange constrainedSize = ASSizeRangeMake(boundsSizeForLayout); - if (_pendingDisplayNodeLayout.layout != nil) { - constrainedSize = _pendingDisplayNodeLayout.constrainedSize; - } else if (_calculatedDisplayNodeLayout.layout != nil) { - constrainedSize = _calculatedDisplayNodeLayout.constrainedSize; - } - - __instanceLock__.unlock(); - - // Perform a measurement pass to get the full tree layout, adapting to the child's new size. - ASLayout *layout = [self layoutThatFits:constrainedSize]; - - // Check if the returned layout has a different size than our current bounds. - if (CGSizeEqualToSize(boundsSizeForLayout, layout.size) == NO) { - // If so, inform our container we need an update (e.g Table, Collection, ViewController, etc). - [self displayNodeDidInvalidateSizeNewSize:layout.size]; - } -} - -// TODO -// We should remove this logic, which is relatively new, and instead -// rely on the parent / host of the root node to do this size change. That's always been the -// expectation with other node containers like ASTableView, ASCollectionView, ASDKViewController, etc. -// E.g. in ASCellNode the _interactionDelegate is a Table or Collection that will resize in this -// case. By resizing without participating with the parent, we could get cases where our parent size -// does not match, especially if there is a size constraint that is applied at that level. -// -// In general a node should never need to set its own size, instead allowing its parent to do so - -// even in the root case. Anyhow this is a separate / pre-existing issue, but I think it could be -// causing real issues in cases of resizing nodes. -- (void)displayNodeDidInvalidateSizeNewSize:(CGSize)size -{ - ASDisplayNodeAssertThreadAffinity(self); - - // The default implementation of display node changes the size of itself to the new size - CGRect oldBounds = self.bounds; - CGSize oldSize = oldBounds.size; - CGSize newSize = size; - - if (! CGSizeEqualToSize(oldSize, newSize)) { - self.bounds = (CGRect){ oldBounds.origin, newSize }; - - // Frame's origin must be preserved. Since it is computed from bounds size, anchorPoint - // and position (see frame setter in ASDisplayNode+UIViewBridge), position needs to be adjusted. - CGPoint anchorPoint = self.anchorPoint; - CGPoint oldPosition = self.position; - CGFloat xDelta = (newSize.width - oldSize.width) * anchorPoint.x; - CGFloat yDelta = (newSize.height - oldSize.height) * anchorPoint.y; - self.position = CGPointMake(oldPosition.x + xDelta, oldPosition.y + yDelta); - } -} - -- (void)_u_measureNodeWithBoundsIfNecessary:(CGRect)bounds -{ - DISABLED_ASAssertUnlocked(__instanceLock__); - ASScopedLockSelfOrToRoot(); - - // Check if we are a subnode in a layout transition. - // In this case no measurement is needed as it's part of the layout transition - if ([self _locked_isLayoutTransitionInvalid]) { - return; - } - - CGSize boundsSizeForLayout = ASCeilSizeValues(bounds.size); - - // Prefer a newer and not yet applied _pendingDisplayNodeLayout over _calculatedDisplayNodeLayout - // If there is no such _pending, check if _calculated is valid to reuse (avoiding recalculation below). - BOOL pendingLayoutIsPreferred = NO; - if (_pendingDisplayNodeLayout.isValid(_layoutVersion)) { - NSUInteger calculatedVersion = _calculatedDisplayNodeLayout.version; - NSUInteger pendingVersion = _pendingDisplayNodeLayout.version; - if (pendingVersion > calculatedVersion) { - pendingLayoutIsPreferred = YES; // Newer _pending - } else if (pendingVersion == calculatedVersion - && !ASSizeRangeEqualToSizeRange(_pendingDisplayNodeLayout.constrainedSize, - _calculatedDisplayNodeLayout.constrainedSize)) { - pendingLayoutIsPreferred = YES; // _pending with a different constrained size - } - } - BOOL calculatedLayoutIsReusable = (_calculatedDisplayNodeLayout.isValid(_layoutVersion) - && (_calculatedDisplayNodeLayout.requestedLayoutFromAbove - || CGSizeEqualToSize(_calculatedDisplayNodeLayout.layout.size, boundsSizeForLayout))); - if (!pendingLayoutIsPreferred && calculatedLayoutIsReusable) { - return; - } - - as_activity_create_for_scope("Update node layout for current bounds"); - as_log_verbose(ASLayoutLog(), "Node %@, bounds size %@, calculatedSize %@, calculatedIsDirty %d", - self, - NSStringFromCGSize(boundsSizeForLayout), - NSStringFromCGSize(_calculatedDisplayNodeLayout.layout.size), - _calculatedDisplayNodeLayout.version < _layoutVersion); - // _calculatedDisplayNodeLayout is not reusable we need to transition to a new one - [self cancelLayoutTransition]; - - BOOL didCreateNewContext = NO; - ASLayoutElementContext *context = ASLayoutElementGetCurrentContext(); - if (context == nil) { - context = [[ASLayoutElementContext alloc] init]; - ASLayoutElementPushContext(context); - didCreateNewContext = YES; - } - - // Figure out previous and pending layouts for layout transition - ASDisplayNodeLayout nextLayout = _pendingDisplayNodeLayout; - BOOL isLayoutSizeDifferentFromBounds = !CGSizeEqualToSize(nextLayout.layout.size, boundsSizeForLayout); - - // nextLayout was likely created by a call to layoutThatFits:, check if it is valid and can be applied. - // If our bounds size is different than it, or invalid, recalculate. Use #define to avoid nullptr-> - BOOL pendingLayoutApplicable = NO; - if (nextLayout.layout == nil) { - as_log_verbose(ASLayoutLog(), "No pending layout."); - } else if (!nextLayout.isValid(_layoutVersion)) { - as_log_verbose(ASLayoutLog(), "Pending layout is stale."); - } else if (isLayoutSizeDifferentFromBounds) { - as_log_verbose(ASLayoutLog(), "Pending layout size %@ doesn't match bounds size.", NSStringFromCGSize(nextLayout.layout.size)); - } else { - as_log_verbose(ASLayoutLog(), "Using pending layout %@.", nextLayout.layout); - pendingLayoutApplicable = YES; - } - - if (!pendingLayoutApplicable) { - as_log_verbose(ASLayoutLog(), "Measuring with previous constrained size."); - // Use the last known constrainedSize passed from a parent during layout (if never, use bounds). - NSUInteger version = _layoutVersion; - ASSizeRange constrainedSize = [self _locked_constrainedSizeForLayoutPass]; -#if YOGA - // This flag indicates to the Texture+Yoga code that this next layout is intended to be - // displayed (vs. just for measurement). This will cause it to call setNeedsLayout on any nodes - // whose layout changes as a result of the Yoga recalculation. This is necessary because a - // change in one Yoga node can change the layout for any other node in the tree. - self.willApplyNextYogaCalculatedLayout = YES; -#endif - ASLayout *layout = [self calculateLayoutThatFits:constrainedSize - restrictedToSize:self.style.size - relativeToParentSize:boundsSizeForLayout]; -#if YOGA - self.willApplyNextYogaCalculatedLayout = NO; -#endif - nextLayout = ASDisplayNodeLayout(layout, constrainedSize, boundsSizeForLayout, version); - // Now that the constrained size of pending layout might have been reused, the layout is useless - // Release it and any orphaned subnodes it retains - _pendingDisplayNodeLayout.layout = nil; - } - - if (didCreateNewContext) { - ASLayoutElementPopContext(); - } - - // If our new layout's desired size for self doesn't match current size, ask our parent to update it. - // This can occur for either pre-calculated or newly-calculated layouts. - if (nextLayout.requestedLayoutFromAbove == NO - && CGSizeEqualToSize(boundsSizeForLayout, nextLayout.layout.size) == NO) { - as_log_verbose(ASLayoutLog(), "Layout size doesn't match bounds size. Requesting layout from above."); - // The layout that we have specifies that this node (self) would like to be a different size - // than it currently is. Because that size has been computed within the constrainedSize, we - // expect that calling setNeedsLayoutFromAbove will result in our parent resizing us to this. - // However, in some cases apps may manually interfere with this (setting a different bounds). - // In this case, we need to detect that we've already asked to be resized to match this - // particular ASLayout object, and shouldn't loop asking again unless we have a different ASLayout. - nextLayout.requestedLayoutFromAbove = YES; - - { - __instanceLock__.unlock(); - [self _u_setNeedsLayoutFromAbove]; - __instanceLock__.lock(); - } - - // If we request that our root layout we may generate a new _pendingDisplayNodeLayout.layout which has - // requestedLayoutFromAbove set to NO. If the pending layout has a different constrained size than nextLayout's - // and the layout sizes don't change we could end up back here asking the root to layout again causing an - // infinite layout loop. Instead, we nil out the _pendingDisplayNodeLayout.layout here because it can be - // considered an undesired artifact of the layout request. nextLayout will become _calculatedDisplayNodeLayout - // when the pending layout transition which will be created later in this method is applied. - // We will use _calculatedLayout the next time around, so requestedLayoutFromAbove will be set to YES and we - // will break out of this layout loop. - _pendingDisplayNodeLayout.layout = nil; - - // Update the layout's version here because _u_setNeedsLayoutFromAbove calls __setNeedsLayout which in turn increases _layoutVersion - // Failing to do this will cause the layout to be invalid immediately - nextLayout.version = _layoutVersion; - } - - // Prepare to transition to nextLayout - ASDisplayNodeAssertNotNil(nextLayout.layout, @"nextLayout.layout should not be nil! %@", self); - _pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self - pendingLayout:nextLayout - previousLayout:_calculatedDisplayNodeLayout]; - - // If a parent is currently executing a layout transition, perform our layout application after it. - if (ASHierarchyStateIncludesLayoutPending(_hierarchyState) == NO) { - // If no transition, apply our new layout immediately (common case). - [self _completePendingLayoutTransition]; - } -} - -- (ASSizeRange)_constrainedSizeForLayoutPass -{ - MutexLocker l(__instanceLock__); - return [self _locked_constrainedSizeForLayoutPass]; -} - -- (ASSizeRange)_locked_constrainedSizeForLayoutPass -{ - // TODO: The logic in -_u_setNeedsLayoutFromAbove seems correct and doesn't use this method. - // logic seems correct. For what case does -this method need to do the CGSizeEqual checks? - // IF WE CAN REMOVE BOUNDS CHECKS HERE, THEN WE CAN ALSO REMOVE "REQUESTED FROM ABOVE" CHECK - - DISABLED_ASAssertLocked(__instanceLock__); - - CGSize boundsSizeForLayout = ASCeilSizeValues(self.threadSafeBounds.size); - - // Checkout if constrained size of pending or calculated display node layout can be used - if (_pendingDisplayNodeLayout.requestedLayoutFromAbove - || CGSizeEqualToSize(_pendingDisplayNodeLayout.layout.size, boundsSizeForLayout)) { - // We assume the size from the last returned layoutThatFits: layout was applied so use the pending display node - // layout constrained size - return _pendingDisplayNodeLayout.constrainedSize; - } else if (_calculatedDisplayNodeLayout.layout != nil - && (_calculatedDisplayNodeLayout.requestedLayoutFromAbove - || CGSizeEqualToSize(_calculatedDisplayNodeLayout.layout.size, boundsSizeForLayout))) { - // We assume the _calculatedDisplayNodeLayout is still valid and the frame is not different - return _calculatedDisplayNodeLayout.constrainedSize; - } else { - // In this case neither the _pendingDisplayNodeLayout or the _calculatedDisplayNodeLayout constrained size can - // be reused, so the current bounds is used. This is usual the case if a frame was set manually that differs to - // the one returned from layoutThatFits: or layoutThatFits: was never called - return ASSizeRangeMake(boundsSizeForLayout); - } -} - -- (void)_layoutSublayouts -{ - ASDisplayNodeAssertThreadAffinity(self); - DISABLED_ASAssertUnlocked(__instanceLock__); - - ASLayout *layout; - { - MutexLocker l(__instanceLock__); - if (_calculatedDisplayNodeLayout.version < _layoutVersion) { - return; - } - layout = _calculatedDisplayNodeLayout.layout; - } - - for (ASDisplayNode *node in self.subnodes) { - CGRect frame = [layout frameForElement:node]; - if (CGRectIsNull(frame)) { - // There is no frame for this node in our layout. - // This currently can happen if we get a CA layout pass - // while waiting for the client to run animateLayoutTransition: - } else { - node.frame = frame; - } - } -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (ASAutomatic Subnode Management) - -@implementation ASDisplayNode (ASAutomaticSubnodeManagement) - -#pragma mark Automatically Manages Subnodes - -- (BOOL)automaticallyManagesSubnodes -{ - MutexLocker l(__instanceLock__); - return _flags.automaticallyManagesSubnodes; -} - -- (void)setAutomaticallyManagesSubnodes:(BOOL)automaticallyManagesSubnodes -{ - MutexLocker l(__instanceLock__); - _flags.automaticallyManagesSubnodes = automaticallyManagesSubnodes; -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (ASLayoutTransition) - -@implementation ASDisplayNode (ASLayoutTransition) - -- (BOOL)_isLayoutTransitionInvalid -{ - MutexLocker l(__instanceLock__); - return [self _locked_isLayoutTransitionInvalid]; -} - -- (BOOL)_locked_isLayoutTransitionInvalid -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) { - ASLayoutElementContext *context = ASLayoutElementGetCurrentContext(); - if (context == nil || _pendingTransitionID != context.transitionID) { - return YES; - } - } - return NO; -} - -/// Starts a new transition and returns the transition id -- (int32_t)_startNewTransition -{ - static std::atomic gNextTransitionID; - int32_t newTransitionID = gNextTransitionID.fetch_add(1) + 1; - _transitionID = newTransitionID; - return newTransitionID; -} - -/// Returns NO if there was no transition to cancel/finish. -- (BOOL)_finishOrCancelTransition -{ - int32_t oldValue = _transitionID.exchange(ASLayoutElementContextInvalidTransitionID); - return oldValue != ASLayoutElementContextInvalidTransitionID; -} - -#pragma mark Layout Transition - -- (void)transitionLayoutWithAnimation:(BOOL)animated - shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(void(^)())completion -{ - ASDisplayNodeAssertMainThread(); - [self transitionLayoutWithSizeRange:[self _constrainedSizeForLayoutPass] - animated:animated - shouldMeasureAsync:shouldMeasureAsync - measurementCompletion:completion]; -} - -- (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize - animated:(BOOL)animated - shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(void(^)())completion -{ - ASDisplayNodeAssertMainThread(); - as_activity_create_for_scope("Transition node layout"); - os_log_debug(ASLayoutLog(), "Transition layout for %@ sizeRange %@ anim %d asyncMeasure %d", self, NSStringFromASSizeRange(constrainedSize), animated, shouldMeasureAsync); - - if (constrainedSize.max.width <= 0.0 || constrainedSize.max.height <= 0.0) { - // Using CGSizeZero for the sizeRange can cause negative values in client layout code. - // Most likely called transitionLayout: without providing a size, before first layout pass. - as_log_verbose(ASLayoutLog(), "Ignoring transition due to bad size range."); - return; - } - - { - MutexLocker l(__instanceLock__); - - // Check if we are a subnode in a layout transition. - // In this case no measurement is needed as we're part of the layout transition. - if ([self _locked_isLayoutTransitionInvalid]) { - return; - } - - if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) { - ASDisplayNodeAssert(NO, @"Can't start a transition when one of the supernodes is performing one."); - return; - } - } - - // Invalidate calculated layout because this method acts as an animated "setNeedsLayout" for nodes. - // If the user has reconfigured the node and calls this, we should never return a stale layout - // for subsequent calls to layoutThatFits: regardless of size range. We choose this method rather than - // -setNeedsLayout because that method also triggers a CA layout invalidation, which isn't necessary at this time. - // See https://github.com/TextureGroup/Texture/issues/463 - [self invalidateCalculatedLayout]; - - // Every new layout transition has a transition id associated to check in subsequent transitions for cancelling - int32_t transitionID = [self _startNewTransition]; - as_log_verbose(ASLayoutLog(), "Transition ID is %d", transitionID); - // NOTE: This block captures self. It's cheaper than hitting the weak table. - asdisplaynode_iscancelled_block_t isCancelled = ^{ - BOOL result = (self->_transitionID != transitionID); - if (result) { - as_log_verbose(ASLayoutLog(), "Transition %d canceled, superseded by %d", transitionID, _transitionID.load()); - } - return result; - }; - - // Move all subnodes in layout pending state for this transition - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - ASDisplayNodeAssert(node->_transitionID == ASLayoutElementContextInvalidTransitionID, @"Can't start a transition when one of the subnodes is performing one."); - node.hierarchyState |= ASHierarchyStateLayoutPending; - node->_pendingTransitionID = transitionID; - }); - - // Transition block that executes the layout transition - void (^transitionBlock)(void) = ^{ - if (isCancelled()) { - return; - } - - // Perform a full layout creation pass with passed in constrained size to create the new layout for the transition - NSUInteger newLayoutVersion = self->_layoutVersion; - ASLayout *newLayout; - { - ASScopedLockSelfOrToRoot(); - - ASLayoutElementContext *ctx = [[ASLayoutElementContext alloc] init]; - ctx.transitionID = transitionID; - ASLayoutElementPushContext(ctx); - - BOOL automaticallyManagesSubnodesDisabled = (self.automaticallyManagesSubnodes == NO); - self.automaticallyManagesSubnodes = YES; // Temporary flag for 1.9.x - newLayout = [self calculateLayoutThatFits:constrainedSize - restrictedToSize:self.style.size - relativeToParentSize:constrainedSize.max]; - if (automaticallyManagesSubnodesDisabled) { - self.automaticallyManagesSubnodes = NO; // Temporary flag for 1.9.x - } - - ASLayoutElementPopContext(); - } - - if (isCancelled()) { - return; - } - - ASPerformBlockOnMainThread(^{ - if (isCancelled()) { - return; - } - as_activity_create_for_scope("Commit layout transition"); - ASLayoutTransition *pendingLayoutTransition; - _ASTransitionContext *pendingLayoutTransitionContext; - { - // Grab __instanceLock__ here to make sure this transition isn't invalidated - // right after it passed the validation test and before it proceeds - MutexLocker l(self->__instanceLock__); - - // Update calculated layout - const auto previousLayout = self->_calculatedDisplayNodeLayout; - const auto pendingLayout = ASDisplayNodeLayout(newLayout, - constrainedSize, - constrainedSize.max, - newLayoutVersion); - [self _locked_setCalculatedDisplayNodeLayout:pendingLayout]; - - // Setup pending layout transition for animation - self->_pendingLayoutTransition = pendingLayoutTransition = [[ASLayoutTransition alloc] initWithNode:self - pendingLayout:pendingLayout - previousLayout:previousLayout]; - // Setup context for pending layout transition. we need to hold a strong reference to the context - self->_pendingLayoutTransitionContext = pendingLayoutTransitionContext = [[_ASTransitionContext alloc] initWithAnimation:animated - layoutDelegate:self->_pendingLayoutTransition - completionDelegate:self]; - } - - // Apply complete layout transitions for all subnodes - { - as_activity_create_for_scope("Complete pending layout transitions for subtree"); - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - [node _completePendingLayoutTransition]; - node.hierarchyState &= (~ASHierarchyStateLayoutPending); - }); - } - - // Measurement pass completion - // Give the subclass a change to hook into before calling the completion block - [self _layoutTransitionMeasurementDidFinish]; - if (completion) { - completion(); - } - - // Apply the subnode insertion immediately to be able to animate the nodes - [pendingLayoutTransition applySubnodeInsertionsAndMoves]; - - // Kick off animating the layout transition - { - as_activity_create_for_scope("Animate layout transition"); - [self animateLayoutTransition:pendingLayoutTransitionContext]; - } - - // Mark transaction as finished - [self _finishOrCancelTransition]; - }); - }; - - // Start transition based on flag on current or background thread - if (shouldMeasureAsync) { - ASPerformBlockOnBackgroundThread(transitionBlock); - } else { - transitionBlock(); - } -} - -- (void)cancelLayoutTransition -{ - if ([self _finishOrCancelTransition]) { - // Tell subnodes to exit layout pending state and clear related properties - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - node.hierarchyState &= (~ASHierarchyStateLayoutPending); - }); - } -} - -- (void)setDefaultLayoutTransitionDuration:(NSTimeInterval)defaultLayoutTransitionDuration -{ - MutexLocker l(__instanceLock__); - _defaultLayoutTransitionDuration = defaultLayoutTransitionDuration; -} - -- (NSTimeInterval)defaultLayoutTransitionDuration -{ - MutexLocker l(__instanceLock__); - return _defaultLayoutTransitionDuration; -} - -- (void)setDefaultLayoutTransitionDelay:(NSTimeInterval)defaultLayoutTransitionDelay -{ - MutexLocker l(__instanceLock__); - _defaultLayoutTransitionDelay = defaultLayoutTransitionDelay; -} - -- (NSTimeInterval)defaultLayoutTransitionDelay -{ - MutexLocker l(__instanceLock__); - return _defaultLayoutTransitionDelay; -} - -- (void)setDefaultLayoutTransitionOptions:(UIViewAnimationOptions)defaultLayoutTransitionOptions -{ - MutexLocker l(__instanceLock__); - _defaultLayoutTransitionOptions = defaultLayoutTransitionOptions; -} - -- (UIViewAnimationOptions)defaultLayoutTransitionOptions -{ - MutexLocker l(__instanceLock__); - return _defaultLayoutTransitionOptions; -} - -#pragma mark - -/* - * Hook for subclasses to perform an animation based on the given ASContextTransitioning. By default a fade in and out - * animation is provided. - */ -- (void)animateLayoutTransition:(id)context -{ - if ([context isAnimated] == NO) { - [self _layoutSublayouts]; - [context completeTransition:YES]; - return; - } - - ASDisplayNode *node = self; - - NSAssert(node.isNodeLoaded == YES, @"Invalid node state"); - - NSArray *removedSubnodes = [context removedSubnodes]; - NSMutableArray *insertedSubnodes = [[context insertedSubnodes] mutableCopy]; - const auto movedSubnodes = [[NSMutableArray alloc] init]; - - const auto insertedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; - const auto removedSubnodeContexts = [[NSMutableArray<_ASAnimatedTransitionContext *> alloc] init]; - - for (ASDisplayNode *subnode in [context subnodesForKey:ASTransitionContextToLayoutKey]) { - if ([insertedSubnodes containsObject:subnode] == NO) { - // This is an existing subnode, check if it is resized, moved or both - CGRect fromFrame = [context initialFrameForNode:subnode]; - CGRect toFrame = [context finalFrameForNode:subnode]; - if (CGSizeEqualToSize(fromFrame.size, toFrame.size) == NO) { - [insertedSubnodes addObject:subnode]; - } - if (CGPointEqualToPoint(fromFrame.origin, toFrame.origin) == NO) { - [movedSubnodes addObject:subnode]; - } - } - } - - // Create contexts for inserted and removed subnodes - for (ASDisplayNode *insertedSubnode in insertedSubnodes) { - [insertedSubnodeContexts addObject:[_ASAnimatedTransitionContext contextForNode:insertedSubnode alpha:insertedSubnode.alpha]]; - } - for (ASDisplayNode *removedSubnode in removedSubnodes) { - [removedSubnodeContexts addObject:[_ASAnimatedTransitionContext contextForNode:removedSubnode alpha:removedSubnode.alpha]]; - } - - // Fade out inserted subnodes - for (ASDisplayNode *insertedSubnode in insertedSubnodes) { - insertedSubnode.frame = [context finalFrameForNode:insertedSubnode]; - insertedSubnode.alpha = 0; - } - - // Adjust groupOpacity for animation - BOOL originAllowsGroupOpacity = node.allowsGroupOpacity; - node.allowsGroupOpacity = YES; - - [UIView animateWithDuration:self.defaultLayoutTransitionDuration delay:self.defaultLayoutTransitionDelay options:self.defaultLayoutTransitionOptions animations:^{ - // Fade removed subnodes and views out - for (ASDisplayNode *removedSubnode in removedSubnodes) { - removedSubnode.alpha = 0; - } - - // Fade inserted subnodes in - for (_ASAnimatedTransitionContext *insertedSubnodeContext in insertedSubnodeContexts) { - insertedSubnodeContext.node.alpha = insertedSubnodeContext.alpha; - } - - // Update frame of self and moved subnodes - CGSize fromSize = [context layoutForKey:ASTransitionContextFromLayoutKey].size; - CGSize toSize = [context layoutForKey:ASTransitionContextToLayoutKey].size; - BOOL isResized = (CGSizeEqualToSize(fromSize, toSize) == NO); - if (isResized == YES) { - CGPoint position = node.frame.origin; - node.frame = CGRectMake(position.x, position.y, toSize.width, toSize.height); - } - for (ASDisplayNode *movedSubnode in movedSubnodes) { - movedSubnode.frame = [context finalFrameForNode:movedSubnode]; - } - } completion:^(BOOL finished) { - // Restore all removed subnode alpha values - for (_ASAnimatedTransitionContext *removedSubnodeContext in removedSubnodeContexts) { - removedSubnodeContext.node.alpha = removedSubnodeContext.alpha; - } - - // Restore group opacity - node.allowsGroupOpacity = originAllowsGroupOpacity; - - // Subnode removals are automatically performed - [context completeTransition:finished]; - }]; -} - -/** - * Hook for subclasses to clean up nodes after the transition happened. Furthermore this can be used from subclasses - * to manually perform deletions. - */ -- (void)didCompleteLayoutTransition:(id)context -{ - ASDisplayNodeAssertMainThread(); - - __instanceLock__.lock(); - ASLayoutTransition *pendingLayoutTransition = _pendingLayoutTransition; - __instanceLock__.unlock(); - - [pendingLayoutTransition applySubnodeRemovals]; -} - -/** - * Completes the pending layout transition immediately without going through the the Layout Transition Animation API - */ -- (void)_completePendingLayoutTransition -{ - __instanceLock__.lock(); - ASLayoutTransition *pendingLayoutTransition = _pendingLayoutTransition; - __instanceLock__.unlock(); - - if (pendingLayoutTransition != nil) { - [self _setCalculatedDisplayNodeLayout:pendingLayoutTransition.pendingLayout]; - [self _completeLayoutTransition:pendingLayoutTransition]; - [self _pendingLayoutTransitionDidComplete]; - } -} - -/** - * Can be directly called to commit the given layout transition immediately to complete without calling through to the - * Layout Transition Animation API - */ -- (void)_completeLayoutTransition:(ASLayoutTransition *)layoutTransition -{ - // Layout transition is not supported for nodes that do not have automatic subnode management enabled - if (layoutTransition == nil || self.automaticallyManagesSubnodes == NO) { - return; - } - - // Trampoline to the main thread if necessary - if (ASDisplayNodeThreadIsMain() || layoutTransition.isSynchronous == NO) { - // Committing the layout transition will result in subnode insertions and removals, both of which must be called without the lock held - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - [layoutTransition commitTransition]; - } else { - // Subnode insertions and removals need to happen always on the main thread if at least one subnode is already loaded - ASPerformBlockOnMainThread(^{ - [layoutTransition commitTransition]; - }); - } -} - -- (void)_assertSubnodeState -{ - // Verify that any orphaned nodes are removed. - // This can occur in rare cases if main thread layout is flushed while a background layout is calculating. - - if (self.automaticallyManagesSubnodes == NO) { - return; - } - - MutexLocker l(__instanceLock__); - NSArray *sublayouts = _calculatedDisplayNodeLayout.layout.sublayouts; - unowned ASLayout *cSublayouts[sublayouts.count]; - [sublayouts getObjects:cSublayouts range:NSMakeRange(0, AS_ARRAY_SIZE(cSublayouts))]; - - // Fast-path if we are in the correct state (likely). - if (_subnodes.count == AS_ARRAY_SIZE(cSublayouts)) { - NSUInteger i = 0; - BOOL matches = YES; - for (ASDisplayNode *subnode in _subnodes) { - if (subnode != cSublayouts[i].layoutElement) { - matches = NO; - } - i++; - } - if (matches) { - return; - } - } - - NSArray *layoutNodes = ASArrayByFlatMapping(sublayouts, ASLayout *layout, (ASDisplayNode *)layout.layoutElement); - NSIndexSet *insertions, *deletions; - [_subnodes asdk_diffWithArray:layoutNodes insertions:&insertions deletions:&deletions]; - if (insertions.count > 0) { - NSLog(@"Warning: node's layout includes subnode that has not been added: node = %@, subnodes = %@, subnodes in layout = %@", self, _subnodes, layoutNodes); - } - - // Remove any nodes that are in the tree but should not be. - // Go in reverse order so we don't shift our indexes. - if (deletions) { - for (NSUInteger i = deletions.lastIndex; i != NSNotFound; i = [deletions indexLessThanIndex:i]) { - NSLog(@"Automatically removing orphaned subnode %@, from parent %@", _subnodes[i], self); - [_subnodes[i] removeFromSupernode]; - } - } -} - -- (void)_pendingLayoutTransitionDidComplete -{ - // This assertion introduces a breaking behavior for nodes that has ASM enabled but also manually manage some subnodes. - // Let's gate it behind YOGA flag. -#if YOGA - [self _assertSubnodeState]; -#endif - - // Subclass hook - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - [self calculatedLayoutDidChange]; - - // Grab lock after calling out to subclass - MutexLocker l(__instanceLock__); - - // We generate placeholders at -layoutThatFits: time so that a node is guaranteed to have a placeholder ready to go. - // This is also because measurement is usually asynchronous, but placeholders need to be set up synchronously. - // First measurement is guaranteed to be before the node is onscreen, so we can create the image async. but still have it appear sync. - if (_flags.placeholderEnabled && !_placeholderImage && [self _locked_displaysAsynchronously]) { - - // Zero-sized nodes do not require a placeholder. - CGSize layoutSize = _calculatedDisplayNodeLayout.layout.size; - if (layoutSize.width * layoutSize.height <= 0.0) { - return; - } - - // If we've displayed our contents, we don't need a placeholder. - // Contents is a thread-affined property and can't be read off main after loading. - if (self.isNodeLoaded) { - ASPerformBlockOnMainThread(^{ - if (self.contents == nil) { - self->_placeholderImage = [self placeholderImage]; - } - }); - } else { - if (self.contents == nil) { - _placeholderImage = [self placeholderImage]; - } - } - } - - // Cleanup pending layout transition - _pendingLayoutTransition = nil; -} - -- (void)_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)displayNodeLayout -{ - MutexLocker l(__instanceLock__); - [self _locked_setCalculatedDisplayNodeLayout:displayNodeLayout]; -} - -- (void)_locked_setCalculatedDisplayNodeLayout:(const ASDisplayNodeLayout &)displayNodeLayout -{ - DISABLED_ASAssertLocked(__instanceLock__); - ASDisplayNodeAssertTrue(displayNodeLayout.layout.layoutElement == self); - ASDisplayNodeAssertTrue(displayNodeLayout.layout.size.width >= 0.0); - ASDisplayNodeAssertTrue(displayNodeLayout.layout.size.height >= 0.0); - - _calculatedDisplayNodeLayout = displayNodeLayout; -} - -@end - -#pragma mark - -#pragma mark - ASDisplayNode (YogaLayout) - -@implementation ASDisplayNode (YogaLayout) - -- (BOOL)locked_shouldLayoutFromYogaRoot { -#if YOGA - YGNodeRef yogaNode = _style.yogaNode; - BOOL hasYogaParent = (_yogaParent != nil); - BOOL hasYogaChildren = (_yogaChildren.count > 0); - BOOL usesYoga = (yogaNode != NULL && (hasYogaParent || hasYogaChildren)); - if (usesYoga) { - if ([self shouldHaveYogaMeasureFunc] == NO) { - return YES; - } else { - return NO; - } - } else { - return NO; - } -#else - return NO; -#endif -} - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.h b/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.h deleted file mode 100644 index d7cd8620..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.h +++ /dev/null @@ -1,66 +0,0 @@ -// -// ASDisplayNode+LayoutSpec.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASLayout; - -NS_ASSUME_NONNULL_BEGIN - -@interface ASDisplayNode (ASLayoutSpec) - -/** - * @abstract Provides a way to declare a block to provide an ASLayoutSpec without having to subclass ASDisplayNode and - * implement layoutSpecThatFits: - * - * @return A block that takes a constrainedSize ASSizeRange argument, and must return an ASLayoutSpec that includes all - * of the subnodes to position in the layout. This input-output relationship is identical to the subclass override - * method -layoutSpecThatFits: - * - * @warning Subclasses that implement -layoutSpecThatFits: must not also use .layoutSpecBlock. Doing so will trigger - * an exception. A future version of the framework may support using both, calling them serially, with the - * .layoutSpecBlock superseding any values set by the method override. - * - * @code ^ASLayoutSpec *(__kindof ASDisplayNode * _Nonnull node, ASSizeRange constrainedSize) {}; - */ -@property (nullable) ASLayoutSpecBlock layoutSpecBlock; - -@end - -// These methods are intended to be used internally to Texture, and should not be called directly. -@interface ASDisplayNode (ASLayoutSpecPrivate) - -/// For internal usage only -- (ASLayout *)calculateLayoutLayoutSpec:(ASSizeRange)constrainedSize; - -@end - -@interface ASDisplayNode (ASLayoutSpecSubclasses) - -/** - * @abstract Return a layout spec that describes the layout of the receiver and its children. - * - * @param constrainedSize The minimum and maximum sizes the receiver should fit in. - * - * @discussion Subclasses that override should expect this method to be called on a non-main thread. The returned layout spec - * is used to calculate an ASLayout and cached by ASDisplayNode for quick access during -layout. Other expensive work that needs to - * be done before display can be performed here, and using ivars to cache any valuable intermediate results is - * encouraged. - * - * @note This method should not be called directly outside of ASDisplayNode; use -layoutThatFits: instead. - * - * @warning Subclasses that implement -layoutSpecThatFits: must not use .layoutSpecBlock. Doing so will trigger an - * exception. A future version of the framework may support using both, calling them serially, with the .layoutSpecBlock - * superseding any values set by the method override. - */ -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.mm b/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.mm deleted file mode 100644 index 04ca0f6a..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+LayoutSpec.mm +++ /dev/null @@ -1,162 +0,0 @@ -// -// ASDisplayNode+LayoutSpec.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import - - -@implementation ASDisplayNode (ASLayoutSpec) - -- (void)setLayoutSpecBlock:(ASLayoutSpecBlock)layoutSpecBlock -{ - // For now there should never be an override of layoutSpecThatFits: and a layoutSpecBlock together. - ASDisplayNodeAssert(!(_methodOverrides & ASDisplayNodeMethodOverrideLayoutSpecThatFits), - @"Nodes with a .layoutSpecBlock must not also implement -layoutSpecThatFits:"); - AS::MutexLocker l(__instanceLock__); - _layoutSpecBlock = layoutSpecBlock; -} - -- (ASLayoutSpecBlock)layoutSpecBlock -{ - AS::MutexLocker l(__instanceLock__); - return _layoutSpecBlock; -} - -- (ASLayout *)calculateLayoutLayoutSpec:(ASSizeRange)constrainedSize -{ - AS::UniqueLock l(__instanceLock__); - - // Manual size calculation via calculateSizeThatFits: - if (_layoutSpecBlock == NULL && (_methodOverrides & ASDisplayNodeMethodOverrideLayoutSpecThatFits) == 0) { - CGSize size = [self calculateSizeThatFits:constrainedSize.max]; - return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:nil]; - } - - // Size calcualtion with layout elements - BOOL measureLayoutSpec = _measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutSpec; - if (measureLayoutSpec) { - _layoutSpecNumberOfPasses++; - } - - // Get layout element from the node - id layoutElement = [self _locked_layoutElementThatFits:constrainedSize]; -#if ASEnableVerboseLogging - for (NSString *asciiLine in [[layoutElement asciiArtString] componentsSeparatedByString:@"\n"]) { - as_log_verbose(ASLayoutLog(), "%@", asciiLine); - } -#endif - - - // Certain properties are necessary to set on an element of type ASLayoutSpec - if (layoutElement.layoutElementType == ASLayoutElementTypeLayoutSpec) { - ASLayoutSpec *layoutSpec = (ASLayoutSpec *)layoutElement; - -#if AS_DEDUPE_LAYOUT_SPEC_TREE - NSHashTable *duplicateElements = [layoutSpec findDuplicatedElementsInSubtree]; - if (duplicateElements.count > 0) { - ASDisplayNodeFailAssert(@"Node %@ returned a layout spec that contains the same elements in multiple positions. Elements: %@", self, duplicateElements); - // Use an empty layout spec to avoid crashes - layoutSpec = [[ASLayoutSpec alloc] init]; - } -#endif - - ASDisplayNodeAssert(layoutSpec.isMutable, @"Node %@ returned layout spec %@ that has already been used. Layout specs should always be regenerated.", self, layoutSpec); - - layoutSpec.isMutable = NO; - } - - // Manually propagate the trait collection here so that any layoutSpec children of layoutSpec will get a traitCollection - { - AS::SumScopeTimer t(_layoutSpecTotalTime, measureLayoutSpec); - ASTraitCollectionPropagateDown(layoutElement, self.primitiveTraitCollection); - } - - BOOL measureLayoutComputation = _measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutComputation; - if (measureLayoutComputation) { - _layoutComputationNumberOfPasses++; - } - - // Layout element layout creation - ASLayout *layout = ({ - AS::SumScopeTimer t(_layoutComputationTotalTime, measureLayoutComputation); - [layoutElement layoutThatFits:constrainedSize]; - }); - ASDisplayNodeAssertNotNil(layout, @"[ASLayoutElement layoutThatFits:] should never return nil! %@, %@", self, layout); - - // Make sure layoutElementObject of the root layout is `self`, so that the flattened layout will be structurally correct. - BOOL isFinalLayoutElement = (layout.layoutElement != self); - if (isFinalLayoutElement) { - layout.position = CGPointZero; - layout = [ASLayout layoutWithLayoutElement:self size:layout.size sublayouts:@[layout]]; - } - - // PR #1157: Reduces accuracy of _unflattenedLayout for debugging/Weaver - if ([ASDisplayNode shouldStoreUnflattenedLayouts]) { - _unflattenedLayout = layout; - } - layout = [layout filteredNodeLayoutTree]; - - // Flip layout if layout should be rendered right-to-left - BOOL shouldRenderRTLLayout = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:_semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; - if (shouldRenderRTLLayout) { - for (ASLayout *sublayout in layout.sublayouts) { - switch (_semanticContentAttribute) { - case UISemanticContentAttributeUnspecified: - case UISemanticContentAttributeForceRightToLeft: { - // Flip - CGPoint flippedPosition = CGPointMake(layout.size.width - CGRectGetWidth(sublayout.frame) - sublayout.position.x, sublayout.position.y); - sublayout.position = flippedPosition; - } - case UISemanticContentAttributePlayback: - case UISemanticContentAttributeForceLeftToRight: - case UISemanticContentAttributeSpatial: - // Don't flip - break; - } - } - } - - - return layout; -} - -- (id)_locked_layoutElementThatFits:(ASSizeRange)constrainedSize -{ - DISABLED_ASAssertLocked(__instanceLock__); - - BOOL measureLayoutSpec = _measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutSpec; - - if (_layoutSpecBlock != NULL) { - return ({ - AS::MutexLocker l(__instanceLock__); - AS::SumScopeTimer t(_layoutSpecTotalTime, measureLayoutSpec); - _layoutSpecBlock(self, constrainedSize); - }); - } else { - return ({ - AS::SumScopeTimer t(_layoutSpecTotalTime, measureLayoutSpec); - [self layoutSpecThatFits:constrainedSize]; - }); - } -} - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - __ASDisplayNodeCheckForLayoutMethodOverrides; - - ASDisplayNodeAssert(NO, @"-[ASDisplayNode layoutSpecThatFits:] should never return an empty value. One way this is caused is by calling -[super layoutSpecThatFits:] which is not currently supported."); - return [[ASLayoutSpec alloc] init]; -} - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Subclasses.h b/Example/Pods/Texture/Source/ASDisplayNode+Subclasses.h deleted file mode 100644 index 9adb9336..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Subclasses.h +++ /dev/null @@ -1,502 +0,0 @@ -// -// ASDisplayNode+Subclasses.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@class ASLayoutSpec, _ASDisplayLayer; - -NS_ASSUME_NONNULL_BEGIN - -/** - * The subclass header _ASDisplayNode+Subclasses_ defines the following methods that either must or can be overriden by - * subclasses of ASDisplayNode. - * - * These methods should never be called directly by other classes. - * - * ## Drawing - * - * Implement one of +displayWithParameters:isCancelled: or +drawRect:withParameters:isCancelled: to provide - * drawing for your node. - * - * Use -drawParametersForAsyncLayer: to copy any properties that are involved in drawing into an immutable object for - * use on the display queue. The display and drawRect implementations *MUST* be thread-safe, as they can be called on - * the displayQueue (asynchronously) or the main thread (synchronously/displayImmediately). - * - * Class methods that require passing in copies of the values are used to minimize the need for locking around instance - * variable access, and the possibility of the asynchronous display pass grabbing an inconsistent state across multiple - * variables. - */ - -@interface ASDisplayNode (Subclassing) - -#pragma mark - Properties -/** @name Properties */ - -/** - * @abstract Return the calculated layout. - * - * @discussion For node subclasses that implement manual layout (e.g., they have a custom -layout method), - * calculatedLayout may be accessed on subnodes to retrieved cached information about their size. - * This allows -layout to be very fast, saving time on the main thread. - * Note: .calculatedLayout will only be set for nodes that have had -layoutThatFits: called on them. - * For manual layout, make sure you call -layoutThatFits: in your implementation of -calculateSizeThatFits:. - * - * For node subclasses that use automatic layout (e.g., they implement -layoutSpecThatFits:), - * it is typically not necessary to use .calculatedLayout at any point. For these nodes, - * the ASLayoutSpec implementation will automatically call -layoutThatFits: on all of the subnodes, - * and the ASDisplayNode base class implementation of -layout will automatically make use of .calculatedLayout on the subnodes. - * - * @return Layout that wraps calculated size returned by -calculateSizeThatFits: (in manual layout mode), - * or layout already calculated from layout spec returned by -layoutSpecThatFits: (in automatic layout mode). - * - * @warning Subclasses must not override this; it returns the last cached layout and is never expensive. - */ -@property (nullable, readonly) ASLayout *calculatedLayout; - -#pragma mark - View Lifecycle -/** @name View Lifecycle */ - -/** - * @abstract Called on the main thread immediately after self.view is created. - * - * @discussion This is the best time to add gesture recognizers to the view. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)didLoad ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * An empty method that you can implement in a category to add global - * node initialization behavior. This method will be called by [ASDisplayNode init]. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)baseDidInit; - -/** - * An empty method that you can implement in a category to add global - * node deallocation behavior. This method will be called by [ASDisplayNode dealloc]. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)baseWillDealloc; - -#pragma mark - Layout -/** @name Layout */ - -/** - * @abstract Called on the main thread by the view's -layoutSubviews. - * - * @discussion Subclasses override this method to layout all subnodes or subviews. - */ -- (void)layout ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Called on the main thread by the view's -layoutSubviews, after -layout. - * - * @discussion Gives a chance for subclasses to perform actions after the subclass and superclass have finished laying - * out. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)layoutDidFinish ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Called on a background thread if !isNodeLoaded - called on the main thread if isNodeLoaded. - * - * @discussion When the .calculatedLayout property is set to a new ASLayout (directly from -calculateLayoutThatFits: or - * calculated via use of -layoutSpecThatFits:), subclasses may inspect it here. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)calculatedLayoutDidChange ASDISPLAYNODE_REQUIRES_SUPER; - - -#pragma mark - Layout calculation -/** @name Layout calculation */ - -/** - * @abstract Calculate a layout based on given size range. - * - * @param constrainedSize The minimum and maximum sizes the receiver should fit in. - * - * @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used). - * - * @discussion This method is called on a non-main thread. The default implementation calls either -layoutSpecThatFits: - * or -calculateSizeThatFits:, whichever method is overriden. Subclasses rarely need to override this method, - * override -layoutSpecThatFits: or -calculateSizeThatFits: instead. - * - * @note This method should not be called directly outside of ASDisplayNode; use -layoutThatFits: or -calculatedLayout instead. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize; - -/** - * ASDisplayNode's implementation of -layoutThatFits:parentSize: calls this method to resolve the node's size - * against parentSize, intersect it with constrainedSize, and call -calculateLayoutThatFits: with the result. - * - * In certain advanced cases, you may want to customize this logic. Overriding this method allows you to receive all - * three parameters and do the computation yourself. - * - * @warning Overriding this method should be done VERY rarely. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize; - -/** - * @abstract Return the calculated size. - * - * @param constrainedSize The maximum size the receiver should fit in. - * - * @discussion Subclasses that override should expect this method to be called on a non-main thread. The returned size - * is wrapped in an ASLayout and cached for quick access during -layout. Other expensive work that needs to - * be done before display can be performed here, and using ivars to cache any valuable intermediate results is - * encouraged. - * - * @note Subclasses that override are committed to manual layout. Therefore, -layout: must be overriden to layout all subnodes or subviews. - * - * @note This method should not be called directly outside of ASDisplayNode; use -layoutThatFits: or layoutThatFits:parentSize: instead. - */ -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize; - -/** - * @abstract Invalidate previously measured and cached layout. - * - * @discussion Subclasses should call this method to invalidate the previously measured and cached layout for the display - * node, when the contents of the node change in such a way as to require measuring it again. - */ -- (void)invalidateCalculatedLayout; - -#pragma mark - Observing Node State Changes -/** @name Observing node state changes */ - -/** - * Declare methods as requiring super calls (this can't be required in the protocol). - * For descriptions, see definition. - */ - -AS_CATEGORY_IMPLEMENTABLE -- (void)didEnterVisibleState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)didExitVisibleState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)didEnterDisplayState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)didExitDisplayState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)didEnterPreloadState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)didExitPreloadState ASDISPLAYNODE_REQUIRES_SUPER; - -AS_CATEGORY_IMPLEMENTABLE -- (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Called when the node's ASTraitCollection changes - * - * @discussion Subclasses can override this method to react to a trait collection change. - * - * @param previousTraitCollection The ASPrimitiveTraitCollection object before the interface environment changed. - */ -AS_CATEGORY_IMPLEMENTABLE -- (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTraitCollection)previousTraitCollection ASDISPLAYNODE_REQUIRES_SUPER; - -#pragma mark - Drawing -/** @name Drawing */ - -/** - * @summary Delegate method to draw layer contents into a CGBitmapContext. The current UIGraphics context will be set - * to an appropriate context. - * - * @param bounds Region to draw in. - * @param parameters An object describing all of the properties you need to draw. Return this from - * -drawParametersForAsyncLayer: - * @param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid - * unnecessary work. A return value of YES means cancel drawing and return. - * @param isRasterizing YES if the layer is being rasterized into another layer, in which case drawRect: probably wants - * to avoid doing things like filling its bounds with a zero-alpha color to clear the backing store. - * - * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) - */ -+ (void)drawRect:(CGRect)bounds withParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock - isRasterizing:(BOOL)isRasterizing; - -/** - * @summary Delegate override to provide new layer contents as a UIImage. - * - * @param parameters An object describing all of the properties you need to draw. Return this from - * -drawParametersForAsyncLayer: - * @param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid - * unnecessary work. A return value of YES means cancel drawing and return. - * - * @return A UIImage with contents that are ready to display on the main thread. Make sure that the image is already - * decoded before returning it here. - * - * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) - */ -+ (nullable UIImage *)displayWithParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; - -/** - * @abstract Delegate override for drawParameters - * - * @param layer The layer that will be drawn into. - * - * @note Called on the main thread only - */ -- (nullable id)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; - -/** - * @abstract Indicates that the receiver is about to display. - * - * @discussion Deprecated in 2.5. - * - * @discussion Subclasses may override this method to be notified when display (asynchronous or synchronous) is - * about to begin. - * - * @note Called on the main thread only - */ -- (void)displayWillStart ASDISPLAYNODE_REQUIRES_SUPER ASDISPLAYNODE_DEPRECATED_MSG("Use displayWillStartAsynchronously: instead."); - -/** - * @abstract Indicates that the receiver is about to display. - * - * @discussion Subclasses may override this method to be notified when display (asynchronous or synchronous) is - * about to begin. - * - * @note Called on the main thread only - */ -- (void)displayWillStartAsynchronously:(BOOL)asynchronously ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Indicates that the receiver has finished displaying. - * - * @discussion Subclasses may override this method to be notified when display (asynchronous or synchronous) has - * completed. - * - * @note Called on the main thread only - */ -- (void)displayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * Called just before the view is added to a window. - */ -- (void)willEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * Called after the view is removed from the window. - */ -- (void)didExitHierarchy ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * Called just after the view is added to a window. - * Note: this may be called multiple times during view controller transitions. To overcome this: use didEnterVisibleState or its equavalents. - */ -- (void)didEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Whether the view or layer of this display node is currently in a window - */ -@property (readonly, getter=isInHierarchy) BOOL inHierarchy; - -/** - * Provides an opportunity to clear backing store and other memory-intensive intermediates, such as text layout managers - * on the current node. - * - * @discussion Called by -recursivelyClearContents. Always called on main thread. Base class implements self.contents = nil, clearing any backing - * store, for asynchronous regeneration when needed. - */ -- (void)clearContents ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Indicates that the receiver is about to display its subnodes. This method is not called if there are no - * subnodes present. - * - * @param subnode The subnode of which display is about to begin. - * - * @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) is - * about to begin. - */ -- (void)subnodeDisplayWillStart:(ASDisplayNode *)subnode ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Indicates that the receiver is finished displaying its subnodes. This method is not called if there are - * no subnodes present. - * - * @param subnode The subnode of which display is about to completed. - * - * @discussion Subclasses may override this method to be notified when subnode display (asynchronous or synchronous) has - * completed. - */ -- (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Marks the receiver's bounds as needing to be redrawn, with a scale value. - * - * @param contentsScale The scale at which the receiver should be drawn. - * - * @discussion Subclasses should override this if they don't want their contentsScale changed. - * - * @note This changes an internal property. - * -setNeedsDisplay is also available to trigger display without changing contentsScaleForDisplay. - * @see -setNeedsDisplay, contentsScaleForDisplay - */ -- (void)setNeedsDisplayAtScale:(CGFloat)contentsScale; - -/** - * @abstract Recursively calls setNeedsDisplayAtScale: on subnodes. - * - * @param contentsScale The scale at which the receiver's subnode hierarchy should be drawn. - * - * @discussion Subclasses may override this if they require modifying the scale set on their child nodes. - * - * @note Only the node tree is walked, not the view or layer trees. - * - * @see setNeedsDisplayAtScale: - * @see contentsScaleForDisplay - */ -- (void)recursivelySetNeedsDisplayAtScale:(CGFloat)contentsScale; - -/** - * @abstract The scale factor to apply to the rendering. - * - * @discussion Use setNeedsDisplayAtScale: to set a value and then after display, the display node will set the layer's - * contentsScale. This is to prevent jumps when re-rasterizing at a different contentsScale. - * Read this property if you need to know the future contentsScale of your layer, eg in drawParameters. - * - * @see setNeedsDisplayAtScale: - */ -@property (readonly) CGFloat contentsScaleForDisplay; - -/** - * Called as part of actionForLayer:forKey:. Gives the node a chance to provide a custom action for its layer. - * - * The default implementation returns NSNull, indicating that no action should be taken. - */ -AS_CATEGORY_IMPLEMENTABLE -- (nullable id)layerActionForKey:(NSString *)event; - -#pragma mark - Touch handling -/** @name Touch handling */ - -/** - * @abstract Tells the node when touches began in its view. - * - * @param touches A set of UITouch instances. - * @param event A UIEvent associated with the touch. - */ -- (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Tells the node when touches moved in its view. - * - * @param touches A set of UITouch instances. - * @param event A UIEvent associated with the touch. - */ -- (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Tells the node when touches ended in its view. - * - * @param touches A set of UITouch instances. - * @param event A UIEvent associated with the touch. - */ -- (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @abstract Tells the node when touches was cancelled in its view. - * - * @param touches A set of UITouch instances. - * @param event A UIEvent associated with the touch. - */ -- (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event ASDISPLAYNODE_REQUIRES_SUPER; - - -#pragma mark - Managing Gesture Recognizers -/** @name Managing Gesture Recognizers */ - -/** - * @abstract Asks the node if a gesture recognizer should continue tracking touches. - * - * @param gestureRecognizer A gesture recognizer trying to recognize a gesture. - */ -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer; - - -#pragma mark - Hit Testing - -/** @name Hit Testing */ - -/** - * @abstract Returns the view that contains the point. - * - * @discussion Override to make this node respond differently to touches: (e.g. hide touches from subviews, send all - * touches to certain subviews (hit area maximizing), etc.) - * - * @param point A point specified in the node's local coordinate system (bounds). - * @param event The event that warranted a call to this method. - * - * @return Returns a UIView, not ASDisplayNode, for two reasons: - * 1) allows sending events to plain UIViews that don't have attached nodes, - * 2) hitTest: is never called before the views are created. - */ -- (nullable UIView *)hitTest:(CGPoint)point withEvent:(nullable UIEvent *)event; - - -#pragma mark - Placeholders -/** @name Placeholders */ - -/** - * @abstract Optionally provide an image to serve as the placeholder for the backing store while the contents are being - * displayed. - * - * @discussion - * Subclasses may override this method and return an image to use as the placeholder. Take caution as there may be a - * time and place where this method is called on a background thread. Note that -[UIImage imageNamed:] is not thread - * safe when using image assets. - * - * To retrieve the CGSize to do any image drawing, use the node's calculatedSize property. - * - * Defaults to nil. - * - * @note Called on the display queue and/or main queue (MUST BE THREAD SAFE) - */ -- (nullable UIImage *)placeholderImage; - - -#pragma mark - Description -/** @name Description */ - -/** - * @abstract Return a description of the node - * - * @discussion The function that gets called for each display node in -recursiveDescription - */ -- (NSString *)descriptionForRecursiveDescription; - -@end - - -// Check that at most a layoutSpecBlock or one of the three layout methods is overridden -#define __ASDisplayNodeCheckForLayoutMethodOverrides \ - ASDisplayNodeAssert(_layoutSpecBlock != NULL || \ - ((ASDisplayNodeSubclassOverridesSelector(self.class, @selector(calculateSizeThatFits:)) ? 1 : 0) \ - + (ASDisplayNodeSubclassOverridesSelector(self.class, @selector(layoutSpecThatFits:)) ? 1 : 0) \ - + (ASDisplayNodeSubclassOverridesSelector(self.class, @selector(calculateLayoutThatFits:)) ? 1 : 0)) <= 1, \ - @"Subclass %@ must at least provide a layoutSpecBlock or override at most one of the three layout methods: calculateLayoutThatFits:, layoutSpecThatFits:, or calculateSizeThatFits:", NSStringFromClass(self.class)) - -#define ASDisplayNodeAssertThreadAffinity(viewNode) ASDisplayNodeAssert(!viewNode || ASMainThreadAssertionsAreDisabled() || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity - this method should not be called off the main thread after the ASDisplayNode's view or layer have been created") -#define ASDisplayNodeCAssertThreadAffinity(viewNode) ASDisplayNodeCAssert(!viewNode || ASMainThreadAssertionsAreDisabled() || ASDisplayNodeThreadIsMain() || !(viewNode).nodeLoaded, @"Incorrect display node thread affinity - this method should not be called off the main thread after the ASDisplayNode's view or layer have been created") - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Yoga.h b/Example/Pods/Texture/Source/ASDisplayNode+Yoga.h deleted file mode 100644 index 000bb90e..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Yoga.h +++ /dev/null @@ -1,103 +0,0 @@ -// -// ASDisplayNode+Yoga.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if YOGA - -NS_ASSUME_NONNULL_BEGIN - -@class ASLayout; - -ASDK_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); - -@interface ASDisplayNode (Yoga) - -@property (copy) NSArray *yogaChildren; - -- (void)addYogaChild:(ASDisplayNode *)child; -- (void)removeYogaChild:(ASDisplayNode *)child; -- (void)insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index; - -- (void)semanticContentAttributeDidChange:(UISemanticContentAttribute)attribute; - -@property BOOL yogaLayoutInProgress; -// TODO: Make this atomic (lock). -@property (nullable, nonatomic) ASLayout *yogaCalculatedLayout; -@property (nonatomic) BOOL willApplyNextYogaCalculatedLayout; - -// Will walk up the Yoga tree and returns the root node -- (ASDisplayNode *)yogaRoot; - - -@end - -@interface ASDisplayNode (YogaLocking) -/** - * @discussion Attempts(spinning) to lock all node up to root node when yoga is enabled. - * This will lock self when yoga is not enabled; - */ -- (ASLockSet)lockToRootIfNeededForLayout; - -@end - - -// These methods are intended to be used internally to Texture, and should not be called directly. -@interface ASDisplayNode (YogaInternal) - -/// For internal usage only -- (BOOL)shouldHaveYogaMeasureFunc; -/// For internal usage only -- (ASLayout *)calculateLayoutYoga:(ASSizeRange)constrainedSize; -/// For internal usage only -- (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize willApply:(BOOL)willApply; -/// For internal usage only -- (void)invalidateCalculatedYogaLayout; -/** - * @discussion return true only when yoga enabled and the node is in yoga tree and the node is - * not leaf that implemented measure function. - */ -- (BOOL)locked_shouldLayoutFromYogaRoot; - -@end - -@interface ASDisplayNode (YogaDebugging) - -- (NSString *)yogaTreeDescription; - -@end - -@interface ASLayoutElementStyle (Yoga) - -- (YGNodeRef)yogaNodeCreateIfNeeded; -- (void)destroyYogaNode; - -@property (readonly) YGNodeRef yogaNode; - -@property ASStackLayoutDirection flexDirection; -@property YGDirection direction; -@property ASStackLayoutJustifyContent justifyContent; -@property ASStackLayoutAlignItems alignItems; -@property YGPositionType positionType; -@property ASEdgeInsets position; -@property ASEdgeInsets margin; -@property ASEdgeInsets padding; -@property ASEdgeInsets border; -@property CGFloat aspectRatio; -@property YGWrap flexWrap; - -@end - -NS_ASSUME_NONNULL_END - -// When Yoga is enabled, there are several points where we want to lock the tree to the root but otherwise (without Yoga) -// will want to simply lock self. -#define ASScopedLockSelfOrToRoot() ASScopedLockSet lockSet = [self lockToRootIfNeededForLayout] -#else -#define ASScopedLockSelfOrToRoot() ASLockScopeSelf() -#endif diff --git a/Example/Pods/Texture/Source/ASDisplayNode+Yoga.mm b/Example/Pods/Texture/Source/ASDisplayNode+Yoga.mm deleted file mode 100644 index 619f5a78..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode+Yoga.mm +++ /dev/null @@ -1,489 +0,0 @@ -// -// ASDisplayNode+Yoga.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if YOGA /* YOGA */ - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import - -#define YOGA_LAYOUT_LOGGING 0 - -#pragma mark - ASDisplayNode+Yoga - -@interface ASDisplayNode (YogaPrivate) -@property (nonatomic, weak) ASDisplayNode *yogaParent; -- (ASSizeRange)_locked_constrainedSizeForLayoutPass; -@end - -@implementation ASDisplayNode (Yoga) - -- (ASDisplayNode *)yogaRoot -{ - ASDisplayNode *yogaRoot = self; - ASDisplayNode *yogaParent = nil; - while ((yogaParent = yogaRoot.yogaParent)) { - yogaRoot = yogaParent; - } - return yogaRoot; -} - -- (void)setYogaChildren:(NSArray *)yogaChildren -{ - ASScopedLockSelfOrToRoot(); - for (ASDisplayNode *child in [_yogaChildren copy]) { - // Make sure to un-associate the YGNodeRef tree before replacing _yogaChildren - // If this becomes a performance bottleneck, it can be optimized by not doing the NSArray removals here. - [self _locked_removeYogaChild:child]; - } - _yogaChildren = nil; - for (ASDisplayNode *child in yogaChildren) { - [self _locked_addYogaChild:child]; - } -} - -- (NSArray *)yogaChildren -{ - ASLockScope(self.yogaRoot); - return [_yogaChildren copy] ?: @[]; -} - -- (void)addYogaChild:(ASDisplayNode *)child -{ - ASScopedLockSelfOrToRoot(); - [self _locked_addYogaChild:child]; -} - -- (void)_locked_addYogaChild:(ASDisplayNode *)child -{ - [self insertYogaChild:child atIndex:_yogaChildren.count]; -} - -- (void)removeYogaChild:(ASDisplayNode *)child -{ - ASScopedLockSelfOrToRoot(); - [self _locked_removeYogaChild:child]; -} - -- (void)_locked_removeYogaChild:(ASDisplayNode *)child -{ - if (child == nil) { - return; - } - - [_yogaChildren removeObjectIdenticalTo:child]; - - // YGNodeRef removal is done in setParent: - child.yogaParent = nil; - [self setNeedsLayout]; -} - -- (void)insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index -{ - ASScopedLockSelfOrToRoot(); - [self _locked_insertYogaChild:child atIndex:index]; -} - -- (void)_locked_insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index -{ - if (child == nil) { - return; - } - if (_yogaChildren == nil) { - _yogaChildren = [[NSMutableArray alloc] init]; - } - - // Clean up state in case this child had another parent. - [self _locked_removeYogaChild:child]; - - [_yogaChildren insertObject:child atIndex:index]; - - // YGNodeRef insertion is done in setParent: - child.yogaParent = self; - [self setNeedsLayout]; -} - -#pragma mark - Subclass Hooks - -- (void)semanticContentAttributeDidChange:(UISemanticContentAttribute)attribute -{ - UIUserInterfaceLayoutDirection layoutDirection = - [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:attribute]; - self.style.direction = (layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight - ? YGDirectionLTR : YGDirectionRTL); -} - -- (void)setYogaParent:(ASDisplayNode *)yogaParent -{ - ASLockScopeSelf(); - if (_yogaParent == yogaParent) { - return; - } - - YGNodeRef yogaNode = [self.style yogaNodeCreateIfNeeded]; - YGNodeRef oldParentRef = YGNodeGetParent(yogaNode); - if (oldParentRef != NULL) { - YGNodeRemoveChild(oldParentRef, yogaNode); - } - - _yogaParent = yogaParent; - if (yogaParent) { - YGNodeRef newParentRef = [yogaParent.style yogaNodeCreateIfNeeded]; - YGNodeInsertChild(newParentRef, yogaNode, YGNodeGetChildCount(newParentRef)); - } -} - -- (ASDisplayNode *)yogaParent -{ - return _yogaParent; -} - -- (void)setYogaCalculatedLayout:(ASLayout *)yogaCalculatedLayout -{ - _yogaCalculatedLayout = yogaCalculatedLayout; -} - -- (ASLayout *)yogaCalculatedLayout -{ - return _yogaCalculatedLayout; -} - -- (BOOL)willApplyNextYogaCalculatedLayout { - return _flags.willApplyNextYogaCalculatedLayout; -} - -- (void)setWillApplyNextYogaCalculatedLayout:(BOOL)willApplyNextYogaCalculatedLayout { - _flags.willApplyNextYogaCalculatedLayout = willApplyNextYogaCalculatedLayout; -} - -- (void)setYogaLayoutInProgress:(BOOL)yogaLayoutInProgress -{ - setFlag(YogaLayoutInProgress, yogaLayoutInProgress); - [self updateYogaMeasureFuncIfNeeded]; -} - -- (BOOL)yogaLayoutInProgress -{ - return checkFlag(YogaLayoutInProgress); -} - -- (ASLayout *)layoutForYogaNode -{ - YGNodeRef yogaNode = self.style.yogaNode; - - CGSize size = CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode)); - CGPoint position = CGPointMake(YGNodeLayoutGetLeft(yogaNode), YGNodeLayoutGetTop(yogaNode)); - - if (!ASIsCGSizeValidForSize(size)) { - size = CGSizeZero; - } - - if (!ASIsCGPositionValidForLayout(position)) { - position = CGPointZero; - } - return [ASLayout layoutWithLayoutElement:self size:size position:position sublayouts:nil]; -} - -- (void)setupYogaCalculatedLayoutAndSetNeedsLayoutForChangedNodes:(BOOL)setNeedsLayoutForChangedNodes -{ - ASScopedLockSelfOrToRoot(); - - YGNodeRef yogaNode = self.style.yogaNode; - uint32_t childCount = YGNodeGetChildCount(yogaNode); - ASDisplayNodeAssert(childCount == _yogaChildren.count, - @"Yoga tree should always be in sync with .yogaNodes array! %@", - _yogaChildren); - - ASLayout *rawSublayouts[childCount]; - int i = 0; - for (ASDisplayNode *subnode in _yogaChildren) { - rawSublayouts[i++] = [subnode layoutForYogaNode]; - } - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:childCount]; - - // The layout for self should have position CGPointNull, but include the calculated size. - CGSize size = CGSizeMake(YGNodeLayoutGetWidth(yogaNode), YGNodeLayoutGetHeight(yogaNode)); - if (!ASIsCGSizeValidForSize(size)) { - size = CGSizeZero; - } - ASLayout *layout = [ASLayout layoutWithLayoutElement:self size:size sublayouts:sublayouts]; - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - // Assert that the sublayout is already flattened. - for (ASLayout *sublayout in layout.sublayouts) { - if (sublayout.sublayouts.count > 0 || ASDynamicCast(sublayout.layoutElement, ASDisplayNode) == nil) { - ASDisplayNodeAssert(NO, @"Yoga sublayout is not flattened! %@, %@", self, sublayout); - } - } -#endif - - // Because this layout won't go through the rest of the logic in calculateLayoutThatFits:, flatten it now. - layout = [layout filteredNodeLayoutTree]; - - if ([self.yogaCalculatedLayout isEqual:layout] == NO) { - if (setNeedsLayoutForChangedNodes && !self.willApplyNextYogaCalculatedLayout) { - // This flag will be set when this layout is intended for immediate display. In this case, we - // want to ensure that we call setNeedsLayout on any other nodes. Note that we skip any nodes - // whose willApplyNextYogaCalculatedLayout flags are set, as those are the nodes that are - // already being laid out. - [self setNeedsLayout]; - } - self.yogaCalculatedLayout = layout; - } else { - layout = self.yogaCalculatedLayout; - ASYogaLog("-setupYogaCalculatedLayout: applying identical ASLayout: %@", layout); - } - - // Setup _pendingDisplayNodeLayout to reference the Yoga-calculated ASLayout, *unless* we are a leaf node. - // Leaf yoga nodes may have their own .sublayouts, if they use a layout spec (such as ASButtonNode). - // Their _pending variable is set after passing the Yoga checks at the start of -calculateLayoutThatFits: - - // For other Yoga nodes, there is no code that will set _pending unless we do it here. Why does it need to be set? - // When CALayer triggers the -[ASDisplayNode __layout] call, we will check if our current _pending layout - // has a size which matches our current bounds size. If it does, that layout will be used without recomputing it. - - // NOTE: Yoga does not make the constrainedSize available to intermediate nodes in the tree (e.g. not root or leaves). - // Although the size range provided here is not accurate, this will only affect caching of calls to layoutThatFits: - // These calls will behave as if they are not cached, starting a new Yoga layout pass, but this will tap into Yoga's - // own internal cache. - - if ([self shouldHaveYogaMeasureFunc] == NO) { - YGNodeRef parentNode = YGNodeGetParent(yogaNode); - CGSize parentSize = CGSizeZero; - if (parentNode) { - parentSize.width = YGNodeLayoutGetWidth(parentNode); - parentSize.height = YGNodeLayoutGetHeight(parentNode); - } - // For the root node in a Yoga tree, make sure to preserve the constrainedSize originally provided. - // This will be used for all relayouts triggered by children, since they escalate to root. - ASSizeRange range = parentNode ? ASSizeRangeUnconstrained : self.constrainedSizeForCalculatedLayout; - _pendingDisplayNodeLayout = ASDisplayNodeLayout(layout, range, parentSize, _layoutVersion); - } -} - -- (BOOL)shouldHaveYogaMeasureFunc -{ - ASLockScopeSelf(); - // Size calculation via calculateSizeThatFits: or layoutSpecThatFits: - // For these nodes, we assume they may need custom Baseline calculation too. - // This will be used for ASTextNode, as well as any other node that has no Yoga children - BOOL isLeafNode = (_yogaChildren.count == 0); - BOOL definesCustomLayout = [self implementsLayoutMethod]; - return (isLeafNode && definesCustomLayout); -} - -- (void)updateYogaMeasureFuncIfNeeded -{ - // We set the measure func only during layout. Otherwise, a cycle is created: - // The YGNodeRef Context will retain the ASDisplayNode, which retains the style, which owns the YGNodeRef. - BOOL shouldHaveMeasureFunc = ([self shouldHaveYogaMeasureFunc] && checkFlag(YogaLayoutInProgress)); - - ASLayoutElementYogaUpdateMeasureFunc(self.style.yogaNode, shouldHaveMeasureFunc ? self : nil); -} - -- (void)invalidateCalculatedYogaLayout -{ - ASLockScopeSelf(); - YGNodeRef yogaNode = self.style.yogaNode; - if (yogaNode && [self shouldHaveYogaMeasureFunc]) { - // Yoga internally asserts that MarkDirty() may only be called on nodes with a measurement function. - BOOL needsTemporaryMeasureFunc = (YGNodeGetMeasureFunc(yogaNode) == NULL); - if (needsTemporaryMeasureFunc) { - ASDisplayNodeAssert(self.yogaLayoutInProgress == NO, - @"shouldHaveYogaMeasureFunc == YES, and inside a layout pass, but no measure func pointer! %@", self); - YGNodeSetMeasureFunc(yogaNode, &ASLayoutElementYogaMeasureFunc); - } - YGNodeMarkDirty(yogaNode); - if (needsTemporaryMeasureFunc) { - YGNodeSetMeasureFunc(yogaNode, NULL); - } - } - self.yogaCalculatedLayout = nil; -} - -- (ASLayout *)calculateLayoutYoga:(ASSizeRange)constrainedSize -{ - AS::UniqueLock l(__instanceLock__); - - // There are several cases where Yoga could arrive here: - // - This node is not in a Yoga tree: it has neither a yogaParent nor yogaChildren. - // - This node is a Yoga tree root: it has no yogaParent, but has yogaChildren. - // - This node is a Yoga tree node: it has both a yogaParent and yogaChildren. - // - This node is a Yoga tree leaf: it has a yogaParent, but no yogaChidlren. - if ([self locked_shouldLayoutFromYogaRoot]) { - // If we're a yoga root, tree node, or leaf with no measure func (e.g. spacer), then - // initiate a new Yoga calculation pass from root. - as_activity_create_for_scope("Yoga layout calculation"); - if (self.yogaLayoutInProgress == NO) { - ASYogaLog("Calculating yoga layout from root %@, %@", self, - NSStringFromASSizeRange(constrainedSize)); - [self calculateLayoutFromYogaRoot:constrainedSize willApply:self.willApplyNextYogaCalculatedLayout]; - } else { - ASYogaLog("Reusing existing yoga layout %@", _yogaCalculatedLayout); - } - ASDisplayNodeAssert(_yogaCalculatedLayout, - @"Yoga node should have a non-nil layout at this stage: %@", self); - return _yogaCalculatedLayout; - } else { - // If we're a yoga leaf node with custom measurement function, proceed with normal layout so - // layoutSpecs can run (e.g. ASButtonNode). - ASYogaLog("PROCEEDING past Yoga check to calculate ASLayout for: %@", self); - } - - // Delegate to layout spec layout for nodes that do not support Yoga - return [self calculateLayoutLayoutSpec:constrainedSize]; -} - -- (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize willApply:(BOOL)willApply -{ - ASScopedLockSet lockSet = [self lockToRootIfNeededForLayout]; - ASDisplayNode *yogaRoot = self.yogaRoot; - - if (self != yogaRoot) { - ASYogaLog("ESCALATING to Yoga root: %@", self); - // TODO(appleguy): Consider how to get the constrainedSize for the yogaRoot when escalating manually. - [yogaRoot calculateLayoutFromYogaRoot:ASSizeRangeUnconstrained willApply:willApply]; - return; - } - - if (ASSizeRangeEqualToSizeRange(rootConstrainedSize, ASSizeRangeUnconstrained)) { - rootConstrainedSize = [self _locked_constrainedSizeForLayoutPass]; - } - - [self willCalculateLayout:rootConstrainedSize]; - [self enumerateInterfaceStateDelegates:^(id _Nonnull delegate) { - if ([delegate respondsToSelector:@selector(nodeWillCalculateLayout:)]) { - [delegate nodeWillCalculateLayout:rootConstrainedSize]; - } - }]; - - // Prepare all children for the layout pass with the current Yoga tree configuration. - ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode *_Nonnull node) { - node.yogaLayoutInProgress = YES; - ASDisplayNode *yogaParent = node.yogaParent; - if (yogaParent) { - node.style.parentAlignStyle = yogaParent.style.alignItems; - } else { - node.style.parentAlignStyle = ASStackLayoutAlignItemsNotSet; - }; - }); - - ASYogaLog("CALCULATING at Yoga root with constraint = {%@, %@}: %@", - NSStringFromCGSize(rootConstrainedSize.min), NSStringFromCGSize(rootConstrainedSize.max), self); - - YGNodeRef rootYogaNode = self.style.yogaNode; - - // Apply the constrainedSize as a base, known frame of reference. - // If the root node also has style.*Size set, these will be overridden below. - // YGNodeCalculateLayout currently doesn't offer the ability to pass a minimum size (max is passed there). - - // TODO(appleguy): Reconcile the self.style.*Size properties with rootConstrainedSize - YGNodeStyleSetMinWidth (rootYogaNode, yogaFloatForCGFloat(rootConstrainedSize.min.width)); - YGNodeStyleSetMinHeight(rootYogaNode, yogaFloatForCGFloat(rootConstrainedSize.min.height)); - - // It is crucial to use yogaFloat... to convert CGFLOAT_MAX into YGUndefined here. - YGNodeCalculateLayout(rootYogaNode, - yogaFloatForCGFloat(rootConstrainedSize.max.width), - yogaFloatForCGFloat(rootConstrainedSize.max.height), - YGDirectionInherit); - - // Reset accessible elements, since layout may have changed. - ASPerformBlockOnMainThread(^{ - if (self.nodeLoaded && !self.isSynchronous) { - self.view.accessibilityElements = nil; - } - }); - - ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode * _Nonnull node) { - [node setupYogaCalculatedLayoutAndSetNeedsLayoutForChangedNodes:willApply]; - node.yogaLayoutInProgress = NO; - }); - -#if YOGA_LAYOUT_LOGGING /* YOGA_LAYOUT_LOGGING */ - // Concurrent layouts will interleave the NSLog messages unless we serialize. - // Use @synchornize rather than trampolining to the main thread so the tree state isn't changed. - @synchronized ([ASDisplayNode class]) { - NSLog(@"****************************************************************************"); - NSLog(@"******************** STARTING YOGA -> ASLAYOUT CREATION ********************"); - NSLog(@"****************************************************************************"); - ASDisplayNodePerformBlockOnEveryYogaChild(self, ^(ASDisplayNode * _Nonnull node) { - NSLog(@"node = %@", node); - YGNodePrint(node.style.yogaNode, (YGPrintOptions)(YGPrintOptionsStyle | YGPrintOptionsLayout)); - NSCAssert(ASIsCGSizeValidForSize(node.yogaCalculatedLayout.size), @"Yoga layout returned an invalid size"); - NSLog(@" "); // Newline - }); - } -#endif /* YOGA_LAYOUT_LOGGING */ -} - -@end - -#pragma mark - ASDisplayNode (YogaLocking) - -@implementation ASDisplayNode (YogaLocking) - -- (ASLockSet)lockToRootIfNeededForLayout { - ASLockSet lockSet = ASLockSequence(^BOOL(ASAddLockBlock addLock) { - if (!addLock(self)) { - return NO; - } -#if YOGA - if (![self locked_shouldLayoutFromYogaRoot]) { - return YES; - } - if (self.nodeController && !addLock(self.nodeController)) { - return NO; - } - ASDisplayNode *parent = _supernode; - while (parent) { - if (!addLock(parent)) { - return NO; - } - if (parent.nodeController && !addLock(parent.nodeController)) { - return NO; - } - parent = parent->_supernode; - } -#endif - return true; - }); - return lockSet; -} - -@end - -@implementation ASDisplayNode (YogaDebugging) - -- (NSString *)yogaTreeDescription { - return [self _yogaTreeDescription:@""]; -} - -- (NSString *)_yogaTreeDescription:(NSString *)indent { - auto subtree = [NSMutableString stringWithFormat:@"%@%@\n", indent, self.description]; - for (ASDisplayNode *n in self.yogaChildren) { - [subtree appendString:[n _yogaTreeDescription:[indent stringByAppendingString:@"| "]]]; - } - return subtree; -} - -@end - -#endif /* YOGA */ diff --git a/Example/Pods/Texture/Source/ASDisplayNode.h b/Example/Pods/Texture/Source/ASDisplayNode.h deleted file mode 100644 index eff930cc..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode.h +++ /dev/null @@ -1,995 +0,0 @@ -// -// ASDisplayNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import - -#import -#import -#import -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#define ASDisplayNodeLoggingEnabled 0 - -#ifndef AS_MAX_INTERFACE_STATE_DELEGATES -#define AS_MAX_INTERFACE_STATE_DELEGATES 4 -#endif - -@class ASDisplayNode; -@protocol ASContextTransitioning; - -/** - * UIView creation block. Used to create the backing view of a new display node. - */ -typedef UIView * _Nonnull(^ASDisplayNodeViewBlock)(void); - -/** - * UIView creation block. Used to create the backing view of a new display node. - */ -typedef UIViewController * _Nonnull(^ASDisplayNodeViewControllerBlock)(void); - -/** - * CALayer creation block. Used to create the backing layer of a new display node. - */ -typedef CALayer * _Nonnull(^ASDisplayNodeLayerBlock)(void); - -/** - * ASDisplayNode loaded callback block. This block is called BEFORE the -didLoad method and is always called on the main thread. - */ -typedef void (^ASDisplayNodeDidLoadBlock)(__kindof ASDisplayNode * node); - -/** - * ASDisplayNode will / did render node content in context. - */ -typedef void (^ASDisplayNodeContextModifier)(CGContextRef context, id _Nullable drawParameters); - -/** - * ASDisplayNode layout spec block. This block can be used instead of implementing layoutSpecThatFits: in subclass - */ -typedef ASLayoutSpec * _Nonnull(^ASLayoutSpecBlock)(__kindof ASDisplayNode *node, ASSizeRange constrainedSize); - -/** - * AsyncDisplayKit non-fatal error block. This block can be used for handling non-fatal errors. Useful for reporting - * errors that happens in production. - */ -typedef void (^ASDisplayNodeNonFatalErrorBlock)(NSError *error); - -typedef NS_ENUM(unsigned char, ASCornerRoundingType) { - ASCornerRoundingTypeDefaultSlowCALayer, - ASCornerRoundingTypePrecomposited, - ASCornerRoundingTypeClipping -}; - -/** - * Default drawing priority for display node - */ -ASDK_EXTERN NSInteger const ASDefaultDrawingPriority; - -/** - * An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view - * hierarchy off the main thread, and could do rendering off the main thread as well. - * - * The node API is designed to be as similar as possible to `UIView`. See the README for examples. - * - * ## Subclassing - * - * `ASDisplayNode` can be subclassed to create a new UI element. The subclass header `ASDisplayNode+Subclasses` provides - * necessary declarations and conveniences. - * - * Commons reasons to subclass includes making a `UIView` property available and receiving a callback after async - * display. - * - */ - -@interface ASDisplayNode : NSObject { -@public - /** - * The _displayNodeContext ivar is unused by Texture, but provided to enable advanced clients to make powerful extensions to base class functionality. - * For example, _displayNodeContext can be used to implement category methods on ASDisplayNode that add functionality to all node subclass types. - * Code demonstrating this technique can be found in the CatDealsCollectionView example. - */ - void *_displayNodeContext; -} - -/** @name Initializing a node object */ - - -/** - * @abstract Designated initializer. - * - * @return An ASDisplayNode instance whose view will be a subclass that enables asynchronous rendering, and passes - * through -layout and touch handling methods. - */ -- (instancetype)init NS_DESIGNATED_INITIALIZER; - - -/** - * @abstract Alternative initializer with a block to create the backing view. - * - * @param viewBlock The block that will be used to create the backing view. - * - * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main - * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. - */ -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock; - -/** - * @abstract Alternative initializer with a block to create the backing view. - * - * @param viewBlock The block that will be used to create the backing view. - * @param didLoadBlock The block that will be called after the view created by the viewBlock is loaded - * - * @return An ASDisplayNode instance that loads its view with the given block that is guaranteed to run on the main - * queue. The view will render synchronously and -layout and touch handling methods on the node will not be called. - */ -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; - -/** - * @abstract Alternative initializer with a block to create the backing layer. - * - * @param layerBlock The block that will be used to create the backing layer. - * - * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main - * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. - */ -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock; - -/** - * @abstract Alternative initializer with a block to create the backing layer. - * - * @param layerBlock The block that will be used to create the backing layer. - * @param didLoadBlock The block that will be called after the layer created by the layerBlock is loaded - * - * @return An ASDisplayNode instance that loads its layer with the given block that is guaranteed to run on the main - * queue. The layer will render synchronously and -layout and touch handling methods on the node will not be called. - */ -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock; - -/** - * @abstract Add a block of work to be performed on the main thread when the node's view or layer is loaded. Thread safe. - * @warning Be careful not to retain self in `body`. Change the block parameter list to `^(MYCustomNode *self) {}` if you - * want to shadow self (e.g. if calling this during `init`). - * - * @param body The work to be performed when the node is loaded. - * - * @precondition The node is not already loaded. - */ -- (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body; - -/** - * Set the block that should be used to load this node's view. - * - * @param viewBlock The block that creates a view for this node. - * - * @precondition The node is not yet loaded. - * - * @note You will usually NOT call this. See the limitations documented in @c initWithViewBlock: - */ -- (void)setViewBlock:(ASDisplayNodeViewBlock)viewBlock; - -/** - * Set the block that should be used to load this node's layer. - * - * @param layerBlock The block that creates a layer for this node. - * - * @precondition The node is not yet loaded. - * - * @note You will usually NOT call this. See the limitations documented in @c initWithLayerBlock: - */ -- (void)setLayerBlock:(ASDisplayNodeLayerBlock)layerBlock; - -/** - * @abstract Returns whether the node is synchronous. - * - * @return NO if the node wraps a _ASDisplayView, YES otherwise. - */ -@property (readonly, getter=isSynchronous) BOOL synchronous; - -/** @name Getting view and layer */ - -/** - * @abstract Returns a view. - * - * @discussion The view property is lazily initialized, similar to UIViewController. - * To go the other direction, use ASViewToDisplayNode() in ASDisplayNodeExtras.h. - * - * @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as - * well. - */ -@property (readonly) UIView *view; - -/** - * @abstract Returns whether a node's backing view or layer is loaded. - * - * @return YES if a view is loaded, or if layerBacked is YES and layer is not nil; NO otherwise. - */ -@property (readonly, getter=isNodeLoaded) BOOL nodeLoaded; - -/** - * @abstract Returns whether the node rely on a layer instead of a view. - * - * @return YES if the node rely on a layer, NO otherwise. - */ -@property (getter=isLayerBacked) BOOL layerBacked; - -/** - * @abstract Returns a layer. - * - * @discussion The layer property is lazily initialized, similar to the view property. - * To go the other direction, use ASLayerToDisplayNode() in ASDisplayNodeExtras.h. - * - * @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as - * well. - */ -@property (readonly) CALayer * layer; - -/** - * Returns YES if the node is – at least partially – visible in a window. - * - * @see didEnterVisibleState and didExitVisibleState - */ -@property (readonly, getter=isVisible) BOOL visible; - -/** - * Returns YES if the node is in the preloading interface state. - * - * @see didEnterPreloadState and didExitPreloadState - */ -@property (readonly, getter=isInPreloadState) BOOL inPreloadState; - -/** - * Returns YES if the node is in the displaying interface state. - * - * @see didEnterDisplayState and didExitDisplayState - */ -@property (readonly, getter=isInDisplayState) BOOL inDisplayState; - -/** - * @abstract Returns the Interface State of the node. - * - * @return The current ASInterfaceState of the node, indicating whether it is visible and other situational properties. - * - * @see ASInterfaceState - */ -@property (readonly) ASInterfaceState interfaceState; - -/** - * @abstract Adds a delegate to receive notifications on interfaceState changes. - * - * @warning This must be called from the main thread. - * There is a hard limit on the number of delegates a node can have; see - * AS_MAX_INTERFACE_STATE_DELEGATES above. - * - * @see ASInterfaceState - */ -- (void)addInterfaceStateDelegate:(id )interfaceStateDelegate; - -/** - * @abstract Removes a delegate from receiving notifications on interfaceState changes. - * - * @warning This must be called from the main thread. - * - * @see ASInterfaceState - */ -- (void)removeInterfaceStateDelegate:(id )interfaceStateDelegate; - -/** - * @abstract Class property that allows to set a block that can be called on non-fatal errors. This - * property can be useful for cases when Async Display Kit can recover from an abnormal behavior, but - * still gives the opportunity to use a reporting mechanism to catch occurrences in production. In - * development, Async Display Kit will assert instead of calling this block. - * - * @warning This method is not thread-safe. - */ -@property (class, nonatomic) ASDisplayNodeNonFatalErrorBlock nonFatalErrorBlock; - -/** @name Managing the nodes hierarchy */ - - -/** - * @abstract Add a node as a subnode to this node. - * - * @param subnode The node to be added. - * - * @discussion The subnode's view will automatically be added to this node's view, lazily if the views are not created - * yet. - */ -- (void)addSubnode:(ASDisplayNode *)subnode; - -/** - * @abstract Insert a subnode before a given subnode in the list. - * - * @param subnode The node to insert below another node. - * @param below The sibling node that will be above the inserted node. - * - * @discussion If the views are loaded, the subnode's view will be inserted below the given node's view in the hierarchy - * even if there are other non-displaynode views. - */ -- (void)insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below; - -/** - * @abstract Insert a subnode after a given subnode in the list. - * - * @param subnode The node to insert below another node. - * @param above The sibling node that will be behind the inserted node. - * - * @discussion If the views are loaded, the subnode's view will be inserted above the given node's view in the hierarchy - * even if there are other non-displaynode views. - */ -- (void)insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above; - -/** - * @abstract Insert a subnode at a given index in subnodes. - * - * @param subnode The node to insert. - * @param idx The index in the array of the subnodes property at which to insert the node. Subnodes indices start at 0 - * and cannot be greater than the number of subnodes. - * - * @discussion If this node's view is loaded, ASDisplayNode insert the subnode's view after the subnode at index - 1's - * view even if there are other non-displaynode views. - */ -- (void)insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx; - -/** - * @abstract Replace subnode with replacementSubnode. - * - * @param subnode A subnode of self. - * @param replacementSubnode A node with which to replace subnode. - * - * @discussion Should both subnode and replacementSubnode already be subnodes of self, subnode is removed and - * replacementSubnode inserted in its place. - * If subnode is not a subnode of self, this method will throw an exception. - * If replacementSubnode is nil, this method will throw an exception - */ -- (void)replaceSubnode:(ASDisplayNode *)subnode withSubnode:(ASDisplayNode *)replacementSubnode; - -/** - * @abstract Remove this node from its supernode. - * - * @discussion The node's view will be automatically removed from the supernode's view. - */ -- (void)removeFromSupernode; - -/** - * @abstract The receiver's immediate subnodes. - */ -@property (nullable, readonly, copy) NSArray *subnodes; - -/** - * @abstract The receiver's supernode. - */ -@property (nullable, readonly, weak) ASDisplayNode *supernode; - - -/** @name Drawing and Updating the View */ - -/** - * @abstract Whether this node's view performs asynchronous rendering. - * - * @return Defaults to YES, except for synchronous views (ie, those created with -initWithViewBlock: / - * -initWithLayerBlock:), which are always NO. - * - * @discussion If this flag is set, then the node will participate in the current asyncdisplaykit_async_transaction and - * do its rendering on the displayQueue instead of the main thread. - * - * Asynchronous rendering proceeds as follows: - * - * When the view is initially added to the hierarchy, it has -needsDisplay true. - * After layout, Core Animation will call -display on the _ASDisplayLayer - * -display enqueues a rendering operation on the displayQueue - * When the render block executes, it calls the delegate display method (-drawRect:... or -display) - * The delegate provides contents via this method and an operation is added to the asyncdisplaykit_async_transaction - * Once all rendering is complete for the current asyncdisplaykit_async_transaction, - * the completion for the block sets the contents on all of the layers in the same frame - * - * If asynchronous rendering is disabled: - * - * When the view is initially added to the hierarchy, it has -needsDisplay true. - * After layout, Core Animation will call -display on the _ASDisplayLayer - * -display calls delegate display method (-drawRect:... or -display) immediately - * -display sets the layer contents immediately with the result - * - * Note: this has nothing to do with -[CALayer drawsAsynchronously]. - */ -@property BOOL displaysAsynchronously; - -/** - * @abstract Prevent the node's layer from displaying. - * - * @discussion A subclass may check this flag during -display or -drawInContext: to cancel a display that is already in - * progress. - * - * Defaults to NO. Does not control display for any child or descendant nodes; for that, use - * -recursivelySetDisplaySuspended:. - * - * If a setNeedsDisplay occurs while displaySuspended is YES, and displaySuspended is set to NO, then the - * layer will be automatically displayed. - */ -@property BOOL displaySuspended; - -/** - * @abstract Whether size changes should be animated. Default to YES. - */ -@property BOOL shouldAnimateSizeChanges; - -/** - * @abstract Prevent the node and its descendants' layer from displaying. - * - * @param flag YES if display should be prevented or cancelled; NO otherwise. - * - * @see displaySuspended - */ -- (void)recursivelySetDisplaySuspended:(BOOL)flag; - -/** - * @abstract Calls -clearContents on the receiver and its subnode hierarchy. - * - * @discussion Clears backing stores and other memory-intensive intermediates. - * If the node is removed from a visible hierarchy and then re-added, it will automatically trigger a new asynchronous display, - * as long as displaySuspended is not set. - * If the node remains in the hierarchy throughout, -setNeedsDisplay is required to trigger a new asynchronous display. - * - * @see displaySuspended and setNeedsDisplay - */ -- (void)recursivelyClearContents; - -/** - * @abstract Toggle displaying a placeholder over the node that covers content until the node and all subnodes are - * displayed. - * - * @discussion Defaults to NO. - */ -@property BOOL placeholderEnabled; - -/** - * @abstract Set the time it takes to fade out the placeholder when a node's contents are finished displaying. - * - * @discussion Defaults to 0 seconds. - */ -@property NSTimeInterval placeholderFadeDuration; - -/** - * @abstract Determines drawing priority of the node. Nodes with higher priority will be drawn earlier. - * - * @discussion Defaults to ASDefaultDrawingPriority. There may be multiple drawing threads, and some of them may - * decide to perform operations in queued order (regardless of drawingPriority) - */ -@property NSInteger drawingPriority; - -/** @name Hit Testing */ - - -/** - * @abstract Bounds insets for hit testing. - * - * @discussion When set to a non-zero inset, increases the bounds for hit testing to make it easier to tap or perform - * gestures on this node. Default is UIEdgeInsetsZero. - * - * This affects the default implementation of -hitTest and -pointInside, so subclasses should call super if you override - * it and want hitTestSlop applied. - */ -@property UIEdgeInsets hitTestSlop; - -/** - * @abstract Returns a Boolean value indicating whether the receiver contains the specified point. - * - * @discussion Includes the "slop" factor specified with hitTestSlop. - * - * @param point A point that is in the receiver's local coordinate system (bounds). - * @param event The event that warranted a call to this method. - * - * @return YES if point is inside the receiver's bounds; otherwise, NO. - */ -- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event AS_WARN_UNUSED_RESULT; - - -/** @name Converting Between View Coordinate Systems */ - - -/** - * @abstract Converts a point from the receiver's coordinate system to that of the specified node. - * - * @param point A point specified in the local coordinate system (bounds) of the receiver. - * @param node The node into whose coordinate system point is to be converted. - * - * @return The point converted to the coordinate system of node. - */ -- (CGPoint)convertPoint:(CGPoint)point toNode:(nullable ASDisplayNode *)node AS_WARN_UNUSED_RESULT; - - -/** - * @abstract Converts a point from the coordinate system of a given node to that of the receiver. - * - * @param point A point specified in the local coordinate system (bounds) of node. - * @param node The node with point in its coordinate system. - * - * @return The point converted to the local coordinate system (bounds) of the receiver. - */ -- (CGPoint)convertPoint:(CGPoint)point fromNode:(nullable ASDisplayNode *)node AS_WARN_UNUSED_RESULT; - - -/** - * @abstract Converts a rectangle from the receiver's coordinate system to that of another view. - * - * @param rect A rectangle specified in the local coordinate system (bounds) of the receiver. - * @param node The node that is the target of the conversion operation. - * - * @return The converted rectangle. - */ -- (CGRect)convertRect:(CGRect)rect toNode:(nullable ASDisplayNode *)node AS_WARN_UNUSED_RESULT; - -/** - * @abstract Converts a rectangle from the coordinate system of another node to that of the receiver. - * - * @param rect A rectangle specified in the local coordinate system (bounds) of node. - * @param node The node with rect in its coordinate system. - * - * @return The converted rectangle. - */ -- (CGRect)convertRect:(CGRect)rect fromNode:(nullable ASDisplayNode *)node AS_WARN_UNUSED_RESULT; - -/** - * Whether or not the node would support having .layerBacked = YES. - */ -@property (readonly) BOOL supportsLayerBacking; - -/** - * Whether or not the node layout should be automatically updated when it receives safeAreaInsetsDidChange. - * - * Defaults to NO. - */ -@property BOOL automaticallyRelayoutOnSafeAreaChanges; - -/** - * Whether or not the node layout should be automatically updated when it receives layoutMarginsDidChange. - * - * Defaults to NO. - */ -@property BOOL automaticallyRelayoutOnLayoutMarginsChanges; - -@end - -/** - * Convenience methods for debugging. - */ -@interface ASDisplayNode (Debugging) - -/** - * Whether or not ASDisplayNode instances should store their unflattened layouts. - * - * The layout can be accessed via `-unflattenedCalculatedLayout`. - * - * Flattened layouts use less memory and are faster to lookup. On the other hand, unflattened layouts are useful for debugging - * because they preserve original information. - * - * Defaults to NO. - */ -@property (class) BOOL shouldStoreUnflattenedLayouts; - -@property (nullable, readonly) ASLayout *unflattenedCalculatedLayout; - -/** - * @abstract Return a description of the node hierarchy. - * - * @discussion For debugging: (lldb) po [node displayNodeRecursiveDescription] - */ -- (NSString *)displayNodeRecursiveDescription AS_WARN_UNUSED_RESULT; - -/** - * A detailed description of this node's layout state. This is useful when debugging. - */ -@property (copy, readonly) NSString *detailedLayoutDescription; - -@end - -/** - * ## UIView bridge - * - * ASDisplayNode provides thread-safe access to most of UIView and CALayer properties and methods, traditionally unsafe. - * - * Using them will not cause the actual view/layer to be created, and will be applied when it is created (when the view - * or layer property is accessed). - * - * - NOTE: After the view or layer is created, the properties pass through to the view or layer directly and must be called on the main thread. - * - * See UIView and CALayer for documentation on these common properties. - */ -@interface ASDisplayNode (UIViewBridge) - -/** - * Marks the view as needing display. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread. - */ -- (void)setNeedsDisplay; - -/** - * Marks the node as needing layout. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread. - * - * If the node determines its own desired layout size will change in the next layout pass, it will propagate this - * information up the tree so its parents can have a chance to consider and apply if necessary the new size onto the node. - * - * Note: ASCellNode has special behavior in that calling this method will automatically notify - * the containing ASTableView / ASCollectionView that the cell should be resized, if necessary. - */ -- (void)setNeedsLayout; - -/** - * Performs a layout pass on the node. Convenience for use whether the view / layer is loaded or not. Safe to call from a background thread. - */ -- (void)layoutIfNeeded; - -@property CGRect frame; // default=CGRectZero -@property CGRect bounds; // default=CGRectZero -@property CGPoint position; // default=CGPointZero -@property CGFloat alpha; // default=1.0f - -/* @abstract Sets the corner rounding method to use on the ASDisplayNode. - * There are three types of corner rounding provided by Texture: CALayer, Precomposited, and Clipping. - * - * - ASCornerRoundingTypeDefaultSlowCALayer: uses CALayer's inefficient .cornerRadius property. Use - * this type of corner in situations in which there is both movement through and movement underneath - * the corner (very rare). This uses only .cornerRadius. - * - * - ASCornerRoundingTypePrecomposited: corners are drawn using bezier paths to clip the content in a - * CGContext / UIGraphicsContext. This requires .backgroundColor and .cornerRadius to be set. Use opaque - * background colors when possible for optimal efficiency, but transparent colors are supported and much - * more efficient than CALayer. The only limitation of this approach is that it cannot clip children, and - * thus works best for ASImageNodes or containers showing a background around their children. - * - * - ASCornerRoundingTypeClipping: overlays 4 separate opaque corners on top of the content that needs - * corner rounding. Requires .backgroundColor and .cornerRadius to be set. Use clip corners in situations - * where there is movement through the corner, with an opaque background (no movement underneath the corner). - * Clipped corners are ideal for animating / resizing views, and still outperform CALayer. - * - * For more information and examples, see http://texturegroup.org/docs/corner-rounding.html - * - * @default ASCornerRoundingTypeDefaultSlowCALayer - */ -@property ASCornerRoundingType cornerRoundingType; // default=ASCornerRoundingTypeDefaultSlowCALayer .cornerRadius (offscreen rendering) - -/** @abstract The radius to use when rounding corners of the ASDisplayNode. - * - * @discussion This property is thread-safe and should always be preferred over CALayer's cornerRadius property, - * even if corner rounding type is ASCornerRoundingTypeDefaultSlowCALayer. - */ -@property CGFloat cornerRadius; // default=0.0 - -/** @abstract Which corners to mask when rounding corners. - * - * @note This option cannot be changed when using iOS < 11 - * and using ASCornerRoundingTypeDefaultSlowCALayer. Use a different corner rounding type to implement not-all-corners - * rounding in prior versions of iOS. - */ -@property CACornerMask maskedCorners; // default=all corners. - -@property BOOL clipsToBounds; // default==NO -@property (getter=isHidden) BOOL hidden; // default==NO -@property (getter=isOpaque) BOOL opaque; // default==YES - -@property (nullable) id contents; // default=nil -@property CGRect contentsRect; // default={0,0,1,1}. @see CALayer.h for details. -@property CGRect contentsCenter; // default={0,0,1,1}. @see CALayer.h for details. -@property CGFloat contentsScale; // default=1.0f. See @contentsScaleForDisplay for details. -@property CGFloat rasterizationScale; // default=1.0f. - -@property CGPoint anchorPoint; // default={0.5, 0.5} -@property CGFloat zPosition; // default=0.0 -@property CATransform3D transform; // default=CATransform3DIdentity -@property CATransform3D subnodeTransform; // default=CATransform3DIdentity - -@property (getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default=YES (NO for layer-backed nodes) -#if TARGET_OS_IOS -@property (getter=isExclusiveTouch) BOOL exclusiveTouch; // default=NO -#endif - -@property (nullable, copy) NSDictionary> *actions; // default = nil - -/** - * @abstract The node view's background color. - * - * @discussion In contrast to UIView, setting a transparent color will not set opaque = NO. - * This only affects nodes that implement +drawRect like ASTextNode. -*/ -@property (nullable, copy) UIColor *backgroundColor; // default=nil - -@property (null_resettable, copy) UIColor *tintColor; // default=Blue - -/** - * Notifies the node when the tintColor has changed. - * - * @note This method is guaranteed to be called if the tintColor is changed after the node loaded. - */ -- (void)tintColorDidChange; - -/** - * @abstract A flag used to determine how a node lays out its content when its bounds change. - * - * @discussion This is like UIView's contentMode property, but better. We do our own mapping to layer.contentsGravity in - * _ASDisplayView. You can set needsDisplayOnBoundsChange independently. - * Thus, UIViewContentModeRedraw is not allowed; use needsDisplayOnBoundsChange = YES instead, and pick an appropriate - * contentMode for your content while it's being re-rendered. - */ -@property UIViewContentMode contentMode; // default=UIViewContentModeScaleToFill -@property (copy) NSString *contentsGravity; // Use .contentMode in preference when possible. -@property UISemanticContentAttribute semanticContentAttribute; - -@property (nullable) CGColorRef shadowColor; // default=opaque rgb black -@property CGFloat shadowOpacity; // default=0.0 -@property CGSize shadowOffset; // default=(0, -3) -@property CGFloat shadowRadius; // default=3 -@property CGFloat borderWidth; // default=0 -@property (nullable) CGColorRef borderColor; // default=opaque rgb black - -@property BOOL allowsGroupOpacity; -@property BOOL allowsEdgeAntialiasing; -@property CAEdgeAntialiasingMask edgeAntialiasingMask; // default==all values from CAEdgeAntialiasingMask - -@property BOOL needsDisplayOnBoundsChange; // default==NO -@property BOOL autoresizesSubviews; // default==YES (undefined for layer-backed nodes) -@property UIViewAutoresizing autoresizingMask; // default==UIViewAutoresizingNone (undefined for layer-backed nodes) - -/** - * @abstract Content margins - * - * @discussion This property is bridged to its UIView counterpart. - * - * If your layout depends on this property, you should probably enable automaticallyRelayoutOnLayoutMarginsChanges to ensure - * that the layout gets automatically updated when the value of this property changes. Or you can override layoutMarginsDidChange - * and make all the necessary updates manually. - */ -@property UIEdgeInsets layoutMargins; -@property BOOL preservesSuperviewLayoutMargins; // default is NO - set to enable pass-through or cascading behavior of margins from this view’s parent to its children -- (void)layoutMarginsDidChange; - -/** - * @abstract Safe area insets - * - * @discussion This property is bridged to its UIVIew counterpart. - * - * If your layout depends on this property, you should probably enable automaticallyRelayoutOnSafeAreaChanges to ensure - * that the layout gets automatically updated when the value of this property changes. Or you can override safeAreaInsetsDidChange - * and make all the necessary updates manually. - */ -@property (readonly) UIEdgeInsets safeAreaInsets; -@property BOOL insetsLayoutMarginsFromSafeArea; // Default: YES -- (void)safeAreaInsetsDidChange; - - -// UIResponder methods -// By default these fall through to the underlying view, but can be overridden. -- (BOOL)canBecomeFirstResponder; // default==NO -- (BOOL)becomeFirstResponder; // default==NO (no-op) -- (BOOL)canResignFirstResponder; // default==YES -- (BOOL)resignFirstResponder; // default==NO (no-op) -- (BOOL)isFirstResponder; -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender; - -#if TARGET_OS_TV -//Focus Engine -- (void)setNeedsFocusUpdate; -- (BOOL)canBecomeFocused; -- (void)updateFocusIfNeeded; -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator; -- (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context; -- (nullable UIView *)preferredFocusedView; -#endif - -@end - -@interface ASDisplayNode (UIViewBridgeAccessibility) - -// Accessibility support -@property BOOL isAccessibilityElement; -@property (nullable, copy) NSString *accessibilityLabel; -@property (nullable, copy) NSAttributedString *accessibilityAttributedLabel API_AVAILABLE(ios(11.0),tvos(11.0)); -@property (nullable, copy) NSString *accessibilityHint; -@property (nullable, copy) NSAttributedString *accessibilityAttributedHint API_AVAILABLE(ios(11.0),tvos(11.0)); -@property (nullable, copy) NSString *accessibilityValue; -@property (nullable, copy) NSAttributedString *accessibilityAttributedValue API_AVAILABLE(ios(11.0),tvos(11.0)); -@property UIAccessibilityTraits accessibilityTraits; -@property CGRect accessibilityFrame; -@property (nullable, copy) UIBezierPath *accessibilityPath; -@property CGPoint accessibilityActivationPoint; -@property (nullable, copy) NSString *accessibilityLanguage; -@property BOOL accessibilityElementsHidden; -@property BOOL accessibilityViewIsModal; -@property BOOL shouldGroupAccessibilityChildren; -@property UIAccessibilityNavigationStyle accessibilityNavigationStyle; -@property (nullable, copy) NSArray *accessibilityCustomActions API_AVAILABLE(ios(8.0),tvos(9.0)); -#if TARGET_OS_TV -@property (nullable, copy) NSArray *accessibilityHeaderElements; -#endif - -// Accessibility identification support -@property (nullable, copy) NSString *accessibilityIdentifier; - -@end - -@interface ASDisplayNode (ASLayoutElement) - -/** - * @abstract Asks the node to return a layout based on given size range. - * - * @param constrainedSize The minimum and maximum sizes the receiver should fit in. - * - * @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used). - * - * @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the - * constraint and the result. - * - * @warning Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may - * be expensive if result is not cached. - * - * @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:] - */ -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize; - -@end - -@interface ASDisplayNode (ASLayoutElementStylability) - -@end - -typedef NS_ENUM(NSInteger, ASLayoutEngineType) { - ASLayoutEngineTypeLayoutSpec, - ASLayoutEngineTypeYoga -}; - -@interface ASDisplayNode (ASLayout) - -/** - * @abstract Returns the current layout type the node uses for layout the subtree. - */ -@property (readonly) ASLayoutEngineType layoutEngineType; - -/** - * @abstract Return the calculated size. - * - * @discussion Ideal for use by subclasses in -layout, having already prompted their subnodes to calculate their size by - * calling -layoutThatFits: on them in -calculateLayoutThatFits. - * - * @return Size already calculated by -calculateLayoutThatFits:. - * - * @warning Subclasses must not override this; it returns the last cached measurement and is never expensive. - */ -@property (readonly) CGSize calculatedSize; - -/** - * @abstract Return the constrained size range used for calculating layout. - * - * @return The minimum and maximum constrained sizes used by calculateLayoutThatFits:. - */ -@property (readonly) ASSizeRange constrainedSizeForCalculatedLayout; - -@end - -@interface ASDisplayNode (ASLayoutTransitioning) - -/** - * @abstract The amount of time it takes to complete the default transition animation. Default is 0.2. - */ -@property NSTimeInterval defaultLayoutTransitionDuration; - -/** - * @abstract The amount of time (measured in seconds) to wait before beginning the default transition animation. - * Default is 0.0. - */ -@property NSTimeInterval defaultLayoutTransitionDelay; - -/** - * @abstract A mask of options indicating how you want to perform the default transition animations. - * For a list of valid constants, see UIViewAnimationOptions. - */ -@property UIViewAnimationOptions defaultLayoutTransitionOptions; - -/** - * @discussion A place to perform your animation. New nodes have been inserted here. You can also use this time to re-order the hierarchy. - */ -- (void)animateLayoutTransition:(nonnull id)context; - -/** - * @discussion A place to clean up your nodes after the transition - */ -- (void)didCompleteLayoutTransition:(nonnull id)context; - -/** - * @abstract Transitions the current layout with a new constrained size. Must be called on main thread. - * - * @param animated Animation is optional, but will still proceed through your `animateLayoutTransition` implementation with `isAnimated == NO`. - * @param shouldMeasureAsync Measure the layout asynchronously. - * @param completion Optional completion block called only if a new layout is calculated. - * It is called on main, right after the measurement and before -animateLayoutTransition:. - * - * @discussion If the passed constrainedSize is the the same as the node's current constrained size, this method is noop. If passed YES to shouldMeasureAsync it's guaranteed that measurement is happening on a background thread, otherwise measaurement will happen on the thread that the method was called on. The measurementCompletion callback is always called on the main thread right after the measurement and before -animateLayoutTransition:. - * - * @see animateLayoutTransition: - * - */ -- (void)transitionLayoutWithSizeRange:(ASSizeRange)constrainedSize - animated:(BOOL)animated - shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(nullable void(^)(void))completion; - - -/** - * @abstract Invalidates the layout and begins a relayout of the node with the current `constrainedSize`. Must be called on main thread. - * - * @discussion It is called right after the measurement and before -animateLayoutTransition:. - * - * @param animated Animation is optional, but will still proceed through your `animateLayoutTransition` implementation with `isAnimated == NO`. - * @param shouldMeasureAsync Measure the layout asynchronously. - * @param completion Optional completion block called only if a new layout is calculated. - * - * @see animateLayoutTransition: - * - */ -- (void)transitionLayoutWithAnimation:(BOOL)animated - shouldMeasureAsync:(BOOL)shouldMeasureAsync - measurementCompletion:(nullable void(^)(void))completion; - -/** - * @abstract Cancels all performing layout transitions. Can be called on any thread. - */ -- (void)cancelLayoutTransition; - -@end - -/* - * ASDisplayNode support for automatic subnode management. - */ -@interface ASDisplayNode (ASAutomaticSubnodeManagement) - -/** - * @abstract A boolean that shows whether the node automatically inserts and removes nodes based on the presence or - * absence of the node and its subnodes is completely determined in its layoutSpecThatFits: method. - * - * @discussion If flag is YES the node no longer require addSubnode: or removeFromSupernode method calls. The presence - * or absence of subnodes is completely determined in its layoutSpecThatFits: method. - */ -@property BOOL automaticallyManagesSubnodes; - -@end - -/* - * ASDisplayNode participates in ASAsyncTransactions, so you can determine when your subnodes are done rendering. - * See: -(void)asyncdisplaykit_asyncTransactionContainerStateDidChange in ASDisplayNodeSubclass.h - */ -@interface ASDisplayNode (ASAsyncTransactionContainer) -@end - -/** UIVIew(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to an UIView. */ -@interface UIView (AsyncDisplayKit) -/** - * Convenience method, equivalent to [view addSubview:node.view] or [view.layer addSublayer:node.layer] if layer-backed. - * - * @param node The node to be added. - */ -- (void)addSubnode:(ASDisplayNode *)node; -@end - -/* - * CALayer(AsyncDisplayKit) defines convenience method for adding sub-ASDisplayNode to a CALayer. - */ -@interface CALayer (AsyncDisplayKit) -/** - * Convenience method, equivalent to [layer addSublayer:node.layer]. - * - * @param node The node to be added. - */ -- (void)addSubnode:(ASDisplayNode *)node; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNode.mm b/Example/Pods/Texture/Source/ASDisplayNode.mm deleted file mode 100644 index b96a7747..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNode.mm +++ /dev/null @@ -1,3789 +0,0 @@ -// -// ASDisplayNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -// Conditionally time these scopes to our debug ivars (only exist in debug/profile builds) -#if TIME_DISPLAYNODE_OPS - #define TIME_SCOPED(outVar) AS::ScopeTimer t(outVar) -#else - #define TIME_SCOPED(outVar) -#endif -// This is trying to merge non-rangeManaged with rangeManaged, so both range-managed and standalone nodes wait before firing their exit-visibility handlers, as UIViewController transitions now do rehosting at both start & end of animation. -// Enable this will mitigate interface updating state when coalescing disabled. -// TODO(wsdwsd0829): Rework enabling code to ensure that interface state behavior is not altered when ASCATransactionQueue is disabled. -#define ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR 0 - -using AS::MutexLocker; - -static ASDisplayNodeNonFatalErrorBlock _nonFatalErrorBlock = nil; - -@interface ASDisplayNode () -/** - * See ASDisplayNodeInternal.h for ivars - */ - -@end - -@implementation ASDisplayNode - -@dynamic layoutElementType; - -@synthesize threadSafeBounds = _threadSafeBounds; - -static std::atomic_bool suppressesInvalidCollectionUpdateExceptions = ATOMIC_VAR_INIT(NO); -static std::atomic_bool storesUnflattenedLayouts = ATOMIC_VAR_INIT(NO); - -BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector) -{ - return ASSubclassOverridesSelector([ASDisplayNode class], subclass, selector); -} - -// For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - we have to be sure to set certain properties -// like setFrame: and setBackgroundColor: directly to the UIView and not apply it to the layer only. -BOOL ASDisplayNodeNeedsSpecialPropertiesHandling(BOOL isSynchronous, BOOL isLayerBacked) -{ - return isSynchronous && !isLayerBacked; -} - -_ASPendingState *ASDisplayNodeGetPendingState(ASDisplayNode *node) -{ - ASLockScope(node); - _ASPendingState *result = node->_pendingViewState; - if (result == nil) { - result = [[_ASPendingState alloc] init]; - node->_pendingViewState = result; - } - return result; -} - -void StubImplementationWithNoArgs(id receiver, SEL _cmd) {} -void StubImplementationWithSizeRange(id receiver, SEL _cmd, ASSizeRange sr) {} -void StubImplementationWithTwoInterfaceStates(id receiver, SEL _cmd, ASInterfaceState s0, ASInterfaceState s1) {} - -/// Returning nil here won't trigger unwanted default actions, because we override -/// +defaultActionForKey: to return kCFNull. -id StubLayerActionImplementation(id receiver, SEL _cmd, NSString *key) { return nil; } - -/** - * Returns ASDisplayNodeFlags for the given class/instance. instance MAY BE NIL. - * - * @param c the class, required - * @param instance the instance, which may be nil. (If so, the class is inspected instead) - * @remarks The instance value is used only if we suspect the class may be dynamic (because it overloads - * +respondsToSelector: or -respondsToSelector.) In that case we use our "slow path", calling this - * method on each -init and passing the instance value. While this may seem like an unlikely scenario, - * it turns out our own internal tests use a dynamic class, so it's worth capturing this edge case. - * - * @return ASDisplayNode flags. - */ -static struct ASDisplayNodeFlags GetASDisplayNodeFlags(Class c, ASDisplayNode *instance) -{ - ASDisplayNodeCAssertNotNil(c, @"class is required"); - - struct ASDisplayNodeFlags flags = {0}; - - flags.isInHierarchy = NO; - flags.displaysAsynchronously = YES; - flags.shouldAnimateSizeChanges = YES; - flags.implementsDrawRect = ([c respondsToSelector:@selector(drawRect:withParameters:isCancelled:isRasterizing:)] ? 1 : 0); - flags.implementsImageDisplay = ([c respondsToSelector:@selector(displayWithParameters:isCancelled:)] ? 1 : 0); - if (instance) { - flags.implementsDrawParameters = ([instance respondsToSelector:@selector(drawParametersForAsyncLayer:)] ? 1 : 0); - } else { - flags.implementsDrawParameters = ([c instancesRespondToSelector:@selector(drawParametersForAsyncLayer:)] ? 1 : 0); - } - - - return flags; -} - -/** - * Returns ASDisplayNodeMethodOverrides for the given class - * - * @param c the class, required. - * - * @return ASDisplayNodeMethodOverrides. - */ -static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c) -{ - ASDisplayNodeCAssertNotNil(c, @"class is required"); - - ASDisplayNodeMethodOverrides overrides = ASDisplayNodeMethodOverrideNone; - - // Handling touches - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesBegan:withEvent:))) { - overrides |= ASDisplayNodeMethodOverrideTouchesBegan; - } - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesMoved:withEvent:))) { - overrides |= ASDisplayNodeMethodOverrideTouchesMoved; - } - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesCancelled:withEvent:))) { - overrides |= ASDisplayNodeMethodOverrideTouchesCancelled; - } - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(touchesEnded:withEvent:))) { - overrides |= ASDisplayNodeMethodOverrideTouchesEnded; - } - - // Layout related methods - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(layoutSpecThatFits:))) { - overrides |= ASDisplayNodeMethodOverrideLayoutSpecThatFits; - } - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateLayoutThatFits:)) || - ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateLayoutThatFits: - restrictedToSize: - relativeToParentSize:))) { - overrides |= ASDisplayNodeMethodOverrideCalcLayoutThatFits; - } - if (ASDisplayNodeSubclassOverridesSelector(c, @selector(calculateSizeThatFits:))) { - overrides |= ASDisplayNodeMethodOverrideCalcSizeThatFits; - } - - return overrides; -} - -+ (void)initialize -{ -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - if (self != [ASDisplayNode class]) { - - // Subclasses should never override these. Use unused to prevent warnings - __unused NSString *classString = NSStringFromClass(self); - - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedSize)), @"Subclass %@ must not override calculatedSize method.", classString); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(calculatedLayout)), @"Subclass %@ must not override calculatedLayout method.", classString); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:)), @"Subclass %@ must not override layoutThatFits: method. Instead override calculateLayoutThatFits:.", classString); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(layoutThatFits:parentSize:)), @"Subclass %@ must not override layoutThatFits:parentSize method. Instead override calculateLayoutThatFits:.", classString); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(recursivelyClearContents)), @"Subclass %@ must not override recursivelyClearContents method.", classString); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self, @selector(recursivelyClearPreloadedData)), @"Subclass %@ must not override recursivelyClearFetchedData method.", classString); - } else { - // Check if subnodes where modified during the creation of the layout - __block IMP originalLayoutSpecThatFitsIMP = ASReplaceMethodWithBlock(self, @selector(_locked_layoutElementThatFits:), ^(ASDisplayNode *_self, ASSizeRange sizeRange) { - NSArray *oldSubnodes = _self.subnodes; - ASLayoutSpec *layoutElement = ((ASLayoutSpec *( *)(id, SEL, ASSizeRange))originalLayoutSpecThatFitsIMP)(_self, @selector(_locked_layoutElementThatFits:), sizeRange); - NSArray *subnodes = _self.subnodes; - ASDisplayNodeAssert(oldSubnodes.count == subnodes.count, @"Adding or removing nodes in layoutSpecBlock or layoutSpecThatFits: is not allowed and can cause unexpected behavior."); - for (NSInteger i = 0; i < oldSubnodes.count; i++) { - ASDisplayNodeAssert(oldSubnodes[i] == subnodes[i], @"Adding or removing nodes in layoutSpecBlock or layoutSpecThatFits: is not allowed and can cause unexpected behavior."); - } - return layoutElement; - }); - } -#endif - - // Below we are pre-calculating values per-class and dynamically adding a method (_staticInitialize) to populate these values - // when each instance is constructed. These values don't change for each class, so there is significant performance benefit - // in doing it here. +initialize is guaranteed to be called before any instance method so it is safe to add this method here. - // Note that we take care to detect if the class overrides +respondsToSelector: or -respondsToSelector and take the slow path - // (recalculating for each instance) to make sure we are always correct. - - BOOL classOverridesRespondsToSelector = ASSubclassOverridesClassSelector([NSObject class], self, @selector(respondsToSelector:)); - BOOL instancesOverrideRespondsToSelector = ASSubclassOverridesSelector([NSObject class], self, @selector(respondsToSelector:)); - struct ASDisplayNodeFlags flags = GetASDisplayNodeFlags(self, nil); - ASDisplayNodeMethodOverrides methodOverrides = GetASDisplayNodeMethodOverrides(self); - - __unused Class initializeSelf = self; - - IMP staticInitialize = imp_implementationWithBlock(^(ASDisplayNode *node) { - ASDisplayNodeAssert(node.class == initializeSelf, @"Node class %@ does not have a matching _staticInitialize method; check to ensure [super initialize] is called within any custom +initialize implementations! Overridden methods will not be called unless they are also implemented by superclass %@", node.class, initializeSelf); - node->_flags = (classOverridesRespondsToSelector || instancesOverrideRespondsToSelector) ? GetASDisplayNodeFlags(node.class, node) : flags; - node->_methodOverrides = (classOverridesRespondsToSelector) ? GetASDisplayNodeMethodOverrides(node.class) : methodOverrides; - }); - - class_replaceMethod(self, @selector(_staticInitialize), staticInitialize, "v:@"); - - // Add stub implementations for global methods that the client didn't - // implement in a category. We do this instead of hard-coding empty - // implementations to avoid a linker warning when it merges categories. - // Note: addMethod will not do anything if a method already exists. - if (self == ASDisplayNode.class) { - IMP noArgsImp = (IMP)StubImplementationWithNoArgs; - class_addMethod(self, @selector(baseDidInit), noArgsImp, "v@:"); - class_addMethod(self, @selector(baseWillDealloc), noArgsImp, "v@:"); - class_addMethod(self, @selector(didLoad), noArgsImp, "v@:"); - class_addMethod(self, @selector(layoutDidFinish), noArgsImp, "v@:"); - class_addMethod(self, @selector(didEnterPreloadState), noArgsImp, "v@:"); - class_addMethod(self, @selector(didExitPreloadState), noArgsImp, "v@:"); - class_addMethod(self, @selector(didEnterDisplayState), noArgsImp, "v@:"); - class_addMethod(self, @selector(didExitDisplayState), noArgsImp, "v@:"); - class_addMethod(self, @selector(didEnterVisibleState), noArgsImp, "v@:"); - class_addMethod(self, @selector(didExitVisibleState), noArgsImp, "v@:"); - class_addMethod(self, @selector(hierarchyDisplayDidFinish), noArgsImp, "v@:"); - class_addMethod(self, @selector(calculatedLayoutDidChange), noArgsImp, "v@:"); - - auto type0 = "v@:" + std::string(@encode(ASSizeRange)); - class_addMethod(self, @selector(willCalculateLayout:), (IMP)StubImplementationWithSizeRange, type0.c_str()); - - auto interfaceStateType = std::string(@encode(ASInterfaceState)); - auto type1 = "v@:" + interfaceStateType + interfaceStateType; - class_addMethod(self, @selector(interfaceStateDidChange:fromState:), (IMP)StubImplementationWithTwoInterfaceStates, type1.c_str()); - - class_addMethod(self, @selector(layerActionForKey:), (IMP)StubLayerActionImplementation, "@@:@"); - } -} - -#if !AS_INITIALIZE_FRAMEWORK_MANUALLY -__attribute__((constructor)) static void ASLoadFrameworkInitializer(void) -{ - ASInitializeFrameworkMainThread(); -} -#endif - -+ (Class)viewClass -{ - return [_ASDisplayView class]; -} - -+ (Class)layerClass -{ - return [_ASDisplayLayer class]; -} - -#pragma mark - Lifecycle - -- (void)_staticInitialize -{ - ASDisplayNodeAssert(NO, @"_staticInitialize must be overridden"); -} - -- (void)_initializeInstance -{ - [self _staticInitialize]; - __instanceLock__.SetDebugNameWithObject(self); - - _viewClass = [self.class viewClass]; - _layerClass = [self.class layerClass]; - BOOL isSynchronous = ![_viewClass isSubclassOfClass:[_ASDisplayView class]] - || ![_layerClass isSubclassOfClass:[_ASDisplayLayer class]]; - setFlag(Synchronous, isSynchronous); - - - _contentsScaleForDisplay = ASScreenScale(); - _drawingPriority = ASDefaultTransactionPriority; - _maskedCorners = kASCACornerAllCorners; - - _primitiveTraitCollection = ASPrimitiveTraitCollectionMakeDefault(); - - _layoutVersion = 1; - - _defaultLayoutTransitionDuration = 0.2; - _defaultLayoutTransitionDelay = 0.0; - _defaultLayoutTransitionOptions = UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionTransitionNone; - - _flags.canClearContentsOfLayer = YES; - _flags.canCallSetNeedsDisplayOfLayer = YES; - - _fallbackSafeAreaInsets = UIEdgeInsetsZero; - _flags.fallbackInsetsLayoutMarginsFromSafeArea = YES; - _flags.isViewControllerRoot = NO; - - _flags.automaticallyRelayoutOnSafeAreaChanges = NO; - _flags.automaticallyRelayoutOnLayoutMarginsChanges = NO; - - [self baseDidInit]; -} - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - [self _initializeInstance]; - - return self; -} - -- (instancetype)initWithViewClass:(Class)viewClass -{ - if (!(self = [self init])) - return nil; - - ASDisplayNodeAssert([viewClass isSubclassOfClass:[UIView class]], @"should initialize with a subclass of UIView"); - - _viewClass = viewClass; - setFlag(Synchronous, ![viewClass isSubclassOfClass:[_ASDisplayView class]]); - - return self; -} - -- (instancetype)initWithLayerClass:(Class)layerClass -{ - if (!(self = [self init])) { - return nil; - } - - ASDisplayNodeAssert([layerClass isSubclassOfClass:[CALayer class]], @"should initialize with a subclass of CALayer"); - - _layerClass = layerClass; - _flags.layerBacked = YES; - setFlag(Synchronous, ![layerClass isSubclassOfClass:[_ASDisplayLayer class]]); - - return self; -} - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock -{ - return [self initWithViewBlock:viewBlock didLoadBlock:nil]; -} - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock -{ - if (!(self = [self init])) { - return nil; - } - - [self setViewBlock:viewBlock]; - if (didLoadBlock != nil) { - [self onDidLoad:didLoadBlock]; - } - - return self; -} - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock -{ - return [self initWithLayerBlock:layerBlock didLoadBlock:nil]; -} - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)layerBlock didLoadBlock:(ASDisplayNodeDidLoadBlock)didLoadBlock -{ - if (!(self = [self init])) { - return nil; - } - - [self setLayerBlock:layerBlock]; - if (didLoadBlock != nil) { - [self onDidLoad:didLoadBlock]; - } - - return self; -} - -ASSynthesizeLockingMethodsWithMutex(__instanceLock__); - -- (void)setViewBlock:(ASDisplayNodeViewBlock)viewBlock -{ - ASDisplayNodeAssertFalse(self.nodeLoaded); - ASDisplayNodeAssertNotNil(viewBlock, @"should initialize with a valid block that returns a UIView"); - - _viewBlock = viewBlock; - setFlag(Synchronous, YES); -} - -- (void)setLayerBlock:(ASDisplayNodeLayerBlock)layerBlock -{ - ASDisplayNodeAssertFalse(self.nodeLoaded); - ASDisplayNodeAssertNotNil(layerBlock, @"should initialize with a valid block that returns a CALayer"); - - _layerBlock = layerBlock; - _flags.layerBacked = YES; - setFlag(Synchronous, YES); -} - -- (ASDisplayNodeMethodOverrides)methodOverrides -{ - return _methodOverrides; -} - -- (void)onDidLoad:(ASDisplayNodeDidLoadBlock)body -{ - AS::UniqueLock l(__instanceLock__); - - if ([self _locked_isNodeLoaded]) { - ASDisplayNodeAssertThreadAffinity(self); - l.unlock(); - body(self); - return; - } else if (_onDidLoadBlocks == nil) { - _onDidLoadBlocks = [NSMutableArray arrayWithObject:body]; - } else { - [_onDidLoadBlocks addObject:body]; - } -} - - -- (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTraitCollection)previousTraitCollection -{ - if (@available(iOS 13.0, tvOS 10.0, *)) { - // When changing between light and dark mode, often the entire node needs to re-render. - // This change doesn't happen frequently so it's fairly safe to render nodes again - __instanceLock__.lock(); - BOOL loaded = _loaded(self); - ASPrimitiveTraitCollection primitiveTraitCollection = _primitiveTraitCollection; - __instanceLock__.unlock(); - if (primitiveTraitCollection.userInterfaceStyle != previousTraitCollection.userInterfaceStyle) { - if (loaded) { - // we need to run that on main thread, cause accessing CALayer properties. - // It seems than in iOS 13 sometimes it causes deadlock. - ASPerformBlockOnMainThread(^{ - self->__instanceLock__.lock(); - CGFloat cornerRadius = self->_cornerRadius; - ASCornerRoundingType cornerRoundingType = self->_cornerRoundingType; - UIColor *backgroundColor = self->_backgroundColor; - self->__instanceLock__.unlock(); - // TODO: we should resolve color using node's trait collection - // but Texture changes it from many places, so we may receive the wrong one. - CGColorRef cgBackgroundColor = backgroundColor.CGColor; - if (!CGColorEqualToColor(self->_layer.backgroundColor, cgBackgroundColor)) { - // Background colors do not dynamically update for layer backed nodes since they utilize CGColorRef - // instead of UIColor. Non layer backed node also receive color to the layer (see [_ASPendingState -applyToView:withSpecialPropertiesHandling:]). - // We utilize the _backgroundColor instance variable to track the full dynamic color - // and apply any changes here when trait collection updates occur. - self->_layer.backgroundColor = cgBackgroundColor; - } - - // If we have clipping corners, re-render the clipping corner layer upon user interface style change - if (cornerRoundingType == ASCornerRoundingTypeClipping && cornerRadius > 0.0f) { - [self _updateClipCornerLayerContentsWithRadius:cornerRadius backgroundColor:backgroundColor]; - } - - [self setNeedsDisplay]; - }); - } - } - } -} - -- (void)dealloc -{ - _flags.isDeallocating = YES; - [self baseWillDealloc]; - - // Synchronous nodes may not be able to call the hierarchy notifications, so only enforce for regular nodes. - ASDisplayNodeAssert(checkFlag(Synchronous) || !ASInterfaceStateIncludesVisible(_interfaceState), @"Node should always be marked invisible before deallocating. Node: %@", self); - - self.asyncLayer.asyncDelegate = nil; - _view.asyncdisplaykit_node = nil; - _layer.asyncdisplaykit_node = nil; - - // Remove any subnodes so they lose their connection to the now deallocated parent. This can happen - // because subnodes do not retain their supernode, but subnodes can legitimately remain alive if another - // thing outside the view hierarchy system (e.g. async display, controller code, etc). keeps a retained - // reference to subnodes. - - for (ASDisplayNode *subnode in _subnodes) - [subnode _setSupernode:nil]; - - [self scheduleIvarsForMainThreadDeallocation]; - - // TODO: Remove this? If supernode isn't already nil, this method isn't dealloc-safe anyway. - [self _setSupernode:nil]; -} - -#pragma mark - Loading - -- (BOOL)_locked_shouldLoadViewOrLayer -{ - DISABLED_ASAssertLocked(__instanceLock__); - return !_flags.isDeallocating && !(_hierarchyState & ASHierarchyStateRasterized); -} - -- (UIView *)_locked_viewToLoad -{ - DISABLED_ASAssertLocked(__instanceLock__); - - UIView *view = nil; - if (_viewBlock) { - view = _viewBlock(); - ASDisplayNodeAssertNotNil(view, @"View block returned nil"); - ASDisplayNodeAssert(![view isKindOfClass:[_ASDisplayView class]], @"View block should return a synchronously displayed view"); - _viewBlock = nil; - _viewClass = [view class]; - } else { - view = [[_viewClass alloc] init]; - } - - // Special handling of wrapping UIKit components - if (checkFlag(Synchronous)) { - [self checkResponderCompatibility]; - - // UIImageView layers. More details on the flags - if ([_viewClass isSubclassOfClass:[UIImageView class]]) { - _flags.canClearContentsOfLayer = NO; - _flags.canCallSetNeedsDisplayOfLayer = NO; - } - - // UIActivityIndicator - if ([_viewClass isSubclassOfClass:[UIActivityIndicatorView class]] - || [_viewClass isSubclassOfClass:[UIVisualEffectView class]]) { - self.opaque = NO; - } - - // CAEAGLLayer - if([[view.layer class] isSubclassOfClass:[CAEAGLLayer class]]){ - _flags.canClearContentsOfLayer = NO; - } - } - - return view; -} - -- (CALayer *)_locked_layerToLoad -{ - DISABLED_ASAssertLocked(__instanceLock__); - ASDisplayNodeAssert(_flags.layerBacked, @"_layerToLoad is only for layer-backed nodes"); - - CALayer *layer = nil; - if (_layerBlock) { - layer = _layerBlock(); - ASDisplayNodeAssertNotNil(layer, @"Layer block returned nil"); - ASDisplayNodeAssert(![layer isKindOfClass:[_ASDisplayLayer class]], @"Layer block should return a synchronously displayed layer"); - _layerBlock = nil; - _layerClass = [layer class]; - } else { - layer = [[_layerClass alloc] init]; - } - - return layer; -} - -- (void)_locked_loadViewOrLayer -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (_flags.layerBacked) { - TIME_SCOPED(_debugTimeToCreateView); - _layer = [self _locked_layerToLoad]; - static int ASLayerDelegateAssociationKey; - - /** - * CALayer's .delegate property is documented to be weak, but the implementation is actually assign. - * Because our layer may survive longer than the node (e.g. if someone else retains it, or if the node - * begins deallocation on a background thread and it waiting for the -dealloc call to reach main), the only - * way to avoid a dangling pointer is to use a weak proxy. - */ - ASWeakProxy *instance = [ASWeakProxy weakProxyWithTarget:self]; - _layer.delegate = (id)instance; - objc_setAssociatedObject(_layer, &ASLayerDelegateAssociationKey, instance, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } else { - TIME_SCOPED(_debugTimeToCreateView); - _view = [self _locked_viewToLoad]; - _view.asyncdisplaykit_node = self; - _layer = _view.layer; - } - _layer.asyncdisplaykit_node = self; - - self._locked_asyncLayer.asyncDelegate = self; -} - -- (void)_didLoad -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - as_log_verbose(ASNodeLog(), "didLoad %@", self); - TIME_SCOPED(_debugTimeForDidLoad); - - [self didLoad]; - - __instanceLock__.lock(); - const auto onDidLoadBlocks = ASTransferStrong(_onDidLoadBlocks); - __instanceLock__.unlock(); - - for (ASDisplayNodeDidLoadBlock block in onDidLoadBlocks) { - block(self); - } - [self enumerateInterfaceStateDelegates:^(id del) { - [del nodeDidLoad]; - }]; -} - -- (BOOL)isNodeLoaded -{ - if (ASDisplayNodeThreadIsMain()) { - // Because the view and layer can only be created and destroyed on Main, that is also the only thread - // where the state of this property can change. As an optimization, we can avoid locking. - return _loaded(self); - } else { - MutexLocker l(__instanceLock__); - return [self _locked_isNodeLoaded]; - } -} - -- (BOOL)_locked_isNodeLoaded -{ - DISABLED_ASAssertLocked(__instanceLock__); - return _loaded(self); -} - -#pragma mark - Misc Setter / Getter - -- (UIView *)view -{ - AS::UniqueLock l(__instanceLock__); - - ASDisplayNodeAssert(!_flags.layerBacked, @"Call to -view undefined on layer-backed nodes"); - BOOL isLayerBacked = _flags.layerBacked; - if (isLayerBacked) { - return nil; - } - - if (_view != nil) { - return _view; - } - - if (![self _locked_shouldLoadViewOrLayer]) { - return nil; - } - - // Loading a view needs to happen on the main thread - ASDisplayNodeAssertMainThread(); - [self _locked_loadViewOrLayer]; - - // FIXME: Ideally we'd call this as soon as the node receives -setNeedsLayout - // but automatic subnode management would require us to modify the node tree - // in the background on a loaded node, which isn't currently supported. - if (_pendingViewState.hasSetNeedsLayout) { - // Need to unlock before calling setNeedsLayout to avoid deadlocks. - l.unlock(); - [self __setNeedsLayout]; - l.lock(); - } - - [self _locked_applyPendingStateToViewOrLayer]; - - // The following methods should not be called with a lock - l.unlock(); - - // No need for the lock as accessing the subviews or layers are always happening on main - [self _addSubnodeViewsAndLayers]; - - // A subclass hook should never be called with a lock - [self _didLoad]; - - return _view; -} - -- (CALayer *)layer -{ - AS::UniqueLock l(__instanceLock__); - if (_layer != nil) { - return _layer; - } - - if (![self _locked_shouldLoadViewOrLayer]) { - return nil; - } - - // Loading a layer needs to happen on the main thread - ASDisplayNodeAssertMainThread(); - [self _locked_loadViewOrLayer]; - CALayer *layer = _layer; - - // FIXME: Ideally we'd call this as soon as the node receives -setNeedsLayout - // but automatic subnode management would require us to modify the node tree - // in the background on a loaded node, which isn't currently supported. - if (_pendingViewState.hasSetNeedsLayout) { - // Need to unlock before calling setNeedsLayout to avoid deadlocks. - l.unlock(); - [self __setNeedsLayout]; - l.lock(); - } - - [self _locked_applyPendingStateToViewOrLayer]; - - // The following methods should not be called with a lock - l.unlock(); - - // No need for the lock as accessing the subviews or layers are always happening on main - [self _addSubnodeViewsAndLayers]; - - // A subclass hook should never be called with a lock - [self _didLoad]; - - return layer; -} - -// Returns nil if the layer is not an _ASDisplayLayer; will not create the layer if nil. -- (_ASDisplayLayer *)asyncLayer -{ - MutexLocker l(__instanceLock__); - return [self _locked_asyncLayer]; -} - -- (_ASDisplayLayer *)_locked_asyncLayer -{ - DISABLED_ASAssertLocked(__instanceLock__); - return [_layer isKindOfClass:[_ASDisplayLayer class]] ? (_ASDisplayLayer *)_layer : nil; -} - -- (BOOL)isSynchronous -{ - return checkFlag(Synchronous); -} - -- (void)setLayerBacked:(BOOL)isLayerBacked -{ - // Only call this if assertions are enabled – it could be expensive. - ASDisplayNodeAssert(!isLayerBacked || self.supportsLayerBacking, @"Node %@ does not support layer backing.", self); - - MutexLocker l(__instanceLock__); - if (_flags.layerBacked == isLayerBacked) { - return; - } - - if ([self _locked_isNodeLoaded]) { - ASDisplayNodeFailAssert(@"Cannot change layerBacked after view/layer has loaded."); - return; - } - - _flags.layerBacked = isLayerBacked; -} - -- (BOOL)isLayerBacked -{ - MutexLocker l(__instanceLock__); - return _flags.layerBacked; -} - -- (BOOL)supportsLayerBacking -{ - MutexLocker l(__instanceLock__); - return !checkFlag(Synchronous) && !_flags.viewEverHadAGestureRecognizerAttached && _viewClass == [_ASDisplayView class] && _layerClass == [_ASDisplayLayer class]; -} - -- (BOOL)shouldAnimateSizeChanges -{ - MutexLocker l(__instanceLock__); - return _flags.shouldAnimateSizeChanges; -} - -- (void)setShouldAnimateSizeChanges:(BOOL)shouldAnimateSizeChanges -{ - MutexLocker l(__instanceLock__); - _flags.shouldAnimateSizeChanges = shouldAnimateSizeChanges; -} - -- (CGRect)threadSafeBounds -{ - MutexLocker l(__instanceLock__); - return [self _locked_threadSafeBounds]; -} - -- (CGRect)_locked_threadSafeBounds -{ - DISABLED_ASAssertLocked(__instanceLock__); - return _threadSafeBounds; -} - -- (void)setThreadSafeBounds:(CGRect)newBounds -{ - MutexLocker l(__instanceLock__); - _threadSafeBounds = newBounds; -} - -- (void)nodeViewDidAddGestureRecognizer -{ - MutexLocker l(__instanceLock__); - _flags.viewEverHadAGestureRecognizerAttached = YES; -} - -- (UIEdgeInsets)fallbackSafeAreaInsets -{ - MutexLocker l(__instanceLock__); - return _fallbackSafeAreaInsets; -} - -- (void)setFallbackSafeAreaInsets:(UIEdgeInsets)insets -{ - BOOL needsManualUpdate; - BOOL updatesLayoutMargins; - - { - MutexLocker l(__instanceLock__); - ASDisplayNodeAssertThreadAffinity(self); - - if (UIEdgeInsetsEqualToEdgeInsets(insets, _fallbackSafeAreaInsets)) { - return; - } - - _fallbackSafeAreaInsets = insets; - needsManualUpdate = !AS_AT_LEAST_IOS11 || _flags.layerBacked; - updatesLayoutMargins = needsManualUpdate && [self _locked_insetsLayoutMarginsFromSafeArea]; - } - - if (needsManualUpdate) { - [self safeAreaInsetsDidChange]; - } - - if (updatesLayoutMargins) { - [self layoutMarginsDidChange]; - } -} - -- (void)_fallbackUpdateSafeAreaOnChildren -{ - ASDisplayNodeAssertThreadAffinity(self); - - UIEdgeInsets insets = self.safeAreaInsets; - CGRect bounds = self.bounds; - - for (ASDisplayNode *child in self.subnodes) { - if (AS_AT_LEAST_IOS11 && !child.layerBacked) { - // In iOS 11 view-backed nodes already know what their safe area is. - continue; - } - - if (child.viewControllerRoot) { - // Its safe area is controlled by a view controller. Don't override it. - continue; - } - - CGRect childFrame = child.frame; - UIEdgeInsets childInsets = UIEdgeInsetsMake(MAX(insets.top - (CGRectGetMinY(childFrame) - CGRectGetMinY(bounds)), 0), - MAX(insets.left - (CGRectGetMinX(childFrame) - CGRectGetMinX(bounds)), 0), - MAX(insets.bottom - (CGRectGetMaxY(bounds) - CGRectGetMaxY(childFrame)), 0), - MAX(insets.right - (CGRectGetMaxX(bounds) - CGRectGetMaxX(childFrame)), 0)); - - child.fallbackSafeAreaInsets = childInsets; - } -} - -- (BOOL)isViewControllerRoot -{ - MutexLocker l(__instanceLock__); - return _flags.isViewControllerRoot; -} - -- (void)setViewControllerRoot:(BOOL)flag -{ - MutexLocker l(__instanceLock__); - _flags.isViewControllerRoot = flag; -} - -- (BOOL)automaticallyRelayoutOnSafeAreaChanges -{ - MutexLocker l(__instanceLock__); - return _flags.automaticallyRelayoutOnSafeAreaChanges; -} - -- (void)setAutomaticallyRelayoutOnSafeAreaChanges:(BOOL)flag -{ - MutexLocker l(__instanceLock__); - _flags.automaticallyRelayoutOnSafeAreaChanges = flag; -} - -- (BOOL)automaticallyRelayoutOnLayoutMarginsChanges -{ - MutexLocker l(__instanceLock__); - return _flags.automaticallyRelayoutOnLayoutMarginsChanges; -} - -- (void)setAutomaticallyRelayoutOnLayoutMarginsChanges:(BOOL)flag -{ - MutexLocker l(__instanceLock__); - _flags.automaticallyRelayoutOnLayoutMarginsChanges = flag; -} - -- (BOOL)placeholderEnabled -{ - MutexLocker l(__instanceLock__); - return _flags.placeholderEnabled; -} - -- (void)setPlaceholderEnabled:(BOOL)flag -{ - MutexLocker l(__instanceLock__); - _flags.placeholderEnabled = flag; -} - -- (void)__setNodeController:(ASNodeController *)controller -{ - // See docs for why we don't lock. - if (controller.shouldInvertStrongReference) { - _strongNodeController = controller; - _weakNodeController = nil; - } else { - _weakNodeController = controller; - _strongNodeController = nil; - } -} - -- (void)checkResponderCompatibility -{ -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - // There are certain cases we cannot handle and are not supported: - // 1. If the _view class is not a subclass of _ASDisplayView - if (checkFlag(Synchronous)) { - // 2. At least one UIResponder methods are overwritten in the node subclass - NSString *message = @"Overwritting %@ and having a backing view that is not an _ASDisplayView is not supported."; - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self.class, @selector(canBecomeFirstResponder)), ([NSString stringWithFormat:message, @"canBecomeFirstResponder"])); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self.class, @selector(becomeFirstResponder)), ([NSString stringWithFormat:message, @"becomeFirstResponder"])); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self.class, @selector(canResignFirstResponder)), ([NSString stringWithFormat:message, @"canResignFirstResponder"])); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self.class, @selector(resignFirstResponder)), ([NSString stringWithFormat:message, @"resignFirstResponder"])); - ASDisplayNodeAssert(!ASDisplayNodeSubclassOverridesSelector(self.class, @selector(isFirstResponder)), ([NSString stringWithFormat:message, @"isFirstResponder"])); - } -#endif -} - -#pragma mark - -- (NSString *)debugName -{ - MutexLocker l(__instanceLock__); - return _debugName; -} - -- (void)setDebugName:(NSString *)debugName -{ - MutexLocker l(__instanceLock__); - if (!ASObjectIsEqual(_debugName, debugName)) { - _debugName = [debugName copy]; - } -} - -#pragma mark - Layout - -#pragma mark - -- (BOOL)canLayoutAsynchronous -{ - return !self.isNodeLoaded; -} - -#pragma mark Layout Pass - -- (void)__setNeedsLayout -{ - [self invalidateCalculatedLayout]; -} - -- (void)invalidateCalculatedLayout -{ - MutexLocker l(__instanceLock__); - - _layoutVersion++; - - _unflattenedLayout = nil; - -#if YOGA - [self invalidateCalculatedYogaLayout]; -#endif -} - -- (void)__layout -{ - ASDisplayNodeAssertThreadAffinity(self); - DISABLED_ASAssertUnlocked(__instanceLock__); - - BOOL loaded = NO; - { - AS::UniqueLock l(__instanceLock__); - loaded = [self _locked_isNodeLoaded]; - CGRect bounds = _threadSafeBounds; - - if (CGRectEqualToRect(bounds, CGRectZero)) { - // Performing layout on a zero-bounds view often results in frame calculations - // with negative sizes after applying margins, which will cause - // layoutThatFits: on subnodes to assert. - os_log_debug(OS_LOG_DISABLED, "Warning: No size given for node before node was trying to layout itself: %@. Please provide a frame for the node.", self); - return; - } - - // If a current layout transition is in progress there is no need to do a measurement and layout pass in here as - // this is supposed to happen within the layout transition process - if (_transitionID != ASLayoutElementContextInvalidTransitionID) { - return; - } - - as_activity_create_for_scope("-[ASDisplayNode __layout]"); - - // This method will confirm that the layout is up to date (and update if needed). - // Importantly, it will also APPLY the layout to all of our subnodes if (unless parent is transitioning). - l.unlock(); - [self _u_measureNodeWithBoundsIfNecessary:bounds]; - l.lock(); - - [self _locked_layoutPlaceholderIfNecessary]; - } - - [self _layoutSublayouts]; - - // Per API contract, `-layout` and `-layoutDidFinish` are called only if the node is loaded. - if (loaded) { - ASPerformBlockOnMainThread(^{ - [self layout]; - [self _layoutClipCornersIfNeeded]; - [self _layoutDidFinish]; - }); - } - - [self _fallbackUpdateSafeAreaOnChildren]; -} - -- (void)_layoutDidFinish -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - ASDisplayNodeAssertTrue(self.isNodeLoaded); - [self layoutDidFinish]; -} - -#pragma mark Calculation - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize -{ - as_activity_scope_verbose(as_activity_create("Calculate node layout", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - as_log_verbose(ASLayoutLog(), "Calculating layout for %@ sizeRange %@", self, NSStringFromASSizeRange(constrainedSize)); - -#if AS_SIGNPOST_ENABLE - // We only want one calculateLayout signpost interval per thread. - // Currently there is no fallback for profiling i386, since it's not useful. - static _Thread_local NSInteger tls_callDepth; - if (tls_callDepth++ == 0) { - ASSignpostStart(CalculateLayout, self, "%@", ASObjectDescriptionMakeTiny(self)); - } -#endif - - ASSizeRange styleAndParentSize = ASLayoutElementSizeResolve(self.style.size, parentSize); - const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, styleAndParentSize); - ASLayout *result = [self calculateLayoutThatFits:resolvedRange]; - as_log_verbose(ASLayoutLog(), "Calculated layout %@", result); - -#if AS_SIGNPOST_ENABLE - if (--tls_callDepth == 0) { - ASSignpostEnd(CalculateLayout, self, ""); - } -#endif - - return result; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - __ASDisplayNodeCheckForLayoutMethodOverrides; - - switch (self.layoutEngineType) { - case ASLayoutEngineTypeLayoutSpec: - return [self calculateLayoutLayoutSpec:constrainedSize]; -#if YOGA - case ASLayoutEngineTypeYoga: - return [self calculateLayoutYoga:constrainedSize]; -#endif - // If YOGA is not defined but for some reason the layout type engine is Yoga - // we explicitly fallthrough here - default: - break; - } - - // If this case is reached a layout type engine was defined for a node that is currently - // not supported. - ASDisplayNodeAssert(NO, @"No layout type determined"); - return nil; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - __ASDisplayNodeCheckForLayoutMethodOverrides; - - return ASIsCGSizeValidForSize(constrainedSize) ? constrainedSize : CGSizeZero; -} - -- (void)layout -{ - // Hook for subclasses - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - ASDisplayNodeAssertTrue(self.isNodeLoaded); - [self enumerateInterfaceStateDelegates:^(id del) { - [del nodeDidLayout]; - }]; -} - -#pragma mark Layout Transition - -- (void)_layoutTransitionMeasurementDidFinish -{ - // Hook for subclasses - No-Op in ASDisplayNode -} - -#pragma mark <_ASTransitionContextCompletionDelegate> - -/** - * After completeTransition: is called on the ASContextTransitioning object in animateLayoutTransition: this - * delegate method will be called that start the completion process of the transition - */ -- (void)transitionContext:(_ASTransitionContext *)context didComplete:(BOOL)didComplete -{ - ASDisplayNodeAssertMainThread(); - - [self didCompleteLayoutTransition:context]; - - _pendingLayoutTransitionContext = nil; - - [self _pendingLayoutTransitionDidComplete]; -} - -#pragma mark - Display - -NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification = @"ASRenderingEngineDidDisplayScheduledNodes"; -NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp = @"ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp"; - -- (BOOL)displaysAsynchronously -{ - MutexLocker l(__instanceLock__); - return [self _locked_displaysAsynchronously]; -} - -/** - * Core implementation of -displaysAsynchronously. - */ -- (BOOL)_locked_displaysAsynchronously -{ - DISABLED_ASAssertLocked(__instanceLock__); - return checkFlag(Synchronous) == NO && _flags.displaysAsynchronously; -} - -- (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously -{ - ASDisplayNodeAssertThreadAffinity(self); - - MutexLocker l(__instanceLock__); - - // Can't do this for synchronous nodes (using layers that are not _ASDisplayLayer and so we can't control display prevention/cancel) - if (checkFlag(Synchronous)) { - return; - } - - if (_flags.displaysAsynchronously == displaysAsynchronously) { - return; - } - - _flags.displaysAsynchronously = displaysAsynchronously; - - self._locked_asyncLayer.displaysAsynchronously = displaysAsynchronously; -} - -- (BOOL)rasterizesSubtree -{ - MutexLocker l(__instanceLock__); - return _flags.rasterizesSubtree; -} - -- (void)enableSubtreeRasterization -{ - MutexLocker l(__instanceLock__); - // Already rasterized from self. - if (_flags.rasterizesSubtree) { - return; - } - - // If rasterized from above, bail. - if (ASHierarchyStateIncludesRasterized(_hierarchyState)) { - ASDisplayNodeFailAssert(@"Subnode of a rasterized node should not have redundant -enableSubtreeRasterization."); - return; - } - - // Ensure not loaded. - if ([self _locked_isNodeLoaded]) { - ASDisplayNodeFailAssert(@"Cannot call %@ on loaded node: %@", NSStringFromSelector(_cmd), self); - return; - } - - // Ensure no loaded subnodes - ASDisplayNode *loadedSubnode = ASDisplayNodeFindFirstSubnode(self, ^BOOL(ASDisplayNode * _Nonnull node) { - return node.nodeLoaded; - }); - if (loadedSubnode != nil) { - ASDisplayNodeFailAssert(@"Cannot call %@ on node %@ with loaded subnode %@", NSStringFromSelector(_cmd), self, loadedSubnode); - return; - } - - _flags.rasterizesSubtree = YES; - - // Tell subnodes that now they're in a rasterized hierarchy (while holding lock!) - for (ASDisplayNode *subnode in _subnodes) { - [subnode enterHierarchyState:ASHierarchyStateRasterized]; - } -} - -- (CGFloat)contentsScaleForDisplay -{ - MutexLocker l(__instanceLock__); - - return _contentsScaleForDisplay; -} - -- (void)setContentsScaleForDisplay:(CGFloat)contentsScaleForDisplay -{ - MutexLocker l(__instanceLock__); - - if (_contentsScaleForDisplay == contentsScaleForDisplay) { - return; - } - - _contentsScaleForDisplay = contentsScaleForDisplay; -} - -- (void)displayImmediately -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(!checkFlag(Synchronous), @"this method is designed for asynchronous mode only"); - - [self.asyncLayer displayImmediately]; -} - -- (void)recursivelyDisplayImmediately -{ - for (ASDisplayNode *child in self.subnodes) { - [child recursivelyDisplayImmediately]; - } - [self displayImmediately]; -} - -- (void)__setNeedsDisplay -{ - BOOL shouldScheduleForDisplay = NO; - { - MutexLocker l(__instanceLock__); - BOOL nowDisplay = ASInterfaceStateIncludesDisplay(_interfaceState); - // FIXME: This should not need to recursively display, so create a non-recursive variant. - // The semantics of setNeedsDisplay (as defined by CALayer behavior) are not recursive. - if (_layer != nil && !checkFlag(Synchronous) && nowDisplay && [self _implementsDisplay]) { - shouldScheduleForDisplay = YES; - } - } - - if (shouldScheduleForDisplay) { - [ASDisplayNode scheduleNodeForRecursiveDisplay:self]; - } -} - -+ (void)scheduleNodeForRecursiveDisplay:(ASDisplayNode *)node -{ - static dispatch_once_t onceToken; - static ASRunLoopQueue *renderQueue; - dispatch_once(&onceToken, ^{ - renderQueue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() - retainObjects:NO - handler:^(ASDisplayNode * _Nonnull dequeuedItem, BOOL isQueueDrained) { - [dequeuedItem _recursivelyTriggerDisplayAndBlock:NO]; - if (isQueueDrained) { - CFTimeInterval timestamp = CACurrentMediaTime(); - [[NSNotificationCenter defaultCenter] postNotificationName:ASRenderingEngineDidDisplayScheduledNodesNotification - object:nil - userInfo:@{ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp: @(timestamp)}]; - } - }]; - }); - - as_log_verbose(ASDisplayLog(), "%s %@", sel_getName(_cmd), node); - [renderQueue enqueue:node]; -} - -/// Helper method to summarize whether or not the node run through the display process -- (BOOL)_implementsDisplay -{ - MutexLocker l(__instanceLock__); - - return _flags.implementsDrawRect || _flags.implementsImageDisplay || _flags.rasterizesSubtree; -} - -// Track that a node will be displayed as part of the current node hierarchy. -// The node sending the message should usually be passed as the parameter, similar to the delegation pattern. -- (void)_pendingNodeWillDisplay:(ASDisplayNode *)node -{ - ASDisplayNodeAssertMainThread(); - - // No lock needed as _pendingDisplayNodes is main thread only - if (!_pendingDisplayNodes) { - _pendingDisplayNodes = [[ASWeakSet alloc] init]; - } - - [_pendingDisplayNodes addObject:node]; -} - -// Notify that a node that was pending display finished -// The node sending the message should usually be passed as the parameter, similar to the delegation pattern. -- (void)_pendingNodeDidDisplay:(ASDisplayNode *)node -{ - ASDisplayNodeAssertMainThread(); - - // No lock for _pendingDisplayNodes needed as it's main thread only - [_pendingDisplayNodes removeObject:node]; - - if (_pendingDisplayNodes.isEmpty) { - // Reclaim object memory. - _pendingDisplayNodes = nil; - - [self hierarchyDisplayDidFinish]; - [self enumerateInterfaceStateDelegates:^(id delegate) { - [delegate hierarchyDisplayDidFinish]; - }]; - - BOOL placeholderShouldPersist = [self placeholderShouldPersist]; - - __instanceLock__.lock(); - if (_placeholderLayer.superlayer && !placeholderShouldPersist) { - void (^cleanupBlock)() = ^{ - [self->_placeholderLayer removeFromSuperlayer]; - }; - - if (_placeholderFadeDuration > 0.0 && ASInterfaceStateIncludesVisible(self.interfaceState)) { - [CATransaction begin]; - [CATransaction setCompletionBlock:cleanupBlock]; - [CATransaction setAnimationDuration:_placeholderFadeDuration]; - _placeholderLayer.opacity = 0.0; - [CATransaction commit]; - } else { - cleanupBlock(); - } - } - __instanceLock__.unlock(); - } -} - -// Helper method to determine if it's safe to call setNeedsDisplay on a layer without throwing away the content. -// For details look at the comment on the canCallSetNeedsDisplayOfLayer flag -- (BOOL)_canCallSetNeedsDisplayOfLayer -{ - MutexLocker l(__instanceLock__); - return _flags.canCallSetNeedsDisplayOfLayer; -} - -void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock) -{ - // This recursion must handle layers in various states: - // 1. Just added to hierarchy, CA hasn't yet called -display - // 2. Previously in a hierarchy (such as a working window owned by an Intelligent Preloading class, like ASTableView / ASCollectionView / ASDKViewController) - // 3. Has no content to display at all - // Specifically for case 1), we need to explicitly trigger a -display call now. - // Otherwise, there is no opportunity to block the main thread after CoreAnimation's transaction commit - // (even a runloop observer at a late call order will not stop the next frame from compositing, showing placeholders). - - ASDisplayNode *node = [layer asyncdisplaykit_node]; - - if (node.isSynchronous && [node _canCallSetNeedsDisplayOfLayer]) { - // Layers for UIKit components that are wrapped within a node needs to be set to be displayed as the contents of - // the layer get's cleared and would not be recreated otherwise. - // We do not call this for _ASDisplayLayer as an optimization. - [layer setNeedsDisplay]; - } - - if ([node _implementsDisplay]) { - // For layers that do get displayed here, this immediately kicks off the work on the concurrent -[_ASDisplayLayer displayQueue]. - // At the same time, it creates an associated _ASAsyncTransaction, which we can use to block on display completion. See ASDisplayNode+AsyncDisplay.mm. - [layer displayIfNeeded]; - } - - // Kick off the recursion first, so that all necessary display calls are sent and the displayQueue is full of parallelizable work. - // NOTE: The docs report that `sublayers` returns a copy but it actually doesn't. - for (CALayer *sublayer in [layer.sublayers copy]) { - recursivelyTriggerDisplayForLayer(sublayer, shouldBlock); - } - - if (shouldBlock) { - // As the recursion unwinds, verify each transaction is complete and block if it is not. - // While blocking on one transaction, others may be completing concurrently, so it doesn't matter which blocks first. - BOOL waitUntilComplete = (!node.shouldBypassEnsureDisplay); - if (waitUntilComplete) { - for (_ASAsyncTransaction *transaction in [layer.asyncdisplaykit_asyncLayerTransactions copy]) { - // Even if none of the layers have had a chance to start display earlier, they will still be allowed to saturate a multicore CPU while blocking main. - // This significantly reduces time on the main thread relative to UIKit. - [transaction waitUntilComplete]; - } - } - } -} - -- (void)_recursivelyTriggerDisplayAndBlock:(BOOL)shouldBlock -{ - ASDisplayNodeAssertMainThread(); - - CALayer *layer = self.layer; - // -layoutIfNeeded is recursive, and even walks up to superlayers to check if they need layout, - // so we should call it outside of starting the recursion below. If our own layer is not marked - // as dirty, we can assume layout has run on this subtree before. - if ([layer needsLayout]) { - [layer layoutIfNeeded]; - } - recursivelyTriggerDisplayForLayer(layer, shouldBlock); -} - -- (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously -{ - [self _recursivelyTriggerDisplayAndBlock:synchronously]; -} - -- (void)setShouldBypassEnsureDisplay:(BOOL)shouldBypassEnsureDisplay -{ - MutexLocker l(__instanceLock__); - _flags.shouldBypassEnsureDisplay = shouldBypassEnsureDisplay; -} - -- (BOOL)shouldBypassEnsureDisplay -{ - MutexLocker l(__instanceLock__); - return _flags.shouldBypassEnsureDisplay; -} - -- (void)setNeedsDisplayAtScale:(CGFloat)contentsScale -{ - { - MutexLocker l(__instanceLock__); - if (contentsScale == _contentsScaleForDisplay) { - return; - } - - _contentsScaleForDisplay = contentsScale; - } - - [self setNeedsDisplay]; -} - -- (void)recursivelySetNeedsDisplayAtScale:(CGFloat)contentsScale -{ - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode *node) { - [node setNeedsDisplayAtScale:contentsScale]; - }); -} - -- (void)_layoutClipCornersIfNeeded -{ - ASDisplayNodeAssertMainThread(); - if (_clipCornerLayers[0] == nil && _clipCornerLayers[1] == nil && _clipCornerLayers[2] == nil && - _clipCornerLayers[3] == nil) { - return; - } - - CGSize boundsSize = self.bounds.size; - for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { - BOOL isTop = (idx == 0 || idx == 1); - BOOL isRight = (idx == 1 || idx == 3); - if (_clipCornerLayers[idx]) { - _clipCornerLayers[idx].position = CGPointMake(isRight ? boundsSize.width : 0.0, isTop ? 0.0 : boundsSize.height); - [_layer addSublayer:_clipCornerLayers[idx]]; - } - } -} - -- (void)_updateClipCornerLayerContentsWithRadius:(CGFloat)radius backgroundColor:(UIColor *)backgroundColor -{ - ASPerformBlockOnMainThread(^{ - for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { - // Skip corners that aren't clipped (we have already set up & torn down layers based on maskedCorners.) - if (self->_clipCornerLayers[idx] == nil) { - continue; - } - - // Layers are, in order: Top Left, Top Right, Bottom Left, Bottom Right, which mirrors CACornerMask. - // anchorPoint is Bottom Left at 0,0 and Top Right at 1,1. - BOOL isTop = (idx == 0 || idx == 1); - BOOL isRight = (idx == 1 || idx == 3); - - CGSize size = CGSizeMake(radius + 1, radius + 1); - UIImage *newContents = ASGraphicsCreateImage(self.primitiveTraitCollection, size, NO, self.contentsScaleForDisplay, nil, nil, ^{ - CGContextRef ctx = UIGraphicsGetCurrentContext(); - if (isRight == YES) { - CGContextTranslateCTM(ctx, -radius + 1, 0); - } - if (isTop == NO) { - CGContextTranslateCTM(ctx, 0, -radius + 1); - } - UIBezierPath *roundedRect = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, radius * 2, radius * 2) cornerRadius:radius]; - [roundedRect setUsesEvenOddFillRule:YES]; - [roundedRect appendPath:[UIBezierPath bezierPathWithRect:CGRectMake(-1, -1, radius * 2 + 1, radius * 2 + 1)]]; - [backgroundColor setFill]; - [roundedRect fill]; - }); - - // No lock needed, as _clipCornerLayers is only modified on the main thread. - unowned CALayer *clipCornerLayer = self->_clipCornerLayers[idx]; - clipCornerLayer.contents = (id)(newContents.CGImage); - clipCornerLayer.bounds = CGRectMake(0.0, 0.0, size.width, size.height); - clipCornerLayer.anchorPoint = CGPointMake(isRight ? 1.0 : 0.0, isTop ? 0.0 : 1.0); - } - [self _layoutClipCornersIfNeeded]; - }); -} - -- (void)_setClipCornerLayersVisible:(CACornerMask)visibleCornerLayers -{ - ASPerformBlockOnMainThread(^{ - ASDisplayNodeAssertMainThread(); - for (int idx = 0; idx < NUM_CLIP_CORNER_LAYERS; idx++) { - BOOL visible = (0 != (visibleCornerLayers & (1 << idx))); - if (visible == (self->_clipCornerLayers[idx] != nil)) { - continue; - } else if (visible) { - static ASDisplayNodeCornerLayerDelegate *clipCornerLayers; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - clipCornerLayers = [[ASDisplayNodeCornerLayerDelegate alloc] init]; - }); - self->_clipCornerLayers[idx] = [[CALayer alloc] init]; - self->_clipCornerLayers[idx].zPosition = 99999; - self->_clipCornerLayers[idx].delegate = clipCornerLayers; - } else { - [self->_clipCornerLayers[idx] removeFromSuperlayer]; - self->_clipCornerLayers[idx] = nil; - } - } - [self _updateClipCornerLayerContentsWithRadius:self->_cornerRadius backgroundColor:self.backgroundColor]; - }); -} - -- (void)updateCornerRoundingWithType:(ASCornerRoundingType)newRoundingType - cornerRadius:(CGFloat)newCornerRadius - maskedCorners:(CACornerMask)newMaskedCorners -{ - __instanceLock__.lock(); - CGFloat oldCornerRadius = _cornerRadius; - ASCornerRoundingType oldRoundingType = _cornerRoundingType; - CACornerMask oldMaskedCorners = _maskedCorners; - - _cornerRadius = newCornerRadius; - _cornerRoundingType = newRoundingType; - _maskedCorners = newMaskedCorners; - __instanceLock__.unlock(); - - ASPerformBlockOnMainThread(^{ - ASDisplayNodeAssertMainThread(); - - if (oldRoundingType != newRoundingType || oldCornerRadius != newCornerRadius || oldMaskedCorners != newMaskedCorners) { - if (oldRoundingType == ASCornerRoundingTypeDefaultSlowCALayer) { - if (newRoundingType == ASCornerRoundingTypePrecomposited) { - self.layerCornerRadius = 0.0; - if (oldCornerRadius > 0.0) { - [self displayImmediately]; - } else { - [self setNeedsDisplay]; // Async display is OK if we aren't replacing an existing .cornerRadius. - } - } - else if (newRoundingType == ASCornerRoundingTypeClipping) { - self.layerCornerRadius = 0.0; - [self _setClipCornerLayersVisible:newMaskedCorners]; - } else if (newRoundingType == ASCornerRoundingTypeDefaultSlowCALayer) { - self.layerCornerRadius = newCornerRadius; - self.layerMaskedCorners = newMaskedCorners; - } - } - else if (oldRoundingType == ASCornerRoundingTypePrecomposited) { - if (newRoundingType == ASCornerRoundingTypeDefaultSlowCALayer) { - self.layerCornerRadius = newCornerRadius; - self.layerMaskedCorners = newMaskedCorners; - [self setNeedsDisplay]; - } - else if (newRoundingType == ASCornerRoundingTypePrecomposited) { - // Corners are already precomposited, but the radius has changed. - // Default to async re-display. The user may force a synchronous display if desired. - [self setNeedsDisplay]; - } - else if (newRoundingType == ASCornerRoundingTypeClipping) { - [self _setClipCornerLayersVisible:newMaskedCorners]; - [self setNeedsDisplay]; - } - } - else if (oldRoundingType == ASCornerRoundingTypeClipping) { - if (newRoundingType == ASCornerRoundingTypeDefaultSlowCALayer) { - self.layerCornerRadius = newCornerRadius; - [self _setClipCornerLayersVisible:kNilOptions]; - } - else if (newRoundingType == ASCornerRoundingTypePrecomposited) { - [self _setClipCornerLayersVisible:kNilOptions]; - [self displayImmediately]; - } - else if (newRoundingType == ASCornerRoundingTypeClipping) { - // Clip corners already exist, but the radius and/or maskedCorners have changed. - // This method will add & remove them, and subsequently redraw them. - [self _setClipCornerLayersVisible:newMaskedCorners]; - } - } - } - }); -} - -- (void)updateSemanticContentAttributeWithAttribute:(UISemanticContentAttribute)attribute -{ - __instanceLock__.lock(); - UISemanticContentAttribute oldAttribute = _semanticContentAttribute; - _semanticContentAttribute = attribute; - __instanceLock__.unlock(); - - ASPerformBlockOnMainThread(^{ - // If the value has changed we should attempt to relayout. - if (attribute != oldAttribute) { - [self setNeedsLayout]; - } - }); -} - -- (void)recursivelySetDisplaySuspended:(BOOL)flag -{ - _recursivelySetDisplaySuspended(self, nil, flag); -} - -// TODO: Replace this with ASDisplayNodePerformBlockOnEveryNode or a variant with a condition / test block. -static void _recursivelySetDisplaySuspended(ASDisplayNode *node, CALayer *layer, BOOL flag) -{ - // If there is no layer, but node whose its view is loaded, then we can traverse down its layer hierarchy. Otherwise we must stick to the node hierarchy to avoid loading views prematurely. Note that for nodes that haven't loaded their views, they can't possibly have subviews/sublayers, so we don't need to traverse the layer hierarchy for them. - if (!layer && node && node.nodeLoaded) { - layer = node.layer; - } - - // If we don't know the node, but the layer is an async layer, get the node from the layer. - if (!node && layer && [layer isKindOfClass:[_ASDisplayLayer class]]) { - node = layer.asyncdisplaykit_node; - } - - // Set the flag on the node. If this is a pure layer (no node) then this has no effect (plain layers don't support preventing/cancelling display). - node.displaySuspended = flag; - - if (layer && !node.rasterizesSubtree) { - // If there is a layer, recurse down the layer hierarchy to set the flag on descendants. This will cover both layer-based and node-based children. - for (CALayer *sublayer in layer.sublayers) { - _recursivelySetDisplaySuspended(nil, sublayer, flag); - } - } else { - // If there is no layer (view not loaded yet) or this node rasterizes descendants (there won't be a layer tree to traverse), recurse down the subnode hierarchy to set the flag on descendants. This covers only node-based children, but for a node whose view is not loaded it can't possibly have nodeless children. - for (ASDisplayNode *subnode in node.subnodes) { - _recursivelySetDisplaySuspended(subnode, nil, flag); - } - } -} - -- (BOOL)displaySuspended -{ - MutexLocker l(__instanceLock__); - return _flags.displaySuspended; -} - -- (void)setDisplaySuspended:(BOOL)flag -{ - ASDisplayNodeAssertThreadAffinity(self); - __instanceLock__.lock(); - - // Can't do this for synchronous nodes (using layers that are not _ASDisplayLayer and so we can't control display prevention/cancel) - if (checkFlag(Synchronous) || _flags.displaySuspended == flag) { - __instanceLock__.unlock(); - return; - } - - _flags.displaySuspended = flag; - - self._locked_asyncLayer.displaySuspended = flag; - - ASDisplayNode *supernode = _supernode; - __instanceLock__.unlock(); - - if ([self _implementsDisplay]) { - // Display start and finish methods needs to happen on the main thread - ASPerformBlockOnMainThread(^{ - if (flag) { - [supernode subnodeDisplayDidFinish:self]; - } else { - [supernode subnodeDisplayWillStart:self]; - } - }); - } -} - -#pragma mark <_ASDisplayLayerDelegate> - -- (void)willDisplayAsyncLayer:(_ASDisplayLayer *)layer asynchronously:(BOOL)asynchronously -{ - // Subclass hook. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self displayWillStart]; -#pragma clang diagnostic pop - - [self displayWillStartAsynchronously:asynchronously]; -} - -- (void)didDisplayAsyncLayer:(_ASDisplayLayer *)layer -{ - // Subclass hook. - [self displayDidFinish]; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)displayWillStart {} -#pragma clang diagnostic pop -- (void)displayWillStartAsynchronously:(BOOL)asynchronously -{ - ASDisplayNodeAssertMainThread(); - - // in case current node takes longer to display than it's subnodes, treat it as a dependent node - [self _pendingNodeWillDisplay:self]; - - __instanceLock__.lock(); - ASDisplayNode *supernode = _supernode; - __instanceLock__.unlock(); - - [supernode subnodeDisplayWillStart:self]; -} - -- (void)displayDidFinish -{ - ASDisplayNodeAssertMainThread(); - - [self _pendingNodeDidDisplay:self]; - - __instanceLock__.lock(); - ASDisplayNode *supernode = _supernode; - __instanceLock__.unlock(); - - [supernode subnodeDisplayDidFinish:self]; -} - -- (void)subnodeDisplayWillStart:(ASDisplayNode *)subnode -{ - // Subclass hook - [self _pendingNodeWillDisplay:subnode]; -} - -- (void)subnodeDisplayDidFinish:(ASDisplayNode *)subnode -{ - // Subclass hook - [self _pendingNodeDidDisplay:subnode]; -} - -#pragma mark - -- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event -{ - // Only drive __enterHierarchy and __exitHierarchy if the node is layer-backed. - // View-backed nodes handle them in _ASDisplayView's -willMoveToWindow: and -didMoveToWindow. - if (self.isLayerBacked) { - if (event == kCAOnOrderIn) { - [self __enterHierarchy]; - } else if (event == kCAOnOrderOut) { - [self __exitHierarchy]; - } - } - - return [self layerActionForKey:event]; -} - -#pragma mark - Error Handling - -+ (void)setNonFatalErrorBlock:(ASDisplayNodeNonFatalErrorBlock)nonFatalErrorBlock -{ - if (_nonFatalErrorBlock != nonFatalErrorBlock) { - _nonFatalErrorBlock = [nonFatalErrorBlock copy]; - } -} - -+ (ASDisplayNodeNonFatalErrorBlock)nonFatalErrorBlock -{ - return _nonFatalErrorBlock; -} - -#pragma mark - Converting to and from the Node's Coordinate System - -- (CATransform3D)_transformToAncestor:(ASDisplayNode *)ancestor -{ - CATransform3D transform = CATransform3DIdentity; - ASDisplayNode *currentNode = self; - while (currentNode.supernode) { - if (currentNode == ancestor) { - return transform; - } - - CGPoint anchorPoint = currentNode.anchorPoint; - CGRect bounds = currentNode.bounds; - CGPoint position = currentNode.position; - CGPoint origin = CGPointMake(position.x - bounds.size.width * anchorPoint.x, - position.y - bounds.size.height * anchorPoint.y); - - transform = CATransform3DTranslate(transform, origin.x, origin.y, 0); - transform = CATransform3DTranslate(transform, -bounds.origin.x, -bounds.origin.y, 0); - currentNode = currentNode.supernode; - } - return transform; -} - -static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNode *referenceNode, ASDisplayNode *targetNode) -{ - ASDisplayNode *ancestor = ASDisplayNodeFindClosestCommonAncestor(referenceNode, targetNode); - - // Transform into global (away from reference coordinate space) - CATransform3D transformToGlobal = [referenceNode _transformToAncestor:ancestor]; - - // Transform into local (via inverse transform from target to ancestor) - CATransform3D transformToLocal = CATransform3DInvert([targetNode _transformToAncestor:ancestor]); - - return CATransform3DConcat(transformToGlobal, transformToLocal); -} - -- (CGPoint)convertPoint:(CGPoint)point fromNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssertThreadAffinity(self); - - /** - * When passed node=nil, all methods in this family use the UIView-style - * behavior – that is, convert from/to window coordinates if there's a window, - * otherwise return the point untransformed. - */ - if (node == nil && self.nodeLoaded) { - CALayer *layer = self.layer; - if (UIWindow *window = ASFindWindowOfLayer(layer)) { - return [layer convertPoint:point fromLayer:window.layer]; - } else { - return point; - } - } - - // Get root node of the accessible node hierarchy, if node not specified - node = node ? : ASDisplayNodeUltimateParentOfNode(self); - - // Calculate transform to map points between coordinate spaces - CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self); - CGAffineTransform flattenedTransform = CATransform3DGetAffineTransform(nodeTransform); - ASDisplayNodeAssertTrue(CATransform3DIsAffine(nodeTransform)); - - // Apply to point - return CGPointApplyAffineTransform(point, flattenedTransform); -} - -- (CGPoint)convertPoint:(CGPoint)point toNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssertThreadAffinity(self); - - if (node == nil && self.nodeLoaded) { - CALayer *layer = self.layer; - if (UIWindow *window = ASFindWindowOfLayer(layer)) { - return [layer convertPoint:point toLayer:window.layer]; - } else { - return point; - } - } - - // Get root node of the accessible node hierarchy, if node not specified - node = node ? : ASDisplayNodeUltimateParentOfNode(self); - - // Calculate transform to map points between coordinate spaces - CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node); - CGAffineTransform flattenedTransform = CATransform3DGetAffineTransform(nodeTransform); - ASDisplayNodeAssertTrue(CATransform3DIsAffine(nodeTransform)); - - // Apply to point - return CGPointApplyAffineTransform(point, flattenedTransform); -} - -- (CGRect)convertRect:(CGRect)rect fromNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssertThreadAffinity(self); - - if (node == nil && self.nodeLoaded) { - CALayer *layer = self.layer; - if (UIWindow *window = ASFindWindowOfLayer(layer)) { - return [layer convertRect:rect fromLayer:window.layer]; - } else { - return rect; - } - } - - // Get root node of the accessible node hierarchy, if node not specified - node = node ? : ASDisplayNodeUltimateParentOfNode(self); - - // Calculate transform to map points between coordinate spaces - CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self); - CGAffineTransform flattenedTransform = CATransform3DGetAffineTransform(nodeTransform); - ASDisplayNodeAssertTrue(CATransform3DIsAffine(nodeTransform)); - - // Apply to rect - return CGRectApplyAffineTransform(rect, flattenedTransform); -} - -- (CGRect)convertRect:(CGRect)rect toNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssertThreadAffinity(self); - - if (node == nil && self.nodeLoaded) { - CALayer *layer = self.layer; - if (UIWindow *window = ASFindWindowOfLayer(layer)) { - return [layer convertRect:rect toLayer:window.layer]; - } else { - return rect; - } - } - - // Get root node of the accessible node hierarchy, if node not specified - node = node ? : ASDisplayNodeUltimateParentOfNode(self); - - // Calculate transform to map points between coordinate spaces - CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node); - CGAffineTransform flattenedTransform = CATransform3DGetAffineTransform(nodeTransform); - ASDisplayNodeAssertTrue(CATransform3DIsAffine(nodeTransform)); - - // Apply to rect - return CGRectApplyAffineTransform(rect, flattenedTransform); -} - -#pragma mark - Managing the Node Hierarchy - -ASDISPLAYNODE_INLINE bool shouldDisableNotificationsForMovingBetweenParents(ASDisplayNode *from, ASDisplayNode *to) { - if (!from || !to) return NO; - if (from.isSynchronous) return NO; - if (to.isSynchronous) return NO; - if (from.isInHierarchy != to.isInHierarchy) return NO; - return YES; -} - -/// Returns incremented value of i if i is not NSNotFound -ASDISPLAYNODE_INLINE NSInteger incrementIfFound(NSInteger i) { - return i == NSNotFound ? NSNotFound : i + 1; -} - -/// Returns if a node is a member of a rasterized tree -ASDISPLAYNODE_INLINE BOOL canUseViewAPI(ASDisplayNode *node, ASDisplayNode *subnode) { - return (subnode.isLayerBacked == NO && node.isLayerBacked == NO); -} - -/// Returns if node is a member of a rasterized tree -ASDISPLAYNODE_INLINE BOOL subtreeIsRasterized(ASDisplayNode *node) { - return (node.rasterizesSubtree || (node.hierarchyState & ASHierarchyStateRasterized)); -} - -// NOTE: This method must be dealloc-safe (should not retain self). -- (ASDisplayNode *)supernode -{ - MutexLocker l(__instanceLock__); - return _supernode; -} - -- (void)_setSupernode:(ASDisplayNode *)newSupernode -{ - BOOL supernodeDidChange = NO; - ASDisplayNode *oldSupernode = nil; - { - MutexLocker l(__instanceLock__); - if (_supernode != newSupernode) { - oldSupernode = _supernode; // Access supernode properties outside of lock to avoid remote chance of deadlock, - // in case supernode implementation must access one of our properties. - _supernode = newSupernode; - supernodeDidChange = YES; - } - } - - if (supernodeDidChange) { - // Hierarchy state - ASHierarchyState stateToEnterOrExit = (newSupernode ? newSupernode.hierarchyState - : oldSupernode.hierarchyState); - - // Rasterized state - BOOL parentWasOrIsRasterized = (newSupernode ? newSupernode.rasterizesSubtree - : oldSupernode.rasterizesSubtree); - if (parentWasOrIsRasterized) { - stateToEnterOrExit |= ASHierarchyStateRasterized; - } - if (newSupernode) { - - // Now that we have a supernode, propagate its traits to self. - // This should be done before possibly forcing self to load so we have traits in -didLoad - ASTraitCollectionPropagateDown(self, newSupernode.primitiveTraitCollection); - - if (!parentWasOrIsRasterized && newSupernode.nodeLoaded) { - // Trigger the subnode to load its layer, which will create its view if it needs one. - // By doing this prior to the downward propagation of newSupernode's interface state, - // we can guarantee that -didEnterVisibleState is only called with .isNodeLoaded = YES. - [self layer]; - } - - [self enterHierarchyState:stateToEnterOrExit]; - - // If a node was added to a supernode, the supernode could be in a layout pending state. All of the hierarchy state - // properties related to the transition need to be copied over as well as propagated down the subtree. - // This is especially important as with automatic subnode management, adding subnodes can happen while a transition - // is in fly - if (ASHierarchyStateIncludesLayoutPending(stateToEnterOrExit)) { - int32_t pendingTransitionId = newSupernode->_pendingTransitionID; - if (pendingTransitionId != ASLayoutElementContextInvalidTransitionID) { - { - _pendingTransitionID = pendingTransitionId; - - // Propagate down the new pending transition id - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - node->_pendingTransitionID = pendingTransitionId; - }); - } - } - } - } else { - // If a node will be removed from the supernode it should go out from the layout pending state to remove all - // layout pending state related properties on the node - stateToEnterOrExit |= ASHierarchyStateLayoutPending; - - [self exitHierarchyState:stateToEnterOrExit]; - - // We only need to explicitly exit hierarchy here if we were rasterized. - // Otherwise we will exit the hierarchy when our view/layer does so - // which has some nice carry-over machinery to handle cases where we are removed from a hierarchy - // and then added into it again shortly after. - __instanceLock__.lock(); - BOOL isInHierarchy = _flags.isInHierarchy; - __instanceLock__.unlock(); - - if (parentWasOrIsRasterized && isInHierarchy) { - [self __exitHierarchy]; - } - } - } -} - -- (NSArray *)subnodes -{ - MutexLocker l(__instanceLock__); - if (_cachedSubnodes == nil) { - _cachedSubnodes = [_subnodes copy]; - } else { - ASDisplayNodeAssert(ASObjectIsEqual(_cachedSubnodes, _subnodes), @"Expected _subnodes and _cachedSubnodes to have the same contents."); - } - return _cachedSubnodes ?: @[]; -} - -/* - * Central private helper method that should eventually be called if submethods add, insert or replace subnodes - * This method is called with thread affinity and without lock held. - * - * @param subnode The subnode to insert - * @param subnodeIndex The index in _subnodes to insert it - * @param viewSublayerIndex The index in layer.sublayers (not view.subviews) at which to insert the view (use if we can use the view API) otherwise pass NSNotFound - * @param sublayerIndex The index in layer.sublayers at which to insert the layer (use if either parent or subnode is layer-backed) otherwise pass NSNotFound - * @param oldSubnode Remove this subnode before inserting; ok to be nil if no removal is desired - */ -- (void)_insertSubnode:(ASDisplayNode *)subnode atSubnodeIndex:(NSInteger)subnodeIndex sublayerIndex:(NSInteger)sublayerIndex andRemoveSubnode:(ASDisplayNode *)oldSubnode -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - as_log_verbose(ASNodeLog(), "Insert subnode %@ at index %zd of %@ and remove subnode %@", subnode, subnodeIndex, self, oldSubnode); - - if (subnode == nil || subnode == self) { - ASDisplayNodeFailAssert(@"Cannot insert a nil subnode or self as subnode"); - return; - } - - if (subnodeIndex == NSNotFound) { - ASDisplayNodeFailAssert(@"Try to insert node on an index that was not found"); - return; - } - - if (self.layerBacked && !subnode.layerBacked) { - ASDisplayNodeFailAssert(@"Cannot add a view-backed node as a subnode of a layer-backed node. Supernode: %@, subnode: %@", self, subnode); - return; - } - - BOOL isRasterized = subtreeIsRasterized(self); - if (isRasterized && subnode.nodeLoaded) { - ASDisplayNodeFailAssert(@"Cannot add loaded node %@ to rasterized subtree of node %@", ASObjectDescriptionMakeTiny(subnode), ASObjectDescriptionMakeTiny(self)); - return; - } - - __instanceLock__.lock(); - NSUInteger subnodesCount = _subnodes.count; - __instanceLock__.unlock(); - if (subnodeIndex > subnodesCount || subnodeIndex < 0) { - ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %ld. Count is %ld", (long)subnodeIndex, (long)subnodesCount); - return; - } - - // Disable appearance methods during move between supernodes, but make sure we restore their state after we do our thing - ASDisplayNode *oldParent = subnode.supernode; - BOOL disableNotifications = shouldDisableNotificationsForMovingBetweenParents(oldParent, self); - if (disableNotifications) { - [subnode __incrementVisibilityNotificationsDisabled]; - } - - [subnode removeFromSupernode]; - [oldSubnode removeFromSupernode]; - - __instanceLock__.lock(); - if (_subnodes == nil) { - _subnodes = [[NSMutableArray alloc] init]; - } - [_subnodes insertObject:subnode atIndex:subnodeIndex]; - _cachedSubnodes = nil; - __instanceLock__.unlock(); - - // This call will apply our .hierarchyState to the new subnode. - // If we are a managed hierarchy, as in ASCellNode trees, it will also apply our .interfaceState. - [subnode _setSupernode:self]; - - // If this subnode will be rasterized, enter hierarchy if needed - // TODO: Move this into _setSupernode: ? - if (isRasterized) { - if (self.inHierarchy) { - [subnode __enterHierarchy]; - } - } else if (self.nodeLoaded) { - // If not rasterizing, and node is loaded insert the subview/sublayer now. - [self _insertSubnodeSubviewOrSublayer:subnode atIndex:sublayerIndex]; - } // Otherwise we will insert subview/sublayer when we get loaded - - ASDisplayNodeAssert(disableNotifications == shouldDisableNotificationsForMovingBetweenParents(oldParent, self), @"Invariant violated"); - if (disableNotifications) { - [subnode __decrementVisibilityNotificationsDisabled]; - } -} - -/* - * Inserts the view or layer of the given node at the given index - * - * @param subnode The subnode to insert - * @param idx The index in _view.subviews or _layer.sublayers at which to insert the subnode.view or - * subnode.layer of the subnode - */ -- (void)_insertSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode atIndex:(NSInteger)idx -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(self.nodeLoaded, @"_insertSubnodeSubviewOrSublayer:atIndex: should never be called before our own view is created"); - - ASDisplayNodeAssert(idx != NSNotFound, @"Try to insert node on an index that was not found"); - if (idx == NSNotFound) { - return; - } - - // Because the view and layer can only be created and destroyed on Main, that is also the only thread - // where the view and layer can change. We can avoid locking. - - // If we can use view API, do. Due to an apple bug, -insertSubview:atIndex: actually wants a LAYER index, - // which we pass in. - if (canUseViewAPI(self, subnode)) { - [_view insertSubview:subnode.view atIndex:idx]; - } else { - [_layer insertSublayer:subnode.layer atIndex:(unsigned int)idx]; - } -} - -- (void)addSubnode:(ASDisplayNode *)subnode -{ - ASDisplayNodeAssertThreadAffinity(self); - - ASDisplayNodeAssert(subnode, @"Cannot insert a nil subnode"); - - // Don't add if it's already a subnode - ASDisplayNode *oldParent = subnode.supernode; - if (!subnode || subnode == self || oldParent == self) { - return; - } - - NSUInteger subnodesIndex; - NSUInteger sublayersIndex; - { - MutexLocker l(__instanceLock__); - subnodesIndex = _subnodes.count; - sublayersIndex = _layer.sublayers.count; - } - - [self _insertSubnode:subnode atSubnodeIndex:subnodesIndex sublayerIndex:sublayersIndex andRemoveSubnode:nil]; -} - -- (void)_addSubnodeViewsAndLayers -{ - ASDisplayNodeAssertMainThread(); - - TIME_SCOPED(_debugTimeToAddSubnodeViews); - - for (ASDisplayNode *node in self.subnodes) { - [self _addSubnodeSubviewOrSublayer:node]; - } -} - -- (void)_addSubnodeSubviewOrSublayer:(ASDisplayNode *)subnode -{ - ASDisplayNodeAssertMainThread(); - - // Due to a bug in Apple's framework we have to use the layer index to insert a subview - // so just use the count of the sublayers to add the subnode - NSInteger idx = _layer.sublayers.count; // No locking is needed as it's main thread only - [self _insertSubnodeSubviewOrSublayer:subnode atIndex:idx]; -} - -- (void)replaceSubnode:(ASDisplayNode *)oldSubnode withSubnode:(ASDisplayNode *)replacementSubnode -{ - ASDisplayNodeAssertThreadAffinity(self); - - if (replacementSubnode == nil) { - ASDisplayNodeFailAssert(@"Invalid subnode to replace"); - return; - } - - if (oldSubnode.supernode != self) { - ASDisplayNodeFailAssert(@"Old Subnode to replace must be a subnode"); - return; - } - - ASDisplayNodeAssert(!(self.nodeLoaded && !oldSubnode.nodeLoaded), @"We have view loaded, but child node does not."); - - NSInteger subnodeIndex; - NSInteger sublayerIndex = NSNotFound; - { - MutexLocker l(__instanceLock__); - ASDisplayNodeAssert(_subnodes, @"You should have subnodes if you have a subnode"); - - subnodeIndex = [_subnodes indexOfObjectIdenticalTo:oldSubnode]; - - // Don't bother figuring out the sublayerIndex if in a rasterized subtree, because there are no layers in the - // hierarchy and none of this could possibly work. - if (subtreeIsRasterized(self) == NO) { - if (_layer) { - sublayerIndex = [_layer.sublayers indexOfObjectIdenticalTo:oldSubnode.layer]; - ASDisplayNodeAssert(sublayerIndex != NSNotFound, @"Somehow oldSubnode's supernode is self, yet we could not find it in our layers to replace"); - if (sublayerIndex == NSNotFound) { - return; - } - } - } - } - - [self _insertSubnode:replacementSubnode atSubnodeIndex:subnodeIndex sublayerIndex:sublayerIndex andRemoveSubnode:oldSubnode]; -} - -- (void)insertSubnode:(ASDisplayNode *)subnode belowSubnode:(ASDisplayNode *)below -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - if (subnode == nil) { - ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); - return; - } - - if (below.supernode != self) { - ASDisplayNodeFailAssert(@"Node to insert below must be a subnode"); - return; - } - - NSInteger belowSubnodeIndex; - NSInteger belowSublayerIndex = NSNotFound; - { - MutexLocker l(__instanceLock__); - ASDisplayNodeAssert(_subnodes, @"You should have subnodes if you have a subnode"); - - belowSubnodeIndex = [_subnodes indexOfObjectIdenticalTo:below]; - - // Don't bother figuring out the sublayerIndex if in a rasterized subtree, because there are no layers in the - // hierarchy and none of this could possibly work. - if (subtreeIsRasterized(self) == NO) { - if (_layer) { - belowSublayerIndex = [_layer.sublayers indexOfObjectIdenticalTo:below.layer]; - ASDisplayNodeAssert(belowSublayerIndex != NSNotFound, @"Somehow below's supernode is self, yet we could not find it in our layers to reference"); - if (belowSublayerIndex == NSNotFound) - return; - } - - ASDisplayNodeAssert(belowSubnodeIndex != NSNotFound, @"Couldn't find above in subnodes"); - - // If the subnode is already in the subnodes array / sublayers and it's before the below node, removing it to - // insert it will mess up our calculation - if (subnode.supernode == self) { - NSInteger currentIndexInSubnodes = [_subnodes indexOfObjectIdenticalTo:subnode]; - if (currentIndexInSubnodes < belowSubnodeIndex) { - belowSubnodeIndex--; - } - if (_layer) { - NSInteger currentIndexInSublayers = [_layer.sublayers indexOfObjectIdenticalTo:subnode.layer]; - if (currentIndexInSublayers < belowSublayerIndex) { - belowSublayerIndex--; - } - } - } - } - } - - ASDisplayNodeAssert(belowSubnodeIndex != NSNotFound, @"Couldn't find below in subnodes"); - - [self _insertSubnode:subnode atSubnodeIndex:belowSubnodeIndex sublayerIndex:belowSublayerIndex andRemoveSubnode:nil]; -} - -- (void)insertSubnode:(ASDisplayNode *)subnode aboveSubnode:(ASDisplayNode *)above -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - if (subnode == nil) { - ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); - return; - } - - if (above.supernode != self) { - ASDisplayNodeFailAssert(@"Node to insert above must be a subnode"); - return; - } - - NSInteger aboveSubnodeIndex; - NSInteger aboveSublayerIndex = NSNotFound; - { - MutexLocker l(__instanceLock__); - ASDisplayNodeAssert(_subnodes, @"You should have subnodes if you have a subnode"); - - aboveSubnodeIndex = [_subnodes indexOfObjectIdenticalTo:above]; - - // Don't bother figuring out the sublayerIndex if in a rasterized subtree, because there are no layers in the - // hierarchy and none of this could possibly work. - if (subtreeIsRasterized(self) == NO) { - if (_layer) { - aboveSublayerIndex = [_layer.sublayers indexOfObjectIdenticalTo:above.layer]; - ASDisplayNodeAssert(aboveSublayerIndex != NSNotFound, @"Somehow above's supernode is self, yet we could not find it in our layers to replace"); - if (aboveSublayerIndex == NSNotFound) - return; - } - - ASDisplayNodeAssert(aboveSubnodeIndex != NSNotFound, @"Couldn't find above in subnodes"); - - // If the subnode is already in the subnodes array / sublayers and it's before the below node, removing it to - // insert it will mess up our calculation - if (subnode.supernode == self) { - NSInteger currentIndexInSubnodes = [_subnodes indexOfObjectIdenticalTo:subnode]; - if (currentIndexInSubnodes <= aboveSubnodeIndex) { - aboveSubnodeIndex--; - } - if (_layer) { - NSInteger currentIndexInSublayers = [_layer.sublayers indexOfObjectIdenticalTo:subnode.layer]; - if (currentIndexInSublayers <= aboveSublayerIndex) { - aboveSublayerIndex--; - } - } - } - } - } - - [self _insertSubnode:subnode atSubnodeIndex:incrementIfFound(aboveSubnodeIndex) sublayerIndex:incrementIfFound(aboveSublayerIndex) andRemoveSubnode:nil]; -} - -- (void)insertSubnode:(ASDisplayNode *)subnode atIndex:(NSInteger)idx -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - if (subnode == nil) { - ASDisplayNodeFailAssert(@"Cannot insert a nil subnode"); - return; - } - - NSInteger sublayerIndex = NSNotFound; - { - MutexLocker l(__instanceLock__); - - if (idx > _subnodes.count || idx < 0) { - ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %ld. Count is %ld", (long)idx, (long)_subnodes.count); - return; - } - - // Don't bother figuring out the sublayerIndex if in a rasterized subtree, because there are no layers in the - // hierarchy and none of this could possibly work. - if (subtreeIsRasterized(self) == NO) { - // Account for potentially having other subviews - if (_layer && idx == 0) { - sublayerIndex = 0; - } else if (_layer) { - ASDisplayNode *positionInRelationTo = (_subnodes.count > 0 && idx > 0) ? _subnodes[idx - 1] : nil; - if (positionInRelationTo) { - sublayerIndex = incrementIfFound([_layer.sublayers indexOfObjectIdenticalTo:positionInRelationTo.layer]); - } - } - } - } - - [self _insertSubnode:subnode atSubnodeIndex:idx sublayerIndex:sublayerIndex andRemoveSubnode:nil]; -} - -- (void)_removeSubnode:(ASDisplayNode *)subnode -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - // Don't call self.supernode here because that will retain/autorelease the supernode. This method -_removeSupernode: is often called while tearing down a node hierarchy, and the supernode in question might be in the middle of its -dealloc. The supernode is never messaged, only compared by value, so this is safe. - // The particular issue that triggers this edge case is when a node calls -removeFromSupernode on a subnode from within its own -dealloc method. - if (!subnode || subnode.supernode != self) { - return; - } - - __instanceLock__.lock(); - [_subnodes removeObjectIdenticalTo:subnode]; - _cachedSubnodes = nil; - __instanceLock__.unlock(); - - [subnode _setSupernode:nil]; -} - -- (void)removeFromSupernode -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - __instanceLock__.lock(); - __weak ASDisplayNode *supernode = _supernode; - __weak UIView *view = _view; - __weak CALayer *layer = _layer; - __instanceLock__.unlock(); - - [self _removeFromSupernode:supernode view:view layer:layer]; -} - -- (void)_removeFromSupernodeIfEqualTo:(ASDisplayNode *)supernode -{ - ASDisplayNodeAssertThreadAffinity(self); - // TODO: Disabled due to PR: https://github.com/TextureGroup/Texture/pull/1204 - DISABLED_ASAssertUnlocked(__instanceLock__); - - __instanceLock__.lock(); - - // Only remove if supernode is still the expected supernode - if (!ASObjectIsEqual(_supernode, supernode)) { - __instanceLock__.unlock(); - return; - } - - __weak UIView *view = _view; - __weak CALayer *layer = _layer; - __instanceLock__.unlock(); - - [self _removeFromSupernode:supernode view:view layer:layer]; -} - -- (void)_removeFromSupernode:(ASDisplayNode *)supernode view:(UIView *)view layer:(CALayer *)layer -{ - // Note: we continue even if supernode is nil to ensure view/layer are removed from hierarchy. - - if (supernode != nil) { - as_log_verbose(ASNodeLog(), "Remove %@ from supernode %@", self, supernode); - } - - // Clear supernode's reference to us before removing the view from the hierarchy, as _ASDisplayView - // will trigger us to clear our _supernode pointer in willMoveToSuperview:nil. - // This may result in removing the last strong reference, triggering deallocation after this method. - [supernode _removeSubnode:self]; - - if (view != nil) { - [view removeFromSuperview]; - } else if (layer != nil) { - [layer removeFromSuperlayer]; - } -} - -#pragma mark - Visibility API - -- (BOOL)__visibilityNotificationsDisabled -{ - // Currently, this method is only used by the testing infrastructure to verify this internal feature. - MutexLocker l(__instanceLock__); - return _flags.visibilityNotificationsDisabled > 0; -} - -- (BOOL)__selfOrParentHasVisibilityNotificationsDisabled -{ - MutexLocker l(__instanceLock__); - return (_hierarchyState & ASHierarchyStateTransitioningSupernodes); -} - -- (void)__incrementVisibilityNotificationsDisabled -{ - __instanceLock__.lock(); - const size_t maxVisibilityIncrement = (1ULL< 0, @"Can't decrement past 0"); - if (_flags.visibilityNotificationsDisabled > 0) { - _flags.visibilityNotificationsDisabled--; - } - BOOL visibilityNotificationsDisabled = (_flags.visibilityNotificationsDisabled == 0); - __instanceLock__.unlock(); - - if (visibilityNotificationsDisabled) { - // Must have just transitioned from 1 to 0. Notify all subnodes that we are no longer in a disabled state. - // FIXME: This system should be revisited when refactoring and consolidating the implementation of the - // addSubnode: and insertSubnode:... methods. As implemented, though logically irrelevant for expected use cases, - // multiple nodes in the subtree below may have a non-zero visibilityNotification count and still have - // the ASHierarchyState bit cleared (the only value checked when reading this state). - [self exitHierarchyState:ASHierarchyStateTransitioningSupernodes]; - } -} - -#pragma mark - Placeholder - -- (void)_locked_layoutPlaceholderIfNecessary -{ - DISABLED_ASAssertLocked(__instanceLock__); - if ([self _locked_shouldHavePlaceholderLayer]) { - [self _locked_setupPlaceholderLayerIfNeeded]; - } - // Update the placeholderLayer size in case the node size has changed since the placeholder was added. - _placeholderLayer.frame = self.threadSafeBounds; -} - -- (BOOL)_locked_shouldHavePlaceholderLayer -{ - DISABLED_ASAssertLocked(__instanceLock__); - return (_flags.placeholderEnabled && [self _implementsDisplay]); -} - -- (void)_locked_setupPlaceholderLayerIfNeeded -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertLocked(__instanceLock__); - - if (!_placeholderLayer) { - _placeholderLayer = [CALayer layer]; - // do not set to CGFLOAT_MAX in the case that something needs to be overtop the placeholder - _placeholderLayer.zPosition = 9999.0; - } - - if (_placeholderLayer.contents == nil) { - if (!_placeholderImage) { - _placeholderImage = [self placeholderImage]; - } - if (_placeholderImage) { - BOOL stretchable = !UIEdgeInsetsEqualToEdgeInsets(_placeholderImage.capInsets, UIEdgeInsetsZero); - if (stretchable) { - ASDisplayNodeSetResizableContents(_placeholderLayer, _placeholderImage); - } else { - _placeholderLayer.contentsScale = self.contentsScale; - _placeholderLayer.contents = (id)_placeholderImage.CGImage; - } - } - } -} - -- (UIImage *)placeholderImage -{ - // Subclass hook - return nil; -} - -- (BOOL)placeholderShouldPersist -{ - // Subclass hook - return NO; -} - -#pragma mark - Hierarchy State - -- (BOOL)isInHierarchy -{ - MutexLocker l(__instanceLock__); - return _flags.isInHierarchy; -} - -- (void)__enterHierarchy -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"Should not cause recursive __enterHierarchy"); - - // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. - __instanceLock__.lock(); - - if (!_flags.isInHierarchy && !_flags.visibilityNotificationsDisabled && ![self __selfOrParentHasVisibilityNotificationsDisabled]) { - _flags.isEnteringHierarchy = YES; - _flags.isInHierarchy = YES; - - // Don't call -willEnterHierarchy while holding __instanceLock__. - // This method and subsequent ones (i.e -interfaceState and didEnter(.*)State) - // don't expect that they are called while the lock is being held. - // More importantly, didEnter(.*)State methods are meant to be overriden by clients. - // And so they can potentially walk up the node tree and cause deadlocks, or do expensive tasks and cause the lock to be held for too long. - __instanceLock__.unlock(); - [self willEnterHierarchy]; - for (ASDisplayNode *subnode in self.subnodes) { - [subnode __enterHierarchy]; - } - __instanceLock__.lock(); - - _flags.isEnteringHierarchy = NO; - - // If we don't have contents finished drawing by the time we are on screen, immediately add the placeholder (if it is enabled and we do have something to draw). - if (self.contents == nil) { - CALayer *layer = self.layer; - [layer setNeedsDisplay]; - - if ([self _locked_shouldHavePlaceholderLayer]) { - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - [self _locked_setupPlaceholderLayerIfNeeded]; - _placeholderLayer.opacity = 1.0; - [CATransaction commit]; - [layer addSublayer:_placeholderLayer]; - } - } - } - - __instanceLock__.unlock(); - - [self didEnterHierarchy]; -} - -- (void)__exitHierarchy -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"Should not cause recursive __exitHierarchy"); - - // Profiling has shown that locking this method is beneficial, so each of the property accesses don't have to lock and unlock. - __instanceLock__.lock(); - - if (_flags.isInHierarchy && !_flags.visibilityNotificationsDisabled && ![self __selfOrParentHasVisibilityNotificationsDisabled]) { - _flags.isExitingHierarchy = YES; - _flags.isInHierarchy = NO; - - // Don't call -didExitHierarchy while holding __instanceLock__. - // This method and subsequent ones (i.e -interfaceState and didExit(.*)State) - // don't expect that they are called while the lock is being held. - // More importantly, didExit(.*)State methods are meant to be overriden by clients. - // And so they can potentially walk up the node tree and cause deadlocks, or do expensive tasks and cause the lock to be held for too long. - __instanceLock__.unlock(); - [self didExitHierarchy]; - for (ASDisplayNode *subnode in self.subnodes) { - [subnode __exitHierarchy]; - } - __instanceLock__.lock(); - - _flags.isExitingHierarchy = NO; - } - - __instanceLock__.unlock(); -} - -- (void)enterHierarchyState:(ASHierarchyState)hierarchyState -{ - if (hierarchyState == ASHierarchyStateNormal) { - return; // This method is a no-op with a 0-bitfield argument, so don't bother recursing. - } - - ASDisplayNodePerformBlockOnEveryNode(nil, self, NO, ^(ASDisplayNode *node) { - node.hierarchyState |= hierarchyState; - }); -} - -- (void)exitHierarchyState:(ASHierarchyState)hierarchyState -{ - if (hierarchyState == ASHierarchyStateNormal) { - return; // This method is a no-op with a 0-bitfield argument, so don't bother recursing. - } - ASDisplayNodePerformBlockOnEveryNode(nil, self, NO, ^(ASDisplayNode *node) { - node.hierarchyState &= (~hierarchyState); - }); -} - -- (ASHierarchyState)hierarchyState -{ - MutexLocker l(__instanceLock__); - return _hierarchyState; -} - -- (void)setHierarchyState:(ASHierarchyState)newState -{ - ASHierarchyState oldState = ASHierarchyStateNormal; - { - MutexLocker l(__instanceLock__); - if (_hierarchyState == newState) { - return; - } - oldState = _hierarchyState; - _hierarchyState = newState; - } - - // Entered rasterization state. - if (newState & ASHierarchyStateRasterized) { - ASDisplayNodeAssert(checkFlag(Synchronous) == NO, @"Node created using -initWithViewBlock:/-initWithLayerBlock: cannot be added to subtree of node with subtree rasterization enabled. Node: %@", self); - } - - // Entered or exited range managed state. - if ((newState & ASHierarchyStateRangeManaged) != (oldState & ASHierarchyStateRangeManaged)) { - if (newState & ASHierarchyStateRangeManaged) { - [self enterInterfaceState:self.supernode.pendingInterfaceState]; - } else { - // The case of exiting a range-managed state should be fairly rare. Adding or removing the node - // to a view hierarchy will cause its interfaceState to be either fully set or unset (all fields), - // but because we might be about to be added to a view hierarchy, exiting the interface state now - // would cause inefficient churn. The tradeoff is that we may not clear contents / fetched data - // for nodes that are removed from a managed state and then retained but not used (bad idea anyway!) - } - } - - if ((newState & ASHierarchyStateLayoutPending) != (oldState & ASHierarchyStateLayoutPending)) { - if (newState & ASHierarchyStateLayoutPending) { - // Entering layout pending state - } else { - // Leaving layout pending state, reset related properties - MutexLocker l(__instanceLock__); - _pendingTransitionID = ASLayoutElementContextInvalidTransitionID; - _pendingLayoutTransition = nil; - } - } - - as_log_verbose(ASNodeLog(), "%s%@ %@", sel_getName(_cmd), NSStringFromASHierarchyStateChange(oldState, newState), self); -} - -- (void)willEnterHierarchy -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(_flags.isEnteringHierarchy, @"You should never call -willEnterHierarchy directly. Appearance is automatically managed by ASDisplayNode"); - ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - DISABLED_ASAssertUnlocked(__instanceLock__); - - if (![self supportsRangeManagedInterfaceState]) { - self.interfaceState = ASInterfaceStateInHierarchy; - } else if (ASCATransactionQueueGet().enabled) { - __instanceLock__.lock(); - ASInterfaceState state = _preExitingInterfaceState; - _preExitingInterfaceState = ASInterfaceStateNone; - __instanceLock__.unlock(); - // Layer thrash happened, revert to before exiting. - if (state != ASInterfaceStateNone) { - self.interfaceState = state; - } - } -} - -- (void)didEnterHierarchy { - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"You should never call -didEnterHierarchy directly. Appearance is automatically managed by ASDisplayNode"); - ASDisplayNodeAssert(!_flags.isExitingHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - ASDisplayNodeAssert(_flags.isInHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - DISABLED_ASAssertUnlocked(__instanceLock__); - - [self enumerateInterfaceStateDelegates:^(id del) { - if ([del respondsToSelector:@selector(didEnterHierarchy)]) { - [del didEnterHierarchy]; - } - }]; -} - -- (void)didExitHierarchy -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(_flags.isExitingHierarchy, @"You should never call -didExitHierarchy directly. Appearance is automatically managed by ASDisplayNode"); - ASDisplayNodeAssert(!_flags.isEnteringHierarchy, @"ASDisplayNode inconsistency. __enterHierarchy and __exitHierarchy are mutually exclusive"); - DISABLED_ASAssertUnlocked(__instanceLock__); - - [self enumerateInterfaceStateDelegates:^(id del) { - if ([del respondsToSelector:@selector(didExitHierarchy)]) { - [del didExitHierarchy]; - } - }]; - - // This case is important when tearing down hierarchies. We must deliver a visibileStateDidChange:NO callback, as part our API guarantee that this method can be used for - // things like data analytics about user content viewing. We cannot call the method in the dealloc as any incidental retain operations in client code would fail. - // Additionally, it may be that a Standard UIView which is containing us is moving between hierarchies, and we should not send the call if we will be re-added in the - // same runloop. Strategy: strong reference (might be the last!), wait one runloop, and confirm we are still outside the hierarchy (both layer-backed and view-backed). - // TODO: This approach could be optimized by only performing the dispatch for root elements + recursively apply the interface state change. This would require a closer - // integration with _ASDisplayLayer to ensure that the superlayer pointer has been cleared by this stage (to check if we are root or not), or a different delegate call. - -#if !ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR - if (![self supportsRangeManagedInterfaceState]) { - self.interfaceState = ASInterfaceStateNone; - return; - } -#endif - if (ASInterfaceStateIncludesVisible(self.pendingInterfaceState)) { - void(^exitVisibleInterfaceState)(void) = ^{ - // This block intentionally retains self. - self->__instanceLock__.lock(); - unsigned isStillInHierarchy = self->_flags.isInHierarchy; - BOOL isVisible = ASInterfaceStateIncludesVisible(self->_pendingInterfaceState); - ASInterfaceState newState = (self->_pendingInterfaceState & ~ASInterfaceStateVisible); - // layer may be thrashed, we need to remember the state so we can reset if it enters in same runloop later. - self->_preExitingInterfaceState = self->_pendingInterfaceState; - self->__instanceLock__.unlock(); - if (!isStillInHierarchy && isVisible) { -#if ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR - if (![self supportsRangeManagedInterfaceState]) { - newState = ASInterfaceStateNone; - } -#endif - self.interfaceState = newState; - } - }; - - if (!ASCATransactionQueueGet().enabled) { - dispatch_async(dispatch_get_main_queue(), exitVisibleInterfaceState); - } else { - exitVisibleInterfaceState(); - } - } -} - -#pragma mark - Interface State - -/** - * We currently only set interface state on nodes in table/collection views. For other nodes, if they are - * in the hierarchy we enable all ASInterfaceState types with `ASInterfaceStateInHierarchy`, otherwise `None`. - */ -- (BOOL)supportsRangeManagedInterfaceState -{ - MutexLocker l(__instanceLock__); - return ASHierarchyStateIncludesRangeManaged(_hierarchyState); -} - -- (void)enterInterfaceState:(ASInterfaceState)interfaceState -{ - if (interfaceState == ASInterfaceStateNone) { - return; // This method is a no-op with a 0-bitfield argument, so don't bother recursing. - } - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode *node) { - node.interfaceState |= interfaceState; - }); -} - -- (void)exitInterfaceState:(ASInterfaceState)interfaceState -{ - if (interfaceState == ASInterfaceStateNone) { - return; // This method is a no-op with a 0-bitfield argument, so don't bother recursing. - } - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode *node) { - node.interfaceState &= (~interfaceState); - }); -} - -- (void)recursivelySetInterfaceState:(ASInterfaceState)newInterfaceState -{ - as_activity_create_for_scope("Recursively set interface state"); - - // Instead of each node in the recursion assuming it needs to schedule itself for display, - // setInterfaceState: skips this when handling range-managed nodes (our whole subtree has this set). - // If our range manager intends for us to be displayed right now, and didn't before, get started! - BOOL shouldScheduleDisplay = [self supportsRangeManagedInterfaceState] && [self shouldScheduleDisplayWithNewInterfaceState:newInterfaceState]; - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode *node) { - node.interfaceState = newInterfaceState; - }); - if (shouldScheduleDisplay) { - [ASDisplayNode scheduleNodeForRecursiveDisplay:self]; - } -} - -- (ASInterfaceState)interfaceState -{ - MutexLocker l(__instanceLock__); - return _interfaceState; -} - -- (void)setInterfaceState:(ASInterfaceState)newState -{ - if (!ASCATransactionQueueGet().enabled) { - [self applyPendingInterfaceState:newState]; - } else { - MutexLocker l(__instanceLock__); - if (_pendingInterfaceState != newState) { - _pendingInterfaceState = newState; - [ASCATransactionQueueGet() enqueue:self]; - } - } -} - -- (ASInterfaceState)pendingInterfaceState -{ - MutexLocker l(__instanceLock__); - return _pendingInterfaceState; -} - -- (void)applyPendingInterfaceState:(ASInterfaceState)newPendingState -{ - //This method is currently called on the main thread. The assert has been added here because all of the - //did(Enter|Exit)(Display|Visible|Preload)State methods currently guarantee calling on main. - ASDisplayNodeAssertMainThread(); - - // This method manages __instanceLock__ itself, to ensure the lock is not held while didEnter/Exit(.*)State methods are called, thus avoid potential deadlocks - DISABLED_ASAssertUnlocked(__instanceLock__); - - ASInterfaceState oldState = ASInterfaceStateNone; - ASInterfaceState newState = ASInterfaceStateNone; - { - MutexLocker l(__instanceLock__); - // newPendingState will not be used when ASCATransactionQueue is enabled - // and use _pendingInterfaceState instead for interfaceState update. - if (!ASCATransactionQueueGet().enabled) { - _pendingInterfaceState = newPendingState; - } - oldState = _interfaceState; - newState = _pendingInterfaceState; - if (newState == oldState) { - return; - } - _interfaceState = newState; - _preExitingInterfaceState = ASInterfaceStateNone; - } - - // It should never be possible for a node to be visible but not be allowed / expected to display. - ASDisplayNodeAssertFalse(ASInterfaceStateIncludesVisible(newState) && !ASInterfaceStateIncludesDisplay(newState)); - - // TODO: Trigger asynchronous measurement if it is not already cached or being calculated. - // if ((newState & ASInterfaceStateMeasureLayout) != (oldState & ASInterfaceStateMeasureLayout)) { - // } - - // For the Preload and Display ranges, we don't want to call -clear* if not being managed by a range controller. - // Otherwise we get flashing behavior from normal UIKit manipulations like navigation controller push / pop. - // Still, the interfaceState should be updated to the current state of the node; just don't act on the transition. - - // Entered or exited data loading state. - BOOL nowPreload = ASInterfaceStateIncludesPreload(newState); - BOOL wasPreload = ASInterfaceStateIncludesPreload(oldState); - - if (nowPreload != wasPreload) { - if (nowPreload) { - [self _didEnterPreloadState]; - } else { - // We don't want to call -didExitPreloadState on nodes that aren't being managed by a range controller. - // Otherwise we get flashing behavior from normal UIKit manipulations like navigation controller push / pop. - if ([self supportsRangeManagedInterfaceState]) { - [self _didExitPreloadState]; - } - } - } - - // Entered or exited contents rendering state. - BOOL nowDisplay = ASInterfaceStateIncludesDisplay(newState); - BOOL wasDisplay = ASInterfaceStateIncludesDisplay(oldState); - - if (nowDisplay != wasDisplay) { - if ([self supportsRangeManagedInterfaceState]) { - if (nowDisplay) { - // Once the working window is eliminated (ASRangeHandlerRender), trigger display directly here. - [self setDisplaySuspended:NO]; - } else { - [self setDisplaySuspended:YES]; - //schedule clear contents on next runloop - dispatch_async(dispatch_get_main_queue(), ^{ - self->__instanceLock__.lock(); - ASInterfaceState interfaceState = self->_interfaceState; - self->__instanceLock__.unlock(); - if (ASInterfaceStateIncludesDisplay(interfaceState) == NO) { - [self clearContents]; - } - }); - } - } else { - // NOTE: This case isn't currently supported as setInterfaceState: isn't exposed externally, and all - // internal use cases are range-managed. When a node is visible, don't mess with display - CA will start it. - if (!ASInterfaceStateIncludesVisible(newState)) { - // Check _implementsDisplay purely for efficiency - it's faster even than calling -asyncLayer. - if ([self _implementsDisplay]) { - if (nowDisplay) { - [ASDisplayNode scheduleNodeForRecursiveDisplay:self]; - } else { - [[self asyncLayer] cancelAsyncDisplay]; - //schedule clear contents on next runloop - dispatch_async(dispatch_get_main_queue(), ^{ - self->__instanceLock__.lock(); - ASInterfaceState interfaceState = self->_interfaceState; - self->__instanceLock__.unlock(); - if (ASInterfaceStateIncludesDisplay(interfaceState) == NO) { - [self clearContents]; - } - }); - } - } - } - } - - if (nowDisplay) { - [self _didEnterDisplayState]; - } else { - [self _didExitDisplayState]; - } - } - - // Became visible or invisible. When range-managed, this represents literal visibility - at least one pixel - // is onscreen. If not range-managed, we can't guarantee more than the node being present in an onscreen window. - BOOL nowVisible = ASInterfaceStateIncludesVisible(newState); - BOOL wasVisible = ASInterfaceStateIncludesVisible(oldState); - - if (nowVisible != wasVisible) { - if (nowVisible) { - [self _didEnterVisibleState]; - } else { - [self _didExitVisibleState]; - } - } - - // Log this change, unless it's just the node going from {} -> {Measure} because that change happens - // for all cell nodes and it isn't currently meaningful. - BOOL measureChangeOnly = ((oldState | newState) == ASInterfaceStateMeasureLayout); - if (!measureChangeOnly) { - as_log_verbose(ASNodeLog(), "%s %@ %@", sel_getName(_cmd), NSStringFromASInterfaceStateChange(oldState, newState), self); - } - - [self _interfaceStateDidChange:newState fromState:oldState]; -} - -- (void)prepareForCATransactionCommit -{ - // Apply _pendingInterfaceState actual _interfaceState, note that ASInterfaceStateNone is not used. - [self applyPendingInterfaceState:ASInterfaceStateNone]; -} - -- (void)_interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState -{ - DISABLED_ASAssertUnlocked(__instanceLock__); - ASDisplayNodeAssertMainThread(); - [self interfaceStateDidChange:newState fromState:oldState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del interfaceStateDidChange:newState fromState:oldState]; - }]; -} - -- (BOOL)shouldScheduleDisplayWithNewInterfaceState:(ASInterfaceState)newInterfaceState -{ - BOOL willDisplay = ASInterfaceStateIncludesDisplay(newInterfaceState); - BOOL nowDisplay = ASInterfaceStateIncludesDisplay(self.interfaceState); - return willDisplay && (willDisplay != nowDisplay); -} - -- (void)addInterfaceStateDelegate:(id )interfaceStateDelegate -{ - MutexLocker l(__instanceLock__); - _flags.hasHadInterfaceStateDelegates = YES; - for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { - if (_interfaceStateDelegates[i] == nil) { - _interfaceStateDelegates[i] = interfaceStateDelegate; - return; - } - } - ASDisplayNodeFailAssert(@"Exceeded interface state delegate limit: %d", AS_MAX_INTERFACE_STATE_DELEGATES); -} - -- (void)removeInterfaceStateDelegate:(id )interfaceStateDelegate -{ - MutexLocker l(__instanceLock__); - for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { - if (_interfaceStateDelegates[i] == interfaceStateDelegate) { - _interfaceStateDelegates[i] = nil; - break; - } - } -} - -- (BOOL)isVisible -{ - MutexLocker l(__instanceLock__); - return ASInterfaceStateIncludesVisible(_interfaceState); -} - -- (void)_didEnterVisibleState -{ - ASDisplayNodeAssertMainThread(); - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - // Rasterized node's loading state is merged with root node of rasterized tree. - if (!(self.hierarchyState & ASHierarchyStateRasterized)) { - ASDisplayNodeAssert(self.isNodeLoaded, @"Node should be loaded before entering visible state."); - } -#endif - - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didEnterVisibleState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del didEnterVisibleState]; - }]; - -#if AS_ENABLE_TIPS - [ASTipsController.shared nodeDidAppear:self]; -#endif -} - -- (void)_didExitVisibleState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didExitVisibleState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del didExitVisibleState]; - }]; -} - -- (BOOL)isInDisplayState -{ - MutexLocker l(__instanceLock__); - return ASInterfaceStateIncludesDisplay(_interfaceState); -} - -- (void)_didEnterDisplayState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didEnterDisplayState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del didEnterDisplayState]; - }]; -} - -- (void)_didExitDisplayState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didExitDisplayState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del didExitDisplayState]; - }]; -} - -- (BOOL)isInPreloadState -{ - MutexLocker l(__instanceLock__); - return ASInterfaceStateIncludesPreload(_interfaceState); -} - -- (void)setNeedsPreload -{ - if (self.isInPreloadState) { - [self recursivelyPreload]; - } -} - -- (void)recursivelyPreload -{ - ASPerformBlockOnMainThread(^{ - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode * _Nonnull node) { - [node didEnterPreloadState]; - }); - }); -} - -- (void)recursivelyClearPreloadedData -{ - ASPerformBlockOnMainThread(^{ - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode * _Nonnull node) { - [node didExitPreloadState]; - }); - }); -} - -- (void)_didEnterPreloadState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didEnterPreloadState]; - - // If this node has ASM enabled and is not yet visible, force a layout pass to apply its applicable pending layout, if any, - // so that its subnodes are inserted/deleted and start preloading right away. - // - // - If it has an up-to-date layout (and subnodes), calling -layoutIfNeeded will be fast. - // - // - If it doesn't have a calculated or pending layout that fits its current bounds, a measurement pass will occur - // (see -__layout and -_u_measureNodeWithBoundsIfNecessary:). This scenario is uncommon, - // and running a measurement pass here is a fine trade-off because preloading any time after this point would be late. - - if (self.automaticallyManagesSubnodes && !ASActivateExperimentalFeature(ASExperimentalDidEnterPreloadSkipASMLayout)) { - [self layoutIfNeeded]; - } - [self enumerateInterfaceStateDelegates:^(id del) { - [del didEnterPreloadState]; - }]; -} - -- (void)_didExitPreloadState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - [self didExitPreloadState]; - [self enumerateInterfaceStateDelegates:^(id del) { - [del didExitPreloadState]; - }]; -} - -- (void)clearContents -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - - MutexLocker l(__instanceLock__); - if (_flags.canClearContentsOfLayer) { - // No-op if these haven't been created yet, as that guarantees they don't have contents that needs to be released. - _layer.contents = nil; - } - - _placeholderLayer.contents = nil; - _placeholderImage = nil; -} - -- (void)recursivelyClearContents -{ - ASPerformBlockOnMainThread(^{ - ASDisplayNodePerformBlockOnEveryNode(nil, self, YES, ^(ASDisplayNode * _Nonnull node) { - [node clearContents]; - }); - }); -} - -- (void)enumerateInterfaceStateDelegates:(void (NS_NOESCAPE ^)(id))block -{ - DISABLED_ASAssertUnlocked(__instanceLock__); - - id dels[AS_MAX_INTERFACE_STATE_DELEGATES]; - int count = 0; - { - ASLockScopeSelf(); - // Fast path for non-delegating nodes. - if (!_flags.hasHadInterfaceStateDelegates) { - return; - } - - for (int i = 0; i < AS_MAX_INTERFACE_STATE_DELEGATES; i++) { - if ((dels[count] = _interfaceStateDelegates[i])) { - count++; - } - } - } - for (int i = 0; i < count; i++) { - block(dels[i]); - } -} - -#pragma mark - Gesture Recognizing - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - // Subclass hook -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - // Subclass hook -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - // Subclass hook -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - // Subclass hook -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - // This method is only implemented on UIView on iOS 6+. - ASDisplayNodeAssertMainThread(); - - // No locking needed as it's main thread only - UIView *view = _view; - if (view == nil) { - return YES; - } - - // If we reach the base implementation, forward up the view hierarchy. - UIView *superview = view.superview; - return [superview gestureRecognizerShouldBegin:gestureRecognizer]; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - return [_view hitTest:point withEvent:event]; -} - -- (void)setHitTestSlop:(UIEdgeInsets)hitTestSlop -{ - MutexLocker l(__instanceLock__); - _hitTestSlop = hitTestSlop; -} - -- (UIEdgeInsets)hitTestSlop -{ - MutexLocker l(__instanceLock__); - return _hitTestSlop; -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - UIEdgeInsets slop = self.hitTestSlop; - if (_view && UIEdgeInsetsEqualToEdgeInsets(slop, UIEdgeInsetsZero)) { - // Safer to use UIView's -pointInside:withEvent: if we can. - return [_view pointInside:point withEvent:event]; - } else { - return CGRectContainsPoint(UIEdgeInsetsInsetRect(self.bounds, slop), point); - } -} - - -#pragma mark - Pending View State - -- (void)_locked_applyPendingStateToViewOrLayer -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertLocked(__instanceLock__); - ASDisplayNodeAssert(self.nodeLoaded, @"must have a view or layer"); - - TIME_SCOPED(_debugTimeToApplyPendingState); - - // If no view/layer properties were set before the view/layer were created, _pendingViewState will be nil and the default values - // for the view/layer are still valid. - [self _locked_applyPendingViewState]; - - if (_flags.displaySuspended) { - self._locked_asyncLayer.displaySuspended = YES; - } - if (!_flags.displaysAsynchronously) { - self._locked_asyncLayer.displaysAsynchronously = NO; - } -} - -- (void)applyPendingViewState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertUnlocked(__instanceLock__); - - AS::UniqueLock l(__instanceLock__); - // FIXME: Ideally we'd call this as soon as the node receives -setNeedsLayout - // but automatic subnode management would require us to modify the node tree - // in the background on a loaded node, which isn't currently supported. - if (_pendingViewState.hasSetNeedsLayout) { - // Need to unlock before calling setNeedsLayout to avoid deadlocks. - l.unlock(); - [self __setNeedsLayout]; - l.lock(); - } - - [self _locked_applyPendingViewState]; -} - -- (void)_locked_applyPendingViewState -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertLocked(__instanceLock__); - ASDisplayNodeAssert([self _locked_isNodeLoaded], @"Expected node to be loaded before applying pending state."); - - if (_flags.layerBacked) { - [_pendingViewState applyToLayer:_layer]; - } else { - BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandling(checkFlag(Synchronous), _flags.layerBacked); - [_pendingViewState applyToView:_view withSpecialPropertiesHandling:specialPropertiesHandling]; - } - - // _ASPendingState objects can add up very quickly when adding - // many nodes. This is especially an issue in large collection views - // and table views. This needs to be weighed against the cost of - // reallocing a _ASPendingState. So in range managed nodes we - // delete the pending state, otherwise we just clear it. - if (ASHierarchyStateIncludesRangeManaged(_hierarchyState)) { - _pendingViewState = nil; - } else { - [_pendingViewState clearChanges]; - } -} - -// This method has proved helpful in a few rare scenarios, similar to a category extension on UIView, but assumes knowledge of _ASDisplayView. -// It's considered private API for now and its use should not be encouraged. -- (ASDisplayNode *)_supernodeWithClass:(Class)supernodeClass checkViewHierarchy:(BOOL)checkViewHierarchy -{ - ASDisplayNode *supernode = self.supernode; - while (supernode) { - if ([supernode isKindOfClass:supernodeClass]) - return supernode; - supernode = supernode.supernode; - } - if (!checkViewHierarchy) { - return nil; - } - - UIView *view = self.view.superview; - while (view) { - ASDisplayNode *viewNode = ((_ASDisplayView *)view).asyncdisplaykit_node; - if (viewNode) { - if ([viewNode isKindOfClass:supernodeClass]) - return viewNode; - } - - view = view.superview; - } - - return nil; -} - -#pragma mark - Performance Measurement - -- (void)setMeasurementOptions:(ASDisplayNodePerformanceMeasurementOptions)measurementOptions -{ - MutexLocker l(__instanceLock__); - _measurementOptions = measurementOptions; -} - -- (ASDisplayNodePerformanceMeasurementOptions)measurementOptions -{ - MutexLocker l(__instanceLock__); - return _measurementOptions; -} - -- (ASDisplayNodePerformanceMeasurements)performanceMeasurements -{ - MutexLocker l(__instanceLock__); - ASDisplayNodePerformanceMeasurements measurements = { .layoutSpecNumberOfPasses = -1, .layoutSpecTotalTime = NAN, .layoutComputationNumberOfPasses = -1, .layoutComputationTotalTime = NAN }; - if (_measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutSpec) { - measurements.layoutSpecNumberOfPasses = _layoutSpecNumberOfPasses; - measurements.layoutSpecTotalTime = _layoutSpecTotalTime; - } - if (_measurementOptions & ASDisplayNodePerformanceMeasurementOptionLayoutComputation) { - measurements.layoutComputationNumberOfPasses = _layoutComputationNumberOfPasses; - measurements.layoutComputationTotalTime = _layoutComputationTotalTime; - } - return measurements; -} - -#pragma mark - Accessibility - -- (void)setIsAccessibilityContainer:(BOOL)isAccessibilityContainer -{ - MutexLocker l(__instanceLock__); - _flags.isAccessibilityContainer = isAccessibilityContainer; -} - -- (BOOL)isAccessibilityContainer -{ - MutexLocker l(__instanceLock__); - return _flags.isAccessibilityContainer; -} - -- (NSString *)defaultAccessibilityLabel -{ - return nil; -} - -- (NSString *)defaultAccessibilityHint -{ - return nil; -} - -- (NSString *)defaultAccessibilityValue -{ - return nil; -} - -- (NSString *)defaultAccessibilityIdentifier -{ - return nil; -} - -- (UIAccessibilityTraits)defaultAccessibilityTraits -{ - return UIAccessibilityTraitNone; -} - -#pragma mark - Debugging (Private) - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - ASPushMainThreadAssertionsDisabled(); - - NSString *debugName = self.debugName; - if (debugName.length > 0) { - [result addObject:@{ (id)kCFNull : ASStringWithQuotesIfMultiword(debugName) }]; - } - - NSString *axId = self.accessibilityIdentifier; - if (axId.length > 0) { - [result addObject:@{ (id)kCFNull : ASStringWithQuotesIfMultiword(axId) }]; - } - - ASPopMainThreadAssertionsDisabled(); - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [NSMutableArray array]; - - if (self.debugName.length > 0) { - [result addObject:@{ @"debugName" : ASStringWithQuotesIfMultiword(self.debugName)}]; - } - if (self.accessibilityIdentifier.length > 0) { - [result addObject:@{ @"axId": ASStringWithQuotesIfMultiword(self.accessibilityIdentifier) }]; - } - - CGRect windowFrame = [self _frameInWindow]; - if (CGRectIsNull(windowFrame) == NO) { - [result addObject:@{ @"frameInWindow" : [NSValue valueWithCGRect:windowFrame] }]; - } - - // Attempt to find view controller. - // Note that the convenience method asdk_associatedViewController has an assertion - // that it's run on main. Since this is a debug method, let's bypass the assertion - // and run up the chain ourselves. - if (_view != nil) { - for (UIResponder *responder in [_view asdk_responderChainEnumerator]) { - UIViewController *vc = ASDynamicCast(responder, UIViewController); - if (vc) { - [result addObject:@{ @"viewController" : ASObjectDescriptionMakeTiny(vc) }]; - break; - } - } - } - - if (_view != nil) { - [result addObject:@{ @"alpha" : @(_view.alpha) }]; - [result addObject:@{ @"frame" : [NSValue valueWithCGRect:_view.frame] }]; - } else if (_layer != nil) { - [result addObject:@{ @"alpha" : @(_layer.opacity) }]; - [result addObject:@{ @"frame" : [NSValue valueWithCGRect:_layer.frame] }]; - } else if (_pendingViewState != nil) { - [result addObject:@{ @"alpha" : @(_pendingViewState.alpha) }]; - [result addObject:@{ @"frame" : [NSValue valueWithCGRect:_pendingViewState.frame] }]; - } - - // Check supernode so that if we are a cell node we don't find self. - ASCellNode *cellNode = [self supernodeOfClass:[ASCellNode class] includingSelf:NO]; - if (cellNode != nil) { - [result addObject:@{ @"cellNode" : ASObjectDescriptionMakeTiny(cellNode) }]; - } - - [result addObject:@{ @"interfaceState" : NSStringFromASInterfaceState(self.interfaceState)} ]; - - if (_view != nil) { - [result addObject:@{ @"view" : ASObjectDescriptionMakeTiny(_view) }]; - } else if (_layer != nil) { - [result addObject:@{ @"layer" : ASObjectDescriptionMakeTiny(_layer) }]; - } else if (_viewClass != nil) { - [result addObject:@{ @"viewClass" : _viewClass }]; - } else if (_layerClass != nil) { - [result addObject:@{ @"layerClass" : _layerClass }]; - } else if (_viewBlock != nil) { - [result addObject:@{ @"viewBlock" : _viewBlock }]; - } else if (_layerBlock != nil) { - [result addObject:@{ @"layerBlock" : _layerBlock }]; - } - -#if TIME_DISPLAYNODE_OPS - NSString *creationTypeString = [NSString stringWithFormat:@"cr8:%.2lfms dl:%.2lfms ap:%.2lfms ad:%.2lfms", 1000 * _debugTimeToCreateView, 1000 * _debugTimeForDidLoad, 1000 * _debugTimeToApplyPendingState, 1000 * _debugTimeToAddSubnodeViews]; - [result addObject:@{ @"creationTypeString" : creationTypeString }]; -#endif - - return result; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSString *)debugDescription -{ - ASPushMainThreadAssertionsDisabled(); - const auto result = ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); - ASPopMainThreadAssertionsDisabled(); - return result; -} - -// This should only be called for debugging. It's not thread safe and it doesn't assert. -// NOTE: Returns CGRectNull if the node isn't in a hierarchy. -- (CGRect)_frameInWindow -{ - if (self.isNodeLoaded == NO || self.isInHierarchy == NO) { - return CGRectNull; - } - - if (self.layerBacked) { - CALayer *rootLayer = _layer; - CALayer *nextLayer = nil; - while ((nextLayer = rootLayer.superlayer) != nil) { - rootLayer = nextLayer; - } - - return [_layer convertRect:self.threadSafeBounds toLayer:rootLayer]; - } else { - return [_view convertRect:self.threadSafeBounds toView:nil]; - } -} - -@end - -#pragma mark - ASDisplayNode (Debugging) - -@implementation ASDisplayNode (Debugging) - -+ (void)setShouldStoreUnflattenedLayouts:(BOOL)shouldStore -{ - storesUnflattenedLayouts.store(shouldStore); -} - -+ (BOOL)shouldStoreUnflattenedLayouts -{ - return storesUnflattenedLayouts.load(); -} - -- (ASLayout *)unflattenedCalculatedLayout -{ - MutexLocker l(__instanceLock__); - return _unflattenedLayout; -} - -+ (void)setSuppressesInvalidCollectionUpdateExceptions:(BOOL)suppresses -{ - suppressesInvalidCollectionUpdateExceptions.store(suppresses); -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -+ (BOOL)suppressesInvalidCollectionUpdateExceptions -{ - return suppressesInvalidCollectionUpdateExceptions.load(); -} -#pragma clang diagnostic pop - -- (NSString *)displayNodeRecursiveDescription -{ - return [self _recursiveDescriptionHelperWithIndent:@""]; -} - -- (NSString *)_recursiveDescriptionHelperWithIndent:(NSString *)indent -{ - NSMutableString *subtree = [[[indent stringByAppendingString:self.debugDescription] stringByAppendingString:@"\n"] mutableCopy]; - for (ASDisplayNode *n in self.subnodes) { - [subtree appendString:[n _recursiveDescriptionHelperWithIndent:[indent stringByAppendingString:@" | "]]]; - } - return subtree; -} - -- (NSString *)detailedLayoutDescription -{ - ASPushMainThreadAssertionsDisabled(); - MutexLocker l(__instanceLock__); - const auto props = [[NSMutableArray alloc] init]; - - [props addObject:@{ @"layoutVersion": @(_layoutVersion.load()) }]; - [props addObject:@{ @"bounds": [NSValue valueWithCGRect:self.bounds] }]; - - if (_calculatedDisplayNodeLayout.layout) { - [props addObject:@{ @"calculatedLayout": _calculatedDisplayNodeLayout.layout }]; - [props addObject:@{ @"calculatedVersion": @(_calculatedDisplayNodeLayout.version) }]; - [props addObject:@{ @"calculatedConstrainedSize" : NSStringFromASSizeRange(_calculatedDisplayNodeLayout.constrainedSize) }]; - if (_calculatedDisplayNodeLayout.requestedLayoutFromAbove) { - [props addObject:@{ @"calculatedRequestedLayoutFromAbove": @"YES" }]; - } - } - if (_pendingDisplayNodeLayout.layout) { - [props addObject:@{ @"pendingLayout": _pendingDisplayNodeLayout.layout }]; - [props addObject:@{ @"pendingVersion": @(_pendingDisplayNodeLayout.version) }]; - [props addObject:@{ @"pendingConstrainedSize" : NSStringFromASSizeRange(_pendingDisplayNodeLayout.constrainedSize) }]; - if (_pendingDisplayNodeLayout.requestedLayoutFromAbove) { - [props addObject:@{ @"pendingRequestedLayoutFromAbove": (id)kCFNull }]; - } - } - - ASPopMainThreadAssertionsDisabled(); - return ASObjectDescriptionMake(self, props); -} - -@end - -#pragma mark - ASDisplayNode UIKit / CA Categories - -// We use associated objects as a last resort if our view is not a _ASDisplayView ie it doesn't have the _node ivar to write to - -static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode"; - -@implementation UIView (ASDisplayNodeInternal) - -- (void)setAsyncdisplaykit_node:(ASDisplayNode *)node -{ - ASWeakProxy *weakProxy = [ASWeakProxy weakProxyWithTarget:node]; - objc_setAssociatedObject(self, ASDisplayNodeAssociatedNodeKey, weakProxy, OBJC_ASSOCIATION_RETAIN); // Weak reference to avoid cycle, since the node retains the view. -} - -- (ASDisplayNode *)asyncdisplaykit_node -{ - ASWeakProxy *weakProxy = objc_getAssociatedObject(self, ASDisplayNodeAssociatedNodeKey); - return weakProxy.target; -} - -@end - -@implementation CALayer (ASDisplayNodeInternal) - -- (void)setAsyncdisplaykit_node:(ASDisplayNode *)node -{ - ASWeakProxy *weakProxy = [ASWeakProxy weakProxyWithTarget:node]; - objc_setAssociatedObject(self, ASDisplayNodeAssociatedNodeKey, weakProxy, OBJC_ASSOCIATION_RETAIN); // Weak reference to avoid cycle, since the node retains the layer. -} - -- (ASDisplayNode *)asyncdisplaykit_node -{ - ASWeakProxy *weakProxy = objc_getAssociatedObject(self, ASDisplayNodeAssociatedNodeKey); - return weakProxy.target; -} - -@end - -@implementation UIView (AsyncDisplayKit) - -- (void)addSubnode:(ASDisplayNode *)subnode -{ - if (subnode.layerBacked) { - // Call -addSubnode: so that we use the asyncdisplaykit_node path if possible. - [self.layer addSubnode:subnode]; - } else { - ASDisplayNode *selfNode = self.asyncdisplaykit_node; - if (selfNode) { - [selfNode addSubnode:subnode]; - } else { - if (subnode.supernode) { - [subnode removeFromSupernode]; - } - [self addSubview:subnode.view]; - } - } -} - -@end - -@implementation CALayer (AsyncDisplayKit) - -- (void)addSubnode:(ASDisplayNode *)subnode -{ - ASDisplayNode *selfNode = self.asyncdisplaykit_node; - if (selfNode) { - [selfNode addSubnode:subnode]; - } else { - if (subnode.supernode) { - [subnode removeFromSupernode]; - } - [self addSublayer:subnode.layer]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/ASDisplayNodeExtras.h b/Example/Pods/Texture/Source/ASDisplayNodeExtras.h deleted file mode 100644 index 03f29404..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNodeExtras.h +++ /dev/null @@ -1,213 +0,0 @@ -// -// ASDisplayNodeExtras.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import - -/** - * Sets the debugName field for these nodes to the given symbol names, within the domain of "self.class" - * For instance, in `MYButtonNode` if you call `ASSetDebugNames(self.titleNode, _countNode)` the debug names - * for the nodes will be set to `MYButtonNode.titleNode` and `MYButtonNode.countNode`. - */ -#if DEBUG - #define ASSetDebugName(node, format, ...) node.debugName = [NSString stringWithFormat:format, __VA_ARGS__] - #define ASSetDebugNames(...) _ASSetDebugNames(self.class, @"" # __VA_ARGS__, __VA_ARGS__, nil) -#else - #define ASSetDebugName(node, format, ...) - #define ASSetDebugNames(...) -#endif - -NS_ASSUME_NONNULL_BEGIN - -/// For deallocation of objects on the main thread across multiple run loops. -ASDK_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); - -// Because inline methods can't be extern'd and need to be part of the translation unit of code -// that compiles with them to actually inline, we both declare and define these in the header. -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesVisible(ASInterfaceState interfaceState) -{ - return ((interfaceState & ASInterfaceStateVisible) == ASInterfaceStateVisible); -} - -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesDisplay(ASInterfaceState interfaceState) -{ - return ((interfaceState & ASInterfaceStateDisplay) == ASInterfaceStateDisplay); -} - -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesPreload(ASInterfaceState interfaceState) -{ - return ((interfaceState & ASInterfaceStatePreload) == ASInterfaceStatePreload); -} - -ASDISPLAYNODE_INLINE BOOL ASInterfaceStateIncludesMeasureLayout(ASInterfaceState interfaceState) -{ - return ((interfaceState & ASInterfaceStateMeasureLayout) == ASInterfaceStateMeasureLayout); -} - -__unused static NSString * NSStringFromASInterfaceState(ASInterfaceState interfaceState) -{ - NSMutableArray *states = [NSMutableArray array]; - if (interfaceState == ASInterfaceStateNone) { - [states addObject:@"No state"]; - } - if (ASInterfaceStateIncludesMeasureLayout(interfaceState)) { - [states addObject:@"MeasureLayout"]; - } - if (ASInterfaceStateIncludesPreload(interfaceState)) { - [states addObject:@"Preload"]; - } - if (ASInterfaceStateIncludesDisplay(interfaceState)) { - [states addObject:@"Display"]; - } - if (ASInterfaceStateIncludesVisible(interfaceState)) { - [states addObject:@"Visible"]; - } - return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]]; -} - -#define INTERFACE_STATE_DELTA(Name) ({ \ - if ((oldState & ASInterfaceState##Name) != (newState & ASInterfaceState##Name)) { \ - [changes appendFormat:@"%c%s ", (newState & ASInterfaceState##Name ? '+' : '-'), #Name]; \ - } \ -}) - -/// e.g. { +Visible, -Preload } (although that should never actually happen.) -/// NOTE: Changes to MeasureLayout state don't really mean anything so we omit them for now. -__unused static NSString *NSStringFromASInterfaceStateChange(ASInterfaceState oldState, ASInterfaceState newState) -{ - if (oldState == newState) { - return @"{ }"; - } - - NSMutableString *changes = [NSMutableString stringWithString:@"{ "]; - INTERFACE_STATE_DELTA(Preload); - INTERFACE_STATE_DELTA(Display); - INTERFACE_STATE_DELTA(Visible); - [changes appendString:@"}"]; - return changes; -} - -#undef INTERFACE_STATE_DELTA - -/** - Returns the appropriate interface state for a given ASDisplayNode and window - */ -ASDK_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; - -/** - Given a layer, returns the associated display node, if any. - */ -ASDK_EXTERN ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; - -/** - Given a view, returns the associated display node, if any. - */ -ASDK_EXTERN ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; - -/** - Given a node, returns the root of the node hierarchy (where supernode == nil) - */ -ASDK_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; - -/** - If traverseSublayers == YES, this function will walk the layer hierarchy, spanning discontinuous sections of the node hierarchy\ - (e.g. the layers of UIKit intermediate views in UIViewControllers, UITableView, UICollectionView). - In the event that a node's backing layer is not created yet, the function will only walk the direct subnodes instead - of forcing the layer hierarchy to be created. - */ -ASDK_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); - -/** - This function will walk the node hierarchy in a breadth first fashion. It does run the block on the node provided - directly to the function call. It does NOT traverse sublayers. - */ -ASDK_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); - -/** - Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the - node provided directly to the function call - only on all descendants. - */ -ASDK_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); - -/** - Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block. - */ -ASDK_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead."); - -/** - Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class. - */ -ASDK_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); - -/** - * Given a layer, find the window it lives in, if any. - */ -ASDK_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; - -/** - * Given a layer, find the closest view it lives in, if any. - */ -ASDK_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; - -/** - * Given two nodes, finds their most immediate common parent. Used for geometry conversion methods. - * NOTE: It is an error to try to convert between nodes which do not share a common ancestor. This behavior is - * disallowed in UIKit documentation and the behavior is left undefined. The output does not have a rigorously defined - * failure mode (i.e. returning CGPointZero or returning the point exactly as passed in). Rather than track the internal - * undefined and undocumented behavior of UIKit in ASDisplayNode, this operation is defined to be incorrect in all - * circumstances and must be fixed wherever encountered. - */ -ASDK_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, collects all descendants. This is a specialization of ASCollectContainer() that walks the Core Animation layer tree as opposed to the display node tree, thus supporting non-continues display node hierarchies. - */ -ASDK_EXTERN NSArray *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, traverses down the node hierarchy, returning all the display nodes that pass the block. - */ -ASDK_EXTERN NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class. - */ -ASDK_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, traverses down the node hierarchy, returning the depth-first display node, including the start node that pass the block. - */ -ASDK_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, traverses down the node hierarchy, returning the depth-first display node, excluding the start node, that pass the block - */ -ASDK_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; - -/** - Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class. - */ -ASDK_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; - -ASDK_EXTERN UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; -ASDK_EXTERN UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; - -/** - Disable willAppear / didAppear / didDisappear notifications for a sub-hierarchy, then re-enable when done. Nested calls are supported. - */ -ASDK_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); -ASDK_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); - -// Not to be called directly. -ASDK_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode * _Nullable object, ...); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASDisplayNodeExtras.mm b/Example/Pods/Texture/Source/ASDisplayNodeExtras.mm deleted file mode 100644 index caf68ca8..00000000 --- a/Example/Pods/Texture/Source/ASDisplayNodeExtras.mm +++ /dev/null @@ -1,337 +0,0 @@ -// -// ASDisplayNodeExtras.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -#import -#import - -void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { - /** - * UIKit components must be deallocated on the main thread. We use this shared - * run loop queue to gradually deallocate them across many turns of the main run loop. - */ - static ASRunLoopQueue *queue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - queue = [[ASRunLoopQueue alloc] initWithRunLoop:CFRunLoopGetMain() retainObjects:YES handler:nil]; - queue.batchSize = 10; - }); - - if (objectPtr != NULL && *objectPtr != nil) { - // TODO: If ASRunLoopQueue supported an "unsafe_unretained" mode, we could - // transfer the caller's +1 into it and save the retain/release pair. - - // Lock queue while enqueuing and releasing, so that there's no risk - // that the queue will release before we get a chance to release. - [queue lock]; - [queue enqueue:*objectPtr]; // Retain, +1 - *objectPtr = nil; // Release, +0 - [queue unlock]; // (After queue drains), release, -1 - } -} - -void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) -{ - NSString *owningClassName = NSStringFromClass(owningClass); - NSArray *nameArray = [names componentsSeparatedByString:@", "]; - va_list args; - va_start(args, object); - NSInteger i = 0; - for (ASDisplayNode *node = object; node != nil; node = va_arg(args, id), i++) { - NSMutableString *symbolName = [nameArray[i] mutableCopy]; - // Remove any `self.` or `_` prefix - [symbolName replaceOccurrencesOfString:@"self." withString:@"" options:NSAnchoredSearch range:NSMakeRange(0, symbolName.length)]; - [symbolName replaceOccurrencesOfString:@"_" withString:@"" options:NSAnchoredSearch range:NSMakeRange(0, symbolName.length)]; - node.debugName = [NSString stringWithFormat:@"%@.%@", owningClassName, symbolName]; - } - ASDisplayNodeCAssert(nameArray.count == i, @"Malformed call to ASSetDebugNames: %@", names); - va_end(args); -} - -ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) -{ - ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window"); - if (displayNode && [displayNode supportsRangeManagedInterfaceState]) { - // Directly clear the visible bit if we are not in a window. This means that the interface state is, - // if not already, about to be set to invisible as it is not possible for an element to be visible - // while outside of a window. - ASInterfaceState interfaceState = displayNode.pendingInterfaceState; - return (window == nil ? (interfaceState & (~ASInterfaceStateVisible)) : interfaceState); - } else { - // For not range managed nodes we might be on our own to try to guess if we're visible. - return (window == nil ? ASInterfaceStateNone : (ASInterfaceStateVisible | ASInterfaceStateDisplay)); - } -} - -ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) -{ - return layer.asyncdisplaykit_node; -} - -ASDisplayNode *ASViewToDisplayNode(UIView *view) -{ - return view.asyncdisplaykit_node; -} - -void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) -{ - if (!node) { - ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer"); - ASDisplayNodeCAssertMainThread(); - node = ASLayerToDisplayNode(layer); - } - - if (node) { - block(node); - } - if (traverseSublayers && !layer && [node isNodeLoaded] && ASDisplayNodeThreadIsMain()) { - layer = node.layer; - } - - if (traverseSublayers && layer && node.rasterizesSubtree == NO) { - /// NOTE: The docs say `sublayers` returns a copy, but it does not. - /// See: http://stackoverflow.com/questions/14854480/collection-calayerarray-0x1ed8faa0-was-mutated-while-being-enumerated - for (CALayer *sublayer in [[layer sublayers] copy]) { - ASDisplayNodePerformBlockOnEveryNode(sublayer, nil, traverseSublayers, block); - } - } else if (node) { - for (ASDisplayNode *subnode in [node subnodes]) { - ASDisplayNodePerformBlockOnEveryNode(nil, subnode, traverseSublayers, block); - } - } -} - -void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) -{ - // Queue used to keep track of subnodes while traversing this layout in a BFS fashion. - std::queue queue; - queue.push(node); - - while (!queue.empty()) { - node = queue.front(); - queue.pop(); - - block(node); - - // Add all subnodes to process in next step - for (ASDisplayNode *subnode in node.subnodes) { - queue.push(subnode); - } - } -} - -void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) -{ - for (ASDisplayNode *subnode in node.subnodes) { - ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block); - } -} - -ASDisplayNode *ASDisplayNodeFindFirstSupernode(ASDisplayNode *node, BOOL (^block)(ASDisplayNode *node)) -{ - // This function has historically started with `self` but the name suggests - // that it wouldn't. Perhaps we should change the behavior. - for (ASDisplayNode *ancestor in node.supernodesIncludingSelf) { - if (block(ancestor)) { - return ancestor; - } - } - return nil; -} - -__kindof ASDisplayNode *ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) -{ - // This function has historically started with `self` but the name suggests - // that it wouldn't. Perhaps we should change the behavior. - return [start supernodeOfClass:c includingSelf:YES]; -} - -static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer) -{ - ASDisplayNode *node = ASLayerToDisplayNode(layer); - - if (nil != node) { - [array addObject:node]; - } - - for (CALayer *sublayer in layer.sublayers) - _ASCollectDisplayNodes(array, sublayer); -} - -NSArray *ASCollectDisplayNodes(ASDisplayNode *node) -{ - NSMutableArray *list = [[NSMutableArray alloc] init]; - for (CALayer *sublayer in node.layer.sublayers) { - _ASCollectDisplayNodes(list, sublayer); - } - return list; -} - -#pragma mark - Find all subnodes - -static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode *node, BOOL (^block)(ASDisplayNode *node)) -{ - if (!node) - return; - - for (ASDisplayNode *subnode in node.subnodes) { - if (block(subnode)) { - [array addObject:subnode]; - } - - _ASDisplayNodeFindAllSubnodes(array, subnode, block); - } -} - -NSArray *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) -{ - NSMutableArray *list = [[NSMutableArray alloc] init]; - _ASDisplayNodeFindAllSubnodes(list, start, block); - return list; -} - -NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) -{ - return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { - return [n isKindOfClass:c]; - }); -} - -#pragma mark - Find first subnode - -static ASDisplayNode *_ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL includeStartNode, BOOL (^block)(ASDisplayNode *node)) -{ - for (ASDisplayNode *subnode in startNode.subnodes) { - ASDisplayNode *foundNode = _ASDisplayNodeFindFirstNode(subnode, YES, block); - if (foundNode) { - return foundNode; - } - } - - if (includeStartNode && block(startNode)) - return startNode; - - return nil; -} - -__kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) -{ - return _ASDisplayNodeFindFirstNode(startNode, YES, block); -} - -__kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) -{ - return _ASDisplayNodeFindFirstNode(startNode, NO, block); -} - -__kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) -{ - return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { - return [n isKindOfClass:c]; - }); -} - -static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possibleAncestor, ASDisplayNode *possibleDescendant) -{ - ASDisplayNode *supernode = possibleDescendant; - while (supernode) { - if (supernode == possibleAncestor) { - return YES; - } - supernode = supernode.supernode; - } - - return NO; -} - -UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) -{ - UIView *view = ASFindClosestViewOfLayer(layer); - if (UIWindow *window = ASDynamicCast(view, UIWindow)) { - return window; - } else { - return view.window; - } -} - -UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) -{ - while (layer != nil) { - if (UIView *view = ASDynamicCast(layer.delegate, UIView)) { - return view; - } - layer = layer.superlayer; - } - return nil; -} - -ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) -{ - ASDisplayNode *possibleAncestor = node1; - while (possibleAncestor) { - if (_ASDisplayNodeIsAncestorOfDisplayNode(possibleAncestor, node2)) { - break; - } - possibleAncestor = possibleAncestor.supernode; - } - - ASDisplayNodeCAssertNotNil(possibleAncestor, @"Could not find a common ancestor between node1: %@ and node2: %@", node1, node2); - return possibleAncestor; -} - -ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) -{ - // node <- supernode on each loop - // previous <- node on each loop where node is not nil - // previous is the final non-nil value of supernode, i.e. the root node - ASDisplayNode *previousNode = node; - while ((node = [node supernode])) { - previousNode = node; - } - return previousNode; -} - -#pragma mark - Placeholders - -UIColor *ASDisplayNodeDefaultPlaceholderColor() -{ - static UIColor *defaultPlaceholderColor; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultPlaceholderColor = [UIColor colorWithWhite:0.95 alpha:1.0]; - }); - return defaultPlaceholderColor; -} - -UIColor *ASDisplayNodeDefaultTintColor() -{ - static UIColor *defaultTintColor; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultTintColor = [UIColor colorWithRed:0.0 green:0.478 blue:1.0 alpha:1.0]; - }); - return defaultTintColor; -} - -#pragma mark - Hierarchy Notifications - -void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node) -{ - [node __incrementVisibilityNotificationsDisabled]; -} - -void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node) -{ - [node __decrementVisibilityNotificationsDisabled]; -} diff --git a/Example/Pods/Texture/Source/ASEditableTextNode.h b/Example/Pods/Texture/Source/ASEditableTextNode.h deleted file mode 100644 index e660eb10..00000000 --- a/Example/Pods/Texture/Source/ASEditableTextNode.h +++ /dev/null @@ -1,203 +0,0 @@ -// -// ASEditableTextNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASEditableTextNodeDelegate; -@class ASTextKitComponents; - -/** - @abstract Implements a node that supports text editing. - @discussion Does not support layer backing. - */ -@interface ASEditableTextNode : ASDisplayNode - -/** - * @abstract Initializes an editable text node using default TextKit components. - * - * @return An initialized ASEditableTextNode. - */ -- (instancetype)init; - -/** - * @abstract Initializes an editable text node using the provided TextKit components. - * - * @param textKitComponents The TextKit stack used to render text. - * @param placeholderTextKitComponents The TextKit stack used to render placeholder text. - * - * @return An initialized ASEditableTextNode. - */ -- (instancetype)initWithTextKitComponents:(ASTextKitComponents *)textKitComponents - placeholderTextKitComponents:(ASTextKitComponents *)placeholderTextKitComponents; - -//! @abstract The text node's delegate, which must conform to the protocol. -@property (nullable, weak) id delegate; - -#pragma mark - Configuration - -/** - @abstract Enable scrolling on the textView - @default true - */ -@property (nonatomic) BOOL scrollEnabled; - -/** - @abstract Access to underlying UITextView for more configuration options. - @warning This property should only be used on the main thread and should not be accessed before the editable text node's view is created. - */ -@property (nonatomic, readonly) UITextView *textView; - -//! @abstract The attributes to apply to new text being entered by the user. -@property (nullable, nonatomic, copy) NSDictionary *typingAttributes; - -//! @abstract The range of text currently selected. If length is zero, the range is the cursor location. -@property NSRange selectedRange; - -#pragma mark - Placeholder -/** - @abstract Indicates if the receiver is displaying the placeholder text. - @discussion To update the placeholder, see the property. - @result YES if the placeholder is currently displayed; NO otherwise. - */ -- (BOOL)isDisplayingPlaceholder AS_WARN_UNUSED_RESULT; - -/** - @abstract The styled placeholder text displayed by the text node while no text is entered - @discussion The placeholder is displayed when the user has not entered any text and the keyboard is not visible. - */ -@property (nullable, nonatomic, copy) NSAttributedString *attributedPlaceholderText; - -#pragma mark - Modifying User Text -/** - @abstract The styled text displayed by the receiver. - @discussion When the placeholder is displayed (as indicated by -isDisplayingPlaceholder), this value is nil. Otherwise, this value is the attributed text the user has entered. This value can be modified regardless of whether the receiver is the first responder (and thus, editing) or not. Changing this value from nil to non-nil will result in the placeholder being hidden, and the new value being displayed. - */ -@property (nullable, nonatomic, copy) NSAttributedString *attributedText; - -#pragma mark - Managing The Keyboard -//! @abstract The text input mode used by the receiver's keyboard, if it is visible. This value is undefined if the receiver is not the first responder. -@property (nonatomic, readonly) UITextInputMode *textInputMode; - -/** - @abstract The textContainerInset of both the placeholder and typed textView. This value defaults to UIEdgeInsetsZero. - */ -@property (nonatomic) UIEdgeInsets textContainerInset; - -/** - @abstract The maximum number of lines to display. Additional lines will require scrolling. - @default 0 (No limit) - */ -@property (nonatomic) NSUInteger maximumLinesToDisplay; - -/** - @abstract Indicates whether the receiver's text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user. - @result YES if the receiver's text view is the first-responder; NO otherwise. - */ -- (BOOL)isFirstResponder AS_WARN_UNUSED_RESULT; - -//! @abstract Makes the receiver's text view the first responder. -- (BOOL)becomeFirstResponder; - -//! @abstract Resigns the receiver's text view from first-responder status, if it has it. -- (BOOL)resignFirstResponder; - -#pragma mark - Geometry -/** - @abstract Returns the frame of the given range of characters. - @param textRange A range of characters. - @discussion This method raises an exception if `textRange` is not a valid range of characters within the receiver's attributed text. - @result A CGRect that is the bounding box of the glyphs covered by the given range of characters, in the coordinate system of the receiver. - */ -- (CGRect)frameForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract properties. - */ -@property (nonatomic) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences -@property (nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault -@property (nonatomic) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault; -@property (nonatomic) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault -@property (nonatomic) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault -@property (nonatomic) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum) -@property (nonatomic) BOOL enablesReturnKeyAutomatically; // default is NO (when YES, will automatically disable return key when text widget has zero-length contents, and will automatically enable when text widget has non-zero-length contents) -@property (nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO - -@end - -@interface ASEditableTextNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end - -#pragma mark - -/** - * The methods declared by the ASEditableTextNodeDelegate protocol allow the adopting delegate to - * respond to notifications such as began and finished editing, selection changed and text updated; - * and manage whether a specified text should be replaced. - */ -@protocol ASEditableTextNodeDelegate - -@optional -/** - @abstract Asks the delegate if editing should begin for the text node. - @param editableTextNode An editable text node. - @discussion YES if editing should begin; NO if editing should not begin -- the default returns YES. - */ -- (BOOL)editableTextNodeShouldBeginEditing:(ASEditableTextNode *)editableTextNode; - -/** - @abstract Indicates to the delegate that the text node began editing. - @param editableTextNode An editable text node. - @discussion The invocation of this method coincides with the keyboard animating to become visible. - */ -- (void)editableTextNodeDidBeginEditing:(ASEditableTextNode *)editableTextNode; - -/** - @abstract Asks the delegate whether the specified text should be replaced in the editable text node. - @param editableTextNode An editable text node. - @param range The current selection range. If the length of the range is 0, range reflects the current insertion point. If the user presses the Delete key, the length of the range is 1 and an empty string object replaces that single character. - @param text The text to insert. - @discussion YES if the old text should be replaced by the new text; NO if the replacement operation should be aborted. - @result The text node calls this method whenever the user types a new character or deletes an existing character. Implementation of this method is optional -- the default implementation returns YES. - */ -- (BOOL)editableTextNode:(ASEditableTextNode *)editableTextNode shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; - -/** - @abstract Indicates to the delegate that the text node's selection has changed. - @param editableTextNode An editable text node. - @param fromSelectedRange The previously selected range. - @param toSelectedRange The current selected range. Equivalent to the property. - @param dueToEditing YES if the selection change was due to editing; NO otherwise. - @discussion You can access the selection of the receiver via . - */ -- (void)editableTextNodeDidChangeSelection:(ASEditableTextNode *)editableTextNode fromSelectedRange:(NSRange)fromSelectedRange toSelectedRange:(NSRange)toSelectedRange dueToEditing:(BOOL)dueToEditing; - -/** - @abstract Indicates to the delegate that the text node's text was updated. - @param editableTextNode An editable text node. - @discussion This method is called each time the user updated the text node's text. It is not called for programmatic changes made to the text via the property. - */ -- (void)editableTextNodeDidUpdateText:(ASEditableTextNode *)editableTextNode; - -/** - @abstract Indicates to the delegate that the text node has finished editing. - @param editableTextNode An editable text node. - @discussion The invocation of this method coincides with the keyboard animating to become hidden. - */ -- (void)editableTextNodeDidFinishEditing:(ASEditableTextNode *)editableTextNode; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASEditableTextNode.mm b/Example/Pods/Texture/Source/ASEditableTextNode.mm deleted file mode 100644 index 60be21f9..00000000 --- a/Example/Pods/Texture/Source/ASEditableTextNode.mm +++ /dev/null @@ -1,880 +0,0 @@ -// -// ASEditableTextNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import -#import -#import -#import - -/** - @abstract Object to hold UITextView's pending UITextInputTraits -**/ -@interface _ASTextInputTraitsPendingState : NSObject - -@property UITextAutocapitalizationType autocapitalizationType; -@property UITextAutocorrectionType autocorrectionType; -@property UITextSpellCheckingType spellCheckingType; -@property UIKeyboardAppearance keyboardAppearance; -@property UIKeyboardType keyboardType; -@property UIReturnKeyType returnKeyType; -@property BOOL enablesReturnKeyAutomatically; -@property (getter=isSecureTextEntry) BOOL secureTextEntry; - -@end - -@implementation _ASTextInputTraitsPendingState - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // set default values, as defined in Apple's comments in UITextInputTraits.h - _autocapitalizationType = UITextAutocapitalizationTypeSentences; - _autocorrectionType = UITextAutocorrectionTypeDefault; - _spellCheckingType = UITextSpellCheckingTypeDefault; - _keyboardAppearance = UIKeyboardAppearanceDefault; - _keyboardType = UIKeyboardTypeDefault; - _returnKeyType = UIReturnKeyDefault; - - return self; -} - -@end - -/** - @abstract As originally reported in rdar://14729288, when scrollEnabled = NO, - UITextView does not calculate its contentSize. This makes it difficult - for a client to embed a UITextView inside a different scroll view with - other content (setting scrollEnabled = NO on the UITextView itself, - because the containing scroll view will handle the gesture)... - because accessing contentSize is typically necessary to perform layout. - Apple later closed the issue as expected behavior. This works around - the issue by ensuring that contentSize is always calculated, while - still providing control over the UITextView's scrolling. - - See issue: https://github.com/facebook/AsyncDisplayKit/issues/1063 - */ -@interface ASPanningOverriddenUITextView : ASTextKitComponentsTextView -{ - BOOL _shouldBlockPanGesture; -} -@end - -@implementation ASPanningOverriddenUITextView - -#if TARGET_OS_IOS - // tvOS doesn't support self.scrollsToTop -- (BOOL)scrollEnabled -{ - return _shouldBlockPanGesture; -} - -- (void)setScrollEnabled:(BOOL)scrollEnabled -{ - _shouldBlockPanGesture = !scrollEnabled; - self.scrollsToTop = scrollEnabled; - - [super setScrollEnabled:YES]; -} -#endif - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - // Never allow our pans to begin when _shouldBlockPanGesture is true. - if (_shouldBlockPanGesture && gestureRecognizer == self.panGestureRecognizer) - return NO; - - // Otherwise, proceed as usual. - if ([UITextView instancesRespondToSelector:_cmd]) - return [super gestureRecognizerShouldBegin:gestureRecognizer]; - return YES; -} - -@end - -#pragma mark - -@interface ASEditableTextNode () -{ - @private - // Configuration. - NSDictionary *_typingAttributes; - - // Core. - id __weak _delegate; - - // TextKit. - AS::RecursiveMutex _textKitLock; - ASTextKitComponents *_textKitComponents; - ASTextKitComponents *_placeholderTextKitComponents; - // Forwards NSLayoutManagerDelegate methods related to word kerning - ASTextNodeWordKerner *_wordKerner; - - // UITextInputTraits - AS::RecursiveMutex _textInputTraitsLock; - _ASTextInputTraitsPendingState *_textInputTraits; - - // Misc. State. - BOOL _displayingPlaceholder; // Defaults to YES. - BOOL _isPreservingSelection; - BOOL _selectionChangedForEditedText; - BOOL _delegateDidUpdateEnqueued; - BOOL _scrollEnabled; - - NSRange _previousSelectedRange; -} - -@property (nonatomic, readonly) _ASTextInputTraitsPendingState *textInputTraits; - -@end - -@implementation ASEditableTextNode - -#pragma mark - NSObject Overrides -- (instancetype)init -{ - return [self initWithTextKitComponents:[ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero] - placeholderTextKitComponents:[ASTextKitComponents componentsWithAttributedSeedString:nil textContainerSize:CGSizeZero]]; -} - -- (instancetype)initWithTextKitComponents:(ASTextKitComponents *)textKitComponents - placeholderTextKitComponents:(ASTextKitComponents *)placeholderTextKitComponents -{ - if (!(self = [super init])) - return nil; - - _displayingPlaceholder = YES; - _scrollEnabled = YES; - - // Create the scaffolding for the text view. - _textKitComponents = textKitComponents; - _textKitComponents.layoutManager.delegate = self; - _wordKerner = [[ASTextNodeWordKerner alloc] init]; - _textContainerInset = UIEdgeInsetsZero; - - // Create the placeholder scaffolding. - _placeholderTextKitComponents = placeholderTextKitComponents; - _placeholderTextKitComponents.layoutManager.delegate = self; - - return self; -} - -#pragma mark - ASDisplayNode Overrides -- (void)didLoad -{ - [super didLoad]; - - void (^configureTextView)(UITextView *) = ^(UITextView *textView) { - if (!self->_displayingPlaceholder || textView != self->_textKitComponents.textView) { - // If showing the placeholder, don't propagate backgroundColor/opaque to the editable textView. It is positioned over the placeholder to accept taps to begin editing, and if it's opaque/colored then it'll obscure the placeholder. - textView.backgroundColor = self.backgroundColor; - textView.opaque = self.opaque; - } else if (self->_displayingPlaceholder && textView == self->_textKitComponents.textView) { - // The default backgroundColor for a textView is white. Due to the reason described above, make sure the editable textView starts out transparent. - textView.backgroundColor = nil; - textView.opaque = NO; - } - textView.textContainerInset = self.textContainerInset; - - // Configure textView with UITextInputTraits - { - AS::MutexLocker l(self->_textInputTraitsLock); - if (self->_textInputTraits) { - textView.autocapitalizationType = self->_textInputTraits.autocapitalizationType; - textView.autocorrectionType = self->_textInputTraits.autocorrectionType; - textView.spellCheckingType = self->_textInputTraits.spellCheckingType; - textView.keyboardType = self->_textInputTraits.keyboardType; - textView.keyboardAppearance = self->_textInputTraits.keyboardAppearance; - textView.returnKeyType = self->_textInputTraits.returnKeyType; - textView.enablesReturnKeyAutomatically = self->_textInputTraits.enablesReturnKeyAutomatically; - textView.secureTextEntry = self->_textInputTraits.isSecureTextEntry; - } - } - - [self.view addSubview:textView]; - }; - - AS::MutexLocker l(_textKitLock); - - // Create and configure the placeholder text view. - _placeholderTextKitComponents.textView = [[ASTextKitComponentsTextView alloc] initWithFrame:CGRectZero textContainer:_placeholderTextKitComponents.textContainer]; - _placeholderTextKitComponents.textView.userInteractionEnabled = NO; - _placeholderTextKitComponents.textView.accessibilityElementsHidden = YES; - configureTextView(_placeholderTextKitComponents.textView); - - // Create and configure our text view. - _textKitComponents.textView = [[ASPanningOverriddenUITextView alloc] initWithFrame:CGRectZero textContainer:_textKitComponents.textContainer]; - _textKitComponents.textView.scrollEnabled = _scrollEnabled; - _textKitComponents.textView.delegate = self; - #if TARGET_OS_IOS - _textKitComponents.textView.editable = YES; - #endif - _textKitComponents.textView.typingAttributes = _typingAttributes; - _textKitComponents.textView.accessibilityHint = _placeholderTextKitComponents.textStorage.string; - configureTextView(_textKitComponents.textView); - - [self _updateDisplayingPlaceholder]; - - // once view is loaded, setters set directly on view - _textInputTraits = nil; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - ASTextKitComponents *displayedComponents = [self isDisplayingPlaceholder] ? _placeholderTextKitComponents : _textKitComponents; - - CGSize textSize; - - if (_maximumLinesToDisplay > 0) { - textSize = [displayedComponents sizeForConstrainedWidth:constrainedSize.width - forMaxNumberOfLines: _maximumLinesToDisplay]; - } else { - textSize = [displayedComponents sizeForConstrainedWidth:constrainedSize.width]; - } - - CGFloat width = std::ceil(textSize.width + _textContainerInset.left + _textContainerInset.right); - CGFloat height = std::ceil(textSize.height + _textContainerInset.top + _textContainerInset.bottom); - return CGSizeMake(std::fmin(width, constrainedSize.width), std::fmin(height, constrainedSize.height)); -} - -- (void)layout -{ - ASDisplayNodeAssertMainThread(); - - [super layout]; - [self _layoutTextView]; -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor -{ - [super setBackgroundColor:backgroundColor]; - - AS::MutexLocker l(_textKitLock); - - // If showing the placeholder, don't propagate backgroundColor/opaque to the editable textView. It is positioned over the placeholder to accept taps to begin editing, and if it's opaque/colored then it'll obscure the placeholder. - // The backgroundColor/opaque will be propagated to the editable textView when editing begins. - if (!_displayingPlaceholder) { - _textKitComponents.textView.backgroundColor = backgroundColor; - } - _placeholderTextKitComponents.textView.backgroundColor = backgroundColor; -} - -- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset -{ - AS::MutexLocker l(_textKitLock); - - _textContainerInset = textContainerInset; - _textKitComponents.textView.textContainerInset = textContainerInset; - _placeholderTextKitComponents.textView.textContainerInset = textContainerInset; -} - -- (void)setOpaque:(BOOL)opaque -{ - [super setOpaque:opaque]; - - AS::MutexLocker l(_textKitLock); - - // If showing the placeholder, don't propagate backgroundColor/opaque to the editable textView. It is positioned over the placeholder to accept taps to begin editing, and if it's opaque/colored then it'll obscure the placeholder. - // The backgroundColor/opaque will be propagated to the editable textView when editing begins. - if (!_displayingPlaceholder) { - _textKitComponents.textView.opaque = opaque; - } - _placeholderTextKitComponents.textView.opaque = opaque; -} - -- (void)setLayerBacked:(BOOL)layerBacked -{ - ASDisplayNodeAssert(!layerBacked, @"Cannot set layerBacked to YES on ASEditableTextNode – instances must be view-backed in order to ensure touch events can be passed to the internal UITextView during editing."); - [super setLayerBacked:layerBacked]; -} - -- (BOOL)supportsLayerBacking -{ - return NO; -} - -#pragma mark - Configuration -@synthesize delegate = _delegate; - -- (void)setScrollEnabled:(BOOL)scrollEnabled -{ - AS::MutexLocker l(_textKitLock); - _scrollEnabled = scrollEnabled; - [_textKitComponents.textView setScrollEnabled:_scrollEnabled]; -} - -- (UITextView *)textView -{ - ASDisplayNodeAssertMainThread(); - [self view]; - ASDisplayNodeAssert(_textKitComponents.textView != nil, @"UITextView must be created in -[ASEditableTextNode didLoad]"); - return _textKitComponents.textView; -} - -- (void)setMaximumLinesToDisplay:(NSUInteger)maximumLines -{ - _maximumLinesToDisplay = maximumLines; - [self setNeedsLayout]; -} - -#pragma mark - -@dynamic typingAttributes; - -- (NSDictionary *)typingAttributes -{ - return _typingAttributes; -} - -- (void)setTypingAttributes:(NSDictionary *)typingAttributes -{ - if (ASObjectIsEqual(typingAttributes, _typingAttributes)) - return; - - _typingAttributes = [typingAttributes copy]; - - AS::MutexLocker l(_textKitLock); - - _textKitComponents.textView.typingAttributes = _typingAttributes; -} - -#pragma mark - -@dynamic selectedRange; - -- (NSRange)selectedRange -{ - AS::MutexLocker l(_textKitLock); - return _textKitComponents.textView.selectedRange; -} - -- (void)setSelectedRange:(NSRange)selectedRange -{ - AS::MutexLocker l(_textKitLock); - _textKitComponents.textView.selectedRange = selectedRange; -} - -#pragma mark - Placeholder -- (BOOL)isDisplayingPlaceholder -{ - return _displayingPlaceholder; -} - -#pragma mark - -@dynamic attributedPlaceholderText; -- (NSAttributedString *)attributedPlaceholderText -{ - AS::MutexLocker l(_textKitLock); - - return [_placeholderTextKitComponents.textStorage copy]; -} - -- (void)setAttributedPlaceholderText:(NSAttributedString *)attributedPlaceholderText -{ - AS::MutexLocker l(_textKitLock); - - if (ASObjectIsEqual(_placeholderTextKitComponents.textStorage, attributedPlaceholderText)) - return; - - [_placeholderTextKitComponents.textStorage setAttributedString:attributedPlaceholderText ? : [[NSAttributedString alloc] initWithString:@""]]; - _textKitComponents.textView.accessibilityHint = attributedPlaceholderText.string; -} - -#pragma mark - Modifying User Text -@dynamic attributedText; -- (NSAttributedString *)attributedText -{ - // Per contract in our header, this value is nil when the placeholder is displayed. - if ([self isDisplayingPlaceholder]) - return nil; - - AS::MutexLocker l(_textKitLock); - - return [_textKitComponents.textStorage copy]; -} - -- (void)setAttributedText:(NSAttributedString *)attributedText -{ - AS::MutexLocker l(_textKitLock); - - // If we (_cmd) are called while the text view itself is updating (-textViewDidUpdate:), you cannot update the text storage and expect perfect propagation to the text view. - // Thus, we always update the textview directly if it's been created already. - if (ASObjectIsEqual((_textKitComponents.textView.attributedText ? : _textKitComponents.textStorage), attributedText)) - return; - - // If the cursor isn't at the end of the text, we need to preserve the selected range to avoid moving the cursor. - NSRange selectedRange = _textKitComponents.textView.selectedRange; - BOOL preserveSelectedRange = (selectedRange.location != _textKitComponents.textStorage.length); - - NSAttributedString *attributedStringToDisplay = nil; - - if (attributedText) - attributedStringToDisplay = attributedText; - // Otherwise, note that we don't simply nil out attributed text. Because the insertion point is guided by the attributes at index 0, we need to attribute an empty string to ensure the insert point obeys our typing attributes. - else - attributedStringToDisplay = [[NSAttributedString alloc] initWithString:@"" attributes:self.typingAttributes]; - - // Always prefer updating the text view directly if it's been created (see above). - if (_textKitComponents.textView) - [_textKitComponents.textView setAttributedText:attributedStringToDisplay]; - else - [_textKitComponents.textStorage setAttributedString:attributedStringToDisplay]; - - // Calculated size depends on the seeded text. - [self setNeedsLayout]; - - // Update if placeholder is shown. - [self _updateDisplayingPlaceholder]; - - // Preserve cursor range, if necessary. - if (preserveSelectedRange) { - _isPreservingSelection = YES; // Used in -textViewDidChangeSelection: to avoid informing our delegate about our preservation. - [_textKitComponents.textView setSelectedRange:selectedRange]; - _isPreservingSelection = NO; - } -} - -#pragma mark - Core -- (void)_updateDisplayingPlaceholder -{ - AS::MutexLocker l(_textKitLock); - - // Show the placeholder if necessary. - _displayingPlaceholder = (_textKitComponents.textStorage.length == 0); - _placeholderTextKitComponents.textView.hidden = !_displayingPlaceholder; - - // If hiding the placeholder, propagate backgroundColor/opaque to the editable textView. It is positioned over the placeholder to accept taps to begin editing, and was kept transparent so it doesn't obscure the placeholder text. Now that we're editing it and the placeholder is hidden, we can make it opaque to avoid unnecessary blending. - if (!_displayingPlaceholder) { - _textKitComponents.textView.opaque = self.isOpaque; - _textKitComponents.textView.backgroundColor = self.backgroundColor; - } else { - _textKitComponents.textView.opaque = NO; - _textKitComponents.textView.backgroundColor = nil; - } -} - -- (void)_layoutTextView -{ - AS::MutexLocker l(_textKitLock); - - // Layout filling our bounds. - _textKitComponents.textView.frame = self.bounds; - _placeholderTextKitComponents.textView.frame = self.bounds; - - // Note that both of these won't be necessary once we can disable scrolling, pending rdar://14729288 - // When we resize to fit (above) the prior layout becomes invalid. For whatever reason, UITextView doesn't invalidate its layout when its frame changes on its own, so we have to do so ourselves. - [_textKitComponents.layoutManager invalidateLayoutForCharacterRange:NSMakeRange(0, [_textKitComponents.textStorage length]) actualCharacterRange:NULL]; - - // When you type beyond UITextView's bounds it scrolls you down a line. We need to remain at the top. - [_textKitComponents.textView setContentOffset:CGPointZero animated:NO]; -} - -#pragma mark - Keyboard -@dynamic textInputMode; -- (UITextInputMode *)textInputMode -{ - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView textInputMode]; -} - -- (BOOL)isFirstResponder -{ - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView isFirstResponder]; -} - -- (BOOL)canBecomeFirstResponder { - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView canBecomeFirstResponder]; -} - -- (BOOL)becomeFirstResponder -{ - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView becomeFirstResponder]; -} - -- (BOOL)canResignFirstResponder { - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView canResignFirstResponder]; -} - -- (BOOL)resignFirstResponder -{ - AS::MutexLocker l(_textKitLock); - return [_textKitComponents.textView resignFirstResponder]; -} - -#pragma mark - UITextInputTraits - -- (_ASTextInputTraitsPendingState *)textInputTraits -{ - if (!_textInputTraits) { - _textInputTraits = [[_ASTextInputTraitsPendingState alloc] init]; - } - return _textInputTraits; -} - -- (void)setAutocapitalizationType:(UITextAutocapitalizationType)autocapitalizationType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setAutocapitalizationType:autocapitalizationType]; - } else { - [self.textInputTraits setAutocapitalizationType:autocapitalizationType]; - } -} - -- (UITextAutocapitalizationType)autocapitalizationType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView autocapitalizationType]; - } else { - return [self.textInputTraits autocapitalizationType]; - } -} - -- (void)setAutocorrectionType:(UITextAutocorrectionType)autocorrectionType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setAutocorrectionType:autocorrectionType]; - } else { - [self.textInputTraits setAutocorrectionType:autocorrectionType]; - } -} - -- (UITextAutocorrectionType)autocorrectionType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView autocorrectionType]; - } else { - return [self.textInputTraits autocorrectionType]; - } -} - -- (void)setSpellCheckingType:(UITextSpellCheckingType)spellCheckingType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setSpellCheckingType:spellCheckingType]; - } else { - [self.textInputTraits setSpellCheckingType:spellCheckingType]; - } -} - -- (UITextSpellCheckingType)spellCheckingType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView spellCheckingType]; - } else { - return [self.textInputTraits spellCheckingType]; - } -} - -- (void)setEnablesReturnKeyAutomatically:(BOOL)enablesReturnKeyAutomatically -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setEnablesReturnKeyAutomatically:enablesReturnKeyAutomatically]; - } else { - [self.textInputTraits setEnablesReturnKeyAutomatically:enablesReturnKeyAutomatically]; - } -} - -- (BOOL)enablesReturnKeyAutomatically -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView enablesReturnKeyAutomatically]; - } else { - return [self.textInputTraits enablesReturnKeyAutomatically]; - } -} - -- (void)setKeyboardAppearance:(UIKeyboardAppearance)setKeyboardAppearance -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setKeyboardAppearance:setKeyboardAppearance]; - } else { - [self.textInputTraits setKeyboardAppearance:setKeyboardAppearance]; - } -} - -- (UIKeyboardAppearance)keyboardAppearance -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView keyboardAppearance]; - } else { - return [self.textInputTraits keyboardAppearance]; - } -} - -- (void)setKeyboardType:(UIKeyboardType)keyboardType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setKeyboardType:keyboardType]; - } else { - [self.textInputTraits setKeyboardType:keyboardType]; - } -} - -- (UIKeyboardType)keyboardType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView keyboardType]; - } else { - return [self.textInputTraits keyboardType]; - } -} - -- (void)setReturnKeyType:(UIReturnKeyType)returnKeyType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setReturnKeyType:returnKeyType]; - } else { - [self.textInputTraits setReturnKeyType:returnKeyType]; - } -} - -- (UIReturnKeyType)returnKeyType -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView returnKeyType]; - } else { - return [self.textInputTraits returnKeyType]; - } -} - -- (void)setSecureTextEntry:(BOOL)secureTextEntry -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - [self.textView setSecureTextEntry:secureTextEntry]; - } else { - [self.textInputTraits setSecureTextEntry:secureTextEntry]; - } -} - -- (BOOL)isSecureTextEntry -{ - AS::MutexLocker l(_textInputTraitsLock); - if (self.isNodeLoaded) { - return [self.textView isSecureTextEntry]; - } else { - return [self.textInputTraits isSecureTextEntry]; - } -} - -#pragma mark - UITextView Delegate -- (BOOL)textViewShouldBeginEditing:(UITextView *)textView -{ - // Delegateify. - return [self _delegateShouldBeginEditing]; -} - -- (void)textViewDidBeginEditing:(UITextView *)textView -{ - // Delegateify. - [self _delegateDidBeginEditing]; -} - -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - // Delegateify. - return [self _delegateShouldChangeTextInRange:range replacementText:text]; -} - -- (void)textViewDidChange:(UITextView *)textView -{ - AS::MutexLocker l(_textKitLock); - - // Note we received a text changed event. - // This is used by _delegateDidChangeSelectionFromSelectedRange:toSelectedRange: to distinguish between selection changes that happen because of editing or pure selection changes. - _selectionChangedForEditedText = YES; - - // Update if the placeholder is visible. - [self _updateDisplayingPlaceholder]; - - // Invalidate, as our calculated size depends on the textview's seeded text. - [self invalidateCalculatedLayout]; - - // Delegateify. - [self _delegateDidUpdateText]; -} - -- (void)textViewDidChangeSelection:(UITextView *)textView -{ - // Typing attributes get reset when selection changes. Reapply them so they actually obey our header. - _textKitComponents.textView.typingAttributes = _typingAttributes; - - // If we're only changing selection to preserve it, don't notify about anything. - if (_isPreservingSelection) - return; - - // Note if we receive a -textDidChange: between now and when we delegatify. - // This is used by _delegateDidChangeSelectionFromSelectedRange:toSelectedRange: to distinguish between selection changes that happen because of editing or pure selection changes. - _selectionChangedForEditedText = NO; - - NSRange fromSelectedRange = _previousSelectedRange; - NSRange toSelectedRange = self.selectedRange; - _previousSelectedRange = toSelectedRange; - - // Delegateify. - [self _delegateDidChangeSelectionFromSelectedRange:fromSelectedRange toSelectedRange:toSelectedRange]; -} - -- (void)textViewDidEndEditing:(UITextView *)textView -{ - // Delegateify. - [self _delegateDidFinishEditing]; -} - -#pragma mark - NSLayoutManager Delegate - -- (NSUInteger)layoutManager:(NSLayoutManager *)layoutManager shouldGenerateGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)properties characterIndexes:(const NSUInteger *)characterIndexes font:(UIFont *)aFont forGlyphRange:(NSRange)glyphRange -{ - return [_wordKerner layoutManager:layoutManager shouldGenerateGlyphs:glyphs properties:properties characterIndexes:characterIndexes font:aFont forGlyphRange:glyphRange]; -} - -- (NSControlCharacterAction)layoutManager:(NSLayoutManager *)layoutManager shouldUseAction:(NSControlCharacterAction)defaultAction forControlCharacterAtIndex:(NSUInteger)characterIndex -{ - return [_wordKerner layoutManager:layoutManager shouldUseAction:defaultAction forControlCharacterAtIndex:characterIndex]; -} - -- (CGRect)layoutManager:(NSLayoutManager *)layoutManager boundingBoxForControlGlyphAtIndex:(NSUInteger)glyphIndex forTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(CGRect)proposedRect glyphPosition:(CGPoint)glyphPosition characterIndex:(NSUInteger)characterIndex -{ - return [_wordKerner layoutManager:layoutManager boundingBoxForControlGlyphAtIndex:glyphIndex forTextContainer:textContainer proposedLineFragment:proposedRect glyphPosition:glyphPosition characterIndex:characterIndex]; -} - -#pragma mark - Geometry -- (CGRect)frameForTextRange:(NSRange)textRange -{ - AS::MutexLocker l(_textKitLock); - - // Bail on invalid range. - if (NSMaxRange(textRange) > [_textKitComponents.textStorage length]) { - ASDisplayNodeAssert(NO, @"Invalid range"); - return CGRectZero; - } - - // Force glyph generation and layout. - [_textKitComponents.layoutManager ensureLayoutForTextContainer:_textKitComponents.textContainer]; - - NSRange glyphRange = [_textKitComponents.layoutManager glyphRangeForCharacterRange:textRange actualCharacterRange:NULL]; - CGRect textRect = [_textKitComponents.layoutManager boundingRectForGlyphRange:glyphRange inTextContainer:_textKitComponents.textContainer]; - return [_textKitComponents.textView convertRect:textRect toView:self.view]; -} - -#pragma mark - -- (BOOL)_delegateShouldBeginEditing -{ - if ([_delegate respondsToSelector:@selector(editableTextNodeShouldBeginEditing:)]) { - return [_delegate editableTextNodeShouldBeginEditing:self]; - } - return YES; -} - -- (void)_delegateDidBeginEditing -{ - if ([_delegate respondsToSelector:@selector(editableTextNodeDidBeginEditing:)]) - [_delegate editableTextNodeDidBeginEditing:self]; -} - -- (BOOL)_delegateShouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - if ([_delegate respondsToSelector:@selector(editableTextNode:shouldChangeTextInRange:replacementText:)]) { - return [_delegate editableTextNode:self shouldChangeTextInRange:range replacementText:text]; - } - - return YES; -} - -- (void)_delegateDidChangeSelectionFromSelectedRange:(NSRange)fromSelectedRange toSelectedRange:(NSRange)toSelectedRange -{ - // There are two reasons we're invoking the delegate on the next run of the runloop. - // 1. UITextView invokes its delegate methods when it's in the middle of text-processing. For example, -textViewDidChange: is invoked before you can truly rely on the changes being propagated throughout the Text Kit hierarchy. - // 2. This delegate method (-textViewDidChangeSelection:) is called both before -textViewDidChange: and before the layout manager/etc. has necessarily generated+laid out its glyphs. Because of the former, we need to wait until -textViewDidChange: has had an opportunity to be called so can accurately determine whether this selection change is due to editing (_selectionChangedForEditedText). - // Thus, to avoid calling out to client code in the middle of UITextView's processing, we call the delegate on the next run of the runloop, when all such internal processing is surely done. - dispatch_async(dispatch_get_main_queue(), ^{ - if ([self->_delegate respondsToSelector:@selector(editableTextNodeDidChangeSelection:fromSelectedRange:toSelectedRange:dueToEditing:)]) - [self->_delegate editableTextNodeDidChangeSelection:self fromSelectedRange:fromSelectedRange toSelectedRange:toSelectedRange dueToEditing:self->_selectionChangedForEditedText]; - }); -} - -- (void)_delegateDidUpdateText -{ - // Note that because -editableTextNodeDidUpdateText: passes no state, the current state of the receiver will be accessed. Thus, it's not useful to enqueue a second delegation call if the first hasn't happened yet -- doing so will result in the delegate receiving -editableTextNodeDidUpdateText: when the "updated text" has already been processed. This may sound innocuous, but because our delegation may cause additional updates to the textview's string, and because such updates discard spelling suggestions and autocompletions (like double-space to `.`), it can actually be quite dangerous! - if (_delegateDidUpdateEnqueued) - return; - - _delegateDidUpdateEnqueued = YES; - - // UITextView invokes its delegate methods when it's in the middle of text-processing. For example, -textViewDidChange: is invoked before you can truly rely on the changes being propagated throughout the Text Kit hierarchy. - // Thus, to avoid calling out to client code in the middle of UITextView's processing, we call the delegate on the next run of the runloop, when all such internal processing is surely done. - dispatch_async(dispatch_get_main_queue(), ^{ - self->_delegateDidUpdateEnqueued = NO; - if ([self->_delegate respondsToSelector:@selector(editableTextNodeDidUpdateText:)]) - [self->_delegate editableTextNodeDidUpdateText:self]; - }); -} - -- (void)_delegateDidFinishEditing -{ - if ([_delegate respondsToSelector:@selector(editableTextNodeDidFinishEditing:)]) - [_delegate editableTextNodeDidFinishEditing:self]; -} - -#pragma mark - UIAccessibilityContainer - -- (NSInteger)accessibilityElementCount -{ - if (!self.isNodeLoaded) { - ASDisplayNodeFailAssert(@"Cannot access accessibilityElementCount since ASEditableTextNode is not loaded"); - return 0; - } - return 1; -} - -- (NSArray *)accessibilityElements -{ - if (!self.isNodeLoaded) { - ASDisplayNodeFailAssert(@"Cannot access accessibilityElements since ASEditableTextNode is not loaded"); - return @[]; - } - return @[self.textView]; -} - -- (id)accessibilityElementAtIndex:(NSInteger)index -{ - if (!self.isNodeLoaded) { - ASDisplayNodeFailAssert(@"Cannot access accessibilityElementAtIndex: since ASEditableTextNode is not loaded"); - return nil; - } - return self.textView; -} - -- (NSInteger)indexOfAccessibilityElement:(id)element -{ - return 0; -} - -@end diff --git a/Example/Pods/Texture/Source/ASExperimentalFeatures.h b/Example/Pods/Texture/Source/ASExperimentalFeatures.h deleted file mode 100644 index a8b655ce..00000000 --- a/Example/Pods/Texture/Source/ASExperimentalFeatures.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// ASExperimentalFeatures.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A bit mask of features. Make sure to update configuration.json when you add entries. - */ -typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) { - // If AS_ENABLE_TEXTNODE=0 or TextNode2 subspec is used this setting is a no op and ASTextNode2 - // will be used in all cases - ASExperimentalTextNode = 1 << 0, // exp_text_node - ASExperimentalInterfaceStateCoalescing = 1 << 1, // exp_interface_state_coalesce - ASExperimentalLayerDefaults = 1 << 2, // exp_infer_layer_defaults - ASExperimentalCollectionTeardown = 1 << 3, // exp_collection_teardown - ASExperimentalFramesetterCache = 1 << 4, // exp_framesetter_cache - ASExperimentalSkipClearData = 1 << 5, // exp_skip_clear_data - ASExperimentalDidEnterPreloadSkipASMLayout = 1 << 6, // exp_did_enter_preload_skip_asm_layout - ASExperimentalDispatchApply = 1 << 7, // exp_dispatch_apply - ASExperimentalDrawingGlobal = 1 << 8, // exp_drawing_global - ASExperimentalOptimizeDataControllerPipeline = 1 << 9, // exp_optimize_data_controller_pipeline - ASExperimentalDisableGlobalTextkitLock = 1 << 10, // exp_disable_global_textkit_lock - ASExperimentalMainThreadOnlyDataController = 1 << 11, // exp_main_thread_only_data_controller - ASExperimentalRangeUpdateOnChangesetUpdate = 1 << 12, // exp_range_update_on_changeset_update - ASExperimentalFeatureAll = 0xFFFFFFFF -}; - -/// Convert flags -> name array. -ASDK_EXTERN NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); - -/// Convert name array -> flags. -ASDK_EXTERN ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASExperimentalFeatures.mm b/Example/Pods/Texture/Source/ASExperimentalFeatures.mm deleted file mode 100644 index 6113dc40..00000000 --- a/Example/Pods/Texture/Source/ASExperimentalFeatures.mm +++ /dev/null @@ -1,52 +0,0 @@ -// -// ASExperimentalFeatures.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NSArray *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags) -{ - NSArray *allNames = ASCreateOnce((@[@"exp_text_node", - @"exp_interface_state_coalesce", - @"exp_infer_layer_defaults", - @"exp_collection_teardown", - @"exp_framesetter_cache", - @"exp_skip_clear_data", - @"exp_did_enter_preload_skip_asm_layout", - @"exp_dispatch_apply", - @"exp_drawing_global", - @"exp_optimize_data_controller_pipeline", - @"exp_disable_global_textkit_lock", - @"exp_main_thread_only_data_controller", - @"exp_range_update_on_changeset_update"])); - if (flags == ASExperimentalFeatureAll) { - return allNames; - } - - // Go through all names, testing each bit. - NSUInteger i = 0; - return ASArrayByFlatMapping(allNames, NSString *name, ({ - (flags & (1 << i++)) ? name : nil; - })); -} - -// O(N^2) but with counts this small, it's probably faster -// than hashing the strings. -ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray *array) -{ - NSArray *allNames = ASExperimentalFeaturesGetNames(ASExperimentalFeatureAll); - ASExperimentalFeatures result = kNilOptions; - for (NSString *str in array) { - NSUInteger i = [allNames indexOfObject:str]; - if (i != NSNotFound) { - result |= (1 << i); - } - } - return result; -} diff --git a/Example/Pods/Texture/Source/ASImageNode+AnimatedImage.mm b/Example/Pods/Texture/Source/ASImageNode+AnimatedImage.mm deleted file mode 100644 index 9716f852..00000000 --- a/Example/Pods/Texture/Source/ASImageNode+AnimatedImage.mm +++ /dev/null @@ -1,400 +0,0 @@ -// -// ASImageNode+AnimatedImage.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#define ASAnimatedImageDebug 0 - -@interface ASNetworkImageNode (Private) -- (void)_locked_setDefaultImage:(UIImage *)image; -@end - - -@implementation ASImageNode (AnimatedImage) - -#pragma mark - GIF support - -- (void)setAnimatedImage:(id )animatedImage -{ - ASLockScopeSelf(); - [self _locked_setAnimatedImage:animatedImage]; -} - -- (void)_locked_setAnimatedImage:(id )animatedImage -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (ASObjectIsEqual(_animatedImage, animatedImage) && (animatedImage == nil || animatedImage.playbackReady)) { - return; - } - - __block id previousAnimatedImage = _animatedImage; - - _animatedImage = animatedImage; - - if (animatedImage != nil) { - __weak ASImageNode *weakSelf = self; - if ([animatedImage respondsToSelector:@selector(setCoverImageReadyCallback:)]) { - animatedImage.coverImageReadyCallback = ^(UIImage *coverImage) { - // In this case the lock is already gone we have to call the unlocked version therefore - [weakSelf setCoverImageCompleted:coverImage]; - }; - } - - animatedImage.playbackReadyCallback = ^{ - // In this case the lock is already gone we have to call the unlocked version therefore - [weakSelf setShouldAnimate:YES]; - }; - if (animatedImage.playbackReady) { - [self _locked_setShouldAnimate:YES]; - } - } else { - // Clean up after ourselves. - - // Don't bother using a `_locked` version for setting contnst as it should be pretty safe calling it with - // reaquire the lock and would add overhead to introduce this version - self.contents = nil; - [self _locked_setCoverImage:nil]; - } - - // Push calling subclass to the next runloop cycle - // We have to schedule the block on the common modes otherwise the tracking mode will not be included and it will - // not fire e.g. while scrolling down - CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopCommonModes, ^(void) { - [self animatedImageSet:animatedImage previousAnimatedImage:previousAnimatedImage]; - }); - // Don't need to wakeup the runloop as the current is already running - // CFRunLoopWakeUp(runLoop); // Should not be necessary -} - -- (void)animatedImageSet:(id )newAnimatedImage previousAnimatedImage:(id )previousAnimatedImage -{ - // Subclass hook should not be called with the lock held - DISABLED_ASAssertUnlocked(__instanceLock__); - - // Subclasses may override -} - -- (id )animatedImage -{ - ASLockScopeSelf(); - return _animatedImage; -} - -- (void)setAnimatedImagePaused:(BOOL)animatedImagePaused -{ - ASLockScopeSelf(); - - _imageNodeFlags.animatedImagePaused = animatedImagePaused; - - [self _locked_setShouldAnimate:!animatedImagePaused]; -} - -- (BOOL)animatedImagePaused -{ - ASLockScopeSelf(); - return _imageNodeFlags.animatedImagePaused; -} - -- (void)setCoverImageCompleted:(UIImage *)coverImage -{ - if (ASInterfaceStateIncludesDisplay(self.interfaceState)) { - ASLockScopeSelf(); - [self _locked_setCoverImageCompleted:coverImage]; - } -} - -- (void)_locked_setCoverImageCompleted:(UIImage *)coverImage -{ - DISABLED_ASAssertLocked(__instanceLock__); - - _displayLinkLock.lock(); - BOOL setCoverImage = (_displayLink == nil) || _displayLink.paused; - _displayLinkLock.unlock(); - - if (setCoverImage) { - [self _locked_setCoverImage:coverImage]; - } -} - -- (void)setCoverImage:(UIImage *)coverImage -{ - ASLockScopeSelf(); - [self _locked_setCoverImage:coverImage]; -} - -- (void)_locked_setCoverImage:(UIImage *)coverImage -{ - DISABLED_ASAssertLocked(__instanceLock__); - - //If we're a network image node, we want to set the default image so - //that it will correctly be restored if it exits the range. -#if ASAnimatedImageDebug - NSLog(@"setting cover image: %p", self); -#endif - if ([self isKindOfClass:[ASNetworkImageNode class]]) { - [(ASNetworkImageNode *)self _locked_setDefaultImage:coverImage]; - } else if (_displayLink == nil || _displayLink.paused == YES) { - [self _locked_setImage:coverImage]; - } -} - -- (NSString *)animatedImageRunLoopMode -{ - AS::MutexLocker l(_displayLinkLock); - return _animatedImageRunLoopMode; -} - -- (void)setAnimatedImageRunLoopMode:(NSString *)runLoopMode -{ - AS::MutexLocker l(_displayLinkLock); - - if (runLoopMode == nil) { - runLoopMode = ASAnimatedImageDefaultRunLoopMode; - } - - if (_displayLink != nil) { - [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_animatedImageRunLoopMode]; - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode]; - } - _animatedImageRunLoopMode = [runLoopMode copy]; -} - -- (void)setShouldAnimate:(BOOL)shouldAnimate -{ - ASLockScopeSelf(); - [self _locked_setShouldAnimate:shouldAnimate]; -} - -- (void)_locked_setShouldAnimate:(BOOL)shouldAnimate -{ - DISABLED_ASAssertLocked(__instanceLock__); - - // This test is explicitly done and not ASPerformBlockOnMainThread as this would perform the block immediately - // on main if called on main thread and we have to call methods locked or unlocked based on which thread we are on - if (ASDisplayNodeThreadIsMain()) { - if (shouldAnimate) { - [self _locked_startAnimating]; - } else { - [self _locked_stopAnimating]; - } - } else { - // We have to dispatch to the main thread and call the regular methods as the lock is already gone if the - // block is called - dispatch_async(dispatch_get_main_queue(), ^{ - if (shouldAnimate) { - [self startAnimating]; - } else { - [self stopAnimating]; - } - }); - } -} - -#pragma mark - Animating - -- (void)startAnimating -{ - ASDisplayNodeAssertMainThread(); - - ASLockScopeSelf(); - [self _locked_startAnimating]; -} - -- (void)_locked_startAnimating -{ - DISABLED_ASAssertLocked(__instanceLock__); - - // It should be safe to call self.interfaceState in this case as it will only grab the lock of the superclass - if (!ASInterfaceStateIncludesVisible(self.interfaceState)) { - return; - } - - if (_imageNodeFlags.animatedImagePaused) { - return; - } - - if (_animatedImage.playbackReady == NO) { - return; - } - -#if ASAnimatedImageDebug - NSLog(@"starting animation: %p", self); -#endif - - AS::MutexLocker l(_displayLinkLock); - if (_displayLink == nil) { - _playHead = 0; - _displayLink = [CADisplayLink displayLinkWithTarget:[ASWeakProxy weakProxyWithTarget:self] selector:@selector(displayLinkFired:)]; - _lastSuccessfulFrameIndex = NSUIntegerMax; - - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:_animatedImageRunLoopMode]; - } else { - _displayLink.paused = NO; - } -} - -- (void)stopAnimating -{ - ASDisplayNodeAssertMainThread(); - - ASLockScopeSelf(); - [self _locked_stopAnimating]; -} - -- (void)_locked_stopAnimating -{ - ASDisplayNodeAssertMainThread(); - DISABLED_ASAssertLocked(__instanceLock__); - -#if ASAnimatedImageDebug - NSLog(@"stopping animation: %p", self); -#endif - ASDisplayNodeAssertMainThread(); - AS::MutexLocker l(_displayLinkLock); - _displayLink.paused = YES; - self.lastDisplayLinkFire = 0; - - [_animatedImage clearAnimatedImageCache]; -} - -#pragma mark - ASDisplayNode - -- (void)didEnterVisibleState -{ - ASDisplayNodeAssertMainThread(); - [super didEnterVisibleState]; - - if (self.animatedImage.coverImageReady) { - [self setCoverImage:self.animatedImage.coverImage]; - } - if (self.animatedImage.playbackReady) { - [self startAnimating]; - } -} - -- (void)didExitVisibleState -{ - ASDisplayNodeAssertMainThread(); - [super didExitVisibleState]; - - [self stopAnimating]; -} - -- (void)didExitDisplayState -{ - ASDisplayNodeAssertMainThread(); -#if ASAnimatedImageDebug - NSLog(@"exiting display state: %p", self); -#endif - - // Check to see if we're an animated image before calling super in case someone - // decides they want to clear out the animatedImage itself on exiting the display - // state - BOOL isAnimatedImage = self.animatedImage != nil; - [super didExitDisplayState]; - - // Also clear out the contents we've set to be good citizens, we'll put it back in when we become visible. - if (isAnimatedImage) { - self.contents = nil; - [self setCoverImage:nil]; - } -} - -#pragma mark - Display Link Callbacks - -- (void)displayLinkFired:(CADisplayLink *)displayLink -{ - ASDisplayNodeAssertMainThread(); - - CFTimeInterval timeBetweenLastFire; - if (self.lastDisplayLinkFire == 0) { - timeBetweenLastFire = 0; - } else if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - timeBetweenLastFire = displayLink.targetTimestamp - displayLink.timestamp; - } else { - timeBetweenLastFire = CACurrentMediaTime() - self.lastDisplayLinkFire; - } - self.lastDisplayLinkFire = CACurrentMediaTime(); - - _playHead += timeBetweenLastFire; - - while (_playHead > self.animatedImage.totalDuration) { - // Set playhead to zero to keep from showing different frames on different playthroughs - _playHead = 0; - _playedLoops++; - } - - if (self.animatedImage.loopCount > 0 && _playedLoops >= self.animatedImage.loopCount) { - [self stopAnimating]; - return; - } - - NSUInteger frameIndex = [self frameIndexAtPlayHeadPosition:_playHead]; - if (frameIndex == _lastSuccessfulFrameIndex) { - return; - } - CGImageRef frameImage = [self.animatedImage imageAtIndex:frameIndex]; - - if (frameImage == nil) { - //Pause the display link until we get a file ready notification - displayLink.paused = YES; - self.lastDisplayLinkFire = 0; - } else { - self.contents = (__bridge id)frameImage; - _lastSuccessfulFrameIndex = frameIndex; - [self displayDidFinish]; - } -} - -- (NSUInteger)frameIndexAtPlayHeadPosition:(CFTimeInterval)playHead -{ - ASDisplayNodeAssertMainThread(); - NSUInteger frameIndex = 0; - for (NSUInteger durationIndex = 0; durationIndex < self.animatedImage.frameCount; durationIndex++) { - playHead -= [self.animatedImage durationAtIndex:durationIndex]; - if (playHead < 0) { - return frameIndex; - } - frameIndex++; - } - - return frameIndex; -} - -@end - -#pragma mark - ASImageNode(AnimatedImageInvalidation) - -@implementation ASImageNode(AnimatedImageInvalidation) - -- (void)invalidateAnimatedImage -{ - AS::MutexLocker l(_displayLinkLock); -#if ASAnimatedImageDebug - if (_displayLink) { - NSLog(@"invalidating display link"); - } -#endif - [_displayLink invalidate]; - _displayLink = nil; -} - -@end diff --git a/Example/Pods/Texture/Source/ASImageNode.h b/Example/Pods/Texture/Source/ASImageNode.h deleted file mode 100644 index dcdb1106..00000000 --- a/Example/Pods/Texture/Source/ASImageNode.h +++ /dev/null @@ -1,212 +0,0 @@ -// -// ASImageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASAnimatedImageProtocol; - -/** - * Image modification block. Use to transform an image before display. - * - * @param image The image to be displayed. - * - * @return A transformed image. - */ -typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image, ASPrimitiveTraitCollection traitCollection); - -/** - * @abstract Draws images. - * @discussion Supports cropping, tinting, and arbitrary image modification blocks. - */ -@interface ASImageNode : ASControlNode - -/** - * @abstract The image to display. - * - * @discussion The node will efficiently display stretchable images by using - * the layer's contentsCenter property. Non-stretchable images work too, of - * course. - */ -@property (nullable) UIImage *image; - -/** - @abstract The placeholder color. - */ -@property (nullable, copy) UIColor *placeholderColor; - -/** - * @abstract Indicates whether efficient cropping of the receiver is enabled. - * - * @discussion Defaults to YES. See -setCropEnabled:recropImmediately:inBounds: for more - * information. - */ -@property (getter=isCropEnabled) BOOL cropEnabled; - -/** - * @abstract Indicates that efficient downsizing of backing store should *not* be enabled. - * - * @discussion Defaults to NO. @see ASCroppedImageBackingSizeAndDrawRectInBounds for more - * information. - */ -@property BOOL forceUpscaling; - -/** - * @abstract Forces image to be rendered at forcedSize. - * @discussion Defaults to CGSizeZero to indicate that the forcedSize should not be used. - * Setting forcedSize to non-CGSizeZero will force the backing of the layer contents to - * be forcedSize (automatically adjusted for contentsSize). - */ -@property CGSize forcedSize; - -/** - * @abstract Enables or disables efficient cropping. - * - * @param cropEnabled YES to efficiently crop the receiver's contents such that - * contents outside of its bounds are not included; NO otherwise. - * - * @param recropImmediately If the receiver has an image, YES to redisplay the - * receiver immediately; NO otherwise. - * - * @param cropBounds The bounds into which the receiver will be cropped. Useful - * if bounds are to change in response to cropping (but have not yet done so). - * - * @discussion Efficient cropping is only performed when the receiver's view's - * contentMode is UIViewContentModeScaleAspectFill. By default, cropping is - * enabled. The crop alignment may be controlled via cropAlignmentFactor. - */ -- (void)setCropEnabled:(BOOL)cropEnabled recropImmediately:(BOOL)recropImmediately inBounds:(CGRect)cropBounds; - -/** - * @abstract A value that controls how the receiver's efficient cropping is aligned. - * - * @discussion This value defines a rectangle that is to be featured by the - * receiver. The rectangle is specified as a "unit rectangle," using - * fractions of the source image's width and height, e.g. CGRectMake(0.5, 0, - * 0.5, 1.0) will feature the full right half a photo. If the cropRect is - * empty, the content mode of the receiver will be used to determine its - * dimensions, and only the cropRect's origin will be used for positioning. The - * default value of this property is CGRectMake(0.5, 0.5, 0.0, 0.0). - */ -@property CGRect cropRect; - -/** - * @abstract An optional block which can perform drawing operations on image - * during the display phase. - * - * @discussion Can be used to add image effects (such as rounding, adding - * borders, or other pattern overlays) without extraneous display calls. - */ -@property (nullable) asimagenode_modification_block_t imageModificationBlock; - -/** - * @abstract Marks the receiver as needing display and performs a block after - * display has finished. - * - * @param displayCompletionBlock The block to be performed after display has - * finished. Its `canceled` property will be YES if display was prevented or - * canceled (via displaySuspended); NO otherwise. - * - * @discussion displayCompletionBlock will be performed on the main-thread. If - * `displaySuspended` is YES, `displayCompletionBlock` is will be - * performed immediately and `YES` will be passed for `canceled`. - */ -- (void)setNeedsDisplayWithCompletion:(nullable void (^)(BOOL canceled))displayCompletionBlock; - -#if TARGET_OS_TV -/** - * A bool to track if the current appearance of the node - * is the default focus appearance. - * Exposed here so the category methods can set it. - */ -@property BOOL isDefaultFocusAppearance; -#endif - -@end - -#if TARGET_OS_TV -@interface ASImageNode (tvOS) -@end -#endif - -@interface ASImageNode (AnimatedImage) - -/** - * @abstract The animated image to playback - * - * @discussion Set this to an object which conforms to ASAnimatedImageProtocol - * to have the ASImageNode playback an animated image. - * @warning this method should not be overridden, it may not always be called as - * another method is used internally. If you need to know when the animatedImage - * is set, override @c animatedImageSet:previousAnimatedImage: - */ -@property (nullable) id animatedImage; - -/** - * @abstract Pause the playback of an animated image. - * - * @discussion Set to YES to pause playback of an animated image and NO to resume - * playback. - */ -@property BOOL animatedImagePaused; - -/** - * @abstract The runloop mode used to animate the image. - * - * @discussion Defaults to NSRunLoopCommonModes. Another commonly used mode is NSDefaultRunLoopMode. - * Setting NSDefaultRunLoopMode will cause animation to pause while scrolling (if the ASImageNode is - * in a scroll view), which may improve scroll performance in some use cases. - */ -@property (copy) NSString *animatedImageRunLoopMode; - -/** - * @abstract Method called when animated image has been set - * - * @discussion This method is for subclasses to override so they can know if an animated image - * has been set on the node. - */ -- (void)animatedImageSet:(nullable id )newAnimatedImage previousAnimatedImage:(nullable id )previousAnimatedImage ASDISPLAYNODE_REQUIRES_SUPER; - -@end - -@interface ASImageNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE(); - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock AS_UNAVAILABLE(); - -@end - -/** - * @abstract Image modification block that rounds (and optionally adds a border to) an image. - * - * @param borderWidth The width of the round border to draw, or zero if no border is desired. - * @param borderColor What colour border to draw. - * - * @see - * - * @return An ASImageNode image modification block. - */ -ASDK_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); - -/** - * @abstract Image modification block that applies a tint color à la UIImage configured with - * renderingMode set to UIImageRenderingModeAlwaysTemplate. - * - * @param color The color to tint the image. - * - * @see - * - * @return An ASImageNode image modification block. - */ -ASDK_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASImageNode.mm b/Example/Pods/Texture/Source/ASImageNode.mm deleted file mode 100644 index 95ac2014..00000000 --- a/Example/Pods/Texture/Source/ASImageNode.mm +++ /dev/null @@ -1,837 +0,0 @@ -// -// ASImageNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -// TODO: It would be nice to remove this dependency; it's the only subclass using more than +FrameworkSubclasses.h -#import - -typedef void (^ASImageNodeDrawParametersBlock)(ASWeakMapEntry *entry); - -@interface ASImageNodeDrawParameters : NSObject { -@package - UIImage *_image; - BOOL _opaque; - CGRect _bounds; - CGFloat _contentsScale; - UIColor *_backgroundColor; - UIColor *_tintColor; - UIViewContentMode _contentMode; - BOOL _cropEnabled; - BOOL _forceUpscaling; - CGSize _forcedSize; - CGRect _cropRect; - CGRect _cropDisplayBounds; - asimagenode_modification_block_t _imageModificationBlock; - ASDisplayNodeContextModifier _willDisplayNodeContentWithRenderingContext; - ASDisplayNodeContextModifier _didDisplayNodeContentWithRenderingContext; - ASImageNodeDrawParametersBlock _didDrawBlock; - ASPrimitiveTraitCollection _traitCollection; -} - -@end - -@implementation ASImageNodeDrawParameters - -@end - -/** - * Contains all data that is needed to generate the content bitmap. - */ -@interface ASImageNodeContentsKey : NSObject - -@property (nonatomic) UIImage *image; -@property CGSize backingSize; -@property CGRect imageDrawRect; -@property BOOL isOpaque; -@property (nonatomic, copy) UIColor *backgroundColor; -@property (nonatomic, copy) UIColor *tintColor; -@property (nonatomic) ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext; -@property (nonatomic) ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext; -@property (nonatomic) asimagenode_modification_block_t imageModificationBlock; -@property UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(tvos(10.0), ios(12.0)); -@end - -@implementation ASImageNodeContentsKey - -- (BOOL)isEqual:(id)object -{ - if (self == object) { - return YES; - } - - // Optimization opportunity: The `isKindOfClass` call here could be avoided by not using the NSObject `isEqual:` - // convention and instead using a custom comparison function that assumes all items are heterogeneous. - // However, profiling shows that our entire `isKindOfClass` expression is only ~1/40th of the total - // overheard of our caching, so it's likely not high-impact. - if ([object isKindOfClass:[ASImageNodeContentsKey class]]) { - ASImageNodeContentsKey *other = (ASImageNodeContentsKey *)object; - BOOL areKeysEqual = [_image isEqual:other.image] - && CGSizeEqualToSize(_backingSize, other.backingSize) - && CGRectEqualToRect(_imageDrawRect, other.imageDrawRect) - && _isOpaque == other.isOpaque - && [_backgroundColor isEqual:other.backgroundColor] - && [_tintColor isEqual:other.tintColor] - && _willDisplayNodeContentWithRenderingContext == other.willDisplayNodeContentWithRenderingContext - && _didDisplayNodeContentWithRenderingContext == other.didDisplayNodeContentWithRenderingContext - && _imageModificationBlock == other.imageModificationBlock; - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - // iOS 12, tvOS 10 and later (userInterfaceStyle only available in iOS12+) - areKeysEqual = areKeysEqual && _userInterfaceStyle == other.userInterfaceStyle; - } - return areKeysEqual; - } else { - return NO; - } -} - -- (NSUInteger)hash -{ -#pragma clang diagnostic push -#pragma clang diagnostic warning "-Wpadded" - struct { - NSUInteger imageHash; - CGSize backingSize; - CGRect imageDrawRect; - NSInteger isOpaque; - NSUInteger backgroundColorHash; - NSUInteger tintColorHash; - void *willDisplayNodeContentWithRenderingContext; - void *didDisplayNodeContentWithRenderingContext; - void *imageModificationBlock; -#pragma clang diagnostic pop - } data = { - _image.hash, - _backingSize, - _imageDrawRect, - _isOpaque, - _backgroundColor.hash, - _tintColor.hash, - (void *)_willDisplayNodeContentWithRenderingContext, - (void *)_didDisplayNodeContentWithRenderingContext, - (void *)_imageModificationBlock - }; - return ASHashBytes(&data, sizeof(data)); -} - -@end - -@implementation ASImageNode -{ -@private - UIImage *_image; - ASWeakMapEntry *_weakCacheEntry; // Holds a reference that keeps our contents in cache. - UIColor *_placeholderColor; - - void (^_displayCompletionBlock)(BOOL canceled); - - // Drawing - ASTextNode *_debugLabelNode; - - // Cropping. - CGSize _forcedSize; //Defaults to CGSizeZero, indicating no forced size. - CGRect _cropRect; // Defaults to CGRectMake(0.5, 0.5, 0, 0) - CGRect _cropDisplayBounds; // Defaults to CGRectNull -} - -@synthesize image = _image; -@synthesize imageModificationBlock = _imageModificationBlock; - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - // TODO can this be removed? - self.contentsScale = ASScreenScale(); - self.contentMode = UIViewContentModeScaleAspectFill; - self.opaque = NO; - self.clipsToBounds = YES; - - // If no backgroundColor is set to the image node and it's a subview of UITableViewCell, UITableView is setting - // the opaque value of all subviews to YES if highlighting / selection is happening and does not set it back to the - // initial value. With setting a explicit backgroundColor we can prevent that change. - self.backgroundColor = [UIColor clearColor]; - - _imageNodeFlags.cropEnabled = YES; - _imageNodeFlags.forceUpscaling = NO; - _imageNodeFlags.regenerateFromImageAsset = NO; - _cropRect = CGRectMake(0.5, 0.5, 0, 0); - _cropDisplayBounds = CGRectNull; - _placeholderColor = ASDisplayNodeDefaultPlaceholderColor(); - _animatedImageRunLoopMode = ASAnimatedImageDefaultRunLoopMode; - - return self; -} - -- (void)dealloc -{ - // Invalidate all components around animated images - [self invalidateAnimatedImage]; -} - -#pragma mark - Placeholder - -- (UIImage *)placeholderImage -{ - // FIXME: Replace this implementation with reusable CALayers that have .backgroundColor set. - // This would completely eliminate the memory and performance cost of the backing store. - CGSize size = self.calculatedSize; - if ((size.width * size.height) < CGFLOAT_EPSILON) { - return nil; - } - - __instanceLock__.lock(); - ASPrimitiveTraitCollection tc = _primitiveTraitCollection; - __instanceLock__.unlock(); - return ASGraphicsCreateImage(tc, size, NO, 1, nil, nil, ^{ - AS::MutexLocker l(__instanceLock__); - [_placeholderColor setFill]; - UIRectFill(CGRectMake(0, 0, size.width, size.height)); - }); -} - -#pragma mark - Layout and Sizing - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - const auto image = ASLockedSelf(_image); - - if (image == nil) { - return [super calculateSizeThatFits:constrainedSize]; - } - - return image.size; -} - -#pragma mark - Setter / Getter - -- (void)setImage:(UIImage *)image -{ - AS::MutexLocker l(__instanceLock__); - [self _locked_setImage:image]; -} - -- (void)_locked_setImage:(UIImage *)image -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (ASObjectIsEqual(_image, image)) { - return; - } - - _image = image; - - if (image != nil) { - // We explicitly call setNeedsDisplay in this case, although we know setNeedsDisplay will be called with lock held. - // Therefore we have to be careful in methods that are involved with setNeedsDisplay to not run into a deadlock - [self setNeedsDisplay]; - - // For debugging purposes we don't care about locking for now - if ([ASImageNode shouldShowImageScalingOverlay] && _debugLabelNode == nil) { - // do not use ASPerformBlockOnMainThread here, if it performs the block synchronously it will continue - // holding the lock while calling addSubnode. - dispatch_async(dispatch_get_main_queue(), ^{ - self->_debugLabelNode = [[ASTextNode alloc] init]; - self->_debugLabelNode.layerBacked = YES; - [self addSubnode:self->_debugLabelNode]; - }); - } - } else { - self.contents = nil; - } -} - -- (UIImage *)image -{ - return ASLockedSelf(_image); -} - -- (UIColor *)placeholderColor -{ - return ASLockedSelf(_placeholderColor); -} - -- (void)setPlaceholderColor:(UIColor *)placeholderColor -{ - ASLockScopeSelf(); - if (ASCompareAssignCopy(_placeholderColor, placeholderColor)) { - _flags.placeholderEnabled = (placeholderColor != nil); - } -} - -#pragma mark - Drawing - -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - ASImageNodeDrawParameters *drawParameters = [[ASImageNodeDrawParameters alloc] init]; - - { - ASLockScopeSelf(); - UIImage *drawImage = _image; - if (AS_AVAILABLE_IOS_TVOS(13, 10)) { - if (_imageNodeFlags.regenerateFromImageAsset && drawImage != nil) { - _imageNodeFlags.regenerateFromImageAsset = NO; - UITraitCollection *tc = [UITraitCollection traitCollectionWithUserInterfaceStyle:_primitiveTraitCollection.userInterfaceStyle]; - UIImage *generatedImage = [drawImage.imageAsset imageWithTraitCollection:tc]; - if ( generatedImage != nil ) { - drawImage = generatedImage; - } - } - } - - drawParameters->_image = drawImage; - drawParameters->_contentsScale = _contentsScaleForDisplay; - drawParameters->_cropEnabled = _imageNodeFlags.cropEnabled; - drawParameters->_forceUpscaling = _imageNodeFlags.forceUpscaling; - drawParameters->_forcedSize = _forcedSize; - drawParameters->_cropRect = _cropRect; - drawParameters->_cropDisplayBounds = _cropDisplayBounds; - drawParameters->_imageModificationBlock = _imageModificationBlock; - drawParameters->_willDisplayNodeContentWithRenderingContext = _willDisplayNodeContentWithRenderingContext; - drawParameters->_didDisplayNodeContentWithRenderingContext = _didDisplayNodeContentWithRenderingContext; - drawParameters->_traitCollection = _primitiveTraitCollection; - - // Hack for now to retain the weak entry that was created while this drawing happened - drawParameters->_didDrawBlock = ^(ASWeakMapEntry *entry){ - ASLockScopeSelf(); - self->_weakCacheEntry = entry; - }; - } - - // We need to unlock before we access the other accessor. - // Especially tintColor because it needs to walk up the view hierarchy - drawParameters->_bounds = [self threadSafeBounds]; - drawParameters->_opaque = self.opaque; - drawParameters->_backgroundColor = self.backgroundColor; - drawParameters->_contentMode = self.contentMode; - drawParameters->_tintColor = self.tintColor; - - return drawParameters; -} - -+ (UIImage *)displayWithParameters:(id)parameter isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelled -{ - ASImageNodeDrawParameters *drawParameter = (ASImageNodeDrawParameters *)parameter; - - UIImage *image = drawParameter->_image; - if (image == nil) { - return nil; - } - - CGRect drawParameterBounds = drawParameter->_bounds; - BOOL forceUpscaling = drawParameter->_forceUpscaling; - CGSize forcedSize = drawParameter->_forcedSize; - BOOL cropEnabled = drawParameter->_cropEnabled; - BOOL isOpaque = drawParameter->_opaque; - UIColor *backgroundColor = drawParameter->_backgroundColor; - UIColor *tintColor = drawParameter->_tintColor; - UIViewContentMode contentMode = drawParameter->_contentMode; - CGFloat contentsScale = drawParameter->_contentsScale; - CGRect cropDisplayBounds = drawParameter->_cropDisplayBounds; - CGRect cropRect = drawParameter->_cropRect; - asimagenode_modification_block_t imageModificationBlock = drawParameter->_imageModificationBlock; - ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext = drawParameter->_willDisplayNodeContentWithRenderingContext; - ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext = drawParameter->_didDisplayNodeContentWithRenderingContext; - - BOOL hasValidCropBounds = cropEnabled && !CGRectIsEmpty(cropDisplayBounds); - CGRect bounds = (hasValidCropBounds ? cropDisplayBounds : drawParameterBounds); - - - ASDisplayNodeAssert(contentsScale > 0, @"invalid contentsScale at display time"); - - // if the image is resizable, bail early since the image has likely already been configured - BOOL stretchable = !UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero); - if (stretchable) { - if (imageModificationBlock != NULL) { - image = imageModificationBlock(image, drawParameter->_traitCollection); - } - return image; - } - - CGSize imageSize = image.size; - CGSize imageSizeInPixels = CGSizeMake(imageSize.width * image.scale, imageSize.height * image.scale); - CGSize boundsSizeInPixels = CGSizeMake(std::floor(bounds.size.width * contentsScale), std::floor(bounds.size.height * contentsScale)); - - BOOL contentModeSupported = contentMode == UIViewContentModeScaleAspectFill || - contentMode == UIViewContentModeScaleAspectFit || - contentMode == UIViewContentModeCenter; - - CGSize backingSize = CGSizeZero; - CGRect imageDrawRect = CGRectZero; - - if (boundsSizeInPixels.width * contentsScale < 1.0f || boundsSizeInPixels.height * contentsScale < 1.0f || - imageSizeInPixels.width < 1.0f || imageSizeInPixels.height < 1.0f) { - return nil; - } - - - // If we're not supposed to do any cropping, just decode image at original size - if (!cropEnabled || !contentModeSupported) { - backingSize = imageSizeInPixels; - imageDrawRect = (CGRect){.size = backingSize}; - } else { - if (CGSizeEqualToSize(CGSizeZero, forcedSize) == NO) { - //scale forced size - forcedSize.width *= contentsScale; - forcedSize.height *= contentsScale; - } - ASCroppedImageBackingSizeAndDrawRectInBounds(imageSizeInPixels, - boundsSizeInPixels, - contentMode, - cropRect, - forceUpscaling, - forcedSize, - &backingSize, - &imageDrawRect); - } - - if (backingSize.width <= 0.0f || backingSize.height <= 0.0f || - imageDrawRect.size.width <= 0.0f || imageDrawRect.size.height <= 0.0f) { - return nil; - } - - ASImageNodeContentsKey *contentsKey = [[ASImageNodeContentsKey alloc] init]; - contentsKey.image = image; - contentsKey.backingSize = backingSize; - contentsKey.imageDrawRect = imageDrawRect; - contentsKey.isOpaque = isOpaque; - contentsKey.backgroundColor = backgroundColor; - contentsKey.tintColor = tintColor; - contentsKey.willDisplayNodeContentWithRenderingContext = willDisplayNodeContentWithRenderingContext; - contentsKey.didDisplayNodeContentWithRenderingContext = didDisplayNodeContentWithRenderingContext; - contentsKey.imageModificationBlock = imageModificationBlock; - - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - contentsKey.userInterfaceStyle = drawParameter->_traitCollection.userInterfaceStyle; - } - - if (isCancelled()) { - return nil; - } - - ASWeakMapEntry *entry = [self.class contentsForkey:contentsKey - drawParameters:parameter - isCancelled:isCancelled]; - // If nil, we were cancelled. - if (entry == nil) { - return nil; - } - - if (drawParameter->_didDrawBlock) { - drawParameter->_didDrawBlock(entry); - } - - return entry.value; -} - -static ASWeakMap *cache = nil; - -+ (ASWeakMapEntry *)contentsForkey:(ASImageNodeContentsKey *)key drawParameters:(id)drawParameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelled -{ - static dispatch_once_t onceToken; - static AS::Mutex *cacheLock = nil; - dispatch_once(&onceToken, ^{ - cacheLock = new AS::Mutex(); - }); - - { - AS::MutexLocker l(*cacheLock); - if (!cache) { - cache = [[ASWeakMap alloc] init]; - } - ASWeakMapEntry *entry = [cache entryForKey:key]; - if (entry != nil) { - return entry; - } - } - - // cache miss - UIImage *contents = [self createContentsForkey:key drawParameters:drawParameters isCancelled:isCancelled]; - if (contents == nil) { // If nil, we were cancelled - return nil; - } - - { - AS::MutexLocker l(*cacheLock); - return [cache setObject:contents forKey:key]; - } -} - -+ (UIImage *)createContentsForkey:(ASImageNodeContentsKey *)key drawParameters:(id)parameter isCancelled:(asdisplaynode_iscancelled_block_t)isCancelled -{ - // The following `ASGraphicsCreateImage` call will sometimes take take longer than 5ms on an - // A5 processor for a 400x800 backingSize. - // Check for cancellation before we call it. - if (isCancelled()) { - return nil; - } - - ASImageNodeDrawParameters *drawParameters = (ASImageNodeDrawParameters *)parameter; - - // Use contentsScale of 1.0 and do the contentsScale handling in boundsSizeInPixels so ASCroppedImageBackingSizeAndDrawRectInBounds - // will do its rounding on pixel instead of point boundaries - UIImage *result = ASGraphicsCreateImage(drawParameters->_traitCollection, key.backingSize, key.isOpaque, 1.0, key.image, isCancelled, ^{ - BOOL contextIsClean = YES; - - CGContextRef context = UIGraphicsGetCurrentContext(); - if (context && key.willDisplayNodeContentWithRenderingContext) { - key.willDisplayNodeContentWithRenderingContext(context, drawParameters); - contextIsClean = NO; - } - - // if view is opaque, fill the context with background color - if (key.isOpaque && key.backgroundColor) { - [key.backgroundColor setFill]; - UIRectFill({ .size = key.backingSize }); - contextIsClean = NO; - } - - // iOS 9 appears to contain a thread safety regression when drawing the same CGImageRef on - // multiple threads concurrently. In fact, instead of crashing, it appears to deadlock. - // The issue is present in Mac OS X El Capitan and has been seen hanging Pro apps like Adobe Premiere, - // as well as iOS games, and a small number of ASDK apps that provide the same image reference - // to many separate ASImageNodes. A workaround is to set .displaysAsynchronously = NO for the nodes - // that may get the same pointer for a given UI asset image, etc. - // FIXME: We should replace @synchronized here, probably using a global, locked NSMutableSet, and - // only if the object already exists in the set we should create a semaphore to signal waiting threads - // upon removal of the object from the set when the operation completes. - // Another option is to have ASDisplayNode+AsyncDisplay coordinate these cases, and share the decoded buffer. - // Details tracked in https://github.com/facebook/AsyncDisplayKit/issues/1068 - - UIImage *image = key.image; - BOOL canUseCopy = (contextIsClean || ASImageAlphaInfoIsOpaque(CGImageGetAlphaInfo(image.CGImage))); - CGBlendMode blendMode = canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal; - UIImageRenderingMode renderingMode = [image renderingMode]; - if (renderingMode == UIImageRenderingModeAlwaysTemplate && key.tintColor) { - [key.tintColor setFill]; - } - - @synchronized(image) { - [image drawInRect:key.imageDrawRect blendMode:blendMode alpha:1]; - } - - if (context && key.didDisplayNodeContentWithRenderingContext) { - key.didDisplayNodeContentWithRenderingContext(context, drawParameters); - } - }); - - // if the original image was stretchy, keep it stretchy - UIImage *originalImage = key.image; - if (!UIEdgeInsetsEqualToEdgeInsets(originalImage.capInsets, UIEdgeInsetsZero)) { - result = [result resizableImageWithCapInsets:originalImage.capInsets resizingMode:originalImage.resizingMode]; - } - - if (key.imageModificationBlock) { - result = key.imageModificationBlock(result, drawParameters->_traitCollection); - } - - return result; -} - -- (void)displayDidFinish -{ - [super displayDidFinish]; - - __instanceLock__.lock(); - UIImage *image = _image; - void (^displayCompletionBlock)(BOOL canceled) = _displayCompletionBlock; - BOOL shouldPerformDisplayCompletionBlock = (image && displayCompletionBlock); - - // Clear the ivar now. The block is retained and will be executed shortly. - if (shouldPerformDisplayCompletionBlock) { - _displayCompletionBlock = nil; - } - - BOOL hasDebugLabel = (_debugLabelNode != nil); - __instanceLock__.unlock(); - - // Update the debug label if necessary - if (hasDebugLabel) { - // For debugging purposes we don't care about locking for now - CGSize imageSize = image.size; - CGSize imageSizeInPixels = CGSizeMake(imageSize.width * image.scale, imageSize.height * image.scale); - CGSize boundsSizeInPixels = CGSizeMake(std::floor(self.bounds.size.width * self.contentsScale), std::floor(self.bounds.size.height * self.contentsScale)); - CGFloat pixelCountRatio = (imageSizeInPixels.width * imageSizeInPixels.height) / (boundsSizeInPixels.width * boundsSizeInPixels.height); - if (pixelCountRatio != 1.0) { - NSString *scaleString = [NSString stringWithFormat:@"%.2fx", pixelCountRatio]; - _debugLabelNode.attributedText = [[NSAttributedString alloc] initWithString:scaleString attributes:[self debugLabelAttributes]]; - _debugLabelNode.hidden = NO; - } else { - _debugLabelNode.hidden = YES; - _debugLabelNode.attributedText = nil; - } - } - - // If we've got a block to perform after displaying, do it. - if (shouldPerformDisplayCompletionBlock) { - displayCompletionBlock(NO); - } -} - -- (void)setNeedsDisplayWithCompletion:(void (^ _Nullable)(BOOL canceled))displayCompletionBlock -{ - if (self.displaySuspended) { - if (displayCompletionBlock) - displayCompletionBlock(YES); - return; - } - - // Stash the block and call-site queue. We'll invoke it in -displayDidFinish. - { - AS::MutexLocker l(__instanceLock__); - if (_displayCompletionBlock != displayCompletionBlock) { - _displayCompletionBlock = displayCompletionBlock; - } - } - - [self setNeedsDisplay]; -} - -- (void)_setNeedsDisplayOnTemplatedImages -{ - BOOL isTemplateImage = NO; - { - AS::MutexLocker l(__instanceLock__); - isTemplateImage = (_image.renderingMode == UIImageRenderingModeAlwaysTemplate); - } - - if (isTemplateImage) { - [self setNeedsDisplay]; - } -} - -- (void)tintColorDidChange -{ - [super tintColorDidChange]; - - [self _setNeedsDisplayOnTemplatedImages]; -} - -#pragma mark Interface State - -- (void)didEnterHierarchy -{ - [super didEnterHierarchy]; - - [self _setNeedsDisplayOnTemplatedImages]; -} - -- (void)clearContents -{ - [super clearContents]; - - AS::MutexLocker l(__instanceLock__); - _weakCacheEntry = nil; // release contents from the cache. -} - -#pragma mark - Cropping - -- (BOOL)isCropEnabled -{ - AS::MutexLocker l(__instanceLock__); - return _imageNodeFlags.cropEnabled; -} - -- (void)setCropEnabled:(BOOL)cropEnabled -{ - [self setCropEnabled:cropEnabled recropImmediately:NO inBounds:self.bounds]; -} - -- (void)setCropEnabled:(BOOL)cropEnabled recropImmediately:(BOOL)recropImmediately inBounds:(CGRect)cropBounds -{ - __instanceLock__.lock(); - if (_imageNodeFlags.cropEnabled == cropEnabled) { - __instanceLock__.unlock(); - return; - } - - _imageNodeFlags.cropEnabled = cropEnabled; - _cropDisplayBounds = cropBounds; - - UIImage *image = _image; - __instanceLock__.unlock(); - - // If we have an image to display, display it, respecting our recrop flag. - if (image != nil) { - ASPerformBlockOnMainThread(^{ - if (recropImmediately) - [self displayImmediately]; - else - [self setNeedsDisplay]; - }); - } -} - -- (CGRect)cropRect -{ - AS::MutexLocker l(__instanceLock__); - return _cropRect; -} - -- (void)setCropRect:(CGRect)cropRect -{ - { - AS::MutexLocker l(__instanceLock__); - if (CGRectEqualToRect(_cropRect, cropRect)) { - return; - } - - _cropRect = cropRect; - } - - // TODO: this logic needs to be updated to respect cropRect. - CGSize boundsSize = self.bounds.size; - CGSize imageSize = self.image.size; - - BOOL isCroppingImage = ((boundsSize.width < imageSize.width) || (boundsSize.height < imageSize.height)); - - // Re-display if we need to. - ASPerformBlockOnMainThread(^{ - if (self.nodeLoaded && self.contentMode == UIViewContentModeScaleAspectFill && isCroppingImage) - [self setNeedsDisplay]; - }); -} - -- (BOOL)forceUpscaling -{ - AS::MutexLocker l(__instanceLock__); - return _imageNodeFlags.forceUpscaling; -} - -- (void)setForceUpscaling:(BOOL)forceUpscaling -{ - AS::MutexLocker l(__instanceLock__); - _imageNodeFlags.forceUpscaling = forceUpscaling; -} - -- (CGSize)forcedSize -{ - AS::MutexLocker l(__instanceLock__); - return _forcedSize; -} - -- (void)setForcedSize:(CGSize)forcedSize -{ - AS::MutexLocker l(__instanceLock__); - _forcedSize = forcedSize; -} - -- (asimagenode_modification_block_t)imageModificationBlock -{ - AS::MutexLocker l(__instanceLock__); - return _imageModificationBlock; -} - -- (void)setImageModificationBlock:(asimagenode_modification_block_t)imageModificationBlock -{ - AS::MutexLocker l(__instanceLock__); - _imageModificationBlock = imageModificationBlock; -} - -#pragma mark - Debug - -- (void)layout -{ - [super layout]; - - if (_debugLabelNode) { - CGSize boundsSize = self.bounds.size; - CGSize debugLabelSize = [_debugLabelNode layoutThatFits:ASSizeRangeMake(CGSizeZero, boundsSize)].size; - CGPoint debugLabelOrigin = CGPointMake(boundsSize.width - debugLabelSize.width, - boundsSize.height - debugLabelSize.height); - _debugLabelNode.frame = (CGRect) {debugLabelOrigin, debugLabelSize}; - } -} - -- (NSDictionary *)debugLabelAttributes -{ - return @{ - NSFontAttributeName: [UIFont systemFontOfSize:15.0], - NSForegroundColorAttributeName: [UIColor redColor] - }; -} - -- (void)asyncTraitCollectionDidChangeWithPreviousTraitCollection:(ASPrimitiveTraitCollection)previousTraitCollection { - [super asyncTraitCollectionDidChangeWithPreviousTraitCollection:previousTraitCollection]; - - if (AS_AVAILABLE_IOS_TVOS(13, 10)) { - AS::MutexLocker l(__instanceLock__); - // update image if userInterfaceStyle was changed (dark mode) - if (_image != nil - && _primitiveTraitCollection.userInterfaceStyle != previousTraitCollection.userInterfaceStyle) { - _imageNodeFlags.regenerateFromImageAsset = YES; - } - } -} - - -@end - -#pragma mark - Extras - -asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) -{ - return ^(UIImage *originalImage, ASPrimitiveTraitCollection traitCollection) { - return ASGraphicsCreateImage(traitCollection, originalImage.size, NO, originalImage.scale, originalImage, nil, ^{ - UIBezierPath *roundOutline = [UIBezierPath bezierPathWithOvalInRect:(CGRect){CGPointZero, originalImage.size}]; - - // Make the image round - [roundOutline addClip]; - - // Draw the original image - [originalImage drawAtPoint:CGPointZero blendMode:kCGBlendModeCopy alpha:1]; - - // Draw a border on top. - if (borderWidth > 0.0) { - [borderColor setStroke]; - [roundOutline setLineWidth:borderWidth]; - [roundOutline stroke]; - } - }); - }; -} - -asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) -{ - return ^(UIImage *originalImage, ASPrimitiveTraitCollection traitCollection) { - UIImage *modifiedImage = ASGraphicsCreateImage(traitCollection, originalImage.size, NO, originalImage.scale, originalImage, nil, ^{ - // Set color and render template - [color setFill]; - UIImage *templateImage = [originalImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - [templateImage drawAtPoint:CGPointZero blendMode:kCGBlendModeCopy alpha:1]; - }); - - // if the original image was stretchy, keep it stretchy - if (!UIEdgeInsetsEqualToEdgeInsets(originalImage.capInsets, UIEdgeInsetsZero)) { - modifiedImage = [modifiedImage resizableImageWithCapInsets:originalImage.capInsets resizingMode:originalImage.resizingMode]; - } - - return modifiedImage; - }; -} diff --git a/Example/Pods/Texture/Source/ASLocking.h b/Example/Pods/Texture/Source/ASLocking.h deleted file mode 100644 index 3e284dc2..00000000 --- a/Example/Pods/Texture/Source/ASLocking.h +++ /dev/null @@ -1,158 +0,0 @@ -// -// ASLocking.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -#define kLockSetCapacity 32 - -/** - * An extension of NSLocking that supports -tryLock. - */ -@protocol ASLocking - -/// Try to take lock without blocking. Returns whether the lock was taken. -- (BOOL)tryLock; - -@end - -/** - * A set of locks acquired during ASLockSequence. - */ -typedef struct { - unsigned count; - CFTypeRef _Nullable locks[kLockSetCapacity]; -} ASLockSet; - -/** - * Declare a lock set that is automatically unlocked at the end of scope. - * - * We use this instead of a scope-locking macro because we want to be able - * to step through the lock sequence block in the debugger. - */ -#define ASScopedLockSet __unused ASLockSet __attribute__((cleanup(ASUnlockSet))) - -/** - * A block that attempts to add a lock to a lock sequence. - * Such a block is provided to the caller of ASLockSequence. - * - * Returns whether the lock was added. You should return - * NO from your lock sequence body if it returns NO. - * - * For instance, you might write `return addLock(l1) && addLock(l2)`. - * - * @param lock The lock to attempt to add. - * @return YES if the lock was added, NO otherwise. - */ -typedef BOOL(^ASAddLockBlock)(id lock); - -/** - * A block that attempts to lock multiple locks in sequence. - * Such a block is provided by the caller of ASLockSequence. - * - * The block may be run multiple times, if not all locks are immediately - * available. Therefore the block should be idempotent. - * - * The block should attempt to invoke addLock multiple times with - * different locks. It should return NO as soon as any addLock - * operation fails. - * - * For instance, you might write `return addLock(l1) && addLock(l2)`. - * - * @param addLock A block you can call to attempt to add a lock. - * @return YES if all locks were added, NO otherwise. - */ -typedef BOOL(^ASLockSequenceBlock)(NS_NOESCAPE ASAddLockBlock addLock); - -/** - * Unlock and release all of the locks in this lock set. - */ -NS_INLINE void ASUnlockSet(ASLockSet *lockSet) { - for (unsigned i = 0; i < lockSet->count; i++) { - CFTypeRef lock = lockSet->locks[i]; - [(__bridge id)lock unlock]; - CFRelease(lock); - } -} - -/** - * Take multiple locks "simultaneously," avoiding deadlocks - * caused by lock ordering. - * - * The block you provide should attempt to take a series of locks, - * using the provided `addLock` block. As soon as any addLock fails, - * you should return NO. - * - * For example: - * ASLockSequence(^(ASAddLockBlock addLock) ^{ - * return addLock(l0) && addLock(l1); - * }); - * - * Note: This function doesn't protect from lock ordering deadlocks if - * one of the locks is already locked (recursive.) Only locks taken - * inside this function are guaranteed not to cause a deadlock. - */ -NS_INLINE ASLockSet ASLockSequence(NS_NOESCAPE ASLockSequenceBlock body) -{ - __block ASLockSet locks = (ASLockSet){0, {}}; - BOOL (^addLock)(id) = ^(id obj) { - - // nil lock = ignore. - if (!obj) { - return YES; - } - - // If they go over capacity, assert and return YES. - // If we return NO, they will enter an infinite loop. - if (locks.count == kLockSetCapacity) { - ASDisplayNodeCFailAssert(@"Locking more than %d locks at once is not supported.", kLockSetCapacity); - return YES; - } - - if ([obj tryLock]) { - locks.locks[locks.count++] = (__bridge_retained CFTypeRef)obj; - return YES; - } - return NO; - }; - - /** - * Repeatedly try running their block, passing in our `addLock` - * until it succeeds. If it fails, unlock all and yield the thread - * to reduce spinning. - */ - while (true) { - if (body(addLock)) { - // Success - return locks; - } else { - ASUnlockSet(&locks); - locks.count = 0; - sched_yield(); - } - } -} - -/** - * These Foundation classes already implement -tryLock. - */ - -@interface NSLock (ASLocking) -@end - -@interface NSRecursiveLock (ASLocking) -@end - -@interface NSConditionLock (ASLocking) -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASMainThreadDeallocation.h b/Example/Pods/Texture/Source/ASMainThreadDeallocation.h deleted file mode 100644 index 391b6bb6..00000000 --- a/Example/Pods/Texture/Source/ASMainThreadDeallocation.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// ASMainThreadDeallocation.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSObject (ASMainThreadIvarTeardown) - -/** - * Call this from -dealloc to schedule this instance's - * ivars for main thread deallocation as needed. - * - * This method includes a check for whether it's on the main thread, - * and it will do nothing in that case. - */ -- (void)scheduleIvarsForMainThreadDeallocation; - -@end - -@interface NSObject (ASNeedsMainThreadDeallocation) - -/** - * Override this property to indicate that instances of this - * class need to be deallocated on the main thread. - * You do not access this property yourself. - * - * The NSObject implementation returns YES if the class name has - * a prefix UI, AV, or CA. This property is also overridden to - * return fixed values for other common classes, such as UIImage, - * UIGestureRecognizer, and UIResponder. - */ -@property (class, readonly) BOOL needsMainThreadDeallocation; - -@end - -@interface NSProxy (ASNeedsMainThreadDeallocation) - -/** - * Override this property to indicate that instances of this - * class need to be deallocated on the main thread. - * You do not access this property yourself. - * - * The NSProxy implementation returns NO because - * proxies almost always hold weak references. - */ -@property (class, readonly) BOOL needsMainThreadDeallocation; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASMainThreadDeallocation.mm b/Example/Pods/Texture/Source/ASMainThreadDeallocation.mm deleted file mode 100644 index 8b732a5c..00000000 --- a/Example/Pods/Texture/Source/ASMainThreadDeallocation.mm +++ /dev/null @@ -1,202 +0,0 @@ -// -// ASMainThreadDeallocation.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -@implementation NSObject (ASMainThreadIvarTeardown) - -- (void)scheduleIvarsForMainThreadDeallocation -{ - if (ASDisplayNodeThreadIsMain()) { - return; - } - - NSValue *ivarsObj = [[self class] _ivarsThatMayNeedMainDeallocation]; - - // Unwrap the ivar array - unsigned int count = 0; - // Will be unused if assertions are disabled. - __unused int scanResult = sscanf(ivarsObj.objCType, "[%u^{objc_ivar}]", &count); - ASDisplayNodeAssert(scanResult == 1, @"Unexpected type in NSValue: %s", ivarsObj.objCType); - Ivar ivars[count]; - [ivarsObj getValue:ivars]; - - for (Ivar ivar : ivars) { - id value = object_getIvar(self, ivar); - if (value == nil) { - continue; - } - - if ([object_getClass(value) needsMainThreadDeallocation]) { - os_log_debug(ASMainThreadDeallocationLog(), "%@: Trampolining ivar '%s' value %@ for main deallocation.", self, ivar_getName(ivar), value); - - // Release the ivar's reference before handing the object to the queue so we - // don't risk holding onto it longer than the queue does. - object_setIvar(self, ivar, nil); - - ASPerformMainThreadDeallocation(&value); - } else { - os_log_debug(ASMainThreadDeallocationLog(), "%@: Not trampolining ivar '%s' value %@.", self, ivar_getName(ivar), value); - } - } -} - -/** - * Returns an NSValue-wrapped array of all the ivars in this class or its superclasses - * up through ASDisplayNode, that we expect may need to be deallocated on main. - * - * This method caches its results. - * - * Result is of type NSValue<[Ivar]> - */ -+ (NSValue * _Nonnull)_ivarsThatMayNeedMainDeallocation NS_RETURNS_RETAINED -{ - static NSCache *ivarsCache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - ivarsCache = [[NSCache alloc] init]; - }); - - NSValue *result = [ivarsCache objectForKey:self]; - if (result != nil) { - return result; - } - - // Cache miss. - unsigned int resultCount = 0; - static const int kMaxDealloc2MainIvarsPerClassTree = 64; - Ivar resultIvars[kMaxDealloc2MainIvarsPerClassTree]; - - // Get superclass results first. - Class c = class_getSuperclass(self); - if (c != [NSObject class]) { - NSValue *ivarsObj = [c _ivarsThatMayNeedMainDeallocation]; - // Unwrap the ivar array and append it to our working array - unsigned int count = 0; - // Will be unused if assertions are disabled. - __unused int scanResult = sscanf(ivarsObj.objCType, "[%u^{objc_ivar}]", &count); - ASDisplayNodeAssert(scanResult == 1, @"Unexpected type in NSValue: %s", ivarsObj.objCType); - ASDisplayNodeCAssert(resultCount + count < kMaxDealloc2MainIvarsPerClassTree, @"More than %d dealloc2main ivars are not supported. Count: %d", kMaxDealloc2MainIvarsPerClassTree, resultCount + count); - [ivarsObj getValue:resultIvars + resultCount]; - resultCount += count; - } - - // Now gather ivars from this particular class. - unsigned int allMyIvarsCount; - Ivar *allMyIvars = class_copyIvarList(self, &allMyIvarsCount); - - for (NSUInteger i = 0; i < allMyIvarsCount; i++) { - Ivar ivar = allMyIvars[i]; - - // NOTE: Would be great to exclude weak/unowned ivars, since we don't - // release them. Unfortunately the objc_ivar_management access is private and - // class_getWeakIvarLayout does not have a well-defined structure. - - const char *type = ivar_getTypeEncoding(ivar); - - if (type != NULL && strcmp(type, @encode(id)) == 0) { - // If it's `id` we have to include it just in case. - resultIvars[resultCount] = ivar; - resultCount += 1; - as_log_verbose(ASMainThreadDeallocationLog(), "%@: Marking ivar '%s' for possible main deallocation due to type id", self, ivar_getName(ivar)); - } else { - // If it's an ivar with a static type, check the type. - Class c = ASGetClassFromType(type); - if ([c needsMainThreadDeallocation]) { - resultIvars[resultCount] = ivar; - resultCount += 1; - as_log_verbose(ASMainThreadDeallocationLog(), "%@: Marking ivar '%s' for main deallocation due to class %@", self, ivar_getName(ivar), c); - } else { - as_log_verbose(ASMainThreadDeallocationLog(), "%@: Skipping ivar '%s' for main deallocation.", self, ivar_getName(ivar)); - } - } - } - free(allMyIvars); - - // Encode the type (array of Ivars) into a string and wrap it in an NSValue - char arrayType[32]; - snprintf(arrayType, 32, "[%u^{objc_ivar}]", resultCount); - result = [NSValue valueWithBytes:resultIvars objCType:arrayType]; - - [ivarsCache setObject:result forKey:self]; - return result; -} - -@end - -@implementation NSObject (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - const auto name = class_getName(self); - if (0 == strncmp(name, "AV", 2) || 0 == strncmp(name, "UI", 2) || 0 == strncmp(name, "CA", 2)) { - return YES; - } - return NO; -} - -@end - -@implementation CALayer (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return YES; -} - -@end - -@implementation UIColor (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return NO; -} - -@end - -@implementation UIGestureRecognizer (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return YES; -} - -@end - -@implementation UIImage (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return NO; -} - -@end - -@implementation UIResponder (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return YES; -} - -@end - -@implementation NSProxy (ASNeedsMainThreadDeallocation) - -+ (BOOL)needsMainThreadDeallocation -{ - return NO; -} - -@end diff --git a/Example/Pods/Texture/Source/ASMapNode.h b/Example/Pods/Texture/Source/ASMapNode.h deleted file mode 100644 index 9ddc2b6f..00000000 --- a/Example/Pods/Texture/Source/ASMapNode.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// ASMapNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if TARGET_OS_IOS && AS_USE_MAPKIT -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Map Annotation options. - * The default behavior is to ignore the annotations' positions, use the region or options specified instead. - * Swift: to select the default behavior, use []. - */ -typedef NS_OPTIONS(NSUInteger, ASMapNodeShowAnnotationsOptions) -{ - /** The annotations' positions are ignored, use the region or options specified instead. */ - ASMapNodeShowAnnotationsOptionsIgnored = 0, - /** The annotations' positions are used to calculate the region to show in the map, equivalent to showAnnotations:animated. */ - ASMapNodeShowAnnotationsOptionsZoomed = 1 << 0, - /** This will only have an effect if combined with the Zoomed state with liveMap turned on.*/ - ASMapNodeShowAnnotationsOptionsAnimated = 1 << 1 -}; - -@interface ASMapNode : ASImageNode - -/** - The current options of ASMapNode. This can be set at any time and ASMapNode will animate the change.

This property may be set from a background thread before the node is loaded, and will automatically be applied to define the behavior of the static snapshot (if .liveMap = NO) or the internal MKMapView (otherwise).

Changes to the region and camera options will only be animated when when the liveMap mode is enabled, otherwise these options will be applied statically to the new snapshot.

The options object is used to specify properties even when the liveMap mode is enabled, allowing seamless transitions between the snapshot and liveMap (as well as back to the snapshot). - */ -@property (nonatomic) MKMapSnapshotOptions *options; - -/** The region is simply the sub-field on the options object. If the objects object is reset, - this will in effect be overwritten and become the value of the .region property on that object. - Defaults to MKCoordinateRegionForMapRect(MKMapRectWorld). - */ -@property (nonatomic) MKCoordinateRegion region; - -/** - This is the MKMapView that is the live map part of ASMapNode. This will be nil if .liveMap = NO. Note, MKMapView is *not* thread-safe. - */ -@property (nullable, readonly) MKMapView *mapView; - -/** - Set this to YES to turn the snapshot into an interactive MKMapView and vice versa. Defaults to NO. This property may be set on a background thread before the node is loaded, and will automatically be actioned, once the node is loaded. - */ -@property (getter=isLiveMap) BOOL liveMap; - -/** - @abstract Whether ASMapNode should automatically request a new map snapshot to correspond to the new node size. - @default Default value is YES. - @discussion If mapSize is set then this will be set to NO, since the size will be the same in all orientations. - */ -@property BOOL needsMapReloadOnBoundsChange; - -/** - Set the delegate of the MKMapView. This can be set even before mapView is created and will be set on the map in the case that the liveMap mode is engaged. - - If the live map view has been created, this may only be set on the main thread. - */ -@property (nonatomic, weak) id mapDelegate; - -/** - * @abstract The annotations to display on the map. - */ -@property (copy) NSArray> *annotations; - -/** - * @abstract This property specifies how to show the annotations. - * @default Default value is ASMapNodeShowAnnotationsIgnored - */ -@property ASMapNodeShowAnnotationsOptions showAnnotationsOptions; - -/** - * @abstract The block which should return annotation image for static map based on provided annotation. - * @discussion This block is executed on an arbitrary serial queue. If this block is nil, standard pin is used. - */ -@property (nullable) UIImage * _Nullable (^imageForStaticMapAnnotationBlock)(id annotation, CGPoint *centerOffset); - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/ASMapNode.mm b/Example/Pods/Texture/Source/ASMapNode.mm deleted file mode 100644 index 599851e9..00000000 --- a/Example/Pods/Texture/Source/ASMapNode.mm +++ /dev/null @@ -1,440 +0,0 @@ -// -// ASMapNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if TARGET_OS_IOS && AS_USE_MAPKIT - -#import - -#import -#import -#import -#import -#import -#import - -@interface ASMapNode() -{ - MKMapSnapshotter *_snapshotter; - BOOL _snapshotAfterLayout; - NSArray *_annotations; -} -@end - -@implementation ASMapNode - -@synthesize needsMapReloadOnBoundsChange = _needsMapReloadOnBoundsChange; -@synthesize mapDelegate = _mapDelegate; -@synthesize options = _options; -@synthesize liveMap = _liveMap; -@synthesize showAnnotationsOptions = _showAnnotationsOptions; - -#pragma mark - Lifecycle -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - self.backgroundColor = ASDisplayNodeDefaultPlaceholderColor(); - self.clipsToBounds = YES; - self.userInteractionEnabled = YES; - - _needsMapReloadOnBoundsChange = YES; - _liveMap = NO; - _annotations = @[]; - _showAnnotationsOptions = ASMapNodeShowAnnotationsOptionsIgnored; - return self; -} - -- (void)didLoad -{ - [super didLoad]; - if (self.isLiveMap) { - [self addLiveMap]; - } -} - -- (void)dealloc -{ - [self destroySnapshotter]; -} - -- (void)setLayerBacked:(BOOL)layerBacked -{ - ASDisplayNodeAssert(!self.isLiveMap, @"ASMapNode can not be layer backed whilst .liveMap = YES, set .liveMap = NO to use layer backing."); - [super setLayerBacked:layerBacked]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - ASPerformBlockOnMainThread(^{ - if (self.isLiveMap) { - [self addLiveMap]; - } else { - [self takeSnapshot]; - } - }); -} - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - ASPerformBlockOnMainThread(^{ - if (self.isLiveMap) { - [self removeLiveMap]; - } - }); -} - -#pragma mark - Settings - -- (BOOL)isLiveMap -{ - ASLockScopeSelf(); - return _liveMap; -} - -- (void)setLiveMap:(BOOL)liveMap -{ - ASDisplayNodeAssert(!self.isLayerBacked, @"ASMapNode can not use the interactive map feature whilst .isLayerBacked = YES, set .layerBacked = NO to use the interactive map feature."); - ASLockScopeSelf(); - if (liveMap == _liveMap) { - return; - } - _liveMap = liveMap; - if (self.nodeLoaded) { - liveMap ? [self addLiveMap] : [self removeLiveMap]; - } -} - -- (BOOL)needsMapReloadOnBoundsChange -{ - ASLockScopeSelf(); - return _needsMapReloadOnBoundsChange; -} - -- (void)setNeedsMapReloadOnBoundsChange:(BOOL)needsMapReloadOnBoundsChange -{ - ASLockScopeSelf(); - _needsMapReloadOnBoundsChange = needsMapReloadOnBoundsChange; -} - -- (MKMapSnapshotOptions *)options -{ - ASLockScopeSelf(); - if (!_options) { - _options = [[MKMapSnapshotOptions alloc] init]; - _options.region = MKCoordinateRegionForMapRect(MKMapRectWorld); - CGSize calculatedSize = self.calculatedSize; - if (!CGSizeEqualToSize(calculatedSize, CGSizeZero)) { - _options.size = calculatedSize; - } - } - return _options; -} - -- (void)setOptions:(MKMapSnapshotOptions *)options -{ - ASLockScopeSelf(); - if (!_options || ![options isEqual:_options]) { - _options = options; - if (self.isLiveMap) { - [self applySnapshotOptions]; - } else if (_snapshotter) { - [self destroySnapshotter]; - [self takeSnapshot]; - } - } -} - -- (MKCoordinateRegion)region -{ - return self.options.region; -} - -- (void)setRegion:(MKCoordinateRegion)region -{ - MKMapSnapshotOptions * options = [self.options copy]; - options.region = region; - self.options = options; -} - -- (id)mapDelegate -{ - return ASLockedSelf(_mapDelegate); -} - -- (void)setMapDelegate:(id)mapDelegate { - ASLockScopeSelf(); - _mapDelegate = mapDelegate; - - if (_mapView) { - ASDisplayNodeAssertMainThread(); - _mapView.delegate = mapDelegate; - } -} - -#pragma mark - Snapshotter - -- (void)takeSnapshot -{ - // If our size is zero, we want to avoid calling a default sized snapshot. Set _snapshotAfterLayout to YES - // so if layout changes in the future, we'll try snapshotting again. - ASLayout *layout = self.calculatedLayout; - if (layout == nil || CGSizeEqualToSize(CGSizeZero, layout.size)) { - _snapshotAfterLayout = YES; - return; - } - - _snapshotAfterLayout = NO; - - if (!_snapshotter) { - [self setUpSnapshotter]; - } - - if (_snapshotter.isLoading) { - return; - } - - __weak __typeof__(self) weakSelf = self; - [_snapshotter startWithQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - completionHandler:^(MKMapSnapshot *snapshot, NSError *error) { - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - if (!error) { - UIImage *image = snapshot.image; - NSArray *annotations = strongSelf.annotations; - if (annotations.count > 0) { - // Only create a graphics context if we have annotations to draw. - // The MKMapSnapshotter is currently not capable of rendering annotations automatically. - - CGRect finalImageRect = CGRectMake(0, 0, image.size.width, image.size.height); - - image = ASGraphicsCreateImage(strongSelf.primitiveTraitCollection, image.size, YES, image.scale, image, nil, ^{ - [image drawAtPoint:CGPointZero]; - - UIImage *pinImage; - CGPoint pinCenterOffset = CGPointZero; - - // Get a standard annotation view pin if there is no custom annotation block. - if (!strongSelf.imageForStaticMapAnnotationBlock) { - pinImage = [strongSelf.class defaultPinImageWithCenterOffset:&pinCenterOffset]; - } - - for (id annotation in annotations) { - if (strongSelf.imageForStaticMapAnnotationBlock) { - // Get custom annotation image from custom annotation block. - pinImage = strongSelf.imageForStaticMapAnnotationBlock(annotation, &pinCenterOffset); - if (!pinImage) { - // just for case block returned nil, which can happen - pinImage = [strongSelf.class defaultPinImageWithCenterOffset:&pinCenterOffset]; - } - } - - CGPoint point = [snapshot pointForCoordinate:annotation.coordinate]; - if (CGRectContainsPoint(finalImageRect, point)) { - CGSize pinSize = pinImage.size; - point.x -= pinSize.width / 2.0; - point.y -= pinSize.height / 2.0; - point.x += pinCenterOffset.x; - point.y += pinCenterOffset.y; - [pinImage drawAtPoint:point]; - } - } - }); - } - - strongSelf.image = image; - } - }]; -} - -+ (UIImage *)defaultPinImageWithCenterOffset:(CGPoint *)centerOffset NS_RETURNS_RETAINED -{ - static MKAnnotationView *pin; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - pin = [[MKPinAnnotationView alloc] initWithAnnotation:nil reuseIdentifier:@""]; - }); - *centerOffset = pin.centerOffset; - return pin.image; -} - -- (void)setUpSnapshotter -{ - _snapshotter = [[MKMapSnapshotter alloc] initWithOptions:self.options]; -} - -- (void)destroySnapshotter -{ - [_snapshotter cancel]; - _snapshotter = nil; -} - -- (void)applySnapshotOptions -{ - MKMapSnapshotOptions *options = self.options; - [_mapView setCamera:options.camera animated:YES]; - [_mapView setRegion:options.region animated:YES]; - [_mapView setMapType:options.mapType]; - _mapView.showsBuildings = options.showsBuildings; - _mapView.showsPointsOfInterest = options.showsPointsOfInterest; -} - -#pragma mark - Actions -- (void)addLiveMap -{ - ASDisplayNodeAssertMainThread(); - if (!_mapView) { - __weak ASMapNode *weakSelf = self; - _mapView = [[MKMapView alloc] initWithFrame:CGRectZero]; - _mapView.delegate = weakSelf.mapDelegate; - [weakSelf applySnapshotOptions]; - [_mapView addAnnotations:_annotations]; - [weakSelf setNeedsLayout]; - [weakSelf.view addSubview:_mapView]; - - ASMapNodeShowAnnotationsOptions showAnnotationsOptions = self.showAnnotationsOptions; - if (showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsZoomed) { - BOOL const animated = showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsAnimated; - [_mapView showAnnotations:_mapView.annotations animated:animated]; - } - } -} - -- (void)removeLiveMap -{ - [_mapView removeFromSuperview]; - _mapView = nil; -} - -- (NSArray *)annotations -{ - ASLockScopeSelf(); - return _annotations; -} - -- (void)setAnnotations:(NSArray *)annotations -{ - annotations = [annotations copy] ? : @[]; - - ASLockScopeSelf(); - _annotations = annotations; - ASMapNodeShowAnnotationsOptions showAnnotationsOptions = self.showAnnotationsOptions; - if (self.isLiveMap) { - [_mapView removeAnnotations:_mapView.annotations]; - [_mapView addAnnotations:annotations]; - - if (showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsZoomed) { - BOOL const animated = showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsAnimated; - [_mapView showAnnotations:_mapView.annotations animated:animated]; - } - } else { - if (showAnnotationsOptions & ASMapNodeShowAnnotationsOptionsZoomed) { - self.region = [self regionToFitAnnotations:annotations]; - } - else { - [self takeSnapshot]; - } - } -} - -- (MKCoordinateRegion)regionToFitAnnotations:(NSArray> *)annotations -{ - if([annotations count] == 0) - return MKCoordinateRegionForMapRect(MKMapRectWorld); - - CLLocationCoordinate2D topLeftCoord = CLLocationCoordinate2DMake(-90, 180); - CLLocationCoordinate2D bottomRightCoord = CLLocationCoordinate2DMake(90, -180); - - for (id annotation in annotations) { - topLeftCoord = CLLocationCoordinate2DMake(std::fmax(topLeftCoord.latitude, annotation.coordinate.latitude), - std::fmin(topLeftCoord.longitude, annotation.coordinate.longitude)); - bottomRightCoord = CLLocationCoordinate2DMake(std::fmin(bottomRightCoord.latitude, annotation.coordinate.latitude), - std::fmax(bottomRightCoord.longitude, annotation.coordinate.longitude)); - } - - MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(topLeftCoord.latitude - (topLeftCoord.latitude - bottomRightCoord.latitude) * 0.5, - topLeftCoord.longitude + (bottomRightCoord.longitude - topLeftCoord.longitude) * 0.5), - MKCoordinateSpanMake(std::fabs(topLeftCoord.latitude - bottomRightCoord.latitude) * 2, - std::fabs(bottomRightCoord.longitude - topLeftCoord.longitude) * 2)); - - return region; -} - --(ASMapNodeShowAnnotationsOptions)showAnnotationsOptions { - return ASLockedSelf(_showAnnotationsOptions); -} - --(void)setShowAnnotationsOptions:(ASMapNodeShowAnnotationsOptions)showAnnotationsOptions { - ASLockScopeSelf(); - _showAnnotationsOptions = showAnnotationsOptions; -} - -#pragma mark - Layout -- (void)setSnapshotSizeWithReloadIfNeeded:(CGSize)snapshotSize -{ - if (snapshotSize.height > 0 && snapshotSize.width > 0 && !CGSizeEqualToSize(self.options.size, snapshotSize)) { - _options.size = snapshotSize; - if (_snapshotter) { - [self destroySnapshotter]; - [self takeSnapshot]; - } - } -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - // FIXME: Need a better way to allow maps to take up the right amount of space in a layout (sizeRange, etc) - // These fallbacks protect against inheriting a constrainedSize that contains a CGFLOAT_MAX value. - if (!ASIsCGSizeValidForLayout(constrainedSize)) { - //ASDisplayNodeAssert(NO, @"Invalid width or height in ASMapNode"); - constrainedSize = CGSizeZero; - } - [self setSnapshotSizeWithReloadIfNeeded:constrainedSize]; - return constrainedSize; -} - -- (void)calculatedLayoutDidChange -{ - [super calculatedLayoutDidChange]; - - if (_snapshotAfterLayout) { - [self takeSnapshot]; - } -} - -// -layout isn't usually needed over -layoutSpecThatFits, but this way we can avoid a needless node wrapper for MKMapView. -- (void)layout -{ - [super layout]; - if (self.isLiveMap) { - _mapView.frame = CGRectMake(0.0f, 0.0f, self.calculatedSize.width, self.calculatedSize.height); - } else { - // If our bounds.size is different from our current snapshot size, then let's request a new image from MKMapSnapshotter. - if (_needsMapReloadOnBoundsChange) { - [self setSnapshotSizeWithReloadIfNeeded:self.bounds.size]; - // FIXME: Adding a check for Preload here seems to cause intermittent map load failures, but shouldn't. - // if (ASInterfaceStateIncludesPreload(self.interfaceState)) { - } - } -} - -- (BOOL)supportsLayerBacking -{ - return NO; -} - -@end -#endif // TARGET_OS_IOS && AS_USE_MAPKIT diff --git a/Example/Pods/Texture/Source/ASMultiplexImageNode.h b/Example/Pods/Texture/Source/ASMultiplexImageNode.h deleted file mode 100644 index a3ce97a9..00000000 --- a/Example/Pods/Texture/Source/ASMultiplexImageNode.h +++ /dev/null @@ -1,288 +0,0 @@ -// -// ASMultiplexImageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_USE_PHOTOS -#import -#else -@class PHAsset; -@class PHImageManager; -@class PHImageRequestOptions; -#endif - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASMultiplexImageNodeDelegate; -@protocol ASMultiplexImageNodeDataSource; - -typedef id ASImageIdentifier; - -ASDK_EXTERN NSString *const ASMultiplexImageNodeErrorDomain; - -/** - * ASMultiplexImageNode error codes. - */ -typedef NS_ENUM(NSUInteger, ASMultiplexImageNodeErrorCode) { - /** - * Indicates that the data source didn't provide a source for an image identifier. - */ - ASMultiplexImageNodeErrorCodeNoSourceForImage = 0, - - /** - * Indicates that the best image identifier changed before a download for a worse identifier began. - */ - ASMultiplexImageNodeErrorCodeBestImageIdentifierChanged, - - /** - * Indicates that the Photos framework returned no image and no error. - * This may happen if the image is in iCloud and the user did not specify `allowsNetworkAccess` - * in their image request. - */ - ASMultiplexImageNodeErrorCodePhotosImageManagerFailedWithoutError, - - /** - * Indicates that the image node could not retrieve the PHAsset for a given asset identifier. - * This typically means that the user has not given Photos framework permissions yet or the asset - * has been removed from the device. - */ - ASMultiplexImageNodeErrorCodePHAssetIsUnavailable -}; - - -/** - * @abstract ASMultiplexImageNode is an image node that can load and display multiple versions of an image. For - * example, it can display a low-resolution version of an image while the high-resolution version is loading. - * - * @discussion ASMultiplexImageNode begins loading images when its resource can either return a UIImage directly, or a URL the image node should load. - */ -@interface ASMultiplexImageNode : ASImageNode - -/** - * @abstract The designated initializer. - * @param cache The object that implements a cache of images for the image node. - * @param downloader The object that implements image downloading for the image node. - * @discussion If `cache` is nil, the receiver will not attempt to retrieve images from a cache before downloading them. - * @return An initialized ASMultiplexImageNode. - */ -- (instancetype)initWithCache:(nullable id)cache downloader:(nullable id)downloader NS_DESIGNATED_INITIALIZER; - -/** - * @abstract The delegate, which must conform to the protocol. - */ -@property (nonatomic, weak) id delegate; - -/** - * @abstract The data source, which must conform to the protocol. - * @discussion This value is required for ASMultiplexImageNode to load images. - */ -@property (nonatomic, weak) id dataSource; - -/** - * @abstract Whether the receiver should download more than just its highest-quality image. Defaults to NO. - * - * @discussion ASMultiplexImageNode immediately loads and displays the first image specified in (its - * highest-quality image). If that image is not immediately available or cached, the node can download and display - * lesser-quality images. Set `downloadsIntermediateImages` to YES to enable this behaviour. - */ -@property (nonatomic) BOOL downloadsIntermediateImages; - -/** - * @abstract An array of identifiers representing various versions of an image for ASMultiplexImageNode to display. - * - * @discussion An identifier can be any object that conforms to NSObject and NSCopying. The array should be in - * decreasing order of image quality -- that is, the first identifier in the array represents the best version. - * - * @see for more information on the image loading process. - */ -@property (nonatomic, copy) NSArray *imageIdentifiers; - -/** - * @abstract Notify the receiver SSAA that its data source has new UIImages or NSURLs available for . - * - * @discussion If a higher-quality image than is currently displayed is now available, it will be loaded. - */ -- (void)reloadImageIdentifierSources; - -/** - * @abstract The identifier for the last image that the receiver loaded, or nil. - * - * @discussion This value may differ from if the image hasn't yet been displayed. - */ -@property (nullable, nonatomic, readonly) ASImageIdentifier loadedImageIdentifier; - -/** - * @abstract The identifier for the image that the receiver is currently displaying, or nil. - */ -@property (nullable, nonatomic, readonly) ASImageIdentifier displayedImageIdentifier; - -/** - * @abstract If the downloader implements progressive image rendering and this value is YES progressive renders of the - * image will be displayed as the image downloads. Regardless of this properties value, progress renders will - * only occur when the node is visible. Defaults to YES. - */ -@property (nonatomic) BOOL shouldRenderProgressImages; - -/** - * Specifies whether the underlying image downloader should attempt to retry downloading the image if the remote - * host is unreachable. It will have no effect if the downloader does not support retrying. The default is YES. - */ -@property BOOL shouldRetryImageDownload; - -/** - * @abstract The image manager that this image node should use when requesting images from the Photos framework. If this is `nil` (the default), then `PHImageManager.defaultManager` is used. - - * @see `+[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:]` below. - */ -@property (nullable, nonatomic) PHImageManager *imageManager API_AVAILABLE(ios(8.0), tvos(10.0)); - -@end - - -#pragma mark - -/** - * The methods declared by the ASMultiplexImageNodeDelegate protocol allow the adopting delegate to respond to - * notifications such as began, progressed and finished downloading, updated and displayed an image. - */ -@protocol ASMultiplexImageNodeDelegate - -@optional -/** - * @abstract Notification that the image node began downloading an image. - * @param imageNode The sender. - * @param imageIdentifier The identifier for the image that is downloading. - */ -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode didStartDownloadOfImageWithIdentifier:(id)imageIdentifier; - -/** - * @abstract Notification that the image node's download progressed. - * @param imageNode The sender. - * @param downloadProgress The progress of the download. Value is between 0.0 and 1.0. - * @param imageIdentifier The identifier for the image that is downloading. - */ -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode - didUpdateDownloadProgress:(CGFloat)downloadProgress - forImageWithIdentifier:(ASImageIdentifier)imageIdentifier; - -/** - * @abstract Notification that the image node's download has finished. - * @param imageNode The sender. - * @param imageIdentifier The identifier for the image that finished downloading. - * @param error The error that occurred while downloading, if one occurred; nil otherwise. - */ -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode -didFinishDownloadingImageWithIdentifier:(ASImageIdentifier)imageIdentifier - error:(nullable NSError *)error; - -/** - * @abstract Notification that the image node's image was updated. - * @param imageNode The sender. - * @param image The new image, ready for display. - * @param imageIdentifier The identifier for `image`. - * @param previousImage The old, previously-loaded image. - * @param previousImageIdentifier The identifier for `previousImage`. - * @note This method does not indicate that `image` has been displayed. - * @see <[ASMultiplexImageNodeDelegate multiplexImageNode:didDisplayUpdatedImage:withIdentifier:]>. - */ -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode - didUpdateImage:(nullable UIImage *)image - withIdentifier:(nullable ASImageIdentifier)imageIdentifier - fromImage:(nullable UIImage *)previousImage - withIdentifier:(nullable ASImageIdentifier)previousImageIdentifier; - -/** - * @abstract Notification that the image node displayed a new image. - * @param imageNode The sender. - * @param image The new image, now being displayed. - * @param imageIdentifier The identifier for `image`. - * @discussion This method is only called when `image` changes, and not on subsequent redisplays of the same image. - */ -- (void)multiplexImageNode:(ASMultiplexImageNode *)imageNode - didDisplayUpdatedImage:(nullable UIImage *)image - withIdentifier:(nullable ASImageIdentifier)imageIdentifier; - -/** - * @abstract Notification that the image node finished displaying an image. - * @param imageNode The sender. - * @discussion This method is called every time an image is displayed, whether or not it has changed. - */ -- (void)multiplexImageNodeDidFinishDisplay:(ASMultiplexImageNode *)imageNode; - -@end - - -#pragma mark - -/** - * The ASMultiplexImageNodeDataSource protocol is adopted by an object that provides the multiplex image node, - * for each image identifier, an image or a URL the image node should load. - */ -@protocol ASMultiplexImageNodeDataSource - -@optional -/** - * @abstract An image for the specified identifier. - * @param imageNode The sender. - * @param imageIdentifier The identifier for the image that should be returned. - * @discussion If the image is already available to the data source, this method should be used in lieu of providing the - * URL to the image via -multiplexImageNode:URLForImageIdentifier:. - * @return A UIImage corresponding to `imageIdentifier`, or nil if none is available. - */ -- (nullable UIImage *)multiplexImageNode:(ASMultiplexImageNode *)imageNode imageForImageIdentifier:(ASImageIdentifier)imageIdentifier; - -/** - * @abstract An image URL for the specified identifier. - * @param imageNode The sender. - * @param imageIdentifier The identifier for the image that will be downloaded. - * @discussion Supported URLs include HTTP, HTTPS, AssetsLibrary, and FTP URLs as well as Photos framework URLs (see note). - * - * If the image is already available to the data source, it should be provided via <[ASMultiplexImageNodeDataSource - * multiplexImageNode:imageForImageIdentifier:]> instead. - * @return An NSURL for the image identified by `imageIdentifier`, or nil if none is available. - * @see `+[NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:]` below. - */ -- (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ASImageIdentifier)imageIdentifier; - -/** - * @abstract A PHAsset for the specific asset local identifier - * @param imageNode The sender. - * @param assetLocalIdentifier The local identifier for a PHAsset that this image node is loading. - * - * @discussion This optional method can improve image performance if your data source already has the PHAsset available. - * If this method is not implemented, or returns nil, the image node will request the asset from the Photos framework. - * @note This method may be called from any thread. - * @return A PHAsset corresponding to `assetLocalIdentifier`, or nil if none is available. - */ -- (nullable PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier API_AVAILABLE(ios(8.0), tvos(10.0)); -@end - -#pragma mark - - -#if AS_USE_PHOTOS - -@interface NSURL (ASPhotosFrameworkURLs) - -/** - * @abstract Create an NSURL that specifies an image from the Photos framework. - * - * @discussion When implementing `-multiplexImageNode:URLForImageIdentifier:`, you can return a URL - * created by this method and the image node will attempt to load the image from the Photos framework. - * @note The `synchronous` flag in `options` is ignored. - * @note The `Opportunistic` delivery mode is not supported and will be treated as `HighQualityFormat`. - */ -+ (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier - targetSize:(CGSize)targetSize - contentMode:(PHImageContentMode)contentMode - options:(PHImageRequestOptions *)options NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT API_AVAILABLE(ios(8.0), tvos(10.0)); - -@end - -#endif - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASMultiplexImageNode.mm b/Example/Pods/Texture/Source/ASMultiplexImageNode.mm deleted file mode 100644 index abacdfac..00000000 --- a/Example/Pods/Texture/Source/ASMultiplexImageNode.mm +++ /dev/null @@ -1,943 +0,0 @@ -// -// ASMultiplexImageNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY -#import -#endif - -#import -#import -#import -#import -#import -#import -#import - -#if AS_USE_PHOTOS -#import -#endif - -#if AS_PIN_REMOTE_IMAGE -#import -#else -#import -#endif - -using AS::MutexLocker; - -NSString *const ASMultiplexImageNodeErrorDomain = @"ASMultiplexImageNodeErrorDomain"; - -#if AS_USE_ASSETS_LIBRARY -static NSString *const kAssetsLibraryURLScheme = @"assets-library"; -#endif - -/** - @abstract Signature for the block to be performed after an image has loaded. - @param image The image that was loaded, or nil if no image was loaded. - @param imageIdentifier The identifier of the image that was loaded, or nil if no image was loaded. - @param error An error describing why an image couldn't be loaded, if it failed to load; nil otherwise. - */ -typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdentifier, NSError *error); - -@interface ASMultiplexImageNode () -{ -@private - // Core. - id _cache; - - id _downloader; - struct { - unsigned int downloaderImplementsSetProgress:1; - unsigned int downloaderImplementsSetPriority:1; - unsigned int downloaderImplementsDownloadWithPriority:1; - } _downloaderFlags; - - __weak id _delegate; - struct { - unsigned int downloadStart:1; - unsigned int downloadProgress:1; - unsigned int downloadFinish:1; - unsigned int updatedImageDisplayFinish:1; - unsigned int updatedImage:1; - unsigned int displayFinish:1; - } _delegateFlags; - - __weak id _dataSource; - struct { - unsigned int image:1; - unsigned int URL:1; - unsigned int asset:1; - } _dataSourceFlags; - - // Image flags. - BOOL _downloadsIntermediateImages; // Defaults to NO. - AS::Mutex _imageIdentifiersLock; - NSArray *_imageIdentifiers; - id _loadedImageIdentifier; - id _loadingImageIdentifier; - id _displayedImageIdentifier; - __weak NSOperation *_phImageRequestOperation; - - // Networking. - AS::RecursiveMutex _downloadIdentifierLock; - id _downloadIdentifier; - - // Properties - BOOL _shouldRenderProgressImages; - - //set on init only - BOOL _cacheSupportsClearing; -} - -//! @abstract Read-write redeclaration of property declared in ASMultiplexImageNode.h. -@property (nonatomic, copy) id loadedImageIdentifier; - -//! @abstract The image identifier that's being loaded by _loadNextImageWithCompletion:. -@property (nonatomic, copy) id loadingImageIdentifier; - -/** - @abstract Returns the next image identifier that should be downloaded. - @discussion This method obeys and reflects the value of `downloadsIntermediateImages`. - @result The next image identifier, from `_imageIdentifiers`, that should be downloaded, or nil if no image should be downloaded next. - */ -- (id)_nextImageIdentifierToDownload; - -/** - @abstract Returns the best image that is immediately available from our datasource without downloading or hitting the cache. - @param imageIdentifierOut Upon return, the image identifier for the returned image; nil otherwise. - @discussion This method exclusively uses the data source's -multiplexImageNode:imageForIdentifier: method to return images. It does not fetch from the cache or kick off downloading. - @result The best UIImage available immediately; nil if no image is immediately available. - */ -- (UIImage *)_bestImmediatelyAvailableImageFromDataSource:(id *)imageIdentifierOut; - -/** - @abstract Loads and displays the next image in the receiver's loading sequence. - @discussion This method obeys `downloadsIntermediateImages`. This method has no effect if nothing further should be loaded, as indicated by `_nextImageIdentifierToDownload`. This method will load the next image from the data-source, if possible; otherwise, the session's image cache will be queried for the desired image, and as a last resort, the image will be downloaded. - */ -- (void)_loadNextImage; - -/** - @abstract Fetches the image corresponding to the given imageIdentifier from the given URL from the session's image cache. - @param imageIdentifier The identifier for the image to be fetched. May not be nil. - @param imageURL The URL of the image to fetch. May not be nil. - @param completionBlock The block to be performed when the image has been fetched from the cache, if possible. May not be nil. - @discussion This method queries both the session's in-memory and on-disk caches (with preference for the in-memory cache). - */ -- (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock; - -#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY -/** - @abstract Loads the image corresponding to the given assetURL from the device's Assets Library. - @param imageIdentifier The identifier for the image to be loaded. May not be nil. - @param assetURL The assets-library URL (e.g., "assets-library://identifier") of the image to load, from ALAsset. May not be nil. - @param completionBlock The block to be performed when the image has been loaded, if possible. May not be nil. - */ -- (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock; -#endif - -#if AS_USE_PHOTOS -/** - @abstract Loads the image corresponding to the given image request from the Photos framework. - @param imageIdentifier The identifier for the image to be loaded. May not be nil. - @param request The photos image request to load. May not be nil. - @param completionBlock The block to be performed when the image has been loaded, if possible. May not be nil. - */ -- (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock API_AVAILABLE(ios(8.0), tvos(10.0)); -#endif - -/** - @abstract Downloads the image corresponding to the given imageIdentifier from the given URL. - @param imageIdentifier The identifier for the image to be downloaded. May not be nil. - @param imageURL The URL of the image to downloaded. May not be nil. - @param completionBlock The block to be performed when the image has been downloaded, if possible. May not be nil. - */ -- (void)_downloadImageWithIdentifier:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image, NSError *error))completionBlock; - -@end - -@implementation ASMultiplexImageNode - -#pragma mark - Getting Started / Tearing Down -- (instancetype)initWithCache:(id)cache downloader:(id)downloader -{ - if (!(self = [super init])) - return nil; - - _cache = (id)cache; - _downloader = (id)downloader; - - _downloaderFlags.downloaderImplementsSetProgress = [downloader respondsToSelector:@selector(setProgressImageBlock:callbackQueue:withDownloadIdentifier:)]; - _downloaderFlags.downloaderImplementsSetPriority = [downloader respondsToSelector:@selector(setPriority:withDownloadIdentifier:)]; - _downloaderFlags.downloaderImplementsDownloadWithPriority = [downloader respondsToSelector:@selector(downloadImageWithURL:shouldRetry:priority:callbackQueue:downloadProgress:completion:)]; - - _cacheSupportsClearing = [cache respondsToSelector:@selector(clearFetchedImageFromCacheWithURL:)]; - - _shouldRenderProgressImages = YES; - - self.shouldBypassEnsureDisplay = YES; - self.shouldRetryImageDownload = YES; - - return self; -} - -- (instancetype)init -{ -#if AS_PIN_REMOTE_IMAGE - return [self initWithCache:[ASPINRemoteImageDownloader sharedDownloader] downloader:[ASPINRemoteImageDownloader sharedDownloader]]; -#else - return [self initWithCache:nil downloader:[ASBasicImageDownloader sharedImageDownloader]]; -#endif -} - -- (void)dealloc -{ - [_phImageRequestOperation cancel]; -} - -#pragma mark - ASDisplayNode Overrides - -- (void)clearContents -{ - [super clearContents]; // This actually clears the contents, so we need to do this first for our displayedImageIdentifier to be meaningful. - [self _setDisplayedImageIdentifier:nil withImage:nil]; - - // NOTE: We intentionally do not cancel image downloads until `clearPreloadedData`. -} - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - - [_phImageRequestOperation cancel]; - - [self _setDownloadIdentifier:nil]; - - if (_cacheSupportsClearing && self.loadedImageIdentifier != nil) { - NSURL *URL = [_dataSource multiplexImageNode:self URLForImageIdentifier:self.loadedImageIdentifier]; - if (URL != nil) { - [_cache clearFetchedImageFromCacheWithURL:URL]; - } - } - - // setting this to nil makes the node fetch images the next time its display starts - _loadedImageIdentifier = nil; - [self _setImage:nil]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - - [self _loadImageIdentifiers]; -} - -- (void)displayDidFinish -{ - [super displayDidFinish]; - - // We may now be displaying the loaded identifier, if they're different. - UIImage *displayedImage = self.image; - if (displayedImage) { - if (!ASObjectIsEqual(_displayedImageIdentifier, _loadedImageIdentifier)) - [self _setDisplayedImageIdentifier:_loadedImageIdentifier withImage:displayedImage]; - - // Delegateify - if (_delegateFlags.displayFinish) { - if (ASDisplayNodeThreadIsMain()) - [_delegate multiplexImageNodeDidFinishDisplay:self]; - else { - __weak __typeof__(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - [strongSelf.delegate multiplexImageNodeDidFinishDisplay:strongSelf]; - }); - } - } - } -} - -- (BOOL)placeholderShouldPersist -{ - return (self.image == nil && self.animatedImage == nil && self.imageIdentifiers.count > 0); -} - -/* displayWillStartAsynchronously in ASNetworkImageNode has a very similar implementation. Changes here are likely necessary - in ASNetworkImageNode as well. */ -- (void)displayWillStartAsynchronously:(BOOL)asynchronously -{ - [super displayWillStartAsynchronously:asynchronously]; - [self didEnterPreloadState]; - [self _updatePriorityOnDownloaderIfNeeded]; -} - -/* didEnterVisibleState / didExitVisibleState in ASNetworkImageNode has a very similar implementation. Changes here are likely necessary - in ASNetworkImageNode as well. */ -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - [self _updatePriorityOnDownloaderIfNeeded]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - [self _updatePriorityOnDownloaderIfNeeded]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; -} - -- (void)didExitDisplayState -{ - [super didExitDisplayState]; - [self _updatePriorityOnDownloaderIfNeeded]; -} - -#pragma mark - Core - -- (void)setImage:(UIImage *)image -{ - ASDisplayNodeAssert(NO, @"Setting the image directly on an ASMultiplexImageNode is unsafe. It will be cleared in didExitPreloadRange and will have no way to restore in didEnterPreloadRange"); - super.image = image; -} - -- (void)_setImage:(UIImage *)image -{ - super.image = image; -} - -- (void)setDelegate:(id )delegate -{ - if (_delegate == delegate) - return; - - _delegate = delegate; - _delegateFlags.downloadStart = [_delegate respondsToSelector:@selector(multiplexImageNode:didStartDownloadOfImageWithIdentifier:)]; - _delegateFlags.downloadProgress = [_delegate respondsToSelector:@selector(multiplexImageNode:didUpdateDownloadProgress:forImageWithIdentifier:)]; - _delegateFlags.downloadFinish = [_delegate respondsToSelector:@selector(multiplexImageNode:didFinishDownloadingImageWithIdentifier:error:)]; - _delegateFlags.updatedImageDisplayFinish = [_delegate respondsToSelector:@selector(multiplexImageNode:didDisplayUpdatedImage:withIdentifier:)]; - _delegateFlags.updatedImage = [_delegate respondsToSelector:@selector(multiplexImageNode:didUpdateImage:withIdentifier:fromImage:withIdentifier:)]; - _delegateFlags.displayFinish = [_delegate respondsToSelector:@selector(multiplexImageNodeDidFinishDisplay:)]; -} - - -- (void)setDataSource:(id )dataSource -{ - if (_dataSource == dataSource) - return; - - _dataSource = dataSource; - _dataSourceFlags.image = [_dataSource respondsToSelector:@selector(multiplexImageNode:imageForImageIdentifier:)]; - _dataSourceFlags.URL = [_dataSource respondsToSelector:@selector(multiplexImageNode:URLForImageIdentifier:)]; - if (AS_AVAILABLE_IOS_TVOS(9, 10)) { - _dataSourceFlags.asset = [_dataSource respondsToSelector:@selector(multiplexImageNode:assetForLocalIdentifier:)]; - } -} - - -- (void)setShouldRenderProgressImages:(BOOL)shouldRenderProgressImages -{ - [self lock]; - if (shouldRenderProgressImages == _shouldRenderProgressImages) { - [self unlock]; - return; - } - - _shouldRenderProgressImages = shouldRenderProgressImages; - - [self unlock]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; -} - -- (BOOL)shouldRenderProgressImages -{ - return ASLockedSelf(_shouldRenderProgressImages); -} - -#pragma mark - - -#pragma mark - - -- (NSArray *)imageIdentifiers -{ - MutexLocker l(_imageIdentifiersLock); - return _imageIdentifiers; -} - -- (void)setImageIdentifiers:(NSArray *)imageIdentifiers -{ - { - MutexLocker l(_imageIdentifiersLock); - if (ASObjectIsEqual(_imageIdentifiers, imageIdentifiers)) { - return; - } - - _imageIdentifiers = [[NSArray alloc] initWithArray:imageIdentifiers copyItems:YES]; - } - - [self setNeedsPreload]; -} - -- (void)reloadImageIdentifierSources -{ - // setting this to nil makes the node think it has not downloaded any images - _loadedImageIdentifier = nil; - [self _loadImageIdentifiers]; -} - -#pragma mark - - - -#pragma mark - Core Internal -- (void)_setDisplayedImageIdentifier:(id)displayedImageIdentifier withImage:(UIImage *)image -{ - ASDisplayNodeAssertMainThread(); - - if (ASObjectIsEqual(_displayedImageIdentifier, displayedImageIdentifier)) { - return; - } - - _displayedImageIdentifier = displayedImageIdentifier; - - // Delegateify. - // Note that we're using the params here instead of self.image and _displayedImageIdentifier because those can change before the async block below executes. - if (_delegateFlags.updatedImageDisplayFinish) { - if (ASDisplayNodeThreadIsMain()) - [_delegate multiplexImageNode:self didDisplayUpdatedImage:image withIdentifier:displayedImageIdentifier]; - else { - __weak __typeof__(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - [strongSelf.delegate multiplexImageNode:strongSelf didDisplayUpdatedImage:image withIdentifier:displayedImageIdentifier]; - }); - } - } -} - -- (void)_setDownloadIdentifier:(id)downloadIdentifier -{ - MutexLocker l(_downloadIdentifierLock); - if (ASObjectIsEqual(downloadIdentifier, _downloadIdentifier)) - return; - - if (_downloadIdentifier) { - [_downloader cancelImageDownloadForIdentifier:_downloadIdentifier]; - } - _downloadIdentifier = downloadIdentifier; -} - -#pragma mark - Image Loading Machinery - -- (void)_loadImageIdentifiers -{ - // Grab the best possible image we can load right now. - id bestImmediatelyAvailableImageIdentifier = nil; - UIImage *bestImmediatelyAvailableImage = [self _bestImmediatelyAvailableImageFromDataSource:&bestImmediatelyAvailableImageIdentifier]; - as_log_verbose(ASImageLoadingLog(), "%@ Best immediately available image identifier is %@", self, bestImmediatelyAvailableImageIdentifier); - - // Load it. This kicks off cache fetching/downloading, as appropriate. - [self _finishedLoadingImage:bestImmediatelyAvailableImage forIdentifier:bestImmediatelyAvailableImageIdentifier error:nil]; -} - -- (UIImage *)_bestImmediatelyAvailableImageFromDataSource:(id *)imageIdentifierOut -{ - MutexLocker l(_imageIdentifiersLock); - - // If we don't have any identifiers to load or don't implement the image DS method, bail. - if ([_imageIdentifiers count] == 0 || !_dataSourceFlags.image) { - return nil; - } - - // Grab the best available image from the data source. - UIImage *existingImage = self.image; - for (id imageIdentifier in _imageIdentifiers) { - // If this image is already loaded, don't request it from the data source again because - // the data source may generate a new instance of UIImage that returns NO for isEqual: - // and we'll end up in an infinite loading loop. - UIImage *image = ASObjectIsEqual(imageIdentifier, _loadedImageIdentifier) ? existingImage : [_dataSource multiplexImageNode:self imageForImageIdentifier:imageIdentifier]; - if (image) { - if (imageIdentifierOut) { - *imageIdentifierOut = imageIdentifier; - } - - return image; - } - } - - return nil; -} - -#pragma mark - - -- (void)_updatePriorityOnDownloaderIfNeeded -{ - DISABLED_ASAssertUnlocked(_downloadIdentifierLock); - - if (_downloaderFlags.downloaderImplementsSetPriority) { - // Read our interface state before locking so that we don't lock super while holding our lock. - ASInterfaceState interfaceState = self.interfaceState; - MutexLocker l(_downloadIdentifierLock); - - if (_downloadIdentifier != nil) { - ASImageDownloaderPriority priority = ASImageDownloaderPriorityWithInterfaceState(interfaceState); - [_downloader setPriority:priority withDownloadIdentifier:_downloadIdentifier]; - } - } -} - -- (void)_updateProgressImageBlockOnDownloaderIfNeeded -{ - DISABLED_ASAssertUnlocked(_downloadIdentifierLock); - - BOOL shouldRenderProgressImages = self.shouldRenderProgressImages; - - // Read our interface state before locking so that we don't lock super while holding our lock. - ASInterfaceState interfaceState = self.interfaceState; - MutexLocker l(_downloadIdentifierLock); - - if (!_downloaderFlags.downloaderImplementsSetProgress || _downloadIdentifier == nil) { - return; - } - - ASImageDownloaderProgressImage progress = nil; - if (shouldRenderProgressImages && ASInterfaceStateIncludesVisible(interfaceState)) { - __weak __typeof__(self) weakSelf = self; - progress = ^(UIImage * _Nonnull progressImage, CGFloat progress, id _Nullable downloadIdentifier) { - __typeof__(self) strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - - MutexLocker l(strongSelf->_downloadIdentifierLock); - //Getting a result back for a different download identifier, download must not have been successfully canceled - if (ASObjectIsEqual(strongSelf->_downloadIdentifier, downloadIdentifier) == NO && downloadIdentifier != nil) { - return; - } - [strongSelf _setImage:progressImage]; - }; - } - [_downloader setProgressImageBlock:progress callbackQueue:dispatch_get_main_queue() withDownloadIdentifier:_downloadIdentifier]; -} - -- (void)_clearImage -{ - [self _setImage:nil]; -} - -#pragma mark - -- (id)_nextImageIdentifierToDownload -{ - MutexLocker l(_imageIdentifiersLock); - - // If we've already loaded the best identifier, we've got nothing else to do. - id bestImageIdentifier = _imageIdentifiers.firstObject; - if (!bestImageIdentifier || ASObjectIsEqual(_loadedImageIdentifier, bestImageIdentifier)) { - return nil; - } - - id nextImageIdentifierToDownload = nil; - - // If we're not supposed to download intermediate images, load the best identifier we've got. - if (!_downloadsIntermediateImages) { - nextImageIdentifierToDownload = bestImageIdentifier; - } - // Otherwise, load progressively. - else { - NSUInteger loadedIndex = [_imageIdentifiers indexOfObject:_loadedImageIdentifier]; - - // If nothing has loaded yet, load the worst identifier. - if (loadedIndex == NSNotFound) { - nextImageIdentifierToDownload = [_imageIdentifiers lastObject]; - } - // Otherwise, load the next best identifier (if there is one) - else if (loadedIndex > 0) { - nextImageIdentifierToDownload = _imageIdentifiers[loadedIndex - 1]; - } - } - - return nextImageIdentifierToDownload; -} - -- (void)_loadNextImage -{ - // Determine the next identifier to load (if any). - id nextImageIdentifier = [self _nextImageIdentifierToDownload]; - if (!nextImageIdentifier) { - [self _finishedLoadingImage:nil forIdentifier:nil error:nil]; - return; - } - - as_activity_create_for_scope("Load next image for multiplex image node"); - as_log_verbose(ASImageLoadingLog(), "Loading image for %@ ident: %@", self, nextImageIdentifier); - self.loadingImageIdentifier = nextImageIdentifier; - - __weak __typeof__(self) weakSelf = self; - ASMultiplexImageLoadCompletionBlock finishedLoadingBlock = ^(UIImage *image, id imageIdentifier, NSError *error) { - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - - // Only nil out the loading identifier if the loading identifier hasn't changed. - if (ASObjectIsEqual(strongSelf.loadingImageIdentifier, nextImageIdentifier)) { - strongSelf.loadingImageIdentifier = nil; - } - [strongSelf _finishedLoadingImage:image forIdentifier:imageIdentifier error:error]; - }; - - // Ask our data-source if it's got this image. - if (_dataSourceFlags.image) { - UIImage *image = [_dataSource multiplexImageNode:self imageForImageIdentifier:nextImageIdentifier]; - if (image) { - as_log_verbose(ASImageLoadingLog(), "Acquired image from data source for %@ ident: %@", self, nextImageIdentifier); - finishedLoadingBlock(image, nextImageIdentifier, nil); - return; - } - } - - NSURL *nextImageURL = (_dataSourceFlags.URL) ? [_dataSource multiplexImageNode:self URLForImageIdentifier:nextImageIdentifier] : nil; - // If we fail to get a URL for the image, we have no source and can't proceed. - if (!nextImageURL) { - os_log_error(ASImageLoadingLog(), "Could not acquire URL %@ ident: (%@)", self, nextImageIdentifier); - finishedLoadingBlock(nil, nil, [NSError errorWithDomain:ASMultiplexImageNodeErrorDomain code:ASMultiplexImageNodeErrorCodeNoSourceForImage userInfo:nil]); - return; - } - -#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY - // If it's an assets-library URL, we need to fetch it from the assets library. - if ([[nextImageURL scheme] isEqualToString:kAssetsLibraryURLScheme]) { - // Load the asset. - [self _loadALAssetWithIdentifier:nextImageIdentifier URL:nextImageURL completion:^(UIImage *downloadedImage, NSError *error) { - as_log_verbose(ASImageLoadingLog(), "Acquired image from assets library for %@ %@", weakSelf, nextImageIdentifier); - finishedLoadingBlock(downloadedImage, nextImageIdentifier, error); - }]; - - return; - } -#endif - -#if AS_USE_PHOTOS - if (AS_AVAILABLE_IOS_TVOS(9, 10)) { - // Likewise, if it's a Photos asset, we need to fetch it accordingly. - if (ASPhotosFrameworkImageRequest *request = [ASPhotosFrameworkImageRequest requestWithURL:nextImageURL]) { - [self _loadPHAssetWithRequest:request identifier:nextImageIdentifier completion:^(UIImage *image, NSError *error) { - as_log_verbose(ASImageLoadingLog(), "Acquired image from Photos for %@ %@", weakSelf, nextImageIdentifier); - finishedLoadingBlock(image, nextImageIdentifier, error); - }]; - - return; - } - } -#endif - - // Otherwise, it's a web URL that we can download. - // First, check the cache. - [self _fetchImageWithIdentifierFromCache:nextImageIdentifier URL:nextImageURL completion:^(UIImage *imageFromCache) { - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - - // If we had a cache-hit, we're done. - if (imageFromCache) { - as_log_verbose(ASImageLoadingLog(), "Acquired image from cache for %@ id: %@ img: %@", strongSelf, nextImageIdentifier, imageFromCache); - finishedLoadingBlock(imageFromCache, nextImageIdentifier, nil); - return; - } - - // If the next image to load has changed, bail. - if (!ASObjectIsEqual([strongSelf _nextImageIdentifierToDownload], nextImageIdentifier)) { - finishedLoadingBlock(nil, nil, [NSError errorWithDomain:ASMultiplexImageNodeErrorDomain code:ASMultiplexImageNodeErrorCodeBestImageIdentifierChanged userInfo:nil]); - return; - } - - // Otherwise, we've got to download it. - [strongSelf _downloadImageWithIdentifier:nextImageIdentifier URL:nextImageURL completion:^(UIImage *downloadedImage, NSError *error) { - __typeof__(self) strongSelf = weakSelf; - if (downloadedImage) { - as_log_verbose(ASImageLoadingLog(), "Acquired image from download for %@ id: %@ img: %@", strongSelf, nextImageIdentifier, downloadedImage); - } else { - os_log_error(ASImageLoadingLog(), "Error downloading image for %@ id: %@ err: %@", strongSelf, nextImageIdentifier, error); - } - finishedLoadingBlock(downloadedImage, nextImageIdentifier, error); - }]; - }]; -} -#if TARGET_OS_IOS && AS_USE_ASSETS_LIBRARY -- (void)_loadALAssetWithIdentifier:(id)imageIdentifier URL:(NSURL *)assetURL completion:(void (^)(UIImage *image, NSError *error))completionBlock -{ - ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); - ASDisplayNodeAssertNotNil(assetURL, @"assetURL is required"); - ASDisplayNodeAssertNotNil(completionBlock, @"completionBlock is required"); - - // ALAssetsLibrary was replaced in iOS 8 and deprecated in iOS 9. - // We'll drop support very soon. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init]; - - [assetLibrary assetForURL:assetURL resultBlock:^(ALAsset *asset) { - ALAssetRepresentation *representation = [asset defaultRepresentation]; - CGImageRef coreGraphicsImage = [representation fullScreenImage]; - - UIImage *downloadedImage = (coreGraphicsImage ? [UIImage imageWithCGImage:coreGraphicsImage] : nil); - completionBlock(downloadedImage, nil); - } failureBlock:^(NSError *error) { - completionBlock(nil, error); - }]; -#pragma clang diagnostic pop -} -#endif - -#if AS_USE_PHOTOS -- (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identifier:(id)imageIdentifier completion:(void (^)(UIImage *image, NSError *error))completionBlock -{ - ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); - ASDisplayNodeAssertNotNil(request, @"request is required"); - ASDisplayNodeAssertNotNil(completionBlock, @"completionBlock is required"); - - /* - * Locking rationale: - * As of iOS 9, Photos.framework will eventually deadlock if you hit it with concurrent fetch requests. rdar://22984886 - * Concurrent image requests are OK, but metadata requests aren't, so we limit ourselves to one at a time. - */ - static NSLock *phRequestLock; - static NSOperationQueue *phImageRequestQueue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - phRequestLock = [NSLock new]; - phImageRequestQueue = [NSOperationQueue new]; - phImageRequestQueue.maxConcurrentOperationCount = 10; - phImageRequestQueue.name = @"org.AsyncDisplayKit.MultiplexImageNode.phImageRequestQueue"; - }); - - // Each ASMultiplexImageNode can have max 1 inflight Photos image request operation - [_phImageRequestOperation cancel]; - - __weak __typeof(self) weakSelf = self; - NSOperation *newImageRequestOp = [NSBlockOperation blockOperationWithBlock:^{ - __strong __typeof(weakSelf) strongSelf = weakSelf; - if (strongSelf == nil) { return; } - - PHAsset *imageAsset = nil; - - // Try to get the asset immediately from the data source. - if (strongSelf->_dataSourceFlags.asset) { - imageAsset = [strongSelf.dataSource multiplexImageNode:strongSelf assetForLocalIdentifier:request.assetIdentifier]; - } - - // Fall back to locking and getting the PHAsset. - if (imageAsset == nil) { - [phRequestLock lock]; - // -[PHFetchResult dealloc] plays a role in the deadlock mentioned above, so we make sure the PHFetchResult is deallocated inside the critical section - @autoreleasepool { - imageAsset = [PHAsset fetchAssetsWithLocalIdentifiers:@[request.assetIdentifier] options:nil].firstObject; - } - [phRequestLock unlock]; - } - - if (imageAsset == nil) { - NSError *error = [NSError errorWithDomain:ASMultiplexImageNodeErrorDomain code:ASMultiplexImageNodeErrorCodePHAssetIsUnavailable userInfo:nil]; - completionBlock(nil, error); - return; - } - - PHImageRequestOptions *options = [request.options copy]; - - // We don't support opportunistic delivery – one request, one image. - if (options.deliveryMode == PHImageRequestOptionsDeliveryModeOpportunistic) { - options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; - } - - if (options.deliveryMode == PHImageRequestOptionsDeliveryModeHighQualityFormat) { - // Without this flag the result will be delivered on the main queue, which is pointless - // But synchronous -> HighQualityFormat so we only use it if high quality format is specified - options.synchronous = YES; - } - - PHImageManager *imageManager = strongSelf.imageManager ? : PHImageManager.defaultManager; - [imageManager requestImageForAsset:imageAsset targetSize:request.targetSize contentMode:request.contentMode options:options resultHandler:^(UIImage *image, NSDictionary *info) { - NSError *error = info[PHImageErrorKey]; - - if (error == nil && image == nil) { - error = [NSError errorWithDomain:ASMultiplexImageNodeErrorDomain code:ASMultiplexImageNodeErrorCodePhotosImageManagerFailedWithoutError userInfo:nil]; - } - - if (NSThread.isMainThread) { - dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{ - completionBlock(image, error); - }); - } else { - completionBlock(image, error); - } - }]; - }]; - // If you don't set this, iOS will sometimes infer NSQualityOfServiceUserInteractive and promote the entire queue to that level, damaging system responsiveness - newImageRequestOp.qualityOfService = NSQualityOfServiceUserInitiated; - _phImageRequestOperation = newImageRequestOp; - [phImageRequestQueue addOperation:newImageRequestOp]; -} -#endif - -- (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock -{ - ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); - ASDisplayNodeAssertNotNil(imageURL, @"imageURL is required"); - ASDisplayNodeAssertNotNil(completionBlock, @"completionBlock is required"); - - if (_cache) { - [_cache cachedImageWithURL:imageURL callbackQueue:dispatch_get_main_queue() completion:^(id imageContainer, __unused ASImageCacheType cacheType ) { - completionBlock([imageContainer asdk_image]); - }]; - } - // If we don't have a cache, just fail immediately. - else { - completionBlock(nil); - } -} - -- (void)_downloadImageWithIdentifier:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image, NSError *error))completionBlock -{ - ASDisplayNodeAssertNotNil(imageIdentifier, @"imageIdentifier is required"); - ASDisplayNodeAssertNotNil(imageURL, @"imageURL is required"); - ASDisplayNodeAssertNotNil(completionBlock, @"completionBlock is required"); - - // Delegate (start) - if (_delegateFlags.downloadStart) - [_delegate multiplexImageNode:self didStartDownloadOfImageWithIdentifier:imageIdentifier]; - - __weak __typeof__(self) weakSelf = self; - ASImageDownloaderProgress downloadProgressBlock = NULL; - if (_delegateFlags.downloadProgress) { - downloadProgressBlock = ^(CGFloat progress) { - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - [strongSelf.delegate multiplexImageNode:strongSelf didUpdateDownloadProgress:progress forImageWithIdentifier:imageIdentifier]; - }; - } - - ASImageDownloaderCompletion completion = ^(id imageContainer, NSError *error, id downloadIdentifier, id userInfo) { - // We dereference iVars directly, so we can't have weakSelf going nil on us. - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - - MutexLocker l(strongSelf->_downloadIdentifierLock); - //Getting a result back for a different download identifier, download must not have been successfully canceled - if (ASObjectIsEqual(strongSelf->_downloadIdentifier, downloadIdentifier) == NO && downloadIdentifier != nil) { - return; - } - - completionBlock([imageContainer asdk_image], error); - - // Delegateify. - if (strongSelf->_delegateFlags.downloadFinish) - [strongSelf->_delegate multiplexImageNode:weakSelf didFinishDownloadingImageWithIdentifier:imageIdentifier error:error]; - }; - - // Download! - ASPerformBlockOnBackgroundThread(^{ - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - - dispatch_queue_t callbackQueue = dispatch_get_main_queue(); - - id downloadIdentifier; - if (strongSelf->_downloaderFlags.downloaderImplementsDownloadWithPriority) { - /* - Decide a priority based on the current interface state of this node. - It can happen that this method was called when the node entered preload state - but the interface state, at this point, tells us that the node is (going to be) visible, - If that's the case, we jump to a higher priority directly. - */ - ASImageDownloaderPriority priority = ASImageDownloaderPriorityWithInterfaceState(strongSelf.interfaceState); - downloadIdentifier = [strongSelf->_downloader downloadImageWithURL:imageURL - shouldRetry:[self shouldRetryImageDownload] - priority:priority - callbackQueue:callbackQueue - downloadProgress:downloadProgressBlock - completion:completion]; - } else { - /* - Kick off a download with default priority. - The actual "default" value is decided by the downloader. - ASBasicImageDownloader and ASPINRemoteImageDownloader both use ASImageDownloaderPriorityImminent - which is mapped to NSURLSessionTaskPriorityDefault. - - This means that preload and display nodes use the same priority - and their requests are put into the same pool. - */ - downloadIdentifier = [strongSelf->_downloader downloadImageWithURL:imageURL - shouldRetry:[self shouldRetryImageDownload] - callbackQueue:callbackQueue - downloadProgress:downloadProgressBlock - completion:completion]; - } - - [strongSelf _setDownloadIdentifier:downloadIdentifier]; - [strongSelf _updateProgressImageBlockOnDownloaderIfNeeded]; - }); -} - -#pragma mark - -- (void)_finishedLoadingImage:(UIImage *)image forIdentifier:(id)imageIdentifier error:(NSError *)error -{ - // If we failed to load, we stop the loading process. - // Note that if we bailed before we began downloading because the best identifier changed, we don't bail, but rather just begin loading the best image identifier. - if (error && !([error.domain isEqual:ASMultiplexImageNodeErrorDomain] && error.code == ASMultiplexImageNodeErrorCodeBestImageIdentifierChanged)) - return; - - - _imageIdentifiersLock.lock(); - NSUInteger imageIdentifierCount = [_imageIdentifiers count]; - _imageIdentifiersLock.unlock(); - - // Update our image if we got one, or if we're not supposed to display one at all. - // We explicitly perform this check because our datasource often doesn't give back immediately available images, even though we might have downloaded one already. - // Because we seed this call with bestImmediatelyAvailableImageFromDataSource, we must be careful not to trample an existing image. - if (image || imageIdentifierCount == 0) { - as_log_verbose(ASImageLoadingLog(), "[%p] loaded -> displaying (%@, %@)", self, imageIdentifier, image); - id previousIdentifier = self.loadedImageIdentifier; - UIImage *previousImage = self.image; - - self.loadedImageIdentifier = imageIdentifier; - [self _setImage:image]; - - if (_delegateFlags.updatedImage) { - [_delegate multiplexImageNode:self didUpdateImage:image withIdentifier:imageIdentifier fromImage:previousImage withIdentifier:previousIdentifier]; - } - - } - - // Load our next image, if we have one to load. - if ([self _nextImageIdentifierToDownload]) - [self _loadNextImage]; -} - -@end - -#if AS_USE_PHOTOS -@implementation NSURL (ASPhotosFrameworkURLs) - -+ (NSURL *)URLWithAssetLocalIdentifier:(NSString *)assetLocalIdentifier targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(PHImageRequestOptions *)options NS_RETURNS_RETAINED -{ - ASPhotosFrameworkImageRequest *request = [[ASPhotosFrameworkImageRequest alloc] initWithAssetIdentifier:assetLocalIdentifier]; - request.options = options; - request.contentMode = contentMode; - request.targetSize = targetSize; - return request.url; -} - -@end -#endif diff --git a/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.h b/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.h deleted file mode 100644 index 55c4b49a..00000000 --- a/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// ASNetworkImageLoadInfo.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSInteger, ASNetworkImageSourceType) { - ASNetworkImageSourceUnspecified = 0, - ASNetworkImageSourceSynchronousCache, - ASNetworkImageSourceAsynchronousCache, - ASNetworkImageSourceFileURL, - ASNetworkImageSourceDownload, -}; - -AS_SUBCLASSING_RESTRICTED -@interface ASNetworkImageLoadInfo : NSObject - -/// The type of source from which the image was loaded. -@property (readonly) ASNetworkImageSourceType sourceType; - -/// The image URL that was downloaded. -@property (readonly) NSURL *url; - -/// The download identifier, if one was provided. -@property (nullable, readonly) id downloadIdentifier; - -/// The userInfo object provided by the downloader, if one was provided. -@property (nullable, readonly) id userInfo; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.mm b/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.mm deleted file mode 100644 index 64ec547a..00000000 --- a/Example/Pods/Texture/Source/ASNetworkImageLoadInfo.mm +++ /dev/null @@ -1,31 +0,0 @@ -// -// ASNetworkImageLoadInfo.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation ASNetworkImageLoadInfo - -- (instancetype)initWithURL:(NSURL *)url sourceType:(ASNetworkImageSourceType)sourceType downloadIdentifier:(id)downloadIdentifier userInfo:(id)userInfo -{ - if (self = [super init]) { - _url = [url copy]; - _sourceType = sourceType; - _downloadIdentifier = downloadIdentifier; - _userInfo = userInfo; - } - return self; -} - -#pragma mark - NSCopying - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -@end diff --git a/Example/Pods/Texture/Source/ASNetworkImageNode.h b/Example/Pods/Texture/Source/ASNetworkImageNode.h deleted file mode 100644 index bc931cbe..00000000 --- a/Example/Pods/Texture/Source/ASNetworkImageNode.h +++ /dev/null @@ -1,259 +0,0 @@ -// -// ASNetworkImageNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASNetworkImageNodeDelegate, ASImageCacheProtocol, ASImageDownloaderProtocol; -@class ASNetworkImageLoadInfo; - - -/** - * ASNetworkImageNode is a simple image node that can download and display an image from the network, with support for a - * placeholder image (). The currently-displayed image is always available in the inherited ASImageNode - * property. - * - * @see ASMultiplexImageNode for a more powerful counterpart to this class. - */ -@interface ASNetworkImageNode : ASImageNode - -/** - * The designated initializer. Cache and Downloader are WEAK references. - * - * @param cache The object that implements a cache of images for the image node. Weak reference. - * @param downloader The object that implements image downloading for the image node. Must not be nil. Weak reference. - * - * @discussion If `cache` is nil, the receiver will not attempt to retrieve images from a cache before downloading them. - * - * @return An initialized ASNetworkImageNode. - */ -- (instancetype)initWithCache:(nullable id)cache downloader:(id)downloader NS_DESIGNATED_INITIALIZER; - -/** - * Convenience initializer. - * - * @return An ASNetworkImageNode configured to use the NSURLSession-powered ASBasicImageDownloader, and no extra cache. - */ -- (instancetype)init; - -/** - * The delegate, which must conform to the protocol. - */ -@property (nullable, weak) id delegate; - -/** - * The delegate will receive callbacks on main thread. Default to YES. - */ -@property (class) BOOL useMainThreadDelegateCallbacks; - -/** - * The image to display. - * - * @discussion By setting an image to the image property the ASNetworkImageNode will act like a plain ASImageNode. - * As soon as the URL is set the ASNetworkImageNode will act like an ASNetworkImageNode and the image property - * will be managed internally. This means the image property will be cleared out and replaced by the placeholder - * () image while loading and the final image after the new image data was downloaded and processed. - * If you want to use a placholder image functionality use the defaultImage property instead. - */ -@property (nullable) UIImage *image; - -/** - * A placeholder image to display while the URL is loading. This is slightly different than placeholderImage in the - * ASDisplayNode superclass as defaultImage will *not* be displayed synchronously. If you wish to have the image - * displayed synchronously, use @c placeholderImage. - */ -@property (nullable) UIImage *defaultImage; - -/** - * The URL of a new image to download and display. - * - * @discussion By setting an URL, the image property of this node will be managed internally. This means previously - * directly set images to the image property will be cleared out and replaced by the placeholder () image - * while loading and the final image after the new image data was downloaded and processed. - */ -@property (nullable, copy) NSURL *URL; - -/** - * An array of URLs of increasing cost to download. - * - * @discussion By setting an array of URLs, the image property of this node will be managed internally. This means previously - * directly set images to the image property will be cleared out and replaced by the placeholder () image - * while loading and the final image after the new image data was downloaded and processed. - * - * @deprecated This API has been removed for now due to the increased complexity to the class that it brought. - * Please use .URL instead. - */ -@property (nullable, copy) NSArray *URLs ASDISPLAYNODE_DEPRECATED_MSG("Please use URL instead."); - -/** - * Download and display a new image. - * - * @param URL The URL of a new image to download and display. - * @param reset Whether to display a placeholder () while loading the new image. - * - * @discussion By setting an URL, the image property of this node will be managed internally. This means previously - * directly set images to the image property will be cleared out and replaced by the placeholder () image - * while loading and the final image after the new image data was downloaded and processed. - */ -- (void)setURL:(nullable NSURL *)URL resetToDefault:(BOOL)reset; - -/** - * If is a local file, set this property to YES to take advantage of UIKit's image caching. Defaults to YES. - */ -@property BOOL shouldCacheImage; - -/** - * If the downloader implements progressive image rendering and this value is YES progressive renders of the - * image will be displayed as the image downloads. Regardless of this properties value, progress renders will - * only occur when the node is visible. Defaults to YES. - */ -@property BOOL shouldRenderProgressImages; - -/** - * Specifies whether the underlying image downloader should attempt to retry downloading the image if the remote - * host is unreachable. It will have no effect if the downloader does not support retrying. The default is YES. - */ -@property BOOL shouldRetryImageDownload; - -/** - * The image quality of the current image. - * - * If the URL is set, this is a number between 0 and 1 and can be used to track - * progressive progress. Calculated by dividing number of bytes / expected number of total bytes. - * This is zero until the first progressive render or the final display. - * - * If the URL is unset, this is 1 if defaultImage or image is set to non-nil. - * - */ -@property (readonly) CGFloat currentImageQuality; - -/** - * The currentImageQuality (value between 0 and 1) of the last image that completed displaying. - */ -@property (readonly) CGFloat renderedImageQuality; - -/** - * Download progress of the current image. - * When downloading a network image, this value would be updated to track download progress (value between 0 and 1) - * This is 1 if image load from cache or network successfully. - */ -@property (readonly) CGFloat downloadProgress; - -@end - - -#pragma mark - - -/** - * The methods declared by the ASNetworkImageNodeDelegate protocol allow the adopting delegate to respond to - * notifications such as finished decoding and downloading an image. - */ -@protocol ASNetworkImageNodeDelegate -@optional - -/** - * Notification that the image node started to load - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeDidStartFetchingData:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node will load image from cache - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeWillLoadImageFromCache:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node finished loading image from cache - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeDidLoadImageFromCache:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node failed to load image from cache - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeDidFailToLoadImageFromCache:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node will load image from network - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeWillLoadImageFromNetwork:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node will start display - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeWillStartDisplayAsynchronously:(ASNetworkImageNode *)imageNode; - -/** - * Notification that the image node finished downloading an image, with additional info. - * If implemented, this method will be called instead of `imageNode:didLoadImage:`. - * - * @param imageNode The sender. - * @param image The newly-loaded image. - * @param info Additional information about the image load. - * - * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. - */ -- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageLoadInfo *)info; - -/** - * Notification that the image node finished downloading an image. - * - * @param imageNode The sender. - * @param image The newly-loaded image. - * - * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. - */ -- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image; - -/** - * Notification that the image node failed to download the image. - * - * @param imageNode The sender. - * @param error The error with details. - * - * @discussion Called on the main thread if useMainThreadDelegateCallbacks=YES (the default), otherwise on a background thread. - */ -- (void)imageNode:(ASNetworkImageNode *)imageNode didFailWithError:(NSError *)error; - -/** - * Notification that the image node finished decoding an image. - * - * @param imageNode The sender. - * - * @discussion Called on the main thread. - */ -- (void)imageNodeDidFinishDecoding:(ASNetworkImageNode *)imageNode; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASNetworkImageNode.mm b/Example/Pods/Texture/Source/ASNetworkImageNode.mm deleted file mode 100644 index 8509ce39..00000000 --- a/Example/Pods/Texture/Source/ASNetworkImageNode.mm +++ /dev/null @@ -1,947 +0,0 @@ -// -// ASNetworkImageNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#if AS_PIN_REMOTE_IMAGE -#import -#endif - -@interface ASNetworkImageNode () -{ - // Only access any of these while locked. - __weak id _delegate; - - NSURL *_URL; - UIImage *_defaultImage; - - NSInteger _cacheSentinel; - id _downloadIdentifier; - // The download identifier that we have set a progress block on, if any. - id _downloadIdentifierForProgressBlock; - - CGFloat _currentImageQuality; - CGFloat _renderedImageQuality; - CGFloat _downloadProgress; - - // Immutable and set on init only. We don't need to lock in this case. - __weak id _downloader; - - // Immutable and set on init only. We don't need to lock in this case. - __weak id _cache; - - // Group all of these BOOLs into a shared bitfield struct in order to save on memory used. - struct { - unsigned int delegateWillStartDisplayAsynchronously:1; - unsigned int delegateWillLoadImageFromCache:1; - unsigned int delegateWillLoadImageFromNetwork:1; - unsigned int delegateDidStartFetchingData:1; - unsigned int delegateDidFailWithError:1; - unsigned int delegateDidFinishDecoding:1; - unsigned int delegateDidLoadImage:1; - unsigned int delegateDidLoadImageFromCache:1; - unsigned int delegateDidLoadImageWithInfo:1; - unsigned int delegateDidFailToLoadImageFromCache:1; - - unsigned int downloaderImplementsSetProgress:1; - unsigned int downloaderImplementsSetPriority:1; - unsigned int downloaderImplementsAnimatedImage:1; - unsigned int downloaderImplementsCancelWithResume:1; - unsigned int downloaderImplementsDownloadWithPriority:1; - - unsigned int cacheSupportsClearing:1; - unsigned int cacheSupportsSynchronousFetch:1; - - unsigned int imageLoaded:1; - unsigned int imageWasSetExternally:1; - unsigned int shouldRenderProgressImages:1; - unsigned int shouldCacheImage:1; - } _networkImageNodeFlags; -} - -@end - -@implementation ASNetworkImageNode - -static std::atomic_bool _useMainThreadDelegateCallbacks(true); - -@dynamic image; - -- (instancetype)initWithCache:(id)cache downloader:(id)downloader -{ - if (!(self = [super init])) - return nil; - - _cache = (id)cache; - _downloader = (id)downloader; - - _networkImageNodeFlags.downloaderImplementsSetProgress = [downloader respondsToSelector:@selector(setProgressImageBlock:callbackQueue:withDownloadIdentifier:)]; - _networkImageNodeFlags.downloaderImplementsSetPriority = [downloader respondsToSelector:@selector(setPriority:withDownloadIdentifier:)]; - _networkImageNodeFlags.downloaderImplementsAnimatedImage = [downloader respondsToSelector:@selector(animatedImageWithData:)]; - _networkImageNodeFlags.downloaderImplementsCancelWithResume = [downloader respondsToSelector:@selector(cancelImageDownloadWithResumePossibilityForIdentifier:)]; - _networkImageNodeFlags.downloaderImplementsDownloadWithPriority = [downloader respondsToSelector:@selector(downloadImageWithURL:shouldRetry:priority:callbackQueue:downloadProgress:completion:)]; - - _networkImageNodeFlags.cacheSupportsClearing = [cache respondsToSelector:@selector(clearFetchedImageFromCacheWithURL:)]; - _networkImageNodeFlags.cacheSupportsSynchronousFetch = [cache respondsToSelector:@selector(synchronouslyFetchedCachedImageWithURL:)]; - - _networkImageNodeFlags.shouldCacheImage = YES; - _networkImageNodeFlags.shouldRenderProgressImages = YES; - self.shouldBypassEnsureDisplay = YES; - self.shouldRetryImageDownload = YES; - - return self; -} - -- (instancetype)init -{ -#if AS_PIN_REMOTE_IMAGE - return [self initWithCache:[ASPINRemoteImageDownloader sharedDownloader] downloader:[ASPINRemoteImageDownloader sharedDownloader]]; -#else - return [self initWithCache:nil downloader:[ASBasicImageDownloader sharedImageDownloader]]; -#endif -} - -- (void)dealloc -{ - [self _cancelImageDownloadWithResumePossibility:NO]; -} - -- (dispatch_queue_t)callbackQueue -{ - return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); -} - -#pragma mark - Public methods -- must lock - -/// Setter for public image property. It has the side effect of setting an internal _networkImageNodeFlags.imageWasSetExternally that prevents setting an image internally. Setting an image internally should happen with the _setImage: method -- (void)setImage:(UIImage *)image -{ - ASLockScopeSelf(); - [self _locked_setImage:image]; -} - -- (void)_locked_setImage:(UIImage *)image -{ - DISABLED_ASAssertLocked(__instanceLock__); - - BOOL imageWasSetExternally = (image != nil); - BOOL shouldCancelAndClear = imageWasSetExternally && (imageWasSetExternally != _networkImageNodeFlags.imageWasSetExternally); - _networkImageNodeFlags.imageWasSetExternally = imageWasSetExternally; - if (shouldCancelAndClear) { - ASDisplayNodeAssertNil(_URL, @"Directly setting an image on an ASNetworkImageNode causes it to behave like an ASImageNode instead of an ASNetworkImageNode. If this is what you want, set the URL to nil first."); - _URL = nil; - [self _locked_cancelDownloadAndClearImageWithResumePossibility:NO]; - } - - // If our image is being set externally, the image quality is 100% - if (imageWasSetExternally) { - [self _setCurrentImageQuality:1.0]; - [self _setDownloadProgress:1.0]; - } - - [self _locked__setImage:image]; -} - -/// Setter for private image property. See @c _locked_setImage why this is needed -- (void)_setImage:(UIImage *)image -{ - ASLockScopeSelf(); - [self _locked__setImage:image]; -} - -- (void)_locked__setImage:(UIImage *)image -{ - DISABLED_ASAssertLocked(__instanceLock__); - [super _locked_setImage:image]; -} - -// Deprecated -- (void)setURLs:(NSArray *)URLs -{ - [self setURL:[URLs firstObject]]; -} - -// Deprecated -- (NSArray *)URLs -{ - return @[self.URL]; -} - -- (void)setURL:(NSURL *)URL -{ - [self setURL:URL resetToDefault:YES]; -} - -- (void)setURL:(NSURL *)URL resetToDefault:(BOOL)reset -{ - { - ASLockScopeSelf(); - - if (ASObjectIsEqual(URL, _URL)) { - return; - } - - URL = [URL copy]; - - ASDisplayNodeAssert(_networkImageNodeFlags.imageWasSetExternally == NO, @"Setting a URL to an ASNetworkImageNode after setting an image changes its behavior from an ASImageNode to an ASNetworkImageNode. If this is what you want, set the image to nil first."); - - _networkImageNodeFlags.imageWasSetExternally = NO; - - [self _locked_cancelImageDownloadWithResumePossibility:NO]; - - [self _setDownloadProgress:0.0]; - - _networkImageNodeFlags.imageLoaded = NO; - - _URL = URL; - - // If URL is nil and URL was not equal to _URL (checked at the top), then we previously had a URL but it's been nil'd out. - BOOL hadURL = (URL == nil); - if (reset || hadURL) { - [self _setCurrentImageQuality:(hadURL ? 0.0 : 1.0)]; - [self _locked__setImage:_defaultImage]; - [self _locked_setAnimatedImage:nil]; - } - } - - [self setNeedsPreload]; -} - -- (NSURL *)URL -{ - return ASLockedSelf(_URL); -} - -- (void)setDefaultImage:(UIImage *)defaultImage -{ - ASLockScopeSelf(); - - [self _locked_setDefaultImage:defaultImage]; -} - -- (void)_locked_setDefaultImage:(UIImage *)defaultImage -{ - if (ASObjectIsEqual(defaultImage, _defaultImage)) { - return; - } - - _defaultImage = defaultImage; - - if (!_networkImageNodeFlags.imageLoaded) { - [self _setCurrentImageQuality:((_URL == nil) ? 0.0 : 1.0)]; - [self _locked__setImage:defaultImage]; - } -} - -- (UIImage *)defaultImage -{ - return ASLockedSelf(_defaultImage); -} - -- (void)setCurrentImageQuality:(CGFloat)currentImageQuality -{ - ASLockScopeSelf(); - _currentImageQuality = currentImageQuality; -} - -- (CGFloat)currentImageQuality -{ - return ASLockedSelf(_currentImageQuality); -} - -/** - * Always use these methods internally to update the current image quality - * We want to maintain the order that currentImageQuality is set regardless of the calling thread, - * so we always have to dispatch to the main thread to ensure that we queue the operations in the correct order. - * (see comment in displayDidFinish) - */ -- (void)_setCurrentImageQuality:(CGFloat)imageQuality -{ - dispatch_async(dispatch_get_main_queue(), ^{ - self.currentImageQuality = imageQuality; - }); -} - -- (void)setDownloadProgress:(CGFloat)downloadProgress -{ - ASLockScopeSelf(); - _downloadProgress = downloadProgress; -} - -- (CGFloat)downloadProgress -{ - return ASLockedSelf(_downloadProgress); -} - -/** - * Always use these methods internally to update the current download progress - * We want to maintain the order that downloadProgress is set regardless of the calling thread, - * so we always have to dispatch to the main thread to ensure that we queue the operations in the correct order. - * (see comment in displayDidFinish) - */ -- (void)_setDownloadProgress:(CGFloat)downloadProgress -{ - dispatch_async(dispatch_get_main_queue(), ^{ - self.downloadProgress = downloadProgress; - }); -} - -- (void)setRenderedImageQuality:(CGFloat)renderedImageQuality -{ - ASLockScopeSelf(); - _renderedImageQuality = renderedImageQuality; -} - -- (CGFloat)renderedImageQuality -{ - ASLockScopeSelf(); - return _renderedImageQuality; -} - -- (void)setDelegate:(id)delegate -{ - ASLockScopeSelf(); - _delegate = delegate; - - _networkImageNodeFlags.delegateWillStartDisplayAsynchronously = [delegate respondsToSelector:@selector(imageNodeWillStartDisplayAsynchronously:)]; - _networkImageNodeFlags.delegateWillLoadImageFromCache = [delegate respondsToSelector:@selector(imageNodeWillLoadImageFromCache:)]; - _networkImageNodeFlags.delegateWillLoadImageFromNetwork = [delegate respondsToSelector:@selector(imageNodeWillLoadImageFromNetwork:)]; - _networkImageNodeFlags.delegateDidStartFetchingData = [delegate respondsToSelector:@selector(imageNodeDidStartFetchingData:)]; - _networkImageNodeFlags.delegateDidFailWithError = [delegate respondsToSelector:@selector(imageNode:didFailWithError:)]; - _networkImageNodeFlags.delegateDidFinishDecoding = [delegate respondsToSelector:@selector(imageNodeDidFinishDecoding:)]; - _networkImageNodeFlags.delegateDidLoadImage = [delegate respondsToSelector:@selector(imageNode:didLoadImage:)]; - _networkImageNodeFlags.delegateDidLoadImageFromCache = [delegate respondsToSelector:@selector(imageNodeDidLoadImageFromCache:)]; - _networkImageNodeFlags.delegateDidLoadImageWithInfo = [delegate respondsToSelector:@selector(imageNode:didLoadImage:info:)]; - _networkImageNodeFlags.delegateDidFailToLoadImageFromCache = [delegate respondsToSelector:@selector(imageNodeDidFailToLoadImageFromCache:)]; -} - -- (id)delegate -{ - ASLockScopeSelf(); - return _delegate; -} - -- (void)setShouldRenderProgressImages:(BOOL)shouldRenderProgressImages -{ - if (ASLockedSelfCompareAssign(_networkImageNodeFlags.shouldRenderProgressImages, shouldRenderProgressImages)) { - [self _updateProgressImageBlockOnDownloaderIfNeeded]; - } -} - -- (BOOL)shouldRenderProgressImages -{ - ASLockScopeSelf(); - return _networkImageNodeFlags.shouldRenderProgressImages; -} - -- (void)setShouldCacheImage:(BOOL)shouldCacheImage -{ - ASLockedSelfCompareAssign(_networkImageNodeFlags.shouldCacheImage, shouldCacheImage); -} - -- (BOOL)shouldCacheImage -{ - ASLockScopeSelf(); - return _networkImageNodeFlags.shouldCacheImage; -} - -- (BOOL)placeholderShouldPersist -{ - ASLockScopeSelf(); - return (self.image == nil && self.animatedImage == nil && _URL != nil); -} - -/* displayWillStartAsynchronously: in ASMultiplexImageNode has a very similar implementation. Changes here are likely necessary - in ASMultiplexImageNode as well. */ -- (void)displayWillStartAsynchronously:(BOOL)asynchronously -{ - [super displayWillStartAsynchronously:asynchronously]; - - id delegate; - BOOL notifyDelegate; - { - ASLockScopeSelf(); - notifyDelegate = _networkImageNodeFlags.delegateWillStartDisplayAsynchronously; - delegate = _delegate; - } - if (notifyDelegate) { - [delegate imageNodeWillStartDisplayAsynchronously:self]; - } - - if (asynchronously == NO && _networkImageNodeFlags.cacheSupportsSynchronousFetch) { - ASLockScopeSelf(); - - NSURL *url = _URL; - if (_networkImageNodeFlags.imageLoaded == NO && url && _downloadIdentifier == nil) { - UIImage *result = [[_cache synchronouslyFetchedCachedImageWithURL:url] asdk_image]; - if (result) { - [self _setCurrentImageQuality:1.0]; - [self _setDownloadProgress:1.0]; - [self _locked__setImage:result]; - _networkImageNodeFlags.imageLoaded = YES; - - // Call out to the delegate. - if (_networkImageNodeFlags.delegateDidLoadImageWithInfo) { - ASUnlockScope(self); - const auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:url sourceType:ASNetworkImageSourceSynchronousCache downloadIdentifier:nil userInfo:nil]; - [delegate imageNode:self didLoadImage:result info:info]; - } else if (_networkImageNodeFlags.delegateDidLoadImage) { - ASUnlockScope(self); - [delegate imageNode:self didLoadImage:result]; - } - } - } - } - - if (self.image == nil) { - [self _updatePriorityOnDownloaderIfNeeded]; - } -} - -/* visibileStateDidChange in ASMultiplexImageNode has a very similar implementation. Changes here are likely necessary - in ASMultiplexImageNode as well. */ -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - [self _updatePriorityOnDownloaderIfNeeded]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - [self _updatePriorityOnDownloaderIfNeeded]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; -} - -- (void)didExitDisplayState -{ - [super didExitDisplayState]; - [self _updatePriorityOnDownloaderIfNeeded]; -} - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - - // If the image was set explicitly we don't want to remove it while exiting the preload state - if (ASLockedSelf(_networkImageNodeFlags.imageWasSetExternally)) { - return; - } - - [self _cancelDownloadAndClearImageWithResumePossibility:YES]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - - // Image was set externally no need to load an image - [self _lazilyLoadImageIfNecessary]; -} - -+ (void)setUseMainThreadDelegateCallbacks:(BOOL)useMainThreadDelegateCallbacks -{ - _useMainThreadDelegateCallbacks = useMainThreadDelegateCallbacks; -} - -+ (BOOL)useMainThreadDelegateCallbacks -{ - return _useMainThreadDelegateCallbacks; -} - -#pragma mark - Progress - -- (void)_updateDownloadedProgress:(CGFloat)progress - downloadIdentifier:(nullable id)downloadIdentifier -{ - ASLockScopeSelf(); - // Getting a result back for a different download identifier, download must not have been successfully canceled - if (ASObjectIsEqual(_downloadIdentifier, downloadIdentifier) == NO && downloadIdentifier != nil) { - return; - } - [self _setDownloadProgress:progress]; -} - -- (void)handleProgressImage:(UIImage *)progressImage progress:(CGFloat)progress downloadIdentifier:(nullable id)downloadIdentifier -{ - ASLockScopeSelf(); - - // Getting a result back for a different download identifier, download must not have been successfully canceled - if (ASObjectIsEqual(_downloadIdentifier, downloadIdentifier) == NO && downloadIdentifier != nil) { - return; - } - - as_log_verbose(ASImageLoadingLog(), "Received progress image for %@ q: %.2g id: %@", self, progress, progressImage); - [self _setCurrentImageQuality:progress]; - [self _locked__setImage:progressImage]; -} - -- (void)_updatePriorityOnDownloaderIfNeeded -{ - if (_networkImageNodeFlags.downloaderImplementsSetPriority) { - ASLockScopeSelf(); - - if (_downloadIdentifier != nil) { - ASImageDownloaderPriority priority = ASImageDownloaderPriorityWithInterfaceState(_interfaceState); - [_downloader setPriority:priority withDownloadIdentifier:_downloadIdentifier]; - } - } -} - -- (void)_updateProgressImageBlockOnDownloaderIfNeeded -{ - // If the downloader doesn't do progress, we are done. - if (_networkImageNodeFlags.downloaderImplementsSetProgress == NO) { - return; - } - - // Read state. - [self lock]; - BOOL shouldRender = _networkImageNodeFlags.shouldRenderProgressImages && ASInterfaceStateIncludesVisible(_interfaceState); - id oldDownloadIDForProgressBlock = _downloadIdentifierForProgressBlock; - id newDownloadIDForProgressBlock = shouldRender ? _downloadIdentifier : nil; - BOOL clearAndReattempt = NO; - [self unlock]; - - // If we're already bound to the correct download, we're done. - if (ASObjectIsEqual(oldDownloadIDForProgressBlock, newDownloadIDForProgressBlock)) { - return; - } - - // Unbind from the previous download. - if (oldDownloadIDForProgressBlock != nil) { - as_log_verbose(ASImageLoadingLog(), "Disabled progress images for %@ id: %@", self, oldDownloadIDForProgressBlock); - [_downloader setProgressImageBlock:nil callbackQueue:[self callbackQueue] withDownloadIdentifier:oldDownloadIDForProgressBlock]; - } - - // Bind to the current download. - if (newDownloadIDForProgressBlock != nil) { - __weak __typeof(self) weakSelf = self; - as_log_verbose(ASImageLoadingLog(), "Enabled progress images for %@ id: %@", self, newDownloadIDForProgressBlock); - [_downloader setProgressImageBlock:^(UIImage * _Nonnull progressImage, CGFloat progress, id _Nullable downloadIdentifier) { - [weakSelf handleProgressImage:progressImage progress:progress downloadIdentifier:downloadIdentifier]; - } callbackQueue:[self callbackQueue] withDownloadIdentifier:newDownloadIDForProgressBlock]; - } - - // Update state local state with lock held. - { - ASLockScopeSelf(); - // Check if the oldDownloadIDForProgressBlock still is the same as the _downloadIdentifierForProgressBlock - if (_downloadIdentifierForProgressBlock == oldDownloadIDForProgressBlock) { - _downloadIdentifierForProgressBlock = newDownloadIDForProgressBlock; - } else if (newDownloadIDForProgressBlock != nil) { - // If this is not the case another thread did change the _downloadIdentifierForProgressBlock already so - // we have to deregister the newDownloadIDForProgressBlock that we registered above - clearAndReattempt = YES; - } - } - - if (clearAndReattempt) { - // In this case another thread changed the _downloadIdentifierForProgressBlock before we finished registering - // the new progress block for newDownloadIDForProgressBlock ID. Let's clear it now and reattempt to register - [_downloader setProgressImageBlock:nil callbackQueue:[self callbackQueue] withDownloadIdentifier:newDownloadIDForProgressBlock]; - [self _updateProgressImageBlockOnDownloaderIfNeeded]; - } -} - -- (void)_cancelDownloadAndClearImageWithResumePossibility:(BOOL)storeResume -{ - ASLockScopeSelf(); - [self _locked_cancelDownloadAndClearImageWithResumePossibility:storeResume]; -} - -- (void)_locked_cancelDownloadAndClearImageWithResumePossibility:(BOOL)storeResume -{ - DISABLED_ASAssertLocked(__instanceLock__); - - [self _locked_cancelImageDownloadWithResumePossibility:storeResume]; - - [self _locked_setAnimatedImage:nil]; - [self _setCurrentImageQuality:0.0]; - [self _setDownloadProgress:0.0]; - [self _locked__setImage:_defaultImage]; - - _networkImageNodeFlags.imageLoaded = NO; - - if (_networkImageNodeFlags.cacheSupportsClearing) { - if (_URL != nil) { - as_log_verbose(ASImageLoadingLog(), "Clearing cached image for %@ url: %@", self, _URL); - [_cache clearFetchedImageFromCacheWithURL:_URL]; - } - } -} - -- (void)_cancelImageDownloadWithResumePossibility:(BOOL)storeResume -{ - ASLockScopeSelf(); - [self _locked_cancelImageDownloadWithResumePossibility:storeResume]; -} - -- (void)_locked_cancelImageDownloadWithResumePossibility:(BOOL)storeResume -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (!_downloadIdentifier) { - return; - } - - if (_downloadIdentifier) { - if (storeResume && _networkImageNodeFlags.downloaderImplementsCancelWithResume) { - as_log_verbose(ASImageLoadingLog(), "Canceling image download with resume for %@ id: %@", self, _downloadIdentifier); - [_downloader cancelImageDownloadWithResumePossibilityForIdentifier:_downloadIdentifier]; - } else { - as_log_verbose(ASImageLoadingLog(), "Canceling image download no resume for %@ id: %@", self, _downloadIdentifier); - [_downloader cancelImageDownloadForIdentifier:_downloadIdentifier]; - } - } - _downloadIdentifier = nil; - _cacheSentinel++; -} - -- (void)_downloadImageWithCompletion:(void (^)(id imageContainer, NSError*, id downloadIdentifier, id userInfo))finished -{ - ASPerformBlockOnBackgroundThread(^{ - NSURL *url; - id downloadIdentifier; - BOOL cancelAndReattempt = NO; - ASInterfaceState interfaceState; - - // Below, to avoid performance issues, we're calling downloadImageWithURL without holding the lock. This is a bit ugly because - // We need to reobtain the lock after and ensure that the task we've kicked off still matches our URL. If not, we need to cancel - // it and try again. - { - ASLockScopeSelf(); - url = self->_URL; - interfaceState = self->_interfaceState; - } - - dispatch_queue_t callbackQueue = [self callbackQueue]; - __weak __typeof__(self) weakSelf = self; - ASImageDownloaderProgress downloadProgress = ^(CGFloat progress){ - __typeof__(self) strongSelf = weakSelf; - if (strongSelf) { - [strongSelf _updateDownloadedProgress:progress downloadIdentifier:downloadIdentifier]; - } - }; - ASImageDownloaderCompletion completion = ^(id _Nullable imageContainer, NSError * _Nullable error, id _Nullable downloadIdentifier, id _Nullable userInfo) { - if (finished != NULL) { - finished(imageContainer, error, downloadIdentifier, userInfo); - } - }; - - if (self->_networkImageNodeFlags.downloaderImplementsDownloadWithPriority) { - /* - Decide a priority based on the current interface state of this node. - It can happen that this method was called when the node entered preload state - but the interface state, at this point, tells us that the node is (going to be) visible. - If that's the case, we jump to a higher priority directly. - */ - ASImageDownloaderPriority priority = ASImageDownloaderPriorityWithInterfaceState(interfaceState); - - downloadIdentifier = [self->_downloader downloadImageWithURL:url - shouldRetry:[self shouldRetryImageDownload] - priority:priority - callbackQueue:callbackQueue - downloadProgress:downloadProgress - completion:completion]; - } else { - /* - Kick off a download with default priority. - The actual "default" value is decided by the downloader. - ASBasicImageDownloader and ASPINRemoteImageDownloader both use ASImageDownloaderPriorityImminent - which is mapped to NSURLSessionTaskPriorityDefault. - - This means that preload and display nodes use the same priority - and their requests are put into the same pool. - */ - downloadIdentifier = [self->_downloader downloadImageWithURL:url - shouldRetry:[self shouldRetryImageDownload] - callbackQueue:callbackQueue - downloadProgress:downloadProgress - completion:completion]; - } - as_log_verbose(ASImageLoadingLog(), "Downloading image for %@ url: %@", self, url); - - { - ASLockScopeSelf(); - if (ASObjectIsEqual(self->_URL, url)) { - // The download we kicked off is correct, no need to do any more work. - self->_downloadIdentifier = downloadIdentifier; - } else { - // The URL changed since we kicked off our download task. This shouldn't happen often so we'll pay the cost and - // cancel that request and kick off a new one. - cancelAndReattempt = YES; - } - } - - if (cancelAndReattempt) { - if (downloadIdentifier != nil) { - as_log_verbose(ASImageLoadingLog(), "Canceling image download no resume for %@ id: %@", self, downloadIdentifier); - [self->_downloader cancelImageDownloadForIdentifier:downloadIdentifier]; - } - [self _downloadImageWithCompletion:finished]; - return; - } - - [self _updateProgressImageBlockOnDownloaderIfNeeded]; - }); -} - -- (void)_lazilyLoadImageIfNecessary -{ - ASDisplayNodeAssertMainThread(); - - [self lock]; - __weak id delegate = _delegate; - BOOL delegateDidStartFetchingData = _networkImageNodeFlags.delegateDidStartFetchingData; - BOOL delegateWillLoadImageFromCache = _networkImageNodeFlags.delegateWillLoadImageFromCache; - BOOL delegateWillLoadImageFromNetwork = _networkImageNodeFlags.delegateWillLoadImageFromNetwork; - BOOL delegateDidLoadImageFromCache = _networkImageNodeFlags.delegateDidLoadImageFromCache; - BOOL delegateDidFailToLoadImageFromCache = _networkImageNodeFlags.delegateDidFailToLoadImageFromCache; - BOOL isImageLoaded = _networkImageNodeFlags.imageLoaded; - __block NSURL *URL = _URL; - id currentDownloadIdentifier = _downloadIdentifier; - [self unlock]; - - if (!isImageLoaded && URL != nil && currentDownloadIdentifier == nil) { - if (delegateDidStartFetchingData) { - [delegate imageNodeDidStartFetchingData:self]; - } - - if (URL.isFileURL) { - dispatch_async(dispatch_get_main_queue(), ^{ - ASLockScopeSelf(); - - // Bail out if not the same URL anymore - if (!ASObjectIsEqual(URL, self->_URL)) { - return; - } - - if (self->_networkImageNodeFlags.shouldCacheImage) { - [self _locked__setImage:[UIImage imageNamed:URL.path.lastPathComponent]]; - } else { - // First try to load the path directly, for efficiency assuming a developer who - // doesn't want caching is trying to be as minimal as possible. - auto nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:URL.path]; - if (nonAnimatedImage == nil) { - // If we couldn't find it, execute an -imageNamed:-like search so we can find resources even if the - // extension is not provided in the path. This allows the same path to work regardless of shouldCacheImage. - NSString *filename = [[NSBundle mainBundle] pathForResource:URL.path.lastPathComponent ofType:nil]; - if (filename != nil) { - nonAnimatedImage = [[UIImage alloc] initWithContentsOfFile:filename]; - // Update URL to point to newly-resolved file URL for animated image load. - URL = nonAnimatedImage ? [NSURL URLWithString:filename] : URL; - } - } - - // If the file may be an animated gif and then created an animated image. - id animatedImage = nil; - if (self->_networkImageNodeFlags.downloaderImplementsAnimatedImage) { - const auto data = [[NSData alloc] initWithContentsOfURL:URL]; - if (data != nil) { - animatedImage = [self->_downloader animatedImageWithData:data]; - - if ([animatedImage respondsToSelector:@selector(isDataSupported:)] && [animatedImage isDataSupported:data] == NO) { - animatedImage = nil; - } - } - } - - if (animatedImage != nil) { - [self _locked_setAnimatedImage:animatedImage]; - } else { - [self _locked__setImage:nonAnimatedImage]; - } - } - - self->_networkImageNodeFlags.imageLoaded = YES; - - [self _setCurrentImageQuality:1.0]; - [self _setDownloadProgress:1.0]; - - if (self->_networkImageNodeFlags.delegateDidLoadImageWithInfo) { - ASUnlockScope(self); - const auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:ASNetworkImageSourceFileURL downloadIdentifier:nil userInfo:nil]; - [delegate imageNode:self didLoadImage:self.image info:info]; - } else if (self->_networkImageNodeFlags.delegateDidLoadImage) { - ASUnlockScope(self); - [delegate imageNode:self didLoadImage:self.image]; - } - }); - } else { - __weak __typeof__(self) weakSelf = self; - const auto finished = ^(id imageContainer, NSError *error, id downloadIdentifier, ASNetworkImageSourceType imageSource, id userInfo) { - ASPerformBlockOnBackgroundThread(^{ - __typeof__(self) strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - - as_log_verbose(ASImageLoadingLog(), "Downloaded image for %@ img: %@ url: %@", self, [imageContainer asdk_image], URL); - - // Grab the lock for the rest of the block - ASLockScope(strongSelf); - - //Getting a result back for a different download identifier, download must not have been successfully canceled - if (ASObjectIsEqual(strongSelf->_downloadIdentifier, downloadIdentifier) == NO && downloadIdentifier != nil) { - return; - } - - //No longer in preload range, no point in setting the results (they won't be cleared in exit preload range) - if (ASInterfaceStateIncludesPreload(strongSelf->_interfaceState) == NO) { - strongSelf->_downloadIdentifier = nil; - strongSelf->_cacheSentinel++; - return; - } - - UIImage *newImage; - if (imageContainer != nil) { - [strongSelf _setCurrentImageQuality:1.0]; - [strongSelf _setDownloadProgress:1.0]; - NSData *animatedImageData = [imageContainer asdk_animatedImageData]; - if (animatedImageData && strongSelf->_networkImageNodeFlags.downloaderImplementsAnimatedImage) { - id animatedImage = [strongSelf->_downloader animatedImageWithData:animatedImageData]; - [strongSelf _locked_setAnimatedImage:animatedImage]; - } else { - newImage = [imageContainer asdk_image]; - [strongSelf _locked__setImage:newImage]; - } - strongSelf->_networkImageNodeFlags.imageLoaded = YES; - } - - strongSelf->_downloadIdentifier = nil; - strongSelf->_cacheSentinel++; - - void (^calloutBlock)(ASNetworkImageNode *inst); - - if (newImage) { - if (strongSelf->_networkImageNodeFlags.delegateDidLoadImageWithInfo) { - calloutBlock = ^(ASNetworkImageNode *strongSelf) { - const auto info = [[ASNetworkImageLoadInfo alloc] initWithURL:URL sourceType:imageSource downloadIdentifier:downloadIdentifier userInfo:userInfo]; - [delegate imageNode:strongSelf didLoadImage:newImage info:info]; - }; - } else if (strongSelf->_networkImageNodeFlags.delegateDidLoadImage) { - calloutBlock = ^(ASNetworkImageNode *strongSelf) { - [delegate imageNode:strongSelf didLoadImage:newImage]; - }; - } - } else if (error && strongSelf->_networkImageNodeFlags.delegateDidFailWithError) { - calloutBlock = ^(ASNetworkImageNode *strongSelf) { - [delegate imageNode:strongSelf didFailWithError:error]; - }; - } - - if (calloutBlock) { - if (ASNetworkImageNode.useMainThreadDelegateCallbacks) { - ASPerformBlockOnMainThread(^{ - if (auto strongSelf = weakSelf) { - calloutBlock(strongSelf); - } - }); - } else { - calloutBlock(strongSelf); - } - } - }); - }; - - // As the _cache and _downloader is only set once in the intializer we don't have to use a - // lock in here - if (_cache != nil) { - NSInteger cacheSentinel = ASLockedSelf(++_cacheSentinel); - - as_log_verbose(ASImageLoadingLog(), "Decaching image for %@ url: %@", self, URL); - - ASImageCacherCompletion completion = ^(id imageContainer, ASImageCacheType cacheType) { - // If the cache sentinel changed, that means this request was cancelled. - if (ASLockedSelf(self->_cacheSentinel != cacheSentinel)) { - return; - } - - if ([imageContainer asdk_image] == nil && [imageContainer asdk_animatedImageData] == nil && self->_downloader != nil) { - if (delegateDidFailToLoadImageFromCache) { - [delegate imageNodeDidFailToLoadImageFromCache:self]; - } - if (delegateWillLoadImageFromNetwork) { - [delegate imageNodeWillLoadImageFromNetwork:self]; - } - [self _downloadImageWithCompletion:^(id imageContainer, NSError *error, id downloadIdentifier, id userInfo) { - finished(imageContainer, error, downloadIdentifier, ASNetworkImageSourceDownload, userInfo); - }]; - } else { - if (delegateDidLoadImageFromCache) { - [delegate imageNodeDidLoadImageFromCache:self]; - } - as_log_verbose(ASImageLoadingLog(), "Decached image for %@ img: %@ url: %@ cacheType: %@", self, [imageContainer asdk_image], URL, cacheType); - finished(imageContainer, nil, nil, cacheType == ASImageCacheTypeSynchronous ? ASNetworkImageSourceSynchronousCache : ASNetworkImageSourceAsynchronousCache, nil); - } - }; - - if (delegateWillLoadImageFromCache) { - [delegate imageNodeWillLoadImageFromCache:self]; - } - [_cache cachedImageWithURL:URL - callbackQueue:[self callbackQueue] - completion:completion]; - } else { - if (delegateWillLoadImageFromNetwork) { - [delegate imageNodeWillLoadImageFromNetwork:self]; - } - [self _downloadImageWithCompletion:^(id imageContainer, NSError *error, id downloadIdentifier, id userInfo) { - finished(imageContainer, error, downloadIdentifier, ASNetworkImageSourceDownload, userInfo); - }]; - } - } - } -} - -#pragma mark - ASDisplayNode+Subclasses - -- (void)displayDidFinish -{ - [super displayDidFinish]; - - id delegate = nil; - - { - ASLockScopeSelf(); - if (_networkImageNodeFlags.delegateDidFinishDecoding && self.layer.contents != nil) { - /* We store the image quality in _currentImageQuality whenever _image is set. On the following displayDidFinish, we'll know that - _currentImageQuality is the quality of the image that has just finished rendering. In order for this to be accurate, we - need to be sure we are on main thread when we set _currentImageQuality. Otherwise, it is possible for _currentImageQuality - to be modified at a point where it is too late to cancel the main thread's previous display (the final sentinel check has passed), - but before the displayDidFinish of the previous display pass is called. In this situation, displayDidFinish would be called and we - would set _renderedImageQuality to the new _currentImageQuality, but the actual quality of the rendered image should be the previous - value stored in _currentImageQuality. */ - - _renderedImageQuality = _currentImageQuality; - - // Assign the delegate to be used - delegate = _delegate; - } - } - - if (delegate != nil) { - [delegate imageNodeDidFinishDecoding:self]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/ASNodeController+Beta.h b/Example/Pods/Texture/Source/ASNodeController+Beta.h deleted file mode 100644 index 6501a114..00000000 --- a/Example/Pods/Texture/Source/ASNodeController+Beta.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// ASNodeController+Beta.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import // for ASInterfaceState protocol - -/* ASNodeController is currently beta and open to change in the future */ -@interface ASNodeController<__covariant DisplayNodeType : ASDisplayNode *> - : NSObject - -@property (nonatomic, strong /* may be weak! */) DisplayNodeType node; - -// Until an ASNodeController can be provided in place of an ASCellNode, some apps may prefer to have -// nodes keep their controllers alive (and a weak reference from controller to node) - -@property (nonatomic) BOOL shouldInvertStrongReference; - -- (void)loadNode; - -// for descriptions see definition -- (void)nodeDidLoad ASDISPLAYNODE_REQUIRES_SUPER; -- (void)nodeDidLayout ASDISPLAYNODE_REQUIRES_SUPER; - -// This is only called during Yoga-driven layouts. -- (void)nodeWillCalculateLayout:(ASSizeRange)constrainedSize ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)didEnterVisibleState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitVisibleState ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)didEnterDisplayState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitDisplayState ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)didEnterPreloadState ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitPreloadState ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)hierarchyDisplayDidFinish ASDISPLAYNODE_REQUIRES_SUPER; - -- (void)didEnterHierarchy ASDISPLAYNODE_REQUIRES_SUPER; -- (void)didExitHierarchy ASDISPLAYNODE_REQUIRES_SUPER; - -/** - * @discussion Attempts (via ASLockSequence, a backing-off spinlock similar to - * std::lock()) to lock both the node and its ASNodeController, if one exists. - */ -- (ASLockSet)lockPair; - -@end - -@interface ASDisplayNode (ASNodeController) - -@property(nonatomic, readonly) ASNodeController *nodeController; - -@end diff --git a/Example/Pods/Texture/Source/ASNodeController+Beta.mm b/Example/Pods/Texture/Source/ASNodeController+Beta.mm deleted file mode 100644 index 0245a7d4..00000000 --- a/Example/Pods/Texture/Source/ASNodeController+Beta.mm +++ /dev/null @@ -1,136 +0,0 @@ -// -// ASNodeController+Beta.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#define _node (_shouldInvertStrongReference ? _weakNode : _strongNode) - -@implementation ASNodeController -{ - ASDisplayNode *_strongNode; - __weak ASDisplayNode *_weakNode; - AS::RecursiveMutex __instanceLock__; -} - -- (void)loadNode -{ - ASLockScopeSelf(); - self.node = [[ASDisplayNode alloc] init]; -} - -- (ASDisplayNode *)node -{ - ASLockScopeSelf(); - if (_node == nil) { - [self loadNode]; - } - return _node; -} - -- (void)setupReferencesWithNode:(ASDisplayNode *)node -{ - ASLockScopeSelf(); - if (_shouldInvertStrongReference) { - // The node should own the controller; weak reference from controller to node. - _weakNode = node; - _strongNode = nil; - } else { - // The controller should own the node; weak reference from node to controller. - _strongNode = node; - _weakNode = nil; - } - - [node __setNodeController:self]; -} - -- (void)setNode:(ASDisplayNode *)node -{ - ASLockScopeSelf(); - if (node == _node) { - return; - } - [self setupReferencesWithNode:node]; - [node addInterfaceStateDelegate:self]; -} - -- (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference -{ - ASLockScopeSelf(); - if (_shouldInvertStrongReference != shouldInvertStrongReference) { - // Because the BOOL controls which ivar we access, get the node before toggling. - ASDisplayNode *node = _node; - _shouldInvertStrongReference = shouldInvertStrongReference; - [self setupReferencesWithNode:node]; - } -} - -// subclass overrides -- (void)nodeDidLoad {} -- (void)nodeDidLayout {} -- (void)nodeWillCalculateLayout:(ASSizeRange)constrainedSize {} - -- (void)didEnterVisibleState {} -- (void)didExitVisibleState {} - -- (void)didEnterDisplayState {} -- (void)didExitDisplayState {} - -- (void)didEnterPreloadState {} -- (void)didExitPreloadState {} - -- (void)interfaceStateDidChange:(ASInterfaceState)newState - fromState:(ASInterfaceState)oldState {} - -- (void)hierarchyDisplayDidFinish {} - -- (void)didEnterHierarchy {} -- (void)didExitHierarchy {} - -- (ASLockSet)lockPair { - ASLockSet lockSet = ASLockSequence(^BOOL(ASAddLockBlock addLock) { - if (!addLock(_node)) { - return NO; - } - if (!addLock(self)) { - return NO; - } - return YES; - }); - - return lockSet; -} - -#pragma mark NSLocking - -- (void)lock -{ - __instanceLock__.lock(); -} - -- (void)unlock -{ - __instanceLock__.unlock(); -} - -- (BOOL)tryLock -{ - return __instanceLock__.try_lock(); -} - -@end - -@implementation ASDisplayNode (ASNodeController) - -- (ASNodeController *)nodeController -{ - return _weakNodeController ?: _strongNodeController; -} - -@end diff --git a/Example/Pods/Texture/Source/ASPagerFlowLayout.h b/Example/Pods/Texture/Source/ASPagerFlowLayout.h deleted file mode 100644 index 17c61d6c..00000000 --- a/Example/Pods/Texture/Source/ASPagerFlowLayout.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ASPagerFlowLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASPagerFlowLayout : UICollectionViewFlowLayout - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASPagerFlowLayout.mm b/Example/Pods/Texture/Source/ASPagerFlowLayout.mm deleted file mode 100644 index 301cea24..00000000 --- a/Example/Pods/Texture/Source/ASPagerFlowLayout.mm +++ /dev/null @@ -1,110 +0,0 @@ -// -// ASPagerFlowLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@interface ASPagerFlowLayout () { - __weak ASCellNode *_currentCellNode; -} - -@end - -//TODO make this an ASCollectionViewLayout -@implementation ASPagerFlowLayout - -- (ASCollectionView *)asCollectionView -{ - // Dynamic cast is too slow and not worth it. - return (ASCollectionView *)self.collectionView; -} - -- (void)prepareLayout -{ - [super prepareLayout]; - if (_currentCellNode == nil) { - [self _updateCurrentNode]; - } -} - -- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset -{ - // Don't mess around if the user is interacting with the page node. Although if just a rotation happened we should - // try to use the current index path to not end up setting the target content offset to something in between pages - if (!self.collectionView.decelerating && !self.collectionView.tracking) { - NSIndexPath *indexPath = [self.asCollectionView indexPathForNode:_currentCellNode]; - if (indexPath) { - return [self _targetContentOffsetForItemAtIndexPath:indexPath proposedContentOffset:proposedContentOffset]; - } - } - - return [super targetContentOffsetForProposedContentOffset:proposedContentOffset]; -} - -- (CGPoint)_targetContentOffsetForItemAtIndexPath:(NSIndexPath *)indexPath proposedContentOffset:(CGPoint)proposedContentOffset -{ - if ([self _dataSourceIsEmpty]) { - return proposedContentOffset; - } - - UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath]; - if (attributes == nil) { - return proposedContentOffset; - } - - CGFloat xOffset = (CGRectGetWidth(self.collectionView.bounds) - CGRectGetWidth(attributes.frame)) / 2.0; - return CGPointMake(attributes.frame.origin.x - xOffset, proposedContentOffset.y); -} - -- (BOOL)_dataSourceIsEmpty -{ - return ([self.collectionView numberOfSections] == 0 || - [self.collectionView numberOfItemsInSection:0] == 0); -} - -- (void)_updateCurrentNode -{ - // Never change node during an animated bounds change (rotation) - // NOTE! Listening for -prepareForAnimatedBoundsChange and -finalizeAnimatedBoundsChange - // isn't sufficient here! It's broken! - NSArray *animKeys = self.collectionView.layer.animationKeys; - for (NSString *key in animKeys) { - if ([key hasPrefix:@"bounds"]) { - return; - } - } - - CGRect bounds = self.collectionView.bounds; - CGRect rect = CGRectMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds), 1, 1); - - NSIndexPath *indexPath = [self layoutAttributesForElementsInRect:rect].firstObject.indexPath; - if (indexPath) { - ASCellNode *node = [self.asCollectionView nodeForItemAtIndexPath:indexPath]; - if (node) { - _currentCellNode = node; - } - } -} - -- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds -{ - [self _updateCurrentNode]; - return [super shouldInvalidateLayoutForBoundsChange:newBounds]; -} - -- (UICollectionViewLayoutInvalidationContext *)invalidationContextForBoundsChange:(CGRect)newBounds -{ - UICollectionViewFlowLayoutInvalidationContext *ctx = (UICollectionViewFlowLayoutInvalidationContext *)[super invalidationContextForBoundsChange:newBounds]; - ctx.invalidateFlowLayoutDelegateMetrics = YES; - ctx.invalidateFlowLayoutAttributes = YES; - return ctx; -} - -@end diff --git a/Example/Pods/Texture/Source/ASPagerNode+Beta.h b/Example/Pods/Texture/Source/ASPagerNode+Beta.h deleted file mode 100644 index a768f6be..00000000 --- a/Example/Pods/Texture/Source/ASPagerNode+Beta.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ASPagerNode+Beta.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASPagerNode (Beta) - -- (instancetype)initUsingAsyncCollectionLayout; - -@end diff --git a/Example/Pods/Texture/Source/ASPagerNode.h b/Example/Pods/Texture/Source/ASPagerNode.h deleted file mode 100644 index 9fb99775..00000000 --- a/Example/Pods/Texture/Source/ASPagerNode.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// ASPagerNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASPagerNode; -@class ASPagerFlowLayout; - -NS_ASSUME_NONNULL_BEGIN - -#define ASPagerNodeDataSource ASPagerDataSource -@protocol ASPagerDataSource - -/** - * This method replaces -collectionView:numberOfItemsInSection: - * - * @param pagerNode The sender. - * @return The total number of pages that can display in the pagerNode. - */ -- (NSInteger)numberOfPagesInPagerNode:(ASPagerNode *)pagerNode; - -@optional - -/** - * This method replaces -collectionView:nodeForItemAtIndexPath: - * - * @param pagerNode The sender. - * @param index The index of the requested node. - * @return a node for display at this index. This will be called on the main thread and should - * not implement reuse (it will be called once per row). Unlike UICollectionView's version, - * this method is not called when the row is about to display. - */ -- (ASCellNode *)pagerNode:(ASPagerNode *)pagerNode nodeAtIndex:(NSInteger)index; - -/** - * This method replaces -collectionView:nodeBlockForItemAtIndexPath: - * This method takes precedence over pagerNode:nodeAtIndex: if implemented. - * - * @param pagerNode The sender. - * @param index The index of the requested node. - * @return a block that creates the node for display at this index. - * Must be thread-safe (can be called on the main thread or a background - * queue) and should not implement reuse (it will be called once per row). - */ -- (ASCellNodeBlock)pagerNode:(ASPagerNode *)pagerNode nodeBlockAtIndex:(NSInteger)index; - -@end - -@protocol ASPagerDelegate -@end - -/** - * A horizontal, paging collection node. - */ -@interface ASPagerNode : ASCollectionNode - -/** - * Configures a default horizontal, paging flow layout with 0 inter-item spacing. - */ -- (instancetype)init; - -/** - * Initializer with custom-configured flow layout properties. - * - * NOTE: The flow layout must have a horizontal scroll direction. - */ -- (instancetype)initWithCollectionViewLayout:(ASPagerFlowLayout *)flowLayout; - -/** - * Data Source is required, and uses a different protocol from ASCollectionNode. - */ -- (void)setDataSource:(nullable id )dataSource; -- (nullable id )dataSource AS_WARN_UNUSED_RESULT; - -/** - * Delegate is optional. - * This includes UIScrollViewDelegate as well as most methods from UICollectionViewDelegate, like willDisplay... - */ -- (void)setDelegate:(nullable id )delegate; -- (nullable id )delegate AS_WARN_UNUSED_RESULT; - -/** - * The underlying ASCollectionView object. - */ -@property (readonly) ASCollectionView *view; - -/** - * Returns the current page index. Main thread only. - */ -@property (nonatomic, readonly) NSInteger currentPageIndex; - -/** - * Scroll the contents of the receiver to ensure that the page is visible - */ -- (void)scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated; - -/** - * Returns the node for the passed page index - */ -- (ASCellNode *)nodeForPageAtIndex:(NSInteger)index AS_WARN_UNUSED_RESULT; - -/** - * Returns the index of the page for the cell passed or NSNotFound - */ -- (NSInteger)indexOfPageWithNode:(ASCellNode *)node; - -/** - * Tells the pager node to allow its view controller to automatically adjust its content insets. - * - * @see UIViewController.automaticallyAdjustsScrollViewInsets - * - * @discussion ASPagerNode should usually not have its content insets automatically adjusted - * because it scrolls horizontally, and flow layout will log errors because the pages - * do not fit between the top & bottom insets of the collection view. - * - * The default value is NO, which means that ASPagerNode expects that its view controller will - * have automaticallyAdjustsScrollViewInsets=NO. - * - * If this property is NO, but your view controller has automaticallyAdjustsScrollViewInsets=YES, - * the pager node will set the property on the view controller to NO and log a warning message. In the future, - * the pager node will just log the warning, and you'll need to configure your view controller on your own. - */ -@property (nonatomic) BOOL allowsAutomaticInsetsAdjustment; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASPagerNode.mm b/Example/Pods/Texture/Source/ASPagerNode.mm deleted file mode 100644 index 082ffc66..00000000 --- a/Example/Pods/Texture/Source/ASPagerNode.mm +++ /dev/null @@ -1,230 +0,0 @@ -// -// ASPagerNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -@interface ASPagerNode () -{ - __weak id _pagerDataSource; - ASPagerNodeProxy *_proxyDataSource; - struct { - unsigned nodeBlockAtIndex:1; - unsigned nodeAtIndex:1; - } _pagerDataSourceFlags; - BOOL _allowsAutomaticInsetsAdjustment; - - __weak id _pagerDelegate; - ASPagerNodeProxy *_proxyDelegate; -} - -@end - -@implementation ASPagerNode - -@dynamic view, delegate, dataSource; - -#pragma mark - Lifecycle - -- (instancetype)init -{ - ASPagerFlowLayout *flowLayout = [[ASPagerFlowLayout alloc] init]; - flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal; - flowLayout.minimumInteritemSpacing = 0; - flowLayout.minimumLineSpacing = 0; - - return [self initWithCollectionViewLayout:flowLayout]; -} - -- (instancetype)initWithCollectionViewLayout:(ASPagerFlowLayout *)flowLayout -{ - ASDisplayNodeAssert([flowLayout isKindOfClass:[ASPagerFlowLayout class]], @"ASPagerNode requires a flow layout."); - ASDisplayNodeAssertTrue(flowLayout.scrollDirection == UICollectionViewScrollDirectionHorizontal); - self = [super initWithCollectionViewLayout:flowLayout]; - return self; -} - -- (instancetype)initUsingAsyncCollectionLayout -{ - ASCollectionGalleryLayoutDelegate *layoutDelegate = [[ASCollectionGalleryLayoutDelegate alloc] initWithScrollableDirections:ASScrollDirectionHorizontalDirections]; - self = [super initWithLayoutDelegate:layoutDelegate layoutFacilitator:nil]; - if (self) { - layoutDelegate.propertiesProvider = self; - } - return self; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - ASCollectionView *cv = self.view; - cv.asyncDataSource = (id)_proxyDataSource ?: self; - cv.asyncDelegate = (id)_proxyDelegate ?: self; -#if TARGET_OS_IOS - cv.pagingEnabled = YES; - cv.scrollsToTop = NO; -#endif - cv.allowsSelection = NO; - cv.showsVerticalScrollIndicator = NO; - cv.showsHorizontalScrollIndicator = NO; - - ASRangeTuningParameters minimumRenderParams = { .leadingBufferScreenfuls = 0.0, .trailingBufferScreenfuls = 0.0 }; - ASRangeTuningParameters minimumPreloadParams = { .leadingBufferScreenfuls = 1.0, .trailingBufferScreenfuls = 1.0 }; - [self setTuningParameters:minimumRenderParams forRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypeDisplay]; - [self setTuningParameters:minimumPreloadParams forRangeMode:ASLayoutRangeModeMinimum rangeType:ASLayoutRangeTypePreload]; - - ASRangeTuningParameters fullRenderParams = { .leadingBufferScreenfuls = 1.0, .trailingBufferScreenfuls = 1.0 }; - ASRangeTuningParameters fullPreloadParams = { .leadingBufferScreenfuls = 2.0, .trailingBufferScreenfuls = 2.0 }; - [self setTuningParameters:fullRenderParams forRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypeDisplay]; - [self setTuningParameters:fullPreloadParams forRangeMode:ASLayoutRangeModeFull rangeType:ASLayoutRangeTypePreload]; -} - -#pragma mark - Getters / Setters - -- (NSInteger)currentPageIndex -{ - return (self.view.contentOffset.x / [self pageSize].width); -} - -- (CGSize)pageSize -{ - UIEdgeInsets contentInset = self.contentInset; - CGSize pageSize = self.bounds.size; - pageSize.height -= (contentInset.top + contentInset.bottom); - return pageSize; -} - -#pragma mark - Helpers - -- (void)scrollToPageAtIndex:(NSInteger)index animated:(BOOL)animated -{ - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:animated]; -} - -- (ASCellNode *)nodeForPageAtIndex:(NSInteger)index -{ - return [self nodeForItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0]]; -} - -- (NSInteger)indexOfPageWithNode:(ASCellNode *)node -{ - NSIndexPath *indexPath = [self indexPathForNode:node]; - if (!indexPath) { - return NSNotFound; - } - return indexPath.row; -} - -#pragma mark - ASCollectionGalleryLayoutPropertiesProviding - -- (CGSize)galleryLayoutDelegate:(nonnull ASCollectionGalleryLayoutDelegate *)delegate sizeForElements:(nonnull ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - return [self pageSize]; -} - -#pragma mark - ASCollectionDataSource - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_pagerDataSourceFlags.nodeBlockAtIndex) { - return [_pagerDataSource pagerNode:self nodeBlockAtIndex:indexPath.item]; - } else if (_pagerDataSourceFlags.nodeAtIndex) { - ASCellNode *node = [_pagerDataSource pagerNode:self nodeAtIndex:indexPath.item]; - return ^{ return node; }; - } else { - ASDisplayNodeFailAssert(@"Pager data source must implement either %@ or %@. Data source: %@", NSStringFromSelector(@selector(pagerNode:nodeBlockAtIndex:)), NSStringFromSelector(@selector(pagerNode:nodeAtIndex:)), _pagerDataSource); - return ^{ - return [[ASCellNode alloc] init]; - }; - } -} - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - ASDisplayNodeAssert(_pagerDataSource != nil, @"ASPagerNode must have a data source to load nodes to display"); - return [_pagerDataSource numberOfPagesInPagerNode:self]; -} - -#pragma mark - ASCollectionDelegate - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - return ASSizeRangeMake([self pageSize]); -} - -#pragma mark - Data Source Proxy - -- (id )dataSource -{ - return _pagerDataSource; -} - -- (void)setDataSource:(id )dataSource -{ - if (dataSource != _pagerDataSource) { - _pagerDataSource = dataSource; - - if (dataSource == nil) { - memset(&_pagerDataSourceFlags, 0, sizeof(_pagerDataSourceFlags)); - } else { - _pagerDataSourceFlags.nodeBlockAtIndex = [_pagerDataSource respondsToSelector:@selector(pagerNode:nodeBlockAtIndex:)]; - _pagerDataSourceFlags.nodeAtIndex = [_pagerDataSource respondsToSelector:@selector(pagerNode:nodeAtIndex:)]; - } - - _proxyDataSource = dataSource ? [[ASPagerNodeProxy alloc] initWithTarget:dataSource interceptor:self] : nil; - - super.dataSource = (id )_proxyDataSource; - } -} - -- (void)setDelegate:(id)delegate -{ - if (delegate != _pagerDelegate) { - _pagerDelegate = delegate; - _proxyDelegate = delegate ? [[ASPagerNodeProxy alloc] initWithTarget:delegate interceptor:self] : nil; - super.delegate = (id )_proxyDelegate; - } -} - -- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy -{ - [self setDataSource:nil]; - [self setDelegate:nil]; -} - -- (void)didEnterHierarchy -{ - [super didEnterHierarchy]; - - // Check that our view controller does not automatically set our content insets - // In every use case I can imagine, the pager is not hosted inside a range-managed node. - if (_allowsAutomaticInsetsAdjustment == NO) { - UIViewController *vc = [self.view asdk_associatedViewController]; - if (vc.automaticallyAdjustsScrollViewInsets) { - NSLog(@"AsyncDisplayKit: ASPagerNode is setting automaticallyAdjustsScrollViewInsets=NO on its owning view controller %@. This automatic behavior will be disabled in the future. Set allowsAutomaticInsetsAdjustment=YES on the pager node to suppress this behavior.", vc); - vc.automaticallyAdjustsScrollViewInsets = NO; - } - } -} - -@end diff --git a/Example/Pods/Texture/Source/ASRangeManagingNode.h b/Example/Pods/Texture/Source/ASRangeManagingNode.h deleted file mode 100644 index c331a77b..00000000 --- a/Example/Pods/Texture/Source/ASRangeManagingNode.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ASRangeManagingNode.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASCellNode; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Basically ASTableNode or ASCollectionNode. - */ -@protocol ASRangeManagingNode - -/** - * Retrieve the index path for the given node, if it's a member of this container. - * - * @param node The node. - * @return The index path, or nil if the node is not part of this container. - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)node; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASRunLoopQueue.h b/Example/Pods/Texture/Source/ASRunLoopQueue.h deleted file mode 100644 index c66a5dbf..00000000 --- a/Example/Pods/Texture/Source/ASRunLoopQueue.h +++ /dev/null @@ -1,80 +0,0 @@ -// -// ASRunLoopQueue.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASCATransactionQueueObserving -- (void)prepareForCATransactionCommit; -@end - -@interface ASAbstractRunLoopQueue : NSObject -@end - -AS_SUBCLASSING_RESTRICTED -@interface ASRunLoopQueue : ASAbstractRunLoopQueue - -/** - * Create a new queue with the given run loop and handler. - * - * @param runloop The run loop that will drive this queue. - * @param retainsObjects Whether the queue should retain its objects. - * @param handlerBlock An optional block to be run for each enqueued object. - * - * @discussion You may pass @c nil for the handler if you simply want the objects to - * be retained at enqueue time, and released during the run loop step. This is useful - * for creating a "main deallocation queue". - */ -- (instancetype)initWithRunLoop:(CFRunLoopRef)runloop - retainObjects:(BOOL)retainsObjects - handler:(nullable void(^)(ObjectType dequeuedItem, BOOL isQueueDrained))handlerBlock; - -- (void)enqueue:(ObjectType)object; - -@property (readonly) BOOL isEmpty; - -@property (nonatomic) NSUInteger batchSize; // Default == 1. -@property (nonatomic) BOOL ensureExclusiveMembership; // Default == YES. Set-like behavior. - -@end - - - -/** - * The queue to run on main run loop before CATransaction commit. - * - * @discussion this queue will run after ASRunLoopQueue and before CATransaction commit - * to get last chance of updating/coalesce info like interface state. - * Each node will only be called once per transaction commit to reflect interface change. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASCATransactionQueue : ASAbstractRunLoopQueue - -@property (readonly) BOOL isEmpty; - -@property (readonly, getter=isEnabled) BOOL enabled; - -- (void)enqueue:(id)object; - -@end - -extern ASCATransactionQueue *_ASSharedCATransactionQueue; -extern dispatch_once_t _ASSharedCATransactionQueueOnceToken; - -NS_INLINE ASCATransactionQueue *ASCATransactionQueueGet(void) { - dispatch_once(&_ASSharedCATransactionQueueOnceToken, ^{ - _ASSharedCATransactionQueue = [[ASCATransactionQueue alloc] init]; - }); - return _ASSharedCATransactionQueue; -} - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASRunLoopQueue.mm b/Example/Pods/Texture/Source/ASRunLoopQueue.mm deleted file mode 100644 index 8c917b07..00000000 --- a/Example/Pods/Texture/Source/ASRunLoopQueue.mm +++ /dev/null @@ -1,430 +0,0 @@ -// -// ASRunLoopQueue.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -#define ASRunLoopQueueLoggingEnabled 0 -#define ASRunLoopQueueVerboseLoggingEnabled 0 - -using AS::MutexLocker; - -static void runLoopSourceCallback(void *info) { - // No-op -#if ASRunLoopQueueVerboseLoggingEnabled - NSLog(@"<%@> - Called runLoopSourceCallback", info); -#endif -} - -@implementation ASAbstractRunLoopQueue - -- (instancetype)init -{ - self = [super init]; - if (self == nil) { - return nil; - } - ASDisplayNodeAssert(self.class != [ASAbstractRunLoopQueue class], @"Should never create instances of abstract class ASAbstractRunLoopQueue."); - return self; -} - -@end - -#pragma mark - ASRunLoopQueue - -@interface ASRunLoopQueue () { - CFRunLoopRef _runLoop; - CFRunLoopSourceRef _runLoopSource; - CFRunLoopObserverRef _runLoopObserver; - NSPointerArray *_internalQueue; // Use NSPointerArray so we can decide __strong or __weak per-instance. - AS::RecursiveMutex _internalQueueLock; - - // In order to not pollute the top-level activities, each queue has 1 root activity. - os_activity_t _rootActivity; - -#if ASRunLoopQueueLoggingEnabled - NSTimer *_runloopQueueLoggingTimer; -#endif -} - -@property (nonatomic) void (^queueConsumer)(id dequeuedItem, BOOL isQueueDrained); - -@end - -@implementation ASRunLoopQueue - -- (instancetype)initWithRunLoop:(CFRunLoopRef)runloop retainObjects:(BOOL)retainsObjects handler:(void (^)(id _Nullable, BOOL))handlerBlock -{ - if (self = [super init]) { - _runLoop = runloop; - NSPointerFunctionsOptions options = retainsObjects ? NSPointerFunctionsStrongMemory : NSPointerFunctionsWeakMemory; - _internalQueue = [[NSPointerArray alloc] initWithOptions:options]; - _queueConsumer = handlerBlock; - _batchSize = 1; - _ensureExclusiveMembership = YES; - - // We don't want to pollute the top-level app activities with run loop batches, so we create one top-level - // activity per queue, and each batch activity joins that one instead. - _rootActivity = as_activity_create("Process run loop queue items", OS_ACTIVITY_NONE, OS_ACTIVITY_FLAG_DEFAULT); - { - // Log a message identifying this queue into the queue's root activity. - as_activity_scope_verbose(_rootActivity); - as_log_verbose(ASDisplayLog(), "Created run loop queue: %@", self); - } - - // Self is guaranteed to outlive the observer. Without the high cost of a weak pointer, - // unowned(__unsafe_unretained) allows us to avoid flagging the memory cycle detector. - unowned __typeof__(self) weakSelf = self; - void (^handlerBlock) (CFRunLoopObserverRef observer, CFRunLoopActivity activity) = ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - [weakSelf processQueue]; - }; - _runLoopObserver = CFRunLoopObserverCreateWithHandler(NULL, kCFRunLoopBeforeWaiting, true, 0, handlerBlock); - CFRunLoopAddObserver(_runLoop, _runLoopObserver, kCFRunLoopCommonModes); - - // It is not guaranteed that the runloop will turn if it has no scheduled work, and this causes processing of - // the queue to stop. Attaching a custom loop source to the run loop and signal it if new work needs to be done - CFRunLoopSourceContext sourceContext = {}; - sourceContext.perform = runLoopSourceCallback; -#if ASRunLoopQueueLoggingEnabled - sourceContext.info = (__bridge void *)self; -#endif - _runLoopSource = CFRunLoopSourceCreate(NULL, 0, &sourceContext); - CFRunLoopAddSource(runloop, _runLoopSource, kCFRunLoopCommonModes); - -#if ASRunLoopQueueLoggingEnabled - _runloopQueueLoggingTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(checkRunLoop) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:_runloopQueueLoggingTimer forMode:NSRunLoopCommonModes]; -#endif - } - return self; -} - -- (void)dealloc -{ - if (CFRunLoopContainsSource(_runLoop, _runLoopSource, kCFRunLoopCommonModes)) { - CFRunLoopRemoveSource(_runLoop, _runLoopSource, kCFRunLoopCommonModes); - } - CFRelease(_runLoopSource); - _runLoopSource = nil; - - if (CFRunLoopObserverIsValid(_runLoopObserver)) { - CFRunLoopObserverInvalidate(_runLoopObserver); - } - CFRelease(_runLoopObserver); - _runLoopObserver = nil; -} - -#if ASRunLoopQueueLoggingEnabled -- (void)checkRunLoop -{ - NSLog(@"<%@> - Jobs: %ld", self, _internalQueue.count); -} -#endif - -- (void)processQueue -{ - BOOL hasExecutionBlock = (_queueConsumer != nil); - - // If we have an execution block, this vector will be populated, otherwise remains empty. - // This is to avoid needlessly retaining/releasing the objects if we don't have a block. - std::vector itemsToProcess; - - BOOL isQueueDrained = NO; - { - MutexLocker l(_internalQueueLock); - - NSInteger internalQueueCount = _internalQueue.count; - // Early-exit if the queue is empty. - if (internalQueueCount == 0) { - return; - } - - ASSignpostStart(RunLoopQueueBatch, self, "%s", object_getClassName(self)); - - // Snatch the next batch of items. - NSInteger maxCountToProcess = MIN(internalQueueCount, self.batchSize); - - /** - * For each item in the next batch, if it's non-nil then NULL it out - * and if we have an execution block then add it in. - * This could be written a bunch of different ways but - * this particular one nicely balances readability, safety, and efficiency. - */ - NSInteger foundItemCount = 0; - for (NSInteger i = 0; i < internalQueueCount && foundItemCount < maxCountToProcess; i++) { - /** - * It is safe to use unsafe_unretained here. If the queue is weak, the - * object will be added to the autorelease pool. If the queue is strong, - * it will retain the object until we transfer it (retain it) in itemsToProcess. - */ - unowned id ptr = (__bridge id)[_internalQueue pointerAtIndex:i]; - if (ptr != nil) { - foundItemCount++; - if (hasExecutionBlock) { - itemsToProcess.push_back(ptr); - } - [_internalQueue replacePointerAtIndex:i withPointer:NULL]; - } - } - - if (foundItemCount == 0) { - // If _internalQueue holds weak references, and all of them just become NULL, then the array - // is never marked as needsCompletion, and compact will return early, not removing the NULL's. - // Inserting a NULL here ensures the compaction will take place. - // See http://www.openradar.me/15396578 and https://stackoverflow.com/a/40274426/1136669 - [_internalQueue addPointer:NULL]; - } - - [_internalQueue compact]; - if (_internalQueue.count == 0) { - isQueueDrained = YES; - } - } - - // itemsToProcess will be empty if _queueConsumer == nil so no need to check again. - const auto count = itemsToProcess.size(); - if (count > 0) { - as_activity_scope_verbose(as_activity_create("Process run loop queue batch", _rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - const auto itemsEnd = itemsToProcess.cend(); - for (auto iterator = itemsToProcess.begin(); iterator < itemsEnd; iterator++) { - unowned id value = *iterator; - _queueConsumer(value, isQueueDrained && iterator == itemsEnd - 1); - as_log_verbose(ASDisplayLog(), "processed %@", value); - } - if (count > 1) { - as_log_verbose(ASDisplayLog(), "processed %lu items", (unsigned long)count); - } - } - - // If the queue is not fully drained yet force another run loop to process next batch of items - if (!isQueueDrained) { - CFRunLoopSourceSignal(_runLoopSource); - CFRunLoopWakeUp(_runLoop); - } - - ASSignpostEnd(RunLoopQueueBatch, self, "count: %d", (int)count); -} - -- (void)enqueue:(id)object -{ - if (!object) { - return; - } - - MutexLocker l(_internalQueueLock); - - // Check if the object exists. - BOOL foundObject = NO; - - if (_ensureExclusiveMembership) { - for (id currentObject in _internalQueue) { - if (currentObject == object) { - foundObject = YES; - break; - } - } - } - - if (!foundObject) { - [_internalQueue addPointer:(__bridge void *)object]; - if (_internalQueue.count == 1) { - CFRunLoopSourceSignal(_runLoopSource); - CFRunLoopWakeUp(_runLoop); - } - } -} - -- (BOOL)isEmpty -{ - MutexLocker l(_internalQueueLock); - return _internalQueue.count == 0; -} - -ASSynthesizeLockingMethodsWithMutex(_internalQueueLock) - -@end - -#pragma mark - ASCATransactionQueue - -@interface ASCATransactionQueue () { - CFRunLoopSourceRef _runLoopSource; - CFRunLoopObserverRef _preTransactionObserver; - - // Current buffer for new entries, only accessed from within its mutex. - std::vector> _internalQueue; - - // No retain, no release, pointer hash, pointer equality. - // Enforce uniqueness in our queue. std::unordered_set does a heap allocation for each entry – not good. - CFMutableSetRef _internalQueueHashSet; - - // Temporary buffer, only accessed from the main thread in -process. - std::vector> _batchBuffer; - - AS::Mutex _internalQueueLock; - - // In order to not pollute the top-level activities, each queue has 1 root activity. - os_activity_t _rootActivity; - -#if ASRunLoopQueueLoggingEnabled - NSTimer *_runloopQueueLoggingTimer; -#endif -} - -@end - -@implementation ASCATransactionQueue - -// CoreAnimation commit order is 2000000, the goal of this is to process shortly beforehand -// but after most other scheduled work on the runloop has processed. -static int const kASASCATransactionQueueOrder = 1000000; - -ASCATransactionQueue *_ASSharedCATransactionQueue; -dispatch_once_t _ASSharedCATransactionQueueOnceToken; - -- (instancetype)init -{ - if (self = [super init]) { - _internalQueueHashSet = CFSetCreateMutable(NULL, 0, NULL); - - // This is going to be a very busy queue – every node in the preload range will enter this queue. - // Save some time on first render by reserving space up front. - static constexpr int kInternalQueueInitialCapacity = 64; - _internalQueue.reserve(kInternalQueueInitialCapacity); - _batchBuffer.reserve(kInternalQueueInitialCapacity); - - // We don't want to pollute the top-level app activities with run loop batches, so we create one top-level - // activity per queue, and each batch activity joins that one instead. - _rootActivity = as_activity_create("Process run loop queue items", OS_ACTIVITY_NONE, OS_ACTIVITY_FLAG_DEFAULT); - { - // Log a message identifying this queue into the queue's root activity. - as_activity_scope_verbose(_rootActivity); - as_log_verbose(ASDisplayLog(), "Created run loop queue: %@", self); - } - - // Self is guaranteed to outlive the observer. Without the high cost of a weak pointer, - // unowned(__unsafe_unretained) allows us to avoid flagging the memory cycle detector. - unowned __typeof__(self) weakSelf = self; - _preTransactionObserver = CFRunLoopObserverCreateWithHandler(NULL, kCFRunLoopBeforeWaiting, true, kASASCATransactionQueueOrder, ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - while (!weakSelf->_internalQueue.empty()) { - [weakSelf processQueue]; - } - }); - - CFRunLoopAddObserver(CFRunLoopGetMain(), _preTransactionObserver, kCFRunLoopCommonModes); - - // It is not guaranteed that the runloop will turn if it has no scheduled work, and this causes processing of - // the queue to stop. Attaching a custom loop source to the run loop and signal it if new work needs to be done - CFRunLoopSourceContext sourceContext = {}; - sourceContext.perform = runLoopSourceCallback; -#if ASRunLoopQueueLoggingEnabled - sourceContext.info = (__bridge void *)self; -#endif - _runLoopSource = CFRunLoopSourceCreate(NULL, 0, &sourceContext); - CFRunLoopAddSource(CFRunLoopGetMain(), _runLoopSource, kCFRunLoopCommonModes); - -#if ASRunLoopQueueLoggingEnabled - _runloopQueueLoggingTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(checkRunLoop) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:_runloopQueueLoggingTimer forMode:NSRunLoopCommonModes]; -#endif - } - return self; -} - -- (void)dealloc -{ - ASDisplayNodeAssertMainThread(); - - CFRelease(_internalQueueHashSet); - CFRunLoopRemoveSource(CFRunLoopGetMain(), _runLoopSource, kCFRunLoopCommonModes); - CFRelease(_runLoopSource); - _runLoopSource = nil; - - if (CFRunLoopObserverIsValid(_preTransactionObserver)) { - CFRunLoopObserverInvalidate(_preTransactionObserver); - } - CFRelease(_preTransactionObserver); - _preTransactionObserver = nil; -} - -#if ASRunLoopQueueLoggingEnabled -- (void)checkRunLoop -{ - NSLog(@"<%@> - Jobs: %ld", self, _internalQueue.count); -} -#endif - -- (void)processQueue -{ - ASDisplayNodeAssertMainThread(); - - AS::UniqueLock l(_internalQueueLock); - NSInteger count = _internalQueue.size(); - // Early-exit if the queue is empty. - if (count == 0) { - return; - } - as_activity_scope_verbose(as_activity_create("Process run loop queue batch", _rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - ASSignpostStart(RunLoopQueueBatch, self, "CATransactionQueue"); - - // Swap buffers, clear our hash table. - _internalQueue.swap(_batchBuffer); - CFSetRemoveAllValues(_internalQueueHashSet); - - // Unlock early. We are done with internal queue, and batch buffer is main-thread-only so no lock. - l.unlock(); - - for (const id &value : _batchBuffer) { - [value prepareForCATransactionCommit]; - as_log_verbose(ASDisplayLog(), "processed %@", value); - } - _batchBuffer.clear(); - as_log_verbose(ASDisplayLog(), "processed %lu items", (unsigned long)count); - ASSignpostEnd(RunLoopQueueBatch, self, "count: %d", (int)count); -} - -- (void)enqueue:(id)object -{ - if (!object) { - return; - } - - if (!self.enabled) { - [object prepareForCATransactionCommit]; - return; - } - - MutexLocker l(_internalQueueLock); - if (CFSetContainsValue(_internalQueueHashSet, (__bridge void *)object)) { - return; - } - CFSetAddValue(_internalQueueHashSet, (__bridge void *)object); - _internalQueue.emplace_back(object); - if (_internalQueue.size() == 1) { - CFRunLoopSourceSignal(_runLoopSource); - CFRunLoopWakeUp(CFRunLoopGetMain()); - } -} - -- (BOOL)isEmpty -{ - MutexLocker l(_internalQueueLock); - return _internalQueue.empty(); -} - -- (BOOL)isEnabled -{ - return ASActivateExperimentalFeature(ASExperimentalInterfaceStateCoalescing); -} - -@end diff --git a/Example/Pods/Texture/Source/ASScrollNode.h b/Example/Pods/Texture/Source/ASScrollNode.h deleted file mode 100644 index 1137e89e..00000000 --- a/Example/Pods/Texture/Source/ASScrollNode.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASScrollNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class UIScrollView; - -/** - * Simple node that wraps UIScrollView. - */ -@interface ASScrollNode : ASDisplayNode - -/** - * @abstract The node's UIScrollView. - */ -@property (readonly) UIScrollView *view; - -/** - * @abstract When enabled, the size calculated by the node's layout spec is used as - * the .contentSize of the scroll view, instead of the bounds size. The bounds is instead - * allowed to match the parent's size (whenever it is finite - otherwise, the bounds size - * also grows to the full contentSize). It also works with .layoutSpecBlock(). - * NOTE: Most users of ASScrollNode will want to use this, and may be enabled by default later. - */ -@property BOOL automaticallyManagesContentSize; - -/** - * @abstract This property controls how the constrainedSize is interpreted when sizing the content. - * if you are using automaticallyManagesContentSize, it can be crucial to ensure that the sizing is - * done how you expect. - * Vertical: The constrainedSize is interpreted as having unbounded .height (CGFLOAT_MAX), allowing - * stacks and other content in the layout spec to expand and result in scrollable content. - * Horizontal: The constrainedSize is interpreted as having unbounded .width (CGFLOAT_MAX), ... - * Vertical & Horizontal: the constrainedSize is interpreted as unbounded in both directions. - * @default ASScrollDirectionVerticalDirections - */ -@property ASScrollDirection scrollableDirections; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASScrollNode.mm b/Example/Pods/Texture/Source/ASScrollNode.mm deleted file mode 100644 index bb9c826d..00000000 --- a/Example/Pods/Texture/Source/ASScrollNode.mm +++ /dev/null @@ -1,187 +0,0 @@ -// -// ASScrollNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -@interface ASScrollView : UIScrollView -@end - -@implementation ASScrollView - -// This special +layerClass allows ASScrollNode to get -layout calls from -layoutSublayers. -+ (Class)layerClass -{ - return [_ASDisplayLayer class]; -} - -- (ASScrollNode *)scrollNode -{ - return (ASScrollNode *)ASViewToDisplayNode(self); -} - -#pragma mark - _ASDisplayView behavior substitutions -// Need these to drive interfaceState so we know when we are visible, if not nested in another range-managing element. -// Because our superclass is a true UIKit class, we cannot also subclass _ASDisplayView. -- (void)willMoveToWindow:(UIWindow *)newWindow -{ - ASDisplayNode *node = self.scrollNode; // Create strong reference to weak ivar. - BOOL visible = (newWindow != nil); - if (visible && !node.inHierarchy) { - [node __enterHierarchy]; - } -} - -- (void)didMoveToWindow -{ - ASDisplayNode *node = self.scrollNode; // Create strong reference to weak ivar. - BOOL visible = (self.window != nil); - if (!visible && node.inHierarchy) { - [node __exitHierarchy]; - } -} - -- (NSArray *)accessibilityElements -{ - return [self.asyncdisplaykit_node accessibilityElements]; -} - -@end - -@implementation ASScrollNode -{ - ASScrollDirection _scrollableDirections; - BOOL _automaticallyManagesContentSize; - CGSize _contentCalculatedSizeFromLayout; -} -@dynamic view; - -- (instancetype)init -{ - if (self = [super init]) { - [self setViewBlock:^UIView *{ return [[ASScrollView alloc] init]; }]; - } - return self; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize -{ - ASScopedLockSelfOrToRoot(); - - ASSizeRange contentConstrainedSize = constrainedSize; - if (ASScrollDirectionContainsVerticalDirection(_scrollableDirections)) { - contentConstrainedSize.max.height = CGFLOAT_MAX; - } - if (ASScrollDirectionContainsHorizontalDirection(_scrollableDirections)) { - contentConstrainedSize.max.width = CGFLOAT_MAX; - } - - ASLayout *layout = [super calculateLayoutThatFits:contentConstrainedSize - restrictedToSize:size - relativeToParentSize:parentSize]; - - if (_automaticallyManagesContentSize) { - // To understand this code, imagine we're containing a horizontal stack set within a vertical table node. - // Our parentSize is fixed ~375pt width, but 0 - INF height. Our stack measures 1000pt width, 50pt height. - // In this case, we want our scrollNode.bounds to be 375pt wide, and 50pt high. ContentSize 1000pt, 50pt. - // We can achieve this behavior by: - // 1. Always set contentSize to layout.size. - // 2. Set bounds to a size that is calculated by clamping parentSize against constrained size, - // unless one dimension is not defined, in which case adopt the contentSize for that dimension. - _contentCalculatedSizeFromLayout = layout.size; - CGSize selfSize = ASSizeRangeClamp(constrainedSize, parentSize); - if (ASPointsValidForLayout(selfSize.width) == NO) { - selfSize.width = _contentCalculatedSizeFromLayout.width; - } - if (ASPointsValidForLayout(selfSize.height) == NO) { - selfSize.height = _contentCalculatedSizeFromLayout.height; - } - - // The side effect for layout with CGFLOAT_MAX is that the min-height/width on the child of - // ScrollNode may not be applied correctly. Resulting in the contentSize less than the - // scrollNode's bounds which may not be what the child want (e.g. The child want to fill - // ScrollNode's bounds). In that case we need to give it a chance to layout with ScrollNode's - // bound in case children want to fill the ScrollNode's bound. - if ((ASScrollDirectionContainsVerticalDirection(_scrollableDirections) && - layout.size.height < selfSize.height) || - (ASScrollDirectionContainsHorizontalDirection(_scrollableDirections) && - layout.size.width < selfSize.width)) { - layout = [super calculateLayoutThatFits:constrainedSize - restrictedToSize:size - relativeToParentSize:parentSize]; - } - - // Don't provide a position, as that should be set by the parent. - layout = [ASLayout layoutWithLayoutElement:self - size:selfSize - sublayouts:layout.sublayouts]; - } - return layout; -} - -- (void)layout -{ - [super layout]; - - ASLockScopeSelf(); // Lock for using our two instance variables. - - if (_automaticallyManagesContentSize) { - CGSize contentSize = _contentCalculatedSizeFromLayout; - if (ASIsCGSizeValidForLayout(contentSize) == NO) { - NSLog(@"%@ calculated a size in its layout spec that can't be applied to .contentSize: %@. Applying parentSize (scrollNode's bounds) instead: %@.", self, NSStringFromCGSize(contentSize), NSStringFromCGSize(self.calculatedSize)); - contentSize = self.calculatedSize; - } - self.view.contentSize = contentSize; - } -} - -- (BOOL)automaticallyManagesContentSize -{ - ASLockScopeSelf(); - return _automaticallyManagesContentSize; -} - -- (void)setAutomaticallyManagesContentSize:(BOOL)automaticallyManagesContentSize -{ - ASLockScopeSelf(); - _automaticallyManagesContentSize = automaticallyManagesContentSize; - if (_automaticallyManagesContentSize == YES - && ASScrollDirectionContainsVerticalDirection(_scrollableDirections) == NO - && ASScrollDirectionContainsHorizontalDirection(_scrollableDirections) == NO) { - // Set the @default value, for more user-friendly behavior of the most - // common use cases of .automaticallyManagesContentSize. - _scrollableDirections = ASScrollDirectionVerticalDirections; - } -} - -- (ASScrollDirection)scrollableDirections -{ - ASLockScopeSelf(); - return _scrollableDirections; -} - -- (void)setScrollableDirections:(ASScrollDirection)scrollableDirections -{ - ASLockScopeSelf(); - if (_scrollableDirections != scrollableDirections) { - _scrollableDirections = scrollableDirections; - [self setNeedsLayout]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/ASSectionController.h b/Example/Pods/Texture/Source/ASSectionController.h deleted file mode 100644 index 68075961..00000000 --- a/Example/Pods/Texture/Source/ASSectionController.h +++ /dev/null @@ -1,86 +0,0 @@ -// -// ASSectionController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASBatchContext; - -/** - * A protocol that your section controllers should conform to, in order to be used with Texture. - * - * @note Your supplementary view source should conform to @c ASSupplementaryNodeSource. - */ -@protocol ASSectionController - -@optional - -/** - * A method to provide the node block for the item at the given index. - * The node block you return will be run asynchronously off the main thread, - * so it's important to retrieve any objects from your section _outside_ the block - * because by the time the block is run, the array may have changed. - * - * @param index The index of the item. - * @return A block to be run concurrently to build the node for this item. - * @see collectionNode:nodeBlockForItemAtIndexPath: - */ -- (ASCellNodeBlock)nodeBlockForItemAtIndex:(NSInteger)index; - -/** - * Similar to -collectionView:cellForItemAtIndexPath:. - * - * Note: only called if nodeBlockForItemAtIndex: returns nil. - * - * @param index The index of the item. - * - * @return A node to display for the given item. This will be called on the main thread and should - * not implement reuse (it will be called once per item). Unlike UICollectionView's version, - * this method is not called when the item is about to display. - */ -- (ASCellNode *)nodeForItemAtIndex:(NSInteger)index; - -/** - * Asks the section controller whether it should batch fetch because the user is - * near the end of the current data set. - * - * @discussion Use this method to conditionally fetch batches. Example use cases are: limiting the total number of - * objects that can be fetched or no network connection. - * - * If not implemented, the assumed return value is @c YES. - */ -- (BOOL)shouldBatchFetch; - -/** - * Asks the section controller to begin fetching more content (tail loading) because - * the user is near the end of the current data set. - * - * @param context A context object that must be notified when the batch fetch is completed. - * - * @discussion You must eventually call -completeBatchFetching: with an argument of YES in order to receive future - * notifications to do batch fetches. This method is called on a background queue. - */ -- (void)beginBatchFetchWithContext:(ASBatchContext *)context; - -/** - * A method to provide the size range used for measuring the item - * at the given index. - * - * @param index The index of the item. - * @return A size range used for asynchronously measuring the node at this index. - * @see collectionNode:constrainedSizeForItemAtIndexPath: - */ -- (ASSizeRange)sizeRangeForItemAtIndex:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASSupplementaryNodeSource.h b/Example/Pods/Texture/Source/ASSupplementaryNodeSource.h deleted file mode 100644 index 20beddde..00000000 --- a/Example/Pods/Texture/Source/ASSupplementaryNodeSource.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// ASSupplementaryNodeSource.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASSupplementaryNodeSource - -@optional - -/** - * A method to provide the node-block for the supplementary element. - * - * @param elementKind The kind of supplementary element. - * @param index The index of the item. - * @return A node block for the supplementary element. - * @see collectionNode:nodeForSupplementaryElementOfKind:atIndexPath: - */ -- (ASCellNodeBlock)nodeBlockForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index; - -/** - * Asks the controller to provide a node to display for the given supplementary element. - * - * @param kind The kind of supplementary element. - * @param index The index of the item. - */ -- (ASCellNode *)nodeForSupplementaryElementOfKind:(NSString *)kind atIndex:(NSInteger)index; - -/** - * A method to provide the size range used for measuring the supplementary - * element of the given kind at the given index. - * - * @param elementKind The kind of supplementary element. - * @param index The index of the item. - * @return A size range used for asynchronously measuring the node. - * @see collectionNode:constrainedSizeForSupplementaryElementOfKind:atIndexPath: - */ -- (ASSizeRange)sizeRangeForSupplementaryElementOfKind:(NSString *)elementKind atIndex:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTabBarController.h b/Example/Pods/Texture/Source/ASTabBarController.h deleted file mode 100644 index faa67a04..00000000 --- a/Example/Pods/Texture/Source/ASTabBarController.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ASTabBarController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * ASTabBarController - * - * @discussion ASTabBarController is a drop in replacement for UITabBarController - * which implements the memory efficiency improving @c ASManagesChildVisibilityDepth protocol. - * - * @see ASManagesChildVisibilityDepth - */ -@interface ASTabBarController : UITabBarController - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTabBarController.mm b/Example/Pods/Texture/Source/ASTabBarController.mm deleted file mode 100644 index 63867f1a..00000000 --- a/Example/Pods/Texture/Source/ASTabBarController.mm +++ /dev/null @@ -1,84 +0,0 @@ -// -// ASTabBarController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASTabBarController -{ - BOOL _parentManagesVisibilityDepth; - NSInteger _visibilityDepth; -} - -ASVisibilityDidMoveToParentViewController; - -ASVisibilityViewWillAppear; - -ASVisibilityViewDidDisappearImplementation; - -ASVisibilitySetVisibilityDepth; - -ASVisibilityDepthImplementation; - -- (void)visibilityDepthDidChange -{ - for (UIViewController *viewController in self.viewControllers) { - if ([viewController conformsToProtocol:@protocol(ASVisibilityDepth)]) { - [(id )viewController visibilityDepthDidChange]; - } - } -} - -- (NSInteger)visibilityDepthOfChildViewController:(UIViewController *)childViewController -{ - NSUInteger viewControllerIndex = [self.viewControllers indexOfObjectIdenticalTo:childViewController]; - if (viewControllerIndex == NSNotFound) { - //If childViewController is not actually a child, return NSNotFound which is also a really large number. - return NSNotFound; - } - - if (self.selectedViewController == childViewController) { - return [self visibilityDepth]; - } - return [self visibilityDepth] + 1; -} - -#pragma mark - UIKit overrides - -- (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers -{ - [super setViewControllers:viewControllers]; - [self visibilityDepthDidChange]; -} - -- (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers animated:(BOOL)animated -{ - [super setViewControllers:viewControllers animated:animated]; - [self visibilityDepthDidChange]; -} - -- (void)setSelectedIndex:(NSUInteger)selectedIndex -{ - as_activity_create_for_scope("Set selected index of ASTabBarController"); - os_log_info(ASNodeLog(), "Selected tab %tu of %@", selectedIndex, self); - - [super setSelectedIndex:selectedIndex]; - [self visibilityDepthDidChange]; -} - -- (void)setSelectedViewController:(__kindof UIViewController *)selectedViewController -{ - as_activity_create_for_scope("Set selected view controller of ASTabBarController"); - os_log_info(ASNodeLog(), "Selected view controller %@ of %@", selectedViewController, self); - - [super setSelectedViewController:selectedViewController]; - [self visibilityDepthDidChange]; -} - -@end diff --git a/Example/Pods/Texture/Source/ASTableNode+Beta.h b/Example/Pods/Texture/Source/ASTableNode+Beta.h deleted file mode 100644 index 6d580bdc..00000000 --- a/Example/Pods/Texture/Source/ASTableNode+Beta.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASTableNode+Beta.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@protocol ASBatchFetchingDelegate; - -NS_ASSUME_NONNULL_BEGIN - -@interface ASTableNode (Beta) - -@property (nonatomic, weak) id batchFetchingDelegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTableNode.h b/Example/Pods/Texture/Source/ASTableNode.h deleted file mode 100644 index 772f3a7e..00000000 --- a/Example/Pods/Texture/Source/ASTableNode.h +++ /dev/null @@ -1,763 +0,0 @@ -// -// ASTableNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASTableDataSource; -@protocol ASTableDelegate; -@class ASTableView, ASBatchContext; - -/** - * ASTableNode is a node based class that wraps an ASTableView. It can be used - * as a subnode of another node, and provide room for many (great) features and improvements later on. - */ -@interface ASTableNode : ASDisplayNode - -- (instancetype)init; // UITableViewStylePlain -- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER; - -@property (readonly) ASTableView *view; - -// These properties can be set without triggering the view to be created, so it's fine to set them in -init. -@property (nonatomic, weak) id delegate; -@property (nonatomic, weak) id dataSource; - -/** - * The number of screens left to scroll before the delegate -tableNode:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic) CGFloat leadingScreensForBatching; - -/* - * A Boolean value that determines whether the table will be flipped. - * If the value of this property is YES, the first cell node will be at the bottom of the table (as opposed to the top by default). This is useful for chat/messaging apps. The default value is NO. - */ -@property (nonatomic) BOOL inverted; - -/** - * The distance that the content view is inset from the table node edges. Defaults to UIEdgeInsetsZero. - */ -@property (nonatomic) UIEdgeInsets contentInset; - -/** - * The offset of the content view's origin from the table node's origin. Defaults to CGPointZero. - */ -@property (nonatomic) CGPoint contentOffset; - -/** - * Sets the offset from the content node’s origin to the table node’s origin. - * - * @param contentOffset The offset - * - * @param animated YES to animate to this new offset at a constant velocity, NO to not aniamte and immediately make the transition. - */ -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; - -/** - * YES to automatically adjust the contentOffset when cells are inserted or deleted above - * visible cells, maintaining the users' visible scroll position. - * - * @note This is only applied to non-animated updates. For animated updates, there is no way to - * synchronize or "cancel out" the appearance of a scroll due to UITableView API limitations. - * - * default is NO. - */ -@property (nonatomic) BOOL automaticallyAdjustsContentOffset; - -/** - * A Boolean value that determines whether paging is enabled for the scroll view. - * The default value of this property is NO. - */ -@property (nonatomic, getter=isPagingEnabled) BOOL pagingEnabled __TVOS_PROHIBITED; - -/* - * A Boolean value that determines whether users can select a row. - * If the value of this property is YES (the default), users can select rows. If you set it to NO, they cannot select rows. Setting this property affects cell selection only when the table view is not in editing mode. If you want to restrict selection of cells in editing mode, use `allowsSelectionDuringEditing`. - */ -@property (nonatomic) BOOL allowsSelection; -/* - * A Boolean value that determines whether users can select cells while the table view is in editing mode. - * If the value of this property is YES, users can select rows during editing. The default value is NO. If you want to restrict selection of cells regardless of mode, use allowsSelection. - */ -@property (nonatomic) BOOL allowsSelectionDuringEditing; -/* - * A Boolean value that determines whether users can select more than one row outside of editing mode. - * This property controls whether multiple rows can be selected simultaneously outside of editing mode. When the value of this property is YES, each row that is tapped acquires a selected appearance. Tapping the row again removes the selected appearance. If you access indexPathsForSelectedRows, you can get the index paths that identify the selected rows. - */ -@property (nonatomic) BOOL allowsMultipleSelection; -/* - * A Boolean value that controls whether users can select more than one cell simultaneously in editing mode. - * The default value of this property is NO. If you set it to YES, check marks appear next to selected rows in editing mode. In addition, UITableView does not query for editing styles when it goes into editing mode. If you access indexPathsForSelectedRows, you can get the index paths that identify the selected rows. - */ -@property (nonatomic) BOOL allowsMultipleSelectionDuringEditing; - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType; - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -/** - * Scrolls the table to the given row. - * - * @param indexPath The index path of the row. - * @param scrollPosition Where the row should end up after the scroll. - * @param animated Whether the scroll should be animated or not. - * - * This method must be called on the main thread. - */ -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on - * the main thread. - * @warning This method is substantially more expensive than UITableView's version. - */ -- (void)reloadDataWithCompletion:(nullable void (^)(void))completion; - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @warning This method is substantially more expensive than UITableView's version. - */ -- (void)reloadData; - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the table view. - */ -- (void)relayoutItems; - -/** - * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. - * The data source must be updated to reflect the changes before the update block completes. - * - * @param animated NO to disable animations for this batch - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Perform a batch of updates asynchronously with animations in the batch. This method must be called from the main thread. - * The data source must be updated to reflect the changes before the update block completes. - * - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Returns YES if the ASCollectionNode is still processing changes from performBatchUpdates:. - * This is typically the concurrent allocation (calling nodeBlocks) and layout of newly inserted - * ASCellNodes. If YES is returned, then calling -waitUntilAllUpdatesAreProcessed may take tens of - * milliseconds to return as it blocks on these concurrent operations. - * - * Returns NO if ASCollectionNode is fully synchronized with the underlying UICollectionView. This - * means that until the next performBatchUpdates: is called, it is safe to compare UIKit values - * (such as from UICollectionViewLayout) with your app's data source. - * - * This method will always return NO if called immediately after -waitUntilAllUpdatesAreProcessed. - */ -@property (nonatomic, readonly) BOOL isProcessingUpdates; - -/** - * Schedules a block to be performed (on the main thread) after processing of performBatchUpdates: - * is finished (completely synchronized to UIKit). The blocks will be run at the moment that - * -isProcessingUpdates changes from YES to NO; - * - * When isProcessingUpdates == NO, the block is run block immediately (before the method returns). - * - * Blocks scheduled by this mechanism are NOT guaranteed to run in the order they are scheduled. - * They may also be delayed if performBatchUpdates continues to be called; the blocks will wait until - * all running updates are finished. - * - * Calling -waitUntilAllUpdatesAreProcessed is one way to flush any pending update completion blocks. - */ -- (void)onDidFinishProcessingUpdates:(void (^)(void))didFinishProcessingUpdates; - -/** - * Blocks execution of the main thread until all section and item updates are committed to the view. This method must be called from the main thread. - */ -- (void)waitUntilAllUpdatesAreProcessed; - -/** - * Inserts one or more sections, with an option to animate the insertion. - * - * @param sections An index set that specifies the sections to insert. - * - * @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Deletes one or more sections, with an option to animate the deletion. - * - * @param sections An index set that specifies the sections to delete. - * - * @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Reloads the specified sections using a given animation effect. - * - * @param sections An index set that specifies the sections to reload. - * - * @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Moves a section to a new location. - * - * @param section The index of the section to move. - * - * @param newSection The index that is the destination of the move for the section. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; - -/** - * Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion. - * - * @param indexPaths An array of NSIndexPath objects, each representing a row index and section index that together identify a row. - * - * @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Deletes the rows specified by an array of index paths, with an option to animate the deletion. - * - * @param indexPaths An array of NSIndexPath objects identifying the rows to delete. - * - * @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Reloads the specified rows using a given animation effect. - * - * @param indexPaths An array of NSIndexPath objects identifying the rows to reload. - * - * @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Moves the row at a specified location to a destination location. - * - * @param indexPath The index path identifying the row to move. - * - * @param newIndexPath The index path that is the destination of the move for the row. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - -#pragma mark - Selection - -/** - * Selects a row in the table view identified by index path, optionally scrolling the row to a location in the table view. - * This method does not cause any selection-related delegate methods to be called. - * - * @param indexPath An index path identifying a row in the table view. - * - * @param animated Specify YES to animate the change in the selection or NO to make the change without animating it. - * - * @param scrollPosition A constant that identifies a relative position in the table view (top, middle, bottom) for the row when scrolling concludes. See `UITableViewScrollPosition` for descriptions of valid constants. - * - * @discussion This method must be called from the main thread. - */ -- (void)selectRowAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; - -/* - * Deselects a given row identified by index path, with an option to animate the deselection. - * This method does not cause any selection-related delegate methods to be called. - * Calling this method does not cause any scrolling to the deselected row. - * - * @param indexPath An index path identifying a row in the table view. - * - * @param animated Specify YES to animate the change in the selection or NO to make the change without animating it. - * - * @discussion This method must be called from the main thread. - */ -- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; - -#pragma mark - Querying Data - -/** - * Retrieves the number of rows in the given section. - * - * @param section The section. - * - * @return The number of rows. - */ -- (NSInteger)numberOfRowsInSection:(NSInteger)section AS_WARN_UNUSED_RESULT; - -/** - * The number of sections in the table node. - */ -@property (nonatomic, readonly) NSInteger numberOfSections; - -/** - * Similar to -visibleCells. - * - * @return an array containing the nodes being displayed on screen. This must be called on the main thread. - */ -@property (nonatomic, readonly) NSArray<__kindof ASCellNode *> *visibleNodes; - -/** - * Retrieves the node for the row at the given index path. - */ -- (nullable __kindof ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Similar to -indexPathForCell:. - * - * @param cellNode a node for a row. - * - * @return The index path to this row, if it exists. - * - * @discussion This method will return @c nil for a node that is still being - * displayed in the table view, if the data source has deleted the row. - * That is, the node is visible but it no longer corresponds - * to any item in the data source and will be removed soon. - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; - -/** - * Similar to -[UITableView rectForRowAtIndexPath:] - * - * @param indexPath An index path identifying a row in the table view. - * - * @return A rectangle defining the area in which the table view draws the row or CGRectZero if indexPath is invalid. - * - * @discussion This method must be called from the main thread. - */ -- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Similar to -[UITableView cellForRowAtIndexPath:] - * - * @param indexPath An index path identifying a row in the table view. - * - * @return An object representing a cell of the table, or nil if the cell is not visible or indexPath is out of range. - * - * @discussion This method must be called from the main thread. - */ -- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -/** - * Similar to UITableView.indexPathForSelectedRow - * - * @return The value of this property is an index path identifying the row and section - * indexes of the selected row, or nil if the index path is invalid. If there are multiple selections, - * this property contains the first index-path object in the array of row selections; - * this object has the lowest index values for section and row. - * - * @discussion This method must be called from the main thread. - */ -@property (nullable, nonatomic, copy, readonly) NSIndexPath *indexPathForSelectedRow; - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows; - -/** - * Similar to -[UITableView indexPathForRowAtPoint:] - * - * @param point A point in the local coordinate system of the table view (the table view’€™s bounds). - * - * @return An index path representing the row and section associated with point, - * or nil if the point is out of the bounds of any row. - * - * @discussion This method must be called from the main thread. - */ -- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point AS_WARN_UNUSED_RESULT; - -/** - * Similar to -[UITableView indexPathsForRowsInRect:] - * - * @param rect A rectangle defining an area of the table view in local coordinates. - * - * @return An array of NSIndexPath objects each representing a row and section index identifying a row within rect. - * Returns an empty array if there aren’t any rows to return. - * - * @discussion This method must be called from the main thread. - */ -- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect AS_WARN_UNUSED_RESULT; - -/** - * Similar to -[UITableView indexPathsForVisibleRows] - * - * @return The value of this property is an array of NSIndexPath objects each representing a row index and section index - * that together identify a visible row in the table view. If no rows are visible, the value is nil. - * - * @discussion This method must be called from the main thread. - */ -- (NSArray *)indexPathsForVisibleRows AS_WARN_UNUSED_RESULT; - -@end - -/** - * This is a node-based UITableViewDataSource. - */ -@protocol ASTableDataSource - -@optional - -/** - * Asks the data source for the number of sections in the table node. - * - * @see @c numberOfSectionsInTableView: - */ -- (NSInteger)numberOfSectionsInTableNode:(ASTableNode *)tableNode; - -/** - * Asks the data source for the number of rows in the given section of the table node. - * - * @see @c numberOfSectionsInTableView: - */ -- (NSInteger)tableNode:(ASTableNode *)tableNode numberOfRowsInSection:(NSInteger)section; - -/** - * Asks the data source for a block to create a node to represent the row at the given index path. - * The block will be run by the table node concurrently in the background before the row is inserted - * into the table view. - * - * @param tableNode The sender. - * @param indexPath The index path of the row. - * - * @return a block that creates the node for display at this indexpath. - * Must be thread-safe (can be called on the main thread or a background - * queue) and should not implement reuse (it will be called once per row). - * - * @note This method takes precedence over tableNode:nodeForRowAtIndexPath: if implemented. - */ -- (ASCellNodeBlock)tableNode:(ASTableNode *)tableNode nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Asks the data source for a node to represent the row at the given index path. - * - * @param tableNode The sender. - * @param indexPath The index path of the row. - * - * @return a node to display for this row. This will be called on the main thread and should not implement reuse (it will be called once per row). Unlike UITableView's version, this method - * is not called when the row is about to display. - */ -- (ASCellNode *)tableNode:(ASTableNode *)tableNode nodeForRowAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Similar to -tableView:cellForRowAtIndexPath:. - * - * @param tableView The sender. - * - * @param indexPath The index path of the requested node. - * - * @return a node for display at this indexpath. This will be called on the main thread and should not implement reuse (it will be called once per row). Unlike UITableView's version, this method - * is not called when the row is about to display. - */ -- (ASCellNode *)tableView:(ASTableView *)tableView nodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Similar to -tableView:nodeForRowAtIndexPath: - * This method takes precedence over tableView:nodeForRowAtIndexPath: if implemented. - * @param tableView The sender. - * - * @param indexPath The index path of the requested node. - * - * @return a block that creates the node for display at this indexpath. - * Must be thread-safe (can be called on the main thread or a background - * queue) and should not implement reuse (it will be called once per row). - */ -- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Indicator to lock the data source for data fetching in async mode. - * We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception - * due to the data access in async mode. - * - * @param tableView The sender. - * @deprecated The data source is always accessed on the main thread, and this method will not be called. - */ -- (void)tableViewLockDataSource:(ASTableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); - -/** - * Indicator to unlock the data source for data fetching in asyn mode. - * We should not update the data source until the data source has been unlocked. Otherwise, it will incur data inconsistency or exception - * due to the data access in async mode. - * - * @param tableView The sender. - * @deprecated The data source is always accessed on the main thread, and this method will not be called. - */ -- (void)tableViewUnlockDataSource:(ASTableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Data source accesses are on the main thread. Method will not be called."); - -/** - * Generate a unique identifier for an element in a table. This helps state restoration persist the scroll position - * of a table view even when the data in that table changes. See the documentation for UIDataSourceModelAssociation for more information. - * - * @param indexPath The index path of the requested node. - * - * @param tableNode The sender. - * - * @return a unique identifier for the element at the given path. Return nil if the index path does not exist in the table. - */ -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inNode:(ASTableNode *)tableNode; - -/** - * Similar to -tableView:cellForRowAtIndexPath:. See the documentation for UIDataSourceModelAssociation for more information. - * - * @param identifier The model identifier of the element, previously generated by a call to modelIdentifierForElementAtIndexPath. - * - * @param tableNode The sender. - * - * @return the index path to the current position of the matching element in the table. Return nil if the element is not found. - */ -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inNode:(ASTableNode *)tableNode; - -@end - -/** - * This is a node-based UITableViewDelegate. - * - * Note that -tableView:heightForRowAtIndexPath: has been removed; instead, your custom ASCellNode subclasses are - * responsible for deciding their preferred onscreen height in -calculateSizeThatFits:. - */ -@protocol ASTableDelegate - -@optional - -- (void)tableNode:(ASTableNode *)tableNode willDisplayRowWithNode:(ASCellNode *)node; - -- (void)tableNode:(ASTableNode *)tableNode didEndDisplayingRowWithNode:(ASCellNode *)node; - -- (nullable NSIndexPath *)tableNode:(ASTableNode *)tableNode willSelectRowAtIndexPath:(NSIndexPath *)indexPath; - -- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - -- (nullable NSIndexPath *)tableNode:(ASTableNode *)tableNode willDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - -- (void)tableNode:(ASTableNode *)tableNode didDeselectRowAtIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)tableNode:(ASTableNode *)tableNode shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath; -- (void)tableNode:(ASTableNode *)tableNode didHighlightRowAtIndexPath:(NSIndexPath *)indexPath; -- (void)tableNode:(ASTableNode *)tableNode didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)tableNode:(ASTableNode *)tableNode shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)tableNode:(ASTableNode *)tableNode canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; -- (void)tableNode:(ASTableNode *)tableNode performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender; - -/** - * Provides the constrained size range for measuring the row at the index path. - * Note: the widths in the returned size range are ignored! - * - * @param tableNode The sender. - * - * @param indexPath The index path of the node. - * - * @return A constrained size range for layout the node at this index path. - */ -- (ASSizeRange)tableNode:(ASTableNode *)tableNode constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary. - * - * @param tableNode The sender. - * @param context A context object that must be notified when the batch fetch is completed. - * - * @discussion You must eventually call -completeBatchFetching: with an argument of YES in order to receive future - * notifications to do batch fetches. This method is called on a background queue. - * - * ASTableView currently only supports batch events for tail loads. If you require a head load, consider implementing a - * UIRefreshControl. - */ -- (void)tableNode:(ASTableNode *)tableNode willBeginBatchFetchWithContext:(ASBatchContext *)context; - -/** - * Tell the tableView if batch fetching should begin. - * - * @param tableNode The sender. - * - * @discussion Use this method to conditionally fetch batches. Example use cases are: limiting the total number of - * objects that can be fetched or no network connection. - * - * If not implemented, the tableView assumes that it should notify its asyncDelegate when batch fetching - * should occur. - */ -- (BOOL)shouldBatchFetchForTableNode:(ASTableNode *)tableNode; - -/** - * Informs the delegate that the table view will add the given node - * at the given index path to the view hierarchy. - * - * @param tableView The sender. - * @param node The node that will be displayed. - * @param indexPath The index path of the row that will be displayed. - * - * @warning AsyncDisplayKit processes table view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - */ -- (void)tableView:(ASTableView *)tableView willDisplayNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Informs the delegate that the table view did remove the provided node from the view hierarchy. - * This may be caused by the node scrolling out of view, or by deleting the row - * or its containing section with @c deleteRowsAtIndexPaths:withRowAnimation: or @c deleteSections:withRowAnimation: . - * - * @param tableView The sender. - * @param node The node which was removed from the view hierarchy. - * @param indexPath The index path at which the node was located before the removal. - * - * @warning AsyncDisplayKit processes table view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - */ -- (void)tableView:(ASTableView *)tableView didEndDisplayingNode:(ASCellNode *)node forRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary. - * - * @param tableView The sender. - * @param context A context object that must be notified when the batch fetch is completed. - * - * @discussion You must eventually call -completeBatchFetching: with an argument of YES in order to receive future - * notifications to do batch fetches. This method is called on a background queue. - * - * ASTableView currently only supports batch events for tail loads. If you require a head load, consider implementing a - * UIRefreshControl. - */ -- (void)tableView:(ASTableView *)tableView willBeginBatchFetchWithContext:(ASBatchContext *)context ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Tell the tableView if batch fetching should begin. - * - * @param tableView The sender. - * - * @discussion Use this method to conditionally fetch batches. Example use cases are: limiting the total number of - * objects that can be fetched or no network connection. - * - * If not implemented, the tableView assumes that it should notify its asyncDelegate when batch fetching - * should occur. - */ -- (BOOL)shouldBatchFetchForTableView:(ASTableView *)tableView AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Provides the constrained size range for measuring the row at the index path. - * Note: the widths in the returned size range are ignored! - * - * @param tableView The sender. - * - * @param indexPath The index path of the node. - * - * @return A constrained size range for layout the node at this index path. - */ -- (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -/** - * Informs the delegate that the table view will add the node - * at the given index path to the view hierarchy. - * - * @param tableView The sender. - * @param indexPath The index path of the row that will be displayed. - * - * @warning AsyncDisplayKit processes table view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - * - * This method is deprecated. Use @c tableView:willDisplayNode:forRowAtIndexPath: instead. - */ -- (void)tableView:(ASTableView *)tableView willDisplayNodeForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's method instead."); - -@end - -@interface ASTableNode (Deprecated) - -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("This method has been renamed to -waitUntilAllUpdatesAreProcessed."); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTableNode.mm b/Example/Pods/Texture/Source/ASTableNode.mm deleted file mode 100644 index d8acc8a3..00000000 --- a/Example/Pods/Texture/Source/ASTableNode.mm +++ /dev/null @@ -1,894 +0,0 @@ -// -// ASTableNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#pragma mark - _ASTablePendingState - -@interface _ASTablePendingState : NSObject { -@public - std::vector> _tuningParameters; -} -@property (nonatomic, weak) id delegate; -@property (nonatomic, weak) id dataSource; -@property (nonatomic) ASLayoutRangeMode rangeMode; -@property (nonatomic) BOOL allowsSelection; -@property (nonatomic) BOOL allowsSelectionDuringEditing; -@property (nonatomic) BOOL allowsMultipleSelection; -@property (nonatomic) BOOL allowsMultipleSelectionDuringEditing; -@property (nonatomic) BOOL inverted; -@property (nonatomic) CGFloat leadingScreensForBatching; -@property (nonatomic) UIEdgeInsets contentInset; -@property (nonatomic) CGPoint contentOffset; -@property (nonatomic) BOOL animatesContentOffset; -@property (nonatomic) BOOL automaticallyAdjustsContentOffset; -@property (nonatomic) BOOL pagingEnabled; -@end - -@implementation _ASTablePendingState - -#pragma mark - Lifecycle - -- (instancetype)init -{ - self = [super init]; - if (self) { - _rangeMode = ASLayoutRangeModeUnspecified; - _tuningParameters = [ASAbstractLayoutController defaultTuningParameters]; - _allowsSelection = YES; - _allowsSelectionDuringEditing = NO; - _allowsMultipleSelection = NO; - _allowsMultipleSelectionDuringEditing = NO; - _inverted = NO; - _leadingScreensForBatching = 2; - _contentInset = UIEdgeInsetsZero; - _contentOffset = CGPointZero; - _animatesContentOffset = NO; - _automaticallyAdjustsContentOffset = NO; - _pagingEnabled = NO; - } - return self; -} - -#pragma mark Tuning Parameters - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - return [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Requesting a range that is OOB for the configured tuning parameters"); - return _tuningParameters[rangeMode][rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Setting a range that is OOB for the configured tuning parameters"); - _tuningParameters[rangeMode][rangeType] = tuningParameters; -} - -@end - -#pragma mark - ASTableView - -@interface ASTableNode () -{ - AS::RecursiveMutex _environmentStateLock; - id _batchFetchingDelegate; -} - -@property (nonatomic) _ASTablePendingState *pendingState; -@property (nonatomic, weak) ASRangeController *rangeController; -@end - -@implementation ASTableNode - -#pragma mark Lifecycle - -- (instancetype)initWithStyle:(UITableViewStyle)style -{ - if (self = [super init]) { - __weak __typeof__(self) weakSelf = self; - [self setViewBlock:^{ - // Variable will be unused if event logging is off. - __unused __typeof__(self) strongSelf = weakSelf; - return [[ASTableView alloc] _initWithFrame:CGRectZero style:style dataControllerClass:nil owningNode:strongSelf]; - }]; - } - return self; -} - -- (instancetype)init -{ - return [self initWithStyle:UITableViewStylePlain]; -} - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED -- (void)dealloc -{ - if (self.nodeLoaded) { - __weak UIView *view = self.view; - ASPerformBlockOnMainThread(^{ - ASDisplayNodeCAssertNil(view.superview, @"Node's view should be removed from hierarchy."); - }); - } -} -#endif - -#pragma mark ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - ASTableView *view = self.view; - view.tableNode = self; - - _rangeController = view.rangeController; - - if (_pendingState) { - _ASTablePendingState *pendingState = _pendingState; - self.pendingState = nil; - view.asyncDelegate = pendingState.delegate; - view.asyncDataSource = pendingState.dataSource; - view.inverted = pendingState.inverted; - view.allowsSelection = pendingState.allowsSelection; - view.allowsSelectionDuringEditing = pendingState.allowsSelectionDuringEditing; - view.allowsMultipleSelection = pendingState.allowsMultipleSelection; - view.allowsMultipleSelectionDuringEditing = pendingState.allowsMultipleSelectionDuringEditing; - view.automaticallyAdjustsContentOffset = pendingState.automaticallyAdjustsContentOffset; -#if !TARGET_OS_TV - view.pagingEnabled = pendingState.pagingEnabled; -#endif - - UIEdgeInsets contentInset = pendingState.contentInset; - if (!UIEdgeInsetsEqualToEdgeInsets(contentInset, UIEdgeInsetsZero)) { - view.contentInset = contentInset; - } - - CGPoint contentOffset = pendingState.contentOffset; - if (!CGPointEqualToPoint(contentOffset, CGPointZero)) { - [view setContentOffset:contentOffset animated:pendingState.animatesContentOffset]; - } - - const auto tuningParametersVector = pendingState->_tuningParameters; - const auto tuningParametersVectorSize = tuningParametersVector.size(); - for (NSInteger rangeMode = 0; rangeMode < tuningParametersVectorSize; rangeMode++) { - const auto tuningparametersRangeModeVector = tuningParametersVector[rangeMode]; - const auto tuningParametersVectorRangeModeSize = tuningparametersRangeModeVector.size(); - for (NSInteger rangeType = 0; rangeType < tuningParametersVectorRangeModeSize; rangeType++) { - ASRangeTuningParameters tuningParameters = tuningparametersRangeModeVector[rangeType]; - [_rangeController setTuningParameters:tuningParameters - forRangeMode:(ASLayoutRangeMode)rangeMode - rangeType:(ASLayoutRangeType)rangeType]; - } - } - - if (pendingState.rangeMode != ASLayoutRangeModeUnspecified) { - [_rangeController updateCurrentRangeWithMode:pendingState.rangeMode]; - } - } -} - -- (ASTableView *)view -{ - return (ASTableView *)[super view]; -} - -- (void)clearContents -{ - [super clearContents]; - [self.rangeController clearContents]; -} - -- (void)interfaceStateDidChange:(ASInterfaceState)newState fromState:(ASInterfaceState)oldState -{ - [super interfaceStateDidChange:newState fromState:oldState]; - [ASRangeController layoutDebugOverlayIfNeeded]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - // Intentionally allocate the view here and trigger a layout pass on it, which in turn will trigger the intial data load. - // We can get rid of this call later when ASDataController, ASRangeController and ASCollectionLayout can operate without the view. - [self.view layoutIfNeeded]; -} - -#if ASRangeControllerLoggingEnabled -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - NSLog(@"%@ - visible: YES", self); -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - NSLog(@"%@ - visible: NO", self); -} -#endif - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - [self.rangeController clearPreloadedData]; -} - -#pragma mark Setter / Getter - -// TODO: Implement this without the view. Then revisit ASLayoutElementCollectionTableSetTraitCollection -- (ASDataController *)dataController -{ - return self.view.dataController; -} - -- (_ASTablePendingState *)pendingState -{ - if (!_pendingState && ![self isNodeLoaded]) { - _pendingState = [[_ASTablePendingState alloc] init]; - } - ASDisplayNodeAssert(![self isNodeLoaded] || !_pendingState, @"ASTableNode should not have a pendingState once it is loaded"); - return _pendingState; -} - -- (void)setInverted:(BOOL)inverted -{ - self.transform = inverted ? CATransform3DMakeScale(1, -1, 1) : CATransform3DIdentity; - if ([self pendingState]) { - _pendingState.inverted = inverted; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.inverted = inverted; - } -} - -- (BOOL)inverted -{ - if ([self pendingState]) { - return _pendingState.inverted; - } else { - return self.view.inverted; - } -} - -- (void)setLeadingScreensForBatching:(CGFloat)leadingScreensForBatching -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - pendingState.leadingScreensForBatching = leadingScreensForBatching; - } else { - ASDisplayNodeAssert(self.nodeLoaded, @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.leadingScreensForBatching = leadingScreensForBatching; - } -} - -- (CGFloat)leadingScreensForBatching -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - return pendingState.leadingScreensForBatching; - } else { - return self.view.leadingScreensForBatching; - } -} - -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - pendingState.contentInset = contentInset; - } else { - ASDisplayNodeAssert(self.nodeLoaded, @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.contentInset = contentInset; - } -} - -- (UIEdgeInsets)contentInset -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - return pendingState.contentInset; - } else { - return self.view.contentInset; - } -} - -- (void)setContentOffset:(CGPoint)contentOffset -{ - [self setContentOffset:contentOffset animated:NO]; -} - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - pendingState.contentOffset = contentOffset; - pendingState.animatesContentOffset = animated; - } else { - ASDisplayNodeAssert(self.nodeLoaded, @"ASTableNode should be loaded if pendingState doesn't exist"); - [self.view setContentOffset:contentOffset animated:animated]; - } -} - -- (CGPoint)contentOffset -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - return pendingState.contentOffset; - } else { - return self.view.contentOffset; - } -} - -- (void)setAutomaticallyAdjustsContentOffset:(BOOL)automaticallyAdjustsContentOffset -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - pendingState.automaticallyAdjustsContentOffset = automaticallyAdjustsContentOffset; - } else { - ASDisplayNodeAssert(self.nodeLoaded, @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.automaticallyAdjustsContentOffset = automaticallyAdjustsContentOffset; - } -} - -- (BOOL)automaticallyAdjustsContentOffset -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - return pendingState.automaticallyAdjustsContentOffset; - } else { - return self.view.automaticallyAdjustsContentOffset; - } -} - -#if !TARGET_OS_TV -- (void)setPagingEnabled:(BOOL)pagingEnabled -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - pendingState.pagingEnabled = pagingEnabled; - } else { - ASDisplayNodeAssert([self isNodeLoaded], - @"ASCollectionNode should be loaded if pendingState doesn't exist"); - self.view.pagingEnabled = pagingEnabled; - } -} - -- (BOOL)isPagingEnabled -{ - _ASTablePendingState *pendingState = self.pendingState; - if (pendingState) { - return pendingState.pagingEnabled; - } else { - return self.view.isPagingEnabled; - } -} -#endif - -- (void)setDelegate:(id )delegate -{ - if ([self pendingState]) { - _pendingState.delegate = delegate; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - - // Manually trampoline to the main thread. The view requires this be called on main - // and asserting here isn't an option – it is a common pattern for users to clear - // the delegate/dataSource in dealloc, which may be running on a background thread. - // It is important that we avoid retaining self in this block, so that this method is dealloc-safe. - ASTableView *view = self.view; - ASPerformBlockOnMainThread(^{ - view.asyncDelegate = delegate; - }); - } -} - -- (id )delegate -{ - if ([self pendingState]) { - return _pendingState.delegate; - } else { - return self.view.asyncDelegate; - } -} - -- (void)setDataSource:(id )dataSource -{ - if ([self pendingState]) { - _pendingState.dataSource = dataSource; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - - // Manually trampoline to the main thread. The view requires this be called on main - // and asserting here isn't an option – it is a common pattern for users to clear - // the delegate/dataSource in dealloc, which may be running on a background thread. - // It is important that we avoid retaining self in this block, so that this method is dealloc-safe. - ASTableView *view = self.view; - ASPerformBlockOnMainThread(^{ - view.asyncDataSource = dataSource; - }); - } -} - -- (id )dataSource -{ - if ([self pendingState]) { - return _pendingState.dataSource; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - return self.view.asyncDataSource; - } -} - -- (void)setAllowsSelection:(BOOL)allowsSelection -{ - if ([self pendingState]) { - _pendingState.allowsSelection = allowsSelection; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.allowsSelection = allowsSelection; - } -} - -- (BOOL)allowsSelection -{ - if ([self pendingState]) { - return _pendingState.allowsSelection; - } else { - return self.view.allowsSelection; - } -} - -- (void)setAllowsSelectionDuringEditing:(BOOL)allowsSelectionDuringEditing -{ - if ([self pendingState]) { - _pendingState.allowsSelectionDuringEditing = allowsSelectionDuringEditing; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.allowsSelectionDuringEditing = allowsSelectionDuringEditing; - } -} - -- (BOOL)allowsSelectionDuringEditing -{ - if ([self pendingState]) { - return _pendingState.allowsSelectionDuringEditing; - } else { - return self.view.allowsSelectionDuringEditing; - } -} - -- (void)setAllowsMultipleSelection:(BOOL)allowsMultipleSelection -{ - if ([self pendingState]) { - _pendingState.allowsMultipleSelection = allowsMultipleSelection; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.allowsMultipleSelection = allowsMultipleSelection; - } -} - -- (BOOL)allowsMultipleSelection -{ - if ([self pendingState]) { - return _pendingState.allowsMultipleSelection; - } else { - return self.view.allowsMultipleSelection; - } -} - -- (void)setAllowsMultipleSelectionDuringEditing:(BOOL)allowsMultipleSelectionDuringEditing -{ - if ([self pendingState]) { - _pendingState.allowsMultipleSelectionDuringEditing = allowsMultipleSelectionDuringEditing; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - self.view.allowsMultipleSelectionDuringEditing = allowsMultipleSelectionDuringEditing; - } -} - -- (BOOL)allowsMultipleSelectionDuringEditing -{ - if ([self pendingState]) { - return _pendingState.allowsMultipleSelectionDuringEditing; - } else { - return self.view.allowsMultipleSelectionDuringEditing; - } -} - -- (void)setBatchFetchingDelegate:(id)batchFetchingDelegate -{ - _batchFetchingDelegate = batchFetchingDelegate; -} - -- (id)batchFetchingDelegate -{ - return _batchFetchingDelegate; -} - -#pragma mark ASRangeControllerUpdateRangeProtocol - -- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode -{ - if ([self pendingState]) { - _pendingState.rangeMode = rangeMode; - } else { - ASDisplayNodeAssert([self isNodeLoaded], @"ASTableNode should be loaded if pendingState doesn't exist"); - [self.rangeController updateCurrentRangeWithMode:rangeMode]; - } -} - -#pragma mark ASEnvironment - -ASLayoutElementCollectionTableSetTraitCollection(_environmentStateLock) - -#pragma mark - Range Tuning - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - if ([self pendingState]) { - return [_pendingState tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - } else { - return [self.rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - } -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - if ([self pendingState]) { - [_pendingState setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; - } else { - return [self.rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; - } -} - -#pragma mark - Selection - -- (void)selectRowAtIndexPath:(nullable NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - indexPath = [tableView convertIndexPathFromTableNode:indexPath waitingIfNeeded:YES]; - if (indexPath != nil) { - [tableView selectRowAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition]; - } else { - NSLog(@"Failed to select row at index path %@ because the row never reached the view.", indexPath); - } - -} - -- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - indexPath = [tableView convertIndexPathFromTableNode:indexPath waitingIfNeeded:YES]; - if (indexPath != nil) { - [tableView deselectRowAtIndexPath:indexPath animated:animated]; - } else { - NSLog(@"Failed to deselect row at index path %@ because the row never reached the view.", indexPath); - } -} - -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - indexPath = [tableView convertIndexPathFromTableNode:indexPath waitingIfNeeded:YES]; - - if (indexPath != nil) { - [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; - } else { - NSLog(@"Failed to scroll to row at index path %@ because the row never reached the view.", indexPath); - } -} - -#pragma mark - Querying Data - -- (void)reloadDataInitiallyIfNeeded -{ - ASDisplayNodeAssertMainThread(); - if (!self.dataController.initialReloadDataHasBeenCalled) { - // Note: Just calling reloadData isn't enough here – we need to - // ensure that _nodesConstrainedWidth is updated first. - [self.view layoutIfNeeded]; - } -} - -- (NSInteger)numberOfRowsInSection:(NSInteger)section -{ - ASDisplayNodeAssertMainThread(); - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap numberOfItemsInSection:section]; -} - -- (NSInteger)numberOfSections -{ - ASDisplayNodeAssertMainThread(); - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap numberOfSections]; -} - -- (NSArray<__kindof ASCellNode *> *)visibleNodes -{ - ASDisplayNodeAssertMainThread(); - return self.isNodeLoaded ? [self.view visibleNodes] : @[]; -} - -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode -{ - return [self.dataController.pendingMap indexPathForElement:cellNode.collectionElement]; -} - -- (ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - [self reloadDataInitiallyIfNeeded]; - return [self.dataController.pendingMap elementForItemAtIndexPath:indexPath].node; -} - -- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - indexPath = [tableView convertIndexPathFromTableNode:indexPath waitingIfNeeded:YES]; - return [tableView rectForRowAtIndexPath:indexPath]; -} - -- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - indexPath = [tableView convertIndexPathFromTableNode:indexPath waitingIfNeeded:YES]; - if (indexPath == nil) { - return nil; - } - return [tableView cellForRowAtIndexPath:indexPath]; -} - -- (nullable NSIndexPath *)indexPathForSelectedRow -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - NSIndexPath *indexPath = tableView.indexPathForSelectedRow; - if (indexPath != nil) { - return [tableView convertIndexPathToTableNode:indexPath]; - } - return indexPath; -} - -- (NSArray *)indexPathsForSelectedRows -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - return [tableView convertIndexPathsToTableNode:tableView.indexPathsForSelectedRows]; -} - -- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - - NSIndexPath *indexPath = [tableView indexPathForRowAtPoint:point]; - if (indexPath != nil) { - return [tableView convertIndexPathToTableNode:indexPath]; - } - return indexPath; -} - -- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect -{ - ASDisplayNodeAssertMainThread(); - ASTableView *tableView = self.view; - return [tableView convertIndexPathsToTableNode:[tableView indexPathsForRowsInRect:rect]]; -} - -- (NSArray *)indexPathsForVisibleRows -{ - ASDisplayNodeAssertMainThread(); - NSMutableArray *indexPathsArray = [NSMutableArray new]; - for (ASCellNode *cell in [self visibleNodes]) { - NSIndexPath *indexPath = [self indexPathForNode:cell]; - if (indexPath) { - [indexPathsArray addObject:indexPath]; - } - } - return indexPathsArray; -} - -#pragma mark - Editing - -- (void)reloadDataWithCompletion:(void (^)())completion -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view reloadDataWithCompletion:completion]; - } else { - if (completion) { - completion(); - } - } -} - -- (void)reloadData -{ - [self reloadDataWithCompletion:nil]; -} - -- (void)relayoutItems -{ - [self.view relayoutItems]; -} - -- (void)performBatchAnimated:(BOOL)animated updates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - ASTableView *tableView = self.view; - [tableView beginUpdates]; - if (updates) { - updates(); - } - [tableView endUpdatesAnimated:animated completion:completion]; - } else { - if (updates) { - updates(); - } - } -} - -- (void)performBatchUpdates:(NS_NOESCAPE void (^)())updates completion:(void (^)(BOOL))completion -{ - [self performBatchAnimated:YES updates:updates completion:completion]; -} - -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view insertSections:sections withRowAnimation:animation]; - } -} - -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view deleteSections:sections withRowAnimation:animation]; - } -} - -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view reloadSections:sections withRowAnimation:animation]; - } -} - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view moveSection:section toSection:newSection]; - } -} - -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view insertRowsAtIndexPaths:indexPaths withRowAnimation:animation]; - } -} - -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation]; - } -} - -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation]; - } -} - -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view moveRowAtIndexPath:indexPath toIndexPath:newIndexPath]; - } -} - -- (BOOL)isProcessingUpdates -{ - return (self.nodeLoaded ? [self.view isProcessingUpdates] : NO); -} - -- (void)onDidFinishProcessingUpdates:(void (^)())completion -{ - if (!completion) { - return; - } - if (!self.nodeLoaded) { - completion(); - } else { - [self.view onDidFinishProcessingUpdates:completion]; - } -} - -- (void)waitUntilAllUpdatesAreProcessed -{ - ASDisplayNodeAssertMainThread(); - if (self.nodeLoaded) { - [self.view waitUntilAllUpdatesAreCommitted]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (void)waitUntilAllUpdatesAreCommitted -{ - [self waitUntilAllUpdatesAreProcessed]; -} -#pragma clang diagnostic pop - -#pragma mark - Debugging (Private) - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [super propertiesForDebugDescription]; - [result addObject:@{ @"dataSource" : ASObjectDescriptionMakeTiny(self.dataSource) }]; - [result addObject:@{ @"delegate" : ASObjectDescriptionMakeTiny(self.delegate) }]; - return result; -} - -@end diff --git a/Example/Pods/Texture/Source/ASTableView.h b/Example/Pods/Texture/Source/ASTableView.h deleted file mode 100644 index a2258b32..00000000 --- a/Example/Pods/Texture/Source/ASTableView.h +++ /dev/null @@ -1,245 +0,0 @@ -// -// ASTableView.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCellNode; -@protocol ASTableDataSource; -@protocol ASTableDelegate; -@class ASTableNode; - -/** - * Asynchronous UITableView with Intelligent Preloading capabilities. - * - * @note ASTableNode is strongly recommended over ASTableView. This class is provided for adoption convenience. - */ -@interface ASTableView : UITableView - -/// The corresponding table node, or nil if one does not exist. -@property (nonatomic, weak, readonly) ASTableNode *tableNode; - -/** - * Retrieves the node for the row at the given index path. - */ -- (nullable ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath AS_WARN_UNUSED_RESULT; - -@end - -@interface ASTableView (Deprecated) - -@property (nonatomic, weak) id asyncDelegate ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's .delegate property instead."); -@property (nonatomic, weak) id asyncDataSource ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode .dataSource property instead."); - -/** - * Initializer. - * - * @param frame A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. - * The frame of the table view changes as table cells are added and deleted. - * - * @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. - */ -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style ASDISPLAYNODE_DEPRECATED_MSG("Please use ASTableNode instead of ASTableView."); - -/** - * The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic) CGFloat leadingScreensForBatching ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -/** - * The distance that the content view is inset from the table view edges. Defaults to UIEdgeInsetsZero. - */ -@property (nonatomic) UIEdgeInsets contentInset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead"); - -/** - * The offset of the content view's origin from the table node's origin. Defaults to CGPointZero. - */ -@property (nonatomic) CGPoint contentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -/** - * YES to automatically adjust the contentOffset when cells are inserted or deleted above - * visible cells, maintaining the users' visible scroll position. - * - * @note This is only applied to non-animated updates. For animated updates, there is no way to - * synchronize or "cancel out" the appearance of a scroll due to UITableView API limitations. - * - * default is NO. - */ -@property (nonatomic) BOOL automaticallyAdjustsContentOffset ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -/* - * A Boolean value that determines whether the nodes that the data source renders will be flipped. - */ -@property (nonatomic) BOOL inverted ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -@property (nonatomic, readonly, nullable) NSIndexPath *indexPathForSelectedRow ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForVisibleRows ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode property instead."); - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Similar to -visibleCells. - * - * @return an array containing the cell nodes being displayed on screen. - */ -- (NSArray *)visibleNodes AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Similar to -indexPathForCell:. - * - * @param cellNode a cellNode part of the table view - * - * @return an indexPath for this cellNode - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on - * the main thread. - * @warning This method is substantially more expensive than UITableView's version. - */ --(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @warning This method is substantially more expensive than UITableView's version. - */ -- (void)reloadData ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the table view. - */ -- (void)relayoutItems ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)beginUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); - -- (void)endUpdates ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); - -/** - * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. - * You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations - * to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating - * the operations simultaneously. This method is must be called from the main thread. It's important to remember that the ASTableView will - * be processing the updates asynchronously after this call and are not guaranteed to be reflected in the ASTableView until - * the completion block is executed. - * - * @param animated NO to disable all animations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL completed))completion ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode's -performBatchUpdates:completion: instead."); - -/** - * See ASTableNode.h for full documentation of these methods. - */ -@property (nonatomic, readonly) BOOL isProcessingUpdates; -- (void)onDidFinishProcessingUpdates:(void (^)(void))completion; -- (void)waitUntilAllUpdatesAreCommitted ASDISPLAYNODE_DEPRECATED_MSG("Use -[ASTableNode waitUntilAllUpdatesAreProcessed] instead."); - -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated ASDISPLAYNODE_DEPRECATED_MSG("Use ASTableNode method instead."); - -@end - -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASTableDataSource.") -@protocol ASTableViewDataSource -@end - -ASDISPLAYNODE_DEPRECATED_MSG("Renamed to ASTableDelegate.") -@protocol ASTableViewDelegate -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTableView.mm b/Example/Pods/Texture/Source/ASTableView.mm deleted file mode 100644 index 195cb183..00000000 --- a/Example/Pods/Texture/Source/ASTableView.mm +++ /dev/null @@ -1,2043 +0,0 @@ -// -// ASTableView.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - - -static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; - -//#define LOG(...) NSLog(__VA_ARGS__) -#define LOG(...) - -/** - * See note at the top of ASCollectionView.mm near declaration of macro GET_COLLECTIONNODE_OR_RETURN - */ -#define GET_TABLENODE_OR_RETURN(__var, __val) \ - ASTableNode *__var = self.tableNode; \ - if (__var == nil) { \ - return __val; \ - } - -#define UITABLEVIEW_RESPONDS_TO_SELECTOR() \ - ({ \ - static BOOL superResponds; \ - static dispatch_once_t onceToken; \ - dispatch_once(&onceToken, ^{ \ - superResponds = [UITableView instancesRespondToSelector:_cmd]; \ - }); \ - superResponds; \ - }) - -@interface UITableView (ScrollViewDelegate) - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView; -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset; -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; - -@end - -#pragma mark - -#pragma mark ASCellNode<->UITableViewCell bridging. - -@class _ASTableViewCell; - -@protocol _ASTableViewCellDelegate -- (void)didLayoutSubviewsOfTableViewCell:(_ASTableViewCell *)tableViewCell; -@end - -@interface _ASTableViewCell : UITableViewCell -@property (nonatomic, weak) id<_ASTableViewCellDelegate> delegate; -@property (nonatomic, readonly) ASCellNode *node; -@property (nonatomic) ASCollectionElement *element; -@end - -@implementation _ASTableViewCell -// TODO add assertions to prevent use of view-backed UITableViewCell properties (eg .textLabel) - -- (void)layoutSubviews -{ - [super layoutSubviews]; - [_delegate didLayoutSubviewsOfTableViewCell:self]; -} - -- (void)didTransitionToState:(UITableViewCellStateMask)state -{ - [self setNeedsLayout]; - [self layoutIfNeeded]; - [super didTransitionToState:state]; -} - -- (ASCellNode *)node -{ - return self.element.node; -} - -- (void)setElement:(ASCollectionElement *)element -{ - _element = element; - ASCellNode *node = element.node; - - if (node) { - self.backgroundColor = node.backgroundColor; - self.selectedBackgroundView = node.selectedBackgroundView; - self.backgroundView = node.backgroundView; -#if TARGET_OS_IOS - self.separatorInset = node.separatorInset; -#endif - self.selectionStyle = node.selectionStyle; - self.focusStyle = node.focusStyle; - self.accessoryType = node.accessoryType; - self.isAccessibilityElement = node.isAccessibilityElement; - self.accessibilityElementsHidden = node.accessibilityElementsHidden; - // the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default) - // This is actually a workaround for a bug we are seeing in some rare cases (selected background view - // overlaps other cells if size of ASCellNode has changed.) - self.clipsToBounds = node.clipsToBounds; - - // If the cell node has been explicitly configured with a tint color, we can apply that directly to the cell view to preserve the previous behavior - self.tintColor = node->_tintColor; - } - - [node __setSelectedFromUIKit:self.selected]; - [node __setHighlightedFromUIKit:self.highlighted]; -} - -- (BOOL)consumesCellNodeVisibilityEvents -{ - ASCellNode *node = self.node; - if (node == nil) { - return NO; - } - return ASSubclassOverridesSelector([ASCellNode class], [node class], @selector(cellNodeVisibilityEvent:inScrollView:withCellFrame:)); -} - -- (void)setSelected:(BOOL)selected animated:(BOOL)animated -{ - [super setSelected:selected animated:animated]; - [self.node __setSelectedFromUIKit:selected]; -} - -- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated -{ - [super setHighlighted:highlighted animated:animated]; - [self.node __setHighlightedFromUIKit:highlighted]; -} - -- (void)prepareForReuse -{ - // Need to clear element before UIKit calls setSelected:NO / setHighlighted:NO on its cells - self.element = nil; - [super prepareForReuse]; -} - -@end - -#pragma mark - -#pragma mark ASTableView - -@interface ASTableView () -{ - ASTableViewProxy *_proxyDataSource; - ASTableViewProxy *_proxyDelegate; - - ASTableLayoutController *_layoutController; - - ASRangeController *_rangeController; - - ASBatchContext *_batchContext; - - // When we update our data controller in response to an interactive move, - // we don't want to tell the table view about the change (it knows!) - BOOL _updatingInResponseToInteractiveMove; - BOOL _inverted; - - // The top cell node that was visible before the update. - __weak ASCellNode *_contentOffsetAdjustmentTopVisibleNode; - // The y-offset of the top visible row's origin before the update. - CGFloat _contentOffsetAdjustmentTopVisibleNodeOffset; - CGFloat _leadingScreensForBatching; - BOOL _automaticallyAdjustsContentOffset; - - CGPoint _deceleratingVelocity; - - CGFloat _nodesConstrainedWidth; - BOOL _queuedNodeHeightUpdate; - BOOL _isDeallocating; - NSHashTable<_ASTableViewCell *> *_cellsForVisibilityUpdates; - - // CountedSet because UIKit may display the same element in multiple cells e.g. during animations. - NSCountedSet *_visibleElements; - - NSHashTable *_cellsForLayoutUpdates; - - // See documentation on same property in ASCollectionView - BOOL _hasEverCheckedForBatchFetchingDueToUpdate; - - // The section index overlay view, if there is one present. - // This is useful because we need to measure our row nodes against (width - indexView.width). - __weak UIView *_sectionIndexView; - - /** - * The change set that we're currently building, if any. - */ - _ASHierarchyChangeSet *_changeSet; - - /** - * Counter used to keep track of nested batch updates. - */ - NSInteger _batchUpdateCount; - - /** - * Keep a strong reference to node till view is ready to release. - */ - ASTableNode *_keepalive_node; - - struct { - unsigned int scrollViewDidScroll:1; - unsigned int scrollViewWillBeginDragging:1; - unsigned int scrollViewDidEndDragging:1; - unsigned int scrollViewWillEndDragging:1; - unsigned int scrollViewDidEndDecelerating:1; - unsigned int tableNodeWillDisplayNodeForRow:1; - unsigned int tableViewWillDisplayNodeForRow:1; - unsigned int tableViewWillDisplayNodeForRowDeprecated:1; - unsigned int tableNodeDidEndDisplayingNodeForRow:1; - unsigned int tableViewDidEndDisplayingNodeForRow:1; - unsigned int tableNodeWillBeginBatchFetch:1; - unsigned int tableViewWillBeginBatchFetch:1; - unsigned int shouldBatchFetchForTableView:1; - unsigned int shouldBatchFetchForTableNode:1; - unsigned int tableViewConstrainedSizeForRow:1; - unsigned int tableNodeConstrainedSizeForRow:1; - unsigned int tableViewWillSelectRow:1; - unsigned int tableNodeWillSelectRow:1; - unsigned int tableViewDidSelectRow:1; - unsigned int tableNodeDidSelectRow:1; - unsigned int tableViewWillDeselectRow:1; - unsigned int tableNodeWillDeselectRow:1; - unsigned int tableViewDidDeselectRow:1; - unsigned int tableNodeDidDeselectRow:1; - unsigned int tableViewShouldHighlightRow:1; - unsigned int tableNodeShouldHighlightRow:1; - unsigned int tableViewDidHighlightRow:1; - unsigned int tableNodeDidHighlightRow:1; - unsigned int tableViewDidUnhighlightRow:1; - unsigned int tableNodeDidUnhighlightRow:1; - unsigned int tableViewShouldShowMenuForRow:1; - unsigned int tableNodeShouldShowMenuForRow:1; - unsigned int tableViewCanPerformActionForRow:1; - unsigned int tableNodeCanPerformActionForRow:1; - unsigned int tableViewPerformActionForRow:1; - unsigned int tableNodePerformActionForRow:1; - } _asyncDelegateFlags; - - struct { - unsigned int numberOfSectionsInTableView:1; - unsigned int numberOfSectionsInTableNode:1; - unsigned int tableNodeNumberOfRowsInSection:1; - unsigned int tableViewNumberOfRowsInSection:1; - unsigned int tableViewNodeBlockForRow:1; - unsigned int tableNodeNodeBlockForRow:1; - unsigned int tableViewNodeForRow:1; - unsigned int tableNodeNodeForRow:1; - unsigned int tableViewCanMoveRow:1; - unsigned int tableNodeCanMoveRow:1; - unsigned int tableViewMoveRow:1; - unsigned int tableNodeMoveRow:1; - unsigned int sectionIndexMethods:1; // if both section index methods are implemented - unsigned int modelIdentifierMethods:1; // if both modelIdentifierForElementAtIndexPath and indexPathForElementWithModelIdentifier are implemented - } _asyncDataSourceFlags; -} - -@property (nonatomic) ASDataController *dataController; - -@property (nonatomic, weak) ASTableNode *tableNode; - -@property (nonatomic) BOOL test_enableSuperUpdateCallLogging; -@end - -@implementation ASTableView -{ - __weak id _asyncDelegate; - __weak id _asyncDataSource; -} - -// Using _ASDisplayLayer ensures things like -layout are properly forwarded to ASTableNode. -+ (Class)layerClass -{ - return [_ASDisplayLayer class]; -} - -+ (Class)dataControllerClass -{ - return [ASDataController class]; -} - -#pragma mark - -#pragma mark Lifecycle - -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style -{ - return [self _initWithFrame:frame style:style dataControllerClass:nil owningNode:nil]; -} - -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode -{ - if (!(self = [super initWithFrame:frame style:style])) { - return nil; - } - _cellsForVisibilityUpdates = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - _cellsForLayoutUpdates = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - if (!dataControllerClass) { - dataControllerClass = [[self class] dataControllerClass]; - } - - _layoutController = [[ASTableLayoutController alloc] initWithTableView:self]; - - _rangeController = [[ASRangeController alloc] init]; - _rangeController.layoutController = _layoutController; - _rangeController.dataSource = self; - _rangeController.delegate = self; - - _dataController = [[dataControllerClass alloc] initWithDataSource:self node:tableNode]; - _dataController.delegate = _rangeController; - - _leadingScreensForBatching = 2.0; - _batchContext = [[ASBatchContext alloc] init]; - _visibleElements = [[NSCountedSet alloc] init]; - - _automaticallyAdjustsContentOffset = NO; - - _nodesConstrainedWidth = self.bounds.size.width; - - _proxyDelegate = [[ASTableViewProxy alloc] initWithTarget:nil interceptor:self]; - super.delegate = (id)_proxyDelegate; - - _proxyDataSource = [[ASTableViewProxy alloc] initWithTarget:nil interceptor:self]; - super.dataSource = (id)_proxyDataSource; - - [self registerClass:_ASTableViewCell.class forCellReuseIdentifier:kCellReuseIdentifier]; - - // iOS 11 automatically uses estimated heights, so disable those (see PR #485) - if (AS_AT_LEAST_IOS11) { - super.estimatedRowHeight = 0.0; - super.estimatedSectionHeaderHeight = 0.0; - super.estimatedSectionFooterHeight = 0.0; - } - - return self; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - NSLog(@"Warning: AsyncDisplayKit is not designed to be used with Interface Builder. Table properties set in IB will be lost."); - return [self initWithFrame:CGRectZero style:UITableViewStylePlain]; -} - -- (void)dealloc -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeCAssert(_batchUpdateCount == 0, @"ASTableView deallocated in the middle of a batch update."); - - // Sometimes the UIKit classes can call back to their delegate even during deallocation. - _isDeallocating = YES; - if (!ASActivateExperimentalFeature(ASExperimentalCollectionTeardown)) { - [self setAsyncDelegate:nil]; - [self setAsyncDataSource:nil]; - } -} - -#pragma mark - -#pragma mark Overrides - -- (void)setDataSource:(id)dataSource -{ - // UIKit can internally generate a call to this method upon changing the asyncDataSource; only assert for non-nil. - ASDisplayNodeAssert(dataSource == nil, @"ASTableView uses asyncDataSource, not UITableView's dataSource property."); -} - -- (void)setDelegate:(id)delegate -{ - // Our UIScrollView superclass sets its delegate to nil on dealloc. Only assert if we get a non-nil value here. - ASDisplayNodeAssert(delegate == nil, @"ASTableView uses asyncDelegate, not UITableView's delegate property."); -} - -- (id)asyncDataSource -{ - return _asyncDataSource; -} - -- (void)setAsyncDataSource:(id)asyncDataSource -{ - // Changing super.dataSource will trigger a setNeedsLayout, so this must happen on the main thread. - ASDisplayNodeAssertMainThread(); - - // Note: It's common to check if the value hasn't changed and short-circuit but we aren't doing that here to handle - // the (common) case of nilling the asyncDataSource in the ViewController's dealloc. In this case our _asyncDataSource - // will return as nil (ARC magic) even though the _proxyDataSource still exists. It's really important to hold a strong - // reference to the old dataSource in this case because calls to ASTableViewProxy will start failing and cause crashes. - NS_VALID_UNTIL_END_OF_SCOPE id oldDataSource = self.dataSource; - - if (asyncDataSource == nil) { - _asyncDataSource = nil; - _proxyDataSource = _isDeallocating ? nil : [[ASTableViewProxy alloc] initWithTarget:nil interceptor:self]; - - memset(&_asyncDataSourceFlags, 0, sizeof(_asyncDataSourceFlags)); - } else { - _asyncDataSource = asyncDataSource; - _proxyDataSource = [[ASTableViewProxy alloc] initWithTarget:_asyncDataSource interceptor:self]; - - _asyncDataSourceFlags.numberOfSectionsInTableView = [_asyncDataSource respondsToSelector:@selector(numberOfSectionsInTableView:)]; - _asyncDataSourceFlags.numberOfSectionsInTableNode = [_asyncDataSource respondsToSelector:@selector(numberOfSectionsInTableNode:)]; - _asyncDataSourceFlags.tableViewNumberOfRowsInSection = [_asyncDataSource respondsToSelector:@selector(tableView:numberOfRowsInSection:)]; - _asyncDataSourceFlags.tableNodeNumberOfRowsInSection = [_asyncDataSource respondsToSelector:@selector(tableNode:numberOfRowsInSection:)]; - _asyncDataSourceFlags.tableViewNodeForRow = [_asyncDataSource respondsToSelector:@selector(tableView:nodeForRowAtIndexPath:)]; - _asyncDataSourceFlags.tableNodeNodeForRow = [_asyncDataSource respondsToSelector:@selector(tableNode:nodeForRowAtIndexPath:)]; - _asyncDataSourceFlags.tableViewNodeBlockForRow = [_asyncDataSource respondsToSelector:@selector(tableView:nodeBlockForRowAtIndexPath:)]; - _asyncDataSourceFlags.tableNodeNodeBlockForRow = [_asyncDataSource respondsToSelector:@selector(tableNode:nodeBlockForRowAtIndexPath:)]; - _asyncDataSourceFlags.tableViewCanMoveRow = [_asyncDataSource respondsToSelector:@selector(tableView:canMoveRowAtIndexPath:)]; - _asyncDataSourceFlags.tableViewMoveRow = [_asyncDataSource respondsToSelector:@selector(tableView:moveRowAtIndexPath:toIndexPath:)]; - _asyncDataSourceFlags.sectionIndexMethods = [_asyncDataSource respondsToSelector:@selector(sectionIndexTitlesForTableView:)] && [_asyncDataSource respondsToSelector:@selector(tableView:sectionForSectionIndexTitle:atIndex:)]; - _asyncDataSourceFlags.modelIdentifierMethods = [_asyncDataSource respondsToSelector:@selector(modelIdentifierForElementAtIndexPath:inNode:)] && [_asyncDataSource respondsToSelector:@selector(indexPathForElementWithModelIdentifier:inNode:)]; - - ASDisplayNodeAssert(_asyncDataSourceFlags.tableViewNodeBlockForRow - || _asyncDataSourceFlags.tableViewNodeForRow - || _asyncDataSourceFlags.tableNodeNodeBlockForRow - || _asyncDataSourceFlags.tableNodeNodeForRow, @"Data source must implement tableNode:nodeBlockForRowAtIndexPath: or tableNode:nodeForRowAtIndexPath:"); - ASDisplayNodeAssert(_asyncDataSourceFlags.tableNodeNumberOfRowsInSection || _asyncDataSourceFlags.tableViewNumberOfRowsInSection, @"Data source must implement tableNode:numberOfRowsInSection:"); - } - - _dataController.validationErrorSource = asyncDataSource; - super.dataSource = (id)_proxyDataSource; - [self _asyncDelegateOrDataSourceDidChange]; -} - -- (id)asyncDelegate -{ - return _asyncDelegate; -} - -- (void)setAsyncDelegate:(id)asyncDelegate -{ - // Changing super.delegate will trigger a setNeedsLayout, so this must happen on the main thread. - ASDisplayNodeAssertMainThread(); - - // Note: It's common to check if the value hasn't changed and short-circuit but we aren't doing that here to handle - // the (common) case of nilling the asyncDelegate in the ViewController's dealloc. In this case our _asyncDelegate - // will return as nil (ARC magic) even though the _proxyDataSource still exists. It's really important to hold a strong - // reference to the old delegate in this case because calls to ASTableViewProxy will start failing and cause crashes. - NS_VALID_UNTIL_END_OF_SCOPE id oldDelegate = super.delegate; - - if (asyncDelegate == nil) { - _asyncDelegate = nil; - _proxyDelegate = _isDeallocating ? nil : [[ASTableViewProxy alloc] initWithTarget:nil interceptor:self]; - - memset(&_asyncDelegateFlags, 0, sizeof(_asyncDelegateFlags)); - } else { - _asyncDelegate = asyncDelegate; - _proxyDelegate = [[ASTableViewProxy alloc] initWithTarget:_asyncDelegate interceptor:self]; - - _asyncDelegateFlags.scrollViewDidScroll = [_asyncDelegate respondsToSelector:@selector(scrollViewDidScroll:)]; - - _asyncDelegateFlags.tableViewWillDisplayNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableView:willDisplayNode:forRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeWillDisplayNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:willDisplayRowWithNode:)]; - if (_asyncDelegateFlags.tableViewWillDisplayNodeForRow == NO) { - _asyncDelegateFlags.tableViewWillDisplayNodeForRowDeprecated = [_asyncDelegate respondsToSelector:@selector(tableView:willDisplayNodeForRowAtIndexPath:)]; - } - _asyncDelegateFlags.tableViewDidEndDisplayingNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableView:didEndDisplayingNode:forRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeDidEndDisplayingNodeForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didEndDisplayingRowWithNode:)]; - _asyncDelegateFlags.scrollViewWillEndDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]; - _asyncDelegateFlags.scrollViewDidEndDecelerating = [_asyncDelegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]; - _asyncDelegateFlags.tableViewWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(tableView:willBeginBatchFetchWithContext:)]; - _asyncDelegateFlags.tableNodeWillBeginBatchFetch = [_asyncDelegate respondsToSelector:@selector(tableNode:willBeginBatchFetchWithContext:)]; - _asyncDelegateFlags.shouldBatchFetchForTableView = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForTableView:)]; - _asyncDelegateFlags.shouldBatchFetchForTableNode = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForTableNode:)]; - _asyncDelegateFlags.scrollViewWillBeginDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]; - _asyncDelegateFlags.scrollViewDidEndDragging = [_asyncDelegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]; - _asyncDelegateFlags.tableViewConstrainedSizeForRow = [_asyncDelegate respondsToSelector:@selector(tableView:constrainedSizeForRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeConstrainedSizeForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:constrainedSizeForRowAtIndexPath:)]; - - _asyncDelegateFlags.tableViewWillSelectRow = [_asyncDelegate respondsToSelector:@selector(tableView:willSelectRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeWillSelectRow = [_asyncDelegate respondsToSelector:@selector(tableNode:willSelectRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewDidSelectRow = [_asyncDelegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeDidSelectRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didSelectRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewWillDeselectRow = [_asyncDelegate respondsToSelector:@selector(tableView:willDeselectRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeWillDeselectRow = [_asyncDelegate respondsToSelector:@selector(tableNode:willDeselectRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewDidDeselectRow = [_asyncDelegate respondsToSelector:@selector(tableView:didDeselectRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeDidDeselectRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didDeselectRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewShouldHighlightRow = [_asyncDelegate respondsToSelector:@selector(tableView:shouldHighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeShouldHighlightRow = [_asyncDelegate respondsToSelector:@selector(tableNode:shouldHighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewDidHighlightRow = [_asyncDelegate respondsToSelector:@selector(tableView:didHighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeDidHighlightRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didHighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewDidUnhighlightRow = [_asyncDelegate respondsToSelector:@selector(tableView:didUnhighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeDidUnhighlightRow = [_asyncDelegate respondsToSelector:@selector(tableNode:didUnhighlightRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewShouldShowMenuForRow = [_asyncDelegate respondsToSelector:@selector(tableView:shouldShowMenuForRowAtIndexPath:)]; - _asyncDelegateFlags.tableNodeShouldShowMenuForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:shouldShowMenuForRowAtIndexPath:)]; - _asyncDelegateFlags.tableViewCanPerformActionForRow = [_asyncDelegate respondsToSelector:@selector(tableView:canPerformAction:forRowAtIndexPath:withSender:)]; - _asyncDelegateFlags.tableNodeCanPerformActionForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:canPerformAction:forRowAtIndexPath:withSender:)]; - _asyncDelegateFlags.tableViewPerformActionForRow = [_asyncDelegate respondsToSelector:@selector(tableView:performAction:forRowAtIndexPath:withSender:)]; - _asyncDelegateFlags.tableNodePerformActionForRow = [_asyncDelegate respondsToSelector:@selector(tableNode:performAction:forRowAtIndexPath:withSender:)]; - } - - super.delegate = (id)_proxyDelegate; - [self _asyncDelegateOrDataSourceDidChange]; -} - -- (void)_asyncDelegateOrDataSourceDidChange -{ - ASDisplayNodeAssertMainThread(); - - if (_asyncDataSource == nil && _asyncDelegate == nil && !ASActivateExperimentalFeature(ASExperimentalSkipClearData)) { - [_dataController clearData]; - } -} - -- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy -{ - if (proxy == _proxyDelegate) { - [self setAsyncDelegate:nil]; - } else if (proxy == _proxyDataSource) { - [self setAsyncDataSource:nil]; - } -} - -- (void)reloadDataWithCompletion:(void (^)())completion -{ - ASDisplayNodeAssertMainThread(); - - if (! _dataController.initialReloadDataHasBeenCalled) { - // If this is the first reload, forward to super immediately to prevent it from triggering more "initial" loads while our data controller is working. - [super reloadData]; - } - - void (^batchUpdatesCompletion)(BOOL); - if (completion) { - batchUpdatesCompletion = ^(BOOL) { - completion(); - }; - } - - [self beginUpdates]; - [_changeSet reloadData]; - [self endUpdatesWithCompletion:batchUpdatesCompletion]; -} - -- (void)reloadData -{ - [self reloadDataWithCompletion:nil]; -} - -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated -{ - if ([self validateIndexPath:indexPath]) { - [super scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated]; - } -} - -- (void)relayoutItems -{ - [_dataController relayoutAllNodesWithInvalidationBlock:nil]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - [_rangeController setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [_rangeController tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - [_rangeController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - return [_rangeController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; -} - -- (ASElementMap *)elementMapForRangeController:(ASRangeController *)rangeController -{ - return _dataController.visibleMap; -} - -- (ASCellNode *)nodeForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return [_dataController.visibleMap elementForItemAtIndexPath:indexPath].node; -} - -- (NSIndexPath *)convertIndexPathFromTableNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait -{ - NSIndexPath *viewIndexPath = [_dataController.visibleMap convertIndexPath:indexPath fromMap:_dataController.pendingMap]; - if (viewIndexPath == nil && wait) { - [self waitUntilAllUpdatesAreCommitted]; - return [self convertIndexPathFromTableNode:indexPath waitingIfNeeded:NO]; - } - return viewIndexPath; -} - -- (NSIndexPath *)convertIndexPathToTableNode:(NSIndexPath *)indexPath -{ - if ([self validateIndexPath:indexPath] == nil) { - return nil; - } - - return [_dataController.pendingMap convertIndexPath:indexPath fromMap:_dataController.visibleMap]; -} - -- (NSArray *)convertIndexPathsToTableNode:(NSArray *)indexPaths -{ - if (indexPaths == nil) { - return nil; - } - - NSMutableArray *indexPathsArray = [NSMutableArray new]; - - for (NSIndexPath *indexPathInView in indexPaths) { - NSIndexPath *indexPath = [self convertIndexPathToTableNode:indexPathInView]; - if (indexPath != nil) { - [indexPathsArray addObject:indexPath]; - } - } - return indexPathsArray; -} - -- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode -{ - return [self indexPathForNode:cellNode waitingIfNeeded:NO]; -} - -/** - * Asserts that the index path is a valid view-index-path, and returns it if so, nil otherwise. - */ -- (nullable NSIndexPath *)validateIndexPath:(nullable NSIndexPath *)indexPath -{ - if (indexPath == nil) { - return nil; - } - - NSInteger section = indexPath.section; - if (section >= self.numberOfSections) { - ASDisplayNodeFailAssert(@"Table view index path has invalid section %lu, section count = %lu", (unsigned long)section, (unsigned long)self.numberOfSections); - return nil; - } - - NSInteger item = indexPath.item; - // item == NSNotFound means e.g. "scroll to this section" and is acceptable - if (item != NSNotFound && item >= [self numberOfRowsInSection:section]) { - ASDisplayNodeFailAssert(@"Table view index path has invalid item %lu in section %lu, item count = %lu", (unsigned long)indexPath.item, (unsigned long)section, (unsigned long)[self numberOfRowsInSection:section]); - return nil; - } - - return indexPath; -} - -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode waitingIfNeeded:(BOOL)wait -{ - if (cellNode == nil) { - return nil; - } - - NSIndexPath *indexPath = [_dataController.visibleMap indexPathForElement:cellNode.collectionElement]; - indexPath = [self validateIndexPath:indexPath]; - if (indexPath == nil && wait) { - [self waitUntilAllUpdatesAreCommitted]; - return [self indexPathForNode:cellNode waitingIfNeeded:NO]; - } - return indexPath; -} - -- (NSArray *)visibleNodes -{ - const auto elements = [self visibleElementsForRangeController:_rangeController]; - return ASArrayByFlatMapping(elements, ASCollectionElement *e, e.node); -} - -- (void)beginUpdates -{ - ASDisplayNodeAssertMainThread(); - // _changeSet must be available during batch update - ASDisplayNodeAssertTrue((_batchUpdateCount > 0) == (_changeSet != nil)); - - if (_batchUpdateCount == 0) { - _changeSet = [[_ASHierarchyChangeSet alloc] initWithOldData:[_dataController itemCountsFromDataSource]]; - } - _batchUpdateCount++; -} - -- (void)endUpdates -{ - [self endUpdatesWithCompletion:nil]; -} - -- (void)endUpdatesWithCompletion:(void (^)(BOOL completed))completion -{ - // We capture the current state of whether animations are enabled if they don't provide us with one. - [self endUpdatesAnimated:[UIView areAnimationsEnabled] completion:completion]; -} - -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL completed))completion -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssertNotNil(_changeSet, @"_changeSet must be available when batch update ends"); - - _batchUpdateCount--; - // Prevent calling endUpdatesAnimated:completion: in an unbalanced way - NSAssert(_batchUpdateCount >= 0, @"endUpdatesAnimated:completion: called without having a balanced beginUpdates call"); - - [_changeSet addCompletionHandler:completion]; - - if (_batchUpdateCount == 0) { - _ASHierarchyChangeSet *changeSet = _changeSet; - // Nil out _changeSet before forwarding to _dataController to allow the change set to cause subsequent batch updates on the same run loop - _changeSet = nil; - changeSet.animated = animated; - [_dataController updateWithChangeSet:changeSet]; - } -} - -- (BOOL)isProcessingUpdates -{ - return [_dataController isProcessingUpdates]; -} - -- (void)onDidFinishProcessingUpdates:(void (^)())completion -{ - [_dataController onDidFinishProcessingUpdates:completion]; -} - -- (void)waitUntilAllUpdatesAreCommitted -{ - ASDisplayNodeAssertMainThread(); - if (_batchUpdateCount > 0) { - // This assertion will be enabled soon. - // ASDisplayNodeFailAssert(@"Should not call %@ during batch update", NSStringFromSelector(_cmd)); - return; - } - - [_dataController waitUntilAllUpdatesAreProcessed]; -} - -- (void)layoutSubviews -{ - // Remeasure all rows if our row width has changed. - UIEdgeInsets contentInset = self.contentInset; - CGFloat constrainedWidth = self.bounds.size.width - [self sectionIndexWidth] - contentInset.left - contentInset.right; - if (constrainedWidth > 0 && _nodesConstrainedWidth != constrainedWidth) { - _nodesConstrainedWidth = constrainedWidth; - [_cellsForLayoutUpdates removeAllObjects]; - - [self beginUpdates]; - [_dataController relayoutAllNodesWithInvalidationBlock:nil]; - [self endUpdatesAnimated:(ASDisplayNodeLayerHasAnimations(self.layer) == NO) completion:nil]; - } else { - if (_cellsForLayoutUpdates.count > 0) { - NSArray *nodes = [_cellsForLayoutUpdates allObjects]; - [_cellsForLayoutUpdates removeAllObjects]; - - const auto nodesSizeChanged = [[NSMutableArray alloc] init]; - [_dataController relayoutNodes:nodes nodesSizeChanged:nodesSizeChanged]; - if (nodesSizeChanged.count > 0) { - [self requeryNodeHeights]; - } - } - } - - // To ensure _nodesConstrainedWidth is up-to-date for every usage, this call to super must be done last - [super layoutSubviews]; - [_rangeController updateIfNeeded]; -} - -#pragma mark - -#pragma mark Editing - -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self beginUpdates]; - [_changeSet insertSections:sections animationOptions:animation]; - [self endUpdates]; -} - -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self beginUpdates]; - [_changeSet deleteSections:sections animationOptions:animation]; - [self endUpdates]; -} - -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (sections.count == 0) { return; } - [self beginUpdates]; - [_changeSet reloadSections:sections animationOptions:animation]; - [self endUpdates]; -} - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection -{ - ASDisplayNodeAssertMainThread(); - [self beginUpdates]; - [_changeSet moveSection:section toSection:newSection animationOptions:UITableViewRowAnimationNone]; - [self endUpdates]; -} - -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self beginUpdates]; - [_changeSet insertItems:indexPaths animationOptions:animation]; - [self endUpdates]; -} - -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self beginUpdates]; - [_changeSet deleteItems:indexPaths animationOptions:animation]; - [self endUpdates]; -} - -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation -{ - ASDisplayNodeAssertMainThread(); - if (indexPaths.count == 0) { return; } - [self beginUpdates]; - [_changeSet reloadItems:indexPaths animationOptions:animation]; - [self endUpdates]; -} - -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath -{ - ASDisplayNodeAssertMainThread(); - [self beginUpdates]; - [_changeSet moveItemAtIndexPath:indexPath toIndexPath:newIndexPath animationOptions:UITableViewRowAnimationNone]; - [self endUpdates]; -} - -#pragma mark - -#pragma mark adjust content offset - -- (void)beginAdjustingContentOffset -{ - NSIndexPath *firstVisibleIndexPath = [self.indexPathsForVisibleRows sortedArrayUsingSelector:@selector(compare:)].firstObject; - if (firstVisibleIndexPath) { - ASCellNode *node = [self nodeForRowAtIndexPath:firstVisibleIndexPath]; - if (node) { - _contentOffsetAdjustmentTopVisibleNode = node; - _contentOffsetAdjustmentTopVisibleNodeOffset = [self rectForRowAtIndexPath:firstVisibleIndexPath].origin.y - self.bounds.origin.y; - } - } -} - -- (void)endAdjustingContentOffsetAnimated:(BOOL)animated -{ - // We can't do this for animated updates. - if (animated) { - return; - } - - // We can't do this if we didn't have a top visible row before. - if (_contentOffsetAdjustmentTopVisibleNode == nil) { - return; - } - - NSIndexPath *newIndexPathForTopVisibleRow = [self indexPathForNode:_contentOffsetAdjustmentTopVisibleNode]; - // We can't do this if our top visible row was deleted - if (newIndexPathForTopVisibleRow == nil) { - return; - } - - CGFloat newRowOriginYInSelf = [self rectForRowAtIndexPath:newIndexPathForTopVisibleRow].origin.y - self.bounds.origin.y; - CGPoint newContentOffset = self.contentOffset; - newContentOffset.y += (newRowOriginYInSelf - _contentOffsetAdjustmentTopVisibleNodeOffset); - self.contentOffset = newContentOffset; - _contentOffsetAdjustmentTopVisibleNode = nil; -} - -#pragma mark - Intercepted selectors - -- (void)setTableHeaderView:(UIView *)tableHeaderView -{ - // Typically the view will be nil before setting it, but reset state if it is being re-hosted. - [self.tableHeaderView.asyncdisplaykit_node exitHierarchyState:ASHierarchyStateRangeManaged]; - [super setTableHeaderView:tableHeaderView]; - [self.tableHeaderView.asyncdisplaykit_node enterHierarchyState:ASHierarchyStateRangeManaged]; -} - -- (void)setTableFooterView:(UIView *)tableFooterView -{ - // Typically the view will be nil before setting it, but reset state if it is being re-hosted. - [self.tableFooterView.asyncdisplaykit_node exitHierarchyState:ASHierarchyStateRangeManaged]; - [super setTableFooterView:tableFooterView]; - [self.tableFooterView.asyncdisplaykit_node enterHierarchyState:ASHierarchyStateRangeManaged]; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - _ASTableViewCell *cell = [self dequeueReusableCellWithIdentifier:kCellReuseIdentifier forIndexPath:indexPath]; - cell.delegate = self; - - ASCollectionElement *element = [_dataController.visibleMap elementForItemAtIndexPath:indexPath]; - cell.element = element; - ASCellNode *node = element.node; - if (node) { - [_rangeController configureContentView:cell.contentView forCellNode:node]; - } - - return cell; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - CGFloat height = 0.0; - - ASCollectionElement *element = [_dataController.visibleMap elementForItemAtIndexPath:indexPath]; - if (element != nil) { - ASCellNode *node = element.node; - ASDisplayNodeAssertNotNil(node, @"Node must not be nil!"); - height = [node layoutThatFits:element.constrainedSize].size.height; - } - -#if TARGET_OS_IOS - /** - * Weirdly enough, Apple expects the return value here to _include_ the height - * of the separator, if there is one! So if our node wants to be 43.5, we need - * to return 44. UITableView will make a cell of height 44 with a content view - * of height 43.5. - */ - if (tableView.separatorStyle != UITableViewCellSeparatorStyleNone) { - height += 1.0 / ASScreenScale(); - } -#endif - - return height; -} - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return _dataController.visibleMap.numberOfSections; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return [_dataController.visibleMap numberOfItemsInSection:section]; -} - -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view { - if (_asyncDataSourceFlags.modelIdentifierMethods) { - GET_TABLENODE_OR_RETURN(tableNode, nil); - NSIndexPath *convertedPath = [self convertIndexPathToTableNode:indexPath]; - if (convertedPath == nil) { - return nil; - } else { - return [_asyncDataSource modelIdentifierForElementAtIndexPath:convertedPath inNode:tableNode]; - } - } else { - return nil; - } -} - -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view { - if (_asyncDataSourceFlags.modelIdentifierMethods) { - GET_TABLENODE_OR_RETURN(tableNode, nil); - return [_asyncDataSource indexPathForElementWithModelIdentifier:identifier inNode:tableNode]; - } else { - return nil; - } -} - -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (_asyncDataSourceFlags.tableViewCanMoveRow) { - return [_asyncDataSource tableView:self canMoveRowAtIndexPath:indexPath]; - } else { - return NO; - } -} - -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath -{ - if (_asyncDataSourceFlags.tableViewMoveRow) { - [_asyncDataSource tableView:self moveRowAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; - } - - // Move node after informing data source in case they call nodeAtIndexPath: - // Get up to date - [self waitUntilAllUpdatesAreCommitted]; - // Set our flag to suppress informing super about the change. - _updatingInResponseToInteractiveMove = YES; - // Submit the move - [self moveRowAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath]; - // Wait for it to finish – should be fast! - [self waitUntilAllUpdatesAreCommitted]; - // Clear the flag - _updatingInResponseToInteractiveMove = NO; -} - -- (void)tableView:(UITableView *)tableView willDisplayCell:(_ASTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath -{ - ASCollectionElement *element = cell.element; - if (element) { - ASDisplayNodeAssertTrue([_dataController.visibleMap elementForItemAtIndexPath:indexPath] == element); - [_visibleElements addObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for willDisplayCell: %@, %@, %@", cell, self, indexPath); - return; - } - - ASCellNode *cellNode = element.node; - cellNode.scrollView = tableView; - - ASDisplayNodeAssertNotNil(cellNode, @"Expected node associated with cell that will be displayed not to be nil. indexPath: %@", indexPath); - - if (_asyncDelegateFlags.tableNodeWillDisplayNodeForRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - [_asyncDelegate tableNode:tableNode willDisplayRowWithNode:cellNode]; - } else if (_asyncDelegateFlags.tableViewWillDisplayNodeForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self willDisplayNode:cellNode forRowAtIndexPath:indexPath]; - } else if (_asyncDelegateFlags.tableViewWillDisplayNodeForRowDeprecated) { - [_asyncDelegate tableView:self willDisplayNodeForRowAtIndexPath:indexPath]; - } -#pragma clang diagnostic pop - - [_rangeController setNeedsUpdate]; - - if ([cell consumesCellNodeVisibilityEvents]) { - [_cellsForVisibilityUpdates addObject:cell]; - } -} - -- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(_ASTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Retrieve the element from cell instead of visible map because at this point visible map could have been updated and no longer holds the element. - ASCollectionElement *element = cell.element; - if (element) { - [_visibleElements removeObject:element]; - } else { - ASDisplayNodeAssert(NO, @"Unexpected nil element for didEndDisplayingCell: %@, %@, %@", cell, self, indexPath); - return; - } - - ASCellNode *cellNode = element.node; - - [_rangeController setNeedsUpdate]; - - ASDisplayNodeAssertNotNil(cellNode, @"Expected node associated with removed cell not to be nil."); - if (_asyncDelegateFlags.tableNodeDidEndDisplayingNodeForRow) { - if (ASTableNode *tableNode = self.tableNode) { - [_asyncDelegate tableNode:tableNode didEndDisplayingRowWithNode:cellNode]; - } - } else if (_asyncDelegateFlags.tableViewDidEndDisplayingNodeForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self didEndDisplayingNode:cellNode forRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - - [_cellsForVisibilityUpdates removeObject:cell]; - - cellNode.scrollView = nil; -} - -- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeWillSelectRow) { - GET_TABLENODE_OR_RETURN(tableNode, indexPath); - NSIndexPath *result = [self convertIndexPathToTableNode:indexPath]; - // If this item was is gone, just let the table view do its default behavior and select. - if (result == nil) { - return indexPath; - } else { - result = [_asyncDelegate tableNode:tableNode willSelectRowAtIndexPath:result]; - result = [self convertIndexPathFromTableNode:result waitingIfNeeded:YES]; - return result; - } - } else if (_asyncDelegateFlags.tableViewWillSelectRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate tableView:self willSelectRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } else { - return indexPath; - } -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeDidSelectRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate tableNode:tableNode didSelectRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewDidSelectRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self didSelectRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeWillDeselectRow) { - GET_TABLENODE_OR_RETURN(tableNode, indexPath); - NSIndexPath *result = [self convertIndexPathToTableNode:indexPath]; - // If this item was is gone, just let the table view do its default behavior and deselect. - if (result == nil) { - return indexPath; - } else { - result = [_asyncDelegate tableNode:tableNode willDeselectRowAtIndexPath:result]; - result = [self convertIndexPathFromTableNode:result waitingIfNeeded:YES]; - return result; - } - } else if (_asyncDelegateFlags.tableViewWillDeselectRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate tableView:self willDeselectRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return indexPath; -} - -- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeDidDeselectRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate tableNode:tableNode didDeselectRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewDidDeselectRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self didDeselectRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeShouldHighlightRow) { - GET_TABLENODE_OR_RETURN(tableNode, NO); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate tableNode:tableNode shouldHighlightRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewShouldHighlightRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate tableView:self shouldHighlightRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return YES; -} - -- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeDidHighlightRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate tableNode:tableNode didHighlightRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewDidHighlightRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self didHighlightRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeDidHighlightRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate tableNode:tableNode didUnhighlightRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewDidUnhighlightRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self didUnhighlightRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } -} - -- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - if (_asyncDelegateFlags.tableNodeShouldShowMenuForRow) { - GET_TABLENODE_OR_RETURN(tableNode, NO); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate tableNode:tableNode shouldShowMenuForRowAtIndexPath:indexPath]; - } - } else if (_asyncDelegateFlags.tableViewShouldShowMenuForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate tableView:self shouldShowMenuForRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } - return NO; -} - -- (BOOL)tableView:(UITableView *)tableView canPerformAction:(nonnull SEL)action forRowAtIndexPath:(nonnull NSIndexPath *)indexPath withSender:(nullable id)sender -{ - if (_asyncDelegateFlags.tableNodeCanPerformActionForRow) { - GET_TABLENODE_OR_RETURN(tableNode, NO); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - return [_asyncDelegate tableNode:tableNode canPerformAction:action forRowAtIndexPath:indexPath withSender:sender]; - } - } else if (_asyncDelegateFlags.tableViewCanPerformActionForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate tableView:self canPerformAction:action forRowAtIndexPath:indexPath withSender:sender]; -#pragma clang diagnostic pop - } - return NO; -} - -- (void)tableView:(UITableView *)tableView performAction:(nonnull SEL)action forRowAtIndexPath:(nonnull NSIndexPath *)indexPath withSender:(nullable id)sender -{ - if (_asyncDelegateFlags.tableNodePerformActionForRow) { - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - indexPath = [self convertIndexPathToTableNode:indexPath]; - if (indexPath != nil) { - [_asyncDelegate tableNode:tableNode performAction:action forRowAtIndexPath:indexPath withSender:sender]; - } - } else if (_asyncDelegateFlags.tableViewPerformActionForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_asyncDelegate tableView:self performAction:action forRowAtIndexPath:indexPath withSender:sender]; -#pragma clang diagnostic pop - } -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - if (scrollView != self && UITABLEVIEW_RESPONDS_TO_SELECTOR()) { - [super scrollViewDidScroll:scrollView]; - return; - } - ASInterfaceState interfaceState = [self interfaceStateForRangeController:_rangeController]; - if (ASInterfaceStateIncludesVisible(interfaceState)) { - [self _checkForBatchFetching]; - } - for (_ASTableViewCell *tableCell in _cellsForVisibilityUpdates) { - [[tableCell node] cellNodeVisibilityEvent:ASCellNodeVisibilityEventVisibleRectChanged - inScrollView:scrollView - withCellFrame:tableCell.frame]; - } - if (_asyncDelegateFlags.scrollViewDidScroll) { - [_asyncDelegate scrollViewDidScroll:scrollView]; - } -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset -{ - if (scrollView != self && UITABLEVIEW_RESPONDS_TO_SELECTOR()) { - [super scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset]; - return; - } - CGPoint contentOffset = scrollView.contentOffset; - _deceleratingVelocity = CGPointMake( - contentOffset.x - ((targetContentOffset != NULL) ? targetContentOffset->x : 0), - contentOffset.y - ((targetContentOffset != NULL) ? targetContentOffset->y : 0) - ); - - if (targetContentOffset != NULL) { - ASDisplayNodeAssert(_batchContext != nil, @"Batch context should exist"); - [self _beginBatchFetchingIfNeededWithContentOffset:*targetContentOffset velocity:velocity]; - } - - if (_asyncDelegateFlags.scrollViewWillEndDragging) { - [_asyncDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:(targetContentOffset ? : &contentOffset)]; - } -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView -{ - if (scrollView != self && UITABLEVIEW_RESPONDS_TO_SELECTOR()) { - [super scrollViewDidEndDecelerating:scrollView]; - return; - } - _deceleratingVelocity = CGPointZero; - - if (_asyncDelegateFlags.scrollViewDidEndDecelerating) { - [_asyncDelegate scrollViewDidEndDecelerating:scrollView]; - } -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - if (scrollView != self && UITABLEVIEW_RESPONDS_TO_SELECTOR()) { - [super scrollViewWillBeginDragging:scrollView]; - return; - } - // If a scroll happens the current range mode needs to go to full - _rangeController.contentHasBeenScrolled = YES; - [_rangeController updateCurrentRangeWithMode:ASLayoutRangeModeFull]; - - for (_ASTableViewCell *tableViewCell in _cellsForVisibilityUpdates) { - [[tableViewCell node] cellNodeVisibilityEvent:ASCellNodeVisibilityEventWillBeginDragging - inScrollView:scrollView - withCellFrame:tableViewCell.frame]; - } - if (_asyncDelegateFlags.scrollViewWillBeginDragging) { - [_asyncDelegate scrollViewWillBeginDragging:scrollView]; - } -} - -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate -{ - if (scrollView != self && UITABLEVIEW_RESPONDS_TO_SELECTOR()) { - [super scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; - return; - } - for (_ASTableViewCell *tableViewCell in _cellsForVisibilityUpdates) { - [[tableViewCell node] cellNodeVisibilityEvent:ASCellNodeVisibilityEventDidEndDragging - inScrollView:scrollView - withCellFrame:tableViewCell.frame]; - } - if (_asyncDelegateFlags.scrollViewDidEndDragging) { - [_asyncDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; - } -} - -#pragma mark - Misc - -- (BOOL)inverted -{ - return _inverted; -} - -- (void)setInverted:(BOOL)inverted -{ - _inverted = inverted; -} - -- (CGFloat)leadingScreensForBatching -{ - return _leadingScreensForBatching; -} - -- (void)setLeadingScreensForBatching:(CGFloat)leadingScreensForBatching -{ - if (_leadingScreensForBatching != leadingScreensForBatching) { - _leadingScreensForBatching = leadingScreensForBatching; - ASPerformBlockOnMainThread(^{ - [self _checkForBatchFetching]; - }); - } -} - -- (BOOL)automaticallyAdjustsContentOffset -{ - return _automaticallyAdjustsContentOffset; -} - -- (void)setAutomaticallyAdjustsContentOffset:(BOOL)automaticallyAdjustsContentOffset -{ - _automaticallyAdjustsContentOffset = automaticallyAdjustsContentOffset; -} - -#pragma mark - Scroll Direction - -- (ASScrollDirection)scrollDirection -{ - CGPoint scrollVelocity; - if (self.isTracking) { - scrollVelocity = [self.panGestureRecognizer velocityInView:self.superview]; - } else { - scrollVelocity = _deceleratingVelocity; - } - - ASScrollDirection scrollDirection = [self _scrollDirectionForVelocity:scrollVelocity]; - return ASScrollDirectionApplyTransform(scrollDirection, self.transform); -} - -- (ASScrollDirection)_scrollDirectionForVelocity:(CGPoint)scrollVelocity -{ - ASScrollDirection direction = ASScrollDirectionNone; - ASScrollDirection scrollableDirections = [self scrollableDirections]; - - if (ASScrollDirectionContainsVerticalDirection(scrollableDirections)) { // Can scroll vertically. - if (scrollVelocity.y < 0.0) { - direction |= ASScrollDirectionDown; - } else if (scrollVelocity.y > 0.0) { - direction |= ASScrollDirectionUp; - } - } - - return direction; -} - -- (ASScrollDirection)scrollableDirections -{ - ASScrollDirection scrollableDirection = ASScrollDirectionNone; - CGFloat totalContentWidth = self.contentSize.width + self.contentInset.left + self.contentInset.right; - CGFloat totalContentHeight = self.contentSize.height + self.contentInset.top + self.contentInset.bottom; - - if (self.alwaysBounceHorizontal || totalContentWidth > self.bounds.size.width) { // Can scroll horizontally. - scrollableDirection |= ASScrollDirectionHorizontalDirections; - } - if (self.alwaysBounceVertical || totalContentHeight > self.bounds.size.height) { // Can scroll vertically. - scrollableDirection |= ASScrollDirectionVerticalDirections; - } - return scrollableDirection; -} - - -#pragma mark - Batch Fetching - -- (ASBatchContext *)batchContext -{ - return _batchContext; -} - -- (BOOL)canBatchFetch -{ - // if the delegate does not respond to this method, there is no point in starting to fetch - BOOL canFetch = _asyncDelegateFlags.tableNodeWillBeginBatchFetch || _asyncDelegateFlags.tableViewWillBeginBatchFetch; - if (canFetch && _asyncDelegateFlags.shouldBatchFetchForTableNode) { - GET_TABLENODE_OR_RETURN(tableNode, NO); - return [_asyncDelegate shouldBatchFetchForTableNode:tableNode]; - } else if (canFetch && _asyncDelegateFlags.shouldBatchFetchForTableView) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDelegate shouldBatchFetchForTableView:self]; -#pragma clang diagnostic pop - } else { - return canFetch; - } -} - -- (id)batchFetchingDelegate -{ - return self.tableNode.batchFetchingDelegate; -} - -- (void)_scheduleCheckForBatchFetchingForNumberOfChanges:(NSUInteger)changes -{ - // Prevent fetching will continually trigger in a loop after reaching end of content and no new content was provided - if (changes == 0 && _hasEverCheckedForBatchFetchingDueToUpdate) { - return; - } - _hasEverCheckedForBatchFetchingDueToUpdate = YES; - - // Push this to the next runloop to be sure the scroll view has the right content size - dispatch_async(dispatch_get_main_queue(), ^{ - [self _checkForBatchFetching]; - }); -} - -- (void)_checkForBatchFetching -{ - // Dragging will be handled in scrollViewWillEndDragging:withVelocity:targetContentOffset: - if (self.isDragging || self.isTracking) { - return; - } - - [self _beginBatchFetchingIfNeededWithContentOffset:self.contentOffset velocity:CGPointZero]; -} - -- (void)_beginBatchFetchingIfNeededWithContentOffset:(CGPoint)contentOffset velocity:(CGPoint)velocity -{ - if (ASDisplayShouldFetchBatchForScrollView(self, self.scrollDirection, ASScrollDirectionVerticalDirections, contentOffset, velocity, NO)) { - [self _beginBatchFetching]; - } -} - -- (void)_beginBatchFetching -{ - [_batchContext beginBatchFetching]; - if (_asyncDelegateFlags.tableNodeWillBeginBatchFetch) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - GET_TABLENODE_OR_RETURN(tableNode, (void)0); - [self->_asyncDelegate tableNode:tableNode willBeginBatchFetchWithContext:self->_batchContext]; - }); - } else if (_asyncDelegateFlags.tableViewWillBeginBatchFetch) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self->_asyncDelegate tableView:self willBeginBatchFetchWithContext:self->_batchContext]; -#pragma clang diagnostic pop - }); - } -} - -#pragma mark - ASRangeControllerDataSource - -- (ASRangeController *)rangeController -{ - return _rangeController; -} - -- (NSHashTable *)visibleElementsForRangeController:(ASRangeController *)rangeController -{ - return ASPointerTableByFlatMapping(_visibleElements, id element, element); -} - -- (ASScrollDirection)scrollDirectionForRangeController:(ASRangeController *)rangeController -{ - return self.scrollDirection; -} - -- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController -{ - return ASInterfaceStateForDisplayNode(self.tableNode, self.window); -} - -- (NSString *)nameForRangeControllerDataSource -{ - return self.asyncDataSource ? NSStringFromClass([self.asyncDataSource class]) : NSStringFromClass([self class]); -} - -#pragma mark - ASRangeControllerDelegate - -- (BOOL)rangeControllerShouldUpdateRanges:(ASRangeController *)rangeController -{ - return YES; -} - -- (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates -{ - ASDisplayNodeAssertMainThread(); - if (!self.asyncDataSource || _updatingInResponseToInteractiveMove) { - updates(); - [changeSet executeCompletionHandlerWithFinished:NO]; - return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes - } - - if (changeSet.includesReloadData) { - LOG(@"UITableView reloadData"); - ASPerformBlockWithoutAnimation(!changeSet.animated, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super reloadData]"); - } - updates(); - [super reloadData]; - // Flush any range changes that happened as part of submitting the reload. - [self->_rangeController updateIfNeeded]; - [self _scheduleCheckForBatchFetchingForNumberOfChanges:1]; - [changeSet executeCompletionHandlerWithFinished:YES]; - }); - return; - } - - BOOL shouldAdjustContentOffset = (_automaticallyAdjustsContentOffset && !changeSet.includesReloadData); - if (shouldAdjustContentOffset) { - [self beginAdjustingContentOffset]; - } - - NSUInteger numberOfUpdates = 0; - - LOG(@"--- UITableView beginUpdates"); - [super beginUpdates]; - - updates(); - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeReload]) { - NSArray *indexPaths = change.indexPaths; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView reloadRows:%ld rows", indexPaths.count); - BOOL preventAnimation = animationOptions == UITableViewRowAnimationNone; - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super reloadRowsAtIndexPaths]: %@", indexPaths); - } - [super reloadRowsAtIndexPaths:indexPaths withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeReload]) { - NSIndexSet *sectionIndexes = change.indexSet; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView reloadSections:%@", sectionIndexes); - BOOL preventAnimation = (animationOptions == UITableViewRowAnimationNone); - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super reloadSections]: %@", sectionIndexes); - } - [super reloadSections:sectionIndexes withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeOriginalDelete]) { - NSArray *indexPaths = change.indexPaths; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView deleteRows:%ld rows", indexPaths.count); - BOOL preventAnimation = animationOptions == UITableViewRowAnimationNone; - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super deleteRowsAtIndexPaths]: %@", indexPaths); - } - [super deleteRowsAtIndexPaths:indexPaths withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeOriginalDelete]) { - NSIndexSet *sectionIndexes = change.indexSet; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView deleteSections:%@", sectionIndexes); - BOOL preventAnimation = (animationOptions == UITableViewRowAnimationNone); - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super deleteSections]: %@", sectionIndexes); - } - [super deleteSections:sectionIndexes withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeOriginalInsert]) { - NSIndexSet *sectionIndexes = change.indexSet; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView insertSections:%@", sectionIndexes); - BOOL preventAnimation = (animationOptions == UITableViewRowAnimationNone); - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super insertSections]: %@", sectionIndexes); - } - [super insertSections:sectionIndexes withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeOriginalInsert]) { - NSArray *indexPaths = change.indexPaths; - UITableViewRowAnimation animationOptions = (UITableViewRowAnimation)change.animationOptions; - - LOG(@"UITableView insertRows:%ld rows", indexPaths.count); - BOOL preventAnimation = (animationOptions == UITableViewRowAnimationNone); - ASPerformBlockWithoutAnimation(preventAnimation, ^{ - if (self.test_enableSuperUpdateCallLogging) { - NSLog(@"-[super insertRowsAtIndexPaths]: %@", indexPaths); - } - [super insertRowsAtIndexPaths:indexPaths withRowAnimation:animationOptions]; - }); - - numberOfUpdates++; - } - - LOG(@"--- UITableView endUpdates"); - ASPerformBlockWithoutAnimation(!changeSet.animated, ^{ - [super endUpdates]; - if (numberOfUpdates > 0 && ASActivateExperimentalFeature(ASExperimentalRangeUpdateOnChangesetUpdate)) { - [self->_rangeController setNeedsUpdate]; - } - [self->_rangeController updateIfNeeded]; - [self _scheduleCheckForBatchFetchingForNumberOfChanges:numberOfUpdates]; - }); - if (shouldAdjustContentOffset) { - [self endAdjustingContentOffsetAnimated:changeSet.animated]; - } - [changeSet executeCompletionHandlerWithFinished:YES]; -} - -#pragma mark - ASDataControllerSource - -- (BOOL)dataController:(ASDataController *)dataController shouldEagerlyLayoutNode:(ASCellNode *)node -{ - return YES; -} - -- (BOOL)dataControllerShouldSerializeNodeCreation:(ASDataController *)dataController -{ - return NO; -} - -- (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyProcessChangeSet:(_ASHierarchyChangeSet *)changeSet -{ - // Reload data is expensive, don't block main while doing so. - if (changeSet.includesReloadData) { - return NO; - } - // For more details on this method, see the comment in the ASCollectionView implementation. - if (changeSet.countForAsyncLayout < 2) { - return YES; - } - CGSize contentSize = self.contentSize; - CGSize boundsSize = self.bounds.size; - if (contentSize.height <= boundsSize.height && contentSize.width <= boundsSize.width) { - return YES; - } - return NO; -} - -- (void)dataControllerDidFinishWaiting:(ASDataController *)dataController -{ - // ASCellLayoutMode is not currently supported on ASTableView (see ASCollectionView for details). -} - -- (id)dataController:(ASDataController *)dataController nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath -{ - // Not currently supported for tables. Will be added when the collection API stabilizes. - return nil; -} - -- (ASCellNodeBlock)dataController:(ASDataController *)dataController nodeBlockAtIndexPath:(NSIndexPath *)indexPath shouldAsyncLayout:(BOOL *)shouldAsyncLayout -{ - ASCellNodeBlock block = nil; - - if (_asyncDataSourceFlags.tableNodeNodeBlockForRow) { - if (ASTableNode *tableNode = self.tableNode) { - block = [_asyncDataSource tableNode:tableNode nodeBlockForRowAtIndexPath:indexPath]; - } - } else if (_asyncDataSourceFlags.tableNodeNodeForRow) { - ASCellNode *node = nil; - if (ASTableNode *tableNode = self.tableNode) { - node = [_asyncDataSource tableNode:tableNode nodeForRowAtIndexPath:indexPath]; - } - if ([node isKindOfClass:[ASCellNode class]]) { - block = ^{ - return node; - }; - } else { - ASDisplayNodeFailAssert(@"Data source returned invalid node from tableNode:nodeForRowAtIndexPath:. Node: %@", node); - } - } else if (_asyncDataSourceFlags.tableViewNodeBlockForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - block = [_asyncDataSource tableView:self nodeBlockForRowAtIndexPath:indexPath]; - } else if (_asyncDataSourceFlags.tableViewNodeForRow) { - ASCellNode *node = [_asyncDataSource tableView:self nodeForRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - if ([node isKindOfClass:[ASCellNode class]]) { - block = ^{ - return node; - }; - } else { - ASDisplayNodeFailAssert(@"Data source returned invalid node from tableView:nodeForRowAtIndexPath:. Node: %@", node); - } - } - - // Handle nil node block - if (block == nil) { - ASDisplayNodeFailAssert(@"ASTableNode could not get a node block for row at index path %@", indexPath); - block = ^{ - return [[ASCellNode alloc] init]; - }; - } - - // Wrap the node block - __weak __typeof__(self) weakSelf = self; - return ^{ - __typeof__(self) strongSelf = weakSelf; - ASCellNode *node = (block != nil ? block() : [[ASCellNode alloc] init]); - ASDisplayNodeAssert([node isKindOfClass:[ASCellNode class]], @"ASTableNode provided a non-ASCellNode! %@, %@", node, strongSelf); - - [node enterHierarchyState:ASHierarchyStateRangeManaged]; - if (node.interactionDelegate == nil) { - node.interactionDelegate = strongSelf; - } - if (self->_inverted) { - node.transform = CATransform3DMakeScale(1, -1, 1) ; - } - return node; - }; - return block; -} - -- (ASSizeRange)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - ASSizeRange constrainedSize = ASSizeRangeZero; - if (_asyncDelegateFlags.tableNodeConstrainedSizeForRow) { - GET_TABLENODE_OR_RETURN(tableNode, constrainedSize); - ASSizeRange delegateConstrainedSize = [_asyncDelegate tableNode:tableNode constrainedSizeForRowAtIndexPath:indexPath]; - // ignore widths in the returned size range (for TableView) - constrainedSize = ASSizeRangeMake(CGSizeMake(_nodesConstrainedWidth, delegateConstrainedSize.min.height), - CGSizeMake(_nodesConstrainedWidth, delegateConstrainedSize.max.height)); - } else if (_asyncDelegateFlags.tableViewConstrainedSizeForRow) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - ASSizeRange delegateConstrainedSize = [_asyncDelegate tableView:self constrainedSizeForRowAtIndexPath:indexPath]; -#pragma clang diagnostic pop - // ignore widths in the returned size range (for TableView) - constrainedSize = ASSizeRangeMake(CGSizeMake(_nodesConstrainedWidth, delegateConstrainedSize.min.height), - CGSizeMake(_nodesConstrainedWidth, delegateConstrainedSize.max.height)); - } else { - constrainedSize = ASSizeRangeMake(CGSizeMake(_nodesConstrainedWidth, 0), - CGSizeMake(_nodesConstrainedWidth, CGFLOAT_MAX)); - } - return constrainedSize; -} - -- (NSUInteger)dataController:(ASDataController *)dataController rowsInSection:(NSUInteger)section -{ - if (_asyncDataSourceFlags.tableNodeNumberOfRowsInSection) { - GET_TABLENODE_OR_RETURN(tableNode, 0); - return [_asyncDataSource tableNode:tableNode numberOfRowsInSection:section]; - } else if (_asyncDataSourceFlags.tableViewNumberOfRowsInSection) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDataSource tableView:self numberOfRowsInSection:section]; -#pragma clang diagnostic pop - } else { - return 0; - } -} - -- (NSUInteger)numberOfSectionsInDataController:(ASDataController *)dataController -{ - if (_asyncDataSourceFlags.numberOfSectionsInTableNode) { - GET_TABLENODE_OR_RETURN(tableNode, 0); - return [_asyncDataSource numberOfSectionsInTableNode:tableNode]; - } else if (_asyncDataSourceFlags.numberOfSectionsInTableView) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [_asyncDataSource numberOfSectionsInTableView:self]; -#pragma clang diagnostic pop - } else { - return 1; // default section number - } -} - -- (BOOL)dataController:(ASDataController *)dataController presentedSizeForElement:(ASCollectionElement *)element matchesSize:(CGSize)size -{ - NSIndexPath *indexPath = [self indexPathForNode:element.node]; - if (indexPath == nil) { - ASDisplayNodeFailAssert(@"Data controller should not ask for presented size for element that is not presented."); - return YES; - } - CGRect rect = [self rectForRowAtIndexPath:indexPath]; - -#if TARGET_OS_IOS - /** - * Weirdly enough, Apple expects the return value in tableView:heightForRowAtIndexPath: to _include_ the height - * of the separator, if there is one! So if rectForRow would return 44.0 we need to use 43.5. - */ - if (self.separatorStyle != UITableViewCellSeparatorStyleNone) { - rect.size.height -= 1.0 / ASScreenScale(); - } -#endif - - return (fabs(rect.size.height - size.height) < FLT_EPSILON); -} - -#pragma mark - _ASTableViewCellDelegate - -- (void)didLayoutSubviewsOfTableViewCell:(_ASTableViewCell *)tableViewCell -{ - ASCellNode *node = tableViewCell.node; - if (node == nil || _asyncDataSource == nil) { - return; - } - - CGFloat contentViewWidth = tableViewCell.contentView.bounds.size.width; - ASSizeRange constrainedSize = node.constrainedSizeForCalculatedLayout; - - // Table view cells should always fill its content view width. - // Normally the content view width equals to the constrained size width (which equals to the table view width). - // If there is a mismatch between these values, for example after the table view entered or left editing mode, - // content view width is preferred and used to re-measure the cell node. - if (CGSizeEqualToSize(node.calculatedSize, CGSizeZero) == NO && contentViewWidth != constrainedSize.max.width) { - constrainedSize.min.width = contentViewWidth; - constrainedSize.max.width = contentViewWidth; - - // Re-measurement is done on main to ensure thread affinity. In the worst case, this is as fast as UIKit's implementation. - // - // Unloaded nodes *could* be re-measured off the main thread, but only with the assumption that content view width - // is the same for all cells (because there is no easy way to get that individual value before the node being assigned to a _ASTableViewCell). - // Also, in many cases, some nodes may not need to be re-measured at all, such as when user enters and then immediately leaves editing mode. - // To avoid premature optimization and making such assumption, as well as to keep ASTableView simple, re-measurement is strictly done on main. - CGSize oldSize = node.bounds.size; - const CGSize calculatedSize = [node layoutThatFits:constrainedSize].size; - node.frame = { .size = calculatedSize }; - - // After the re-measurement, set the new constrained size to the node's backing colleciton element. - node.collectionElement.constrainedSize = constrainedSize; - - // If the node height changed, trigger a height requery. - if (oldSize.height != calculatedSize.height) { - [self beginUpdates]; - [self endUpdatesAnimated:(ASDisplayNodeLayerHasAnimations(self.layer) == NO) completion:nil]; - } - } -} - -#pragma mark - ASCellNodeDelegate - -- (void)nodeSelectedStateDidChange:(ASCellNode *)node -{ - NSIndexPath *indexPath = [self indexPathForNode:node]; - if (indexPath) { - if (node.isSelected) { - [self selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; - } else { - [self deselectRowAtIndexPath:indexPath animated:NO]; - } - } -} - -- (void)nodeHighlightedStateDidChange:(ASCellNode *)node -{ - NSIndexPath *indexPath = [self indexPathForNode:node]; - if (indexPath) { - [self cellForRowAtIndexPath:indexPath].highlighted = node.isHighlighted; - } -} - -- (void)nodeDidInvalidateSize:(ASCellNode *)node -{ - [_cellsForLayoutUpdates addObject:node]; - [self setNeedsLayout]; -} - -// Cause UITableView to requery for the new height of this node -- (void)requeryNodeHeights -{ - _queuedNodeHeightUpdate = NO; - - [super beginUpdates]; - [super endUpdates]; -} - -#pragma mark - Helper Methods - -// Note: This is called every layout, and so it is very performance sensitive. -- (CGFloat)sectionIndexWidth -{ - // If they don't implement the methods, then there's no section index. - if (_asyncDataSourceFlags.sectionIndexMethods == NO) { - return 0; - } - - UIView *indexView = _sectionIndexView; - if (indexView.superview == self) { - return indexView.frame.size.width; - } - - CGRect bounds = self.bounds; - for (UIView *view in self.subviews) { - CGRect frame = view.frame; - // Section index is right-aligned and less than half-width. - if (CGRectGetMaxX(frame) == CGRectGetMaxX(bounds) && frame.size.width * 2 < bounds.size.width) { - _sectionIndexView = view; - return frame.size.width; - } - } - return 0; -} - -#pragma mark - _ASDisplayView behavior substitutions -// Need these to drive interfaceState so we know when we are visible, if not nested in another range-managing element. -// Because our superclass is a true UIKit class, we cannot also subclass _ASDisplayView. -- (void)willMoveToWindow:(UIWindow *)newWindow -{ - BOOL visible = (newWindow != nil); - ASDisplayNode *node = self.tableNode; - if (visible && !node.inHierarchy) { - [node __enterHierarchy]; - } -} - -- (void)didMoveToWindow -{ - BOOL visible = (self.window != nil); - ASDisplayNode *node = self.tableNode; - BOOL rangeControllerNeedsUpdate = ![node supportsRangeManagedInterfaceState];; - - if (!visible && node.inHierarchy) { - if (rangeControllerNeedsUpdate) { - rangeControllerNeedsUpdate = NO; - // Exit CellNodes first before Table to match UIKit behaviors (tear down bottom up). - // Although we have not yet cleared the interfaceState's Visible bit (this happens in __exitHierarchy), - // the ASRangeController will get the correct value from -interfaceStateForRangeController:. - [_rangeController updateRanges]; - } - [node __exitHierarchy]; - } - - // Updating the visible node index paths only for not range managed nodes. Range managed nodes will get their - // their update in the layout pass - if (rangeControllerNeedsUpdate) { - [_rangeController updateRanges]; - } - - // When we aren't visible, we will only fetch up to the visible area. Now that we are visible, - // we will fetch visible area + leading screens, so we need to check. - if (visible) { - [self _checkForBatchFetching]; - } -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - if (self.superview == nil && newSuperview != nil) { - _keepalive_node = self.tableNode; - } -} - -- (void)didMoveToSuperview -{ - if (self.superview == nil) { - _keepalive_node = nil; - } -} - -#pragma mark - Accessibility overrides - -- (NSArray *)accessibilityElements -{ - [self waitUntilAllUpdatesAreCommitted]; - return [super accessibilityElements]; -} - -@end diff --git a/Example/Pods/Texture/Source/ASTableViewInternal.h b/Example/Pods/Texture/Source/ASTableViewInternal.h deleted file mode 100644 index 35a55d4e..00000000 --- a/Example/Pods/Texture/Source/ASTableViewInternal.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// ASTableViewInternal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASDataController; -@class ASTableNode; -@class ASRangeController; - -@interface ASTableView (Internal) - -@property (nonatomic, readonly) ASDataController *dataController; -@property (nonatomic, weak) ASTableNode *tableNode; -@property (nonatomic, readonly) ASRangeController *rangeController; - -/** - * Initializer. - * - * @param frame A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. - * The frame of the table view changes as table cells are added and deleted. - * - * @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. - * - * @param dataControllerClass A controller class injected to and used to create a data controller for the table view. - */ -- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass owningNode:(ASTableNode *)tableNode; - -/// Set YES and we'll log every time we call [super insertRows…] etc -@property (nonatomic) BOOL test_enableSuperUpdateCallLogging; - -/** - * Attempt to get the view-layer index path for the row with the given index path. - * - * @param indexPath The index path of the row. - * @param wait If the item hasn't reached the view yet, this attempts to wait for updates to commit. - */ -- (NSIndexPath *)convertIndexPathFromTableNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait; - -/** - * Attempt to get the node index path given the view-layer index path. - * - * @param indexPath The index path of the row. - */ -- (NSIndexPath *)convertIndexPathToTableNode:(NSIndexPath *)indexPath; - -/** - * Attempt to get the node index paths given the view-layer index paths. - * - * @param indexPaths An array of index paths in the view space - */ -- (NSArray *)convertIndexPathsToTableNode:(NSArray *)indexPaths; - -/// Returns the width of the section index view on the right-hand side of the table, if one is present. -- (CGFloat)sectionIndexWidth; - -@end diff --git a/Example/Pods/Texture/Source/ASTableViewProtocols.h b/Example/Pods/Texture/Source/ASTableViewProtocols.h deleted file mode 100644 index ea392e2f..00000000 --- a/Example/Pods/Texture/Source/ASTableViewProtocols.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// ASTableViewProtocols.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * This is a subset of UITableViewDataSource. - * - * @see ASTableDataSource - */ -@protocol ASCommonTableDataSource - -@optional - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:numberOfRowsInSection: instead."); - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView ASDISPLAYNODE_DEPRECATED_MSG("Implement numberOfSectionsInTableNode: instead."); - -- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; -- (nullable NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath; - -- (nullable NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; -- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; - -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; - -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath; - -@end - - -/** - * This is a subset of UITableViewDelegate. - * - * @see ASTableDelegate - */ -@protocol ASCommonTableViewDelegate - -@optional - -- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section; -- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section; -- (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section; -- (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section; - -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; - -- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; -- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; - -- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:shouldHighlightRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didHighlightRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didUnhighlightRowAtIndexPath: instead."); - -- (nullable NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:willSelectRowAtIndexPath: instead."); -- (nullable NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:willDeselectRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didSelectRowAtIndexPath: instead."); -- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:didDeselectRowAtIndexPath: instead."); - -- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; -- (nullable NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath; -#if TARGET_OS_IOS -- (nullable NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath API_DEPRECATED_WITH_REPLACEMENT("tableView:trailingSwipeActionsConfigurationForRowAtIndexPath:", ios(8.0, 13.0)); -- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)); -- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)); -- (nullable UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point API_AVAILABLE(ios(13.0)); -- (nullable UITargetedPreview *)tableView:(UITableView *)tableView previewForHighlightingContextMenuWithConfiguration:(UIContextMenuConfiguration *)configuration API_AVAILABLE(ios(13.0)); -- (nullable UITargetedPreview *)tableView:(UITableView *)tableView previewForDismissingContextMenuWithConfiguration:(UIContextMenuConfiguration *)configuration API_AVAILABLE(ios(13.0)); -- (void)tableView:(UITableView *)tableView willPerformPreviewActionForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration animator:(id)animator API_AVAILABLE(ios(13.0)); -#endif -- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; - -- (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath; -- (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath; - -- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath; - -- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; - -- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:shouldShowMenuForRowAtIndexPath: instead."); -- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:canPerformAction:forRowAtIndexPath:withSender: instead."); -- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(nullable id)sender ASDISPLAYNODE_DEPRECATED_MSG("Implement -tableNode:performAction:forRowAtIndexPath:withSender: instead."); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTextNode+Beta.h b/Example/Pods/Texture/Source/ASTextNode+Beta.h deleted file mode 100644 index ad897c5f..00000000 --- a/Example/Pods/Texture/Source/ASTextNode+Beta.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASTextNode+Beta.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASTextNode () - -/** - @abstract An array of descending scale factors that will be applied to this text node to try to make it fit within its constrained size - @discussion This array should be in descending order and NOT contain the scale factor 1.0. For example, it could return @[@(.9), @(.85), @(.8)]; - @default nil (no scaling) - */ -@property (nullable, nonatomic, copy) NSArray *pointSizeScaleFactors; - -/** - @abstract Text margins for text laid out in the text node. - @discussion defaults to UIEdgeInsetsZero. - This property can be useful for handling text which does not fit within the view by default. An example: like UILabel, - ASTextNode will clip the left and right of the string "judar" if it's rendered in an italicised font. - */ -@property (nonatomic) UIEdgeInsets textContainerInset; - -/** - * Returns YES if this node is using the experimental implementation. NO otherwise. Will not change. - */ -@property (readonly) BOOL usingExperiment; - -/** - * Returns a Boolean indicating if the text node will truncate for the given constrained size - */ -- (BOOL)shouldTruncateForConstrainedSize:(ASSizeRange)constrainedSize; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASTextNode.h b/Example/Pods/Texture/Source/ASTextNode.h deleted file mode 100644 index b05a1d54..00000000 --- a/Example/Pods/Texture/Source/ASTextNode.h +++ /dev/null @@ -1,278 +0,0 @@ -// -// ASTextNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#if (!AS_ENABLE_TEXTNODE) - -// Pull in ASTextNode2 to replace ASTextNode with ASTextNode2 -#import - -#else - -NS_ASSUME_NONNULL_BEGIN - -/** - @abstract Draws interactive rich text. - @discussion Backed by TextKit. - */ -@interface ASTextNode : ASControlNode - -/** - @abstract The styled text displayed by the node. - @discussion Defaults to nil, no text is shown. - For inline image attachments, add an attribute of key NSAttachmentAttributeName, with a value of an NSTextAttachment. - */ -@property (nullable, copy) NSAttributedString *attributedText; - -#pragma mark - Truncation - -/** - @abstract The attributedText to use when the text must be truncated. - @discussion Defaults to a localized ellipsis character. - */ -@property (nullable, copy) NSAttributedString *truncationAttributedText; - -/** - @summary The second attributed string appended for truncation. - @discussion This string will be highlighted on touches. - @default nil - */ -@property (nullable, copy) NSAttributedString *additionalTruncationMessage; - -/** - @abstract Determines how the text is truncated to fit within the receiver's maximum size. - @discussion Defaults to NSLineBreakByWordWrapping. - @note Setting a truncationMode in attributedString will override the truncation mode set here. - */ -@property NSLineBreakMode truncationMode; - -/** - @abstract If the text node is truncated. Text must have been sized first. - */ -@property (readonly, getter=isTruncated) BOOL truncated; - -/** - @abstract The maximum number of lines to render of the text before truncation. - @default 0 (No limit) - */ -@property NSUInteger maximumNumberOfLines; - -/** - @abstract The number of lines in the text. Text must have been sized first. - */ -@property (readonly) NSUInteger lineCount; - -/** - * An array of path objects representing the regions where text should not be displayed. - * - * @discussion The default value of this property is an empty array. You can - * assign an array of UIBezierPath objects to exclude text from one or more regions in - * the text node's bounds. You can use this property to have text wrap around images, - * shapes or other text like a fancy magazine. - */ -@property (nullable, copy) NSArray *exclusionPaths; - -#pragma mark - Placeholders - -/** - * @abstract ASTextNode has a special placeholder behavior when placeholderEnabled is YES. - * - * @discussion Defaults to NO. When YES, it draws rectangles for each line of text, - * following the true shape of the text's wrapping. This visually mirrors the overall - * shape and weight of paragraphs, making the appearance of the finished text less jarring. - */ -@property BOOL placeholderEnabled; - -/** - @abstract The placeholder color. - */ -@property (nullable, copy) UIColor *placeholderColor; - -/** - @abstract Inset each line of the placeholder. - */ -@property UIEdgeInsets placeholderInsets; - -#pragma mark - Shadow - -/** - @abstract When you set these ASDisplayNode properties, they are composited into the bitmap instead of being applied by CA. - - @property (nonatomic) CGColorRef shadowColor; - @property (nonatomic) CGFloat shadowOpacity; - @property (nonatomic) CGSize shadowOffset; - @property (nonatomic) CGFloat shadowRadius; - */ - -/** - @abstract The number of pixels used for shadow padding on each side of the receiver. - @discussion Each inset will be less than or equal to zero, so that applying - UIEdgeInsetsRect(boundingRectForText, shadowPadding) - will return a CGRect large enough to fit both the text and the appropriate shadow padding. - */ -@property (readonly) UIEdgeInsets shadowPadding; - -#pragma mark - Positioning - -/** - @abstract Returns an array of rects bounding the characters in a given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion Use this method to detect all the different rectangles a given range of text occupies. - The rects returned are not guaranteed to be contiguous (for example, if the given text range spans - a line break, the rects returned will be on opposite sides and different lines). The rects returned - are in the coordinate system of the receiver. - */ -- (NSArray *)rectsForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns an array of rects used for highlighting the characters in a given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion Use this method to detect all the different rectangles the highlights of a given range of text occupies. - The rects returned are not guaranteed to be contiguous (for example, if the given text range spans - a line break, the rects returned will be on opposite sides and different lines). The rects returned - are in the coordinate system of the receiver. This method is useful for visual coordination with a - highlighted range of text. - */ -- (NSArray *)highlightRectsForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns a bounding rect for the given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion The height of the frame returned is that of the receiver's line-height; adjustment for - cap-height and descenders is not performed. This method raises an exception if textRange is not - a valid substring range of the receiver's string. - */ -- (CGRect)frameForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns the trailing rectangle of space in the receiver, after the final character. - @discussion Use this method to detect which portion of the receiver is not occupied by characters. - The rect returned is in the coordinate system of the receiver. - */ -- (CGRect)trailingRect AS_WARN_UNUSED_RESULT; - - -#pragma mark - Actions - -/** - @abstract The set of attribute names to consider links. Defaults to NSLinkAttributeName. - */ -@property (copy) NSArray *linkAttributeNames; - -/** - @abstract Indicates whether the receiver has an entity at a given point. - @param point The point, in the receiver's coordinate system. - @param attributeNameOut The name of the attribute at the point. Can be NULL. - @param rangeOut The ultimate range of the found text. Can be NULL. - @result YES if an entity exists at `point`; NO otherwise. - */ -- (nullable id)linkAttributeValueAtPoint:(CGPoint)point attributeName:(out NSString * _Nullable * _Nullable)attributeNameOut range:(out NSRange * _Nullable)rangeOut AS_WARN_UNUSED_RESULT; - -/** - @abstract The style to use when highlighting text. - */ -@property ASTextNodeHighlightStyle highlightStyle; - -/** - @abstract The range of text highlighted by the receiver. Changes to this property are not animated by default. - */ -@property NSRange highlightRange; - -/** - @abstract Set the range of text to highlight, with optional animation. - - @param highlightRange The range of text to highlight. - - @param animated Whether the text should be highlighted with an animation. - */ -- (void)setHighlightRange:(NSRange)highlightRange animated:(BOOL)animated; - -/** - @abstract Responds to actions from links in the text node. - @discussion The delegate must be set before the node is loaded, and implement - textNode:longPressedLinkAttribute:value:atPoint:textRange: in order for - the long press gesture recognizer to be installed. - */ -@property (nullable, weak) id delegate; - -/** - @abstract If YES and a long press is recognized, touches are cancelled. Default is NO - */ -@property (nonatomic) BOOL longPressCancelsTouches; - -/** - @abstract if YES will not intercept touches for non-link areas of the text. Default is NO. - @discussion If you still want to handle tap truncation action when passthroughNonlinkTouches is YES, - you should set the alwaysHandleTruncationTokenTap to YES. - */ -@property (nonatomic) BOOL passthroughNonlinkTouches; - -/** - @abstract Always handle tap truncationAction, even the passthroughNonlinkTouches is YES. Default is NO. - @discussion if this is set to YES, the [ASTextNodeDelegate textNodeTappedTruncationToken:] callback will be called. - */ -@property (nonatomic) BOOL alwaysHandleTruncationTokenTap; - -/** - @abstract if YES will use the value of `self.tintColor` if the foreground color of text is not defined. - @discussion This is mainly used from ASButtonNode since by default text nodes do not respect tintColor settings unless contained within a interactive control - */ -@property (nonatomic) BOOL textColorFollowsTintColor; - -@end - -@interface ASTextNode (Unavailable) - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end - -/** - * @abstract Text node unsupported properties - */ -@interface ASTextNode (Unsupported) - -@property (nullable, nonatomic) id textContainerLinePositionModifier; - -@end - -/** - * @abstract Text node deprecated properties - */ -@interface ASTextNode (Deprecated) - -/** - The attributedString and attributedText properties are equivalent, but attributedText is now the standard API - name in order to match UILabel and ASEditableTextNode. - - @see attributedText - */ -@property (nullable, copy) NSAttributedString *attributedString ASDISPLAYNODE_DEPRECATED_MSG("Use .attributedText instead."); - - -/** - The truncationAttributedString and truncationAttributedText properties are equivalent, but truncationAttributedText is now the - standard API name in order to match UILabel and ASEditableTextNode. - - @see truncationAttributedText - */ -@property (nullable, copy) NSAttributedString *truncationAttributedString ASDISPLAYNODE_DEPRECATED_MSG("Use .truncationAttributedText instead."); - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/ASTextNode.mm b/Example/Pods/Texture/Source/ASTextNode.mm deleted file mode 100644 index 8df44266..00000000 --- a/Example/Pods/Texture/Source/ASTextNode.mm +++ /dev/null @@ -1,1561 +0,0 @@ -// -// ASTextNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -#import - -#import -#import - -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import - -#import -#import - -/** - * If set, we will record all values set to attributedText into an array - * and once we get 2000, we'll write them all out into a plist file. - * - * This is useful for gathering realistic text data sets from apps for performance - * testing. - */ -#define AS_TEXTNODE_RECORD_ATTRIBUTED_STRINGS 0 - -static const NSTimeInterval ASTextNodeHighlightFadeOutDuration = 0.15; -static const NSTimeInterval ASTextNodeHighlightFadeInDuration = 0.1; -static const CGFloat ASTextNodeHighlightLightOpacity = 0.11; -static const CGFloat ASTextNodeHighlightDarkOpacity = 0.22; -static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncationAttribute"; - -#pragma mark - ASTextKitRenderer - -@interface ASTextNodeRendererKey : NSObject -- (instancetype)initWithTextKitAttributes:(const ASTextKitAttributes &)attributes constrainedSize:(const CGSize)constrainedSize; -@end - -@implementation ASTextNodeRendererKey { - ASTextKitAttributes _attributes; - CGSize _constrainedSize; -} - -- (instancetype)initWithTextKitAttributes:(const ASTextKitAttributes &)attributes constrainedSize:(const CGSize)constrainedSize -{ - if (self = [super init]) { - _attributes = attributes; - _constrainedSize = constrainedSize; - } - return self; -} - -- (NSUInteger)hash -{ -#pragma clang diagnostic push -#pragma clang diagnostic warning "-Wpadded" - struct { - size_t attributesHash; - CGSize constrainedSize; -#pragma clang diagnostic pop - } data = { - _attributes.hash(), - _constrainedSize - }; - return ASHashBytes(&data, sizeof(data)); -} - -- (BOOL)isEqual:(ASTextNodeRendererKey *)object -{ - if (self == object) { - return YES; - } - if (!object) { - return NO; - } - // NOTE: Skip the class check for this specialized, internal Key object. - - return _attributes == object->_attributes && CGSizeEqualToSize(_constrainedSize, object->_constrainedSize); -} - -@end - -static NSCache *sharedRendererCache() -{ - static dispatch_once_t onceToken; - static NSCache *__rendererCache = nil; - dispatch_once(&onceToken, ^{ - __rendererCache = [[NSCache alloc] init]; - __rendererCache.countLimit = 500; // 500 renders cache - }); - return __rendererCache; -} - -/** - The concept here is that neither the node nor layout should ever have a strong reference to the renderer object. - This is to reduce memory load when loading thousands and thousands of text nodes into memory at once. Instead - we maintain a LRU renderer cache that is queried via a unique key based on text kit attributes and constrained size. - */ - -static ASTextKitRenderer *rendererForAttributes(ASTextKitAttributes attributes, CGSize constrainedSize) -{ - NSCache *cache = sharedRendererCache(); - - ASTextNodeRendererKey *key = [[ASTextNodeRendererKey alloc] initWithTextKitAttributes:attributes constrainedSize:constrainedSize]; - - ASTextKitRenderer *renderer = [cache objectForKey:key]; - if (renderer == nil) { - renderer = [[ASTextKitRenderer alloc] initWithTextKitAttributes:attributes constrainedSize:constrainedSize]; - [cache setObject:renderer forKey:key]; - } - - return renderer; -} - -#pragma mark - ASTextNodeDrawParameter - -@interface ASTextNodeDrawParameter : NSObject { -@package - ASTextKitAttributes _rendererAttributes; - UIColor *_backgroundColor; - UIEdgeInsets _textContainerInsets; - CGFloat _contentScale; - BOOL _opaque; - CGRect _bounds; - ASPrimitiveTraitCollection _traitCollection; - ASDisplayNodeContextModifier _willDisplayNodeContentWithRenderingContext; - ASDisplayNodeContextModifier _didDisplayNodeContentWithRenderingContext; -} -@end - -@implementation ASTextNodeDrawParameter - -- (instancetype)initWithRendererAttributes:(ASTextKitAttributes)rendererAttributes - backgroundColor:(/*nullable*/ UIColor *)backgroundColor - textContainerInsets:(UIEdgeInsets)textContainerInsets - contentScale:(CGFloat)contentScale - opaque:(BOOL)opaque - bounds:(CGRect)bounds - traitCollection:(ASPrimitiveTraitCollection)traitCollection -willDisplayNodeContentWithRenderingContext:(ASDisplayNodeContextModifier)willDisplayNodeContentWithRenderingContext - didDisplayNodeContentWithRenderingContext:(ASDisplayNodeContextModifier)didDisplayNodeContentWithRenderingContext -{ - self = [super init]; - if (self != nil) { - _rendererAttributes = rendererAttributes; - _backgroundColor = backgroundColor; - _textContainerInsets = textContainerInsets; - _contentScale = contentScale; - _opaque = opaque; - _bounds = bounds; - _traitCollection = traitCollection; - _willDisplayNodeContentWithRenderingContext = willDisplayNodeContentWithRenderingContext; - _didDisplayNodeContentWithRenderingContext = didDisplayNodeContentWithRenderingContext; - } - return self; -} - -- (ASTextKitRenderer *)rendererForBounds:(CGRect)bounds -{ - CGRect rect = UIEdgeInsetsInsetRect(bounds, _textContainerInsets); - return rendererForAttributes(_rendererAttributes, rect.size); -} - -@end - - -#pragma mark - ASTextNode - -@interface ASTextNode () - -@end - -@implementation ASTextNode { - CGSize _shadowOffset; - CGColorRef _shadowColor; - UIColor *_cachedShadowUIColor; - UIColor *_cachedTintColor; - UIColor *_placeholderColor; - CGFloat _shadowOpacity; - CGFloat _shadowRadius; - - UIEdgeInsets _textContainerInset; - - NSArray *_exclusionPaths; - - NSAttributedString *_attributedText; - NSAttributedString *_truncationAttributedText; - NSAttributedString *_additionalTruncationMessage; - NSAttributedString *_composedTruncationText; - NSArray *_pointSizeScaleFactors; - NSLineBreakMode _truncationMode; - - NSUInteger _maximumNumberOfLines; - - NSString *_highlightedLinkAttributeName; - id _highlightedLinkAttributeValue; - NSRange _highlightRange; - ASHighlightOverlayLayer *_activeHighlightLayer; - - UILongPressGestureRecognizer *_longPressGestureRecognizer; - ASTextNodeHighlightStyle _highlightStyle; - BOOL _longPressCancelsTouches; - BOOL _passthroughNonlinkTouches; - BOOL _alwaysHandleTruncationTokenTap; -} -@dynamic placeholderEnabled; - -static NSArray *DefaultLinkAttributeNames() { - static NSArray *names; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - names = @[ NSLinkAttributeName ]; - }); - return names; -} - -- (instancetype)init -{ - if (self = [super init]) { - // Load default values from superclass. - _shadowOffset = [super shadowOffset]; - _shadowColor = CGColorRetain([super shadowColor]); - _shadowOpacity = [super shadowOpacity]; - _shadowRadius = [super shadowRadius]; - - // Disable user interaction for text node by default. - self.userInteractionEnabled = NO; - self.needsDisplayOnBoundsChange = YES; - - _truncationMode = NSLineBreakByWordWrapping; - - // The common case is for a text node to be non-opaque and blended over some background. - self.opaque = NO; - self.backgroundColor = [UIColor clearColor]; - - self.linkAttributeNames = DefaultLinkAttributeNames(); - - // Accessibility - self.isAccessibilityElement = YES; - self.accessibilityTraits = self.defaultAccessibilityTraits; - - // Placeholders - // Disabled by default in ASDisplayNode, but add a few options for those who toggle - // on the special placeholder behavior of ASTextNode. - _placeholderColor = ASDisplayNodeDefaultPlaceholderColor(); - _placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0); - - // Tint color is applied when text nodes are within controls and indicate user action - // Most text nodes do not require interaction and this matches the default value of UILabel - _textColorFollowsTintColor = NO; - } - - return self; -} - -- (void)dealloc -{ - CGColorRelease(_shadowColor); -} - -- (BOOL)usingExperiment -{ - return NO; -} - -#pragma mark - Description - -- (NSString *)_plainStringForDescription -{ - NSString *plainString = [[self.attributedText string] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - if (plainString.length > 50) { - plainString = [[plainString substringToIndex:50] stringByAppendingString:@"\u2026"]; - } - return plainString; -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [super propertiesForDescription]; - NSString *plainString = [self _plainStringForDescription]; - if (plainString.length > 0) { - [result addObject:@{ (id)kCFNull : ASStringWithQuotesIfMultiword(plainString) }]; - } - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [super propertiesForDebugDescription]; - NSString *plainString = [self _plainStringForDescription]; - if (plainString.length > 0) { - [result insertObject:@{ @"text" : ASStringWithQuotesIfMultiword(plainString) } atIndex:0]; - } - return result; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - // If we are view-backed and the delegate cares, support the long-press callback. - SEL longPressCallback = @selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:); - if (!self.isLayerBacked && [_delegate respondsToSelector:longPressCallback]) { - _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_handleLongPress:)]; - _longPressGestureRecognizer.cancelsTouchesInView = self.longPressCancelsTouches; - _longPressGestureRecognizer.delegate = self; - [self.view addGestureRecognizer:_longPressGestureRecognizer]; - } -} - -- (BOOL)supportsLayerBacking -{ - if (!super.supportsLayerBacking) { - return NO; - } - - // If the text contains any links, return NO. - NSAttributedString *attributedText = self.attributedText; - NSRange range = NSMakeRange(0, attributedText.length); - for (NSString *linkAttributeName in _linkAttributeNames) { - __block BOOL hasLink = NO; - [attributedText enumerateAttribute:linkAttributeName inRange:range options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { - hasLink = (value != nil); - *stop = YES; - }]; - if (hasLink) { - return NO; - } - } - return YES; -} - -#pragma mark - Renderer Management - -- (ASTextKitRenderer *)_renderer -{ - ASLockScopeSelf(); - return [self _locked_renderer]; -} - -- (ASTextKitRenderer *)_rendererWithBounds:(CGRect)bounds -{ - ASLockScopeSelf(); - return [self _locked_rendererWithBounds:bounds]; -} - -- (ASTextKitRenderer *)_locked_renderer -{ - DISABLED_ASAssertLocked(__instanceLock__); - return [self _locked_rendererWithBounds:[self _locked_threadSafeBounds]]; -} - -- (ASTextKitRenderer *)_locked_rendererWithBounds:(CGRect)bounds -{ - DISABLED_ASAssertLocked(__instanceLock__); - bounds = UIEdgeInsetsInsetRect(bounds, _textContainerInset); - return rendererForAttributes([self _locked_rendererAttributes], bounds.size); -} - -- (ASTextKitAttributes)_locked_rendererAttributes -{ - DISABLED_ASAssertLocked(__instanceLock__); - return { - .attributedString = _attributedText, - .truncationAttributedString = [self _locked_composedTruncationText], - .lineBreakMode = _truncationMode, - .maximumNumberOfLines = _maximumNumberOfLines, - .exclusionPaths = _exclusionPaths, - // use the property getter so a subclass can provide these scale factors on demand if desired - .pointSizeScaleFactors = self.pointSizeScaleFactors, - .shadowOffset = _shadowOffset, - .shadowColor = _cachedShadowUIColor, - .shadowOpacity = _shadowOpacity, - .shadowRadius = _shadowRadius, - .tintColor = _cachedTintColor - }; -} - -- (NSString *)defaultAccessibilityLabel -{ - ASLockScopeSelf(); - return _attributedText.string; -} - -- (UIAccessibilityTraits)defaultAccessibilityTraits -{ - return UIAccessibilityTraitStaticText; -} - -#pragma mark - Layout and Sizing - -- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset -{ - if (ASLockedSelfCompareAssignCustom(_textContainerInset, textContainerInset, UIEdgeInsetsEqualToEdgeInsets)) { - [self setNeedsLayout]; - } -} - -- (UIEdgeInsets)textContainerInset -{ - return ASLockedSelf(_textContainerInset); -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - ASLockScopeSelf(); - - ASDisplayNodeAssert(constrainedSize.width >= 0, @"Constrained width for text (%f) is too narrow", constrainedSize.width); - ASDisplayNodeAssert(constrainedSize.height >= 0, @"Constrained height for text (%f) is too short", constrainedSize.height); - - // Cache the original constrained size for final size calculateion - CGSize originalConstrainedSize = constrainedSize; - - [self setNeedsDisplay]; - - ASTextKitRenderer *renderer = [self _locked_rendererWithBounds:{.size = constrainedSize}]; - CGSize size = renderer.size; - if (_attributedText.length > 0) { - self.style.ascender = [[self class] ascenderWithAttributedString:_attributedText]; - self.style.descender = [[_attributedText attribute:NSFontAttributeName atIndex:_attributedText.length - 1 effectiveRange:NULL] descender]; - if (renderer.currentScaleFactor > 0 && renderer.currentScaleFactor < 1.0) { - // while not perfect, this is a good estimate of what the ascender of the scaled font will be. - self.style.ascender *= renderer.currentScaleFactor; - self.style.descender *= renderer.currentScaleFactor; - } - } - - // Add the constrained size back textContainerInset - size.width += (_textContainerInset.left + _textContainerInset.right); - size.height += (_textContainerInset.top + _textContainerInset.bottom); - - return CGSizeMake(std::fmin(size.width, originalConstrainedSize.width), - std::fmin(size.height, originalConstrainedSize.height)); -} - -#pragma mark - Modifying User Text - -// Returns the ascender of the first character in attributedString by also including the line height if specified in paragraph style. -+ (CGFloat)ascenderWithAttributedString:(NSAttributedString *)attributedString -{ - UIFont *font = [attributedString attribute:NSFontAttributeName atIndex:0 effectiveRange:NULL]; - NSParagraphStyle *paragraphStyle = [attributedString attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:NULL]; - if (!paragraphStyle) { - return font.ascender; - } - CGFloat lineHeight = MAX(font.lineHeight, paragraphStyle.minimumLineHeight); - if (paragraphStyle.maximumLineHeight > 0) { - lineHeight = MIN(lineHeight, paragraphStyle.maximumLineHeight); - } - return lineHeight + font.descender; -} - -- (NSAttributedString *)attributedText -{ - ASLockScopeSelf(); - return _attributedText; -} - -- (void)setAttributedText:(NSAttributedString *)attributedText -{ - - if (attributedText == nil) { - attributedText = [[NSAttributedString alloc] initWithString:@"" attributes:nil]; - } - - NSAttributedString *oldAttributedText = nil; - - { - ASLockScopeSelf(); - if (ASObjectIsEqual(attributedText, _attributedText)) { - return; - } - - oldAttributedText = _attributedText; - - NSAttributedString *cleanedAttributedString = ASCleanseAttributedStringOfCoreTextAttributes(attributedText); - - // Invalidating the truncation text must be done while we still hold the lock. Because after we release it, - // another thread may set a new truncation text that will then be cleared by this thread, other may draw - // this soon-to-be-invalidated text. - [self _locked_invalidateTruncationText]; - - NSUInteger length = cleanedAttributedString.length; - if (length > 0) { - // Updating ascender and descender in one transaction while holding the lock. - ASLayoutElementStyle *style = [self _locked_style]; - style.ascender = [[self class] ascenderWithAttributedString:cleanedAttributedString]; - style.descender = [[attributedText attribute:NSFontAttributeName atIndex:cleanedAttributedString.length - 1 effectiveRange:NULL] descender]; - } - - // Update attributed text with cleaned attributed string - _attributedText = cleanedAttributedString; - } - - // Tell the display node superclasses that the cached layout is incorrect now - [self setNeedsLayout]; - - // Force display to create renderer with new size and redisplay with new string - [self setNeedsDisplay]; - - // Accessiblity - const auto currentAttributedText = self.attributedText; // Grab attributed string again in case it changed in the meantime - self.accessibilityLabel = self.defaultAccessibilityLabel; - - // We update the isAccessibilityElement setting if this node is not switching between strings. - if (oldAttributedText.length == 0 || currentAttributedText.length == 0) { - // We're an accessibility element by default if there is a string. - self.isAccessibilityElement = (currentAttributedText.length != 0); - } - -#if AS_TEXTNODE_RECORD_ATTRIBUTED_STRINGS - [ASTextNode _registerAttributedText:_attributedText]; -#endif -} - -#pragma mark - Text Layout - -- (void)setExclusionPaths:(NSArray *)exclusionPaths -{ - if (ASLockedSelfCompareAssignCopy(_exclusionPaths, exclusionPaths)) { - [self setNeedsLayout]; - [self setNeedsDisplay]; - } -} - -- (NSArray *)exclusionPaths -{ - return ASLockedSelf(_exclusionPaths); -} - -#pragma mark - Drawing - -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - /// have to access tintColor outside of the lock to prevent dead lock when accessing up the view hierarchy - UIColor *tintColor = self.tintColor; - ASLockScopeSelf(); - if (_textColorFollowsTintColor) { - _cachedTintColor = tintColor; - } else { - _cachedTintColor = nil; - } - return [[ASTextNodeDrawParameter alloc] initWithRendererAttributes:[self _locked_rendererAttributes] - backgroundColor:self.backgroundColor - textContainerInsets:_textContainerInset - contentScale:_contentsScaleForDisplay - opaque:self.isOpaque - bounds:[self threadSafeBounds] - traitCollection:self.primitiveTraitCollection - willDisplayNodeContentWithRenderingContext:self.willDisplayNodeContentWithRenderingContext - didDisplayNodeContentWithRenderingContext:self.didDisplayNodeContentWithRenderingContext]; -} - -+ (UIImage *)displayWithParameters:(id)parameters isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelled -{ - ASTextNodeDrawParameter *drawParameter = (ASTextNodeDrawParameter *)parameters; - - if (drawParameter->_bounds.size.width <= 0 || drawParameter->_bounds.size.height <= 0) { - return nil; - } - - UIColor *backgroundColor = drawParameter->_backgroundColor; - UIEdgeInsets textContainerInsets = drawParameter ? drawParameter->_textContainerInsets : UIEdgeInsetsZero; - ASTextKitRenderer *renderer = [drawParameter rendererForBounds:drawParameter->_bounds]; - ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext = drawParameter->_willDisplayNodeContentWithRenderingContext; - ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext = drawParameter->_didDisplayNodeContentWithRenderingContext; - - UIImage *result = ASGraphicsCreateImage(drawParameter->_traitCollection, CGSizeMake(drawParameter->_bounds.size.width, drawParameter->_bounds.size.height), drawParameter->_opaque, drawParameter->_contentScale, nil, nil, ^{ - CGContextRef context = UIGraphicsGetCurrentContext(); - ASDisplayNodeAssert(context, @"This is no good without a context."); - - CGContextSaveGState(context); - - if (context && willDisplayNodeContentWithRenderingContext) { - willDisplayNodeContentWithRenderingContext(context, drawParameter); - } - - CGContextTranslateCTM(context, textContainerInsets.left, textContainerInsets.top); - - // Fill background - if (backgroundColor != nil) { - [backgroundColor setFill]; - UIRectFillUsingBlendMode(CGContextGetClipBoundingBox(context), kCGBlendModeCopy); - } - - - // Draw text - [renderer drawInContext:context bounds:drawParameter->_bounds]; - - if (context && didDisplayNodeContentWithRenderingContext) { - didDisplayNodeContentWithRenderingContext(context, drawParameter); - } - - CGContextRestoreGState(context); - }); - - return result; -} - -#pragma mark - Attributes - -- (id)linkAttributeValueAtPoint:(CGPoint)point - attributeName:(out NSString **)attributeNameOut - range:(out NSRange *)rangeOut -{ - return [self _linkAttributeValueAtPoint:point - attributeName:attributeNameOut - range:rangeOut - inAdditionalTruncationMessage:NULL - forHighlighting:NO]; -} - -- (id)_linkAttributeValueAtPoint:(CGPoint)point - attributeName:(out NSString * __autoreleasing *)attributeNameOut - range:(out NSRange *)rangeOut - inAdditionalTruncationMessage:(out BOOL *)inAdditionalTruncationMessageOut - forHighlighting:(BOOL)highlighting -{ - ASDisplayNodeAssertMainThread(); - - ASLockScopeSelf(); - - ASTextKitRenderer *renderer = [self _locked_renderer]; - NSRange visibleRange = renderer.firstVisibleRange; - NSAttributedString *attributedString = _attributedText; - NSRange clampedRange = NSIntersectionRange(visibleRange, NSMakeRange(0, attributedString.length)); - - // Check in a 9-point region around the actual touch point so we make sure - // we get the best attribute for the touch. - __block CGFloat minimumGlyphDistance = CGFLOAT_MAX; - - // Final output vars - __block id linkAttributeValue = nil; - __block BOOL inTruncationMessage = NO; - - [renderer enumerateTextIndexesAtPosition:point usingBlock:^(NSUInteger characterIndex, CGRect glyphBoundingRect, BOOL *stop) { - CGPoint glyphLocation = CGPointMake(CGRectGetMidX(glyphBoundingRect), CGRectGetMidY(glyphBoundingRect)); - CGFloat currentDistance = std::sqrt(std::pow(point.x - glyphLocation.x, 2.f) + std::pow(point.y - glyphLocation.y, 2.f)); - if (currentDistance >= minimumGlyphDistance) { - // If the distance computed from the touch to the glyph location is - // not the minimum among the located link attributes, we can just skip - // to the next location. - return; - } - - // Check if it's outside the visible range, if so, then we mark this touch - // as inside the truncation message, because in at least one of the touch - // points it was. - if (!(NSLocationInRange(characterIndex, visibleRange))) { - inTruncationMessage = YES; - } - - if (inAdditionalTruncationMessageOut != NULL) { - *inAdditionalTruncationMessageOut = inTruncationMessage; - } - - // Short circuit here if it's just in the truncation message. Since the - // truncation message may be beyond the scope of the actual input string, - // we have to make sure that we don't start asking for attributes on it. - if (inTruncationMessage) { - return; - } - - for (NSString *attributeName in self->_linkAttributeNames) { - NSRange range; - id value = [attributedString attribute:attributeName atIndex:characterIndex longestEffectiveRange:&range inRange:clampedRange]; - NSString *name = attributeName; - - if (value == nil || name == nil) { - // Didn't find anything - continue; - } - - // If highlighting, check with delegate first. If not implemented, assume YES. - if (highlighting - && [self->_delegate respondsToSelector:@selector(textNode:shouldHighlightLinkAttribute:value:atPoint:)] - && ![self->_delegate textNode:self shouldHighlightLinkAttribute:name value:value atPoint:point]) { - value = nil; - name = nil; - } - - if (value != nil || name != nil) { - // We found a minimum glyph distance link attribute, so set the min - // distance, and the out params. - minimumGlyphDistance = currentDistance; - - if (rangeOut != NULL && value != nil) { - *rangeOut = range; - // Limit to only the visible range, because the attributed string will - // return values outside the visible range. - if (NSMaxRange(*rangeOut) > NSMaxRange(visibleRange)) { - (*rangeOut).length = MAX(NSMaxRange(visibleRange) - (*rangeOut).location, 0); - } - } - - if (attributeNameOut != NULL) { - *attributeNameOut = name; - } - - // Set the values for the next iteration - linkAttributeValue = value; - - break; - } - } - }]; - - return linkAttributeValue; -} - -#pragma mark - UIGestureRecognizerDelegate - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ASDisplayNodeAssertMainThread(); - - if (gestureRecognizer == _longPressGestureRecognizer) { - // Don't allow long press on truncation message - if ([self _pendingTruncationTap]) { - return NO; - } - - // Ask our delegate if a long-press on an attribute is relevant - if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:atPoint:)]) { - return [_delegate textNode:self - shouldLongPressLinkAttribute:_highlightedLinkAttributeName - value:_highlightedLinkAttributeValue - atPoint:[gestureRecognizer locationInView:self.view]]; - } - - // Otherwise we are good to go. - return YES; - } - - if (([self _pendingLinkTap] || [self _pendingTruncationTap]) - && [gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] - && CGRectContainsPoint(self.threadSafeBounds, [gestureRecognizer locationInView:self.view])) { - return NO; - } - - return [super gestureRecognizerShouldBegin:gestureRecognizer]; -} - -#pragma mark - Highlighting - -- (ASTextNodeHighlightStyle)highlightStyle -{ - ASLockScopeSelf(); - - return _highlightStyle; -} - -- (void)setHighlightStyle:(ASTextNodeHighlightStyle)highlightStyle -{ - ASLockScopeSelf(); - - _highlightStyle = highlightStyle; -} - -- (NSRange)highlightRange -{ - ASDisplayNodeAssertMainThread(); - - return _highlightRange; -} - -- (void)setHighlightRange:(NSRange)highlightRange -{ - [self setHighlightRange:highlightRange animated:NO]; -} - -- (void)setHighlightRange:(NSRange)highlightRange animated:(BOOL)animated -{ - [self _setHighlightRange:highlightRange forAttributeName:nil value:nil animated:animated]; -} - -- (void)_setHighlightRange:(NSRange)highlightRange forAttributeName:(NSString *)highlightedAttributeName value:(id)highlightedAttributeValue animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); - - _highlightedLinkAttributeName = highlightedAttributeName; - _highlightedLinkAttributeValue = highlightedAttributeValue; - - if (!NSEqualRanges(highlightRange, _highlightRange) && ((0 != highlightRange.length) || (0 != _highlightRange.length))) { - - _highlightRange = highlightRange; - - if (_activeHighlightLayer) { - if (animated) { - __weak CALayer *weakHighlightLayer = _activeHighlightLayer; - _activeHighlightLayer = nil; - - weakHighlightLayer.opacity = 0.0; - - CFTimeInterval beginTime = CACurrentMediaTime(); - CABasicAnimation *possibleFadeIn = (CABasicAnimation *)[weakHighlightLayer animationForKey:@"opacity"]; - if (possibleFadeIn) { - // Calculate when we should begin fading out based on the end of the fade in animation, - // Also check to make sure that the new begin time hasn't already passed - CGFloat newBeginTime = (possibleFadeIn.beginTime + possibleFadeIn.duration); - if (newBeginTime > beginTime) { - beginTime = newBeginTime; - } - } - - CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fadeOut.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - fadeOut.fromValue = possibleFadeIn.toValue ? : @(((CALayer *)weakHighlightLayer.presentationLayer).opacity); - fadeOut.toValue = @0.0; - fadeOut.fillMode = kCAFillModeBoth; - fadeOut.duration = ASTextNodeHighlightFadeOutDuration; - fadeOut.beginTime = beginTime; - - dispatch_block_t prev = [CATransaction completionBlock]; - [CATransaction setCompletionBlock:^{ - [weakHighlightLayer removeFromSuperlayer]; - }]; - - [weakHighlightLayer addAnimation:fadeOut forKey:fadeOut.keyPath]; - - [CATransaction setCompletionBlock:prev]; - - } else { - [_activeHighlightLayer removeFromSuperlayer]; - _activeHighlightLayer = nil; - } - } - if (0 != highlightRange.length) { - // Find layer in hierarchy that allows us to draw highlighting on. - CALayer *highlightTargetLayer = self.layer; - while (highlightTargetLayer != nil) { - if (highlightTargetLayer.as_allowsHighlightDrawing) { - break; - } - highlightTargetLayer = highlightTargetLayer.superlayer; - } - - if (highlightTargetLayer != nil) { - ASTextKitRenderer *renderer = [self _locked_renderer]; - - NSArray *highlightRects = [renderer rectsForTextRange:highlightRange measureOption:ASTextKitRendererMeasureOptionBlock]; - NSMutableArray *converted = [NSMutableArray arrayWithCapacity:highlightRects.count]; - for (NSValue *rectValue in highlightRects) { - UIEdgeInsets shadowPadding = renderer.shadower.shadowPadding; - CGRect rendererRect = ASTextNodeAdjustRenderRectForShadowPadding(rectValue.CGRectValue, shadowPadding); - - // The rects returned from renderer don't have `textContainerInset`, - // as well as they are using the `constrainedSize` for layout, - // so we can simply increase the rect by insets to get the full blown layout. - rendererRect.size.width += _textContainerInset.left + _textContainerInset.right; - rendererRect.size.height += _textContainerInset.top + _textContainerInset.bottom; - - CGRect highlightedRect = [self.layer convertRect:rendererRect toLayer:highlightTargetLayer]; - - // We set our overlay layer's frame to the bounds of the highlight target layer. - // Offset highlight rects to avoid double-counting target layer's bounds.origin. - highlightedRect.origin.x -= highlightTargetLayer.bounds.origin.x; - highlightedRect.origin.y -= highlightTargetLayer.bounds.origin.y; - [converted addObject:[NSValue valueWithCGRect:highlightedRect]]; - } - - ASHighlightOverlayLayer *overlayLayer = [[ASHighlightOverlayLayer alloc] initWithRects:converted]; - overlayLayer.highlightColor = [[self class] _highlightColorForStyle:self.highlightStyle]; - overlayLayer.frame = highlightTargetLayer.bounds; - overlayLayer.masksToBounds = NO; - overlayLayer.opacity = [[self class] _highlightOpacityForStyle:self.highlightStyle]; - [highlightTargetLayer addSublayer:overlayLayer]; - - if (animated) { - CABasicAnimation *fadeIn = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fadeIn.fromValue = @0.0; - fadeIn.toValue = @(overlayLayer.opacity); - fadeIn.duration = ASTextNodeHighlightFadeInDuration; - fadeIn.beginTime = CACurrentMediaTime(); - - [overlayLayer addAnimation:fadeIn forKey:fadeIn.keyPath]; - } - - [overlayLayer setNeedsDisplay]; - - _activeHighlightLayer = overlayLayer; - } - } - } -} - -- (void)_clearHighlightIfNecessary -{ - ASDisplayNodeAssertMainThread(); - - if ([self _pendingLinkTap] || [self _pendingTruncationTap]) { - [self setHighlightRange:NSMakeRange(0, 0) animated:YES]; - } -} - -+ (CGColorRef)_highlightColorForStyle:(ASTextNodeHighlightStyle)style -{ - return [UIColor colorWithWhite:(style == ASTextNodeHighlightStyleLight ? 0.0 : 1.0) alpha:1.0].CGColor; -} - -+ (CGFloat)_highlightOpacityForStyle:(ASTextNodeHighlightStyle)style -{ - return (style == ASTextNodeHighlightStyleLight) ? ASTextNodeHighlightLightOpacity : ASTextNodeHighlightDarkOpacity; -} - -#pragma mark - Text rects - -static CGRect ASTextNodeAdjustRenderRectForShadowPadding(CGRect rendererRect, UIEdgeInsets shadowPadding) { - rendererRect.origin.x -= shadowPadding.left; - rendererRect.origin.y -= shadowPadding.top; - return rendererRect; -} - -- (NSArray *)rectsForTextRange:(NSRange)textRange -{ - return [self _rectsForTextRange:textRange measureOption:ASTextKitRendererMeasureOptionCapHeight]; -} - -- (NSArray *)highlightRectsForTextRange:(NSRange)textRange -{ - return [self _rectsForTextRange:textRange measureOption:ASTextKitRendererMeasureOptionBlock]; -} - -- (NSArray *)_rectsForTextRange:(NSRange)textRange measureOption:(ASTextKitRendererMeasureOption)measureOption -{ - ASLockScopeSelf(); - - NSArray *rects = [[self _locked_renderer] rectsForTextRange:textRange measureOption:measureOption]; - const auto adjustedRects = [[NSMutableArray alloc] init]; - - for (NSValue *rectValue in rects) { - CGRect rect = [rectValue CGRectValue]; - rect = ASTextNodeAdjustRenderRectForShadowPadding(rect, self.shadowPadding); - - NSValue *adjustedRectValue = [NSValue valueWithCGRect:rect]; - [adjustedRects addObject:adjustedRectValue]; - } - - return adjustedRects; -} - -- (CGRect)trailingRect -{ - ASLockScopeSelf(); - - CGRect rect = [[self _locked_renderer] trailingRect]; - return ASTextNodeAdjustRenderRectForShadowPadding(rect, self.shadowPadding); -} - -- (CGRect)frameForTextRange:(NSRange)textRange -{ - ASLockScopeSelf(); - - CGRect frame = [[self _locked_renderer] frameForTextRange:textRange]; - return ASTextNodeAdjustRenderRectForShadowPadding(frame, self.shadowPadding); -} - -#pragma mark - Tint Colors - - -- (void)tintColorDidChange -{ - [super tintColorDidChange]; - - [self _setNeedsDisplayOnTintedTextColor]; -} - -- (void)_setNeedsDisplayOnTintedTextColor -{ - BOOL textColorFollowsTintColor = NO; - { - AS::MutexLocker l(__instanceLock__); - textColorFollowsTintColor = _textColorFollowsTintColor; - } - - if (textColorFollowsTintColor) { - [self setNeedsDisplay]; - } -} - - -#pragma mark Interface State - -- (void)didEnterHierarchy -{ - [super didEnterHierarchy]; - - [self _setNeedsDisplayOnTintedTextColor]; -} - -#pragma mark - Placeholders - -- (UIColor *)placeholderColor -{ - return ASLockedSelf(_placeholderColor); -} - -- (void)setPlaceholderColor:(UIColor *)placeholderColor -{ - if (ASLockedSelfCompareAssignCopy(_placeholderColor, placeholderColor)) { - self.placeholderEnabled = CGColorGetAlpha(placeholderColor.CGColor) > 0; - } -} - -- (UIImage *)placeholderImage -{ - // FIXME: Replace this implementation with reusable CALayers that have .backgroundColor set. - // This would completely eliminate the memory and performance cost of the backing store. - CGSize size = self.calculatedSize; - if ((size.width * size.height) < CGFLOAT_EPSILON) { - return nil; - } - - ASLockScopeSelf(); - - UIGraphicsBeginImageContextWithOptions(size, NO, 1.0); - [self.placeholderColor setFill]; - - ASTextKitRenderer *renderer = [self _locked_renderer]; - NSRange visibleRange = renderer.firstVisibleRange; - - // cap height is both faster and creates less subpixel blending - NSArray *lineRects = [self _rectsForTextRange:visibleRange measureOption:ASTextKitRendererMeasureOptionLineHeight]; - - // fill each line with the placeholder color - for (NSValue *rectValue in lineRects) { - CGRect lineRect = [rectValue CGRectValue]; - CGRect fillBounds = CGRectIntegral(UIEdgeInsetsInsetRect(lineRect, self.placeholderInsets)); - - if (fillBounds.size.width > 0.0 && fillBounds.size.height > 0.0) { - UIRectFill(fillBounds); - } - } - - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return image; -} - -#pragma mark - Touch Handling - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); // Protect usage of _passthroughNonlinkTouches and _alwaysHandleTruncationTokenTap ivars. - - if (!_passthroughNonlinkTouches) { - return [super pointInside:point withEvent:event]; - } - - if (_alwaysHandleTruncationTokenTap) { - return YES; - } - - NSRange range = NSMakeRange(0, 0); - NSString *linkAttributeName = nil; - BOOL inAdditionalTruncationMessage = NO; - - id linkAttributeValue = [self _linkAttributeValueAtPoint:point - attributeName:&linkAttributeName - range:&range - inAdditionalTruncationMessage:&inAdditionalTruncationMessage - forHighlighting:YES]; - - NSUInteger lastCharIndex = NSIntegerMax; - BOOL linkCrossesVisibleRange = (lastCharIndex > range.location) && (lastCharIndex < NSMaxRange(range) - 1); - - if (range.length > 0 && !linkCrossesVisibleRange && linkAttributeValue != nil && linkAttributeName != nil) { - return YES; - } else { - return NO; - } -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - - [super touchesBegan:touches withEvent:event]; - - CGPoint point = [[touches anyObject] locationInView:self.view]; - - NSRange range = NSMakeRange(0, 0); - NSString *linkAttributeName = nil; - BOOL inAdditionalTruncationMessage = NO; - - id linkAttributeValue = [self _linkAttributeValueAtPoint:point - attributeName:&linkAttributeName - range:&range - inAdditionalTruncationMessage:&inAdditionalTruncationMessage - forHighlighting:YES]; - - NSUInteger lastCharIndex = NSIntegerMax; - BOOL linkCrossesVisibleRange = (lastCharIndex > range.location) && (lastCharIndex < NSMaxRange(range) - 1); - - if (inAdditionalTruncationMessage) { - NSRange visibleRange = NSMakeRange(0, 0); - { - ASLockScopeSelf(); - visibleRange = [self _locked_renderer].firstVisibleRange; - } - NSRange truncationMessageRange = [self _additionalTruncationMessageRangeWithVisibleRange:visibleRange]; - [self _setHighlightRange:truncationMessageRange forAttributeName:ASTextNodeTruncationTokenAttributeName value:nil animated:YES]; - } else if (range.length > 0 && !linkCrossesVisibleRange && linkAttributeValue != nil && linkAttributeName != nil) { - [self _setHighlightRange:range forAttributeName:linkAttributeName value:linkAttributeValue animated:YES]; - } -} - - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesCancelled:touches withEvent:event]; - - [self _clearHighlightIfNecessary]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesEnded:touches withEvent:event]; - - if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:tappedLinkAttribute:value:atPoint:textRange:)]) { - CGPoint point = [[touches anyObject] locationInView:self.view]; - [_delegate textNode:self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange]; - } - - if ([self _pendingTruncationTap]) { - if ([_delegate respondsToSelector:@selector(textNodeTappedTruncationToken:)]) { - [_delegate textNodeTappedTruncationToken:self]; - } - } - - [self _clearHighlightIfNecessary]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesMoved:touches withEvent:event]; - - UITouch *touch = [touches anyObject]; - CGPoint locationInView = [touch locationInView:self.view]; - // on 3D Touch enabled phones, this gets fired with changes in force, and usually will get fired immediately after touchesBegan:withEvent: - if (CGPointEqualToPoint([touch previousLocationInView:self.view], locationInView)) - return; - - // If touch has moved out of the current highlight range, clear the highlight. - if (_highlightRange.length > 0) { - NSRange range = NSMakeRange(0, 0); - [self _linkAttributeValueAtPoint:locationInView - attributeName:NULL - range:&range - inAdditionalTruncationMessage:NULL - forHighlighting:YES]; - - if (!NSEqualRanges(_highlightRange, range)) { - [self _clearHighlightIfNecessary]; - } - } -} - -- (void)_handleLongPress:(UILongPressGestureRecognizer *)longPressRecognizer -{ - ASDisplayNodeAssertMainThread(); - - // Respond to long-press when it begins, not when it ends. - if (longPressRecognizer.state == UIGestureRecognizerStateBegan) { - if ([self _pendingLinkTap] && [_delegate respondsToSelector:@selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:)]) { - CGPoint touchPoint = [_longPressGestureRecognizer locationInView:self.view]; - [_delegate textNode:self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange]; - } - } -} - -- (BOOL)_pendingLinkTap -{ - ASLockScopeSelf(); - - return (_highlightedLinkAttributeValue != nil && ![self _pendingTruncationTap]) && _delegate != nil; -} - -- (BOOL)_pendingTruncationTap -{ - ASLockScopeSelf(); - - return [_highlightedLinkAttributeName isEqualToString:ASTextNodeTruncationTokenAttributeName]; -} - -- (BOOL)alwaysHandleTruncationTokenTap -{ - ASLockScopeSelf(); - return _alwaysHandleTruncationTokenTap; -} - -- (void)setAlwaysHandleTruncationTokenTap:(BOOL)alwaysHandleTruncationTokenTap -{ - ASLockScopeSelf(); - _alwaysHandleTruncationTokenTap = alwaysHandleTruncationTokenTap; -} - -#pragma mark - Shadow Properties - -- (CGColorRef)shadowColor -{ - return ASLockedSelf(_shadowColor); -} - -- (void)setShadowColor:(CGColorRef)shadowColor -{ - [self lock]; - - if (_shadowColor != shadowColor && CGColorEqualToColor(shadowColor, _shadowColor) == NO) { - CGColorRelease(_shadowColor); - _shadowColor = CGColorRetain(shadowColor); - _cachedShadowUIColor = [UIColor colorWithCGColor:shadowColor]; - [self unlock]; - - [self setNeedsDisplay]; - return; - } - - [self unlock]; -} - -- (CGSize)shadowOffset -{ - return ASLockedSelf(_shadowOffset); -} - -- (void)setShadowOffset:(CGSize)shadowOffset -{ - if (ASLockedSelfCompareAssignCustom(_shadowOffset, shadowOffset, CGSizeEqualToSize)) { - [self setNeedsDisplay]; - } -} - -- (CGFloat)shadowOpacity -{ - return ASLockedSelf(_shadowOpacity); -} - -- (void)setShadowOpacity:(CGFloat)shadowOpacity -{ - if (ASLockedSelfCompareAssign(_shadowOpacity, shadowOpacity)) { - [self setNeedsDisplay]; - } -} - -- (CGFloat)shadowRadius -{ - return ASLockedSelf(_shadowRadius); -} - -- (void)setShadowRadius:(CGFloat)shadowRadius -{ - if (ASLockedSelfCompareAssign(_shadowRadius, shadowRadius)) { - [self setNeedsDisplay]; - } -} - -- (UIEdgeInsets)shadowPadding -{ - ASLockScopeSelf(); - return [self _locked_renderer].shadower.shadowPadding; -} - -#pragma mark - Truncation Message - -static NSAttributedString *DefaultTruncationAttributedString() -{ - static NSAttributedString *defaultTruncationAttributedString; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultTruncationAttributedString = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"\u2026", @"Default truncation string")]; - }); - return defaultTruncationAttributedString; -} - -- (NSAttributedString *)truncationAttributedText -{ - return ASLockedSelf(_truncationAttributedText); -} - -- (void)setTruncationAttributedText:(NSAttributedString *)truncationAttributedText -{ - if (ASLockedSelfCompareAssignCopy(_truncationAttributedText, truncationAttributedText)) { - [self _invalidateTruncationText]; - [self setNeedsDisplay]; - } -} - -- (void)setAdditionalTruncationMessage:(NSAttributedString *)additionalTruncationMessage -{ - if (ASLockedSelfCompareAssignCopy(_additionalTruncationMessage, additionalTruncationMessage)) { - [self _invalidateTruncationText]; - [self setNeedsDisplay]; - } -} - -- (NSAttributedString *)additionalTruncationMessage -{ - return ASLockedSelf(_additionalTruncationMessage); -} - -- (void)setTruncationMode:(NSLineBreakMode)truncationMode -{ - if (ASLockedSelfCompareAssign(_truncationMode, truncationMode)) { - [self setNeedsDisplay]; - } -} - -- (NSLineBreakMode)truncationMode -{ - return ASLockedSelf(_truncationMode); -} - -- (BOOL)isTruncated -{ - return ASLockedSelf([[self _locked_renderer] isTruncated]); -} - -- (BOOL)shouldTruncateForConstrainedSize:(ASSizeRange)constrainedSize -{ - return ASLockedSelf([[self _locked_rendererWithBounds:{.size = constrainedSize.max}] isTruncated]); -} - -- (void)setPointSizeScaleFactors:(NSArray *)pointSizeScaleFactors -{ - if (ASLockedSelfCompareAssignCopy(_pointSizeScaleFactors, pointSizeScaleFactors)) { - [self setNeedsDisplay]; - } -} - -- (NSArray *)pointSizeScaleFactors -{ - return ASLockedSelf(_pointSizeScaleFactors); -} - -- (void)setMaximumNumberOfLines:(NSUInteger)maximumNumberOfLines -{ - if (ASLockedSelfCompareAssign(_maximumNumberOfLines, maximumNumberOfLines)) { - [self setNeedsDisplay]; - } -} - -- (NSUInteger)maximumNumberOfLines -{ - return ASLockedSelf(_maximumNumberOfLines); -} - -- (NSUInteger)lineCount -{ - return ASLockedSelf([[self _locked_renderer] lineCount]); -} - -- (BOOL)textColorFollowsTintColor -{ - return ASLockedSelf(_textColorFollowsTintColor); -} - -#pragma mark - Truncation Message - -- (void)_invalidateTruncationText -{ - ASLockScopeSelf(); - [self _locked_invalidateTruncationText]; -} - -- (void)_locked_invalidateTruncationText -{ - _composedTruncationText = nil; -} - -/** - * @return the additional truncation message range within the as-rendered text. - * Must be called from main thread - */ -- (NSRange)_additionalTruncationMessageRangeWithVisibleRange:(NSRange)visibleRange -{ - ASLockScopeSelf(); - - // Check if we even have an additional truncation message. - if (!_additionalTruncationMessage) { - return NSMakeRange(NSNotFound, 0); - } - - // Character location of the unicode ellipsis (the first index after the visible range) - NSInteger truncationTokenIndex = NSMaxRange(visibleRange); - - NSUInteger additionalTruncationMessageLength = _additionalTruncationMessage.length; - // We get the location of the truncation token, then add the length of the - // truncation attributed string +1 for the space between. - return NSMakeRange(truncationTokenIndex + _truncationAttributedText.length + 1, additionalTruncationMessageLength); -} - -/** - * @return the truncation message for the string. If there are both an - * additional truncation message and a truncation attributed string, they will - * be properly composed. - */ -- (NSAttributedString *)_locked_composedTruncationText -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (_composedTruncationText == nil) { - if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) { - NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText]; - [newComposedTruncationString.mutableString appendString:@" "]; - [newComposedTruncationString appendAttributedString:_additionalTruncationMessage]; - _composedTruncationText = newComposedTruncationString; - } else if (_truncationAttributedText != nil) { - _composedTruncationText = _truncationAttributedText; - } else if (_additionalTruncationMessage != nil) { - _composedTruncationText = _additionalTruncationMessage; - } else { - _composedTruncationText = DefaultTruncationAttributedString(); - } - _composedTruncationText = [self _locked_prepareTruncationStringForDrawing:_composedTruncationText]; - } - return _composedTruncationText; -} - -/** - * - cleanses it of core text attributes so TextKit doesn't crash - * - Adds whole-string attributes so the truncation message matches the styling - * of the body text - */ -- (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedString *)truncationString -{ - DISABLED_ASAssertLocked(__instanceLock__); - truncationString = ASCleanseAttributedStringOfCoreTextAttributes(truncationString); - NSMutableAttributedString *truncationMutableString = [truncationString mutableCopy]; - // Grab the attributes from the full string - if (_attributedText.length > 0) { - NSAttributedString *originalString = _attributedText; - NSInteger originalStringLength = _attributedText.length; - // Add any of the original string's attributes to the truncation string, - // but don't overwrite any of the truncation string's attributes - NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL]; - [truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock: - ^(NSDictionary *attributes, NSRange range, BOOL *stop) { - NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy]; - [futureTruncationAttributes addEntriesFromDictionary:attributes]; - [truncationMutableString setAttributes:futureTruncationAttributes range:range]; - }]; - } - return truncationMutableString; -} - -#if AS_TEXTNODE_RECORD_ATTRIBUTED_STRINGS -+ (void)_registerAttributedText:(NSAttributedString *)str -{ - static NSMutableArray *array; - static NSLock *lock; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - lock = [NSLock new]; - array = [NSMutableArray new]; - }); - [lock lock]; - [array addObject:str]; - if (array.count % 20 == 0) { - NSLog(@"Got %d strings", (int)array.count); - } - if (array.count == 2000) { - NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"AttributedStrings.plist"]; - NSAssert([NSKeyedArchiver archiveRootObject:array toFile:path], nil); - NSLog(@"Saved to %@", path); - } - [lock unlock]; -} -#endif - -// All direct descendants of ASTextNode get their superclass replaced by ASTextNode2. -+ (void)initialize -{ - // Texture requires that node subclasses call [super initialize] - [super initialize]; - - if (class_getSuperclass(self) == [ASTextNode class] - && ASActivateExperimentalFeature(ASExperimentalTextNode)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - class_setSuperclass(self, [ASTextNode2 class]); -#pragma clang diagnostic pop - } -} - -// For direct allocations of ASTextNode itself, we override allocWithZone: -+ (id)allocWithZone:(struct _NSZone *)zone -{ - if (ASActivateExperimentalFeature(ASExperimentalTextNode)) { - return (ASTextNode *)[ASTextNode2 allocWithZone:zone]; - } else { - return [super allocWithZone:zone]; - } -} - -@end - -@implementation ASTextNode (Unsupported) - -- (void)setTextContainerLinePositionModifier:(id)textContainerLinePositionModifier -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); -} - -- (id)textContainerLinePositionModifier -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return nil; -} - -@end - -@implementation ASTextNode (Deprecated) - -- (void)setAttributedString:(NSAttributedString *)attributedString -{ - self.attributedText = attributedString; -} - -- (NSAttributedString *)attributedString -{ - return self.attributedText; -} - -- (void)setTruncationAttributedString:(NSAttributedString *)truncationAttributedString -{ - self.truncationAttributedText = truncationAttributedString; -} - -- (NSAttributedString *)truncationAttributedString -{ - return self.truncationAttributedText; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/ASTextNode2.h b/Example/Pods/Texture/Source/ASTextNode2.h deleted file mode 100644 index 5848adc3..00000000 --- a/Example/Pods/Texture/Source/ASTextNode2.h +++ /dev/null @@ -1,256 +0,0 @@ -// -// ASTextNode2.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@protocol ASTextLinePositionModifier; - -NS_ASSUME_NONNULL_BEGIN - -/** - @abstract Draws interactive rich text. - @discussion Backed by the code in TextExperiment folder, on top of CoreText. - */ -#if AS_ENABLE_TEXTNODE -@interface ASTextNode2 : ASControlNode -#else -@interface ASTextNode : ASControlNode -#endif - -/** - @abstract The styled text displayed by the node. - @discussion Defaults to nil, no text is shown. - For inline image attachments, add an attribute of key NSAttachmentAttributeName, with a value of an NSTextAttachment. - */ -@property (nullable, copy) NSAttributedString *attributedText; - -#pragma mark - Truncation - -/** - @abstract The attributedText to use when the text must be truncated. - @discussion Defaults to a localized ellipsis character. - */ -@property (nullable, copy) NSAttributedString *truncationAttributedText; - -/** - @summary The second attributed string appended for truncation. - @discussion This string will be highlighted on touches. - @default nil - */ -@property (nullable, copy) NSAttributedString *additionalTruncationMessage; - -/** - @abstract Determines how the text is truncated to fit within the receiver's maximum size. - @discussion Defaults to NSLineBreakByWordWrapping. - @note Setting a truncationMode in attributedString will override the truncation mode set here. - */ -@property NSLineBreakMode truncationMode; - -/** - @abstract If the text node is truncated. Text must have been sized first. - */ -@property (readonly, getter=isTruncated) BOOL truncated; - -/** - @abstract The maximum number of lines to render of the text before truncation. - @default 0 (No limit) - */ -@property NSUInteger maximumNumberOfLines; - -/** - @abstract The number of lines in the text. Text must have been sized first. - */ -@property (readonly) NSUInteger lineCount; - -/** - * An array of path objects representing the regions where text should not be displayed. - * - * @discussion The default value of this property is an empty array. You can - * assign an array of UIBezierPath objects to exclude text from one or more regions in - * the text node's bounds. You can use this property to have text wrap around images, - * shapes or other text like a fancy magazine. - */ -@property (nullable, copy) NSArray *exclusionPaths; - -#pragma mark - Placeholders - -/** - * @abstract ASTextNode has a special placeholder behavior when placeholderEnabled is YES. - * - * @discussion Defaults to NO. When YES, it draws rectangles for each line of text, - * following the true shape of the text's wrapping. This visually mirrors the overall - * shape and weight of paragraphs, making the appearance of the finished text less jarring. - */ -@property BOOL placeholderEnabled; - -/** - @abstract The placeholder color. - */ -@property (nullable, copy) UIColor *placeholderColor; - -/** - @abstract Inset each line of the placeholder. - */ -@property UIEdgeInsets placeholderInsets; - -#pragma mark - Shadow - -/** - @abstract When you set these ASDisplayNode properties, they are composited into the bitmap instead of being applied by CA. - - @property (nonatomic) CGColorRef shadowColor; - @property (nonatomic) CGFloat shadowOpacity; - @property (nonatomic) CGSize shadowOffset; - @property (nonatomic) CGFloat shadowRadius; - */ - -/** - @abstract The number of pixels used for shadow padding on each side of the receiver. - @discussion Each inset will be less than or equal to zero, so that applying - UIEdgeInsetsRect(boundingRectForText, shadowPadding) - will return a CGRect large enough to fit both the text and the appropriate shadow padding. - */ -@property (nonatomic, readonly) UIEdgeInsets shadowPadding; - -#pragma mark - Positioning - -/** - @abstract Returns an array of rects bounding the characters in a given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion Use this method to detect all the different rectangles a given range of text occupies. - The rects returned are not guaranteed to be contiguous (for example, if the given text range spans - a line break, the rects returned will be on opposite sides and different lines). The rects returned - are in the coordinate system of the receiver. - */ -- (NSArray *)rectsForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns an array of rects used for highlighting the characters in a given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion Use this method to detect all the different rectangles the highlights of a given range of text occupies. - The rects returned are not guaranteed to be contiguous (for example, if the given text range spans - a line break, the rects returned will be on opposite sides and different lines). The rects returned - are in the coordinate system of the receiver. This method is useful for visual coordination with a - highlighted range of text. - */ -- (NSArray *)highlightRectsForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns a bounding rect for the given text range. - @param textRange A range of text. Must be valid for the receiver's string. - @discussion The height of the frame returned is that of the receiver's line-height; adjustment for - cap-height and descenders is not performed. This method raises an exception if textRange is not - a valid substring range of the receiver's string. - */ -- (CGRect)frameForTextRange:(NSRange)textRange AS_WARN_UNUSED_RESULT; - -/** - @abstract Returns the trailing rectangle of space in the receiver, after the final character. - @discussion Use this method to detect which portion of the receiver is not occupied by characters. - The rect returned is in the coordinate system of the receiver. - */ -- (CGRect)trailingRect AS_WARN_UNUSED_RESULT; - - -#pragma mark - Actions - -/** - @abstract The set of attribute names to consider links. Defaults to NSLinkAttributeName. - */ -@property (nonatomic, copy) NSArray *linkAttributeNames; - -/** - @abstract Indicates whether the receiver has an entity at a given point. - @param point The point, in the receiver's coordinate system. - @param attributeNameOut The name of the attribute at the point. Can be NULL. - @param rangeOut The ultimate range of the found text. Can be NULL. - @result YES if an entity exists at `point`; NO otherwise. - */ -- (nullable id)linkAttributeValueAtPoint:(CGPoint)point attributeName:(out NSString * _Nullable * _Nullable)attributeNameOut range:(out NSRange * _Nullable)rangeOut AS_WARN_UNUSED_RESULT; - -/** - @abstract The style to use when highlighting text. - */ -@property (nonatomic) ASTextNodeHighlightStyle highlightStyle; - -/** - @abstract The range of text highlighted by the receiver. Changes to this property are not animated by default. - */ -@property (nonatomic) NSRange highlightRange; - -/** - @abstract Set the range of text to highlight, with optional animation. - - @param highlightRange The range of text to highlight. - - @param animated Whether the text should be highlighted with an animation. - */ -- (void)setHighlightRange:(NSRange)highlightRange animated:(BOOL)animated; - -/** - @abstract Responds to actions from links in the text node. - @discussion The delegate must be set before the node is loaded, and implement - textNode:longPressedLinkAttribute:value:atPoint:textRange: in order for - the long press gesture recognizer to be installed. - */ -@property (weak) id delegate; - -/** - @abstract If YES and a long press is recognized, touches are cancelled. Default is NO - */ -@property (nonatomic) BOOL longPressCancelsTouches; - -/** - @abstract if YES will not intercept touches for non-link areas of the text. Default is NO. - @discussion If you still want to handle tap truncation action when passthroughNonlinkTouches is YES, - you should set the alwaysHandleTruncationTokenTap to YES. - */ -@property (nonatomic) BOOL passthroughNonlinkTouches; - -/** - @abstract Always handle tap truncationAction, even the passthroughNonlinkTouches is YES. Default is NO. - @discussion if this is set to YES, the [ASTextNodeDelegate textNodeTappedTruncationToken:] callback will be called. - */ -@property (nonatomic) BOOL alwaysHandleTruncationTokenTap; - -/** - @abstract if YES will use the value of `self.tintColor` if the foreground color of text is not defined. - @discussion This is mainly used from ASButtonNode since by default text nodes do not respect tintColor settings unless contained within a interactive control - */ -@property (nonatomic) BOOL textColorFollowsTintColor; - -+ (void)enableDebugging; - -#pragma mark - Layout and Sizing - -@property (nullable, nonatomic) id textContainerLinePositionModifier; - -@end - -#if AS_ENABLE_TEXTNODE -@interface ASTextNode2 (Unavailable) -#else -@interface ASTextNode (Unavailable) -#endif - -- (instancetype)initWithLayerBlock:(ASDisplayNodeLayerBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end - -#if (!AS_ENABLE_TEXTNODE) -// For the time beeing remap ASTextNode2 to ASTextNode -#define ASTextNode2 ASTextNode -#endif - -NS_ASSUME_NONNULL_END - - diff --git a/Example/Pods/Texture/Source/ASTextNode2.mm b/Example/Pods/Texture/Source/ASTextNode2.mm deleted file mode 100644 index e268eca2..00000000 --- a/Example/Pods/Texture/Source/ASTextNode2.mm +++ /dev/null @@ -1,1512 +0,0 @@ -// -// ASTextNode2.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import // Definition of ASTextNodeDelegate - -#import -#import - -#import -#import -#import -#import -#import -#import - -#import -#import - -#import - -@interface ASTextCacheValue : NSObject { - @package - AS::Mutex _m; - std::deque> _layouts; -} -@end -@implementation ASTextCacheValue -@end - -/** - * If set, we will record all values set to attributedText into an array - * and once we get 2000, we'll write them all out into a plist file. - * - * This is useful for gathering realistic text data sets from apps for performance - * testing. - */ -#define AS_TEXTNODE2_RECORD_ATTRIBUTED_STRINGS 0 - -/** - * If it can't find a compatible layout, this method creates one. - * - * NOTE: Be careful to copy `text` if needed. - */ -static NS_RETURNS_RETAINED ASTextLayout *ASTextNodeCompatibleLayoutWithContainerAndText(ASTextContainer *container, NSAttributedString *text) { - static dispatch_once_t onceToken; - static AS::Mutex *layoutCacheLock; - static NSCache *textLayoutCache; - dispatch_once(&onceToken, ^{ - layoutCacheLock = new AS::Mutex(); - textLayoutCache = [[NSCache alloc] init]; - }); - - layoutCacheLock->lock(); - - ASTextCacheValue *cacheValue = [textLayoutCache objectForKey:text]; - if (cacheValue == nil) { - cacheValue = [[ASTextCacheValue alloc] init]; - [textLayoutCache setObject:cacheValue forKey:[text copy]]; - } - - // Lock the cache item for the rest of the method. Only after acquiring can we release the NSCache. - AS::MutexLocker lock(cacheValue->_m); - layoutCacheLock->unlock(); - - CGRect containerBounds = (CGRect){ .size = container.size }; - { - for (const auto &t : cacheValue->_layouts) { - CGSize constrainedSize = std::get<0>(t); - ASTextLayout *layout = std::get<1>(t); - - CGSize layoutSize = layout.textBoundingSize; - // 1. CoreText can return frames that are narrower than the constrained width, for obvious reasons. - // 2. CoreText can return frames that are slightly wider than the constrained width, for some reason. - // We have to trust that somehow it's OK to try and draw within our size constraint, despite the return value. - // 3. Thus, those two values (constrained width & returned width) form a range, where - // intermediate values in that range will be snapped. Thus, we can use a given layout as long as our - // width is in that range, between the min and max of those two values. - CGRect minRect = CGRectMake(0, 0, MIN(layoutSize.width, constrainedSize.width), MIN(layoutSize.height, constrainedSize.height)); - if (!CGRectContainsRect(containerBounds, minRect)) { - continue; - } - CGRect maxRect = CGRectMake(0, 0, MAX(layoutSize.width, constrainedSize.width), MAX(layoutSize.height, constrainedSize.height)); - if (!CGRectContainsRect(maxRect, containerBounds)) { - continue; - } - if (!CGSizeEqualToSize(container.size, constrainedSize)) { - continue; - } - - // Now check container params. - ASTextContainer *otherContainer = layout.container; - if (!UIEdgeInsetsEqualToEdgeInsets(container.insets, otherContainer.insets)) { - continue; - } - if (!ASObjectIsEqual(container.exclusionPaths, otherContainer.exclusionPaths)) { - continue; - } - if (container.maximumNumberOfRows != otherContainer.maximumNumberOfRows) { - continue; - } - if (container.truncationType != otherContainer.truncationType) { - continue; - } - if (!ASObjectIsEqual(container.truncationToken, otherContainer.truncationToken)) { - continue; - } - // TODO: When we get a cache hit, move this entry to the front (LRU). - return layout; - } - } - - // Cache Miss. Compute the text layout. - ASTextLayout *layout = [ASTextLayout layoutWithContainer:container text:text]; - - // Store the result in the cache. - { - // This is a critical section. However we also must hold the lock until this point, in case - // another thread requests this cache item while a layout is being calculated, so they don't race. - cacheValue->_layouts.push_front(std::make_tuple(container.size, layout)); - if (cacheValue->_layouts.size() > 3) { - cacheValue->_layouts.pop_back(); - } - } - - return layout; -} - -static const NSTimeInterval ASTextNodeHighlightFadeOutDuration = 0.15; -static const NSTimeInterval ASTextNodeHighlightFadeInDuration = 0.1; -static const CGFloat ASTextNodeHighlightLightOpacity = 0.11; -static const CGFloat ASTextNodeHighlightDarkOpacity = 0.22; -static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncationAttribute"; - -#if AS_ENABLE_TEXTNODE -#define AS_TN2_CLASSNAME ASTextNode2 -#else -#define AS_TN2_CLASSNAME ASTextNode -#endif - -@interface AS_TN2_CLASSNAME () - -@end - -@implementation AS_TN2_CLASSNAME { - ASTextContainer *_textContainer; - - CGSize _shadowOffset; - CGColorRef _shadowColor; - CGFloat _shadowOpacity; - CGFloat _shadowRadius; - - NSAttributedString *_attributedText; - NSAttributedString *_truncationAttributedText; - NSAttributedString *_additionalTruncationMessage; - NSArray *_pointSizeScaleFactors; - NSLineBreakMode _truncationMode; - - NSString *_highlightedLinkAttributeName; - id _highlightedLinkAttributeValue; - NSRange _highlightRange; - ASHighlightOverlayLayer *_activeHighlightLayer; - UIColor *_placeholderColor; - - UILongPressGestureRecognizer *_longPressGestureRecognizer; - ASTextNodeHighlightStyle _highlightStyle; - BOOL _longPressCancelsTouches; - BOOL _passthroughNonlinkTouches; - BOOL _alwaysHandleTruncationTokenTap; -} -@dynamic placeholderEnabled; - -static NSArray *DefaultLinkAttributeNames() { - static NSArray *names; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - names = @[ NSLinkAttributeName ]; - }); - return names; -} - -- (instancetype)init -{ - if (self = [super init]) { - _textContainer = [[ASTextContainer alloc] init]; - // Load default values from superclass. - _shadowOffset = [super shadowOffset]; - _shadowColor = CGColorRetain([super shadowColor]); - _shadowOpacity = [super shadowOpacity]; - _shadowRadius = [super shadowRadius]; - - // Disable user interaction for text node by default. - self.userInteractionEnabled = NO; - self.needsDisplayOnBoundsChange = YES; - - _textContainer.truncationType = ASTextTruncationTypeEnd; - - // The common case is for a text node to be non-opaque and blended over some background. - self.opaque = NO; - self.backgroundColor = [UIColor clearColor]; - - self.linkAttributeNames = DefaultLinkAttributeNames(); - - // Accessibility - self.isAccessibilityElement = YES; - self.accessibilityTraits = self.defaultAccessibilityTraits; - - // Placeholders - // Disabled by default in ASDisplayNode, but add a few options for those who toggle - // on the special placeholder behavior of ASTextNode. - _placeholderColor = ASDisplayNodeDefaultPlaceholderColor(); - _placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0); - } - - return self; -} - -- (void)dealloc -{ - CGColorRelease(_shadowColor); -} - -#pragma mark - Description - -- (NSString *)_plainStringForDescription -{ - NSString *plainString = [[self.attributedText string] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - if (plainString.length > 50) { - plainString = [[plainString substringToIndex:50] stringByAppendingString:@"…"]; - } - return plainString; -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [super propertiesForDescription]; - NSString *plainString = [self _plainStringForDescription]; - if (plainString.length > 0) { - [result insertObject:@{ @"text" : ASStringWithQuotesIfMultiword(plainString) } atIndex:0]; - } - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [super propertiesForDebugDescription]; - NSString *plainString = [self _plainStringForDescription]; - if (plainString.length > 0) { - [result insertObject:@{ @"text" : ASStringWithQuotesIfMultiword(plainString) } atIndex:0]; - } - return result; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - // If we are view-backed and the delegate cares, support the long-press callback. - // Locking is not needed, as all instance variables used are main-thread-only. - SEL longPressCallback = @selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:); - if (!self.isLayerBacked && [self.delegate respondsToSelector:longPressCallback]) { - _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_handleLongPress:)]; - _longPressGestureRecognizer.cancelsTouchesInView = self.longPressCancelsTouches; - _longPressGestureRecognizer.delegate = self; - [self.view addGestureRecognizer:_longPressGestureRecognizer]; - } -} - -- (BOOL)supportsLayerBacking -{ - if (!super.supportsLayerBacking) { - return NO; - } - - ASLockScopeSelf(); - // If the text contains any links, return NO. - NSAttributedString *attributedText = _attributedText; - NSRange range = NSMakeRange(0, attributedText.length); - for (NSString *linkAttributeName in _linkAttributeNames) { - __block BOOL hasLink = NO; - [attributedText enumerateAttribute:linkAttributeName inRange:range options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { - if (value == nil) { - return; - } - hasLink = YES; - *stop = YES; - }]; - if (hasLink) { - return NO; - } - } - return YES; -} - -- (NSString *)defaultAccessibilityLabel -{ - ASLockScopeSelf(); - return _attributedText.string; -} - -- (UIAccessibilityTraits)defaultAccessibilityTraits -{ - return UIAccessibilityTraitStaticText; -} - -#pragma mark - Layout and Sizing - -- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset -{ - ASLockScopeSelf(); - if (ASCompareAssignCustom(_textContainer.insets, textContainerInset, UIEdgeInsetsEqualToEdgeInsets)) { - [self setNeedsLayout]; - } -} - -- (UIEdgeInsets)textContainerInset -{ - // textContainer is invariant and has an atomic accessor. - return _textContainer.insets; -} - -- (void)setTextContainerLinePositionModifier:(id)modifier -{ - ASLockedSelfCompareAssignObjects(_textContainer.linePositionModifier, modifier); -} - -- (id)textContainerLinePositionModifier -{ - ASLockScopeSelf(); - return _textContainer.linePositionModifier; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - ASDisplayNodeAssert(constrainedSize.width >= 0, @"Constrained width for text (%f) is too narrow", constrainedSize.width); - ASDisplayNodeAssert(constrainedSize.height >= 0, @"Constrained height for text (%f) is too short", constrainedSize.height); - - ASLockScopeSelf(); - - _textContainer.size = constrainedSize; - [self _ensureTruncationText]; - - // If the constrained size has a max/inf value on the text's forward direction, the text node is calculating its intrinsic size. - // Need to consider both width and height when determining if it is calculating instrinsic size. Even the constrained width is provided, the height can be inf - // it may provide a text that is longer than the width and require a wordWrapping line break mode and looking for the height to be calculated. - BOOL isCalculatingIntrinsicSize = (_textContainer.size.width >= ASTextContainerMaxSize.width) || (_textContainer.size.height >= ASTextContainerMaxSize.height); - - NSMutableAttributedString *mutableText = [_attributedText mutableCopy]; - [self prepareAttributedString:mutableText isForIntrinsicSize:isCalculatingIntrinsicSize]; - ASTextLayout *layout = ASTextNodeCompatibleLayoutWithContainerAndText(_textContainer, mutableText); - if (layout.truncatedLine != nil && layout.truncatedLine.size.width > layout.textBoundingSize.width) { - return (CGSize) {MIN(constrainedSize.width, layout.truncatedLine.size.width), layout.textBoundingSize.height}; - } - - return layout.textBoundingSize; -} - -#pragma mark - Modifying User Text - -// Returns the ascender of the first character in attributedString by also including the line height if specified in paragraph style. -+ (CGFloat)ascenderWithAttributedString:(NSAttributedString *)attributedString -{ - UIFont *font = [attributedString attribute:NSFontAttributeName atIndex:0 effectiveRange:NULL]; - NSParagraphStyle *paragraphStyle = [attributedString attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:NULL]; - if (!paragraphStyle) { - return font.ascender; - } - CGFloat lineHeight = MAX(font.lineHeight, paragraphStyle.minimumLineHeight); - if (paragraphStyle.maximumLineHeight > 0) { - lineHeight = MIN(lineHeight, paragraphStyle.maximumLineHeight); - } - return lineHeight + font.descender; -} - -- (NSAttributedString *)attributedText -{ - ASLockScopeSelf(); - return _attributedText; -} - -- (void)setAttributedText:(NSAttributedString *)attributedText -{ - if (attributedText == nil) { - attributedText = [[NSAttributedString alloc] initWithString:@"" attributes:nil]; - } - - // Many accessors in this method will acquire the lock (including ASDisplayNode methods). - // Holding it for the duration of the method is more efficient in this case. - ASLockScopeSelf(); - - NSAttributedString *oldAttributedText = _attributedText; - if (!ASCompareAssignCopy(_attributedText, attributedText)) { - return; - } - - // Since truncation text matches style of attributedText, invalidate it now. - [self _locked_invalidateTruncationText]; - - NSUInteger length = attributedText.length; - if (length > 0) { - ASLayoutElementStyle *style = [self _locked_style]; - style.ascender = [[self class] ascenderWithAttributedString:attributedText]; - style.descender = [[attributedText attribute:NSFontAttributeName atIndex:attributedText.length - 1 effectiveRange:NULL] descender]; - } - - // Tell the display node superclasses that the cached layout is incorrect now - [self setNeedsLayout]; - - // Force display to create renderer with new size and redisplay with new string - [self setNeedsDisplay]; - - // Accessiblity - self.accessibilityLabel = self.defaultAccessibilityLabel; - - // We update the isAccessibilityElement setting if this node is not switching between strings. - if (oldAttributedText.length == 0 || length == 0) { - // We're an accessibility element by default if there is a string. - self.isAccessibilityElement = (length != 0); - } - -#if AS_TEXTNODE2_RECORD_ATTRIBUTED_STRINGS - [ASTextNode _registerAttributedText:_attributedText]; -#endif -} - -#pragma mark - Text Layout - -- (void)setExclusionPaths:(NSArray *)exclusionPaths -{ - ASLockScopeSelf(); - _textContainer.exclusionPaths = exclusionPaths; - - [self setNeedsLayout]; - [self setNeedsDisplay]; -} - -- (NSArray *)exclusionPaths -{ - ASLockScopeSelf(); - return _textContainer.exclusionPaths; -} - -- (void)prepareAttributedString:(NSMutableAttributedString *)attributedString isForIntrinsicSize:(BOOL)isForIntrinsicSize -{ - ASLockScopeSelf(); - NSLineBreakMode innerMode; - switch (_truncationMode) { - case NSLineBreakByWordWrapping: - case NSLineBreakByCharWrapping: - case NSLineBreakByClipping: - innerMode = _truncationMode; - break; - default: - innerMode = NSLineBreakByWordWrapping; - } - - // Apply/Fix paragraph style if needed - [attributedString enumerateAttribute:NSParagraphStyleAttributeName inRange:NSMakeRange(0, attributedString.length) options:kNilOptions usingBlock:^(NSParagraphStyle *style, NSRange range, BOOL * _Nonnull stop) { - - BOOL applyTruncationMode = YES; - NSMutableParagraphStyle *paragraphStyle = nil; - // Only "left" and "justified" alignments are supported while calculating intrinsic size. - // Other alignments like "right", "center" and "natural" cause the size to be bigger than needed and thus should be ignored/overridden. - const BOOL forceLeftAlignment = (style != nil - && isForIntrinsicSize - && style.alignment != NSTextAlignmentLeft - && style.alignment != NSTextAlignmentJustified); - if (style != nil) { - if (innerMode == style.lineBreakMode) { - applyTruncationMode = NO; - } - paragraphStyle = [style mutableCopy]; - } else { - if (innerMode == NSLineBreakByWordWrapping) { - applyTruncationMode = NO; - } - paragraphStyle = [NSMutableParagraphStyle new]; - } - if (!applyTruncationMode && !forceLeftAlignment) { - return; - } - paragraphStyle.lineBreakMode = innerMode; - - if (applyTruncationMode) { - paragraphStyle.lineBreakMode = _truncationMode; - } - if (forceLeftAlignment) { - paragraphStyle.alignment = NSTextAlignmentLeft; - } - [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; - }]; - - // Apply shadow if needed - if (_shadowOpacity > 0 && (_shadowRadius != 0 || !CGSizeEqualToSize(_shadowOffset, CGSizeZero)) && CGColorGetAlpha(_shadowColor) > 0) { - NSShadow *shadow = [[NSShadow alloc] init]; - if (_shadowOpacity != 1) { - CGColorRef shadowColorRef = CGColorCreateCopyWithAlpha(_shadowColor, _shadowOpacity * CGColorGetAlpha(_shadowColor)); - shadow.shadowColor = [UIColor colorWithCGColor:shadowColorRef]; - CGColorRelease(shadowColorRef); - } else { - shadow.shadowColor = [UIColor colorWithCGColor:_shadowColor]; - } - shadow.shadowOffset = _shadowOffset; - shadow.shadowBlurRadius = _shadowRadius; - [attributedString addAttribute:NSShadowAttributeName value:shadow range:NSMakeRange(0, attributedString.length)]; - } -} - -#pragma mark - Drawing - -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - ASTextContainer *copiedContainer; - NSMutableAttributedString *mutableText; - BOOL needsTintColor; - id bgColor; - { - // Wrapping all the other access here, because we can't lock while accessing tintColor. - ASLockScopeSelf(); - [self _ensureTruncationText]; - - // Unlike layout, here we must copy the container since drawing is asynchronous. - copiedContainer = [_textContainer copy]; - copiedContainer.size = self.bounds.size; - [copiedContainer makeImmutable]; - mutableText = [_attributedText mutableCopy] ?: [[NSMutableAttributedString alloc] init]; - - [self prepareAttributedString:mutableText isForIntrinsicSize:NO]; - needsTintColor = self.textColorFollowsTintColor && mutableText.length > 0; - bgColor = self.backgroundColor ?: [NSNull null]; - } - - // After all other attributes are set, apply tint color if needed and foreground color is not already specified - if (needsTintColor) { - // Apply tint color if specified and if foreground color is undefined for attributedString - NSRange limit = NSMakeRange(0, mutableText.length); - // Look for previous attributes that define foreground color - UIColor *attributeValue = (UIColor *)[mutableText attribute:NSForegroundColorAttributeName atIndex:limit.location effectiveRange:NULL]; - - // we need to unlock before accessing tintColor - UIColor *tintColor = self.tintColor; - if (attributeValue == nil && tintColor) { - // None are found, apply tint color if available. Fallback to "black" text color - [mutableText addAttributes:@{ NSForegroundColorAttributeName : tintColor } range:limit]; - } - } - - return @{ - @"container": copiedContainer, - @"text": mutableText, - @"bgColor": bgColor - }; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(NSDictionary *)layoutDict isCancelled:(NS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - ASTextContainer *container = layoutDict[@"container"]; - NSAttributedString *text = layoutDict[@"text"]; - UIColor *bgColor = layoutDict[@"bgColor"]; - ASTextLayout *layout = ASTextNodeCompatibleLayoutWithContainerAndText(container, text); - - if (isCancelledBlock()) { - return; - } - - // Fill background color. - if (bgColor == (id)[NSNull null]) { - bgColor = nil; - } - - // They may have already drawn into this context in the pre-context block - // so unfortunately we have to use the normal blend mode, not copy. - if (bgColor && CGColorGetAlpha(bgColor.CGColor) > 0) { - [bgColor setFill]; - UIRectFillUsingBlendMode(bounds, kCGBlendModeNormal); - } - - CGContextRef context = UIGraphicsGetCurrentContext(); - ASDisplayNodeAssert(context, @"This is no good without a context."); - - [layout drawInContext:context size:bounds.size point:bounds.origin view:nil layer:nil debug:[ASTextDebugOption sharedDebugOption] cancel:isCancelledBlock]; -} - -#pragma mark - Tint Color - -- (void)tintColorDidChange -{ - [super tintColorDidChange]; - - [self _setNeedsDisplayOnTintedTextColor]; -} - -- (void)_setNeedsDisplayOnTintedTextColor -{ - BOOL textColorFollowsTintColor = NO; - { - AS::MutexLocker l(__instanceLock__); - textColorFollowsTintColor = _textColorFollowsTintColor; - } - - if (textColorFollowsTintColor) { - [self setNeedsDisplay]; - } -} - - -#pragma mark Interface State - -- (void)didEnterHierarchy -{ - [super didEnterHierarchy]; - - [self _setNeedsDisplayOnTintedTextColor]; -} - -#pragma mark - Attributes - -- (id)linkAttributeValueAtPoint:(CGPoint)point - attributeName:(out NSString **)attributeNameOut - range:(out NSRange *)rangeOut -{ - return [self _linkAttributeValueAtPoint:point - attributeName:attributeNameOut - range:rangeOut - inAdditionalTruncationMessage:NULL - forHighlighting:NO]; -} - -- (id)_linkAttributeValueAtPoint:(CGPoint)point - attributeName:(out NSString **)attributeNameOut - range:(out NSRange *)rangeOut - inAdditionalTruncationMessage:(out BOOL *)inAdditionalTruncationMessageOut - forHighlighting:(BOOL)highlighting -{ - ASLockScopeSelf(); - - // TODO: The copy and application of size shouldn't be required, but it is currently. - // See discussion in https://github.com/TextureGroup/Texture/pull/396 - ASTextContainer *containerCopy = [_textContainer copy]; - containerCopy.size = self.calculatedSize; - ASTextLayout *layout = ASTextNodeCompatibleLayoutWithContainerAndText(containerCopy, _attributedText); - - if ([self _locked_pointInsideAdditionalTruncationMessage:point withLayout:layout]) { - if (inAdditionalTruncationMessageOut != NULL) { - *inAdditionalTruncationMessageOut = YES; - } - return nil; - } - - NSRange visibleRange = layout.visibleRange; - NSRange clampedRange = NSIntersectionRange(visibleRange, NSMakeRange(0, _attributedText.length)); - - // Search the 9 points of a 44x44 square around the touch until we find a link. - // Start from center, then do sides, then do top/bottom, then do corners. - static constexpr CGSize kRectOffsets[9] = { - { 0, 0 }, - { -22, 0 }, { 22, 0 }, - { 0, -22 }, { 0, 22 }, - { -22, -22 }, { -22, 22 }, - { 22, -22 }, { 22, 22 } - }; - - for (const CGSize &offset : kRectOffsets) { - const CGPoint testPoint = CGPointMake(point.x + offset.width, - point.y + offset.height); - ASTextPosition *pos = [layout closestPositionToPoint:testPoint]; - if (!pos || !NSLocationInRange(pos.offset, clampedRange)) { - continue; - } - for (NSString *attributeName in _linkAttributeNames) { - NSRange effectiveRange = NSMakeRange(0, 0); - id value = [_attributedText attribute:attributeName atIndex:pos.offset - longestEffectiveRange:&effectiveRange inRange:clampedRange]; - if (value == nil) { - // Didn't find any links specified with this attribute. - continue; - } - - // If highlighting, check with delegate first. If not implemented, assume YES. - if (highlighting - && [_delegate respondsToSelector:@selector(textNode:shouldHighlightLinkAttribute:value:atPoint:)] - && ![_delegate textNode:(ASTextNode *)self shouldHighlightLinkAttribute:attributeName - value:value atPoint:point]) { - continue; - } - - *rangeOut = NSIntersectionRange(visibleRange, effectiveRange); - - if (attributeNameOut != NULL) { - *attributeNameOut = attributeName; - } - - return value; - } - } - - return nil; -} - -- (BOOL)_locked_pointInsideAdditionalTruncationMessage:(CGPoint)point withLayout:(ASTextLayout *)layout -{ - // Check if the range is within the additional truncation range - BOOL inAdditionalTruncationMessage = NO; - - CTLineRef truncatedCTLine = layout.truncatedLine.CTLine; - if (truncatedCTLine != NULL && _additionalTruncationMessage != nil) { - CFIndex stringIndexForPosition = CTLineGetStringIndexForPosition(truncatedCTLine, point); - if (stringIndexForPosition != kCFNotFound) { - CFIndex truncatedCTLineGlyphCount = CTLineGetGlyphCount(truncatedCTLine); - - CTLineRef truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_truncationAttributedText); - CFIndex truncationTokenLineGlyphCount = truncationTokenLine ? CTLineGetGlyphCount(truncationTokenLine) : 0; - - if (truncationTokenLine) { - CFRelease(truncationTokenLine); - } - - CTLineRef additionalTruncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_additionalTruncationMessage); - CFIndex additionalTruncationTokenLineGlyphCount = additionalTruncationTokenLine ? CTLineGetGlyphCount(additionalTruncationTokenLine) : 0; - - if (additionalTruncationTokenLine) { - CFRelease(additionalTruncationTokenLine); - } - - switch (_textContainer.truncationType) { - case ASTextTruncationTypeStart: { - CFIndex composedTruncationTextLineGlyphCount = truncationTokenLineGlyphCount + additionalTruncationTokenLineGlyphCount; - if (stringIndexForPosition > truncationTokenLineGlyphCount && - stringIndexForPosition < composedTruncationTextLineGlyphCount) { - inAdditionalTruncationMessage = YES; - } - break; - } - case ASTextTruncationTypeMiddle: { - CFIndex composedTruncationTextLineGlyphCount = truncationTokenLineGlyphCount + additionalTruncationTokenLineGlyphCount; - CFIndex firstTruncatedTokenIndex = (truncatedCTLineGlyphCount - composedTruncationTextLineGlyphCount) / 2.0; - if ((firstTruncatedTokenIndex + truncationTokenLineGlyphCount) < stringIndexForPosition && - stringIndexForPosition < (firstTruncatedTokenIndex + composedTruncationTextLineGlyphCount)) { - inAdditionalTruncationMessage = YES; - } - break; - } - case ASTextTruncationTypeEnd: { - if (stringIndexForPosition > (truncatedCTLineGlyphCount - additionalTruncationTokenLineGlyphCount)) { - inAdditionalTruncationMessage = YES; - } - break; - } - default: - // For now, assume that a tap inside this text, but outside the text range is a tap on the - // truncation token. - if (![layout textRangeAtPoint:point]) { - inAdditionalTruncationMessage = YES; - } - break; - } - } - } - - return inAdditionalTruncationMessage; -} - -#pragma mark - UIGestureRecognizerDelegate - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); // Protect usage of _highlight* ivars. - - if (gestureRecognizer == _longPressGestureRecognizer) { - // Don't allow long press on truncation message - if ([self _pendingTruncationTap]) { - return NO; - } - - // Ask our delegate if a long-press on an attribute is relevant - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(textNode:shouldLongPressLinkAttribute:value:atPoint:)]) { - return [delegate textNode:(ASTextNode *)self - shouldLongPressLinkAttribute:_highlightedLinkAttributeName - value:_highlightedLinkAttributeValue - atPoint:[gestureRecognizer locationInView:self.view]]; - } - - // Otherwise we are good to go. - return YES; - } - - if (([self _pendingLinkTap] || [self _pendingTruncationTap]) - && [gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] - && CGRectContainsPoint(self.threadSafeBounds, [gestureRecognizer locationInView:self.view])) { - return NO; - } - - return [super gestureRecognizerShouldBegin:gestureRecognizer]; -} - -#pragma mark - Highlighting - -- (ASTextNodeHighlightStyle)highlightStyle -{ - ASLockScopeSelf(); - - return _highlightStyle; -} - -- (void)setHighlightStyle:(ASTextNodeHighlightStyle)highlightStyle -{ - ASLockScopeSelf(); - - _highlightStyle = highlightStyle; -} - -- (NSRange)highlightRange -{ - ASLockScopeSelf(); - - return _highlightRange; -} - -- (void)setHighlightRange:(NSRange)highlightRange -{ - [self setHighlightRange:highlightRange animated:NO]; -} - -- (void)setHighlightRange:(NSRange)highlightRange animated:(BOOL)animated -{ - [self _setHighlightRange:highlightRange forAttributeName:nil value:nil animated:animated]; -} - -- (void)_setHighlightRange:(NSRange)highlightRange forAttributeName:(NSString *)highlightedAttributeName value:(id)highlightedAttributeValue animated:(BOOL)animated -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); // Protect usage of _highlight* ivars. - - // Set these so that link tapping works. - _highlightedLinkAttributeName = highlightedAttributeName; - _highlightedLinkAttributeValue = highlightedAttributeValue; - - if (!NSEqualRanges(highlightRange, _highlightRange) && ((0 != highlightRange.length) || (0 != _highlightRange.length))) { - - _highlightRange = highlightRange; - - if (_activeHighlightLayer) { - if (animated) { - __weak CALayer *weakHighlightLayer = _activeHighlightLayer; - _activeHighlightLayer = nil; - - weakHighlightLayer.opacity = 0.0; - - CFTimeInterval beginTime = CACurrentMediaTime(); - CABasicAnimation *possibleFadeIn = (CABasicAnimation *)[weakHighlightLayer animationForKey:@"opacity"]; - if (possibleFadeIn) { - // Calculate when we should begin fading out based on the end of the fade in animation, - // Also check to make sure that the new begin time hasn't already passed - CGFloat newBeginTime = (possibleFadeIn.beginTime + possibleFadeIn.duration); - if (newBeginTime > beginTime) { - beginTime = newBeginTime; - } - } - - CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fadeOut.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - fadeOut.fromValue = possibleFadeIn.toValue ? : @(((CALayer *)weakHighlightLayer.presentationLayer).opacity); - fadeOut.toValue = @0.0; - fadeOut.fillMode = kCAFillModeBoth; - fadeOut.duration = ASTextNodeHighlightFadeOutDuration; - fadeOut.beginTime = beginTime; - - dispatch_block_t prev = [CATransaction completionBlock]; - [CATransaction setCompletionBlock:^{ - [weakHighlightLayer removeFromSuperlayer]; - }]; - - [weakHighlightLayer addAnimation:fadeOut forKey:fadeOut.keyPath]; - - [CATransaction setCompletionBlock:prev]; - - } else { - [_activeHighlightLayer removeFromSuperlayer]; - _activeHighlightLayer = nil; - } - } - if (0 != highlightRange.length) { - // Find layer in hierarchy that allows us to draw highlighting on. - CALayer *highlightTargetLayer = self.layer; - while (highlightTargetLayer != nil) { - if (highlightTargetLayer.as_allowsHighlightDrawing) { - break; - } - highlightTargetLayer = highlightTargetLayer.superlayer; - } - - if (highlightTargetLayer != nil) { - // TODO: The copy and application of size shouldn't be required, but it is currently. - // See discussion in https://github.com/TextureGroup/Texture/pull/396 - ASTextContainer *textContainerCopy = [_textContainer copy]; - textContainerCopy.size = self.calculatedSize; - ASTextLayout *layout = ASTextNodeCompatibleLayoutWithContainerAndText(textContainerCopy, _attributedText); - - NSArray *highlightRects = [layout selectionRectsWithoutStartAndEndForRange:[ASTextRange rangeWithRange:highlightRange]]; - NSMutableArray *converted = [NSMutableArray arrayWithCapacity:highlightRects.count]; - - CALayer *layer = self.layer; - UIEdgeInsets shadowPadding = self.shadowPadding; - for (ASTextSelectionRect *rectValue in highlightRects) { - // Adjust shadow padding - CGRect rendererRect = ASTextNodeAdjustRenderRectForShadowPadding(rectValue.rect, shadowPadding); - CGRect highlightedRect = [layer convertRect:rendererRect toLayer:highlightTargetLayer]; - - // We set our overlay layer's frame to the bounds of the highlight target layer. - // Offset highlight rects to avoid double-counting target layer's bounds.origin. - highlightedRect.origin.x -= highlightTargetLayer.bounds.origin.x; - highlightedRect.origin.y -= highlightTargetLayer.bounds.origin.y; - [converted addObject:[NSValue valueWithCGRect:highlightedRect]]; - } - - ASHighlightOverlayLayer *overlayLayer = [[ASHighlightOverlayLayer alloc] initWithRects:converted]; - overlayLayer.highlightColor = [[self class] _highlightColorForStyle:self.highlightStyle]; - overlayLayer.frame = highlightTargetLayer.bounds; - overlayLayer.masksToBounds = NO; - overlayLayer.opacity = [[self class] _highlightOpacityForStyle:self.highlightStyle]; - [highlightTargetLayer addSublayer:overlayLayer]; - - if (animated) { - CABasicAnimation *fadeIn = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fadeIn.fromValue = @0.0; - fadeIn.toValue = @(overlayLayer.opacity); - fadeIn.duration = ASTextNodeHighlightFadeInDuration; - fadeIn.beginTime = CACurrentMediaTime(); - - [overlayLayer addAnimation:fadeIn forKey:fadeIn.keyPath]; - } - - [overlayLayer setNeedsDisplay]; - - _activeHighlightLayer = overlayLayer; - } - } - } -} - -- (void)_clearHighlightIfNecessary -{ - ASDisplayNodeAssertMainThread(); - - if ([self _pendingLinkTap] || [self _pendingTruncationTap]) { - [self setHighlightRange:NSMakeRange(0, 0) animated:YES]; - } -} - -+ (CGColorRef)_highlightColorForStyle:(ASTextNodeHighlightStyle)style -{ - return [UIColor colorWithWhite:(style == ASTextNodeHighlightStyleLight ? 0.0 : 1.0) alpha:1.0].CGColor; -} - -+ (CGFloat)_highlightOpacityForStyle:(ASTextNodeHighlightStyle)style -{ - return (style == ASTextNodeHighlightStyleLight) ? ASTextNodeHighlightLightOpacity : ASTextNodeHighlightDarkOpacity; -} - -#pragma mark - Text rects - -static CGRect ASTextNodeAdjustRenderRectForShadowPadding(CGRect rendererRect, UIEdgeInsets shadowPadding) { - rendererRect.origin.x -= shadowPadding.left; - rendererRect.origin.y -= shadowPadding.top; - return rendererRect; -} - -- (NSArray *)rectsForTextRange:(NSRange)textRange -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return @[]; -} - -- (NSArray *)highlightRectsForTextRange:(NSRange)textRange -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return @[]; -} - -- (CGRect)trailingRect -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return CGRectZero; -} - -- (CGRect)frameForTextRange:(NSRange)textRange -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return CGRectZero; -} - -#pragma mark - Placeholders - -- (UIColor *)placeholderColor -{ - return ASLockedSelf(_placeholderColor); -} - -- (void)setPlaceholderColor:(UIColor *)placeholderColor -{ - ASLockScopeSelf(); - if (ASCompareAssignCopy(_placeholderColor, placeholderColor)) { - self.placeholderEnabled = CGColorGetAlpha(placeholderColor.CGColor) > 0; - } -} - -- (UIImage *)placeholderImage -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return nil; -} - -#pragma mark - Touch Handling - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); // Protect usage of _passthroughNonlinkTouches and _alwaysHandleTruncationTokenTap ivars. - - if (!_passthroughNonlinkTouches) { - return [super pointInside:point withEvent:event]; - } - - if (_alwaysHandleTruncationTokenTap) { - return YES; - } - - NSRange range = NSMakeRange(0, 0); - NSString *linkAttributeName = nil; - BOOL inAdditionalTruncationMessage = NO; - - id linkAttributeValue = [self _linkAttributeValueAtPoint:point - attributeName:&linkAttributeName - range:&range - inAdditionalTruncationMessage:&inAdditionalTruncationMessage - forHighlighting:YES]; - - NSUInteger lastCharIndex = NSIntegerMax; - BOOL linkCrossesVisibleRange = (lastCharIndex > range.location) && (lastCharIndex < NSMaxRange(range) - 1); - - if (range.length > 0 && !linkCrossesVisibleRange && linkAttributeValue != nil && linkAttributeName != nil) { - return YES; - } else { - return NO; - } -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - - [super touchesBegan:touches withEvent:event]; - - CGPoint point = [[touches anyObject] locationInView:self.view]; - - NSRange range = NSMakeRange(0, 0); - NSString *linkAttributeName = nil; - BOOL inAdditionalTruncationMessage = NO; - - id linkAttributeValue = [self _linkAttributeValueAtPoint:point - attributeName:&linkAttributeName - range:&range - inAdditionalTruncationMessage:&inAdditionalTruncationMessage - forHighlighting:YES]; - - NSUInteger lastCharIndex = NSIntegerMax; - BOOL linkCrossesVisibleRange = (lastCharIndex > range.location) && (lastCharIndex < NSMaxRange(range) - 1); - - if (inAdditionalTruncationMessage) { - NSRange visibleRange = NSMakeRange(0, 0); - { - ASLockScopeSelf(); - // TODO: The copy and application of size shouldn't be required, but it is currently. - // See discussion in https://github.com/TextureGroup/Texture/pull/396 - ASTextContainer *containerCopy = [_textContainer copy]; - containerCopy.size = self.calculatedSize; - ASTextLayout *layout = ASTextNodeCompatibleLayoutWithContainerAndText(containerCopy, _attributedText); - visibleRange = layout.visibleRange; - } - NSRange truncationMessageRange = [self _additionalTruncationMessageRangeWithVisibleRange:visibleRange]; - [self _setHighlightRange:truncationMessageRange forAttributeName:ASTextNodeTruncationTokenAttributeName value:nil animated:YES]; - } else if (range.length > 0 && !linkCrossesVisibleRange && linkAttributeValue != nil && linkAttributeName != nil) { - [self _setHighlightRange:range forAttributeName:linkAttributeName value:linkAttributeValue animated:YES]; - } - - return; -} - - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesCancelled:touches withEvent:event]; - - [self _clearHighlightIfNecessary]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesEnded:touches withEvent:event]; - - ASLockScopeSelf(); // Protect usage of _highlight* ivars. - id delegate = self.delegate; - if ([self _pendingLinkTap] && [delegate respondsToSelector:@selector(textNode:tappedLinkAttribute:value:atPoint:textRange:)]) { - CGPoint point = [[touches anyObject] locationInView:self.view]; - [delegate textNode:(ASTextNode *)self tappedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:point textRange:_highlightRange]; - } - - if ([self _pendingTruncationTap]) { - if ([delegate respondsToSelector:@selector(textNodeTappedTruncationToken:)]) { - [delegate textNodeTappedTruncationToken:(ASTextNode *)self]; - } - } - - [self _clearHighlightIfNecessary]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNodeAssertMainThread(); - [super touchesMoved:touches withEvent:event]; - - ASLockScopeSelf(); // Protect usage of _highlight* ivars. - UITouch *touch = [touches anyObject]; - CGPoint locationInView = [touch locationInView:self.view]; - // on 3D Touch enabled phones, this gets fired with changes in force, and usually will get fired immediately after touchesBegan:withEvent: - if (CGPointEqualToPoint([touch previousLocationInView:self.view], locationInView)) - return; - - // If touch has moved out of the current highlight range, clear the highlight. - if (_highlightRange.length > 0) { - NSRange range = NSMakeRange(0, 0); - [self _linkAttributeValueAtPoint:locationInView - attributeName:NULL - range:&range - inAdditionalTruncationMessage:NULL - forHighlighting:YES]; - - if (!NSEqualRanges(_highlightRange, range)) { - [self _clearHighlightIfNecessary]; - } - } -} - -- (void)_handleLongPress:(UILongPressGestureRecognizer *)longPressRecognizer -{ - ASDisplayNodeAssertMainThread(); - - // Respond to long-press when it begins, not when it ends. - if (longPressRecognizer.state == UIGestureRecognizerStateBegan) { - id delegate = self.delegate; - if ([delegate respondsToSelector:@selector(textNode:longPressedLinkAttribute:value:atPoint:textRange:)]) { - ASLockScopeSelf(); // Protect usage of _highlight* ivars. - CGPoint touchPoint = [_longPressGestureRecognizer locationInView:self.view]; - [delegate textNode:(ASTextNode *)self longPressedLinkAttribute:_highlightedLinkAttributeName value:_highlightedLinkAttributeValue atPoint:touchPoint textRange:_highlightRange]; - } - } -} - -- (BOOL)_pendingLinkTap -{ - ASLockScopeSelf(); - - return (_highlightedLinkAttributeValue != nil && ![self _pendingTruncationTap]) && self.delegate != nil; -} - -- (BOOL)_pendingTruncationTap -{ - return [ASLockedSelf(_highlightedLinkAttributeName) isEqualToString:ASTextNodeTruncationTokenAttributeName]; -} - -- (BOOL)alwaysHandleTruncationTokenTap -{ - ASLockScopeSelf(); - return _alwaysHandleTruncationTokenTap; -} - -- (void)setAlwaysHandleTruncationTokenTap:(BOOL)alwaysHandleTruncationTokenTap -{ - ASLockScopeSelf(); - _alwaysHandleTruncationTokenTap = alwaysHandleTruncationTokenTap; -} - -#pragma mark - Shadow Properties - -/** - * Note about shadowed text: - * - * Shadowed text is pretty rare, and we are a framework that targets serious developers. - * We should probably ignore these properties and tell developers to set the shadow into their attributed text instead. - */ -- (CGColorRef)shadowColor -{ - return ASLockedSelf(_shadowColor); -} - -- (void)setShadowColor:(CGColorRef)shadowColor -{ - ASLockScopeSelf(); - if (_shadowColor != shadowColor && CGColorEqualToColor(shadowColor, _shadowColor) == NO) { - CGColorRelease(_shadowColor); - _shadowColor = CGColorRetain(shadowColor); - [self setNeedsDisplay]; - } -} - -- (CGSize)shadowOffset -{ - return ASLockedSelf(_shadowOffset); -} - -- (void)setShadowOffset:(CGSize)shadowOffset -{ - ASLockScopeSelf(); - if (ASCompareAssignCustom(_shadowOffset, shadowOffset, CGSizeEqualToSize)) { - [self setNeedsDisplay]; - } -} - -- (CGFloat)shadowOpacity -{ - return ASLockedSelf(_shadowOpacity); -} - -- (void)setShadowOpacity:(CGFloat)shadowOpacity -{ - ASLockScopeSelf(); - if (ASCompareAssign(_shadowOpacity, shadowOpacity)) { - [self setNeedsDisplay]; - } -} - -- (CGFloat)shadowRadius -{ - return ASLockedSelf(_shadowRadius); -} - -- (void)setShadowRadius:(CGFloat)shadowRadius -{ - ASLockScopeSelf(); - if (ASCompareAssign(_shadowRadius, shadowRadius)) { - [self setNeedsDisplay]; - } -} - -- (UIEdgeInsets)shadowPadding -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return UIEdgeInsetsZero; -} - -- (void)setPointSizeScaleFactors:(NSArray *)scaleFactors -{ - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - ASLockScopeSelf(); - if (ASCompareAssignCopy(_pointSizeScaleFactors, scaleFactors)) { - [self setNeedsLayout]; - } -} - -- (NSArray *)pointSizeScaleFactors -{ - return ASLockedSelf(_pointSizeScaleFactors); -} - -#pragma mark - Truncation Message - -static NSAttributedString *DefaultTruncationAttributedString() -{ - static NSAttributedString *defaultTruncationAttributedString; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultTruncationAttributedString = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"\u2026", @"Default truncation string")]; - }); - return defaultTruncationAttributedString; -} - -- (void)_ensureTruncationText -{ - ASLockScopeSelf(); - if (_textContainer.truncationToken == nil) { - _textContainer.truncationToken = [self _locked_composedTruncationText]; - } -} - -- (NSAttributedString *)truncationAttributedText -{ - return ASLockedSelf(_truncationAttributedText); -} - -- (void)setTruncationAttributedText:(NSAttributedString *)truncationAttributedText -{ - ASLockScopeSelf(); - if (ASCompareAssignCopy(_truncationAttributedText, truncationAttributedText)) { - [self _invalidateTruncationText]; - } -} - -- (NSAttributedString *)additionalTruncationMessage -{ - return ASLockedSelf(_additionalTruncationMessage); -} - -- (void)setAdditionalTruncationMessage:(NSAttributedString *)additionalTruncationMessage -{ - ASLockScopeSelf(); - if (ASCompareAssignCopy(_additionalTruncationMessage, additionalTruncationMessage)) { - [self _invalidateTruncationText]; - } -} - -- (NSLineBreakMode)truncationMode -{ - return ASLockedSelf(_truncationMode); -} - -- (void)setTruncationMode:(NSLineBreakMode)truncationMode -{ - ASLockScopeSelf(); - if (ASCompareAssign(_truncationMode, truncationMode)) { - ASTextTruncationType truncationType; - switch (truncationMode) { - case NSLineBreakByTruncatingHead: - truncationType = ASTextTruncationTypeStart; - break; - case NSLineBreakByTruncatingTail: - truncationType = ASTextTruncationTypeEnd; - break; - case NSLineBreakByTruncatingMiddle: - truncationType = ASTextTruncationTypeMiddle; - break; - default: - truncationType = ASTextTruncationTypeNone; - } - - _textContainer.truncationType = truncationType; - - [self setNeedsDisplay]; - } -} - -- (BOOL)isTruncated -{ - return ASLockedSelf([self locked_textLayoutForSize:[self _locked_threadSafeBounds].size].truncatedLine != nil); -} - -- (BOOL)shouldTruncateForConstrainedSize:(ASSizeRange)constrainedSize -{ - return ASLockedSelf([self locked_textLayoutForSize:constrainedSize.max].truncatedLine != nil); -} - -- (ASTextLayout *)locked_textLayoutForSize:(CGSize)size -{ - ASTextContainer *container = [_textContainer copy]; - container.size = size; - return ASTextNodeCompatibleLayoutWithContainerAndText(container, _attributedText); -} - -- (NSUInteger)maximumNumberOfLines -{ - // _textContainer is invariant and this is just atomic access. - return _textContainer.maximumNumberOfRows; -} - -- (void)setMaximumNumberOfLines:(NSUInteger)maximumNumberOfLines -{ - ASLockScopeSelf(); - if (ASCompareAssign(_textContainer.maximumNumberOfRows, maximumNumberOfLines)) { - [self setNeedsDisplay]; - } -} - -- (NSUInteger)lineCount -{ - ASLockScopeSelf(); - AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE(); - return 0; -} - -#pragma mark - Truncation Message - -- (void)_invalidateTruncationText -{ - ASLockScopeSelf(); - [self _locked_invalidateTruncationText]; - [self setNeedsDisplay]; -} - -- (void)_locked_invalidateTruncationText -{ - _textContainer.truncationToken = nil; -} - -/** - * @return the additional truncation message range within the as-rendered text. - * Must be called from main thread - */ -- (NSRange)_additionalTruncationMessageRangeWithVisibleRange:(NSRange)visibleRange -{ - ASLockScopeSelf(); - - // Check if we even have an additional truncation message. - if (!_additionalTruncationMessage) { - return NSMakeRange(NSNotFound, 0); - } - - // Character location of the unicode ellipsis (the first index after the visible range) - NSInteger truncationTokenIndex = NSMaxRange(visibleRange); - - NSUInteger additionalTruncationMessageLength = _additionalTruncationMessage.length; - // We get the location of the truncation token, then add the length of the - // truncation attributed string +1 for the space between. - return NSMakeRange(truncationTokenIndex + _truncationAttributedText.length + 1, additionalTruncationMessageLength); -} - -/** - * @return the truncation message for the string. If there are both an - * additional truncation message and a truncation attributed string, they will - * be properly composed. - */ -- (NSAttributedString *)_locked_composedTruncationText -{ - DISABLED_ASAssertLocked(__instanceLock__); - NSAttributedString *composedTruncationText = nil; - if (_truncationAttributedText != nil && _additionalTruncationMessage != nil) { - NSMutableAttributedString *newComposedTruncationString = [[NSMutableAttributedString alloc] initWithAttributedString:_truncationAttributedText]; - [newComposedTruncationString.mutableString appendString:@" "]; - [newComposedTruncationString appendAttributedString:_additionalTruncationMessage]; - composedTruncationText = newComposedTruncationString; - } else if (_truncationAttributedText != nil) { - composedTruncationText = _truncationAttributedText; - } else if (_additionalTruncationMessage != nil) { - composedTruncationText = _additionalTruncationMessage; - } else { - composedTruncationText = DefaultTruncationAttributedString(); - } - return [self _locked_prepareTruncationStringForDrawing:composedTruncationText]; -} - -/** - * - cleanses it of core text attributes so TextKit doesn't crash - * - Adds whole-string attributes so the truncation message matches the styling - * of the body text - */ -- (NSAttributedString *)_locked_prepareTruncationStringForDrawing:(NSAttributedString *)truncationString -{ - DISABLED_ASAssertLocked(__instanceLock__); - NSMutableAttributedString *truncationMutableString = [truncationString mutableCopy]; - // Grab the attributes from the full string - if (_attributedText.length > 0) { - NSAttributedString *originalString = _attributedText; - NSInteger originalStringLength = _attributedText.length; - // Add any of the original string's attributes to the truncation string, - // but don't overwrite any of the truncation string's attributes - NSDictionary *originalStringAttributes = [originalString attributesAtIndex:originalStringLength-1 effectiveRange:NULL]; - [truncationString enumerateAttributesInRange:NSMakeRange(0, truncationString.length) options:0 usingBlock: - ^(NSDictionary *attributes, NSRange range, BOOL *stop) { - NSMutableDictionary *futureTruncationAttributes = [originalStringAttributes mutableCopy]; - [futureTruncationAttributes addEntriesFromDictionary:attributes]; - [truncationMutableString setAttributes:futureTruncationAttributes range:range]; - }]; - } - return truncationMutableString; -} - -#if AS_TEXTNODE2_RECORD_ATTRIBUTED_STRINGS -+ (void)_registerAttributedText:(NSAttributedString *)str -{ - static NSMutableArray *array; - static NSLock *lock; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - lock = [NSLock new]; - array = [NSMutableArray new]; - }); - [lock lock]; - [array addObject:str]; - if (array.count % 20 == 0) { - NSLog(@"Got %d strings", (int)array.count); - } - if (array.count == 2000) { - NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"AttributedStrings.plist"]; - NSAssert([NSKeyedArchiver archiveRootObject:array toFile:path], nil); - NSLog(@"Saved to %@", path); - } - [lock unlock]; -} -#endif - -+ (void)enableDebugging -{ - ASTextDebugOption *debugOption = [[ASTextDebugOption alloc] init]; - debugOption.CTLineFillColor = [UIColor colorWithRed:0 green:0.3 blue:1 alpha:0.1]; - [ASTextDebugOption setSharedDebugOption:debugOption]; -} - -- (BOOL)usingExperiment -{ - return YES; -} - -@end diff --git a/Example/Pods/Texture/Source/ASTextNodeCommon.h b/Example/Pods/Texture/Source/ASTextNodeCommon.h deleted file mode 100644 index beee262b..00000000 --- a/Example/Pods/Texture/Source/ASTextNodeCommon.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// ASTextNodeCommon.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@class ASTextNode; - -#define AS_TEXT_ALERT_UNIMPLEMENTED_FEATURE() { \ - static dispatch_once_t onceToken; \ - dispatch_once(&onceToken, ^{ \ - NSLog(@"[Texture] Warning: Feature %@ is unimplemented in %@.", NSStringFromSelector(_cmd), NSStringFromClass(self.class)); \ - });\ -} - -/** - * Highlight styles. - */ -typedef NS_ENUM(unsigned char, ASTextNodeHighlightStyle) { - /** - * Highlight style for text on a light background. - */ - ASTextNodeHighlightStyleLight, - - /** - * Highlight style for text on a dark background. - */ - ASTextNodeHighlightStyleDark -}; - -/** - * @abstract Text node delegate. - */ -@protocol ASTextNodeDelegate -@optional - -/** - @abstract Indicates to the delegate that a link was tapped within a text node. - @param textNode The ASTextNode containing the link that was tapped. - @param attribute The attribute that was tapped. Will not be nil. - @param value The value of the tapped attribute. - @param point The point within textNode, in textNode's coordinate system, that was tapped. - @param textRange The range of highlighted text. - */ -- (void)textNode:(ASTextNode *)textNode tappedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; - -/** - @abstract Indicates to the delegate that a link was tapped within a text node. - @param textNode The ASTextNode containing the link that was tapped. - @param attribute The attribute that was tapped. Will not be nil. - @param value The value of the tapped attribute. - @param point The point within textNode, in textNode's coordinate system, that was tapped. - @param textRange The range of highlighted text. - @discussion In addition to implementing this method, the delegate must be set on the text - node before it is loaded (the recognizer is created in -didLoad) - */ -- (void)textNode:(ASTextNode *)textNode longPressedLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point textRange:(NSRange)textRange; - -//! @abstract Called when the text node's truncation string has been tapped. -- (void)textNodeTappedTruncationToken:(ASTextNode *)textNode; - -/** - @abstract Indicates to the text node if an attribute should be considered a link. - @param textNode The text node containing the entity attribute. - @param attribute The attribute that was tapped. Will not be nil. - @param value The value of the tapped attribute. - @param point The point within textNode, in textNode's coordinate system, that was touched to trigger a highlight. - @discussion If not implemented, the default value is YES. - @return YES if the entity attribute should be a link, NO otherwise. - */ -- (BOOL)textNode:(ASTextNode *)textNode shouldHighlightLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point; - -/** - @abstract Indicates to the text node if an attribute is a valid long-press target - @param textNode The text node containing the entity attribute. - @param attribute The attribute that was tapped. Will not be nil. - @param value The value of the tapped attribute. - @param point The point within textNode, in textNode's coordinate system, that was long-pressed. - @discussion If not implemented, the default value is NO. - @return YES if the entity attribute should be treated as a long-press target, NO otherwise. - */ -- (BOOL)textNode:(ASTextNode *)textNode shouldLongPressLinkAttribute:(NSString *)attribute value:(id)value atPoint:(CGPoint)point; - -@end - diff --git a/Example/Pods/Texture/Source/ASVideoNode.h b/Example/Pods/Texture/Source/ASVideoNode.h deleted file mode 100644 index 440c71c5..00000000 --- a/Example/Pods/Texture/Source/ASVideoNode.h +++ /dev/null @@ -1,171 +0,0 @@ -// -// ASVideoNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_USE_VIDEO - -@class AVAsset, AVPlayer, AVPlayerLayer, AVPlayerItem, AVVideoComposition, AVAudioMix; -@protocol ASVideoNodeDelegate; - -typedef NS_ENUM(NSInteger, ASVideoNodePlayerState) { - ASVideoNodePlayerStateUnknown, - ASVideoNodePlayerStateInitialLoading, - ASVideoNodePlayerStateReadyToPlay, - ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying, - ASVideoNodePlayerStatePlaying, - ASVideoNodePlayerStateLoading, - ASVideoNodePlayerStatePaused, - ASVideoNodePlayerStateFinished -}; - -NS_ASSUME_NONNULL_BEGIN - -// IMPORTANT NOTES: -// 1. Applications using ASVideoNode must link AVFoundation! (this provides the AV* classes below) -// 2. This is a relatively new component of AsyncDisplayKit. It has many useful features, but -// there is room for further expansion and optimization. Please report any issues or requests -// in an issue on GitHub: https://github.com/facebook/AsyncDisplayKit/issues - -@interface ASVideoNode : ASNetworkImageNode - -- (void)play; -- (void)pause; -- (BOOL)isPlaying; -- (void)resetToPlaceholder; - -// TODO: copy -@property (nullable) AVAsset *asset; - -/** - ** @abstract The URL with which the asset was initialized. - ** @discussion Setting the URL will override the current asset with a newly created AVURLAsset created from the given URL, and AVAsset *asset will point to that newly created AVURLAsset. Please don't set both assetURL and asset. - ** @return Current URL the asset was initialized or nil if no URL was given. - **/ -@property (nullable, copy) NSURL *assetURL; - -// TODO: copy both of these. -@property (nullable) AVVideoComposition *videoComposition; -@property (nullable) AVAudioMix *audioMix; - -@property (nullable, readonly) AVPlayer *player; - -// TODO: copy -@property (nullable, readonly) AVPlayerItem *currentItem; - -@property (nullable, nonatomic, readonly) AVPlayerLayer *playerLayer; - - -/** - * When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the "visible" interfaceState. - * If it leaves the visible interfaceState it will pause but will resume once it has returned. - */ -@property BOOL shouldAutoplay; -@property BOOL shouldAutorepeat; - -@property BOOL muted; -@property BOOL shouldAggressivelyRecoverFromStall; - -@property (readonly) ASVideoNodePlayerState playerState; -//! Defaults to 10000 -@property int32_t periodicTimeObserverTimescale; - -//! Defaults to AVLayerVideoGravityResizeAspect -@property (null_resettable, copy) NSString *gravity; - -@property (nullable, weak) id delegate; - -@end - -@protocol ASVideoNodeDelegate -@optional -/** - * @abstract Delegate method invoked when the node's video has played to its end time. - * @param videoNode The video node has played to its end time. - */ -- (void)videoDidPlayToEnd:(ASVideoNode *)videoNode; -/** - * @abstract Delegate method invoked the node is tapped. - * @param videoNode The video node that was tapped. - * @discussion The video's play state is toggled if this method is not implemented. - */ -- (void)didTapVideoNode:(ASVideoNode *)videoNode; -/** - * @abstract Delegate method invoked when player changes state. - * @param videoNode The video node. - * @param state player state before this change. - * @param toState player new state. - * @discussion This method is called after each state change - */ -- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toState; -/** - * @abstract Asks delegate if state change is allowed - * ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused. - * asks delegate if state change is allowed. - * @param videoNode The video node. - * @param state player state that is going to be set. - * @discussion Delegate method invoked when player changes it's state to - * ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused - * and asks delegate if state change is valid - */ -- (BOOL)videoNode:(ASVideoNode*)videoNode shouldChangePlayerStateTo:(ASVideoNodePlayerState)state; -/** - * @abstract Delegate method invoked when player playback time is updated. - * @param videoNode The video node. - * @param timeInterval current playback time in seconds. - */ -- (void)videoNode:(ASVideoNode *)videoNode didPlayToTimeInterval:(NSTimeInterval)timeInterval; -/** - * @abstract Delegate method invoked when the video player stalls. - * @param videoNode The video node that has experienced the stall - * @param timeInterval Current playback time when the stall happens - */ -- (void)videoNode:(ASVideoNode *)videoNode didStallAtTimeInterval:(NSTimeInterval)timeInterval; -/** - * @abstract Delegate method invoked when the video player starts the inital asset loading - * @param videoNode The videoNode - */ -- (void)videoNodeDidStartInitialLoading:(ASVideoNode *)videoNode; -/** - * @abstract Delegate method invoked when the video is done loading the asset and can start the playback - * @param videoNode The videoNode - */ -- (void)videoNodeDidFinishInitialLoading:(ASVideoNode *)videoNode; -/** - * @abstract Delegate method invoked when the AVPlayerItem for the asset has been set up and can be accessed throught currentItem. - * @param videoNode The videoNode. - * @param currentItem The AVPlayerItem that was constructed from the asset. - */ -- (void)videoNode:(ASVideoNode *)videoNode didSetCurrentItem:(AVPlayerItem *)currentItem; -/** - * @abstract Delegate method invoked when the video node has recovered from the stall - * @param videoNode The videoNode - */ -- (void)videoNodeDidRecoverFromStall:(ASVideoNode *)videoNode; -/** - * @abstract Delegate method invoked when an error occurs while trying to load an asset - * @param videoNode The videoNode. - * @param key The key of value that failed to load. - * @param asset The asset. - * @param error The error that occurs. - */ -- (void)videoNode:(ASVideoNode *)videoNode didFailToLoadValueForKey:(NSString *)key asset:(AVAsset *)asset error:(NSError *)error; - -@end - -@interface ASVideoNode (Unavailable) - -- (instancetype)initWithViewBlock:(ASDisplayNodeViewBlock)viewBlock didLoadBlock:(nullable ASDisplayNodeDidLoadBlock)didLoadBlock NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/ASVideoNode.mm b/Example/Pods/Texture/Source/ASVideoNode.mm deleted file mode 100644 index 141ca2ea..00000000 --- a/Example/Pods/Texture/Source/ASVideoNode.mm +++ /dev/null @@ -1,861 +0,0 @@ -// -// ASVideoNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_USE_VIDEO - -#import -#import -#import -#import -#import -#import - -static BOOL ASAssetIsEqual(AVAsset *asset1, AVAsset *asset2) { - return ASObjectIsEqual(asset1, asset2) - || ([asset1 isKindOfClass:[AVURLAsset class]] - && [asset2 isKindOfClass:[AVURLAsset class]] - && ASObjectIsEqual(((AVURLAsset *)asset1).URL, ((AVURLAsset *)asset2).URL)); -} - -static UIViewContentMode ASContentModeFromVideoGravity(NSString *videoGravity) { - if ([videoGravity isEqualToString:AVLayerVideoGravityResizeAspectFill]) { - return UIViewContentModeScaleAspectFill; - } else if ([videoGravity isEqualToString:AVLayerVideoGravityResize]) { - return UIViewContentModeScaleToFill; - } else { - return UIViewContentModeScaleAspectFit; - } -} - -static void *ASVideoNodeContext = &ASVideoNodeContext; -static NSString * const kPlaybackLikelyToKeepUpKey = @"playbackLikelyToKeepUp"; -static NSString * const kplaybackBufferEmpty = @"playbackBufferEmpty"; -static NSString * const kStatus = @"status"; -static NSString * const kRate = @"rate"; - -@interface ASVideoNode () -{ - struct { - unsigned int delegateVideNodeShouldChangePlayerStateTo:1; - unsigned int delegateVideoDidPlayToEnd:1; - unsigned int delegateDidTapVideoNode:1; - unsigned int delegateVideoNodeWillChangePlayerStateToState:1; - unsigned int delegateVideoNodeDidPlayToTimeInterval:1; - unsigned int delegateVideoNodeDidStartInitialLoading:1; - unsigned int delegateVideoNodeDidFinishInitialLoading:1; - unsigned int delegateVideoNodeDidSetCurrentItem:1; - unsigned int delegateVideoNodeDidStallAtTimeInterval:1; - unsigned int delegateVideoNodeDidRecoverFromStall:1; - unsigned int delegateVideoNodeDidFailToLoadValueForKey:1; - } _delegateFlags; - - BOOL _shouldBePlaying; - - BOOL _shouldAutorepeat; - BOOL _shouldAutoplay; - BOOL _shouldAggressivelyRecoverFromStall; - BOOL _muted; - - ASVideoNodePlayerState _playerState; - - AVAsset *_asset; - NSURL *_assetURL; - AVVideoComposition *_videoComposition; - AVAudioMix *_audioMix; - - AVPlayerItem *_currentPlayerItem; - AVPlayer *_player; - - id _timeObserver; - int32_t _periodicTimeObserverTimescale; - CMTime _timeObserverInterval; - - CMTime _lastPlaybackTime; - - ASDisplayNode *_playerNode; - NSString *_gravity; -} - -@end - -@implementation ASVideoNode - -@dynamic delegate; - -// TODO: Support preview images with HTTP Live Streaming videos. - -#pragma mark - Construction and Layout - -- (instancetype)initWithCache:(id)cache downloader:(id)downloader -{ - if (!(self = [super initWithCache:cache downloader:downloader])) { - return nil; - } - - self.gravity = AVLayerVideoGravityResizeAspect; - _periodicTimeObserverTimescale = 10000; - [self addTarget:self action:@selector(tapped) forControlEvents:ASControlNodeEventTouchUpInside]; - _lastPlaybackTime = kCMTimeZero; - - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil]; - - return self; -} - -- (ASDisplayNode *)constructPlayerNode -{ - ASVideoNode * __weak weakSelf = self; - - return [[ASDisplayNode alloc] initWithLayerBlock:^CALayer *{ - AVPlayerLayer *playerLayer = [[AVPlayerLayer alloc] init]; - playerLayer.player = weakSelf.player; - playerLayer.videoGravity = weakSelf.gravity; - return playerLayer; - }]; -} - -- (AVPlayerItem *)constructPlayerItem -{ - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); - - AVPlayerItem *playerItem = nil; - if (_assetURL != nil) { - playerItem = [[AVPlayerItem alloc] initWithURL:_assetURL]; - _asset = [playerItem asset]; - } else { - playerItem = [[AVPlayerItem alloc] initWithAsset:_asset]; - } - - playerItem.videoComposition = _videoComposition; - playerItem.audioMix = _audioMix; - return playerItem; -} - -- (void)prepareToPlayAsset:(AVAsset *)asset withKeys:(NSArray *)requestedKeys -{ - ASDisplayNodeAssertMainThread(); - - for (NSString *key in requestedKeys) { - NSError *error = nil; - AVKeyValueStatus keyStatus = [asset statusOfValueForKey:key error:&error]; - if (keyStatus == AVKeyValueStatusFailed) { - NSLog(@"Asset loading failed with error: %@", error); - if (_delegateFlags.delegateVideoNodeDidFailToLoadValueForKey) { - [self.delegate videoNode:self didFailToLoadValueForKey:key asset:asset error:error]; - } - } - } - - if ([asset isPlayable] == NO) { - NSLog(@"Asset is not playable."); - return; - } - - AVPlayerItem *playerItem = [self constructPlayerItem]; - [self setCurrentItem:playerItem]; - - if (_player != nil) { - [_player replaceCurrentItemWithPlayerItem:playerItem]; - } else { - self.player = [AVPlayer playerWithPlayerItem:playerItem]; - } - - if (_delegateFlags.delegateVideoNodeDidSetCurrentItem) { - [self.delegate videoNode:self didSetCurrentItem:playerItem]; - } - - if (self.image == nil && self.URL == nil) { - [self generatePlaceholderImage]; - } -} - -- (void)addPlayerItemObservers:(AVPlayerItem *)playerItem -{ - if (playerItem == nil) { - return; - } - - [playerItem addObserver:self forKeyPath:kStatus options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:ASVideoNodeContext]; - [playerItem addObserver:self forKeyPath:kPlaybackLikelyToKeepUpKey options:NSKeyValueObservingOptionNew context:ASVideoNodeContext]; - [playerItem addObserver:self forKeyPath:kplaybackBufferEmpty options:NSKeyValueObservingOptionNew context:ASVideoNodeContext]; - - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter addObserver:self selector:@selector(didPlayToEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem]; - [notificationCenter addObserver:self selector:@selector(videoNodeDidStall:) name:AVPlayerItemPlaybackStalledNotification object:playerItem]; - [notificationCenter addObserver:self selector:@selector(errorWhilePlaying:) name:AVPlayerItemFailedToPlayToEndTimeNotification object:playerItem]; - [notificationCenter addObserver:self selector:@selector(errorWhilePlaying:) name:AVPlayerItemNewErrorLogEntryNotification object:playerItem]; -} - -- (void)removePlayerItemObservers:(AVPlayerItem *)playerItem -{ - @try { - [playerItem removeObserver:self forKeyPath:kStatus context:ASVideoNodeContext]; - [playerItem removeObserver:self forKeyPath:kPlaybackLikelyToKeepUpKey context:ASVideoNodeContext]; - [playerItem removeObserver:self forKeyPath:kplaybackBufferEmpty context:ASVideoNodeContext]; - } - @catch (NSException * __unused exception) { - NSLog(@"Unnecessary KVO removal"); - } - - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:playerItem]; - [notificationCenter removeObserver:self name: AVPlayerItemPlaybackStalledNotification object:playerItem]; - [notificationCenter removeObserver:self name:AVPlayerItemFailedToPlayToEndTimeNotification object:playerItem]; - [notificationCenter removeObserver:self name:AVPlayerItemNewErrorLogEntryNotification object:playerItem]; -} - -- (void)addPlayerObservers:(AVPlayer *)player -{ - if (player == nil) { - return; - } - - [player addObserver:self forKeyPath:kRate options:NSKeyValueObservingOptionNew context:ASVideoNodeContext]; - - __weak __typeof(self) weakSelf = self; - _timeObserverInterval = CMTimeMake(1, _periodicTimeObserverTimescale); - _timeObserver = [player addPeriodicTimeObserverForInterval:_timeObserverInterval queue:NULL usingBlock:^(CMTime time){ - [weakSelf periodicTimeObserver:time]; - }]; -} - -- (void) removePlayerObservers:(AVPlayer *)player -{ - if (_timeObserver != nil) { - [player removeTimeObserver:_timeObserver]; - _timeObserver = nil; - } - - @try { - [player removeObserver:self forKeyPath:kRate context:ASVideoNodeContext]; - } - @catch (NSException * __unused exception) { - NSLog(@"Unnecessary KVO removal"); - } -} - -- (void)layout -{ - [super layout]; - // The _playerNode wraps AVPlayerLayer, and therefore should extend across the entire bounds. - _playerNode.frame = self.bounds; -} - -- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize -{ - ASDisplayNode *playerNode = ASLockedSelf(_playerNode); - - CGSize calculatedSize = constrainedSize; - - // Prevent crashes through if infinite width or height - if (isinf(calculatedSize.width) || isinf(calculatedSize.height)) { - ASDisplayNodeAssert(NO, @"Infinite width or height in ASVideoNode"); - calculatedSize = CGSizeZero; - } - - if (playerNode != nil) { - playerNode.style.preferredSize = calculatedSize; - [playerNode layoutThatFits:ASSizeRangeMake(CGSizeZero, calculatedSize)]; - } - - return calculatedSize; -} - -- (void)generatePlaceholderImage -{ - ASVideoNode * __weak weakSelf = self; - AVAsset *asset = self.asset; - - [self imageAtTime:kCMTimeZero completionHandler:^(UIImage *image) { - ASPerformBlockOnMainThread(^{ - // Ensure the asset hasn't changed since the image request was made - if (ASAssetIsEqual(weakSelf.asset, asset)) { - [weakSelf setVideoPlaceholderImage:image]; - } - }); - }]; -} - -- (void)imageAtTime:(CMTime)imageTime completionHandler:(void(^)(UIImage *image))completionHandler -{ - ASPerformBlockOnBackgroundThread(^{ - AVAsset *asset = self->_asset; - - // Skip the asset image generation if we don't have any tracks available that are capable of supporting it - NSArray* visualAssetArray = [asset tracksWithMediaCharacteristic:AVMediaCharacteristicVisual]; - if (visualAssetArray.count == 0) { - completionHandler(nil); - return; - } - - AVAssetImageGenerator *previewImageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; - previewImageGenerator.appliesPreferredTrackTransform = YES; - previewImageGenerator.videoComposition = self->_videoComposition; - - [previewImageGenerator generateCGImagesAsynchronouslyForTimes:@[[NSValue valueWithCMTime:imageTime]] - completionHandler:^(CMTime requestedTime, CGImageRef image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error) { - if (error != nil && result != AVAssetImageGeneratorCancelled) { - NSLog(@"Asset preview image generation failed with error: %@", error); - } - completionHandler(image ? [UIImage imageWithCGImage:image] : nil); - }]; - }); -} - -- (void)setVideoPlaceholderImage:(UIImage *)image -{ - NSString *gravity = self.gravity; - - if (image != nil) { - self.contentMode = ASContentModeFromVideoGravity(gravity); - } - self.image = image; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - AS::UniqueLock l(__instanceLock__); - - if (object == _currentPlayerItem) { - if ([keyPath isEqualToString:kStatus]) { - if ([change[NSKeyValueChangeNewKey] integerValue] == AVPlayerItemStatusReadyToPlay) { - if (self.playerState != ASVideoNodePlayerStatePlaying) { - self.playerState = ASVideoNodePlayerStateReadyToPlay; - if (_shouldBePlaying && ASInterfaceStateIncludesVisible(self.interfaceState)) { - l.unlock(); - [self play]; - l.lock(); - } - } - // If we don't yet have a placeholder image update it now that we should have data available for it - if (self.image == nil && self.URL == nil) { - [self generatePlaceholderImage]; - } - } - } else if ([keyPath isEqualToString:kPlaybackLikelyToKeepUpKey]) { - BOOL likelyToKeepUp = [change[NSKeyValueChangeNewKey] boolValue]; - if (likelyToKeepUp && self.playerState == ASVideoNodePlayerStatePlaying) { - return; - } - if (!likelyToKeepUp) { - self.playerState = ASVideoNodePlayerStateLoading; - } else if (self.playerState != ASVideoNodePlayerStateFinished) { - self.playerState = ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying; - } - if (_shouldBePlaying && (_shouldAggressivelyRecoverFromStall || likelyToKeepUp) && ASInterfaceStateIncludesVisible(self.interfaceState)) { - if (self.playerState == ASVideoNodePlayerStateLoading && _delegateFlags.delegateVideoNodeDidRecoverFromStall) { - [self.delegate videoNodeDidRecoverFromStall:self]; - } - - l.unlock(); - [self play]; // autoresume after buffer catches up - // NOTE: Early return without re-locking. - return; - } - } else if ([keyPath isEqualToString:kplaybackBufferEmpty]) { - if (_shouldBePlaying && [change[NSKeyValueChangeNewKey] boolValue] == YES && ASInterfaceStateIncludesVisible(self.interfaceState)) { - self.playerState = ASVideoNodePlayerStateLoading; - } - } - } else if (object == _player) { - if ([keyPath isEqualToString:kRate]) { - if ([change[NSKeyValueChangeNewKey] floatValue] == 0.0) { - if (self.playerState == ASVideoNodePlayerStatePlaying) { - self.playerState = ASVideoNodePlayerStatePaused; - } - } else { - self.playerState = ASVideoNodePlayerStatePlaying; - } - } - } - - // NOTE: Early return above. -} - -- (void)tapped -{ - if (_delegateFlags.delegateDidTapVideoNode) { - [self.delegate didTapVideoNode:self]; - - } else { - if (_shouldBePlaying) { - [self pause]; - } else { - [self play]; - } - } -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - - ASLockScopeSelf(); - AVAsset *asset = self.asset; - // Return immediately if the asset is nil; - if (asset == nil || self.playerState != ASVideoNodePlayerStateUnknown) { - return; - } - - self.playerState = ASVideoNodePlayerStateLoading; - if (_delegateFlags.delegateVideoNodeDidStartInitialLoading) { - [self.delegate videoNodeDidStartInitialLoading:self]; - } - - NSArray *requestedKeys = @[@"playable"]; - [asset loadValuesAsynchronouslyForKeys:requestedKeys completionHandler:^{ - ASPerformBlockOnMainThread(^{ - if (self->_delegateFlags.delegateVideoNodeDidFinishInitialLoading) { - [self.delegate videoNodeDidFinishInitialLoading:self]; - } - [self prepareToPlayAsset:asset withKeys:requestedKeys]; - }); - }]; -} - -- (void)periodicTimeObserver:(CMTime)time -{ - NSTimeInterval timeInSeconds = CMTimeGetSeconds(time); - if (timeInSeconds <= 0) { - return; - } - - if (_delegateFlags.delegateVideoNodeDidPlayToTimeInterval) { - [self.delegate videoNode:self didPlayToTimeInterval:timeInSeconds]; - - } -} - -- (void)didExitPreloadState -{ - [super didExitPreloadState]; - - { - ASLockScopeSelf(); - - self.player = nil; - self.currentItem = nil; - self.playerState = ASVideoNodePlayerStateUnknown; - } -} - -- (void)didEnterVisibleState -{ - [super didEnterVisibleState]; - - BOOL shouldPlay = NO; - { - ASLockScopeSelf(); - if (_shouldBePlaying || _shouldAutoplay) { - if (_player != nil && CMTIME_IS_VALID(_lastPlaybackTime)) { - [_player seekToTime:_lastPlaybackTime]; - } - shouldPlay = YES; - } - } - - if (shouldPlay) { - [self play]; - } -} - -- (void)didExitVisibleState -{ - [super didExitVisibleState]; - - ASLockScopeSelf(); - - if (_shouldBePlaying) { - [self pause]; - if (_player != nil && CMTIME_IS_VALID(_player.currentTime)) { - _lastPlaybackTime = _player.currentTime; - } - _shouldBePlaying = YES; - } -} - -#pragma mark - Video Properties - -- (void)setPlayerState:(ASVideoNodePlayerState)playerState -{ - ASLockScopeSelf(); - - ASVideoNodePlayerState oldState = _playerState; - - if (oldState == playerState) { - return; - } - - if (_delegateFlags.delegateVideoNodeWillChangePlayerStateToState) { - [self.delegate videoNode:self willChangePlayerState:oldState toState:playerState]; - } - - _playerState = playerState; -} - -- (void)setAssetURL:(NSURL *)assetURL -{ - ASDisplayNodeAssertMainThread(); - - if (ASObjectIsEqual(assetURL, self.assetURL) == NO) { - [self setAndFetchAsset:[AVURLAsset assetWithURL:assetURL] url:assetURL]; - } -} - -- (NSURL *)assetURL -{ - ASLockScopeSelf(); - - if (_assetURL != nil) { - return _assetURL; - } else if ([_asset isKindOfClass:AVURLAsset.class]) { - return ((AVURLAsset *)_asset).URL; - } - - return nil; -} - -- (void)setAsset:(AVAsset *)asset -{ - ASDisplayNodeAssertMainThread(); - - if (ASAssetIsEqual(asset, self.asset) == NO) { - [self setAndFetchAsset:asset url:nil]; - } -} - -- (AVAsset *)asset -{ - ASLockScopeSelf(); - return _asset; -} - -- (void)setAndFetchAsset:(AVAsset *)asset url:(NSURL *)assetURL -{ - ASDisplayNodeAssertMainThread(); - - [self didExitPreloadState]; - - { - ASLockScopeSelf(); - self.videoPlaceholderImage = nil; - _asset = asset; - _assetURL = assetURL; - } - - [self setNeedsPreload]; -} - -- (void)setVideoComposition:(AVVideoComposition *)videoComposition -{ - ASLockScopeSelf(); - - _videoComposition = videoComposition; - _currentPlayerItem.videoComposition = videoComposition; -} - -- (AVVideoComposition *)videoComposition -{ - ASLockScopeSelf(); - return _videoComposition; -} - -- (void)setAudioMix:(AVAudioMix *)audioMix -{ - ASLockScopeSelf(); - - _audioMix = audioMix; - _currentPlayerItem.audioMix = audioMix; -} - -- (AVAudioMix *)audioMix -{ - ASLockScopeSelf(); - return _audioMix; -} - -- (AVPlayer *)player -{ - ASLockScopeSelf(); - return _player; -} - -- (AVPlayerLayer *)playerLayer -{ - ASLockScopeSelf(); - return (AVPlayerLayer *)_playerNode.layer; -} - -- (void)setDelegate:(id)delegate -{ - [super setDelegate:delegate]; - - if (delegate == nil) { - memset(&_delegateFlags, 0, sizeof(_delegateFlags)); - } else { - _delegateFlags.delegateVideNodeShouldChangePlayerStateTo = [delegate respondsToSelector:@selector(videoNode:shouldChangePlayerStateTo:)]; - _delegateFlags.delegateVideoDidPlayToEnd = [delegate respondsToSelector:@selector(videoDidPlayToEnd:)]; - _delegateFlags.delegateDidTapVideoNode = [delegate respondsToSelector:@selector(didTapVideoNode:)]; - _delegateFlags.delegateVideoNodeWillChangePlayerStateToState = [delegate respondsToSelector:@selector(videoNode:willChangePlayerState:toState:)]; - _delegateFlags.delegateVideoNodeDidPlayToTimeInterval = [delegate respondsToSelector:@selector(videoNode:didPlayToTimeInterval:)]; - _delegateFlags.delegateVideoNodeDidStartInitialLoading = [delegate respondsToSelector:@selector(videoNodeDidStartInitialLoading:)]; - _delegateFlags.delegateVideoNodeDidFinishInitialLoading = [delegate respondsToSelector:@selector(videoNodeDidFinishInitialLoading:)]; - _delegateFlags.delegateVideoNodeDidSetCurrentItem = [delegate respondsToSelector:@selector(videoNode:didSetCurrentItem:)]; - _delegateFlags.delegateVideoNodeDidStallAtTimeInterval = [delegate respondsToSelector:@selector(videoNode:didStallAtTimeInterval:)]; - _delegateFlags.delegateVideoNodeDidRecoverFromStall = [delegate respondsToSelector:@selector(videoNodeDidRecoverFromStall:)]; - _delegateFlags.delegateVideoNodeDidFailToLoadValueForKey = [delegate respondsToSelector:@selector(videoNode:didFailToLoadValueForKey:asset:error:)]; - } -} - -- (void)setGravity:(NSString *)gravity -{ - ASLockScopeSelf(); - if (!gravity) { - gravity = AVLayerVideoGravityResizeAspect; - } - - if (!ASCompareAssignObjects(_gravity, gravity)) { - return; - } - - if (_playerNode.isNodeLoaded) { - ((AVPlayerLayer *)_playerNode.layer).videoGravity = gravity; - } - self.contentMode = ASContentModeFromVideoGravity(gravity); - _gravity = gravity; -} - -- (NSString *)gravity -{ - ASLockScopeSelf(); - return _gravity; -} - -- (BOOL)muted -{ - ASLockScopeSelf(); - return _muted; -} - -- (void)setMuted:(BOOL)muted -{ - ASLockScopeSelf(); - - _player.muted = muted; - _muted = muted; -} - -#pragma mark - Video Playback - -- (void)play -{ - ASLockScopeSelf(); - - if (![self isStateChangeValid:ASVideoNodePlayerStatePlaying]) { - return; - } - - if (_player == nil) { - ASUnlockScope(self); - [self setNeedsPreload]; - } - - if (_playerNode == nil) { - _playerNode = [self constructPlayerNode]; - - { - ASUnlockScope(self); - [self addSubnode:_playerNode]; - } - - [self setNeedsLayout]; - } - - - [_player play]; - _shouldBePlaying = YES; -} - -- (BOOL)ready -{ - return _currentPlayerItem.status == AVPlayerItemStatusReadyToPlay; -} - -- (void)pause -{ - ASLockScopeSelf(); - if (![self isStateChangeValid:ASVideoNodePlayerStatePaused]) { - return; - } - [_player pause]; - _shouldBePlaying = NO; -} - -- (BOOL)isPlaying -{ - ASLockScopeSelf(); - - return (_player.rate > 0 && !_player.error); -} - -- (BOOL)isStateChangeValid:(ASVideoNodePlayerState)state -{ - if (_delegateFlags.delegateVideNodeShouldChangePlayerStateTo) { - if (![self.delegate videoNode:self shouldChangePlayerStateTo:state]) { - return NO; - } - } - return YES; -} - -- (void)resetToPlaceholder -{ - ASLockScopeSelf(); - - if (_playerNode != nil) { - [_playerNode removeFromSupernode]; - _playerNode = nil; - } - - [_player seekToTime:kCMTimeZero]; - [self pause]; -} - - -#pragma mark - Playback observers - -- (void)applicationDidBecomeActive:(NSNotification *)notification -{ - if (self.shouldBePlaying && self.isVisible) { - [self play]; - } -} - -- (void)didPlayToEnd:(NSNotification *)notification -{ - self.playerState = ASVideoNodePlayerStateFinished; - if (_delegateFlags.delegateVideoDidPlayToEnd) { - [self.delegate videoDidPlayToEnd:self]; - } - - if (_shouldAutorepeat) { - [_player seekToTime:kCMTimeZero]; - [self play]; - } else { - [self pause]; - } -} - -- (void)videoNodeDidStall:(NSNotification *)notification -{ - self.playerState = ASVideoNodePlayerStateLoading; - if (_delegateFlags.delegateVideoNodeDidStallAtTimeInterval) { - [self.delegate videoNode:self didStallAtTimeInterval:CMTimeGetSeconds(_player.currentItem.currentTime)]; - } -} - -- (void)errorWhilePlaying:(NSNotification *)notification -{ - if ([notification.name isEqualToString:AVPlayerItemFailedToPlayToEndTimeNotification]) { - NSLog(@"Failed to play video"); - } else if ([notification.name isEqualToString:AVPlayerItemNewErrorLogEntryNotification]) { - AVPlayerItem *item = (AVPlayerItem *)notification.object; - AVPlayerItemErrorLogEvent *logEvent = item.errorLog.events.lastObject; - NSLog(@"AVPlayerItem error log entry added for video with error %@ status %@", item.error, - (item.status == AVPlayerItemStatusFailed ? @"FAILED" : [NSString stringWithFormat:@"%ld", (long)item.status])); - NSLog(@"Item is %@", item); - - if (logEvent) { - NSLog(@"Log code %ld domain %@ comment %@", (long)logEvent.errorStatusCode, logEvent.errorDomain, logEvent.errorComment); - } - } -} - -#pragma mark - Internal Properties - -- (AVPlayerItem *)currentItem -{ - ASLockScopeSelf(); - return _currentPlayerItem; -} - -- (void)setCurrentItem:(AVPlayerItem *)currentItem -{ - ASLockScopeSelf(); - - [self removePlayerItemObservers:_currentPlayerItem]; - - _currentPlayerItem = currentItem; - - if (currentItem != nil) { - [self addPlayerItemObservers:currentItem]; - } -} - -- (ASDisplayNode *)playerNode -{ - ASLockScopeSelf(); - return _playerNode; -} - -- (void)setPlayerNode:(ASDisplayNode *)playerNode -{ - { - ASLockScopeSelf(); - _playerNode = playerNode; - } - - [self setNeedsLayout]; -} - -- (void)setPlayer:(AVPlayer *)player -{ - ASLockScopeSelf(); - - [self removePlayerObservers:_player]; - - _player = player; - player.muted = _muted; - ((AVPlayerLayer *)_playerNode.layer).player = player; - - if (player != nil) { - [self addPlayerObservers:player]; - } -} - -- (BOOL)shouldBePlaying -{ - ASLockScopeSelf(); - return _shouldBePlaying; -} - -- (void)setShouldBePlaying:(BOOL)shouldBePlaying -{ - ASLockScopeSelf(); - _shouldBePlaying = shouldBePlaying; -} - -#pragma mark - Lifecycle - -- (void)dealloc -{ - [self removePlayerItemObservers:_currentPlayerItem]; - [self removePlayerObservers:_player]; - - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/ASVideoPlayerNode.h b/Example/Pods/Texture/Source/ASVideoPlayerNode.h deleted file mode 100644 index 4483f601..00000000 --- a/Example/Pods/Texture/Source/ASVideoPlayerNode.h +++ /dev/null @@ -1,225 +0,0 @@ -// -// ASVideoPlayerNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_USE_VIDEO - -#if TARGET_OS_IOS -#import -#import -#import -#import - -@class AVAsset; -@class ASButtonNode; -@protocol ASVideoPlayerNodeDelegate; - -typedef NS_ENUM(NSInteger, ASVideoPlayerNodeControlType) { - ASVideoPlayerNodeControlTypePlaybackButton, - ASVideoPlayerNodeControlTypeElapsedText, - ASVideoPlayerNodeControlTypeDurationText, - ASVideoPlayerNodeControlTypeScrubber, - ASVideoPlayerNodeControlTypeFullScreenButton, - ASVideoPlayerNodeControlTypeFlexGrowSpacer, -}; - -NS_ASSUME_NONNULL_BEGIN - -@interface ASVideoPlayerNode : ASDisplayNode - -@property (nullable, nonatomic, weak) id delegate; - -@property (nonatomic, readonly) CMTime duration; - -@property (nonatomic) BOOL controlsDisabled; - -#pragma mark - ASVideoNode property proxy -/** - * When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the "visible" interfaceState. - * If it leaves the visible interfaceState it will pause but will resume once it has returned. - */ -@property (nonatomic) BOOL shouldAutoPlay; -@property (nonatomic) BOOL shouldAutoRepeat; -@property (nonatomic) BOOL muted; -@property (nonatomic, readonly) ASVideoNodePlayerState playerState; -@property (nonatomic) BOOL shouldAggressivelyRecoverFromStall; -@property (nullable, nonatomic) NSURL *placeholderImageURL; - -@property (nullable, nonatomic) AVAsset *asset; -/** - ** @abstract The URL with which the asset was initialized. - ** @discussion Setting the URL will override the current asset with a newly created AVURLAsset created from the given URL, and AVAsset *asset will point to that newly created AVURLAsset. Please don't set both assetURL and asset. - ** @return Current URL the asset was initialized or nil if no URL was given. - **/ -@property (nullable, nonatomic) NSURL *assetURL; - -/// You should never set any value on the backing video node. Use exclusivively the video player node to set properties -@property (nonatomic, readonly) ASVideoNode *videoNode; - -//! Defaults to 10000 -@property (nonatomic) int32_t periodicTimeObserverTimescale; -//! Defaults to AVLayerVideoGravityResizeAspect -@property (nonatomic, copy) NSString *gravity; - -#pragma mark - Lifecycle -- (instancetype)initWithURL:(NSURL *)URL; -- (instancetype)initWithAsset:(AVAsset *)asset; -- (instancetype)initWithAsset:(AVAsset *)asset videoComposition:(AVVideoComposition *)videoComposition audioMix:(AVAudioMix *)audioMix; - -#pragma mark - Public API -- (void)seekToTime:(CGFloat)percentComplete; -- (void)play; -- (void)pause; -- (BOOL)isPlaying; -- (void)resetToPlaceholder; - -@end - -#pragma mark - ASVideoPlayerNodeDelegate - -@protocol ASVideoPlayerNodeDelegate -@optional -/** - * @abstract Delegate method invoked before creating controlbar controls - * @param videoPlayer The sender - */ -- (NSArray *)videoPlayerNodeNeededDefaultControls:(ASVideoPlayerNode*)videoPlayer; - -/** - * @abstract Delegate method invoked before creating default controls, asks delegate for custom controls dictionary. - * This dictionary must constain only ASDisplayNode subclass objects. - * @param videoPlayer The sender - * @discussion - This method is invoked only when developer implements videoPlayerNodeLayoutSpec:forControls:forMaximumSize: - * and gives ability to add custom constrols to ASVideoPlayerNode, for example mute button. - */ -- (NSDictionary *)videoPlayerNodeCustomControls:(ASVideoPlayerNode*)videoPlayer; - -/** - * @abstract Delegate method invoked in layoutSpecThatFits: - * @param videoPlayer The sender - * @param controls - Dictionary of controls which are used in videoPlayer; Dictionary keys are ASVideoPlayerNodeControlType - * @param maxSize - Maximum size for ASVideoPlayerNode - * @discussion - Developer can layout whole ASVideoPlayerNode as he wants. ASVideoNode is locked and it can't be changed - */ -- (ASLayoutSpec *)videoPlayerNodeLayoutSpec:(ASVideoPlayerNode *)videoPlayer - forControls:(NSDictionary *)controls - forMaximumSize:(CGSize)maxSize; - -#pragma mark Text delegate methods -/** - * @abstract Delegate method invoked before creating ASVideoPlayerNodeControlTypeElapsedText and ASVideoPlayerNodeControlTypeDurationText - * @param videoPlayer The sender - * @param timeLabelType The of the time label - */ -- (NSDictionary *)videoPlayerNodeTimeLabelAttributes:(ASVideoPlayerNode *)videoPlayer timeLabelType:(ASVideoPlayerNodeControlType)timeLabelType; -- (NSString *)videoPlayerNode:(ASVideoPlayerNode *)videoPlayerNode - timeStringForTimeLabelType:(ASVideoPlayerNodeControlType)timeLabelType - forTime:(CMTime)time; - -#pragma mark Scrubber delegate methods -- (UIColor *)videoPlayerNodeScrubberMaximumTrackTint:(ASVideoPlayerNode *)videoPlayer; -- (UIColor *)videoPlayerNodeScrubberMinimumTrackTint:(ASVideoPlayerNode *)videoPlayer; -- (UIColor *)videoPlayerNodeScrubberThumbTint:(ASVideoPlayerNode *)videoPlayer; -- (UIImage *)videoPlayerNodeScrubberThumbImage:(ASVideoPlayerNode *)videoPlayer; - -#pragma mark - Spinner delegate methods -- (UIColor *)videoPlayerNodeSpinnerTint:(ASVideoPlayerNode *)videoPlayer; -- (UIActivityIndicatorViewStyle)videoPlayerNodeSpinnerStyle:(ASVideoPlayerNode *)videoPlayer; - -#pragma mark - Playback button delegate methods -- (UIColor *)videoPlayerNodePlaybackButtonTint:(ASVideoPlayerNode *)videoPlayer; - -#pragma mark - Fullscreen button delegate methods - -- (UIImage *)videoPlayerNodeFullScreenButtonImage:(ASVideoPlayerNode *)videoPlayer; - - -#pragma mark ASVideoNodeDelegate proxy methods -/** - * @abstract Delegate method invoked when ASVideoPlayerNode is taped. - * @param videoPlayer The ASVideoPlayerNode that was tapped. - */ -- (void)didTapVideoPlayerNode:(ASVideoPlayerNode *)videoPlayer; - -/** - * @abstract Delegate method invoked when fullcreen button is taped. - * @param buttonNode The fullscreen button node that was tapped. - */ -- (void)didTapFullScreenButtonNode:(ASButtonNode *)buttonNode; - -/** - * @abstract Delegate method invoked when ASVideoNode playback time is updated. - * @param videoPlayer The video player node - * @param time current playback time. - */ -- (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didPlayToTime:(CMTime)time; - -/** - * @abstract Delegate method invoked when ASVideoNode changes state. - * @param videoPlayer The ASVideoPlayerNode whose ASVideoNode is changing state. - * @param state ASVideoNode state before this change. - * @param toState ASVideoNode new state. - * @discussion This method is called after each state change - */ -- (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer willChangeVideoNodeState:(ASVideoNodePlayerState)state toVideoNodeState:(ASVideoNodePlayerState)toState; - -/** - * @abstract Delegate method is invoked when ASVideoNode decides to change state. - * @param videoPlayer The ASVideoPlayerNode whose ASVideoNode is changing state. - * @param state ASVideoNode that is going to be set. - * @discussion Delegate method invoked when player changes it's state to - * ASVideoNodePlayerStatePlaying or ASVideoNodePlayerStatePaused - * and asks delegate if state change is valid - */ -- (BOOL)videoPlayerNode:(ASVideoPlayerNode*)videoPlayer shouldChangeVideoNodeStateTo:(ASVideoNodePlayerState)state; - -/** - * @abstract Delegate method invoked when the ASVideoNode has played to its end time. - * @param videoPlayer The video node has played to its end time. - */ -- (void)videoPlayerNodeDidPlayToEnd:(ASVideoPlayerNode *)videoPlayer; - -/** - * @abstract Delegate method invoked when the ASVideoNode has constructed its AVPlayerItem for the asset. - * @param videoPlayer The video player node. - * @param currentItem The AVPlayerItem that was constructed from the asset. - */ -- (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didSetCurrentItem:(AVPlayerItem *)currentItem; - -/** - * @abstract Delegate method invoked when the ASVideoNode stalls. - * @param videoPlayer The video player node that has experienced the stall - * @param timeInterval Current playback time when the stall happens - */ -- (void)videoPlayerNode:(ASVideoPlayerNode *)videoPlayer didStallAtTimeInterval:(NSTimeInterval)timeInterval; - -/** - * @abstract Delegate method invoked when the ASVideoNode starts the inital asset loading - * @param videoPlayer The videoPlayer - */ -- (void)videoPlayerNodeDidStartInitialLoading:(ASVideoPlayerNode *)videoPlayer; - -/** - * @abstract Delegate method invoked when the ASVideoNode is done loading the asset and can start the playback - * @param videoPlayer The videoPlayer - */ -- (void)videoPlayerNodeDidFinishInitialLoading:(ASVideoPlayerNode *)videoPlayer; - -/** - * @abstract Delegate method invoked when the ASVideoNode has recovered from the stall - * @param videoPlayer The videoplayer - */ -- (void)videoPlayerNodeDidRecoverFromStall:(ASVideoPlayerNode *)videoPlayer; - - -@end -NS_ASSUME_NONNULL_END -#endif // TARGET_OS_IOS - -#endif diff --git a/Example/Pods/Texture/Source/ASVideoPlayerNode.mm b/Example/Pods/Texture/Source/ASVideoPlayerNode.mm deleted file mode 100644 index 36b4a3fb..00000000 --- a/Example/Pods/Texture/Source/ASVideoPlayerNode.mm +++ /dev/null @@ -1,1017 +0,0 @@ -// -// ASVideoPlayerNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_USE_VIDEO -#if TARGET_OS_IOS - -#import - -#import -#import -#import - -static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; - -@interface ASVideoPlayerNode() -{ - __weak id _delegate; - - struct { - unsigned int delegateNeededDefaultControls:1; - unsigned int delegateCustomControls:1; - unsigned int delegateSpinnerTintColor:1; - unsigned int delegateSpinnerStyle:1; - unsigned int delegatePlaybackButtonTint:1; - unsigned int delegateFullScreenButtonImage:1; - unsigned int delegateScrubberMaximumTrackTintColor:1; - unsigned int delegateScrubberMinimumTrackTintColor:1; - unsigned int delegateScrubberThumbTintColor:1; - unsigned int delegateScrubberThumbImage:1; - unsigned int delegateTimeLabelAttributes:1; - unsigned int delegateTimeLabelAttributedString:1; - unsigned int delegateLayoutSpecForControls:1; - unsigned int delegateVideoNodeDidPlayToTime:1; - unsigned int delegateVideoNodeWillChangeState:1; - unsigned int delegateVideoNodeShouldChangeState:1; - unsigned int delegateVideoNodePlaybackDidFinish:1; - unsigned int delegateDidTapVideoPlayerNode:1; - unsigned int delegateDidTapFullScreenButtonNode:1; - unsigned int delegateVideoPlayerNodeDidSetCurrentItem:1; - unsigned int delegateVideoPlayerNodeDidStallAtTimeInterval:1; - unsigned int delegateVideoPlayerNodeDidStartInitialLoading:1; - unsigned int delegateVideoPlayerNodeDidFinishInitialLoading:1; - unsigned int delegateVideoPlayerNodeDidRecoverFromStall:1; - } _delegateFlags; - - // The asset passed in the initializer will be assigned as pending asset. As soon as the first - // preload state happened all further asset handling is made by using the asset of the backing - // video node - AVAsset *_pendingAsset; - - // The backing video node. Ideally this is the source of truth and the video player node should - // not handle anything related to asset management - ASVideoNode *_videoNode; - - NSArray *_neededDefaultControls; - - NSMutableDictionary *_cachedControls; - - ASDefaultPlaybackButton *_playbackButtonNode; - ASButtonNode *_fullScreenButtonNode; - ASTextNode *_elapsedTextNode; - ASTextNode *_durationTextNode; - ASDisplayNode *_scrubberNode; - ASStackLayoutSpec *_controlFlexGrowSpacerSpec; - ASDisplayNode *_spinnerNode; - - BOOL _isSeeking; - CMTime _duration; - - BOOL _controlsDisabled; - - BOOL _shouldAutoPlay; - BOOL _shouldAutoRepeat; - BOOL _muted; - int32_t _periodicTimeObserverTimescale; - NSString *_gravity; - - BOOL _shouldAggressivelyRecoverFromStall; - - UIColor *_defaultControlsColor; -} - -@end - -@implementation ASVideoPlayerNode - -@dynamic placeholderImageURL; - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - [self _initControlsAndVideoNode]; - - return self; -} - -- (instancetype)initWithAsset:(AVAsset *)asset -{ - if (!(self = [self init])) { - return nil; - } - - _pendingAsset = asset; - - return self; -} - -- (instancetype)initWithURL:(NSURL *)URL -{ - return [self initWithAsset:[AVAsset assetWithURL:URL]]; -} - -- (instancetype)initWithAsset:(AVAsset *)asset videoComposition:(AVVideoComposition *)videoComposition audioMix:(AVAudioMix *)audioMix -{ - if (!(self = [self initWithAsset:asset])) { - return nil; - } - - _videoNode.videoComposition = videoComposition; - _videoNode.audioMix = audioMix; - - return self; -} - -- (void)_initControlsAndVideoNode -{ - _defaultControlsColor = [UIColor whiteColor]; - _cachedControls = [[NSMutableDictionary alloc] init]; - - _videoNode = [[ASVideoNode alloc] init]; - _videoNode.delegate = self; - [self addSubnode:_videoNode]; -} - -#pragma mark - Setter / Getter - -- (void)setAssetURL:(NSURL *)assetURL -{ - ASDisplayNodeAssertMainThread(); - - self.asset = [AVAsset assetWithURL:assetURL]; -} - -- (NSURL *)assetURL -{ - NSURL *url = nil; - { - ASLockScopeSelf(); - if ([_pendingAsset isKindOfClass:AVURLAsset.class]) { - url = ((AVURLAsset *)_pendingAsset).URL; - } - } - - return url ?: _videoNode.assetURL; -} - -- (void)setAsset:(AVAsset *)asset -{ - ASDisplayNodeAssertMainThread(); - - [self lock]; - - // Clean out pending asset - _pendingAsset = nil; - - // Set asset based on interface state - if ((ASInterfaceStateIncludesPreload(self.interfaceState))) { - // Don't hold the lock while accessing the subnode - [self unlock]; - _videoNode.asset = asset; - return; - } - - _pendingAsset = asset; - [self unlock]; -} - -- (AVAsset *)asset -{ - return ASLockedSelf(_pendingAsset) ?: _videoNode.asset; -} - -#pragma mark - ASDisplayNode - -- (void)didLoad -{ - [super didLoad]; - - [self createControls]; -} - -- (void)didEnterPreloadState -{ - [super didEnterPreloadState]; - - AVAsset *pendingAsset = nil; - { - ASLockScopeSelf(); - pendingAsset = _pendingAsset; - _pendingAsset = nil; - } - - // If we enter preload state we apply the pending asset to load to the video node so it can start and fetch the asset - if (pendingAsset != nil && _videoNode.asset != pendingAsset) { - _videoNode.asset = pendingAsset; - } -} - -- (BOOL)supportsLayerBacking -{ - return NO; -} - -#pragma mark - UI - -- (void)createControls -{ - { - ASLockScopeSelf(); - - if (_controlsDisabled) { - return; - } - - if (_neededDefaultControls == nil) { - _neededDefaultControls = [self createDefaultControlElementArray]; - } - - if (_cachedControls == nil) { - _cachedControls = [[NSMutableDictionary alloc] init]; - } - - for (id object in _neededDefaultControls) { - ASVideoPlayerNodeControlType type = (ASVideoPlayerNodeControlType)[object integerValue]; - switch (type) { - case ASVideoPlayerNodeControlTypePlaybackButton: - [self _locked_createPlaybackButton]; - break; - case ASVideoPlayerNodeControlTypeElapsedText: - [self _locked_createElapsedTextField]; - break; - case ASVideoPlayerNodeControlTypeDurationText: - [self _locked_createDurationTextField]; - break; - case ASVideoPlayerNodeControlTypeScrubber: - [self _locked_createScrubber]; - break; - case ASVideoPlayerNodeControlTypeFullScreenButton: - [self _locked_createFullScreenButton]; - break; - case ASVideoPlayerNodeControlTypeFlexGrowSpacer: - [self _locked_createControlFlexGrowSpacer]; - break; - default: - break; - } - } - - if (_delegateFlags.delegateCustomControls && _delegateFlags.delegateLayoutSpecForControls) { - NSDictionary *customControls = [_delegate videoPlayerNodeCustomControls:self]; - std::vector subnodes; - for (id key in customControls) { - id node = customControls[key]; - if (![node isKindOfClass:[ASDisplayNode class]]) { - continue; - } - - subnodes.push_back(node); - [_cachedControls setObject:node forKey:key]; - } - - { - ASUnlockScope(self); - for (ASDisplayNode *subnode : subnodes) { - [self addSubnode:subnode]; - } - } - } - } - - ASPerformBlockOnMainThread(^{ - [self setNeedsLayout]; - }); -} - -- (NSArray *)createDefaultControlElementArray -{ - if (_delegateFlags.delegateNeededDefaultControls) { - return [_delegate videoPlayerNodeNeededDefaultControls:self]; - } - - return @[ @(ASVideoPlayerNodeControlTypePlaybackButton), - @(ASVideoPlayerNodeControlTypeElapsedText), - @(ASVideoPlayerNodeControlTypeScrubber), - @(ASVideoPlayerNodeControlTypeDurationText) ]; -} - -- (void)removeControls -{ - NSMutableDictionary *cachedControls = nil; - { - ASLockScope(self); - - // Grab the cached controls for removing it - cachedControls = [_cachedControls copy]; - [self _locked_cleanCachedControls]; - } - - for (ASDisplayNode *node in [cachedControls objectEnumerator]) { - [node removeFromSupernode]; - } -} - -- (void)_locked_cleanCachedControls -{ - [_cachedControls removeAllObjects]; - - _playbackButtonNode = nil; - _fullScreenButtonNode = nil; - _elapsedTextNode = nil; - _durationTextNode = nil; - _scrubberNode = nil; -} - -- (void)_locked_createPlaybackButton -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_playbackButtonNode == nil) { - _playbackButtonNode = [[ASDefaultPlaybackButton alloc] init]; - _playbackButtonNode.style.preferredSize = CGSizeMake(16.0, 22.0); - - if (_delegateFlags.delegatePlaybackButtonTint) { - _playbackButtonNode.tintColor = [_delegate videoPlayerNodePlaybackButtonTint:self]; - } else { - _playbackButtonNode.tintColor = _defaultControlsColor; - } - - if (_videoNode.playerState == ASVideoNodePlayerStatePlaying) { - _playbackButtonNode.buttonType = ASDefaultPlaybackButtonTypePause; - } - - [_playbackButtonNode addTarget:self action:@selector(didTapPlaybackButton:) forControlEvents:ASControlNodeEventTouchUpInside]; - [_cachedControls setObject:_playbackButtonNode forKey:@(ASVideoPlayerNodeControlTypePlaybackButton)]; - } - - { - ASUnlockScope(self); - [self addSubnode:_playbackButtonNode]; - } -} - -- (void)_locked_createFullScreenButton -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_fullScreenButtonNode == nil) { - _fullScreenButtonNode = [[ASButtonNode alloc] init]; - _fullScreenButtonNode.style.preferredSize = CGSizeMake(16.0, 22.0); - - if (_delegateFlags.delegateFullScreenButtonImage) { - [_fullScreenButtonNode setImage:[_delegate videoPlayerNodeFullScreenButtonImage:self] forState:UIControlStateNormal]; - } - - [_fullScreenButtonNode addTarget:self action:@selector(didTapFullScreenButton:) forControlEvents:ASControlNodeEventTouchUpInside]; - [_cachedControls setObject:_fullScreenButtonNode forKey:@(ASVideoPlayerNodeControlTypeFullScreenButton)]; - } - - { - ASUnlockScope(self); - [self addSubnode:_fullScreenButtonNode]; - } -} - -- (void)_locked_createElapsedTextField -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_elapsedTextNode == nil) { - _elapsedTextNode = [[ASTextNode alloc] init]; - _elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" - forControlType:ASVideoPlayerNodeControlTypeElapsedText]; - _elapsedTextNode.truncationMode = NSLineBreakByClipping; - - [_cachedControls setObject:_elapsedTextNode forKey:@(ASVideoPlayerNodeControlTypeElapsedText)]; - } - { - ASUnlockScope(self); - [self addSubnode:_elapsedTextNode]; - } -} - -- (void)_locked_createDurationTextField -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_durationTextNode == nil) { - _durationTextNode = [[ASTextNode alloc] init]; - _durationTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" - forControlType:ASVideoPlayerNodeControlTypeDurationText]; - _durationTextNode.truncationMode = NSLineBreakByClipping; - - [_cachedControls setObject:_durationTextNode forKey:@(ASVideoPlayerNodeControlTypeDurationText)]; - } - [self updateDurationTimeLabel]; - { - ASUnlockScope(self); - [self addSubnode:_durationTextNode]; - } -} - -- (void)_locked_createScrubber -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_scrubberNode == nil) { - __weak __typeof__(self) weakSelf = self; - _scrubberNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView * _Nonnull { - __typeof__(self) strongSelf = weakSelf; - - UISlider *slider = [[UISlider alloc] initWithFrame:CGRectZero]; - slider.minimumValue = 0.0; - slider.maximumValue = 1.0; - - if (strongSelf->_delegateFlags.delegateScrubberMinimumTrackTintColor) { - slider.minimumTrackTintColor = [strongSelf.delegate videoPlayerNodeScrubberMinimumTrackTint:strongSelf]; - } - - if (strongSelf->_delegateFlags.delegateScrubberMaximumTrackTintColor) { - slider.maximumTrackTintColor = [strongSelf.delegate videoPlayerNodeScrubberMaximumTrackTint:strongSelf]; - } - - if (strongSelf->_delegateFlags.delegateScrubberThumbTintColor) { - slider.thumbTintColor = [strongSelf.delegate videoPlayerNodeScrubberThumbTint:strongSelf]; - } - - if (strongSelf->_delegateFlags.delegateScrubberThumbImage) { - UIImage *thumbImage = [strongSelf.delegate videoPlayerNodeScrubberThumbImage:strongSelf]; - [slider setThumbImage:thumbImage forState:UIControlStateNormal]; - } - - - [slider addTarget:strongSelf action:@selector(beginSeek) forControlEvents:UIControlEventTouchDown]; - [slider addTarget:strongSelf action:@selector(endSeek) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside|UIControlEventTouchCancel]; - [slider addTarget:strongSelf action:@selector(seekTimeDidChange:) forControlEvents:UIControlEventValueChanged]; - - return slider; - }]; - - _scrubberNode.style.flexShrink = 1; - - [_cachedControls setObject:_scrubberNode forKey:@(ASVideoPlayerNodeControlTypeScrubber)]; - } - { - ASUnlockScope(self); - [self addSubnode:_scrubberNode]; - } -} - -- (void)_locked_createControlFlexGrowSpacer -{ - DISABLED_ASAssertLocked(__instanceLock__); - - if (_controlFlexGrowSpacerSpec == nil) { - _controlFlexGrowSpacerSpec = [[ASStackLayoutSpec alloc] init]; - _controlFlexGrowSpacerSpec.style.flexGrow = 1.0; - } - - [_cachedControls setObject:_controlFlexGrowSpacerSpec forKey:@(ASVideoPlayerNodeControlTypeFlexGrowSpacer)]; -} - -- (void)updateDurationTimeLabel -{ - if (!_durationTextNode) { - return; - } - NSString *formattedDuration = [self timeStringForCMTime:_duration forTimeLabelType:ASVideoPlayerNodeControlTypeDurationText]; - _durationTextNode.attributedText = [self timeLabelAttributedStringForString:formattedDuration forControlType:ASVideoPlayerNodeControlTypeDurationText]; -} - -- (void)updateElapsedTimeLabel:(NSTimeInterval)seconds -{ - if (!_elapsedTextNode) { - return; - } - NSString *formattedElapsed = [self timeStringForCMTime:CMTimeMakeWithSeconds( seconds, _videoNode.periodicTimeObserverTimescale ) forTimeLabelType:ASVideoPlayerNodeControlTypeElapsedText]; - _elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:formattedElapsed forControlType:ASVideoPlayerNodeControlTypeElapsedText]; -} - -- (NSAttributedString*)timeLabelAttributedStringForString:(NSString*)string forControlType:(ASVideoPlayerNodeControlType)controlType -{ - NSDictionary *options; - if (_delegateFlags.delegateTimeLabelAttributes) { - options = [_delegate videoPlayerNodeTimeLabelAttributes:self timeLabelType:controlType]; - } else { - options = @{ - NSFontAttributeName : [UIFont systemFontOfSize:12.0], - NSForegroundColorAttributeName: _defaultControlsColor - }; - } - - - NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string attributes:options]; - - return attributedString; -} - -#pragma mark - ASVideoNodeDelegate -- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toState -{ - if (_delegateFlags.delegateVideoNodeWillChangeState) { - [_delegate videoPlayerNode:self willChangeVideoNodeState:state toVideoNodeState:toState]; - } - - if (toState == ASVideoNodePlayerStateReadyToPlay) { - _duration = _videoNode.currentItem.duration; - [self updateDurationTimeLabel]; - } - - if (toState == ASVideoNodePlayerStatePlaying) { - _playbackButtonNode.buttonType = ASDefaultPlaybackButtonTypePause; - [self removeSpinner]; - } else if (toState != ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying && toState != ASVideoNodePlayerStateReadyToPlay) { - _playbackButtonNode.buttonType = ASDefaultPlaybackButtonTypePlay; - } - - if (toState == ASVideoNodePlayerStateLoading || toState == ASVideoNodePlayerStateInitialLoading) { - [self showSpinner]; - } - - if (toState == ASVideoNodePlayerStateReadyToPlay || toState == ASVideoNodePlayerStatePaused || toState == ASVideoNodePlayerStatePlaybackLikelyToKeepUpButNotPlaying) { - [self removeSpinner]; - } -} - -- (BOOL)videoNode:(ASVideoNode *)videoNode shouldChangePlayerStateTo:(ASVideoNodePlayerState)state -{ - if (_delegateFlags.delegateVideoNodeShouldChangeState) { - return [_delegate videoPlayerNode:self shouldChangeVideoNodeStateTo:state]; - } - return YES; -} - -- (void)videoNode:(ASVideoNode *)videoNode didPlayToTimeInterval:(NSTimeInterval)timeInterval -{ - if (_delegateFlags.delegateVideoNodeDidPlayToTime) { - [_delegate videoPlayerNode:self didPlayToTime:_videoNode.player.currentTime]; - } - - if (_isSeeking) { - return; - } - - if (_elapsedTextNode) { - [self updateElapsedTimeLabel:timeInterval]; - } - - if (_scrubberNode) { - [(UISlider*)_scrubberNode.view setValue:( timeInterval / CMTimeGetSeconds(_duration) ) animated:NO]; - } -} - -- (void)videoDidPlayToEnd:(ASVideoNode *)videoNode -{ - if (_delegateFlags.delegateVideoNodePlaybackDidFinish) { - [_delegate videoPlayerNodeDidPlayToEnd:self]; - } -} - -- (void)didTapVideoNode:(ASVideoNode *)videoNode -{ - if (_delegateFlags.delegateDidTapVideoPlayerNode) { - [_delegate didTapVideoPlayerNode:self]; - } else { - [self togglePlayPause]; - } -} - -- (void)videoNode:(ASVideoNode *)videoNode didSetCurrentItem:(AVPlayerItem *)currentItem -{ - if (_delegateFlags.delegateVideoPlayerNodeDidSetCurrentItem) { - [_delegate videoPlayerNode:self didSetCurrentItem:currentItem]; - } -} - -- (void)videoNode:(ASVideoNode *)videoNode didStallAtTimeInterval:(NSTimeInterval)timeInterval -{ - if (_delegateFlags.delegateVideoPlayerNodeDidStallAtTimeInterval) { - [_delegate videoPlayerNode:self didStallAtTimeInterval:timeInterval]; - } -} - -- (void)videoNodeDidStartInitialLoading:(ASVideoNode *)videoNode -{ - if (_delegateFlags.delegateVideoPlayerNodeDidStartInitialLoading) { - [_delegate videoPlayerNodeDidStartInitialLoading:self]; - } -} - -- (void)videoNodeDidFinishInitialLoading:(ASVideoNode *)videoNode -{ - if (_delegateFlags.delegateVideoPlayerNodeDidFinishInitialLoading) { - [_delegate videoPlayerNodeDidFinishInitialLoading:self]; - } -} - -- (void)videoNodeDidRecoverFromStall:(ASVideoNode *)videoNode -{ - if (_delegateFlags.delegateVideoPlayerNodeDidRecoverFromStall) { - [_delegate videoPlayerNodeDidRecoverFromStall:self]; - } -} - -#pragma mark - Actions -- (void)togglePlayPause -{ - if (_videoNode.playerState == ASVideoNodePlayerStatePlaying) { - [_videoNode pause]; - } else { - [_videoNode play]; - } -} - -- (void)showSpinner -{ - ASLockScopeSelf(); - - if (!_spinnerNode) { - __weak __typeof__(self) weakSelf = self; - _spinnerNode = [[ASDisplayNode alloc] initWithViewBlock:^UIView *{ - __typeof__(self) strongSelf = weakSelf; - UIActivityIndicatorView *spinnnerView = [[UIActivityIndicatorView alloc] init]; - spinnnerView.backgroundColor = [UIColor clearColor]; - - if (strongSelf->_delegateFlags.delegateSpinnerTintColor) { - spinnnerView.color = [strongSelf->_delegate videoPlayerNodeSpinnerTint:strongSelf]; - } else { - spinnnerView.color = strongSelf->_defaultControlsColor; - } - - if (strongSelf->_delegateFlags.delegateSpinnerStyle) { - spinnnerView.activityIndicatorViewStyle = [strongSelf->_delegate videoPlayerNodeSpinnerStyle:strongSelf]; - } - - return spinnnerView; - }]; - _spinnerNode.style.preferredSize = CGSizeMake(44.0, 44.0); - - const auto spinnerNode = _spinnerNode; - { - ASUnlockScope(self); - [self addSubnode:spinnerNode]; - [self setNeedsLayout]; - } - } - [(UIActivityIndicatorView *)_spinnerNode.view startAnimating]; -} - -- (void)removeSpinner -{ - ASDisplayNode *spinnerNode = nil; - { - ASLockScopeSelf(); - if (!_spinnerNode) { - return; - } - - spinnerNode = _spinnerNode; - _spinnerNode = nil; - } - - [spinnerNode removeFromSupernode]; -} - -- (void)didTapPlaybackButton:(ASControlNode*)node -{ - [self togglePlayPause]; -} - -- (void)didTapFullScreenButton:(ASButtonNode*)node -{ - if (_delegateFlags.delegateDidTapFullScreenButtonNode) { - [_delegate didTapFullScreenButtonNode:node]; - } -} - -- (void)beginSeek -{ - _isSeeking = YES; -} - -- (void)endSeek -{ - _isSeeking = NO; -} - -- (void)seekTimeDidChange:(UISlider*)slider -{ - CGFloat percentage = slider.value * 100; - [self seekToTime:percentage]; -} - -#pragma mark - Public API -- (void)seekToTime:(CGFloat)percentComplete -{ - CGFloat seconds = ( CMTimeGetSeconds(_duration) * percentComplete ) / 100; - - [self updateElapsedTimeLabel:seconds]; - [_videoNode.player seekToTime:CMTimeMakeWithSeconds(seconds, _videoNode.periodicTimeObserverTimescale)]; - - if (_videoNode.playerState != ASVideoNodePlayerStatePlaying) { - [self togglePlayPause]; - } -} - -- (void)play -{ - [_videoNode play]; -} - -- (void)pause -{ - [_videoNode pause]; -} - -- (BOOL)isPlaying -{ - return [_videoNode isPlaying]; -} - -- (void)resetToPlaceholder -{ - [_videoNode resetToPlaceholder]; -} - -- (NSArray *)controlsForLayoutSpec -{ - NSMutableArray *controls = [[NSMutableArray alloc] initWithCapacity:_cachedControls.count]; - - if (_cachedControls[ @(ASVideoPlayerNodeControlTypePlaybackButton) ]) { - [controls addObject:_cachedControls[ @(ASVideoPlayerNodeControlTypePlaybackButton) ]]; - } - - if (_cachedControls[ @(ASVideoPlayerNodeControlTypeElapsedText) ]) { - [controls addObject:_cachedControls[ @(ASVideoPlayerNodeControlTypeElapsedText) ]]; - } - - if (_cachedControls[ @(ASVideoPlayerNodeControlTypeScrubber) ]) { - [controls addObject:_cachedControls[ @(ASVideoPlayerNodeControlTypeScrubber) ]]; - } - - if (_cachedControls[ @(ASVideoPlayerNodeControlTypeDurationText) ]) { - [controls addObject:_cachedControls[ @(ASVideoPlayerNodeControlTypeDurationText) ]]; - } - - if (_cachedControls[ @(ASVideoPlayerNodeControlTypeFullScreenButton) ]) { - [controls addObject:_cachedControls[ @(ASVideoPlayerNodeControlTypeFullScreenButton) ]]; - } - - return controls; -} - - -#pragma mark - Layout - -- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize -{ - CGSize maxSize = constrainedSize.max; - - // Prevent crashes through if infinite width or height - if (isinf(maxSize.width) || isinf(maxSize.height)) { - ASDisplayNodeAssert(NO, @"Infinite width or height in ASVideoPlayerNode"); - maxSize = CGSizeZero; - } - - _videoNode.style.preferredSize = maxSize; - - ASLayoutSpec *layoutSpec; - if (_delegateFlags.delegateLayoutSpecForControls) { - layoutSpec = [_delegate videoPlayerNodeLayoutSpec:self forControls:_cachedControls forMaximumSize:maxSize]; - } else { - layoutSpec = [self defaultLayoutSpecThatFits:maxSize]; - } - - NSMutableArray *children = [[NSMutableArray alloc] init]; - - if (_spinnerNode) { - ASCenterLayoutSpec *centerLayoutSpec = [ASCenterLayoutSpec centerLayoutSpecWithCenteringOptions:ASCenterLayoutSpecCenteringXY sizingOptions:ASCenterLayoutSpecSizingOptionDefault child:_spinnerNode]; - centerLayoutSpec.style.preferredSize = maxSize; - [children addObject:centerLayoutSpec]; - } - - ASOverlayLayoutSpec *overlaySpec = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:_videoNode overlay:layoutSpec]; - overlaySpec.style.preferredSize = maxSize; - [children addObject:overlaySpec]; - - return [ASAbsoluteLayoutSpec absoluteLayoutSpecWithChildren:children]; -} - -- (ASLayoutSpec *)defaultLayoutSpecThatFits:(CGSize)maxSize -{ - _scrubberNode.style.preferredSize = CGSizeMake(maxSize.width, 44.0); - - ASLayoutSpec *spacer = [[ASLayoutSpec alloc] init]; - spacer.style.flexGrow = 1.0; - - ASStackLayoutSpec *controlbarSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:10.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsCenter - children: [self controlsForLayoutSpec] ]; - controlbarSpec.style.alignSelf = ASStackLayoutAlignSelfStretch; - - UIEdgeInsets insets = UIEdgeInsetsMake(10.0, 10.0, 10.0, 10.0); - - ASInsetLayoutSpec *controlbarInsetSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:controlbarSpec]; - - controlbarInsetSpec.style.alignSelf = ASStackLayoutAlignSelfStretch; - - ASStackLayoutSpec *mainVerticalStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical - spacing:0.0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - children:@[spacer,controlbarInsetSpec]]; - - return mainVerticalStack; -} - -#pragma mark - Properties -- (id)delegate -{ - return _delegate; -} - -- (void)setDelegate:(id)delegate -{ - if (delegate == _delegate) { - return; - } - - _delegate = delegate; - - if (_delegate == nil) { - memset(&_delegateFlags, 0, sizeof(_delegateFlags)); - } else { - _delegateFlags.delegateNeededDefaultControls = [_delegate respondsToSelector:@selector(videoPlayerNodeNeededDefaultControls:)]; - _delegateFlags.delegateCustomControls = [_delegate respondsToSelector:@selector(videoPlayerNodeCustomControls:)]; - _delegateFlags.delegateSpinnerTintColor = [_delegate respondsToSelector:@selector(videoPlayerNodeSpinnerTint:)]; - _delegateFlags.delegateSpinnerStyle = [_delegate respondsToSelector:@selector(videoPlayerNodeSpinnerStyle:)]; - _delegateFlags.delegateScrubberMaximumTrackTintColor = [_delegate respondsToSelector:@selector(videoPlayerNodeScrubberMaximumTrackTint:)]; - _delegateFlags.delegateScrubberMinimumTrackTintColor = [_delegate respondsToSelector:@selector(videoPlayerNodeScrubberMinimumTrackTint:)]; - _delegateFlags.delegateScrubberThumbTintColor = [_delegate respondsToSelector:@selector(videoPlayerNodeScrubberThumbTint:)]; - _delegateFlags.delegateScrubberThumbImage = [_delegate respondsToSelector:@selector(videoPlayerNodeScrubberThumbImage:)]; - _delegateFlags.delegateTimeLabelAttributes = [_delegate respondsToSelector:@selector(videoPlayerNodeTimeLabelAttributes:timeLabelType:)]; - _delegateFlags.delegateLayoutSpecForControls = [_delegate respondsToSelector:@selector(videoPlayerNodeLayoutSpec:forControls:forMaximumSize:)]; - _delegateFlags.delegateVideoNodeDidPlayToTime = [_delegate respondsToSelector:@selector(videoPlayerNode:didPlayToTime:)]; - _delegateFlags.delegateVideoNodeWillChangeState = [_delegate respondsToSelector:@selector(videoPlayerNode:willChangeVideoNodeState:toVideoNodeState:)]; - _delegateFlags.delegateVideoNodePlaybackDidFinish = [_delegate respondsToSelector:@selector(videoPlayerNodeDidPlayToEnd:)]; - _delegateFlags.delegateVideoNodeShouldChangeState = [_delegate respondsToSelector:@selector(videoPlayerNode:shouldChangeVideoNodeStateTo:)]; - _delegateFlags.delegateTimeLabelAttributedString = [_delegate respondsToSelector:@selector(videoPlayerNode:timeStringForTimeLabelType:forTime:)]; - _delegateFlags.delegatePlaybackButtonTint = [_delegate respondsToSelector:@selector(videoPlayerNodePlaybackButtonTint:)]; - _delegateFlags.delegateFullScreenButtonImage = [_delegate respondsToSelector:@selector(videoPlayerNodeFullScreenButtonImage:)]; - _delegateFlags.delegateDidTapVideoPlayerNode = [_delegate respondsToSelector:@selector(didTapVideoPlayerNode:)]; - _delegateFlags.delegateDidTapFullScreenButtonNode = [_delegate respondsToSelector:@selector(didTapFullScreenButtonNode:)]; - _delegateFlags.delegateVideoPlayerNodeDidSetCurrentItem = [_delegate respondsToSelector:@selector(videoPlayerNode:didSetCurrentItem:)]; - _delegateFlags.delegateVideoPlayerNodeDidStallAtTimeInterval = [_delegate respondsToSelector:@selector(videoPlayerNode:didStallAtTimeInterval:)]; - _delegateFlags.delegateVideoPlayerNodeDidStartInitialLoading = [_delegate respondsToSelector:@selector(videoPlayerNodeDidStartInitialLoading:)]; - _delegateFlags.delegateVideoPlayerNodeDidFinishInitialLoading = [_delegate respondsToSelector:@selector(videoPlayerNodeDidFinishInitialLoading:)]; - _delegateFlags.delegateVideoPlayerNodeDidRecoverFromStall = [_delegate respondsToSelector:@selector(videoPlayerNodeDidRecoverFromStall:)]; - } -} - -- (void)setControlsDisabled:(BOOL)controlsDisabled -{ - if (_controlsDisabled == controlsDisabled) { - return; - } - - _controlsDisabled = controlsDisabled; - - if (_controlsDisabled && _cachedControls.count > 0) { - [self removeControls]; - } else if (!_controlsDisabled) { - [self createControls]; - } -} - -- (void)setShouldAutoPlay:(BOOL)shouldAutoPlay -{ - if (_shouldAutoPlay == shouldAutoPlay) { - return; - } - _shouldAutoPlay = shouldAutoPlay; - _videoNode.shouldAutoplay = _shouldAutoPlay; -} - -- (void)setShouldAutoRepeat:(BOOL)shouldAutoRepeat -{ - if (_shouldAutoRepeat == shouldAutoRepeat) { - return; - } - _shouldAutoRepeat = shouldAutoRepeat; - _videoNode.shouldAutorepeat = _shouldAutoRepeat; -} - -- (void)setMuted:(BOOL)muted -{ - if (_muted == muted) { - return; - } - _muted = muted; - _videoNode.muted = _muted; -} - -- (void)setPeriodicTimeObserverTimescale:(int32_t)periodicTimeObserverTimescale -{ - if (_periodicTimeObserverTimescale == periodicTimeObserverTimescale) { - return; - } - _periodicTimeObserverTimescale = periodicTimeObserverTimescale; - _videoNode.periodicTimeObserverTimescale = _periodicTimeObserverTimescale; -} - -- (NSString *)gravity -{ - if (_gravity == nil) { - _gravity = _videoNode.gravity; - } - return _gravity; -} - -- (void)setGravity:(NSString *)gravity -{ - if (_gravity == gravity) { - return; - } - _gravity = gravity; - _videoNode.gravity = _gravity; -} - -- (ASVideoNodePlayerState)playerState -{ - return _videoNode.playerState; -} - -- (BOOL)shouldAggressivelyRecoverFromStall -{ - return _videoNode.shouldAggressivelyRecoverFromStall; -} - -- (void) setPlaceholderImageURL:(NSURL *)placeholderImageURL -{ - _videoNode.URL = placeholderImageURL; -} - -- (NSURL*) placeholderImageURL -{ - return _videoNode.URL; -} - -- (ASVideoNode*)videoNode -{ - return _videoNode; -} - -- (void)setShouldAggressivelyRecoverFromStall:(BOOL)shouldAggressivelyRecoverFromStall -{ - if (_shouldAggressivelyRecoverFromStall == shouldAggressivelyRecoverFromStall) { - return; - } - _shouldAggressivelyRecoverFromStall = shouldAggressivelyRecoverFromStall; - _videoNode.shouldAggressivelyRecoverFromStall = _shouldAggressivelyRecoverFromStall; -} - -#pragma mark - Helpers -- (NSString *)timeStringForCMTime:(CMTime)time forTimeLabelType:(ASVideoPlayerNodeControlType)type -{ - if (!CMTIME_IS_VALID(time)) { - return @"00:00"; - } - if (_delegateFlags.delegateTimeLabelAttributedString) { - return [_delegate videoPlayerNode:self timeStringForTimeLabelType:type forTime:time]; - } - - NSUInteger dTotalSeconds = CMTimeGetSeconds(time); - - NSUInteger dHours = floor(dTotalSeconds / 3600); - NSUInteger dMinutes = floor(dTotalSeconds % 3600 / 60); - NSUInteger dSeconds = floor(dTotalSeconds % 3600 % 60); - - NSString *videoDurationText; - if (dHours > 0) { - videoDurationText = [NSString stringWithFormat:@"%i:%02i:%02i", (int)dHours, (int)dMinutes, (int)dSeconds]; - } else { - videoDurationText = [NSString stringWithFormat:@"%02i:%02i", (int)dMinutes, (int)dSeconds]; - } - return videoDurationText; -} - -@end - -#endif // TARGET_OS_IOS - -#endif diff --git a/Example/Pods/Texture/Source/ASVisibilityProtocols.h b/Example/Pods/Texture/Source/ASVisibilityProtocols.h deleted file mode 100644 index d8ab1773..00000000 --- a/Example/Pods/Texture/Source/ASVisibilityProtocols.h +++ /dev/null @@ -1,145 +0,0 @@ -// -// ASVisibilityProtocols.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class UIViewController; - -ASDK_EXTERN ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth); - -/** - * ASVisibilityDepth - * - * @discussion "Visibility Depth" represents the number of user actions required to make an ASDisplayNode or - * ASDKViewController visibile. AsyncDisplayKit uses this information to intelligently manage memory and focus - * resources where they are most visible to the user. - * - * The ASVisibilityDepth protocol describes how custom view controllers can integrate with this system. - * - * Parent view controllers should also implement @c ASManagesChildVisibilityDepth - * - * @see ASManagesChildVisibilityDepth - */ - -@protocol ASVisibilityDepth - -/** - * Visibility depth - * - * @discussion Represents the number of user actions necessary to reach the view controller. An increased visibility - * depth indicates a higher number of user interactions for the view controller to be visible again. For example, - * an onscreen navigation controller's top view controller should have a visibility depth of 0. The view controller - * one from the top should have a visibility depth of 1 as should the root view controller in the stack (because - * the user can hold the back button to pop to the root view controller). - * - * Visibility depth is used to automatically adjust ranges on range controllers (and thus free up memory) and can - * be used to reduce memory usage of other items as well. - */ -- (NSInteger)visibilityDepth; - -/** - * Called when visibility depth changes - * - * @discussion @c visibilityDepthDidChange is called whenever the visibility depth of the represented view controller - * has changed. - * - * If implemented by a view controller container, use this method to notify child view controllers that their view - * depth has changed @see ASDKNavigationController.m - * - * If implemented on an ASDKViewController, use this method to reduce or increase the resources that your - * view controller uses. A higher visibility depth view controller should decrease it's resource usage, a lower - * visibility depth controller should pre-warm resources in preperation for a display at 0 depth. - * - * ASDKViewController implements this method and reduces / increases range mode of supporting nodes (such as ASCollectionNode - * and ASTableNode). - * - * @see visibilityDepth - */ -- (void)visibilityDepthDidChange; - -@end - -/** - * ASManagesChildVisibilityDepth - * - * @discussion A protocol which should be implemented by container view controllers to allow proper - * propagation of visibility depth - * - * @see ASVisibilityDepth - */ -@protocol ASManagesChildVisibilityDepth - -/** - * @abstract Container view controllers should adopt this protocol to indicate that they will manage their child's - * visibilityDepth. For example, ASDKNavigationController adopts this protocol and manages its childrens visibility - * depth. - * - * If you adopt this protocol, you *must* also emit visibilityDepthDidChange messages to child view controllers. - * - * @param childViewController Expected to return the visibility depth of the child view controller. - */ -- (NSInteger)visibilityDepthOfChildViewController:(UIViewController *)childViewController; - -@end - -#define ASVisibilitySetVisibilityDepth \ -- (void)setVisibilityDepth:(NSUInteger)visibilityDepth \ -{ \ - if (_visibilityDepth == visibilityDepth) { \ - return; \ - } \ - _visibilityDepth = visibilityDepth; \ - [self visibilityDepthDidChange]; \ -} - -#define ASVisibilityDepthImplementation \ -- (NSInteger)visibilityDepth \ -{ \ - if (self.parentViewController && _parentManagesVisibilityDepth == NO) { \ - _parentManagesVisibilityDepth = [self.parentViewController conformsToProtocol:@protocol(ASManagesChildVisibilityDepth)]; \ - } \ - \ - if (_parentManagesVisibilityDepth) { \ - return [(id )self.parentViewController visibilityDepthOfChildViewController:self]; \ - } \ - return _visibilityDepth; \ -} - -#define ASVisibilityViewDidDisappearImplementation \ -- (void)viewDidDisappear:(BOOL)animated \ -{ \ - [super viewDidDisappear:animated]; \ - \ - if (_parentManagesVisibilityDepth == NO) { \ - [self setVisibilityDepth:1]; \ - } \ -} - -#define ASVisibilityViewWillAppear \ -- (void)viewWillAppear:(BOOL)animated \ -{ \ - [super viewWillAppear:animated]; \ - \ - if (_parentManagesVisibilityDepth == NO) { \ - [self setVisibilityDepth:0]; \ - } \ -} - -#define ASVisibilityDidMoveToParentViewController \ -- (void)didMoveToParentViewController:(UIViewController *)parent \ -{ \ - [super didMoveToParentViewController:parent]; \ - _parentManagesVisibilityDepth = NO; \ - [self visibilityDepthDidChange]; \ -} - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/ASVisibilityProtocols.mm b/Example/Pods/Texture/Source/ASVisibilityProtocols.mm deleted file mode 100644 index b13a683b..00000000 --- a/Example/Pods/Texture/Source/ASVisibilityProtocols.mm +++ /dev/null @@ -1,22 +0,0 @@ -// -// ASVisibilityProtocols.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth) -{ - if (visibilityDepth == 0) { - return ASLayoutRangeModeFull; - } else if (visibilityDepth == 1) { - return ASLayoutRangeModeMinimum; - } else if (visibilityDepth == 2) { - return ASLayoutRangeModeVisibleOnly; - } - return ASLayoutRangeModeLowMemory; -} diff --git a/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.h b/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.h deleted file mode 100644 index aa0de425..00000000 --- a/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// AsyncDisplayKit+IGListKitMethods.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * If you are using AsyncDisplayKit with IGListKit, you should use - * these methods to provide implementations for methods like - * -cellForItemAtIndex: that don't apply when used with AsyncDisplayKit. - * - * Your section controllers should also conform to @c ASSectionController and your - * supplementary view sources should conform to @c ASSupplementaryNodeSource. - */ - -AS_SUBCLASSING_RESTRICTED -@interface ASIGListSectionControllerMethods : NSObject - -/** - * Call this for your section controller's @c cellForItemAtIndex: method. - */ -+ (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index sectionController:(IGListSectionController *)sectionController; - -/** - * Call this for your section controller's @c sizeForItemAtIndex: method. - */ -+ (CGSize)sizeForItemAtIndex:(NSInteger)index; - -@end - -AS_SUBCLASSING_RESTRICTED -@interface ASIGListSupplementaryViewSourceMethods : NSObject - -/** - * Call this for your supplementary source's @c viewForSupplementaryElementOfKind:atIndex: method. - */ -+ (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind - atIndex:(NSInteger)index - sectionController:(IGListSectionController *)sectionController; - -/** - * Call this for your supplementary source's @c sizeForSupplementaryViewOfKind:atIndex: method. - */ -+ (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndex:(NSInteger)index; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.mm b/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.mm deleted file mode 100644 index 50d7a219..00000000 --- a/Example/Pods/Texture/Source/AsyncDisplayKit+IGListKitMethods.mm +++ /dev/null @@ -1,53 +0,0 @@ -// -// AsyncDisplayKit+IGListKitMethods.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import "AsyncDisplayKit+IGListKitMethods.h" -#import -#import -#import - - -@implementation ASIGListSectionControllerMethods - -+ (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index sectionController:(IGListSectionController *)sectionController -{ - // Cast to id for backwards-compatibility until 3.0.0 is officially released – IGListSectionType was removed. This is safe. - return [sectionController.collectionContext dequeueReusableCellOfClass:[_ASCollectionViewCell class] forSectionController:(id)sectionController atIndex:index]; -} - -+ (CGSize)sizeForItemAtIndex:(NSInteger)index -{ - ASDisplayNodeFailAssert(@"Did not expect %@ to be called.", NSStringFromSelector(_cmd)); - return CGSizeZero; -} - -@end - -@implementation ASIGListSupplementaryViewSourceMethods - -+ (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind - atIndex:(NSInteger)index - sectionController:(IGListSectionController *)sectionController -{ - return [sectionController.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind forSectionController:(id)sectionController class:[_ASCollectionReusableView class] atIndex:index]; -} - -+ (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndex:(NSInteger)index -{ - ASDisplayNodeFailAssert(@"Did not expect %@ to be called.", NSStringFromSelector(_cmd)); - return CGSizeZero; -} - -@end - -#endif // AS_IG_LIST_KIT diff --git a/Example/Pods/Texture/Source/AsyncDisplayKit.h b/Example/Pods/Texture/Source/AsyncDisplayKit.h deleted file mode 100644 index 4f1e7e3a..00000000 --- a/Example/Pods/Texture/Source/AsyncDisplayKit.h +++ /dev/null @@ -1,134 +0,0 @@ -// -// AsyncDisplayKit.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import - -#import -#import - -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import - -#import -#import - -#import - -#import -#import -#import - -#import -#import -#import -#import -#import - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import - -#import -#import -#import -#import diff --git a/Example/Pods/Texture/Source/Base/ASAssert.h b/Example/Pods/Texture/Source/Base/ASAssert.h deleted file mode 100644 index 4445b244..00000000 --- a/Example/Pods/Texture/Source/Base/ASAssert.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// ASAssert.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import -#import -#import - -#if !defined(NS_BLOCK_ASSERTIONS) - #define ASDISPLAYNODE_ASSERTIONS_ENABLED 1 -#else - #define ASDISPLAYNODE_ASSERTIONS_ENABLED 0 -#endif - -/** - * Note: In some cases it would be sufficient to do e.g.: - * ASDisplayNodeAssert(...) NSAssert(__VA_ARGS__) - * but we prefer not to, because we want to match the autocomplete behavior of NSAssert. - * The construction listed above does not show the user what arguments are required and what are optional. - */ - -#define ASDisplayNodeAssert(condition, desc, ...) NSAssert(condition, desc, ##__VA_ARGS__) -#define ASDisplayNodeCAssert(condition, desc, ...) NSCAssert(condition, desc, ##__VA_ARGS__) - -#define ASDisplayNodeAssertNil(condition, desc, ...) ASDisplayNodeAssert((condition) == nil, desc, ##__VA_ARGS__) -#define ASDisplayNodeCAssertNil(condition, desc, ...) ASDisplayNodeCAssert((condition) == nil, desc, ##__VA_ARGS__) - -#define ASDisplayNodeAssertNotNil(condition, desc, ...) ASDisplayNodeAssert((condition) != nil, desc, ##__VA_ARGS__) -#define ASDisplayNodeCAssertNotNil(condition, desc, ...) ASDisplayNodeCAssert((condition) != nil, desc, ##__VA_ARGS__) - -#define ASDisplayNodeAssertImplementedBySubclass() ASDisplayNodeAssert(NO, @"This method must be implemented by subclass %@", [self class]); -#define ASDisplayNodeAssertNotInstantiable() ASDisplayNodeAssert(NO, nil, @"This class is not instantiable."); -#define ASDisplayNodeAssertNotSupported() ASDisplayNodeAssert(NO, nil, @"This method is not supported by class %@", [self class]); - -#define ASDisplayNodeAssertMainThread() ASDisplayNodeAssert(ASMainThreadAssertionsAreDisabled() || 0 != pthread_main_np(), @"This method must be called on the main thread") -#define ASDisplayNodeCAssertMainThread() ASDisplayNodeCAssert(ASMainThreadAssertionsAreDisabled() || 0 != pthread_main_np(), @"This function must be called on the main thread") - -#define ASDisplayNodeAssertNotMainThread() ASDisplayNodeAssert(0 == pthread_main_np(), @"This method must be called off the main thread") -#define ASDisplayNodeCAssertNotMainThread() ASDisplayNodeCAssert(0 == pthread_main_np(), @"This function must be called off the main thread") - -#define ASDisplayNodeAssertFlag(X, desc, ...) ASDisplayNodeAssert((1 == __builtin_popcount(X)), desc, ##__VA_ARGS__) -#define ASDisplayNodeCAssertFlag(X, desc, ...) ASDisplayNodeCAssert((1 == __builtin_popcount(X)), desc, ##__VA_ARGS__) - -#define ASDisplayNodeAssertTrue(condition) ASDisplayNodeAssert((condition), @"Expected %s to be true.", #condition) -#define ASDisplayNodeCAssertTrue(condition) ASDisplayNodeCAssert((condition), @"Expected %s to be true.", #condition) - -#define ASDisplayNodeAssertFalse(condition) ASDisplayNodeAssert(!(condition), @"Expected %s to be false.", #condition) -#define ASDisplayNodeCAssertFalse(condition) ASDisplayNodeCAssert(!(condition), @"Expected %s to be false.", #condition) - -#define ASDisplayNodeFailAssert(desc, ...) ASDisplayNodeAssert(NO, desc, ##__VA_ARGS__) -#define ASDisplayNodeCFailAssert(desc, ...) ASDisplayNodeCAssert(NO, desc, ##__VA_ARGS__) - -#define ASDisplayNodeConditionalAssert(shouldTestCondition, condition, desc, ...) ASDisplayNodeAssert((!(shouldTestCondition) || (condition)), desc, ##__VA_ARGS__) -#define ASDisplayNodeConditionalCAssert(shouldTestCondition, condition, desc, ...) ASDisplayNodeCAssert((!(shouldTestCondition) || (condition)), desc, ##__VA_ARGS__) - -#define ASDisplayNodeCAssertPositiveReal(description, num) ASDisplayNodeCAssert(num >= 0 && num <= CGFLOAT_MAX, @"%@ must be a real positive integer: %f.", description, (CGFloat)num) -#define ASDisplayNodeCAssertInfOrPositiveReal(description, num) ASDisplayNodeCAssert(isinf(num) || (num >= 0 && num <= CGFLOAT_MAX), @"%@ must be infinite or a real positive integer: %f.", description, (CGFloat)num) - -#define ASDisplayNodeCAssertPermanent(object) ASDisplayNodeCAssert(CFGetRetainCount((__bridge CFTypeRef)(object)) == CFGetRetainCount(kCFNull), @"Expected %s to be a permanent object.", #object) -#define ASDisplayNodeErrorDomain @"ASDisplayNodeErrorDomain" -#define ASDisplayNodeNonFatalErrorCode 1 - -/** - * In debug methods, it can be useful to disable main thread assertions to get valuable information, - * even if it means violating threading requirements. These functions are used in -debugDescription and let - * threads decide to suppress/re-enable main thread assertions. - */ -#pragma mark - Main Thread Assertions Disabling - -ASDK_EXTERN BOOL ASMainThreadAssertionsAreDisabled(void); - -ASDK_EXTERN void ASPushMainThreadAssertionsDisabled(void); - -ASDK_EXTERN void ASPopMainThreadAssertionsDisabled(void); - -#pragma mark - Non-Fatal Assertions - -/// Returns YES if assertion passed, NO otherwise. -#define ASDisplayNodeAssertNonFatal(condition, desc, ...) ({ \ - BOOL __evaluated = condition; \ - if (__evaluated == NO) { \ - ASDisplayNodeFailAssert(desc, ##__VA_ARGS__); \ - ASDisplayNodeNonFatalErrorBlock block = [ASDisplayNode nonFatalErrorBlock]; \ - if (block != nil) { \ - NSDictionary *userInfo = nil; \ - if (desc.length > 0) { \ - userInfo = @{ NSLocalizedDescriptionKey : desc }; \ - } \ - NSError *error = [NSError errorWithDomain:ASDisplayNodeErrorDomain code:ASDisplayNodeNonFatalErrorCode userInfo:userInfo]; \ - block(error); \ - } \ - } \ - __evaluated; \ -}) \ diff --git a/Example/Pods/Texture/Source/Base/ASAssert.mm b/Example/Pods/Texture/Source/Base/ASAssert.mm deleted file mode 100644 index 6a78b06e..00000000 --- a/Example/Pods/Texture/Source/Base/ASAssert.mm +++ /dev/null @@ -1,58 +0,0 @@ -// -// ASAssert.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_TLS_AVAILABLE - -static _Thread_local int tls_mainThreadAssertionsDisabledCount; -BOOL ASMainThreadAssertionsAreDisabled() { - return tls_mainThreadAssertionsDisabledCount > 0; -} - -void ASPushMainThreadAssertionsDisabled() { - tls_mainThreadAssertionsDisabledCount += 1; -} - -void ASPopMainThreadAssertionsDisabled() { - tls_mainThreadAssertionsDisabledCount -= 1; - ASDisplayNodeCAssert(tls_mainThreadAssertionsDisabledCount >= 0, @"Attempt to pop thread assertion-disabling without corresponding push."); -} - -#else - -#import - -static pthread_key_t ASMainThreadAssertionsDisabledKey() { - static pthread_key_t k; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - pthread_key_create(&k, NULL); - }); - return k; -} - -BOOL ASMainThreadAssertionsAreDisabled() { - return (nullptr != pthread_getspecific(ASMainThreadAssertionsDisabledKey())); -} - -void ASPushMainThreadAssertionsDisabled() { - const auto key = ASMainThreadAssertionsDisabledKey(); - const auto oldVal = (intptr_t)pthread_getspecific(key); - pthread_setspecific(key, (void *)(oldVal + 1)); -} - -void ASPopMainThreadAssertionsDisabled() { - const auto key = ASMainThreadAssertionsDisabledKey(); - const auto oldVal = (intptr_t)pthread_getspecific(key); - pthread_setspecific(key, (void *)(oldVal - 1)); - ASDisplayNodeCAssert(oldVal > 0, @"Attempt to pop thread assertion-disabling without corresponding push."); -} - -#endif // AS_TLS_AVAILABLE diff --git a/Example/Pods/Texture/Source/Base/ASAvailability.h b/Example/Pods/Texture/Source/Base/ASAvailability.h deleted file mode 100644 index b210397f..00000000 --- a/Example/Pods/Texture/Source/Base/ASAvailability.h +++ /dev/null @@ -1,95 +0,0 @@ -// -// ASAvailability.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#pragma once - -#ifdef __i386__ - #define AS_TLS_AVAILABLE 0 -#else - #define AS_TLS_AVAILABLE 1 -#endif - -#ifndef AS_ENABLE_TEXTNODE - #define AS_ENABLE_TEXTNODE 1 // Enable old TextNode by default -#endif - -// This needs to stay in sync with Weaver -#ifndef AS_USE_VIDEO - #define AS_USE_VIDEO 0 -#endif - -#ifndef AS_USE_PHOTOS - #define AS_USE_PHOTOS 0 -#endif - -#ifndef AS_USE_MAPKIT - #define AS_USE_MAPKIT 0 -#endif - -#ifndef AS_USE_ASSETS_LIBRARY - #define AS_USE_ASSETS_LIBRARY 0 -#endif - -#ifndef kCFCoreFoundationVersionNumber_iOS_10_0 - #define kCFCoreFoundationVersionNumber_iOS_10_0 1348.00 -#endif - -#ifndef kCFCoreFoundationVersionNumber_iOS_11_0 - #define kCFCoreFoundationVersionNumber_iOS_11_0 1438.10 -#endif - -#ifndef __IPHONE_11_0 - #define __IPHONE_11_0 110000 -#endif - -#ifndef __IPHONE_13_0 - #define __IPHONE_13_0 130000 -#endif - -#define AS_AT_LEAST_IOS10 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_10_0) -#define AS_AT_LEAST_IOS11 (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_11_0) -#define AS_AT_LEAST_IOS13 (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0) - -// Use __builtin_available if we're on Xcode >= 9, AS_AT_LEAST otherwise. -#if __has_builtin(__builtin_available) - #define AS_AVAILABLE_IOS(ver) __builtin_available(iOS ver, *) - #define AS_AVAILABLE_TVOS(ver) __builtin_available(tvOS ver, *) - #define AS_AVAILABLE_IOS_TVOS(ver1, ver2) __builtin_available(iOS ver1, tvOS ver2, *) -#else - #define AS_AVAILABLE_IOS(ver) (TARGET_OS_IOS && AS_AT_LEAST_IOS##ver) - #define AS_AVAILABLE_TVOS(ver) (TARGET_OS_TV && AS_AT_LEAST_IOS##ver) - #define AS_AVAILABLE_IOS_TVOS(ver1, ver2) (AS_AVAILABLE_IOS(ver1) || AS_AVAILABLE_TVOS(ver2)) -#endif - -// If Yoga is available, make it available anywhere we use ASAvailability. -// This reduces Yoga-specific code in other files. -// NOTE: Yoga integration is experimental and not fully tested. Use with caution and test layouts carefully. -#ifndef YOGA_HEADER_PATH - #define YOGA_HEADER_PATH -#endif - -#ifndef YOGA - #define YOGA __has_include(YOGA_HEADER_PATH) -#endif - -#ifdef ASTEXTNODE_EXPERIMENT_GLOBAL_ENABLE - #error "ASTEXTNODE_EXPERIMENT_GLOBAL_ENABLE is unavailable. See ASConfiguration.h." -#endif - -#define AS_PIN_REMOTE_IMAGE __has_include() -#define AS_IG_LIST_KIT __has_include() -#define AS_IG_LIST_DIFF_KIT __has_include() - -/** - * For IGListKit versions < 3.0, you have to use IGListCollectionView. - * For 3.0 and later, that class is removed and you use UICollectionView. - */ -#define IG_LIST_COLLECTION_VIEW __has_include() diff --git a/Example/Pods/Texture/Source/Base/ASBaseDefines.h b/Example/Pods/Texture/Source/Base/ASBaseDefines.h deleted file mode 100644 index 53ea66a0..00000000 --- a/Example/Pods/Texture/Source/Base/ASBaseDefines.h +++ /dev/null @@ -1,237 +0,0 @@ -// -// ASBaseDefines.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define ASDK_EXTERN FOUNDATION_EXTERN -#define unowned __unsafe_unretained - -/** - * Decorates methods that clients can implement in categories on our base class. These methods - * will be stubbed with an empty implementation if no implementation is provided. - */ -#define AS_CATEGORY_IMPLEMENTABLE - -#ifdef __GNUC__ -# define ASDISPLAYNODE_GNUC(major, minor) \ -(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) -#else -# define ASDISPLAYNODE_GNUC(major, minor) 0 -#endif - -#ifndef ASDISPLAYNODE_INLINE -# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -# define ASDISPLAYNODE_INLINE static inline -# elif defined (__MWERKS__) || defined (__cplusplus) -# define ASDISPLAYNODE_INLINE static inline -# elif ASDISPLAYNODE_GNUC (3, 0) -# define ASDISPLAYNODE_INLINE static __inline__ __attribute__ ((always_inline)) -# else -# define ASDISPLAYNODE_INLINE static -# endif -#endif - -#ifndef ASDISPLAYNODE_WARN_DEPRECATED -# define ASDISPLAYNODE_WARN_DEPRECATED 1 -#endif - -#ifndef ASDISPLAYNODE_DEPRECATED -# if ASDISPLAYNODE_GNUC (3, 0) && ASDISPLAYNODE_WARN_DEPRECATED -# define ASDISPLAYNODE_DEPRECATED __attribute__ ((deprecated)) -# else -# define ASDISPLAYNODE_DEPRECATED -# endif -#endif - -#ifndef ASDISPLAYNODE_DEPRECATED_MSG -# if ASDISPLAYNODE_GNUC (3, 0) && ASDISPLAYNODE_WARN_DEPRECATED -# define ASDISPLAYNODE_DEPRECATED_MSG(msg) __deprecated_msg(msg) -# else -# define ASDISPLAYNODE_DEPRECATED_MSG(msg) -# endif -#endif - -#ifndef AS_ENABLE_TIPS -#define AS_ENABLE_TIPS 0 -#endif - -#ifndef __has_feature // Optional. -#define __has_feature(x) 0 // Compatibility with non-clang compilers. -#endif - -#ifndef __has_attribute // Optional. -#define __has_attribute(x) 0 // Compatibility with non-clang compilers. -#endif - -#ifndef NS_RETURNS_RETAINED -#if __has_feature(attribute_ns_returns_retained) -#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) -#else -#define NS_RETURNS_RETAINED -#endif -#endif - -#ifndef CF_RETURNS_RETAINED -#if __has_feature(attribute_cf_returns_retained) -#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -#else -#define CF_RETURNS_RETAINED -#endif -#endif - -#ifndef ASDISPLAYNODE_REQUIRES_SUPER -#if __has_attribute(objc_requires_super) -#define ASDISPLAYNODE_REQUIRES_SUPER __attribute__((objc_requires_super)) -#else -#define ASDISPLAYNODE_REQUIRES_SUPER -#endif -#endif - -#ifndef AS_UNAVAILABLE -#if __has_attribute(unavailable) -#define AS_UNAVAILABLE(message) __attribute__((unavailable(message))) -#else -#define AS_UNAVAILABLE(message) -#endif -#endif - -#ifndef AS_WARN_UNUSED_RESULT -#if __has_attribute(warn_unused_result) -#define AS_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define AS_WARN_UNUSED_RESULT -#endif -#endif - -#define ASOVERLOADABLE __attribute__((overloadable)) - -/// Xcode >= 10. -#define AS_HAS_OS_SIGNPOST __has_include() - -#if __has_attribute(noescape) -#define AS_NOESCAPE __attribute__((noescape)) -#else -#define AS_NOESCAPE -#endif - -#if __has_attribute(objc_subclassing_restricted) -#define AS_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted)) -#else -#define AS_SUBCLASSING_RESTRICTED -#endif - -#define AS_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) - -#define ASCreateOnce(expr) ({ \ - static dispatch_once_t onceToken; \ - static __typeof__(expr) staticVar; \ - dispatch_once(&onceToken, ^{ \ - staticVar = expr; \ - }); \ - staticVar; \ -}) - -/// Ensure that class is of certain kind -#define ASDynamicCast(x, c) ({ \ - id __val = x;\ - ((c *) ([__val isKindOfClass:[c class]] ? __val : nil));\ -}) - -/// Ensure that class is of certain kind, assuming it is subclass restricted -#define ASDynamicCastStrict(x, c) ({ \ - id __val = x;\ - ((c *) ([__val class] == [c class] ? __val : nil));\ -}) - -// Compare two primitives, assign if different. Returns whether the assignment happened. -#define ASCompareAssign(lvalue, newValue) ({ \ - BOOL result = (lvalue != newValue); \ - if (result) { lvalue = newValue; } \ - result; \ -}) - -#define ASCompareAssignObjects(lvalue, newValue) \ - ASCompareAssignCustom(lvalue, newValue, ASObjectIsEqual) - -// e.g. ASCompareAssignCustom(_myInsets, insets, UIEdgeInsetsEqualToEdgeInsets) -#define ASCompareAssignCustom(lvalue, newValue, isequal) ({ \ - BOOL result = !(isequal(lvalue, newValue)); \ - if (result) { lvalue = newValue; } \ - result; \ -}) - -#define ASCompareAssignCopy(lvalue, newValue) ({ \ - BOOL result = !ASObjectIsEqual(lvalue, newValue); \ - if (result) { lvalue = [newValue copyWithZone:NULL]; } \ - result; \ -}) - -/** - * Create a new set by mapping `collection` over `work`, ignoring nil. - */ -#define ASSetByFlatMapping(collection, decl, work) ({ \ - NSMutableSet *s = [[NSMutableSet alloc] init]; \ - for (decl in collection) {\ - id result = work; \ - if (result != nil) { \ - [s addObject:result]; \ - } \ - } \ - s; \ -}) - -/** - * Create a new ObjectPointerPersonality NSHashTable by mapping `collection` over `work`, ignoring nil. - * - * capacity: 0 is taken from +hashTableWithOptions. - */ -#define ASPointerTableByFlatMapping(collection, decl, work) ({ \ - NSHashTable *t = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:0]; \ - for (decl in collection) {\ - id result = work; \ - if (result != nil) { \ - [t addObject:result]; \ - } \ - } \ - t; \ -}) - -/** - * Create a new array by mapping `collection` over `work`, ignoring nil. - */ -#define ASArrayByFlatMapping(collectionArg, decl, work) ({ \ - id __collection = collectionArg; \ - NSArray *__result; \ - if (__collection) { \ - id __buf[[__collection count]]; \ - NSUInteger __i = 0; \ - for (decl in __collection) {\ - if ((__buf[__i] = work)) { \ - __i++; \ - } \ - } \ - __result = [NSArray arrayByTransferring:__buf count:__i]; \ - } \ - __result; \ -}) - -/** - * Capture-and-clear a strong reference without the intervening retain/release pair. - * - * E.g. const auto localVar = ASTransferStrong(_myIvar); - * Post-condition: localVar has the strong value from _myIvar and _myIvar is nil. - * No retain/release is emitted when the optimizer is on. - */ -#define ASTransferStrong(lvalue) ({ \ - CFTypeRef *__rawPtr = (CFTypeRef *)(void *)(&(lvalue)); \ - CFTypeRef __cfValue = *__rawPtr; \ - *__rawPtr = NULL; \ - __typeof(lvalue) __result = (__bridge_transfer __typeof(lvalue))__cfValue; \ - __result; \ -}) diff --git a/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.h b/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.h deleted file mode 100644 index 2c61cee0..00000000 --- a/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// ASDisplayNode+Ancestry.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASDisplayNode (Ancestry) - -/** - * Returns an object to enumerate the supernode ancestry of this node, starting with its supernode. - * - * For instance, you could write: - * for (ASDisplayNode *node in self.supernodes) { - * if ([node.backgroundColor isEqual:[UIColor blueColor]]) { - * node.hidden = YES; - * } - * } - * - * Note: If this property is read on the main thread, the enumeration will attempt to go up - * the layer hierarchy if it finds a break in the display node hierarchy. - */ -@property (readonly) id supernodes; - -/** - * Same as `supernodes` but begins the enumeration with self. - */ -@property (readonly) id supernodesIncludingSelf; - -/** - * Searches the supernodes of this node for one matching the given class. - * - * @param supernodeClass The class of node you're looking for. - * @param includeSelf Whether to include self in the search. - * @return A node of the given class that is an ancestor of this node, or nil. - * - * @note See the documentation on `supernodes` for details about the upward traversal. - */ -- (nullable __kindof ASDisplayNode *)supernodeOfClass:(Class)supernodeClass includingSelf:(BOOL)includeSelf; - -/** - * e.g. "(, , )" - */ -@property (copy, readonly) NSString *ancestryDescription; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.mm b/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.mm deleted file mode 100644 index 7003064c..00000000 --- a/Example/Pods/Texture/Source/Base/ASDisplayNode+Ancestry.mm +++ /dev/null @@ -1,90 +0,0 @@ -// -// ASDisplayNode+Ancestry.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASDisplayNode+Ancestry.h" -#import -#import - -AS_SUBCLASSING_RESTRICTED -@interface ASNodeAncestryEnumerator : NSEnumerator -@end - -@implementation ASNodeAncestryEnumerator { - ASDisplayNode *_lastNode; // This needs to be strong because enumeration will not retain the current batch of objects - BOOL _initialState; -} - -- (instancetype)initWithNode:(ASDisplayNode *)node -{ - if (self = [super init]) { - _initialState = YES; - _lastNode = node; - } - return self; -} - -- (id)nextObject -{ - if (_initialState) { - _initialState = NO; - return _lastNode; - } - - ASDisplayNode *nextNode = _lastNode.supernode; - if (nextNode == nil && ASDisplayNodeThreadIsMain()) { - CALayer *layer = _lastNode.nodeLoaded ? _lastNode.layer.superlayer : nil; - while (layer != nil) { - nextNode = ASLayerToDisplayNode(layer); - if (nextNode != nil) { - break; - } - layer = layer.superlayer; - } - } - _lastNode = nextNode; - return nextNode; -} - -@end - -@implementation ASDisplayNode (Ancestry) - -- (id)supernodes -{ - NSEnumerator *result = [[ASNodeAncestryEnumerator alloc] initWithNode:self]; - [result nextObject]; // discard first object (self) - return result; -} - -- (id)supernodesIncludingSelf -{ - return [[ASNodeAncestryEnumerator alloc] initWithNode:self]; -} - -- (nullable __kindof ASDisplayNode *)supernodeOfClass:(Class)supernodeClass includingSelf:(BOOL)includeSelf -{ - id chain = includeSelf ? self.supernodesIncludingSelf : self.supernodes; - for (ASDisplayNode *ancestor in chain) { - if ([ancestor isKindOfClass:supernodeClass]) { - return ancestor; - } - } - return nil; -} - -- (NSString *)ancestryDescription -{ - NSMutableArray *strings = [NSMutableArray array]; - for (ASDisplayNode *node in self.supernodes) { - [strings addObject:ASObjectDescriptionMakeTiny(node)]; - } - return strings.description; -} - -@end diff --git a/Example/Pods/Texture/Source/Base/ASEqualityHelpers.h b/Example/Pods/Texture/Source/Base/ASEqualityHelpers.h deleted file mode 100644 index 60245954..00000000 --- a/Example/Pods/Texture/Source/Base/ASEqualityHelpers.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASEqualityHelpers.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - @abstract Correctly equates two objects, including cases where both objects are nil. The latter is a case where `isEqual:` fails. - @param obj The first object in the comparison. Can be nil. - @param otherObj The second object in the comparison. Can be nil. - @result YES if the objects are equal, including cases where both object are nil. - */ -ASDISPLAYNODE_INLINE BOOL ASObjectIsEqual(id obj, id otherObj) -{ - return obj == otherObj || [obj isEqual:otherObj]; -} diff --git a/Example/Pods/Texture/Source/Base/ASLog.h b/Example/Pods/Texture/Source/Base/ASLog.h deleted file mode 100644 index fb0eb574..00000000 --- a/Example/Pods/Texture/Source/Base/ASLog.h +++ /dev/null @@ -1,131 +0,0 @@ -// -// ASLog.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -#ifndef ASEnableVerboseLogging - #define ASEnableVerboseLogging 0 -#endif - -/** - * Disable all logging. - * - * You should only use this function if the default log level is - * annoying during development. By default, logging is run at - * the appropriate system log level (see the os_log_* functions), - * so you do not need to worry generally about the performance - * implications of log messages. - * - * For example, virtually all log messages generated by Texture - * are at the `debug` log level, which the system - * disables in production. - */ -ASDK_EXTERN void ASDisableLogging(void); - -/** - * Restore logging that has been runtime-disabled via ASDisableLogging(). - * - * Logging can be disabled at runtime using the ASDisableLogging() function. - * This command restores logging to the level provided in the build - * configuration. This can be used in conjunction with ASDisableLogging() - * to allow logging to be toggled off and back on at runtime. - */ -ASDK_EXTERN void ASEnableLogging(void); - -/// Log for general node events e.g. interfaceState, didLoad. -#define ASNodeLogEnabled 1 -ASDK_EXTERN os_log_t ASNodeLog(void); - -/// Log for layout-specific events e.g. calculateLayout. -#define ASLayoutLogEnabled 1 -ASDK_EXTERN os_log_t ASLayoutLog(void); - -/// Log for display-specific events e.g. display queue batches. -#define ASDisplayLogEnabled 1 -ASDK_EXTERN os_log_t ASDisplayLog(void); - -/// Log for collection events e.g. reloadData, performBatchUpdates. -#define ASCollectionLogEnabled 1 -ASDK_EXTERN os_log_t ASCollectionLog(void); - -/// Log for ASNetworkImageNode and ASMultiplexImageNode events. -#define ASImageLoadingLogEnabled 1 -ASDK_EXTERN os_log_t ASImageLoadingLog(void); - -/// Specialized log for our main thread deallocation trampoline. -#define ASMainThreadDeallocationLogEnabled 0 -ASDK_EXTERN os_log_t ASMainThreadDeallocationLog(void); - -#define ASLockingLogEnabled 0 -ASDK_EXTERN os_log_t ASLockingLog(void); - -#if AS_HAS_OS_SIGNPOST -/// Uses the special POI category for Instruments. Used by ASSignpost.h. -ASDK_EXTERN os_log_t ASPointsOfInterestLog(void); -#endif - -/** - * The activity tracing system changed a lot between iOS 9 and 10. - * In iOS 10, the system was merged with logging and became much more powerful - * and adopted a new API. - * - * The legacy API is visible, but its functionality is extremely limited and the API is so different - * that we don't bother with it. For example, activities described by os_activity_start/end are not - * reflected in the log whereas activities described by the newer - * os_activity_scope are. So unfortunately we must use these iOS 10 - * APIs to get meaningful logging data. - * - * NOTE: Creating and tearing down activities require inter-process communication and can - * take dozens of microseconds on an A8. We do it quite often. Enable activities only during debugging. - */ -#if DEBUG && OS_LOG_TARGET_HAS_10_12_FEATURES - -#define OS_ACTIVITY_NULLABLE nullable -#define AS_ACTIVITY_CURRENT OS_ACTIVITY_CURRENT -#define as_activity_scope(activity) os_activity_scope(activity) -#define as_activity_apply(activity, block) os_activity_apply(activity, block) -#define as_activity_create(description, parent_activity, flags) os_activity_create(description, parent_activity, flags) -#define as_activity_scope_enter(activity, statePtr) os_activity_scope_enter(activity, statePtr) -#define as_activity_scope_leave(statePtr) os_activity_scope_leave(statePtr) -#define as_activity_get_identifier(activity, outParentID) os_activity_get_identifier(activity, outParentID) - -#else - -#define OS_ACTIVITY_NULLABLE -#define AS_ACTIVITY_CURRENT OS_ACTIVITY_NULL -#define as_activity_scope(activity) -#define as_activity_apply(activity, block) -#define as_activity_create(description, parent_activity, flags) OS_ACTIVITY_NULL -#define as_activity_scope_enter(activity, statePtr) -#define as_activity_scope_leave(statePtr) -#define as_activity_get_identifier(activity, outParentID) (os_activity_id_t)0 - -#endif // OS_LOG_TARGET_HAS_10_12_FEATURES - -// Create activities only when verbose enabled. Doesn't materially impact performance, but good if we're cluttering up -// activity scopes and reducing readability. -#if ASEnableVerboseLogging - #define as_activity_scope_verbose(activity) as_activity_scope(activity) -#else - #define as_activity_scope_verbose(activity) -#endif - -// Convenience for: as_activity_scope(as_activity_create(description, AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)) -#define as_activity_create_for_scope(description) \ - as_activity_scope(as_activity_create(description, AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)) - -#if ASEnableVerboseLogging - #define as_log_verbose(log, format, ...) os_log_debug(log, format, ##__VA_ARGS__) -#else - #define as_log_verbose(log, format, ...) -#endif diff --git a/Example/Pods/Texture/Source/Base/ASLog.mm b/Example/Pods/Texture/Source/Base/ASLog.mm deleted file mode 100644 index e2014e2e..00000000 --- a/Example/Pods/Texture/Source/Base/ASLog.mm +++ /dev/null @@ -1,61 +0,0 @@ -// -// ASLog.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#if AS_HAS_OS_SIGNPOST -#import -#endif - -static atomic_bool __ASLogEnabled = ATOMIC_VAR_INIT(YES); - -void ASDisableLogging() { - atomic_store(&__ASLogEnabled, NO); -} - -void ASEnableLogging() { - atomic_store(&__ASLogEnabled, YES); -} - -ASDISPLAYNODE_INLINE BOOL ASLoggingIsEnabled() { - return atomic_load(&__ASLogEnabled); -} - -os_log_t ASNodeLog() { - return (ASNodeLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Node")) : OS_LOG_DISABLED; -} - -os_log_t ASLayoutLog() { - return (ASLayoutLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Layout")) : OS_LOG_DISABLED; -} - -os_log_t ASCollectionLog() { - return (ASCollectionLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Collection")) : OS_LOG_DISABLED; -} - -os_log_t ASDisplayLog() { - return (ASDisplayLogEnabled && ASLoggingIsEnabled()) ?ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Display")) : OS_LOG_DISABLED; -} - -os_log_t ASImageLoadingLog() { - return (ASImageLoadingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "ImageLoading")) : OS_LOG_DISABLED; -} - -os_log_t ASMainThreadDeallocationLog() { - return (ASMainThreadDeallocationLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "MainDealloc")) : OS_LOG_DISABLED; -} - -os_log_t ASLockingLog() { - return (ASLockingLogEnabled && ASLoggingIsEnabled()) ? ASCreateOnce(os_log_create("org.TextureGroup.Texture", "Locking")) : OS_LOG_DISABLED; -} - -#if AS_HAS_OS_SIGNPOST -os_log_t ASPointsOfInterestLog() { - return ASCreateOnce(os_log_create("org.TextureGroup.Texture", OS_LOG_CATEGORY_POINTS_OF_INTEREST)); -} -#endif diff --git a/Example/Pods/Texture/Source/Base/ASSignpost.h b/Example/Pods/Texture/Source/Base/ASSignpost.h deleted file mode 100644 index 27a44afb..00000000 --- a/Example/Pods/Texture/Source/Base/ASSignpost.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASSignpost.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -/// The signposts we use. Signposts are grouped by color. The SystemTrace.tracetemplate file -/// should be kept up-to-date with these values. -typedef NS_ENUM(uint32_t, ASSignpostName) { - // Collection/Table - ASSignpostDataControllerBatch = 300, // Alloc/layout nodes before collection update. - ASSignpostRangeControllerUpdate, // Ranges update pass. - - // Rendering - ASSignpostLayerDisplay = 325, // Client display callout. - ASSignpostRunLoopQueueBatch, // One batch of ASRunLoopQueue. - - // Layout - ASSignpostCalculateLayout = 350, // Start of calculateLayoutThatFits to end. Max 1 per thread. - - // Misc - ASSignpostDeallocQueueDrain = 375, // One chunk of dealloc queue work. arg0 is count. - ASSignpostOrientationChange, // From WillChangeStatusBarOrientation to animation end. -}; - -#ifdef PROFILE - #define AS_SIGNPOST_ENABLE 1 -#else - #define AS_SIGNPOST_ENABLE 0 -#endif - -#if AS_SIGNPOST_ENABLE - -#import -#if AS_HAS_OS_SIGNPOST -#import -#endif - -// These definitions are required to build the backward-compatible kdebug trace -// on the iOS 10 SDK. The kdebug_trace function crashes if run on iOS 9 and earlier. -// It's valuable to support trace signposts on iOS 9, because A5 devices don't support iOS 10. -#ifndef DBG_MACH_CHUD -#define DBG_MACH_CHUD 0x0A -#define DBG_FUNC_NONE 0 -#define DBG_FUNC_START 1 -#define DBG_FUNC_END 2 -#define DBG_APPS 33 -#define SYS_kdebug_trace 180 -#define KDBG_CODE(Class, SubClass, code) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16) | ((code & 0x3fff) << 2)) -#define APPSDBG_CODE(SubClass,code) KDBG_CODE(DBG_APPS, SubClass, code) -#endif - -#if AS_HAS_OS_SIGNPOST - -#define ASSignpostStart(name, identifier, format, ...) ({\ - if (AS_AVAILABLE_IOS_TVOS(12, 12)) { \ - unowned os_log_t log = ASPointsOfInterestLog(); \ - os_signpost_id_t spid = os_signpost_id_make_with_id(log, identifier); \ - os_signpost_interval_begin(log, spid, #name, format, ##__VA_ARGS__); \ - } else if (AS_AVAILABLE_IOS_TVOS(10, 10)) { \ - kdebug_signpost_start(ASSignpost##name, (uintptr_t)identifier, 0, 0, 0); \ - } else { \ - syscall(SYS_kdebug_trace, APPSDBG_CODE(DBG_MACH_CHUD, ASSignpost##name) | DBG_FUNC_START, (uintptr_t)identifier, 0, 0, 0); \ - } \ -}) - -#define ASSignpostEnd(name, identifier, format, ...) ({\ - if (AS_AVAILABLE_IOS_TVOS(12, 12)) { \ - unowned os_log_t log = ASPointsOfInterestLog(); \ - os_signpost_id_t spid = os_signpost_id_make_with_id(log, identifier); \ - os_signpost_interval_end(log, spid, #name, format, ##__VA_ARGS__); \ - } else if (AS_AVAILABLE_IOS_TVOS(10, 10)) { \ - kdebug_signpost_end(ASSignpost##name, (uintptr_t)identifier, 0, 0, 0); \ - } else { \ - syscall(SYS_kdebug_trace, APPSDBG_CODE(DBG_MACH_CHUD, ASSignpost##name) | DBG_FUNC_END, (uintptr_t)identifier, 0, 0, 0); \ - } \ -}) - -#else // !AS_HAS_OS_SIGNPOST - -#define ASSignpostStart(name, identifier, format, ...) ({\ - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { \ - kdebug_signpost_start(ASSignpost##name, (uintptr_t)identifier, 0, 0, 0); \ - } else { \ - syscall(SYS_kdebug_trace, APPSDBG_CODE(DBG_MACH_CHUD, ASSignpost##name) | DBG_FUNC_START, (uintptr_t)identifier, 0, 0, 0); \ - } \ -}) - -#define ASSignpostEnd(name, identifier, format, ...) ({\ - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { \ - kdebug_signpost_end(ASSignpost##name, (uintptr_t)identifier, 0, 0, 0); \ - } else { \ - syscall(SYS_kdebug_trace, APPSDBG_CODE(DBG_MACH_CHUD, ASSignpost##name) | DBG_FUNC_END, (uintptr_t)identifier, 0, 0, 0); \ - } \ -}) - -#endif - -#else // !AS_SIGNPOST_ENABLE - -#define ASSignpostStart(name, identifier, format, ...) -#define ASSignpostEnd(name, identifier, format, ...) - -#endif diff --git a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.h b/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.h deleted file mode 100644 index 6dc51374..00000000 --- a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// AsyncDisplayKit+Debug.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASImageNode (Debugging) - -/** - * Enables an ASImageNode debug label that shows the ratio of pixels in the source image to those in - * the displayed bounds (including cropRect). This helps detect excessive image fetching / downscaling, - * as well as upscaling (such as providing a URL not suitable for a Retina device). For dev purposes only. - * Specify YES to show the label on all ASImageNodes with non-1.0x source-to-bounds pixel ratio. - */ -@property (class, nonatomic) BOOL shouldShowImageScalingOverlay; - -@end - -@interface ASControlNode (Debugging) - -/** - * Class method to enable a visualization overlay of the tappable area on the ASControlNode. For app debugging purposes only. - * NOTE: GESTURE RECOGNIZERS, (including tap gesture recognizers on a control node) WILL NOT BE VISUALIZED!!! - * Overlay = translucent GREEN color, - * edges that are clipped by the tappable area of any parent (their bounds + hitTestSlop) in the hierarchy = DARK GREEN BORDERED EDGE, - * edges that are clipped by clipToBounds = YES of any parent in the hierarchy = ORANGE BORDERED EDGE (may still receive touches beyond - * overlay rect, but can't be visualized). - * Specify YES to make this debug feature enabled when messaging the ASControlNode class. - */ -@property (class, nonatomic) BOOL enableHitTestDebug; - -@end - -@interface ASDisplayNode (RangeDebugging) - -/** - * Enable a visualization overlay of the all table/collection tuning parameters. For dev purposes only. - * To use, set this in the AppDelegate --> ASDisplayNode.shouldShowRangeDebugOverlay = YES - */ -@property (class, nonatomic) BOOL shouldShowRangeDebugOverlay; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.mm b/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.mm deleted file mode 100644 index 45a8cb4e..00000000 --- a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Debug.mm +++ /dev/null @@ -1,753 +0,0 @@ -// -// AsyncDisplayKit+Debug.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - - -#pragma mark - ASImageNode (Debugging) - -static BOOL __shouldShowImageScalingOverlay = NO; - -@implementation ASImageNode (Debugging) - -+ (void)setShouldShowImageScalingOverlay:(BOOL)show -{ - __shouldShowImageScalingOverlay = show; -} - -+ (BOOL)shouldShowImageScalingOverlay -{ - return __shouldShowImageScalingOverlay; -} - -@end - -#pragma mark - ASControlNode (DebuggingInternal) - -static BOOL __enableHitTestDebug = NO; - -@interface ASControlNode (DebuggingInternal) - -- (ASImageNode *)debugHighlightOverlay; - -@end - -@implementation ASControlNode (Debugging) - -+ (void)setEnableHitTestDebug:(BOOL)enable -{ - __enableHitTestDebug = enable; -} - -+ (BOOL)enableHitTestDebug -{ - return __enableHitTestDebug; -} - -// layout method required ONLY when hitTestDebug is enabled -- (void)layout -{ - [super layout]; - - if ([ASControlNode enableHitTestDebug]) { - - // Construct hitTestDebug highlight overlay frame indicating tappable area of a node, which can be restricted by two things: - - // (1) Any parent's tapable area (its own bounds + hitTestSlop) may restrict the desired tappable area expansion using - // hitTestSlop of a child as UIKit event delivery (hitTest:) will not search sub-hierarchies if one of our parents does - // not return YES for pointInside:. To circumvent this restriction, a developer will need to set / adjust the hitTestSlop - // on the limiting parent. This is indicated in the overlay by a dark GREEN edge. This is an ACTUAL restriction. - - // (2) Any parent's .clipToBounds. If a parent is clipping, we cannot show the overlay outside that area - // (although it still respond to touch). To indicate that the overlay cannot accurately display the true tappable area, - // the overlay will have an ORANGE edge. This is a VISUALIZATION restriction. - - CGRect intersectRect = UIEdgeInsetsInsetRect(self.bounds, [self hitTestSlop]); - UIRectEdge clippedEdges = UIRectEdgeNone; - UIRectEdge clipsToBoundsClippedEdges = UIRectEdgeNone; - CALayer *layer = self.layer; - CALayer *intersectLayer = layer; - CALayer *intersectSuperlayer = layer.superlayer; - - // FIXED: Stop climbing hierarchy if UIScrollView is encountered (its offset bounds origin may make it seem like our events - // will be clipped when scrolling will actually reveal them (because this process will not re-run due to scrolling)) - while (intersectSuperlayer && ![intersectSuperlayer.delegate respondsToSelector:@selector(contentOffset)]) { - - // Get parent's tappable area - CGRect parentHitRect = intersectSuperlayer.bounds; - BOOL parentClipsToBounds = NO; - - // If parent is a node, tappable area may be expanded by hitTestSlop - ASDisplayNode *parentNode = ASLayerToDisplayNode(intersectSuperlayer); - if (parentNode) { - UIEdgeInsets parentSlop = [parentNode hitTestSlop]; - - // If parent has hitTestSlop, expand tappable area (if parent doesn't clipToBounds) - if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, parentSlop)) { - parentClipsToBounds = parentNode.clipsToBounds; - if (!parentClipsToBounds) { - parentHitRect = UIEdgeInsetsInsetRect(parentHitRect, [parentNode hitTestSlop]); - } - } - } - - // Convert our current rect to parent coordinates - CGRect intersectRectInParentCoordinates = [intersectSuperlayer convertRect:intersectRect fromLayer:intersectLayer]; - - // Intersect rect with the parent's tappable area rect - intersectRect = CGRectIntersection(parentHitRect, intersectRectInParentCoordinates); - if (!CGSizeEqualToSize(parentHitRect.size, intersectRectInParentCoordinates.size)) { - clippedEdges = [self setEdgesOfIntersectionForChildRect:intersectRectInParentCoordinates - parentRect:parentHitRect rectEdge:clippedEdges]; - if (parentClipsToBounds) { - clipsToBoundsClippedEdges = [self setEdgesOfIntersectionForChildRect:intersectRectInParentCoordinates - parentRect:parentHitRect rectEdge:clipsToBoundsClippedEdges]; - } - } - - // move up hierarchy - intersectLayer = intersectSuperlayer; - intersectSuperlayer = intersectLayer.superlayer; - } - - // produce final overlay image (or fill background if edges aren't restricted) - CGRect finalRect = [intersectLayer convertRect:intersectRect toLayer:layer]; - UIColor *fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.4]; - - ASImageNode *debugOverlay = [self debugHighlightOverlay]; - - // determine if edges are clipped and if so, highlight the restricted edges - if (clippedEdges == UIRectEdgeNone) { - debugOverlay.backgroundColor = fillColor; - } else { - const CGFloat borderWidth = 2.0; - UIColor *borderColor = [[UIColor orangeColor] colorWithAlphaComponent:0.8]; - UIColor *clipsBorderColor = [UIColor colorWithRed:30/255.0 green:90/255.0 blue:50/255.0 alpha:0.7]; - CGRect imgRect = CGRectMake(0, 0, 2.0 * borderWidth + 1.0, 2.0 * borderWidth + 1.0); - - UIImage *debugHighlightImage = ASGraphicsCreateImage(self.primitiveTraitCollection, imgRect.size, NO, 1, nil, nil, ^{ - [fillColor setFill]; - UIRectFill(imgRect); - - [self drawEdgeIfClippedWithEdges:clippedEdges color:clipsBorderColor borderWidth:borderWidth imgRect:imgRect]; - [self drawEdgeIfClippedWithEdges:clipsToBoundsClippedEdges color:borderColor borderWidth:borderWidth imgRect:imgRect]; - }); - - UIEdgeInsets edgeInsets = UIEdgeInsetsMake(borderWidth, borderWidth, borderWidth, borderWidth); - debugOverlay.image = [debugHighlightImage resizableImageWithCapInsets:edgeInsets resizingMode:UIImageResizingModeStretch]; - debugOverlay.backgroundColor = nil; - } - - debugOverlay.frame = finalRect; - } -} - -- (UIRectEdge)setEdgesOfIntersectionForChildRect:(CGRect)childRect parentRect:(CGRect)parentRect rectEdge:(UIRectEdge)rectEdge -{ - // determine which edges of childRect are outside parentRect (and thus will be clipped) - if (childRect.origin.y < parentRect.origin.y) { - rectEdge |= UIRectEdgeTop; - } - if (childRect.origin.x < parentRect.origin.x) { - rectEdge |= UIRectEdgeLeft; - } - if (CGRectGetMaxY(childRect) > CGRectGetMaxY(parentRect)) { - rectEdge |= UIRectEdgeBottom; - } - if (CGRectGetMaxX(childRect) > CGRectGetMaxX(parentRect)) { - rectEdge |= UIRectEdgeRight; - } - - return rectEdge; -} - -- (void)drawEdgeIfClippedWithEdges:(UIRectEdge)rectEdge color:(UIColor *)color borderWidth:(CGFloat)borderWidth imgRect:(CGRect)imgRect -{ - [color setFill]; - - // highlight individual edges of overlay if edge is restricted by parentRect - // so that the developer is aware that increasing hitTestSlop will not result in an expanded tappable area - if (rectEdge & UIRectEdgeTop) { - UIRectFill(CGRectMake(0.0, 0.0, imgRect.size.width, borderWidth)); - } - if (rectEdge & UIRectEdgeLeft) { - UIRectFill(CGRectMake(0.0, 0.0, borderWidth, imgRect.size.height)); - } - if (rectEdge & UIRectEdgeBottom) { - UIRectFill(CGRectMake(0.0, imgRect.size.height - borderWidth, imgRect.size.width, borderWidth)); - } - if (rectEdge & UIRectEdgeRight) { - UIRectFill(CGRectMake(imgRect.size.width - borderWidth, 0.0, borderWidth, imgRect.size.height)); - } -} - -@end - -#pragma mark - ASRangeController (Debugging) - -@interface _ASRangeDebugOverlayView : UIView - -+ (instancetype)sharedInstance NS_RETURNS_RETAINED; - -- (void)addRangeController:(ASRangeController *)rangeController; - -- (void)updateRangeController:(ASRangeController *)controller - withScrollableDirections:(ASScrollDirection)scrollableDirections - scrollDirection:(ASScrollDirection)direction - rangeMode:(ASLayoutRangeMode)mode - displayTuningParameters:(ASRangeTuningParameters)displayTuningParameters - preloadTuningParameters:(ASRangeTuningParameters)preloadTuningParameters - interfaceState:(ASInterfaceState)interfaceState; - -@end - -@interface _ASRangeDebugBarView : UIView - -@property (nonatomic, weak) ASRangeController *rangeController; -@property (nonatomic) BOOL destroyOnLayout; -@property (nonatomic) NSString *debugString; - -- (instancetype)initWithRangeController:(ASRangeController *)rangeController; - -- (void)updateWithVisibleRatio:(CGFloat)visibleRatio - displayRatio:(CGFloat)displayRatio - leadingDisplayRatio:(CGFloat)leadingDisplayRatio - preloadRatio:(CGFloat)preloadRatio - leadingpreloadRatio:(CGFloat)leadingpreloadRatio - direction:(ASScrollDirection)direction; - -@end - -static BOOL __shouldShowRangeDebugOverlay = NO; - -@implementation ASDisplayNode (RangeDebugging) - -+ (void)setShouldShowRangeDebugOverlay:(BOOL)show -{ - __shouldShowRangeDebugOverlay = show; -} - -+ (BOOL)shouldShowRangeDebugOverlay -{ - return __shouldShowRangeDebugOverlay; -} - -@end - -@implementation ASRangeController (DebugInternal) - -+ (void)layoutDebugOverlayIfNeeded -{ - [[_ASRangeDebugOverlayView sharedInstance] setNeedsLayout]; -} - -- (void)addRangeControllerToRangeDebugOverlay -{ - [[_ASRangeDebugOverlayView sharedInstance] addRangeController:self]; -} - -- (void)updateRangeController:(ASRangeController *)controller - withScrollableDirections:(ASScrollDirection)scrollableDirections - scrollDirection:(ASScrollDirection)direction - rangeMode:(ASLayoutRangeMode)mode - displayTuningParameters:(ASRangeTuningParameters)displayTuningParameters - preloadTuningParameters:(ASRangeTuningParameters)preloadTuningParameters - interfaceState:(ASInterfaceState)interfaceState -{ - [[_ASRangeDebugOverlayView sharedInstance] updateRangeController:controller - withScrollableDirections:scrollableDirections - scrollDirection:direction - rangeMode:mode - displayTuningParameters:displayTuningParameters - preloadTuningParameters:preloadTuningParameters - interfaceState:interfaceState]; -} - -@end - - -#pragma mark _ASRangeDebugOverlayView - -@interface _ASRangeDebugOverlayView () -@end - -@implementation _ASRangeDebugOverlayView -{ - NSMutableArray *_rangeControllerViews; - NSInteger _newControllerCount; - NSInteger _removeControllerCount; - BOOL _animating; -} - -+ (UIWindow *)keyWindow -{ - // hack to work around app extensions not having UIApplication...not sure of a better way to do this? - return [[NSClassFromString(@"UIApplication") sharedApplication] keyWindow]; -} - -+ (_ASRangeDebugOverlayView *)sharedInstance NS_RETURNS_RETAINED -{ - static _ASRangeDebugOverlayView *__rangeDebugOverlay = nil; - - if (!__rangeDebugOverlay && ASDisplayNode.shouldShowRangeDebugOverlay) { - __rangeDebugOverlay = [[self alloc] initWithFrame:CGRectZero]; - [[self keyWindow] addSubview:__rangeDebugOverlay]; - } - - return __rangeDebugOverlay; -} - -#define OVERLAY_INSET 10 -#define OVERLAY_SCALE 3 -- (instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - - if (self) { - _rangeControllerViews = [[NSMutableArray alloc] init]; - self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4]; - self.layer.zPosition = 1000; - self.clipsToBounds = YES; - - CGSize windowSize = [[[self class] keyWindow] bounds].size; - self.frame = CGRectMake(windowSize.width - (windowSize.width / OVERLAY_SCALE) - OVERLAY_INSET, windowSize.height - OVERLAY_INSET, - windowSize.width / OVERLAY_SCALE, 0.0); - - UIPanGestureRecognizer *panGR = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(rangeDebugOverlayWasPanned:)]; - [self addGestureRecognizer:panGR]; - } - - return self; -} - -#define BAR_THICKNESS 24 - -- (void)layoutSubviews -{ - [super layoutSubviews]; - [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ - [self layoutToFitAllBarsExcept:0]; - } completion:^(BOOL finished) { - - }]; -} - -- (void)layoutToFitAllBarsExcept:(NSInteger)barsToClip -{ - CGSize boundsSize = self.bounds.size; - CGFloat totalHeight = 0.0; - - CGRect barRect = CGRectMake(0, boundsSize.height - BAR_THICKNESS, self.bounds.size.width, BAR_THICKNESS); - NSMutableArray *displayedBars = [NSMutableArray array]; - - for (_ASRangeDebugBarView *barView in [_rangeControllerViews copy]) { - barView.frame = barRect; - - ASInterfaceState interfaceState = [barView.rangeController.dataSource interfaceStateForRangeController:barView.rangeController]; - - if (!(interfaceState & (ASInterfaceStateVisible))) { - if (barView.destroyOnLayout && barView.alpha == 0.0) { - [_rangeControllerViews removeObjectIdenticalTo:barView]; - [barView removeFromSuperview]; - } else { - barView.alpha = 0.0; - } - } else { - assert(!barView.destroyOnLayout); // In this case we should not have a visible interfaceState - barView.alpha = 1.0; - totalHeight += BAR_THICKNESS; - barRect.origin.y -= BAR_THICKNESS; - [displayedBars addObject:barView]; - } - } - - if (totalHeight > 0) { - totalHeight -= (BAR_THICKNESS * barsToClip); - } - - if (barsToClip == 0) { - CGRect overlayFrame = self.frame; - CGFloat heightChange = (overlayFrame.size.height - totalHeight); - - overlayFrame.origin.y += heightChange; - overlayFrame.size.height = totalHeight; - self.frame = overlayFrame; - - for (_ASRangeDebugBarView *barView in displayedBars) { - [self offsetYOrigin:-heightChange forView:barView]; - } - } -} - -- (void)setOrigin:(CGPoint)origin forView:(UIView *)view -{ - CGRect newFrame = view.frame; - newFrame.origin = origin; - view.frame = newFrame; -} - -- (void)offsetYOrigin:(CGFloat)offset forView:(UIView *)view -{ - CGRect newFrame = view.frame; - newFrame.origin = CGPointMake(newFrame.origin.x, newFrame.origin.y + offset); - view.frame = newFrame; -} - -- (void)addRangeController:(ASRangeController *)rangeController -{ - for (_ASRangeDebugBarView *rangeView in _rangeControllerViews) { - if (rangeView.rangeController == rangeController) { - return; - } - } - _ASRangeDebugBarView *rangeView = [[_ASRangeDebugBarView alloc] initWithRangeController:rangeController]; - [_rangeControllerViews addObject:rangeView]; - [self addSubview:rangeView]; - - if (!_animating) { - [self layoutToFitAllBarsExcept:1]; - } - - [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ - self->_animating = YES; - [self layoutToFitAllBarsExcept:0]; - } completion:^(BOOL finished) { - self->_animating = NO; - }]; -} - -- (void)updateRangeController:(ASRangeController *)controller - withScrollableDirections:(ASScrollDirection)scrollableDirections - scrollDirection:(ASScrollDirection)scrollDirection - rangeMode:(ASLayoutRangeMode)rangeMode - displayTuningParameters:(ASRangeTuningParameters)displayTuningParameters - preloadTuningParameters:(ASRangeTuningParameters)preloadTuningParameters - interfaceState:(ASInterfaceState)interfaceState -{ - _ASRangeDebugBarView *viewToUpdate = [self barViewForRangeController:controller]; - - CGRect boundsRect = self.bounds; - CGRect visibleRect = CGRectExpandToRangeWithScrollableDirections(boundsRect, ASRangeTuningParametersZero, scrollableDirections, scrollDirection); - CGRect displayRect = CGRectExpandToRangeWithScrollableDirections(boundsRect, displayTuningParameters, scrollableDirections, scrollDirection); - CGRect preloadRect = CGRectExpandToRangeWithScrollableDirections(boundsRect, preloadTuningParameters, scrollableDirections, scrollDirection); - - // figure out which is biggest and assume that is full bounds - BOOL displayRangeLargerThanPreload = NO; - CGFloat visibleRatio = 0; - CGFloat displayRatio = 0; - CGFloat preloadRatio = 0; - CGFloat leadingDisplayTuningRatio = 0; - CGFloat leadingPreloadTuningRatio = 0; - - if (displayTuningParameters.leadingBufferScreenfuls + displayTuningParameters.trailingBufferScreenfuls != 0) { - leadingDisplayTuningRatio = displayTuningParameters.leadingBufferScreenfuls / (displayTuningParameters.leadingBufferScreenfuls + displayTuningParameters.trailingBufferScreenfuls); - } - if (preloadTuningParameters.leadingBufferScreenfuls + preloadTuningParameters.trailingBufferScreenfuls != 0) { - leadingPreloadTuningRatio = preloadTuningParameters.leadingBufferScreenfuls / (preloadTuningParameters.leadingBufferScreenfuls + preloadTuningParameters.trailingBufferScreenfuls); - } - - if (ASScrollDirectionContainsVerticalDirection(scrollDirection)) { - - if (displayRect.size.height >= preloadRect.size.height) { - displayRangeLargerThanPreload = YES; - } else { - displayRangeLargerThanPreload = NO; - } - - if (displayRangeLargerThanPreload) { - visibleRatio = visibleRect.size.height / displayRect.size.height; - displayRatio = 1.0; - preloadRatio = preloadRect.size.height / displayRect.size.height; - } else { - visibleRatio = visibleRect.size.height / preloadRect.size.height; - displayRatio = displayRect.size.height / preloadRect.size.height; - preloadRatio = 1.0; - } - - } else { - - if (displayRect.size.width >= preloadRect.size.width) { - displayRangeLargerThanPreload = YES; - } else { - displayRangeLargerThanPreload = NO; - } - - if (displayRangeLargerThanPreload) { - visibleRatio = visibleRect.size.width / displayRect.size.width; - displayRatio = 1.0; - preloadRatio = preloadRect.size.width / displayRect.size.width; - } else { - visibleRatio = visibleRect.size.width / preloadRect.size.width; - displayRatio = displayRect.size.width / preloadRect.size.width; - preloadRatio = 1.0; - } - } - - [viewToUpdate updateWithVisibleRatio:visibleRatio - displayRatio:displayRatio - leadingDisplayRatio:leadingDisplayTuningRatio - preloadRatio:preloadRatio - leadingpreloadRatio:leadingPreloadTuningRatio - direction:scrollDirection]; - - [self setNeedsLayout]; -} - -- (_ASRangeDebugBarView *)barViewForRangeController:(ASRangeController *)controller -{ - _ASRangeDebugBarView *rangeControllerBarView = nil; - - for (_ASRangeDebugBarView *rangeView in [[_rangeControllerViews reverseObjectEnumerator] allObjects]) { - // remove barView if its rangeController has been deleted - if (!rangeView.rangeController) { - rangeView.destroyOnLayout = YES; - [self setNeedsLayout]; - } - ASInterfaceState interfaceState = [rangeView.rangeController.dataSource interfaceStateForRangeController:rangeView.rangeController]; - if (!(interfaceState & (ASInterfaceStateVisible | ASInterfaceStateDisplay))) { - [self setNeedsLayout]; - } - - if ([rangeView.rangeController isEqual:controller]) { - rangeControllerBarView = rangeView; - } - } - - return rangeControllerBarView; -} - -#define MIN_VISIBLE_INSET 40 -- (void)rangeDebugOverlayWasPanned:(UIPanGestureRecognizer *)recognizer -{ - CGPoint translation = [recognizer translationInView:recognizer.view]; - CGFloat newCenterX = recognizer.view.center.x + translation.x; - CGFloat newCenterY = recognizer.view.center.y + translation.y; - CGSize boundsSize = recognizer.view.bounds.size; - CGSize superBoundsSize = recognizer.view.superview.bounds.size; - CGFloat minAllowableX = -boundsSize.width / 2.0 + MIN_VISIBLE_INSET; - CGFloat maxAllowableX = superBoundsSize.width + boundsSize.width / 2.0 - MIN_VISIBLE_INSET; - - if (newCenterX > maxAllowableX) { - newCenterX = maxAllowableX; - } else if (newCenterX < minAllowableX) { - newCenterX = minAllowableX; - } - - CGFloat minAllowableY = -boundsSize.height / 2.0 + MIN_VISIBLE_INSET; - CGFloat maxAllowableY = superBoundsSize.height + boundsSize.height / 2.0 - MIN_VISIBLE_INSET; - - if (newCenterY > maxAllowableY) { - newCenterY = maxAllowableY; - } else if (newCenterY < minAllowableY) { - newCenterY = minAllowableY; - } - - recognizer.view.center = CGPointMake(newCenterX, newCenterY); - [recognizer setTranslation:CGPointMake(0, 0) inView:recognizer.view]; -} - -@end - -#pragma mark _ASRangeDebugBarView - -@implementation _ASRangeDebugBarView -{ - ASTextNode *_debugText; - ASTextNode *_leftDebugText; - ASTextNode *_rightDebugText; - ASImageNode *_visibleRect; - ASImageNode *_displayRect; - ASImageNode *_preloadRect; - CGFloat _visibleRatio; - CGFloat _displayRatio; - CGFloat _preloadRatio; - CGFloat _leadingDisplayRatio; - CGFloat _leadingpreloadRatio; - ASScrollDirection _scrollDirection; - BOOL _firstLayoutOfRects; -} - -- (instancetype)initWithRangeController:(ASRangeController *)rangeController -{ - self = [super initWithFrame:CGRectZero]; - if (self) { - _firstLayoutOfRects = YES; - _rangeController = rangeController; - _debugText = [self createDebugTextNode]; - _leftDebugText = [self createDebugTextNode]; - _rightDebugText = [self createDebugTextNode]; - _preloadRect = [self createRangeNodeWithColor:[UIColor orangeColor]]; - _displayRect = [self createRangeNodeWithColor:[UIColor yellowColor]]; - _visibleRect = [self createRangeNodeWithColor:[UIColor greenColor]]; - } - - return self; -} - -#define HORIZONTAL_INSET 10 -- (void)layoutSubviews -{ - [super layoutSubviews]; - - CGSize boundsSize = self.bounds.size; - CGFloat subCellHeight = 9.0; - [self setBarDebugLabelsWithSize:subCellHeight]; - [self setBarSubviewOrder]; - - CGRect rect = CGRectIntegral(CGRectMake(0, 0, boundsSize.width, floorf(boundsSize.height / 2.0))); - rect.size = [_debugText layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX))].size; - rect.origin.x = (boundsSize.width - rect.size.width) / 2.0; - _debugText.frame = rect; - rect.origin.y += rect.size.height; - - rect.origin.x = 0; - rect.size = CGSizeMake(HORIZONTAL_INSET, boundsSize.height / 2.0); - _leftDebugText.frame = rect; - - rect.origin.x = boundsSize.width - HORIZONTAL_INSET; - _rightDebugText.frame = rect; - - CGFloat visibleDimension = (boundsSize.width - 2 * HORIZONTAL_INSET) * _visibleRatio; - CGFloat displayDimension = (boundsSize.width - 2 * HORIZONTAL_INSET) * _displayRatio; - CGFloat preloadDimension = (boundsSize.width - 2 * HORIZONTAL_INSET) * _preloadRatio; - CGFloat visiblePoint = 0; - CGFloat displayPoint = 0; - CGFloat preloadPoint = 0; - - BOOL displayLargerThanPreload = (_displayRatio == 1.0) ? YES : NO; - - if (ASScrollDirectionContainsLeft(_scrollDirection) || ASScrollDirectionContainsUp(_scrollDirection)) { - - if (displayLargerThanPreload) { - visiblePoint = (displayDimension - visibleDimension) * _leadingDisplayRatio; - preloadPoint = visiblePoint - (preloadDimension - visibleDimension) * _leadingpreloadRatio; - } else { - visiblePoint = (preloadDimension - visibleDimension) * _leadingpreloadRatio; - displayPoint = visiblePoint - (displayDimension - visibleDimension) * _leadingDisplayRatio; - } - } else if (ASScrollDirectionContainsRight(_scrollDirection) || ASScrollDirectionContainsDown(_scrollDirection)) { - - if (displayLargerThanPreload) { - visiblePoint = (displayDimension - visibleDimension) * (1 - _leadingDisplayRatio); - preloadPoint = visiblePoint - (preloadDimension - visibleDimension) * (1 - _leadingpreloadRatio); - } else { - visiblePoint = (preloadDimension - visibleDimension) * (1 - _leadingpreloadRatio); - displayPoint = visiblePoint - (displayDimension - visibleDimension) * (1 - _leadingDisplayRatio); - } - } - - BOOL animate = !_firstLayoutOfRects; - [UIView animateWithDuration:animate ? 0.3 : 0.0 delay:0.0 options:UIViewAnimationOptionLayoutSubviews animations:^{ - self->_visibleRect.frame = CGRectMake(HORIZONTAL_INSET + visiblePoint, rect.origin.y, visibleDimension, subCellHeight); - self->_displayRect.frame = CGRectMake(HORIZONTAL_INSET + displayPoint, rect.origin.y, displayDimension, subCellHeight); - self->_preloadRect.frame = CGRectMake(HORIZONTAL_INSET + preloadPoint, rect.origin.y, preloadDimension, subCellHeight); - } completion:^(BOOL finished) {}]; - - if (!animate) { - _visibleRect.alpha = _displayRect.alpha = _preloadRect.alpha = 0; - [UIView animateWithDuration:0.3 animations:^{ - self->_visibleRect.alpha = self->_displayRect.alpha = self->_preloadRect.alpha = 1; - }]; - } - - _firstLayoutOfRects = NO; -} - -- (void)updateWithVisibleRatio:(CGFloat)visibleRatio - displayRatio:(CGFloat)displayRatio - leadingDisplayRatio:(CGFloat)leadingDisplayRatio - preloadRatio:(CGFloat)preloadRatio - leadingpreloadRatio:(CGFloat)leadingpreloadRatio - direction:(ASScrollDirection)scrollDirection -{ - _visibleRatio = visibleRatio; - _displayRatio = displayRatio; - _leadingDisplayRatio = leadingDisplayRatio; - _preloadRatio = preloadRatio; - _leadingpreloadRatio = leadingpreloadRatio; - _scrollDirection = scrollDirection; - - [self setNeedsLayout]; -} - -- (void)setBarSubviewOrder -{ - if (_preloadRatio == 1.0) { - [self sendSubviewToBack:_preloadRect.view]; - } else { - [self sendSubviewToBack:_displayRect.view]; - } - - [self bringSubviewToFront:_visibleRect.view]; -} - -- (void)setBarDebugLabelsWithSize:(CGFloat)size -{ - if (!_debugString) { - _debugString = [[_rangeController dataSource] nameForRangeControllerDataSource]; - } - if (_debugString) { - _debugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:_debugString withSize:size]; - } - - if (ASScrollDirectionContainsVerticalDirection(_scrollDirection)) { - _leftDebugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:@"▲" withSize:size]; - _rightDebugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:@"▼" withSize:size]; - } else if (ASScrollDirectionContainsHorizontalDirection(_scrollDirection)) { - _leftDebugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:@"◀︎" withSize:size]; - _rightDebugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:@"▶︎" withSize:size]; - } - - _leftDebugText.hidden = (_scrollDirection != ASScrollDirectionLeft && _scrollDirection != ASScrollDirectionUp); - _rightDebugText.hidden = (_scrollDirection != ASScrollDirectionRight && _scrollDirection != ASScrollDirectionDown); -} - -- (ASTextNode *)createDebugTextNode -{ - ASTextNode *label = [[ASTextNode alloc] init]; - [self addSubnode:label]; - return label; -} - -#define RANGE_BAR_CORNER_RADIUS 3 -#define RANGE_BAR_BORDER_WIDTH 1 -- (ASImageNode *)createRangeNodeWithColor:(UIColor *)color -{ - ASImageNode *rangeBarImageNode = [[ASImageNode alloc] init]; - ASPrimitiveTraitCollection primitiveTraitCollection = ASPrimitiveTraitCollectionFromUITraitCollection(self.traitCollection); - rangeBarImageNode.image = [UIImage as_resizableRoundedImageWithCornerRadius:RANGE_BAR_CORNER_RADIUS - cornerColor:[UIColor clearColor] - fillColor:[color colorWithAlphaComponent:0.5] - borderColor:[[UIColor blackColor] colorWithAlphaComponent:0.9] - borderWidth:RANGE_BAR_BORDER_WIDTH - roundedCorners:UIRectCornerAllCorners - scale:[[UIScreen mainScreen] scale] - traitCollection:primitiveTraitCollection]; - [self addSubnode:rangeBarImageNode]; - - return rangeBarImageNode; -} - -+ (NSAttributedString *)whiteAttributedStringFromString:(NSString *)string withSize:(CGFloat)size NS_RETURNS_RETAINED -{ - NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor whiteColor], - NSFontAttributeName : [UIFont systemFontOfSize:size]}; - return [[NSAttributedString alloc] initWithString:string attributes:attributes]; -} - -@end diff --git a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.h b/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.h deleted file mode 100644 index 6232746a..00000000 --- a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// AsyncDisplayKit+Tips.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef void(^ASTipDisplayBlock)(ASDisplayNode *node, NSString *message); - -/** - * The methods added to ASDisplayNode to control the tips system. - * - * To enable tips, define AS_ENABLE_TIPS=1 (e.g. modify ASBaseDefines.h). - */ -@interface ASDisplayNode (Tips) - -/** - * Whether this class should have tips active. Default YES. - * - * NOTE: This property is for _disabling_ tips on a per-class basis, - * if they become annoying or have false-positives. The tips system - * is completely disabled unless you define AS_ENABLE_TIPS=1. - */ -@property (class) BOOL enableTips; - -/** - * A block to be run on the main thread to show text when a tip is tapped. - * - * If nil, the default, the message is just logged to the console with the - * ancestry of the node. - */ -@property (class, nonatomic, null_resettable) ASTipDisplayBlock tipDisplayBlock; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.mm b/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.mm deleted file mode 100644 index f1a3ec8d..00000000 --- a/Example/Pods/Texture/Source/Debug/AsyncDisplayKit+Tips.mm +++ /dev/null @@ -1,48 +0,0 @@ -// -// AsyncDisplayKit+Tips.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASDisplayNode (Tips) - -static char ASDisplayNodeEnableTipsKey; -static ASTipDisplayBlock _Nullable __tipDisplayBlock; - -/** - * Use associated objects with NSNumbers. This is a debug property - simplicity is king. - */ -+ (void)setEnableTips:(BOOL)enableTips -{ - objc_setAssociatedObject(self, &ASDisplayNodeEnableTipsKey, @(enableTips), OBJC_ASSOCIATION_COPY); -} - -+ (BOOL)enableTips -{ - NSNumber *result = objc_getAssociatedObject(self, &ASDisplayNodeEnableTipsKey); - if (result == nil) { - return YES; - } - return result.boolValue; -} - - -+ (void)setTipDisplayBlock:(ASTipDisplayBlock)tipDisplayBlock -{ - __tipDisplayBlock = tipDisplayBlock; -} - -+ (ASTipDisplayBlock)tipDisplayBlock -{ - return __tipDisplayBlock ?: ^(ASDisplayNode *node, NSString *string) { - NSLog(@"%@. Node ancestry: %@", string, node.ancestryDescription); - }; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.h b/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.h deleted file mode 100644 index 4cc7b3ae..00000000 --- a/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// ASAbstractLayoutController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); - -ASDK_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); - -ASDK_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection); - -@interface ASAbstractLayoutController : NSObject - -@end - -@interface ASAbstractLayoutController (Unavailable) - -- (NSHashTable *)indexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType __unavailable; - -- (void)allIndexPathsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSHashTable * _Nullable * _Nullable)displaySet preloadSet:(NSHashTable * _Nullable * _Nullable)preloadSet __unavailable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.mm b/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.mm deleted file mode 100644 index 9d6b61f6..00000000 --- a/Example/Pods/Texture/Source/Details/ASAbstractLayoutController.mm +++ /dev/null @@ -1,185 +0,0 @@ -// -// ASAbstractLayoutController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -ASRangeTuningParameters const ASRangeTuningParametersZero = {}; - -BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) -{ - return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls; -} - -ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, - ASRangeTuningParameters rangeTuningParameters) -{ - ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0}; - BOOL movingRight = ASScrollDirectionContainsRight(scrollDirection); - - horizontalBuffer.positiveDirection = movingRight ? rangeTuningParameters.leadingBufferScreenfuls - : rangeTuningParameters.trailingBufferScreenfuls; - horizontalBuffer.negativeDirection = movingRight ? rangeTuningParameters.trailingBufferScreenfuls - : rangeTuningParameters.leadingBufferScreenfuls; - return horizontalBuffer; -} - -ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, - ASRangeTuningParameters rangeTuningParameters) -{ - ASDirectionalScreenfulBuffer verticalBuffer = {0, 0}; - BOOL movingDown = ASScrollDirectionContainsDown(scrollDirection); - - verticalBuffer.positiveDirection = movingDown ? rangeTuningParameters.leadingBufferScreenfuls - : rangeTuningParameters.trailingBufferScreenfuls; - verticalBuffer.negativeDirection = movingDown ? rangeTuningParameters.trailingBufferScreenfuls - : rangeTuningParameters.leadingBufferScreenfuls; - return verticalBuffer; -} - -CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) -{ - CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width; - CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width; - rect.size.width = negativeDirectionWidth + rect.size.width + positiveDirectionWidth; - rect.origin.x -= negativeDirectionWidth; - return rect; -} - -CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) -{ - CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height; - CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height; - rect.size.height = negativeDirectionHeight + rect.size.height + positiveDirectionHeight; - rect.origin.y -= negativeDirectionHeight; - return rect; -} - -CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, - ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection) -{ - // Can scroll horizontally - expand the range appropriately - if (ASScrollDirectionContainsHorizontalDirection(scrollableDirections)) { - ASDirectionalScreenfulBuffer horizontalBuffer = ASDirectionalScreenfulBufferHorizontal(scrollDirection, tuningParameters); - rect = CGRectExpandHorizontally(rect, horizontalBuffer); - } - - // Can scroll vertically - expand the range appropriately - if (ASScrollDirectionContainsVerticalDirection(scrollableDirections)) { - ASDirectionalScreenfulBuffer verticalBuffer = ASDirectionalScreenfulBufferVertical(scrollDirection, tuningParameters); - rect = CGRectExpandVertically(rect, verticalBuffer); - } - - return rect; -} - -@interface ASAbstractLayoutController () { - std::vector> _tuningParameters; -} -@end - -@implementation ASAbstractLayoutController - -+ (std::vector>)defaultTuningParameters -{ - auto tuningParameters = std::vector> (ASLayoutRangeModeCount, std::vector (ASLayoutRangeTypeCount)); - - tuningParameters[ASLayoutRangeModeFull][ASLayoutRangeTypeDisplay] = { - .leadingBufferScreenfuls = 1.0, - .trailingBufferScreenfuls = 0.5 - }; - - tuningParameters[ASLayoutRangeModeFull][ASLayoutRangeTypePreload] = { - .leadingBufferScreenfuls = 2.5, - .trailingBufferScreenfuls = 1.5 - }; - - tuningParameters[ASLayoutRangeModeMinimum][ASLayoutRangeTypeDisplay] = { - .leadingBufferScreenfuls = 0.25, - .trailingBufferScreenfuls = 0.25 - }; - tuningParameters[ASLayoutRangeModeMinimum][ASLayoutRangeTypePreload] = { - .leadingBufferScreenfuls = 0.5, - .trailingBufferScreenfuls = 0.25 - }; - - tuningParameters[ASLayoutRangeModeVisibleOnly][ASLayoutRangeTypeDisplay] = { - .leadingBufferScreenfuls = 0, - .trailingBufferScreenfuls = 0 - }; - tuningParameters[ASLayoutRangeModeVisibleOnly][ASLayoutRangeTypePreload] = { - .leadingBufferScreenfuls = 0, - .trailingBufferScreenfuls = 0 - }; - - // The Low Memory range mode has special handling. Because a zero range still includes the visible area / bounds, - // in order to implement the behavior of releasing all graphics memory (backing stores), ASRangeController must check - // for this range mode and use an empty set for displayIndexPaths rather than querying the ASLayoutController for the indexPaths. - tuningParameters[ASLayoutRangeModeLowMemory][ASLayoutRangeTypeDisplay] = { - .leadingBufferScreenfuls = 0, - .trailingBufferScreenfuls = 0 - }; - tuningParameters[ASLayoutRangeModeLowMemory][ASLayoutRangeTypePreload] = { - .leadingBufferScreenfuls = 0, - .trailingBufferScreenfuls = 0 - }; - return tuningParameters; -} - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - ASDisplayNodeAssert(self.class != [ASAbstractLayoutController class], @"Should never create instances of abstract class ASAbstractLayoutController."); - - _tuningParameters = [[self class] defaultTuningParameters]; - - return self; -} - -#pragma mark - Tuning Parameters - -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType -{ - return [self tuningParametersForRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType -{ - return [self setTuningParameters:tuningParameters forRangeMode:ASLayoutRangeModeFull rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Requesting a range that is OOB for the configured tuning parameters"); - return _tuningParameters[rangeMode][rangeType]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - ASDisplayNodeAssert(rangeMode < _tuningParameters.size() && rangeType < _tuningParameters[rangeMode].size(), @"Setting a range that is OOB for the configured tuning parameters"); - _tuningParameters[rangeMode][rangeType] = tuningParameters; -} - -#pragma mark - Abstract Index Path Range Support - -- (NSHashTable *)elementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType map:(ASElementMap *)map -{ - ASDisplayNodeAssertNotSupported(); - return nil; -} - -- (void)allElementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSHashTable *__autoreleasing _Nullable *)displaySet preloadSet:(NSHashTable *__autoreleasing _Nullable *)preloadSet map:(ASElementMap *)map -{ - ASDisplayNodeAssertNotSupported(); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.h b/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.h deleted file mode 100644 index 4b675311..00000000 --- a/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASBasicImageDownloader.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * @abstract Simple NSURLSession-based image downloader. - */ -@interface ASBasicImageDownloader : NSObject - -/** - * A shared image downloader which can be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes. - * The userInfo provided by this downloader is `nil`. - * - * This is a very basic image downloader. It does not support caching, retrying, progressive downloading and likely - * isn't something you should use in production. If you'd like something production ready, see @c ASPINRemoteImageDownloader - * - * @note It is strongly recommended you include PINRemoteImage and use @c ASPINRemoteImageDownloader instead. - */ -@property (class, readonly) ASBasicImageDownloader *sharedImageDownloader; -+ (ASBasicImageDownloader *)sharedImageDownloader NS_RETURNS_RETAINED; - -+ (instancetype)new __attribute__((unavailable("+[ASBasicImageDownloader sharedImageDownloader] must be used."))); -- (instancetype)init __attribute__((unavailable("+[ASBasicImageDownloader sharedImageDownloader] must be used."))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.mm b/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.mm deleted file mode 100644 index f71d232c..00000000 --- a/Example/Pods/Texture/Source/Details/ASBasicImageDownloader.mm +++ /dev/null @@ -1,355 +0,0 @@ -// -// ASBasicImageDownloader.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import -#import - -using AS::MutexLocker; - -#pragma mark - -/** - * Collection of properties associated with a download request. - */ - -NSString * const kASBasicImageDownloaderContextCallbackQueue = @"kASBasicImageDownloaderContextCallbackQueue"; -NSString * const kASBasicImageDownloaderContextProgressBlock = @"kASBasicImageDownloaderContextProgressBlock"; -NSString * const kASBasicImageDownloaderContextCompletionBlock = @"kASBasicImageDownloaderContextCompletionBlock"; - -static inline float NSURLSessionTaskPriorityWithImageDownloaderPriority(ASImageDownloaderPriority priority) { - switch (priority) { - case ASImageDownloaderPriorityPreload: - return NSURLSessionTaskPriorityLow; - - case ASImageDownloaderPriorityImminent: - return NSURLSessionTaskPriorityDefault; - - case ASImageDownloaderPriorityVisible: - return NSURLSessionTaskPriorityHigh; - } -} - -@interface ASBasicImageDownloaderContext () -{ - BOOL _invalid; - AS::RecursiveMutex __instanceLock__; -} - -@property (nonatomic) NSMutableArray *callbackDatas; - -@end - -@implementation ASBasicImageDownloaderContext - -static NSMutableDictionary *currentRequests = nil; - -+ (AS::Mutex *)currentRequestLock -{ - static dispatch_once_t onceToken; - static AS::Mutex *currentRequestsLock; - dispatch_once(&onceToken, ^{ - currentRequestsLock = new AS::Mutex(); - }); - return currentRequestsLock; -} - -+ (ASBasicImageDownloaderContext *)contextForURL:(NSURL *)URL -{ - MutexLocker l(*self.currentRequestLock); - if (!currentRequests) { - currentRequests = [[NSMutableDictionary alloc] init]; - } - ASBasicImageDownloaderContext *context = currentRequests[URL]; - if (!context) { - context = [[ASBasicImageDownloaderContext alloc] initWithURL:URL]; - currentRequests[URL] = context; - } - return context; -} - -+ (void)cancelContextWithURL:(NSURL *)URL -{ - MutexLocker l(*self.currentRequestLock); - if (currentRequests) { - [currentRequests removeObjectForKey:URL]; - } -} - -- (instancetype)initWithURL:(NSURL *)URL -{ - if (self = [super init]) { - _URL = URL; - _callbackDatas = [NSMutableArray array]; - } - return self; -} - -- (void)cancel -{ - MutexLocker l(__instanceLock__); - - NSURLSessionTask *sessionTask = self.sessionTask; - if (sessionTask) { - [sessionTask cancel]; - self.sessionTask = nil; - } - - _invalid = YES; - [self.class cancelContextWithURL:self.URL]; -} - -- (BOOL)isCancelled -{ - MutexLocker l(__instanceLock__); - return _invalid; -} - -- (void)addCallbackData:(NSDictionary *)callbackData -{ - MutexLocker l(__instanceLock__); - [self.callbackDatas addObject:callbackData]; -} - -- (void)performProgressBlocks:(CGFloat)progress -{ - MutexLocker l(__instanceLock__); - for (NSDictionary *callbackData in self.callbackDatas) { - ASImageDownloaderProgress progressBlock = callbackData[kASBasicImageDownloaderContextProgressBlock]; - dispatch_queue_t callbackQueue = callbackData[kASBasicImageDownloaderContextCallbackQueue]; - - if (progressBlock) { - dispatch_async(callbackQueue, ^{ - progressBlock(progress); - }); - } - } -} - -- (void)completeWithImage:(UIImage *)image error:(NSError *)error -{ - MutexLocker l(__instanceLock__); - for (NSDictionary *callbackData in self.callbackDatas) { - ASImageDownloaderCompletion completionBlock = callbackData[kASBasicImageDownloaderContextCompletionBlock]; - dispatch_queue_t callbackQueue = callbackData[kASBasicImageDownloaderContextCallbackQueue]; - - if (completionBlock) { - dispatch_async(callbackQueue, ^{ - completionBlock(image, error, nil, nil); - }); - } - } - - self.sessionTask = nil; - [self.callbackDatas removeAllObjects]; -} - -- (NSURLSessionTask *)createSessionTaskIfNecessaryWithBlock:(NSURLSessionTask *(^)())creationBlock { - { - MutexLocker l(__instanceLock__); - - if (self.isCancelled) { - return nil; - } - - if (self.sessionTask && (self.sessionTask.state == NSURLSessionTaskStateRunning)) { - return nil; - } - } - - NSURLSessionTask *newTask = creationBlock(); - - { - MutexLocker l(__instanceLock__); - - if (self.isCancelled) { - return nil; - } - - if (self.sessionTask && (self.sessionTask.state == NSURLSessionTaskStateRunning)) { - return nil; - } - - self.sessionTask = newTask; - - return self.sessionTask; - } -} - -@end - - -#pragma mark - -/** - * NSURLSessionDownloadTask lacks a `userInfo` property, so add this association ourselves. - */ -@interface NSURLRequest (ASBasicImageDownloader) -@property (nonatomic) ASBasicImageDownloaderContext *asyncdisplaykit_context; -@end - -@implementation NSURLRequest (ASBasicImageDownloader) - -static const void *ContextKey() { - return @selector(asyncdisplaykit_context); -} - -- (void)setAsyncdisplaykit_context:(ASBasicImageDownloaderContext *)asyncdisplaykit_context -{ - objc_setAssociatedObject(self, ContextKey(), asyncdisplaykit_context, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} -- (ASBasicImageDownloader *)asyncdisplaykit_context -{ - return objc_getAssociatedObject(self, ContextKey()); -} -@end - - -#pragma mark - -@interface ASBasicImageDownloader () -{ - NSOperationQueue *_sessionDelegateQueue; - NSURLSession *_session; -} - -@end - -@implementation ASBasicImageDownloader - -+ (ASBasicImageDownloader *)sharedImageDownloader -{ - static ASBasicImageDownloader *sharedImageDownloader = nil; - static dispatch_once_t once = 0; - dispatch_once(&once, ^{ - sharedImageDownloader = [[ASBasicImageDownloader alloc] _init]; - }); - return sharedImageDownloader; -} - -#pragma mark Lifecycle. - -- (instancetype)_init -{ - if (!(self = [super init])) - return nil; - - _sessionDelegateQueue = [[NSOperationQueue alloc] init]; - _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] - delegate:self - delegateQueue:_sessionDelegateQueue]; - - return self; -} - - -#pragma mark ASImageDownloaderProtocol. - -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(nullable ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion -{ - return [self downloadImageWithURL:URL - shouldRetry:shouldRetry - priority:ASImageDownloaderPriorityImminent // maps to default priority - callbackQueue:callbackQueue - downloadProgress:downloadProgress - completion:completion]; -} - -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - priority:(ASImageDownloaderPriority)priority - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion -{ - ASBasicImageDownloaderContext *context = [ASBasicImageDownloaderContext contextForURL:URL]; - - // NSURLSessionDownloadTask will do file I/O to create a temp directory. If called on the main thread this will - // cause significant performance issues. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - // associate metadata with it - const auto callbackData = [[NSMutableDictionary alloc] init]; - callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ? : dispatch_get_main_queue(); - - if (downloadProgress) { - callbackData[kASBasicImageDownloaderContextProgressBlock] = [downloadProgress copy]; - } - - if (completion) { - callbackData[kASBasicImageDownloaderContextCompletionBlock] = [completion copy]; - } - - [context addCallbackData:[[NSDictionary alloc] initWithDictionary:callbackData]]; - - // Create new task if necessary - NSURLSessionDownloadTask *task = (NSURLSessionDownloadTask *)[context createSessionTaskIfNecessaryWithBlock:^(){return [self->_session downloadTaskWithURL:URL];}]; - - if (task) { - task.priority = NSURLSessionTaskPriorityWithImageDownloaderPriority(priority); - task.originalRequest.asyncdisplaykit_context = context; - - // start downloading - [task resume]; - } - }); - - return context; -} - -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier -{ - ASDisplayNodeAssert([downloadIdentifier isKindOfClass:ASBasicImageDownloaderContext.class], @"unexpected downloadIdentifier"); - ASBasicImageDownloaderContext *context = (ASBasicImageDownloaderContext *)downloadIdentifier; - - [context cancel]; -} - - -#pragma mark NSURLSessionDownloadDelegate. - -- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask - didWriteData:(int64_t)bytesWritten - totalBytesWritten:(int64_t)totalBytesWritten - totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite -{ - ASBasicImageDownloaderContext *context = downloadTask.originalRequest.asyncdisplaykit_context; - [context performProgressBlocks:(CGFloat)totalBytesWritten / (CGFloat)totalBytesExpectedToWrite]; -} - -// invoked if the download succeeded with no error -- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask - didFinishDownloadingToURL:(NSURL *)location -{ - ASBasicImageDownloaderContext *context = downloadTask.originalRequest.asyncdisplaykit_context; - if ([context isCancelled]) { - return; - } - - if (context) { - UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:location]]; - [context completeWithImage:image error:nil]; - } -} - -// invoked unconditionally -- (void)URLSession:(NSURLSession *)session task:(NSURLSessionDownloadTask *)task - didCompleteWithError:(NSError *)error -{ - ASBasicImageDownloaderContext *context = task.originalRequest.asyncdisplaykit_context; - if (context && error) { - [context completeWithImage:nil error:error]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASBatchContext.h b/Example/Pods/Texture/Source/Details/ASBatchContext.h deleted file mode 100644 index 2c71e03f..00000000 --- a/Example/Pods/Texture/Source/Details/ASBatchContext.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASBatchContext.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * @abstract A context object to notify when batch fetches are finished or cancelled. - */ -@interface ASBatchContext : NSObject - -/** - * Retrieve the state of the current batch process. - * - * @return A boolean reflecting if the owner of the context object is fetching another batch. - */ -- (BOOL)isFetching; - -/** - * Let the context object know that a batch fetch was completed. - * - * @param didComplete A boolean that states whether or not the batch fetch completed. - * - * @discussion Only by passing YES will the owner of the context know to attempt another batch update when necessary. - * For instance, when a table has reached the end of its data, a batch fetch will be attempted unless the context - * object thinks that it is still fetching. - */ -- (void)completeBatchFetching:(BOOL)didComplete; - -/** - * Ask the context object if the batch fetching process was cancelled by the context owner. - * - * @discussion If an error occurs in the context owner, the batch fetching may become out of sync and need to be - * cancelled. For best practices, pass the return value of -batchWasCancelled to -completeBatchFetch:. - * - * @return A boolean reflecting if the context object owner had to cancel the batch process. - */ -- (BOOL)batchFetchingWasCancelled; - -/** - * Notify the context object that something has interrupted the batch fetching process. - * - * @discussion Call this method only when something has corrupted the batch fetching process. Calling this method should - * be left to the owner of the batch process unless there is a specific purpose. - */ -- (void)cancelBatchFetching; - -/** - * Notify the context object that fetching has started. - * - * @discussion Call this method only when you are beginning a fetch process. This should really only be called by the - * context object's owner. Calling this method should be paired with -completeBatchFetching:. - */ -- (void)beginBatchFetching; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASBatchContext.mm b/Example/Pods/Texture/Source/Details/ASBatchContext.mm deleted file mode 100644 index a3395f6c..00000000 --- a/Example/Pods/Texture/Source/Details/ASBatchContext.mm +++ /dev/null @@ -1,61 +0,0 @@ -// -// ASBatchContext.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -typedef NS_ENUM(NSInteger, ASBatchContextState) { - ASBatchContextStateFetching, - ASBatchContextStateCancelled, - ASBatchContextStateCompleted -}; - -@implementation ASBatchContext { - atomic_int _state; -} - -- (instancetype)init -{ - if (self = [super init]) { - _state = ATOMIC_VAR_INIT(ASBatchContextStateCompleted); - } - return self; -} - -- (BOOL)isFetching -{ - return atomic_load(&_state) == ASBatchContextStateFetching; -} - -- (BOOL)batchFetchingWasCancelled -{ - return atomic_load(&_state) == ASBatchContextStateCancelled; -} - -- (void)beginBatchFetching -{ - atomic_store(&_state, ASBatchContextStateFetching); -} - -- (void)completeBatchFetching:(BOOL)didComplete -{ - if (didComplete) { - os_log_debug(ASCollectionLog(), "Completed batch fetch with context %@", self); - atomic_store(&_state, ASBatchContextStateCompleted); - } -} - -- (void)cancelBatchFetching -{ - atomic_store(&_state, ASBatchContextStateCancelled); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASBatchFetchingDelegate.h b/Example/Pods/Texture/Source/Details/ASBatchFetchingDelegate.h deleted file mode 100644 index 3b351150..00000000 --- a/Example/Pods/Texture/Source/Details/ASBatchFetchingDelegate.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ASBatchFetchingDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@protocol ASBatchFetchingDelegate - -/** - * @abstract Determine if batch fetching should begin based on the remaining time. - * If the delegate doesn't have enough information to confidently decide, it can take the given hint. - * - * @param remainingTime The amount of time left for user to reach the end of the scroll view's content. - * - * @param hint A hint for the delegate to fallback to. - */ -- (BOOL)shouldFetchBatchWithRemainingTime:(NSTimeInterval)remainingTime hint:(BOOL)hint; - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionElement.h b/Example/Pods/Texture/Source/Details/ASCollectionElement.h deleted file mode 100644 index b128dd66..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionElement.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// ASCollectionElement.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASDisplayNode; -@protocol ASRangeManagingNode; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionElement : NSObject - -@property (nullable, nonatomic, copy, readonly) NSString *supplementaryElementKind; -@property (nonatomic) ASSizeRange constrainedSize; -@property (nonatomic, weak, readonly) id owningNode; -@property (nonatomic) ASPrimitiveTraitCollection traitCollection; -@property (nullable, nonatomic, readonly) id nodeModel; - -- (instancetype)initWithNodeModel:(nullable id)nodeModel - nodeBlock:(ASCellNodeBlock)nodeBlock - supplementaryElementKind:(nullable NSString *)supplementaryElementKind - constrainedSize:(ASSizeRange)constrainedSize - owningNode:(id)owningNode - traitCollection:(ASPrimitiveTraitCollection)traitCollection; - -/** - * @return The node, running the node block if necessary. The node block will be discarded - * after the first time it is run. - */ -@property (readonly) ASCellNode *node; - -/** - * @return The node, if the node block has been run already. - */ -@property (nullable, readonly) ASCellNode *nodeIfAllocated; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionElement.mm b/Example/Pods/Texture/Source/Details/ASCollectionElement.mm deleted file mode 100644 index 9f9a05c5..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionElement.mm +++ /dev/null @@ -1,87 +0,0 @@ -// -// ASCollectionElement.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@interface ASCollectionElement () - -/// Required node block used to allocate a cell node. Nil after the first execution. -@property (nonatomic) ASCellNodeBlock nodeBlock; - -@end - -@implementation ASCollectionElement { - AS::Mutex _lock; - ASCellNode *_node; -} - -- (instancetype)initWithNodeModel:(id)nodeModel - nodeBlock:(ASCellNodeBlock)nodeBlock - supplementaryElementKind:(NSString *)supplementaryElementKind - constrainedSize:(ASSizeRange)constrainedSize - owningNode:(id)owningNode - traitCollection:(ASPrimitiveTraitCollection)traitCollection -{ - NSAssert(nodeBlock != nil, @"Node block must not be nil"); - self = [super init]; - if (self) { - _nodeModel = nodeModel; - _nodeBlock = nodeBlock; - _supplementaryElementKind = [supplementaryElementKind copy]; - _constrainedSize = constrainedSize; - _owningNode = owningNode; - _traitCollection = traitCollection; - } - return self; -} - -- (ASCellNode *)node -{ - AS::MutexLocker l(_lock); - if (_nodeBlock != nil) { - ASCellNode *node = _nodeBlock(); - _nodeBlock = nil; - if (node == nil) { - ASDisplayNodeFailAssert(@"Node block returned nil node!"); - node = [[ASCellNode alloc] init]; - } - node.collectionElement = self; - ASTraitCollectionPropagateDown(node, _traitCollection); - node.nodeModel = _nodeModel; - _node = node; - } - return _node; -} - -- (ASCellNode *)nodeIfAllocated -{ - AS::MutexLocker l(_lock); - return _node; -} - -- (void)setTraitCollection:(ASPrimitiveTraitCollection)traitCollection -{ - ASCellNode *nodeIfNeedsPropagation; - - { - AS::MutexLocker l(_lock); - if (! ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(_traitCollection, traitCollection)) { - _traitCollection = traitCollection; - nodeIfNeedsPropagation = _node; - } - } - - if (nodeIfNeedsPropagation != nil) { - ASTraitCollectionPropagateDown(nodeIfNeedsPropagation, traitCollection); - } -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.h b/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.h deleted file mode 100644 index d22e9bba..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ASCollectionFlowLayoutDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED - -/** - * A thread-safe, high performant layout delegate that arranges items into a flow layout. - * It uses a concurrent and multi-line ASStackLayoutSpec under the hood. Thus, per-child flex properties (i.e alignSelf, - * flexShrink, flexGrow, etc - see @ASStackLayoutElement) can be set directly on cell nodes to be used - * to calculate the final collection layout. - */ -@interface ASCollectionFlowLayoutDelegate : NSObject - -- (instancetype)initWithScrollableDirections:(ASScrollDirection)scrollableDirections NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.mm b/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.mm deleted file mode 100644 index 7a2796ca..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionFlowLayoutDelegate.mm +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASCollectionFlowLayoutDelegate.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -@implementation ASCollectionFlowLayoutDelegate { - ASScrollDirection _scrollableDirections; -} - -- (instancetype)init -{ - return [self initWithScrollableDirections:ASScrollDirectionVerticalDirections]; -} - -- (instancetype)initWithScrollableDirections:(ASScrollDirection)scrollableDirections -{ - self = [super init]; - if (self) { - _scrollableDirections = scrollableDirections; - } - return self; -} - -- (ASScrollDirection)scrollableDirections -{ - ASDisplayNodeAssertMainThread(); - return _scrollableDirections; -} - -- (id)additionalInfoForLayoutWithElements:(ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - return nil; -} - -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context -{ - ASElementMap *elements = context.elements; - NSArray *children = ASArrayByFlatMapping(elements.itemElements, ASCollectionElement *element, element.node); - if (children.count == 0) { - return [[ASCollectionLayoutState alloc] initWithContext:context]; - } - - ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal - spacing:0 - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - flexWrap:ASStackLayoutFlexWrapWrap - alignContent:ASStackLayoutAlignContentStart - children:children]; - stackSpec.concurrent = YES; - - ASSizeRange sizeRange = ASSizeRangeForCollectionLayoutThatFitsViewportSize(context.viewportSize, context.scrollableDirections); - ASLayout *layout = [stackSpec layoutThatFits:sizeRange]; - - return [[ASCollectionLayoutState alloc] initWithContext:context layout:layout getElementBlock:^ASCollectionElement * _Nullable(ASLayout * _Nonnull sublayout) { - ASCellNode *node = ASDynamicCast(sublayout.layoutElement, ASCellNode); - return node ? node.collectionElement : nil; - }]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.h b/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.h deleted file mode 100644 index 064891c5..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASCollectionGalleryLayoutDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASElementMap; -@class ASCollectionGalleryLayoutDelegate; - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASCollectionGalleryLayoutPropertiesProviding - -/** - * Returns the fixed size of each and every element. - * - * @discussion This method will only be called on main thread. - * - * @param delegate The calling object. - * - * @param elements All elements to be sized. - * - * @return The elements' size - */ -- (CGSize)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sizeForElements:(ASElementMap *)elements; - -@optional - -/** - * Returns the minumum spacing to use between lines of items. - * - * @discussion This method will only be called on main thread. - * - * @discussion For a vertically scrolling layout, this value represents the minimum spacing between rows. - * For a horizontally scrolling one, it represents the minimum spacing between columns. - * It is not applied between the first line and the header, or between the last line and the footer. - * This is the same behavior as UICollectionViewFlowLayout's minimumLineSpacing. - * - * @param delegate The calling object. - * - * @param elements All elements in the layout. - * - * @return The interitem spacing - */ -- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumLineSpacingForElements:(ASElementMap *)elements; - -/** - * Returns the minumum spacing to use between items in the same row or column, depending on the scroll directions. - * - * @discussion This method will only be called on main thread. - * - * @discussion For a vertically scrolling layout, this value represents the minimum spacing between items in the same row. - * For a horizontally scrolling one, it represents the minimum spacing between items in the same column. - * It is considered while fitting items into lines, but the actual final spacing between some items might be larger. - * This is the same behavior as UICollectionViewFlowLayout's minimumInteritemSpacing. - * - * @param delegate The calling object. - * - * @param elements All elements in the layout. - * - * @return The interitem spacing - */ -- (CGFloat)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate minimumInteritemSpacingForElements:(ASElementMap *)elements; - -/** - * Returns the margins of each section. - * - * @discussion This method will only be called on main thread. - * - * @param delegate The calling object. - * - * @param elements All elements in the layout. - * - * @return The margins used to layout content in a section - */ -- (UIEdgeInsets)galleryLayoutDelegate:(ASCollectionGalleryLayoutDelegate *)delegate sectionInsetForElements:(ASElementMap *)elements; - -@end - -/** - * A thread-safe layout delegate that arranges items with the same size into a flow layout. - * - * @note Supplemenraty elements are not supported. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionGalleryLayoutDelegate : NSObject - -@property (nonatomic, weak) id propertiesProvider; - -/** - * Designated initializer. - * - * @param scrollableDirections The scrollable directions of this layout. Must be either vertical or horizontal directions. - */ -- (instancetype)initWithScrollableDirections:(ASScrollDirection)scrollableDirections NS_DESIGNATED_INITIALIZER; - -- (instancetype)init __unavailable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.mm b/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.mm deleted file mode 100644 index 5ba74d61..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionGalleryLayoutDelegate.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASCollectionGalleryLayoutDelegate.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#pragma mark - ASCollectionGalleryLayoutDelegate - -@implementation ASCollectionGalleryLayoutDelegate { - ASScrollDirection _scrollableDirections; - - struct { - unsigned int minimumLineSpacingForElements:1; - unsigned int minimumInteritemSpacingForElements:1; - unsigned int sectionInsetForElements:1; - } _propertiesProviderFlags; -} - -- (instancetype)initWithScrollableDirections:(ASScrollDirection)scrollableDirections -{ - self = [super init]; - if (self) { - // Scrollable directions must be either vertical or horizontal, but not both - ASDisplayNodeAssertTrue(ASScrollDirectionContainsVerticalDirection(scrollableDirections) - || ASScrollDirectionContainsHorizontalDirection(scrollableDirections)); - ASDisplayNodeAssertFalse(ASScrollDirectionContainsVerticalDirection(scrollableDirections) - && ASScrollDirectionContainsHorizontalDirection(scrollableDirections)); - _scrollableDirections = scrollableDirections; - } - return self; -} - -- (ASScrollDirection)scrollableDirections -{ - ASDisplayNodeAssertMainThread(); - return _scrollableDirections; -} - -- (void)setPropertiesProvider:(id)propertiesProvider -{ - ASDisplayNodeAssertMainThread(); - if (propertiesProvider == nil) { - _propertiesProvider = nil; - _propertiesProviderFlags = {}; - } else { - _propertiesProvider = propertiesProvider; - _propertiesProviderFlags.minimumLineSpacingForElements = [_propertiesProvider respondsToSelector:@selector(galleryLayoutDelegate:minimumLineSpacingForElements:)]; - _propertiesProviderFlags.minimumInteritemSpacingForElements = [_propertiesProvider respondsToSelector:@selector(galleryLayoutDelegate:minimumInteritemSpacingForElements:)]; - _propertiesProviderFlags.sectionInsetForElements = [_propertiesProvider respondsToSelector:@selector(galleryLayoutDelegate:sectionInsetForElements:)]; - } -} - -- (id)additionalInfoForLayoutWithElements:(ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - id propertiesProvider = _propertiesProvider; - if (propertiesProvider == nil) { - return nil; - } - - CGSize itemSize = [propertiesProvider galleryLayoutDelegate:self sizeForElements:elements]; - UIEdgeInsets sectionInset = _propertiesProviderFlags.sectionInsetForElements ? [propertiesProvider galleryLayoutDelegate:self sectionInsetForElements:elements] : UIEdgeInsetsZero; - CGFloat lineSpacing = _propertiesProviderFlags.minimumLineSpacingForElements ? [propertiesProvider galleryLayoutDelegate:self minimumLineSpacingForElements:elements] : 0.0; - CGFloat interitemSpacing = _propertiesProviderFlags.minimumInteritemSpacingForElements ? [propertiesProvider galleryLayoutDelegate:self minimumInteritemSpacingForElements:elements] : 0.0; - return [[_ASCollectionGalleryLayoutInfo alloc] initWithItemSize:itemSize - minimumLineSpacing:lineSpacing - minimumInteritemSpacing:interitemSpacing - sectionInset:sectionInset]; -} - -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context -{ - ASElementMap *elements = context.elements; - CGSize pageSize = context.viewportSize; - ASScrollDirection scrollableDirections = context.scrollableDirections; - - _ASCollectionGalleryLayoutInfo *info = ASDynamicCast(context.additionalInfo, _ASCollectionGalleryLayoutInfo); - CGSize itemSize = info.itemSize; - if (info == nil || CGSizeEqualToSize(CGSizeZero, itemSize)) { - return [[ASCollectionLayoutState alloc] initWithContext:context]; - } - - NSArray<_ASGalleryLayoutItem *> *children = ASArrayByFlatMapping(elements.itemElements, - ASCollectionElement *element, - [[_ASGalleryLayoutItem alloc] initWithItemSize:itemSize collectionElement:element]); - if (children.count == 0) { - return [[ASCollectionLayoutState alloc] initWithContext:context]; - } - - // Use a stack spec to calculate layout content size and frames of all elements without actually measuring each element - ASStackLayoutDirection stackDirection = ASScrollDirectionContainsVerticalDirection(scrollableDirections) - ? ASStackLayoutDirectionHorizontal - : ASStackLayoutDirectionVertical; - ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:stackDirection - spacing:info.minimumInteritemSpacing - justifyContent:ASStackLayoutJustifyContentStart - alignItems:ASStackLayoutAlignItemsStart - flexWrap:ASStackLayoutFlexWrapWrap - alignContent:ASStackLayoutAlignContentStart - lineSpacing:info.minimumLineSpacing - children:children]; - stackSpec.concurrent = YES; - - ASLayoutSpec *finalSpec = stackSpec; - UIEdgeInsets sectionInset = info.sectionInset; - if (UIEdgeInsetsEqualToEdgeInsets(sectionInset, UIEdgeInsetsZero) == NO) { - finalSpec = [ASInsetLayoutSpec insetLayoutSpecWithInsets:sectionInset child:stackSpec]; - } - - ASLayout *layout = [finalSpec layoutThatFits:ASSizeRangeForCollectionLayoutThatFitsViewportSize(pageSize, scrollableDirections)]; - - return [[ASCollectionLayoutState alloc] initWithContext:context layout:layout getElementBlock:^ASCollectionElement * _Nullable(ASLayout * _Nonnull sublayout) { - _ASGalleryLayoutItem *item = ASDynamicCast(sublayout.layoutElement, _ASGalleryLayoutItem); - return item ? item.collectionElement : nil; - }]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionInternal.h b/Example/Pods/Texture/Source/Details/ASCollectionInternal.h deleted file mode 100644 index 42f651ae..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionInternal.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// ASCollectionInternal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASCollectionViewLayoutFacilitatorProtocol; -@class ASCollectionNode; -@class ASDataController; -@class ASRangeController; - -@interface ASCollectionView () -- (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(nullable id)layoutFacilitator owningNode:(nullable ASCollectionNode *)owningNode; - -@property (nonatomic, weak) ASCollectionNode *collectionNode; -@property (nonatomic, readonly) ASDataController *dataController; -@property (nonatomic, readonly) ASRangeController *rangeController; - -/** - * The change set that we're currently building, if any. - */ -@property (nonatomic, nullable, readonly) _ASHierarchyChangeSet *changeSet; - -/** - * @see ASCollectionNode+Beta.h for full documentation. - */ -@property (nonatomic) ASCellLayoutMode cellLayoutMode; - -/** - * Attempt to get the view-layer index path for the item with the given index path. - * - * @param indexPath The index path of the item. - * @param wait If the item hasn't reached the view yet, this attempts to wait for updates to commit. - */ -- (nullable NSIndexPath *)convertIndexPathFromCollectionNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait; - -/** - * Attempt to get the node index path given the view-layer index path. - * - * @param indexPath The index path of the row. - */ -- (nullable NSIndexPath *)convertIndexPathToCollectionNode:(NSIndexPath *)indexPath; - -/** - * Attempt to get the node index paths given the view-layer index paths. - * - * @param indexPaths An array of index paths in the view space - */ -- (nullable NSArray *)convertIndexPathsToCollectionNode:(nullable NSArray *)indexPaths; - -- (void)beginUpdates; - -- (void)endUpdatesAnimated:(BOOL)animated completion:(nullable void (^)(BOOL))completion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.h b/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.h deleted file mode 100644 index 4c25838d..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ASCollectionLayoutContext.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASElementMap; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionLayoutContext : NSObject - -@property (nonatomic, readonly) CGSize viewportSize; -@property (nonatomic, readonly) CGPoint initialContentOffset; -@property (nonatomic, readonly) ASScrollDirection scrollableDirections; -@property (nonatomic, weak, readonly) ASElementMap *elements; -@property (nullable, nonatomic, readonly) id additionalInfo; - -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.mm b/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.mm deleted file mode 100644 index 6f2ba718..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionLayoutContext.mm +++ /dev/null @@ -1,102 +0,0 @@ -// -// ASCollectionLayoutContext.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import -#import -#import - -@implementation ASCollectionLayoutContext { - Class _layoutDelegateClass; - __weak ASCollectionLayoutCache *_layoutCache; -} - -- (instancetype)initWithViewportSize:(CGSize)viewportSize - initialContentOffset:(CGPoint)initialContentOffset - scrollableDirections:(ASScrollDirection)scrollableDirections - elements:(ASElementMap *)elements - layoutDelegateClass:(Class)layoutDelegateClass - layoutCache:(ASCollectionLayoutCache *)layoutCache - additionalInfo:(id)additionalInfo -{ - self = [super init]; - if (self) { - _viewportSize = viewportSize; - _initialContentOffset = initialContentOffset; - _scrollableDirections = scrollableDirections; - _elements = elements; - _layoutDelegateClass = layoutDelegateClass; - _layoutCache = layoutCache; - _additionalInfo = additionalInfo; - } - return self; -} - -- (Class)layoutDelegateClass -{ - return _layoutDelegateClass; -} - -- (ASCollectionLayoutCache *)layoutCache -{ - return _layoutCache; -} - -// NOTE: Some properties, like initialContentOffset and layoutCache are ignored in -isEqualToContext: and -hash. -// That is because contexts can be equal regardless of the content offsets or layout caches. -- (BOOL)isEqualToContext:(ASCollectionLayoutContext *)context -{ - if (context == nil) { - return NO; - } - - // NOTE: ASObjectIsEqual returns YES when both objects are nil. - // So don't use ASObjectIsEqual on _elements. - // It is a weak property and 2 layouts generated from different sets of elements - // should never be considered the same even if they are nil now. - return CGSizeEqualToSize(_viewportSize, context.viewportSize) - && _scrollableDirections == context.scrollableDirections - && [_elements isEqual:context.elements] - && _layoutDelegateClass == context.layoutDelegateClass - && ASObjectIsEqual(_additionalInfo, context.additionalInfo); -} - -- (BOOL)isEqual:(id)other -{ - if (self == other) { - return YES; - } - if (! [other isKindOfClass:[ASCollectionLayoutContext class]]) { - return NO; - } - return [self isEqualToContext:other]; -} - -- (NSUInteger)hash -{ - struct { - CGSize viewportSize; - ASScrollDirection scrollableDirections; - NSUInteger elementsHash; - NSUInteger layoutDelegateClassHash; - NSUInteger additionalInfoHash; - } data = { - _viewportSize, - _scrollableDirections, - _elements.hash, - _layoutDelegateClass.hash, - [_additionalInfo hash] - }; - return ASHashBytes(&data, sizeof(data)); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionLayoutDelegate.h b/Example/Pods/Texture/Source/Details/ASCollectionLayoutDelegate.h deleted file mode 100644 index c53e22a0..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionLayoutDelegate.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// ASCollectionLayoutDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASElementMap, ASCollectionLayoutContext, ASCollectionLayoutState; - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASCollectionLayoutDelegate - -/** - * @abstract Returns the scrollable directions of the coming layout (@see @c -calculateLayoutWithContext:). - * It will be available in the context parameter in +calculateLayoutWithContext: - * - * @return The scrollable directions. - * - * @discusstion This method will be called on main thread. - */ -- (ASScrollDirection)scrollableDirections; - -/** - * @abstract Returns any additional information needed for a coming layout pass (@see @c -calculateLayoutWithContext:) with the given elements. - * - * @param elements The elements to be laid out later. - * - * @discussion The returned object must support equality and hashing (i.e `-isEqual:` and `-hash` must be properly implemented). - * It should contain all the information needed for the layout pass to perform. It will be available in the context parameter in +calculateLayoutWithContext: - * - * This method will be called on main thread. - */ -- (nullable id)additionalInfoForLayoutWithElements:(ASElementMap *)elements; - -/** - * @abstract Prepares and returns a new layout for given context. - * - * @param context A context that contains all elements to be laid out and any additional information needed. - * - * @return The new layout calculated for the given context. - * - * @discussion This method is called ahead of time, i.e before the underlying collection/table view is aware of the provided elements. - * As a result, clients must solely rely on the given context and should not reach out to other objects for information not available in the context. - * - * This method can be called on background theads. It must be thread-safe and should not change any internal state of this delegate. - * It must block the calling thread but can dispatch to other theads to reduce total blocking time. - */ -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.h b/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.h deleted file mode 100644 index c3620330..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// ASCollectionLayoutState.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASCollectionLayoutContext, ASLayout, ASCollectionElement; - -NS_ASSUME_NONNULL_BEGIN - -typedef ASCollectionElement * _Nullable (^ASCollectionLayoutStateGetElementBlock)(ASLayout *); - -@interface NSMapTable (ASCollectionLayoutConvenience) - -+ (NSMapTable *)elementToLayoutAttributesTable; - -@end - -AS_SUBCLASSING_RESTRICTED - -/// An immutable state of the collection layout -@interface ASCollectionLayoutState : NSObject - -/// The context used to calculate this object -@property (readonly) ASCollectionLayoutContext *context; - -/// The final content size of the collection's layout -@property (readonly) CGSize contentSize; - -- (instancetype)init NS_UNAVAILABLE; - -/** - * Designated initializer. - * - * @param context The context used to calculate this object - * - * @param contentSize The content size of the collection's layout - * - * @param table A map between elements to their layout attributes. It must contain all elements. - * It should have NSMapTableObjectPointerPersonality and NSMapTableWeakMemory as key options. - */ -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context - contentSize:(CGSize)contentSize - elementToLayoutAttributesTable:(NSMapTable *)table NS_DESIGNATED_INITIALIZER; - -/** - * Convenience initializer. Returns an object with zero content size and an empty table. - * - * @param context The context used to calculate this object - */ -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context; - -/** - * Convenience initializer. - * - * @param context The context used to calculate this object - * - * @param layout The layout describes size and position of all elements. - * - * @param getElementBlock A block that can retrieve the collection element from a sublayout of the root layout. - */ -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context - layout:(ASLayout *)layout - getElementBlock:(ASCollectionLayoutStateGetElementBlock)getElementBlock; - -/** - * Returns all layout attributes present in this object. - */ -- (NSArray *)allLayoutAttributes; - -/** - * Returns layout attributes of elements in the specified rect. - * - * @param rect The rect containing the target elements. - */ -- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect; - -/** - * Returns layout attributes of the element at the specified index path. - * - * @param indexPath The index path of the item. - */ -- (nullable UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Returns layout attributes of the specified supplementary element. - * - * @param kind A string that identifies the type of the supplementary element. - * - * @param indexPath The index path of the element. - */ -- (nullable UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryElementOfKind:(NSString *)kind - atIndexPath:(NSIndexPath *)indexPath; - -/** - * Returns layout attributes of the specified element. - * - * @element The element. - */ -- (nullable UICollectionViewLayoutAttributes *)layoutAttributesForElement:(ASCollectionElement *)element; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.mm b/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.mm deleted file mode 100644 index 0f98b215..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionLayoutState.mm +++ /dev/null @@ -1,253 +0,0 @@ -// -// ASCollectionLayoutState.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import - -@implementation NSMapTable (ASCollectionLayoutConvenience) - -+ (NSMapTable *)elementToLayoutAttributesTable -{ - return [NSMapTable mapTableWithKeyOptions:(NSMapTableWeakMemory | NSMapTableObjectPointerPersonality) valueOptions:NSMapTableStrongMemory]; -} - -@end - -@implementation ASCollectionLayoutState { - AS::Mutex __instanceLock__; - CGSize _contentSize; - ASCollectionLayoutContext *_context; - NSMapTable *_elementToLayoutAttributesTable; - ASPageToLayoutAttributesTable *_pageToLayoutAttributesTable; - ASPageToLayoutAttributesTable *_unmeasuredPageToLayoutAttributesTable; -} - -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context -{ - return [self initWithContext:context - contentSize:CGSizeZero -elementToLayoutAttributesTable:[NSMapTable elementToLayoutAttributesTable]]; -} - -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context - layout:(ASLayout *)layout - getElementBlock:(ASCollectionLayoutStateGetElementBlock)getElementBlock -{ - ASElementMap *elements = context.elements; - NSMapTable *table = [NSMapTable elementToLayoutAttributesTable]; - - // Traverse the given layout tree in breadth first fashion. Generate layout attributes for all included elements along the way. - struct Context { - ASLayout *layout; - CGPoint absolutePosition; - }; - - std::queue queue; - queue.push({layout, CGPointZero}); - - while (!queue.empty()) { - Context context = queue.front(); - queue.pop(); - - ASLayout *layout = context.layout; - const CGPoint absolutePosition = context.absolutePosition; - - ASCollectionElement *element = getElementBlock(layout); - if (element != nil) { - NSIndexPath *indexPath = [elements indexPathForElement:element]; - NSString *supplementaryElementKind = element.supplementaryElementKind; - - UICollectionViewLayoutAttributes *attrs; - if (supplementaryElementKind == nil) { - attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; - } else { - attrs = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:supplementaryElementKind withIndexPath:indexPath]; - } - - CGRect frame = layout.frame; - frame.origin = absolutePosition; - attrs.frame = frame; - [table setObject:attrs forKey:element]; - } - - // Add all sublayouts to process in next step - for (ASLayout *sublayout in layout.sublayouts) { - queue.push({sublayout, absolutePosition + sublayout.position}); - } - } - - return [self initWithContext:context contentSize:layout.size elementToLayoutAttributesTable:table]; -} - -- (instancetype)initWithContext:(ASCollectionLayoutContext *)context - contentSize:(CGSize)contentSize - elementToLayoutAttributesTable:(NSMapTable *)table -{ - self = [super init]; - if (self) { - _context = context; - _contentSize = contentSize; - _elementToLayoutAttributesTable = [table copy]; // Copy the given table to make sure clients can't mutate it after this point. - CGSize pageSize = context.viewportSize; - _pageToLayoutAttributesTable = [ASPageTable pageTableWithLayoutAttributes:table.objectEnumerator contentSize:contentSize pageSize:pageSize]; - _unmeasuredPageToLayoutAttributesTable = [ASCollectionLayoutState _unmeasuredLayoutAttributesTableFromTable:table contentSize:contentSize pageSize:pageSize]; - } - return self; -} - -- (ASCollectionLayoutContext *)context -{ - return _context; -} - -- (CGSize)contentSize -{ - return _contentSize; -} - -- (NSArray *)allLayoutAttributes -{ - return [_elementToLayoutAttributesTable.objectEnumerator allObjects]; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASCollectionElement *element = [_context.elements elementForItemAtIndexPath:indexPath]; - return [_elementToLayoutAttributesTable objectForKey:element]; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryElementOfKind:(NSString *)elementKind - atIndexPath:(NSIndexPath *)indexPath -{ - ASCollectionElement *element = [_context.elements supplementaryElementOfKind:elementKind atIndexPath:indexPath]; - return [_elementToLayoutAttributesTable objectForKey:element]; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForElement:(ASCollectionElement *)element -{ - return [_elementToLayoutAttributesTable objectForKey:element]; -} - -- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect -{ - CGSize pageSize = _context.viewportSize; - NSPointerArray *pages = ASPageCoordinatesForPagesThatIntersectRect(rect, _contentSize, pageSize); - if (pages.count == 0) { - return @[]; - } - - // Use a set here because some items may span multiple pages - const auto result = [[NSMutableSet alloc] init]; - for (id pagePtr in pages) { - ASPageCoordinate page = (ASPageCoordinate)pagePtr; - NSArray *allAttrs = [_pageToLayoutAttributesTable objectForPage:page]; - if (allAttrs.count > 0) { - CGRect pageRect = ASPageCoordinateGetPageRect(page, pageSize); - - if (CGRectContainsRect(rect, pageRect)) { - [result addObjectsFromArray:allAttrs]; - } else { - for (UICollectionViewLayoutAttributes *attrs in allAttrs) { - if (CGRectIntersectsRect(rect, attrs.frame)) { - [result addObject:attrs]; - } - } - } - } - } - - return [result allObjects]; -} - -- (ASPageToLayoutAttributesTable *)getAndRemoveUnmeasuredLayoutAttributesPageTableInRect:(CGRect)rect -{ - CGSize pageSize = _context.viewportSize; - CGSize contentSize = _contentSize; - - AS::MutexLocker l(__instanceLock__); - if (_unmeasuredPageToLayoutAttributesTable.count == 0 || CGRectIsNull(rect) || CGRectIsEmpty(rect) || CGSizeEqualToSize(CGSizeZero, contentSize) || CGSizeEqualToSize(CGSizeZero, pageSize)) { - return nil; - } - - // Step 1: Determine all the pages that intersect the specified rect - NSPointerArray *pagesInRect = ASPageCoordinatesForPagesThatIntersectRect(rect, contentSize, pageSize); - if (pagesInRect.count == 0) { - return nil; - } - - // Step 2: Filter out attributes in these pages that intersect the specified rect. - ASPageToLayoutAttributesTable *result = nil; - for (id pagePtr in pagesInRect) { - ASPageCoordinate page = (ASPageCoordinate)pagePtr; - NSMutableArray *attrsInPage = [_unmeasuredPageToLayoutAttributesTable objectForPage:page]; - if (attrsInPage.count == 0) { - continue; - } - - NSMutableArray *intersectingAttrsInPage = nil; - CGRect pageRect = ASPageCoordinateGetPageRect(page, pageSize); - if (CGRectContainsRect(rect, pageRect)) { - // This page fits well within the specified rect. Simply return all of its attributes. - intersectingAttrsInPage = attrsInPage; - } else { - // The page intersects the specified rect. Some attributes in this page are returned, some are not. - for (UICollectionViewLayoutAttributes *attrs in attrsInPage) { - if (CGRectIntersectsRect(rect, attrs.frame)) { - if (intersectingAttrsInPage == nil) { - intersectingAttrsInPage = [[NSMutableArray alloc] init]; - } - [intersectingAttrsInPage addObject:attrs]; - } - } - } - - if (intersectingAttrsInPage.count > 0) { - if (attrsInPage.count == intersectingAttrsInPage.count) { - [_unmeasuredPageToLayoutAttributesTable removeObjectForPage:page]; - } else { - [attrsInPage removeObjectsInArray:intersectingAttrsInPage]; - } - if (result == nil) { - result = [ASPageTable pageTableForStrongObjectPointers]; - } - [result setObject:intersectingAttrsInPage forPage:page]; - } - } - - return result; -} - -#pragma mark - Private methods - -+ (ASPageToLayoutAttributesTable *)_unmeasuredLayoutAttributesTableFromTable:(NSMapTable *)table - contentSize:(CGSize)contentSize - pageSize:(CGSize)pageSize -{ - NSMutableArray *unmeasuredAttrs = [[NSMutableArray alloc] init]; - for (ASCollectionElement *element in table) { - UICollectionViewLayoutAttributes *attrs = [table objectForKey:element]; - if (element.nodeIfAllocated == nil || CGSizeEqualToSize(element.nodeIfAllocated.calculatedSize, attrs.frame.size) == NO) { - [unmeasuredAttrs addObject:attrs]; - } - } - - return [ASPageTable pageTableWithLayoutAttributes:unmeasuredAttrs contentSize:contentSize pageSize:pageSize]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.h b/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.h deleted file mode 100644 index 6311e0ad..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ASCollectionViewLayoutController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionView; - -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionViewLayoutController : ASAbstractLayoutController - -- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.mm b/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.mm deleted file mode 100644 index b31bb127..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutController.mm +++ /dev/null @@ -1,126 +0,0 @@ -// -// ASCollectionViewLayoutController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -struct ASRangeGeometry { - CGRect rangeBounds; - CGRect updateBounds; -}; -typedef struct ASRangeGeometry ASRangeGeometry; - -#pragma mark - -#pragma mark ASCollectionViewLayoutController - -@interface ASCollectionViewLayoutController () -{ - @package - ASCollectionView * __weak _collectionView; - UICollectionViewLayout * __strong _collectionViewLayout; -} -@end - -@implementation ASCollectionViewLayoutController - -- (instancetype)initWithCollectionView:(ASCollectionView *)collectionView -{ - if (!(self = [super init])) { - return nil; - } - - _collectionView = collectionView; - _collectionViewLayout = [collectionView collectionViewLayout]; - return self; -} - -- (NSHashTable *)elementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType map:(ASElementMap *)map -{ - ASRangeTuningParameters tuningParameters = [self tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - CGRect rangeBounds = [self rangeBoundsWithScrollDirection:scrollDirection rangeTuningParameters:tuningParameters]; - return [self elementsWithinRangeBounds:rangeBounds map:map]; -} - -- (void)allElementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSHashTable *__autoreleasing _Nullable *)displaySet preloadSet:(NSHashTable *__autoreleasing _Nullable *)preloadSet map:(ASElementMap *)map -{ - if (displaySet == NULL || preloadSet == NULL) { - return; - } - - ASRangeTuningParameters displayParams = [self tuningParametersForRangeMode:rangeMode rangeType:ASLayoutRangeTypeDisplay]; - ASRangeTuningParameters preloadParams = [self tuningParametersForRangeMode:rangeMode rangeType:ASLayoutRangeTypePreload]; - CGRect displayBounds = [self rangeBoundsWithScrollDirection:scrollDirection rangeTuningParameters:displayParams]; - CGRect preloadBounds = [self rangeBoundsWithScrollDirection:scrollDirection rangeTuningParameters:preloadParams]; - - CGRect unionBounds = CGRectUnion(displayBounds, preloadBounds); - NSArray *layoutAttributes = [_collectionViewLayout layoutAttributesForElementsInRect:unionBounds]; - NSInteger count = layoutAttributes.count; - - __auto_type display = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:count]; - __auto_type preload = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:count]; - - for (UICollectionViewLayoutAttributes *la in layoutAttributes) { - // Manually filter out elements that don't intersect the range bounds. - // See comment in elementsForItemsWithinRangeBounds: - // This is re-implemented here so that the iteration over layoutAttributes can be done once to check both ranges. - CGRect frame = la.frame; - BOOL intersectsDisplay = CGRectIntersectsRect(displayBounds, frame); - BOOL intersectsPreload = CGRectIntersectsRect(preloadBounds, frame); - if (intersectsDisplay == NO && intersectsPreload == NO && CATransform3DIsIdentity(la.transform3D) == YES) { - // Questionable why the element would be included here, but it doesn't belong. - continue; - } - - // Avoid excessive retains and releases, as well as property calls. We know the element is kept alive by map. - unowned ASCollectionElement *e = [map elementForLayoutAttributes:la]; - if (e != nil && intersectsDisplay) { - [display addObject:e]; - } - if (e != nil && intersectsPreload) { - [preload addObject:e]; - } - } - - *displaySet = display; - *preloadSet = preload; - return; -} - -- (NSHashTable *)elementsWithinRangeBounds:(CGRect)rangeBounds map:(ASElementMap *)map -{ - NSArray *layoutAttributes = [_collectionViewLayout layoutAttributesForElementsInRect:rangeBounds]; - NSHashTable *elementSet = [[NSHashTable alloc] initWithOptions:NSHashTableObjectPointerPersonality capacity:layoutAttributes.count]; - - for (UICollectionViewLayoutAttributes *la in layoutAttributes) { - // Manually filter out elements that don't intersect the range bounds. - // If a layout returns elements outside the requested rect this can be a huge problem. - // For instance in a paging flow, you may only want to preload 3 pages (one center, one on each side) - // but if flow layout includes the 4th page (which it does! as of iOS 9&10), you will preload a 4th - // page as well. - if (CATransform3DIsIdentity(la.transform3D) && CGRectIntersectsRect(la.frame, rangeBounds) == NO) { - continue; - } - [elementSet addObject:[map elementForLayoutAttributes:la]]; - } - - return elementSet; -} - -- (CGRect)rangeBoundsWithScrollDirection:(ASScrollDirection)scrollDirection - rangeTuningParameters:(ASRangeTuningParameters)tuningParameters -{ - CGRect rect = _collectionView.bounds; - - return CGRectExpandToRangeWithScrollableDirections(rect, tuningParameters, [_collectionView scrollableDirections], scrollDirection); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.h b/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.h deleted file mode 100644 index 4e58890f..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.h +++ /dev/null @@ -1,83 +0,0 @@ -// -// ASCollectionViewLayoutInspector.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASCollectionView; -@protocol ASCollectionDataSource; -@protocol ASCollectionDelegate; - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); - -@protocol ASCollectionViewLayoutInspecting - -/** - * Asks the inspector to provide a constrained size range for the given collection view node. - */ -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Return the directions in which your collection view can scroll - */ -- (ASScrollDirection)scrollableDirections; - -@optional - -/** - * Asks the inspector to provide a constrained size range for the given supplementary node. - */ -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForSupplementaryNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - -/** - * Asks the inspector for the number of supplementary views for the given kind in the specified section. - */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section; - -/** - * Allow the inspector to respond to delegate changes. - * - * @discussion A great time to update perform selector caches! - */ -- (void)didChangeCollectionViewDelegate:(nullable id)delegate; - -/** - * Allow the inspector to respond to dataSource changes. - * - * @discussion A great time to update perform selector caches! - */ -- (void)didChangeCollectionViewDataSource:(nullable id)dataSource; - -#pragma mark Deprecated Methods - -/** - * Asks the inspector for the number of supplementary sections in the collection view for the given kind. - * - * @deprecated This method will not be called, and it is only deprecated as a reminder to remove it. - * Supplementary elements must exist in the same sections as regular collection view items i.e. -numberOfSectionsInCollectionView: - */ -- (NSUInteger)collectionView:(ASCollectionView *)collectionView numberOfSectionsForSupplementaryNodeOfKind:(NSString *)kind ASDISPLAYNODE_DEPRECATED_MSG("Use ASCollectionNode's method instead."); - -@end - -/** - * A layout inspector for non-flow layouts that returns a constrained size to let the cells layout itself as - * far as possible based on the scrollable direction of the collection view. - * It doesn't support supplementary nodes and therefore doesn't implement delegate methods - * that are related to supplementary node's management. - * - * @warning This class is not meant to be subclassed and will be restricted in the future. - */ -@interface ASCollectionViewLayoutInspector : NSObject -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.mm b/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.mm deleted file mode 100644 index 1747c464..00000000 --- a/Example/Pods/Texture/Source/Details/ASCollectionViewLayoutInspector.mm +++ /dev/null @@ -1,76 +0,0 @@ -// -// ASCollectionViewLayoutInspector.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#pragma mark - Helper Functions - -// Returns a constrained size to let the cells layout itself as far as possible based on the scrollable direction -// of the collection view -ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView) { - CGSize maxSize = collectionView.bounds.size; - UIEdgeInsets contentInset = collectionView.contentInset; - if (ASScrollDirectionContainsHorizontalDirection(collectionView.scrollableDirections)) { - maxSize.width = CGFLOAT_MAX; - maxSize.height -= (contentInset.top + contentInset.bottom); - } else { - maxSize.width -= (contentInset.left + contentInset.right); - maxSize.height = CGFLOAT_MAX; - } - return ASSizeRangeMake(CGSizeZero, maxSize); -} - -#pragma mark - ASCollectionViewLayoutInspector - -@implementation ASCollectionViewLayoutInspector { - struct { - unsigned int implementsConstrainedSizeForNodeAtIndexPathDeprecated:1; - unsigned int implementsConstrainedSizeForNodeAtIndexPath:1; - } _delegateFlags; -} - -#pragma mark ASCollectionViewLayoutInspecting - -- (void)didChangeCollectionViewDelegate:(id)delegate -{ - if (delegate == nil) { - memset(&_delegateFlags, 0, sizeof(_delegateFlags)); - } else { - _delegateFlags.implementsConstrainedSizeForNodeAtIndexPathDeprecated = [delegate respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)]; - _delegateFlags.implementsConstrainedSizeForNodeAtIndexPath = [delegate respondsToSelector:@selector(collectionNode:constrainedSizeForItemAtIndexPath:)]; - } -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - if (_delegateFlags.implementsConstrainedSizeForNodeAtIndexPath) { - return [collectionView.asyncDelegate collectionNode:collectionView.collectionNode constrainedSizeForItemAtIndexPath:indexPath]; - } else if (_delegateFlags.implementsConstrainedSizeForNodeAtIndexPathDeprecated) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - return [collectionView.asyncDelegate collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } else { - // With 2.0 `collectionView:constrainedSizeForNodeAtIndexPath:` was moved to the delegate. Assert if not implemented on the delegate but on the data source - ASDisplayNodeAssert([collectionView.asyncDataSource respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)] == NO, @"collectionView:constrainedSizeForNodeAtIndexPath: was moved from the ASCollectionDataSource to the ASCollectionDelegate."); - } - - return NodeConstrainedSizeForScrollDirection(collectionView); -} - -- (ASScrollDirection)scrollableDirections -{ - return ASScrollDirectionNone; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASDataController.h b/Example/Pods/Texture/Source/Details/ASDataController.h deleted file mode 100644 index 88150cba..00000000 --- a/Example/Pods/Texture/Source/Details/ASDataController.h +++ /dev/null @@ -1,275 +0,0 @@ -// -// ASDataController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import -#import -#import -#ifdef __cplusplus -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -@class ASCellNode; -@class ASCollectionElement; -@class ASCollectionLayoutContext; -@class ASCollectionLayoutState; -@class ASDataController; -@class ASElementMap; -@class ASLayout; -@class _ASHierarchyChangeSet; -@protocol ASRangeManagingNode; -@protocol ASTraitEnvironment; -@protocol ASSectionContext; - -typedef NSUInteger ASDataControllerAnimationOptions; - -ASDK_EXTERN NSString * const ASDataControllerRowNodeKind; -ASDK_EXTERN NSString * const ASCollectionInvalidUpdateException; - -/** - Data source for data controller - It will be invoked in the same thread as the api call of ASDataController. - */ - -@protocol ASDataControllerSource - -/** - Fetch the ASCellNode block for specific index path. This block should return the ASCellNode for the specified index path. - */ -- (ASCellNodeBlock)dataController:(ASDataController *)dataController nodeBlockAtIndexPath:(NSIndexPath *)indexPath shouldAsyncLayout:(BOOL *)shouldAsyncLayout; - -/** - Fetch the number of rows in specific section. - */ -- (NSUInteger)dataController:(ASDataController *)dataController rowsInSection:(NSUInteger)section; - -/** - Fetch the number of sections. - */ -- (NSUInteger)numberOfSectionsInDataController:(ASDataController *)dataController; - -/** - Returns if the collection element size matches a given size. - @precondition The element is present in the data controller's visible map. - */ -- (BOOL)dataController:(ASDataController *)dataController presentedSizeForElement:(ASCollectionElement *)element matchesSize:(CGSize)size; - -- (nullable id)dataController:(ASDataController *)dataController nodeModelForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Called just after dispatching ASCellNode allocation and layout to the concurrent background queue. - * In some cases, for example on the first content load for a screen, it may be desirable to call - * -waitUntilAllUpdatesAreProcessed at this point. - * - * Returning YES will cause the ASDataController to wait on the background queue, and this ensures - * that any new / changed cells are in the hierarchy by the very next CATransaction / frame draw. - */ -- (BOOL)dataController:(ASDataController *)dataController shouldSynchronouslyProcessChangeSet:(_ASHierarchyChangeSet *)changeSet; -- (BOOL)dataController:(ASDataController *)dataController shouldEagerlyLayoutNode:(ASCellNode *)node; -- (BOOL)dataControllerShouldSerializeNodeCreation:(ASDataController *)dataController; - -@optional - -/** - The constrained size range for layout. Called only if collection layout delegate is not provided. - */ -- (ASSizeRange)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath; - -- (NSArray *)dataController:(ASDataController *)dataController supplementaryNodeKindsInSections:(NSIndexSet *)sections; - -- (NSUInteger)dataController:(ASDataController *)dataController supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section; - -- (ASCellNodeBlock)dataController:(ASDataController *)dataController supplementaryNodeBlockOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath shouldAsyncLayout:(BOOL *)shouldAsyncLayout; - -/** - The constrained size range for layout. Called only if no data controller layout delegate is provided. - */ -- (ASSizeRange)dataController:(ASDataController *)dataController constrainedSizeForSupplementaryNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - -- (nullable id)dataController:(ASDataController *)dataController contextForSection:(NSInteger)section; - -@end - -/** - Delegate for notify the data updating of data controller. - These methods will be invoked from main thread right now, but it may be moved to background thread in the future. - */ -@protocol ASDataControllerDelegate - -/** - * Called for change set updates. - * - * @param changeSet The change set that includes all updates - * - * @param updates The block that performs relevant data updates. - * - * @discussion The updates block must always be executed or the data controller will get into a bad state. - * It should be called at the time the backing view is ready to process the updates, - * i.e inside the updates block of `-[UICollectionView performBatchUpdates:completion:] or after calling `-[UITableView beginUpdates]`. - */ -- (void)dataController:(ASDataController *)dataController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates; - -@end - -@protocol ASDataControllerLayoutDelegate - -/** - * @abstract Returns a layout context needed for a coming layout pass with the given elements. - * The context should contain the elements and any additional information needed. - * - * @discussion This method will be called on main thread. - */ -- (ASCollectionLayoutContext *)layoutContextWithElements:(ASElementMap *)elements; - -/** - * @abstract Prepares and returns a new layout for given context. - * - * @param context A context that was previously returned by `-layoutContextWithElements:`. - * - * @return The new layout calculated for the given context. - * - * @discussion This method is called ahead of time, i.e before the underlying collection/table view is aware of the provided elements. - * As a result, clients must solely rely on the given context and should not reach out to other objects for information not available in the context. - * - * This method will be called on background theads. It must be thread-safe and should not change any internal state of the conforming object. - * It must block the calling thread but can dispatch to other theads to reduce total blocking time. - */ -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context; - -@end - -/** - * Controller to layout data in background, and managed data updating. - * - * All operations are asynchronous and thread safe. You can call it from background thread (it is recommendated) and the data - * will be updated asynchronously. The dataSource must be updated to reflect the changes before these methods has been called. - * For each data updating, the corresponding methods in delegate will be called. - */ -@interface ASDataController : NSObject - -- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; - -/** - * The node that owns this data controller, if any. - * - * NOTE: Soon we will drop support for using ASTableView/ASCollectionView without the node, so this will be non-null. - */ -@property (nullable, nonatomic, weak, readonly) id node; - -/** - * The map that is currently displayed. The "UIKit index space." - * - * This property will only be changed on the main thread. - */ -@property (copy, readonly) ASElementMap *visibleMap; - -/** - * The latest map fetched from the data source. May be more recent than @c visibleMap. - * - * This property will only be changed on the main thread. - */ -@property (copy, readonly) ASElementMap *pendingMap; - -/** - Data source for fetching data info. - */ -@property (nonatomic, weak, readonly) id dataSource; - -/** - An object that will be included in the backtrace of any update validation exceptions that occur. - */ -@property (nonatomic, weak) id validationErrorSource; - -/** - Delegate to notify when data is updated. - */ -@property (nonatomic, weak) id delegate; - -/** - * Delegate for preparing layouts. Main thead only. - */ -@property (nonatomic, weak) id layoutDelegate; - -#ifdef __cplusplus -/** - * Returns the most recently gathered item counts from the data source. If the counts - * have been invalidated, this synchronously queries the data source and saves the result. - * - * This must be called on the main thread. - */ -- (std::vector)itemCountsFromDataSource; -#endif - -/** - * Returns YES if reloadData has been called at least once. Before this point it is - * important to ignore/suppress some operations. For example, inserting a section - * before the initial data load should have no effect. - * - * This must be called on the main thread. - */ -@property (nonatomic, readonly) BOOL initialReloadDataHasBeenCalled; - -/** @name Data Updating */ - -- (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet; - -/** - * Re-measures all loaded nodes in the backing store. - * - * @discussion Used to respond to a change in size of the containing view - * (e.g. ASTableView or ASCollectionView after an orientation change). - * - * The invalidationBlock is called after flushing the ASMainSerialQueue, which ensures that any in-progress - * layout calculations have been applied. The block will not be called if data hasn't been loaded. - */ -- (void)relayoutAllNodesWithInvalidationBlock:(nullable void (^)(void))invalidationBlock; - -/** - * Re-measures given nodes in the backing store. - * - * @discussion Used to respond to setNeedsLayout calls in ASCellNode - */ -- (void)relayoutNodes:(id)nodes nodesSizeChanged:(NSMutableArray *)nodesSizesChanged; - -/** - * See ASCollectionNode.h for full documentation of these methods. - */ -@property (nonatomic, readonly) BOOL isProcessingUpdates; -- (void)onDidFinishProcessingUpdates:(void (^)(void))completion; -- (void)waitUntilAllUpdatesAreProcessed; - -/** - * See ASCollectionNode.h for full documentation of these methods. - */ -@property (nonatomic, readonly, getter=isSynchronized) BOOL synchronized; -- (void)onDidFinishSynchronizing:(void (^)(void))completion; - -/** - * Notifies the data controller object that its environment has changed. The object will request its environment delegate for new information - * and propagate the information to all visible elements, including ones that are being prepared in background. - * - * @discussion If called before the initial @c reloadData, this method will do nothing and the trait collection of the initial load will be requested from the environment delegate. - * - * @discussion This method can be called on any threads. - */ -- (void)environmentDidChange; - -/** - * Reset visibleMap and pendingMap when asyncDataSource and asyncDelegate of collection view become nil. - */ -- (void)clearData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASDataController.mm b/Example/Pods/Texture/Source/Details/ASDataController.mm deleted file mode 100644 index 10442da6..00000000 --- a/Example/Pods/Texture/Source/Details/ASDataController.mm +++ /dev/null @@ -1,973 +0,0 @@ -// -// ASDataController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import -#import -#import -#import - -//#define LOG(...) NSLog(__VA_ARGS__) -#define LOG(...) - -const static char * kASDataControllerEditingQueueKey = "kASDataControllerEditingQueueKey"; -const static char * kASDataControllerEditingQueueContext = "kASDataControllerEditingQueueContext"; - -NSString * const ASDataControllerRowNodeKind = @"_ASDataControllerRowNodeKind"; -NSString * const ASCollectionInvalidUpdateException = @"ASCollectionInvalidUpdateException"; - -typedef dispatch_block_t ASDataControllerCompletionBlock; - -typedef void (^ASDataControllerSynchronizationBlock)(); - -@interface ASDataController () { - id _layoutDelegate; - - NSInteger _nextSectionID; - - BOOL _itemCountsFromDataSourceAreValid; // Main thread only. - std::vector _itemCountsFromDataSource; // Main thread only. - - ASMainSerialQueue *_mainSerialQueue; - - dispatch_queue_t _editingTransactionQueue; // Serial background queue. Dispatches concurrent layout and manages _editingNodes. - dispatch_group_t _editingTransactionGroup; // Group of all edit transaction blocks. Useful for waiting. - std::atomic _editingTransactionGroupCount; - - BOOL _initialReloadDataHasBeenCalled; - - BOOL _synchronized; - NSMutableSet *_onDidFinishSynchronizingBlocks; - - struct { - unsigned int supplementaryNodeKindsInSections:1; - unsigned int supplementaryNodesOfKindInSection:1; - unsigned int supplementaryNodeBlockOfKindAtIndexPath:1; - unsigned int constrainedSizeForNodeAtIndexPath:1; - unsigned int constrainedSizeForSupplementaryNodeOfKindAtIndexPath:1; - unsigned int contextForSection:1; - } _dataSourceFlags; -} - -@property (copy) ASElementMap *pendingMap; -@property (copy) ASElementMap *visibleMap; -@end - -@implementation ASDataController - -#pragma mark - Lifecycle - -- (instancetype)initWithDataSource:(id)dataSource node:(nullable id)node -{ - if (!(self = [super init])) { - return nil; - } - - _node = node; - _dataSource = dataSource; - - _dataSourceFlags.supplementaryNodeKindsInSections = [_dataSource respondsToSelector:@selector(dataController:supplementaryNodeKindsInSections:)]; - _dataSourceFlags.supplementaryNodesOfKindInSection = [_dataSource respondsToSelector:@selector(dataController:supplementaryNodesOfKind:inSection:)]; - _dataSourceFlags.supplementaryNodeBlockOfKindAtIndexPath = [_dataSource respondsToSelector:@selector(dataController:supplementaryNodeBlockOfKind:atIndexPath:shouldAsyncLayout:)]; - _dataSourceFlags.constrainedSizeForNodeAtIndexPath = [_dataSource respondsToSelector:@selector(dataController:constrainedSizeForNodeAtIndexPath:)]; - _dataSourceFlags.constrainedSizeForSupplementaryNodeOfKindAtIndexPath = [_dataSource respondsToSelector:@selector(dataController:constrainedSizeForSupplementaryNodeOfKind:atIndexPath:)]; - _dataSourceFlags.contextForSection = [_dataSource respondsToSelector:@selector(dataController:contextForSection:)]; - - self.visibleMap = self.pendingMap = [[ASElementMap alloc] init]; - - _nextSectionID = 0; - - _mainSerialQueue = [[ASMainSerialQueue alloc] init]; - - _synchronized = YES; - _onDidFinishSynchronizingBlocks = [[NSMutableSet alloc] init]; - - const char *queueName = [[NSString stringWithFormat:@"org.AsyncDisplayKit.ASDataController.editingTransactionQueue:%p", self] cStringUsingEncoding:NSASCIIStringEncoding]; - _editingTransactionQueue = dispatch_queue_create(queueName, DISPATCH_QUEUE_SERIAL); - dispatch_queue_set_specific(_editingTransactionQueue, &kASDataControllerEditingQueueKey, &kASDataControllerEditingQueueContext, NULL); - _editingTransactionGroup = dispatch_group_create(); - - return self; -} - -- (id)layoutDelegate -{ - ASDisplayNodeAssertMainThread(); - return _layoutDelegate; -} - -- (void)setLayoutDelegate:(id)layoutDelegate -{ - ASDisplayNodeAssertMainThread(); - if (layoutDelegate != _layoutDelegate) { - _layoutDelegate = layoutDelegate; - } -} - -#pragma mark - Cell Layout - -/** - * Allocates and layouts nodes from the given collection elements, and blocks the current thread while doing so. - * - * @param elements The elements from which nodes can be allocated and laid out. - * @param strictlyOnCurrentThread Whether or not all the work must be done strictly on the current thread. - * YES means all nodes will be allocated and laid out serially on the current thread. - * NO means the work can be offloaded to other thread(s), potentially reduce the blocking time on the calling thread. - */ -- (void)_allocateNodesFromElements:(NSArray *)elements - strictlyOnCurrentThread:(BOOL)strictlyOnCurrentThread -{ - NSUInteger nodeCount = elements.count; - __weak id weakDataSource = _dataSource; - if (nodeCount == 0 || weakDataSource == nil) { - return; - } - - ASSignpostStart(DataControllerBatch, self, "%@", ASObjectDescriptionMakeTiny(weakDataSource)); - - { - as_activity_create_for_scope("Data controller batch"); - - void(^work)(size_t) = ^(size_t i) { - __strong id strongDataSource = weakDataSource; - if (strongDataSource == nil) { - return; - } - - unowned ASCollectionElement *element = elements[i]; - - NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary]; - dict[ASThreadDictMaxConstraintSizeKey] = - [NSValue valueWithCGSize:element.constrainedSize.max]; - unowned ASCellNode *node = element.node; - [dict removeObjectForKey:ASThreadDictMaxConstraintSizeKey]; - - // Layout the node if the size range is valid. - ASSizeRange sizeRange = element.constrainedSize; - if (ASSizeRangeHasSignificantArea(sizeRange)) { - [self _layoutNode:node withConstrainedSize:sizeRange]; - } - }; - - if (strictlyOnCurrentThread) { - for (NSUInteger i = 0; i < nodeCount; i++) { - work(i); - } - } else { - dispatch_queue_t queue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0); - NSUInteger threadCount = 0; - if ([_dataSource dataControllerShouldSerializeNodeCreation:self]) { - threadCount = 1; - } - ASDispatchApply(nodeCount, queue, threadCount, work); - } - } - - ASSignpostEnd(DataControllerBatch, self, "count: %lu", (unsigned long)nodeCount); -} - -/** - * Measure and layout the given node with the constrained size range. - */ -- (void)_layoutNode:(ASCellNode *)node withConstrainedSize:(ASSizeRange)constrainedSize -{ - if (![_dataSource dataController:self shouldEagerlyLayoutNode:node]) { - return; - } - - ASDisplayNodeAssert(ASSizeRangeHasSignificantArea(constrainedSize), @"Attempt to layout cell node with invalid size range %@", NSStringFromASSizeRange(constrainedSize)); - - CGRect frame = CGRectZero; - frame.size = [node layoutThatFits:constrainedSize].size; - node.frame = frame; -} - -#pragma mark - Data Source Access (Calling _dataSource) - -- (NSArray *)_allIndexPathsForItemsOfKind:(NSString *)kind inSections:(NSIndexSet *)sections -{ - ASDisplayNodeAssertMainThread(); - - if (sections.count == 0 || _dataSource == nil) { - return @[]; - } - - const auto indexPaths = [[NSMutableArray alloc] init]; - if ([kind isEqualToString:ASDataControllerRowNodeKind]) { - std::vector counts = [self itemCountsFromDataSource]; - [sections enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - for (NSUInteger sectionIndex = range.location; sectionIndex < NSMaxRange(range); sectionIndex++) { - NSUInteger itemCount = counts[sectionIndex]; - for (NSUInteger i = 0; i < itemCount; i++) { - [indexPaths addObject:[NSIndexPath indexPathForItem:i inSection:sectionIndex]]; - } - } - }]; - } else if (_dataSourceFlags.supplementaryNodesOfKindInSection) { - id dataSource = _dataSource; - [sections enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - for (NSUInteger sectionIndex = range.location; sectionIndex < NSMaxRange(range); sectionIndex++) { - NSUInteger itemCount = [dataSource dataController:self supplementaryNodesOfKind:kind inSection:sectionIndex]; - for (NSUInteger i = 0; i < itemCount; i++) { - [indexPaths addObject:[NSIndexPath indexPathForItem:i inSection:sectionIndex]]; - } - } - }]; - } - - return indexPaths; -} - -/** - * Agressively repopulates supplementary nodes of all kinds for sections that contains some given index paths. - * - * @param map The element map into which to apply the change. - * @param indexPaths The index paths belongs to sections whose supplementary nodes need to be repopulated. - * @param changeSet The changeset that triggered this repopulation. - * @param traitCollection The trait collection needed to initialize elements - * @param indexPathsAreNew YES if index paths are "after the update," NO otherwise. - * @param shouldFetchSizeRanges Whether constrained sizes should be fetched from data source - */ -- (void)_repopulateSupplementaryNodesIntoMap:(ASMutableElementMap *)map - forSectionsContainingIndexPaths:(NSArray *)indexPaths - changeSet:(_ASHierarchyChangeSet *)changeSet - traitCollection:(ASPrimitiveTraitCollection)traitCollection - indexPathsAreNew:(BOOL)indexPathsAreNew - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - - if (indexPaths.count == 0) { - return; - } - - // Remove all old supplementaries from these sections - NSIndexSet *oldSections = [NSIndexSet as_sectionsFromIndexPaths:indexPaths]; - - // Add in new ones with the new kinds. - NSIndexSet *newSections; - if (indexPathsAreNew) { - newSections = oldSections; - } else { - newSections = [oldSections as_indexesByMapping:^NSUInteger(NSUInteger oldSection) { - return [changeSet newSectionForOldSection:oldSection]; - }]; - } - - for (NSString *kind in [self supplementaryKindsInSections:newSections]) { - [self _insertElementsIntoMap:map kind:kind forSections:newSections traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - } -} - -/** - * Update supplementary nodes of all kinds for sections. - * - * @param map The element map into which to apply the change. - * @param traitCollection The trait collection needed to initialize elements - * @param shouldFetchSizeRanges Whether constrained sizes should be fetched from data source - */ -- (void)_updateSupplementaryNodesIntoMap:(ASMutableElementMap *)map - traitCollection:(ASPrimitiveTraitCollection)traitCollection - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - if (self.layoutDelegate != nil) { - // TODO: https://github.com/TextureGroup/Texture/issues/948 - return; - } - NSUInteger sectionCount = [self itemCountsFromDataSource].size(); - if (sectionCount > 0) { - NSIndexSet *sectionIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, sectionCount)]; - ASSizeRange newSizeRange = ASSizeRangeZero; - for (NSString *kind in [self supplementaryKindsInSections:sectionIndexes]) { - NSArray *indexPaths = [self _allIndexPathsForItemsOfKind:kind inSections:sectionIndexes]; - NSMutableArray *indexPathsToDeleteForKind = [[NSMutableArray alloc] init]; - NSMutableArray *indexPathsToInsertForKind = [[NSMutableArray alloc] init]; - // If supplementary node does exist and size is now zero, remove it. - // If supplementary node doesn't exist and size is now non-zero, insert one. - for (NSIndexPath *indexPath in indexPaths) { - ASCollectionElement *previousElement = [previousMap supplementaryElementOfKind:kind atIndexPath:indexPath]; - newSizeRange = [self constrainedSizeForNodeOfKind:kind atIndexPath:indexPath]; - BOOL sizeRangeIsZero = ASSizeRangeEqualToSizeRange(ASSizeRangeZero, newSizeRange); - if (previousElement != nil && sizeRangeIsZero) { - [indexPathsToDeleteForKind addObject:indexPath]; - } else if (previousElement == nil && !sizeRangeIsZero) { - [indexPathsToInsertForKind addObject:indexPath]; - } - } - - [map removeSupplementaryElementsAtIndexPaths:indexPathsToDeleteForKind kind:kind]; - [self _insertElementsIntoMap:map kind:kind atIndexPaths:indexPathsToInsertForKind traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:nil previousMap:previousMap]; - } - } -} - -/** - * Inserts new elements of a certain kind for some sections - * - * @param kind The kind of the elements, e.g ASDataControllerRowNodeKind - * @param sections The sections that should be populated by new elements - * @param traitCollection The trait collection needed to initialize elements - * @param shouldFetchSizeRanges Whether constrained sizes should be fetched from data source - */ -- (void)_insertElementsIntoMap:(ASMutableElementMap *)map - kind:(NSString *)kind - forSections:(NSIndexSet *)sections - traitCollection:(ASPrimitiveTraitCollection)traitCollection - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - changeSet:(_ASHierarchyChangeSet *)changeSet - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - - if (sections.count == 0 || _dataSource == nil) { - return; - } - - NSArray *indexPaths = [self _allIndexPathsForItemsOfKind:kind inSections:sections]; - [self _insertElementsIntoMap:map kind:kind atIndexPaths:indexPaths traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; -} - -/** - * Inserts new elements of a certain kind at some index paths - * - * @param map The map to insert the elements into. - * @param kind The kind of the elements, e.g ASDataControllerRowNodeKind - * @param indexPaths The index paths at which new elements should be populated - * @param traitCollection The trait collection needed to initialize elements - * @param shouldFetchSizeRanges Whether constrained sizes should be fetched from data source - */ -- (void)_insertElementsIntoMap:(ASMutableElementMap *)map - kind:(NSString *)kind - atIndexPaths:(NSArray *)indexPaths - traitCollection:(ASPrimitiveTraitCollection)traitCollection - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - changeSet:(_ASHierarchyChangeSet *)changeSet - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - - if (indexPaths.count == 0 || _dataSource == nil) { - return; - } - - BOOL isRowKind = [kind isEqualToString:ASDataControllerRowNodeKind]; - if (!isRowKind && !_dataSourceFlags.supplementaryNodeBlockOfKindAtIndexPath) { - // Populating supplementary elements but data source doesn't support. - return; - } - - LOG(@"Populating elements of kind: %@, for index paths: %@", kind, indexPaths); - id dataSource = self.dataSource; - id node = self.node; - BOOL shouldAsyncLayout = YES; - for (NSIndexPath *indexPath in indexPaths) { - ASCellNodeBlock nodeBlock; - id nodeModel; - if (isRowKind) { - nodeModel = [dataSource dataController:self nodeModelForItemAtIndexPath:indexPath]; - - // Get the prior element and attempt to update the existing cell node. - if (nodeModel != nil && !changeSet.includesReloadData) { - NSIndexPath *oldIndexPath = [changeSet oldIndexPathForNewIndexPath:indexPath]; - if (oldIndexPath != nil) { - ASCollectionElement *oldElement = [previousMap elementForItemAtIndexPath:oldIndexPath]; - ASCellNode *oldNode = oldElement.node; - if ([oldNode canUpdateToNodeModel:nodeModel]) { - // Just wrap the node in a block. The collection element will -setNodeModel: - nodeBlock = ^{ - return oldNode; - }; - } - } - } - if (nodeBlock == nil) { - nodeBlock = [dataSource dataController:self nodeBlockAtIndexPath:indexPath shouldAsyncLayout:&shouldAsyncLayout]; - } - } else { - nodeBlock = [dataSource dataController:self supplementaryNodeBlockOfKind:kind atIndexPath:indexPath shouldAsyncLayout:&shouldAsyncLayout]; - } - - ASSizeRange constrainedSize = ASSizeRangeUnconstrained; - if (shouldFetchSizeRanges) { - constrainedSize = [self constrainedSizeForNodeOfKind:kind atIndexPath:indexPath]; - } - - ASCollectionElement *element = [[ASCollectionElement alloc] initWithNodeModel:nodeModel - nodeBlock:nodeBlock - supplementaryElementKind:isRowKind ? nil : kind - constrainedSize:constrainedSize - owningNode:node - traitCollection:traitCollection]; - [map insertElement:element atIndexPath:indexPath]; - changeSet.countForAsyncLayout += (shouldAsyncLayout ? 1 : 0); - } -} - -- (void)invalidateDataSourceItemCounts -{ - ASDisplayNodeAssertMainThread(); - _itemCountsFromDataSourceAreValid = NO; -} - -- (std::vector)itemCountsFromDataSource -{ - ASDisplayNodeAssertMainThread(); - if (NO == _itemCountsFromDataSourceAreValid) { - id source = self.dataSource; - NSInteger sectionCount = [source numberOfSectionsInDataController:self]; - std::vector newCounts; - newCounts.reserve(sectionCount); - for (NSInteger i = 0; i < sectionCount; i++) { - newCounts.push_back([source dataController:self rowsInSection:i]); - } - _itemCountsFromDataSource = newCounts; - _itemCountsFromDataSourceAreValid = YES; - } - return _itemCountsFromDataSource; -} - -- (NSArray *)supplementaryKindsInSections:(NSIndexSet *)sections -{ - if (_dataSourceFlags.supplementaryNodeKindsInSections) { - return [_dataSource dataController:self supplementaryNodeKindsInSections:sections]; - } - - return @[]; -} - -/** - * Returns constrained size for the node of the given kind and at the given index path. - * NOTE: index path must be in the data-source index space. - */ -- (ASSizeRange)constrainedSizeForNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - - id dataSource = _dataSource; - if (dataSource == nil || indexPath == nil) { - return ASSizeRangeZero; - } - - if ([kind isEqualToString:ASDataControllerRowNodeKind]) { - ASDisplayNodeAssert(_dataSourceFlags.constrainedSizeForNodeAtIndexPath, @"-dataController:constrainedSizeForNodeAtIndexPath: must also be implemented"); - return [dataSource dataController:self constrainedSizeForNodeAtIndexPath:indexPath]; - } - - if (_dataSourceFlags.constrainedSizeForSupplementaryNodeOfKindAtIndexPath){ - return [dataSource dataController:self constrainedSizeForSupplementaryNodeOfKind:kind atIndexPath:indexPath]; - } - - ASDisplayNodeAssert(NO, @"Unknown constrained size for node of kind %@ by data source %@", kind, dataSource); - return ASSizeRangeZero; -} - -#pragma mark - Batching (External API) - -- (void)waitUntilAllUpdatesAreProcessed -{ - // Schedule block in main serial queue to wait until all operations are finished that are - // where scheduled while waiting for the _editingTransactionQueue to finish - [self _scheduleBlockOnMainSerialQueue:^{ }]; -} - -- (BOOL)isProcessingUpdates -{ - ASDisplayNodeAssertMainThread(); - return _mainSerialQueue.numberOfScheduledBlocks > 0 || _editingTransactionGroupCount > 0; -} - -- (void)onDidFinishProcessingUpdates:(void (^)())completion -{ - ASDisplayNodeAssertMainThread(); - if (!completion) { - return; - } - if ([self isProcessingUpdates] == NO) { - ASPerformBlockOnMainThread(completion); - } else { - dispatch_async(_editingTransactionQueue, ^{ - // Retry the block. If we're done processing updates, it'll run immediately, otherwise - // wait again for updates to quiesce completely. - // Don't use _mainSerialQueue so that we don't affect -isProcessingUpdates. - dispatch_async(dispatch_get_main_queue(), ^{ - [self onDidFinishProcessingUpdates:completion]; - }); - }); - } -} - -- (BOOL)isSynchronized { - return _synchronized; -} - -- (void)onDidFinishSynchronizing:(void (^)())completion { - ASDisplayNodeAssertMainThread(); - if (!completion) { - return; - } - if ([self isSynchronized]) { - ASPerformBlockOnMainThread(completion); - } else { - // Hang on to the completion block so that it gets called the next time view is synchronized to data. - [_onDidFinishSynchronizingBlocks addObject:[completion copy]]; - } -} - -- (void)updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet -{ - ASDisplayNodeAssertMainThread(); - - _synchronized = NO; - - [changeSet addCompletionHandler:^(BOOL finished) { - self->_synchronized = YES; - [self onDidFinishProcessingUpdates:^{ - if (self->_synchronized) { - for (ASDataControllerSynchronizationBlock block in self->_onDidFinishSynchronizingBlocks) { - block(); - } - [self->_onDidFinishSynchronizingBlocks removeAllObjects]; - } - }]; - }]; - - if (changeSet.includesReloadData) { - if (_initialReloadDataHasBeenCalled) { - os_log_debug(ASCollectionLog(), "reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); - } else { - os_log_debug(ASCollectionLog(), "Initial reloadData %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView))); - _initialReloadDataHasBeenCalled = YES; - } - } else { - os_log_debug(ASCollectionLog(), "performBatchUpdates %@ %@", ASViewToDisplayNode(ASDynamicCast(self.dataSource, UIView)), changeSet); - } - - if (!ASActivateExperimentalFeature(ASExperimentalOptimizeDataControllerPipeline)) { - NSTimeInterval transactionQueueFlushDuration = 0.0f; - { - AS::ScopeTimer t(transactionQueueFlushDuration); - dispatch_group_wait(_editingTransactionGroup, DISPATCH_TIME_FOREVER); - } - } - - // If the initial reloadData has not been called, just bail because we don't have our old data source counts. - // See ASUICollectionViewTests.testThatIssuingAnUpdateBeforeInitialReloadIsUnacceptable - // for the issue that UICollectionView has that we're choosing to workaround. - if (!_initialReloadDataHasBeenCalled) { - os_log_debug(ASCollectionLog(), "%@ Skipped update because load hasn't happened.", ASObjectDescriptionMakeTiny(_dataSource)); - [changeSet executeCompletionHandlerWithFinished:YES]; - return; - } - - [self invalidateDataSourceItemCounts]; - - // Attempt to mark the update completed. This is when update validation will occur inside the changeset. - // If an invalid update exception is thrown, we catch it and inject our "validationErrorSource" object, - // which is the table/collection node's data source, into the exception reason to help debugging. - @try { - [changeSet markCompletedWithNewItemCounts:[self itemCountsFromDataSource]]; - } @catch (NSException *e) { - id responsibleDataSource = self.validationErrorSource; - if (e.name == ASCollectionInvalidUpdateException && responsibleDataSource != nil) { - [NSException raise:ASCollectionInvalidUpdateException format:@"%@: %@", [responsibleDataSource class], e.reason]; - } else { - @throw e; - } - } - - BOOL canDelegate = (self.layoutDelegate != nil); - ASElementMap *newMap; - ASCollectionLayoutContext *layoutContext; - { - as_activity_scope(as_activity_create("Latch new data for collection update", changeSet.rootActivity, OS_ACTIVITY_FLAG_DEFAULT)); - - // Step 1: Populate a new map that reflects the data source's state and use it as pendingMap - ASElementMap *previousMap = self.pendingMap; - if (changeSet.isEmpty) { - // If the change set is empty, nothing has changed so we can just reuse the previous map - newMap = previousMap; - } else { - // Mutable copy of current data. - ASMutableElementMap *mutableMap = [previousMap mutableCopy]; - - // Step 1.1: Update the mutable copies to match the data source's state - [self _updateSectionsInMap:mutableMap changeSet:changeSet]; - ASPrimitiveTraitCollection existingTraitCollection = [self.node primitiveTraitCollection]; - [self _updateElementsInMap:mutableMap changeSet:changeSet traitCollection:existingTraitCollection shouldFetchSizeRanges:(! canDelegate) previousMap:previousMap]; - - // Step 1.2: Clone the new data - newMap = [mutableMap copy]; - } - self.pendingMap = newMap; - - // Step 2: Ask layout delegate for contexts - if (canDelegate) { - layoutContext = [self.layoutDelegate layoutContextWithElements:newMap]; - } - } - - os_log_debug(ASCollectionLog(), "New content: %@", newMap.smallDescription); - - Class layoutDelegateClass = [self.layoutDelegate class]; - - // Step 3: Call the layout delegate if possible. Otherwise, allocate and layout all elements - void (^step3)(BOOL) = ^(BOOL strictlyOnCurrentThread){ - if (canDelegate) { - // Don't pass strictlyOnCurrentThread to the layout delegate. Instead give it - // total control over its threading behavior, as long as it blocks the - // calling thread while preparing the layout (which is part of the API contract). - [layoutDelegateClass calculateLayoutWithContext:layoutContext]; - } else { - const auto elementsToProcess = [[NSMutableArray alloc] init]; - for (ASCollectionElement *element in newMap) { - ASCellNode *nodeIfAllocated = element.nodeIfAllocated; - if (nodeIfAllocated.shouldUseUIKitCell) { - // If the node exists and we know it is a passthrough cell, we know it will never have a .calculatedLayout. - continue; - } else if (nodeIfAllocated.calculatedLayout == nil) { - // If the node hasn't been allocated, or it doesn't have a valid layout, let's process it. - [elementsToProcess addObject:element]; - } - } - [self _allocateNodesFromElements:elementsToProcess - strictlyOnCurrentThread:strictlyOnCurrentThread]; - } - }; - - // Step 3 can be done on the main thread or on _editingTransactionQueue - // depending on an experiment. - BOOL mainThreadOnly = ASActivateExperimentalFeature(ASExperimentalMainThreadOnlyDataController); - if (mainThreadOnly) { - // In main-thread-only mode allocate and layout all nodes serially on the main thread. - // - // After this step, we'll still dispatch to _editingTransactionQueue only to schedule a block - // to _mainSerialQueue to execute next steps. This is not optimized because - // in theory we can skip _editingTransactionQueue entirely, but it's much safer - // because change sets will still flow through the pipeline in pretty the same way - // (main thread -> _editingTransactionQueue -> _mainSerialQueue) and so - // any methods that block on _editingTransactionQueue will still work. - step3(YES); - } - - ++_editingTransactionGroupCount; - dispatch_group_async(_editingTransactionGroup, _editingTransactionQueue, ^{ - __block __unused os_activity_scope_state_s preparationScope = {}; // unused if deployment target < iOS10 - as_activity_scope_enter(as_activity_create("Prepare nodes for collection update", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT), &preparationScope); - - if (!mainThreadOnly) { - step3(NO); - } - - // Step 4: Inform the delegate on main thread - [self->_mainSerialQueue performBlockOnMainThread:^{ - as_activity_scope_leave(&preparationScope); - [self->_delegate dataController:self updateWithChangeSet:changeSet updates:^{ - // Step 5: Deploy the new data as "completed" - // - // Note that since the backing collection view might be busy responding to user events (e.g scrolling), - // it will not consume the batch update blocks immediately. - // As a result, in a short intermidate time, the view will still be relying on the old data source state. - // Thus, we can't just swap the new map immediately before step 4, but until this update block is executed. - // (https://github.com/TextureGroup/Texture/issues/378) - self.visibleMap = newMap; - }]; - }]; - --self->_editingTransactionGroupCount; - }); - - // We've now dispatched node allocation and layout to a concurrent background queue. - // In some cases, it's advantageous to prevent the main thread from returning, to ensure the next - // frame displayed to the user has the view updates in place. Doing this does slightly reduce - // total latency, by donating the main thread's priority to the background threads. As such, the - // two cases where it makes sense to block: - // 1. There is very little work to be performed in the background (UIKit passthrough) - // 2. There is a higher priority on display latency than smoothness, e.g. app startup. - if ([_dataSource dataController:self shouldSynchronouslyProcessChangeSet:changeSet]) { - [self waitUntilAllUpdatesAreProcessed]; - } -} - -/** - * Update sections based on the given change set. - */ -- (void)_updateSectionsInMap:(ASMutableElementMap *)map changeSet:(_ASHierarchyChangeSet *)changeSet -{ - ASDisplayNodeAssertMainThread(); - - if (changeSet.includesReloadData) { - [map removeAllSections]; - - NSUInteger sectionCount = [self itemCountsFromDataSource].size(); - NSIndexSet *sectionIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, sectionCount)]; - [self _insertSectionsIntoMap:map indexes:sectionIndexes]; - // Return immediately because reloadData can't be used in conjuntion with other updates. - return; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeDelete]) { - [map removeSectionsAtIndexes:change.indexSet]; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeInsert]) { - [self _insertSectionsIntoMap:map indexes:change.indexSet]; - } -} - -- (void)_insertSectionsIntoMap:(ASMutableElementMap *)map indexes:(NSIndexSet *)sectionIndexes -{ - ASDisplayNodeAssertMainThread(); - - [sectionIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - id context; - if (_dataSourceFlags.contextForSection) { - context = [_dataSource dataController:self contextForSection:idx]; - } - ASSection *section = [[ASSection alloc] initWithSectionID:_nextSectionID context:context]; - [map insertSection:section atIndex:idx]; - _nextSectionID++; - }]; -} - -/** - * Update elements based on the given change set. - */ -- (void)_updateElementsInMap:(ASMutableElementMap *)map - changeSet:(_ASHierarchyChangeSet *)changeSet - traitCollection:(ASPrimitiveTraitCollection)traitCollection - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - - if (changeSet.includesReloadData) { - [map removeAllElements]; - - NSUInteger sectionCount = [self itemCountsFromDataSource].size(); - if (sectionCount > 0) { - NSIndexSet *sectionIndexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, sectionCount)]; - [self _insertElementsIntoMap:map sections:sectionIndexes traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - } - // Return immediately because reloadData can't be used in conjuntion with other updates. - return; - } - - // Migrate old supplementary nodes to their new index paths. - [map migrateSupplementaryElementsWithSectionMapping:changeSet.sectionMapping]; - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeDelete]) { - [map removeItemsAtIndexPaths:change.indexPaths]; - // Aggressively repopulate supplementary nodes (#1773 & #1629) - [self _repopulateSupplementaryNodesIntoMap:map forSectionsContainingIndexPaths:change.indexPaths - changeSet:changeSet - traitCollection:traitCollection - indexPathsAreNew:NO - shouldFetchSizeRanges:shouldFetchSizeRanges - previousMap:previousMap]; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeDelete]) { - NSIndexSet *sectionIndexes = change.indexSet; - [map removeSectionsOfItems:sectionIndexes]; - } - - for (_ASHierarchySectionChange *change in [changeSet sectionChangesOfType:_ASHierarchyChangeTypeInsert]) { - [self _insertElementsIntoMap:map sections:change.indexSet traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - } - - for (_ASHierarchyItemChange *change in [changeSet itemChangesOfType:_ASHierarchyChangeTypeInsert]) { - [self _insertElementsIntoMap:map kind:ASDataControllerRowNodeKind atIndexPaths:change.indexPaths traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - // Aggressively reload supplementary nodes (#1773 & #1629) - [self _repopulateSupplementaryNodesIntoMap:map forSectionsContainingIndexPaths:change.indexPaths - changeSet:changeSet - traitCollection:traitCollection - indexPathsAreNew:YES - shouldFetchSizeRanges:shouldFetchSizeRanges - previousMap:previousMap]; - } -} - -- (void)_insertElementsIntoMap:(ASMutableElementMap *)map - sections:(NSIndexSet *)sectionIndexes - traitCollection:(ASPrimitiveTraitCollection)traitCollection - shouldFetchSizeRanges:(BOOL)shouldFetchSizeRanges - changeSet:(_ASHierarchyChangeSet *)changeSet - previousMap:(ASElementMap *)previousMap -{ - ASDisplayNodeAssertMainThread(); - - if (sectionIndexes.count == 0 || _dataSource == nil) { - return; - } - - // Items - [map insertEmptySectionsOfItemsAtIndexes:sectionIndexes]; - [self _insertElementsIntoMap:map kind:ASDataControllerRowNodeKind forSections:sectionIndexes traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - - // Supplementaries - for (NSString *kind in [self supplementaryKindsInSections:sectionIndexes]) { - // Step 2: Populate new elements for all sections - [self _insertElementsIntoMap:map kind:kind forSections:sectionIndexes traitCollection:traitCollection shouldFetchSizeRanges:shouldFetchSizeRanges changeSet:changeSet previousMap:previousMap]; - } -} - -#pragma mark - Relayout - -- (void)relayoutNodes:(id)nodes nodesSizeChanged:(NSMutableArray *)nodesSizesChanged -{ - NSParameterAssert(nodes); - NSParameterAssert(nodesSizesChanged); - - ASDisplayNodeAssertMainThread(); - if (!_initialReloadDataHasBeenCalled) { - return; - } - - id dataSource = self.dataSource; - const auto visibleMap = self.visibleMap; - const auto pendingMap = self.pendingMap; - for (ASCellNode *node in nodes) { - const auto element = node.collectionElement; - NSIndexPath *indexPathInPendingMap = [pendingMap indexPathForElement:element]; - // Ensure the element is present in both maps or skip it. If it's not in the visible map, - // then we can't check the presented size. If it's not in the pending map, we can't get the constrained size. - // This will only happen if the element has been deleted, so the specifics of this behavior aren't important. - if (indexPathInPendingMap == nil || [visibleMap indexPathForElement:element] == nil) { - continue; - } - - NSString *kind = element.supplementaryElementKind ?: ASDataControllerRowNodeKind; - ASSizeRange constrainedSize = [self constrainedSizeForNodeOfKind:kind atIndexPath:indexPathInPendingMap]; - [self _layoutNode:node withConstrainedSize:constrainedSize]; - - BOOL matchesSize = [dataSource dataController:self presentedSizeForElement:element matchesSize:node.frame.size]; - if (! matchesSize) { - [nodesSizesChanged addObject:node]; - } - } -} - -- (void)relayoutAllNodesWithInvalidationBlock:(nullable void (^)())invalidationBlock -{ - ASDisplayNodeAssertMainThread(); - if (!_initialReloadDataHasBeenCalled) { - return; - } - - // Can't relayout right away because _visibleMap may not be up-to-date, - // i.e there might be some nodes that were measured using the old constrained size but haven't been added to _visibleMap - LOG(@"Edit Command - relayoutRows"); - [self _scheduleBlockOnMainSerialQueue:^{ - // Because -invalidateLayout doesn't trigger any operations by itself, and we answer queries from UICollectionView using layoutThatFits:, - // we invalidate the layout before we have updated all of the cells. Any cells that the collection needs the size of immediately will get - // -layoutThatFits: with a new constraint, on the main thread, and synchronously calculate them. Meanwhile, relayoutAllNodes will update - // the layout of any remaining nodes on background threads (and fast-return for any nodes that the UICV got to first). - if (invalidationBlock) { - invalidationBlock(); - } - [self _relayoutAllNodes]; - }]; -} - -- (void)_relayoutAllNodes -{ - ASDisplayNodeAssertMainThread(); - // Aggressively repopulate all supplemtary elements - // Assuming this method is run on the main serial queue, _pending and _visible maps are synced and can be manipulated directly. - ASDisplayNodeAssert(_visibleMap == _pendingMap, @"Expected visible and pending maps to be synchronized: %@", self); - - ASMutableElementMap *newMap = [_pendingMap mutableCopy]; - [self _updateSupplementaryNodesIntoMap:newMap - traitCollection:[self.node primitiveTraitCollection] - shouldFetchSizeRanges:YES - previousMap:_pendingMap]; - _pendingMap = [newMap copy]; - _visibleMap = _pendingMap; - - for (ASCollectionElement *element in _visibleMap) { - // Ignore this element if it is no longer in the latest data. It is still recognized in the UIKit world but will be deleted soon. - NSIndexPath *indexPathInPendingMap = [_pendingMap indexPathForElement:element]; - if (indexPathInPendingMap == nil) { - continue; - } - - NSString *kind = element.supplementaryElementKind ?: ASDataControllerRowNodeKind; - ASSizeRange newConstrainedSize = [self constrainedSizeForNodeOfKind:kind atIndexPath:indexPathInPendingMap]; - - if (ASSizeRangeHasSignificantArea(newConstrainedSize)) { - element.constrainedSize = newConstrainedSize; - - // Node may not be allocated yet (e.g node virtualization or same size optimization) - // Call context.nodeIfAllocated here to avoid premature node allocation and layout - ASCellNode *node = element.nodeIfAllocated; - if (node) { - [self _layoutNode:node withConstrainedSize:newConstrainedSize]; - } - } - } -} - -# pragma mark - ASPrimitiveTraitCollection - -- (void)environmentDidChange -{ - ASPerformBlockOnMainThread(^{ - if (!self->_initialReloadDataHasBeenCalled) { - return; - } - - // Can't update the trait collection right away because _visibleMap may not be up-to-date, - // i.e there might be some elements that were allocated using the old trait collection but haven't been added to _visibleMap - [self _scheduleBlockOnMainSerialQueue:^{ - ASPrimitiveTraitCollection newTraitCollection = [self.node primitiveTraitCollection]; - for (ASCollectionElement *element in self->_visibleMap) { - element.traitCollection = newTraitCollection; - } - }]; - }); -} - -- (void)clearData -{ - ASDisplayNodeAssertMainThread(); - if (_initialReloadDataHasBeenCalled) { - [self waitUntilAllUpdatesAreProcessed]; - self.visibleMap = self.pendingMap = [[ASElementMap alloc] init]; - } -} - -# pragma mark - Helper methods - -- (void)_scheduleBlockOnMainSerialQueue:(dispatch_block_t)block -{ - ASDisplayNodeAssertMainThread(); - dispatch_group_wait(_editingTransactionGroup, DISPATCH_TIME_FOREVER); - [_mainSerialQueue performBlockOnMainThread:block]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASDelegateProxy.h b/Example/Pods/Texture/Source/Details/ASDelegateProxy.h deleted file mode 100644 index 7ed406b6..00000000 --- a/Example/Pods/Texture/Source/Details/ASDelegateProxy.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// ASDelegateProxy.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASDelegateProxy; -@protocol ASDelegateProxyInterceptor -@required -// Called if the target object is discovered to be nil if it had been non-nil at init time. -// This happens if the object is deallocated, because the proxy must maintain a weak reference to avoid cycles. -// Though the target object may become nil, the interceptor must not; it is assumed the interceptor owns the proxy. -- (void)proxyTargetHasDeallocated:(ASDelegateProxy *)proxy; -@end - -/** - * Stand-in for delegates like UITableView or UICollectionView's delegate / dataSource. - * Any selectors flagged by "interceptsSelector" are routed to the interceptor object and are not delivered to the target. - * Everything else leaves AsyncDisplayKit safely and arrives at the original target object. - */ - -@interface ASDelegateProxy : NSProxy - -- (instancetype)initWithTarget:(id)target interceptor:(id )interceptor; - -// This method must be overridden by a subclass. -- (BOOL)interceptsSelector:(SEL)selector; - -@end - -/** - * ASTableView intercepts and/or overrides a few of UITableView's critical data source and delegate methods. - * - * Any selector included in this function *MUST* be implemented by ASTableView. - */ - -@interface ASTableViewProxy : ASDelegateProxy -@end - -/** - * ASCollectionView intercepts and/or overrides a few of UICollectionView's critical data source and delegate methods. - * - * Any selector included in this function *MUST* be implemented by ASCollectionView. - */ - -@interface ASCollectionViewProxy : ASDelegateProxy -@end - -@interface ASPagerNodeProxy : ASDelegateProxy -@end - diff --git a/Example/Pods/Texture/Source/Details/ASDelegateProxy.mm b/Example/Pods/Texture/Source/Details/ASDelegateProxy.mm deleted file mode 100644 index 844fe633..00000000 --- a/Example/Pods/Texture/Source/Details/ASDelegateProxy.mm +++ /dev/null @@ -1,268 +0,0 @@ -// -// ASDelegateProxy.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -// UIKit performs a class check for UIDataSourceModelAssociation protocol conformance rather than an instance check, so -// the implementation of conformsToProtocol: below never gets called. We need to declare the two as conforming to the protocol here, then -// we need to implement dummy methods to get rid of a compiler warning about not conforming to the protocol. -@interface ASTableViewProxy () -@end - -@interface ASCollectionViewProxy () -@end - -@interface ASDelegateProxy (UIDataSourceModelAssociationPrivate) -- (nullable NSString *)_modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view; -- (nullable NSIndexPath *)_indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view; -@end - -@implementation ASTableViewProxy - -- (BOOL)interceptsSelector:(SEL)selector -{ - return ( - // handled by ASTableView node<->cell machinery - selector == @selector(tableView:cellForRowAtIndexPath:) || - selector == @selector(tableView:heightForRowAtIndexPath:) || - - // Selection, highlighting, menu - selector == @selector(tableView:willSelectRowAtIndexPath:) || - selector == @selector(tableView:didSelectRowAtIndexPath:) || - selector == @selector(tableView:willDeselectRowAtIndexPath:) || - selector == @selector(tableView:didDeselectRowAtIndexPath:) || - selector == @selector(tableView:shouldHighlightRowAtIndexPath:) || - selector == @selector(tableView:didHighlightRowAtIndexPath:) || - selector == @selector(tableView:didUnhighlightRowAtIndexPath:) || - selector == @selector(tableView:shouldShowMenuForRowAtIndexPath:) || - selector == @selector(tableView:canPerformAction:forRowAtIndexPath:withSender:) || - selector == @selector(tableView:performAction:forRowAtIndexPath:withSender:) || - - // handled by ASRangeController - selector == @selector(numberOfSectionsInTableView:) || - selector == @selector(tableView:numberOfRowsInSection:) || - - // reordering support - selector == @selector(tableView:canMoveRowAtIndexPath:) || - selector == @selector(tableView:moveRowAtIndexPath:toIndexPath:) || - - // used for ASCellNode visibility - selector == @selector(scrollViewDidScroll:) || - - // used for ASCellNode user interaction - selector == @selector(scrollViewWillBeginDragging:) || - selector == @selector(scrollViewDidEndDragging:willDecelerate:) || - - // used for ASRangeController visibility updates - selector == @selector(tableView:willDisplayCell:forRowAtIndexPath:) || - selector == @selector(tableView:didEndDisplayingCell:forRowAtIndexPath:) || - - // used for batch fetching API - selector == @selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:) || - selector == @selector(scrollViewDidEndDecelerating:) || - - // UIDataSourceModelAssociation - selector == @selector(modelIdentifierForElementAtIndexPath:inView:) || - selector == @selector(indexPathForElementWithModelIdentifier:inView:) - ); -} - -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view { - return [self _modelIdentifierForElementAtIndexPath:indexPath inView:view]; -} - -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view { - return [self _indexPathForElementWithModelIdentifier:identifier inView:view]; -} - -@end - -@implementation ASCollectionViewProxy - -- (BOOL)interceptsSelector:(SEL)selector -{ - return ( - // handled by ASCollectionView node<->cell machinery - selector == @selector(collectionView:cellForItemAtIndexPath:) || - selector == @selector(collectionView:layout:sizeForItemAtIndexPath:) || - selector == @selector(collectionView:layout:insetForSectionAtIndex:) || - selector == @selector(collectionView:layout:minimumLineSpacingForSectionAtIndex:) || - selector == @selector(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:) || - selector == @selector(collectionView:layout:referenceSizeForHeaderInSection:) || - selector == @selector(collectionView:layout:referenceSizeForFooterInSection:) || - selector == @selector(collectionView:viewForSupplementaryElementOfKind:atIndexPath:) || - - // Selection, highlighting, menu - selector == @selector(collectionView:shouldSelectItemAtIndexPath:) || - selector == @selector(collectionView:didSelectItemAtIndexPath:) || - selector == @selector(collectionView:shouldDeselectItemAtIndexPath:) || - selector == @selector(collectionView:didDeselectItemAtIndexPath:) || - selector == @selector(collectionView:shouldHighlightItemAtIndexPath:) || - selector == @selector(collectionView:didHighlightItemAtIndexPath:) || - selector == @selector(collectionView:didUnhighlightItemAtIndexPath:) || - selector == @selector(collectionView:shouldShowMenuForItemAtIndexPath:) || - selector == @selector(collectionView:canPerformAction:forItemAtIndexPath:withSender:) || - selector == @selector(collectionView:performAction:forItemAtIndexPath:withSender:) || - - // Item counts - selector == @selector(numberOfSectionsInCollectionView:) || - selector == @selector(collectionView:numberOfItemsInSection:) || - - // Element appearance callbacks - selector == @selector(collectionView:willDisplayCell:forItemAtIndexPath:) || - selector == @selector(collectionView:didEndDisplayingCell:forItemAtIndexPath:) || - selector == @selector(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:) || - selector == @selector(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:) || - - // used for batch fetching API - selector == @selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:) || - selector == @selector(scrollViewDidEndDecelerating:) || - - // used for ASCellNode visibility - selector == @selector(scrollViewDidScroll:) || - - // used for ASCellNode user interaction - selector == @selector(scrollViewWillBeginDragging:) || - selector == @selector(scrollViewDidEndDragging:willDecelerate:) || - - // intercepted due to not being supported by ASCollectionView (prevent bugs caused by usage) - selector == @selector(collectionView:canMoveItemAtIndexPath:) || - selector == @selector(collectionView:moveItemAtIndexPath:toIndexPath:) || - - // UIDataSourceModelAssociation - selector == @selector(modelIdentifierForElementAtIndexPath:inView:) || - selector == @selector(indexPathForElementWithModelIdentifier:inView:) - ); -} - -- (nullable NSString *)modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view { - return [self _modelIdentifierForElementAtIndexPath:indexPath inView:view]; -} - -- (nullable NSIndexPath *)indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view { - return [self _indexPathForElementWithModelIdentifier:identifier inView:view]; -} - -@end - -@implementation ASPagerNodeProxy - -- (BOOL)interceptsSelector:(SEL)selector -{ - return ( - // handled by ASPagerDataSource node<->cell machinery - selector == @selector(collectionNode:nodeForItemAtIndexPath:) || - selector == @selector(collectionNode:nodeBlockForItemAtIndexPath:) || - selector == @selector(collectionNode:numberOfItemsInSection:) || - selector == @selector(collectionNode:constrainedSizeForItemAtIndexPath:) - ); -} - -@end - -@implementation ASDelegateProxy { - id __weak _interceptor; - id __weak _target; -} - -- (instancetype)initWithTarget:(id)target interceptor:(id )interceptor -{ - ASDisplayNodeAssert(interceptor, @"interceptor must not be nil"); - - _target = target ? : [NSNull null]; - _interceptor = interceptor; - - return self; -} - -- (BOOL)conformsToProtocol:(Protocol *)aProtocol -{ - id target = _target; - if (target) { - return [target conformsToProtocol:aProtocol]; - } else { - return [super conformsToProtocol:aProtocol]; - } -} - -- (BOOL)respondsToSelector:(SEL)aSelector -{ - if ([self interceptsSelector:aSelector]) { - return [_interceptor respondsToSelector:aSelector]; - } else { - // Also return NO if _target has become nil due to zeroing weak reference (or placeholder initialization). - return [_target respondsToSelector:aSelector]; - } -} - -- (id)forwardingTargetForSelector:(SEL)aSelector -{ - if ([self interceptsSelector:aSelector]) { - return _interceptor; - } else { - id target = _target; - if (target) { - return [target respondsToSelector:aSelector] ? target : nil; - } else { - // The _interceptor needs to be nilled out in this scenario. For that a strong reference needs to be created - // to be able to nil out the _interceptor but still let it know that the proxy target has deallocated - // We have to hold a strong reference to the interceptor as we have to nil it out and call the proxyTargetHasDeallocated - // The reason that the interceptor needs to be nilled out is that there maybe a change of a infinite loop, for example - // if a method will be called in the proxyTargetHasDeallocated: that again would trigger a whole new forwarding cycle - id interceptor = _interceptor; - _interceptor = nil; - [interceptor proxyTargetHasDeallocated:self]; - - return nil; - } - } -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector -{ - // Check for a compiled definition for the selector - NSMethodSignature *methodSignature = nil; - if ([self interceptsSelector:aSelector]) { - methodSignature = [[_interceptor class] instanceMethodSignatureForSelector:aSelector]; - } else { - methodSignature = [[_target class] instanceMethodSignatureForSelector:aSelector]; - } - - // Unfortunately, in order to get this object to work properly, the use of a method which creates an NSMethodSignature - // from a C string. -methodSignatureForSelector is called when a compiled definition for the selector cannot be found. - // This is the place where we have to create our own dud NSMethodSignature. This is necessary because if this method - // returns nil, a selector not found exception is raised. The string argument to -signatureWithObjCTypes: outlines - // the return type and arguments to the message. To return a dud NSMethodSignature, pretty much any signature will - // suffice. Since the -forwardInvocation call will do nothing if the delegate does not respond to the selector, - // the dud NSMethodSignature simply gets us around the exception. - return methodSignature ?: [NSMethodSignature signatureWithObjCTypes:"@^v^c"]; -} - -- (void)forwardInvocation:(NSInvocation *)invocation -{ - // If we are down here this means _interceptor and _target where nil. Just don't do anything to prevent a crash -} - -- (BOOL)interceptsSelector:(SEL)selector -{ - ASDisplayNodeAssert(NO, @"This method must be overridden by subclasses."); - return NO; -} - -- (nullable NSString *)_modelIdentifierForElementAtIndexPath:(NSIndexPath *)indexPath inView:(UIView *)view { - return [(id)_interceptor modelIdentifierForElementAtIndexPath:indexPath inView:view]; -} - -- (nullable NSIndexPath *)_indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view { - return [(id)_interceptor indexPathForElementWithModelIdentifier:identifier inView:view]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASElementMap.h b/Example/Pods/Texture/Source/Details/ASElementMap.h deleted file mode 100644 index bf5b2599..00000000 --- a/Example/Pods/Texture/Source/Details/ASElementMap.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// ASElementMap.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionElement, ASSection, UICollectionViewLayoutAttributes; -@protocol ASSectionContext; - -/** - * An immutable representation of the state of a collection view's data. - * All items and supplementary elements are represented by ASCollectionElement. - * Fast enumeration is in terms of ASCollectionElement. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASElementMap : NSObject - -/** - * The total number of elements in this map. - */ -@property (readonly) NSUInteger count; - -/** - * The number of sections (of items) in this map. - */ -@property (readonly) NSInteger numberOfSections; - -/** - * The kinds of supplementary elements present in this map. O(1) - */ -@property (copy, readonly) NSArray *supplementaryElementKinds; - -/** - * Returns number of items in the given section. O(1) - */ -- (NSInteger)numberOfItemsInSection:(NSInteger)section; - -/** - * Returns the context object for the given section, if any. O(1) - */ -- (nullable id)contextForSection:(NSInteger)section; - -/** - * All the index paths for all the items in this map. O(N) - * - * This property may be removed in the future, since it doesn't account for supplementary nodes. - */ -@property (copy, readonly) NSArray *itemIndexPaths; - -/** - * All the item elements in this map, in ascending order. O(N) - */ -@property (copy, readonly) NSArray *itemElements; - -/** - * Returns the index path that corresponds to the same element in @c map at the given @c indexPath. - * O(1) for items, fast O(N) for sections. - * - * Note you can pass "section index paths" of length 1 and get a corresponding section index path. - */ -- (nullable NSIndexPath *)convertIndexPath:(NSIndexPath *)indexPath fromMap:(ASElementMap *)map; - -/** - * Returns the section index into the receiver that corresponds to the same element in @c map at @c sectionIndex. Fast O(N). - * - * Returns @c NSNotFound if the section does not exist in the receiver. - */ -- (NSInteger)convertSection:(NSInteger)sectionIndex fromMap:(ASElementMap *)map; - -/** - * Returns the index path for the given element. O(1) - */ -- (nullable NSIndexPath *)indexPathForElement:(ASCollectionElement *)element; - -/** - * Returns the index path for the given element, if it represents a cell. O(1) - */ -- (nullable NSIndexPath *)indexPathForElementIfCell:(ASCollectionElement *)element; - -/** - * Returns the item-element at the given index path. O(1) - */ -- (nullable ASCollectionElement *)elementForItemAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Returns the element for the supplementary element of the given kind at the given index path. O(1) - */ -- (nullable ASCollectionElement *)supplementaryElementOfKind:(NSString *)supplementaryElementKind atIndexPath:(NSIndexPath *)indexPath; - -/** - * Returns the element that corresponds to the given layout attributes, if any. - * - * NOTE: This method only regards the category, kind, and index path of the attributes object. Elements do not - * have any concept of size/position. - */ -- (nullable ASCollectionElement *)elementForLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes; - -/** - * A very terse description e.g. { itemCounts = [ ] } - */ -@property (readonly) NSString *smallDescription; - -#pragma mark - Initialization -- Only Useful to ASDataController - - -// SectionIndex -> ItemIndex -> Element -typedef NSArray *> ASCollectionElementTwoDimensionalArray; - -// ElementKind -> IndexPath -> Element -typedef NSDictionary *> ASSupplementaryElementDictionary; - -/** - * Create a new element map for this dataset. You probably don't need to use this – ASDataController is the only one who creates these. - * - * @param sections The array of ASSection objects. - * @param items A 2D array of ASCollectionElements, for each item. - * @param supplementaryElements A dictionary of gathered supplementary elements. - */ -- (instancetype)initWithSections:(NSArray *)sections - items:(ASCollectionElementTwoDimensionalArray *)items - supplementaryElements:(ASSupplementaryElementDictionary *)supplementaryElements; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASElementMap.mm b/Example/Pods/Texture/Source/Details/ASElementMap.mm deleted file mode 100644 index 6dd0d64d..00000000 --- a/Example/Pods/Texture/Source/Details/ASElementMap.mm +++ /dev/null @@ -1,275 +0,0 @@ -// -// ASElementMap.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -@interface ASElementMap () - -@property (nonatomic, readonly) NSArray *sections; - -// Element -> IndexPath -@property (nonatomic, readonly) NSMapTable *elementToIndexPathMap; - -// The items, in a 2D array -@property (nonatomic, readonly) ASCollectionElementTwoDimensionalArray *sectionsOfItems; - -@property (nonatomic, readonly) ASSupplementaryElementDictionary *supplementaryElements; - -@end - -@implementation ASElementMap - -- (instancetype)init -{ - return [self initWithSections:@[] items:@[] supplementaryElements:@{}]; -} - -- (instancetype)initWithSections:(NSArray *)sections items:(ASCollectionElementTwoDimensionalArray *)items supplementaryElements:(ASSupplementaryElementDictionary *)supplementaryElements -{ - NSCParameterAssert(items.count == sections.count); - - if (self = [super init]) { - _sections = [sections copy]; - _sectionsOfItems = [[NSArray alloc] initWithArray:items copyItems:YES]; - _supplementaryElements = [[NSDictionary alloc] initWithDictionary:supplementaryElements copyItems:YES]; - - // Setup our index path map - _elementToIndexPathMap = [NSMapTable mapTableWithKeyOptions:(NSMapTableStrongMemory | NSMapTableObjectPointerPersonality) valueOptions:NSMapTableCopyIn]; - NSInteger s = 0; - for (NSArray *section in _sectionsOfItems) { - NSInteger i = 0; - for (ASCollectionElement *element in section) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:s]; - [_elementToIndexPathMap setObject:indexPath forKey:element]; - i++; - } - s++; - } - for (NSDictionary *supplementariesForKind in [_supplementaryElements objectEnumerator]) { - [supplementariesForKind enumerateKeysAndObjectsUsingBlock:^(NSIndexPath *_Nonnull indexPath, ASCollectionElement * _Nonnull element, BOOL * _Nonnull stop) { - [_elementToIndexPathMap setObject:indexPath forKey:element]; - }]; - } - } - return self; -} - -- (NSUInteger)count -{ - return _elementToIndexPathMap.count; -} - -- (NSArray *)itemIndexPaths -{ - return ASIndexPathsForTwoDimensionalArray(_sectionsOfItems); -} - -- (NSArray *)itemElements -{ - return ASElementsInTwoDimensionalArray(_sectionsOfItems); -} - -- (NSInteger)numberOfSections -{ - return _sectionsOfItems.count; -} - -- (NSArray *)supplementaryElementKinds -{ - return _supplementaryElements.allKeys; -} - -- (NSInteger)numberOfItemsInSection:(NSInteger)section -{ - if (![self sectionIndexIsValid:section assert:YES]) { - return 0; - } - - return _sectionsOfItems[section].count; -} - -- (id)contextForSection:(NSInteger)section -{ - if (![self sectionIndexIsValid:section assert:NO]) { - return nil; - } - - return _sections[section].context; -} - -- (nullable NSIndexPath *)indexPathForElement:(ASCollectionElement *)element -{ - return element ? [_elementToIndexPathMap objectForKey:element] : nil; -} - -- (nullable NSIndexPath *)indexPathForElementIfCell:(ASCollectionElement *)element -{ - if (element.supplementaryElementKind == nil) { - return [self indexPathForElement:element]; - } else { - return nil; - } -} - -- (nullable ASCollectionElement *)elementForItemAtIndexPath:(NSIndexPath *)indexPath -{ - NSInteger section, item; - if (![self itemIndexPathIsValid:indexPath assert:NO item:&item section:§ion]) { - return nil; - } - - return _sectionsOfItems[section][item]; -} - -- (nullable ASCollectionElement *)supplementaryElementOfKind:(NSString *)supplementaryElementKind atIndexPath:(NSIndexPath *)indexPath -{ - return _supplementaryElements[supplementaryElementKind][indexPath]; -} - -- (ASCollectionElement *)elementForLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - switch (layoutAttributes.representedElementCategory) { - case UICollectionElementCategoryCell: - // Cell - return [self elementForItemAtIndexPath:layoutAttributes.indexPath]; - case UICollectionElementCategorySupplementaryView: - // Supplementary element. - return [self supplementaryElementOfKind:layoutAttributes.representedElementKind atIndexPath:layoutAttributes.indexPath]; - case UICollectionElementCategoryDecorationView: - // No support for decoration views. - return nil; - } -} - -- (NSIndexPath *)convertIndexPath:(NSIndexPath *)indexPath fromMap:(ASElementMap *)map -{ - if (indexPath.item == NSNotFound) { - // Section index path - NSInteger result = [self convertSection:indexPath.section fromMap:map]; - return (result != NSNotFound ? [NSIndexPath indexPathWithIndex:result] : nil); - } else { - // Item index path - ASCollectionElement *element = [map elementForItemAtIndexPath:indexPath]; - return [self indexPathForElement:element]; - } -} - -- (NSInteger)convertSection:(NSInteger)sectionIndex fromMap:(ASElementMap *)map -{ - if (![map sectionIndexIsValid:sectionIndex assert:YES]) { - return NSNotFound; - } - - ASSection *section = map.sections[sectionIndex]; - return [_sections indexOfObjectIdenticalTo:section]; -} - -#pragma mark - NSCopying - -- (id)copyWithZone:(NSZone *)zone -{ - return self; -} - -// NSMutableCopying conformance is declared in ASMutableElementMap.h, so that most consumers of ASElementMap don't bother with it. -#pragma mark - NSMutableCopying - -- (id)mutableCopyWithZone:(NSZone *)zone -{ - return [[ASMutableElementMap alloc] initWithSections:_sections items:_sectionsOfItems supplementaryElements:_supplementaryElements]; -} - -#pragma mark - NSFastEnumeration - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id _Nullable unowned [])buffer count:(NSUInteger)len -{ - return [_elementToIndexPathMap countByEnumeratingWithState:state objects:buffer count:len]; -} - -- (NSString *)smallDescription -{ - NSMutableArray *sectionDescriptions = [NSMutableArray array]; - - NSUInteger i = 0; - for (NSArray *section in _sectionsOfItems) { - [sectionDescriptions addObject:[NSString stringWithFormat:@"", i, section.count]]; - i++; - } - return ASObjectDescriptionMakeWithoutObject(@[ @{ @"itemCounts": sectionDescriptions }]); -} - -#pragma mark - ASDescriptionProvider - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"items" : _sectionsOfItems }]; - [result addObject:@{ @"supplementaryElements" : _supplementaryElements }]; - return result; -} - -#pragma mark - Internal - -/** - * Fails assert + return NO if section is out of bounds. - */ -- (BOOL)sectionIndexIsValid:(NSInteger)section assert:(BOOL)assert -{ - NSInteger sectionCount = _sectionsOfItems.count; - if (section >= sectionCount || section < 0) { - if (assert) { - ASDisplayNodeFailAssert(@"Invalid section index %ld when there are only %ld sections!", (long)section, (long)sectionCount); - } - return NO; - } else { - return YES; - } -} - -/** - * If indexPath is nil, just returns NO. - * If indexPath is invalid, fails assertion and returns NO. - * Otherwise returns YES and sets the item & section. - */ -- (BOOL)itemIndexPathIsValid:(NSIndexPath *)indexPath assert:(BOOL)assert item:(out NSInteger *)outItem section:(out NSInteger *)outSection -{ - if (indexPath == nil) { - return NO; - } - - NSInteger section = indexPath.section; - if (![self sectionIndexIsValid:section assert:assert]) { - return NO; - } - - NSInteger itemCount = _sectionsOfItems[section].count; - NSInteger item = indexPath.item; - if (item >= itemCount || item < 0) { - if (assert) { - ASDisplayNodeFailAssert(@"Invalid item index %ld in section %ld which only has %ld items!", (long)item, (long)section, (long)itemCount); - } - return NO; - } - *outItem = item; - *outSection = section; - return YES; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASGraphicsContext.h b/Example/Pods/Texture/Source/Details/ASGraphicsContext.h deleted file mode 100644 index 5bd15376..00000000 --- a/Example/Pods/Texture/Source/Details/ASGraphicsContext.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASGraphicsContext.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A wrapper for the UIKit drawing APIs. If you are in ASExperimentalDrawingGlobal, and you have iOS >= 10, we will create - * a UIGraphicsRenderer with an appropriate format. Otherwise, we will use UIGraphicsBeginImageContext et al. - * - * @param size The size of the context. - * @param opaque Whether the context should be opaque or not. - * @param scale The scale of the context. 0 uses main screen scale. - * @param sourceImage If you are planning to render a UIImage into this context, provide it here and we will use its - * preferred renderer format if we are using UIGraphicsImageRenderer. - * @param isCancelled An optional block for canceling the drawing before forming the image. Only takes effect under - * the legacy code path, as UIGraphicsRenderer does not support cancellation. - * @param work A block, wherein the current UIGraphics context is set based on the arguments. - * - * @return The rendered image. You can also render intermediary images using UIGraphicsGetImageFromCurrentImageContext. - */ -ASDK_EXTERN UIImage *ASGraphicsCreateImageWithOptions(CGSize size, BOOL opaque, CGFloat scale, UIImage * _Nullable sourceImage, asdisplaynode_iscancelled_block_t NS_NOESCAPE _Nullable isCancelled, void (NS_NOESCAPE ^work)(void)) ASDISPLAYNODE_DEPRECATED_MSG("Use ASGraphicsCreateImageWithTraitCollectionAndOptions instead"); - -/** -* A wrapper for the UIKit drawing APIs. If you are in ASExperimentalDrawingGlobal, and you have iOS >= 10, we will create -* a UIGraphicsRenderer with an appropriate format. Otherwise, we will use UIGraphicsBeginImageContext et al. -* -* @param traitCollection Trait collection. The `work` block will be executed with this trait collection, so it will affect dynamic colors, etc. -* @param size The size of the context. -* @param opaque Whether the context should be opaque or not. -* @param scale The scale of the context. 0 uses main screen scale. -* @param sourceImage If you are planning to render a UIImage into this context, provide it here and we will use its -* preferred renderer format if we are using UIGraphicsImageRenderer. -* @param isCancelled An optional block for canceling the drawing before forming the image. -* @param work A block, wherein the current UIGraphics context is set based on the arguments. -* -* @return The rendered image. You can also render intermediary images using UIGraphicsGetImageFromCurrentImageContext. -*/ -ASDK_EXTERN UIImage *ASGraphicsCreateImage(ASPrimitiveTraitCollection traitCollection, CGSize size, BOOL opaque, CGFloat scale, UIImage * _Nullable sourceImage, asdisplaynode_iscancelled_block_t _Nullable NS_NOESCAPE isCancelled, void (NS_NOESCAPE ^work)(void)); - -/** -* A wrapper for the UIKit drawing APIs. -* -* @param traitCollection Trait collection. The `work` block will be executed with this trait collection, so it will affect dynamic colors, etc. -* @param size The size of the context. -* @param opaque Whether the context should be opaque or not. -* @param scale The scale of the context. 0 uses main screen scale. -* @param sourceImage If you are planning to render a UIImage into this context, provide it here and we will use its -* preferred renderer format if we are using UIGraphicsImageRenderer. -* @param work A block, wherein the current UIGraphics context is set based on the arguments. -* -* @return The rendered image. You can also render intermediary images using UIGraphicsGetImageFromCurrentImageContext. -*/ -ASDK_EXTERN UIImage *ASGraphicsCreateImageWithTraitCollectionAndOptions(ASPrimitiveTraitCollection traitCollection, CGSize size, BOOL opaque, CGFloat scale, UIImage * _Nullable sourceImage, void (NS_NOESCAPE ^work)(void)) ASDISPLAYNODE_DEPRECATED_MSG("Use ASGraphicsCreateImage instead"); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASGraphicsContext.mm b/Example/Pods/Texture/Source/Details/ASGraphicsContext.mm deleted file mode 100644 index 8f543e06..00000000 --- a/Example/Pods/Texture/Source/Details/ASGraphicsContext.mm +++ /dev/null @@ -1,136 +0,0 @@ -// -// ASGraphicsContext.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - - -#if AS_AT_LEAST_IOS13 -#define ASPerformBlockWithTraitCollection(work, traitCollection) \ - if (@available(iOS 13.0, tvOS 13.0, *)) { \ - UITraitCollection *uiTraitCollection = ASPrimitiveTraitCollectionToUITraitCollection(traitCollection); \ - [uiTraitCollection performAsCurrentTraitCollection:^{ \ - work(); \ - }];\ - } else { \ - work(); \ - } -#else -#define ASPerformBlockWithTraitCollection(work, traitCollection) work(); -#endif - - -NS_AVAILABLE_IOS(10) -NS_INLINE void ASConfigureExtendedRange(UIGraphicsImageRendererFormat *format) -{ - if (AS_AVAILABLE_IOS_TVOS(12, 12)) { - // nop. We always use automatic range on iOS >= 12. - } else { - // Currently we never do wide color. One day we could pipe this information through from the ASImageNode if it was worth it. - format.prefersExtendedRange = NO; - } -} - -UIImage *ASGraphicsCreateImageWithOptions(CGSize size, BOOL opaque, CGFloat scale, UIImage *sourceImage, - asdisplaynode_iscancelled_block_t NS_NOESCAPE isCancelled, - void (^NS_NOESCAPE work)()) -{ - return ASGraphicsCreateImage(ASPrimitiveTraitCollectionMakeDefault(), size, opaque, scale, sourceImage, isCancelled, work); -} - -UIImage *ASGraphicsCreateImage(ASPrimitiveTraitCollection traitCollection, CGSize size, BOOL opaque, CGFloat scale, UIImage * sourceImage, asdisplaynode_iscancelled_block_t NS_NOESCAPE isCancelled, void (NS_NOESCAPE ^work)()) { - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - if (ASActivateExperimentalFeature(ASExperimentalDrawingGlobal)) { - // If they used default scale, reuse one of two preferred formats. - static UIGraphicsImageRendererFormat *defaultFormat; - static UIGraphicsImageRendererFormat *opaqueFormat; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - defaultFormat = [UIGraphicsImageRendererFormat preferredFormat]; - opaqueFormat = [UIGraphicsImageRendererFormat preferredFormat]; - } else { - defaultFormat = [UIGraphicsImageRendererFormat defaultFormat]; - opaqueFormat = [UIGraphicsImageRendererFormat defaultFormat]; - } - opaqueFormat.opaque = YES; - ASConfigureExtendedRange(defaultFormat); - ASConfigureExtendedRange(opaqueFormat); - }); - - UIGraphicsImageRendererFormat *format; - if (sourceImage) { - if (sourceImage.renderingMode == UIImageRenderingModeAlwaysTemplate) { - // Template images will be black and transparent, so if we use - // sourceImage.imageRenderFormat it will assume a grayscale color space. - // This is not good because a template image should be able to tint to any color, - // so we'll just use the default here. - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - format = [UIGraphicsImageRendererFormat preferredFormat]; - } else { - format = [UIGraphicsImageRendererFormat defaultFormat]; - } - } else { - format = sourceImage.imageRendererFormat; - } - // We only want the private bits (color space and bits per component) from the image. - // We have our own ideas about opacity and scale. - format.opaque = opaque; - format.scale = scale; - } else if (scale == 0 || scale == ASScreenScale()) { - format = opaque ? opaqueFormat : defaultFormat; - } else { - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - format = [UIGraphicsImageRendererFormat preferredFormat]; - } else { - format = [UIGraphicsImageRendererFormat defaultFormat]; - } - if (opaque) format.opaque = YES; - format.scale = scale; - ASConfigureExtendedRange(format); - } - - // Avoid using the imageWithActions: method because it does not support cancellation at the - // last moment i.e. before actually creating the resulting image. - __block UIImage *image; - NSError *error; - [[[UIGraphicsImageRenderer alloc] initWithSize:size format:format] - runDrawingActions:^(UIGraphicsImageRendererContext *rendererContext) { - ASDisplayNodeCAssert(UIGraphicsGetCurrentContext(), @"Should have a context!"); - ASPerformBlockWithTraitCollection(work, traitCollection); - } - completionActions:^(UIGraphicsImageRendererContext *rendererContext) { - if (isCancelled == nil || !isCancelled()) { - image = rendererContext.currentImage; - } - } - error:&error]; - if (error) { - NSCAssert(NO, @"Error drawing: %@", error); - } - return image; - } - } - - // Bad OS or experiment flag. Use UIGraphics* API. - UIGraphicsBeginImageContextWithOptions(size, opaque, scale); - ASPerformBlockWithTraitCollection(work, traitCollection) - UIImage *image = nil; - if (isCancelled == nil || !isCancelled()) { - image = UIGraphicsGetImageFromCurrentImageContext(); - } - UIGraphicsEndImageContext(); - return image; -} - -UIImage *ASGraphicsCreateImageWithTraitCollectionAndOptions(ASPrimitiveTraitCollection traitCollection, CGSize size, BOOL opaque, CGFloat scale, UIImage * sourceImage, void (NS_NOESCAPE ^work)()) { - return ASGraphicsCreateImage(traitCollection, size, opaque, scale, sourceImage, nil, work); -} diff --git a/Example/Pods/Texture/Source/Details/ASHashing.h b/Example/Pods/Texture/Source/Details/ASHashing.h deleted file mode 100644 index 42a4a98b..00000000 --- a/Example/Pods/Texture/Source/Details/ASHashing.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// ASHashing.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * When std::hash is unavailable, this function will hash a bucket o' bits real fast. - * The hashing algorithm is copied from CoreFoundation's private function CFHashBytes. - * https://opensource.apple.com/source/CF/CF-1153.18/CFUtilities.c.auto.html - * - * Simple example: - * CGRect myRect = { ... }; - * ASHashBytes(&myRect, sizeof(myRect)); - * - * Example: - * struct { - * NSUInteger imageHash; - * CGSize size; - * } data = { - * _image.hash, - * _bounds.size - * }; - * return ASHashBytes(&data, sizeof(data)); - * - * @warning: If a struct has padding, any fields that are intiailized in {} - * will have garbage data for their padding, which will break this hash! Either - * use `pragma clang diagnostic warning "-Wpadded"` around your struct definition - * or manually initialize the fields of your struct (`myStruct.x = 7;` etc). - */ -ASDK_EXTERN NSUInteger ASHashBytes(void *bytes, size_t length); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASHashing.mm b/Example/Pods/Texture/Source/Details/ASHashing.mm deleted file mode 100644 index 17bf66bd..00000000 --- a/Example/Pods/Texture/Source/Details/ASHashing.mm +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASHashing.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define ELF_STEP(B) T1 = (H << 4) + B; T2 = T1 & 0xF0000000; if (T2) T1 ^= (T2 >> 24); T1 &= (~T2); H = T1; - -/** - * The hashing algorithm copied from CoreFoundation CFHashBytes function. - * https://opensource.apple.com/source/CF/CF-1153.18/CFUtilities.c.auto.html - */ -NSUInteger ASHashBytes(void *bytesarg, size_t length) { - /* The ELF hash algorithm, used in the ELF object file format */ - uint8_t *bytes = (uint8_t *)bytesarg; - UInt32 H = 0, T1, T2; - SInt32 rem = (SInt32)length; - while (3 < rem) { - ELF_STEP(bytes[length - rem]); - ELF_STEP(bytes[length - rem + 1]); - ELF_STEP(bytes[length - rem + 2]); - ELF_STEP(bytes[length - rem + 3]); - rem -= 4; - } - switch (rem) { - case 3: ELF_STEP(bytes[length - 3]); - case 2: ELF_STEP(bytes[length - 2]); - case 1: ELF_STEP(bytes[length - 1]); - case 0: ; - } - return H; -} - -#undef ELF_STEP diff --git a/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.h b/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.h deleted file mode 100644 index aff6694b..00000000 --- a/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// ASHighlightOverlayLayer.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASHighlightOverlayLayer : CALayer - -/** - @summary Initializes with CGRects for the highlighting, in the targetLayer's coordinate space. - - @desc This is the designated initializer. - - @param rects Array containing CGRects wrapped in NSValue. - @param targetLayer The layer that the rects are relative to. The rects will be translated to the receiver's coordinate space when rendering. - */ -- (instancetype)initWithRects:(NSArray *)rects targetLayer:(nullable CALayer *)targetLayer; - -/** - @summary Initializes with CGRects for the highlighting, in the receiver's coordinate space. - - @param rects Array containing CGRects wrapped in NSValue. - */ -- (instancetype)initWithRects:(NSArray *)rects; - -@property (nullable, nonatomic) __attribute__((NSObject)) CGColorRef highlightColor; -@property (nonatomic, weak) CALayer *targetLayer; - -@end - -@interface CALayer (ASHighlightOverlayLayerSupport) - -/** - @summary Set to YES to indicate to a sublayer that this is where highlight overlay layers (for pressed states) should - be added so that the highlight won't be clipped by a neighboring layer. - */ -@property (nonatomic, setter=as_setAllowsHighlightDrawing:) BOOL as_allowsHighlightDrawing; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.mm b/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.mm deleted file mode 100644 index 03cf4681..00000000 --- a/Example/Pods/Texture/Source/Details/ASHighlightOverlayLayer.mm +++ /dev/null @@ -1,134 +0,0 @@ -// -// ASHighlightOverlayLayer.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import - -static const CGFloat kCornerRadius = 2.5; -static const UIEdgeInsets padding = {2, 4, 1.5, 4}; - -@implementation ASHighlightOverlayLayer -{ - NSArray *_rects; -} - -+ (id)defaultValueForKey:(NSString *)key -{ - if ([key isEqualToString:@"contentsScale"]) { - return @(ASScreenScale()); - } else if ([key isEqualToString:@"highlightColor"]) { - CGFloat components[] = {0, 0, 0, 0.25}; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGColorRef color = CGColorCreate(colorSpace, components); - CGColorSpaceRelease(colorSpace); - return CFBridgingRelease(color); - } else { - return [super defaultValueForKey:key]; - } -} - -+ (BOOL)needsDisplayForKey:(NSString *)key -{ - if ([key isEqualToString:@"bounds"]) { - return YES; - } else { - return [super needsDisplayForKey:key]; - } -} - -+ (id)defaultActionForKey:(NSString *)event -{ - return (id)[NSNull null]; -} - -- (instancetype)initWithRects:(NSArray *)rects -{ - return [self initWithRects:rects targetLayer:nil]; -} - -- (instancetype)initWithRects:(NSArray *)rects targetLayer:(id)targetLayer -{ - if (self = [super init]) { - _rects = [rects copy]; - _targetLayer = targetLayer; - } - return self; -} - -@dynamic highlightColor; - -- (void)drawInContext:(CGContextRef)ctx -{ - [super drawInContext:ctx]; - - CGAffineTransform affine = CGAffineTransformIdentity; - CGMutablePathRef highlightPath = CGPathCreateMutable(); - CALayer *targetLayer = self.targetLayer; - - for (NSValue *value in _rects) { - CGRect rect = [value CGRectValue]; - - // Don't highlight empty rects. - if (CGRectIsEmpty(rect)) { - continue; - } - - if (targetLayer != nil) { - rect = [self convertRect:rect fromLayer:targetLayer]; - } - rect = CGRectMake(std::round(rect.origin.x), std::round(rect.origin.y), std::round(rect.size.width), std::round(rect.size.height)); - - CGFloat minX = rect.origin.x - padding.left; - CGFloat maxX = CGRectGetMaxX(rect) + padding.right; - CGFloat midX = (maxX - minX) / 2 + minX; - CGFloat minY = rect.origin.y - padding.top; - CGFloat maxY = CGRectGetMaxY(rect) + padding.bottom; - CGFloat midY = (maxY - minY) / 2 + minY; - - CGPathMoveToPoint(highlightPath, &affine, minX, midY); - CGPathAddArcToPoint(highlightPath, &affine, minX, maxY, midX, maxY, kCornerRadius); - CGPathAddArcToPoint(highlightPath, &affine, maxX, maxY, maxX, midY, kCornerRadius); - CGPathAddArcToPoint(highlightPath, &affine, maxX, minY, midX, minY, kCornerRadius); - CGPathAddArcToPoint(highlightPath, &affine, minX, minY, minX, midY, kCornerRadius); - CGPathCloseSubpath(highlightPath); - } - - CGContextAddPath(ctx, highlightPath); - CGContextSetFillColorWithColor(ctx, self.highlightColor); - CGContextDrawPath(ctx, kCGPathFill); - CGPathRelease(highlightPath); -} - -- (CALayer *)hitTest:(CGPoint)p -{ - // Don't handle taps - return nil; -} - -@end - -@implementation CALayer (ASHighlightOverlayLayerSupport) - -static NSString *kAllowsHighlightDrawingKey = @"allows_highlight_drawing"; - -- (BOOL)as_allowsHighlightDrawing -{ - return [[self valueForKey:kAllowsHighlightDrawingKey] boolValue]; -} - -- (void)as_setAllowsHighlightDrawing:(BOOL)allowsHighlightDrawing -{ - [self setValue:@(allowsHighlightDrawing) forKey:kAllowsHighlightDrawingKey]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.h b/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.h deleted file mode 100644 index 44ddc354..00000000 --- a/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASImageContainerProtocolCategories.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface UIImage (ASImageContainerProtocol) - -@end - -@interface NSData (ASImageContainerProtocol) - -@end diff --git a/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.mm b/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.mm deleted file mode 100644 index c9316c32..00000000 --- a/Example/Pods/Texture/Source/Details/ASImageContainerProtocolCategories.mm +++ /dev/null @@ -1,38 +0,0 @@ -// -// ASImageContainerProtocolCategories.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation UIImage (ASImageContainerProtocol) - -- (UIImage *)asdk_image -{ - return self; -} - -- (NSData *)asdk_animatedImageData -{ - return nil; -} - -@end - -@implementation NSData (ASImageContainerProtocol) - -- (UIImage *)asdk_image -{ - return nil; -} - -- (NSData *)asdk_animatedImageData -{ - return self; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASImageProtocols.h b/Example/Pods/Texture/Source/Details/ASImageProtocols.h deleted file mode 100644 index 91a0d579..00000000 --- a/Example/Pods/Texture/Source/Details/ASImageProtocols.h +++ /dev/null @@ -1,249 +0,0 @@ -// -// ASImageProtocols.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASAnimatedImageProtocol; - -@protocol ASImageContainerProtocol - -- (nullable UIImage *)asdk_image; -- (nullable NSData *)asdk_animatedImageData; - -@end - -typedef NS_ENUM(NSInteger, ASImageCacheType) { - ASImageCacheTypeAsynchronous = 0, - ASImageCacheTypeSynchronous, -}; - -typedef void(^ASImageCacherCompletion)(id _Nullable imageFromCache, ASImageCacheType cacheType); - -@protocol ASImageCacheProtocol - -/** - @abstract Attempts to fetch an image with the given URL from the cache. - @param URL The URL of the image to retrieve from the cache. - @param callbackQueue The queue to call `completion` on. - @param completion The block to be called when the cache has either hit or missed. - @discussion If `URL` is nil, `completion` will be invoked immediately with a nil image. This method should not block - the calling thread as it is likely to be called from the main thread. - */ -- (void)cachedImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - completion:(ASImageCacherCompletion)completion; - -@optional - -/** - @abstract Attempts to fetch an image with the given URL from a memory cache. - @param URL The URL of the image to retrieve from the cache. - @discussion This method exists to support synchronous rendering of nodes. Before the layer is drawn, this method - is called to attempt to get the image out of the cache synchronously. This allows drawing to occur on the main thread - if displaysAsynchronously is set to NO or recursivelyEnsureDisplaySynchronously: has been called. - - This method *should* block the calling thread to fetch the image from a fast memory cache. It is OK to return nil from - this method and instead support only cachedImageWithURL:callbackQueue:completion: however, synchronous rendering will - not be possible. - */ -- (nullable id )synchronouslyFetchedCachedImageWithURL:(NSURL *)URL; - -/** - @abstract Called during clearPreloadedData. Allows the cache to optionally trim items. - @note Depending on your caches implementation you may *not* wish to respond to this method. It is however useful - if you have a memory and disk cache in which case you'll likely want to clear out the memory cache. - */ -- (void)clearFetchedImageFromCacheWithURL:(NSURL *)URL; - -@end - -/** - @param image The image that was downloaded, if the image could be successfully downloaded; nil otherwise. - @param error An error describing why the download of `URL` failed, if the download failed; nil otherwise. - @param downloadIdentifier The identifier for the download task that completed. - @param userInfo Any additional info that your downloader would like to communicate through Texture. - */ -typedef void(^ASImageDownloaderCompletion)(id _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier, id _Nullable userInfo); - -/** - @param progress The progress of the download, in the range of (0.0, 1.0), inclusive. - */ -typedef void(^ASImageDownloaderProgress)(CGFloat progress); -typedef void(^ASImageDownloaderProgressImage)(UIImage *progressImage, CGFloat progress, id _Nullable downloadIdentifier); - -typedef NS_ENUM(NSUInteger, ASImageDownloaderPriority) { - ASImageDownloaderPriorityPreload = 0, - ASImageDownloaderPriorityImminent, - ASImageDownloaderPriorityVisible -}; - -@protocol ASImageDownloaderProtocol - -@required - -/** - @abstract Downloads an image with the given URL. - @param URL The URL of the image to download. - @param shouldRetry Whether to attempt to retry downloading if the remote host is currently unreachable. - @param callbackQueue The queue to call `downloadProgressBlock` and `completion` on. - @param downloadProgress The block to be invoked when the download of `URL` progresses. - @param completion The block to be invoked when the download has completed, or has failed. - @discussion This method is likely to be called on the main thread, so any custom implementations should make sure to background any expensive download operations. - @result An opaque identifier to be used in canceling the download, via `cancelImageDownloadForIdentifier:`. You must - retain the identifier if you wish to use it later. - */ -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(nullable ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion; - -/** - @abstract Cancels an image download. - @param downloadIdentifier The opaque download identifier object returned from - `downloadImageWithURL:callbackQueue:downloadProgress:completion:`. - @discussion This method has no effect if `downloadIdentifier` is nil. - */ -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier; - -@optional - -/** - @abstract Downloads an image with the given URL. - @param URL The URL of the image to download. - @param shouldRetry Whether to attempt to retry downloading if the remote host is currently unreachable. - @param priority The priority at which the image should be downloaded. - @param callbackQueue The queue to call `downloadProgressBlock` and `completion` on. - @param downloadProgress The block to be invoked when the download of `URL` progresses. - @param completion The block to be invoked when the download has completed, or has failed. - @discussion This method is likely to be called on the main thread, so any custom implementations should make sure to background any expensive download operations. - @note If this method is implemented, it will be called instead of the required method (`downloadImageWithURL:callbackQueue:downloadProgress:completion:`). - @result An opaque identifier to be used in canceling the download, via `cancelImageDownloadForIdentifier:`. You must - retain the identifier if you wish to use it later. - */ -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - priority:(ASImageDownloaderPriority)priority - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(nullable ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion; - -/** - @abstract Cancels an image download, however indicating resume data should be stored in case of redownload. - @param downloadIdentifier The opaque download identifier object returned from - `downloadImageWithURL:callbackQueue:downloadProgress:completion:`. - @discussion This method has no effect if `downloadIdentifier` is nil. If implemented, this method - may be called instead of `cancelImageDownloadForIdentifier:` in cases where ASDK believes there's a chance - the image download will be resumed (currently when an image exits preload range). You can use this to store - any data that has already been downloaded for use in resuming the download later. - */ -- (void)cancelImageDownloadWithResumePossibilityForIdentifier:(id)downloadIdentifier; - -/** - @abstract Return an object that conforms to ASAnimatedImageProtocol - @param animatedImageData Data that represents an animated image. - */ -- (nullable id )animatedImageWithData:(NSData *)animatedImageData; - - -/** - @abstract Sets block to be called when a progress image is available. - @param progressBlock The block to be invoked when the download has a progressive render of an image available. - @param callbackQueue The queue to call `progressImageBlock` on. - @param downloadIdentifier The opaque download identifier object returned from - `downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:`. - */ -- (void)setProgressImageBlock:(nullable ASImageDownloaderProgressImage)progressBlock - callbackQueue:(dispatch_queue_t)callbackQueue - withDownloadIdentifier:(id)downloadIdentifier; - -/** - @abstract Called to indicate what priority an image should be downloaded at. - @param priority The priority at which the image should be downloaded. - @param downloadIdentifier The opaque download identifier object returned from - `downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:`. - */ -- (void)setPriority:(ASImageDownloaderPriority)priority -withDownloadIdentifier:(id)downloadIdentifier; - -@end - -@protocol ASAnimatedImageProtocol - -@optional - -/** - @abstract A block which receives the cover image. Should be called when the objects cover image is ready. - */ -@property (nonatomic) void (^coverImageReadyCallback)(UIImage *coverImage); - -/** - @abstract Returns whether the supplied data contains a supported animated image format. - @param data the data to check if contains a supported animated image. - */ -- (BOOL)isDataSupported:(NSData *)data; - - -@required - -/** - @abstract Return the objects's cover image. - */ -@property (nonatomic, readonly) UIImage *coverImage; -/** - @abstract Return a boolean to indicate that the cover image is ready. - */ -@property (nonatomic, readonly) BOOL coverImageReady; -/** - @abstract Return the total duration of the animated image's playback. - */ -@property (nonatomic, readonly) CFTimeInterval totalDuration; -/** - @abstract Return the interval at which playback should occur. Will be set to a CADisplayLink's frame interval. - */ -@property (nonatomic, readonly) NSUInteger frameInterval; -/** - @abstract Return the total number of loops the animated image should play or 0 to loop infinitely. - */ -@property (nonatomic, readonly) size_t loopCount; -/** - @abstract Return the total number of frames in the animated image. - */ -@property (nonatomic, readonly) size_t frameCount; -/** - @abstract Return YES when playback is ready to occur. - */ -@property (nonatomic, readonly) BOOL playbackReady; -/** - @abstract Return any error that has occured. Playback will be paused if this returns non-nil. - */ -@property (nonatomic, readonly) NSError *error; -/** - @abstract Should be called when playback is ready. - */ -@property (nonatomic) dispatch_block_t playbackReadyCallback; - -/** - @abstract Return the image at a given index. - */ -- (CGImageRef)imageAtIndex:(NSUInteger)index; -/** - @abstract Return the duration at a given index. - */ -- (CFTimeInterval)durationAtIndex:(NSUInteger)index; -/** - @abstract Clear any cached data. Called when playback is paused. - */ -- (void)clearAnimatedImageCache; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASIntegerMap.h b/Example/Pods/Texture/Source/Details/ASIntegerMap.h deleted file mode 100644 index ece6f5a8..00000000 --- a/Example/Pods/Texture/Source/Details/ASIntegerMap.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// ASIntegerMap.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * An objective-C wrapper for unordered_map. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASIntegerMap : NSObject - -/** - * Creates a map based on the specified update to an array. - * - * If oldCount is 0, returns the empty map. - * If deleted and inserted are empty, returns the identity map. - */ -+ (ASIntegerMap *)mapForUpdateWithOldCount:(NSInteger)oldCount - deleted:(nullable NSIndexSet *)deleted - inserted:(nullable NSIndexSet *)inserted NS_RETURNS_RETAINED; - -/** - * A singleton that maps each integer to itself. Its inverse is itself. - * - * Note: You cannot mutate this. - */ -@property (class, readonly) ASIntegerMap *identityMap; -+ (ASIntegerMap *)identityMap NS_RETURNS_RETAINED; - -/** - * A singleton that returns NSNotFound for all keys. Its inverse is itself. - * - * Note: You cannot mutate this. - */ -@property (class, readonly) ASIntegerMap *emptyMap; -+ (ASIntegerMap *)emptyMap NS_RETURNS_RETAINED; - -/** - * Retrieves the integer for a given key, or NSNotFound if the key is not found. - * - * @param key A key to lookup the value for. - */ -- (NSInteger)integerForKey:(NSInteger)key; - -/** - * Sets the value for a given key. - * - * @param value The new value. - * @param key The key to store the value for. - */ -- (void)setInteger:(NSInteger)value forKey:(NSInteger)key; - -/** - * Create and return a map with the inverse mapping. - */ -- (ASIntegerMap *)inverseMap; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASIntegerMap.mm b/Example/Pods/Texture/Source/Details/ASIntegerMap.mm deleted file mode 100644 index fdf0d528..00000000 --- a/Example/Pods/Texture/Source/Details/ASIntegerMap.mm +++ /dev/null @@ -1,184 +0,0 @@ -// -// ASIntegerMap.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASIntegerMap.h" -#import -#import -#import - -/** - * This is just a friendly Objective-C interface to unordered_map - */ -@interface ASIntegerMap () -@end - -@implementation ASIntegerMap { - std::unordered_map _map; - BOOL _isIdentity; - BOOL _isEmpty; - BOOL _immutable; // identity map and empty mape are immutable. -} - -#pragma mark - Singleton - -+ (ASIntegerMap *)identityMap NS_RETURNS_RETAINED -{ - static ASIntegerMap *identityMap; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - identityMap = [[ASIntegerMap alloc] init]; - identityMap->_isIdentity = YES; - identityMap->_immutable = YES; - }); - return identityMap; -} - -+ (ASIntegerMap *)emptyMap NS_RETURNS_RETAINED -{ - static ASIntegerMap *emptyMap; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - emptyMap = [[ASIntegerMap alloc] init]; - emptyMap->_isEmpty = YES; - emptyMap->_immutable = YES; - }); - return emptyMap; -} - -+ (ASIntegerMap *)mapForUpdateWithOldCount:(NSInteger)oldCount deleted:(NSIndexSet *)deletions inserted:(NSIndexSet *)insertions NS_RETURNS_RETAINED -{ - if (oldCount == 0) { - return ASIntegerMap.emptyMap; - } - - if (deletions.count == 0 && insertions.count == 0) { - return ASIntegerMap.identityMap; - } - - ASIntegerMap *result = [[ASIntegerMap alloc] init]; - // Start with the old indexes - NSMutableIndexSet *indexes = [NSMutableIndexSet indexSetWithIndexesInRange:NSMakeRange(0, oldCount)]; - - // Descending order, shift deleted ranges left - [deletions enumerateRangesWithOptions:NSEnumerationReverse usingBlock:^(NSRange range, BOOL * _Nonnull stop) { - [indexes shiftIndexesStartingAtIndex:NSMaxRange(range) by:-range.length]; - }]; - - // Ascending order, shift inserted ranges right - [insertions enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - [indexes shiftIndexesStartingAtIndex:range.location by:range.length]; - }]; - - __block NSInteger oldIndex = 0; - [indexes enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - // Note we advance oldIndex unconditionally, not newIndex - for (NSInteger newIndex = range.location; newIndex < NSMaxRange(range); oldIndex++) { - if ([deletions containsIndex:oldIndex]) { - // index was deleted, do nothing, just let oldIndex advance. - } else { - // assign the next index for this item. - result->_map[oldIndex] = newIndex++; - } - } - }]; - return result; -} - -- (NSInteger)integerForKey:(NSInteger)key -{ - if (_isIdentity) { - return key; - } else if (_isEmpty) { - return NSNotFound; - } - - const auto result = _map.find(key); - return result != _map.end() ? result->second : NSNotFound; -} - -- (void)setInteger:(NSInteger)value forKey:(NSInteger)key -{ - if (_immutable) { - ASDisplayNodeFailAssert(@"Cannot mutate special integer map: %@", self); - return; - } - - _map[key] = value; -} - -- (ASIntegerMap *)inverseMap -{ - if (_isIdentity || _isEmpty) { - return self; - } - - const auto result = [[ASIntegerMap alloc] init]; - - for (const auto &e : _map) { - result->_map[e.second] = e.first; - } - return result; -} - -#pragma mark - NSCopying - -- (id)copyWithZone:(NSZone *)zone -{ - if (_immutable) { - return self; - } - - const auto newMap = [[ASIntegerMap allocWithZone:zone] init]; - newMap->_map = _map; - return newMap; -} - -#pragma mark - Description - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - - if (_isIdentity) { - [result addObject:@{ @"map": @"" }]; - } else if (_isEmpty) { - [result addObject:@{ @"map": @"" }]; - } else { - // { 1->2 3->4 5->6 } - NSMutableString *str = [NSMutableString string]; - for (const auto &e : _map) { - [str appendFormat:@" %ld->%ld", (long)e.first, (long)e.second]; - } - // Remove leading space - if (str.length > 0) { - [str deleteCharactersInRange:NSMakeRange(0, 1)]; - } - [result addObject:@{ @"map": str }]; - } - - return result; -} - -- (NSString *)description -{ - return ASObjectDescriptionMakeWithoutObject([self propertiesForDescription]); -} - -- (BOOL)isEqual:(id)object -{ - if ([super isEqual:object]) { - return YES; - } - - if (ASIntegerMap *otherMap = ASDynamicCast(object, ASIntegerMap)) { - return otherMap->_map == _map; - } - return NO; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASLayoutController.h b/Example/Pods/Texture/Source/Details/ASLayoutController.h deleted file mode 100644 index d0e2f609..00000000 --- a/Example/Pods/Texture/Source/Details/ASLayoutController.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// ASLayoutController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionElement, ASElementMap; - -struct ASDirectionalScreenfulBuffer { - CGFloat positiveDirection; // Positive relative to iOS Core Animation layer coordinate space. - CGFloat negativeDirection; -}; -typedef struct ASDirectionalScreenfulBuffer ASDirectionalScreenfulBuffer; - -@protocol ASLayoutController - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -- (NSHashTable *)elementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType map:(ASElementMap *)map; - -- (void)allElementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSHashTable * _Nullable * _Nullable)displaySet preloadSet:(NSHashTable * _Nullable * _Nullable)preloadSet map:(ASElementMap *)map; - -@optional - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASLayoutRangeType.h b/Example/Pods/Texture/Source/Details/ASLayoutRangeType.h deleted file mode 100644 index 1a60e29d..00000000 --- a/Example/Pods/Texture/Source/Details/ASLayoutRangeType.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// ASLayoutRangeType.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -typedef struct { - CGFloat leadingBufferScreenfuls; - CGFloat trailingBufferScreenfuls; -} ASRangeTuningParameters; - -ASDK_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero; - -ASDK_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs); - -/** - * Each mode has a complete set of tuning parameters for range types. - * Depending on some conditions (including interface state and direction of the scroll view, state of rendering engine, etc), - * a range controller can choose which mode it should use at a given time. - */ -typedef NS_ENUM(char, ASLayoutRangeMode) { - ASLayoutRangeModeUnspecified = -1, - - /** - * Minimum mode is used when a range controller should limit the amount of work it performs. - * Thus, fewer views/layers are created and less data is fetched, saving system resources. - * Range controller can automatically switch to full mode when conditions change. - */ - ASLayoutRangeModeMinimum = 0, - - /** - * Normal/Full mode that a range controller uses to provide the best experience for end users. - * This mode is usually used for an active scroll view. - * A range controller under this requires more resources compare to minimum mode. - */ - ASLayoutRangeModeFull, - - /** - * Visible Only mode is used when a range controller should set its display and preload regions to only the size of their bounds. - * This causes all additional backing stores & preloaded data to be released, while ensuring a user revisiting the view will - * still be able to see the expected content. This mode is automatically set on all ASRangeControllers when the app suspends, - * allowing the operating system to keep the app alive longer and increase the chance it is still warm when the user returns. - */ - ASLayoutRangeModeVisibleOnly, - - /** - * Low Memory mode is used when a range controller should discard ALL graphics buffers, including for the area that would be visible - * the next time the user views it (bounds). The only range it preserves is Preload, which is limited to the bounds, allowing - * the content to be restored relatively quickly by re-decoding images (the compressed images are ~10% the size of the decoded ones, - * and text is a tiny fraction of its rendered size). - */ - ASLayoutRangeModeLowMemory -}; - -static NSInteger const ASLayoutRangeModeCount = 4; - -typedef NS_ENUM(NSInteger, ASLayoutRangeType) { - ASLayoutRangeTypeDisplay, - ASLayoutRangeTypePreload -}; - -static NSInteger const ASLayoutRangeTypeCount = 2; diff --git a/Example/Pods/Texture/Source/Details/ASMainSerialQueue.h b/Example/Pods/Texture/Source/Details/ASMainSerialQueue.h deleted file mode 100644 index 405164f7..00000000 --- a/Example/Pods/Texture/Source/Details/ASMainSerialQueue.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASMainSerialQueue.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -AS_SUBCLASSING_RESTRICTED -@interface ASMainSerialQueue : NSObject - -@property (nonatomic, readonly) NSUInteger numberOfScheduledBlocks; -- (void)performBlockOnMainThread:(dispatch_block_t)block; - -@end diff --git a/Example/Pods/Texture/Source/Details/ASMainSerialQueue.mm b/Example/Pods/Texture/Source/Details/ASMainSerialQueue.mm deleted file mode 100644 index ba2c7434..00000000 --- a/Example/Pods/Texture/Source/Details/ASMainSerialQueue.mm +++ /dev/null @@ -1,76 +0,0 @@ -// -// ASMainSerialQueue.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -@interface ASMainSerialQueue () -{ - AS::Mutex _serialQueueLock; - std::queue _blocks; -} - -@end - -@implementation ASMainSerialQueue - -- (NSUInteger)numberOfScheduledBlocks -{ - AS::MutexLocker l(_serialQueueLock); - return _blocks.size(); -} - -- (void)performBlockOnMainThread:(dispatch_block_t)block -{ - { - AS::MutexLocker l(_serialQueueLock); - _blocks.push(block); - } - - [self runBlocks]; -} - -- (void)runBlocks -{ - dispatch_block_t mainThread = ^{ - AS::UniqueLock l(self->_serialQueueLock); - do { - if (self->_blocks.empty()) { - break; - } - dispatch_block_t block = self->_blocks.front(); - self->_blocks.pop(); - { - l.unlock(); - block(); - l.lock(); - } - } while (true); - }; - - ASPerformBlockOnMainThread(mainThread); -} - -- (NSString *)description -{ - NSString *desc = [super description]; - std::queue blocks = _blocks; - [desc stringByAppendingString:@" Blocks: "]; - while (!blocks.empty()) { - dispatch_block_t block = blocks.front(); - [desc stringByAppendingFormat:@"%@", block]; - blocks.pop(); - } - return desc; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.h b/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.h deleted file mode 100644 index d531549a..00000000 --- a/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASMutableAttributedStringBuilder.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/* - * Use this class to compose new attributed strings. You may use the normal - * attributed string calls on this the same way you would on a normal mutable - * attributed string, but it coalesces your changes into transactions on the - * actual string allowing improvements in performance. - * - * @discussion This is a use-once and throw away class for each string you make. - * Since this class is designed for increasing performance, we actually hand - * back the internally managed mutable attributed string in the - * `composedAttributedString` call. So once you make that call, any more - * changes will actually modify the string that was handed back to you in that - * method. - * - * Combination of multiple calls into single attribution is managed through - * merging of attribute dictionaries over ranges. For best performance, call - * collections of attributions over a single range together. So for instance, - * don't call addAttributes for range1, then range2, then range1 again. Group - * them together so you call addAttributes for both range1 together, and then - * range2. - * - * Also please note that switching between addAttribute and setAttributes in the - * middle of composition is a bad idea for performance because they have - * semantically different meanings, and trigger a commit of the pending - * attributes. - * - * Please note that ALL of the standard NSString methods are left unimplemented. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASMutableAttributedStringBuilder : NSMutableAttributedString - -- (instancetype)initWithString:(NSString *)str attributes:(nullable NSDictionary *)attrs; -- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr; - -- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str; -- (void)setAttributes:(nullable NSDictionary *)attrs range:(NSRange)range; - -- (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range; -- (void)addAttributes:(NSDictionary *)attrs range:(NSRange)range; -- (void)removeAttribute:(NSString *)name range:(NSRange)range; - -- (void)replaceCharactersInRange:(NSRange)range withAttributedString:(NSAttributedString *)attrString; -- (void)insertAttributedString:(NSAttributedString *)attrString atIndex:(NSUInteger)loc; -- (void)appendAttributedString:(NSAttributedString *)attrString; -- (void)deleteCharactersInRange:(NSRange)range; -- (void)setAttributedString:(NSAttributedString *)attrString; - -- (NSMutableAttributedString *)composedAttributedString; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.mm b/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.mm deleted file mode 100644 index b393fe11..00000000 --- a/Example/Pods/Texture/Source/Details/ASMutableAttributedStringBuilder.mm +++ /dev/null @@ -1,254 +0,0 @@ -// -// ASMutableAttributedStringBuilder.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation ASMutableAttributedStringBuilder { - // Flag for the type of the current transaction (set or add) - BOOL _setRange; - // The range over which the currently pending transaction will occur - NSRange _pendingRange; - // The actual attribute dictionary that is being composed - NSMutableDictionary *_pendingRangeAttributes; - NSMutableAttributedString *_attrStr; - - // We delay initialization of the _attrStr until we need to - NSString *_initString; -} - -- (instancetype)init -{ - if (self = [super init]) { - _attrStr = [[NSMutableAttributedString alloc] init]; - _pendingRange.location = NSNotFound; - } - return self; -} - -- (instancetype)initWithString:(NSString *)str -{ - return [self initWithString:str attributes:@{}]; -} - -- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary *)attrs -{ - if (self = [super init]) { - // We cache this in an ivar that we can lazily construct the attributed - // string with when we get to a forced commit point. - _initString = str; - // Triggers a creation of the _pendingRangeAttributes dictionary which then - // is filled with entries from the given attrs dict. - [[self _pendingRangeAttributes] addEntriesFromDictionary:attrs]; - _setRange = NO; - _pendingRange = NSMakeRange(0, _initString.length); - } - return self; -} - -- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr -{ - if (self = [super init]) { - _attrStr = [[NSMutableAttributedString alloc] initWithAttributedString:attrStr]; - _pendingRange.location = NSNotFound; - } - return self; -} - -- (NSMutableAttributedString *)_attributedString -{ - if (_attrStr == nil && _initString != nil) { - // We can lazily construct the attributed string if it hasn't already been - // created with the existing pending attributes. This is significantly - // faster if more attributes are added after initializing this instance - // and the new attributions are for the entire string anyway. - _attrStr = [[NSMutableAttributedString alloc] initWithString:_initString attributes:_pendingRangeAttributes]; - _pendingRangeAttributes = nil; - _pendingRange.location = NSNotFound; - _initString = nil; - } - - return _attrStr; -} - -#pragma mark - Pending attribution - -- (NSMutableDictionary *)_pendingRangeAttributes -{ - // Lazy dictionary creation. Call this if you want to force initialization, - // otherwise just use the ivar. - if (_pendingRangeAttributes == nil) { - _pendingRangeAttributes = [[NSMutableDictionary alloc] init]; - } - return _pendingRangeAttributes; -} - -- (void)_applyPendingRangeAttributions -{ - if (_attrStr == nil) { - // Trigger its creation if it doesn't exist. - [self _attributedString]; - } - - if (_pendingRangeAttributes.count == 0) { - return; - } - - if (_pendingRange.location == NSNotFound) { - return; - } - - if (_setRange) { - [[self _attributedString] setAttributes:_pendingRangeAttributes range:_pendingRange]; - } else { - [[self _attributedString] addAttributes:_pendingRangeAttributes range:_pendingRange]; - } - _pendingRangeAttributes = nil; - _pendingRange.location = NSNotFound; -} - -#pragma mark - Editing - -- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] replaceCharactersInRange:range withString:str]; -} - -- (void)replaceCharactersInRange:(NSRange)range withAttributedString:(NSAttributedString *)attrString -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] replaceCharactersInRange:range withAttributedString:attrString]; -} - -- (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range -{ - if (_setRange) { - [self _applyPendingRangeAttributions]; - _setRange = NO; - } - - if (!NSEqualRanges(_pendingRange, range)) { - [self _applyPendingRangeAttributions]; - _pendingRange = range; - } - - NSMutableDictionary *pendingAttributes = [self _pendingRangeAttributes]; - pendingAttributes[name] = value; -} - -- (void)addAttributes:(NSDictionary *)attrs range:(NSRange)range -{ - if (_setRange) { - [self _applyPendingRangeAttributions]; - _setRange = NO; - } - - if (!NSEqualRanges(_pendingRange, range)) { - [self _applyPendingRangeAttributions]; - _pendingRange = range; - } - - NSMutableDictionary *pendingAttributes = [self _pendingRangeAttributes]; - [pendingAttributes addEntriesFromDictionary:attrs]; -} - -- (void)insertAttributedString:(NSAttributedString *)attrString atIndex:(NSUInteger)loc -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] insertAttributedString:attrString atIndex:loc]; -} - -- (void)appendAttributedString:(NSAttributedString *)attrString -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] appendAttributedString:attrString]; -} - -- (void)deleteCharactersInRange:(NSRange)range -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] deleteCharactersInRange:range]; -} - -- (void)setAttributedString:(NSAttributedString *)attrString -{ - [self _applyPendingRangeAttributions]; - [[self _attributedString] setAttributedString:attrString]; -} - -- (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range -{ - if (!_setRange) { - [self _applyPendingRangeAttributions]; - _setRange = YES; - } - - if (!NSEqualRanges(_pendingRange, range)) { - [self _applyPendingRangeAttributions]; - _pendingRange = range; - } - - NSMutableDictionary *pendingAttributes = [self _pendingRangeAttributes]; - [pendingAttributes addEntriesFromDictionary:attrs]; -} - -- (void)removeAttribute:(NSString *)name range:(NSRange)range -{ - // This call looks like the other set/add functions, but in order for this - // function to perform as advertised we MUST first add the attributes we - // currently have pending. - [self _applyPendingRangeAttributions]; - - [[self _attributedString] removeAttribute:name range:range]; -} - -#pragma mark - Output - -- (NSMutableAttributedString *)composedAttributedString -{ - if (_pendingRangeAttributes.count > 0) { - [self _applyPendingRangeAttributions]; - } - return [self _attributedString]; -} - -#pragma mark - Forwarding - -- (NSUInteger)length -{ - // If we just want a length call, no need to lazily construct the attributed string - return _attrStr ? _attrStr.length : _initString.length; -} - -- (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range -{ - return [[self _attributedString] attributesAtIndex:location effectiveRange:range]; -} - -- (NSString *)string -{ - return _attrStr ? _attrStr.string : _initString; -} - -- (NSMutableString *)mutableString -{ - return [[self _attributedString] mutableString]; -} - -- (void)beginEditing -{ - [[self _attributedString] beginEditing]; -} - -- (void)endEditing -{ - [[self _attributedString] endEditing]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.h b/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.h deleted file mode 100644 index beaf889a..00000000 --- a/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASObjectDescriptionHelpers.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASDebugNameProvider - -@required -/** - * @abstract Name that is printed by ascii art string and displayed in description. - */ -@property (nullable, nonatomic, copy) NSString *debugName; - -@end - -/** - * Your base class should conform to this and override `-debugDescription` - * to call `[self propertiesForDebugDescription]` and use `ASObjectDescriptionMake` - * to return a string. Subclasses of this base class just need to override - * `propertiesForDebugDescription`, call super, and modify the result as needed. - */ -@protocol ASDebugDescriptionProvider -@required -- (NSMutableArray *)propertiesForDebugDescription; -@end - -/** - * Your base class should conform to this and override `-description` - * to call `[self propertiesForDescription]` and use `ASObjectDescriptionMake` - * to return a string. Subclasses of this base class just need to override - * `propertiesForDescription`, call super, and modify the result as needed. - */ -@protocol ASDescriptionProvider -@required -- (NSMutableArray *)propertiesForDescription; -@end - -ASDK_EXTERN NSString *ASGetDescriptionValueString(id object); - -/// Useful for structs etc. Returns e.g. { position = (0 0); frame = (0 0; 50 50) } -ASDK_EXTERN NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups); - -/// Returns e.g. -ASDK_EXTERN NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray * _Nullable propertyGroups); - -/** - * Returns e.g. - * - * Note: `object` param is autoreleasing so that this function is dealloc-safe. - * No, unsafe_unretained isn't acceptable here – the optimizer may deallocate object early. - */ -ASDK_EXTERN NSString *ASObjectDescriptionMakeTiny(__autoreleasing id _Nullable object); - -ASDK_EXTERN NSString * _Nullable ASStringWithQuotesIfMultiword(NSString * _Nullable string); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.mm b/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.mm deleted file mode 100644 index e0b7c21f..00000000 --- a/Example/Pods/Texture/Source/Details/ASObjectDescriptionHelpers.mm +++ /dev/null @@ -1,104 +0,0 @@ -// -// ASObjectDescriptionHelpers.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -NSString *ASGetDescriptionValueString(id object) -{ - if ([object isKindOfClass:[NSValue class]]) { - // Use shortened NSValue descriptions - NSValue *value = object; - const char *type = value.objCType; - - if (strcmp(type, @encode(CGRect)) == 0) { - CGRect rect = [value CGRectValue]; - return [NSString stringWithFormat:@"(%g %g; %g %g)", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height]; - } else if (strcmp(type, @encode(CGSize)) == 0) { - return NSStringFromCGSize(value.CGSizeValue); - } else if (strcmp(type, @encode(CGPoint)) == 0) { - return NSStringFromCGPoint(value.CGPointValue); - } - - } else if ([object isKindOfClass:[NSIndexSet class]]) { - return [object as_smallDescription]; - } else if ([object isKindOfClass:[NSIndexPath class]]) { - // index paths like (0, 7) - NSIndexPath *indexPath = object; - NSMutableArray *strings = [NSMutableArray array]; - for (NSUInteger i = 0; i < indexPath.length; i++) { - [strings addObject:[NSString stringWithFormat:@"%lu", (unsigned long)[indexPath indexAtPosition:i]]]; - } - return [NSString stringWithFormat:@"(%@)", [strings componentsJoinedByString:@", "]]; - } else if ([object respondsToSelector:@selector(componentsJoinedByString:)]) { - // e.g. "[ ]" - return [NSString stringWithFormat:@"[ %@ ]", [object componentsJoinedByString:@" "]]; - } - return [object description]; -} - -NSString *_ASObjectDescriptionMakePropertyList(NSArray * _Nullable propertyGroups) -{ - NSMutableArray *components = [NSMutableArray array]; - for (NSDictionary *properties in propertyGroups) { - [properties enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) { - NSString *str; - if (key == (id)kCFNull) { - str = ASGetDescriptionValueString(obj); - } else { - str = [NSString stringWithFormat:@"%@ = %@", key, ASGetDescriptionValueString(obj)]; - } - [components addObject:str]; - }]; - } - return [components componentsJoinedByString:@"; "]; -} - -NSString *ASObjectDescriptionMakeWithoutObject(NSArray * _Nullable propertyGroups) -{ - return [NSString stringWithFormat:@"{ %@ }", _ASObjectDescriptionMakePropertyList(propertyGroups)]; -} - -NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray *propertyGroups) -{ - if (object == nil) { - return @"(null)"; - } - - NSMutableString *str = [NSMutableString stringWithFormat:@"<%s: %p", object_getClassName(object), object]; - - NSString *propList = _ASObjectDescriptionMakePropertyList(propertyGroups); - if (propList.length > 0) { - [str appendFormat:@"; %@", propList]; - } - [str appendString:@">"]; - return str; -} - -NSString *ASObjectDescriptionMakeTiny(__autoreleasing id object) { - static constexpr int kBufSize = 64; - char buf[kBufSize]; - int len = snprintf(buf, kBufSize, "<%s: %p>", object_getClassName(object), object); - return (__bridge_transfer NSString *)CFStringCreateWithBytes(NULL, (const UInt8 *)buf, len, kCFStringEncodingASCII, false); -} - -NSString *ASStringWithQuotesIfMultiword(NSString *string) { - if (string == nil) { - return nil; - } - - if ([string rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) { - return [NSString stringWithFormat:@"\"%@\"", string]; - } else { - return string; - } -} diff --git a/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.h b/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.h deleted file mode 100644 index cbbe8574..00000000 --- a/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.h +++ /dev/null @@ -1,80 +0,0 @@ -// -// ASPINRemoteImageDownloader.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_PIN_REMOTE_IMAGE - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class PINRemoteImageManager; -@protocol PINRemoteImageCaching; - -@interface ASPINRemoteImageDownloader : NSObject - -/** - * A shared image downloader which can be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes. - * The userInfo provided by this downloader is an instance of `PINRemoteImageManagerResult`. - * - * This is the default downloader used by network backed image nodes if PINRemoteImage and PINCache are - * available. It uses PINRemoteImage's features to provide caching and progressive image downloads. - */ -+ (ASPINRemoteImageDownloader *)sharedDownloader NS_RETURNS_RETAINED; - -/** - * Sets the default NSURLSessionConfiguration that will be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes - * while loading images off the network. This must be specified early in the application lifecycle before - * `sharedDownloader` is accessed. - * - * @param configuration The session configuration that will be used by `sharedDownloader` - * - */ -+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration; - -/** - * Sets the default NSURLSessionConfiguration that will be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes - * while loading images off the network. This must be specified early in the application lifecycle before - * `sharedDownloader` is accessed. - * - * @param configuration The session configuration that will be used by `sharedDownloader` - * @param imageCache The cache to be used by PINRemoteImage - nil will set up a default cache: PINCache - * if it is available, PINRemoteImageBasicCache (NSCache) if not. - * - */ -+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration - imageCache:(nullable id)imageCache; - -/** - * Sets a custom preconfigured PINRemoteImageManager that will be used by @c ASNetworkImageNodes and @c ASMultiplexImageNodes - * while loading images off the network. This must be specified early in the application lifecycle before - * `sharedDownloader` is accessed. - * - * @param preconfiguredPINRemoteImageManager The preconfigured remote image manager that will be used by `sharedDownloader` - */ -+ (void)setSharedPreconfiguredRemoteImageManager:(PINRemoteImageManager *)preconfiguredPINRemoteImageManager; - -/** - * The shared instance of a @c PINRemoteImageManager used by all @c ASPINRemoteImageDownloaders - * - * @discussion you can use this method to access the shared manager. This is useful to share a cache - * and resources if you need to download images outside of an @c ASNetworkImageNode or - * @c ASMultiplexImageNode. It's also useful to access the memoryCache and diskCache to set limits - * or handle authentication challenges. - * - * @return An instance of a @c PINRemoteImageManager - */ -- (PINRemoteImageManager *)sharedPINRemoteImageManager; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.mm b/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.mm deleted file mode 100644 index 8576cc7d..00000000 --- a/Example/Pods/Texture/Source/Details/ASPINRemoteImageDownloader.mm +++ /dev/null @@ -1,398 +0,0 @@ -// -// ASPINRemoteImageDownloader.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_PIN_REMOTE_IMAGE -#import - -#import -#import -#import - -#if __has_include () -#define PIN_ANIMATED_AVAILABLE 1 -#import -#import -#else -#define PIN_ANIMATED_AVAILABLE 0 -#endif - -#if __has_include() -#define PIN_WEBP_AVAILABLE 1 -#else -#define PIN_WEBP_AVAILABLE 0 -#endif - -#import -#import -#import - -static inline PINRemoteImageManagerPriority PINRemoteImageManagerPriorityWithASImageDownloaderPriority(ASImageDownloaderPriority priority) { - switch (priority) { - case ASImageDownloaderPriorityPreload: - return PINRemoteImageManagerPriorityLow; - - case ASImageDownloaderPriorityImminent: - return PINRemoteImageManagerPriorityDefault; - - case ASImageDownloaderPriorityVisible: - return PINRemoteImageManagerPriorityHigh; - } -} - -#if PIN_ANIMATED_AVAILABLE - -@interface ASPINRemoteImageDownloader () -@end - -@interface PINCachedAnimatedImage (ASPINRemoteImageDownloader) -@end - -@implementation PINCachedAnimatedImage (ASPINRemoteImageDownloader) - -- (BOOL)isDataSupported:(NSData *)data -{ - if ([data pin_isGIF]) { - return YES; - } -#if PIN_WEBP_AVAILABLE - else if ([data pin_isAnimatedWebP]) { - return YES; - } -#endif - return NO; -} - -@end -#endif - -// Declare two key methods on PINCache objects, avoiding a direct dependency on PINCache.h -@protocol ASPINCache -- (id)diskCache; -@end - -@protocol ASPINDiskCache -@property NSUInteger byteLimit; -@end - -@interface ASPINRemoteImageManager : PINRemoteImageManager -@end - -@implementation ASPINRemoteImageManager - -//Share image cache with sharedImageManager image cache. -+ (id )defaultImageCache -{ - static dispatch_once_t onceToken; - static id cache = nil; - dispatch_once(&onceToken, ^{ - cache = [[PINRemoteImageManager sharedImageManager] cache]; - if ([cache respondsToSelector:@selector(diskCache)]) { - id diskCache = [(id )cache diskCache]; - if ([diskCache respondsToSelector:@selector(setByteLimit:)]) { - // Set a default byteLimit. PINCache recently implemented a 50MB default (PR #201). - // Ensure that older versions of PINCache also have a byteLimit applied. - // NOTE: Using 20MB limit while large cache initialization is being optimized (Issue #144). - ((id )diskCache).byteLimit = 20 * 1024 * 1024; - } - } - }); - return cache; -} - -@end - -static ASPINRemoteImageDownloader *sharedDownloader = nil; -static PINRemoteImageManager *sharedPINRemoteImageManager = nil; - -@interface ASPINRemoteImageDownloader () -@end - -@implementation ASPINRemoteImageDownloader - -+ (ASPINRemoteImageDownloader *)sharedDownloader NS_RETURNS_RETAINED -{ - static dispatch_once_t onceToken = 0; - dispatch_once(&onceToken, ^{ - sharedDownloader = [[ASPINRemoteImageDownloader alloc] init]; - }); - return sharedDownloader; -} - -+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration -{ - NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured."); - PINRemoteImageManager *sharedManager = [self PINRemoteImageManagerWithConfiguration:configuration imageCache:nil]; - [self setSharedPreconfiguredRemoteImageManager:sharedManager]; -} - -+ (void)setSharedImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration - imageCache:(nullable id)imageCache -{ - NSAssert(sharedDownloader == nil, @"Singleton has been created and session can no longer be configured."); - PINRemoteImageManager *sharedManager = [self PINRemoteImageManagerWithConfiguration:configuration imageCache:imageCache]; - [self setSharedPreconfiguredRemoteImageManager:sharedManager]; -} - -static dispatch_once_t shared_init_predicate; - -+ (void)setSharedPreconfiguredRemoteImageManager:(PINRemoteImageManager *)preconfiguredPINRemoteImageManager -{ - NSAssert(preconfiguredPINRemoteImageManager != nil, @"setSharedPreconfiguredRemoteImageManager requires a non-nil parameter"); - NSAssert1(sharedPINRemoteImageManager == nil, @"An instance of %@ has been set. Either configuration or preconfigured image manager can be set at a time and only once.", [[sharedPINRemoteImageManager class] description]); - - dispatch_once(&shared_init_predicate, ^{ - sharedPINRemoteImageManager = preconfiguredPINRemoteImageManager; - }); -} - -+ (PINRemoteImageManager *)PINRemoteImageManagerWithConfiguration:(nullable NSURLSessionConfiguration *)configuration imageCache:(nullable id)imageCache -{ - PINRemoteImageManager *manager = nil; -#if DEBUG - // Check that Carthage users have linked both PINRemoteImage & PINCache by testing for one file each - if (!(NSClassFromString(@"PINRemoteImageManager"))) { - NSException *e = [NSException - exceptionWithName:@"FrameworkSetupException" - reason:@"Missing the path to the PINRemoteImage framework." - userInfo:nil]; - @throw e; - } - if (!(NSClassFromString(@"PINCache"))) { - NSException *e = [NSException - exceptionWithName:@"FrameworkSetupException" - reason:@"Missing the path to the PINCache framework." - userInfo:nil]; - @throw e; - } -#endif -#if PIN_ANIMATED_AVAILABLE - manager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration - alternativeRepresentationProvider:[self sharedDownloader] - imageCache:imageCache]; -#else - manager = [[ASPINRemoteImageManager alloc] initWithSessionConfiguration:configuration - alternativeRepresentationProvider:nil - imageCache:imageCache]; -#endif - return manager; -} - -- (PINRemoteImageManager *)sharedPINRemoteImageManager -{ - dispatch_once(&shared_init_predicate, ^{ - sharedPINRemoteImageManager = [ASPINRemoteImageDownloader PINRemoteImageManagerWithConfiguration:nil imageCache:nil]; - }); - return sharedPINRemoteImageManager; -} - -- (BOOL)sharedImageManagerSupportsMemoryRemoval -{ - static BOOL sharedImageManagerSupportsMemoryRemoval = NO; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedImageManagerSupportsMemoryRemoval = [[[self sharedPINRemoteImageManager] cache] respondsToSelector:@selector(removeObjectForKeyFromMemory:)]; - }); - return sharedImageManagerSupportsMemoryRemoval; -} - -#pragma mark ASImageProtocols - -#if PIN_ANIMATED_AVAILABLE -- (nullable id )animatedImageWithData:(NSData *)animatedImageData -{ - return [[PINCachedAnimatedImage alloc] initWithAnimatedImageData:animatedImageData]; -} -#endif - -- (id )synchronouslyFetchedCachedImageWithURL:(NSURL *)URL -{ - PINRemoteImageManager *manager = [self sharedPINRemoteImageManager]; - PINRemoteImageManagerResult *result = [manager synchronousImageFromCacheWithURL:URL processorKey:nil options:PINRemoteImageManagerDownloadOptionsSkipDecode]; - -#if PIN_ANIMATED_AVAILABLE - if (result.alternativeRepresentation) { - return result.alternativeRepresentation; - } -#endif - return result.image; -} - -- (void)cachedImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - completion:(ASImageCacherCompletion)completion -{ - [[self sharedPINRemoteImageManager] imageFromCacheWithURL:URL processorKey:nil options:PINRemoteImageManagerDownloadOptionsSkipDecode completion:^(PINRemoteImageManagerResult * _Nonnull result) { - [ASPINRemoteImageDownloader _performWithCallbackQueue:callbackQueue work:^{ - ASImageCacheType cacheType = (result.resultType == PINRemoteImageResultTypeMemoryCache ? ASImageCacheTypeSynchronous : ASImageCacheTypeAsynchronous); -#if PIN_ANIMATED_AVAILABLE - if (result.alternativeRepresentation) { - completion(result.alternativeRepresentation, cacheType); - } else { - completion(result.image, cacheType); - } -#else - completion(result.image, cacheType); -#endif - }]; - }]; -} - -- (void)clearFetchedImageFromCacheWithURL:(NSURL *)URL -{ - if ([self sharedImageManagerSupportsMemoryRemoval]) { - PINRemoteImageManager *manager = [self sharedPINRemoteImageManager]; - NSString *key = [manager cacheKeyForURL:URL processorKey:nil]; - [[manager cache] removeObjectForKeyFromMemory:key]; - } -} - -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion -{ - return [self downloadImageWithURL:URL - shouldRetry:shouldRetry - priority:ASImageDownloaderPriorityImminent // maps to default priority - callbackQueue:callbackQueue - downloadProgress:downloadProgress - completion:completion]; -} - -- (nullable id)downloadImageWithURL:(NSURL *)URL - shouldRetry:(BOOL)shouldRetry - priority:(ASImageDownloaderPriority)priority - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgress:(ASImageDownloaderProgress)downloadProgress - completion:(ASImageDownloaderCompletion)completion -{ - PINRemoteImageManagerPriority pi_priority = PINRemoteImageManagerPriorityWithASImageDownloaderPriority(priority); - - PINRemoteImageManagerProgressDownload progressDownload = ^(int64_t completedBytes, int64_t totalBytes) { - if (downloadProgress == nil) { return; } - - [ASPINRemoteImageDownloader _performWithCallbackQueue:callbackQueue work:^{ - downloadProgress(completedBytes / (CGFloat)totalBytes); - }]; - }; - - PINRemoteImageManagerImageCompletion imageCompletion = ^(PINRemoteImageManagerResult * _Nonnull result) { - [ASPINRemoteImageDownloader _performWithCallbackQueue:callbackQueue work:^{ -#if PIN_ANIMATED_AVAILABLE - if (result.alternativeRepresentation) { - completion(result.alternativeRepresentation, result.error, result.UUID, result); - } else { - completion(result.image, result.error, result.UUID, result); - } -#else - completion(result.image, result.error, result.UUID, result); -#endif - }]; - }; - - // add "IgnoreCache" option since we have a caching API so we already checked it, not worth checking again. - // PINRemoteImage is responsible for coalescing downloads, and even if it wasn't, the tiny probability of - // extra downloads isn't worth the effort of rechecking caches every single time. In order to provide - // feedback to the consumer about whether images are cached, we can't simply make the cache a no-op and - // check the cache as part of this download. - PINRemoteImageManagerDownloadOptions options = PINRemoteImageManagerDownloadOptionsSkipDecode | PINRemoteImageManagerDownloadOptionsIgnoreCache; - if (!shouldRetry) { - options |= PINRemoteImageManagerDownloadOptionsSkipRetry; - } - - return [[self sharedPINRemoteImageManager] downloadImageWithURL:URL - options:options - priority:pi_priority - progressImage:nil - progressDownload:progressDownload - completion:imageCompletion]; -} - -- (void)cancelImageDownloadForIdentifier:(id)downloadIdentifier -{ - ASDisplayNodeAssert([downloadIdentifier isKindOfClass:[NSUUID class]], @"downloadIdentifier must be NSUUID"); - [[self sharedPINRemoteImageManager] cancelTaskWithUUID:downloadIdentifier storeResumeData:NO]; -} - -- (void)cancelImageDownloadWithResumePossibilityForIdentifier:(id)downloadIdentifier -{ - ASDisplayNodeAssert([downloadIdentifier isKindOfClass:[NSUUID class]], @"downloadIdentifier must be NSUUID"); - [[self sharedPINRemoteImageManager] cancelTaskWithUUID:downloadIdentifier storeResumeData:YES]; -} - -- (void)setProgressImageBlock:(ASImageDownloaderProgressImage)progressBlock callbackQueue:(dispatch_queue_t)callbackQueue withDownloadIdentifier:(id)downloadIdentifier -{ - ASDisplayNodeAssert([downloadIdentifier isKindOfClass:[NSUUID class]], @"downloadIdentifier must be NSUUID"); - - if (progressBlock) { - [[self sharedPINRemoteImageManager] setProgressImageCallback:^(PINRemoteImageManagerResult * _Nonnull result) { - dispatch_async(callbackQueue, ^{ - progressBlock(result.image, result.renderedImageQuality, result.UUID); - }); - } ofTaskWithUUID:downloadIdentifier]; - } else { - [[self sharedPINRemoteImageManager] setProgressImageCallback:nil ofTaskWithUUID:downloadIdentifier]; - } -} - -- (void)setPriority:(ASImageDownloaderPriority)priority withDownloadIdentifier:(id)downloadIdentifier -{ - ASDisplayNodeAssert([downloadIdentifier isKindOfClass:[NSUUID class]], @"downloadIdentifier must be NSUUID"); - - PINRemoteImageManagerPriority pi_priority = PINRemoteImageManagerPriorityWithASImageDownloaderPriority(priority); - [[self sharedPINRemoteImageManager] setPriority:pi_priority ofTaskWithUUID:downloadIdentifier]; -} - -#pragma mark - PINRemoteImageManagerAlternateRepresentationProvider - -- (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageManagerDownloadOptions)options -{ -#if PIN_ANIMATED_AVAILABLE - if ([data pin_isAnimatedGIF]) { - return data; - } -#if PIN_WEBP_AVAILABLE - else if ([data pin_isAnimatedWebP]) { - return data; - } -#endif - -#endif - return nil; -} - -#pragma mark - Private - -/** - * If on main thread and queue is main, perform now. - * If queue is nil, assert and perform now. - * Otherwise, dispatch async to queue. - */ -+ (void)_performWithCallbackQueue:(dispatch_queue_t)queue work:(void (^)(void))work -{ - if (work == nil) { - // No need to assert here, really. We aren't expecting any feedback from this method. - return; - } - - if (ASDisplayNodeThreadIsMain() && queue == dispatch_get_main_queue()) { - work(); - } else if (queue == nil) { - ASDisplayNodeFailAssert(@"Callback queue should not be nil."); - work(); - } else { - dispatch_async(queue, work); - } -} - -@end -#endif diff --git a/Example/Pods/Texture/Source/Details/ASPageTable.h b/Example/Pods/Texture/Source/Details/ASPageTable.h deleted file mode 100644 index e9cd11a2..00000000 --- a/Example/Pods/Texture/Source/Details/ASPageTable.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// ASPageTable.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@class ASCollectionElement; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Represents x and y coordinates of a page. - */ -typedef uintptr_t ASPageCoordinate; - -/** - * Returns a page coordinate with the given x and y values. Both of them must be less than 65,535. - */ -ASDK_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) AS_WARN_UNUSED_RESULT; - -/** - * Returns coordinate of the page that contains the specified point. - * Similar to CGRectContainsPoint, a point is considered inside a page if its lie inside the page or on the minimum X or minimum Y edge. - * - * @param point The point that the page at the returned should contain. Any negative of the point will be corrected to 0.0 - * - * @param pageSize The size of each page. - */ -ASDK_EXTERN ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) AS_WARN_UNUSED_RESULT; - -ASDK_EXTERN uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT; - -ASDK_EXTERN uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT; - -ASDK_EXTERN CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) AS_WARN_UNUSED_RESULT; - -/** - * Returns coordinate pointers for pages that intersect the specified rect. For each pointer, use ASPageCoordinateFromPointer() to get the original coordinate. - * The specified rect is restricted to the bounds of a content rect that has an origin of {0, 0} and a size of the given contentSize. - * - * @param rect The rect intersecting the target pages. - * - * @param contentSize The combined size of all pages. - * - * @param pageSize The size of each page. - */ -ASDK_EXTERN NSPointerArray * _Nullable ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) AS_WARN_UNUSED_RESULT; - -/** - * An alias for an NSMapTable created to store objects using ASPageCoordinates as keys. - * - * You should not call -objectForKey:, -setObject:forKey:, or -removeObjectForKey: - * on these objects. - */ -typedef NSMapTable ASPageTable; - -/** - * A page to array of layout attributes table. - */ -typedef ASPageTable *> ASPageToLayoutAttributesTable; - -/** - * A category for creating & using map tables meant for storing objects using ASPage as keys. - */ -@interface NSMapTable (ASPageTableMethods) - -/** - * Creates a new page table with (NSMapTableStrongMemory | NSMapTableObjectPointerPersonality) for values. - */ -+ (ASPageTable *)pageTableForStrongObjectPointers NS_RETURNS_RETAINED; - -/** - * Creates a new page table with (NSMapTableWeakMemory | NSMapTableObjectPointerPersonality) for values. - */ -+ (ASPageTable *)pageTableForWeakObjectPointers NS_RETURNS_RETAINED; - -/** - * Builds a new page to layout attributes from the given layout attributes. - * - * @param layoutAttributesEnumerator The layout attributes to build from - * - * @param contentSize The combined size of all pages. - * - * @param pageSize The size of each page. - */ -+ (ASPageToLayoutAttributesTable *)pageTableWithLayoutAttributes:(id)layoutAttributesEnumerator contentSize:(CGSize)contentSize pageSize:(CGSize)pageSize NS_RETURNS_RETAINED; - -/** - * Retrieves the object for a given page, or nil if the page is not found. - * - * @param page A page to lookup the object for. - */ -- (nullable ObjectType)objectForPage:(ASPageCoordinate)page; - -/** - * Sets the given object for the associated page. - * - * @param object The object to store as value. - * - * @param page The page to use for the rect. - */ -- (void)setObject:(ObjectType)object forPage:(ASPageCoordinate)page; - -/** - * Removes the object for the given page, if one exists. - * - * @param page The page to remove. - */ -- (void)removeObjectForPage:(ASPageCoordinate)page; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASPageTable.mm b/Example/Pods/Texture/Source/Details/ASPageTable.mm deleted file mode 100644 index fde81083..00000000 --- a/Example/Pods/Texture/Source/Details/ASPageTable.mm +++ /dev/null @@ -1,147 +0,0 @@ -// -// ASPageTable.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) -{ - // Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable. - // To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**. - // But for API simplification, we enforce the same restriction to both values. - ASDisplayNodeCAssert(x < UINT16_MAX, @"x coordinate must be less than 65,535"); - ASDisplayNodeCAssert(y < UINT16_MAX, @"y coordinate must be less than 65,535"); - return (x << 16) + y + 1; -} - -ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) -{ - return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height)); -} - -uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) -{ - return (pageCoordinate - 1) >> 16; -} - -uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) -{ - return (pageCoordinate - 1) & ~(0xFFFF<<16); -} - -CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) -{ - CGFloat pageWidth = pageSize.width; - CGFloat pageHeight = pageSize.height; - return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight); -} - -NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) -{ - CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height); - // Make sure the specified rect is within contentRect - rect = CGRectIntersection(rect, contentRect); - if (CGRectIsNull(rect) || CGRectIsEmpty(rect)) { - return nil; - } - - NSPointerArray *result = [NSPointerArray pointerArrayWithOptions:(NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory)]; - - ASPageCoordinate minPage = ASPageCoordinateForPageThatContainsPoint(CGPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)), pageSize); - ASPageCoordinate maxPage = ASPageCoordinateForPageThatContainsPoint(CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)), pageSize); - if (minPage == maxPage) { - [result addPointer:(void *)minPage]; - return result; - } - - NSUInteger minX = ASPageCoordinateGetX(minPage); - NSUInteger minY = ASPageCoordinateGetY(minPage); - NSUInteger maxX = ASPageCoordinateGetX(maxPage); - NSUInteger maxY = ASPageCoordinateGetY(maxPage); - - for (NSUInteger x = minX; x <= maxX; x++) { - for (NSUInteger y = minY; y <= maxY; y++) { - ASPageCoordinate page = ASPageCoordinateMake(x, y); - [result addPointer:(void *)page]; - } - } - - return result; -} - -@implementation NSMapTable (ASPageTableMethods) - -+ (instancetype)pageTableWithValuePointerFunctions:(NSPointerFunctions *)valueFuncs NS_RETURNS_RETAINED -{ - static NSPointerFunctions *pageCoordinatesFuncs; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - pageCoordinatesFuncs = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory]; - }); - - return [[NSMapTable alloc] initWithKeyPointerFunctions:pageCoordinatesFuncs valuePointerFunctions:valueFuncs capacity:0]; -} - -+ (ASPageTable *)pageTableForStrongObjectPointers NS_RETURNS_RETAINED -{ - static NSPointerFunctions *strongObjectPointerFuncs; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - strongObjectPointerFuncs = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory]; - }); - return [self pageTableWithValuePointerFunctions:strongObjectPointerFuncs]; -} - -+ (ASPageTable *)pageTableForWeakObjectPointers NS_RETURNS_RETAINED -{ - static NSPointerFunctions *weakObjectPointerFuncs; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - weakObjectPointerFuncs = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsWeakMemory]; - }); - return [self pageTableWithValuePointerFunctions:weakObjectPointerFuncs]; -} - -+ (ASPageToLayoutAttributesTable *)pageTableWithLayoutAttributes:(id)layoutAttributesEnumerator contentSize:(CGSize)contentSize pageSize:(CGSize)pageSize NS_RETURNS_RETAINED -{ - ASPageToLayoutAttributesTable *result = [ASPageTable pageTableForStrongObjectPointers]; - for (UICollectionViewLayoutAttributes *attrs in layoutAttributesEnumerator) { - // This attrs may span multiple pages. Make sure it's registered to all of them - NSPointerArray *pages = ASPageCoordinatesForPagesThatIntersectRect(attrs.frame, contentSize, pageSize); - - for (id pagePtr in pages) { - ASPageCoordinate page = (ASPageCoordinate)pagePtr; - NSMutableArray *attrsInPage = [result objectForPage:page]; - if (attrsInPage == nil) { - attrsInPage = [[NSMutableArray alloc] init]; - [result setObject:attrsInPage forPage:page]; - } - [attrsInPage addObject:attrs]; - } - } - return result; -} - -- (id)objectForPage:(ASPageCoordinate)page -{ - unowned id key = (__bridge id)(void *)page; - return [self objectForKey:key]; -} - -- (void)setObject:(id)object forPage:(ASPageCoordinate)page -{ - unowned id key = (__bridge id)(void *)page; - [self setObject:object forKey:key]; -} - -- (void)removeObjectForPage:(ASPageCoordinate)page -{ - unowned id key = (__bridge id)(void *)page; - [self removeObjectForKey:key]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.h b/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.h deleted file mode 100644 index 90f04fa2..00000000 --- a/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// ASPhotosFrameworkImageRequest.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_USE_PHOTOS - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN NSString *const ASPhotosURLScheme; - -/** - @abstract Use ASPhotosFrameworkImageRequest to encapsulate all the information needed to request an image from - the Photos framework and store it in a URL. - */ -API_AVAILABLE(ios(8.0), tvos(10.0)) -@interface ASPhotosFrameworkImageRequest : NSObject - -- (instancetype)initWithAssetIdentifier:(NSString *)assetIdentifier NS_DESIGNATED_INITIALIZER; - -/** - @return A new image request deserialized from `url`, or nil if `url` is not a valid photos URL. - */ -+ (nullable ASPhotosFrameworkImageRequest *)requestWithURL:(NSURL *)url; - -/** - @abstract The asset identifier for this image request provided during initialization. - */ -@property (nonatomic, readonly) NSString *assetIdentifier; - -/** - @abstract The target size for this image request. Defaults to `PHImageManagerMaximumSize`. - */ -@property (nonatomic) CGSize targetSize; - -/** - @abstract The content mode for this image request. Defaults to `PHImageContentModeDefault`. - - @see `PHImageManager` - */ -@property (nonatomic) PHImageContentMode contentMode; - -/** - @abstract The options specified for this request. Default value is the result of `[PHImageRequestOptions new]`. - - @discussion Some properties of this object are ignored when converting this request into a URL. - As of iOS SDK 9.0, these properties are `progressHandler` and `synchronous`. - */ -@property (nonatomic) PHImageRequestOptions *options; - -/** - @return A new URL converted from this request. - */ -@property (nonatomic, readonly) NSURL *url; - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_USE_PHOTOS diff --git a/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.mm b/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.mm deleted file mode 100644 index ac1d4773..00000000 --- a/Example/Pods/Texture/Source/Details/ASPhotosFrameworkImageRequest.mm +++ /dev/null @@ -1,157 +0,0 @@ -// -// ASPhotosFrameworkImageRequest.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_USE_PHOTOS - -NSString *const ASPhotosURLScheme = @"ph"; - -static NSString *const _ASPhotosURLQueryKeyWidth = @"width"; -static NSString *const _ASPhotosURLQueryKeyHeight = @"height"; - -// value is PHImageContentMode value -static NSString *const _ASPhotosURLQueryKeyContentMode = @"contentmode"; - -// value is PHImageRequestOptionsResizeMode value -static NSString *const _ASPhotosURLQueryKeyResizeMode = @"resizemode"; - -// value is PHImageRequestOptionsDeliveryMode value -static NSString *const _ASPhotosURLQueryKeyDeliveryMode = @"deliverymode"; - -// value is PHImageRequestOptionsVersion value -static NSString *const _ASPhotosURLQueryKeyVersion = @"version"; - -// value is 0 or 1 -static NSString *const _ASPhotosURLQueryKeyAllowNetworkAccess = @"network"; - -static NSString *const _ASPhotosURLQueryKeyCropOriginX = @"crop_x"; -static NSString *const _ASPhotosURLQueryKeyCropOriginY = @"crop_y"; -static NSString *const _ASPhotosURLQueryKeyCropWidth = @"crop_w"; -static NSString *const _ASPhotosURLQueryKeyCropHeight = @"crop_h"; - -@implementation ASPhotosFrameworkImageRequest - -- (instancetype)initWithAssetIdentifier:(NSString *)assetIdentifier -{ - self = [super init]; - if (self) { - _assetIdentifier = assetIdentifier; - _options = [PHImageRequestOptions new]; - _contentMode = PHImageContentModeDefault; - _targetSize = PHImageManagerMaximumSize; - } - return self; -} - -#pragma mark NSCopying - -- (id)copyWithZone:(NSZone *)zone -{ - ASPhotosFrameworkImageRequest *copy = [[ASPhotosFrameworkImageRequest alloc] initWithAssetIdentifier:self.assetIdentifier]; - copy.options = [self.options copy]; - copy.targetSize = self.targetSize; - copy.contentMode = self.contentMode; - return copy; -} - -#pragma mark Converting to URL - -- (NSURL *)url -{ - NSURLComponents *comp = [NSURLComponents new]; - comp.scheme = ASPhotosURLScheme; - comp.host = _assetIdentifier; - NSMutableArray *queryItems = [NSMutableArray arrayWithObjects: - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyWidth value:@(_targetSize.width).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyHeight value:@(_targetSize.height).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyVersion value:@(_options.version).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyContentMode value:@(_contentMode).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyAllowNetworkAccess value:@(_options.networkAccessAllowed).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyResizeMode value:@(_options.resizeMode).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyDeliveryMode value:@(_options.deliveryMode).stringValue] - , nil]; - - CGRect cropRect = _options.normalizedCropRect; - if (!CGRectIsEmpty(cropRect)) { - [queryItems addObjectsFromArray:@[ - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyCropOriginX value:@(cropRect.origin.x).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyCropOriginY value:@(cropRect.origin.y).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyCropWidth value:@(cropRect.size.width).stringValue], - [NSURLQueryItem queryItemWithName:_ASPhotosURLQueryKeyCropHeight value:@(cropRect.size.height).stringValue] - ]]; - } - comp.queryItems = queryItems; - return comp.URL; -} - -#pragma mark Converting from URL - -+ (ASPhotosFrameworkImageRequest *)requestWithURL:(NSURL *)url -{ - // not a photos URL - if (![url.scheme isEqualToString:ASPhotosURLScheme]) { - return nil; - } - - NSURLComponents *comp = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; - - ASPhotosFrameworkImageRequest *request = [[ASPhotosFrameworkImageRequest alloc] initWithAssetIdentifier:url.host]; - - CGRect cropRect = CGRectZero; - CGSize targetSize = PHImageManagerMaximumSize; - for (NSURLQueryItem *item in comp.queryItems) { - if ([_ASPhotosURLQueryKeyAllowNetworkAccess isEqualToString:item.name]) { - request.options.networkAccessAllowed = item.value.boolValue; - } else if ([_ASPhotosURLQueryKeyWidth isEqualToString:item.name]) { - targetSize.width = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyHeight isEqualToString:item.name]) { - targetSize.height = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyContentMode isEqualToString:item.name]) { - request.contentMode = (PHImageContentMode)item.value.integerValue; - } else if ([_ASPhotosURLQueryKeyVersion isEqualToString:item.name]) { - request.options.version = (PHImageRequestOptionsVersion)item.value.integerValue; - } else if ([_ASPhotosURLQueryKeyCropOriginX isEqualToString:item.name]) { - cropRect.origin.x = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyCropOriginY isEqualToString:item.name]) { - cropRect.origin.y = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyCropWidth isEqualToString:item.name]) { - cropRect.size.width = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyCropHeight isEqualToString:item.name]) { - cropRect.size.height = item.value.doubleValue; - } else if ([_ASPhotosURLQueryKeyResizeMode isEqualToString:item.name]) { - request.options.resizeMode = (PHImageRequestOptionsResizeMode)item.value.integerValue; - } else if ([_ASPhotosURLQueryKeyDeliveryMode isEqualToString:item.name]) { - request.options.deliveryMode = (PHImageRequestOptionsDeliveryMode)item.value.integerValue; - } - } - request.targetSize = targetSize; - request.options.normalizedCropRect = cropRect; - return request; -} - -#pragma mark NSObject - -- (BOOL)isEqual:(id)object -{ - if (![object isKindOfClass:ASPhotosFrameworkImageRequest.class]) { - return NO; - } - ASPhotosFrameworkImageRequest *other = object; - return [other.assetIdentifier isEqualToString:self.assetIdentifier] && - other.contentMode == self.contentMode && - CGSizeEqualToSize(other.targetSize, self.targetSize) && - CGRectEqualToRect(other.options.normalizedCropRect, self.options.normalizedCropRect) && - other.options.resizeMode == self.options.resizeMode && - other.options.version == self.options.version; -} - -@end - -#endif // AS_USE_PHOTOS diff --git a/Example/Pods/Texture/Source/Details/ASRangeController.h b/Example/Pods/Texture/Source/Details/ASRangeController.h deleted file mode 100644 index 1ce29525..00000000 --- a/Example/Pods/Texture/Source/Details/ASRangeController.h +++ /dev/null @@ -1,202 +0,0 @@ -// -// ASRangeController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -#define ASRangeControllerLoggingEnabled 0 - -NS_ASSUME_NONNULL_BEGIN - -@class _ASHierarchyChangeSet; -@protocol ASRangeControllerDataSource; -@protocol ASRangeControllerDelegate; -@protocol ASLayoutController; - -/** - * Working range controller. - * - * Used internally by ASTableView and ASCollectionView. It is paired with ASDataController. - * It is designed to support custom scrolling containers as well. Observes the visible range, maintains - * "working ranges" to trigger network calls and rendering, and is responsible for driving asynchronous layout of cells. - * This includes cancelling those asynchronous operations as cells fall outside of the working ranges. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASRangeController : NSObject -{ - id _layoutController; - __weak id _dataSource; - __weak id _delegate; -} - -/** - * Notify the range controller that the visible range has been updated. - * This is the primary input call that drives updating the working ranges, and triggering their actions. - * The ranges will be updated in the next turn of the main loop, or when -updateIfNeeded is called. - * - * @see [ASRangeControllerDelegate rangeControllerVisibleNodeIndexPaths:] - */ -- (void)setNeedsUpdate; - -/** - * Update the ranges immediately, if -setNeedsUpdate has been called since the last update. - * This is useful because the ranges must be updated immediately after a cell is added - * into a table/collection to satisfy interface state API guarantees. - */ -- (void)updateIfNeeded; - -/** - * Force update the ranges immediately. - */ -- (void)updateRanges; - -/** - * Add the sized node for `indexPath` as a subview of `contentView`. - * - * @param contentView UIView to add a (sized) node's view to. - * - * @param node The cell node to be added. - */ -- (void)configureContentView:(UIView *)contentView forCellNode:(ASCellNode *)node; - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -// These methods call the corresponding method on each node, visiting each one that -// the range controller has set a non-default interface state on. -- (void)clearContents; -- (void)clearPreloadedData; - -/** - * An object that describes the layout behavior of the ranged component (table view, collection view, etc.) - * - * Used primarily for providing the current range of index paths and identifying when the - * range controller should invalidate its range. - */ -@property (nonatomic) id layoutController; - -/** - * The underlying data source for the range controller - */ -@property (nonatomic, weak) id dataSource; - -/** - * Delegate for handling range controller events. Must not be nil. - */ -@property (nonatomic, weak) id delegate; - -/** - * Property that indicates whether the scroll view for this range controller has ever changed its contentOffset. - */ -@property (nonatomic) BOOL contentHasBeenScrolled; - -@end - - -/** - * Data source for ASRangeController. - * - * Allows the range controller to perform external queries on the range. - * Ex. range nodes, visible index paths, and viewport size. - */ -@protocol ASRangeControllerDataSource - -/** - * @param rangeController Sender. - * - * @return an table of elements corresponding to the data currently visible onscreen (i.e., the visible range). - */ -- (nullable NSHashTable *)visibleElementsForRangeController:(ASRangeController *)rangeController; - -/** - * @param rangeController Sender. - * - * @return the current scroll direction of the view using this range controller. - */ -- (ASScrollDirection)scrollDirectionForRangeController:(ASRangeController *)rangeController; - -/** - * @param rangeController Sender. - * - * @return the ASInterfaceState of the node that this controller is powering. This allows nested range controllers - * to collaborate with one another, as an outer controller may set bits in .interfaceState such as Visible. - * If this controller is an orthogonally scrolling element, it waits until it is visible to preload outside the viewport. - */ -- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController; - -- (ASElementMap *)elementMapForRangeController:(ASRangeController *)rangeController; - -- (NSString *)nameForRangeControllerDataSource; - -@end - -/** - * Delegate for ASRangeController. - */ -@protocol ASRangeControllerDelegate - -/** - * Called to update with given change set. - * - * @param changeSet The change set that includes all updates - * - * @param updates The block that performs relevant data updates. - * - * @discussion The updates block must always be executed or the data controller will get into a bad state. - * It should be called at the time the backing view is ready to process the updates, - * i.e inside the updates block of `-[UICollectionView performBatchUpdates:completion:] or after calling `-[UITableView beginUpdates]`. - */ -- (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates; - -- (BOOL)rangeControllerShouldUpdateRanges:(ASRangeController *)rangeController; - -@end - -@interface ASRangeController (ASRangeControllerUpdateRangeProtocol) - -/** - * Update the range mode for a range controller to a explicitly set mode until the node that contains the range - * controller becomes visible again - * - * Logic for the automatic range mode: - * 1. If there are no visible node paths available nothing is to be done and no range update will happen - * 2. The initial range update if the range controller is visible always will be - * ASLayoutRangeModeMinimum as it's the initial fetch - * 3. The range mode set explicitly via updateCurrentRangeWithMode: will last at least one range update. After that it - the range controller will use the explicit set range mode until it becomes visible and a new range update was - triggered or a new range mode via updateCurrentRangeWithMode: is set - * 4. If range mode is not explicitly set the range mode is variying based if the range controller is visible or not - */ -- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode; - -@end - -@interface ASRangeController (DebugInternal) - -+ (void)layoutDebugOverlayIfNeeded; - -- (void)addRangeControllerToRangeDebugOverlay; - -- (void)updateRangeController:(ASRangeController *)controller - withScrollableDirections:(ASScrollDirection)scrollableDirections - scrollDirection:(ASScrollDirection)direction - rangeMode:(ASLayoutRangeMode)mode - displayTuningParameters:(ASRangeTuningParameters)displayTuningParameters - preloadTuningParameters:(ASRangeTuningParameters)preloadTuningParameters - interfaceState:(ASInterfaceState)interfaceState; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASRangeController.mm b/Example/Pods/Texture/Source/Details/ASRangeController.mm deleted file mode 100644 index 1dcd062a..00000000 --- a/Example/Pods/Texture/Source/Details/ASRangeController.mm +++ /dev/null @@ -1,663 +0,0 @@ -// -// ASRangeController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import // Required for interfaceState and hierarchyState setter methods. -#import -#import - -#import -#import -#import - -#define AS_RANGECONTROLLER_LOG_UPDATE_FREQ 0 - -#ifndef ASRangeControllerAutomaticLowMemoryHandling -#define ASRangeControllerAutomaticLowMemoryHandling 1 -#endif - -@interface ASRangeController () -{ - BOOL _rangeIsValid; - BOOL _needsRangeUpdate; - NSSet *_allPreviousIndexPaths; - NSHashTable *_visibleNodes; - ASLayoutRangeMode _currentRangeMode; - BOOL _contentHasBeenScrolled; - BOOL _preserveCurrentRangeMode; - BOOL _didRegisterForNodeDisplayNotifications; - CFTimeInterval _pendingDisplayNodesTimestamp; - - // If the user is not currently scrolling, we will keep our ranges - // configured to match their previous scroll direction. Defaults - // to [.right, .down] so that when the user first opens a screen - // the ranges point down into the content. - ASScrollDirection _previousScrollDirection; - -#if AS_RANGECONTROLLER_LOG_UPDATE_FREQ - NSUInteger _updateCountThisFrame; - CADisplayLink *_displayLink; -#endif -} - -@end - -static UIApplicationState __ApplicationState = UIApplicationStateActive; - -@implementation ASRangeController - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - _rangeIsValid = YES; - _currentRangeMode = ASLayoutRangeModeUnspecified; - _contentHasBeenScrolled = NO; - _preserveCurrentRangeMode = NO; - _previousScrollDirection = ASScrollDirectionDown | ASScrollDirectionRight; - - [[[self class] allRangeControllersWeakSet] addObject:self]; - -#if AS_RANGECONTROLLER_LOG_UPDATE_FREQ - _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_updateCountDisplayLinkDidFire)]; - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; -#endif - - if (ASDisplayNode.shouldShowRangeDebugOverlay) { - [self addRangeControllerToRangeDebugOverlay]; - } - - return self; -} - -- (void)dealloc -{ -#if AS_RANGECONTROLLER_LOG_UPDATE_FREQ - [_displayLink invalidate]; -#endif - - if (_didRegisterForNodeDisplayNotifications) { - [[NSNotificationCenter defaultCenter] removeObserver:self name:ASRenderingEngineDidDisplayScheduledNodesNotification object:nil]; - } -} - -#pragma mark - Core visible node range management API - -+ (BOOL)isFirstRangeUpdateForRangeMode:(ASLayoutRangeMode)rangeMode -{ - return (rangeMode == ASLayoutRangeModeUnspecified); -} - -+ (ASLayoutRangeMode)rangeModeForInterfaceState:(ASInterfaceState)interfaceState - currentRangeMode:(ASLayoutRangeMode)currentRangeMode -{ - BOOL isVisible = (ASInterfaceStateIncludesVisible(interfaceState)); - BOOL isFirstRangeUpdate = [self isFirstRangeUpdateForRangeMode:currentRangeMode]; - if (!isVisible || isFirstRangeUpdate) { - return ASLayoutRangeModeMinimum; - } - - return ASLayoutRangeModeFull; -} - -- (ASInterfaceState)interfaceState -{ - ASInterfaceState selfInterfaceState = ASInterfaceStateNone; - if (_dataSource) { - selfInterfaceState = [_dataSource interfaceStateForRangeController:self]; - } - if (__ApplicationState == UIApplicationStateBackground) { - // If the app is background, pretend to be invisible so that we inform each cell it is no longer being viewed by the user - selfInterfaceState &= ~(ASInterfaceStateVisible); - } - return selfInterfaceState; -} - -- (void)setNeedsUpdate -{ - if (!_needsRangeUpdate) { - _needsRangeUpdate = YES; - - __weak __typeof__(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf updateIfNeeded]; - }); - } -} - -- (void)updateIfNeeded -{ - if (_needsRangeUpdate) { - [self updateRanges]; - } -} - -- (void)updateRanges -{ - _needsRangeUpdate = NO; - [self _updateVisibleNodeIndexPaths]; -} - -- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode -{ - _preserveCurrentRangeMode = YES; - if (_currentRangeMode != rangeMode) { - _currentRangeMode = rangeMode; - - [self setNeedsUpdate]; - } -} - -- (void)setLayoutController:(id)layoutController -{ - _layoutController = layoutController; - if (layoutController && _dataSource) { - [self updateIfNeeded]; - } -} - -- (void)setDataSource:(id)dataSource -{ - _dataSource = dataSource; - if (dataSource && _layoutController) { - [self updateIfNeeded]; - } -} - -// Clear the visible bit from any nodes that disappeared since last update. -// Currently we guarantee that nodes will not be marked visible when deallocated, -// but it's OK to be in e.g. the preload range. So for the visible bit specifically, -// we add this extra mechanism to account for e.g. deleted items. -// -// NOTE: There is a minor risk here, if a node is transferred from one range controller -// to another before the first rc updates and clears the node out of this set. It's a pretty -// wild scenario that I doubt happens in practice. -- (void)_setVisibleNodes:(NSHashTable *)newVisibleNodes -{ - for (ASCellNode *node in _visibleNodes) { - if (![newVisibleNodes containsObject:node] && node.isVisible) { - [node exitInterfaceState:ASInterfaceStateVisible]; - } - } - _visibleNodes = newVisibleNodes; -} - -- (void)_updateVisibleNodeIndexPaths -{ - as_activity_scope_verbose(as_activity_create("Update range controller", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - as_log_verbose(ASCollectionLog(), "Updating ranges for %@", ASViewToDisplayNode(ASDynamicCast(self.delegate, UIView))); - ASDisplayNodeAssert(_layoutController, @"An ASLayoutController is required by ASRangeController"); - if (!_layoutController || !_dataSource) { - return; - } - - if (![_delegate rangeControllerShouldUpdateRanges:self]) { - return; - } - -#if AS_RANGECONTROLLER_LOG_UPDATE_FREQ - _updateCountThisFrame += 1; -#endif - - ASElementMap *map = [_dataSource elementMapForRangeController:self]; - - // TODO: Consider if we need to use this codepath, or can rely on something more similar to the data & display ranges - // Example: ... = [_layoutController indexPathsForScrolling:scrollDirection rangeType:ASLayoutRangeTypeVisible]; - auto visibleElements = [_dataSource visibleElementsForRangeController:self]; - NSHashTable *newVisibleNodes = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - - ASSignpostStart(RangeControllerUpdate, _dataSource, "%@", ASObjectDescriptionMakeTiny(_dataSource)); - - // Get the scroll direction. Default to using the previous one, if they're not scrolling. - ASScrollDirection scrollDirection = [_dataSource scrollDirectionForRangeController:self]; - if (scrollDirection == ASScrollDirectionNone) { - scrollDirection = _previousScrollDirection; - } - _previousScrollDirection = scrollDirection; - - if (visibleElements.count == 0) { // if we don't have any visibleNodes currently (scrolled before or after content)... - // Verify the actual state by checking the layout with a "VisibleOnly" range. - // This allows us to avoid thrashing through -didExitVisibleState in the case of -reloadData, since that generates didEndDisplayingCell calls. - // Those didEndDisplayingCell calls result in items being removed from the visibleElements returned by the _dataSource, even though the layout remains correct. - visibleElements = [_layoutController elementsForScrolling:scrollDirection rangeMode:ASLayoutRangeModeVisibleOnly rangeType:ASLayoutRangeTypeDisplay map:map]; - for (ASCollectionElement *element in visibleElements) { - [newVisibleNodes addObject:element.node]; - } - [self _setVisibleNodes:newVisibleNodes]; - ASSignpostEnd(RangeControllerUpdate, _dataSource, ""); - return; // don't do anything for this update, but leave _rangeIsValid == NO to make sure we update it later - } - - ASInterfaceState selfInterfaceState = [self interfaceState]; - ASLayoutRangeMode rangeMode = _currentRangeMode; - BOOL updateRangeMode = (!_preserveCurrentRangeMode && _contentHasBeenScrolled); - - // If we've never scrolled before, we never update the range mode, so it doesn't jump into Full too early. - // This can happen if we have multiple, noisy updates occurring from application code before the user has engaged. - // If the range mode is explicitly set via updateCurrentRangeWithMode:, we'll preserve that for at least one update cycle. - // Once the user has scrolled and the range is visible, we'll always resume managing the range mode automatically. - if ((updateRangeMode && ASInterfaceStateIncludesVisible(selfInterfaceState)) || [[self class] isFirstRangeUpdateForRangeMode:rangeMode]) { - rangeMode = [ASRangeController rangeModeForInterfaceState:selfInterfaceState currentRangeMode:_currentRangeMode]; - } - - ASRangeTuningParameters parametersPreload = [_layoutController tuningParametersForRangeMode:rangeMode - rangeType:ASLayoutRangeTypePreload]; - ASRangeTuningParameters parametersDisplay = [_layoutController tuningParametersForRangeMode:rangeMode - rangeType:ASLayoutRangeTypeDisplay]; - - // Preload can express the ultra-low-memory state with 0, 0 returned for its tuningParameters above, and will match Visible. - // However, in this rangeMode, Display is not supposed to contain *any* paths -- not even the visible bounds. TuningParameters can't express this. - BOOL emptyDisplayRange = (rangeMode == ASLayoutRangeModeLowMemory); - BOOL equalDisplayPreload = ASRangeTuningParametersEqualToRangeTuningParameters(parametersDisplay, parametersPreload); - BOOL equalDisplayVisible = (ASRangeTuningParametersEqualToRangeTuningParameters(parametersDisplay, ASRangeTuningParametersZero) - && emptyDisplayRange == NO); - - // Check if both Display and Preload are unique. If they are, we load them with a single fetch from the layout controller for performance. - BOOL optimizedLoadingOfBothRanges = (equalDisplayPreload == NO && equalDisplayVisible == NO && emptyDisplayRange == NO); - - NSHashTable *displayElements = nil; - NSHashTable *preloadElements = nil; - - if (optimizedLoadingOfBothRanges) { - [_layoutController allElementsForScrolling:scrollDirection rangeMode:rangeMode displaySet:&displayElements preloadSet:&preloadElements map:map]; - } else { - if (emptyDisplayRange == YES) { - displayElements = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - } else if (equalDisplayVisible == YES) { - displayElements = visibleElements; - } else { - // Calculating only the Display range means the Preload range is either the same as Display or Visible. - displayElements = [_layoutController elementsForScrolling:scrollDirection rangeMode:rangeMode rangeType:ASLayoutRangeTypeDisplay map:map]; - } - - BOOL equalPreloadVisible = ASRangeTuningParametersEqualToRangeTuningParameters(parametersPreload, ASRangeTuningParametersZero); - if (equalDisplayPreload == YES) { - preloadElements = displayElements; - } else if (equalPreloadVisible == YES) { - preloadElements = visibleElements; - } else { - preloadElements = [_layoutController elementsForScrolling:scrollDirection rangeMode:rangeMode rangeType:ASLayoutRangeTypePreload map:map]; - } - } - - // For now we are only interested in items. Filter-map out from element to item-index-path. - NSSet *visibleIndexPaths = ASSetByFlatMapping(visibleElements, ASCollectionElement *element, [map indexPathForElementIfCell:element]); - NSSet *displayIndexPaths = ASSetByFlatMapping(displayElements, ASCollectionElement *element, [map indexPathForElementIfCell:element]); - NSSet *preloadIndexPaths = ASSetByFlatMapping(preloadElements, ASCollectionElement *element, [map indexPathForElementIfCell:element]); - - // Prioritize the order in which we visit each. Visible nodes should be updated first so they are enqueued on - // the network or display queues before preloading (offscreen) nodes are enqueued. - NSMutableOrderedSet *allIndexPaths = [[NSMutableOrderedSet alloc] initWithSet:visibleIndexPaths]; - - // Typically the preloadIndexPaths will be the largest, and be a superset of the others, though it may be disjoint. - // Because allIndexPaths is an NSMutableOrderedSet, this adds the non-duplicate items /after/ the existing items. - // This means that during iteration, we will first visit visible, then display, then preload nodes. - [allIndexPaths unionSet:displayIndexPaths]; - [allIndexPaths unionSet:preloadIndexPaths]; - - // Add anything we had applied interfaceState to in the last update, but is no longer in range, so we can clear any - // range flags it still has enabled. Most of the time, all but a few elements are equal; a large programmatic - // scroll or major main thread stall could cause entirely disjoint sets. In either case we must visit all. - // Calling "-set" on NSMutableOrderedSet just references the underlying mutable data store, so we must copy it. - NSSet *allCurrentIndexPaths = [[allIndexPaths set] copy]; - [allIndexPaths unionSet:_allPreviousIndexPaths]; - _allPreviousIndexPaths = allCurrentIndexPaths; - - _currentRangeMode = rangeMode; - _preserveCurrentRangeMode = NO; - - if (!_rangeIsValid) { - [allIndexPaths addObjectsFromArray:map.itemIndexPaths]; - } - -#if ASRangeControllerLoggingEnabled - ASDisplayNodeAssertTrue([visibleIndexPaths isSubsetOfSet:displayIndexPaths]); - NSMutableArray *modifiedIndexPaths = (ASRangeControllerLoggingEnabled ? [NSMutableArray array] : nil); -#endif - - for (NSIndexPath *indexPath in allIndexPaths) { - // Before a node / indexPath is exposed to ASRangeController, ASDataController should have already measured it. - // For consistency, make sure each node knows that it should measure itself if something changes. - ASInterfaceState interfaceState = ASInterfaceStateMeasureLayout; - - if (ASInterfaceStateIncludesVisible(selfInterfaceState)) { - if ([visibleIndexPaths containsObject:indexPath]) { - interfaceState |= (ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStatePreload); - } else { - if ([preloadIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStatePreload; - } - if ([displayIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStateDisplay; - } - } - } else { - // If selfInterfaceState isn't visible, then visibleIndexPaths represents either what /will/ be immediately visible at the - // instant we come onscreen, or what /will/ no longer be visible at the instant we come offscreen. - // So, preload and display all of those things, but don't waste resources displaying others. - // - // DO NOT set Visible: even though these elements are in the visible range / "viewport", - // our overall container object is itself not yet, or no longer, visible. - // The moment it becomes visible, we will run the condition above. - if ([visibleIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStatePreload; - if (rangeMode != ASLayoutRangeModeLowMemory) { - interfaceState |= ASInterfaceStateDisplay; - } - } else if ([displayIndexPaths containsObject:indexPath]) { - interfaceState |= ASInterfaceStatePreload; - } - } - - ASCellNode *node = [map elementForItemAtIndexPath:indexPath].nodeIfAllocated; - if (node != nil) { - ASDisplayNodeAssert(node.hierarchyState & ASHierarchyStateRangeManaged, @"All nodes reaching this point should be range-managed, or interfaceState may be incorrectly reset."); - if (ASInterfaceStateIncludesVisible(interfaceState)) { - [newVisibleNodes addObject:node]; - } - // Skip the many method calls of the recursive operation if the top level cell node already has the right interfaceState. - if (node.pendingInterfaceState != interfaceState) { -#if ASRangeControllerLoggingEnabled - [modifiedIndexPaths addObject:indexPath]; -#endif - - BOOL nodeShouldScheduleDisplay = [node shouldScheduleDisplayWithNewInterfaceState:interfaceState]; - [node recursivelySetInterfaceState:interfaceState]; - - if (nodeShouldScheduleDisplay) { - [self registerForNodeDisplayNotificationsForInterfaceStateIfNeeded:selfInterfaceState]; - if (_didRegisterForNodeDisplayNotifications) { - _pendingDisplayNodesTimestamp = CACurrentMediaTime(); - } - } - } - } - } - - [self _setVisibleNodes:newVisibleNodes]; - - // TODO: This code is for debugging only, but would be great to clean up with a delegate method implementation. - if (ASDisplayNode.shouldShowRangeDebugOverlay) { - ASScrollDirection scrollableDirections = ASScrollDirectionUp | ASScrollDirectionDown; - if ([_dataSource isKindOfClass:NSClassFromString(@"ASCollectionView")]) { - scrollableDirections = ((ASCollectionView *)_dataSource).scrollableDirections; - } - - [self updateRangeController:self - withScrollableDirections:scrollableDirections - scrollDirection:scrollDirection - rangeMode:rangeMode - displayTuningParameters:parametersDisplay - preloadTuningParameters:parametersPreload - interfaceState:selfInterfaceState]; - } - - _rangeIsValid = YES; - -#if ASRangeControllerLoggingEnabled -// NSSet *visibleNodePathsSet = [NSSet setWithArray:visibleNodePaths]; -// BOOL setsAreEqual = [visibleIndexPaths isEqualToSet:visibleNodePathsSet]; -// NSLog(@"visible sets are equal: %d", setsAreEqual); -// if (!setsAreEqual) { -// NSLog(@"standard: %@", visibleIndexPaths); -// NSLog(@"custom: %@", visibleNodePathsSet); -// } - [modifiedIndexPaths sortUsingSelector:@selector(compare:)]; - NSLog(@"Range update complete; modifiedIndexPaths: %@, rangeMode: %d", [self descriptionWithIndexPaths:modifiedIndexPaths], rangeMode); -#endif - - ASSignpostEnd(RangeControllerUpdate, _dataSource, ""); -} - -#pragma mark - Notification observers - -/** - * If we're in a restricted range mode, but we're going to change to a full range mode soon, - * go ahead and schedule the transition as soon as all the currently-scheduled rendering is done #1163. - */ -- (void)registerForNodeDisplayNotificationsForInterfaceStateIfNeeded:(ASInterfaceState)interfaceState -{ - // Do not schedule to listen if we're already in full range mode. - // This avoids updating the range controller during a collection teardown when it is removed - // from the hierarchy and its data source is cleared, causing UIKit to call -reloadData. - if (!_didRegisterForNodeDisplayNotifications && _currentRangeMode != ASLayoutRangeModeFull) { - ASLayoutRangeMode nextRangeMode = [ASRangeController rangeModeForInterfaceState:interfaceState - currentRangeMode:_currentRangeMode]; - if (_currentRangeMode != nextRangeMode) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(scheduledNodesDidDisplay:) - name:ASRenderingEngineDidDisplayScheduledNodesNotification - object:nil]; - _didRegisterForNodeDisplayNotifications = YES; - } - } -} - -- (void)scheduledNodesDidDisplay:(NSNotification *)notification -{ - CFAbsoluteTime notificationTimestamp = ((NSNumber *) notification.userInfo[ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp]).doubleValue; - if (_pendingDisplayNodesTimestamp < notificationTimestamp) { - // The rendering engine has processed all the nodes this range controller scheduled. Let's schedule a range update - [[NSNotificationCenter defaultCenter] removeObserver:self name:ASRenderingEngineDidDisplayScheduledNodesNotification object:nil]; - _didRegisterForNodeDisplayNotifications = NO; - - [self setNeedsUpdate]; - } -} - -#pragma mark - Cell node view handling - -- (void)configureContentView:(UIView *)contentView forCellNode:(ASCellNode *)node -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(node, @"Cannot move a nil node to a view"); - ASDisplayNodeAssert(contentView, @"Cannot move a node to a non-existent view"); - - if (node.shouldUseUIKitCell) { - // When using UIKit cells, the ASCellNode is just a placeholder object with a preferredSize. - // In this case, we should not disrupt the subviews of the contentView. - return; - } - - if (node.view.superview == contentView) { - // this content view is already correctly configured - return; - } - - // clean the content view - for (UIView *view in contentView.subviews) { - [view removeFromSuperview]; - } - - [contentView addSubview:node.view]; -} - -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - [_layoutController setTuningParameters:tuningParameters forRangeMode:rangeMode rangeType:rangeType]; -} - -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType -{ - return [_layoutController tuningParametersForRangeMode:rangeMode rangeType:rangeType]; -} - -#pragma mark - ASDataControllerDelegete - -- (void)dataController:(ASDataController *)dataController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates -{ - ASDisplayNodeAssertMainThread(); - if (changeSet.includesReloadData) { - [self _setVisibleNodes:nil]; - } - _rangeIsValid = NO; - [_delegate rangeController:self updateWithChangeSet:changeSet updates:updates]; -} - -#pragma mark - Memory Management - -// Skip the many method calls of the recursive operation if the top level cell node already has the right interfaceState. -- (void)clearContents -{ - ASDisplayNodeAssertMainThread(); - for (ASCollectionElement *element in [_dataSource elementMapForRangeController:self]) { - ASCellNode *node = element.nodeIfAllocated; - if (ASInterfaceStateIncludesDisplay(node.interfaceState)) { - [node exitInterfaceState:ASInterfaceStateDisplay]; - } - } -} - -- (void)clearPreloadedData -{ - ASDisplayNodeAssertMainThread(); - for (ASCollectionElement *element in [_dataSource elementMapForRangeController:self]) { - ASCellNode *node = element.nodeIfAllocated; - if (ASInterfaceStateIncludesPreload(node.interfaceState)) { - [node exitInterfaceState:ASInterfaceStatePreload]; - } - } -} - -#pragma mark - Class Methods (Application Notification Handlers) - -+ (ASWeakSet *)allRangeControllersWeakSet -{ - static ASWeakSet *__allRangeControllersWeakSet; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - __allRangeControllersWeakSet = [[ASWeakSet alloc] init]; - [self registerSharedApplicationNotifications]; - }); - return __allRangeControllersWeakSet; -} - -+ (void)registerSharedApplicationNotifications -{ - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; -#if ASRangeControllerAutomaticLowMemoryHandling - [center addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif - [center addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [center addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; -} - -static ASLayoutRangeMode __rangeModeForMemoryWarnings = ASLayoutRangeModeLowMemory; -+ (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode -{ - ASDisplayNodeAssert(rangeMode == ASLayoutRangeModeVisibleOnly || rangeMode == ASLayoutRangeModeLowMemory, @"It is highly inadvisable to engage a larger range mode when a memory warning occurs, as this will almost certainly cause app eviction"); - __rangeModeForMemoryWarnings = rangeMode; -} - -+ (void)didReceiveMemoryWarning:(NSNotification *)notification -{ - NSArray *allRangeControllers = [[self allRangeControllersWeakSet] allObjects]; - for (ASRangeController *rangeController in allRangeControllers) { - BOOL isDisplay = ASInterfaceStateIncludesDisplay([rangeController interfaceState]); - [rangeController updateCurrentRangeWithMode:isDisplay ? ASLayoutRangeModeVisibleOnly : __rangeModeForMemoryWarnings]; - // There's no need to call needs update as updateCurrentRangeWithMode sets this if necessary. - [rangeController updateIfNeeded]; - } - -#if ASRangeControllerLoggingEnabled - NSLog(@"+[ASRangeController didReceiveMemoryWarning] with controllers: %@", allRangeControllers); -#endif -} - -+ (void)didEnterBackground:(NSNotification *)notification -{ - NSArray *allRangeControllers = [[self allRangeControllersWeakSet] allObjects]; - for (ASRangeController *rangeController in allRangeControllers) { - // We do not want to fully collapse the Display ranges of any visible range controllers so that flashes can be avoided when - // the app is resumed. Non-visible controllers can be more aggressively culled to the LowMemory state (see definitions for documentation) - BOOL isVisible = ASInterfaceStateIncludesVisible([rangeController interfaceState]); - [rangeController updateCurrentRangeWithMode:isVisible ? ASLayoutRangeModeVisibleOnly : ASLayoutRangeModeLowMemory]; - } - - // Because -interfaceState checks __ApplicationState and always clears the "visible" bit if Backgrounded, we must set this after updating the range mode. - __ApplicationState = UIApplicationStateBackground; - for (ASRangeController *rangeController in allRangeControllers) { - // Trigger a range update immediately, as we may not be allowed by the system to run the update block scheduled by changing range mode. - // There's no need to call needs update as updateCurrentRangeWithMode sets this if necessary. - [rangeController updateIfNeeded]; - } - -#if ASRangeControllerLoggingEnabled - NSLog(@"+[ASRangeController didEnterBackground] with controllers, after backgrounding: %@", allRangeControllers); -#endif -} - -+ (void)willEnterForeground:(NSNotification *)notification -{ - NSArray *allRangeControllers = [[self allRangeControllersWeakSet] allObjects]; - __ApplicationState = UIApplicationStateActive; - for (ASRangeController *rangeController in allRangeControllers) { - BOOL isVisible = ASInterfaceStateIncludesVisible([rangeController interfaceState]); - [rangeController updateCurrentRangeWithMode:isVisible ? ASLayoutRangeModeMinimum : ASLayoutRangeModeVisibleOnly]; - // There's no need to call needs update as updateCurrentRangeWithMode sets this if necessary. - [rangeController updateIfNeeded]; - } - -#if ASRangeControllerLoggingEnabled - NSLog(@"+[ASRangeController willEnterForeground] with controllers, after foregrounding: %@", allRangeControllers); -#endif -} - -#pragma mark - Debugging - -#if AS_RANGECONTROLLER_LOG_UPDATE_FREQ -- (void)_updateCountDisplayLinkDidFire -{ - if (_updateCountThisFrame > 1) { - NSLog(@"ASRangeController %p updated %lu times this frame.", self, (unsigned long)_updateCountThisFrame); - } - _updateCountThisFrame = 0; -} -#endif - -- (NSString *)descriptionWithIndexPaths:(NSArray *)indexPaths -{ - NSMutableString *description = [NSMutableString stringWithFormat:@"%@ %@", [super description], @" allPreviousIndexPaths:\n"]; - for (NSIndexPath *indexPath in indexPaths) { - ASDisplayNode *node = [[_dataSource elementMapForRangeController:self] elementForItemAtIndexPath:indexPath].nodeIfAllocated; - ASInterfaceState interfaceState = node.interfaceState; - BOOL inVisible = ASInterfaceStateIncludesVisible(interfaceState); - BOOL inDisplay = ASInterfaceStateIncludesDisplay(interfaceState); - BOOL inPreload = ASInterfaceStateIncludesPreload(interfaceState); - [description appendFormat:@"indexPath %@, Visible: %d, Display: %d, Preload: %d\n", indexPath, inVisible, inDisplay, inPreload]; - } - return description; -} - -- (NSString *)description -{ - NSArray *indexPaths = [[_allPreviousIndexPaths allObjects] sortedArrayUsingSelector:@selector(compare:)]; - return [self descriptionWithIndexPaths:indexPaths]; -} - -@end - -@implementation ASDisplayNode (RangeModeConfiguring) - -+ (void)setRangeModeForMemoryWarnings:(ASLayoutRangeMode)rangeMode -{ - [ASRangeController setRangeModeForMemoryWarnings:rangeMode]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h b/Example/Pods/Texture/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h deleted file mode 100644 index 4c5b08a9..00000000 --- a/Example/Pods/Texture/Source/Details/ASRangeControllerUpdateRangeProtocol+Beta.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASRangeControllerUpdateRangeProtocol+Beta.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@protocol ASRangeControllerUpdateRangeProtocol - -/** - * Updates the current range mode of the range controller for at least the next range update - * and, if the new mode is different from the previous mode, enqueues a range update. - */ -- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode; - -@end diff --git a/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.h b/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.h deleted file mode 100644 index bf99f7e6..00000000 --- a/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// ASRecursiveUnfairLock.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -// Note: We don't use ATOMIC_VAR_INIT here because C++ compilers don't like it, -// and it literally does absolutely nothing. -#define AS_RECURSIVE_UNFAIR_LOCK_INIT ((ASRecursiveUnfairLock){ OS_UNFAIR_LOCK_INIT, NULL, 0}) - -NS_ASSUME_NONNULL_BEGIN - -OS_UNFAIR_LOCK_AVAILABILITY -typedef struct { - os_unfair_lock _lock OS_UNFAIR_LOCK_AVAILABILITY; - _Atomic(pthread_t) _thread; - int _count; // Protected by lock -} ASRecursiveUnfairLock; - -/** - * Lock, blocking if needed. - */ -ASDK_EXTERN OS_UNFAIR_LOCK_AVAILABILITY -void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l); - -/** - * Try to lock without blocking. Returns whether we took the lock. - */ -ASDK_EXTERN OS_UNFAIR_LOCK_AVAILABILITY -BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); - -/** - * Unlock. Calling this on a thread that does not own - * the lock will result in an assertion failure, and undefined - * behavior if foundation assertions are disabled. - */ -ASDK_EXTERN OS_UNFAIR_LOCK_AVAILABILITY -void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.mm b/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.mm deleted file mode 100644 index d6eb1886..00000000 --- a/Example/Pods/Texture/Source/Details/ASRecursiveUnfairLock.mm +++ /dev/null @@ -1,87 +0,0 @@ -// -// ASRecursiveUnfairLock.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASRecursiveUnfairLock.h" - -#import - -/** - * Since the lock itself is a memory barrier, we only need memory_order_relaxed for our - * thread atomic. That guarantees we won't have torn writes, but otherwise no ordering - * is required. - */ -#define rul_set_thread(l, t) atomic_store_explicit(&l->_thread, t, memory_order_relaxed) -#define rul_get_thread(l) atomic_load_explicit(&l->_thread, memory_order_relaxed) - -OS_UNFAIR_LOCK_AVAILABILITY -NS_INLINE void ASRecursiveUnfairLockDidAcquire(ASRecursiveUnfairLock *l, pthread_t tid) { - NSCAssert(pthread_equal(rul_get_thread(l), NULL) && l->_count == 0, @"Unfair lock error"); - rul_set_thread(l, tid); -} - -OS_UNFAIR_LOCK_AVAILABILITY -NS_INLINE void ASRecursiveUnfairLockWillRelease(ASRecursiveUnfairLock *l) { - NSCAssert(pthread_equal(rul_get_thread(l), pthread_self()) && l->_count == 0, @"Unfair lock error"); - rul_set_thread(l, NULL); -} - -OS_UNFAIR_LOCK_AVAILABILITY -NS_INLINE void ASRecursiveUnfairLockAssertHeld(ASRecursiveUnfairLock *l) { - NSCAssert(pthread_equal(rul_get_thread(l), pthread_self()) && l->_count > 0, @"Unfair lock error"); -} - -void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l) -{ - // Try to lock without blocking. If we fail, check what thread owns it. - // Note that the owning thread CAN CHANGE freely, but if the thread is specifically `self` then we know - // it is a recursive call, because we clear it before unlocking, and only `self` can set it - // to `self`. - - const pthread_t s = pthread_self(); - if (pthread_equal(rul_get_thread(l), s)) { - // Owned by self (recursive lock.) nop. - ASRecursiveUnfairLockAssertHeld(l); - } else { - os_unfair_lock_lock(&l->_lock); - ASRecursiveUnfairLockDidAcquire(l, s); - } - - l->_count++; -} - -BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l) { - // Same as Lock above. See comments there. - const pthread_t s = pthread_self(); - if (pthread_equal(rul_get_thread(l), s)) { - ASRecursiveUnfairLockAssertHeld(l); - } else if (os_unfair_lock_trylock(&l->_lock)) { - ASRecursiveUnfairLockDidAcquire(l, s); - } else { - // Owned by other thread. Fail. - return NO; - } - - l->_count++; - return YES; -} - -void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l) -{ - // Ensure we have the lock. This check may miss some pathological cases, - // but it'll catch 99.999999% of this serious programmer error. - NSCAssert(pthread_equal(rul_get_thread(l), pthread_self()), @"Unlocking from a different thread than locked."); - - if (0 == --l->_count) { - // Note that we have to clear this before unlocking because, if another thread - // succeeds in locking above, but hasn't managed to update _thread, and we - // try to re-lock, and fail the -tryLock, and read _thread, then we'll mistakenly - // think that we still own the lock and proceed without blocking. - ASRecursiveUnfairLockWillRelease(l); - os_unfair_lock_unlock(&l->_lock); - } -} diff --git a/Example/Pods/Texture/Source/Details/ASScrollDirection.h b/Example/Pods/Texture/Source/Details/ASScrollDirection.h deleted file mode 100644 index 14317ba5..00000000 --- a/Example/Pods/Texture/Source/Details/ASScrollDirection.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ASScrollDirection.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_OPTIONS(unsigned char, ASScrollDirection) { - ASScrollDirectionNone = 0, - ASScrollDirectionRight = 1 << 0, - ASScrollDirectionLeft = 1 << 1, - ASScrollDirectionUp = 1 << 2, - ASScrollDirectionDown = 1 << 3 -}; - -ASDK_EXTERN const ASScrollDirection ASScrollDirectionHorizontalDirections; -ASDK_EXTERN const ASScrollDirection ASScrollDirectionVerticalDirections; - -ASDK_EXTERN BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); -ASDK_EXTERN BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); - -ASDK_EXTERN BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); -ASDK_EXTERN BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); -ASDK_EXTERN BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection); -ASDK_EXTERN BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection); -ASDK_EXTERN ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASScrollDirection.mm b/Example/Pods/Texture/Source/Details/ASScrollDirection.mm deleted file mode 100644 index 3dff6ba9..00000000 --- a/Example/Pods/Texture/Source/Details/ASScrollDirection.mm +++ /dev/null @@ -1,64 +0,0 @@ -// -// ASScrollDirection.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -const ASScrollDirection ASScrollDirectionHorizontalDirections = ASScrollDirectionLeft | ASScrollDirectionRight; -const ASScrollDirection ASScrollDirectionVerticalDirections = ASScrollDirectionUp | ASScrollDirectionDown; - -BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionVerticalDirections) != 0; -} - -BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionHorizontalDirections) != 0; -} - -BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionRight) != 0; -} - -BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionLeft) != 0; -} - -BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionUp) != 0; -} - -BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection) { - return (scrollDirection & ASScrollDirectionDown) != 0; -} - -ASScrollDirection ASScrollDirectionInvertHorizontally(ASScrollDirection scrollDirection) { - if (scrollDirection == ASScrollDirectionRight) { - return ASScrollDirectionLeft; - } else if (scrollDirection == ASScrollDirectionLeft) { - return ASScrollDirectionRight; - } - return scrollDirection; -} - -ASScrollDirection ASScrollDirectionInvertVertically(ASScrollDirection scrollDirection) { - if (scrollDirection == ASScrollDirectionUp) { - return ASScrollDirectionDown; - } else if (scrollDirection == ASScrollDirectionDown) { - return ASScrollDirectionUp; - } - return scrollDirection; -} - -ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform) { - if ((transform.a < 0) && ASScrollDirectionContainsHorizontalDirection(scrollDirection)) { - return ASScrollDirectionInvertHorizontally(scrollDirection); - } else if ((transform.d < 0) && ASScrollDirectionContainsVerticalDirection(scrollDirection)) { - return ASScrollDirectionInvertVertically(scrollDirection); - } - return scrollDirection; -} diff --git a/Example/Pods/Texture/Source/Details/ASSectionContext.h b/Example/Pods/Texture/Source/Details/ASSectionContext.h deleted file mode 100644 index 8112cb22..00000000 --- a/Example/Pods/Texture/Source/Details/ASSectionContext.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ASSectionContext.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASCollectionView; - -@protocol ASSectionContext - -/** - * Custom name of this section, for debugging only. - */ -@property (nonatomic, copy, nullable) NSString *sectionName; -@property (nonatomic, weak, nullable) ASCollectionView *collectionView; - -@end diff --git a/Example/Pods/Texture/Source/Details/ASTableLayoutController.h b/Example/Pods/Texture/Source/Details/ASTableLayoutController.h deleted file mode 100644 index 385a6a4d..00000000 --- a/Example/Pods/Texture/Source/Details/ASTableLayoutController.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ASTableLayoutController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class UITableView; - -/** - * A layout controller designed for use with UITableView. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTableLayoutController : ASAbstractLayoutController - -@property (nonatomic, weak, readonly) UITableView *tableView; - -- (instancetype)initWithTableView:(UITableView *)tableView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASTableLayoutController.mm b/Example/Pods/Texture/Source/Details/ASTableLayoutController.mm deleted file mode 100644 index 46429ca2..00000000 --- a/Example/Pods/Texture/Source/Details/ASTableLayoutController.mm +++ /dev/null @@ -1,54 +0,0 @@ -// -// ASTableLayoutController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import - -@interface ASTableLayoutController() -@end - -@implementation ASTableLayoutController - -- (instancetype)initWithTableView:(UITableView *)tableView -{ - if (!(self = [super init])) { - return nil; - } - _tableView = tableView; - return self; -} - -#pragma mark - ASLayoutController - -- (NSHashTable *)elementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType map:(ASElementMap *)map -{ - CGRect bounds = _tableView.bounds; - - ASRangeTuningParameters tuningParameters = [self tuningParametersForRangeMode:rangeMode rangeType:rangeType]; - CGRect rangeBounds = CGRectExpandToRangeWithScrollableDirections(bounds, tuningParameters, ASScrollDirectionVerticalDirections, scrollDirection); - NSArray *array = [_tableView indexPathsForRowsInRect:rangeBounds]; - return ASPointerTableByFlatMapping(array, NSIndexPath *indexPath, [map elementForItemAtIndexPath:indexPath]); -} - -- (void)allElementsForScrolling:(ASScrollDirection)scrollDirection rangeMode:(ASLayoutRangeMode)rangeMode displaySet:(NSHashTable *__autoreleasing _Nullable *)displaySet preloadSet:(NSHashTable *__autoreleasing _Nullable *)preloadSet map:(ASElementMap *)map -{ - if (displaySet == NULL || preloadSet == NULL) { - return; - } - - *displaySet = [self elementsForScrolling:scrollDirection rangeMode:rangeMode rangeType:ASLayoutRangeTypeDisplay map:map]; - *preloadSet = [self elementsForScrolling:scrollDirection rangeMode:rangeMode rangeType:ASLayoutRangeTypePreload map:map]; - return; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASThread.h b/Example/Pods/Texture/Source/Details/ASThread.h deleted file mode 100644 index 0ef3d325..00000000 --- a/Example/Pods/Texture/Source/Details/ASThread.h +++ /dev/null @@ -1,333 +0,0 @@ -// -// ASThread.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import -#import -#import -#import -#import - -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDisplayNodeThreadIsMain() -{ - return 0 != pthread_main_np(); -} - -/** - * Adds the lock to the current scope. - * - * A C version of the C++ lockers. Pass in any id. - * One benefit this has over C++ lockers is that the lock is retained. We - * had bugs in the past where an object would be deallocated while someone - * had locked its instanceLock, and we'd get a crash. This macro - * retains the locked object until it can be unlocked, which is nice. - */ -#define ASLockScope(nsLocking) \ - id __lockToken __attribute__((cleanup(_ASLockScopeCleanup))) NS_VALID_UNTIL_END_OF_SCOPE = nsLocking; \ - [__lockToken lock]; - -/// Same as ASLockScope(1) but lock isn't retained (be careful). -#define ASLockScopeUnowned(nsLocking) \ - unowned id __lockToken __attribute__((cleanup(_ASLockScopeUnownedCleanup))) = nsLocking; \ - [__lockToken lock]; - -ASDISPLAYNODE_INLINE void _ASLockScopeCleanup(id __strong * const lockPtr) { - [*lockPtr unlock]; -} - -ASDISPLAYNODE_INLINE void _ASLockScopeUnownedCleanup(id unowned * const lockPtr) { - [*lockPtr unlock]; -} - -/** - * Same as ASLockScope(1) but it uses self, so we can skip retain/release. - */ -#define ASLockScopeSelf() ASLockScopeUnowned(self) - -/// One-liner while holding the lock. -#define ASLocked(nsLocking, expr) ({ ASLockScope(nsLocking); expr; }) - -/// Faster self-version. -#define ASLockedSelf(expr) ({ ASLockScopeSelf(); expr; }) - -#define ASLockedSelfCompareAssign(lvalue, newValue) \ - ASLockedSelf(ASCompareAssign(lvalue, newValue)) - -#define ASLockedSelfCompareAssignObjects(lvalue, newValue) \ - ASLockedSelf(ASCompareAssignObjects(lvalue, newValue)) - -#define ASLockedSelfCompareAssignCustom(lvalue, newValue, isequal) \ - ASLockedSelf(ASCompareAssignCustom(lvalue, newValue, isequal)) - -#define ASLockedSelfCompareAssignCopy(lvalue, obj) \ - ASLockedSelf(ASCompareAssignCopy(lvalue, obj)) - -#define ASUnlockScope(nsLocking) \ - id __lockToken __attribute__((cleanup(_ASUnlockScopeCleanup))) NS_VALID_UNTIL_END_OF_SCOPE = nsLocking; \ - [__lockToken unlock]; - -#define ASSynthesizeLockingMethodsWithMutex(mutex) \ -- (void)lock { mutex.lock(); } \ -- (void)unlock { mutex.unlock(); } \ -- (BOOL)tryLock { return (BOOL)mutex.try_lock(); } - -#define ASSynthesizeLockingMethodsWithObject(object) \ -- (void)lock { [object lock]; } \ -- (void)unlock { [object unlock]; } \ -- (BOOL)tryLock { return [object tryLock]; } - -ASDISPLAYNODE_INLINE void _ASUnlockScopeCleanup(id __strong *lockPtr) { - [*lockPtr lock]; -} - -#ifdef __cplusplus - -#include -#include -#include -#include - -// These macros are here for legacy reasons. We may get rid of them later. -#define DISABLED_ASAssertLocked(m) -#define DISABLED_ASAssertUnlocked(m) - -namespace AS { - - // Set once in Mutex constructor. Linker fails if this is a member variable. ?? - static bool gMutex_unfair; - -// Silence unguarded availability warnings in here, because -// perf is critical and we will check availability once -// and not again. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability" - class Mutex - { - public: - /// Constructs a plain mutex (the default). - Mutex () : Mutex (false) {} - - void SetDebugNameWithObject(id object) { -#if ASEnableVerboseLogging && ASDISPLAYNODE_ASSERTIONS_ENABLED - _debug_name = std::string(ASObjectDescriptionMakeTiny(object).UTF8String); -#endif - } - - ~Mutex () { - // Manually destroy since unions can't do it. - switch (_type) { - case Plain: - _plain.~mutex(); - break; - case Recursive: - _recursive.~recursive_mutex(); - break; - case Unfair: - // nop - break; - case RecursiveUnfair: - // nop - break; - } - } - - Mutex (const Mutex&) = delete; - Mutex &operator=(const Mutex&) = delete; - - bool try_lock() { - bool success = false; - switch (_type) { - case Plain: - success = _plain.try_lock(); - break; - case Recursive: - success = _recursive.try_lock(); - break; - case Unfair: - success = os_unfair_lock_trylock(&_unfair); - break; - case RecursiveUnfair: - if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) { - success = ASRecursiveUnfairLockTryLock(&_runfair); - } else { - success = _recursive.try_lock(); - } - break; - } - if (success) { - DidLock(); - } - return success; - } - - void lock() { - switch (_type) { - case Plain: - _plain.lock(); - break; - case Recursive: - _recursive.lock(); - break; - case Unfair: - os_unfair_lock_lock(&_unfair); - break; - case RecursiveUnfair: - if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) { - ASRecursiveUnfairLockLock(&_runfair); - } else { - _recursive.lock(); - } - break; - } - DidLock(); - } - - void unlock() { - WillUnlock(); - switch (_type) { - case Plain: - _plain.unlock(); - break; - case Recursive: - _recursive.unlock(); - break; - case Unfair: - os_unfair_lock_unlock(&_unfair); - break; - case RecursiveUnfair: - if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) { - ASRecursiveUnfairLockUnlock(&_runfair); - } else { - _recursive.unlock(); - } - break; - } - } - - void AssertHeld() { - ASDisplayNodeCAssert(_owner == std::this_thread::get_id(), @"Thread should hold lock"); - } - - void AssertNotHeld() { - ASDisplayNodeCAssert(_owner != std::this_thread::get_id(), @"Thread should not hold lock"); - } - - explicit Mutex (bool recursive) { - - // Check if we can use unfair lock and store in static var. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - gMutex_unfair = YES; - } - }); - - if (recursive) { - if (gMutex_unfair) { - _type = RecursiveUnfair; - if (@available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) { - _runfair = AS_RECURSIVE_UNFAIR_LOCK_INIT; - } else { - new (&_recursive) std::recursive_mutex(); - } - } else { - _type = Recursive; - new (&_recursive) std::recursive_mutex(); - } - } else { - if (gMutex_unfair) { - _type = Unfair; - _unfair = OS_UNFAIR_LOCK_INIT; - } else { - _type = Plain; - new (&_plain) std::mutex(); - } - } - } - - private: - enum Type { - Plain, - Recursive, - Unfair, - RecursiveUnfair - }; - - void WillUnlock() { -#if ASDISPLAYNODE_ASSERTIONS_ENABLED -#if ASEnableVerboseLogging - if (!_debug_name.empty()) { - as_log_verbose(ASLockingLog(), "unlock %s, count is %d", _debug_name.c_str(), (int)(_count - 1)); - } -#endif - if (--_count == 0) { - _owner = std::thread::id(); - } -#endif - } - - void DidLock() { -#if ASDISPLAYNODE_ASSERTIONS_ENABLED -#if ASEnableVerboseLogging - if (!_debug_name.empty()) { - as_log_verbose(ASLockingLog(), "lock %s, count is %d", _debug_name.c_str(), (int)(_count + 1)); - } -#endif - if (++_count == 1) { - // New owner. - _owner = std::this_thread::get_id(); - } -#endif - } - - Type _type; - union { - os_unfair_lock _unfair; - ASRecursiveUnfairLock _runfair; - std::mutex _plain; - std::recursive_mutex _recursive; - }; -#if ASEnableVerboseLogging - std::string _debug_name; -#endif - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - std::thread::id _owner = std::thread::id(); - int _count = 0; -#endif - }; -#pragma clang diagnostic pop // ignored "-Wunguarded-availability" - - /** - Obj-C doesn't allow you to pass parameters to C++ ivar constructors. - Provide a convenience to change the default from non-recursive to recursive. - - But wait! Recursive mutexes are a bad idea. Think twice before using one: - - http://www.zaval.org/resources/library/butenhof1.html - http://www.fieryrobot.com/blog/2008/10/14/recursive-locks-will-kill-you/ - */ - class RecursiveMutex : public Mutex - { - public: - RecursiveMutex () : Mutex (true) {} - }; - - typedef std::lock_guard MutexLocker; - typedef std::unique_lock UniqueLock; - -} // namespace AS - -#endif /* __cplusplus */ diff --git a/Example/Pods/Texture/Source/Details/ASTraitCollection.h b/Example/Pods/Texture/Source/Details/ASTraitCollection.h deleted file mode 100644 index 7adb1976..00000000 --- a/Example/Pods/Texture/Source/Details/ASTraitCollection.h +++ /dev/null @@ -1,179 +0,0 @@ -// -// ASTraitCollection.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import - -#import - -@class ASTraitCollection; -@protocol ASLayoutElement; -@protocol ASTraitEnvironment; - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - ASPrimitiveTraitCollection - -/** - * @abstract This is an internal struct-representation of ASTraitCollection. - * - * @discussion This struct is for internal use only. Framework users should always use ASTraitCollection. - * - * If you use ASPrimitiveTraitCollection, please do make sure to initialize it with ASPrimitiveTraitCollectionMakeDefault() - * or ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection*). - */ -#pragma clang diagnostic push -#pragma clang diagnostic warning "-Wpadded" -typedef struct { - UIUserInterfaceSizeClass horizontalSizeClass; - UIUserInterfaceSizeClass verticalSizeClass; - - CGFloat displayScale; - UIDisplayGamut displayGamut API_AVAILABLE(ios(10.0)); - - UIUserInterfaceIdiom userInterfaceIdiom; - UIForceTouchCapability forceTouchCapability; - UITraitEnvironmentLayoutDirection layoutDirection API_AVAILABLE(ios(10.0)); - UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(tvos(10.0), ios(12.0)); - - - // NOTE: This must be a constant. We will assert. - unowned UIContentSizeCategory preferredContentSizeCategory API_AVAILABLE(ios(10.0)); - - CGSize containerSize; - -#if TARGET_OS_IOS - UIUserInterfaceLevel userInterfaceLevel API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos); -#endif - UIAccessibilityContrast accessibilityContrast API_AVAILABLE(ios(13.0)); - UILegibilityWeight legibilityWeight API_AVAILABLE(ios(13.0)); -} ASPrimitiveTraitCollection; -#pragma clang diagnostic pop - -/** - * Creates ASPrimitiveTraitCollection with default values. - */ -ASDK_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); - -/** - * Creates a ASPrimitiveTraitCollection from a given UITraitCollection. - */ -ASDK_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); - -/** - * Creates a UITraitCollection from a given ASPrimitiveTraitCollection. - */ -ASDK_EXTERN UITraitCollection * ASPrimitiveTraitCollectionToUITraitCollection(ASPrimitiveTraitCollection traitCollection); - - -/** - * Compares two ASPrimitiveTraitCollection to determine if they are the same. - */ -ASDK_EXTERN BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); - -/** - * Returns a string representation of a ASPrimitiveTraitCollection. - */ -ASDK_EXTERN NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); - -/** - * This function will walk the layout element hierarchy and updates the layout element trait collection for every - * layout element within the hierarchy. - */ -ASDK_EXTERN void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection); - -/** - * Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout - */ -@protocol ASTraitEnvironment - -/** - * @abstract Returns a struct-representation of the environment's ASEnvironmentDisplayTraits. - * - * @discussion This only exists as an internal convenience method. Users should access the trait collections through - * the NSObject based asyncTraitCollection API - */ -- (ASPrimitiveTraitCollection)primitiveTraitCollection; - -/** - * @abstract Sets a trait collection on this environment state. - * - * @discussion This only exists as an internal convenience method. Users should not override trait collection using it. - * Use [ASDKViewController overrideDisplayTraitsWithTraitCollection] block instead. - */ -- (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection; - -/** - * @abstract Returns the thread-safe UITraitCollection equivalent. - */ -- (ASTraitCollection *)asyncTraitCollection; - -@end - -#define ASLayoutElementCollectionTableSetTraitCollection(lock) \ -- (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection\ -{\ - AS::MutexLocker l(lock);\ -\ - ASPrimitiveTraitCollection oldTraits = self.primitiveTraitCollection;\ - [super setPrimitiveTraitCollection:traitCollection];\ -\ - /* Extra Trait Collection Handling */\ -\ - /* If the node is not loaded yet don't do anything as otherwise the access of the view will trigger a load */\ - if (! self.isNodeLoaded) { return; }\ -\ - ASPrimitiveTraitCollection currentTraits = self.primitiveTraitCollection;\ - if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(currentTraits, oldTraits) == NO) {\ - [self.dataController environmentDidChange];\ - }\ -}\ - -#pragma mark - ASTraitCollection - -AS_SUBCLASSING_RESTRICTED -@interface ASTraitCollection : NSObject - -@property (readonly) UIUserInterfaceSizeClass horizontalSizeClass; -@property (readonly) UIUserInterfaceSizeClass verticalSizeClass; - -@property (readonly) CGFloat displayScale; -@property (readonly) UIDisplayGamut displayGamut API_AVAILABLE(ios(10.0)); - -@property (readonly) UIUserInterfaceIdiom userInterfaceIdiom; -@property (readonly) UIForceTouchCapability forceTouchCapability; -@property (readonly) UITraitEnvironmentLayoutDirection layoutDirection API_AVAILABLE(ios(10.0)); -@property (readonly) UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(tvos(10.0), ios(12.0)); -@property (readonly) UIContentSizeCategory preferredContentSizeCategory API_AVAILABLE(ios(10.0)); - -@property (readonly) CGSize containerSize; - -#if TARGET_OS_IOS -@property (readonly) UIUserInterfaceLevel userInterfaceLevel API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(tvos); -#endif - -@property (readonly) UIAccessibilityContrast accessibilityContrast API_AVAILABLE(ios(13.0)); -@property (readonly) UILegibilityWeight legibilityWeight API_AVAILABLE(ios(13.0)); - -- (BOOL)isEqualToTraitCollection:(ASTraitCollection *)traitCollection; - -@end - -/** - * These are internal helper methods. Should never be called by the framework users. - */ -@interface ASTraitCollection (PrimitiveTraits) - -+ (ASTraitCollection *)traitCollectionWithASPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traits NS_RETURNS_RETAINED; - -- (ASPrimitiveTraitCollection)primitiveTraitCollection; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASTraitCollection.mm b/Example/Pods/Texture/Source/Details/ASTraitCollection.mm deleted file mode 100644 index f26a2bea..00000000 --- a/Example/Pods/Texture/Source/Details/ASTraitCollection.mm +++ /dev/null @@ -1,366 +0,0 @@ -// -// ASTraitCollection.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -#pragma mark - ASPrimitiveTraitCollection - -void ASTraitCollectionPropagateDown(id element, ASPrimitiveTraitCollection traitCollection) { - if (element) { - element.primitiveTraitCollection = traitCollection; - } - - for (id subelement in element.sublayoutElements) { - ASTraitCollectionPropagateDown(subelement, traitCollection); - } -} - -ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault() { - ASPrimitiveTraitCollection tc = {}; - tc.userInterfaceIdiom = UIUserInterfaceIdiomUnspecified; - tc.forceTouchCapability = UIForceTouchCapabilityUnknown; - tc.displayScale = 0.0; - tc.horizontalSizeClass = UIUserInterfaceSizeClassUnspecified; - tc.verticalSizeClass = UIUserInterfaceSizeClassUnspecified; - tc.containerSize = CGSizeZero; - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - tc.displayGamut = UIDisplayGamutUnspecified; - tc.preferredContentSizeCategory = UIContentSizeCategoryUnspecified; - tc.layoutDirection = UITraitEnvironmentLayoutDirectionUnspecified; - } - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - tc.userInterfaceStyle = UIUserInterfaceStyleUnspecified; - } - -#if TARGET_OS_IOS - if(AS_AVAILABLE_IOS(13)){ - tc.userInterfaceLevel = UIUserInterfaceLevelUnspecified; - } -#endif - - if (AS_AVAILABLE_IOS_TVOS(13, 13)) { - tc.accessibilityContrast = UIAccessibilityContrastUnspecified; - tc.legibilityWeight = UILegibilityWeightUnspecified; - } - return tc; -} - -ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection) { - ASPrimitiveTraitCollection environmentTraitCollection = ASPrimitiveTraitCollectionMakeDefault(); - environmentTraitCollection.horizontalSizeClass = traitCollection.horizontalSizeClass; - environmentTraitCollection.verticalSizeClass = traitCollection.verticalSizeClass; - environmentTraitCollection.displayScale = traitCollection.displayScale; - environmentTraitCollection.userInterfaceIdiom = traitCollection.userInterfaceIdiom; - environmentTraitCollection.forceTouchCapability = traitCollection.forceTouchCapability; - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - environmentTraitCollection.displayGamut = traitCollection.displayGamut; - environmentTraitCollection.layoutDirection = traitCollection.layoutDirection; - - ASDisplayNodeCAssertPermanent(traitCollection.preferredContentSizeCategory); - environmentTraitCollection.preferredContentSizeCategory = traitCollection.preferredContentSizeCategory; - } - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - environmentTraitCollection.userInterfaceStyle = traitCollection.userInterfaceStyle; - } - -#if TARGET_OS_IOS - if(AS_AVAILABLE_IOS(13)){ - environmentTraitCollection.userInterfaceLevel = traitCollection.userInterfaceLevel; - } -#endif - - if (AS_AVAILABLE_IOS_TVOS(13, 13)) { - environmentTraitCollection.accessibilityContrast = traitCollection.accessibilityContrast; - environmentTraitCollection.legibilityWeight = traitCollection.legibilityWeight; - } - return environmentTraitCollection; -} - -ASDK_EXTERN UITraitCollection * ASPrimitiveTraitCollectionToUITraitCollection(ASPrimitiveTraitCollection traitCollection) { - NSMutableArray *collections = [[NSMutableArray alloc] initWithArray:@[ - [UITraitCollection traitCollectionWithHorizontalSizeClass:traitCollection.horizontalSizeClass], - [UITraitCollection traitCollectionWithVerticalSizeClass:traitCollection.verticalSizeClass], - [UITraitCollection traitCollectionWithDisplayScale:traitCollection.displayScale], - [UITraitCollection traitCollectionWithUserInterfaceIdiom:traitCollection.userInterfaceIdiom], - [UITraitCollection traitCollectionWithForceTouchCapability:traitCollection.forceTouchCapability], - ]]; - - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - [collections addObject:[UITraitCollection traitCollectionWithDisplayGamut:traitCollection.displayGamut]]; - [collections addObject:[UITraitCollection traitCollectionWithLayoutDirection:traitCollection.layoutDirection]]; - [collections addObject:[UITraitCollection traitCollectionWithPreferredContentSizeCategory:traitCollection.preferredContentSizeCategory]]; - } - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - [collections addObject:[UITraitCollection traitCollectionWithUserInterfaceStyle:traitCollection.userInterfaceStyle]]; - } - - UITraitCollection *result = [UITraitCollection traitCollectionWithTraitsFromCollections:collections]; - return result; -} - -BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs) { - return !memcmp(&lhs, &rhs, sizeof(ASPrimitiveTraitCollection)); -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceIdiom(UIUserInterfaceIdiom idiom) { - switch (idiom) { - case UIUserInterfaceIdiomTV: - return @"TV"; - case UIUserInterfaceIdiomPad: - return @"Pad"; - case UIUserInterfaceIdiomPhone: - return @"Phone"; - case UIUserInterfaceIdiomCarPlay: - return @"CarPlay"; - default: - return @"Unspecified"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIForceTouchCapability(UIForceTouchCapability capability) { - switch (capability) { - case UIForceTouchCapabilityAvailable: - return @"Available"; - case UIForceTouchCapabilityUnavailable: - return @"Unavailable"; - default: - return @"Unknown"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceSizeClass(UIUserInterfaceSizeClass sizeClass) { - switch (sizeClass) { - case UIUserInterfaceSizeClassCompact: - return @"Compact"; - case UIUserInterfaceSizeClassRegular: - return @"Regular"; - default: - return @"Unspecified"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(ios(10)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIDisplayGamut(UIDisplayGamut displayGamut) { - switch (displayGamut) { - case UIDisplayGamutSRGB: - return @"sRGB"; - case UIDisplayGamutP3: - return @"P3"; - default: - return @"Unspecified"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(ios(10)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentLayoutDirection(UITraitEnvironmentLayoutDirection layoutDirection) { - switch (layoutDirection) { - case UITraitEnvironmentLayoutDirectionLeftToRight: - return @"LeftToRight"; - case UITraitEnvironmentLayoutDirectionRightToLeft: - return @"RightToLeft"; - default: - return @"Unspecified"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(tvos(10.0), ios(12.0)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceStyle(UIUserInterfaceStyle userInterfaceStyle) { - switch (userInterfaceStyle) { - case UIUserInterfaceStyleLight: - return @"Light"; - case UIUserInterfaceStyleDark: - return @"Dark"; - default: - return @"Unspecified"; - } -} - -#if TARGET_OS_IOS -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(ios(13)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentUserInterfaceLevel(UIUserInterfaceLevel userInterfaceLevel) { - switch (userInterfaceLevel) { - case UIUserInterfaceLevelBase: - return @"Base"; - case UIUserInterfaceLevelElevated: - return @"Elevated"; - default: - return @"Unspecified"; - } -} -#endif - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(ios(13)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentAccessibilityContrast(UIAccessibilityContrast accessibilityContrast) { - switch (accessibilityContrast) { - case UIAccessibilityContrastNormal: - return @"Normal"; - case UIAccessibilityContrastHigh: - return @"High"; - default: - return @"Unspecified"; - } -} - -// Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline -API_AVAILABLE(ios(13)) -ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUITraitEnvironmentLegibilityWeight(UILegibilityWeight legibilityWeight) { - switch (legibilityWeight) { - case UILegibilityWeightRegular: - return @"Regular"; - case UILegibilityWeightBold: - return @"Bold"; - default: - return @"Unspecified"; - } -} - - - -NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits) { - NSMutableArray *props = [NSMutableArray array]; - [props addObject:@{ @"verticalSizeClass": AS_NSStringFromUIUserInterfaceSizeClass(traits.verticalSizeClass) }]; - [props addObject:@{ @"horizontalSizeClass": AS_NSStringFromUIUserInterfaceSizeClass(traits.horizontalSizeClass) }]; - [props addObject:@{ @"displayScale": [NSString stringWithFormat: @"%.0lf", (double)traits.displayScale] }]; - [props addObject:@{ @"userInterfaceIdiom": AS_NSStringFromUIUserInterfaceIdiom(traits.userInterfaceIdiom) }]; - [props addObject:@{ @"forceTouchCapability": AS_NSStringFromUIForceTouchCapability(traits.forceTouchCapability) }]; - if (AS_AVAILABLE_IOS_TVOS(12, 10)) { - [props addObject:@{ @"userInterfaceStyle": AS_NSStringFromUIUserInterfaceStyle(traits.userInterfaceStyle) }]; - } - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - [props addObject:@{ @"layoutDirection": AS_NSStringFromUITraitEnvironmentLayoutDirection(traits.layoutDirection) }]; - if (traits.preferredContentSizeCategory != nil) { - [props addObject:@{ @"preferredContentSizeCategory": traits.preferredContentSizeCategory }]; - } - [props addObject:@{ @"displayGamut": AS_NSStringFromUIDisplayGamut(traits.displayGamut) }]; - } - -#if TARGET_OS_IOS - if (AS_AVAILABLE_IOS(13)){ - [props addObject:@{ @"userInterfaceLevel": AS_NSStringFromUITraitEnvironmentUserInterfaceLevel(traits.userInterfaceLevel) }]; - } -#endif - - if (AS_AVAILABLE_IOS_TVOS(13, 13)) { - [props addObject:@{ @"accessibilityContrast": AS_NSStringFromUITraitEnvironmentAccessibilityContrast(traits.accessibilityContrast) }]; - [props addObject:@{ @"legibilityWeight": AS_NSStringFromUITraitEnvironmentLegibilityWeight(traits.legibilityWeight) }]; - } - [props addObject:@{ @"containerSize": NSStringFromCGSize(traits.containerSize) }]; - return ASObjectDescriptionMakeWithoutObject(props); -} - -#pragma mark - ASTraitCollection - -@implementation ASTraitCollection { - ASPrimitiveTraitCollection _prim; -} - -+ (ASTraitCollection *)traitCollectionWithASPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traits NS_RETURNS_RETAINED { - ASTraitCollection *tc = [[ASTraitCollection alloc] init]; - if (AS_AVAILABLE_IOS_TVOS(10, 10)) { - ASDisplayNodeCAssertPermanent(traits.preferredContentSizeCategory); - } - tc->_prim = traits; - return tc; -} - -- (ASPrimitiveTraitCollection)primitiveTraitCollection { - return _prim; -} -- (UIUserInterfaceSizeClass)horizontalSizeClass -{ - return _prim.horizontalSizeClass; -} --(UIUserInterfaceSizeClass)verticalSizeClass -{ - return _prim.verticalSizeClass; -} -- (CGFloat)displayScale -{ - return _prim.displayScale; -} -- (UIDisplayGamut)displayGamut -{ - return _prim.displayGamut; -} -- (UIForceTouchCapability)forceTouchCapability -{ - return _prim.forceTouchCapability; -} -- (UITraitEnvironmentLayoutDirection)layoutDirection -{ - return _prim.layoutDirection; -} -- (CGSize)containerSize -{ - return _prim.containerSize; -} - -- (UIUserInterfaceStyle)userInterfaceStyle -{ - return _prim.userInterfaceStyle; -} - -- (UIContentSizeCategory)preferredContentSizeCategory -{ - return _prim.preferredContentSizeCategory; -} - -#if TARGET_OS_IOS -- (UIUserInterfaceLevel)userInterfaceLevel -{ - return _prim.userInterfaceLevel; -} -#endif - -- (UIAccessibilityContrast)accessibilityContrast -{ - return _prim.accessibilityContrast; -} - -- (UILegibilityWeight)legibilityWeight -{ - return _prim.legibilityWeight; -} - -- (NSUInteger)hash { - return ASHashBytes(&_prim, sizeof(ASPrimitiveTraitCollection)); -} - -- (BOOL)isEqual:(id)object { - if (!object || ![object isKindOfClass:ASTraitCollection.class]) { - return NO; - } - return [self isEqualToTraitCollection:object]; -} - -- (BOOL)isEqualToTraitCollection:(ASTraitCollection *)traitCollection -{ - if (traitCollection == nil) { - return NO; - } - - if (self == traitCollection) { - return YES; - } - return ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(_prim, traitCollection->_prim); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASWeakProxy.h b/Example/Pods/Texture/Source/Details/ASWeakProxy.h deleted file mode 100644 index 7396474b..00000000 --- a/Example/Pods/Texture/Source/Details/ASWeakProxy.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASWeakProxy.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -AS_SUBCLASSING_RESTRICTED -@interface ASWeakProxy : NSProxy - -/** - * @return target The target which will be forwarded all messages sent to the weak proxy. - */ -@property (nonatomic, weak, readonly) id target; - -/** - * An object which forwards messages to a target which it weakly references - * - * @discussion This class is useful for breaking retain cycles. You can pass this in place - * of the target to something which creates a strong reference. All messages sent to the - * proxy will be passed onto the target. - * - * @return an instance of ASWeakProxy - */ -+ (instancetype)weakProxyWithTarget:(id)target NS_RETURNS_RETAINED; - -@end diff --git a/Example/Pods/Texture/Source/Details/ASWeakProxy.mm b/Example/Pods/Texture/Source/Details/ASWeakProxy.mm deleted file mode 100644 index 4a73408d..00000000 --- a/Example/Pods/Texture/Source/Details/ASWeakProxy.mm +++ /dev/null @@ -1,72 +0,0 @@ -// -// ASWeakProxy.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@implementation ASWeakProxy - -- (instancetype)initWithTarget:(id)target -{ - if (self) { - _target = target; - } - return self; -} - -+ (instancetype)weakProxyWithTarget:(id)target NS_RETURNS_RETAINED -{ - return [[ASWeakProxy alloc] initWithTarget:target]; -} - -- (id)forwardingTargetForSelector:(SEL)aSelector -{ - return _target; -} - -- (BOOL)respondsToSelector:(SEL)aSelector -{ - return [_target respondsToSelector:aSelector]; -} - -- (BOOL)conformsToProtocol:(Protocol *)aProtocol -{ - return [_target conformsToProtocol:aProtocol]; -} - -/// Strangely, this method doesn't get forwarded by ObjC. -- (BOOL)isKindOfClass:(Class)aClass -{ - return [_target isKindOfClass:aClass]; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, @[@{ @"target": _target ?: (id)kCFNull }]); -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel -{ - ASDisplayNodeAssertNil(_target, @"ASWeakProxy got %@ when its target is still alive, which is unexpected.", NSStringFromSelector(_cmd)); - // Unfortunately, in order to get this object to work properly, the use of a method which creates an NSMethodSignature - // from a C string. -methodSignatureForSelector is called when a compiled definition for the selector cannot be found. - // This is the place where we have to create our own dud NSMethodSignature. This is necessary because if this method - // returns nil, a selector not found exception is raised. The string argument to -signatureWithObjCTypes: outlines - // the return type and arguments to the message. To return a dud NSMethodSignature, pretty much any signature will - // suffice. Since the -forwardInvocation call will do nothing if the target does not respond to the selector, - // the dud NSMethodSignature simply gets us around the exception. - return [NSMethodSignature signatureWithObjCTypes:"@^v^c"]; -} -- (void)forwardInvocation:(NSInvocation *)invocation -{ - ASDisplayNodeAssertNil(_target, @"ASWeakProxy got %@ when its target is still alive, which is unexpected.", NSStringFromSelector(_cmd)); -} - -@end diff --git a/Example/Pods/Texture/Source/Details/ASWeakSet.h b/Example/Pods/Texture/Source/Details/ASWeakSet.h deleted file mode 100644 index cc435dec..00000000 --- a/Example/Pods/Texture/Source/Details/ASWeakSet.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASWeakSet.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A class similar to NSSet that stores objects weakly. - * Note that this class uses NSPointerFunctionsObjectPointerPersonality – - * that is, it uses shifted pointer for hashing, and identity comparison for equality. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASWeakSet<__covariant ObjectType> : NSObject - -/// Returns YES if the receiver is empty, NO otherwise. -@property (nonatomic, readonly, getter=isEmpty) BOOL empty; - -/// Returns YES if `object` is in the receiver, NO otherwise. -- (BOOL)containsObject:(ObjectType)object AS_WARN_UNUSED_RESULT; - -/// Insets `object` into the set. -- (void)addObject:(ObjectType)object; - -/// Removes object from the set. -- (void)removeObject:(ObjectType)object; - -/// Removes all objects from the set. -- (void)removeAllObjects; - -/// Returns a standard *retained* NSArray of all objects. Not free to generate, but useful for iterating over contents. -- (NSArray *)allObjects AS_WARN_UNUSED_RESULT; - -/** - * How many objects are contained in this set. - - * NOTE: This computed property is O(N). Consider using the `empty` property. - */ -@property (nonatomic, readonly) NSUInteger count; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/ASWeakSet.mm b/Example/Pods/Texture/Source/Details/ASWeakSet.mm deleted file mode 100644 index a65dbff2..00000000 --- a/Example/Pods/Texture/Source/Details/ASWeakSet.mm +++ /dev/null @@ -1,84 +0,0 @@ -// -// ASWeakSet.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASWeakSet<__covariant ObjectType> () -@property (nonatomic, readonly) NSHashTable *hashTable; -@end - -@implementation ASWeakSet - -- (instancetype)init -{ - self = [super init]; - if (self) { - _hashTable = [NSHashTable hashTableWithOptions:NSHashTableWeakMemory | NSHashTableObjectPointerPersonality]; - } - return self; -} - -- (void)addObject:(id)object -{ - [_hashTable addObject:object]; -} - -- (void)removeObject:(id)object -{ - [_hashTable removeObject:object]; -} - -- (void)removeAllObjects -{ - [_hashTable removeAllObjects]; -} - -- (NSArray *)allObjects -{ - return _hashTable.allObjects; -} - -- (BOOL)containsObject:(id)object -{ - return [_hashTable containsObject:object]; -} - -- (BOOL)isEmpty -{ - return [_hashTable anyObject] == nil; -} - -/** - Note: The `count` property of NSHashTable is unreliable - in the case of weak-memory hash tables because entries - that have been deallocated are not removed immediately. - - In order to get the true count we have to fall back to using - fast enumeration. - */ -- (NSUInteger)count -{ - NSUInteger count = 0; - for (__unused id object in _hashTable) { - count += 1; - } - return count; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(unowned id _Nonnull *)buffer count:(NSUInteger)len -{ - return [_hashTable countByEnumeratingWithState:state objects:buffer count:len]; -} - -- (NSString *)description -{ - return [[super description] stringByAppendingFormat:@" count: %tu, contents: %@", self.count, _hashTable]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/CoreGraphics+ASConvenience.h b/Example/Pods/Texture/Source/Details/CoreGraphics+ASConvenience.h deleted file mode 100644 index e1e96033..00000000 --- a/Example/Pods/Texture/Source/Details/CoreGraphics+ASConvenience.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// CoreGraphics+ASConvenience.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - - -#ifndef CGFLOAT_EPSILON - #if CGFLOAT_IS_DOUBLE - #define CGFLOAT_EPSILON DBL_EPSILON - #else - #define CGFLOAT_EPSILON FLT_EPSILON - #endif -#endif - -NS_ASSUME_NONNULL_BEGIN - -ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string) -{ -#if CGFLOAT_IS_DOUBLE - return string.doubleValue; -#else - return string.floatValue; -#endif -} - -ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromNumber(NSNumber *number) -{ -#if CGFLOAT_IS_DOUBLE - return number.doubleValue; -#else - return number.floatValue; -#endif -} - -ASDISPLAYNODE_INLINE BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CGFloat delta) -{ - return ABS(size1.width - size2.width) < delta && ABS(size1.height - size2.height) < delta; -}; - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/NSArray+Diffing.h b/Example/Pods/Texture/Source/Details/NSArray+Diffing.h deleted file mode 100644 index c4639031..00000000 --- a/Example/Pods/Texture/Source/Details/NSArray+Diffing.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// NSArray+Diffing.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * These changes can be used to transform `self` to `array` by applying them in (any) order, *without shifting* the - * other elements. This can be done (in an NSMutableArray) by calling `setObject:atIndexedSubscript:` (or just use - * [subscripting] directly) for insertions from `array` into `self` (not the seemingly more apt `insertObject:atIndex`!), - * and using the same method for deletions from `self` (*set* a `[NSNull null]` as opposed to `removeObject:atIndex:`). - * After all inserts/deletes have been applied, there will be no nulls left (except possibly at the end of the array if - * `[array count] < [self count]`) - - * Some examples: - * in: ab c - * out: abdc - * diff: ..+. - * - * in: abcd - * out: dcba - * dif: ---.+++ - * - * in: abcd - * out: ab d - * diff: ..-. - * - * in: a bcd - * out: adbc - * diff: .+..- - * - * If `moves` pointer is passed in, instances where one element moves to another location are detected and reported, - * possibly replacing pairs of delete/insert. The process for transforming an array remains the same, however now it is - * important to apply the moves in order and not overwrite an element that needs to be moved somewhere else. - * - * the same examples, with moves: - * in: ab c - * out: abdc - * diff: ..+. - * - * in: abcd - * out: dcba - * diff: 321. - * - * in: abcd - * out: ab d - * diff: ..-. - * - * in: abcd - * out: adbc - * diff: .312 - * - * Other notes: - * - * No index will be both moved from and deleted. - * Each index 0...[self count] will be either moved from or deleted. If it is moved to the same location, we omit it. - * Each index 0...[array count] will be the destination of ONE move or ONE insert. - * Knowing these things means any two of the three (delete, move, insert) implies the third. - */ - -@interface NSArray (Diffing) - -/** - * @abstract Compares two arrays, providing the insertion and deletion indexes needed to transform into the target array. - * @discussion This compares the equality of each object with `isEqual:`. - * This diffing algorithm uses a bottom-up memoized longest common subsequence solution to identify differences. - * It runs in O(mn) complexity. - */ -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions; - -/** - * @abstract Compares two arrays, providing the insertion and deletion indexes needed to transform into the target array. - * @discussion The `compareBlock` is used to identify the equality of the objects within the arrays. - * This diffing algorithm uses a bottom-up memoized longest common subsequence solution to identify differences. - * It runs in O(mn) complexity. - */ -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions compareBlock:(BOOL (^)(id lhs, id rhs))comparison; - -/** - * @abstract Compares two arrays, providing the insertion, deletion, and move indexes needed to transform into the target array. - * @discussion This compares the equality of each object with `isEqual:`. - * This diffing algorithm uses a bottom-up memoized longest common subsequence solution to identify differences. - * It runs in O(mn) complexity. - * The moves are returned in ascending order of their destination index. - */ -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions moves:(NSArray **)moves; -@end diff --git a/Example/Pods/Texture/Source/Details/NSArray+Diffing.mm b/Example/Pods/Texture/Source/Details/NSArray+Diffing.mm deleted file mode 100644 index 83d32fea..00000000 --- a/Example/Pods/Texture/Source/Details/NSArray+Diffing.mm +++ /dev/null @@ -1,177 +0,0 @@ -// -// NSArray+Diffing.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -@implementation NSArray (Diffing) - -typedef BOOL (^compareBlock)(id _Nonnull lhs, id _Nonnull rhs); - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions -{ - [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:nil compareBlock:[NSArray defaultCompareBlock]]; -} - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions - compareBlock:(compareBlock)comparison -{ - [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:nil compareBlock:comparison]; -} - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions - moves:(NSArray **)moves -{ - [self asdk_diffWithArray:array insertions:insertions deletions:deletions moves:moves - compareBlock:[NSArray defaultCompareBlock]]; -} - -- (void)asdk_diffWithArray:(NSArray *)array insertions:(NSIndexSet **)insertions deletions:(NSIndexSet **)deletions - moves:(NSArray **)moves compareBlock:(compareBlock)comparison -{ - struct NSObjectHash - { - std::size_t operator()(id k) const { return (std::size_t) [k hash]; }; - }; - struct NSObjectCompare - { - bool operator()(id lhs, id rhs) const { return (bool) [lhs isEqual:rhs]; }; - }; - std::unordered_multimap potentialMoves; - - NSAssert(comparison != nil, @"Comparison block is required"); - NSAssert(moves == nil || comparison == [NSArray defaultCompareBlock], @"move detection requires isEqual: and hash (no custom compare)"); - NSMutableArray *moveIndexPaths = nil; - NSMutableIndexSet *insertionIndexes = nil, *deletionIndexes = nil; - if (moves) { - moveIndexPaths = [NSMutableArray new]; - } - NSMutableIndexSet *commonIndexes = [self _asdk_commonIndexesWithArray:array compareBlock:comparison]; - - if (deletions || moves) { - deletionIndexes = [NSMutableIndexSet indexSet]; - NSUInteger i = 0; - for (id element in self) { - if (![commonIndexes containsIndex:i]) { - [deletionIndexes addIndex:i]; - } - if (moves) { - potentialMoves.insert(std::pair(element, i)); - } - ++i; - } - } - - if (insertions || moves) { - insertionIndexes = [NSMutableIndexSet indexSet]; - NSArray *commonObjects = [self objectsAtIndexes:commonIndexes]; - for (NSUInteger i = 0, j = 0; j < array.count; j++) { - auto moveFound = potentialMoves.find(array[j]); - NSUInteger movedFrom = NSNotFound; - if (moveFound != potentialMoves.end() && moveFound->second != j) { - movedFrom = moveFound->second; - potentialMoves.erase(moveFound); - [moveIndexPaths addObject:[NSIndexPath indexPathForItem:j inSection:movedFrom]]; - } - if (i < commonObjects.count && j < array.count && comparison(commonObjects[i], array[j])) { - i++; - } else { - if (movedFrom != NSNotFound) { - // moves will coalesce a delete / insert - the insert is just not done, and here we remove the delete: - [deletionIndexes removeIndex:movedFrom]; - // OR a move will have come from the LCS: - if ([commonIndexes containsIndex:movedFrom]) { - [commonIndexes removeIndex:movedFrom]; - commonObjects = [self objectsAtIndexes:commonIndexes]; - } - } else { - [insertionIndexes addIndex:j]; - } - } - } - } - - if (moves) {*moves = moveIndexPaths;} - if (deletions) {*deletions = deletionIndexes;} - if (insertions) {*insertions = insertionIndexes;} -} - -// https://github.com/raywenderlich/swift-algorithm-club/tree/master/Longest%20Common%20Subsequence is not exactly this code (obviously), but -// is a good commentary on the algorithm. -- (NSMutableIndexSet *)_asdk_commonIndexesWithArray:(NSArray *)array compareBlock:(BOOL (^)(id lhs, id rhs))comparison -{ - NSAssert(comparison != nil, @"Comparison block is required"); - - NSInteger selfCount = self.count; - NSInteger arrayCount = array.count; - - // Allocate the diff map in the heap so we don't blow the stack for large arrays. - NSInteger **lengths = NULL; - lengths = (NSInteger **)malloc(sizeof(NSInteger*) * (selfCount+1)); - if (lengths == NULL) { - ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); - return nil; - } - // Fill in a LCS length matrix: - for (NSInteger i = 0; i <= selfCount; i++) { - lengths[i] = (NSInteger *)malloc(sizeof(NSInteger) * (arrayCount+1)); - if (lengths[i] == NULL) { - ASDisplayNodeFailAssert(@"Failed to allocate memory for diffing"); - return nil; - } - id selfObj = i > 0 ? self[i-1] : nil; - for (NSInteger j = 0; j <= arrayCount; j++) { - if (i == 0 || j == 0) { - lengths[i][j] = 0; - } else if (comparison(selfObj, array[j-1])) { - lengths[i][j] = 1 + lengths[i-1][j-1]; - } else { - lengths[i][j] = MAX(lengths[i-1][j], lengths[i][j-1]); - } - } - } - // Backtrack to fill in indices based on length matrix: - NSMutableIndexSet *common = [NSMutableIndexSet indexSet]; - NSInteger i = selfCount, j = arrayCount; - while(i > 0 && j > 0) { - if (comparison(self[i-1], array[j-1])) { - [common addIndex:(i-1)]; - i--; j--; - } else if (lengths[i-1][j] > lengths[i][j-1]) { - i--; - } else { - j--; - } - } - - for (NSInteger i = 0; i <= selfCount; i++) { - free(lengths[i]); - } - free(lengths); - return common; -} - -static compareBlock defaultCompare = nil; - -+ (compareBlock)defaultCompareBlock -{ - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - defaultCompare = ^BOOL(id lhs, id rhs) { - return [lhs isEqual:rhs]; - }; - }); - - return defaultCompare; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.h b/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.h deleted file mode 100644 index cab7c943..00000000 --- a/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// NSIndexSet+ASHelpers.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface NSIndexSet (ASHelpers) - -- (NSIndexSet *)as_indexesByMapping:(NSUInteger (^)(NSUInteger idx))block; - -- (NSIndexSet *)as_intersectionWithIndexes:(NSIndexSet *)indexes; - -/// Returns all the item indexes from the given index paths that are in the given section. -+ (NSIndexSet *)as_indexSetFromIndexPaths:(NSArray *)indexPaths inSection:(NSUInteger)section; - -/// If you've got an old index, and you insert items using this index set, this returns the change to get to the new index. -- (NSUInteger)as_indexChangeByInsertingItemsBelowIndex:(NSUInteger)index; - -- (NSString *)as_smallDescription; - -/// Returns all the section indexes contained in the index paths array. -+ (NSIndexSet *)as_sectionsFromIndexPaths:(NSArray *)indexPaths; - -@end diff --git a/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.mm b/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.mm deleted file mode 100644 index 0eba0358..00000000 --- a/Example/Pods/Texture/Source/Details/NSIndexSet+ASHelpers.mm +++ /dev/null @@ -1,91 +0,0 @@ -// -// NSIndexSet+ASHelpers.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -// UIKit indexPath helpers -#import - -#import - -@implementation NSIndexSet (ASHelpers) - -- (NSIndexSet *)as_indexesByMapping:(NSUInteger (^)(NSUInteger))block -{ - NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init]; - [self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - for (NSUInteger i = range.location; i < NSMaxRange(range); i++) { - NSUInteger newIndex = block(i); - if (newIndex != NSNotFound) { - [result addIndex:newIndex]; - } - } - }]; - return result; -} - -- (NSIndexSet *)as_intersectionWithIndexes:(NSIndexSet *)indexes -{ - NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init]; - [self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - [indexes enumerateRangesInRange:range options:kNilOptions usingBlock:^(NSRange range, BOOL * _Nonnull stop) { - [result addIndexesInRange:range]; - }]; - }]; - return result; -} - -+ (NSIndexSet *)as_indexSetFromIndexPaths:(NSArray *)indexPaths inSection:(NSUInteger)section -{ - NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init]; - for (NSIndexPath *indexPath in indexPaths) { - if (indexPath.section == section) { - [result addIndex:indexPath.item]; - } - } - return result; -} - -- (NSUInteger)as_indexChangeByInsertingItemsBelowIndex:(NSUInteger)index -{ - __block NSUInteger newIndex = index; - [self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - for (NSUInteger i = range.location; i < NSMaxRange(range); i++) { - if (i <= newIndex) { - newIndex += 1; - } else { - *stop = YES; - } - } - }]; - return newIndex - index; -} - -- (NSString *)as_smallDescription -{ - NSMutableString *result = [NSMutableString stringWithString:@"{ "]; - [self enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - if (range.length == 1) { - [result appendFormat:@"%tu ", range.location]; - } else { - [result appendFormat:@"%tu-%tu ", range.location, NSMaxRange(range) - 1]; - } - }]; - [result appendString:@"}"]; - return result; -} - -+ (NSIndexSet *)as_sectionsFromIndexPaths:(NSArray *)indexPaths -{ - NSMutableIndexSet *result = [[NSMutableIndexSet alloc] init]; - for (NSIndexPath *indexPath in indexPaths) { - [result addIndex:indexPath.section]; - } - return result; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.h b/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.h deleted file mode 100644 index afb96722..00000000 --- a/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// NSMutableAttributedString+TextKitAdditions.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSMutableAttributedString (TextKitAdditions) - -- (void)attributeTextInRange:(NSRange)range withTextKitMinimumLineHeight:(CGFloat)minimumLineHeight; - -- (void)attributeTextInRange:(NSRange)range withTextKitMinimumLineHeight:(CGFloat)minimumLineHeight maximumLineHeight:(CGFloat)maximumLineHeight; - -- (void)attributeTextInRange:(NSRange)range withTextKitLineHeight:(CGFloat)lineHeight; - -- (void)attributeTextInRange:(NSRange)range withTextKitParagraphStyle:(NSParagraphStyle *)paragraphStyle; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.mm b/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.mm deleted file mode 100644 index 3f2ed9d3..00000000 --- a/Example/Pods/Texture/Source/Details/NSMutableAttributedString+TextKitAdditions.mm +++ /dev/null @@ -1,49 +0,0 @@ -// -// NSMutableAttributedString+TextKitAdditions.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation NSMutableAttributedString (TextKitAdditions) - -#pragma mark - Convenience Methods - -- (void)attributeTextInRange:(NSRange)range withTextKitMinimumLineHeight:(CGFloat)minimumLineHeight -{ - if (range.length) { - - NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; - [style setMinimumLineHeight:minimumLineHeight]; - [self attributeTextInRange:range withTextKitParagraphStyle:style]; - } -} - -- (void)attributeTextInRange:(NSRange)range withTextKitMinimumLineHeight:(CGFloat)minimumLineHeight maximumLineHeight:(CGFloat)maximumLineHeight -{ - if (range.length) { - - NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; - [style setMinimumLineHeight:minimumLineHeight]; - [style setMaximumLineHeight:maximumLineHeight]; - [self attributeTextInRange:range withTextKitParagraphStyle:style]; - } -} - -- (void)attributeTextInRange:(NSRange)range withTextKitLineHeight:(CGFloat)lineHeight -{ - [self attributeTextInRange:range withTextKitMinimumLineHeight:lineHeight maximumLineHeight:lineHeight]; -} - -- (void)attributeTextInRange:(NSRange)range withTextKitParagraphStyle:(NSParagraphStyle *)paragraphStyle -{ - if (range.length) { - [self addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.h b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.h deleted file mode 100644 index e3d0f211..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.h +++ /dev/null @@ -1,119 +0,0 @@ -// -// _ASAsyncTransaction.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#define ASDISPLAYNODE_DELAY_DISPLAY 0 - -@class _ASAsyncTransaction; - -typedef void(^asyncdisplaykit_async_transaction_completion_block_t)(_ASAsyncTransaction *completedTransaction, BOOL canceled); -typedef id _Nullable(^asyncdisplaykit_async_transaction_operation_block_t)(void); -typedef void(^asyncdisplaykit_async_transaction_operation_completion_block_t)(id _Nullable value, BOOL canceled); - -/** - State is initially ASAsyncTransactionStateOpen. - Every transaction MUST be committed. It is an error to fail to commit a transaction. - A committed transaction MAY be canceled. You cannot cancel an open (uncommitted) transaction. - */ -typedef NS_ENUM(NSUInteger, ASAsyncTransactionState) { - ASAsyncTransactionStateOpen = 0, - ASAsyncTransactionStateCommitted, - ASAsyncTransactionStateCanceled, - ASAsyncTransactionStateComplete -}; - -ASDK_EXTERN NSInteger const ASDefaultTransactionPriority; - -/** - @summary ASAsyncTransaction provides lightweight transaction semantics for asynchronous operations. - - @desc ASAsyncTransaction provides the following properties: - - - Transactions group an arbitrary number of operations, each consisting of an execution block and a completion block. - - The execution block returns a single object that will be passed to the completion block. - - Execution blocks added to a transaction will run in parallel on the global background dispatch queues; - the completion blocks are dispatched to the callback queue. - - Every operation completion block is guaranteed to execute, regardless of cancelation. - However, execution blocks may be skipped if the transaction is canceled. - - Operation completion blocks are always executed in the order they were added to the transaction, assuming the - callback queue is serial of course. - */ -@interface _ASAsyncTransaction : NSObject - -/** - @summary Initialize a transaction that can start collecting async operations. - - @param completionBlock A block that is called when the transaction is completed. - */ -- (instancetype)initWithCompletionBlock:(nullable asyncdisplaykit_async_transaction_completion_block_t)completionBlock; - -/** - @summary Block the main thread until the transaction is complete, including callbacks. - - @desc This must be called on the main thread. - */ -- (void)waitUntilComplete; - -/** - A block that is called when the transaction is completed. - */ -@property (nullable, readonly) asyncdisplaykit_async_transaction_completion_block_t completionBlock; - -/** - The state of the transaction. - @see ASAsyncTransactionState - */ -@property (readonly) ASAsyncTransactionState state; - -/** - @summary Adds a synchronous operation to the transaction. The execution block will be executed immediately. - - @desc The block will be executed on the specified queue and is expected to complete synchronously. The async - transaction will wait for all operations to execute on their appropriate queues, so the blocks may still be executing - async if they are running on a concurrent queue, even though the work for this block is synchronous. - - @param block The execution block that will be executed on a background queue. This is where the expensive work goes. - @param priority Execution priority; Tasks with higher priority will be executed sooner - @param queue The dispatch queue on which to execute the block. - @param completion The completion block that will be executed with the output of the execution block when all of the - operations in the transaction are completed. Executed and released on callbackQueue. - */ -- (void)addOperationWithBlock:(asyncdisplaykit_async_transaction_operation_block_t)block - priority:(NSInteger)priority - queue:(dispatch_queue_t)queue - completion:(nullable asyncdisplaykit_async_transaction_operation_completion_block_t)completion; - -/** - @summary Cancels all operations in the transaction. - - @desc You can only cancel a committed transaction. - - All completion blocks are always called, regardless of cancelation. Execution blocks may be skipped if canceled. - */ -- (void)cancel; - -/** - @summary Marks the end of adding operations to the transaction. - - @desc You MUST commit every transaction you create. It is an error to create a transaction that is never committed. - - When all of the operations that have been added have completed the transaction will execute their completion - blocks. - - If no operations were added to this transaction, invoking commit will execute the transaction's completion block synchronously. - */ -- (void)commit; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.mm b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.mm deleted file mode 100644 index 48348ca8..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransaction.mm +++ /dev/null @@ -1,461 +0,0 @@ -// -// _ASAsyncTransaction.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import -#import -#import -#import -#import -#import - -#ifndef __STRICT_ANSI__ - #warning "Texture must be compiled with std=c++11 to prevent layout issues. gnu++ is not supported. This is hopefully temporary." -#endif - -ASDK_EXTERN NSRunLoopMode const UITrackingRunLoopMode; - -NSInteger const ASDefaultTransactionPriority = 0; - -@interface ASAsyncTransactionOperation : NSObject -- (instancetype)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock; -@property (nonatomic) asyncdisplaykit_async_transaction_operation_completion_block_t operationCompletionBlock; -@property id value; // set on bg queue by the operation block -@end - -@implementation ASAsyncTransactionOperation - -- (instancetype)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock -{ - if ((self = [super init])) { - _operationCompletionBlock = operationCompletionBlock; - } - return self; -} - -- (void)dealloc -{ - NSAssert(_operationCompletionBlock == nil, @"Should have been called and released before -dealloc"); -} - -- (void)callAndReleaseCompletionBlock:(BOOL)canceled -{ - ASDisplayNodeAssertMainThread(); - if (_operationCompletionBlock) { - _operationCompletionBlock(self.value, canceled); - // Guarantee that _operationCompletionBlock is released on main thread - _operationCompletionBlock = nil; - } -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"", self, self.value]; -} - -@end - -// Lightweight operation queue for _ASAsyncTransaction that limits number of spawned threads -class ASAsyncTransactionQueue -{ -public: - - // Similar to dispatch_group_t - class Group - { - public: - // call when group is no longer needed; after last scheduled operation the group will delete itself - virtual void release() = 0; - - // schedule block on given queue - virtual void schedule(NSInteger priority, dispatch_queue_t queue, dispatch_block_t block) = 0; - - // dispatch block on given queue when all previously scheduled blocks finished executing - virtual void notify(dispatch_queue_t queue, dispatch_block_t block) = 0; - - // used when manually executing blocks - virtual void enter() = 0; - virtual void leave() = 0; - - // wait until all scheduled blocks finished executing - virtual void wait() = 0; - - protected: - virtual ~Group() { }; // call release() instead - }; - - // Create new group - Group *createGroup(); - - static ASAsyncTransactionQueue &instance(); - -private: - - struct GroupNotify - { - dispatch_block_t _block; - dispatch_queue_t _queue; - }; - - class GroupImpl : public Group - { - public: - GroupImpl(ASAsyncTransactionQueue &queue) - : _pendingOperations(0) - , _releaseCalled(false) - , _queue(queue) - { - } - - virtual void release(); - virtual void schedule(NSInteger priority, dispatch_queue_t queue, dispatch_block_t block); - virtual void notify(dispatch_queue_t queue, dispatch_block_t block); - virtual void enter(); - virtual void leave(); - virtual void wait(); - - int _pendingOperations; - std::list _notifyList; - std::condition_variable _condition; - BOOL _releaseCalled; - ASAsyncTransactionQueue &_queue; - }; - - struct Operation - { - dispatch_block_t _block; - GroupImpl *_group; - NSInteger _priority; - }; - - struct DispatchEntry // entry for each dispatch queue - { - typedef std::list OperationQueue; - typedef std::list OperationIteratorList; // each item points to operation queue - typedef std::map OperationPriorityMap; // sorted by priority - - OperationQueue _operationQueue; - OperationPriorityMap _operationPriorityMap; - int _threadCount; - - Operation popNextOperation(bool respectPriority); // assumes locked mutex - void pushOperation(Operation operation); // assumes locked mutex - }; - - std::map _entries; - std::mutex _mutex; -}; - -ASAsyncTransactionQueue::Group* ASAsyncTransactionQueue::createGroup() -{ - Group *res = new GroupImpl(*this); - return res; -} - -void ASAsyncTransactionQueue::GroupImpl::release() -{ - std::lock_guard l(_queue._mutex); - - if (_pendingOperations == 0) { - delete this; - } else { - _releaseCalled = YES; - } -} - -ASAsyncTransactionQueue::Operation ASAsyncTransactionQueue::DispatchEntry::popNextOperation(bool respectPriority) -{ - NSCAssert(!_operationQueue.empty() && !_operationPriorityMap.empty(), @"No scheduled operations available"); - - OperationQueue::iterator queueIterator; - OperationPriorityMap::iterator mapIterator; - - if (respectPriority) { - mapIterator = --_operationPriorityMap.end(); // highest priority "bucket" - queueIterator = *mapIterator->second.begin(); - } else { - queueIterator = _operationQueue.begin(); - mapIterator = _operationPriorityMap.find(queueIterator->_priority); - } - - // no matter what, first item in "bucket" must match item in queue - NSCAssert(mapIterator->second.front() == queueIterator, @"Queue inconsistency"); - - Operation res = *queueIterator; - _operationQueue.erase(queueIterator); - - mapIterator->second.pop_front(); - if (mapIterator->second.empty()) { - _operationPriorityMap.erase(mapIterator); - } - - return res; -} - -void ASAsyncTransactionQueue::DispatchEntry::pushOperation(ASAsyncTransactionQueue::Operation operation) -{ - _operationQueue.push_back(operation); - - OperationIteratorList &list = _operationPriorityMap[operation._priority]; - list.push_back(--_operationQueue.end()); -} - -void ASAsyncTransactionQueue::GroupImpl::schedule(NSInteger priority, dispatch_queue_t queue, dispatch_block_t block) -{ - ASAsyncTransactionQueue &q = _queue; - std::lock_guard l(q._mutex); - - DispatchEntry &entry = q._entries[queue]; - - Operation operation; - operation._block = block; - operation._group = this; - operation._priority = priority; - entry.pushOperation(operation); - - ++_pendingOperations; // enter group - -#if ASDISPLAYNODE_DELAY_DISPLAY - NSUInteger maxThreads = 1; -#else - NSUInteger maxThreads = [NSProcessInfo processInfo].activeProcessorCount * 2; - - // Bit questionable maybe - we can give main thread more CPU time during tracking. - if ([[NSRunLoop mainRunLoop].currentMode isEqualToString:UITrackingRunLoopMode]) - --maxThreads; -#endif - - if (entry._threadCount < maxThreads) { // we need to spawn another thread - - // first thread will take operations in queue order (regardless of priority), other threads will respect priority - bool respectPriority = entry._threadCount > 0; - ++entry._threadCount; - - dispatch_async(queue, ^{ - std::unique_lock lock(q._mutex); - - // go until there are no more pending operations - while (!entry._operationQueue.empty()) { - Operation operation = entry.popNextOperation(respectPriority); - lock.unlock(); - if (operation._block) { - operation._block(); - } - operation._group->leave(); - operation._block = nil; // the block must be freed while mutex is unlocked - lock.lock(); - } - --entry._threadCount; - - if (entry._threadCount == 0) { - NSCAssert(entry._operationQueue.empty() || entry._operationPriorityMap.empty(), @"No working threads but operations are still scheduled"); // this shouldn't happen - q._entries.erase(queue); - } - }); - } -} - -void ASAsyncTransactionQueue::GroupImpl::notify(dispatch_queue_t queue, dispatch_block_t block) -{ - std::lock_guard l(_queue._mutex); - - if (_pendingOperations == 0) { - dispatch_async(queue, block); - } else { - _notifyList.push_back({block, queue}); - } -} - -void ASAsyncTransactionQueue::GroupImpl::enter() -{ - std::lock_guard l(_queue._mutex); - ++_pendingOperations; -} - -void ASAsyncTransactionQueue::GroupImpl::leave() -{ - std::lock_guard l(_queue._mutex); - --_pendingOperations; - - if (_pendingOperations == 0) { - std::list notifyList; - _notifyList.swap(notifyList); - - for (GroupNotify & notify : notifyList) { - dispatch_async(notify._queue, notify._block); - } - - _condition.notify_one(); - - // there was attempt to release the group before, but we still - // had operations scheduled so now is good time - if (_releaseCalled) { - delete this; - } - } -} - -void ASAsyncTransactionQueue::GroupImpl::wait() -{ - std::unique_lock lock(_queue._mutex); - while (_pendingOperations > 0) { - _condition.wait(lock); - } -} - -ASAsyncTransactionQueue & ASAsyncTransactionQueue::instance() -{ - static ASAsyncTransactionQueue *instance = new ASAsyncTransactionQueue(); - return *instance; -} - -@interface _ASAsyncTransaction () -@property ASAsyncTransactionState state; -@end - - -@implementation _ASAsyncTransaction -{ - ASAsyncTransactionQueue::Group *_group; - NSMutableArray *_operations; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithCompletionBlock:(void(^)(_ASAsyncTransaction *, BOOL))completionBlock -{ - if ((self = [super init])) { - _completionBlock = completionBlock; - self.state = ASAsyncTransactionStateOpen; - } - return self; -} - -- (void)dealloc -{ - // Uncommitted transactions break our guarantees about releasing completion blocks on callbackQueue. - NSAssert(self.state != ASAsyncTransactionStateOpen, @"Uncommitted ASAsyncTransactions are not allowed"); - if (_group) { - _group->release(); - } -} - -#pragma mark - Transaction Management - -- (void)addOperationWithBlock:(asyncdisplaykit_async_transaction_operation_block_t)block - priority:(NSInteger)priority - queue:(dispatch_queue_t)queue - completion:(asyncdisplaykit_async_transaction_operation_completion_block_t)completion -{ - ASDisplayNodeAssertMainThread(); - NSAssert(self.state == ASAsyncTransactionStateOpen, @"You can only add operations to open transactions"); - - [self _ensureTransactionData]; - - ASAsyncTransactionOperation *operation = [[ASAsyncTransactionOperation alloc] initWithOperationCompletionBlock:completion]; - [_operations addObject:operation]; - _group->schedule(priority, queue, ^{ - @autoreleasepool { - if (self.state != ASAsyncTransactionStateCanceled) { - operation.value = block(); - } - } - }); -} - -- (void)cancel -{ - ASDisplayNodeAssertMainThread(); - NSAssert(self.state != ASAsyncTransactionStateOpen, @"You can only cancel a committed or already-canceled transaction"); - self.state = ASAsyncTransactionStateCanceled; -} - -- (void)commit -{ - ASDisplayNodeAssertMainThread(); - NSAssert(self.state == ASAsyncTransactionStateOpen, @"You cannot double-commit a transaction"); - self.state = ASAsyncTransactionStateCommitted; - - if ([_operations count] == 0) { - // Fast path: if a transaction was opened, but no operations were added, execute completion block synchronously. - if (_completionBlock) { - _completionBlock(self, NO); - } - } else { - NSAssert(_group != NULL, @"If there are operations, dispatch group should have been created"); - - _group->notify(dispatch_get_main_queue(), ^{ - [self completeTransaction]; - }); - } -} - -- (void)completeTransaction -{ - ASDisplayNodeAssertMainThread(); - ASAsyncTransactionState state = self.state; - if (state != ASAsyncTransactionStateComplete) { - BOOL isCanceled = (state == ASAsyncTransactionStateCanceled); - for (ASAsyncTransactionOperation *operation in _operations) { - [operation callAndReleaseCompletionBlock:isCanceled]; - } - - // Always set state to Complete, even if we were cancelled, to block any extraneous - // calls to this method that may have been scheduled for the next runloop - // (e.g. if we needed to force one in this runloop with -waitUntilComplete, but another was already scheduled) - self.state = ASAsyncTransactionStateComplete; - - if (_completionBlock) { - _completionBlock(self, isCanceled); - } - } -} - -- (void)waitUntilComplete -{ - ASDisplayNodeAssertMainThread(); - if (self.state != ASAsyncTransactionStateComplete) { - if (_group) { - _group->wait(); - - // At this point, the asynchronous operation may have completed, but the runloop - // observer has not committed the batch of transactions we belong to. It's important to - // commit ourselves via the group to avoid double-committing the transaction. - // This is only necessary when forcing display work to complete before allowing the runloop - // to continue, e.g. in the implementation of -[ASDisplayNode recursivelyEnsureDisplay]. - if (self.state == ASAsyncTransactionStateOpen) { - [_ASAsyncTransactionGroup.mainTransactionGroup commit]; - NSAssert(self.state != ASAsyncTransactionStateOpen, @"Transaction should not be open after committing group"); - } - // If we needed to commit the group above, -completeTransaction may have already been run. - // It is designed to accommodate this by checking _state to ensure it is not complete. - [self completeTransaction]; - } - } -} - -#pragma mark - Helper Methods - -- (void)_ensureTransactionData -{ - // Lazily initialize _group and _operations to avoid overhead in the case where no operations are added to the transaction - if (_group == NULL) { - _group = ASAsyncTransactionQueue::instance().createGroup(); - } - if (_operations == nil) { - _operations = [[NSMutableArray alloc] init]; - } -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"<_ASAsyncTransaction: %p - _state = %lu, _group = %p, _operations = %@>", self, (unsigned long)self.state, _group, _operations]; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h deleted file mode 100644 index cd4b414a..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer+Private.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// _ASAsyncTransactionContainer+Private.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class _ASAsyncTransaction; - -@interface CALayer (ASAsyncTransactionContainerTransactions) -@property (nonatomic, nullable, setter=asyncdisplaykit_setAsyncLayerTransactions:) NSMutableSet<_ASAsyncTransaction *> *asyncdisplaykit_asyncLayerTransactions; - -- (void)asyncdisplaykit_asyncTransactionContainerWillBeginTransaction:(_ASAsyncTransaction *)transaction; -- (void)asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:(_ASAsyncTransaction *)transaction; -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.h b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.h deleted file mode 100644 index 53fe40f8..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// _ASAsyncTransactionContainer.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class _ASAsyncTransaction; - -typedef NS_ENUM(NSUInteger, ASAsyncTransactionContainerState) { - /** - The async container has no outstanding transactions. - Whatever it is displaying is up-to-date. - */ - ASAsyncTransactionContainerStateNoTransactions = 0, - /** - The async container has one or more outstanding async transactions. - Its contents may be out of date or showing a placeholder, depending on the configuration of the contained ASDisplayLayers. - */ - ASAsyncTransactionContainerStatePendingTransactions, -}; - -@protocol ASAsyncTransactionContainer - -/** - @summary If YES, the receiver is marked as a container for async transactions, grouping all of the transactions - in the container hierarchy below the receiver together in a single ASAsyncTransaction. - - @default NO - */ -@property (nonatomic, getter=asyncdisplaykit_isAsyncTransactionContainer, setter=asyncdisplaykit_setAsyncTransactionContainer:) BOOL asyncdisplaykit_asyncTransactionContainer; - -/** - @summary The current state of the receiver; indicates if it is currently performing asynchronous operations or if all operations have finished/canceled. - */ -@property (nonatomic, readonly) ASAsyncTransactionContainerState asyncdisplaykit_asyncTransactionContainerState; - -/** - @summary Cancels all async transactions on the receiver. - */ -- (void)asyncdisplaykit_cancelAsyncTransactions; - -@property (nullable, nonatomic, setter=asyncdisplaykit_setCurrentAsyncTransaction:) _ASAsyncTransaction *asyncdisplaykit_currentAsyncTransaction; - -@end - -@interface CALayer (ASAsyncTransactionContainer) -/** - @summary Returns the current async transaction for this layer. A new transaction is created if one - did not already exist. This method will always return an open, uncommitted transaction. - @desc asyncdisplaykit_asyncTransactionContainer does not need to be YES for this to return a transaction. - Defaults to nil. - */ -@property (nullable, nonatomic, readonly) _ASAsyncTransaction *asyncdisplaykit_asyncTransaction; - -/** - @summary Goes up the superlayer chain until it finds the first layer with asyncdisplaykit_asyncTransactionContainer=YES (including the receiver) and returns it. - Returns nil if no parent container is found. - */ -@property (nullable, nonatomic, readonly) CALayer *asyncdisplaykit_parentTransactionContainer; - -/** - @summary Whether or not this layer should serve as a transaction container. - Defaults to NO. - */ -@property (nonatomic, getter=asyncdisplaykit_isAsyncTransactionContainer, setter = asyncdisplaykit_setAsyncTransactionContainer:) BOOL asyncdisplaykit_asyncTransactionContainer; - -@end - -@interface UIView (ASAsyncTransactionContainer) -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.mm b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.mm deleted file mode 100644 index 669a083b..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionContainer.mm +++ /dev/null @@ -1,126 +0,0 @@ -// -// _ASAsyncTransactionContainer.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import - -@implementation CALayer (ASAsyncTransactionContainerTransactions) -@dynamic asyncdisplaykit_asyncLayerTransactions; - -// No-ops in the base class. Mostly exposed for testing. -- (void)asyncdisplaykit_asyncTransactionContainerWillBeginTransaction:(_ASAsyncTransaction *)transaction {} -- (void)asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:(_ASAsyncTransaction *)transaction {} -@end - -@implementation CALayer (ASAsyncTransactionContainer) -@dynamic asyncdisplaykit_currentAsyncTransaction; -@dynamic asyncdisplaykit_asyncTransactionContainer; - -- (ASAsyncTransactionContainerState)asyncdisplaykit_asyncTransactionContainerState -{ - return ([self.asyncdisplaykit_asyncLayerTransactions count] == 0) ? ASAsyncTransactionContainerStateNoTransactions : ASAsyncTransactionContainerStatePendingTransactions; -} - -- (void)asyncdisplaykit_cancelAsyncTransactions -{ - // If there was an open transaction, commit and clear the current transaction. Otherwise: - // (1) The run loop observer will try to commit a canceled transaction which is not allowed - // (2) We leave the canceled transaction attached to the layer, dooming future operations - _ASAsyncTransaction *currentTransaction = self.asyncdisplaykit_currentAsyncTransaction; - [currentTransaction commit]; - self.asyncdisplaykit_currentAsyncTransaction = nil; - - for (_ASAsyncTransaction *transaction in [self.asyncdisplaykit_asyncLayerTransactions copy]) { - [transaction cancel]; - } -} - -- (_ASAsyncTransaction *)asyncdisplaykit_asyncTransaction -{ - _ASAsyncTransaction *transaction = self.asyncdisplaykit_currentAsyncTransaction; - if (transaction == nil) { - NSMutableSet<_ASAsyncTransaction *> *transactions = self.asyncdisplaykit_asyncLayerTransactions; - if (transactions == nil) { - transactions = ASCreatePointerBasedMutableSet(); - self.asyncdisplaykit_asyncLayerTransactions = transactions; - } - __weak CALayer *weakSelf = self; - transaction = [[_ASAsyncTransaction alloc] initWithCompletionBlock:^(_ASAsyncTransaction *completedTransaction, BOOL cancelled) { - __strong CALayer *self = weakSelf; - if (self == nil) { - return; - } - [self.asyncdisplaykit_asyncLayerTransactions removeObject:completedTransaction]; - if (self.asyncdisplaykit_asyncLayerTransactions.count == 0) { - // Reclaim object memory. - self.asyncdisplaykit_asyncLayerTransactions = nil; - } - [self asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:completedTransaction]; - }]; - [transactions addObject:transaction]; - self.asyncdisplaykit_currentAsyncTransaction = transaction; - [self asyncdisplaykit_asyncTransactionContainerWillBeginTransaction:transaction]; - } - [_ASAsyncTransactionGroup.mainTransactionGroup addTransactionContainer:self]; - return transaction; -} - -- (CALayer *)asyncdisplaykit_parentTransactionContainer -{ - CALayer *containerLayer = self; - while (containerLayer && !containerLayer.asyncdisplaykit_isAsyncTransactionContainer) { - containerLayer = containerLayer.superlayer; - } - return containerLayer; -} - -@end - -@implementation UIView (ASAsyncTransactionContainer) - -- (BOOL)asyncdisplaykit_isAsyncTransactionContainer -{ - return self.layer.asyncdisplaykit_isAsyncTransactionContainer; -} - -- (void)asyncdisplaykit_setAsyncTransactionContainer:(BOOL)asyncTransactionContainer -{ - self.layer.asyncdisplaykit_asyncTransactionContainer = asyncTransactionContainer; -} - -- (ASAsyncTransactionContainerState)asyncdisplaykit_asyncTransactionContainerState -{ - return self.layer.asyncdisplaykit_asyncTransactionContainerState; -} - -- (void)asyncdisplaykit_cancelAsyncTransactions -{ - [self.layer asyncdisplaykit_cancelAsyncTransactions]; -} - -- (void)asyncdisplaykit_asyncTransactionContainerStateDidChange -{ - // No-op in the base class. -} - -- (void)asyncdisplaykit_setCurrentAsyncTransaction:(_ASAsyncTransaction *)transaction -{ - self.layer.asyncdisplaykit_currentAsyncTransaction = transaction; -} - -- (_ASAsyncTransaction *)asyncdisplaykit_currentAsyncTransaction -{ - return self.layer.asyncdisplaykit_currentAsyncTransaction; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.h b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.h deleted file mode 100644 index cd0b216c..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// _ASAsyncTransactionGroup.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASAsyncTransactionContainer; - -/// A group of transaction containers, for which the current transactions are committed together at the end of the next runloop tick. -AS_SUBCLASSING_RESTRICTED -@interface _ASAsyncTransactionGroup : NSObject - -/// The main transaction group is scheduled to commit on every tick of the main runloop. -/// Access from the main thread only. -@property (class, nonatomic, readonly) _ASAsyncTransactionGroup *mainTransactionGroup; - -- (void)commit; - -/// Add a transaction container to be committed. -- (void)addTransactionContainer:(id)container; - -/// Use the main group. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.mm b/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.mm deleted file mode 100644 index 62cf4c7d..00000000 --- a/Example/Pods/Texture/Source/Details/Transactions/_ASAsyncTransactionGroup.mm +++ /dev/null @@ -1,87 +0,0 @@ -// -// _ASAsyncTransactionGroup.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -@implementation _ASAsyncTransactionGroup { - NSHashTable> *_containers; -} - -+ (_ASAsyncTransactionGroup *)mainTransactionGroup -{ - ASDisplayNodeAssertMainThread(); - static _ASAsyncTransactionGroup *mainTransactionGroup; - - if (mainTransactionGroup == nil) { - mainTransactionGroup = [[_ASAsyncTransactionGroup alloc] _init]; - [mainTransactionGroup registerAsMainRunloopObserver]; - } - return mainTransactionGroup; -} - -- (void)registerAsMainRunloopObserver -{ - ASDisplayNodeAssertMainThread(); - static CFRunLoopObserverRef observer; - ASDisplayNodeAssert(observer == NULL, @"A _ASAsyncTransactionGroup should not be registered on the main runloop twice"); - // defer the commit of the transaction so we can add more during the current runloop iteration - CFRunLoopRef runLoop = CFRunLoopGetCurrent(); - CFOptionFlags activities = (kCFRunLoopBeforeWaiting | // before the run loop starts sleeping - kCFRunLoopExit); // before exiting a runloop run - - observer = CFRunLoopObserverCreateWithHandler(NULL, // allocator - activities, // activities - YES, // repeats - INT_MAX, // order after CA transaction commits - ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - ASDisplayNodeCAssertMainThread(); - [self commit]; - }); - CFRunLoopAddObserver(runLoop, observer, kCFRunLoopCommonModes); - CFRelease(observer); -} - -- (instancetype)_init -{ - if ((self = [super init])) { - _containers = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - } - return self; -} - -- (void)addTransactionContainer:(id)container -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeAssert(container != nil, @"No container"); - [_containers addObject:container]; -} - -- (void)commit -{ - ASDisplayNodeAssertMainThread(); - - if ([_containers count]) { - NSHashTable *containersToCommit = _containers; - _containers = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - - for (id container in containersToCommit) { - // Note that the act of committing a transaction may open a new transaction, - // so we must nil out the transaction we're committing first. - _ASAsyncTransaction *transaction = container.asyncdisplaykit_currentAsyncTransaction; - container.asyncdisplaykit_currentAsyncTransaction = nil; - [transaction commit]; - } - } -} - -@end diff --git a/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.h b/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.h deleted file mode 100644 index 78e55a17..00000000 --- a/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// UICollectionViewLayout+ASConvenience.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@protocol ASCollectionViewLayoutInspecting; - -NS_ASSUME_NONNULL_BEGIN - -@interface UICollectionViewLayout (ASLayoutInspectorProviding) - -/** - * You can override this method on your @c UICollectionViewLayout subclass to - * return a layout inspector tailored to your layout. - * - * It's fine to return @c self. You must not return @c nil. - */ -- (id)asdk_layoutInspector; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.mm b/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.mm deleted file mode 100644 index b7564d0a..00000000 --- a/Example/Pods/Texture/Source/Details/UICollectionViewLayout+ASConvenience.mm +++ /dev/null @@ -1,28 +0,0 @@ -// -// UICollectionViewLayout+ASConvenience.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -@implementation UICollectionViewLayout (ASLayoutInspectorProviding) - -- (id)asdk_layoutInspector -{ - UICollectionViewFlowLayout *flow = ASDynamicCast(self, UICollectionViewFlowLayout); - if (flow != nil) { - return [[ASCollectionViewFlowLayoutInspector alloc] initWithFlowLayout:flow]; - } else { - return [[ASCollectionViewLayoutInspector alloc] init]; - } -} - -@end diff --git a/Example/Pods/Texture/Source/Details/UIView+ASConvenience.h b/Example/Pods/Texture/Source/Details/UIView+ASConvenience.h deleted file mode 100644 index 870793bd..00000000 --- a/Example/Pods/Texture/Source/Details/UIView+ASConvenience.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// UIView+ASConvenience.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - - -/** - These are the properties we support from CALayer (implemented in the pending state) - */ - -@protocol ASDisplayProperties - -@property (nonatomic) CGPoint position; -@property (nonatomic) CGFloat zPosition; -@property (nonatomic) CGPoint anchorPoint; -@property (nonatomic) CGFloat cornerRadius; -@property (nonatomic) CACornerMask maskedCorners API_AVAILABLE(ios(11), tvos(11)); -@property (nullable, nonatomic) id contents; -@property (nonatomic, copy) NSString *contentsGravity; -@property (nonatomic) CGRect contentsRect; -@property (nonatomic) CGRect contentsCenter; -@property (nonatomic) CGFloat contentsScale; -@property (nonatomic) CGFloat rasterizationScale; -@property (nonatomic) CATransform3D transform; -@property (nonatomic) CATransform3D sublayerTransform; -@property (nonatomic) BOOL needsDisplayOnBoundsChange; -@property (nonatomic) __attribute__((NSObject)) CGColorRef shadowColor; -@property (nonatomic) CGFloat shadowOpacity; -@property (nonatomic) CGSize shadowOffset; -@property (nonatomic) CGFloat shadowRadius; -@property (nonatomic) CGFloat borderWidth; -@property (nonatomic, getter = isOpaque) BOOL opaque; -@property (nonatomic) __attribute__((NSObject)) CGColorRef borderColor; -@property (nonatomic) UIColor *backgroundColor; -@property (nonatomic) BOOL allowsGroupOpacity; -@property (nonatomic) BOOL allowsEdgeAntialiasing; -@property (nonatomic) CAEdgeAntialiasingMask edgeAntialiasingMask; -@property (nonatomic, nullable, copy) NSDictionary> *actions; - -- (void)setNeedsDisplay; -- (void)setNeedsLayout; -- (void)layoutIfNeeded; - -@end - -/** - These are all of the "good" properties of the UIView API that we support in pendingViewState or view of an ASDisplayNode. - */ -@protocol ASDisplayNodeViewProperties - -@property (nonatomic) BOOL clipsToBounds; -@property (nonatomic, getter=isHidden) BOOL hidden; -@property (nonatomic) BOOL autoresizesSubviews; -@property (nonatomic) UIViewAutoresizing autoresizingMask; -@property (nonatomic, null_resettable) UIColor *tintColor; -@property (nonatomic) CGFloat alpha; -@property (nonatomic) CGRect bounds; -@property (nonatomic) CGRect frame; // Only for use with nodes wrapping synchronous views -@property (nonatomic) UIViewContentMode contentMode; -@property (nonatomic) UISemanticContentAttribute semanticContentAttribute API_AVAILABLE(ios(9.0), tvos(9.0)); -@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled; -@property (nonatomic, getter=isExclusiveTouch) BOOL exclusiveTouch; -@property (nonatomic, getter=asyncdisplaykit_isAsyncTransactionContainer, setter = asyncdisplaykit_setAsyncTransactionContainer:) BOOL asyncdisplaykit_asyncTransactionContainer; -@property (nonatomic) UIEdgeInsets layoutMargins; -@property (nonatomic) BOOL preservesSuperviewLayoutMargins; -@property (nonatomic) BOOL insetsLayoutMarginsFromSafeArea; - -/** - Following properties of the UIAccessibility informal protocol are supported as well. - We don't declare them here, so _ASPendingState does not complain about them being not implemented, - as they are already on NSObject - - @property (nonatomic) BOOL isAccessibilityElement; - @property (nonatomic, copy, nullable) NSString *accessibilityLabel; - @property (nonatomic, copy, nullable) NSAttributedString *accessibilityAttributedLabel API_AVAILABLE(ios(11.0),tvos(11.0)); - @property (nonatomic, copy, nullable) NSString *accessibilityHint; - @property (nonatomic, copy, nullable) NSAttributedString *accessibilityAttributedHint API_AVAILABLE(ios(11.0),tvos(11.0)); - @property (nonatomic, copy, nullable) NSString *accessibilityValue; - @property (nonatomic, copy, nullable) NSAttributedString *accessibilityAttributedValue API_AVAILABLE(ios(11.0),tvos(11.0)); - @property (nonatomic) UIAccessibilityTraits accessibilityTraits; - @property (nonatomic) CGRect accessibilityFrame; - @property (nonatomic, nullable) NSString *accessibilityLanguage; - @property (nonatomic) BOOL accessibilityElementsHidden; - @property (nonatomic) BOOL accessibilityViewIsModal; - @property (nonatomic) BOOL shouldGroupAccessibilityChildren; - */ - -// Accessibility identification support -@property (nullable, nonatomic, copy) NSString *accessibilityIdentifier; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.h b/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.h deleted file mode 100644 index fdef3595..00000000 --- a/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// _ASCollectionReusableView.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASCellNode, ASCollectionElement; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED // Note: ASDynamicCastStrict is used on instances of this class based on this restriction. -@interface _ASCollectionReusableView : UICollectionReusableView - -@property (nullable, nonatomic, readonly) ASCellNode *node; -@property (nullable, nonatomic) ASCollectionElement *element; -@property (nullable, nonatomic) UICollectionViewLayoutAttributes *layoutAttributes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.mm b/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.mm deleted file mode 100644 index 0ca4b811..00000000 --- a/Example/Pods/Texture/Source/Details/_ASCollectionReusableView.mm +++ /dev/null @@ -1,89 +0,0 @@ -// -// _ASCollectionReusableView.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -@implementation _ASCollectionReusableView - -- (ASCellNode *)node -{ - return self.element.node; -} - -- (void)setElement:(ASCollectionElement *)element -{ - ASDisplayNodeAssertMainThread(); - element.node.layoutAttributes = _layoutAttributes; - _element = element; -} - -- (void)setLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - _layoutAttributes = layoutAttributes; - self.node.layoutAttributes = layoutAttributes; -} - -- (void)prepareForReuse -{ - self.layoutAttributes = nil; - - // Need to clear element before UIKit calls setSelected:NO / setHighlighted:NO on its cells - self.element = nil; - [super prepareForReuse]; -} - -/** - * In the initial case, this is called by UICollectionView during cell dequeueing, before - * we get a chance to assign a node to it, so we must be sure to set these layout attributes - * on our node when one is next assigned to us in @c setNode: . Since there may be cases when we _do_ already - * have our node assigned e.g. during a layout update for existing cells, we also attempt - * to update it now. - */ -- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - self.layoutAttributes = layoutAttributes; -} - -/** - * Keep our node filling our content view. - */ -- (void)layoutSubviews -{ - [super layoutSubviews]; - self.node.frame = self.bounds; -} - -@end - -/** - * A category that makes _ASCollectionReusableView conform to IGListBindable. - * - * We don't need to do anything to bind the view model – the cell node - * serves the same purpose. - */ -#if __has_include() - -#import - -@interface _ASCollectionReusableView (IGListBindable) -@end - -@implementation _ASCollectionReusableView (IGListBindable) - -- (void)bindViewModel:(id)viewModel -{ - // nop -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.h b/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.h deleted file mode 100644 index 94672a96..00000000 --- a/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// _ASCollectionViewCell.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASCollectionElement; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED // Note: ASDynamicCastStrict is used on instances of this class based on this restriction. -@interface _ASCollectionViewCell : UICollectionViewCell - -@property (nonatomic, nullable) ASCollectionElement *element; -@property (nullable, nonatomic, readonly) ASCellNode *node; -@property (nonatomic, nullable) UICollectionViewLayoutAttributes *layoutAttributes; - -/** - * Whether or not this cell is interested in cell node visibility events. - * -cellNodeVisibilityEvent:inScrollView: should be called only if this property is YES. - */ -@property (nonatomic, readonly) BOOL consumesCellNodeVisibilityEvents; - -- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(UIScrollView *)scrollView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.mm b/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.mm deleted file mode 100644 index 93f4626a..00000000 --- a/Example/Pods/Texture/Source/Details/_ASCollectionViewCell.mm +++ /dev/null @@ -1,151 +0,0 @@ -// -// _ASCollectionViewCell.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import -#import -#import - -@implementation _ASCollectionViewCell - -- (ASCellNode *)node -{ - return self.element.node; -} - -- (void)setElement:(ASCollectionElement *)element -{ - ASDisplayNodeAssertMainThread(); - ASCellNode *node = element.node; - node.layoutAttributes = _layoutAttributes; - _element = element; - - [node __setSelectedFromUIKit:self.selected]; - [node __setHighlightedFromUIKit:self.highlighted]; -} - -- (BOOL)consumesCellNodeVisibilityEvents -{ - ASCellNode *node = self.node; - if (node == nil) { - return NO; - } - return ASSubclassOverridesSelector([ASCellNode class], [node class], @selector(cellNodeVisibilityEvent:inScrollView:withCellFrame:)); -} - -- (void)cellNodeVisibilityEvent:(ASCellNodeVisibilityEvent)event inScrollView:(UIScrollView *)scrollView -{ - [self.node cellNodeVisibilityEvent:event inScrollView:scrollView withCellFrame:self.frame]; -} - -- (void)setSelected:(BOOL)selected -{ - [super setSelected:selected]; - [self.node __setSelectedFromUIKit:selected]; -} - -- (void)setHighlighted:(BOOL)highlighted -{ - [super setHighlighted:highlighted]; - [self.node __setHighlightedFromUIKit:highlighted]; -} - -- (void)setLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - _layoutAttributes = layoutAttributes; - self.node.layoutAttributes = layoutAttributes; -} - -- (void)prepareForReuse -{ - self.layoutAttributes = nil; - - // Need to clear element before UIKit calls setSelected:NO / setHighlighted:NO on its cells - self.element = nil; - [super prepareForReuse]; -} - -/** - * In the initial case, this is called by UICollectionView during cell dequeueing, before - * we get a chance to assign a node to it, so we must be sure to set these layout attributes - * on our node when one is next assigned to us in @c setNode: . Since there may be cases when we _do_ already - * have our node assigned e.g. during a layout update for existing cells, we also attempt - * to update it now. - */ -- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes -{ - [super applyLayoutAttributes:layoutAttributes]; - self.layoutAttributes = layoutAttributes; -} - -/** - * Keep our node filling our content view. - */ -- (void)layoutSubviews -{ - [super layoutSubviews]; - self.node.frame = self.contentView.bounds; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - ASCellNode *node = self.node; - UIView *nodeView = node.view; - - /** - * The documentation for hitTest:withEvent: on an UIView explicitly states the fact that: - * it ignores view objects that are hidden, that have disabled user interactions, or have an - * alpha level less than 0.01. - * To be able to determine if the collection view cell should skip going further down the tree - * based on the states above we use a valid point within the cells bounds and check the - * superclass hitTest:withEvent: implementation. If this returns a valid value we can go on with - * checking the node as it's expected to not be in one of these states. - */ - CGPoint originPointOnView = [self convertPoint:nodeView.bounds.origin fromView:nodeView]; - if (![super hitTest:originPointOnView withEvent:event]) { - return nil; - } - - CGPoint pointOnNode = [node.view convertPoint:point fromView:self]; - return [node hitTest:pointOnNode withEvent:event]; -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event -{ - CGPoint pointOnNode = [self.node.view convertPoint:point fromView:self]; - return [self.node pointInside:pointOnNode withEvent:event]; -} - -@end - -/** - * A category that makes _ASCollectionViewCell conform to IGListBindable. - * - * We don't need to do anything to bind the view model – the cell node - * serves the same purpose. - */ -#if __has_include() - -#import - -@interface _ASCollectionViewCell (IGListBindable) -@end - -@implementation _ASCollectionViewCell (IGListBindable) - -- (void)bindViewModel:(id)viewModel -{ - // nop -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayLayer.h b/Example/Pods/Texture/Source/Details/_ASDisplayLayer.h deleted file mode 100644 index 1066a36f..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayLayer.h +++ /dev/null @@ -1,149 +0,0 @@ -// -// _ASDisplayLayer.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASDisplayNode; -@protocol _ASDisplayLayerDelegate; - -@interface _ASDisplayLayer : CALayer - -/** - @discussion This property overrides the CALayer category method which implements this via associated objects. - This should result in much better performance for _ASDisplayLayers. - */ -@property (nullable, nonatomic, weak) ASDisplayNode *asyncdisplaykit_node; - -/** - @summary Set to YES to enable asynchronous display for the receiver. - - @default YES (note that this might change for subclasses) - */ -@property (nonatomic) BOOL displaysAsynchronously; - -/** - @summary Cancels any pending async display. - - @desc If the receiver has had display called and is waiting for the dispatched async display to be executed, this will - cancel that dispatched async display. This method is useful to call when removing the receiver from the window. - */ -- (void)cancelAsyncDisplay; - -/** - @summary The dispatch queue used for async display. - - @desc This is exposed here for tests only. - */ -+ (dispatch_queue_t)displayQueue; - -/** - @summary Delegate for asynchronous display of the layer. This should be the node (default) unless you REALLY know what you're doing. - - @desc The asyncDelegate will have the opportunity to override the methods related to async display. - */ -@property (nullable, weak) id<_ASDisplayLayerDelegate> asyncDelegate; - -/** - @summary Suspends both asynchronous and synchronous display of the receiver if YES. - - @desc This can be used to suspend all display calls while the receiver is still in the view hierarchy. If you - want to just cancel pending async display, use cancelAsyncDisplay instead. - - @default NO - */ -@property (nonatomic, getter=isDisplaySuspended) BOOL displaySuspended; - -/** - @summary Bypasses asynchronous rendering and performs a blocking display immediately on the current thread. - - @desc Used by ASDisplayNode to display the layer synchronously on-demand (must be called on the main thread). - */ -- (void)displayImmediately; - -@end - -/** - * Optional methods that the view associated with an _ASDisplayLayer can implement. - * This is distinguished from _ASDisplayLayerDelegate in that it points to the _view_ - * not the node. Unfortunately this is required by ASCollectionView, since we currently - * can't guarantee that an ASCollectionNode exists for it. - */ -@protocol ASCALayerExtendedDelegate - -@optional - -- (void)layer:(CALayer *)layer didChangeBoundsWithOldValue:(CGRect)oldBounds newValue:(CGRect)newBounds; - -@end - -/** - Implement one of +displayAsyncLayer:parameters:isCancelled: or +drawRect:withParameters:isCancelled: to provide drawing for your node. - Use -drawParametersForAsyncLayer: to copy any properties that are involved in drawing into an immutable object for use on the display queue. - display/drawRect implementations MUST be thread-safe, as they can be called on the displayQueue (async) or the main thread (sync/displayImmediately) - */ -@protocol _ASDisplayLayerDelegate - -@optional - -// Called on the display queue and/or main queue (MUST BE THREAD SAFE) - -/** - @summary Delegate method to draw layer contents into a CGBitmapContext. The current UIGraphics context will be set to an appropriate context. - @param parameters An object describing all of the properties you need to draw. Return this from -drawParametersForAsyncLayer: - @param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid unnecessary work. A return value of YES means cancel drawing and return. - @param isRasterizing YES if the layer is being rasterized into another layer, in which case drawRect: probably wants to avoid doing things like filling its bounds with a zero-alpha color to clear the backing store. - */ -+ (void)drawRect:(CGRect)bounds - withParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock - isRasterizing:(BOOL)isRasterizing; - -/** - @summary Delegate override to provide new layer contents as a UIImage. - @param parameters An object describing all of the properties you need to draw. Return this from -drawParametersForAsyncLayer: - @param isCancelledBlock Execute this block to check whether the current drawing operation has been cancelled to avoid unnecessary work. A return value of YES means cancel drawing and return. - @return A UIImage (backed by a CGImage) with contents that are ready to display on the main thread. Make sure that the image is already decoded before returning it here. - */ -+ (UIImage *)displayWithParameters:(nullable id)parameters - isCancelled:(AS_NOESCAPE asdisplaynode_iscancelled_block_t)isCancelledBlock; - -// Called on the main thread only - -/** - @summary Delegate override for drawParameters - */ -- (NSObject *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer; - -/** - @summary Delegate override for willDisplay - */ -- (void)willDisplayAsyncLayer:(_ASDisplayLayer *)layer asynchronously:(BOOL)asynchronously; - -/** - @summary Delegate override for didDisplay - */ -- (void)didDisplayAsyncLayer:(_ASDisplayLayer *)layer; - -/** - @summary Delegate callback to display a layer, synchronously or asynchronously. 'asyncLayer' does not necessarily need to exist (can be nil). Typically, a delegate will display/draw its own contents and then set .contents on the layer when finished. - */ -- (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asynchronously; - -/** - @summary Delegate callback to handle a layer which requests its asynchronous display be cancelled. - */ -- (void)cancelDisplayAsyncLayer:(_ASDisplayLayer *)asyncLayer; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayLayer.mm b/Example/Pods/Texture/Source/Details/_ASDisplayLayer.mm deleted file mode 100644 index 4e8569d1..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayLayer.mm +++ /dev/null @@ -1,197 +0,0 @@ -// -// _ASDisplayLayer.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -@implementation _ASDisplayLayer -{ - BOOL _attemptedDisplayWhileZeroSized; -} - -@dynamic displaysAsynchronously; - -#pragma mark - Properties - -- (void)setDisplaySuspended:(BOOL)displaySuspended -{ - ASDisplayNodeAssertMainThread(); - if (_displaySuspended != displaySuspended) { - _displaySuspended = displaySuspended; - if (!displaySuspended) { - // If resuming display, trigger a display now. - [self setNeedsDisplay]; - } else { - // If suspending display, cancel any current async display so that we don't have contents set on us when it's finished. - [self cancelAsyncDisplay]; - } - } -} - -- (void)setBounds:(CGRect)bounds -{ - BOOL valid = ASDisplayNodeAssertNonFatal(ASIsCGRectValidForLayout(bounds), @"Caught attempt to set invalid bounds %@ on %@.", NSStringFromCGRect(bounds), self); - if (!valid) { - return; - } - if ([self.delegate respondsToSelector:@selector(layer:didChangeBoundsWithOldValue:newValue:)]) { - CGRect oldBounds = self.bounds; - [super setBounds:bounds]; - self.asyncdisplaykit_node.threadSafeBounds = bounds; - [(id)self.delegate layer:self didChangeBoundsWithOldValue:oldBounds newValue:bounds]; - } else { - [super setBounds:bounds]; - self.asyncdisplaykit_node.threadSafeBounds = bounds; - } - - if (_attemptedDisplayWhileZeroSized && CGRectIsEmpty(bounds) == NO && self.needsDisplayOnBoundsChange == NO) { - _attemptedDisplayWhileZeroSized = NO; - [self setNeedsDisplay]; - } -} - -#if DEBUG // These override is strictly to help detect application-level threading errors. Avoid method overhead in release. -- (void)setContents:(id)contents -{ - ASDisplayNodeAssertMainThread(); - [super setContents:contents]; -} - -- (void)setNeedsLayout -{ - ASDisplayNodeAssertMainThread(); - as_log_verbose(ASNodeLog(), "%s on %@", sel_getName(_cmd), self); - [super setNeedsLayout]; -} -#endif - -- (void)layoutSublayers -{ - ASDisplayNodeAssertMainThread(); - [super layoutSublayers]; - - [self.asyncdisplaykit_node __layout]; -} - -- (void)setNeedsDisplay -{ - ASDisplayNodeAssertMainThread(); - - // FIXME: Reconsider whether we should cancel a display in progress. - // We should definitely cancel a display that is scheduled, but unstarted display. - [self cancelAsyncDisplay]; - - // Short circuit if display is suspended. When resumed, we will setNeedsDisplay at that time. - if (!_displaySuspended) { - [super setNeedsDisplay]; - } -} - -#pragma mark - - -+ (id)defaultActionForKey:(NSString *)event -{ - // We never want to run one of CA's root default actions. So if we return nil from actionForLayer:forKey:, and let CA - // dig into the actions dictionary, and it doesn't find it there, it will check here and we need to stop the search. - return (id)kCFNull; -} - -+ (dispatch_queue_t)displayQueue -{ - static dispatch_queue_t displayQueue = NULL; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - displayQueue = dispatch_queue_create("org.AsyncDisplayKit.ASDisplayLayer.displayQueue", DISPATCH_QUEUE_CONCURRENT); - // we use the highpri queue to prioritize UI rendering over other async operations - dispatch_set_target_queue(displayQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)); - }); - - return displayQueue; -} - -+ (id)defaultValueForKey:(NSString *)key -{ - if ([key isEqualToString:@"displaysAsynchronously"]) { - return @YES; - } else if ([key isEqualToString:@"opaque"]) { - return @YES; - } else { - return [super defaultValueForKey:key]; - } -} - -#pragma mark - Display - -- (void)displayImmediately -{ - // This method is a low-level bypass that avoids touching CA, including any reset of the - // needsDisplay flag, until the .contents property is set with the result. - // It is designed to be able to block the thread of any caller and fully execute the display. - - ASDisplayNodeAssertMainThread(); - [self display:NO]; -} - -- (void)_hackResetNeedsDisplay -{ - ASDisplayNodeAssertMainThread(); - // Don't listen to our subclasses crazy ideas about setContents by going through super - super.contents = super.contents; -} - -- (void)display -{ - ASDisplayNodeAssertMainThread(); - [self _hackResetNeedsDisplay]; - - if (self.displaySuspended) { - return; - } - - [self display:self.displaysAsynchronously]; -} - -- (void)display:(BOOL)asynchronously -{ - if (CGRectIsEmpty(self.bounds)) { - _attemptedDisplayWhileZeroSized = YES; - } - - [self.asyncDelegate displayAsyncLayer:self asynchronously:asynchronously]; -} - -- (void)cancelAsyncDisplay -{ - ASDisplayNodeAssertMainThread(); - - [self.asyncDelegate cancelDisplayAsyncLayer:self]; -} - -// e.g. > -- (NSString *)description -{ - NSMutableString *description = [[super description] mutableCopy]; - ASDisplayNode *node = self.asyncdisplaykit_node; - if (node != nil) { - NSString *classString = [NSString stringWithFormat:@"%s-", object_getClassName(node)]; - [description replaceOccurrencesOfString:@"_ASDisplay" withString:classString options:kNilOptions range:NSMakeRange(0, description.length)]; - NSUInteger insertionIndex = [description rangeOfString:@">"].location; - if (insertionIndex != NSNotFound) { - NSString *nodeString = [NSString stringWithFormat:@"; node = %@", node]; - [description insertString:nodeString atIndex:insertionIndex]; - } - } - return description; -} - -@end diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayView.h b/Example/Pods/Texture/Source/Details/_ASDisplayView.h deleted file mode 100644 index 7e3fe35b..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayView.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// _ASDisplayView.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -// This class is only for use by ASDisplayNode and should never be subclassed or used directly. -// Note that the "node" property is added to UIView directly via a category in ASDisplayNode. - -@class ASDisplayNode; - -@interface _ASDisplayView : UIView - -/** - @discussion This property overrides the UIView category method which implements this via associated objects. - This should result in much better performance for _ASDisplayView. - */ -@property (nullable, nonatomic, weak) ASDisplayNode *asyncdisplaykit_node; - -// These methods expose a way for ASDisplayNode touch events to let the view call super touch events -// Some UIKit mechanisms, like UITableView and UICollectionView selection handling, require this to work -- (void)__forwardTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)__forwardTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)__forwardTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)__forwardTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayView.mm b/Example/Pods/Texture/Source/Details/_ASDisplayView.mm deleted file mode 100644 index 7741e444..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayView.mm +++ /dev/null @@ -1,532 +0,0 @@ -// -// _ASDisplayView.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import - -#pragma mark - _ASDisplayView - -@interface _ASDisplayView () - -// Keep the node alive while its view is active. If you create a view, add its layer to a layer hierarchy, then release -// the view, the layer retains the view to prevent a crash. This replicates this behaviour for the node abstraction. -@property (nonatomic) ASDisplayNode *keepalive_node; -@end - -@implementation _ASDisplayView -{ - struct _ASDisplayViewInternalFlags { - unsigned inHitTest:1; - unsigned inPointInside:1; - - unsigned inCanBecomeFirstResponder:1; - unsigned inBecomeFirstResponder:1; - unsigned inCanResignFirstResponder:1; - unsigned inResignFirstResponder:1; - unsigned inIsFirstResponder:1; - } _internalFlags; - - NSArray *_accessibilityElements; - CGRect _lastAccessibilityElementsFrame; -} - -#pragma mark - Class - -+ (Class)layerClass -{ - return [_ASDisplayLayer class]; -} - -// e.g. ; frame = ...> -- (NSString *)description -{ - NSMutableString *description = [[super description] mutableCopy]; - - ASDisplayNode *node = _asyncdisplaykit_node; - - if (node != nil) { - NSString *classString = [NSString stringWithFormat:@"%s-", object_getClassName(node)]; - [description replaceOccurrencesOfString:@"_ASDisplay" withString:classString options:kNilOptions range:NSMakeRange(0, description.length)]; - NSUInteger semicolon = [description rangeOfString:@";"].location; - if (semicolon != NSNotFound) { - NSString *nodeString = [NSString stringWithFormat:@"; node = %@", node]; - [description insertString:nodeString atIndex:semicolon]; - } - // Remove layer description – it never contains valuable info and it duplicates the node info. Noisy. - NSRange layerDescriptionRange = [description rangeOfString:@"; layer = <.*>" options:NSRegularExpressionSearch]; - if (layerDescriptionRange.location != NSNotFound) { - [description replaceCharactersInRange:layerDescriptionRange withString:@""]; - // Our regex will grab the closing angle bracket and I'm not clever enough to come up with a better one, so re-add it if needed. - if ([description hasSuffix:@">"] == NO) { - [description appendString:@">"]; - } - } - } - return description; -} - -#pragma mark - UIView Overrides - -- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event -{ - id uikitAction = [super actionForLayer:layer forKey:event]; - - // Even though the UIKit action will take precedence, we still unconditionally forward to the node so that it can - // track events like kCAOnOrderIn. - id nodeAction = [_asyncdisplaykit_node actionForLayer:layer forKey:event]; - - // If UIKit specifies an action, that takes precedence. That's an animation block so it's explicit. - if (uikitAction && uikitAction != (id)kCFNull) { - return uikitAction; - } - return nodeAction; -} - -- (void)willMoveToWindow:(UIWindow *)newWindow -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - BOOL visible = (newWindow != nil); - if (visible && !node.inHierarchy) { - [node __enterHierarchy]; - } -} - -- (void)didMoveToWindow -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - BOOL visible = (self.window != nil); - if (!visible && node.inHierarchy) { - [node __exitHierarchy]; - } -} - -- (void)willMoveToSuperview:(UIView *)newSuperview -{ - // Keep the node alive while the view is in a view hierarchy. This helps ensure that async-drawing views can always - // display their contents as long as they are visible somewhere, and aids in lifecycle management because the - // lifecycle of the node can be treated as the same as the lifecycle of the view (let the view hierarchy own the - // view). - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - UIView *currentSuperview = self.superview; - if (!currentSuperview && newSuperview) { - self.keepalive_node = node; - } - - if (newSuperview) { - ASDisplayNode *supernode = node.supernode; - BOOL supernodeLoaded = supernode.nodeLoaded; - ASDisplayNodeAssert(!supernode.isLayerBacked, @"Shouldn't be possible for _ASDisplayView's supernode to be layer-backed."); - - BOOL needsSupernodeUpdate = NO; - - if (supernode) { - if (supernodeLoaded) { - if (supernode.layerBacked) { - // See comment in -didMoveToSuperview. This case should be avoided, but is possible with app-level coding errors. - needsSupernodeUpdate = (supernode.layer != newSuperview.layer); - } else { - // If we have a supernode, compensate for users directly messing with views by hitching up to any new supernode. - needsSupernodeUpdate = (supernode.view != newSuperview); - } - } else { - needsSupernodeUpdate = YES; - } - } else { - // If we have no supernode and we are now in a view hierarchy, check to see if we can hook up to a supernode. - needsSupernodeUpdate = (newSuperview != nil); - } - - if (needsSupernodeUpdate) { - // -removeFromSupernode is called by -addSubnode:, if it is needed. - // FIXME: Needs rethinking if automaticallyManagesSubnodes=YES - [newSuperview.asyncdisplaykit_node addSubnode:node]; - } - } -} - -- (void)didMoveToSuperview -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - UIView *superview = self.superview; - if (superview == nil) { - // Clearing keepalive_node may cause deallocation of the node. In this case, __exitHierarchy may not have an opportunity (e.g. _node will be cleared - // by the time -didMoveToWindow occurs after this) to clear the Visible interfaceState, which we need to do before deallocation to meet an API guarantee. - if (node.inHierarchy) { - [node __exitHierarchy]; - } - self.keepalive_node = nil; - } - -#if DEBUG - // This is only to help detect issues when a root-of-view-controller node is reused separately from its view controller. - // Avoid overhead in release. - if (superview && node.viewControllerRoot) { - UIViewController *vc = [node closestViewController]; - - ASDisplayNodeAssert(vc != nil && [vc isKindOfClass:[ASDKViewController class]] && ((ASDKViewController*)vc).node == node, @"This node was once used as a view controller's node. You should not reuse it without its view controller."); - } -#endif - - ASDisplayNode *supernode = node.supernode; - ASDisplayNodeAssert(!supernode.isLayerBacked, @"Shouldn't be possible for superview's node to be layer-backed."); - - if (supernode) { - ASDisplayNodeAssertTrue(node.nodeLoaded); - BOOL supernodeLoaded = supernode.nodeLoaded; - BOOL needsSupernodeRemoval = NO; - - if (superview) { - // If our new superview is not the same as the supernode's view, or the supernode has no view, disconnect. - if (supernodeLoaded) { - if (supernode.layerBacked) { - // As asserted at the top, this shouldn't be possible, but in production with assertions disabled it can happen. - // We try to make such code behave as well as feasible because it's not that hard of an error to make if some deep - // child node of a layer-backed node happens to be view-backed, but it is not supported and should be avoided. - needsSupernodeRemoval = (supernode.layer != superview.layer); - } else { - needsSupernodeRemoval = (supernode.view != superview); - } - } else { - needsSupernodeRemoval = YES; - } - } else { - // If supernode is loaded but our superview is nil, the user likely manually removed us, so disconnect supernode. - // The unlikely alternative: we are in __unloadNode, with shouldRasterizeSubnodes just having been turned on. - // In the latter case, we don't want to disassemble the node hierarchy because all views are intentionally being destroyed. - BOOL nodeIsRasterized = ((node.hierarchyState & ASHierarchyStateRasterized) == ASHierarchyStateRasterized); - needsSupernodeRemoval = (supernodeLoaded && !nodeIsRasterized); - } - - if (needsSupernodeRemoval) { - // The node will only disconnect from its supernode, not removeFromSuperview, in this condition. - // FIXME: Needs rethinking if automaticallyManagesSubnodes=YES - [node removeFromSupernode]; - } - } -} - -- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index { - [super insertSubview:view atIndex:index]; - -#ifndef ASDK_ACCESSIBILITY_DISABLE - self.accessibilityElements = nil; -#endif -} - -- (void)addSubview:(UIView *)view -{ - [super addSubview:view]; - -#ifndef ASDK_ACCESSIBILITY_DISABLE - self.accessibilityElements = nil; -#endif -} - -- (void)willRemoveSubview:(UIView *)subview -{ - [super willRemoveSubview:subview]; - -#ifndef ASDK_ACCESSIBILITY_DISABLE - self.accessibilityElements = nil; -#endif -} - -- (CGSize)sizeThatFits:(CGSize)size -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return node ? [node layoutThatFits:ASSizeRangeMake(size)].size : [super sizeThatFits:size]; -} - -- (void)setNeedsDisplay -{ - ASDisplayNodeAssertMainThread(); - // Standard implementation does not actually get to the layer, at least for views that don't implement drawRect:. - [self.layer setNeedsDisplay]; -} - -- (UIViewContentMode)contentMode -{ - return ASDisplayNodeUIContentModeFromCAContentsGravity(self.layer.contentsGravity); -} - -- (void)setContentMode:(UIViewContentMode)contentMode -{ - ASDisplayNodeAssert(contentMode != UIViewContentModeRedraw, @"Don't do this. Use needsDisplayOnBoundsChange instead."); - - // Do our own mapping so as not to call super and muck up needsDisplayOnBoundsChange. If we're in a production build, fall back to resize if we see redraw - self.layer.contentsGravity = (contentMode != UIViewContentModeRedraw) ? ASDisplayNodeCAContentsGravityFromUIContentMode(contentMode) : kCAGravityResize; -} - -- (void)setBounds:(CGRect)bounds -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - [super setBounds:bounds]; - node.threadSafeBounds = bounds; -} - -- (void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -{ - [super addGestureRecognizer:gestureRecognizer]; - [_asyncdisplaykit_node nodeViewDidAddGestureRecognizer]; -} - -#pragma mark - Event Handling + UIResponder Overrides -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (node.methodOverrides & ASDisplayNodeMethodOverrideTouchesBegan) { - [node touchesBegan:touches withEvent:event]; - } else { - [super touchesBegan:touches withEvent:event]; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (node.methodOverrides & ASDisplayNodeMethodOverrideTouchesMoved) { - [node touchesMoved:touches withEvent:event]; - } else { - [super touchesMoved:touches withEvent:event]; - } -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (node.methodOverrides & ASDisplayNodeMethodOverrideTouchesEnded) { - [node touchesEnded:touches withEvent:event]; - } else { - [super touchesEnded:touches withEvent:event]; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (node.methodOverrides & ASDisplayNodeMethodOverrideTouchesCancelled) { - [node touchesCancelled:touches withEvent:event]; - } else { - [super touchesCancelled:touches withEvent:event]; - } -} - -- (void)__forwardTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; -} - -- (void)__forwardTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; -} - -- (void)__forwardTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; -} - -- (void)__forwardTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - // REVIEW: We should optimize these types of messages by setting a boolean in the associated ASDisplayNode subclass if - // they actually override the method. Same goes for -pointInside:withEvent: below. Many UIKit classes use that - // pattern for meaningful reductions of message send overhead in hot code (especially event handling). - - // Set boolean so this method can be re-entrant. If the node subclass wants to default to / make use of UIView - // hitTest:, it will call it on the view, which is _ASDisplayView. After calling into the node, any additional calls - // should use the UIView implementation of hitTest: - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inHitTest) { - _internalFlags.inHitTest = YES; - UIView *hitView = [node hitTest:point withEvent:event]; - _internalFlags.inHitTest = NO; - return hitView; - } else { - return [super hitTest:point withEvent:event]; - } -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - // See comments in -hitTest:withEvent: for the strategy here. - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inPointInside) { - _internalFlags.inPointInside = YES; - BOOL result = [node pointInside:point withEvent:event]; - _internalFlags.inPointInside = NO; - return result; - } else { - return [super pointInside:point withEvent:event]; - } -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node gestureRecognizerShouldBegin:gestureRecognizer]; -} - -- (void)tintColorDidChange -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - [super tintColorDidChange]; - - [node tintColorDidChange]; -} - -#pragma mark UIResponder Handling - -- (BOOL)canBecomeFirstResponder -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inCanBecomeFirstResponder) { - _internalFlags.inCanBecomeFirstResponder = YES; - BOOL result = [node canBecomeFirstResponder]; - _internalFlags.inCanBecomeFirstResponder = NO; - return result; - } else { - return [super canBecomeFirstResponder]; - } -} - -- (BOOL)becomeFirstResponder -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inBecomeFirstResponder) { - _internalFlags.inBecomeFirstResponder = YES; - BOOL result = [node becomeFirstResponder]; - _internalFlags.inBecomeFirstResponder = NO; - return result; - } else { - return [super becomeFirstResponder]; - } -} - -- (BOOL)canResignFirstResponder -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inCanResignFirstResponder) { - _internalFlags.inCanResignFirstResponder = YES; - BOOL result = [node canResignFirstResponder]; - _internalFlags.inCanResignFirstResponder = NO; - return result; - } else { - return [super canResignFirstResponder]; - } -} - -- (BOOL)resignFirstResponder -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inResignFirstResponder) { - _internalFlags.inResignFirstResponder = YES; - BOOL result = [node resignFirstResponder]; - _internalFlags.inResignFirstResponder = NO; - return result; - } else { - return [super resignFirstResponder]; - } -} - -- (BOOL)isFirstResponder -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - if (!_internalFlags.inIsFirstResponder) { - _internalFlags.inIsFirstResponder = YES; - BOOL result = [node isFirstResponder]; - _internalFlags.inIsFirstResponder = NO; - return result; - } else { - return [super isFirstResponder]; - } -} - -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - // We forward responder-chain actions to our node if we can't handle them ourselves. See -targetForAction:withSender:. - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return ([super canPerformAction:action withSender:sender] || [node respondsToSelector:action]); -} - -- (void)layoutMarginsDidChange -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - [super layoutMarginsDidChange]; - - [node layoutMarginsDidChange]; -} - -- (void)safeAreaInsetsDidChange -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - [super safeAreaInsetsDidChange]; - - [node safeAreaInsetsDidChange]; -} - -- (id)forwardingTargetForSelector:(SEL)aSelector -{ - // Ideally, we would implement -targetForAction:withSender: and simply return the node where we don't respond personally. - // Unfortunately UIResponder's default implementation of -targetForAction:withSender: doesn't follow its own documentation. It doesn't call -targetForAction:withSender: up the responder chain when -canPerformAction:withSender: fails, but instead merely calls -canPerformAction:withSender: on itself and then up the chain. rdar://20111500. - // Consequently, to forward responder-chain actions to our node, we override -canPerformAction:withSender: (used by the chain) to indicate support for responder chain-driven actions that our node supports, and then provide the node as a forwarding target here. - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return node; -} - -#if TARGET_OS_TV -#pragma mark - tvOS -- (BOOL)canBecomeFocused -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node canBecomeFocused]; -} - -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node didUpdateFocusInContext:context withAnimationCoordinator:coordinator]; -} - -- (void)setNeedsFocusUpdate -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node setNeedsFocusUpdate]; -} - -- (void)updateFocusIfNeeded -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node updateFocusIfNeeded]; -} - -- (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node shouldUpdateFocusInContext:context]; -} - -- (UIView *)preferredFocusedView -{ - ASDisplayNode *node = _asyncdisplaykit_node; // Create strong reference to weak ivar. - return [node preferredFocusedView]; -} -#endif -@end diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.h b/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.h deleted file mode 100644 index 7f159d1d..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// _ASDisplayViewAccessiblity.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -// WARNING: When dealing with accessibility elements, please use the `accessibilityElements` -// property instead of the older methods e.g. `accessibilityElementCount()`. While the older methods -// should still work as long as accessibility is enabled, this framework provides no guarantees on -// their correctness. For details, see -// https://developer.apple.com/documentation/objectivec/nsobject/1615147-accessibilityelements - -// After recusively collecting all of the accessibility elements of a node, they get sorted. This sort determines -// the order that a screen reader will traverse the elements. By default, we sort these elements based on their -// origin: lower y origin comes first, then lower x origin. If 2 nodes have an equal origin, the node with the smaller -// height is placed before the node with the smaller width. If two nodes have the exact same rect, we throw up our hands -// and return NSOrderedSame. -// -// In general this seems to work fairly well. However, if you want to provide a custom sort you can do so via -// setUserDefinedAccessibilitySortComparator(). The two elements you are comparing are NSObjects, which conforms to the -// informal UIAccessibility protocol, so you can safely compare properties like accessibilityFrame. -typedef NSComparisonResult (^ASSortAccessibilityElementsComparator)(NSObject *, NSObject *); - -// Use this method to supply your own custom sort comparator used to determine the order of the accessibility elements -void setUserDefinedAccessibilitySortComparator(ASSortAccessibilityElementsComparator userDefinedComparator); diff --git a/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.mm b/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.mm deleted file mode 100644 index 8f3e1299..00000000 --- a/Example/Pods/Texture/Source/Details/_ASDisplayViewAccessiblity.mm +++ /dev/null @@ -1,398 +0,0 @@ -// -// _ASDisplayViewAccessiblity.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#ifndef ASDK_ACCESSIBILITY_DISABLE - -#import -#import -#import -#import -#import -#import -#import -#import - -#import - -#pragma mark - UIAccessibilityElement - -static ASSortAccessibilityElementsComparator currentAccessibilityComparator = nil; -static ASSortAccessibilityElementsComparator defaultAccessibilityComparator = nil; - -void setUserDefinedAccessibilitySortComparator(ASSortAccessibilityElementsComparator userDefinedComparator) { - currentAccessibilityComparator = userDefinedComparator ?: defaultAccessibilityComparator; -} - -/// Sort accessiblity elements first by y and than by x origin. -void SortAccessibilityElements(NSMutableArray *elements) -{ - ASDisplayNodeCAssertNotNil(elements, @"Should pass in a NSMutableArray"); - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultAccessibilityComparator = ^NSComparisonResult(NSObject *a, NSObject *b) { - CGPoint originA = a.accessibilityFrame.origin; - CGPoint originB = b.accessibilityFrame.origin; - if (originA.y == originB.y) { - if (originA.x == originB.x) { - // if we have the same origin, favor shorter items. If heights are the same, favor thinner items. If size is the same ¯\_(ツ)_/¯ - CGSize sizeA = a.accessibilityFrame.size; - CGSize sizeB = b.accessibilityFrame.size; - if (sizeA.height == sizeB.height) { - if (sizeA.width == sizeB.width) { - return NSOrderedSame; - } - return (sizeA.width < sizeB.width) ? NSOrderedAscending : NSOrderedDescending; - } - return (sizeA.height < sizeB.height) ? NSOrderedAscending : NSOrderedDescending; - } - return (originA.x < originB.x) ? NSOrderedAscending : NSOrderedDescending; - } - return (originA.y < originB.y) ? NSOrderedAscending : NSOrderedDescending; - }; - - if (!currentAccessibilityComparator) { - currentAccessibilityComparator = defaultAccessibilityComparator; - } - }); - - [elements sortUsingComparator:currentAccessibilityComparator]; -} - -static CGRect ASAccessibilityFrameForNode(ASDisplayNode *node) { - CALayer *layer = node.layer; - return [layer convertRect:node.bounds toLayer:ASFindWindowOfLayer(layer).layer]; -} - -@interface ASAccessibilityElement : UIAccessibilityElement - -@property (nonatomic) ASDisplayNode *node; - -+ (ASAccessibilityElement *)accessibilityElementWithContainer:(UIView *)container node:(ASDisplayNode *)node; - -@end - -@implementation ASAccessibilityElement - -+ (ASAccessibilityElement *)accessibilityElementWithContainer:(UIView *)container node:(ASDisplayNode *)node -{ - ASAccessibilityElement *accessibilityElement = [[ASAccessibilityElement alloc] initWithAccessibilityContainer:container]; - accessibilityElement.node = node; - accessibilityElement.accessibilityIdentifier = node.accessibilityIdentifier; - accessibilityElement.accessibilityLabel = node.accessibilityLabel; - accessibilityElement.accessibilityHint = node.accessibilityHint; - accessibilityElement.accessibilityValue = node.accessibilityValue; - accessibilityElement.accessibilityTraits = node.accessibilityTraits; - accessibilityElement.accessibilityElementsHidden = node.accessibilityElementsHidden; - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - accessibilityElement.accessibilityAttributedLabel = node.accessibilityAttributedLabel; - accessibilityElement.accessibilityAttributedHint = node.accessibilityAttributedHint; - accessibilityElement.accessibilityAttributedValue = node.accessibilityAttributedValue; - } - return accessibilityElement; -} - -- (CGRect)accessibilityFrame -{ - return ASAccessibilityFrameForNode(self.node); -} - -@end - -#pragma mark - _ASDisplayView / UIAccessibilityContainer - -@interface ASAccessibilityCustomAction : UIAccessibilityCustomAction - -@property (nonatomic) ASDisplayNode *node; - -@end - -@implementation ASAccessibilityCustomAction - -- (CGRect)accessibilityFrame -{ - return ASAccessibilityFrameForNode(self.node); -} - -@end - -/// Collect all subnodes for the given node by walking down the subnode tree and calculates the screen coordinates based on the containerNode and container -static void CollectUIAccessibilityElementsForNode(ASDisplayNode *node, ASDisplayNode *containerNode, id container, NSMutableArray *elements) -{ - ASDisplayNodeCAssertNotNil(elements, @"Should pass in a NSMutableArray"); - - ASDisplayNodePerformBlockOnEveryNodeBFS(node, ^(ASDisplayNode * _Nonnull currentNode) { - // For every subnode that is layer backed or it's supernode has subtree rasterization enabled - // we have to create a UIAccessibilityElement as no view for this node exists - if (currentNode != containerNode && currentNode.isAccessibilityElement) { - UIAccessibilityElement *accessibilityElement = [ASAccessibilityElement accessibilityElementWithContainer:container node:currentNode]; - [elements addObject:accessibilityElement]; - } - }); -} - -static void CollectAccessibilityElementsForContainer(ASDisplayNode *container, UIView *view, - NSMutableArray *elements) { - ASDisplayNodeCAssertNotNil(view, @"Passed in view should not be nil"); - if (view == nil) { - return; - } - UIAccessibilityElement *accessiblityElement = - [ASAccessibilityElement accessibilityElementWithContainer:view - node:container]; - - NSMutableArray *labeledNodes = [[NSMutableArray alloc] init]; - NSMutableArray *actions = [[NSMutableArray alloc] init]; - std::queue queue; - queue.push(container); - - // If the container does not have an accessibility label set, or if the label is meant for custom - // actions only, then aggregate its subnodes' labels. Otherwise, treat the label as an overriden - // value and do not perform the aggregation. - BOOL shouldAggregateSubnodeLabels = - (container.accessibilityLabel.length == 0) || - (container.accessibilityTraits & ASInteractiveAccessibilityTraitsMask()); - - ASDisplayNode *node = nil; - while (!queue.empty()) { - node = queue.front(); - queue.pop(); - - if (node != container && node.isAccessibilityContainer) { - UIView *containerView = node.isLayerBacked ? view : node.view; - CollectAccessibilityElementsForContainer(node, containerView, elements); - continue; - } - - if (node.accessibilityLabel.length > 0) { - if (node.accessibilityTraits & ASInteractiveAccessibilityTraitsMask()) { - ASAccessibilityCustomAction *action = [[ASAccessibilityCustomAction alloc] initWithName:node.accessibilityLabel target:node selector:@selector(performAccessibilityCustomAction:)]; - action.node = node; - [actions addObject:action]; - - node.accessibilityCustomAction = action; - } else if (node == container || shouldAggregateSubnodeLabels) { - ASAccessibilityElement *nonInteractiveElement = [ASAccessibilityElement accessibilityElementWithContainer:view node:node]; - [labeledNodes addObject:nonInteractiveElement]; - } - } - - for (ASDisplayNode *subnode in node.subnodes) { - queue.push(subnode); - } - } - - SortAccessibilityElements(labeledNodes); - - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - NSArray *attributedLabels = [labeledNodes valueForKey:@"accessibilityAttributedLabel"]; - NSMutableAttributedString *attributedLabel = [NSMutableAttributedString new]; - [attributedLabels enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if (idx != 0) { - [attributedLabel appendAttributedString:[[NSAttributedString alloc] initWithString:@", "]]; - } - [attributedLabel appendAttributedString:(NSAttributedString *)obj]; - }]; - accessiblityElement.accessibilityAttributedLabel = attributedLabel; - } else { - NSArray *labels = [labeledNodes valueForKey:@"accessibilityLabel"]; - accessiblityElement.accessibilityLabel = [labels componentsJoinedByString:@", "]; - } - - SortAccessibilityElements(actions); - accessiblityElement.accessibilityCustomActions = actions; - - [elements addObject:accessiblityElement]; -} - -/// Check if a view is a subviews of an UIScrollView. This is used to determine whether to enforce that -/// accessibility elements must be on screen -static BOOL recusivelyCheckSuperviewsForScrollView(UIView *view) { - if (!view) { - return NO; - } else if ([view isKindOfClass:[UIScrollView class]]) { - return YES; - } - return recusivelyCheckSuperviewsForScrollView(view.superview); -} - -/// returns YES if this node should be considered "hidden" from the screen reader. -static BOOL nodeIsHiddenFromAcessibility(ASDisplayNode *node) { - return node.isHidden || node.alpha == 0.0 || node.accessibilityElementsHidden; -} - -/// Collect all accessibliity elements for a given view and view node -static void CollectAccessibilityElements(ASDisplayNode *node, NSMutableArray *elements) -{ - ASDisplayNodeCAssertNotNil(elements, @"Should pass in a NSMutableArray"); - ASDisplayNodeCAssertFalse(node.isLayerBacked); - if (node.isLayerBacked) { - return; - } - - BOOL anySubNodeIsCollection = (nil != ASDisplayNodeFindFirstNode(node, - ^BOOL(ASDisplayNode *nodeToCheck) { - return ASDynamicCast(nodeToCheck, ASCollectionNode) != nil || - ASDynamicCast(nodeToCheck, ASTableNode) != nil; - })); - - UIView *view = node.view; - - // If we don't have a window, let's just bail out - if (!view.window) { - return; - } - - if (node.isAccessibilityContainer && !anySubNodeIsCollection) { - CollectAccessibilityElementsForContainer(node, view, elements); - return; - } - - // Handle rasterize case - if (node.rasterizesSubtree) { - CollectUIAccessibilityElementsForNode(node, node, view, elements); - return; - } - - if (nodeIsHiddenFromAcessibility(node)) { - return; - } - - // see if one of the subnodes is modal. If it is, then we only need to collect accessibilityElements from that - // node. If more than one subnode is modal, UIKit uses the last view in subviews as the modal view (it appears to - // be based on the index in the subviews array, not the location on screen). Let's do the same. - ASDisplayNode *modalSubnode = nil; - for (ASDisplayNode *subnode in node.subnodes.reverseObjectEnumerator) { - if (subnode.accessibilityViewIsModal) { - modalSubnode = subnode; - break; - } - } - - // If we have a modal subnode, just use that. Otherwise, use all subnodes - NSArray *subnodes = modalSubnode ? @[ modalSubnode ] : node.subnodes; - - for (ASDisplayNode *subnode in subnodes) { - // If a node is hidden or has an alpha of 0.0 we should not include it - if (nodeIsHiddenFromAcessibility(subnode)) { - continue; - } - - // If a subnode is outside of the view's window, exclude it UNLESS it is a subview of an UIScrollView. - // In this case UIKit will return the element even if it is outside of the window or the scrollView's visible rect (contentOffset + contentSize) - CGRect nodeInWindowCoords = [node convertRect:subnode.frame toNode:nil]; - if (!CGRectIntersectsRect(view.window.frame, nodeInWindowCoords) && !recusivelyCheckSuperviewsForScrollView(view)) { - continue; - } - - if (subnode.isAccessibilityElement) { - // An accessiblityElement can either be a UIView or a UIAccessibilityElement - if (subnode.isLayerBacked) { - // No view for layer backed nodes exist. It's necessary to create a UIAccessibilityElement that represents this node - UIAccessibilityElement *accessiblityElement = [ASAccessibilityElement accessibilityElementWithContainer:view node:subnode]; - [elements addObject:accessiblityElement]; - } else { - // Accessiblity element is not layer backed just add the view as accessibility element - [elements addObject:subnode.view]; - } - } else if (subnode.isLayerBacked) { - // Go down the hierarchy of the layer backed subnode and collect all of the UIAccessibilityElement - CollectUIAccessibilityElementsForNode(subnode, node, view, elements); - } else if (subnode.accessibilityElementCount > 0) { - // UIView is itself a UIAccessibilityContainer just add it - [elements addObject:subnode.view]; - } - } -} - -@implementation _ASDisplayView (UIAccessibilityContainer) - -#pragma mark - UIAccessibility - -- (void)setAccessibilityElements:(nullable NSArray *)accessibilityElements -{ - // this is a no-op. You should not be setting accessibilityElements directly on _ASDisplayView. - // if you wish to set accessibilityElements, do so in your node. UIKit will call _ASDisplayView's - // accessibilityElements which will in turn ask its node for its elements. -} - -- (nullable NSArray *)accessibilityElements -{ - ASDisplayNodeAssertMainThread(); - - ASDisplayNode *viewNode = self.asyncdisplaykit_node; - if (viewNode == nil) { - return @[]; - } - - // we no longer cache accessibilityElements. When caching, in order to provide correct element when items become hidden/visible - // we had to manually clear _accessibilityElements. This seemed like a heavy burden to place on a user, and one that is also - // not immediately obvious. While recomputing accessibilityElements may be expensive, this will only affect users that have - // voice over enabled (we checked to ensure performance did not suffer by not caching for an overall user base). For those - // users with voice over on, being correct is almost certainly more important than being performant. - return [viewNode accessibilityElements]; -} - -@end - -@implementation ASDisplayNode (AccessibilityInternal) - -- (nullable NSArray *)accessibilityElements -{ - // NSObject implements the informal accessibility protocol. This means that all ASDisplayNodes already have an accessibilityElements - // property. If an ASDisplayNode subclass has explicitly set the property, let's use that instead of traversing the node tree to try - // to create the elements automatically - NSArray *elements = [super accessibilityElements]; - if (elements.count) { - return elements; - } - - if (!self.isNodeLoaded) { - ASDisplayNodeFailAssert(@"Cannot access accessibilityElements since node is not loaded"); - return nil; - } - NSMutableArray *accessibilityElements = [[NSMutableArray alloc] init]; - CollectAccessibilityElements(self, accessibilityElements); - SortAccessibilityElements(accessibilityElements); - // If we did not find any accessibility elements, return nil instead of empty array. This allows a WKWebView within the node - // to participate in accessibility. - return accessibilityElements.count == 0 ? nil : accessibilityElements; -} - -@end - -@implementation _ASDisplayView (UIAccessibilityAction) - -- (BOOL)accessibilityActivate { - return [self.asyncdisplaykit_node accessibilityActivate]; -} - -- (void)accessibilityIncrement { - [self.asyncdisplaykit_node accessibilityIncrement]; -} - -- (void)accessibilityDecrement { - [self.asyncdisplaykit_node accessibilityDecrement]; -} - -- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { - return [self.asyncdisplaykit_node accessibilityScroll:direction]; -} - -- (BOOL)accessibilityPerformEscape { - return [self.asyncdisplaykit_node accessibilityPerformEscape]; -} - -- (BOOL)accessibilityPerformMagicTap { - return [self.asyncdisplaykit_node accessibilityPerformMagicTap]; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.h b/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.h deleted file mode 100644 index 76b53c19..00000000 --- a/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// IGListAdapter+AsyncDisplayKit.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionNode; - -@interface IGListAdapter (AsyncDisplayKit) - -/** - * Connect this list adapter to the given collection node. - * - * @param collectionNode The collection node to drive with this list adapter. - * - * @note This method may only be called once per list adapter, - * and it must be called on the main thread. -[UIViewController init] - * is a good place to call it. This method does not retain the collection node. - */ -- (void)setASDKCollectionNode:(ASCollectionNode *)collectionNode; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_IG_LIST_KIT diff --git a/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.mm b/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.mm deleted file mode 100644 index bcfb2467..00000000 --- a/Example/Pods/Texture/Source/IGListAdapter+AsyncDisplayKit.mm +++ /dev/null @@ -1,51 +0,0 @@ -// -// IGListAdapter+AsyncDisplayKit.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import -#import - -@implementation IGListAdapter (AsyncDisplayKit) - -- (void)setASDKCollectionNode:(ASCollectionNode *)collectionNode -{ - ASDisplayNodeAssertMainThread(); - - // Attempt to retrieve previous data source. - ASIGListAdapterBasedDataSource *dataSource = objc_getAssociatedObject(self, _cmd); - // Bomb if we already made one. - if (dataSource != nil) { - ASDisplayNodeFailAssert(@"Attempt to call %@ multiple times on the same list adapter. Not currently allowed!", NSStringFromSelector(_cmd)); - return; - } - - // Make a data source and retain it. - dataSource = [[ASIGListAdapterBasedDataSource alloc] initWithListAdapter:self collectionDelegate:collectionNode.delegate]; - objc_setAssociatedObject(self, _cmd, dataSource, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - - // Attach the data source to the collection node. - collectionNode.dataSource = dataSource; - collectionNode.delegate = dataSource; - __weak IGListAdapter *weakSelf = self; - [collectionNode onDidLoad:^(__kindof ASCollectionNode * _Nonnull collectionNode) { -#if IG_LIST_COLLECTION_VIEW - // We manually set the superclass of ASCollectionView to IGListCollectionView at runtime if needed. - weakSelf.collectionView = (IGListCollectionView *)collectionNode.view; -#else - weakSelf.collectionView = collectionNode.view; -#endif - }]; -} - -@end - -#endif // AS_IG_LIST_KIT diff --git a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutElement.h b/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutElement.h deleted file mode 100644 index 109816de..00000000 --- a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutElement.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// ASAbsoluteLayoutElement.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Layout options that can be defined for an ASLayoutElement being added to a ASAbsoluteLayoutSpec. - */ -@protocol ASAbsoluteLayoutElement - -/** - * @abstract The position of this object within its parent spec. - */ -@property (nonatomic) CGPoint layoutPosition; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.h deleted file mode 100644 index 23d27b64..00000000 --- a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASAbsoluteLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** How much space the spec will take up. */ -typedef NS_ENUM(NSInteger, ASAbsoluteLayoutSpecSizing) { - /** The spec will take up the maximum size possible. */ - ASAbsoluteLayoutSpecSizingDefault, - /** Computes a size for the spec that is the union of all children's frames. */ - ASAbsoluteLayoutSpecSizingSizeToFit, -}; - -NS_ASSUME_NONNULL_BEGIN - -/** - A layout spec that positions children at fixed positions. - */ -@interface ASAbsoluteLayoutSpec : ASLayoutSpec - -/** - How much space will the spec taken up - */ -@property (nonatomic) ASAbsoluteLayoutSpecSizing sizing; - -/** - @param sizing How much space the spec will take up - @param children Children to be positioned at fixed positions - */ -+ (instancetype)absoluteLayoutSpecWithSizing:(ASAbsoluteLayoutSpecSizing)sizing children:(NSArray> *)children NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - @param children Children to be positioned at fixed positions - */ -+ (instancetype)absoluteLayoutSpecWithChildren:(NSArray> *)children NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.mm deleted file mode 100644 index 02b14df4..00000000 --- a/Example/Pods/Texture/Source/Layout/ASAbsoluteLayoutSpec.mm +++ /dev/null @@ -1,103 +0,0 @@ -// -// ASAbsoluteLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -#pragma mark - ASAbsoluteLayoutSpec - -@implementation ASAbsoluteLayoutSpec - -#pragma mark - Class - -+ (instancetype)absoluteLayoutSpecWithChildren:(NSArray *)children NS_RETURNS_RETAINED -{ - return [[self alloc] initWithChildren:children]; -} - -+ (instancetype)absoluteLayoutSpecWithSizing:(ASAbsoluteLayoutSpecSizing)sizing children:(NSArray> *)children NS_RETURNS_RETAINED -{ - return [[self alloc] initWithSizing:sizing children:children]; -} - -#pragma mark - Lifecycle - -- (instancetype)init -{ - return [self initWithChildren:nil]; -} - -- (instancetype)initWithChildren:(NSArray *)children -{ - return [self initWithSizing:ASAbsoluteLayoutSpecSizingDefault children:children]; -} - -- (instancetype)initWithSizing:(ASAbsoluteLayoutSpecSizing)sizing children:(NSArray> *)children -{ - if (!(self = [super init])) { - return nil; - } - - _sizing = sizing; - self.children = children; - - return self; -} - -#pragma mark - ASLayoutSpec - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - CGSize size = { - ASPointsValidForSize(constrainedSize.max.width) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.width, - ASPointsValidForSize(constrainedSize.max.height) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.height - }; - - NSArray *children = self.children; - ASLayout *rawSublayouts[children.count]; - int i = 0; - - for (id child in children) { - CGPoint layoutPosition = child.style.layoutPosition; - CGSize autoMaxSize = { - constrainedSize.max.width - layoutPosition.x, - constrainedSize.max.height - layoutPosition.y - }; - - const ASSizeRange childConstraint = ASLayoutElementSizeResolveAutoSize(child.style.size, size, {{0,0}, autoMaxSize}); - - ASLayout *sublayout = [child layoutThatFits:childConstraint parentSize:size]; - sublayout.position = layoutPosition; - rawSublayouts[i++] = sublayout; - } - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; - - if (_sizing == ASAbsoluteLayoutSpecSizingSizeToFit || isnan(size.width)) { - size.width = constrainedSize.min.width; - for (ASLayout *sublayout in sublayouts) { - size.width = MAX(size.width, sublayout.position.x + sublayout.size.width); - } - } - - if (_sizing == ASAbsoluteLayoutSpecSizingSizeToFit || isnan(size.height)) { - size.height = constrainedSize.min.height; - for (ASLayout *sublayout in sublayouts) { - size.height = MAX(size.height, sublayout.position.y + sublayout.size.height); - } - } - - return [ASLayout layoutWithLayoutElement:self size:ASSizeRangeClamp(constrainedSize, size) sublayouts:sublayouts]; -} - -@end - diff --git a/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.h b/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.h deleted file mode 100644 index 83c7bec4..00000000 --- a/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// ASAsciiArtBoxCreator.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASLayoutElementAsciiArtProtocol -/** - * Returns an ascii-art representation of this object and its children. - * For example, an ASInsetSpec may return something like this: - * - * --ASInsetLayoutSpec-- - * | ASTextNode | - * --------------------- - */ -- (NSString *)asciiArtString; - -/** - * returns the name of this object that will display in the ascii art. Usually this can - * simply be NSStringFromClass([self class]). - */ -- (NSString *)asciiArtName; - -@end - -/** - * A that takes a parent and its children and renders as ascii art box. - */ -@interface ASAsciiArtBoxCreator : NSObject - -/** - * Renders an ascii art box with the children aligned horizontally - * Example: - * ------------ASStackLayoutSpec----------- - * | ASTextNode ASTextNode ASTextNode | - * ---------------------------------------- - */ -+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; - -/** - * Renders an ascii art box with the children aligned vertically. - * Example: - * --ASStackLayoutSpec-- - * | ASTextNode | - * | ASTextNode | - * | ASTextNode | - * --------------------- - */ -+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.mm b/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.mm deleted file mode 100644 index 998267b3..00000000 --- a/Example/Pods/Texture/Source/Layout/ASAsciiArtBoxCreator.mm +++ /dev/null @@ -1,185 +0,0 @@ -// -// ASAsciiArtBoxCreator.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -static const NSUInteger kDebugBoxPadding = 2; - -typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation) -{ - PIDebugBoxPaddingLocationFront, - PIDebugBoxPaddingLocationEnd, - PIDebugBoxPaddingLocationBoth -}; - -@interface NSString(PIDebugBox) - -@end - -@implementation NSString(PIDebugBox) - -+ (instancetype)debugbox_stringWithString:(NSString *)stringToRepeat repeatedCount:(NSUInteger)repeatCount NS_RETURNS_RETAINED -{ - NSMutableString *string = [[NSMutableString alloc] initWithCapacity:[stringToRepeat length] * repeatCount]; - for (NSUInteger index = 0; index < repeatCount; index++) { - [string appendString:stringToRepeat]; - } - return [string copy]; -} - -- (NSString *)debugbox_stringByAddingPadding:(NSString *)padding count:(NSUInteger)count location:(PIDebugBoxPaddingLocation)location -{ - NSString *paddingString = [NSString debugbox_stringWithString:padding repeatedCount:count]; - switch (location) { - case PIDebugBoxPaddingLocationFront: - return [NSString stringWithFormat:@"%@%@", paddingString, self]; - case PIDebugBoxPaddingLocationEnd: - return [NSString stringWithFormat:@"%@%@", self, paddingString]; - case PIDebugBoxPaddingLocationBoth: - return [NSString stringWithFormat:@"%@%@%@", paddingString, self, paddingString]; - } - return [self copy]; -} - -@end - -@implementation ASAsciiArtBoxCreator - -+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent -{ - if ([children count] == 0) { - return parent; - } - - NSMutableArray *childrenLines = [NSMutableArray array]; - - // split the children into lines - NSUInteger lineCountPerChild = 0; - for (NSString *child in children) { - NSArray *lines = [child componentsSeparatedByString:@"\n"]; - lineCountPerChild = MAX(lineCountPerChild, [lines count]); - } - - for (NSString *child in children) { - NSMutableArray *lines = [[child componentsSeparatedByString:@"\n"] mutableCopy]; - NSUInteger topPadding = ceil((CGFloat)(lineCountPerChild - [lines count])/2.0); - NSUInteger bottomPadding = (lineCountPerChild - [lines count])/2.0; - NSUInteger lineLength = [lines[0] length]; - - for (NSUInteger index = 0; index < topPadding; index++) { - [lines insertObject:[NSString debugbox_stringWithString:@" " repeatedCount:lineLength] atIndex:0]; - } - for (NSUInteger index = 0; index < bottomPadding; index++) { - [lines addObject:[NSString debugbox_stringWithString:@" " repeatedCount:lineLength]]; - } - [childrenLines addObject:lines]; - } - - NSMutableArray *concatenatedLines = [NSMutableArray array]; - NSString *padding = [NSString debugbox_stringWithString:@" " repeatedCount:kDebugBoxPadding]; - for (NSUInteger index = 0; index < lineCountPerChild; index++) { - NSMutableString *line = [[NSMutableString alloc] init]; - [line appendFormat:@"|%@",padding]; - for (NSArray *childLines in childrenLines) { - [line appendFormat:@"%@%@", childLines[index], padding]; - } - [line appendString:@"|"]; - [concatenatedLines addObject:line]; - } - - // surround the lines in a box - NSUInteger totalLineLength = [concatenatedLines[0] length]; - if (totalLineLength < [parent length]) { - NSUInteger difference = [parent length] + (2 * kDebugBoxPadding) - totalLineLength; - NSUInteger leftPadding = ceil((CGFloat)difference/2.0); - NSUInteger rightPadding = difference/2; - - NSString *leftString = [@"|" debugbox_stringByAddingPadding:@" " count:leftPadding location:PIDebugBoxPaddingLocationEnd]; - NSString *rightString = [@"|" debugbox_stringByAddingPadding:@" " count:rightPadding location:PIDebugBoxPaddingLocationFront]; - - NSMutableArray *paddedLines = [NSMutableArray array]; - for (NSString *line in concatenatedLines) { - NSString *paddedLine = [line stringByReplacingOccurrencesOfString:@"|" withString:leftString options:NSCaseInsensitiveSearch range:NSMakeRange(0, 1)]; - paddedLine = [paddedLine stringByReplacingOccurrencesOfString:@"|" withString:rightString options:NSCaseInsensitiveSearch range:NSMakeRange([paddedLine length] - 1, 1)]; - [paddedLines addObject:paddedLine]; - } - concatenatedLines = paddedLines; - // totalLineLength += difference; - } - concatenatedLines = [self appendTopAndBottomToBoxString:concatenatedLines parent:parent]; - return [concatenatedLines componentsJoinedByString:@"\n"]; - -} - -+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent -{ - if ([children count] == 0) { - return parent; - } - - NSMutableArray *childrenLines = [NSMutableArray array]; - - NSUInteger maxChildLength = 0; - for (NSString *child in children) { - NSArray *lines = [child componentsSeparatedByString:@"\n"]; - maxChildLength = MAX(maxChildLength, [lines[0] length]); - } - - NSUInteger rightPadding = 0; - NSUInteger leftPadding = 0; - - if (maxChildLength < [parent length]) { - NSUInteger difference = [parent length] + (2 * kDebugBoxPadding) - maxChildLength; - leftPadding = ceil((CGFloat)difference/2.0); - rightPadding = difference/2; - } - - NSString *rightPaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:rightPadding + kDebugBoxPadding]; - NSString *leftPaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:leftPadding + kDebugBoxPadding]; - - for (NSString *child in children) { - NSMutableArray *lines = [[child componentsSeparatedByString:@"\n"] mutableCopy]; - - NSUInteger leftLinePadding = ceil((CGFloat)(maxChildLength - [lines[0] length])/2.0); - NSUInteger rightLinePadding = (maxChildLength - [lines[0] length])/2.0; - - for (NSString *line in lines) { - NSString *rightLinePaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:rightLinePadding]; - rightLinePaddingString = [NSString stringWithFormat:@"%@%@|", rightLinePaddingString, rightPaddingString]; - - NSString *leftLinePaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:leftLinePadding]; - leftLinePaddingString = [NSString stringWithFormat:@"|%@%@", leftLinePaddingString, leftPaddingString]; - - NSString *paddingLine = [NSString stringWithFormat:@"%@%@%@", leftLinePaddingString, line, rightLinePaddingString]; - [childrenLines addObject:paddingLine]; - } - } - - childrenLines = [self appendTopAndBottomToBoxString:childrenLines parent:parent]; - return [childrenLines componentsJoinedByString:@"\n"]; -} - -+ (NSMutableArray *)appendTopAndBottomToBoxString:(NSMutableArray *)boxStrings parent:(NSString *)parent -{ - NSUInteger totalLineLength = [boxStrings[0] length]; - [boxStrings addObject:[NSString debugbox_stringWithString:@"-" repeatedCount:totalLineLength]]; - - NSUInteger leftPadding = ceil(((CGFloat)(totalLineLength - [parent length]))/2.0); - NSUInteger rightPadding = (totalLineLength - [parent length])/2; - - NSString *topLine = [parent debugbox_stringByAddingPadding:@"-" count:leftPadding location:PIDebugBoxPaddingLocationFront]; - topLine = [topLine debugbox_stringByAddingPadding:@"-" count:rightPadding location:PIDebugBoxPaddingLocationEnd]; - [boxStrings insertObject:topLine atIndex:0]; - - return boxStrings; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.h deleted file mode 100644 index 032a240b..00000000 --- a/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// ASBackgroundLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - Lays out a single layoutElement child, then lays out a background layoutElement instance behind it stretched to its size. - */ -@interface ASBackgroundLayoutSpec : ASLayoutSpec - -/** - * Background layoutElement for this layout spec - */ -@property (nonatomic) id background; - -/** - * Creates and returns an ASBackgroundLayoutSpec object - * - * @param child A child that is laid out to determine the size of this spec. - * @param background A layoutElement object that is laid out behind the child. - */ -+ (instancetype)backgroundLayoutSpecWithChild:(id)child background:(id)background NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.mm deleted file mode 100644 index 2de9f49b..00000000 --- a/Example/Pods/Texture/Source/Layout/ASBackgroundLayoutSpec.mm +++ /dev/null @@ -1,91 +0,0 @@ -// -// ASBackgroundLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -static NSUInteger const kForegroundChildIndex = 0; -static NSUInteger const kBackgroundChildIndex = 1; - -@implementation ASBackgroundLayoutSpec - -#pragma mark - Class - -+ (instancetype)backgroundLayoutSpecWithChild:(id)child background:(id)background NS_RETURNS_RETAINED -{ - return [[self alloc] initWithChild:child background:background]; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithChild:(id)child background:(id)background -{ - if (!(self = [super init])) { - return nil; - } - self.child = child; - self.background = background; - return self; -} - -#pragma mark - ASLayoutSpec - -/** - * First layout the contents, then fit the background image. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize -{ - ASLayout *contentsLayout = [self.child layoutThatFits:constrainedSize parentSize:parentSize]; - - ASLayout *rawSublayouts[2]; - int i = 0; - if (self.background) { - // Size background to exactly the same size. - ASLayout *backgroundLayout = [self.background layoutThatFits:ASSizeRangeMake(contentsLayout.size) - parentSize:parentSize]; - backgroundLayout.position = CGPointZero; - rawSublayouts[i++] = backgroundLayout; - } - contentsLayout.position = CGPointZero; - rawSublayouts[i++] = contentsLayout; - - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; - return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts]; -} - -#pragma mark - Background - -- (void)setChild:(id)child -{ - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - [super setChild:child atIndex:kForegroundChildIndex]; -} - -- (id)child -{ - return [super childAtIndex:kForegroundChildIndex]; -} - -- (void)setBackground:(id)background -{ - ASDisplayNodeAssertNotNil(background, @"Background cannot be nil"); - [super setChild:background atIndex:kBackgroundChildIndex]; -} - -- (id)background -{ - return [super childAtIndex:kBackgroundChildIndex]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.h deleted file mode 100644 index dd1f99aa..00000000 --- a/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// ASCenterLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * How the child is centered within the spec. - * - * The default option will position the child at {0,0} relatively to the layout bound. - * Swift: use [] for the default behavior. - */ -typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecCenteringOptions) { - /** The child is positioned in {0,0} relatively to the layout bounds */ - ASCenterLayoutSpecCenteringNone = 0, - /** The child is centered along the X axis */ - ASCenterLayoutSpecCenteringX = 1 << 0, - /** The child is centered along the Y axis */ - ASCenterLayoutSpecCenteringY = 1 << 1, - /** Convenience option to center both along the X and Y axis */ - ASCenterLayoutSpecCenteringXY = ASCenterLayoutSpecCenteringX | ASCenterLayoutSpecCenteringY -}; - -/** - * How much space the spec will take up. - * - * The default option will allow the spec to take up the maximum size possible. - * Swift: use [] for the default behavior. - */ -typedef NS_OPTIONS(NSUInteger, ASCenterLayoutSpecSizingOptions) { - /** The spec will take up the maximum size possible */ - ASCenterLayoutSpecSizingOptionDefault = ASRelativeLayoutSpecSizingOptionDefault, - /** The spec will take up the minimum size possible along the X axis */ - ASCenterLayoutSpecSizingOptionMinimumX = ASRelativeLayoutSpecSizingOptionMinimumWidth, - /** The spec will take up the minimum size possible along the Y axis */ - ASCenterLayoutSpecSizingOptionMinimumY = ASRelativeLayoutSpecSizingOptionMinimumHeight, - /** Convenience option to take up the minimum size along both the X and Y axis */ - ASCenterLayoutSpecSizingOptionMinimumXY = ASRelativeLayoutSpecSizingOptionMinimumSize -}; - -NS_ASSUME_NONNULL_BEGIN - -/** Lays out a single layoutElement child and position it so that it is centered into the layout bounds. - * NOTE: ASRelativeLayoutSpec offers all of the capabilities of Center, and more. - * Check it out if you would like to be able to position the child at any corner or the middle of an edge. - */ -@interface ASCenterLayoutSpec : ASRelativeLayoutSpec - -@property (nonatomic) ASCenterLayoutSpecCenteringOptions centeringOptions; -@property (nonatomic) ASCenterLayoutSpecSizingOptions sizingOptions; - -/** - * Initializer. - * - * @param centeringOptions How the child is centered. - * @param sizingOptions How much space will be taken up. - * @param child The child to center. - */ -+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions - sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions - child:(id)child NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.mm deleted file mode 100644 index 4c8ca5b7..00000000 --- a/Example/Pods/Texture/Source/Layout/ASCenterLayoutSpec.mm +++ /dev/null @@ -1,74 +0,0 @@ -// -// ASCenterLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation ASCenterLayoutSpec -{ - ASCenterLayoutSpecCenteringOptions _centeringOptions; - ASCenterLayoutSpecSizingOptions _sizingOptions; -} - -- (instancetype)initWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions - sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions - child:(id)child -{ - ASRelativeLayoutSpecPosition verticalPosition = [self verticalPositionFromCenteringOptions:centeringOptions]; - ASRelativeLayoutSpecPosition horizontalPosition = [self horizontalPositionFromCenteringOptions:centeringOptions]; - - if (!(self = [super initWithHorizontalPosition:horizontalPosition verticalPosition:verticalPosition sizingOption:sizingOptions child:child])) { - return nil; - } - _centeringOptions = centeringOptions; - _sizingOptions = sizingOptions; - return self; -} - -+ (instancetype)centerLayoutSpecWithCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions - sizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions - child:(id)child NS_RETURNS_RETAINED -{ - return [[self alloc] initWithCenteringOptions:centeringOptions sizingOptions:sizingOptions child:child]; -} - -- (void)setCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _centeringOptions = centeringOptions; - - [self setHorizontalPosition:[self horizontalPositionFromCenteringOptions:centeringOptions]]; - [self setVerticalPosition:[self verticalPositionFromCenteringOptions:centeringOptions]]; -} - -- (void)setSizingOptions:(ASCenterLayoutSpecSizingOptions)sizingOptions -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _sizingOptions = sizingOptions; - [self setSizingOption:sizingOptions]; -} - -- (ASRelativeLayoutSpecPosition)horizontalPositionFromCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions -{ - if ((centeringOptions & ASCenterLayoutSpecCenteringX) != 0) { - return ASRelativeLayoutSpecPositionCenter; - } else { - return ASRelativeLayoutSpecPositionNone; - } -} - -- (ASRelativeLayoutSpecPosition)verticalPositionFromCenteringOptions:(ASCenterLayoutSpecCenteringOptions)centeringOptions -{ - if ((centeringOptions & ASCenterLayoutSpecCenteringY) != 0) { - return ASRelativeLayoutSpecPositionCenter; - } else { - return ASRelativeLayoutSpecPositionNone; - } -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.h deleted file mode 100644 index 799c9c28..00000000 --- a/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// ASCornerLayoutSpec.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - The corner location for positioning corner element. - */ -typedef NS_ENUM(NSInteger, ASCornerLayoutLocation) { - ASCornerLayoutLocationTopLeft, - ASCornerLayoutLocationTopRight, - ASCornerLayoutLocationBottomLeft, - ASCornerLayoutLocationBottomRight, -}; - -NS_ASSUME_NONNULL_BEGIN - -/** - A layout spec that positions a corner element which relatives to the child element. - - @warning Both child element and corner element must have valid preferredSize for layout calculation. - */ -@interface ASCornerLayoutSpec : ASLayoutSpec - -/** - A layout spec that positions a corner element which relatives to the child element. - - @param child A child that is laid out to determine the size of this spec. - @param corner A layoutElement object that is laid out to a corner on the child. - @param location The corner position option. - @return An ASCornerLayoutSpec object with a given child and an layoutElement that act as corner. - */ -- (instancetype)initWithChild:(id )child corner:(id )corner location:(ASCornerLayoutLocation)location AS_WARN_UNUSED_RESULT; - -/** - A layout spec that positions a corner element which relatives to the child element. - - @param child A child that is laid out to determine the size of this spec. - @param corner A layoutElement object that is laid out to a corner on the child. - @param location The corner position option. - @return An ASCornerLayoutSpec object with a given child and an layoutElement that act as corner. - */ -+ (instancetype)cornerLayoutSpecWithChild:(id )child corner:(id )corner location:(ASCornerLayoutLocation)location NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - A layoutElement object that is laid out to a corner on the child. - */ -@property (nonatomic) id corner; - -/** - The corner position option. - */ -@property (nonatomic) ASCornerLayoutLocation cornerLocation; - -/** - The point which offsets from the corner location. Use this property to make delta - distance from the default corner location. Default is CGPointZero. - */ -@property (nonatomic) CGPoint offset; - -/** - Whether should include corner element into layout size calculation. If included, - the layout size will be the union size of both child and corner; If not included, - the layout size will be only child's size. Default is NO. - */ -@property (nonatomic) BOOL wrapsCorner; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.mm deleted file mode 100644 index 91a1ac87..00000000 --- a/Example/Pods/Texture/Source/Layout/ASCornerLayoutSpec.mm +++ /dev/null @@ -1,164 +0,0 @@ -// -// ASCornerLayoutSpec.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -CGPoint as_calculatedCornerOriginIn(CGRect baseFrame, CGSize cornerSize, ASCornerLayoutLocation cornerLocation, CGPoint offset) -{ - CGPoint cornerOrigin = CGPointZero; - CGPoint baseOrigin = baseFrame.origin; - CGSize baseSize = baseFrame.size; - - switch (cornerLocation) { - case ASCornerLayoutLocationTopLeft: - cornerOrigin.x = baseOrigin.x - cornerSize.width / 2; - cornerOrigin.y = baseOrigin.y - cornerSize.height / 2; - break; - case ASCornerLayoutLocationTopRight: - cornerOrigin.x = baseOrigin.x + baseSize.width - cornerSize.width / 2; - cornerOrigin.y = baseOrigin.y - cornerSize.height / 2; - break; - case ASCornerLayoutLocationBottomLeft: - cornerOrigin.x = baseOrigin.x - cornerSize.width / 2; - cornerOrigin.y = baseOrigin.y + baseSize.height - cornerSize.height / 2; - break; - case ASCornerLayoutLocationBottomRight: - cornerOrigin.x = baseOrigin.x + baseSize.width - cornerSize.width / 2; - cornerOrigin.y = baseOrigin.y + baseSize.height - cornerSize.height / 2; - break; - } - - cornerOrigin.x += offset.x; - cornerOrigin.y += offset.y; - - return cornerOrigin; -} - -static NSUInteger const kBaseChildIndex = 0; -static NSUInteger const kCornerChildIndex = 1; - -@interface ASCornerLayoutSpec() -@end - -@implementation ASCornerLayoutSpec - -- (instancetype)initWithChild:(id )child corner:(id )corner location:(ASCornerLayoutLocation)location -{ - self = [super init]; - if (self) { - self.child = child; - self.corner = corner; - self.cornerLocation = location; - } - return self; -} - -+ (instancetype)cornerLayoutSpecWithChild:(id )child corner:(id )corner location:(ASCornerLayoutLocation)location NS_RETURNS_RETAINED -{ - return [[self alloc] initWithChild:child corner:corner location:location]; -} - -#pragma mark - Children - -- (void)setChild:(id)child -{ - ASDisplayNodeAssertNotNil(child, @"Child shouldn't be nil."); - [super setChild:child atIndex:kBaseChildIndex]; -} - -- (id)child -{ - return [super childAtIndex:kBaseChildIndex]; -} - -- (void)setCorner:(id)corner -{ - ASDisplayNodeAssertNotNil(corner, @"Corner element cannot be nil."); - [super setChild:corner atIndex:kCornerChildIndex]; -} - -- (id)corner -{ - return [super childAtIndex:kCornerChildIndex]; -} - -#pragma mark - Calculation - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - CGSize size = { - ASPointsValidForSize(constrainedSize.max.width) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.width, - ASPointsValidForSize(constrainedSize.max.height) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.height - }; - - id child = self.child; - id corner = self.corner; - - // Element validation - [self _validateElement:child]; - [self _validateElement:corner]; - - CGRect childFrame = CGRectZero; - CGRect cornerFrame = CGRectZero; - - // Layout child - ASLayout *childLayout = [child layoutThatFits:constrainedSize parentSize:size]; - childFrame.size = childLayout.size; - - // Layout corner - ASLayout *cornerLayout = [corner layoutThatFits:constrainedSize parentSize:size]; - cornerFrame.size = cornerLayout.size; - - // Calculate corner's position - CGPoint relativePosition = as_calculatedCornerOriginIn(childFrame, cornerFrame.size, _cornerLocation, _offset); - - // Update corner's position - cornerFrame.origin = relativePosition; - - // Calculate size - CGRect frame = childFrame; - if (_wrapsCorner) { - frame = CGRectUnion(childFrame, cornerFrame); - frame.size = ASSizeRangeClamp(constrainedSize, frame.size); - } - - // Shift sublayouts' positions if they are off the bounds. - if (frame.origin.x != 0) { - CGFloat deltaX = frame.origin.x; - childFrame.origin.x -= deltaX; - cornerFrame.origin.x -= deltaX; - } - - if (frame.origin.y != 0) { - CGFloat deltaY = frame.origin.y; - childFrame.origin.y -= deltaY; - cornerFrame.origin.y -= deltaY; - } - - childLayout.position = childFrame.origin; - cornerLayout.position = cornerFrame.origin; - - return [ASLayout layoutWithLayoutElement:self size:frame.size sublayouts:@[childLayout, cornerLayout]]; -} - -- (void)_validateElement:(id )element -{ - // Validate non-nil element - if (element == nil) { - ASDisplayNodeAssertNotNil(element, @"[%@]: Must have a non-nil child/corner for layout calculation.", self.class); - } - // Validate preferredSize if needed - CGSize size = element.style.preferredSize; - if (!CGSizeEqualToSize(size, CGSizeZero) && !ASIsCGSizeValidForSize(size) && (size.width < 0 || (size.height < 0))) { - ASDisplayNodeFailAssert(@"[%@]: Should give a valid preferredSize value for %@ before corner's position calculation.", self.class, element); - } -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASDimension.h b/Example/Pods/Texture/Source/Layout/ASDimension.h deleted file mode 100644 index ab0717ba..00000000 --- a/Example/Pods/Texture/Source/Layout/ASDimension.h +++ /dev/null @@ -1,315 +0,0 @@ -// -// ASDimension.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - - -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForLayout(CGFloat points) -{ - return ((isnormal(points) || points == 0.0) && points >= 0.0 && points < (CGFLOAT_MAX / 2.0)); -} - -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForLayout(CGSize size) -{ - return (ASPointsValidForLayout(size.width) && ASPointsValidForLayout(size.height)); -} - -// Note we want YGUndefined (10E20) to be considered invalid, so we have picked a smaller number than CGFLOAT_MAX/2.0 -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASPointsValidForSize(CGFloat points) -{ - return ((isnormal(points) || points == 0.0) && points >= 0.0 && points < 10000000.0); -} - -ASDISPLAYNODE_INLINE BOOL AS_WARN_UNUSED_RESULT ASIsCGSizeValidForSize(CGSize size) -{ - return (ASPointsValidForSize(size.width) && ASPointsValidForSize(size.height)); -} - -// Note we want YGUndefined (10E20) to be considered invalid, so we have picked a smaller number than CGFLOAT_MAX/2.0 -ASDISPLAYNODE_INLINE BOOL ASIsCGPositionPointsValidForLayout(CGFloat points) -{ - return ((isnormal(points) || points == 0.0) && points < 10000000.0); -} - -ASDISPLAYNODE_INLINE BOOL ASIsCGPositionValidForLayout(CGPoint point) -{ - return (ASIsCGPositionPointsValidForLayout(point.x) && ASIsCGPositionPointsValidForLayout(point.y)); -} - -ASDISPLAYNODE_INLINE BOOL ASIsCGRectValidForLayout(CGRect rect) -{ - return (ASIsCGPositionValidForLayout(rect.origin) && ASIsCGSizeValidForLayout(rect.size)); -} - -#pragma mark - ASDimension - -/** - * A dimension relative to constraints to be provided in the future. - * A ASDimension can be one of three types: - * - * "Auto" - This indicated "I have no opinion" and may be resolved in whatever way makes most sense given the circumstances. - * - * "Points" - Just a number. It will always resolve to exactly this amount. - * - * "Percent" - Multiplied to a provided parent amount to resolve a final amount. - */ -typedef NS_ENUM(NSInteger, ASDimensionUnit) { - /** This indicates "I have no opinion" and may be resolved in whatever way makes most sense given the circumstances. */ - ASDimensionUnitAuto, - /** Just a number. It will always resolve to exactly this amount. This is the default type. */ - ASDimensionUnitPoints, - /** Multiplied to a provided parent amount to resolve a final amount. */ - ASDimensionUnitFraction, -}; - -typedef struct { - ASDimensionUnit unit; - CGFloat value; -} ASDimension; - -/** - * Represents auto as ASDimension - */ -ASDK_EXTERN ASDimension const ASDimensionAuto; - -/** - * Returns a dimension with the specified type and value. - */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE ASDimension ASDimensionMake(ASDimensionUnit unit, CGFloat value) -{ - if (unit == ASDimensionUnitAuto ) { - ASDisplayNodeCAssert(value == 0, @"ASDimension auto value must be 0."); - } else if (unit == ASDimensionUnitPoints) { - ASDisplayNodeCAssertPositiveReal(@"Points", value); - } else if (unit == ASDimensionUnitFraction) { - ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASDimension fraction value (%f) must be between 0 and 1.", value); - } - ASDimension dimension; - dimension.unit = unit; - dimension.value = value; - return dimension; -} - -/** - * Returns a dimension with the specified points value. - */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMake(CGFloat points) -{ - return ASDimensionMake(ASDimensionUnitPoints, points); -} - -/** - * Returns a dimension by parsing the specified dimension string. - * Examples: ASDimensionMake(@"50%") = ASDimensionMake(ASDimensionUnitFraction, 0.5) - * ASDimensionMake(@"0.5pt") = ASDimensionMake(ASDimensionUnitPoints, 0.5) - */ -ASOVERLOADABLE AS_WARN_UNUSED_RESULT ASDK_EXTERN ASDimension ASDimensionMake(NSString *dimension); - -/** - * Returns a dimension with the specified points value. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithPoints(CGFloat points) -{ - ASDisplayNodeCAssertPositiveReal(@"Points", points); - return ASDimensionMake(ASDimensionUnitPoints, points); -} - -/** - * Returns a dimension with the specified fraction value. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensionMakeWithFraction(CGFloat fraction) -{ - ASDisplayNodeCAssert( 0 <= fraction && fraction <= 1.0, @"ASDimension fraction value (%f) must be between 0 and 1.", fraction); - return ASDimensionMake(ASDimensionUnitFraction, fraction); -} - -/** - * Returns whether two dimensions are equal. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDimension lhs, ASDimension rhs) -{ - return (lhs.unit == rhs.unit && lhs.value == rhs.value); -} - -/** - * Returns a NSString representation of a dimension. - */ -ASDK_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); - -/** - * Resolve this dimension to a parent size. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGFloat ASDimensionResolve(ASDimension dimension, CGFloat parentSize, CGFloat autoSize) -{ - switch (dimension.unit) { - case ASDimensionUnitAuto: - return autoSize; - case ASDimensionUnitPoints: - return dimension.value; - case ASDimensionUnitFraction: - return dimension.value * parentSize; - } -} - -#pragma mark - ASLayoutSize - -/** - * Expresses a size with relative dimensions. Only used for calculations internally in ASDimension.h - */ -typedef struct { - ASDimension width; - ASDimension height; -} ASLayoutSize; - -ASDK_EXTERN ASLayoutSize const ASLayoutSizeAuto; - -/* - * Creates an ASLayoutSize with provided min and max dimensions. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutSize ASLayoutSizeMake(ASDimension width, ASDimension height) -{ - ASLayoutSize size; - size.width = width; - size.height = height; - return size; -} - -/** - * Resolve this relative size relative to a parent size. - */ -ASDISPLAYNODE_INLINE CGSize ASLayoutSizeResolveSize(ASLayoutSize layoutSize, CGSize parentSize, CGSize autoSize) -{ - return CGSizeMake(ASDimensionResolve(layoutSize.width, parentSize.width, autoSize.width), - ASDimensionResolve(layoutSize.height, parentSize.height, autoSize.height)); -} - -/* - * Returns a string representation of a relative size. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutSize(ASLayoutSize size) -{ - return [NSString stringWithFormat:@"{%@, %@}", - NSStringFromASDimension(size.width), - NSStringFromASDimension(size.height)]; -} - -#pragma mark - ASSizeRange - -/** - * Expresses an inclusive range of sizes. Used to provide a simple constraint to layout. - */ -typedef struct { - CGSize min; - CGSize max; -} ASSizeRange; - -/** - * A size range with all dimensions zero. - */ -ASDK_EXTERN ASSizeRange const ASSizeRangeZero; - -/** - * A size range from zero to infinity in both directions. - */ -ASDK_EXTERN ASSizeRange const ASSizeRangeUnconstrained; - -/** - * Returns whether a size range has > 0.1 max width and max height. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeHasSignificantArea(ASSizeRange sizeRange) -{ - static CGFloat const limit = 0.1f; - return (sizeRange.max.width > limit && sizeRange.max.height > limit); -} - -/** - * Creates an ASSizeRange with provided min and max size. - */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize min, CGSize max) -{ - ASDisplayNodeCAssertPositiveReal(@"Range min width", min.width); - ASDisplayNodeCAssertPositiveReal(@"Range min height", min.height); - ASDisplayNodeCAssertInfOrPositiveReal(@"Range max width", max.width); - ASDisplayNodeCAssertInfOrPositiveReal(@"Range max height", max.height); - ASDisplayNodeCAssert(min.width <= max.width, - @"Range min width (%f) must not be larger than max width (%f).", min.width, max.width); - ASDisplayNodeCAssert(min.height <= max.height, - @"Range min height (%f) must not be larger than max height (%f).", min.height, max.height); - ASSizeRange sizeRange; - sizeRange.min = min; - sizeRange.max = max; - return sizeRange; -} - -/** - * Creates an ASSizeRange with provided size as both min and max. - */ -ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeMake(CGSize exactSize) -{ - return ASSizeRangeMake(exactSize, exactSize); -} - -/** - * Clamps the provided CGSize between the [min, max] bounds of this ASSizeRange. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange sizeRange, CGSize size) -{ - return CGSizeMake(MAX(sizeRange.min.width, MIN(sizeRange.max.width, size.width)), - MAX(sizeRange.min.height, MIN(sizeRange.max.height, size.height))); -} - -/** - * Intersects another size range. If the other size range does not overlap in either dimension, this size range - * "wins" by returning a single point within its own range that is closest to the non-overlapping range. - */ -ASDK_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); - -/** - * Returns whether two size ranges are equal in min and max size. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSizeRange lhs, ASSizeRange rhs) -{ - return CGSizeEqualToSize(lhs.min, rhs.min) && CGSizeEqualToSize(lhs.max, rhs.max); -} - -/** - * Returns a string representation of a size range - */ -ASDK_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); - -#if YOGA - -#pragma mark - ASEdgeInsets - -typedef struct { - ASDimension top; - ASDimension left; - ASDimension bottom; - ASDimension right; - ASDimension start; - ASDimension end; - ASDimension horizontal; - ASDimension vertical; - ASDimension all; -} ASEdgeInsets; - -ASDK_EXTERN ASEdgeInsets const ASEdgeInsetsZero; - -ASDK_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); - -#endif - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASDimension.mm b/Example/Pods/Texture/Source/Layout/ASDimension.mm deleted file mode 100644 index 10af17cc..00000000 --- a/Example/Pods/Texture/Source/Layout/ASDimension.mm +++ /dev/null @@ -1,123 +0,0 @@ -// -// ASDimension.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#pragma mark - ASDimension - -ASDimension const ASDimensionAuto = {ASDimensionUnitAuto, 0}; - -ASOVERLOADABLE ASDimension ASDimensionMake(NSString *dimension) -{ - if (dimension.length > 0) { - - // Handle points - if ([dimension hasSuffix:@"pt"]) { - return ASDimensionMake(ASDimensionUnitPoints, ASCGFloatFromString(dimension)); - } - - // Handle auto - if ([dimension isEqualToString:@"auto"]) { - return ASDimensionAuto; - } - - // Handle percent - if ([dimension hasSuffix:@"%"]) { - return ASDimensionMake(ASDimensionUnitFraction, (ASCGFloatFromString(dimension) / 100.0)); - } - } - - return ASDimensionAuto; -} - -NSString *NSStringFromASDimension(ASDimension dimension) -{ - switch (dimension.unit) { - case ASDimensionUnitPoints: - return [NSString stringWithFormat:@"%.0fpt", dimension.value]; - case ASDimensionUnitFraction: - return [NSString stringWithFormat:@"%.0f%%", dimension.value * 100.0]; - case ASDimensionUnitAuto: - return @"Auto"; - } -} - -#pragma mark - ASLayoutSize - -ASLayoutSize const ASLayoutSizeAuto = {ASDimensionAuto, ASDimensionAuto}; - -#pragma mark - ASSizeRange - -ASSizeRange const ASSizeRangeZero = {}; - -ASSizeRange const ASSizeRangeUnconstrained = { {0, 0}, { INFINITY, INFINITY }}; - -struct _Range { - CGFloat min; - CGFloat max; - - /** - Intersects another dimension range. If the other range does not overlap, this size range "wins" by returning a - single point within its own range that is closest to the non-overlapping range. - */ - _Range intersect(const _Range &other) const - { - CGFloat newMin = MAX(min, other.min); - CGFloat newMax = MIN(max, other.max); - if (newMin <= newMax) { - return {newMin, newMax}; - } else { - // No intersection. If we're before the other range, return our max; otherwise our min. - if (min < other.min) { - return {max, max}; - } else { - return {min, min}; - } - } - } -}; - -ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange) -{ - const auto w = _Range({sizeRange.min.width, sizeRange.max.width}).intersect({otherSizeRange.min.width, otherSizeRange.max.width}); - const auto h = _Range({sizeRange.min.height, sizeRange.max.height}).intersect({otherSizeRange.min.height, otherSizeRange.max.height}); - return {{w.min, h.min}, {w.max, h.max}}; -} - -NSString *NSStringFromASSizeRange(ASSizeRange sizeRange) -{ - // 17 field length copied from iOS 10.3 impl of NSStringFromCGSize. - if (CGSizeEqualToSize(sizeRange.min, sizeRange.max)) { - return [NSString stringWithFormat:@"{{%.*g, %.*g}}", - 17, sizeRange.min.width, - 17, sizeRange.min.height]; - } - return [NSString stringWithFormat:@"{{%.*g, %.*g}, {%.*g, %.*g}}", - 17, sizeRange.min.width, - 17, sizeRange.min.height, - 17, sizeRange.max.width, - 17, sizeRange.max.height]; -} - -#if YOGA -#pragma mark - Yoga - ASEdgeInsets -ASEdgeInsets const ASEdgeInsetsZero = {}; - -ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) -{ - ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero; - asEdgeInsets.top = ASDimensionMake(edgeInsets.top); - asEdgeInsets.left = ASDimensionMake(edgeInsets.left); - asEdgeInsets.bottom = ASDimensionMake(edgeInsets.bottom); - asEdgeInsets.right = ASDimensionMake(edgeInsets.right); - return asEdgeInsets; -} -#endif diff --git a/Example/Pods/Texture/Source/Layout/ASDimensionInternal.h b/Example/Pods/Texture/Source/Layout/ASDimensionInternal.h deleted file mode 100644 index dced2ffa..00000000 --- a/Example/Pods/Texture/Source/Layout/ASDimensionInternal.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// ASDimensionInternal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - ASLayoutElementSize - -/** - * A struct specifying a ASLayoutElement's size. Example: - * - * ASLayoutElementSize size = (ASLayoutElementSize){ - * .width = ASDimensionMakeWithFraction(0.25), - * .maxWidth = ASDimensionMakeWithPoints(200), - * .minHeight = ASDimensionMakeWithFraction(0.50) - * }; - * - * Description: - * - */ -typedef struct { - ASDimension width; - ASDimension height; - ASDimension minWidth; - ASDimension maxWidth; - ASDimension minHeight; - ASDimension maxHeight; -} ASLayoutElementSize; - -/** - * Returns an ASLayoutElementSize with default values. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMake() -{ - return (ASLayoutElementSize){ - .width = ASDimensionAuto, - .height = ASDimensionAuto, - .minWidth = ASDimensionAuto, - .maxWidth = ASDimensionAuto, - .minHeight = ASDimensionAuto, - .maxHeight = ASDimensionAuto - }; -} - -/** - * Returns an ASLayoutElementSize with the specified CGSize values as width and height. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASLayoutElementSize ASLayoutElementSizeMakeFromCGSize(CGSize size) -{ - ASLayoutElementSize s = ASLayoutElementSizeMake(); - s.width = ASDimensionMakeWithPoints(size.width); - s.height = ASDimensionMakeWithPoints(size.height); - return s; -} - -/** - * Returns whether two sizes are equal. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayoutElementSize(ASLayoutElementSize lhs, ASLayoutElementSize rhs) -{ - return (ASDimensionEqualToDimension(lhs.width, rhs.width) - && ASDimensionEqualToDimension(lhs.height, rhs.height) - && ASDimensionEqualToDimension(lhs.minWidth, rhs.minWidth) - && ASDimensionEqualToDimension(lhs.maxWidth, rhs.maxWidth) - && ASDimensionEqualToDimension(lhs.minHeight, rhs.minHeight) - && ASDimensionEqualToDimension(lhs.maxHeight, rhs.maxHeight)); -} - -/** - * Returns a string formatted to contain the data from an ASLayoutElementSize. - */ -ASDK_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); - -/** - * Resolve the given size relative to a parent size and an auto size. - * From the given size uses width, height to resolve the exact size constraint, uses the minHeight and minWidth to - * resolve the min size constraint and the maxHeight and maxWidth to resolve the max size constraint. For every - * dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used. - * Based on the calculated exact, min and max size constraints the final size range will be calculated. - */ -ASDK_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); - -/** - * Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as - * as autoASSizeRange. For more information look at ASLayoutElementSizeResolveAutoSize. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolve(ASLayoutElementSize size, const CGSize parentSize) -{ - return ASLayoutElementSizeResolveAutoSize(size, parentSize, ASSizeRangeMake(CGSizeZero, CGSizeMake(INFINITY, INFINITY))); -} - - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASDimensionInternal.mm b/Example/Pods/Texture/Source/Layout/ASDimensionInternal.mm deleted file mode 100644 index 8af35552..00000000 --- a/Example/Pods/Texture/Source/Layout/ASDimensionInternal.mm +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASDimensionInternal.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#pragma mark - ASLayoutElementSize - -NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size) -{ - return [NSString stringWithFormat: - @"", - NSStringFromASLayoutSize(ASLayoutSizeMake(size.width, size.height)), - NSStringFromASLayoutSize(ASLayoutSizeMake(size.minWidth, size.minHeight)), - NSStringFromASLayoutSize(ASLayoutSizeMake(size.maxWidth, size.maxHeight))]; -} - -ASDISPLAYNODE_INLINE void ASLayoutElementSizeConstrain(CGFloat minVal, CGFloat exactVal, CGFloat maxVal, CGFloat *outMin, CGFloat *outMax) -{ - NSCAssert(!isnan(minVal), @"minVal must not be NaN"); - NSCAssert(!isnan(maxVal), @"maxVal must not be NaN"); - // Avoid use of min/max primitives since they're harder to reason - // about in the presence of NaN (in exactVal) - // Follow CSS: min overrides max overrides exact. - - // Begin with the min/max range - *outMin = minVal; - *outMax = maxVal; - if (maxVal <= minVal) { - // min overrides max and exactVal is irrelevant - *outMax = minVal; - return; - } - if (isnan(exactVal)) { - // no exact value, so leave as a min/max range - return; - } - if (exactVal > maxVal) { - // clip to max value - *outMin = maxVal; - } else if (exactVal < minVal) { - // clip to min value - *outMax = minVal; - } else { - // use exact value - *outMin = *outMax = exactVal; - } -} - -ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange) -{ - CGSize resolvedExact = ASLayoutSizeResolveSize(ASLayoutSizeMake(size.width, size.height), parentSize, {NAN, NAN}); - CGSize resolvedMin = ASLayoutSizeResolveSize(ASLayoutSizeMake(size.minWidth, size.minHeight), parentSize, autoASSizeRange.min); - CGSize resolvedMax = ASLayoutSizeResolveSize(ASLayoutSizeMake(size.maxWidth, size.maxHeight), parentSize, autoASSizeRange.max); - - CGSize rangeMin, rangeMax; - ASLayoutElementSizeConstrain(resolvedMin.width, resolvedExact.width, resolvedMax.width, &rangeMin.width, &rangeMax.width); - ASLayoutElementSizeConstrain(resolvedMin.height, resolvedExact.height, resolvedMax.height, &rangeMin.height, &rangeMax.height); - return {rangeMin, rangeMax}; -} diff --git a/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.h deleted file mode 100644 index 8e22fe9b..00000000 --- a/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// ASInsetLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - A layout spec that wraps another layoutElement child, applying insets around it. - - If the child has a size specified as a fraction, the fraction is resolved against this spec's parent - size **after** applying insets. - - @example ASOuterLayoutSpec contains an ASInsetLayoutSpec with an ASInnerLayoutSpec. Suppose that: - - ASOuterLayoutSpec is 200pt wide. - - ASInnerLayoutSpec specifies its width as 100%. - - The ASInsetLayoutSpec has insets of 10pt on every side. - ASInnerLayoutSpec will have size 180pt, not 200pt, because it receives a parent size that has been adjusted for insets. - - If you're familiar with CSS: ASInsetLayoutSpec's child behaves similarly to "box-sizing: border-box". - - An infinite inset is resolved as an inset equal to all remaining space after applying the other insets and child size. - @example An ASInsetLayoutSpec with an infinite left inset and 10px for all other edges will position it's child 10px from the right edge. - */ -@interface ASInsetLayoutSpec : ASLayoutSpec - -@property (nonatomic) UIEdgeInsets insets; - -/** - @param insets The amount of space to inset on each side. - @param child The wrapped child to inset. - */ -+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id)child NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.mm deleted file mode 100644 index 6beaefed..00000000 --- a/Example/Pods/Texture/Source/Layout/ASInsetLayoutSpec.mm +++ /dev/null @@ -1,122 +0,0 @@ -// -// ASInsetLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -@interface ASInsetLayoutSpec () -{ - UIEdgeInsets _insets; -} -@end - -/* Returns f if f is finite, substitute otherwise */ -static CGFloat finite(CGFloat f, CGFloat substitute) -{ - return isinf(f) ? substitute : f; -} - -/* Returns f if f is finite, 0 otherwise */ -static CGFloat finiteOrZero(CGFloat f) -{ - return finite(f, 0); -} - -/* Returns the inset required to center 'inner' in 'outer' */ -static CGFloat centerInset(CGFloat outer, CGFloat inner) -{ - return ASRoundPixelValue((outer - inner) / 2); -} - -@implementation ASInsetLayoutSpec - -- (instancetype)initWithInsets:(UIEdgeInsets)insets child:(id)child -{ - if (!(self = [super init])) { - return nil; - } - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - _insets = insets; - [self setChild:child]; - return self; -} - -+ (instancetype)insetLayoutSpecWithInsets:(UIEdgeInsets)insets child:(id)child NS_RETURNS_RETAINED -{ - return [[self alloc] initWithInsets:insets child:child]; -} - -- (void)setInsets:(UIEdgeInsets)insets -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _insets = insets; -} - -/** - Inset will compute a new constrained size for it's child after applying insets and re-positioning - the child to respect the inset. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize -{ - if (self.child == nil) { - ASDisplayNodeAssert(NO, @"Inset spec measured without a child. The spec will do nothing."); - return [ASLayout layoutWithLayoutElement:self size:CGSizeZero]; - } - - const CGFloat insetsX = (finiteOrZero(_insets.left) + finiteOrZero(_insets.right)); - const CGFloat insetsY = (finiteOrZero(_insets.top) + finiteOrZero(_insets.bottom)); - - // if either x-axis inset is infinite, let child be intrinsic width - const CGFloat minWidth = (isinf(_insets.left) || isinf(_insets.right)) ? 0 : constrainedSize.min.width; - // if either y-axis inset is infinite, let child be intrinsic height - const CGFloat minHeight = (isinf(_insets.top) || isinf(_insets.bottom)) ? 0 : constrainedSize.min.height; - - const ASSizeRange insetConstrainedSize = { - { - MAX(0, minWidth - insetsX), - MAX(0, minHeight - insetsY), - }, - { - MAX(0, constrainedSize.max.width - insetsX), - MAX(0, constrainedSize.max.height - insetsY), - } - }; - - const CGSize insetParentSize = { - MAX(0, parentSize.width - insetsX), - MAX(0, parentSize.height - insetsY) - }; - - ASLayout *sublayout = [self.child layoutThatFits:insetConstrainedSize parentSize:insetParentSize]; - - const CGSize computedSize = ASSizeRangeClamp(constrainedSize, { - finite(sublayout.size.width + _insets.left + _insets.right, constrainedSize.max.width), - finite(sublayout.size.height + _insets.top + _insets.bottom, constrainedSize.max.height), - }); - - const CGFloat x = finite(_insets.left, constrainedSize.max.width - - (finite(_insets.right, - centerInset(constrainedSize.max.width, sublayout.size.width)) + sublayout.size.width)); - - const CGFloat y = finite(_insets.top, - constrainedSize.max.height - - (finite(_insets.bottom, - centerInset(constrainedSize.max.height, sublayout.size.height)) + sublayout.size.height)); - - sublayout.position = CGPointMake(x, y); - - return [ASLayout layoutWithLayoutElement:self size:computedSize sublayouts:@[sublayout]]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.h b/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.h deleted file mode 100644 index 34636efa..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ASLayout+IGListDiffKit.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#if AS_IG_LIST_DIFF_KIT -#import -#import - -@interface ASLayout(IGListDiffKit) -@end -#endif // AS_IG_LIST_DIFF_KIT diff --git a/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.mm b/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.mm deleted file mode 100644 index d6e57b21..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayout+IGListDiffKit.mm +++ /dev/null @@ -1,30 +0,0 @@ -// -// ASLayout+IGListDiffKit.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// -#import -#if AS_IG_LIST_DIFF_KIT -#import "ASLayout+IGListDiffKit.h" - -@interface ASLayout() { -@public - id _layoutElement; -} -@end - -@implementation ASLayout(IGListDiffKit) - -- (id )diffIdentifier -{ - return self->_layoutElement; -} - -- (BOOL)isEqualToDiffableObject:(id )other -{ - return [self isEqual:other]; -} -@end -#endif // AS_IG_LIST_DIFF_KIT diff --git a/Example/Pods/Texture/Source/Layout/ASLayout.h b/Example/Pods/Texture/Source/Layout/ASLayout.h deleted file mode 100644 index 44b7de08..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayout.h +++ /dev/null @@ -1,157 +0,0 @@ -// -// ASLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN CGPoint const ASPointNull; // {NAN, NAN} - -ASDK_EXTERN BOOL ASPointIsNull(CGPoint point); - -ASDK_EXTERN NSString *const ASThreadDictMaxConstraintSizeKey; - -/** - * Safely calculates the layout of the given root layoutElement by guarding against nil nodes. - * @param rootLayoutElement The root node to calculate the layout for. - * @param sizeRange The size range to calculate the root layout within. - */ -ASDK_EXTERN ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange); - -/** - * Safely computes the layout of the given node by guarding against nil nodes. - * @param layoutElement The layout element to calculate the layout for. - * @param sizeRange The size range to calculate the node layout within. - * @param parentSize The parent size of the node to calculate the layout for. - */ -ASDK_EXTERN ASLayout *ASCalculateLayout(idlayoutElement, const ASSizeRange sizeRange, const CGSize parentSize); - -/** - * A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement). - */ -@interface ASLayout : NSObject - -/** - * The underlying object described by this layout - */ -@property (nonatomic, weak, readonly) id layoutElement; - -/** - * The type of ASLayoutElement that created this layout - */ -@property (nonatomic, readonly) ASLayoutElementType type; - -/** - * Size of the current layout - */ -@property (nonatomic, readonly) CGSize size; - -/** - * Position in parent. Default to ASPointNull. - * - * @discussion When being used as a sublayout, this property must not equal ASPointNull. - */ -@property (nonatomic, readonly) CGPoint position; - -/** - * Array of ASLayouts. Each must have a valid non-null position. - */ -@property (nonatomic, copy, readonly) NSArray *sublayouts; - -/** - * The frame for the given element, or CGRectNull if - * the element is not a direct descendent of this layout. - */ -- (CGRect)frameForElement:(id)layoutElement; - -/** - * @abstract Returns a valid frame for the current layout computed with the size and position. - * @discussion Clamps the layout's origin or position to 0 if any of the calculated values are infinite. - */ -@property (nonatomic, readonly) CGRect frame; - -/** - * Designated initializer - */ -- (instancetype)initWithLayoutElement:(id)layoutElement - size:(CGSize)size - position:(CGPoint)position - sublayouts:(nullable NSArray *)sublayouts NS_DESIGNATED_INITIALIZER; - -/** - * Convenience class initializer for layout construction. - * - * @param layoutElement The backing ASLayoutElement object. - * @param size The size of this layout. - * @param position The position of this layout within its parent (if available). - * @param sublayouts Sublayouts belong to the new layout. - */ -+ (instancetype)layoutWithLayoutElement:(id)layoutElement - size:(CGSize)size - position:(CGPoint)position - sublayouts:(nullable NSArray *)sublayouts NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * Convenience initializer that has CGPointNull position. - * Best used by ASDisplayNode subclasses that are manually creating a layout for -calculateLayoutThatFits:, - * or for ASLayoutSpec subclasses that are referencing the "self" level in the layout tree, - * or for creating a sublayout of which the position is yet to be determined. - * - * @param layoutElement The backing ASLayoutElement object. - * @param size The size of this layout. - * @param sublayouts Sublayouts belong to the new layout. - */ -+ (instancetype)layoutWithLayoutElement:(id)layoutElement - size:(CGSize)size - sublayouts:(nullable NSArray *)sublayouts NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * Convenience that has CGPointNull position and no sublayouts. - * Best used for creating a layout that has no sublayouts, and is either a root one - * or a sublayout of which the position is yet to be determined. - * - * @param layoutElement The backing ASLayoutElement object. - * @param size The size of this layout. - */ -+ (instancetype)layoutWithLayoutElement:(id)layoutElement - size:(CGSize)size NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * Traverses the existing layout tree and generates a new tree that represents only ASDisplayNode layouts - */ -- (ASLayout *)filteredNodeLayoutTree NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)new NS_UNAVAILABLE; - -@end - -#pragma mark - Debugging - -@interface ASLayout (Debugging) - -/** - * Set to YES to tell all ASLayout instances to retain their sublayout elements. Defaults to NO. - * See `-retainSublayoutLayoutElements` to control this per-instance. - * - * Note: Weaver relies on this API. - */ -@property (class) BOOL shouldRetainSublayoutLayoutElements; - -/** - * Recrusively output the description of the layout tree. - */ -- (NSString *)recursiveDescription; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASLayout.mm b/Example/Pods/Texture/Source/Layout/ASLayout.mm deleted file mode 100644 index 3979c842..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayout.mm +++ /dev/null @@ -1,376 +0,0 @@ -// -// ASLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import - -#import -#import - -NSString *const ASThreadDictMaxConstraintSizeKey = @"kASThreadDictMaxConstraintSizeKey"; - -CGPoint const ASPointNull = {NAN, NAN}; - -BOOL ASPointIsNull(CGPoint point) -{ - return isnan(point.x) && isnan(point.y); -} - -/** - * Creates an defined number of " |" indent blocks for the recursive description. - */ -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT NSString * descriptionIndents(NSUInteger indents) -{ - NSMutableString *description = [NSMutableString string]; - for (NSUInteger i = 0; i < indents; i++) { - [description appendString:@" |"]; - } - if (indents > 0) { - [description appendString:@" "]; - } - return description; -} - -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutIsDisplayNodeType(ASLayout *layout) -{ - return layout.type == ASLayoutElementTypeDisplayNode; -} - -@interface ASLayout () -{ - ASLayoutElementType _layoutElementType; - std::atomic_bool _retainSublayoutElements; -} -@end - -@implementation ASLayout - -@dynamic frame, type; - -static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT(NO); - -+ (void)setShouldRetainSublayoutLayoutElements:(BOOL)shouldRetain -{ - static_retainsSublayoutLayoutElements.store(shouldRetain); -} - -+ (BOOL)shouldRetainSublayoutLayoutElements -{ - return static_retainsSublayoutLayoutElements.load(); -} - -- (instancetype)initWithLayoutElement:(id)layoutElement - size:(CGSize)size - position:(CGPoint)position - sublayouts:(nullable NSArray *)sublayouts -{ - NSParameterAssert(layoutElement); - - self = [super init]; - if (self) { -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - for (ASLayout *sublayout in sublayouts) { - ASDisplayNodeAssert(ASPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout."); - } -#endif - - _layoutElement = layoutElement; - - // Read this now to avoid @c weak overhead later. - _layoutElementType = layoutElement.layoutElementType; - - if (!ASIsCGSizeValidForSize(size)) { - ASDisplayNodeFailAssert(@"layoutSize is invalid and unsafe to provide to Core Animation! Release configurations will force to 0, 0. Size = %@, node = %@", NSStringFromCGSize(size), layoutElement); - size = CGSizeZero; - } else { - size = CGSizeMake(ASCeilPixelValue(size.width), ASCeilPixelValue(size.height)); - } - _size = size; - - if (ASPointIsNull(position) == NO) { - _position = ASCeilPointValues(position); - } else { - _position = position; - } - - _sublayouts = [sublayouts copy] ?: @[]; - - if ([ASLayout shouldRetainSublayoutLayoutElements]) { - [self retainSublayoutElements]; - } - } - - return self; -} - -#pragma mark - Class Constructors - -+ (instancetype)layoutWithLayoutElement:(id)layoutElement - size:(CGSize)size - position:(CGPoint)position - sublayouts:(nullable NSArray *)sublayouts NS_RETURNS_RETAINED -{ - return [[self alloc] initWithLayoutElement:layoutElement - size:size - position:position - sublayouts:sublayouts]; -} - -+ (instancetype)layoutWithLayoutElement:(id)layoutElement - size:(CGSize)size - sublayouts:(nullable NSArray *)sublayouts NS_RETURNS_RETAINED -{ - return [self layoutWithLayoutElement:layoutElement - size:size - position:ASPointNull - sublayouts:sublayouts]; -} - -+ (instancetype)layoutWithLayoutElement:(id)layoutElement size:(CGSize)size NS_RETURNS_RETAINED -{ - return [self layoutWithLayoutElement:layoutElement - size:size - position:ASPointNull - sublayouts:nil]; -} - -- (void)dealloc -{ - if (_retainSublayoutElements.load()) { - for (ASLayout *sublayout in _sublayouts) { - // We retained this, so there's no risk of it deallocating on us. - if (CFTypeRef cfElement = (__bridge CFTypeRef)sublayout->_layoutElement) { - CFRelease(cfElement); - } - } - } -} - -#pragma mark - Sublayout Elements Caching - -- (void)retainSublayoutElements -{ - if (_retainSublayoutElements.exchange(true)) { - return; - } - - for (ASLayout *sublayout in _sublayouts) { - // CFBridgingRetain atomically casts and retains. We need the atomicity. - CFBridgingRetain(sublayout->_layoutElement); - } -} - -#pragma mark - Layout Flattening - -- (BOOL)isFlattened -{ - // A layout is flattened if its position is null, and all of its sublayouts are of type displaynode with no sublayouts. - if (!ASPointIsNull(_position)) { - return NO; - } - - for (ASLayout *sublayout in _sublayouts) { - if (ASLayoutIsDisplayNodeType(sublayout) == NO || sublayout->_sublayouts.count > 0) { - return NO; - } - } - - return YES; -} - -- (ASLayout *)filteredNodeLayoutTree NS_RETURNS_RETAINED -{ - if ([self isFlattened]) { - // All flattened layouts must retain sublayout elements until they are applied. - [self retainSublayoutElements]; - return self; - } - - struct Context { - unowned ASLayout *layout; - CGPoint absolutePosition; - }; - - // Queue used to keep track of sublayouts while traversing this layout in a DFS fashion. - std::deque queue; - for (ASLayout *sublayout in _sublayouts) { - queue.push_back({sublayout, sublayout.position}); - } - - std::vector flattenedSublayouts; - - while (!queue.empty()) { - const Context context = std::move(queue.front()); - queue.pop_front(); - - unowned ASLayout *layout = context.layout; - // Direct ivar access to avoid retain/release, use existing +1. - const NSUInteger sublayoutsCount = layout->_sublayouts.count; - const CGPoint absolutePosition = context.absolutePosition; - - if (ASLayoutIsDisplayNodeType(layout)) { - if (sublayoutsCount > 0 || CGPointEqualToPoint(ASCeilPointValues(absolutePosition), layout.position) == NO) { - // Only create a new layout if the existing one can't be reused, which means it has either some sublayouts or an invalid absolute position. - const auto newLayout = [ASLayout layoutWithLayoutElement:layout->_layoutElement - size:layout.size - position:absolutePosition - sublayouts:@[]]; - flattenedSublayouts.push_back(newLayout); - } else { - flattenedSublayouts.push_back(layout); - } - } else if (sublayoutsCount > 0) { - // Fast-reverse-enumerate the sublayouts array by copying it into a C-array and push_front'ing each into the queue. - unowned ASLayout *rawSublayouts[sublayoutsCount]; - [layout->_sublayouts getObjects:rawSublayouts range:NSMakeRange(0, sublayoutsCount)]; - for (NSInteger i = sublayoutsCount - 1; i >= 0; i--) { - queue.push_front({rawSublayouts[i], absolutePosition + rawSublayouts[i].position}); - } - } - } - - NSArray *array = [NSArray arrayByTransferring:flattenedSublayouts.data() count:flattenedSublayouts.size()]; - // flattenedSublayouts is now all nils. - - ASLayout *layout = [ASLayout layoutWithLayoutElement:_layoutElement size:_size sublayouts:array]; - // All flattened layouts must retain sublayout elements until they are applied. - [layout retainSublayoutElements]; - return layout; -} - -#pragma mark - Equality Checking - -- (BOOL)isEqual:(id)object -{ - if (self == object) return YES; - - ASLayout *layout = ASDynamicCast(object, ASLayout); - if (layout == nil) { - return NO; - } - - if (!CGSizeEqualToSize(_size, layout.size)) return NO; - - if (!((ASPointIsNull(self.position) && ASPointIsNull(layout.position)) - || CGPointEqualToPoint(self.position, layout.position))) return NO; - if (_layoutElement != layout.layoutElement) return NO; - - if (!ASObjectIsEqual(_sublayouts, layout.sublayouts)) { - return NO; - } - - return YES; -} - -#pragma mark - Accessors - -- (ASLayoutElementType)type -{ - return _layoutElementType; -} - -- (CGRect)frameForElement:(id)layoutElement -{ - for (ASLayout *l in _sublayouts) { - if (l->_layoutElement == layoutElement) { - return l.frame; - } - } - return CGRectNull; -} - -- (CGRect)frame -{ - CGRect subnodeFrame = CGRectZero; - CGPoint adjustedOrigin = _position; - if (isfinite(adjustedOrigin.x) == NO) { - ASDisplayNodeAssert(0, @"Layout has an invalid position"); - adjustedOrigin.x = 0; - } - if (isfinite(adjustedOrigin.y) == NO) { - ASDisplayNodeAssert(0, @"Layout has an invalid position"); - adjustedOrigin.y = 0; - } - subnodeFrame.origin = adjustedOrigin; - - CGSize adjustedSize = _size; - if (isfinite(adjustedSize.width) == NO) { - ASDisplayNodeAssert(0, @"Layout has an invalid size"); - adjustedSize.width = 0; - } - if (isfinite(adjustedSize.height) == NO) { - ASDisplayNodeAssert(0, @"Layout has an invalid position"); - adjustedSize.height = 0; - } - subnodeFrame.size = adjustedSize; - - return subnodeFrame; -} - -#pragma mark - Description - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"size" : [NSValue valueWithCGSize:self.size] }]; - - if (id layoutElement = self.layoutElement) { - [result addObject:@{ @"layoutElement" : layoutElement }]; - } - - const auto pos = self.position; - if (!ASPointIsNull(pos)) { - [result addObject:@{ @"position" : [NSValue valueWithCGPoint:pos] }]; - } - return result; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSString *)recursiveDescription -{ - return [self _recursiveDescriptionForLayout:self level:0]; -} - -- (NSString *)_recursiveDescriptionForLayout:(ASLayout *)layout level:(NSUInteger)level -{ - NSMutableString *description = [NSMutableString string]; - [description appendString:descriptionIndents(level)]; - [description appendString:[layout description]]; - for (ASLayout *sublayout in layout.sublayouts) { - [description appendString:@"\n"]; - [description appendString:[self _recursiveDescriptionForLayout:sublayout level:level + 1]]; - } - return description; -} - -@end - -ASLayout *ASCalculateLayout(id layoutElement, const ASSizeRange sizeRange, const CGSize parentSize) -{ - NSCParameterAssert(layoutElement != nil); - - return [layoutElement layoutThatFits:sizeRange parentSize:parentSize]; -} - -ASLayout *ASCalculateRootLayout(id rootLayoutElement, const ASSizeRange sizeRange) -{ - ASLayout *layout = ASCalculateLayout(rootLayoutElement, sizeRange, sizeRange.max); - // Here could specific verfication happen - return layout; -} diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutElement.h b/Example/Pods/Texture/Source/Layout/ASLayoutElement.h deleted file mode 100644 index 000f9655..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutElement.h +++ /dev/null @@ -1,306 +0,0 @@ -// -// ASLayoutElement.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import -#import - -@class ASLayout; -@class ASLayoutSpec; -@protocol ASLayoutElementStylability; - -@protocol ASTraitEnvironment; - -NS_ASSUME_NONNULL_BEGIN - -/** A constant that indicates that the parent's size is not yet determined in a given dimension. */ -ASDK_EXTERN CGFloat const ASLayoutElementParentDimensionUndefined; - -/** A constant that indicates that the parent's size is not yet determined in either dimension. */ -ASDK_EXTERN CGSize const ASLayoutElementParentSizeUndefined; - -/** Type of ASLayoutElement */ -typedef NS_ENUM(unsigned char, ASLayoutElementType) { - ASLayoutElementTypeLayoutSpec, - ASLayoutElementTypeDisplayNode -}; - -#pragma mark - ASLayoutElement - -/** - * The ASLayoutElement protocol declares a method for measuring the layout of an object. A layout - * is defined by an ASLayout return value, and must specify 1) the size (but not position) of the - * layoutElement object, and 2) the size and position of all of its immediate child objects. The tree - * recursion is driven by parents requesting layouts from their children in order to determine their - * size, followed by the parents setting the position of the children once the size is known - * - * The protocol also implements a "family" of LayoutElement protocols. These protocols contain layout - * options that can be used for specific layout specs. For example, ASStackLayoutSpec has options - * defining how a layoutElement should shrink or grow based upon available space. - * - * These layout options are all stored in an ASLayoutOptions class (that is defined in ASLayoutElementPrivate). - * Generally you needn't worry about the layout options class, as the layoutElement protocols allow all direct - * access to the options via convenience properties. If you are creating custom layout spec, then you can - * extend the backing layout options class to accommodate any new layout options. - */ -@protocol ASLayoutElement - -#pragma mark - Getter - -/** - * @abstract Returns type of layoutElement - */ -@property (nonatomic, readonly) ASLayoutElementType layoutElementType; - -/** - * @abstract A size constraint that should apply to this ASLayoutElement. - */ -@property (nonatomic, readonly) ASLayoutElementStyle *style; - -/** - * @abstract Returns all children of an object which class conforms to the ASLayoutElement protocol - */ -- (nullable NSArray> *)sublayoutElements; - -#pragma mark - Calculate layout - -/** - * @abstract Asks the node to return a layout based on given size range. - * - * @param constrainedSize The minimum and maximum sizes the receiver should fit in. - * - * @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used). - * - * @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the - * constraint and the result. - * - * @warning Subclasses must not override this; it caches results from -calculateLayoutThatFits:. Calling this method may - * be expensive if result is not cached. - * - * @see [ASDisplayNode(Subclassing) calculateLayoutThatFits:] - */ -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize; - -/** - * Call this on children layoutElements to compute their layouts within your implementation of -calculateLayoutThatFits:. - * - * @warning You may not override this method. Override -calculateLayoutThatFits: instead. - * @warning In almost all cases, prefer the use of ASCalculateLayout in ASLayout - * - * @param constrainedSize Specifies a minimum and maximum size. The receiver must choose a size that is in this range. - * @param parentSize The parent node's size. If the parent component does not have a final size in a given dimension, - * then it should be passed as ASLayoutElementParentDimensionUndefined (for example, if the parent's width - * depends on the child's size). - * - * @discussion Though this method does not set the bounds of the view, it does have side effects--caching both the - * constraint and the result. - * - * @return An ASLayout instance defining the layout of the receiver (and its children, if the box layout model is used). - */ -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize; - -/** - * Override this method to compute your layoutElement's layout. - * - * @discussion Why do you need to override -calculateLayoutThatFits: instead of -layoutThatFits:parentSize:? - * The base implementation of -layoutThatFits:parentSize: does the following for you: - * 1. First, it uses the parentSize parameter to resolve the nodes's size (the one assigned to the size property). - * 2. Then, it intersects the resolved size with the constrainedSize parameter. If the two don't intersect, - * constrainedSize wins. This allows a component to always override its children's sizes when computing its layout. - * (The analogy for UIView: you might return a certain size from -sizeThatFits:, but a parent view can always override - * that size and set your frame to any size.) - * 3. It caches it result for reuse - * - * @param constrainedSize A min and max size. This is computed as described in the description. The ASLayout you - * return MUST have a size between these two sizes. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize; - -/** - * In certain advanced cases, you may want to override this method. Overriding this method allows you to receive the - * layoutElement's size, parentSize, and constrained size. With these values you could calculate the final constrained size - * and call -calculateLayoutThatFits: with the result. - * - * @warning Overriding this method should be done VERY rarely. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize; - -- (BOOL)implementsLayoutMethod; - -@end - -#pragma mark - ASLayoutElementStyle - -ASDK_EXTERN NSString * const ASLayoutElementStyleWidthProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleMinWidthProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleMaxWidthProperty; - -ASDK_EXTERN NSString * const ASLayoutElementStyleHeightProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleMinHeightProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleMaxHeightProperty; - -ASDK_EXTERN NSString * const ASLayoutElementStyleSpacingBeforeProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleSpacingAfterProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleFlexGrowProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleFlexShrinkProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleFlexBasisProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleAlignSelfProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleAscenderProperty; -ASDK_EXTERN NSString * const ASLayoutElementStyleDescenderProperty; - -ASDK_EXTERN NSString * const ASLayoutElementStyleLayoutPositionProperty; - -@protocol ASLayoutElementStyleDelegate -- (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName; -@end - -@interface ASLayoutElementStyle : NSObject - -/** - * @abstract Initializes the layoutElement style with a specified delegate - */ -- (instancetype)initWithDelegate:(id)delegate; - -/** - * @abstract The object that acts as the delegate of the style. - * - * @discussion The delegate must adopt the ASLayoutElementStyleDelegate protocol. The delegate is not retained. - */ -@property (nullable, nonatomic, weak, readonly) id delegate; - - -#pragma mark - Sizing - -/** - * @abstract The width property specifies the width of the content area of an ASLayoutElement. - * The minWidth and maxWidth properties override width. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension width; - -/** - * @abstract The height property specifies the height of the content area of an ASLayoutElement - * The minHeight and maxHeight properties override height. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension height; - -/** - * @abstract The minHeight property is used to set the minimum height of a given element. It prevents the used value - * of the height property from becoming smaller than the value specified for minHeight. - * The value of minHeight overrides both maxHeight and height. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension minHeight; - -/** - * @abstract The maxHeight property is used to set the maximum height of an element. It prevents the used value of the - * height property from becoming larger than the value specified for maxHeight. - * The value of maxHeight overrides height, but minHeight overrides maxHeight. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension maxHeight; - -/** - * @abstract The minWidth property is used to set the minimum width of a given element. It prevents the used value of - * the width property from becoming smaller than the value specified for minWidth. - * The value of minWidth overrides both maxWidth and width. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension minWidth; - -/** - * @abstract The maxWidth property is used to set the maximum width of a given element. It prevents the used value of - * the width property from becoming larger than the value specified for maxWidth. - * The value of maxWidth overrides width, but minWidth overrides maxWidth. - * Defaults to ASDimensionAuto - */ -@property (nonatomic) ASDimension maxWidth; - -#pragma mark - ASLayoutElementStyleSizeHelpers - -/** - * @abstract Provides a suggested size for a layout element. If the optional minSize or maxSize are provided, - * and the preferredSize exceeds these, the minSize or maxSize will be enforced. If this optional value is not - * provided, the layout element’s size will default to it’s intrinsic content size provided calculateSizeThatFits: - * - * @discussion This method is optional, but one of either preferredSize or preferredLayoutSize is required - * for nodes that either have no intrinsic content size or - * should be laid out at a different size than its intrinsic content size. For example, this property could be - * set on an ASImageNode to display at a size different from the underlying image size. - * - * @warning Calling the getter when the size's width or height are relative will cause an assert. - */ -@property (nonatomic) CGSize preferredSize; - - /** - * @abstract An optional property that provides a minimum size bound for a layout element. If provided, this restriction will - * always be enforced. If a parent layout element’s minimum size is smaller than its child’s minimum size, the child’s - * minimum size will be enforced and its size will extend out of the layout spec’s. - * - * @discussion For example, if you set a preferred relative width of 50% and a minimum width of 200 points on an - * element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, - * since 160 pts is lower than the minimum width of 200 pts, the minimum width would be used. - */ -@property (nonatomic) CGSize minSize; -- (CGSize)minSize UNAVAILABLE_ATTRIBUTE; - -/** - * @abstract An optional property that provides a maximum size bound for a layout element. If provided, this restriction will - * always be enforced. If a child layout element’s maximum size is smaller than its parent, the child’s maximum size will - * be enforced and its size will extend out of the layout spec’s. - * - * @discussion For example, if you set a preferred relative width of 50% and a maximum width of 120 points on an - * element in a full screen container, this would result in a width of 160 points on an iPhone screen. However, - * since 160 pts is higher than the maximum width of 120 pts, the maximum width would be used. - */ -@property (nonatomic) CGSize maxSize; -- (CGSize)maxSize UNAVAILABLE_ATTRIBUTE; - -/** - * @abstract Provides a suggested RELATIVE size for a layout element. An ASLayoutSize uses percentages rather - * than points to specify layout. E.g. width should be 50% of the parent’s width. If the optional minLayoutSize or - * maxLayoutSize are provided, and the preferredLayoutSize exceeds these, the minLayoutSize or maxLayoutSize - * will be enforced. If this optional value is not provided, the layout element’s size will default to its intrinsic content size - * provided calculateSizeThatFits: - */ -@property (nonatomic) ASLayoutSize preferredLayoutSize; - -/** - * @abstract An optional property that provides a minimum RELATIVE size bound for a layout element. If provided, this - * restriction will always be enforced. If a parent layout element’s minimum relative size is smaller than its child’s minimum - * relative size, the child’s minimum relative size will be enforced and its size will extend out of the layout spec’s. - */ -@property (nonatomic) ASLayoutSize minLayoutSize; - -/** - * @abstract An optional property that provides a maximum RELATIVE size bound for a layout element. If provided, this - * restriction will always be enforced. If a parent layout element’s maximum relative size is smaller than its child’s maximum - * relative size, the child’s maximum relative size will be enforced and its size will extend out of the layout spec’s. - */ -@property (nonatomic) ASLayoutSize maxLayoutSize; - -@end - -#pragma mark - ASLayoutElementStylability - -@protocol ASLayoutElementStylability - -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutElement.mm b/Example/Pods/Texture/Source/Layout/ASLayoutElement.mm deleted file mode 100644 index 38d50d6c..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutElement.mm +++ /dev/null @@ -1,884 +0,0 @@ -// -// ASLayoutElement.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -using AS::MutexLocker; - -#if YOGA - #import YOGA_HEADER_PATH - #import -#endif - -#pragma mark - ASLayoutElementContext - -@implementation ASLayoutElementContext - -- (instancetype)init -{ - if (self = [super init]) { - _transitionID = ASLayoutElementContextDefaultTransitionID; - } - return self; -} - -@end - -CGFloat const ASLayoutElementParentDimensionUndefined = NAN; -CGSize const ASLayoutElementParentSizeUndefined = {ASLayoutElementParentDimensionUndefined, ASLayoutElementParentDimensionUndefined}; - -int32_t const ASLayoutElementContextInvalidTransitionID = 0; -int32_t const ASLayoutElementContextDefaultTransitionID = ASLayoutElementContextInvalidTransitionID + 1; - -#if AS_TLS_AVAILABLE - -static _Thread_local unowned ASLayoutElementContext *tls_context; - -void ASLayoutElementPushContext(ASLayoutElementContext *context) -{ - // NOTE: It would be easy to support nested contexts – just use an NSMutableArray here. - ASDisplayNodeCAssertNil(tls_context, @"Nested ASLayoutElementContexts aren't supported."); - - tls_context = (__bridge ASLayoutElementContext *)(__bridge_retained CFTypeRef)context; -} - -ASLayoutElementContext *ASLayoutElementGetCurrentContext() -{ - // Don't retain here. Caller will retain if it wants to! - return tls_context; -} - -void ASLayoutElementPopContext() -{ - ASDisplayNodeCAssertNotNil(tls_context, @"Attempt to pop context when there wasn't a context!"); - CFRelease((__bridge CFTypeRef)tls_context); - tls_context = nil; -} - -#else - -static pthread_key_t ASLayoutElementContextKey() { - static pthread_key_t k; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - pthread_key_create(&k, NULL); - }); - return k; -} -void ASLayoutElementPushContext(ASLayoutElementContext *context) -{ - // NOTE: It would be easy to support nested contexts – just use an NSMutableArray here. - ASDisplayNodeCAssertNil(pthread_getspecific(ASLayoutElementContextKey()), @"Nested ASLayoutElementContexts aren't supported."); - - const auto cfCtx = (__bridge_retained CFTypeRef)context; - pthread_setspecific(ASLayoutElementContextKey(), cfCtx); -} - -ASLayoutElementContext *ASLayoutElementGetCurrentContext() -{ - // Don't retain here. Caller will retain if it wants to! - const auto ctxPtr = pthread_getspecific(ASLayoutElementContextKey()); - return (__bridge ASLayoutElementContext *)ctxPtr; -} - -void ASLayoutElementPopContext() -{ - const auto ctx = (CFTypeRef)pthread_getspecific(ASLayoutElementContextKey()); - ASDisplayNodeCAssertNotNil(ctx, @"Attempt to pop context when there wasn't a context!"); - CFRelease(ctx); - pthread_setspecific(ASLayoutElementContextKey(), NULL); -} - -#endif // AS_TLS_AVAILABLE - -#pragma mark - ASLayoutElementStyle - -NSString * const ASLayoutElementStyleWidthProperty = @"ASLayoutElementStyleWidthProperty"; -NSString * const ASLayoutElementStyleMinWidthProperty = @"ASLayoutElementStyleMinWidthProperty"; -NSString * const ASLayoutElementStyleMaxWidthProperty = @"ASLayoutElementStyleMaxWidthProperty"; - -NSString * const ASLayoutElementStyleHeightProperty = @"ASLayoutElementStyleHeightProperty"; -NSString * const ASLayoutElementStyleMinHeightProperty = @"ASLayoutElementStyleMinHeightProperty"; -NSString * const ASLayoutElementStyleMaxHeightProperty = @"ASLayoutElementStyleMaxHeightProperty"; - -NSString * const ASLayoutElementStyleSpacingBeforeProperty = @"ASLayoutElementStyleSpacingBeforeProperty"; -NSString * const ASLayoutElementStyleSpacingAfterProperty = @"ASLayoutElementStyleSpacingAfterProperty"; -NSString * const ASLayoutElementStyleFlexGrowProperty = @"ASLayoutElementStyleFlexGrowProperty"; -NSString * const ASLayoutElementStyleFlexShrinkProperty = @"ASLayoutElementStyleFlexShrinkProperty"; -NSString * const ASLayoutElementStyleFlexBasisProperty = @"ASLayoutElementStyleFlexBasisProperty"; -NSString * const ASLayoutElementStyleAlignSelfProperty = @"ASLayoutElementStyleAlignSelfProperty"; -NSString * const ASLayoutElementStyleAscenderProperty = @"ASLayoutElementStyleAscenderProperty"; -NSString * const ASLayoutElementStyleDescenderProperty = @"ASLayoutElementStyleDescenderProperty"; - -NSString * const ASLayoutElementStyleLayoutPositionProperty = @"ASLayoutElementStyleLayoutPositionProperty"; - -#if YOGA -NSString * const ASYogaFlexWrapProperty = @"ASLayoutElementStyleLayoutFlexWrapProperty"; -NSString * const ASYogaFlexDirectionProperty = @"ASYogaFlexDirectionProperty"; -NSString * const ASYogaDirectionProperty = @"ASYogaDirectionProperty"; -NSString * const ASYogaSpacingProperty = @"ASYogaSpacingProperty"; -NSString * const ASYogaJustifyContentProperty = @"ASYogaJustifyContentProperty"; -NSString * const ASYogaAlignItemsProperty = @"ASYogaAlignItemsProperty"; -NSString * const ASYogaPositionTypeProperty = @"ASYogaPositionTypeProperty"; -NSString * const ASYogaPositionProperty = @"ASYogaPositionProperty"; -NSString * const ASYogaMarginProperty = @"ASYogaMarginProperty"; -NSString * const ASYogaPaddingProperty = @"ASYogaPaddingProperty"; -NSString * const ASYogaBorderProperty = @"ASYogaBorderProperty"; -NSString * const ASYogaAspectRatioProperty = @"ASYogaAspectRatioProperty"; -#endif - -#define ASLayoutElementStyleSetSizeWithScope(x) \ - ({ \ - __instanceLock__.lock(); \ - const ASLayoutElementSize oldSize = _size.load(); \ - ASLayoutElementSize newSize = oldSize; \ - {x}; \ - BOOL changed = !ASLayoutElementSizeEqualToLayoutElementSize(oldSize, newSize); \ - if (changed) { \ - _size.store(newSize); \ - } \ - __instanceLock__.unlock(); \ - changed; \ - }) - -#define ASLayoutElementStyleCallDelegate(propertyName)\ -do {\ - [self propertyDidChange:propertyName];\ - [_delegate style:self propertyDidChange:propertyName];\ -} while(0) - -@implementation ASLayoutElementStyle { - AS::RecursiveMutex __instanceLock__; - ASLayoutElementStyleExtensions _extensions; - - std::atomic _size; - std::atomic _spacingBefore; - std::atomic _spacingAfter; - std::atomic _flexGrow; - std::atomic _flexShrink; - std::atomic _flexBasis; - std::atomic _alignSelf; - std::atomic _ascender; - std::atomic _descender; - std::atomic _layoutPosition; - -#if YOGA - YGNodeRef _yogaNode; - std::atomic _flexWrap; - std::atomic _flexDirection; - std::atomic _direction; - std::atomic _justifyContent; - std::atomic _alignItems; - std::atomic _positionType; - std::atomic _position; - std::atomic _margin; - std::atomic _padding; - std::atomic _border; - std::atomic _aspectRatio; - ASStackLayoutAlignItems _parentAlignStyle; -#endif -} - -@dynamic width, height, minWidth, maxWidth, minHeight, maxHeight; -@dynamic preferredSize, minSize, maxSize, preferredLayoutSize, minLayoutSize, maxLayoutSize; - -#pragma mark - Lifecycle - -- (instancetype)initWithDelegate:(id)delegate -{ - self = [self init]; - if (self) { - _delegate = delegate; - } - return self; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - std::atomic_init(&_size, ASLayoutElementSizeMake()); - std::atomic_init(&_flexBasis, ASDimensionAuto); -#if YOGA - _parentAlignStyle = ASStackLayoutAlignItemsNotSet; - std::atomic_init(&_flexDirection, ASStackLayoutDirectionVertical); - std::atomic_init(&_alignItems, ASStackLayoutAlignItemsStretch); - std::atomic_init(&_aspectRatio, static_cast(YGUndefined)); -#endif - } - return self; -} - -ASSynthesizeLockingMethodsWithMutex(__instanceLock__) - -#pragma mark - ASLayoutElementStyleSize - -- (ASLayoutElementSize)size -{ - return _size.load(); -} - -- (void)setSize:(ASLayoutElementSize)size -{ - ASLayoutElementStyleSetSizeWithScope({ - newSize = size; - }); - // No CallDelegate method as ASLayoutElementSize is currently internal. -} - -#pragma mark - ASLayoutElementStyleSizeForwarding - -- (ASDimension)width -{ - return _size.load().width; -} - -- (void)setWidth:(ASDimension)width -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.width = width; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty); - } -} - -- (ASDimension)height -{ - return _size.load().height; -} - -- (void)setHeight:(ASDimension)height -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.height = height; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty); - } -} - -- (ASDimension)minWidth -{ - return _size.load().minWidth; -} - -- (void)setMinWidth:(ASDimension)minWidth -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.minWidth = minWidth; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty); - } -} - -- (ASDimension)maxWidth -{ - return _size.load().maxWidth; -} - -- (void)setMaxWidth:(ASDimension)maxWidth -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.maxWidth = maxWidth; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty); - } -} - -- (ASDimension)minHeight -{ - return _size.load().minHeight; -} - -- (void)setMinHeight:(ASDimension)minHeight -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.minHeight = minHeight; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty); - } -} - -- (ASDimension)maxHeight -{ - return _size.load().maxHeight; -} - -- (void)setMaxHeight:(ASDimension)maxHeight -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.maxHeight = maxHeight; }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty); - } -} - - -#pragma mark - ASLayoutElementStyleSizeHelpers - -- (void)setPreferredSize:(CGSize)preferredSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.width = ASDimensionMakeWithPoints(preferredSize.width); - newSize.height = ASDimensionMakeWithPoints(preferredSize.height); - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty); - } -} - -- (CGSize)preferredSize -{ - ASLayoutElementSize size = _size.load(); - if (size.width.unit == ASDimensionUnitFraction) { - NSCAssert(NO, @"Cannot get preferredSize of element with fractional width. Width: %@.", NSStringFromASDimension(size.width)); - return CGSizeZero; - } - - if (size.height.unit == ASDimensionUnitFraction) { - NSCAssert(NO, @"Cannot get preferredSize of element with fractional height. Height: %@.", NSStringFromASDimension(size.height)); - return CGSizeZero; - } - - return CGSizeMake(size.width.value, size.height.value); -} - -- (void)setMinSize:(CGSize)minSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.minWidth = ASDimensionMakeWithPoints(minSize.width); - newSize.minHeight = ASDimensionMakeWithPoints(minSize.height); - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty); - } -} - -- (void)setMaxSize:(CGSize)maxSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.maxWidth = ASDimensionMakeWithPoints(maxSize.width); - newSize.maxHeight = ASDimensionMakeWithPoints(maxSize.height); - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty); - } -} - -- (ASLayoutSize)preferredLayoutSize -{ - ASLayoutElementSize size = _size.load(); - return ASLayoutSizeMake(size.width, size.height); -} - -- (void)setPreferredLayoutSize:(ASLayoutSize)preferredLayoutSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.width = preferredLayoutSize.width; - newSize.height = preferredLayoutSize.height; - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty); - } -} - -- (ASLayoutSize)minLayoutSize -{ - ASLayoutElementSize size = _size.load(); - return ASLayoutSizeMake(size.minWidth, size.minHeight); -} - -- (void)setMinLayoutSize:(ASLayoutSize)minLayoutSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.minWidth = minLayoutSize.width; - newSize.minHeight = minLayoutSize.height; - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty); - } -} - -- (ASLayoutSize)maxLayoutSize -{ - ASLayoutElementSize size = _size.load(); - return ASLayoutSizeMake(size.maxWidth, size.maxHeight); -} - -- (void)setMaxLayoutSize:(ASLayoutSize)maxLayoutSize -{ - BOOL changed = ASLayoutElementStyleSetSizeWithScope({ - newSize.maxWidth = maxLayoutSize.width; - newSize.maxHeight = maxLayoutSize.height; - }); - if (changed) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty); - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty); - } -} - -#pragma mark - ASStackLayoutElement - -- (void)setSpacingBefore:(CGFloat)spacingBefore -{ - if (_spacingBefore.exchange(spacingBefore) != spacingBefore) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingBeforeProperty); - } -} - -- (CGFloat)spacingBefore -{ - return _spacingBefore.load(); -} - -- (void)setSpacingAfter:(CGFloat)spacingAfter -{ - if (_spacingAfter.exchange(spacingAfter) != spacingAfter) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingAfterProperty); - } -} - -- (CGFloat)spacingAfter -{ - return _spacingAfter.load(); -} - -- (void)setFlexGrow:(CGFloat)flexGrow -{ - if (_flexGrow.exchange(flexGrow) != flexGrow) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexGrowProperty); - } -} - -- (CGFloat)flexGrow -{ - return _flexGrow.load(); -} - -- (void)setFlexShrink:(CGFloat)flexShrink -{ - if (_flexShrink.exchange(flexShrink) != flexShrink) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexShrinkProperty); - } -} - -- (CGFloat)flexShrink -{ - return _flexShrink.load(); -} - -- (void)setFlexBasis:(ASDimension)flexBasis -{ - if (!ASDimensionEqualToDimension(_flexBasis.exchange(flexBasis), flexBasis)) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexBasisProperty); - } -} - -- (ASDimension)flexBasis -{ - return _flexBasis.load(); -} - -- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf -{ - if (_alignSelf.exchange(alignSelf) != alignSelf) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAlignSelfProperty); - } -} - -- (ASStackLayoutAlignSelf)alignSelf -{ - return _alignSelf.load(); -} - -- (void)setAscender:(CGFloat)ascender -{ - if (_ascender.exchange(ascender) != ascender) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAscenderProperty); - } -} - -- (CGFloat)ascender -{ - return _ascender.load(); -} - -- (void)setDescender:(CGFloat)descender -{ - if (_descender.exchange(descender) != descender) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleDescenderProperty); - } -} - -- (CGFloat)descender -{ - return _descender.load(); -} - -#pragma mark - ASAbsoluteLayoutElement - -- (void)setLayoutPosition:(CGPoint)layoutPosition -{ - if (!CGPointEqualToPoint(_layoutPosition.exchange(layoutPosition), layoutPosition)) { - ASLayoutElementStyleCallDelegate(ASLayoutElementStyleLayoutPositionProperty); - } -} - -- (CGPoint)layoutPosition -{ - return _layoutPosition.load(); -} - -#pragma mark - Extensions - -- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx -{ - NSCAssert(idx < kMaxLayoutElementBoolExtensions, @"Setting index outside of max bool extensions space"); - - MutexLocker l(__instanceLock__); - _extensions.boolExtensions[idx] = value; -} - -- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx\ -{ - NSCAssert(idx < kMaxLayoutElementBoolExtensions, @"Accessing index outside of max bool extensions space"); - - MutexLocker l(__instanceLock__); - return _extensions.boolExtensions[idx]; -} - -- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx -{ - NSCAssert(idx < kMaxLayoutElementStateIntegerExtensions, @"Setting index outside of max integer extensions space"); - - MutexLocker l(__instanceLock__); - _extensions.integerExtensions[idx] = value; -} - -- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx -{ - NSCAssert(idx < kMaxLayoutElementStateIntegerExtensions, @"Accessing index outside of max integer extensions space"); - - MutexLocker l(__instanceLock__); - return _extensions.integerExtensions[idx]; -} - -- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx -{ - NSCAssert(idx < kMaxLayoutElementStateEdgeInsetExtensions, @"Setting index outside of max edge insets extensions space"); - - MutexLocker l(__instanceLock__); - _extensions.edgeInsetsExtensions[idx] = value; -} - -- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx -{ - NSCAssert(idx < kMaxLayoutElementStateEdgeInsetExtensions, @"Accessing index outside of max edge insets extensions space"); - - MutexLocker l(__instanceLock__); - return _extensions.edgeInsetsExtensions[idx]; -} - -#pragma mark - Debugging - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - - if ((self.minLayoutSize.width.unit != ASDimensionUnitAuto || - self.minLayoutSize.height.unit != ASDimensionUnitAuto)) { - [result addObject:@{ @"minLayoutSize" : NSStringFromASLayoutSize(self.minLayoutSize) }]; - } - - if ((self.preferredLayoutSize.width.unit != ASDimensionUnitAuto || - self.preferredLayoutSize.height.unit != ASDimensionUnitAuto)) { - [result addObject:@{ @"preferredSize" : NSStringFromASLayoutSize(self.preferredLayoutSize) }]; - } - - if ((self.maxLayoutSize.width.unit != ASDimensionUnitAuto || - self.maxLayoutSize.height.unit != ASDimensionUnitAuto)) { - [result addObject:@{ @"maxLayoutSize" : NSStringFromASLayoutSize(self.maxLayoutSize) }]; - } - - if (self.alignSelf != ASStackLayoutAlignSelfAuto) { - [result addObject:@{ @"alignSelf" : [@[@"ASStackLayoutAlignSelfAuto", - @"ASStackLayoutAlignSelfStart", - @"ASStackLayoutAlignSelfEnd", - @"ASStackLayoutAlignSelfCenter", - @"ASStackLayoutAlignSelfStretch"] objectAtIndex:self.alignSelf] }]; - } - - if (self.ascender != 0) { - [result addObject:@{ @"ascender" : @(self.ascender) }]; - } - - if (self.descender != 0) { - [result addObject:@{ @"descender" : @(self.descender) }]; - } - - if (ASDimensionEqualToDimension(self.flexBasis, ASDimensionAuto) == NO) { - [result addObject:@{ @"flexBasis" : NSStringFromASDimension(self.flexBasis) }]; - } - - if (self.flexGrow != 0) { - [result addObject:@{ @"flexGrow" : @(self.flexGrow) }]; - } - - if (self.flexShrink != 0) { - [result addObject:@{ @"flexShrink" : @(self.flexShrink) }]; - } - - if (self.spacingAfter != 0) { - [result addObject:@{ @"spacingAfter" : @(self.spacingAfter) }]; - } - - if (self.spacingBefore != 0) { - [result addObject:@{ @"spacingBefore" : @(self.spacingBefore) }]; - } - - if (CGPointEqualToPoint(self.layoutPosition, CGPointZero) == NO) { - [result addObject:@{ @"layoutPosition" : [NSValue valueWithCGPoint:self.layoutPosition] }]; - } - - return result; -} - -- (void)propertyDidChange:(NSString *)propertyName -{ -#if YOGA - /* TODO(appleguy): STYLE SETTER METHODS LEFT TO IMPLEMENT - void YGNodeStyleSetOverflow(YGNodeRef node, YGOverflow overflow); - void YGNodeStyleSetFlex(YGNodeRef node, float flex); - */ - - if (_yogaNode == NULL) { - return; - } - // Because the NSStrings used to identify each property are const, use efficient pointer comparison. - if (propertyName == ASLayoutElementStyleWidthProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, Width, self.width); - } - else if (propertyName == ASLayoutElementStyleMinWidthProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, MinWidth, self.minWidth); - } - else if (propertyName == ASLayoutElementStyleMaxWidthProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, MaxWidth, self.maxWidth); - } - else if (propertyName == ASLayoutElementStyleHeightProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, Height, self.height); - } - else if (propertyName == ASLayoutElementStyleMinHeightProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, MinHeight, self.minHeight); - } - else if (propertyName == ASLayoutElementStyleMaxHeightProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, MaxHeight, self.maxHeight); - } - else if (propertyName == ASLayoutElementStyleFlexGrowProperty) { - YGNodeStyleSetFlexGrow(_yogaNode, self.flexGrow); - } - else if (propertyName == ASLayoutElementStyleFlexShrinkProperty) { - YGNodeStyleSetFlexShrink(_yogaNode, self.flexShrink); - } - else if (propertyName == ASLayoutElementStyleFlexBasisProperty) { - YGNODE_STYLE_SET_DIMENSION(_yogaNode, FlexBasis, self.flexBasis); - } - else if (propertyName == ASLayoutElementStyleAlignSelfProperty) { - YGNodeStyleSetAlignSelf(_yogaNode, yogaAlignSelf(self.alignSelf)); - } - else if (propertyName == ASYogaFlexWrapProperty) { - YGNodeStyleSetFlexWrap(_yogaNode, self.flexWrap); - } - else if (propertyName == ASYogaFlexDirectionProperty) { - YGNodeStyleSetFlexDirection(_yogaNode, yogaFlexDirection(self.flexDirection)); - } - else if (propertyName == ASYogaDirectionProperty) { - YGNodeStyleSetDirection(_yogaNode, self.direction); - } - else if (propertyName == ASYogaJustifyContentProperty) { - YGNodeStyleSetJustifyContent(_yogaNode, yogaJustifyContent(self.justifyContent)); - } - else if (propertyName == ASYogaAlignItemsProperty) { - ASStackLayoutAlignItems alignItems = self.alignItems; - if (alignItems != ASStackLayoutAlignItemsNotSet) { - YGNodeStyleSetAlignItems(_yogaNode, yogaAlignItems(alignItems)); - } - } - else if (propertyName == ASYogaPositionTypeProperty) { - YGNodeStyleSetPositionType(_yogaNode, self.positionType); - } - else if (propertyName == ASYogaPositionProperty) { - ASEdgeInsets position = self.position; - YGEdge edge = YGEdgeLeft; - for (int i = 0; i < YGEdgeAll + 1; ++i) { - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(_yogaNode, Position, dimensionForEdgeWithEdgeInsets(edge, position), edge); - edge = (YGEdge)(edge + 1); - } - } - else if (propertyName == ASYogaMarginProperty) { - ASEdgeInsets margin = self.margin; - YGEdge edge = YGEdgeLeft; - for (int i = 0; i < YGEdgeAll + 1; ++i) { - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(_yogaNode, Margin, dimensionForEdgeWithEdgeInsets(edge, margin), edge); - edge = (YGEdge)(edge + 1); - } - } - else if (propertyName == ASYogaPaddingProperty) { - ASEdgeInsets padding = self.padding; - YGEdge edge = YGEdgeLeft; - for (int i = 0; i < YGEdgeAll + 1; ++i) { - YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(_yogaNode, Padding, dimensionForEdgeWithEdgeInsets(edge, padding), edge); - edge = (YGEdge)(edge + 1); - } - } - else if (propertyName == ASYogaBorderProperty) { - ASEdgeInsets border = self.border; - YGEdge edge = YGEdgeLeft; - for (int i = 0; i < YGEdgeAll + 1; ++i) { - YGNODE_STYLE_SET_FLOAT_WITH_EDGE(_yogaNode, Border, dimensionForEdgeWithEdgeInsets(edge, border), edge); - edge = (YGEdge)(edge + 1); - } - } - else if (propertyName == ASYogaAspectRatioProperty) { - CGFloat aspectRatio = self.aspectRatio; - if (aspectRatio > FLT_EPSILON && aspectRatio < CGFLOAT_MAX / 2.0) { - YGNodeStyleSetAspectRatio(_yogaNode, aspectRatio); - } - } -#endif -} - -#pragma mark - Yoga Flexbox Properties - -#if YOGA - -+ (void)initialize -{ - [super initialize]; - YGConfigSetPointScaleFactor(YGConfigGetDefault(), ASScreenScale()); - // Yoga recommends using Web Defaults for all new projects. This will be enabled for Texture very soon. - //YGConfigSetUseWebDefaults(YGConfigGetDefault(), true); -} - -- (YGNodeRef)yogaNode -{ - return _yogaNode; -} - -- (YGNodeRef)yogaNodeCreateIfNeeded -{ - if (_yogaNode == NULL) { - _yogaNode = YGNodeNew(); - } - return _yogaNode; -} - -- (void)destroyYogaNode -{ - if (_yogaNode != NULL) { - // Release the __bridge_retained Context object. - ASLayoutElementYogaUpdateMeasureFunc(_yogaNode, nil); - YGNodeFree(_yogaNode); - _yogaNode = NULL; - } -} - -- (void)dealloc -{ - [self destroyYogaNode]; -} - -- (YGWrap)flexWrap { return _flexWrap.load(); } -- (ASStackLayoutDirection)flexDirection { return _flexDirection.load(); } -- (YGDirection)direction { return _direction.load(); } -- (ASStackLayoutJustifyContent)justifyContent { return _justifyContent.load(); } -- (ASStackLayoutAlignItems)alignItems { return _alignItems.load(); } -- (YGPositionType)positionType { return _positionType.load(); } -- (ASEdgeInsets)position { return _position.load(); } -- (ASEdgeInsets)margin { return _margin.load(); } -- (ASEdgeInsets)padding { return _padding.load(); } -- (ASEdgeInsets)border { return _border.load(); } -- (CGFloat)aspectRatio { return _aspectRatio.load(); } -// private (ASLayoutElementStylePrivate.h) -- (ASStackLayoutAlignItems)parentAlignStyle { - return _parentAlignStyle; -} - -- (void)setFlexWrap:(YGWrap)flexWrap { - if (_flexWrap.exchange(flexWrap) != flexWrap) { - ASLayoutElementStyleCallDelegate(ASYogaFlexWrapProperty); - } -} -- (void)setFlexDirection:(ASStackLayoutDirection)flexDirection { - if (_flexDirection.exchange(flexDirection) != flexDirection) { - ASLayoutElementStyleCallDelegate(ASYogaFlexDirectionProperty); - } -} -- (void)setDirection:(YGDirection)direction { - if (_direction.exchange(direction) != direction) { - ASLayoutElementStyleCallDelegate(ASYogaDirectionProperty); - } -} -- (void)setJustifyContent:(ASStackLayoutJustifyContent)justify { - if (_justifyContent.exchange(justify) != justify) { - ASLayoutElementStyleCallDelegate(ASYogaJustifyContentProperty); - } -} -- (void)setAlignItems:(ASStackLayoutAlignItems)alignItems { - if (_alignItems.exchange(alignItems) != alignItems) { - ASLayoutElementStyleCallDelegate(ASYogaAlignItemsProperty); - } -} -- (void)setPositionType:(YGPositionType)positionType { - if (_positionType.exchange(positionType) != positionType) { - ASLayoutElementStyleCallDelegate(ASYogaPositionTypeProperty); - } -} -/// TODO: smart compare ASEdgeInsets instead of memory compare. -- (void)setPosition:(ASEdgeInsets)position { - ASEdgeInsets oldValue = _position.exchange(position); - if (0 != memcmp(&position, &oldValue, sizeof(ASEdgeInsets))) { - ASLayoutElementStyleCallDelegate(ASYogaPositionProperty); - } -} -- (void)setMargin:(ASEdgeInsets)margin { - ASEdgeInsets oldValue = _margin.exchange(margin); - if (0 != memcmp(&margin, &oldValue, sizeof(ASEdgeInsets))) { - ASLayoutElementStyleCallDelegate(ASYogaMarginProperty); - } -} -- (void)setPadding:(ASEdgeInsets)padding { - ASEdgeInsets oldValue = _padding.exchange(padding); - if (0 != memcmp(&padding, &oldValue, sizeof(ASEdgeInsets))) { - ASLayoutElementStyleCallDelegate(ASYogaPaddingProperty); - } -} -- (void)setBorder:(ASEdgeInsets)border { - ASEdgeInsets oldValue = _border.exchange(border); - if (0 != memcmp(&border, &oldValue, sizeof(ASEdgeInsets))) { - ASLayoutElementStyleCallDelegate(ASYogaBorderProperty); - } -} -- (void)setAspectRatio:(CGFloat)aspectRatio { - if (_aspectRatio.exchange(aspectRatio) != aspectRatio) { - ASLayoutElementStyleCallDelegate(ASYogaAspectRatioProperty); - } -} -// private (ASLayoutElementStylePrivate.h) -- (void)setParentAlignStyle:(ASStackLayoutAlignItems)style { - _parentAlignStyle = style; -} - -#endif /* YOGA */ - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutElementExtensibility.h b/Example/Pods/Texture/Source/Layout/ASLayoutElementExtensibility.h deleted file mode 100644 index f46b63e8..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutElementExtensibility.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASLayoutElementExtensibility.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#pragma mark - ASLayoutElementExtensibility - -@protocol ASLayoutElementExtensibility - -// The maximum number of extended values per type are defined in ASEnvironment.h above the ASEnvironmentStateExtensions -// struct definition. If you try to set a value at an index after the maximum it will throw an assertion. - -- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx; -- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx; - -- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx; -- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx; - -- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx; -- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx; - -@end - -#pragma mark - Dynamic Properties - -/** - * Unbox NSNumber based on the type - */ -#define ASDK_UNBOX_NUMBER(NUMBER, PROPERTY_TYPE) \ -const char *objCType = [NUMBER objCType]; \ -if (strcmp(objCType, @encode(BOOL)) == 0) { \ - return (PROPERTY_TYPE)[obj boolValue]; \ -} else if (strcmp(objCType, @encode(int)) == 0) { \ - return (PROPERTY_TYPE)[obj intValue]; \ -} else if (strcmp(objCType, @encode(NSInteger)) == 0) { \ - return (PROPERTY_TYPE)[obj integerValue]; \ -} else if (strcmp(objCType, @encode(NSUInteger)) == 0) { \ - return (PROPERTY_TYPE)[obj unsignedIntegerValue]; \ -} else if (strcmp(objCType, @encode(CGFloat)) == 0) { \ - return (PROPERTY_TYPE)[obj floatValue]; \ -} else { \ - NSAssert(NO, @"Data type not supported"); \ -} \ - -/** - * Define a NSObject property - */ -#define ASDK_STYLE_PROP_OBJ(PROPERTY_TYPE, PROPERTY_NAME, SETTER_NAME) \ -@dynamic PROPERTY_NAME; \ -- (PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - return (PROPERTY_TYPE)objc_getAssociatedObject(self, @selector(PROPERTY_NAME)); \ -} \ -\ -- (void)SETTER_NAME:(PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - objc_setAssociatedObject(self, @selector(PROPERTY_NAME), PROPERTY_NAME, OBJC_ASSOCIATION_RETAIN); \ -} \ - -/** - * Define an primitive property - */ -#define ASDK_STYLE_PROP_PRIM(PROPERTY_TYPE, PROPERTY_NAME, SETTER_NAME, DEFAULT_VALUE) \ -@dynamic PROPERTY_NAME; \ -- (PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - id obj = objc_getAssociatedObject(self, @selector(PROPERTY_NAME)); \ - \ - if (obj != nil) { \ - ASDK_UNBOX_NUMBER(obj, PROPERTY_TYPE); \ - } \ - \ - return DEFAULT_VALUE;\ -} \ -\ -- (void)SETTER_NAME:(PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - objc_setAssociatedObject(self, @selector(PROPERTY_NAME), @(PROPERTY_NAME), OBJC_ASSOCIATION_RETAIN); \ -} \ - -/** - * Define an structure property - */ -#define ASDK_STYLE_PROP_STR(PROPERTY_TYPE, PROPERTY_NAME, SETTER_NAME, DEFAULT_STRUCT) \ -@dynamic PROPERTY_NAME; \ -- (PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - id obj = objc_getAssociatedObject(self, @selector(PROPERTY_NAME)); \ - if (obj == nil) { \ - return DEFAULT_STRUCT; \ - } \ - PROPERTY_TYPE PROPERTY_NAME; [obj getValue:&PROPERTY_NAME]; return PROPERTY_NAME; \ -} \ -\ -- (void)SETTER_NAME:(PROPERTY_TYPE)PROPERTY_NAME \ -{ \ - objc_setAssociatedObject(self, @selector(PROPERTY_NAME), [NSValue value:&PROPERTY_NAME withObjCType:@encode(PROPERTY_TYPE)], OBJC_ASSOCIATION_RETAIN_NONATOMIC);\ -} \ diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutElementPrivate.h b/Example/Pods/Texture/Source/Layout/ASLayoutElementPrivate.h deleted file mode 100644 index bf8c05bf..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutElementPrivate.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASLayoutElementPrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@protocol ASLayoutElement; -@class ASLayoutElementStyle; - -#pragma mark - ASLayoutElementContext - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASLayoutElementContext : NSObject -@property (nonatomic) int32_t transitionID; -@end - -ASDK_EXTERN int32_t const ASLayoutElementContextInvalidTransitionID; - -ASDK_EXTERN int32_t const ASLayoutElementContextDefaultTransitionID; - -// Does not currently support nesting – there must be no current context. -ASDK_EXTERN void ASLayoutElementPushContext(ASLayoutElementContext * context); - -ASDK_EXTERN ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); - -ASDK_EXTERN void ASLayoutElementPopContext(void); - -NS_ASSUME_NONNULL_END - -#pragma mark - ASLayoutElementLayoutDefaults - -#define ASLayoutElementLayoutCalculationDefaults \ -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize\ -{\ - return [self layoutThatFits:constrainedSize parentSize:constrainedSize.max];\ -}\ -\ -- (ASLayout *)layoutThatFits:(ASSizeRange)constrainedSize parentSize:(CGSize)parentSize\ -{\ - return [self calculateLayoutThatFits:constrainedSize restrictedToSize:self.style.size relativeToParentSize:parentSize];\ -}\ -\ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize\ - restrictedToSize:(ASLayoutElementSize)size\ - relativeToParentSize:(CGSize)parentSize\ -{\ - const ASSizeRange resolvedRange = ASSizeRangeIntersect(constrainedSize, ASLayoutElementSizeResolve(self.style.size, parentSize));\ - return [self calculateLayoutThatFits:resolvedRange];\ -}\ - - -#pragma mark - ASLayoutElementExtensibility - -// Provides extension points for elments that comply to ASLayoutElement like ASLayoutSpec to add additional -// properties besides the default one provided in ASLayoutElementStyle - -static const int kMaxLayoutElementBoolExtensions = 1; -static const int kMaxLayoutElementStateIntegerExtensions = 4; -static const int kMaxLayoutElementStateEdgeInsetExtensions = 1; - -typedef struct ASLayoutElementStyleExtensions { - // Values to store extensions - BOOL boolExtensions[kMaxLayoutElementBoolExtensions]; - NSInteger integerExtensions[kMaxLayoutElementStateIntegerExtensions]; - UIEdgeInsets edgeInsetsExtensions[kMaxLayoutElementStateEdgeInsetExtensions]; -} ASLayoutElementStyleExtensions; - -#define ASLayoutElementStyleExtensibilityForwarding \ -- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx\ -{\ - [self.style setLayoutOptionExtensionBool:value atIndex:idx];\ -}\ -\ -- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx\ -{\ - return [self.style layoutOptionExtensionBoolAtIndex:idx];\ -}\ -\ -- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx\ -{\ - [self.style setLayoutOptionExtensionInteger:value atIndex:idx];\ -}\ -\ -- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx\ -{\ - return [self.style layoutOptionExtensionIntegerAtIndex:idx];\ -}\ -\ -- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx\ -{\ - [self.style setLayoutOptionExtensionEdgeInsets:value atIndex:idx];\ -}\ -\ -- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx\ -{\ - return [self.style layoutOptionExtensionEdgeInsetsAtIndex:idx];\ -}\ - diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.h b/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.h deleted file mode 100644 index 34bf6e06..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// ASLayoutSpec+Subclasses.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASLayoutElement; - -@interface ASLayoutSpec (Subclassing) - -/** - * Adds a child with the given identifier to this layout spec. - * - * @param child A child to be added. - * - * @param index An index associated with the child. - * - * @discussion Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the - * responsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, - * only require a single child. - * - * For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) - * a subclass can use the setChild method to set the "primary" child. It should then use this method - * to set any other required children. Ideally a subclass would hide this from the user, and use the - * setChild:forIndex: internally. For example, ASBackgroundLayoutSpec exposes a backgroundChild - * property that behind the scenes is calling setChild:forIndex:. - */ -- (void)setChild:(id)child atIndex:(NSUInteger)index; - -/** - * Returns the child added to this layout spec using the given index. - * - * @param index An identifier associated with the the child. - */ -- (nullable id)childAtIndex:(NSUInteger)index; - -@end - -@interface ASLayout () - -/** - * Position in parent. Default to CGPointNull. - * - * @discussion When being used as a sublayout, this property must not equal CGPointNull. - */ -@property (nonatomic) CGPoint position; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.mm b/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.mm deleted file mode 100644 index fb9daf3b..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutSpec+Subclasses.mm +++ /dev/null @@ -1,86 +0,0 @@ -// -// ASLayoutSpec+Subclasses.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#pragma mark - ASNullLayoutSpec - -@interface ASNullLayoutSpec : ASLayoutSpec -- (instancetype)init NS_UNAVAILABLE; -+ (ASNullLayoutSpec *)null; -@end - -@implementation ASNullLayoutSpec : ASLayoutSpec - -+ (ASNullLayoutSpec *)null -{ - static ASNullLayoutSpec *sharedNullLayoutSpec = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedNullLayoutSpec = [[self alloc] init]; - }); - return sharedNullLayoutSpec; -} - -- (BOOL)isMutable -{ - return NO; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - return [ASLayout layoutWithLayoutElement:self size:CGSizeZero]; -} - -@end - - -#pragma mark - ASLayoutSpec (Subclassing) - -@implementation ASLayoutSpec (Subclassing) - -#pragma mark - Child with index - -- (void)setChild:(id)child atIndex:(NSUInteger)index -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - - id layoutElement = child ?: [ASNullLayoutSpec null]; - - if (child) { - if (_childrenArray.count < index) { - // Fill up the array with null objects until the index - NSInteger i = _childrenArray.count; - while (i < index) { - _childrenArray[i] = [ASNullLayoutSpec null]; - i++; - } - } - } - - // Replace object at the given index with the layoutElement - _childrenArray[index] = layoutElement; -} - -- (id)childAtIndex:(NSUInteger)index -{ - id layoutElement = nil; - if (index < _childrenArray.count) { - layoutElement = _childrenArray[index]; - } - - // Null layoutElement should not be accessed - ASDisplayNodeAssert(layoutElement != [ASNullLayoutSpec null], @"Access child at index without set a child at that index"); - - return layoutElement; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASLayoutSpec.h deleted file mode 100644 index c7aa01c3..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutSpec.h +++ /dev/null @@ -1,100 +0,0 @@ -// -// ASLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * A layout spec is an immutable object that describes a layout, loosely inspired by React. - */ -@interface ASLayoutSpec : NSObject - -/** - * Creation of a layout spec should only happen by a user in layoutSpecThatFits:. During that method, a - * layout spec can be created and mutated. Once it is passed back to ASDK, the isMutable flag will be - * set to NO and any further mutations will cause an assert. - */ -@property (nonatomic) BOOL isMutable; - -/** - * First child within the children's array. - * - * @discussion Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the - * responsibility of holding on to the spec children. Some layout specs, like ASInsetLayoutSpec, - * only require a single child. - * - * For layout specs that require a known number of children (ASBackgroundLayoutSpec, for example) - * a subclass should use this method to set the "primary" child. It can then use setChild:atIndex: - * to set any other required children. Ideally a subclass would hide this from the user, and use the - * setChild:atIndex: internally. For example, ASBackgroundLayoutSpec exposes a "background" - * property that behind the scenes is calling setChild:atIndex:. - */ -@property (nullable, nonatomic) id child; - -/** - * An array of ASLayoutElement children - * - * @discussion Every ASLayoutSpec must act on at least one child. The ASLayoutSpec base class takes the - * reponsibility of holding on to the spec children. Some layout specs, like ASStackLayoutSpec, - * can take an unknown number of children. In this case, the this method should be used. - * For good measure, in these layout specs it probably makes sense to define - * setChild: and setChild:forIdentifier: methods to do something appropriate or to assert. - */ -@property (nullable, nonatomic) NSArray> *children; - -@end - -/** - * An ASLayoutSpec subclass that can wrap one or more ASLayoutElement and calculates the layout based on the - * sizes of the children. If multiple children are provided the size of the biggest child will be used to for - * size of this layout spec. - */ -@interface ASWrapperLayoutSpec : ASLayoutSpec - -/* - * Returns an ASWrapperLayoutSpec object with the given layoutElement as child. - */ -+ (instancetype)wrapperWithLayoutElement:(id)layoutElement NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/* - * Returns an ASWrapperLayoutSpec object with the given layoutElements as children. - */ -+ (instancetype)wrapperWithLayoutElements:(NSArray> *)layoutElements NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/* - * Returns an ASWrapperLayoutSpec object initialized with the given layoutElement as child. - */ -- (instancetype)initWithLayoutElement:(id)layoutElement AS_WARN_UNUSED_RESULT; - -/* - * Returns an ASWrapperLayoutSpec object initialized with the given layoutElements as children. - */ -- (instancetype)initWithLayoutElements:(NSArray> *)layoutElements AS_WARN_UNUSED_RESULT; - -/* - * Init not available for ASWrapperLayoutSpec - */ -- (instancetype)init NS_UNAVAILABLE; - -@end - -@interface ASLayoutSpec (Debugging) -/** - * Used by other layout specs to create ascii art debug strings - */ -+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction; -+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASLayoutSpec.mm deleted file mode 100644 index 6d0ba622..00000000 --- a/Example/Pods/Texture/Source/Layout/ASLayoutSpec.mm +++ /dev/null @@ -1,342 +0,0 @@ -// -// ASLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -#import -#import -#import - -@implementation ASLayoutSpec - -// Dynamic properties for ASLayoutElements -@dynamic layoutElementType; -@synthesize debugName = _debugName; - -#pragma mark - Lifecycle - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - _isMutable = YES; - _primitiveTraitCollection = ASPrimitiveTraitCollectionMakeDefault(); - _childrenArray = [[NSMutableArray alloc] init]; - - return self; -} - -- (ASLayoutElementType)layoutElementType -{ - return ASLayoutElementTypeLayoutSpec; -} - -- (BOOL)canLayoutAsynchronous -{ - return YES; -} - -- (BOOL)implementsLayoutMethod -{ - return YES; -} - -#pragma mark - Style - -- (ASLayoutElementStyle *)style -{ - AS::MutexLocker l(__instanceLock__); - if (_style == nil) { - _style = [[ASLayoutElementStyle alloc] init]; - } - return _style; -} - -- (instancetype)styledWithBlock:(AS_NOESCAPE void (^)(__kindof ASLayoutElementStyle *style))styleBlock -{ - styleBlock(self.style); - return self; -} - -#pragma mark - Layout - -ASLayoutElementLayoutCalculationDefaults - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - return [ASLayout layoutWithLayoutElement:self size:constrainedSize.min]; -} - -#pragma mark - Child - -- (void)setChild:(id)child -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API"); - - if (child) { - _childrenArray[0] = child; - } else { - if (_childrenArray.count) { - [_childrenArray removeObjectAtIndex:0]; - } - } -} - -- (id)child -{ - ASDisplayNodeAssert(_childrenArray.count < 2, @"This layout spec does not support more than one child. Use the setChildren: or the setChild:AtIndex: API"); - - return _childrenArray.firstObject; -} - -#pragma mark - Children - -- (void)setChildren:(NSArray> *)children -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - for (id child in children) { - ASDisplayNodeAssert([child conformsToProtocol:NSProtocolFromString(@"ASLayoutElement")], @"Child %@ of spec %@ is not an ASLayoutElement!", child, self); - } -#endif - [_childrenArray setArray:children]; -} - -- (nullable NSArray> *)children -{ - return [_childrenArray copy]; -} - -- (NSArray> *)sublayoutElements -{ - return [_childrenArray copy]; -} - -#pragma mark - NSFastEnumeration - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id unowned _Nullable [_Nonnull])buffer count:(NSUInteger)len -{ - return [_childrenArray countByEnumeratingWithState:state objects:buffer count:len]; -} - -#pragma mark - ASTraitEnvironment - -- (ASTraitCollection *)asyncTraitCollection -{ - AS::MutexLocker l(__instanceLock__); - return [ASTraitCollection traitCollectionWithASPrimitiveTraitCollection:self.primitiveTraitCollection]; -} - -- (ASPrimitiveTraitCollection)primitiveTraitCollection -{ - AS::MutexLocker l(__instanceLock__); - return _primitiveTraitCollection; -} - -- (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection -{ - AS::MutexLocker l(__instanceLock__); - _primitiveTraitCollection = traitCollection; -} - -#pragma mark - ASLayoutElementStyleExtensibility - -ASLayoutElementStyleExtensibilityForwarding - -#pragma mark - ASDescriptionProvider - -- (NSMutableArray *)propertiesForDescription -{ - const auto result = [NSMutableArray array]; - if (NSArray *children = self.children) { - // Use tiny descriptions because these trees can get nested very deep. - const auto tinyDescriptions = ASArrayByFlatMapping(children, id object, ASObjectDescriptionMakeTiny(object)); - [result addObject:@{ @"children": tinyDescriptions }]; - } - return result; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -#pragma mark - Framework Private - -#if AS_DEDUPE_LAYOUT_SPEC_TREE -- (nullable NSHashTable> *)findDuplicatedElementsInSubtree -{ - NSHashTable *result = nil; - NSUInteger count = 0; - [self _findDuplicatedElementsInSubtreeWithWorkingSet:[NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality] workingCount:&count result:&result]; - return result; -} - -/** - * This method is extremely performance-sensitive, so we do some strange things. - * - * @param workingSet A working set of elements for use in the recursion. - * @param workingCount The current count of the set for use in the recursion. - * @param result The set into which to put the result. This initially points to @c nil to save time if no duplicates exist. - */ -- (void)_findDuplicatedElementsInSubtreeWithWorkingSet:(NSHashTable> *)workingSet workingCount:(NSUInteger *)workingCount result:(NSHashTable> * _Nullable *)result -{ - Class layoutSpecClass = [ASLayoutSpec class]; - - for (id child in self) { - // Add the object into the set. - [workingSet addObject:child]; - - // Check that addObject: caused the count to increase. - // This is faster than using containsObject. - NSUInteger oldCount = *workingCount; - NSUInteger newCount = workingSet.count; - BOOL objectAlreadyExisted = (newCount != oldCount + 1); - if (objectAlreadyExisted) { - if (*result == nil) { - *result = [NSHashTable hashTableWithOptions:NSHashTableObjectPointerPersonality]; - } - [*result addObject:child]; - } else { - *workingCount = newCount; - // If child is a layout spec we haven't visited, recurse its children. - if ([child isKindOfClass:layoutSpecClass]) { - [(ASLayoutSpec *)child _findDuplicatedElementsInSubtreeWithWorkingSet:workingSet workingCount:workingCount result:result]; - } - } - } -} -#endif - -#pragma mark - Debugging - -- (NSString *)debugName -{ - AS::MutexLocker l(__instanceLock__); - return _debugName; -} - -- (void)setDebugName:(NSString *)debugName -{ - AS::MutexLocker l(__instanceLock__); - if (!ASObjectIsEqual(_debugName, debugName)) { - _debugName = [debugName copy]; - } -} - -#pragma mark - ASLayoutElementAsciiArtProtocol - -- (NSString *)asciiArtString -{ - NSArray *children = self.children.count < 2 && self.child ? @[self.child] : self.children; - return [ASLayoutSpec asciiArtStringForChildren:children parentName:[self asciiArtName]]; -} - -- (NSString *)asciiArtName -{ - NSMutableString *result = [NSMutableString stringWithCString:object_getClassName(self) encoding:NSASCIIStringEncoding]; - if (_debugName) { - [result appendFormat:@" (%@)", _debugName]; - } - return result; -} - -ASSynthesizeLockingMethodsWithMutex(__instanceLock__) - -@end - -#pragma mark - ASWrapperLayoutSpec - -@implementation ASWrapperLayoutSpec - -+ (instancetype)wrapperWithLayoutElement:(id)layoutElement NS_RETURNS_RETAINED -{ - return [[self alloc] initWithLayoutElement:layoutElement]; -} - -- (instancetype)initWithLayoutElement:(id)layoutElement -{ - self = [super init]; - if (self) { - self.child = layoutElement; - } - return self; -} - -+ (instancetype)wrapperWithLayoutElements:(NSArray> *)layoutElements NS_RETURNS_RETAINED -{ - return [[self alloc] initWithLayoutElements:layoutElements]; -} - -- (instancetype)initWithLayoutElements:(NSArray> *)layoutElements -{ - self = [super init]; - if (self) { - self.children = layoutElements; - } - return self; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - NSArray *children = self.children; - const auto count = children.count; - ASLayout *rawSublayouts[count]; - int i = 0; - - CGSize size = constrainedSize.min; - for (id child in children) { - ASLayout *sublayout = [child layoutThatFits:constrainedSize parentSize:constrainedSize.max]; - sublayout.position = CGPointZero; - - size.width = MAX(size.width, sublayout.size.width); - size.height = MAX(size.height, sublayout.size.height); - - rawSublayouts[i++] = sublayout; - } - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; - return [ASLayout layoutWithLayoutElement:self size:size sublayouts:sublayouts]; -} - -@end - -#pragma mark - ASLayoutSpec (Debugging) - -@implementation ASLayoutSpec (Debugging) - -#pragma mark - ASCII Art Helpers - -+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName direction:(ASStackLayoutDirection)direction -{ - NSMutableArray *childStrings = [NSMutableArray array]; - for (id layoutChild in children) { - NSString *childString = [layoutChild asciiArtString]; - if (childString) { - [childStrings addObject:childString]; - } - } - if (direction == ASStackLayoutDirectionHorizontal) { - return [ASAsciiArtBoxCreator horizontalBoxStringForChildren:childStrings parent:parentName]; - } - return [ASAsciiArtBoxCreator verticalBoxStringForChildren:childStrings parent:parentName]; -} - -+ (NSString *)asciiArtStringForChildren:(NSArray *)children parentName:(NSString *)parentName -{ - return [self asciiArtStringForChildren:children parentName:parentName direction:ASStackLayoutDirectionHorizontal]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.h deleted file mode 100644 index a29a72b7..00000000 --- a/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// ASOverlayLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - This layout spec lays out a single layoutElement child and then overlays a layoutElement object on top of it streched to its size - */ -@interface ASOverlayLayoutSpec : ASLayoutSpec - -/** - * Overlay layoutElement of this layout spec - */ -@property (nonatomic) id overlay; - -/** - * Creates and returns an ASOverlayLayoutSpec object with a given child and an layoutElement that act as overlay. - * - * @param child A child that is laid out to determine the size of this spec. - * @param overlay A layoutElement object that is laid out over the child. - */ -+ (instancetype)overlayLayoutSpecWithChild:(id)child overlay:(id)overlay NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.mm deleted file mode 100644 index 8a3640de..00000000 --- a/Example/Pods/Texture/Source/Layout/ASOverlayLayoutSpec.mm +++ /dev/null @@ -1,87 +0,0 @@ -// -// ASOverlayLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -static NSUInteger const kUnderlayChildIndex = 0; -static NSUInteger const kOverlayChildIndex = 1; - -@implementation ASOverlayLayoutSpec - -#pragma mark - Class - -+ (instancetype)overlayLayoutSpecWithChild:(id)child overlay:(id)overlay NS_RETURNS_RETAINED -{ - return [[self alloc] initWithChild:child overlay:overlay]; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithChild:(id)child overlay:(id)overlay -{ - if (!(self = [super init])) { - return nil; - } - self.child = child; - self.overlay = overlay; - return self; -} - -#pragma mark - Setter / Getter - -- (void)setChild:(id)child -{ - ASDisplayNodeAssertNotNil(child, @"Child that will be overlayed on shouldn't be nil"); - [super setChild:child atIndex:kUnderlayChildIndex]; -} - -- (id)child -{ - return [super childAtIndex:kUnderlayChildIndex]; -} - -- (void)setOverlay:(id)overlay -{ - ASDisplayNodeAssertNotNil(overlay, @"Overlay cannot be nil"); - [super setChild:overlay atIndex:kOverlayChildIndex]; -} - -- (id)overlay -{ - return [super childAtIndex:kOverlayChildIndex]; -} - -#pragma mark - ASLayoutSpec - -/** - First layout the contents, then fit the overlay on top of it. - */ -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize - restrictedToSize:(ASLayoutElementSize)size - relativeToParentSize:(CGSize)parentSize -{ - ASLayout *contentsLayout = [self.child layoutThatFits:constrainedSize parentSize:parentSize]; - contentsLayout.position = CGPointZero; - ASLayout *rawSublayouts[2]; - int i = 0; - rawSublayouts[i++] = contentsLayout; - if (self.overlay) { - ASLayout *overlayLayout = [self.overlay layoutThatFits:ASSizeRangeMake(contentsLayout.size) - parentSize:contentsLayout.size]; - overlayLayout.position = CGPointZero; - rawSublayouts[i++] = overlayLayout; - } - - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; - return [ASLayout layoutWithLayoutElement:self size:contentsLayout.size sublayouts:sublayouts]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.h deleted file mode 100644 index b70e6fe7..00000000 --- a/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// ASRatioLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASLayoutElement; - -/** - Ratio layout spec - For when the content should respect a certain inherent ratio but can be scaled (think photos or videos) - The ratio passed is the ratio of height / width you expect - - For a ratio 0.5, the spec will have a flat rectangle shape - _ _ _ _ - | | - |_ _ _ _| - - For a ratio 2.0, the spec will be twice as tall as it is wide - _ _ - | | - | | - | | - |_ _| - - **/ -@interface ASRatioLayoutSpec : ASLayoutSpec - -@property (nonatomic) CGFloat ratio; - -+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id)child NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.mm deleted file mode 100644 index 12091827..00000000 --- a/Example/Pods/Texture/Source/Layout/ASRatioLayoutSpec.mm +++ /dev/null @@ -1,102 +0,0 @@ -// -// ASRatioLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#import - -#import - -#pragma mark - ASRatioLayoutSpec - -@implementation ASRatioLayoutSpec -{ - CGFloat _ratio; -} - -#pragma mark - Lifecycle - -+ (instancetype)ratioLayoutSpecWithRatio:(CGFloat)ratio child:(id)child NS_RETURNS_RETAINED -{ - return [[self alloc] initWithRatio:ratio child:child]; -} - -- (instancetype)initWithRatio:(CGFloat)ratio child:(id)child -{ - if (!(self = [super init])) { - return nil; - } - - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - ASDisplayNodeAssert(ratio > 0, @"Ratio should be strictly positive, but received %f", ratio); - _ratio = ratio; - self.child = child; - - return self; -} - -#pragma mark - Setter / Getter - -- (void)setRatio:(CGFloat)ratio -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _ratio = ratio; -} - -#pragma mark - ASLayoutElement - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - std::vector sizeOptions; - - if (ASPointsValidForSize(constrainedSize.max.width)) { - sizeOptions.push_back(ASSizeRangeClamp(constrainedSize, { - constrainedSize.max.width, - ASFloorPixelValue(_ratio * constrainedSize.max.width) - })); - } - - if (ASPointsValidForSize(constrainedSize.max.height)) { - sizeOptions.push_back(ASSizeRangeClamp(constrainedSize, { - ASFloorPixelValue(constrainedSize.max.height / _ratio), - constrainedSize.max.height - })); - } - - // Choose the size closest to the desired ratio. - const auto &bestSize = std::max_element(sizeOptions.begin(), sizeOptions.end(), [&](const CGSize &a, const CGSize &b){ - return std::fabs((a.height / a.width) - _ratio) > std::fabs((b.height / b.width) - _ratio); - }); - - // If there is no max size in *either* dimension, we can't apply the ratio, so just pass our size range through. - const ASSizeRange childRange = (bestSize == sizeOptions.end()) ? constrainedSize : ASSizeRangeIntersect(constrainedSize, ASSizeRangeMake(*bestSize, *bestSize)); - const CGSize parentSize = (bestSize == sizeOptions.end()) ? ASLayoutElementParentSizeUndefined : *bestSize; - ASLayout *sublayout = [self.child layoutThatFits:childRange parentSize:parentSize]; - sublayout.position = CGPointZero; - return [ASLayout layoutWithLayoutElement:self size:sublayout.size sublayouts:@[sublayout]]; -} - -@end - -#pragma mark - ASRatioLayoutSpec (Debugging) - -@implementation ASRatioLayoutSpec (Debugging) - -#pragma mark - ASLayoutElementAsciiArtProtocol - -- (NSString *)asciiArtName -{ - return [NSString stringWithFormat:@"%@ (%.1f)", NSStringFromClass([self class]), self.ratio]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.h deleted file mode 100644 index 9b260d9c..00000000 --- a/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.h +++ /dev/null @@ -1,87 +0,0 @@ -// -// ASRelativeLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - * How the child is positioned within the spec. - * - * The default option will position the child at point 0. - * Swift: use [] for the default behavior. - */ -typedef NS_ENUM(NSUInteger, ASRelativeLayoutSpecPosition) { - /** The child is positioned at point 0 */ - ASRelativeLayoutSpecPositionNone = 0, - /** The child is positioned at point 0 relatively to the layout axis (ie left / top most) */ - ASRelativeLayoutSpecPositionStart = 1, - /** The child is centered along the specified axis */ - ASRelativeLayoutSpecPositionCenter = 2, - /** The child is positioned at the maximum point of the layout axis (ie right / bottom most) */ - ASRelativeLayoutSpecPositionEnd = 3, -}; - -/** - * How much space the spec will take up. - * - * The default option will allow the spec to take up the maximum size possible. - * Swift: use [] for the default behavior. - */ -typedef NS_OPTIONS(NSUInteger, ASRelativeLayoutSpecSizingOption) { - /** The spec will take up the maximum size possible */ - ASRelativeLayoutSpecSizingOptionDefault, - /** The spec will take up the minimum size possible along the X axis */ - ASRelativeLayoutSpecSizingOptionMinimumWidth = 1 << 0, - /** The spec will take up the minimum size possible along the Y axis */ - ASRelativeLayoutSpecSizingOptionMinimumHeight = 1 << 1, - /** Convenience option to take up the minimum size along both the X and Y axis */ - ASRelativeLayoutSpecSizingOptionMinimumSize = ASRelativeLayoutSpecSizingOptionMinimumWidth | ASRelativeLayoutSpecSizingOptionMinimumHeight, -}; - -NS_ASSUME_NONNULL_BEGIN - -/** Lays out a single layoutElement child and positions it within the layout bounds according to vertical and horizontal positional specifiers. - * Can position the child at any of the 4 corners, or the middle of any of the 4 edges, as well as the center - similar to "9-part" image areas. - */ -@interface ASRelativeLayoutSpec : ASLayoutSpec - -// You may create a spec with alloc / init, then set any non-default properties; or use a convenience initialize that accepts all properties. -@property (nonatomic) ASRelativeLayoutSpecPosition horizontalPosition; -@property (nonatomic) ASRelativeLayoutSpecPosition verticalPosition; -@property (nonatomic) ASRelativeLayoutSpecSizingOption sizingOption; - -/*! - * @discussion convenience constructor for a ASRelativeLayoutSpec - * @param horizontalPosition how to position the item on the horizontal (x) axis - * @param verticalPosition how to position the item on the vertical (y) axis - * @param sizingOption how much size to take up - * @param child the child to layout - * @return a configured ASRelativeLayoutSpec - */ -+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition - verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition - sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption - child:(id)child NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/*! - * @discussion convenience initializer for a ASRelativeLayoutSpec - * @param horizontalPosition how to position the item on the horizontal (x) axis - * @param verticalPosition how to position the item on the vertical (y) axis - * @param sizingOption how much size to take up - * @param child the child to layout - * @return a configured ASRelativeLayoutSpec - */ -- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition - verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition - sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption - child:(id)child; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.mm deleted file mode 100644 index f096ce51..00000000 --- a/Example/Pods/Texture/Source/Layout/ASRelativeLayoutSpec.mm +++ /dev/null @@ -1,104 +0,0 @@ -// -// ASRelativeLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -@implementation ASRelativeLayoutSpec - -- (instancetype)initWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id)child -{ - if (!(self = [super init])) { - return nil; - } - ASDisplayNodeAssertNotNil(child, @"Child cannot be nil"); - _horizontalPosition = horizontalPosition; - _verticalPosition = verticalPosition; - _sizingOption = sizingOption; - [self setChild:child]; - return self; -} - -+ (instancetype)relativePositionLayoutSpecWithHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition verticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition sizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption child:(id)child NS_RETURNS_RETAINED -{ - return [[self alloc] initWithHorizontalPosition:horizontalPosition verticalPosition:verticalPosition sizingOption:sizingOption child:child]; -} - -- (void)setHorizontalPosition:(ASRelativeLayoutSpecPosition)horizontalPosition -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _horizontalPosition = horizontalPosition; -} - -- (void)setVerticalPosition:(ASRelativeLayoutSpecPosition)verticalPosition { - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _verticalPosition = verticalPosition; -} - -- (void)setSizingOption:(ASRelativeLayoutSpecSizingOption)sizingOption -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _sizingOption = sizingOption; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - // If we have a finite size in any direction, pass this so that the child can resolve percentages against it. - // Otherwise pass ASLayoutElementParentDimensionUndefined as the size will depend on the content - CGSize size = { - ASPointsValidForSize(constrainedSize.max.width) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.width, - ASPointsValidForSize(constrainedSize.max.height) == NO ? ASLayoutElementParentDimensionUndefined : constrainedSize.max.height - }; - - // Layout the child - const CGSize minChildSize = { - (_horizontalPosition != ASRelativeLayoutSpecPositionNone) ? 0 : constrainedSize.min.width, - (_verticalPosition != ASRelativeLayoutSpecPositionNone) ? 0 : constrainedSize.min.height, - }; - ASLayout *sublayout = [self.child layoutThatFits:ASSizeRangeMake(minChildSize, constrainedSize.max) parentSize:size]; - - // If we have an undetermined height or width, use the child size to define the layout size - size = ASSizeRangeClamp(constrainedSize, { - isfinite(size.width) == NO ? sublayout.size.width : size.width, - isfinite(size.height) == NO ? sublayout.size.height : size.height - }); - - // If minimum size options are set, attempt to shrink the size to the size of the child - size = ASSizeRangeClamp(constrainedSize, { - MIN(size.width, (_sizingOption & ASRelativeLayoutSpecSizingOptionMinimumWidth) != 0 ? sublayout.size.width : size.width), - MIN(size.height, (_sizingOption & ASRelativeLayoutSpecSizingOptionMinimumHeight) != 0 ? sublayout.size.height : size.height) - }); - - // Compute the position for the child on each axis according to layout parameters - CGFloat xPosition = [self proportionOfAxisForAxisPosition:_horizontalPosition]; - CGFloat yPosition = [self proportionOfAxisForAxisPosition:_verticalPosition]; - - sublayout.position = { - ASRoundPixelValue((size.width - sublayout.size.width) * xPosition), - ASRoundPixelValue((size.height - sublayout.size.height) * yPosition) - }; - - return [ASLayout layoutWithLayoutElement:self size:size sublayouts:@[sublayout]]; -} - -- (CGFloat)proportionOfAxisForAxisPosition:(ASRelativeLayoutSpecPosition)position -{ - if (position == ASRelativeLayoutSpecPositionCenter) { - return 0.5f; - } else if (position == ASRelativeLayoutSpecPositionEnd) { - return 1.0f; - } else { - return 0.0f; - } -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASStackLayoutDefines.h b/Example/Pods/Texture/Source/Layout/ASStackLayoutDefines.h deleted file mode 100644 index de054390..00000000 --- a/Example/Pods/Texture/Source/Layout/ASStackLayoutDefines.h +++ /dev/null @@ -1,148 +0,0 @@ -// -// ASStackLayoutDefines.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** The direction children are stacked in */ -typedef NS_ENUM(unsigned char, ASStackLayoutDirection) { - /** Children are stacked vertically */ - ASStackLayoutDirectionVertical, - /** Children are stacked horizontally */ - ASStackLayoutDirectionHorizontal, -#if YOGA - /** Children are stacked vertically, but in reverse. Only used by Yoga spec. */ - ASStackLayoutDirectionVerticalReverse, - /** Children are stacked horizontally, but in reverse. Only used by Yoga spec. */ - ASStackLayoutDirectionHorizontalReverse, -#endif -}; - -/** If no children are flexible, how should this spec justify its children in the available space? */ -typedef NS_ENUM(unsigned char, ASStackLayoutJustifyContent) { - /** - On overflow, children overflow out of this spec's bounds on the right/bottom side. - On underflow, children are left/top-aligned within this spec's bounds. - */ - ASStackLayoutJustifyContentStart, - /** - On overflow, children are centered and overflow on both sides. - On underflow, children are centered within this spec's bounds in the stacking direction. - */ - ASStackLayoutJustifyContentCenter, - /** - On overflow, children overflow out of this spec's bounds on the left/top side. - On underflow, children are right/bottom-aligned within this spec's bounds. - */ - ASStackLayoutJustifyContentEnd, - /** - On overflow or if the stack has only 1 child, this value is identical to ASStackLayoutJustifyContentStart. - Otherwise, the starting edge of the first child is at the starting edge of the stack, - the ending edge of the last child is at the ending edge of the stack, and the remaining children - are distributed so that the spacing between any two adjacent ones is the same. - If there is a remaining space after spacing division, it is combined with the last spacing (i.e the one between the last 2 children). - */ - ASStackLayoutJustifyContentSpaceBetween, - /** - On overflow or if the stack has only 1 child, this value is identical to ASStackLayoutJustifyContentCenter. - Otherwise, children are distributed such that the spacing between any two adjacent ones is the same, - and the spacing between the first/last child and the stack edges is half the size of the spacing between children. - If there is a remaining space after spacing division, it is combined with the last spacing (i.e the one between the last child and the stack ending edge). - */ - ASStackLayoutJustifyContentSpaceAround -}; - -/** Orientation of children along cross axis */ -typedef NS_ENUM(unsigned char, ASStackLayoutAlignItems) { - /** Align children to start of cross axis */ - ASStackLayoutAlignItemsStart, - /** Align children with end of cross axis */ - ASStackLayoutAlignItemsEnd, - /** Center children on cross axis */ - ASStackLayoutAlignItemsCenter, - /** Expand children to fill cross axis */ - ASStackLayoutAlignItemsStretch, - /** Children align to their first baseline. Only available for horizontal stack spec */ - ASStackLayoutAlignItemsBaselineFirst, - /** Children align to their last baseline. Only available for horizontal stack spec */ - ASStackLayoutAlignItemsBaselineLast, - ASStackLayoutAlignItemsNotSet -}; - -/** - Each child may override their parent stack's cross axis alignment. - @see ASStackLayoutAlignItems - */ -typedef NS_ENUM(unsigned char, ASStackLayoutAlignSelf) { - /** Inherit alignment value from containing stack. */ - ASStackLayoutAlignSelfAuto, - /** Align to start of cross axis */ - ASStackLayoutAlignSelfStart, - /** Align with end of cross axis */ - ASStackLayoutAlignSelfEnd, - /** Center on cross axis */ - ASStackLayoutAlignSelfCenter, - /** Expand to fill cross axis */ - ASStackLayoutAlignSelfStretch, -}; - -/** Whether children are stacked into a single or multiple lines. */ -typedef NS_ENUM(unsigned char, ASStackLayoutFlexWrap) { - ASStackLayoutFlexWrapNoWrap, - ASStackLayoutFlexWrapWrap, -}; - -/** Orientation of lines along cross axis if there are multiple lines. */ -typedef NS_ENUM(unsigned char, ASStackLayoutAlignContent) { - ASStackLayoutAlignContentStart, - ASStackLayoutAlignContentCenter, - ASStackLayoutAlignContentEnd, - ASStackLayoutAlignContentSpaceBetween, - ASStackLayoutAlignContentSpaceAround, - ASStackLayoutAlignContentStretch, -}; - -/** Orientation of children along horizontal axis */ -typedef NS_ENUM(unsigned char, ASHorizontalAlignment) { - /** No alignment specified. Default value */ - ASHorizontalAlignmentNone, - /** Left aligned */ - ASHorizontalAlignmentLeft, - /** Center aligned */ - ASHorizontalAlignmentMiddle, - /** Right aligned */ - ASHorizontalAlignmentRight, - - // After 2.0 has landed, we'll add ASDISPLAYNODE_DEPRECATED here - for now, avoid triggering errors for projects with -Werror - /** @deprecated Use ASHorizontalAlignmentLeft instead */ - ASAlignmentLeft ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentLeft, - /** @deprecated Use ASHorizontalAlignmentMiddle instead */ - ASAlignmentMiddle ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentMiddle, - /** @deprecated Use ASHorizontalAlignmentRight instead */ - ASAlignmentRight ASDISPLAYNODE_DEPRECATED = ASHorizontalAlignmentRight, -}; - -/** Orientation of children along vertical axis */ -typedef NS_ENUM(unsigned char, ASVerticalAlignment) { - /** No alignment specified. Default value */ - ASVerticalAlignmentNone, - /** Top aligned */ - ASVerticalAlignmentTop, - /** Center aligned */ - ASVerticalAlignmentCenter, - /** Bottom aligned */ - ASVerticalAlignmentBottom, - - // After 2.0 has landed, we'll add ASDISPLAYNODE_DEPRECATED here - for now, avoid triggering errors for projects with -Werror - /** @deprecated Use ASVerticalAlignmentTop instead */ - ASAlignmentTop ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentTop, - /** @deprecated Use ASVerticalAlignmentCenter instead */ - ASAlignmentCenter ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentCenter, - /** @deprecated Use ASVerticalAlignmentBottom instead */ - ASAlignmentBottom ASDISPLAYNODE_DEPRECATED = ASVerticalAlignmentBottom, -}; diff --git a/Example/Pods/Texture/Source/Layout/ASStackLayoutElement.h b/Example/Pods/Texture/Source/Layout/ASStackLayoutElement.h deleted file mode 100644 index 10e2d50b..00000000 --- a/Example/Pods/Texture/Source/Layout/ASStackLayoutElement.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// ASStackLayoutElement.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Layout options that can be defined for an ASLayoutElement being added to a ASStackLayoutSpec. - */ -@protocol ASStackLayoutElement - -/** - * @abstract Additional space to place before this object in the stacking direction. - * Used when attached to a stack layout. - */ -@property (nonatomic) CGFloat spacingBefore; - -/** - * @abstract Additional space to place after this object in the stacking direction. - * Used when attached to a stack layout. - */ -@property (nonatomic) CGFloat spacingAfter; - -/** - * @abstract If the sum of children's stack dimensions is less than the minimum size, how much should this component grow? - * This value represents the "flex grow factor" and determines how much this component should grow in relation to any - * other flexible children. - */ -@property (nonatomic) CGFloat flexGrow; - -/** - * @abstract If the sum of children's stack dimensions is greater than the maximum size, how much should this component shrink? - * This value represents the "flex shrink factor" and determines how much this component should shink in relation to - * other flexible children. - */ -@property (nonatomic) CGFloat flexShrink; - -/** - * @abstract Specifies the initial size in the stack dimension for this object. - * Defaults to ASDimensionAuto. - * Used when attached to a stack layout. - */ -@property (nonatomic) ASDimension flexBasis; - -/** - * @abstract Orientation of the object along cross axis, overriding alignItems. - * Defaults to ASStackLayoutAlignSelfAuto. - * Used when attached to a stack layout. - */ -@property (nonatomic) ASStackLayoutAlignSelf alignSelf; - -/** - * @abstract Used for baseline alignment. The distance from the top of the object to its baseline. - */ -@property (nonatomic) CGFloat ascender; - -/** - * @abstract Used for baseline alignment. The distance from the baseline of the object to its bottom. - */ -@property (nonatomic) CGFloat descender; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.h b/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.h deleted file mode 100644 index ccc2084e..00000000 --- a/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.h +++ /dev/null @@ -1,133 +0,0 @@ -// -// ASStackLayoutSpec.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - A simple layout spec that stacks a list of children vertically or horizontally. - - - All children are initially laid out with the an infinite available size in the stacking direction. - - In the other direction, this spec's constraint is passed. - - The children's sizes are summed in the stacking direction. - - If this sum is less than this spec's minimum size in stacking direction, children with flexGrow are flexed. - - If it is greater than this spec's maximum size in the stacking direction, children with flexShrink are flexed. - - If, even after flexing, the sum is still greater than this spec's maximum size in the stacking direction, - justifyContent determines how children are laid out. - - For example: - - - Suppose stacking direction is Vertical, min-width=100, max-width=300, min-height=200, max-height=500. - - All children are laid out with min-width=100, max-width=300, min-height=0, max-height=INFINITY. - - If the sum of the children's heights is less than 200, children with flexGrow are flexed larger. - - If the sum of the children's heights is greater than 500, children with flexShrink are flexed smaller. - Each child is shrunk by `((sum of heights) - 500)/(number of flexShrink-able children)`. - - If the sum of the children's heights is greater than 500 even after flexShrink-able children are flexed, - justifyContent determines how children are laid out. - */ -@interface ASStackLayoutSpec : ASLayoutSpec - -/** - Specifies the direction children are stacked in. If horizontalAlignment and verticalAlignment were set, - they will be resolved again, causing justifyContent and alignItems to be updated accordingly - */ -@property (nonatomic) ASStackLayoutDirection direction; -/** The amount of space between each child. */ -@property (nonatomic) CGFloat spacing; -/** - Specifies how children are aligned horizontally. Depends on the stack direction, setting the alignment causes either - justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. - Thus, it is preferred to those properties - */ -@property (nonatomic) ASHorizontalAlignment horizontalAlignment; -/** - Specifies how children are aligned vertically. Depends on the stack direction, setting the alignment causes either - justifyContent or alignItems to be updated. The alignment will remain valid after future direction changes. - Thus, it is preferred to those properties - */ -@property (nonatomic) ASVerticalAlignment verticalAlignment; -/** The amount of space between each child. Defaults to ASStackLayoutJustifyContentStart */ -@property (nonatomic) ASStackLayoutJustifyContent justifyContent; -/** Orientation of children along cross axis. Defaults to ASStackLayoutAlignItemsStretch */ -@property (nonatomic) ASStackLayoutAlignItems alignItems; -/** Whether children are stacked into a single or multiple lines. Defaults to single line (ASStackLayoutFlexWrapNoWrap) */ -@property (nonatomic) ASStackLayoutFlexWrap flexWrap; -/** Orientation of lines along cross axis if there are multiple lines. Defaults to ASStackLayoutAlignContentStart */ -@property (nonatomic) ASStackLayoutAlignContent alignContent; -/** If the stack spreads on multiple lines using flexWrap, the amount of space between lines. */ -@property (nonatomic) CGFloat lineSpacing; -/** Whether this stack can dispatch to other threads, regardless of which thread it's running on */ -@property (nonatomic, getter=isConcurrent) BOOL concurrent; - -- (instancetype)init; - -/** - @param direction The direction of the stack view (horizontal or vertical) - @param spacing The spacing between the children - @param justifyContent If no children are flexible, this describes how to fill any extra space - @param alignItems Orientation of the children along the cross axis - @param children ASLayoutElement children to be positioned. - */ -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction - spacing:(CGFloat)spacing - justifyContent:(ASStackLayoutJustifyContent)justifyContent - alignItems:(ASStackLayoutAlignItems)alignItems - children:(NSArray> *)children NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - @param direction The direction of the stack view (horizontal or vertical) - @param spacing The spacing between the children - @param justifyContent If no children are flexible, this describes how to fill any extra space - @param alignItems Orientation of the children along the cross axis - @param flexWrap Whether children are stacked into a single or multiple lines - @param alignContent Orientation of lines along cross axis if there are multiple lines - @param children ASLayoutElement children to be positioned. - */ -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction - spacing:(CGFloat)spacing - justifyContent:(ASStackLayoutJustifyContent)justifyContent - alignItems:(ASStackLayoutAlignItems)alignItems - flexWrap:(ASStackLayoutFlexWrap)flexWrap - alignContent:(ASStackLayoutAlignContent)alignContent - children:(NSArray> *)children NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - @param direction The direction of the stack view (horizontal or vertical) - @param spacing The spacing between the children - @param justifyContent If no children are flexible, this describes how to fill any extra space - @param alignItems Orientation of the children along the cross axis - @param flexWrap Whether children are stacked into a single or multiple lines - @param alignContent Orientation of lines along cross axis if there are multiple lines - @param lineSpacing The spacing between lines - @param children ASLayoutElement children to be positioned. - */ -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction - spacing:(CGFloat)spacing - justifyContent:(ASStackLayoutJustifyContent)justifyContent - alignItems:(ASStackLayoutAlignItems)alignItems - flexWrap:(ASStackLayoutFlexWrap)flexWrap - alignContent:(ASStackLayoutAlignContent)alignContent - lineSpacing:(CGFloat)lineSpacing - children:(NSArray> *)children NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * @return A stack layout spec with direction of ASStackLayoutDirectionVertical - **/ -+ (instancetype)verticalStackLayoutSpec NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * @return A stack layout spec with direction of ASStackLayoutDirectionHorizontal - **/ -+ (instancetype)horizontalStackLayoutSpec NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.mm b/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.mm deleted file mode 100644 index 976cc029..00000000 --- a/Example/Pods/Texture/Source/Layout/ASStackLayoutSpec.mm +++ /dev/null @@ -1,216 +0,0 @@ -// -// ASStackLayoutSpec.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import -#import -#import -#import - -@implementation ASStackLayoutSpec - -- (instancetype)init -{ - return [self initWithDirection:ASStackLayoutDirectionHorizontal spacing:0.0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStretch flexWrap:ASStackLayoutFlexWrapNoWrap alignContent:ASStackLayoutAlignContentStart lineSpacing:0.0 children:nil]; -} - -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems children:(NSArray *)children NS_RETURNS_RETAINED -{ - return [[self alloc] initWithDirection:direction spacing:spacing justifyContent:justifyContent alignItems:alignItems flexWrap:ASStackLayoutFlexWrapNoWrap alignContent:ASStackLayoutAlignContentStart lineSpacing: 0.0 children:children]; -} - -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems flexWrap:(ASStackLayoutFlexWrap)flexWrap alignContent:(ASStackLayoutAlignContent)alignContent children:(NSArray> *)children NS_RETURNS_RETAINED -{ - return [[self alloc] initWithDirection:direction spacing:spacing justifyContent:justifyContent alignItems:alignItems flexWrap:flexWrap alignContent:alignContent lineSpacing:0.0 children:children]; -} - -+ (instancetype)stackLayoutSpecWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems flexWrap:(ASStackLayoutFlexWrap)flexWrap alignContent:(ASStackLayoutAlignContent)alignContent lineSpacing:(CGFloat)lineSpacing children:(NSArray> *)children NS_RETURNS_RETAINED -{ - return [[self alloc] initWithDirection:direction spacing:spacing justifyContent:justifyContent alignItems:alignItems flexWrap:flexWrap alignContent:alignContent lineSpacing:lineSpacing children:children]; -} - -+ (instancetype)verticalStackLayoutSpec NS_RETURNS_RETAINED -{ - ASStackLayoutSpec *stackLayoutSpec = [[self alloc] init]; - stackLayoutSpec.direction = ASStackLayoutDirectionVertical; - return stackLayoutSpec; -} - -+ (instancetype)horizontalStackLayoutSpec NS_RETURNS_RETAINED -{ - ASStackLayoutSpec *stackLayoutSpec = [[self alloc] init]; - stackLayoutSpec.direction = ASStackLayoutDirectionHorizontal; - return stackLayoutSpec; -} - -- (instancetype)initWithDirection:(ASStackLayoutDirection)direction spacing:(CGFloat)spacing justifyContent:(ASStackLayoutJustifyContent)justifyContent alignItems:(ASStackLayoutAlignItems)alignItems flexWrap:(ASStackLayoutFlexWrap)flexWrap alignContent:(ASStackLayoutAlignContent)alignContent lineSpacing:(CGFloat)lineSpacing children:(NSArray *)children -{ - if (!(self = [super init])) { - return nil; - } - _direction = direction; - _spacing = spacing; - _horizontalAlignment = ASHorizontalAlignmentNone; - _verticalAlignment = ASVerticalAlignmentNone; - _alignItems = alignItems; - _justifyContent = justifyContent; - _flexWrap = flexWrap; - _alignContent = alignContent; - _lineSpacing = lineSpacing; - - [self setChildren:children]; - return self; -} - -- (void)setDirection:(ASStackLayoutDirection)direction -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - if (_direction != direction) { - _direction = direction; - [self resolveHorizontalAlignment]; - [self resolveVerticalAlignment]; - } -} - -- (void)setHorizontalAlignment:(ASHorizontalAlignment)horizontalAlignment -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - if (_horizontalAlignment != horizontalAlignment) { - _horizontalAlignment = horizontalAlignment; - [self resolveHorizontalAlignment]; - } -} - -- (void)setVerticalAlignment:(ASVerticalAlignment)verticalAlignment -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - if (_verticalAlignment != verticalAlignment) { - _verticalAlignment = verticalAlignment; - [self resolveVerticalAlignment]; - } -} - -- (void)setAlignItems:(ASStackLayoutAlignItems)alignItems -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - ASDisplayNodeAssert(_horizontalAlignment == ASHorizontalAlignmentNone, @"Cannot set this property directly because horizontalAlignment is being used"); - ASDisplayNodeAssert(_verticalAlignment == ASVerticalAlignmentNone, @"Cannot set this property directly because verticalAlignment is being used"); - _alignItems = alignItems; -} - -- (void)setJustifyContent:(ASStackLayoutJustifyContent)justifyContent -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - ASDisplayNodeAssert(_horizontalAlignment == ASHorizontalAlignmentNone, @"Cannot set this property directly because horizontalAlignment is being used"); - ASDisplayNodeAssert(_verticalAlignment == ASVerticalAlignmentNone, @"Cannot set this property directly because verticalAlignment is being used"); - _justifyContent = justifyContent; -} - -- (void)setSpacing:(CGFloat)spacing -{ - ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable"); - _spacing = spacing; -} - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - NSArray *children = self.children; - if (children.count == 0) { - return [ASLayout layoutWithLayoutElement:self size:constrainedSize.min]; - } - - as_activity_scope_verbose(as_activity_create("Calculate stack layout", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - as_log_verbose(ASLayoutLog(), "Stack layout %@", self); - // Accessing the style and size property is pretty costly we create layout spec children we use to figure - // out the layout for each child - const auto stackChildren = AS::map(children, [&](const id child) -> ASStackLayoutSpecChild { - ASLayoutElementStyle *style = child.style; - return {child, style, style.size}; - }); - - const ASStackLayoutSpecStyle style = {.direction = _direction, .spacing = _spacing, .justifyContent = _justifyContent, .alignItems = _alignItems, .flexWrap = _flexWrap, .alignContent = _alignContent, .lineSpacing = _lineSpacing}; - - const auto unpositionedLayout = ASStackUnpositionedLayout::compute(stackChildren, style, constrainedSize, _concurrent); - const auto positionedLayout = ASStackPositionedLayout::compute(unpositionedLayout, style, constrainedSize); - - if (style.direction == ASStackLayoutDirectionVertical) { - self.style.ascender = stackChildren.front().style.ascender; - self.style.descender = stackChildren.back().style.descender; - } - - ASLayout *rawSublayouts[positionedLayout.items.size()]; - int i = 0; - for (const auto &item : positionedLayout.items) { - rawSublayouts[i++] = item.layout; - } - - const auto sublayouts = [NSArray arrayByTransferring:rawSublayouts count:i]; - return [ASLayout layoutWithLayoutElement:self size:positionedLayout.size sublayouts:sublayouts]; -} - -- (void)resolveHorizontalAlignment -{ - if (_direction == ASStackLayoutDirectionHorizontal) { - _justifyContent = justifyContent(_horizontalAlignment, _justifyContent); - } else { - _alignItems = alignment(_horizontalAlignment, _alignItems); - } -} - -- (void)resolveVerticalAlignment -{ - if (_direction == ASStackLayoutDirectionHorizontal) { - _alignItems = alignment(_verticalAlignment, _alignItems); - } else { - _justifyContent = justifyContent(_verticalAlignment, _justifyContent); - } -} - -- (NSMutableArray *)propertiesForDescription -{ - auto result = [super propertiesForDescription]; - - // Add our direction - switch (self.direction) { - case ASStackLayoutDirectionVertical: - [result insertObject:@{ (id)kCFNull: @"vertical" } atIndex:0]; - break; - case ASStackLayoutDirectionHorizontal: - [result insertObject:@{ (id)kCFNull: @"horizontal" } atIndex:0]; - break; -#if YOGA - case ASStackLayoutDirectionVerticalReverse: - case ASStackLayoutDirectionHorizontalReverse: - // Currently not handled. - ASDisplayNodeFailAssert(@"Reverse directions not implemented."); - break; -#endif - } - - return result; -} - -@end - -@implementation ASStackLayoutSpec (Debugging) - -#pragma mark - ASLayoutElementAsciiArtProtocol - -- (NSString *)asciiArtString -{ - return [ASLayoutSpec asciiArtStringForChildren:self.children parentName:[self asciiArtName] direction:self.direction]; -} - -@end diff --git a/Example/Pods/Texture/Source/Layout/ASYogaUtilities.h b/Example/Pods/Texture/Source/Layout/ASYogaUtilities.h deleted file mode 100644 index d5529fc4..00000000 --- a/Example/Pods/Texture/Source/Layout/ASYogaUtilities.h +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASYogaUtilities.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if YOGA /* YOGA */ - -#import -#import -#import - -// Should pass a string literal, not an NSString as the first argument to ASYogaLog -#define ASYogaLog(x, ...) as_log_verbose(ASLayoutLog(), x, ##__VA_ARGS__); - -@interface ASDisplayNode (YogaHelpers) - -+ (ASDisplayNode *)yogaNode; -+ (ASDisplayNode *)yogaSpacerNode; -+ (ASDisplayNode *)yogaVerticalStack; -+ (ASDisplayNode *)yogaHorizontalStack; - -@end - -// pre-order, depth-first -ASDK_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); - -#pragma mark - Yoga Type Conversion Helpers - -ASDK_EXTERN YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); -ASDK_EXTERN YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); -ASDK_EXTERN YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); -ASDK_EXTERN YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); -ASDK_EXTERN float yogaFloatForCGFloat(CGFloat value); -ASDK_EXTERN float yogaDimensionToPoints(ASDimension dimension); -ASDK_EXTERN float yogaDimensionToPercent(ASDimension dimension); -ASDK_EXTERN ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); - -ASDK_EXTERN void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement); -ASDK_EXTERN float ASLayoutElementYogaBaselineFunc(YGNodeRef yogaNode, const float width, const float height); -ASDK_EXTERN YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, - float width, YGMeasureMode widthMode, - float height, YGMeasureMode heightMode); - -#pragma mark - Yoga Style Setter Helpers - -#define YGNODE_STYLE_SET_DIMENSION(yogaNode, property, dimension) \ - if (dimension.unit == ASDimensionUnitPoints) { \ - YGNodeStyleSet##property(yogaNode, yogaDimensionToPoints(dimension)); \ - } else if (dimension.unit == ASDimensionUnitFraction) { \ - YGNodeStyleSet##property##Percent(yogaNode, yogaDimensionToPercent(dimension)); \ - } else { \ - YGNodeStyleSet##property(yogaNode, YGUndefined); \ - }\ - -#define YGNODE_STYLE_SET_DIMENSION_WITH_EDGE(yogaNode, property, dimension, edge) \ - if (dimension.unit == ASDimensionUnitPoints) { \ - YGNodeStyleSet##property(yogaNode, edge, yogaDimensionToPoints(dimension)); \ - } else if (dimension.unit == ASDimensionUnitFraction) { \ - YGNodeStyleSet##property##Percent(yogaNode, edge, yogaDimensionToPercent(dimension)); \ - } else { \ - YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \ - } \ - -#define YGNODE_STYLE_SET_FLOAT_WITH_EDGE(yogaNode, property, dimension, edge) \ - if (dimension.unit == ASDimensionUnitPoints) { \ - YGNodeStyleSet##property(yogaNode, edge, yogaDimensionToPoints(dimension)); \ - } else if (dimension.unit == ASDimensionUnitFraction) { \ - ASDisplayNodeAssert(NO, @"Unexpected Fraction value in applying ##property## values to YGNode"); \ - } else { \ - YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \ - } \ - -#endif /* YOGA */ diff --git a/Example/Pods/Texture/Source/Layout/ASYogaUtilities.mm b/Example/Pods/Texture/Source/Layout/ASYogaUtilities.mm deleted file mode 100644 index 68beede1..00000000 --- a/Example/Pods/Texture/Source/Layout/ASYogaUtilities.mm +++ /dev/null @@ -1,249 +0,0 @@ -// -// ASYogaUtilities.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#if YOGA /* YOGA */ - -@implementation ASDisplayNode (YogaHelpers) - -+ (ASDisplayNode *)yogaNode -{ - ASDisplayNode *node = [[ASDisplayNode alloc] init]; - node.automaticallyManagesSubnodes = YES; - [node.style yogaNodeCreateIfNeeded]; - return node; -} - -+ (ASDisplayNode *)yogaSpacerNode -{ - ASDisplayNode *node = [ASDisplayNode yogaNode]; - node.style.flexGrow = 1.0f; - return node; -} - -+ (ASDisplayNode *)yogaVerticalStack -{ - ASDisplayNode *node = [self yogaNode]; - node.style.flexDirection = ASStackLayoutDirectionVertical; - return node; -} - -+ (ASDisplayNode *)yogaHorizontalStack -{ - ASDisplayNode *node = [self yogaNode]; - node.style.flexDirection = ASStackLayoutDirectionHorizontal; - return node; -} - -@end - -void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) -{ - if (node == nil) { - return; - } - block(node); - // We use the accessor here despite the copy, because the block may modify the yoga tree e.g. - // replacing a node. - for (ASDisplayNode *child in node.yogaChildren) { - ASDisplayNodePerformBlockOnEveryYogaChild(child, block); - } -} - -#pragma mark - Yoga Type Conversion Helpers - -YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems) -{ - switch (alignItems) { - case ASStackLayoutAlignItemsNotSet: return YGAlignAuto; - case ASStackLayoutAlignItemsStart: return YGAlignFlexStart; - case ASStackLayoutAlignItemsEnd: return YGAlignFlexEnd; - case ASStackLayoutAlignItemsCenter: return YGAlignCenter; - case ASStackLayoutAlignItemsStretch: return YGAlignStretch; - case ASStackLayoutAlignItemsBaselineFirst: return YGAlignBaseline; - // FIXME: WARNING, Yoga does not currently support last-baseline item alignment. - case ASStackLayoutAlignItemsBaselineLast: return YGAlignBaseline; - } -} - -YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent) -{ - switch (justifyContent) { - case ASStackLayoutJustifyContentStart: return YGJustifyFlexStart; - case ASStackLayoutJustifyContentCenter: return YGJustifyCenter; - case ASStackLayoutJustifyContentEnd: return YGJustifyFlexEnd; - case ASStackLayoutJustifyContentSpaceBetween: return YGJustifySpaceBetween; - case ASStackLayoutJustifyContentSpaceAround: return YGJustifySpaceAround; - } -} - -YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf) -{ - switch (alignSelf) { - case ASStackLayoutAlignSelfStart: return YGAlignFlexStart; - case ASStackLayoutAlignSelfCenter: return YGAlignCenter; - case ASStackLayoutAlignSelfEnd: return YGAlignFlexEnd; - case ASStackLayoutAlignSelfStretch: return YGAlignStretch; - case ASStackLayoutAlignSelfAuto: return YGAlignAuto; - } -} - -YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction) -{ - switch (direction) { - case ASStackLayoutDirectionVertical: - return YGFlexDirectionColumn; - case ASStackLayoutDirectionVerticalReverse: - return YGFlexDirectionColumnReverse; - case ASStackLayoutDirectionHorizontal: - return YGFlexDirectionRow; - case ASStackLayoutDirectionHorizontalReverse: - return YGFlexDirectionRowReverse; - } -} - -float yogaFloatForCGFloat(CGFloat value) -{ - if (value < CGFLOAT_MAX / 2) { - return value; - } else { - return YGUndefined; - } -} - -CGFloat cgFloatForYogaFloat(float yogaFloat, CGFloat undefinedDefault) -{ - return YGFloatIsUndefined(yogaFloat) ? undefinedDefault : yogaFloat; -} - -float yogaDimensionToPoints(ASDimension dimension) -{ - ASDisplayNodeCAssert(dimension.unit == ASDimensionUnitPoints, - @"Dimensions should not be type Fraction for this method: %f", dimension.value); - return yogaFloatForCGFloat(dimension.value); -} - -float yogaDimensionToPercent(ASDimension dimension) -{ - ASDisplayNodeCAssert(dimension.unit == ASDimensionUnitFraction, - @"Dimensions should not be type Points for this method: %f", dimension.value); - return 100.0 * yogaFloatForCGFloat(dimension.value); - -} - -ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets) -{ - switch (edge) { - case YGEdgeLeft: return insets.left; - case YGEdgeTop: return insets.top; - case YGEdgeRight: return insets.right; - case YGEdgeBottom: return insets.bottom; - case YGEdgeStart: return insets.start; - case YGEdgeEnd: return insets.end; - case YGEdgeHorizontal: return insets.horizontal; - case YGEdgeVertical: return insets.vertical; - case YGEdgeAll: return insets.all; - default: ASDisplayNodeCAssert(NO, @"YGEdge other than ASEdgeInsets is not supported."); - return ASDimensionAuto; - } -} - -void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id layoutElement) -{ - if (yogaNode == NULL) { - return; - } - - BOOL shouldHaveMeasureFunc = [layoutElement implementsLayoutMethod]; - // How expensive is it to set a baselineFunc on all (leaf) nodes? - BOOL shouldHaveBaselineFunc = YES; - - if (layoutElement != nil) { - if (shouldHaveMeasureFunc || shouldHaveBaselineFunc) { - // Retain the Context object. This must be explicitly released with a - // __bridge_transfer - YGNodeFree() is not sufficient. - YGNodeSetContext(yogaNode, (__bridge_retained void *)layoutElement); - } - if (shouldHaveMeasureFunc) { - YGNodeSetMeasureFunc(yogaNode, &ASLayoutElementYogaMeasureFunc); - } - if (shouldHaveBaselineFunc) { - YGNodeSetBaselineFunc(yogaNode, &ASLayoutElementYogaBaselineFunc); - } - ASDisplayNodeCAssert(YGNodeGetContext(yogaNode) == (__bridge void *)layoutElement, - @"Yoga node context should contain layoutElement: %@", layoutElement); - } else { - // If we lack any of the conditions above, and currently have a measureFn/baselineFn/context, - // get rid of it. - // Release the __bridge_retained Context object. - __unused id element = (__bridge_transfer id)YGNodeGetContext(yogaNode); - YGNodeSetContext(yogaNode, NULL); - YGNodeSetMeasureFunc(yogaNode, NULL); - YGNodeSetBaselineFunc(yogaNode, NULL); - } -} - -float ASLayoutElementYogaBaselineFunc(YGNodeRef yogaNode, const float width, const float height) -{ - id layoutElement = (__bridge id)YGNodeGetContext(yogaNode); - ASDisplayNodeCAssert([layoutElement conformsToProtocol:@protocol(ASLayoutElement)], - @"Yoga context must be "); - - ASDisplayNode *displayNode = ASDynamicCast(layoutElement, ASDisplayNode); - - switch (displayNode.style.parentAlignStyle) { - case ASStackLayoutAlignItemsBaselineFirst: - return layoutElement.style.ascender; - case ASStackLayoutAlignItemsBaselineLast: - return height + layoutElement.style.descender; - default: - return 0; - } -} - -YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, float width, YGMeasureMode widthMode, - float height, YGMeasureMode heightMode) -{ - id layoutElement = (__bridge id )YGNodeGetContext(yogaNode); - ASDisplayNodeCAssert([layoutElement conformsToProtocol:@protocol(ASLayoutElement)], @"Yoga context must be "); - - width = cgFloatForYogaFloat(width, CGFLOAT_MAX); - height = cgFloatForYogaFloat(height, CGFLOAT_MAX); - - ASSizeRange sizeRange; - sizeRange.min = CGSizeZero; - sizeRange.max = CGSizeMake(width, height); - if (widthMode == YGMeasureModeExactly) { - sizeRange.min.width = sizeRange.max.width; - } else { - // Mode is (YGMeasureModeAtMost | YGMeasureModeUndefined) - ASDimension minWidth = layoutElement.style.minWidth; - sizeRange.min.width = (minWidth.unit == ASDimensionUnitPoints ? yogaDimensionToPoints(minWidth) : 0.0); - } - if (heightMode == YGMeasureModeExactly) { - sizeRange.min.height = sizeRange.max.height; - } else { - // Mode is (YGMeasureModeAtMost | YGMeasureModeUndefined) - ASDimension minHeight = layoutElement.style.minHeight; - sizeRange.min.height = (minHeight.unit == ASDimensionUnitPoints ? yogaDimensionToPoints(minHeight) : 0.0); - } - - ASDisplayNodeCAssert(isnan(sizeRange.min.width) == NO && isnan(sizeRange.min.height) == NO, @"Yoga size range for measurement should not have NaN in minimum"); - if (isnan(sizeRange.max.width)) { - sizeRange.max.width = CGFLOAT_MAX; - } - if (isnan(sizeRange.max.height)) { - sizeRange.max.height = CGFLOAT_MAX; - } - - CGSize size = [[layoutElement layoutThatFits:sizeRange] size]; - return (YGSize){ .width = (float)size.width, .height = (float)size.height }; -} - -#endif /* YOGA */ diff --git a/Example/Pods/Texture/Source/Private/ASAbstractLayoutController+FrameworkPrivate.h b/Example/Pods/Texture/Source/Private/ASAbstractLayoutController+FrameworkPrivate.h deleted file mode 100644 index f836fa0b..00000000 --- a/Example/Pods/Texture/Source/Private/ASAbstractLayoutController+FrameworkPrivate.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASAbstractLayoutController+FrameworkPrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -// -// The following methods are ONLY for use by _ASDisplayLayer, _ASDisplayView, and ASDisplayNode. -// These methods must never be called or overridden by other classes. -// - -#include - -@interface ASAbstractLayoutController (FrameworkPrivate) - -+ (std::vector>)defaultTuningParameters; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASBasicImageDownloaderInternal.h b/Example/Pods/Texture/Source/Private/ASBasicImageDownloaderInternal.h deleted file mode 100644 index ba06e0bc..00000000 --- a/Example/Pods/Texture/Source/Private/ASBasicImageDownloaderInternal.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ASBasicImageDownloaderInternal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -@interface ASBasicImageDownloaderContext : NSObject - -+ (ASBasicImageDownloaderContext *)contextForURL:(NSURL *)URL; - -@property (nonatomic, readonly) NSURL *URL; -@property (nonatomic, weak) NSURLSessionTask *sessionTask; - -- (BOOL)isCancelled; -- (void)cancel; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASBatchFetching.h b/Example/Pods/Texture/Source/Private/ASBatchFetching.h deleted file mode 100644 index 6682a55a..00000000 --- a/Example/Pods/Texture/Source/Private/ASBatchFetching.h +++ /dev/null @@ -1,80 +0,0 @@ -// -// ASBatchFetching.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASBatchContext; -@protocol ASBatchFetchingDelegate; - -@protocol ASBatchFetchingScrollView - -- (BOOL)canBatchFetch; -- (ASBatchContext *)batchContext; -- (CGFloat)leadingScreensForBatching; -- (nullable id)batchFetchingDelegate; - -@end - -/** - @abstract Determine if batch fetching should begin based on the state of the parameters. - @discussion This method is broken into a category for unit testing purposes and should be used with the ASTableView and - * ASCollectionView batch fetching API. - @param scrollView The scroll view that in-flight fetches are happening. - @param scrollDirection The current scrolling direction of the scroll view. - @param scrollableDirections The possible scrolling directions of the scroll view. - @param contentOffset The offset that the scrollview will scroll to. - @param velocity The velocity of the scroll view (in points) at the moment the touch was released. - @param flipsHorizontallyInOppositeLayoutDirection Whether or not this scroll view flips its layout automatically in RTL. - See flipsHorizontallyInOppositeLayoutDirection in UICollectionViewLayout - @return Whether or not the current state should proceed with batch fetching. - */ -ASDK_EXTERN BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, - ASScrollDirection scrollDirection, - ASScrollDirection scrollableDirections, - CGPoint contentOffset, - CGPoint velocity, - BOOL flipsHorizontallyInOppositeLayoutDirection); - - -/** - @abstract Determine if batch fetching should begin based on the state of the parameters. - @param context The batch fetching context that contains knowledge about in-flight fetches. - @param scrollDirection The current scrolling direction of the scroll view. - @param scrollableDirections The possible scrolling directions of the scroll view. - @param bounds The bounds of the scrollview. - @param contentSize The content size of the scrollview. - @param targetOffset The offset that the scrollview will scroll to. - @param leadingScreens How many screens in the remaining distance will trigger batch fetching. - @param visible Whether the view is visible or not. - @param velocity The velocity of the scroll view (in points) at the moment the touch was released. - @param delegate The delegate to be consulted if needed. - @param flipsHorizontallyInOppositeLayoutDirection Whether or not this scroll view flips its layout automatically in RTL. - See flipsHorizontallyInOppositeLayoutDirection in UICollectionViewLayout - @return Whether or not the current state should proceed with batch fetching. - @discussion This method is broken into a category for unit testing purposes and should be used with the ASTableView and - * ASCollectionView batch fetching API. - */ -ASDK_EXTERN BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context, - ASScrollDirection scrollDirection, - ASScrollDirection scrollableDirections, - CGRect bounds, - CGSize contentSize, - CGPoint targetOffset, - CGFloat leadingScreens, - BOOL visible, - BOOL shouldRenderRTLLayout, - CGPoint velocity, - BOOL flipsHorizontallyInOppositeLayoutDirection, - _Nullable id delegate); - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASBatchFetching.mm b/Example/Pods/Texture/Source/Private/ASBatchFetching.mm deleted file mode 100644 index 49e8e62f..00000000 --- a/Example/Pods/Texture/Source/Private/ASBatchFetching.mm +++ /dev/null @@ -1,108 +0,0 @@ -// -// ASBatchFetching.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView *scrollView, - ASScrollDirection scrollDirection, - ASScrollDirection scrollableDirections, - CGPoint contentOffset, - CGPoint velocity, - BOOL flipsHorizontallyInOppositeLayoutDirection) -{ - // Don't fetch if the scroll view does not allow - if (![scrollView canBatchFetch]) { - return NO; - } - - // Check if we should batch fetch - ASBatchContext *context = scrollView.batchContext; - CGRect bounds = scrollView.bounds; - CGSize contentSize = scrollView.contentSize; - CGFloat leadingScreens = scrollView.leadingScreensForBatching; - id delegate = scrollView.batchFetchingDelegate; - BOOL visible = (scrollView.window != nil); - BOOL shouldRenderRTLLayout = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:scrollView.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft; - return ASDisplayShouldFetchBatchForContext(context, scrollDirection, scrollableDirections, bounds, contentSize, contentOffset, leadingScreens, visible, shouldRenderRTLLayout, velocity, flipsHorizontallyInOppositeLayoutDirection, delegate); -} - -BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context, - ASScrollDirection scrollDirection, - ASScrollDirection scrollableDirections, - CGRect bounds, - CGSize contentSize, - CGPoint targetOffset, - CGFloat leadingScreens, - BOOL visible, - BOOL shouldRenderRTLLayout, - CGPoint velocity, - BOOL flipsHorizontallyInOppositeLayoutDirection, - id delegate) -{ - // Do not allow fetching if a batch is already in-flight and hasn't been completed or cancelled - if ([context isFetching]) { - return NO; - } - - // No fetching for null states - if (leadingScreens <= 0.0 || CGRectIsEmpty(bounds)) { - return NO; - } - - - CGFloat viewLength, offset, contentLength, velocityLength; - if (ASScrollDirectionContainsVerticalDirection(scrollableDirections)) { - viewLength = bounds.size.height; - offset = targetOffset.y; - contentLength = contentSize.height; - velocityLength = velocity.y; - } else { // horizontal / right - viewLength = bounds.size.width; - offset = targetOffset.x; - contentLength = contentSize.width; - velocityLength = velocity.x; - } - - BOOL hasSmallContent = contentLength < viewLength; - if (hasSmallContent) { - return YES; - } - - // If we are not visible, but we do have enough content to fill visible area, - // don't batch fetch. - if (visible == NO) { - return NO; - } - - // If they are scrolling toward the head of content, don't batch fetch. - BOOL isScrollingTowardHead = (ASScrollDirectionContainsUp(scrollDirection) || (shouldRenderRTLLayout ? ASScrollDirectionContainsRight(scrollDirection) : ASScrollDirectionContainsLeft(scrollDirection))); - if (isScrollingTowardHead) { - return NO; - } - - CGFloat triggerDistance = viewLength * leadingScreens; - CGFloat remainingDistance = 0; - if (!flipsHorizontallyInOppositeLayoutDirection && shouldRenderRTLLayout && ASScrollDirectionContainsHorizontalDirection(scrollableDirections)) { - remainingDistance = offset; - } else { - remainingDistance = contentLength - viewLength - offset; - } - BOOL result = remainingDistance <= triggerDistance; - - if (delegate != nil && velocityLength > 0.0) { - // Don't need to get absolute value of remaining time - // because both remainingDistance and velocityLength are positive when scrolling toward tail - NSTimeInterval remainingTime = remainingDistance / (velocityLength * 1000); - result = [delegate shouldFetchBatchWithRemainingTime:remainingTime hint:result]; - } - - return result; -} diff --git a/Example/Pods/Texture/Source/Private/ASCellNode+Internal.h b/Example/Pods/Texture/Source/Private/ASCellNode+Internal.h deleted file mode 100644 index 0ec70ca0..00000000 --- a/Example/Pods/Texture/Source/Private/ASCellNode+Internal.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// ASCellNode+Internal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionElement; - -@protocol ASCellNodeInteractionDelegate - -/** - * Notifies the delegate that a specified cell node invalidates it's size what could result into a size change. - * - * @param node A node informing the delegate about the relayout. - */ -- (void)nodeDidInvalidateSize:(ASCellNode *)node; - -/* - * Methods to be called whenever the selection or highlight state changes - * on ASCellNode. UIKit internally stores these values to update reusable cells. - */ - -- (void)nodeSelectedStateDidChange:(ASCellNode *)node; -- (void)nodeHighlightedStateDidChange:(ASCellNode *)node; - -@end - -@interface ASCellNode () - -@property (nonatomic, weak) id interactionDelegate; - -/* - * Back-pointer to the containing scrollView instance, set only for visible cells. Used for Cell Visibility Event callbacks. - */ -@property (nonatomic, weak) UIScrollView *scrollView; - -- (void)__setSelectedFromUIKit:(BOOL)selected; -- (void)__setHighlightedFromUIKit:(BOOL)highlighted; - -/** - * @note This could be declared @c copy, but since this is only settable internally, we can ensure - * that it's always safe simply to retain it, and copy if needed. Since @c UICollectionViewLayoutAttributes - * is always mutable, @c copy is never "free" like it is for e.g. NSString. - */ -@property (nullable, nonatomic) UICollectionViewLayoutAttributes *layoutAttributes; - -@property (weak, nullable) ASCollectionElement *collectionElement; - -@property (nonatomic, readonly) BOOL shouldUseUIKitCell; - -@end - -@class ASWrapperCellNode; - -typedef CGSize (^ASSizeForItemBlock)(ASWrapperCellNode *node, CGSize collectionSize); -typedef UICollectionViewCell * _Nonnull(^ASCellForItemBlock)(ASWrapperCellNode *node); -typedef UICollectionReusableView * _Nonnull(^ASViewForSupplementaryBlock)(ASWrapperCellNode *node); - -@interface ASWrapperCellNode : ASCellNode - -@property (nonatomic, readonly) ASSizeForItemBlock sizeForItemBlock; -@property (nonatomic, readonly) ASCellForItemBlock cellForItemBlock; -@property (nonatomic, readonly) ASViewForSupplementaryBlock viewForSupplementaryBlock; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayout.h b/Example/Pods/Texture/Source/Private/ASCollectionLayout.h deleted file mode 100644 index c31114e6..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayout.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASCollectionLayout.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@protocol ASCollectionLayoutDelegate; -@class ASElementMap, ASCollectionLayout, ASCollectionNode; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionLayout : UICollectionViewLayout - -/** - * The collection node object currently using this layout object. - * - * @discussion The collection node object sets the value of this property when a new layout object is assigned to it. - * - * @discussion To get the truth on the current state of the collection, call methods on the collection node or the data source rather than the collection view because: - * 1. The view might not yet be allocated. - * 2. The collection node and data source are thread-safe. - */ -@property (nonatomic, weak) ASCollectionNode *collectionNode; - -@property (nonatomic, readonly) id layoutDelegate; - -/** - * Initializes with a layout delegate. - * - * @discussion For developers' convenience, the delegate is retained by this layout object, similar to UICollectionView retains its UICollectionViewLayout object. - * - * @discussion For simplicity, the delegate is read-only. If a new layout delegate is needed, construct a new layout object with that delegate and notify ASCollectionView about it. - * This ensures the underlying UICollectionView purges its cache and properly loads the new layout. - */ -- (instancetype)initWithLayoutDelegate:(id)layoutDelegate NS_DESIGNATED_INITIALIZER; - -- (instancetype)init __unavailable; - -- (instancetype)initWithCoder:(NSCoder *)aDecoder __unavailable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayout.mm b/Example/Pods/Texture/Source/Private/ASCollectionLayout.mm deleted file mode 100644 index e69baa48..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayout.mm +++ /dev/null @@ -1,396 +0,0 @@ -// -// ASCollectionLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -static const ASRangeTuningParameters kASDefaultMeasureRangeTuningParameters = { - .leadingBufferScreenfuls = 2.0, - .trailingBufferScreenfuls = 2.0 -}; - -static const ASScrollDirection kASStaticScrollDirection = (ASScrollDirectionRight | ASScrollDirectionDown); - -@interface ASCollectionLayout () { - ASCollectionLayoutCache *_layoutCache; - ASCollectionLayoutState *_layout; // Main thread only. - - struct { - unsigned int implementsAdditionalInfoForLayoutWithElements:1; - } _layoutDelegateFlags; -} - -@end - -@implementation ASCollectionLayout - -- (instancetype)initWithLayoutDelegate:(id)layoutDelegate -{ - self = [super init]; - if (self) { - ASDisplayNodeAssertNotNil(layoutDelegate, @"Collection layout delegate cannot be nil"); - _layoutDelegate = layoutDelegate; - _layoutDelegateFlags.implementsAdditionalInfoForLayoutWithElements = [layoutDelegate respondsToSelector:@selector(additionalInfoForLayoutWithElements:)]; - _layoutCache = [[ASCollectionLayoutCache alloc] init]; - } - return self; -} - -#pragma mark - ASDataControllerLayoutDelegate - -- (ASCollectionLayoutContext *)layoutContextWithElements:(ASElementMap *)elements -{ - ASDisplayNodeAssertMainThread(); - - Class layoutDelegateClass = [_layoutDelegate class]; - ASCollectionLayoutCache *layoutCache = _layoutCache; - ASCollectionNode *collectionNode = _collectionNode; - if (collectionNode == nil) { - return [[ASCollectionLayoutContext alloc] initWithViewportSize:CGSizeZero - initialContentOffset:CGPointZero - scrollableDirections:ASScrollDirectionNone - elements:[[ASElementMap alloc] init] - layoutDelegateClass:layoutDelegateClass - layoutCache:layoutCache - additionalInfo:nil]; - } - - ASScrollDirection scrollableDirections = [_layoutDelegate scrollableDirections]; - CGSize viewportSize = [ASCollectionLayout _viewportSizeForCollectionNode:collectionNode scrollableDirections:scrollableDirections]; - CGPoint contentOffset = collectionNode.contentOffset; - - id additionalInfo = nil; - if (_layoutDelegateFlags.implementsAdditionalInfoForLayoutWithElements) { - additionalInfo = [_layoutDelegate additionalInfoForLayoutWithElements:elements]; - } - - return [[ASCollectionLayoutContext alloc] initWithViewportSize:viewportSize - initialContentOffset:contentOffset - scrollableDirections:scrollableDirections - elements:elements - layoutDelegateClass:layoutDelegateClass - layoutCache:layoutCache - additionalInfo:additionalInfo]; -} - -+ (ASCollectionLayoutState *)calculateLayoutWithContext:(ASCollectionLayoutContext *)context -{ - if (context.elements == nil) { - return [[ASCollectionLayoutState alloc] initWithContext:context]; - } - - ASCollectionLayoutState *layout = [context.layoutDelegateClass calculateLayoutWithContext:context]; - [context.layoutCache setLayout:layout forContext:context]; - - // Measure elements in the measure range ahead of time - CGSize viewportSize = context.viewportSize; - CGPoint contentOffset = context.initialContentOffset; - CGRect initialRect = CGRectMake(contentOffset.x, contentOffset.y, viewportSize.width, viewportSize.height); - CGRect measureRect = CGRectExpandToRangeWithScrollableDirections(initialRect, - kASDefaultMeasureRangeTuningParameters, - context.scrollableDirections, - kASStaticScrollDirection); - // The first call to -layoutAttributesForElementsInRect: will be with a rect that is way bigger than initialRect here. - // If we only block on initialRect, a few elements that are outside of initialRect but inside measureRect - // may not be available by the time -layoutAttributesForElementsInRect: is called. - // Since this method is usually run off main, let's spawn more threads to measure and block on all elements in measureRect. - [self _measureElementsInRect:measureRect blockingRect:measureRect layout:layout]; - - return layout; -} - -#pragma mark - UICollectionViewLayout overrides - -- (void)prepareLayout -{ - ASDisplayNodeAssertMainThread(); - [super prepareLayout]; - - ASCollectionLayoutContext *context = [self layoutContextWithElements:_collectionNode.visibleElements]; - if (_layout != nil && ASObjectIsEqual(_layout.context, context)) { - // The existing layout is still valid. No-op - return; - } - - if (ASCollectionLayoutState *cachedLayout = [_layoutCache layoutForContext:context]) { - _layout = cachedLayout; - } else { - // A new layout is needed now. Calculate and apply it immediately - _layout = [ASCollectionLayout calculateLayoutWithContext:context]; - } -} - -- (void)invalidateLayout -{ - ASDisplayNodeAssertMainThread(); - [super invalidateLayout]; - if (_layout != nil) { - [_layoutCache removeLayoutForContext:_layout.context]; - _layout = nil; - } -} - -/** - * NOTE: It is suggested practice on the Web to override invalidationContextForInteractivelyMovingItems… and call out to the - * data source to move the item (so that if e.g. the item size depends on the data, you get the data you expect). However, as of iOS 11 this - * doesn't work, because UICV machinery will also call out to the data source to move the item after the interaction is done. The result is - * that your data source state will be incorrect due to this last move call. Plus it's just an API violation. - * - * Things tried: - * - Doing the speculative data source moves, and then UNDOING the last one in invalidationContextForEndingInteractiveMovementOfItems… - * but this does not work because the UICV machinery informs its data source before it calls that method on us, so we are too late. - * - * The correct practice is to use the UIDataSourceTranslating API introduced in iOS 11. Currently Texture does not support this API but we can - * build it if there is demand. We could add an id field onto the layout context object, and the layout client can - * use data source index paths when it reads nodes or other data source data. - */ - -- (CGSize)collectionViewContentSize -{ - ASDisplayNodeAssertMainThread(); - // The content size can be queried right after a layout invalidation (https://github.com/TextureGroup/Texture/pull/509). - // In that case, return zero. - return _layout ? _layout.contentSize : CGSizeZero; -} - -- (NSArray *)layoutAttributesForElementsInRect:(CGRect)blockingRect -{ - ASDisplayNodeAssertMainThread(); - if (CGRectIsEmpty(blockingRect)) { - return nil; - } - - // Measure elements in the measure range, block on the requested rect - CGRect measureRect = CGRectExpandToRangeWithScrollableDirections(blockingRect, - kASDefaultMeasureRangeTuningParameters, - _layout.context.scrollableDirections, - kASStaticScrollDirection); - [ASCollectionLayout _measureElementsInRect:measureRect blockingRect:blockingRect layout:_layout]; - - NSArray *result = [_layout layoutAttributesForElementsInRect:blockingRect]; - - ASElementMap *elements = _layout.context.elements; - for (UICollectionViewLayoutAttributes *attrs in result) { - ASCollectionElement *element = [elements elementForLayoutAttributes:attrs]; - ASCollectionLayoutSetSizeToElement(attrs.frame.size, element); - } - - return result; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASDisplayNodeAssertMainThread(); - - ASCollectionElement *element = [_layout.context.elements elementForItemAtIndexPath:indexPath]; - UICollectionViewLayoutAttributes *attrs = [_layout layoutAttributesForElement:element]; - - ASCellNode *node = element.node; - CGSize elementSize = attrs.frame.size; - if (! CGSizeEqualToSize(elementSize, node.calculatedSize)) { - [node layoutThatFits:ASCollectionLayoutElementSizeRangeFromSize(elementSize)]; - } - - ASCollectionLayoutSetSizeToElement(attrs.frame.size, element); - return attrs; -} - -- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath -{ - ASCollectionElement *element = [_layout.context.elements supplementaryElementOfKind:elementKind atIndexPath:indexPath]; - UICollectionViewLayoutAttributes *attrs = [_layout layoutAttributesForElement:element]; - - ASCellNode *node = element.node; - CGSize elementSize = attrs.frame.size; - if (! CGSizeEqualToSize(elementSize, node.calculatedSize)) { - [node layoutThatFits:ASCollectionLayoutElementSizeRangeFromSize(elementSize)]; - } - - ASCollectionLayoutSetSizeToElement(attrs.frame.size, element); - return attrs; -} - -- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds -{ - return (! CGSizeEqualToSize([ASCollectionLayout _boundsForCollectionNode:_collectionNode], newBounds.size)); -} - -#pragma mark - Private methods - -+ (CGSize)_boundsForCollectionNode:(nonnull ASCollectionNode *)collectionNode -{ - if (collectionNode == nil) { - return CGSizeZero; - } - - if (!collectionNode.isNodeLoaded) { - // TODO consider calculatedSize as well - return collectionNode.threadSafeBounds.size; - } - - ASDisplayNodeAssertMainThread(); - return collectionNode.view.bounds.size; -} - -+ (CGSize)_viewportSizeForCollectionNode:(nonnull ASCollectionNode *)collectionNode scrollableDirections:(ASScrollDirection)scrollableDirections -{ - if (collectionNode == nil) { - return CGSizeZero; - } - - CGSize result = [ASCollectionLayout _boundsForCollectionNode:collectionNode]; - // TODO: Consider using adjustedContentInset on iOS 11 and later, to include the safe area of the scroll view - UIEdgeInsets contentInset = collectionNode.contentInset; - if (ASScrollDirectionContainsHorizontalDirection(scrollableDirections)) { - result.height -= (contentInset.top + contentInset.bottom); - } else { - result.width -= (contentInset.left + contentInset.right); - } - return result; -} - -/** - * Measures all elements in the specified rect and blocks the calling thread while measuring those in the blocking rect. - */ -+ (void)_measureElementsInRect:(CGRect)rect blockingRect:(CGRect)blockingRect layout:(ASCollectionLayoutState *)layout -{ - if (CGRectIsEmpty(rect) || layout.context.elements == nil) { - return; - } - BOOL hasBlockingRect = !CGRectIsEmpty(blockingRect); - if (hasBlockingRect && CGRectContainsRect(rect, blockingRect) == NO) { - ASDisplayNodeCAssert(NO, @"Blocking rect, if specified, must be within the other (outer) rect"); - return; - } - - // Step 1: Clamp the specified rects between the bounds of content rect - CGSize contentSize = layout.contentSize; - CGRect contentRect = CGRectMake(0, 0, contentSize.width, contentSize.height); - rect = CGRectIntersection(contentRect, rect); - if (CGRectIsNull(rect)) { - return; - } - if (hasBlockingRect) { - blockingRect = CGRectIntersection(contentRect, blockingRect); - hasBlockingRect = !CGRectIsNull(blockingRect); - } - - // Step 2: Get layout attributes of all elements within the specified outer rect - ASPageToLayoutAttributesTable *attrsTable = [layout getAndRemoveUnmeasuredLayoutAttributesPageTableInRect:rect]; - if (attrsTable.count == 0) { - // No elements in this rect! Bail early - return; - } - - // Step 3: Split all those attributes into blocking and non-blocking buckets - // Use ordered sets here because some items may span multiple pages, and the sets will be accessed by indexes later on. - ASCollectionLayoutContext *context = layout.context; - CGSize pageSize = context.viewportSize; - NSMutableOrderedSet *blockingAttrs = hasBlockingRect ? [NSMutableOrderedSet orderedSet] : nil; - NSMutableOrderedSet *nonBlockingAttrs = [NSMutableOrderedSet orderedSet]; - for (id pagePtr in attrsTable) { - ASPageCoordinate page = (ASPageCoordinate)pagePtr; - NSArray *attrsInPage = [attrsTable objectForPage:page]; - // Calculate the page's rect but only if it's going to be used. - CGRect pageRect = hasBlockingRect ? ASPageCoordinateGetPageRect(page, pageSize) : CGRectZero; - - if (hasBlockingRect && CGRectContainsRect(blockingRect, pageRect)) { - // The page fits well within the blocking rect. All attributes in this page are blocking. - [blockingAttrs addObjectsFromArray:attrsInPage]; - } else if (hasBlockingRect && CGRectIntersectsRect(blockingRect, pageRect)) { - // The page intersects the blocking rect. Some elements in this page are blocking, some are not. - for (UICollectionViewLayoutAttributes *attrs in attrsInPage) { - if (CGRectIntersectsRect(blockingRect, attrs.frame)) { - [blockingAttrs addObject:attrs]; - } else { - [nonBlockingAttrs addObject:attrs]; - } - } - } else { - // The page doesn't intersect the blocking rect. All elements in this page are non-blocking. - [nonBlockingAttrs addObjectsFromArray:attrsInPage]; - } - } - - // Step 4: Allocate and measure blocking elements' node - ASElementMap *elements = context.elements; - dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - if (NSUInteger count = blockingAttrs.count) { - ASDispatchApply(count, queue, 0, ^(size_t i) { - UICollectionViewLayoutAttributes *attrs = blockingAttrs[i]; - ASCellNode *node; - if (attrs.representedElementKind == nil) { - node = [elements elementForItemAtIndexPath:attrs.indexPath].node; - } else { - node = [elements supplementaryElementOfKind:attrs.representedElementKind atIndexPath:attrs.indexPath].node; - } - CGSize expectedSize = attrs.frame.size; - if (! CGSizeEqualToSize(expectedSize, node.calculatedSize)) { - [node layoutThatFits:ASCollectionLayoutElementSizeRangeFromSize(expectedSize)]; - } - }); - } - - // Step 5: Allocate and measure non-blocking ones - if (NSUInteger count = nonBlockingAttrs.count) { - __weak ASElementMap *weakElements = elements; - ASDispatchAsync(count, queue, 0, ^(size_t i) { - __strong ASElementMap *strongElements = weakElements; - if (strongElements) { - UICollectionViewLayoutAttributes *attrs = nonBlockingAttrs[i]; - ASCellNode *node; - if (attrs.representedElementKind == nil) { - node = [elements elementForItemAtIndexPath:attrs.indexPath].node; - } else { - node = [elements supplementaryElementOfKind:attrs.representedElementKind atIndexPath:attrs.indexPath].node; - } - CGSize expectedSize = attrs.frame.size; - if (! CGSizeEqualToSize(expectedSize, node.calculatedSize)) { - [node layoutThatFits:ASCollectionLayoutElementSizeRangeFromSize(expectedSize)]; - } - } - }); - } -} - -# pragma mark - Convenient inline functions - -ASDISPLAYNODE_INLINE ASSizeRange ASCollectionLayoutElementSizeRangeFromSize(CGSize size) -{ - // The layout delegate consulted us that this element must fit within this size, - // and the only way to achieve that without asking it again is to use an exact size range here. - return ASSizeRangeMake(size); -} - -ASDISPLAYNODE_INLINE void ASCollectionLayoutSetSizeToElement(CGSize size, ASCollectionElement *element) -{ - if (ASCellNode *node = element.node) { - if (! CGSizeEqualToSize(size, node.frame.size)) { - CGRect frame = CGRectZero; - frame.size = size; - node.frame = frame; - } - } -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.h b/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.h deleted file mode 100644 index 3efad85d..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ASCollectionLayoutCache.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionLayoutContext, ASCollectionLayoutState; - -/// A thread-safe cache for ASCollectionLayoutContext-ASCollectionLayoutState pairs -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionLayoutCache : NSObject - -- (nullable ASCollectionLayoutState *)layoutForContext:(ASCollectionLayoutContext *)context; - -- (void)setLayout:(ASCollectionLayoutState *)layout forContext:(ASCollectionLayoutContext *)context; - -- (void)removeLayoutForContext:(ASCollectionLayoutContext *)context; - -- (void)removeAllLayouts; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.mm b/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.mm deleted file mode 100644 index a5d6d111..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutCache.mm +++ /dev/null @@ -1,88 +0,0 @@ -// -// ASCollectionLayoutCache.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -using AS::MutexLocker; - -@implementation ASCollectionLayoutCache { - AS::Mutex __instanceLock__; - - /** - * The underlying data structure of this cache. - * - * The outer map table is a weak to strong table. That is because ASCollectionLayoutContext doesn't (and shouldn't) - * hold a strong reference on its element map. As a result, this cache should handle the case in which - * an element map no longer exists and all contexts and layouts associated with it should be cleared. - * - * The inner map table is a standard strong to strong map. - * Since different ASCollectionLayoutContext objects with the same content are considered equal, - * "object pointer personality" can't be used as a key option. - */ - NSMapTable *> *_map; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _map = [NSMapTable mapTableWithKeyOptions:(NSMapTableWeakMemory | NSMapTableObjectPointerPersonality) valueOptions:NSMapTableStrongMemory]; - } - return self; -} - -- (ASCollectionLayoutState *)layoutForContext:(ASCollectionLayoutContext *)context -{ - ASElementMap *elements = context.elements; - if (elements == nil) { - return nil; - } - - MutexLocker l(__instanceLock__); - return [[_map objectForKey:elements] objectForKey:context]; -} - -- (void)setLayout:(ASCollectionLayoutState *)layout forContext:(ASCollectionLayoutContext *)context -{ - ASElementMap *elements = context.elements; - if (layout == nil || elements == nil) { - return; - } - - MutexLocker l(__instanceLock__); - auto innerMap = [_map objectForKey:elements]; - if (innerMap == nil) { - innerMap = [NSMapTable strongToStrongObjectsMapTable]; - [_map setObject:innerMap forKey:elements]; - } - [innerMap setObject:layout forKey:context]; -} - -- (void)removeLayoutForContext:(ASCollectionLayoutContext *)context -{ - ASElementMap *elements = context.elements; - if (elements == nil) { - return; - } - - MutexLocker l(__instanceLock__); - [[_map objectForKey:elements] removeObjectForKey:context]; -} - -- (void)removeAllLayouts -{ - MutexLocker l(__instanceLock__); - [_map removeAllObjects]; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutContext+Private.h b/Example/Pods/Texture/Source/Private/ASCollectionLayoutContext+Private.h deleted file mode 100644 index 12e1d9db..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutContext+Private.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASCollectionLayoutContext+Private.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASCollectionLayoutCache; -@protocol ASCollectionLayoutDelegate; - -NS_ASSUME_NONNULL_BEGIN - -@interface ASCollectionLayoutContext (Private) - -@property (nonatomic, readonly) Class layoutDelegateClass; -@property (nonatomic, weak, readonly) ASCollectionLayoutCache *layoutCache; - -- (instancetype)initWithViewportSize:(CGSize)viewportSize - initialContentOffset:(CGPoint)initialContentOffset - scrollableDirections:(ASScrollDirection)scrollableDirections - elements:(ASElementMap *)elements - layoutDelegateClass:(Class)layoutDelegateClass - layoutCache:(ASCollectionLayoutCache *)layoutCache - additionalInfo:(nullable id)additionalInfo; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.h b/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.h deleted file mode 100644 index 6c7ff9d9..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASCollectionLayoutDefines.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT; - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.mm b/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.mm deleted file mode 100644 index e386575c..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutDefines.mm +++ /dev/null @@ -1,23 +0,0 @@ -// -// ASCollectionLayoutDefines.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) -{ - ASSizeRange sizeRange = ASSizeRangeUnconstrained; - if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) { - sizeRange.min.height = viewportSize.height; - sizeRange.max.height = viewportSize.height; - } - if (ASScrollDirectionContainsHorizontalDirection(scrollableDirections) == NO) { - sizeRange.min.width = viewportSize.width; - sizeRange.max.width = viewportSize.width; - } - return sizeRange; -} diff --git a/Example/Pods/Texture/Source/Private/ASCollectionLayoutState+Private.h b/Example/Pods/Texture/Source/Private/ASCollectionLayoutState+Private.h deleted file mode 100644 index c964cf39..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionLayoutState+Private.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// ASCollectionLayoutState+Private.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASCollectionLayoutState (Private) - -/** - * Remove and returns layout attributes for unmeasured elements that intersect the specified rect - * - * @discussion This method is atomic and thread-safe - */ -- (nullable ASPageToLayoutAttributesTable *)getAndRemoveUnmeasuredLayoutAttributesPageTableInRect:(CGRect)rect; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionView+Undeprecated.h b/Example/Pods/Texture/Source/Private/ASCollectionView+Undeprecated.h deleted file mode 100644 index 0a9e0d96..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionView+Undeprecated.h +++ /dev/null @@ -1,300 +0,0 @@ -// -// ASCollectionView+Undeprecated.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Currently our public collection API is on @c ASCollectionNode and the @c ASCollectionView - * API is deprecated, but the implementations still live in the view. - * - * This category lets us avoid deprecation warnings everywhere internally. - * In the future, the @c ASCollectionView public API will be eliminated and so will this file. - */ -@interface ASCollectionView (Undeprecated) - -/** - * The object that acts as the asynchronous delegate of the collection view - * - * @discussion The delegate must adopt the ASCollectionDelegate protocol. The collection view maintains a weak reference to the delegate object. - * - * The delegate object is responsible for providing size constraints for nodes and indicating whether batch fetching should begin. - */ -@property (nonatomic, weak) id asyncDelegate; - -/** - * The object that acts as the asynchronous data source of the collection view - * - * @discussion The datasource must adopt the ASCollectionDataSource protocol. The collection view maintains a weak reference to the datasource object. - * - * The datasource object is responsible for providing nodes or node creation blocks to the collection view. - */ -@property (nonatomic, weak) id asyncDataSource; - -/** - * Initializes an ASCollectionView - * - * @discussion Initializes and returns a newly allocated collection view object with the specified layout. - * - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout; - -/** - * Initializes an ASCollectionView - * - * @discussion Initializes and returns a newly allocated collection view object with the specified frame and layout. - * - * @param frame The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization. - * @param layout The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be nil. - */ -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout; - -@property (nonatomic) CGFloat leadingScreensForBatching; - -@property (nonatomic) BOOL inverted; - -@property (nonatomic, readonly) ASScrollDirection scrollDirection; - -@property (nonatomic, readonly) ASScrollDirection scrollableDirections; - -@property (nonatomic, weak) id layoutInspector; - -@property (nonatomic) UIEdgeInsets contentInset; - -@property (nonatomic) CGPoint contentOffset; - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType; - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -- (nullable __kindof UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath; - -@property (nonatomic, readonly) NSArray *indexPathsForVisibleItems; - -@property (nonatomic, readonly, nullable) NSArray *indexPathsForSelectedItems; - -/** - * Scrolls the collection to the given item. - * - * @param indexPath The index path of the item. - * @param scrollPosition Where the row should end up after the scroll. - * @param animated Whether the scroll should be animated or not. - */ -- (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated; - -- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition; - -/** - * Perform a batch of updates asynchronously, optionally disabling all animations in the batch. This method must be called from the main thread. - * The asyncDataSource must be updated to reflect the changes before the update block completes. - * - * @param animated NO to disable animations for this batch - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchAnimated:(BOOL)animated updates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Perform a batch of updates asynchronously. This method must be called from the main thread. - * The asyncDataSource must be updated to reflect the changes before update block completes. - * - * @param updates The block that performs the relevant insert, delete, reload, or move operations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)performBatchUpdates:(nullable AS_NOESCAPE void (^)(void))updates completion:(nullable void (^)(BOOL finished))completion; - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the collection. - */ -- (void)relayoutItems; - -/** - * Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread. - */ -- (void)waitUntilAllUpdatesAreCommitted; - -/** - * Registers the given kind of supplementary node for use in creating node-backed supplementary views. - * - * @param elementKind The kind of supplementary node that will be requested through the data source. - * - * @discussion Use this method to register support for the use of supplementary nodes in place of the default - * `registerClass:forSupplementaryViewOfKind:withReuseIdentifier:` and `registerNib:forSupplementaryViewOfKind:withReuseIdentifier:` - * methods. This method will register an internal backing view that will host the contents of the supplementary nodes - * returned from the data source. - */ -- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind; - -/** - * Inserts one or more sections. - * - * @param sections An index set that specifies the sections to insert. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertSections:(NSIndexSet *)sections; - -/** - * Deletes one or more sections. - * - * @param sections An index set that specifies the sections to delete. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteSections:(NSIndexSet *)sections; - -/** - * Reloads the specified sections. - * - * @param sections An index set that specifies the sections to reload. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadSections:(NSIndexSet *)sections; - -/** - * Moves a section to a new location. - * - * @param section The index of the section to move. - * - * @param newSection The index that is the destination of the move for the section. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; - -/** - * Inserts items at the locations identified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects, each representing an item index and section index that together identify an item. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Deletes the items specified by an array of index paths. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to delete. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Reloads the specified items. - * - * @param indexPaths An array of NSIndexPath objects identifying the items to reload. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; - -/** - * Moves the item at a specified location to a destination location. - * - * @param indexPath The index path identifying the item to move. - * - * @param newIndexPath The index path that is the destination of the move for the item. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - -/** - * Similar to -visibleCells. - * - * @return an array containing the nodes being displayed on screen. - */ -- (NSArray<__kindof ASCellNode *> *)visibleNodes AS_WARN_UNUSED_RESULT; - -/** - * Similar to -indexPathForCell:. - * - * @param cellNode a cellNode in the collection view - * - * @return The index path for this cell node. - * - * @discussion This index path returned by this method is in the _view's_ index space - * and should only be used with @c ASCollectionView directly. To get an index path suitable - * for use with your data source and @c ASCollectionNode, call @c indexPathForNode: on the - * collection node instead. - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; - -/** - * Invalidates and recalculates the cached sizes stored for pass-through cells used in interop mode. - */ -- (void)invalidateFlowLayoutDelegateMetrics; - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.h b/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.h deleted file mode 100644 index 0272da15..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ASCollectionViewFlowLayoutInspector.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASCollectionView; -@class UICollectionViewFlowLayout; - -/** - * A layout inspector implementation specific for the sizing behavior of UICollectionViewFlowLayouts - */ -AS_SUBCLASSING_RESTRICTED -@interface ASCollectionViewFlowLayoutInspector : NSObject - -@property (nonatomic, weak, readonly) UICollectionViewFlowLayout *layout; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithFlowLayout:(UICollectionViewFlowLayout *)flowLayout NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.mm b/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.mm deleted file mode 100644 index 7e35a396..00000000 --- a/Example/Pods/Texture/Source/Private/ASCollectionViewFlowLayoutInspector.mm +++ /dev/null @@ -1,156 +0,0 @@ -// -// ASCollectionViewFlowLayoutInspector.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -#define kDefaultItemSize CGSizeMake(50, 50) - -#pragma mark - ASCollectionViewFlowLayoutInspector - -@interface ASCollectionViewFlowLayoutInspector () -@property (nonatomic, weak) UICollectionViewFlowLayout *layout; -@end - -@implementation ASCollectionViewFlowLayoutInspector { - struct { - unsigned int implementsSizeRangeForHeader:1; - unsigned int implementsReferenceSizeForHeader:1; - unsigned int implementsSizeRangeForFooter:1; - unsigned int implementsReferenceSizeForFooter:1; - unsigned int implementsConstrainedSizeForNodeAtIndexPathDeprecated:1; - unsigned int implementsConstrainedSizeForItemAtIndexPath:1; - } _delegateFlags; -} - -#pragma mark Lifecycle - -- (instancetype)initWithFlowLayout:(UICollectionViewFlowLayout *)flowLayout -{ - NSParameterAssert(flowLayout); - - self = [super init]; - if (self != nil) { - _layout = flowLayout; - } - return self; -} - -#pragma mark ASCollectionViewLayoutInspecting - -- (void)didChangeCollectionViewDelegate:(id)delegate -{ - if (delegate == nil) { - memset(&_delegateFlags, 0, sizeof(_delegateFlags)); - } else { - _delegateFlags.implementsSizeRangeForHeader = [delegate respondsToSelector:@selector(collectionNode:sizeRangeForHeaderInSection:)]; - _delegateFlags.implementsReferenceSizeForHeader = [delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForHeaderInSection:)]; - _delegateFlags.implementsSizeRangeForFooter = [delegate respondsToSelector:@selector(collectionNode:sizeRangeForFooterInSection:)]; - _delegateFlags.implementsReferenceSizeForFooter = [delegate respondsToSelector:@selector(collectionView:layout:referenceSizeForFooterInSection:)]; - _delegateFlags.implementsConstrainedSizeForNodeAtIndexPathDeprecated = [delegate respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)]; - _delegateFlags.implementsConstrainedSizeForItemAtIndexPath = [delegate respondsToSelector:@selector(collectionNode:constrainedSizeForItemAtIndexPath:)]; - } -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath -{ - ASSizeRange result = ASSizeRangeUnconstrained; - if (_delegateFlags.implementsConstrainedSizeForItemAtIndexPath) { - result = [collectionView.asyncDelegate collectionNode:collectionView.collectionNode constrainedSizeForItemAtIndexPath:indexPath]; - } else if (_delegateFlags.implementsConstrainedSizeForNodeAtIndexPathDeprecated) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - result = [collectionView.asyncDelegate collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]; -#pragma clang diagnostic pop - } else { - // With 2.0 `collectionView:constrainedSizeForNodeAtIndexPath:` was moved to the delegate. Assert if not implemented on the delegate but on the data source - ASDisplayNodeAssert([collectionView.asyncDataSource respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)] == NO, @"collectionView:constrainedSizeForNodeAtIndexPath: was moved from the ASCollectionDataSource to the ASCollectionDelegate."); - } - - // If we got no size range: - if (ASSizeRangeEqualToSizeRange(result, ASSizeRangeUnconstrained)) { - // Use itemSize if they set it. - CGSize itemSize = _layout.itemSize; - if (CGSizeEqualToSize(itemSize, kDefaultItemSize) == NO) { - result = ASSizeRangeMake(itemSize, itemSize); - } else { - // Compute constraint from scroll direction otherwise. - result = NodeConstrainedSizeForScrollDirection(collectionView); - } - } - - return result; -} - -- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForSupplementaryNodeOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - ASSizeRange result = ASSizeRangeZero; - if (ASObjectIsEqual(kind, UICollectionElementKindSectionHeader)) { - if (_delegateFlags.implementsSizeRangeForHeader) { - result = [[self delegateForCollectionView:collectionView] collectionNode:collectionView.collectionNode sizeRangeForHeaderInSection:indexPath.section]; - } else if (_delegateFlags.implementsReferenceSizeForHeader) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CGSize exactSize = [[self delegateForCollectionView:collectionView] collectionView:collectionView layout:_layout referenceSizeForHeaderInSection:indexPath.section]; -#pragma clang diagnostic pop - result = ASSizeRangeMake(exactSize); - } else { - result = ASSizeRangeMake(_layout.headerReferenceSize); - } - } else if (ASObjectIsEqual(kind, UICollectionElementKindSectionFooter)) { - if (_delegateFlags.implementsSizeRangeForFooter) { - result = [[self delegateForCollectionView:collectionView] collectionNode:collectionView.collectionNode sizeRangeForFooterInSection:indexPath.section]; - } else if (_delegateFlags.implementsReferenceSizeForFooter) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CGSize exactSize = [[self delegateForCollectionView:collectionView] collectionView:collectionView layout:_layout referenceSizeForFooterInSection:indexPath.section]; -#pragma clang diagnostic pop - result = ASSizeRangeMake(exactSize); - } else { - result = ASSizeRangeMake(_layout.footerReferenceSize); - } - } else { - ASDisplayNodeFailAssert(@"Unexpected supplementary kind: %@", kind); - return ASSizeRangeZero; - } - - if (_layout.scrollDirection == UICollectionViewScrollDirectionVertical) { - result.min.width = result.max.width = CGRectGetWidth(collectionView.bounds); - } else { - result.min.height = result.max.height = CGRectGetHeight(collectionView.bounds); - } - return result; -} - -- (NSUInteger)collectionView:(ASCollectionView *)collectionView supplementaryNodesOfKind:(NSString *)kind inSection:(NSUInteger)section -{ - ASSizeRange constraint = [self collectionView:collectionView constrainedSizeForSupplementaryNodeOfKind:kind atIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]; - if (_layout.scrollDirection == UICollectionViewScrollDirectionVertical) { - return (constraint.max.height > 0 ? 1 : 0); - } else { - return (constraint.max.width > 0 ? 1 : 0); - } -} - -- (ASScrollDirection)scrollableDirections -{ - return (self.layout.scrollDirection == UICollectionViewScrollDirectionHorizontal) ? ASScrollDirectionHorizontalDirections : ASScrollDirectionVerticalDirections; -} - -#pragma mark - Private helpers - -- (id)delegateForCollectionView:(ASCollectionView *)collectionView -{ - return (id)collectionView.asyncDelegate; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASControlNode+Private.h b/Example/Pods/Texture/Source/Private/ASControlNode+Private.h deleted file mode 100644 index 02f54a20..00000000 --- a/Example/Pods/Texture/Source/Private/ASControlNode+Private.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ASControlNode+Private.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASControlNode (Private) - -#if TARGET_OS_TV -- (void)_pressDown; -#endif - -@end diff --git a/Example/Pods/Texture/Source/Private/ASControlTargetAction.h b/Example/Pods/Texture/Source/Private/ASControlTargetAction.h deleted file mode 100644 index 5a3595c5..00000000 --- a/Example/Pods/Texture/Source/Private/ASControlTargetAction.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASControlTargetAction.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -/** - @abstract ASControlTargetAction stores target action pairs registered for specific ASControlNodeEvent values. - */ -@interface ASControlTargetAction : NSObject - -/** - The action to be called on the registered target. - */ -@property (nonatomic) SEL action; - -/** - Event handler target. The specified action will be called on this object. - */ -@property (nonatomic, weak) id target; - -/** - Indicated whether this target was created without a target, so the action should travel up in the responder chain. - */ -@property (nonatomic, readonly) BOOL createdWithNoTarget; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASControlTargetAction.mm b/Example/Pods/Texture/Source/Private/ASControlTargetAction.mm deleted file mode 100644 index 41cc1133..00000000 --- a/Example/Pods/Texture/Source/Private/ASControlTargetAction.mm +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASControlTargetAction.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation ASControlTargetAction -{ - __weak id _target; - BOOL _createdWithNoTarget; -} - -- (void)setTarget:(id)target { - _target = target; - - if (!target) { - _createdWithNoTarget = YES; - } -} - -- (id)target { - return _target; -} - -- (BOOL)isEqual:(id)object { - if (![object isKindOfClass:[ASControlTargetAction class]]) { - return NO; - } - - ASControlTargetAction *otherObject = (ASControlTargetAction *)object; - - BOOL areTargetsEqual; - - if (self.target != nil && otherObject.target != nil && self.target == otherObject.target) { - areTargetsEqual = YES; - } - else if (self.target == nil && otherObject.target == nil && self.createdWithNoTarget && otherObject.createdWithNoTarget) { - areTargetsEqual = YES; - } - else { - areTargetsEqual = NO; - } - - if (!areTargetsEqual) { - return NO; - } - - if (self.action && otherObject.action && self.action == otherObject.action) { - return YES; - } - else { - return NO; - } -} - -- (NSUInteger)hash { - return [self.target hash]; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.h b/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.h deleted file mode 100644 index e3bc1524..00000000 --- a/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ASDefaultPlayButton.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASDefaultPlayButton : ASButtonNode - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.mm b/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.mm deleted file mode 100644 index 589bda90..00000000 --- a/Example/Pods/Texture/Source/Private/ASDefaultPlayButton.mm +++ /dev/null @@ -1,66 +0,0 @@ -// -// ASDefaultPlayButton.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASDefaultPlayButton - -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - self.opaque = NO; - - return self; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(id)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - CGFloat originX = bounds.size.width/4; - CGRect buttonBounds = CGRectMake(originX, bounds.size.height/4, bounds.size.width/2, bounds.size.height/2); - CGFloat widthHeight = buttonBounds.size.width; - - //When the video isn't a square, the lower bound should be used to figure out the circle size - if (bounds.size.width < bounds.size.height) { - widthHeight = bounds.size.width/2; - originX = (bounds.size.width - widthHeight)/2; - buttonBounds = CGRectMake(originX, (bounds.size.height - widthHeight)/2, widthHeight, widthHeight); - } - if (bounds.size.width > bounds.size.height) { - widthHeight = bounds.size.height/2; - originX = (bounds.size.width - widthHeight)/2; - buttonBounds = CGRectMake(originX, (bounds.size.height - widthHeight)/2, widthHeight, widthHeight); - } - - CGContextRef context = UIGraphicsGetCurrentContext(); - - // Circle Drawing - UIBezierPath *ovalPath = [UIBezierPath bezierPathWithOvalInRect: buttonBounds]; - [[UIColor colorWithWhite:0.0 alpha:0.5] setFill]; - [ovalPath fill]; - - // Triangle Drawing - CGContextSaveGState(context); - - UIBezierPath *trianglePath = [UIBezierPath bezierPath]; - [trianglePath moveToPoint:CGPointMake(originX + widthHeight/3, bounds.size.height/4 + (bounds.size.height/2)/4)]; - [trianglePath addLineToPoint:CGPointMake(originX + widthHeight/3, bounds.size.height - bounds.size.height/4 - (bounds.size.height/2)/4)]; - [trianglePath addLineToPoint:CGPointMake(bounds.size.width - originX - widthHeight/4, bounds.size.height/2)]; - - [trianglePath closePath]; - [[UIColor colorWithWhite:0.9 alpha:0.9] setFill]; - [trianglePath fill]; - - CGContextRestoreGState(context); -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.h b/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.h deleted file mode 100644 index ae7e245d..00000000 --- a/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASDefaultPlaybackButton.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -typedef NS_ENUM(NSInteger, ASDefaultPlaybackButtonType) { - ASDefaultPlaybackButtonTypePlay, - ASDefaultPlaybackButtonTypePause -}; - -@interface ASDefaultPlaybackButton : ASControlNode -@property (nonatomic) ASDefaultPlaybackButtonType buttonType; -@end diff --git a/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.mm b/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.mm deleted file mode 100644 index deda7e87..00000000 --- a/Example/Pods/Texture/Source/Private/ASDefaultPlaybackButton.mm +++ /dev/null @@ -1,84 +0,0 @@ -// -// ASDefaultPlaybackButton.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@interface ASDefaultPlaybackButton() -{ - ASDefaultPlaybackButtonType _buttonType; -} -@end - -@implementation ASDefaultPlaybackButton -- (instancetype)init -{ - if (!(self = [super init])) { - return nil; - } - - self.opaque = NO; - - return self; -} - -- (void)setButtonType:(ASDefaultPlaybackButtonType)buttonType -{ - ASDefaultPlaybackButtonType oldType = _buttonType; - _buttonType = buttonType; - - if (oldType != _buttonType) { - [self setNeedsDisplay]; - } -} - -- (nullable NSDictionary *)drawParametersForAsyncLayer:(_ASDisplayLayer *)layer -{ - return @{ - @"buttonType" : @(self.buttonType), - @"color" : self.tintColor - }; -} - -+ (void)drawRect:(CGRect)bounds withParameters:(NSDictionary *)parameters isCancelled:(asdisplaynode_iscancelled_block_t)isCancelledBlock isRasterizing:(BOOL)isRasterizing -{ - ASDefaultPlaybackButtonType buttonType = (ASDefaultPlaybackButtonType)[parameters[@"buttonType"] intValue]; - UIColor *color = parameters[@"color"]; - - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSaveGState(context); - UIBezierPath* bezierPath = [UIBezierPath bezierPath]; - if (buttonType == ASDefaultPlaybackButtonTypePlay) { - [bezierPath moveToPoint: CGPointMake(0, 0)]; - [bezierPath addLineToPoint: CGPointMake(0, bounds.size.height)]; - [bezierPath addLineToPoint: CGPointMake(bounds.size.width, bounds.size.height/2)]; - [bezierPath addLineToPoint: CGPointMake(0, 0)]; - [bezierPath closePath]; - } else if (buttonType == ASDefaultPlaybackButtonTypePause) { - CGFloat pauseSingleLineWidth = bounds.size.width / 3.0; - [bezierPath moveToPoint: CGPointMake(0, bounds.size.height)]; - [bezierPath addLineToPoint: CGPointMake(pauseSingleLineWidth, bounds.size.height)]; - [bezierPath addLineToPoint: CGPointMake(pauseSingleLineWidth, 0)]; - [bezierPath addLineToPoint: CGPointMake(0, 0)]; - [bezierPath addLineToPoint: CGPointMake(0, bounds.size.height)]; - [bezierPath closePath]; - [bezierPath moveToPoint: CGPointMake(pauseSingleLineWidth * 2, 0)]; - [bezierPath addLineToPoint: CGPointMake(pauseSingleLineWidth * 2, bounds.size.height)]; - [bezierPath addLineToPoint: CGPointMake(bounds.size.width, bounds.size.height)]; - [bezierPath addLineToPoint: CGPointMake(bounds.size.width, 0)]; - [bezierPath addLineToPoint: CGPointMake(pauseSingleLineWidth * 2, 0)]; - [bezierPath closePath]; - } - - [color setFill]; - [bezierPath fill]; - - CGContextRestoreGState(context); -} -@end diff --git a/Example/Pods/Texture/Source/Private/ASDispatch.h b/Example/Pods/Texture/Source/Private/ASDispatch.h deleted file mode 100644 index 6ef5a8c9..00000000 --- a/Example/Pods/Texture/Source/Private/ASDispatch.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// ASDispatch.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -/** - * Like dispatch_apply, but you can set the thread count. 0 means letting dispatch_apply determine it. - * - * Note: The actual number of threads may be lower than threadCount, if libdispatch - * decides the system can't handle it. In reality this rarely happens. - */ -ASDK_EXTERN void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); - -/** - * Like dispatch_async, but you can set the thread count. 0 means 2*active CPUs. - * - * Note: The actual number of threads may be lower than threadCount, if libdispatch - * decides the system can't handle it. In reality this rarely happens. - */ -ASDK_EXTERN void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); diff --git a/Example/Pods/Texture/Source/Private/ASDispatch.mm b/Example/Pods/Texture/Source/Private/ASDispatch.mm deleted file mode 100644 index b82032da..00000000 --- a/Example/Pods/Texture/Source/Private/ASDispatch.mm +++ /dev/null @@ -1,47 +0,0 @@ -// -// ASDispatch.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -// Prefer C atomics in this file because ObjC blocks can't capture C++ atomics well. -#import - -void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)) { - if (threadCount == 0) { - dispatch_apply(iterationCount, queue, work); - } else { - dispatch_group_t group = dispatch_group_create(); - __block atomic_size_t counter = ATOMIC_VAR_INIT(0); - for (NSUInteger t = 0; t < threadCount; t++) { - dispatch_group_async(group, queue, ^{ - size_t i; - while ((i = atomic_fetch_add(&counter, 1)) < iterationCount) { - work(i); - } - }); - } - dispatch_group_wait(group, DISPATCH_TIME_FOREVER); - } -}; - -void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)) { - if (threadCount == 0) { - threadCount = NSProcessInfo.processInfo.activeProcessorCount * 2; - } - __block atomic_size_t counter = ATOMIC_VAR_INIT(0); - for (NSUInteger t = 0; t < threadCount; t++) { - dispatch_async(queue, ^{ - size_t i; - while ((i = atomic_fetch_add(&counter, 1)) < iterationCount) { - work(i); - } - }); - } -}; - diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNode+AsyncDisplay.mm b/Example/Pods/Texture/Source/Private/ASDisplayNode+AsyncDisplay.mm deleted file mode 100644 index c4ea0a20..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNode+AsyncDisplay.mm +++ /dev/null @@ -1,494 +0,0 @@ -// -// ASDisplayNode+AsyncDisplay.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -using AS::MutexLocker; - -@interface ASDisplayNode () <_ASDisplayLayerDelegate> -@end - -@implementation ASDisplayNode (AsyncDisplay) - -#if ASDISPLAYNODE_DELAY_DISPLAY - #define ASDN_DELAY_FOR_DISPLAY() usleep( (long)(0.1 * USEC_PER_SEC) ) -#else - #define ASDN_DELAY_FOR_DISPLAY() -#endif - -#define CHECK_CANCELLED_AND_RETURN_NIL(expr) if (isCancelledBlock()) { \ - expr; \ - return nil; \ - } \ - -- (NSObject *)drawParameters -{ - __instanceLock__.lock(); - BOOL implementsDrawParameters = _flags.implementsDrawParameters; - __instanceLock__.unlock(); - - if (implementsDrawParameters) { - return [self drawParametersForAsyncLayer:self.asyncLayer]; - } else { - return nil; - } -} - -- (void)_recursivelyRasterizeSelfAndSublayersWithIsCancelledBlock:(asdisplaynode_iscancelled_block_t)isCancelledBlock displayBlocks:(NSMutableArray *)displayBlocks -{ - // Skip subtrees that are hidden or zero alpha. - if (self.isHidden || self.alpha <= 0.0) { - return; - } - - __instanceLock__.lock(); - BOOL rasterizingFromAscendent = (_hierarchyState & ASHierarchyStateRasterized); - __instanceLock__.unlock(); - - // if super node is rasterizing descendants, subnodes will not have had layout calls because they don't have layers - if (rasterizingFromAscendent) { - [self __layout]; - } - - // Capture these outside the display block so they are retained. - UIColor *backgroundColor = self.backgroundColor; - CGRect bounds = self.bounds; - CGFloat cornerRadius = self.cornerRadius; - BOOL clipsToBounds = self.clipsToBounds; - - CGRect frame; - - // If this is the root container node, use a frame with a zero origin to draw into. If not, calculate the correct frame using the node's position, transform and anchorPoint. - if (self.rasterizesSubtree) { - frame = CGRectMake(0.0f, 0.0f, bounds.size.width, bounds.size.height); - } else { - CGPoint position = self.position; - CGPoint anchorPoint = self.anchorPoint; - - // Pretty hacky since full 3D transforms aren't actually supported, but attempt to compute the transformed frame of this node so that we can composite it into approximately the right spot. - CGAffineTransform transform = CATransform3DGetAffineTransform(self.transform); - CGSize scaledBoundsSize = CGSizeApplyAffineTransform(bounds.size, transform); - CGPoint origin = CGPointMake(position.x - scaledBoundsSize.width * anchorPoint.x, - position.y - scaledBoundsSize.height * anchorPoint.y); - frame = CGRectMake(origin.x, origin.y, bounds.size.width, bounds.size.height); - } - - // Get the display block for this node. - asyncdisplaykit_async_transaction_operation_block_t displayBlock = [self _displayBlockWithAsynchronous:NO isCancelledBlock:isCancelledBlock rasterizing:YES]; - - // We'll display something if there is a display block, clipping, translation and/or a background color. - BOOL shouldDisplay = displayBlock || backgroundColor || CGPointEqualToPoint(CGPointZero, frame.origin) == NO || clipsToBounds; - - // If we should display, then push a transform, draw the background color, and draw the contents. - // The transform is popped in a block added after the recursion into subnodes. - if (shouldDisplay) { - dispatch_block_t pushAndDisplayBlock = ^{ - // Push transform relative to parent. - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSaveGState(context); - - CGContextTranslateCTM(context, frame.origin.x, frame.origin.y); - - //support cornerRadius - if (rasterizingFromAscendent && clipsToBounds) { - if (cornerRadius) { - [[UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:cornerRadius] addClip]; - } else { - CGContextClipToRect(context, bounds); - } - } - - // Fill background if any. - CGColorRef backgroundCGColor = backgroundColor.CGColor; - if (backgroundColor && CGColorGetAlpha(backgroundCGColor) > 0.0) { - CGContextSetFillColorWithColor(context, backgroundCGColor); - CGContextFillRect(context, bounds); - } - - // If there is a display block, call it to get the image, then copy the image into the current context (which is the rasterized container's backing store). - if (displayBlock) { - UIImage *image = (UIImage *)displayBlock(); - if (image) { - BOOL opaque = ASImageAlphaInfoIsOpaque(CGImageGetAlphaInfo(image.CGImage)); - CGBlendMode blendMode = opaque ? kCGBlendModeCopy : kCGBlendModeNormal; - [image drawInRect:bounds blendMode:blendMode alpha:1]; - } - } - }; - [displayBlocks addObject:pushAndDisplayBlock]; - } - - // Recursively capture displayBlocks for all descendants. - for (ASDisplayNode *subnode in self.subnodes) { - [subnode _recursivelyRasterizeSelfAndSublayersWithIsCancelledBlock:isCancelledBlock displayBlocks:displayBlocks]; - } - - // If we pushed a transform, pop it by adding a display block that does nothing other than that. - if (shouldDisplay) { - // Since this block is pure, we can store it statically. - static dispatch_block_t popBlock; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - popBlock = ^{ - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextRestoreGState(context); - }; - }); - [displayBlocks addObject:popBlock]; - } -} - -- (asyncdisplaykit_async_transaction_operation_block_t)_displayBlockWithAsynchronous:(BOOL)asynchronous - isCancelledBlock:(asdisplaynode_iscancelled_block_t)isCancelledBlock - rasterizing:(BOOL)rasterizing -{ - ASDisplayNodeAssertMainThread(); - - asyncdisplaykit_async_transaction_operation_block_t displayBlock = nil; - ASDisplayNodeFlags flags; - - __instanceLock__.lock(); - - flags = _flags; - - // We always create a graphics context, unless a -display method is used, OR if we are a subnode drawing into a rasterized parent. - BOOL shouldCreateGraphicsContext = (flags.implementsImageDisplay == NO && rasterizing == NO); - BOOL shouldBeginRasterizing = (rasterizing == NO && flags.rasterizesSubtree); - BOOL usesImageDisplay = flags.implementsImageDisplay; - BOOL usesDrawRect = flags.implementsDrawRect; - - if (usesImageDisplay == NO && usesDrawRect == NO && shouldBeginRasterizing == NO) { - // Early exit before requesting more expensive properties like bounds and opaque from the layer. - __instanceLock__.unlock(); - return nil; - } - - BOOL opaque = self.opaque; - CGRect bounds = self.bounds; - UIColor *backgroundColor = self.backgroundColor; - CGColorRef borderColor = self.borderColor; - CGFloat borderWidth = self.borderWidth; - CGFloat contentsScaleForDisplay = _contentsScaleForDisplay; - - __instanceLock__.unlock(); - - // Capture drawParameters from delegate on main thread, if this node is displaying itself rather than recursively rasterizing. - id drawParameters = (shouldBeginRasterizing == NO ? [self drawParameters] : nil); - - // Only the -display methods should be called if we can't size the graphics buffer to use. - if (CGRectIsEmpty(bounds) && (shouldBeginRasterizing || shouldCreateGraphicsContext)) { - return nil; - } - - ASDisplayNodeAssert(contentsScaleForDisplay != 0.0, @"Invalid contents scale"); - ASDisplayNodeAssert(rasterizing || !(_hierarchyState & ASHierarchyStateRasterized), - @"Rasterized descendants should never display unless being drawn into the rasterized container."); - - if (shouldBeginRasterizing) { - // Collect displayBlocks for all descendants. - NSMutableArray *displayBlocks = [[NSMutableArray alloc] init]; - [self _recursivelyRasterizeSelfAndSublayersWithIsCancelledBlock:isCancelledBlock displayBlocks:displayBlocks]; - CHECK_CANCELLED_AND_RETURN_NIL(); - - // If [UIColor clearColor] or another semitransparent background color is used, include alpha channel when rasterizing. - // Unlike CALayer drawing, we include the backgroundColor as a base during rasterization. - opaque = opaque && CGColorGetAlpha(backgroundColor.CGColor) == 1.0f; - - displayBlock = ^id{ - CHECK_CANCELLED_AND_RETURN_NIL(); - - UIImage *image = ASGraphicsCreateImage(self.primitiveTraitCollection, bounds.size, opaque, contentsScaleForDisplay, nil, isCancelledBlock, ^{ - for (dispatch_block_t block in displayBlocks) { - if (isCancelledBlock()) return; - block(); - } - }); - - ASDN_DELAY_FOR_DISPLAY(); - return image; - }; - } else { - displayBlock = ^id{ - CHECK_CANCELLED_AND_RETURN_NIL(); - - __block UIImage *image = nil; - void (^workWithContext)() = ^{ - CGContextRef currentContext = UIGraphicsGetCurrentContext(); - - if (shouldCreateGraphicsContext && !currentContext) { - ASDisplayNodeAssert(NO, @"Failed to create a CGContext (size: %@)", NSStringFromCGSize(bounds.size)); - return; - } - - // For -display methods, we don't have a context, and thus will not call the _willDisplayNodeContentWithRenderingContext or - // _didDisplayNodeContentWithRenderingContext blocks. It's up to the implementation of -display... to do what it needs. - [self __willDisplayNodeContentWithRenderingContext:currentContext drawParameters:drawParameters]; - - if (usesImageDisplay) { // If we are using a display method, we'll get an image back directly. - image = [self.class displayWithParameters:drawParameters isCancelled:isCancelledBlock]; - } else if (usesDrawRect) { // If we're using a draw method, this will operate on the currentContext. - [self.class drawRect:bounds withParameters:drawParameters isCancelled:isCancelledBlock isRasterizing:rasterizing]; - } - - [self __didDisplayNodeContentWithRenderingContext:currentContext image:&image drawParameters:drawParameters backgroundColor:backgroundColor borderWidth:borderWidth borderColor:borderColor]; - ASDN_DELAY_FOR_DISPLAY(); - }; - - if (shouldCreateGraphicsContext) { - return ASGraphicsCreateImage(self.primitiveTraitCollection, bounds.size, opaque, contentsScaleForDisplay, nil, isCancelledBlock, workWithContext); - } else { - workWithContext(); - return image; - } - }; - } - - /** - If we're profiling, wrap the display block with signpost start and end. - Color the interval red if cancelled, green otherwise. - */ -#if AS_SIGNPOST_ENABLE - unowned id ptrSelf = (id)self; - displayBlock = ^{ - ASSignpostStart(LayerDisplay, ptrSelf, "%@", ASObjectDescriptionMakeTiny(ptrSelf)); - id result = displayBlock(); - ASSignpostEnd(LayerDisplay, ptrSelf, "(%d %d), canceled: %d", (int)bounds.size.width, (int)bounds.size.height, (int)isCancelledBlock()); - return result; - }; -#endif - - return displayBlock; -} - -- (void)__willDisplayNodeContentWithRenderingContext:(CGContextRef)context drawParameters:(id _Nullable)drawParameters -{ - if (context) { - __instanceLock__.lock(); - ASCornerRoundingType cornerRoundingType = _cornerRoundingType; - CGFloat cornerRadius = _cornerRadius; - ASDisplayNodeContextModifier willDisplayNodeContentWithRenderingContext = _willDisplayNodeContentWithRenderingContext; - CACornerMask maskedCorners = _maskedCorners; - __instanceLock__.unlock(); - - if (cornerRoundingType == ASCornerRoundingTypePrecomposited && cornerRadius > 0.0) { - ASDisplayNodeAssert(context == UIGraphicsGetCurrentContext(), @"context is expected to be pushed on UIGraphics stack %@", self); - // TODO: This clip path should be removed if we are rasterizing. - CGRect boundingBox = CGContextGetClipBoundingBox(context); - CGSize radii = CGSizeMake(cornerRadius, cornerRadius); - [[UIBezierPath bezierPathWithRoundedRect:boundingBox byRoundingCorners:maskedCorners cornerRadii:radii] addClip]; - } - - if (willDisplayNodeContentWithRenderingContext) { - willDisplayNodeContentWithRenderingContext(context, drawParameters); - } - } - -} -- (void)__didDisplayNodeContentWithRenderingContext:(CGContextRef)context image:(UIImage **)image drawParameters:(id _Nullable)drawParameters backgroundColor:(UIColor *)backgroundColor borderWidth:(CGFloat)borderWidth borderColor:(CGColorRef)borderColor -{ - if (context == NULL && *image == NULL) { - return; - } - - __instanceLock__.lock(); - ASCornerRoundingType cornerRoundingType = _cornerRoundingType; - CGFloat cornerRadius = _cornerRadius; - CGFloat contentsScale = _contentsScaleForDisplay; - ASDisplayNodeContextModifier didDisplayNodeContentWithRenderingContext = _didDisplayNodeContentWithRenderingContext; - CACornerMask maskedCorners = _maskedCorners; - __instanceLock__.unlock(); - - if (context != NULL) { - if (didDisplayNodeContentWithRenderingContext) { - didDisplayNodeContentWithRenderingContext(context, drawParameters); - } - } - - if (cornerRoundingType == ASCornerRoundingTypePrecomposited && cornerRadius > 0.0f) { - CGRect bounds = CGRectZero; - if (context == NULL) { - bounds = self.threadSafeBounds; - bounds.size.width *= contentsScale; - bounds.size.height *= contentsScale; - CGFloat white = 0.0f, alpha = 0.0f; - [backgroundColor getWhite:&white alpha:&alpha]; - UIGraphicsBeginImageContextWithOptions(bounds.size, (alpha == 1.0f), contentsScale); - [*image drawInRect:bounds]; - } else { - bounds = CGContextGetClipBoundingBox(context); - } - - ASDisplayNodeAssert(UIGraphicsGetCurrentContext(), @"context is expected to be pushed on UIGraphics stack %@", self); - - UIBezierPath *roundedHole = [UIBezierPath bezierPathWithRect:bounds]; - CGSize radii = CGSizeMake(cornerRadius * contentsScale, cornerRadius * contentsScale); - [roundedHole appendPath:[UIBezierPath bezierPathWithRoundedRect:bounds - byRoundingCorners:maskedCorners - cornerRadii:radii]]; - roundedHole.usesEvenOddFillRule = YES; - - UIBezierPath *roundedPath = nil; - if (borderWidth > 0.0f) { // Don't create roundedPath and stroke if borderWidth is 0.0 - CGFloat strokeThickness = borderWidth * contentsScale; - CGFloat strokeInset = ((strokeThickness + 1.0f) / 2.0f) - 1.0f; - roundedPath = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(bounds, strokeInset, strokeInset) - cornerRadius:_cornerRadius * contentsScale]; - roundedPath.lineWidth = strokeThickness; - [[UIColor colorWithCGColor:borderColor] setStroke]; - } - - // Punch out the corners by copying the backgroundColor over them. - // This works for everything from clearColor to opaque colors. - [backgroundColor setFill]; - [roundedHole fillWithBlendMode:kCGBlendModeCopy alpha:1.0f]; - - [roundedPath stroke]; // Won't do anything if borderWidth is 0 and roundedPath is nil. - - if (*image) { - *image = UIGraphicsGetImageFromCurrentImageContext(); - } - if (context == NULL) { - UIGraphicsEndImageContext(); - } - } -} - -- (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asynchronously -{ - ASDisplayNodeAssertMainThread(); - - __instanceLock__.lock(); - - if (_hierarchyState & ASHierarchyStateRasterized) { - __instanceLock__.unlock(); - return; - } - - CALayer *layer = _layer; - BOOL rasterizesSubtree = _flags.rasterizesSubtree; - - __instanceLock__.unlock(); - - // for async display, capture the current displaySentinel value to bail early when the job is executed if another is - // enqueued - // for sync display, do not support cancellation - - // FIXME: what about the degenerate case where we are calling setNeedsDisplay faster than the jobs are dequeuing - // from the displayQueue? Need to not cancel early fails from displaySentinel changes. - asdisplaynode_iscancelled_block_t isCancelledBlock = nil; - if (asynchronously) { - uint displaySentinelValue = ++_displaySentinel; - __weak ASDisplayNode *weakSelf = self; - isCancelledBlock = ^BOOL{ - __strong ASDisplayNode *self = weakSelf; - return self == nil || (displaySentinelValue != self->_displaySentinel.load()); - }; - } else { - isCancelledBlock = ^BOOL{ - return NO; - }; - } - - // Set up displayBlock to call either display or draw on the delegate and return a UIImage contents - asyncdisplaykit_async_transaction_operation_block_t displayBlock = [self _displayBlockWithAsynchronous:asynchronously isCancelledBlock:isCancelledBlock rasterizing:NO]; - - if (!displayBlock) { - return; - } - - ASDisplayNodeAssert(layer, @"Expect _layer to be not nil"); - - // This block is called back on the main thread after rendering at the completion of the current async transaction, or immediately if !asynchronously - asyncdisplaykit_async_transaction_operation_completion_block_t completionBlock = ^(id value, BOOL canceled){ - ASDisplayNodeCAssertMainThread(); - if (!canceled && !isCancelledBlock()) { - UIImage *image = (UIImage *)value; - BOOL stretchable = (NO == UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero)); - if (stretchable) { - ASDisplayNodeSetResizableContents(layer, image); - } else { - layer.contentsScale = self.contentsScale; - layer.contents = (id)image.CGImage; - } - [self didDisplayAsyncLayer:self.asyncLayer]; - - if (rasterizesSubtree) { - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - [node didDisplayAsyncLayer:node.asyncLayer]; - }); - } - } - }; - - // Call willDisplay immediately in either case - [self willDisplayAsyncLayer:self.asyncLayer asynchronously:asynchronously]; - - if (rasterizesSubtree) { - ASDisplayNodePerformBlockOnEverySubnode(self, NO, ^(ASDisplayNode * _Nonnull node) { - [node willDisplayAsyncLayer:node.asyncLayer asynchronously:asynchronously]; - }); - } - - if (asynchronously) { - // Async rendering operations are contained by a transaction, which allows them to proceed and concurrently - // while synchronizing the final application of the results to the layer's contents property (completionBlock). - - // First, look to see if we are expected to join a parent's transaction container. - CALayer *containerLayer = layer.asyncdisplaykit_parentTransactionContainer ? : layer; - - // In the case that a transaction does not yet exist (such as for an individual node outside of a container), - // this call will allocate the transaction and add it to _ASAsyncTransactionGroup. - // It will automatically commit the transaction at the end of the runloop. - _ASAsyncTransaction *transaction = containerLayer.asyncdisplaykit_asyncTransaction; - - // Adding this displayBlock operation to the transaction will start it IMMEDIATELY. - // The only function of the transaction commit is to gate the calling of the completionBlock. - [transaction addOperationWithBlock:displayBlock priority:self.drawingPriority queue:[_ASDisplayLayer displayQueue] completion:completionBlock]; - } else { - UIImage *contents = (UIImage *)displayBlock(); - completionBlock(contents, NO); - } -} - -- (void)cancelDisplayAsyncLayer:(_ASDisplayLayer *)asyncLayer -{ - _displaySentinel.fetch_add(1); -} - -- (ASDisplayNodeContextModifier)willDisplayNodeContentWithRenderingContext -{ - MutexLocker l(__instanceLock__); - return _willDisplayNodeContentWithRenderingContext; -} - -- (ASDisplayNodeContextModifier)didDisplayNodeContentWithRenderingContext -{ - MutexLocker l(__instanceLock__); - return _didDisplayNodeContentWithRenderingContext; -} - -- (void)setWillDisplayNodeContentWithRenderingContext:(ASDisplayNodeContextModifier)contextModifier -{ - MutexLocker l(__instanceLock__); - _willDisplayNodeContentWithRenderingContext = contextModifier; -} - -- (void)setDidDisplayNodeContentWithRenderingContext:(ASDisplayNodeContextModifier)contextModifier -{ - MutexLocker l(__instanceLock__); - _didDisplayNodeContentWithRenderingContext = contextModifier; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.h b/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.h deleted file mode 100644 index f6935224..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASDisplayNode+DebugTiming.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASDisplayNode (DebugTiming) - -@property (nonatomic, readonly) NSTimeInterval debugTimeToCreateView; -@property (nonatomic, readonly) NSTimeInterval debugTimeToApplyPendingState; -@property (nonatomic, readonly) NSTimeInterval debugTimeToAddSubnodeViews; -@property (nonatomic, readonly) NSTimeInterval debugTimeForDidLoad; - -- (NSTimeInterval)debugAllCreationTime; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.mm b/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.mm deleted file mode 100644 index d9311a10..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNode+DebugTiming.mm +++ /dev/null @@ -1,85 +0,0 @@ -// -// ASDisplayNode+DebugTiming.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASDisplayNode (DebugTiming) - -#if TIME_DISPLAYNODE_OPS -- (NSTimeInterval)debugTimeToCreateView -{ - return _debugTimeToCreateView; -} - -- (NSTimeInterval)debugTimeToApplyPendingState -{ - return _debugTimeToApplyPendingState; -} - -- (NSTimeInterval)debugTimeToAddSubnodeViews -{ - return _debugTimeToAddSubnodeViews; -} - -- (NSTimeInterval)debugTimeForDidLoad -{ - return _debugTimeForDidLoad; -} - -- (NSTimeInterval)debugAllCreationTime -{ - return self.debugTimeToCreateView + self.debugTimeToApplyPendingState + self.debugTimeToAddSubnodeViews + self.debugTimeForDidLoad; -} - -// This would over-count views that are created in the parent's didload or addsubnodesubviews, so we need to take a more basic approach -//- (NSTimeInterval)debugRecursiveAllCreationTime -//{ -// __block NSTimeInterval total = 0; -// ASDisplayNodeFindAllSubnodes(self, ^(ASDisplayNode *n){ -// total += self.debugTimeToCreateView; -// total += self.debugTimeToApplyPendingState; -// total += self.debugTimeToAddSubnodeViews; -// total += self.debugTimeForDidLoad; -// return NO; -// }); -// return total; -//} - -#else - -// These ivars are compiled out so we don't have the info available -- (NSTimeInterval)debugTimeToCreateView -{ - return -1; -} - -- (NSTimeInterval)debugTimeToApplyPendingState -{ - return -1; -} - -- (NSTimeInterval)debugTimeToAddSubnodeViews -{ - return -1; -} - -- (NSTimeInterval)debugTimeForDidLoad -{ - return -1; -} - -- (NSTimeInterval)debugAllCreationTime -{ - return -1; -} - -#endif - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNode+FrameworkPrivate.h b/Example/Pods/Texture/Source/Private/ASDisplayNode+FrameworkPrivate.h deleted file mode 100644 index b7e8b153..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNode+FrameworkPrivate.h +++ /dev/null @@ -1,335 +0,0 @@ -// -// ASDisplayNode+FrameworkPrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -// -// The following methods are ONLY for use by _ASDisplayLayer, _ASDisplayView, and ASDisplayNode. -// These methods must never be called or overridden by other classes. -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ASInterfaceStateDelegate; - -/** - Hierarchy state is propagated from nodes to all of their children when certain behaviors are required from the subtree. - Examples include rasterization and external driving of the .interfaceState property. - By passing this information explicitly, performance is optimized by avoiding iteration up the supernode chain. - Lastly, this avoidance of supernode traversal protects against the possibility of deadlocks when a supernode is - simultaneously attempting to materialize views / layers for its subtree (as many related methods require property locking) - - Note: as the hierarchy deepens, more state properties may be enabled. However, state properties may never be disabled / - cancelled below the point they are enabled. They continue to the leaves of the hierarchy. - */ - -typedef NS_OPTIONS(unsigned char, ASHierarchyState) -{ - /** The node may or may not have a supernode, but no supernode has a special hierarchy-influencing option enabled. */ - ASHierarchyStateNormal = 0, - /** The node has a supernode with .rasterizesSubtree = YES. - Note: the root node of the rasterized subtree (the one with the property set on it) will NOT have this state set. */ - ASHierarchyStateRasterized = 1 << 0, - /** The node or one of its supernodes is managed by a class like ASRangeController. Most commonly, these nodes are - ASCellNode objects or a subnode of one, and are used in ASTableView or ASCollectionView. - These nodes also receive regular updates to the .interfaceState property with more detailed status information. */ - ASHierarchyStateRangeManaged = 1 << 1, - /** Down-propagated version of _flags.visibilityNotificationsDisabled. This flag is very rarely set, but by having it - locally available to nodes, they do not have to walk up supernodes at the critical points it is checked. */ - ASHierarchyStateTransitioningSupernodes = 1 << 2, - /** One of the supernodes of this node is performing a transition. - Any layout calculated during this state should not be applied immediately, but pending until later. */ - ASHierarchyStateLayoutPending = 1 << 3, -}; - -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesLayoutPending(ASHierarchyState hierarchyState) -{ - return ((hierarchyState & ASHierarchyStateLayoutPending) == ASHierarchyStateLayoutPending); -} - -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesRangeManaged(ASHierarchyState hierarchyState) -{ - return ((hierarchyState & ASHierarchyStateRangeManaged) == ASHierarchyStateRangeManaged); -} - -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesRasterized(ASHierarchyState hierarchyState) -{ - return ((hierarchyState & ASHierarchyStateRasterized) == ASHierarchyStateRasterized); -} - -ASDISPLAYNODE_INLINE BOOL ASHierarchyStateIncludesTransitioningSupernodes(ASHierarchyState hierarchyState) -{ - return ((hierarchyState & ASHierarchyStateTransitioningSupernodes) == ASHierarchyStateTransitioningSupernodes); -} - -__unused static NSString * _Nonnull NSStringFromASHierarchyState(ASHierarchyState hierarchyState) -{ - NSMutableArray *states = [NSMutableArray array]; - if (hierarchyState == ASHierarchyStateNormal) { - [states addObject:@"Normal"]; - } - if (ASHierarchyStateIncludesRangeManaged(hierarchyState)) { - [states addObject:@"RangeManaged"]; - } - if (ASHierarchyStateIncludesLayoutPending(hierarchyState)) { - [states addObject:@"LayoutPending"]; - } - if (ASHierarchyStateIncludesRasterized(hierarchyState)) { - [states addObject:@"Rasterized"]; - } - if (ASHierarchyStateIncludesTransitioningSupernodes(hierarchyState)) { - [states addObject:@"TransitioningSupernodes"]; - } - return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]]; -} - -#define HIERARCHY_STATE_DELTA(Name) ({ \ - if ((oldState & ASHierarchyState##Name) != (newState & ASHierarchyState##Name)) { \ - [changes appendFormat:@"%c%s ", (newState & ASHierarchyState##Name ? '+' : '-'), #Name]; \ - } \ -}) - -__unused static NSString * _Nonnull NSStringFromASHierarchyStateChange(ASHierarchyState oldState, ASHierarchyState newState) -{ - if (oldState == newState) { - return @"{ }"; - } - - NSMutableString *changes = [NSMutableString stringWithString:@"{ "]; - HIERARCHY_STATE_DELTA(Rasterized); - HIERARCHY_STATE_DELTA(RangeManaged); - HIERARCHY_STATE_DELTA(TransitioningSupernodes); - HIERARCHY_STATE_DELTA(LayoutPending); - [changes appendString:@"}"]; - return changes; -} - -#undef HIERARCHY_STATE_DELTA - -@interface ASDisplayNode () - -// The view class to use when creating a new display node instance. Defaults to _ASDisplayView. -+ (Class)viewClass; - -// Thread safe way to access the bounds of the node -@property (nonatomic) CGRect threadSafeBounds; - -// Returns the bounds of the node without reaching the view or layer -- (CGRect)_locked_threadSafeBounds; - -// The -pendingInterfaceState holds the value that will be applied to -interfaceState by the -// ASCATransactionQueue. If already applied, it matches -interfaceState. Thread-safe access. -@property (nonatomic, readonly) ASInterfaceState pendingInterfaceState; - -// These methods are recursive, and either union or remove the provided interfaceState to all sub-elements. -- (void)enterInterfaceState:(ASInterfaceState)interfaceState; -- (void)exitInterfaceState:(ASInterfaceState)interfaceState; -- (void)recursivelySetInterfaceState:(ASInterfaceState)interfaceState; - -// These methods are recursive, and either union or remove the provided hierarchyState to all sub-elements. -- (void)enterHierarchyState:(ASHierarchyState)hierarchyState; -- (void)exitHierarchyState:(ASHierarchyState)hierarchyState; - -// Changed before calling willEnterHierarchy / didExitHierarchy. -@property (readonly, getter = isInHierarchy) BOOL inHierarchy; -// Call willEnterHierarchy if necessary and set inHierarchy = YES if visibility notifications are enabled on all of its parents -- (void)__enterHierarchy; -// Call didExitHierarchy if necessary and set inHierarchy = NO if visibility notifications are enabled on all of its parents -- (void)__exitHierarchy; - -/** - * @abstract Returns the Hierarchy State of the node. - * - * @return The current ASHierarchyState of the node, indicating whether it is rasterized or managed by a range controller. - * - * @see ASInterfaceState - */ -@property (nonatomic) ASHierarchyState hierarchyState; - -/** - * Represent the current custom action in representation for the node - */ -@property (nonatomic, weak) UIAccessibilityCustomAction *accessibilityCustomAction; - -/** - * @abstract Return if the node is range managed or not - * - * @discussion Currently only set interface state on nodes in table and collection views. For other nodes, if they are - * in the hierarchy we enable all ASInterfaceState types with `ASInterfaceStateInHierarchy`, otherwise `None`. - */ -- (BOOL)supportsRangeManagedInterfaceState; - -- (BOOL)_locked_displaysAsynchronously; - -// The two methods below will eventually be exposed, but their names are subject to change. -/** - * @abstract Ensure that all rendering is complete for this node and its descendants. - * - * @discussion Calling this method on the main thread after a node is added to the view hierarchy will ensure that - * placeholder states are never visible to the user. It is used by ASTableView, ASCollectionView, and ASDKViewController - * to implement their respective ".neverShowPlaceholders" option. - * - * If all nodes have layer.contents set and/or their layer does not have -needsDisplay set, the method will return immediately. - * - * This method is capable of handling a mixed set of nodes, with some not having started display, some in progress on an - * asynchronous display operation, and some already finished. - * - * In order to guarantee against deadlocks, this method should only be called on the main thread. - * It may block on the private queue, [_ASDisplayLayer displayQueue] - */ -- (void)recursivelyEnsureDisplaySynchronously:(BOOL)synchronously; - -/** - * @abstract Calls -didExitPreloadState on the receiver and its subnode hierarchy. - * - * @discussion Clears any memory-intensive preloaded content. - * This method is used to notify the node that it should purge any content that is both expensive to fetch and to - * retain in memory. - * - * @see [ASDisplayNode(Subclassing) didExitPreloadState] and [ASDisplayNode(Subclassing) didEnterPreloadState] - */ -- (void)recursivelyClearPreloadedData; - -/** - * @abstract Calls -didEnterPreloadState on the receiver and its subnode hierarchy. - * - * @discussion Fetches content from remote sources for the current node and all subnodes. - * - * @see [ASDisplayNode(Subclassing) didEnterPreloadState] and [ASDisplayNode(Subclassing) didExitPreloadState] - */ -- (void)recursivelyPreload; - -/** - * @abstract Triggers a recursive call to -didEnterPreloadState when the node has an interfaceState of ASInterfaceStatePreload - */ -- (void)setNeedsPreload; - -/** - * @abstract Allows a node to bypass all ensureDisplay passes. Defaults to NO. - * - * @discussion Nodes that are expensive to draw and expected to have placeholder even with - * .neverShowPlaceholders enabled should set this to YES. - * - * ASImageNode uses the default of NO, as it is often used for UI images that are expected to synchronize with ensureDisplay. - * - * ASNetworkImageNode and ASMultiplexImageNode set this to YES, because they load data from a database or server, - * and are expected to support a placeholder state given that display is often blocked on slow data fetching. - */ -@property BOOL shouldBypassEnsureDisplay; - -/** - * @abstract Checks whether a node should be scheduled for display, considering its current and new interface states. - */ -- (BOOL)shouldScheduleDisplayWithNewInterfaceState:(ASInterfaceState)newInterfaceState; - -/** - * @abstract safeAreaInsets will fallback to this value if the corresponding UIKit property is not available - * (due to an old iOS version). - * - * @discussion This should be set by the owning view controller based on it's layout guides. - * If this is not a view controllet's node the value will be calculated automatically by the parent node. - */ -@property (nonatomic) UIEdgeInsets fallbackSafeAreaInsets; - -/** - * @abstract Indicates if this node is a view controller's root node. Defaults to NO. - * - * @discussion Set to YES in -[ASDKViewController initWithNode:]. - * - * YES here only means that this node is used as an ASDKViewController node. It doesn't mean that this node is a root of - * ASDisplayNode hierarchy, e.g. when its view controller is parented by another ASDKViewController. - */ -@property (nonatomic, getter=isViewControllerRoot) BOOL viewControllerRoot; - -@end - - -@interface ASDisplayNode (ASLayoutInternal) - -/** - * @abstract Informs the root node that the intrinsic size of the receiver is no longer valid. - * - * @discussion The size of a root node is determined by each subnode. Calling invalidateSize will let the root node know - * that the intrinsic size of the receiver node is no longer valid and a resizing of the root node needs to happen. - */ -- (void)_u_setNeedsLayoutFromAbove; - -/** - * @abstract Subclass hook for nodes that are acting as root nodes. This method is called if one of the subnodes - * size is invalidated and may need to result in a different size as the current calculated size. - */ -- (void)_rootNodeDidInvalidateSize; - -/** - * This method will confirm that the layout is up to date (and update if needed). - * Importantly, it will also APPLY the layout to all of our subnodes if (unless parent is transitioning). - */ -- (void)_u_measureNodeWithBoundsIfNecessary:(CGRect)bounds; - -/** - * Layout all of the subnodes based on the sublayouts - */ -- (void)_layoutSublayouts; - -@end - -@interface ASDisplayNode (ASLayoutTransitionInternal) - -/** - * If one or multiple layout transitions are in flight this methods returns if the current layout transition that - * happens in in this particular thread was invalidated through another thread is starting a transition for this node - */ -- (BOOL)_isLayoutTransitionInvalid; - -/** - * Same as @c -_isLayoutTransitionInvalid but must be called with the node's instance lock held. - */ -- (BOOL)_locked_isLayoutTransitionInvalid; - -/** - * Internal method that can be overriden by subclasses to add specific behavior after the measurement of a layout - * transition did finish. - */ -- (void)_layoutTransitionMeasurementDidFinish; - -/** - * Informs the node that the pending layout transition did complete - */ -- (void)_completePendingLayoutTransition; - -/** - * Called if the pending layout transition did complete - */ -- (void)_pendingLayoutTransitionDidComplete; - -@end - -/** - * Defines interactive accessibility traits which will be exposed as UIAccessibilityCustomActions - * for nodes within nodes that have isAccessibilityContainer is YES - */ -NS_INLINE UIAccessibilityTraits ASInteractiveAccessibilityTraitsMask() { - return UIAccessibilityTraitLink | UIAccessibilityTraitKeyboardKey | UIAccessibilityTraitButton; -} - -@interface ASDisplayNode (AccessibilityInternal) -- (nullable NSArray *)accessibilityElements; -@end; - -@interface UIView (ASDisplayNodeInternal) -@property (nullable, weak) ASDisplayNode *asyncdisplaykit_node; -@end - -@interface CALayer (ASDisplayNodeInternal) -@property (nullable, weak) ASDisplayNode *asyncdisplaykit_node; -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNode+UIViewBridge.mm b/Example/Pods/Texture/Source/Private/ASDisplayNode+UIViewBridge.mm deleted file mode 100644 index 114e8119..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNode+UIViewBridge.mm +++ /dev/null @@ -1,1446 +0,0 @@ -// -// ASDisplayNode+UIViewBridge.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -/** - * The following macros are conveniences to help in the common tasks related to the bridging that ASDisplayNode does to UIView and CALayer. - * In general, a property can either be: - * - Always sent to the layer or view's layer - * use _getFromLayer / _setToLayer - * - Bridged to the view if view-backed or the layer if layer-backed - * use _getFromViewOrLayer / _setToViewOrLayer / _messageToViewOrLayer - * - Only applicable if view-backed - * use _setToViewOnly / _getFromViewOnly - * - Has differing types on views and layers, or custom ASDisplayNode-specific behavior is desired - * manually implement - * - * _bridge_prologue_write is defined to take the node's property lock. Add it at the beginning of any bridged property setters. - * _bridge_prologue_read is defined to take the node's property lock and enforce thread affinity. Add it at the beginning of any bridged property getters. - */ - -#define DISPLAYNODE_USE_LOCKS 1 - -#if DISPLAYNODE_USE_LOCKS -#define _bridge_prologue_read AS::MutexLocker l(__instanceLock__); ASDisplayNodeAssertThreadAffinity(self) -#define _bridge_prologue_write AS::MutexLocker l(__instanceLock__) -#else -#define _bridge_prologue_read ASDisplayNodeAssertThreadAffinity(self) -#define _bridge_prologue_write -#endif - -/// Returns YES if the property set should be applied to view/layer immediately. -/// Side Effect: Registers the node with the shared ASPendingStateController if -/// the property cannot be immediately applied and the node does not already have pending changes. -/// This function must be called with the node's lock already held (after _bridge_prologue_write). -/// *warning* the lock should *not* be released until the pending state is updated if this method -/// returns NO. Otherwise, the pending state can be scheduled and flushed *before* you get a chance -/// to apply it. -ASDISPLAYNODE_INLINE BOOL ASDisplayNodeShouldApplyBridgedWriteToView(ASDisplayNode *node) { - BOOL loaded = _loaded(node); - if (ASDisplayNodeThreadIsMain()) { - return loaded; - } else { - if (loaded && !ASDisplayNodeGetPendingState(node).hasChanges) { - [[ASPendingStateController sharedInstance] registerNode:node]; - } - return NO; - } -}; - -#define _getFromViewOrLayer(layerProperty, viewAndPendingViewStateProperty) _loaded(self) ? \ - (_view ? _view.viewAndPendingViewStateProperty : _layer.layerProperty )\ - : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty - -#define _setToViewOrLayer(layerProperty, layerValueExpr, viewAndPendingViewStateProperty, viewAndPendingViewStateExpr) BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); \ - if (shouldApply) { (_view ? _view.viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr) : _layer.layerProperty = (layerValueExpr)); } else { ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr); } - -#define _setToViewOnly(viewAndPendingViewStateProperty, viewAndPendingViewStateExpr) BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); \ -if (shouldApply) { _view.viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr); } else { ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty = (viewAndPendingViewStateExpr); } - -#define _getFromViewOnly(viewAndPendingViewStateProperty) _loaded(self) ? _view.viewAndPendingViewStateProperty : ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty - -#define _getFromLayer(layerProperty) _loaded(self) ? _layer.layerProperty : ASDisplayNodeGetPendingState(self).layerProperty - -#define _setToLayer(layerProperty, layerValueExpr) BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); \ -if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNodeGetPendingState(self).layerProperty = (layerValueExpr); } - -/** - * This category implements certain frequently-used properties and methods of UIView and CALayer so that ASDisplayNode clients can just call the view/layer methods on the node, - * with minimal loss in performance. Unlike UIView and CALayer methods, these can be called from a non-main thread until the view or layer is created. - * This allows text sizing in -calculateSizeThatFits: (essentially a simplified layout) to happen off the main thread - * without any CALayer or UIView actually existing while still being able to set and read properties from ASDisplayNode instances. - */ -@implementation ASDisplayNode (UIViewBridge) - -#if TARGET_OS_TV -// Focus Engine -- (BOOL)canBecomeFocused -{ - return NO; -} - -- (void)setNeedsFocusUpdate -{ - ASDisplayNodeAssertMainThread(); - [_view setNeedsFocusUpdate]; -} - -- (void)updateFocusIfNeeded -{ - ASDisplayNodeAssertMainThread(); - [_view updateFocusIfNeeded]; -} - -- (BOOL)shouldUpdateFocusInContext:(UIFocusUpdateContext *)context -{ - return NO; -} - -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator -{ - -} - -- (UIView *)preferredFocusedView -{ - if (self.nodeLoaded) { - return _view; - } - else { - return nil; - } -} -#endif - -- (BOOL)canBecomeFirstResponder -{ - if (_view == nil) { - // By default we return NO if not view is created yet - return NO; - } - return [_view canBecomeFirstResponder]; -} - -- (BOOL)becomeFirstResponder -{ - ASDisplayNodeAssertMainThread(); - - // Note: This implicitly loads the view if it hasn't been loaded yet. - [self view]; - - if (![self canBecomeFirstResponder]) { - return NO; - } - return [_view becomeFirstResponder]; -} - -- (BOOL)canResignFirstResponder -{ - ASDisplayNodeAssertMainThread(); - - if (_view == nil) { - // By default we return YES if no view is created yet - return YES; - } - return [_view canResignFirstResponder]; -} - -- (BOOL)resignFirstResponder -{ - ASDisplayNodeAssertMainThread(); - - // Note: This implicitly loads the view if it hasn't been loaded yet. - [self view]; - - if (![self canResignFirstResponder]) { - return NO; - } - return [_view resignFirstResponder]; -} - -- (BOOL)isFirstResponder -{ - ASDisplayNodeAssertMainThread(); - if (_view == nil) { - // If no view is created yet we can just return NO as it's unlikely it's the first responder - return NO; - } - return [_view isFirstResponder]; -} - -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - ASDisplayNodeAssertMainThread(); - return !self.layerBacked && [self.view canPerformAction:action withSender:sender]; -} - -- (CGFloat)alpha -{ - _bridge_prologue_read; - return _getFromViewOrLayer(opacity, alpha); -} - -- (void)setAlpha:(CGFloat)newAlpha -{ - _bridge_prologue_write; - _setToViewOrLayer(opacity, newAlpha, alpha, newAlpha); -} - -- (CGFloat)cornerRadius -{ - AS::MutexLocker l(__instanceLock__); - return _cornerRadius; -} - -- (void)setCornerRadius:(CGFloat)newCornerRadius -{ - [self updateCornerRoundingWithType:self.cornerRoundingType - cornerRadius:newCornerRadius - maskedCorners:self.maskedCorners]; -} - -- (ASCornerRoundingType)cornerRoundingType -{ - AS::MutexLocker l(__instanceLock__); - return _cornerRoundingType; -} - -- (void)setCornerRoundingType:(ASCornerRoundingType)newRoundingType -{ - [self updateCornerRoundingWithType:newRoundingType cornerRadius:self.cornerRadius maskedCorners:self.maskedCorners]; -} - -- (CACornerMask)maskedCorners -{ - AS::MutexLocker l(__instanceLock__); - return _maskedCorners; -} - -- (void)setMaskedCorners:(CACornerMask)newMaskedCorners -{ - [self updateCornerRoundingWithType:self.cornerRoundingType - cornerRadius:self.cornerRadius - maskedCorners:newMaskedCorners]; -} - -- (NSString *)contentsGravity -{ - _bridge_prologue_read; - return _getFromLayer(contentsGravity); -} - -- (void)setContentsGravity:(NSString *)newContentsGravity -{ - _bridge_prologue_write; - _setToLayer(contentsGravity, newContentsGravity); -} - -- (CGRect)contentsRect -{ - _bridge_prologue_read; - return _getFromLayer(contentsRect); -} - -- (void)setContentsRect:(CGRect)newContentsRect -{ - _bridge_prologue_write; - _setToLayer(contentsRect, newContentsRect); -} - -- (CGRect)contentsCenter -{ - _bridge_prologue_read; - return _getFromLayer(contentsCenter); -} - -- (void)setContentsCenter:(CGRect)newContentsCenter -{ - _bridge_prologue_write; - _setToLayer(contentsCenter, newContentsCenter); -} - -- (CGFloat)contentsScale -{ - _bridge_prologue_read; - return _getFromLayer(contentsScale); -} - -- (void)setContentsScale:(CGFloat)newContentsScale -{ - _bridge_prologue_write; - _setToLayer(contentsScale, newContentsScale); -} - -- (CGFloat)rasterizationScale -{ - _bridge_prologue_read; - return _getFromLayer(rasterizationScale); -} - -- (void)setRasterizationScale:(CGFloat)newRasterizationScale -{ - _bridge_prologue_write; - _setToLayer(rasterizationScale, newRasterizationScale); -} - -- (CGRect)bounds -{ - _bridge_prologue_read; - return _getFromViewOrLayer(bounds, bounds); -} - -- (void)setBounds:(CGRect)newBounds -{ - _bridge_prologue_write; - _setToViewOrLayer(bounds, newBounds, bounds, newBounds); - self.threadSafeBounds = newBounds; -} - -- (CGRect)frame -{ - _bridge_prologue_read; - - // Frame is only defined when transform is identity. -//#if DEBUG -// // Checking if the transform is identity is expensive, so disable when unnecessary. We have assertions on in Release, so DEBUG is the only way I know of. -// ASDisplayNodeAssert(CATransform3DIsIdentity(self.transform), @"-[ASDisplayNode frame] - self.transform must be identity in order to use the frame property. (From Apple's UIView documentation: If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.)"); -//#endif - - CGPoint position = self.position; - CGRect bounds = self.bounds; - CGPoint anchorPoint = self.anchorPoint; - CGPoint origin = CGPointMake(position.x - bounds.size.width * anchorPoint.x, - position.y - bounds.size.height * anchorPoint.y); - return CGRectMake(origin.x, origin.y, bounds.size.width, bounds.size.height); -} - -- (void)setFrame:(CGRect)rect -{ - BOOL setToView = NO; - BOOL setToLayer = NO; - CGRect newBounds = CGRectZero; - CGPoint newPosition = CGPointZero; - BOOL nodeLoaded = NO; - BOOL isMainThread = ASDisplayNodeThreadIsMain(); - { - _bridge_prologue_write; - - // For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - make sure UIView gets setFrame: - struct ASDisplayNodeFlags flags = _flags; - BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandling(checkFlag(Synchronous), flags.layerBacked); - - nodeLoaded = _loaded(self); - if (!specialPropertiesHandling) { - BOOL canReadProperties = isMainThread || !nodeLoaded; - if (canReadProperties) { - // We don't have to set frame directly, and we can read current properties. - // Compute a new bounds and position and set them on self. - CALayer *layer = _layer; - CGPoint origin = (nodeLoaded ? layer.bounds.origin : self.bounds.origin); - CGPoint anchorPoint = (nodeLoaded ? layer.anchorPoint : self.anchorPoint); - - ASBoundsAndPositionForFrame(rect, origin, anchorPoint, &newBounds, &newPosition); - - if (ASIsCGRectValidForLayout(newBounds) == NO || ASIsCGPositionValidForLayout(newPosition) == NO) { - ASDisplayNodeAssertNonFatal(NO, @"-[ASDisplayNode setFrame:] - The new frame (%@) is invalid and unsafe to be set.", NSStringFromCGRect(rect)); - return; - } - - if (nodeLoaded) { - setToLayer = YES; - } else { - self.bounds = newBounds; - self.position = newPosition; - } - } else { - // We don't have to set frame directly, but we can't read properties. - // Store the frame in our pending state, and it'll get decomposed into - // bounds and position when the pending state is applied. - _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); - if (nodeLoaded && !pendingState.hasChanges) { - [[ASPendingStateController sharedInstance] registerNode:self]; - } - pendingState.frame = rect; - } - } else { - if (nodeLoaded && isMainThread) { - // We do have to set frame directly, and we're on main thread with a loaded node. - // Just set the frame on the view. - // NOTE: Frame is only defined when transform is identity because we explicitly diverge from CALayer behavior and define frame without transform. - setToView = YES; - } else { - // We do have to set frame directly, but either the node isn't loaded or we're on a non-main thread. - // Set the frame on the pending state, and it'll call setFrame: when applied. - _ASPendingState *pendingState = ASDisplayNodeGetPendingState(self); - if (nodeLoaded && !pendingState.hasChanges) { - [[ASPendingStateController sharedInstance] registerNode:self]; - } - pendingState.frame = rect; - } - } - } - - if (setToView) { - ASDisplayNodeAssertTrue(nodeLoaded && isMainThread); - _view.frame = rect; - } else if (setToLayer) { - ASDisplayNodeAssertTrue(nodeLoaded && isMainThread); - _layer.bounds = newBounds; - _layer.position = newPosition; - } -} - -- (void)setNeedsDisplay -{ - BOOL isRasterized = NO; - BOOL shouldApply = NO; - id viewOrLayer = nil; - { - _bridge_prologue_write; - isRasterized = _hierarchyState & ASHierarchyStateRasterized; - shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - viewOrLayer = _view ?: _layer; - - if (isRasterized == NO && shouldApply == NO) { - // We can't release the lock before applying to pending state, or it may be flushed before it can be applied. - [ASDisplayNodeGetPendingState(self) setNeedsDisplay]; - } - } - - if (isRasterized) { - ASPerformBlockOnMainThread(^{ - // The below operation must be performed on the main thread to ensure against an extremely rare deadlock, where a parent node - // begins materializing the view / layer hierarchy (locking itself or a descendant) while this node walks up - // the tree and requires locking that node to access .rasterizesSubtree. - // For this reason, this method should be avoided when possible. Use _hierarchyState & ASHierarchyStateRasterized. - ASDisplayNodeAssertMainThread(); - ASDisplayNode *rasterizedContainerNode = self.supernode; - while (rasterizedContainerNode) { - if (rasterizedContainerNode.rasterizesSubtree) { - break; - } - rasterizedContainerNode = rasterizedContainerNode.supernode; - } - [rasterizedContainerNode setNeedsDisplay]; - }); - } else { - if (shouldApply) { - // If not rasterized, and the node is loaded (meaning we certainly have a view or layer), send a - // message to the view/layer first. This is because __setNeedsDisplay calls as scheduleNodeForDisplay, - // which may call -displayIfNeeded. We want to ensure the needsDisplay flag is set now, and then cleared. - [viewOrLayer setNeedsDisplay]; - } - [self __setNeedsDisplay]; - } -} - -- (void)setNeedsLayout -{ - BOOL shouldApply = NO; - BOOL loaded = NO; - id viewOrLayer = nil; - { - _bridge_prologue_write; - shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - loaded = _loaded(self); - viewOrLayer = _view ?: _layer; - if (shouldApply == NO && loaded) { - // The node is loaded but we're not on main. - // We will call [self __setNeedsLayout] when we apply the pending state. - // We need to call it on main if the node is loaded to support automatic subnode management. - // We can't release the lock before applying to pending state, or it may be flushed before it can be applied. - [ASDisplayNodeGetPendingState(self) setNeedsLayout]; - } - } - - if (shouldApply) { - // The node is loaded and we're on main. - // Quite the opposite of setNeedsDisplay, we must call __setNeedsLayout before messaging - // the view or layer to ensure that measurement and implicitly added subnodes have been handled. - [self __setNeedsLayout]; - [viewOrLayer setNeedsLayout]; - } else if (loaded == NO) { - // The node is not loaded and we're not on main. - [self __setNeedsLayout]; - } -} - -- (void)layoutIfNeeded -{ - BOOL shouldApply = NO; - BOOL loaded = NO; - id viewOrLayer = nil; - { - _bridge_prologue_write; - shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - loaded = _loaded(self); - viewOrLayer = _view ?: _layer; - if (shouldApply == NO && loaded) { - // The node is loaded but we're not on main. - // We will call layoutIfNeeded on the view or layer when we apply the pending state. __layout will in turn be called on us (see -[_ASDisplayLayer layoutSublayers]). - // We need to call it on main if the node is loaded to support automatic subnode management. - // We can't release the lock before applying to pending state, or it may be flushed before it can be applied. - [ASDisplayNodeGetPendingState(self) layoutIfNeeded]; - } - } - - if (shouldApply) { - // The node is loaded and we're on main. - // Message the view or layer which in turn will call __layout on us (see -[_ASDisplayLayer layoutSublayers]). - [viewOrLayer layoutIfNeeded]; - } else if (loaded == NO) { - // The node is not loaded and we're not on main. - [self __layout]; - } -} - -- (BOOL)isOpaque -{ - _bridge_prologue_read; - return _getFromViewOrLayer(opaque, opaque); -} - - -- (void)setOpaque:(BOOL)newOpaque -{ - _bridge_prologue_write; - BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - - if (shouldApply) { - /* - NOTE: The values of `opaque` can be different between a view and layer. - - In debugging on Xcode 11 I saw the following in lldb: - - Initially for a new ASDisplayNode layer.isOpaque and _view.isOpaque are true - - Set the backgroundColor of the node to a valid UIColor - Expected: layer.isOpaque and view.isOpaque would be equal and true - Actual: view.isOpaque is true and layer.isOpaque is now false - - This broke some unit tests for view-backed nodes so I think we need to read directly from the view and can't rely on the layers value at this point. - */ - BOOL oldOpaque = _layer.opaque; - if (!_flags.layerBacked) { - oldOpaque = _view.opaque; - _view.opaque = newOpaque; - } - _layer.opaque = newOpaque; - if (oldOpaque != newOpaque) { - [self setNeedsDisplay]; - } - } else { - // NOTE: If we're in the background, we cannot read the current value of self.opaque (if loaded). - // When the pending state is applied to the view on main, we will call `setNeedsDisplay` if - // the new opaque value doesn't match the one on the layer. - ASDisplayNodeGetPendingState(self).opaque = newOpaque; - } -} - -- (BOOL)isUserInteractionEnabled -{ - _bridge_prologue_read; - if (_flags.layerBacked) return NO; - return _getFromViewOnly(userInteractionEnabled); -} - -- (void)setUserInteractionEnabled:(BOOL)enabled -{ - _bridge_prologue_write; - _setToViewOnly(userInteractionEnabled, enabled); -} -#if TARGET_OS_IOS -- (BOOL)isExclusiveTouch -{ - _bridge_prologue_read; - return _getFromViewOnly(exclusiveTouch); -} - -- (void)setExclusiveTouch:(BOOL)exclusiveTouch -{ - _bridge_prologue_write; - _setToViewOnly(exclusiveTouch, exclusiveTouch); -} -#endif -- (BOOL)clipsToBounds -{ - _bridge_prologue_read; - return _getFromViewOrLayer(masksToBounds, clipsToBounds); -} - -- (void)setClipsToBounds:(BOOL)clips -{ - _bridge_prologue_write; - _setToViewOrLayer(masksToBounds, clips, clipsToBounds, clips); -} - -- (CGPoint)anchorPoint -{ - _bridge_prologue_read; - return _getFromLayer(anchorPoint); -} - -- (void)setAnchorPoint:(CGPoint)newAnchorPoint -{ - _bridge_prologue_write; - _setToLayer(anchorPoint, newAnchorPoint); -} - -- (CGPoint)position -{ - _bridge_prologue_read; - return _getFromLayer(position); -} - -- (void)setPosition:(CGPoint)newPosition -{ - _bridge_prologue_write; - _setToLayer(position, newPosition); -} - -- (CGFloat)zPosition -{ - _bridge_prologue_read; - return _getFromLayer(zPosition); -} - -- (void)setZPosition:(CGFloat)newPosition -{ - _bridge_prologue_write; - _setToLayer(zPosition, newPosition); -} - -- (CATransform3D)transform -{ - _bridge_prologue_read; - return _getFromLayer(transform); -} - -- (void)setTransform:(CATransform3D)newTransform -{ - _bridge_prologue_write; - _setToLayer(transform, newTransform); -} - -- (CATransform3D)subnodeTransform -{ - _bridge_prologue_read; - return _getFromLayer(sublayerTransform); -} - -- (void)setSubnodeTransform:(CATransform3D)newSubnodeTransform -{ - _bridge_prologue_write; - _setToLayer(sublayerTransform, newSubnodeTransform); -} - -- (id)contents -{ - _bridge_prologue_read; - return _getFromLayer(contents); -} - -- (void)setContents:(id)newContents -{ - _bridge_prologue_write; - _setToLayer(contents, newContents); -} - -- (BOOL)isHidden -{ - _bridge_prologue_read; - return _getFromViewOrLayer(hidden, hidden); -} - -- (void)setHidden:(BOOL)flag -{ - _bridge_prologue_write; - _setToViewOrLayer(hidden, flag, hidden, flag); -} - -- (BOOL)needsDisplayOnBoundsChange -{ - _bridge_prologue_read; - return _getFromLayer(needsDisplayOnBoundsChange); -} - -- (void)setNeedsDisplayOnBoundsChange:(BOOL)flag -{ - _bridge_prologue_write; - _setToLayer(needsDisplayOnBoundsChange, flag); -} - -- (BOOL)autoresizesSubviews -{ - _bridge_prologue_read; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - return _getFromViewOnly(autoresizesSubviews); -} - -- (void)setAutoresizesSubviews:(BOOL)flag -{ - _bridge_prologue_write; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - _setToViewOnly(autoresizesSubviews, flag); -} - -- (UIViewAutoresizing)autoresizingMask -{ - _bridge_prologue_read; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - return _getFromViewOnly(autoresizingMask); -} - -- (void)setAutoresizingMask:(UIViewAutoresizing)mask -{ - _bridge_prologue_write; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - _setToViewOnly(autoresizingMask, mask); -} - -- (UIViewContentMode)contentMode -{ - _bridge_prologue_read; - if (_loaded(self)) { - if (_flags.layerBacked) { - return ASDisplayNodeUIContentModeFromCAContentsGravity(_layer.contentsGravity); - } else { - return _view.contentMode; - } - } else { - return ASDisplayNodeGetPendingState(self).contentMode; - } -} - -- (void)setContentMode:(UIViewContentMode)contentMode -{ - _bridge_prologue_write; - BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - if (shouldApply) { - if (_flags.layerBacked) { - _layer.contentsGravity = ASDisplayNodeCAContentsGravityFromUIContentMode(contentMode); - } else { - _view.contentMode = contentMode; - } - } else { - ASDisplayNodeGetPendingState(self).contentMode = contentMode; - } -} - -- (UIColor *)backgroundColor -{ - _bridge_prologue_read; - if (_loaded(self)) { - /* - Note: We can no longer rely simply on the layers backgroundColor value if the color is set directly on `_view` - There is no longer a 1:1 mapping between _view.backgroundColor and _layer.backgroundColor after testing in iOS 13 / Xcode 11 so we should prefer one or the other depending on the backing type for the node (view or layer) - */ - if (_flags.layerBacked) { - return _backgroundColor; - } else { - return _view.backgroundColor; - } - } - return ASDisplayNodeGetPendingState(self).backgroundColor; -} - -- (void)setBackgroundColor:(UIColor *)newBackgroundColor -{ - _bridge_prologue_write; - BOOL shouldApply = ASDisplayNodeShouldApplyBridgedWriteToView(self); - if (shouldApply) { - UIColor *oldBackgroundColor = _backgroundColor; - _backgroundColor = newBackgroundColor; - if (_flags.layerBacked) { - _layer.backgroundColor = _backgroundColor.CGColor; - } else { - /* - NOTE: Setting to the view and layer individually is necessary. - - As observed in lldb, the view does not appear to immediately propagate background color to the layer and actually clears it's value (`nil`) initially. This was caught by our snapshot tests. - - Given that UIColor / UIView has dynamic capabilties now, we should set directly to the view and make sure that the layers value is consistent here. - - */ - _view.backgroundColor = _backgroundColor; - // Gather the CGColorRef from the view incase there are any changes it might apply to which CGColorRef is returned for dynamic colors - _layer.backgroundColor = _view.backgroundColor.CGColor; - } - - if (![oldBackgroundColor isEqual:newBackgroundColor]) { - [self setNeedsDisplay]; - } - } else { - // NOTE: If we're in the background, we cannot read the current value of bgcolor (if loaded). - // When the pending state is applied to the view on main, we will call `setNeedsDisplay` if - // the new background color doesn't match the one on the layer. - _backgroundColor = newBackgroundColor; - ASDisplayNodeGetPendingState(self).backgroundColor = newBackgroundColor; - } -} - -- (UIColor *)tintColor -{ - __instanceLock__.lock(); - UIColor *retVal = nil; - BOOL shouldAscend = NO; - if (_flags.layerBacked) { - retVal = _tintColor; - // The first nondefault tint color value in the node’s hierarchy, ascending from and starting with the node itself. - shouldAscend = (retVal == nil); - } else { - ASDisplayNodeAssertThreadAffinity(self); - retVal = _getFromViewOnly(tintColor); - } - __instanceLock__.unlock(); - return shouldAscend ? self.supernode.tintColor : retVal; -} - -- (void)setTintColor:(UIColor *)color -{ - // Handle locking manually since we unlock to notify subclasses when tint color changes - __instanceLock__.lock(); - if (_flags.layerBacked) { - if (![_tintColor isEqual:color]) { - _tintColor = color; - - if (_loaded(self)) { - // Tint color has changed. Unlock here before calling subclasses and exit-early - __instanceLock__.unlock(); - [self tintColorDidChange]; - return; - } - } - } else { - _tintColor = color; - _setToViewOnly(tintColor, color); - } - __instanceLock__.unlock(); -} - -- (void)tintColorDidChange -{ - // ignore this, allow subclasses to be notified -} - -- (CGColorRef)shadowColor -{ - _bridge_prologue_read; - return _getFromLayer(shadowColor); -} - -- (void)setShadowColor:(CGColorRef)colorValue -{ - _bridge_prologue_write; - _setToLayer(shadowColor, colorValue); -} - -- (CGFloat)shadowOpacity -{ - _bridge_prologue_read; - return _getFromLayer(shadowOpacity); -} - -- (void)setShadowOpacity:(CGFloat)opacity -{ - _bridge_prologue_write; - _setToLayer(shadowOpacity, opacity); -} - -- (CGSize)shadowOffset -{ - _bridge_prologue_read; - return _getFromLayer(shadowOffset); -} - -- (void)setShadowOffset:(CGSize)offset -{ - _bridge_prologue_write; - _setToLayer(shadowOffset, offset); -} - -- (CGFloat)shadowRadius -{ - _bridge_prologue_read; - return _getFromLayer(shadowRadius); -} - -- (void)setShadowRadius:(CGFloat)radius -{ - _bridge_prologue_write; - _setToLayer(shadowRadius, radius); -} - -- (CGFloat)borderWidth -{ - _bridge_prologue_read; - return _getFromLayer(borderWidth); -} - -- (void)setBorderWidth:(CGFloat)width -{ - _bridge_prologue_write; - _setToLayer(borderWidth, width); -} - -- (CGColorRef)borderColor -{ - _bridge_prologue_read; - return _getFromLayer(borderColor); -} - -- (void)setBorderColor:(CGColorRef)colorValue -{ - _bridge_prologue_write; - _setToLayer(borderColor, colorValue); -} - -- (BOOL)allowsGroupOpacity -{ - _bridge_prologue_read; - return _getFromLayer(allowsGroupOpacity); -} - -- (void)setAllowsGroupOpacity:(BOOL)allowsGroupOpacity -{ - _bridge_prologue_write; - _setToLayer(allowsGroupOpacity, allowsGroupOpacity); -} - -- (BOOL)allowsEdgeAntialiasing -{ - _bridge_prologue_read; - return _getFromLayer(allowsEdgeAntialiasing); -} - -- (void)setAllowsEdgeAntialiasing:(BOOL)allowsEdgeAntialiasing -{ - _bridge_prologue_write; - _setToLayer(allowsEdgeAntialiasing, allowsEdgeAntialiasing); -} - -- (CAEdgeAntialiasingMask)edgeAntialiasingMask -{ - _bridge_prologue_read; - return _getFromLayer(edgeAntialiasingMask); -} - -- (void)setEdgeAntialiasingMask:(CAEdgeAntialiasingMask)edgeAntialiasingMask -{ - _bridge_prologue_write; - _setToLayer(edgeAntialiasingMask, edgeAntialiasingMask); -} - -- (UISemanticContentAttribute)semanticContentAttribute -{ - AS::MutexLocker l(__instanceLock__); - return _semanticContentAttribute; -} - -- (void)setSemanticContentAttribute:(UISemanticContentAttribute)semanticContentAttribute -{ - AS::MutexLocker l(__instanceLock__); - _setToViewOnly(semanticContentAttribute, semanticContentAttribute); - _semanticContentAttribute = semanticContentAttribute; -#if YOGA - [self semanticContentAttributeDidChange:semanticContentAttribute]; -#endif -} - -- (UIEdgeInsets)layoutMargins -{ - _bridge_prologue_read; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - UIEdgeInsets margins = _getFromViewOnly(layoutMargins); - - if (!AS_AT_LEAST_IOS11 && self.insetsLayoutMarginsFromSafeArea) { - UIEdgeInsets safeArea = self.safeAreaInsets; - margins = ASConcatInsets(margins, safeArea); - } - - return margins; -} - -- (void)setLayoutMargins:(UIEdgeInsets)layoutMargins -{ - _bridge_prologue_write; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - _setToViewOnly(layoutMargins, layoutMargins); -} - -- (BOOL)preservesSuperviewLayoutMargins -{ - _bridge_prologue_read; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - return _getFromViewOnly(preservesSuperviewLayoutMargins); -} - -- (void)setPreservesSuperviewLayoutMargins:(BOOL)preservesSuperviewLayoutMargins -{ - _bridge_prologue_write; - ASDisplayNodeAssert(!_flags.layerBacked, @"Danger: this property is undefined on layer-backed nodes."); - _setToViewOnly(preservesSuperviewLayoutMargins, preservesSuperviewLayoutMargins); -} - -- (void)layoutMarginsDidChange -{ - ASDisplayNodeAssertMainThread(); - - if (self.automaticallyRelayoutOnLayoutMarginsChanges) { - [self setNeedsLayout]; - } -} - -- (UIEdgeInsets)safeAreaInsets -{ - _bridge_prologue_read; - - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - if (!_flags.layerBacked && _loaded(self)) { - return self.view.safeAreaInsets; - } - } - return _fallbackSafeAreaInsets; -} - -- (BOOL)insetsLayoutMarginsFromSafeArea -{ - _bridge_prologue_read; - - return [self _locked_insetsLayoutMarginsFromSafeArea]; -} - -- (void)setInsetsLayoutMarginsFromSafeArea:(BOOL)insetsLayoutMarginsFromSafeArea -{ - ASDisplayNodeAssertThreadAffinity(self); - BOOL shouldNotifyAboutUpdate; - { - _bridge_prologue_write; - - _flags.fallbackInsetsLayoutMarginsFromSafeArea = insetsLayoutMarginsFromSafeArea; - - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - if (!_flags.layerBacked) { - _setToViewOnly(insetsLayoutMarginsFromSafeArea, insetsLayoutMarginsFromSafeArea); - } - } - - shouldNotifyAboutUpdate = _loaded(self) && (!AS_AT_LEAST_IOS11 || _flags.layerBacked); - } - - if (shouldNotifyAboutUpdate) { - [self layoutMarginsDidChange]; - } -} - -- (NSDictionary> *)actions -{ - _bridge_prologue_read; - return _getFromLayer(actions); -} - -- (void)setActions:(NSDictionary> *)actions -{ - _bridge_prologue_write; - _setToLayer(actions, actions); -} - -- (void)safeAreaInsetsDidChange -{ - ASDisplayNodeAssertMainThread(); - - if (self.automaticallyRelayoutOnSafeAreaChanges) { - [self setNeedsLayout]; - } - - [self _fallbackUpdateSafeAreaOnChildren]; -} - -@end - -@implementation ASDisplayNode (InternalPropertyBridge) - -- (CGFloat)layerCornerRadius -{ - _bridge_prologue_read; - return _getFromLayer(cornerRadius); -} - -- (void)setLayerCornerRadius:(CGFloat)newLayerCornerRadius -{ - _bridge_prologue_write; - _setToLayer(cornerRadius, newLayerCornerRadius); -} - -- (CACornerMask)layerMaskedCorners -{ - _bridge_prologue_read; - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - return _getFromLayer(maskedCorners); - } else { - return kASCACornerAllCorners; - } -} - -- (void)setLayerMaskedCorners:(CACornerMask)newLayerMaskedCorners -{ - _bridge_prologue_write; - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - _setToLayer(maskedCorners, newLayerMaskedCorners); - } else { - ASDisplayNodeAssert(newLayerMaskedCorners == kASCACornerAllCorners, - @"Cannot change maskedCorners property in iOS < 11 while using DefaultSlowCALayer rounding."); - } -} - -- (BOOL)_locked_insetsLayoutMarginsFromSafeArea -{ - DISABLED_ASAssertLocked(__instanceLock__); - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - if (!_flags.layerBacked) { - return _getFromViewOnly(insetsLayoutMarginsFromSafeArea); - } - } - return _flags.fallbackInsetsLayoutMarginsFromSafeArea; -} - -@end - -#pragma mark - UIViewBridgeAccessibility - -// ASDK supports accessibility for view or layer backed nodes. To be able to provide support for layer backed -// nodes, properties for all of the UIAccessibility protocol defined properties need to be provided an held in sync -// between node and view - -// Helper function with following logic: -// - If the node is not loaded yet use the property from the pending state -// - In case the node is loaded -// - Check if the node has a view and get the value from the view if loaded or from the pending state -// - If view is not available, e.g. the node is layer backed return the property value -#define _getAccessibilityFromViewOrProperty(nodeProperty, viewAndPendingViewStateProperty) _loaded(self) ? \ -(_view ? _view.viewAndPendingViewStateProperty : nodeProperty )\ -: ASDisplayNodeGetPendingState(self).viewAndPendingViewStateProperty - -// Helper function to set property values on pending state or view and property if loaded -#define _setAccessibilityToViewAndProperty(nodeProperty, nodeValueExpr, viewAndPendingViewStateProperty, viewAndPendingViewStateExpr) \ -nodeProperty = nodeValueExpr; _setToViewOnly(viewAndPendingViewStateProperty, viewAndPendingViewStateExpr) - -@implementation ASDisplayNode (UIViewBridgeAccessibility) - -- (BOOL)isAccessibilityElement -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_flags.isAccessibilityElement, isAccessibilityElement); -} - -- (void)setIsAccessibilityElement:(BOOL)isAccessibilityElement -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_flags.isAccessibilityElement, isAccessibilityElement, isAccessibilityElement, isAccessibilityElement); -} - -- (NSString *)accessibilityLabel -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityLabel, accessibilityLabel); -} - -- (void)setAccessibilityLabel:(NSString *)accessibilityLabel -{ - _bridge_prologue_write; - NSString *oldAccessibilityLabel = _getFromViewOnly(accessibilityLabel); - _setAccessibilityToViewAndProperty(_accessibilityLabel, accessibilityLabel, accessibilityLabel, accessibilityLabel); - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - NSAttributedString *accessibilityAttributedLabel = accessibilityLabel ? [[NSAttributedString alloc] initWithString:accessibilityLabel] : nil; - _setAccessibilityToViewAndProperty(_accessibilityAttributedLabel, accessibilityAttributedLabel, accessibilityAttributedLabel, accessibilityAttributedLabel); - } - - // We need to update action name when it's changed to reflect the latest state. - // Note: Update the custom action itself won't work when a11y is inside a list of custom actions - // in which one action results in a name change in the next action. In that case the UIAccessibility - // will hold the old action strongly until a11y jumps out of the list of custom actions. - // Thus we can only update name in place to have the change take effect. - BOOL needsUpdateActionName = self.isNodeLoaded && ![oldAccessibilityLabel isEqualToString:accessibilityLabel] && (0 != (_accessibilityTraits & ASInteractiveAccessibilityTraitsMask())); - if (needsUpdateActionName) { - self.accessibilityCustomAction.name = accessibilityLabel; - } -} - - -- (NSAttributedString *)accessibilityAttributedLabel -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityAttributedLabel, accessibilityAttributedLabel); -} - -- (void)setAccessibilityAttributedLabel:(NSAttributedString *)accessibilityAttributedLabel -{ - _bridge_prologue_write; - { _setAccessibilityToViewAndProperty(_accessibilityAttributedLabel, accessibilityAttributedLabel, accessibilityAttributedLabel, accessibilityAttributedLabel); } - { _setAccessibilityToViewAndProperty(_accessibilityLabel, accessibilityAttributedLabel.string, accessibilityLabel, accessibilityAttributedLabel.string); } -} - -- (NSString *)accessibilityHint -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityHint, accessibilityHint); -} - -- (void)setAccessibilityHint:(NSString *)accessibilityHint -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityHint, accessibilityHint, accessibilityHint, accessibilityHint); - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - NSAttributedString *accessibilityAttributedHint = accessibilityHint ? [[NSAttributedString alloc] initWithString:accessibilityHint] : nil; - _setAccessibilityToViewAndProperty(_accessibilityAttributedHint, accessibilityAttributedHint, accessibilityAttributedHint, accessibilityAttributedHint); - } -} - -- (NSAttributedString *)accessibilityAttributedHint -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityAttributedHint, accessibilityAttributedHint); -} - -- (void)setAccessibilityAttributedHint:(NSAttributedString *)accessibilityAttributedHint -{ - _bridge_prologue_write; - { _setAccessibilityToViewAndProperty(_accessibilityAttributedHint, accessibilityAttributedHint, accessibilityAttributedHint, accessibilityAttributedHint); } - - { _setAccessibilityToViewAndProperty(_accessibilityHint, accessibilityAttributedHint.string, accessibilityHint, accessibilityAttributedHint.string); } -} - -- (NSString *)accessibilityValue -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityValue, accessibilityValue); -} - -- (void)setAccessibilityValue:(NSString *)accessibilityValue -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityValue, accessibilityValue, accessibilityValue, accessibilityValue); - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - NSAttributedString *accessibilityAttributedValue = accessibilityValue ? [[NSAttributedString alloc] initWithString:accessibilityValue] : nil; - _setAccessibilityToViewAndProperty(_accessibilityAttributedValue, accessibilityAttributedValue, accessibilityAttributedValue, accessibilityAttributedValue); - } -} - -- (NSAttributedString *)accessibilityAttributedValue -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityAttributedValue, accessibilityAttributedValue); -} - -- (void)setAccessibilityAttributedValue:(NSAttributedString *)accessibilityAttributedValue -{ - _bridge_prologue_write; - { _setAccessibilityToViewAndProperty(_accessibilityAttributedValue, accessibilityAttributedValue, accessibilityAttributedValue, accessibilityAttributedValue); } - { _setAccessibilityToViewAndProperty(_accessibilityValue, accessibilityAttributedValue.string, accessibilityValue, accessibilityAttributedValue.string); } -} - -- (UIAccessibilityTraits)accessibilityTraits -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityTraits, accessibilityTraits); -} - -- (void)setAccessibilityTraits:(UIAccessibilityTraits)accessibilityTraits -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityTraits, accessibilityTraits, accessibilityTraits, accessibilityTraits); -} - -- (CGRect)accessibilityFrame -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityFrame, accessibilityFrame); -} - -- (void)setAccessibilityFrame:(CGRect)accessibilityFrame -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityFrame, accessibilityFrame, accessibilityFrame, accessibilityFrame); -} - -- (NSString *)accessibilityLanguage -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityLanguage, accessibilityLanguage); -} - -- (void)setAccessibilityLanguage:(NSString *)accessibilityLanguage -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityLanguage, accessibilityLanguage, accessibilityLanguage, accessibilityLanguage); -} - -- (BOOL)accessibilityElementsHidden -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_flags.accessibilityElementsHidden, accessibilityElementsHidden); -} - -- (void)setAccessibilityElementsHidden:(BOOL)accessibilityElementsHidden -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_flags.accessibilityElementsHidden, accessibilityElementsHidden, accessibilityElementsHidden, accessibilityElementsHidden); -} - -- (BOOL)accessibilityViewIsModal -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_flags.accessibilityViewIsModal, accessibilityViewIsModal); -} - -- (void)setAccessibilityViewIsModal:(BOOL)accessibilityViewIsModal -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_flags.accessibilityViewIsModal, accessibilityViewIsModal, accessibilityViewIsModal, accessibilityViewIsModal); -} - -- (BOOL)shouldGroupAccessibilityChildren -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_flags.shouldGroupAccessibilityChildren, shouldGroupAccessibilityChildren); -} - -- (void)setShouldGroupAccessibilityChildren:(BOOL)shouldGroupAccessibilityChildren -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_flags.shouldGroupAccessibilityChildren, shouldGroupAccessibilityChildren, shouldGroupAccessibilityChildren, shouldGroupAccessibilityChildren); -} - -- (NSString *)accessibilityIdentifier -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityIdentifier, accessibilityIdentifier); -} - -- (void)setAccessibilityIdentifier:(NSString *)accessibilityIdentifier -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityIdentifier, accessibilityIdentifier, accessibilityIdentifier, accessibilityIdentifier); -} - -- (void)setAccessibilityNavigationStyle:(UIAccessibilityNavigationStyle)accessibilityNavigationStyle -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityNavigationStyle, accessibilityNavigationStyle, accessibilityNavigationStyle, accessibilityNavigationStyle); -} - -- (UIAccessibilityNavigationStyle)accessibilityNavigationStyle -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityNavigationStyle, accessibilityNavigationStyle); -} - -- (void)setAccessibilityCustomActions:(NSArray *)accessibilityCustomActions -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityCustomActions, accessibilityCustomActions, accessibilityCustomActions, accessibilityCustomActions); -} - -- (NSArray *)accessibilityCustomActions -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityCustomActions, accessibilityCustomActions); -} - -#if TARGET_OS_TV -- (void)setAccessibilityHeaderElements:(NSArray *)accessibilityHeaderElements -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityHeaderElements, accessibilityHeaderElements, accessibilityHeaderElements, accessibilityHeaderElements); -} - -- (NSArray *)accessibilityHeaderElements -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityHeaderElements, accessibilityHeaderElements); -} -#endif - -- (void)setAccessibilityActivationPoint:(CGPoint)accessibilityActivationPoint -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityActivationPoint, accessibilityActivationPoint, accessibilityActivationPoint, accessibilityActivationPoint); -} - -- (CGPoint)accessibilityActivationPoint -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityActivationPoint, accessibilityActivationPoint); -} - -- (void)setAccessibilityPath:(UIBezierPath *)accessibilityPath -{ - _bridge_prologue_write; - _setAccessibilityToViewAndProperty(_accessibilityPath, accessibilityPath, accessibilityPath, accessibilityPath); -} - -- (UIBezierPath *)accessibilityPath -{ - _bridge_prologue_read; - return _getAccessibilityFromViewOrProperty(_accessibilityPath, accessibilityPath); -} - -- (NSInteger)accessibilityElementCount -{ - _bridge_prologue_read; - return _getFromViewOnly(accessibilityElementCount); -} - -@end - - -#pragma mark - ASAsyncTransactionContainer - -@implementation ASDisplayNode (ASAsyncTransactionContainer) - -- (BOOL)asyncdisplaykit_isAsyncTransactionContainer -{ - _bridge_prologue_read; - return _getFromViewOrLayer(asyncdisplaykit_isAsyncTransactionContainer, asyncdisplaykit_isAsyncTransactionContainer); -} - -- (void)asyncdisplaykit_setAsyncTransactionContainer:(BOOL)asyncTransactionContainer -{ - _bridge_prologue_write; - _setToViewOrLayer(asyncdisplaykit_asyncTransactionContainer, asyncTransactionContainer, asyncdisplaykit_asyncTransactionContainer, asyncTransactionContainer); -} - -- (ASAsyncTransactionContainerState)asyncdisplaykit_asyncTransactionContainerState -{ - ASDisplayNodeAssertMainThread(); - return [_layer asyncdisplaykit_asyncTransactionContainerState]; -} - -- (void)asyncdisplaykit_cancelAsyncTransactions -{ - ASDisplayNodeAssertMainThread(); - [_layer asyncdisplaykit_cancelAsyncTransactions]; -} - -- (void)asyncdisplaykit_setCurrentAsyncTransaction:(_ASAsyncTransaction *)transaction -{ - _layer.asyncdisplaykit_currentAsyncTransaction = transaction; -} - -- (_ASAsyncTransaction *)asyncdisplaykit_currentAsyncTransaction -{ - return _layer.asyncdisplaykit_currentAsyncTransaction; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.h b/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.h deleted file mode 100644 index cb95e9fb..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ASDisplayNodeCornerLayerDelegate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASDisplayNodeCornerLayerDelegate : NSObject -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.mm b/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.mm deleted file mode 100644 index 42838bab..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeCornerLayerDelegate.mm +++ /dev/null @@ -1,19 +0,0 @@ -// -// ASDisplayNodeCornerLayerDelegate.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASDisplayNodeCornerLayerDelegate.h" - -@implementation ASDisplayNodeCornerLayerDelegate - -- (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event -{ - return (id)kCFNull; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeInternal.h b/Example/Pods/Texture/Source/Private/ASDisplayNodeInternal.h deleted file mode 100644 index b9f5f40d..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeInternal.h +++ /dev/null @@ -1,404 +0,0 @@ -// -// ASDisplayNodeInternal.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -// -// The following methods are ONLY for use by _ASDisplayLayer, _ASDisplayView, and ASDisplayNode. -// These methods must never be called or overridden by other classes. -// - -#import -#import -#import -#import -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol _ASDisplayLayerDelegate; -@class _ASDisplayLayer; -@class _ASPendingState; -@class ASNodeController; -struct ASDisplayNodeFlags; - -BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector); -BOOL ASDisplayNodeNeedsSpecialPropertiesHandling(BOOL isSynchronous, BOOL isLayerBacked); - -/// Get the pending view state for the node, creating one if needed. -_ASPendingState * ASDisplayNodeGetPendingState(ASDisplayNode * node); - -typedef NS_OPTIONS(unsigned short, ASDisplayNodeMethodOverrides) -{ - ASDisplayNodeMethodOverrideNone = 0, - ASDisplayNodeMethodOverrideTouchesBegan = 1 << 0, - ASDisplayNodeMethodOverrideTouchesCancelled = 1 << 1, - ASDisplayNodeMethodOverrideTouchesEnded = 1 << 2, - ASDisplayNodeMethodOverrideTouchesMoved = 1 << 3, - ASDisplayNodeMethodOverrideLayoutSpecThatFits = 1 << 4, - ASDisplayNodeMethodOverrideCalcLayoutThatFits = 1 << 5, - ASDisplayNodeMethodOverrideCalcSizeThatFits = 1 << 6, -}; - -typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags) -{ - Synchronous = 1 << 0, - YogaLayoutInProgress = 1 << 1, -}; - -// Can be called without the node's lock. Client is responsible for thread safety. -#define _loaded(node) (node->_layer != nil) - -#define checkFlag(flag) ((_atomicFlags.load() & flag) != 0) -// Returns the old value of the flag as a BOOL. -#define setFlag(flag, x) (((x ? _atomicFlags.fetch_or(flag) \ - : _atomicFlags.fetch_and(~flag)) & flag) != 0) - -ASDK_EXTERN NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification; -ASDK_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp; - -// Allow 2^n increments of begin disabling hierarchy notifications -#define VISIBILITY_NOTIFICATIONS_DISABLED_BITS 4 - -#define TIME_DISPLAYNODE_OPS 0 // If you're using this information frequently, try: (DEBUG || PROFILE) -static constexpr CACornerMask kASCACornerAllCorners = - kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner; - -#define NUM_CLIP_CORNER_LAYERS 4 - -@interface ASDisplayNode () <_ASTransitionContextCompletionDelegate, CALayerDelegate> -{ -@package - AS::RecursiveMutex __instanceLock__; - - _ASPendingState *_pendingViewState; - - UIView *_view; - CALayer *_layer; - - std::atomic _atomicFlags; - - struct ASDisplayNodeFlags { - // public properties - unsigned viewEverHadAGestureRecognizerAttached:1; - unsigned layerBacked:1; - unsigned displaysAsynchronously:1; - unsigned rasterizesSubtree:1; - unsigned shouldBypassEnsureDisplay:1; - unsigned displaySuspended:1; - unsigned shouldAnimateSizeChanges:1; - - // Wrapped view handling - - // The layer contents should not be cleared in case the node is wrapping a UIImageView.UIImageView is specifically - // optimized for performance and does not use the usual way to provide the contents of the CALayer via the - // CALayerDelegate method that backs the UIImageView. - unsigned canClearContentsOfLayer:1; - - // Prevent calling setNeedsDisplay on a layer that backs a UIImageView. Usually calling setNeedsDisplay on a CALayer - // triggers a recreation of the contents of layer unfortunately calling it on a CALayer that backs a UIImageView - // it goes through the normal flow to assign the contents to a layer via the CALayerDelegate methods. Unfortunately - // UIImageView does not do recreate the layer contents the usual way, it actually does not implement some of the - // methods at all instead it throws away the contents of the layer and nothing will show up. - unsigned canCallSetNeedsDisplayOfLayer:1; - - unsigned implementsDrawRect:1; - unsigned implementsImageDisplay:1; - unsigned implementsDrawParameters:1; - - // internal state - unsigned isEnteringHierarchy:1; - unsigned isExitingHierarchy:1; - unsigned isInHierarchy:1; - unsigned visibilityNotificationsDisabled:VISIBILITY_NOTIFICATIONS_DISABLED_BITS; - unsigned isDeallocating:1; - -#if YOGA - unsigned willApplyNextYogaCalculatedLayout:1; -#endif - // Automatically manages subnodes - unsigned automaticallyManagesSubnodes:1; // Main thread only - unsigned placeholderEnabled:1; - // Accessibility support - unsigned isAccessibilityElement:1; - unsigned accessibilityElementsHidden:1; - unsigned accessibilityViewIsModal:1; - unsigned shouldGroupAccessibilityChildren:1; - unsigned isAccessibilityContainer:1; - unsigned fallbackInsetsLayoutMarginsFromSafeArea:1; - unsigned automaticallyRelayoutOnSafeAreaChanges:1; - unsigned automaticallyRelayoutOnLayoutMarginsChanges:1; - unsigned isViewControllerRoot:1; - unsigned hasHadInterfaceStateDelegates:1; - } _flags; - - ASInterfaceState _interfaceState; - ASHierarchyState _hierarchyState; - ASInterfaceState _pendingInterfaceState; - ASInterfaceState _preExitingInterfaceState; - ASCornerRoundingType _cornerRoundingType; - ASDisplayNodePerformanceMeasurementOptions _measurementOptions; - ASDisplayNodeMethodOverrides _methodOverrides; - // Tinting support - UIColor *_tintColor; - - // Dynamic colors support - UIColor *_backgroundColor; - -@protected - ASDisplayNode * __weak _supernode; - NSMutableArray *_subnodes; - - ASNodeController *_strongNodeController; - __weak ASNodeController *_weakNodeController; - - // Set this to nil whenever you modify _subnodes - NSArray *_cachedSubnodes; - - std::atomic_uint _displaySentinel; - - // This is the desired contentsScale, not the scale at which the layer's contents should be displayed - CGFloat _contentsScaleForDisplay; - - UIEdgeInsets _hitTestSlop; - - // Layout support - ASLayoutElementStyle *_style; - ASPrimitiveTraitCollection _primitiveTraitCollection; - - // Layout Spec - ASLayoutSpecBlock _layoutSpecBlock; - NSString *_debugName; - -#if YOGA - // Only ASDisplayNodes are supported in _yogaChildren currently. This means that it is necessary to - // create ASDisplayNodes to make a stack layout when using Yoga. - // However, the implementation is mostly ready for id , with a few areas requiring updates. - NSMutableArray *_yogaChildren; - __weak ASDisplayNode *_yogaParent; - ASLayout *_yogaCalculatedLayout; -#endif - - // Layout Transition - _ASTransitionContext *_pendingLayoutTransitionContext; - NSTimeInterval _defaultLayoutTransitionDuration; - NSTimeInterval _defaultLayoutTransitionDelay; - UIViewAnimationOptions _defaultLayoutTransitionOptions; - - std::atomic _transitionID; - std::atomic _pendingTransitionID; - ASLayoutTransition *_pendingLayoutTransition; - ASDisplayNodeLayout _calculatedDisplayNodeLayout; - ASDisplayNodeLayout _pendingDisplayNodeLayout; - - /// Sentinel for layout data. Incremented when we get -setNeedsLayout / -invalidateCalculatedLayout. - /// Starts at 1. - std::atomic _layoutVersion; - - - // Layout Spec performance measurement - NSTimeInterval _layoutSpecTotalTime; - NSInteger _layoutSpecNumberOfPasses; - NSTimeInterval _layoutComputationTotalTime; - NSInteger _layoutComputationNumberOfPasses; - - - // View Loading - ASDisplayNodeViewBlock _viewBlock; - ASDisplayNodeLayerBlock _layerBlock; - NSMutableArray *_onDidLoadBlocks; - Class _viewClass; // nil -> _ASDisplayView - Class _layerClass; // nil -> _ASDisplayLayer - - - // Placeholder support - UIImage *_placeholderImage; - CALayer *_placeholderLayer; - - // keeps track of nodes/subnodes that have not finished display, used with placeholders - ASWeakSet *_pendingDisplayNodes; - - - // Corner Radius support - CGFloat _cornerRadius; - CALayer *_clipCornerLayers[NUM_CLIP_CORNER_LAYERS]; - CACornerMask _maskedCorners; - - ASDisplayNodeContextModifier _willDisplayNodeContentWithRenderingContext; - ASDisplayNodeContextModifier _didDisplayNodeContentWithRenderingContext; - - - // Accessibility support - NSString *_accessibilityLabel; - NSAttributedString *_accessibilityAttributedLabel; - NSString *_accessibilityHint; - NSAttributedString *_accessibilityAttributedHint; - NSString *_accessibilityValue; - NSAttributedString *_accessibilityAttributedValue; - UIAccessibilityTraits _accessibilityTraits; - CGRect _accessibilityFrame; - NSString *_accessibilityLanguage; - NSString *_accessibilityIdentifier; - UIAccessibilityNavigationStyle _accessibilityNavigationStyle; - NSArray *_accessibilityCustomActions; - NSArray *_accessibilityHeaderElements; - CGPoint _accessibilityActivationPoint; - UIBezierPath *_accessibilityPath; - - - // Safe Area support - // These properties are used on iOS 10 and lower, where safe area is not supported by UIKit. - UIEdgeInsets _fallbackSafeAreaInsets; - - // Right-to-Left layout support - UISemanticContentAttribute _semanticContentAttribute; - -#pragma mark - ASDisplayNode (Debugging) - ASLayout *_unflattenedLayout; - -#if TIME_DISPLAYNODE_OPS -@public - NSTimeInterval _debugTimeToCreateView; - NSTimeInterval _debugTimeToApplyPendingState; - NSTimeInterval _debugTimeToAddSubnodeViews; - NSTimeInterval _debugTimeForDidLoad; -#endif - - /// Fast path: tells whether we've ever had an interface state delegate before. - __weak id _interfaceStateDelegates[AS_MAX_INTERFACE_STATE_DELEGATES]; -} - -+ (void)scheduleNodeForRecursiveDisplay:(ASDisplayNode *)node; - -/// The _ASDisplayLayer backing the node, if any. -@property (nullable, nonatomic, readonly) _ASDisplayLayer *asyncLayer; - -/// Bitmask to check which methods an object overrides. -- (ASDisplayNodeMethodOverrides)methodOverrides; - -/** - * Invoked before a call to setNeedsLayout to the underlying view - */ -- (void)__setNeedsLayout; - -/** - * Invoked after a call to setNeedsDisplay to the underlying view - */ -- (void)__setNeedsDisplay; - -/** - * Setup the node -> controller reference. Strong or weak is based on - * the "shouldInvertStrongReference" property of the controller. - * - * Note: To prevent lock-ordering deadlocks, this method does not take the node's lock. - * In practice, changing the node controller of a node multiple times is not - * supported behavior. - */ -- (void)__setNodeController:(ASNodeController *)controller; - -/** - * Called whenever the node needs to layout its subnodes and, if it's already loaded, its subviews. Executes the layout pass for the node - * - * This method is thread-safe but asserts thread affinity. - */ -- (void)__layout; - -/** - * Internal tree modification methods. - */ -- (void)_removeFromSupernodeIfEqualTo:(ASDisplayNode *)supernode; - -// Private API for helper functions / unit tests. Use ASDisplayNodeDisableHierarchyNotifications() to control this. -- (BOOL)__visibilityNotificationsDisabled; -- (BOOL)__selfOrParentHasVisibilityNotificationsDisabled; -- (void)__incrementVisibilityNotificationsDisabled; -- (void)__decrementVisibilityNotificationsDisabled; - -/// Helper method to summarize whether or not the node run through the display process -- (BOOL)_implementsDisplay; - -/// Display the node's view/layer immediately on the current thread, bypassing the background thread rendering. Will be deprecated. -- (void)displayImmediately; - -/// Refreshes any precomposited or drawn clip corners, setting up state as required to transition corner config. -- (void)updateCornerRoundingWithType:(ASCornerRoundingType)newRoundingType - cornerRadius:(CGFloat)newCornerRadius - maskedCorners:(CACornerMask)newMaskedCorners; - -/// Update the Semantic Content Attribute. Trigger layout if this value has changed. -- (void)updateSemanticContentAttributeWithAttribute:(UISemanticContentAttribute)attribute; - -/// Alternative initialiser for backing with a custom view class. Supports asynchronous display with _ASDisplayView subclasses. -- (instancetype)initWithViewClass:(Class)viewClass; - -/// Alternative initialiser for backing with a custom layer class. Supports asynchronous display with _ASDisplayLayer subclasses. -- (instancetype)initWithLayerClass:(Class)layerClass; - -@property (nonatomic) CGFloat contentsScaleForDisplay; - -- (void)applyPendingViewState; - -/** - * Makes a local copy of the interface state delegates then calls the block on each. - * - * Lock is not held during block invocation. Method must not be called with the lock held. - */ -- (void)enumerateInterfaceStateDelegates:(void(NS_NOESCAPE ^)(id delegate))block; - -/** - * This method has proven helpful in a few rare scenarios, similar to a category extension on UIView, - * but it's considered private API for now and its use should not be encouraged. - * @param checkViewHierarchy If YES, and no supernode can be found, method will walk up from `self.view` to find a supernode. - * If YES, this method must be called on the main thread and the node must not be layer-backed. - */ -- (nullable ASDisplayNode *)_supernodeWithClass:(Class)supernodeClass checkViewHierarchy:(BOOL)checkViewHierarchy; - -/** - * Whether this node rasterizes its descendants. See -enableSubtreeRasterization. - */ -@property (readonly) BOOL rasterizesSubtree; - -/** - * Called if a gesture recognizer was attached to an _ASDisplayView - */ -- (void)nodeViewDidAddGestureRecognizer; - -// Recalculates fallbackSafeAreaInsets for the subnodes -- (void)_fallbackUpdateSafeAreaOnChildren; - -@end - -@interface ASDisplayNode (InternalPropertyBridge) - -@property (nonatomic) CGFloat layerCornerRadius; - -/// NOTE: Changing this to non-default under iOS < 11 will make an assertion (for the end user to see.) -@property (nonatomic) CACornerMask layerMaskedCorners; - -- (BOOL)_locked_insetsLayoutMarginsFromSafeArea; - -@end - -@interface ASDisplayNode (ASLayoutElementPrivate) - -/** - * Returns the internal style object or creates a new if no exists. Need to be called with lock held. - */ -- (ASLayoutElementStyle *)_locked_style; - -/** - * Returns the current layout element. Need to be called with lock held. - */ -- (id)_locked_layoutElementThatFits:(ASSizeRange)constrainedSize; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeLayout.h b/Example/Pods/Texture/Source/Private/ASDisplayNodeLayout.h deleted file mode 100644 index ba8d9c27..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeLayout.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// ASDisplayNodeLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import - -@class ASLayout; - -/* - * Represents a connection between an ASLayout and a ASDisplayNode - * ASDisplayNode uses this to store additional information that are necessary besides the layout - */ -struct ASDisplayNodeLayout { - ASLayout *layout; - ASSizeRange constrainedSize; - CGSize parentSize; - BOOL requestedLayoutFromAbove; - NSUInteger version; - - /* - * Create a new display node layout with - * @param layout The layout to associate, usually returned from a call to -layoutThatFits:parentSize: - * @param constrainedSize Constrained size used to create the layout - * @param parentSize Parent size used to create the layout - * @param version The version of the source layout data – see ASDisplayNode's _layoutVersion. - */ - ASDisplayNodeLayout(ASLayout *layout, ASSizeRange constrainedSize, CGSize parentSize, NSUInteger version) - : layout(layout), constrainedSize(constrainedSize), parentSize(parentSize), requestedLayoutFromAbove(NO), version(version) {}; - - /* - * Creates a layout without any layout associated. By default this display node layout is dirty. - */ - ASDisplayNodeLayout() - : layout(nil), constrainedSize({{0, 0}, {0, 0}}), parentSize({0, 0}), requestedLayoutFromAbove(NO), version(0) {}; - - /** - * Returns whether this is valid for a given version - */ - BOOL isValid(NSUInteger versionArg) { - return layout != nil && version >= versionArg; - } - - /** - * Returns whether this is valid for a given constrained size, parent size, and version - */ - BOOL isValid(ASSizeRange theConstrainedSize, CGSize theParentSize, NSUInteger versionArg) { - return isValid(versionArg) - && CGSizeEqualToSize(parentSize, theParentSize) - && ASSizeRangeEqualToSizeRange(constrainedSize, theConstrainedSize); - } -}; diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.h b/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.h deleted file mode 100644 index 1e1ef207..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASDisplayNodeTipState.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASDisplayNode, ASTipNode; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASDisplayNodeTipState : NSObject - -- (instancetype)initWithNode:(ASDisplayNode *)node NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; - -/// Unsafe because once the node is deallocated, we will not be able to access the tip state. -@property (nonatomic, unsafe_unretained, readonly) ASDisplayNode *node; - -/// Main-thread-only. -@property (nonatomic, nullable) ASTipNode *tipNode; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.mm b/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.mm deleted file mode 100644 index b5a42319..00000000 --- a/Example/Pods/Texture/Source/Private/ASDisplayNodeTipState.mm +++ /dev/null @@ -1,25 +0,0 @@ -// -// ASDisplayNodeTipState.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASDisplayNodeTipState.h" - -@interface ASDisplayNodeTipState () -@end - -@implementation ASDisplayNodeTipState - -- (instancetype)initWithNode:(ASDisplayNode *)node -{ - if (self = [super init]) { - _node = node; - } - return self; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.h b/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.h deleted file mode 100644 index 5be2185f..00000000 --- a/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ASIGListAdapterBasedDataSource.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASIGListAdapterBasedDataSource : NSObject - -- (instancetype)initWithListAdapter:(IGListAdapter *)listAdapter collectionDelegate:(nullable id)collectionDelegate; - -@end - -#endif - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.mm b/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.mm deleted file mode 100644 index 10f51f37..00000000 --- a/Example/Pods/Texture/Source/Private/ASIGListAdapterBasedDataSource.mm +++ /dev/null @@ -1,405 +0,0 @@ -// -// ASIGListAdapterBasedDataSource.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_IG_LIST_KIT - -#import "ASIGListAdapterBasedDataSource.h" -#import -#import - -typedef IGListSectionController ASIGSectionController; - -/// The optional methods that a class implements from ASSectionController. -/// Note: Bitfields are not supported by NSValue so we can't use them. -typedef struct { - BOOL sizeRangeForItem; - BOOL shouldBatchFetch; - BOOL beginBatchFetchWithContext; -} ASSectionControllerOverrides; - -/// The optional methods that a class implements from ASSupplementaryNodeSource. -/// Note: Bitfields are not supported by NSValue so we can't use them. -typedef struct { - BOOL sizeRangeForSupplementary; -} ASSupplementarySourceOverrides; - -@protocol ASIGSupplementaryNodeSource -@end - -@interface ASIGListAdapterBasedDataSource () -@property (nonatomic, weak, readonly) IGListAdapter *listAdapter; -@property (nonatomic, readonly) id delegate; -@property (nonatomic, readonly) id dataSource; -@property (nonatomic, weak, readonly) id collectionDelegate; - -/** - * The section controller that we will forward beginBatchFetchWithContext: to. - * Since shouldBatchFetch: is called on main, we capture the last section controller in there, - * and then we use it and clear it in beginBatchFetchWithContext: (on default queue). - * - * It is safe to use it without a lock in this limited way, since those two methods will - * never execute in parallel. - */ -@property (nonatomic, weak) ASIGSectionController *sectionControllerForBatchFetching; -@end - -@implementation ASIGListAdapterBasedDataSource - -- (instancetype)initWithListAdapter:(IGListAdapter *)listAdapter collectionDelegate:(nullable id)collectionDelegate -{ - if (self = [super init]) { -#if IG_LIST_COLLECTION_VIEW - [ASIGListAdapterBasedDataSource setASCollectionViewSuperclass]; -#endif - [ASIGListAdapterBasedDataSource configureUpdater:listAdapter.updater]; - - ASDisplayNodeAssert([listAdapter conformsToProtocol:@protocol(UICollectionViewDataSource)], @"Expected IGListAdapter to conform to UICollectionViewDataSource."); - ASDisplayNodeAssert([listAdapter conformsToProtocol:@protocol(UICollectionViewDelegateFlowLayout)], @"Expected IGListAdapter to conform to UICollectionViewDelegateFlowLayout."); - _listAdapter = listAdapter; - _collectionDelegate = collectionDelegate; - } - return self; -} - -- (id)dataSource -{ - return (id)_listAdapter; -} - -- (id)delegate -{ - return (id)_listAdapter; -} - -#pragma mark - ASCollectionDelegate - -- (void)collectionNode:(ASCollectionNode *)collectionNode didSelectItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionNode.view didSelectItemAtIndexPath:indexPath]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode didDeselectItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionNode.view didDeselectItemAtIndexPath:indexPath]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode didHighlightItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionNode.view didHighlightItemAtIndexPath:indexPath]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionNode.view didUnhighlightItemAtIndexPath:indexPath]; -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - [self.delegate scrollViewDidScroll:scrollView]; -} - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - [self.delegate scrollViewWillBeginDragging:scrollView]; -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset -{ - // IGListAdapter doesn't implement scrollViewWillEndDragging yet (pending pull request), so we need this check for now. Doesn't hurt to have it anyways :) - if ([self.delegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]) { - [self.delegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset]; - } -} - -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate -{ - [self.delegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate]; -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView -{ - [self.delegate scrollViewDidEndDecelerating:scrollView]; -} - -- (BOOL)shouldBatchFetchForCollectionNode:(ASCollectionNode *)collectionNode -{ - if ([_collectionDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionNode:)]) { - return [_collectionDelegate shouldBatchFetchForCollectionNode:collectionNode]; - } - - NSInteger sectionCount = [self numberOfSectionsInCollectionNode:collectionNode]; - if (sectionCount == 0) { - return NO; - } - - // If they implement shouldBatchFetch, call it. Otherwise, just say YES if they implement beginBatchFetch. - ASIGSectionController *ctrl = [self sectionControllerForSection:sectionCount - 1]; - ASSectionControllerOverrides o = [ASIGListAdapterBasedDataSource overridesForSectionControllerClass:ctrl.class]; - BOOL result = (o.shouldBatchFetch ? [ctrl shouldBatchFetch] : o.beginBatchFetchWithContext); - if (result) { - self.sectionControllerForBatchFetching = ctrl; - } - return result; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode willBeginBatchFetchWithContext:(ASBatchContext *)context -{ - if ([_collectionDelegate respondsToSelector:@selector(collectionNode:willBeginBatchFetchWithContext:)]) { - [_collectionDelegate collectionNode:collectionNode willBeginBatchFetchWithContext:context]; - return; - } - - ASIGSectionController *ctrl = self.sectionControllerForBatchFetching; - self.sectionControllerForBatchFetching = nil; - [ctrl beginBatchFetchWithContext:context]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode willDisplayItemWithNode:(ASCellNode *)node -{ - NSIndexPath *indexPath = [collectionNode.view indexPathForNode:node]; - UIView *contentView = node.view.superview; - UICollectionViewCell *cell = (UICollectionViewCell *)contentView.superview; - - if (cell == nil || indexPath == nil) { - return; - } - - [self.delegate collectionView:collectionNode.view willDisplayCell:cell forItemAtIndexPath:indexPath]; -} - -- (void)collectionNode:(ASCollectionNode *)collectionNode didEndDisplayingItemWithNode:(ASCellNode *)node -{ - NSIndexPath *indexPath = [collectionNode.view indexPathForNode:node]; - UIView *contentView = node.view.superview; - UICollectionViewCell *cell = (UICollectionViewCell *)contentView.superview; - - if (cell == nil || indexPath == nil) { - return; - } - - [self.delegate collectionView:collectionNode.view didEndDisplayingCell:cell forItemAtIndexPath:indexPath]; -} - -/** - * Note: It is not documented that ASCollectionNode will forward these UIKit delegate calls if they are implemented. - * It is not considered harmful to do so, and adding them to documentation will confuse most users, who should - * instead using the ASCollectionDelegate callbacks. - */ -#pragma mark - ASCollectionDelegateInterop - -- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionView willDisplayCell:cell forItemAtIndexPath:indexPath]; -} - -- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath -{ - [self.delegate collectionView:collectionView didEndDisplayingCell:cell forItemAtIndexPath:indexPath]; -} - -#pragma mark - ASCollectionDelegateFlowLayout - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForHeaderInSection:(NSInteger)section -{ - id src = [self supplementaryElementSourceForSection:section]; - if ([ASIGListAdapterBasedDataSource overridesForSupplementarySourceClass:[src class]].sizeRangeForSupplementary) { - return [src sizeRangeForSupplementaryElementOfKind:UICollectionElementKindSectionHeader atIndex:0]; - } else { - return ASSizeRangeZero; - } -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode sizeRangeForFooterInSection:(NSInteger)section -{ - id src = [self supplementaryElementSourceForSection:section]; - if ([ASIGListAdapterBasedDataSource overridesForSupplementarySourceClass:[src class]].sizeRangeForSupplementary) { - return [src sizeRangeForSupplementaryElementOfKind:UICollectionElementKindSectionFooter atIndex:0]; - } else { - return ASSizeRangeZero; - } -} - -- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section -{ - return [self.delegate collectionView:collectionView layout:collectionViewLayout insetForSectionAtIndex:section]; -} - -- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section -{ - return [self.delegate collectionView:collectionView layout:collectionViewLayout minimumLineSpacingForSectionAtIndex:section]; -} - -- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section -{ - return [self.delegate collectionView:collectionView layout:collectionViewLayout minimumInteritemSpacingForSectionAtIndex:section]; -} - -#pragma mark - ASCollectionDataSource - -- (NSInteger)collectionNode:(ASCollectionNode *)collectionNode numberOfItemsInSection:(NSInteger)section -{ - return [self.dataSource collectionView:collectionNode.view numberOfItemsInSection:section]; -} - -- (NSInteger)numberOfSectionsInCollectionNode:(ASCollectionNode *)collectionNode -{ - return [self.dataSource numberOfSectionsInCollectionView:collectionNode.view]; -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASIGSectionController *ctrl = [self sectionControllerForSection:indexPath.section]; - ASDisplayNodeAssert([ctrl respondsToSelector:@selector(nodeBlockForItemAtIndex:)], @"Expected section controller to respond to to %@. Controller: %@", NSStringFromSelector(@selector(nodeBlockForItemAtIndex:)), ctrl); - return [ctrl nodeBlockForItemAtIndex:indexPath.item]; -} - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASIGSectionController *ctrl = [self sectionControllerForSection:indexPath.section]; - ASDisplayNodeAssert([ctrl respondsToSelector:@selector(nodeForItemAtIndex:)], @"Expected section controller to respond to to %@. Controller: %@", NSStringFromSelector(@selector(nodeForItemAtIndex:)), ctrl); - return [ctrl nodeForItemAtIndex:indexPath.item]; -} - -- (ASSizeRange)collectionNode:(ASCollectionNode *)collectionNode constrainedSizeForItemAtIndexPath:(NSIndexPath *)indexPath -{ - ASIGSectionController *ctrl = [self sectionControllerForSection:indexPath.section]; - if ([ASIGListAdapterBasedDataSource overridesForSectionControllerClass:ctrl.class].sizeRangeForItem) { - return [ctrl sizeRangeForItemAtIndex:indexPath.item]; - } else { - return ASSizeRangeUnconstrained; - } -} - -- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - id ctrl = [self supplementaryElementSourceForSection:indexPath.section]; - ASDisplayNodeAssert([ctrl respondsToSelector:@selector(nodeBlockForSupplementaryElementOfKind:atIndex:)], @"Expected section controller to respond to to %@. Controller: %@", NSStringFromSelector(@selector(nodeBlockForSupplementaryElementOfKind:atIndex:)), ctrl); - return [ctrl nodeBlockForSupplementaryElementOfKind:kind atIndex:indexPath.item]; -} - -- (ASCellNode *)collectionNode:(ASCollectionNode *)collectionNode nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - id ctrl = [self supplementaryElementSourceForSection:indexPath.section]; - ASDisplayNodeAssert([ctrl respondsToSelector:@selector(nodeForSupplementaryElementOfKind:atIndex:)], @"Expected section controller to respond to to %@. Controller: %@", NSStringFromSelector(@selector(nodeForSupplementaryElementOfKind:atIndex:)), ctrl); - return [ctrl nodeForSupplementaryElementOfKind:kind atIndex:indexPath.item]; -} - -- (NSArray *)collectionNode:(ASCollectionNode *)collectionNode supplementaryElementKindsInSection:(NSInteger)section -{ - return [[self supplementaryElementSourceForSection:section] supportedElementKinds]; -} - -#pragma mark - ASCollectionDataSourceInterop - -- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - return [self.dataSource collectionView:collectionView cellForItemAtIndexPath:indexPath]; -} - -- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath -{ - return [self.dataSource collectionView:collectionView viewForSupplementaryElementOfKind:kind atIndexPath:indexPath]; -} - -+ (BOOL)dequeuesCellsForNodeBackedItems -{ - return YES; -} - -#pragma mark - Helpers - -- (id)supplementaryElementSourceForSection:(NSInteger)section -{ - ASIGSectionController *ctrl = [self sectionControllerForSection:section]; - id src = (id)ctrl.supplementaryViewSource; - ASDisplayNodeAssert(src == nil || [src conformsToProtocol:@protocol(ASSupplementaryNodeSource)], @"Supplementary view source should conform to %@", NSStringFromProtocol(@protocol(ASSupplementaryNodeSource))); - return src; -} - -- (ASIGSectionController *)sectionControllerForSection:(NSInteger)section -{ - id object = [_listAdapter objectAtSection:section]; - ASIGSectionController *ctrl = (ASIGSectionController *)[_listAdapter sectionControllerForObject:object]; - ASDisplayNodeAssert([ctrl conformsToProtocol:@protocol(ASSectionController)], @"Expected section controller to conform to %@. Controller: %@", NSStringFromProtocol(@protocol(ASSectionController)), ctrl); - return ctrl; -} - -/// If needed, set ASCollectionView's superclass to IGListCollectionView (IGListKit < 3.0). -#if IG_LIST_COLLECTION_VIEW -+ (void)setASCollectionViewSuperclass -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - class_setSuperclass([ASCollectionView class], [IGListCollectionView class]); - }); -#pragma clang diagnostic pop -} -#endif - -/// Ensure updater won't call reloadData on us. -+ (void)configureUpdater:(id)updater -{ - // Cast to NSObject will be removed after https://github.com/Instagram/IGListKit/pull/435 - if ([(id)updater isKindOfClass:[IGListAdapterUpdater class]]) { - [(IGListAdapterUpdater *)updater setAllowsBackgroundReloading:NO]; - } else { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSLog(@"WARNING: Use of non-%@ updater with AsyncDisplayKit is discouraged. Updater: %@", NSStringFromClass([IGListAdapterUpdater class]), updater); - }); - } -} - -+ (ASSupplementarySourceOverrides)overridesForSupplementarySourceClass:(Class)c -{ - static NSCache *cache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - cache = [[NSCache alloc] init]; - }); - NSValue *obj = [cache objectForKey:c]; - ASSupplementarySourceOverrides o; - if (obj == nil) { - o.sizeRangeForSupplementary = [c instancesRespondToSelector:@selector(sizeRangeForSupplementaryElementOfKind:atIndex:)]; - obj = [NSValue valueWithBytes:&o objCType:@encode(ASSupplementarySourceOverrides)]; - [cache setObject:obj forKey:c]; - } else { - [obj getValue:&o]; - } - return o; -} - -+ (ASSectionControllerOverrides)overridesForSectionControllerClass:(Class)c -{ - static NSCache *cache; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - cache = [[NSCache alloc] init]; - }); - NSValue *obj = [cache objectForKey:c]; - ASSectionControllerOverrides o; - if (obj == nil) { - o.sizeRangeForItem = [c instancesRespondToSelector:@selector(sizeRangeForItemAtIndex:)]; - o.beginBatchFetchWithContext = [c instancesRespondToSelector:@selector(beginBatchFetchWithContext:)]; - o.shouldBatchFetch = [c instancesRespondToSelector:@selector(shouldBatchFetch)]; - obj = [NSValue valueWithBytes:&o objCType:@encode(ASSectionControllerOverrides)]; - [cache setObject:obj forKey:c]; - } else { - [obj getValue:&o]; - } - return o; -} - -@end - -#endif // AS_IG_LIST_KIT diff --git a/Example/Pods/Texture/Source/Private/ASImageNode+AnimatedImagePrivate.h b/Example/Pods/Texture/Source/Private/ASImageNode+AnimatedImagePrivate.h deleted file mode 100644 index 917eb6fb..00000000 --- a/Example/Pods/Texture/Source/Private/ASImageNode+AnimatedImagePrivate.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASImageNode+AnimatedImagePrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#define ASAnimatedImageDefaultRunLoopMode NSRunLoopCommonModes - -@interface ASImageNode () -{ - AS::Mutex _displayLinkLock; - id _animatedImage; - NSString *_animatedImageRunLoopMode; - CADisplayLink *_displayLink; - NSUInteger _lastSuccessfulFrameIndex; - - //accessed on main thread only - CFTimeInterval _playHead; - NSUInteger _playedLoops; - - // Group the BOOLs into a bitfield struct to save memory. - struct { - unsigned int animatedImagePaused:1; - unsigned int cropEnabled:1; // Defaults to YES. - unsigned int forceUpscaling:1; //Defaults to NO. - unsigned int regenerateFromImageAsset:1; //Defaults to NO. - } _imageNodeFlags; -} - -@property (nonatomic) CFTimeInterval lastDisplayLinkFire; - -@end - -@interface ASImageNode (AnimatedImagePrivate) - -- (void)_locked_setAnimatedImage:(id )animatedImage; - -@end - - -@interface ASImageNode (AnimatedImageInvalidation) - -- (void)invalidateAnimatedImage; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.h b/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.h deleted file mode 100644 index dd529a3a..00000000 --- a/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ASImageNode+CGExtras.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -/** - @abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images - @param sourceImageSize The size of the encoded image. - @param boundsSize The bounds in which the image will be displayed. - @param contentMode The mode that defines how image will be scaled and cropped to fit. Supported values are UIViewContentModeScaleToAspectFill and UIViewContentModeScaleToAspectFit. - @param cropRect A rectangle that is to be featured by the cropped image. The rectangle is specified as a "unit rectangle," using fractions of the source image's width and height, e.g. CGRectMake(0.5, 0, 0.5, 1.0) will feature the full right half a photo. If the cropRect is empty, the contentMode will be used to determine the drawRect's size, and only the cropRect's origin will be used for positioning. - @param forceUpscaling A boolean that indicates you would *not* like the backing size to be downscaled if the image is smaller than the destination size. Setting this to YES will result in higher memory usage when images are smaller than their destination. - @param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize. - @discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time. - */ -ASDK_EXTERN void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, - CGSize boundsSize, - UIViewContentMode contentMode, - CGRect cropRect, - BOOL forceUpscaling, - CGSize forcedSize, - CGSize *outBackingSize, - CGRect *outDrawRect - ); diff --git a/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.mm b/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.mm deleted file mode 100644 index b7550c54..00000000 --- a/Example/Pods/Texture/Source/Private/ASImageNode+CGExtras.mm +++ /dev/null @@ -1,122 +0,0 @@ -// -// ASImageNode+CGExtras.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -// TODO rewrite these to be closer to the intended use -- take UIViewContentMode as param, CGRect destinationBounds, CGSize sourceSize. -static CGSize _ASSizeFillWithAspectRatio(CGFloat aspectRatio, CGSize constraints); -static CGSize _ASSizeFitWithAspectRatio(CGFloat aspectRatio, CGSize constraints); - -static CGSize _ASSizeFillWithAspectRatio(CGFloat sizeToScaleAspectRatio, CGSize destinationSize) -{ - CGFloat destinationAspectRatio = destinationSize.width / destinationSize.height; - if (sizeToScaleAspectRatio > destinationAspectRatio) { - return CGSizeMake(destinationSize.height * sizeToScaleAspectRatio, destinationSize.height); - } else { - return CGSizeMake(destinationSize.width, round(destinationSize.width / sizeToScaleAspectRatio)); - } -} - -static CGSize _ASSizeFitWithAspectRatio(CGFloat aspectRatio, CGSize constraints) -{ - CGFloat constraintAspectRatio = constraints.width / constraints.height; - if (aspectRatio > constraintAspectRatio) { - return CGSizeMake(constraints.width, constraints.width / aspectRatio); - } else { - return CGSizeMake(constraints.height * aspectRatio, constraints.height); - } -} - -void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, - CGSize boundsSize, - UIViewContentMode contentMode, - CGRect cropRect, - BOOL forceUpscaling, - CGSize forcedSize, - CGSize *outBackingSize, - CGRect *outDrawRect - ) -{ - - size_t destinationWidth = boundsSize.width; - size_t destinationHeight = boundsSize.height; - - // Often, an image is too low resolution to completely fill the width and height provided. - // Per the API contract as commented in the header, we will adjust input parameters (destinationWidth, destinationHeight) to ensure that the image is not upscaled on the CPU. - CGFloat boundsAspectRatio = (CGFloat)destinationWidth / (CGFloat)destinationHeight; - - CGSize minimumDestinationSize = sourceImageSize; - BOOL cropToRectDimensions = !CGRectIsEmpty(cropRect); - - // Given image size and container ratio, calculate minimum container size for the image under different contentMode - if (cropToRectDimensions) { - minimumDestinationSize = CGSizeMake(boundsSize.width / cropRect.size.width, boundsSize.height / cropRect.size.height); - } else { - if (contentMode == UIViewContentModeScaleAspectFill) - minimumDestinationSize = _ASSizeFitWithAspectRatio(boundsAspectRatio, sourceImageSize); - else if (contentMode == UIViewContentModeScaleAspectFit) - minimumDestinationSize = _ASSizeFillWithAspectRatio(boundsAspectRatio, sourceImageSize); - } - - // If fitting the desired aspect ratio to the image size actually results in a larger buffer, use the input values. - // However, if there is a pixel savings (e.g. we would have to upscale the image), override the function arguments. - if (CGSizeEqualToSize(CGSizeZero, forcedSize) == NO) { - destinationWidth = (size_t)round(forcedSize.width); - destinationHeight = (size_t)round(forcedSize.height); - } else if (forceUpscaling == NO && (minimumDestinationSize.width * minimumDestinationSize.height) < (destinationWidth * destinationHeight)) { - destinationWidth = (size_t)round(minimumDestinationSize.width); - destinationHeight = (size_t)round(minimumDestinationSize.height); - if (destinationWidth == 0 || destinationHeight == 0) { - *outBackingSize = CGSizeZero; - *outDrawRect = CGRectZero; - return; - } - } - - // Figure out the scaled size within the destination bounds. - CGFloat sourceImageAspectRatio = sourceImageSize.width / sourceImageSize.height; - CGSize scaledSizeForImage = CGSizeMake(destinationWidth, destinationHeight); - - if (cropToRectDimensions) { - scaledSizeForImage = CGSizeMake(boundsSize.width / cropRect.size.width, boundsSize.height / cropRect.size.height); - } else { - if (contentMode == UIViewContentModeScaleAspectFill) - scaledSizeForImage = _ASSizeFillWithAspectRatio(sourceImageAspectRatio, scaledSizeForImage); - else if (contentMode == UIViewContentModeScaleAspectFit) - scaledSizeForImage = _ASSizeFitWithAspectRatio(sourceImageAspectRatio, scaledSizeForImage); - } - - // Figure out the rectangle into which to draw the image. - CGRect drawRect = CGRectZero; - if (cropToRectDimensions) { - drawRect = CGRectMake(-cropRect.origin.x * scaledSizeForImage.width, - -cropRect.origin.y * scaledSizeForImage.height, - scaledSizeForImage.width, - scaledSizeForImage.height); - } else { - // We want to obey the origin of cropRect in aspect-fill mode. - if (contentMode == UIViewContentModeScaleAspectFill) { - drawRect = CGRectMake(((destinationWidth - scaledSizeForImage.width) * cropRect.origin.x), - ((destinationHeight - scaledSizeForImage.height) * cropRect.origin.y), - scaledSizeForImage.width, - scaledSizeForImage.height); - - } - // And otherwise just center it. - else { - drawRect = CGRectMake(((destinationWidth - scaledSizeForImage.width) / 2.0), - ((destinationHeight - scaledSizeForImage.height) / 2.0), - scaledSizeForImage.width, - scaledSizeForImage.height); - } - } - - *outDrawRect = drawRect; - *outBackingSize = CGSizeMake(destinationWidth, destinationHeight); -} diff --git a/Example/Pods/Texture/Source/Private/ASImageNode+Private.h b/Example/Pods/Texture/Source/Private/ASImageNode+Private.h deleted file mode 100644 index 8de78c87..00000000 --- a/Example/Pods/Texture/Source/Private/ASImageNode+Private.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ASImageNode+Private.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -@interface ASImageNode (Private) - -- (void)_locked_setImage:(UIImage *)image; -- (UIImage *)_locked_Image; - -@end diff --git a/Example/Pods/Texture/Source/Private/ASInternalHelpers.h b/Example/Pods/Texture/Source/Private/ASInternalHelpers.h deleted file mode 100644 index 29fa2689..00000000 --- a/Example/Pods/Texture/Source/Private/ASInternalHelpers.h +++ /dev/null @@ -1,126 +0,0 @@ -// -// ASInternalHelpers.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASAvailability.h" - -#import - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -ASDK_EXTERN void ASInitializeFrameworkMainThread(void); - -ASDK_EXTERN BOOL ASDefaultAllowsGroupOpacity(void); -ASDK_EXTERN BOOL ASDefaultAllowsEdgeAntialiasing(void); - -ASDK_EXTERN BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector); -ASDK_EXTERN BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector); - -/// Replace a method from the given class with a block and returns the original method IMP -ASDK_EXTERN IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); - -/// Dispatches the given block to the main queue if not already running on the main thread -ASDK_EXTERN void ASPerformBlockOnMainThread(void (^block)(void)); - -/// Dispatches the given block to a background queue with priority of DISPATCH_QUEUE_PRIORITY_DEFAULT if not already run on a background queue -ASDK_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT - -ASDK_EXTERN CGFloat ASScreenScale(void); - -ASDK_EXTERN CGSize ASFloorSizeValues(CGSize s); - -ASDK_EXTERN CGFloat ASFloorPixelValue(CGFloat f); - -ASDK_EXTERN CGPoint ASCeilPointValues(CGPoint p); - -ASDK_EXTERN CGSize ASCeilSizeValues(CGSize s); - -ASDK_EXTERN CGFloat ASCeilPixelValue(CGFloat f); - -ASDK_EXTERN CGFloat ASRoundPixelValue(CGFloat f); - -ASDK_EXTERN Class _Nullable ASGetClassFromType(const char * _Nullable type); - -ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { - switch (info) { - case kCGImageAlphaNone: - case kCGImageAlphaNoneSkipLast: - case kCGImageAlphaNoneSkipFirst: - return YES; - default: - return NO; - } -} - -/** - @summary Conditionally performs UIView geometry changes in the given block without animation. - - Used primarily to circumvent UITableView forcing insertion animations when explicitly told not to via - `UITableViewRowAnimationNone`. More info: https://github.com/facebook/AsyncDisplayKit/pull/445 - - @param withoutAnimation Set to `YES` to perform given block without animation - @param block Perform UIView geometry changes within the passed block - */ -ASDISPLAYNODE_INLINE void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)(void)) { - if (withoutAnimation) { - [UIView performWithoutAnimation:block]; - } else { - block(); - } -} - -ASDISPLAYNODE_INLINE void ASBoundsAndPositionForFrame(CGRect rect, CGPoint origin, CGPoint anchorPoint, CGRect *bounds, CGPoint *position) -{ - *bounds = (CGRect){ origin, rect.size }; - *position = CGPointMake(rect.origin.x + rect.size.width * anchorPoint.x, - rect.origin.y + rect.size.height * anchorPoint.y); -} - -ASDISPLAYNODE_INLINE UIEdgeInsets ASConcatInsets(UIEdgeInsets insetsA, UIEdgeInsets insetsB) -{ - insetsA.top += insetsB.top; - insetsA.left += insetsB.left; - insetsA.bottom += insetsB.bottom; - insetsA.right += insetsB.right; - return insetsA; -} - -ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASImageDownloaderPriority ASImageDownloaderPriorityWithInterfaceState(ASInterfaceState interfaceState) { - if (ASInterfaceStateIncludesVisible(interfaceState)) { - return ASImageDownloaderPriorityVisible; - } - - if (ASInterfaceStateIncludesDisplay(interfaceState)) { - return ASImageDownloaderPriorityImminent; - } - - if (ASInterfaceStateIncludesPreload(interfaceState)) { - return ASImageDownloaderPriorityPreload; - } - - return ASImageDownloaderPriorityPreload; -} - -@interface NSIndexPath (ASInverseComparison) -- (NSComparisonResult)asdk_inverseCompare:(NSIndexPath *)otherIndexPath; -@end - -/** - * Create an NSMutableSet that uses pointers for hash & equality. - */ -ASDK_EXTERN NSMutableSet *ASCreatePointerBasedMutableSet(void); - -NS_ASSUME_NONNULL_END - -#ifndef AS_INITIALIZE_FRAMEWORK_MANUALLY -#define AS_INITIALIZE_FRAMEWORK_MANUALLY 0 -#endif diff --git a/Example/Pods/Texture/Source/Private/ASInternalHelpers.mm b/Example/Pods/Texture/Source/Private/ASInternalHelpers.mm deleted file mode 100644 index 4d6e1fde..00000000 --- a/Example/Pods/Texture/Source/Private/ASInternalHelpers.mm +++ /dev/null @@ -1,261 +0,0 @@ -// -// ASInternalHelpers.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -static NSNumber *allowsGroupOpacityFromUIKitOrNil; -static NSNumber *allowsEdgeAntialiasingFromUIKitOrNil; - -BOOL ASDefaultAllowsGroupOpacity() -{ - static BOOL groupOpacity; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSNumber *groupOpacityObj = allowsGroupOpacityFromUIKitOrNil ?: [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIViewGroupOpacity"]; - groupOpacity = groupOpacityObj ? groupOpacityObj.boolValue : YES; - }); - return groupOpacity; -} - -BOOL ASDefaultAllowsEdgeAntialiasing() -{ - static BOOL edgeAntialiasing; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSNumber *antialiasingObj = allowsEdgeAntialiasingFromUIKitOrNil ?: [NSBundle.mainBundle objectForInfoDictionaryKey:@"UIViewEdgeAntialiasing"]; - edgeAntialiasing = antialiasingObj ? antialiasingObj.boolValue : NO; - }); - return edgeAntialiasing; -} - -#if AS_SIGNPOST_ENABLE -void _ASInitializeSignpostObservers(void) -{ - // Orientation changes. Unavailable on tvOS. -#if !TARGET_OS_TV - [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationWillChangeStatusBarOrientationNotification object:nil queue:nil usingBlock:^(NSNotification *note) { - UIInterfaceOrientation orientation = (UIInterfaceOrientation)[note.userInfo[UIApplicationStatusBarOrientationUserInfoKey] integerValue]; - ASSignpostStart(OrientationChange, (id)nil, "from %s", UIInterfaceOrientationIsPortrait(orientation) ? "portrait" : "landscape"); - [CATransaction begin]; - }]; - [NSNotificationCenter.defaultCenter addObserverForName:UIApplicationDidChangeStatusBarOrientationNotification object:nil queue:nil usingBlock:^(NSNotification *note) { - // When profiling, go ahead and commit the transaction early so that it happens as part of our interval. - UIInterfaceOrientation orientation = (UIInterfaceOrientation)[note.userInfo[UIApplicationStatusBarOrientationUserInfoKey] integerValue]; - [CATransaction setCompletionBlock:^{ - ASSignpostEnd(OrientationChange, (id)nil, "to %s", UIInterfaceOrientationIsPortrait(orientation) ? "portrait" : "landscape"); - }]; - [CATransaction commit]; - }]; -#endif // TARGET_OS_TV -} -#endif // AS_SIGNPOST_ENABLE - -void ASInitializeFrameworkMainThread(void) -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - ASDisplayNodeCAssertMainThread(); - // Ensure these values are cached on the main thread before needed in the background. - if (ASActivateExperimentalFeature(ASExperimentalLayerDefaults)) { - // Nop. We will gather default values on-demand in ASDefaultAllowsGroupOpacity and ASDefaultAllowsEdgeAntialiasing - } else { - CALayer *layer = [[[UIView alloc] init] layer]; - allowsGroupOpacityFromUIKitOrNil = @(layer.allowsGroupOpacity); - allowsEdgeAntialiasingFromUIKitOrNil = @(layer.allowsEdgeAntialiasing); - } - ASNotifyInitialized(); -#if AS_SIGNPOST_ENABLE - _ASInitializeSignpostObservers(); -#endif - }); -} - -BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector) -{ - if (superclass == subclass) return NO; // Even if the class implements the selector, it doesn't override itself. - Method superclassMethod = class_getInstanceMethod(superclass, selector); - Method subclassMethod = class_getInstanceMethod(subclass, selector); - return (superclassMethod != subclassMethod); -} - -BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector) -{ - if (superclass == subclass) return NO; // Even if the class implements the selector, it doesn't override itself. - Method superclassMethod = class_getClassMethod(superclass, selector); - Method subclassMethod = class_getClassMethod(subclass, selector); - return (superclassMethod != subclassMethod); -} - -IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block) -{ - NSCParameterAssert(block); - - // Get original method - Method origMethod = class_getInstanceMethod(c, origSEL); - NSCParameterAssert(origMethod); - - // Convert block to IMP trampoline and replace method implementation - IMP newIMP = imp_implementationWithBlock(block); - - // Try adding the method if not yet in the current class - if (!class_addMethod(c, origSEL, newIMP, method_getTypeEncoding(origMethod))) { - return method_setImplementation(origMethod, newIMP); - } else { - return method_getImplementation(origMethod); - } -} - -void ASPerformBlockOnMainThread(void (^block)(void)) -{ - if (block == nil){ - return; - } - if (ASDisplayNodeThreadIsMain()) { - block(); - } else { - dispatch_async(dispatch_get_main_queue(), block); - } -} - -void ASPerformBlockOnBackgroundThread(void (^block)(void)) -{ - if (block == nil){ - return; - } - if (ASDisplayNodeThreadIsMain()) { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); - } else { - block(); - } -} - -Class _Nullable ASGetClassFromType(const char * _Nullable type) -{ - // Class types all start with @" - if (type == NULL || strncmp(type, "@\"", 2) != 0) { - return Nil; - } - - // Ensure length >= 3 - size_t typeLength = strlen(type); - if (typeLength < 3) { - ASDisplayNodeCFailAssert(@"Got invalid type-encoding: %s", type); - return Nil; - } - - // Copy type[2..(end-1)]. So @"UIImage" -> UIImage - size_t resultLength = typeLength - 3; - char className[resultLength + 1]; - strncpy(className, type + 2, resultLength); - className[resultLength] = '\0'; - return objc_getClass(className); -} - -CGFloat ASScreenScale() -{ - static CGFloat __scale = 0.0; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), YES, 0); - __scale = CGContextGetCTM(UIGraphicsGetCurrentContext()).a; - UIGraphicsEndImageContext(); - }); - return __scale; -} - -CGSize ASFloorSizeValues(CGSize s) -{ - return CGSizeMake(ASFloorPixelValue(s.width), ASFloorPixelValue(s.height)); -} - -// See ASCeilPixelValue for a more thoroguh explanation of (f + FLT_EPSILON), -// but here is some quick math: -// -// Imagine a layout that comes back with a height of 100.66666666663 -// for a 3x deice: -// 100.66666666663 * 3 = 301.99999999988995 -// floor(301.99999999988995) = 301 -// 301 / 3 = 100.333333333 -// -// If we add FLT_EPSILON to normalize the garbage at the end we get: -// po (100.66666666663 + FLT_EPSILON) * 3 = 302.00000035751782 -// floor(302.00000035751782) = 302 -// 302/3 = 100.66666666 -CGFloat ASFloorPixelValue(CGFloat f) -{ - CGFloat scale = ASScreenScale(); - return floor((f + FLT_EPSILON) * scale) / scale; -} - -CGPoint ASCeilPointValues(CGPoint p) -{ - return CGPointMake(ASCeilPixelValue(p.x), ASCeilPixelValue(p.y)); -} - -CGSize ASCeilSizeValues(CGSize s) -{ - return CGSizeMake(ASCeilPixelValue(s.width), ASCeilPixelValue(s.height)); -} - -// With 3x devices layouts will often to compute to pixel bounds but -// include garbage values beyond the precision of a float/double. -// This garbage can result in a pixel value being rounded up when it isn't -// necessary. -// -// For example, imagine a layout that comes back with a height of 100.666666666669 -// for a 3x device: -// 100.666666666669 * 3 = 302.00000000000699 -// ceil(302.00000000000699) = 303 -// 303/3 = 101 -// -// If we use FLT_EPSILON to get rid of the garbage at the end of the value, -// things work as expected: -// (100.666666666669 - FLT_EPSILON) * 3 = 301.99999964237912 -// ceil(301.99999964237912) = 302 -// 302/3 = 100.666666666 -// -// For even more conversation around this, see: -// https://github.com/TextureGroup/Texture/issues/838 -CGFloat ASCeilPixelValue(CGFloat f) -{ - CGFloat scale = ASScreenScale(); - return ceil((f - FLT_EPSILON) * scale) / scale; -} - -CGFloat ASRoundPixelValue(CGFloat f) -{ - CGFloat scale = ASScreenScale(); - return round(f * scale) / scale; -} - -@implementation NSIndexPath (ASInverseComparison) - -- (NSComparisonResult)asdk_inverseCompare:(NSIndexPath *)otherIndexPath -{ - return [otherIndexPath compare:self]; -} - -@end - -NSMutableSet *ASCreatePointerBasedMutableSet() -{ - static CFSetCallBacks callbacks; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - callbacks = kCFTypeSetCallBacks; - callbacks.equal = nullptr; - callbacks.hash = nullptr; - }); - return (__bridge_transfer NSMutableSet *)CFSetCreateMutable(NULL, 0, &callbacks); -} diff --git a/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.h b/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.h deleted file mode 100644 index 0cc3d03b..00000000 --- a/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ASLayerBackingTipProvider.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTipProvider.h" -#import - -#if AS_ENABLE_TIPS - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASLayerBackingTipProvider : ASTipProvider - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.mm b/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.mm deleted file mode 100644 index 19d1850a..00000000 --- a/Example/Pods/Texture/Source/Private/ASLayerBackingTipProvider.mm +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASLayerBackingTipProvider.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASLayerBackingTipProvider.h" - -#if AS_ENABLE_TIPS - -#import -#import -#import -#import -#import - -@implementation ASLayerBackingTipProvider - -- (ASTip *)tipForNode:(ASDisplayNode *)node -{ - // Already layer-backed. - if (node.layerBacked) { - return nil; - } - - // TODO: Avoid revisiting nodes we already visited - ASDisplayNode *failNode = ASDisplayNodeFindFirstNode(node, ^BOOL(ASDisplayNode * _Nonnull node) { - return !node.supportsLayerBacking; - }); - if (failNode != nil) { - return nil; - } - - ASTip *result = [[ASTip alloc] initWithNode:node - kind:ASTipKindEnableLayerBacking - format:@"Enable layer backing to improve performance"]; - return result; -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASLayoutTransition.h b/Example/Pods/Texture/Source/Private/ASLayoutTransition.h deleted file mode 100644 index f2bcf9b2..00000000 --- a/Example/Pods/Texture/Source/Private/ASLayoutTransition.h +++ /dev/null @@ -1,93 +0,0 @@ -// -// ASLayoutTransition.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - ASLayoutElementTransition - -/** - * Objects conform to this project returns if it's possible to layout asynchronous - */ -@protocol ASLayoutElementTransition - -/** - * @abstract Returns if the layoutElement can be used to layout in an asynchronous way on a background thread. - */ -@property (nonatomic, readonly) BOOL canLayoutAsynchronous; - -@end - -@interface ASDisplayNode () -@end -@interface ASLayoutSpec () -@end - - -#pragma mark - ASLayoutTransition - -AS_SUBCLASSING_RESTRICTED -@interface ASLayoutTransition : NSObject <_ASTransitionContextLayoutDelegate> - -/** - * Node to apply layout transition on - */ -@property (nonatomic, weak, readonly) ASDisplayNode *node; - -/** - * Previous layout to transition from - */ -@property (nonatomic, readonly) const ASDisplayNodeLayout &previousLayout NS_RETURNS_INNER_POINTER; - -/** - * Pending layout to transition to - */ -@property (nonatomic, readonly) const ASDisplayNodeLayout &pendingLayout NS_RETURNS_INNER_POINTER; - -/** - * Returns if the layout transition needs to happen synchronously - */ -@property (nonatomic, readonly) BOOL isSynchronous; - -/** - * Returns a newly initialized layout transition - */ -- (instancetype)initWithNode:(ASDisplayNode *)node - pendingLayout:(const ASDisplayNodeLayout &)pendingLayout - previousLayout:(const ASDisplayNodeLayout &)previousLayout NS_DESIGNATED_INITIALIZER; - -/** - * Insert and remove subnodes that were added or removed between the previousLayout and the pendingLayout - */ -- (void)commitTransition; - -/** - * Insert all new subnodes that were added and move the subnodes that moved between the previous layout and - * the pending layout. - */ -- (void)applySubnodeInsertionsAndMoves; - -/** - * Remove all subnodes that are removed between the previous layout and the pending layout - */ -- (void)applySubnodeRemovals; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)new NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASLayoutTransition.mm b/Example/Pods/Texture/Source/Private/ASLayoutTransition.mm deleted file mode 100644 index 588b2756..00000000 --- a/Example/Pods/Texture/Source/Private/ASLayoutTransition.mm +++ /dev/null @@ -1,298 +0,0 @@ -// -// ASLayoutTransition.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import -#import // Required for _removeFromSupernodeIfEqualTo: - -#import - -#if AS_IG_LIST_DIFF_KIT -#import -#endif - -using AS::MutexLocker; - -/** - * Search the whole layout stack if at least one layout has a layoutElement object that can not be layed out asynchronous. - * This can be the case for example if a node was already loaded - */ -static inline BOOL ASLayoutCanTransitionAsynchronous(ASLayout *layout) { - // Queue used to keep track of sublayouts while traversing this layout in a BFS fashion. - std::queue queue; - queue.push(layout); - - while (!queue.empty()) { - layout = queue.front(); - queue.pop(); - -#if DEBUG - ASDisplayNodeCAssert([layout.layoutElement conformsToProtocol:@protocol(ASLayoutElementTransition)], @"ASLayoutElement in a layout transition needs to conforms to the ASLayoutElementTransition protocol."); -#endif - if (((id)layout.layoutElement).canLayoutAsynchronous == NO) { - return NO; - } - - // Add all sublayouts to process in next step - for (ASLayout *sublayout in layout.sublayouts) { - queue.push(sublayout); - } - } - - return YES; -} - -@implementation ASLayoutTransition { - std::shared_ptr __instanceLock__; - - BOOL _calculatedSubnodeOperations; - NSArray *_insertedSubnodes; - NSArray *_removedSubnodes; - std::vector _insertedSubnodePositions; - std::vector> _subnodeMoves; - ASDisplayNodeLayout _pendingLayout; - ASDisplayNodeLayout _previousLayout; -} - -- (instancetype)initWithNode:(ASDisplayNode *)node - pendingLayout:(const ASDisplayNodeLayout &)pendingLayout - previousLayout:(const ASDisplayNodeLayout &)previousLayout -{ - self = [super init]; - if (self) { - __instanceLock__ = std::make_shared(); - - _node = node; - _pendingLayout = pendingLayout; - _previousLayout = previousLayout; - } - return self; -} - -- (BOOL)isSynchronous -{ - MutexLocker l(*__instanceLock__); - return !ASLayoutCanTransitionAsynchronous(_pendingLayout.layout); -} - -- (void)commitTransition -{ - [self applySubnodeRemovals]; - [self applySubnodeInsertionsAndMoves]; -} - -- (void)applySubnodeInsertionsAndMoves -{ - MutexLocker l(*__instanceLock__); - [self calculateSubnodeOperationsIfNeeded]; - - // Create an activity even if no subnodes affected. - as_activity_create_for_scope("Apply subnode insertions and moves"); - if (_insertedSubnodePositions.size() == 0 && _subnodeMoves.size() == 0) { - return; - } - - NSUInteger i = 0; - NSUInteger j = 0; - for (auto const &move : _subnodeMoves) { - [move.first _removeFromSupernodeIfEqualTo:_node]; - } - j = 0; - while (i < _insertedSubnodePositions.size() && j < _subnodeMoves.size()) { - NSUInteger p = _insertedSubnodePositions[i]; - NSUInteger q = _subnodeMoves[j].second; - if (p < q) { - [_node insertSubnode:_insertedSubnodes[i] atIndex:p]; - i++; - } else { - [_node insertSubnode:_subnodeMoves[j].first atIndex:q]; - j++; - } - } - for (; i < _insertedSubnodePositions.size(); ++i) { - [_node insertSubnode:_insertedSubnodes[i] atIndex:_insertedSubnodePositions[i]]; - } - for (; j < _subnodeMoves.size(); ++j) { - [_node insertSubnode:_subnodeMoves[j].first atIndex:_subnodeMoves[j].second]; - } -} - -- (void)applySubnodeRemovals -{ - as_activity_scope(as_activity_create("Apply subnode removals", AS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)); - MutexLocker l(*__instanceLock__); - [self calculateSubnodeOperationsIfNeeded]; - - if (_removedSubnodes.count == 0) { - return; - } - - for (ASDisplayNode *subnode in _removedSubnodes) { - // In this case we should only remove the subnode if it's still a subnode of the _node that executes a layout transition. - // It can happen that a node already did a layout transition and added this subnode, in this case the subnode - // would be removed from the new node instead of _node - if (_node.automaticallyManagesSubnodes) { - [subnode _removeFromSupernodeIfEqualTo:_node]; - } - } -} - -- (void)calculateSubnodeOperationsIfNeeded -{ - MutexLocker l(*__instanceLock__); - if (_calculatedSubnodeOperations) { - return; - } - - // Create an activity even if no subnodes affected. - as_activity_create_for_scope("Calculate subnode operations"); - ASLayout *previousLayout = _previousLayout.layout; - ASLayout *pendingLayout = _pendingLayout.layout; - - if (previousLayout) { -#if AS_IG_LIST_DIFF_KIT - // IGListDiff completes in linear time O(m+n), so use it if we have it: - IGListIndexSetResult *result = IGListDiff(previousLayout.sublayouts, pendingLayout.sublayouts, IGListDiffEquality); - _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, result.inserts, &_insertedSubnodes); - findNodesInLayoutAtIndexes(previousLayout, result.deletes, &_removedSubnodes); - for (IGListMoveIndex *move in result.moves) { - _subnodeMoves.emplace_back(previousLayout.sublayouts[move.from].layoutElement, move.to); - } - - // Sort by ascending order of move destinations, this will allow easy loop of `insertSubnode:AtIndex` later. - std::sort(_subnodeMoves.begin(), _subnodeMoves.end(), [](std::pair, NSUInteger> a, - std::pair b) { - return a.second < b.second; - }); -#else - NSIndexSet *insertions, *deletions; - NSArray *moves; - NSArray *previousNodes = [previousLayout.sublayouts valueForKey:@"layoutElement"]; - NSArray *pendingNodes = [pendingLayout.sublayouts valueForKey:@"layoutElement"]; - [previousNodes asdk_diffWithArray:pendingNodes - insertions:&insertions - deletions:&deletions - moves:&moves]; - - _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, insertions, &_insertedSubnodes); - _removedSubnodes = [previousNodes objectsAtIndexes:deletions]; - // These should arrive sorted in ascending order of move destinations. - for (NSIndexPath *move in moves) { - _subnodeMoves.emplace_back(previousLayout.sublayouts[([move indexAtPosition:0])].layoutElement, - [move indexAtPosition:1]); - } -#endif - } else { - NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [pendingLayout.sublayouts count])]; - _insertedSubnodePositions = findNodesInLayoutAtIndexes(pendingLayout, indexes, &_insertedSubnodes); - _removedSubnodes = nil; - } - _calculatedSubnodeOperations = YES; -} - -#pragma mark - _ASTransitionContextDelegate - -- (NSArray *)currentSubnodesWithTransitionContext:(_ASTransitionContext *)context -{ - MutexLocker l(*__instanceLock__); - return _node.subnodes; -} - -- (NSArray *)insertedSubnodesWithTransitionContext:(_ASTransitionContext *)context -{ - MutexLocker l(*__instanceLock__); - [self calculateSubnodeOperationsIfNeeded]; - return _insertedSubnodes; -} - -- (NSArray *)removedSubnodesWithTransitionContext:(_ASTransitionContext *)context -{ - MutexLocker l(*__instanceLock__); - [self calculateSubnodeOperationsIfNeeded]; - return _removedSubnodes; -} - -- (ASLayout *)transitionContext:(_ASTransitionContext *)context layoutForKey:(NSString *)key -{ - MutexLocker l(*__instanceLock__); - if ([key isEqualToString:ASTransitionContextFromLayoutKey]) { - return _previousLayout.layout; - } else if ([key isEqualToString:ASTransitionContextToLayoutKey]) { - return _pendingLayout.layout; - } else { - return nil; - } -} - -- (ASSizeRange)transitionContext:(_ASTransitionContext *)context constrainedSizeForKey:(NSString *)key -{ - MutexLocker l(*__instanceLock__); - if ([key isEqualToString:ASTransitionContextFromLayoutKey]) { - return _previousLayout.constrainedSize; - } else if ([key isEqualToString:ASTransitionContextToLayoutKey]) { - return _pendingLayout.constrainedSize; - } else { - return ASSizeRangeMake(CGSizeZero, CGSizeZero); - } -} - -#pragma mark - Filter helpers - -/** - * @abstract Stores the nodes at the given indexes in the `storedNodes` array, storing indexes in a `storedPositions` c++ vector. - */ -static inline std::vector findNodesInLayoutAtIndexes(ASLayout *layout, - NSIndexSet *indexes, - NSArray * __strong *storedNodes) -{ - return findNodesInLayoutAtIndexesWithFilteredNodes(layout, indexes, nil, storedNodes); -} - -/** - * @abstract Stores the nodes at the given indexes in the `storedNodes` array, storing indexes in a `storedPositions` c++ vector. - * Call only with a flattened layout. - * @discussion If the node exists in the `filteredNodes` array, the node is not added to `storedNodes`. - */ -static inline std::vector findNodesInLayoutAtIndexesWithFilteredNodes(ASLayout *layout, - NSIndexSet *indexes, - NSArray *filteredNodes, - NSArray * __strong *storedNodes) -{ - NSMutableArray *nodes = [NSMutableArray arrayWithCapacity:indexes.count]; - std::vector positions = std::vector(); - - // From inspection, this is how enumerateObjectsAtIndexes: works under the hood - NSUInteger firstIndex = indexes.firstIndex; - NSUInteger lastIndex = indexes.lastIndex; - NSUInteger idx = 0; - for (ASLayout *sublayout in layout.sublayouts) { - if (idx > lastIndex) { break; } - if (idx >= firstIndex && [indexes containsIndex:idx]) { - ASDisplayNode *node = (ASDisplayNode *)(sublayout.layoutElement); - ASDisplayNodeCAssert(node, @"ASDisplayNode was deallocated before it was added to a subnode. It's likely the case that you use automatically manages subnodes and allocate a ASDisplayNode in layoutSpecThatFits: and don't have any strong reference to it."); - ASDisplayNodeCAssert([node isKindOfClass:[ASDisplayNode class]], @"sublayout is an ASLayout, but not an ASDisplayNode - only call findNodesInLayoutAtIndexesWithFilteredNodes with a flattened layout (all sublayouts are ASDisplayNodes)."); - if (node != nil) { - BOOL notFiltered = (filteredNodes == nil || [filteredNodes indexOfObjectIdenticalTo:node] == NSNotFound); - if (notFiltered) { - [nodes addObject:node]; - positions.push_back(idx); - } - } - } - idx += 1; - } - *storedNodes = nodes; - - return positions; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASMutableElementMap.h b/Example/Pods/Texture/Source/Private/ASMutableElementMap.h deleted file mode 100644 index 1ca18293..00000000 --- a/Example/Pods/Texture/Source/Private/ASMutableElementMap.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// ASMutableElementMap.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASSection, ASCollectionElement, _ASHierarchyChangeSet; - -/** - * This mutable version will be removed in the future. It's only here now to keep the diff small - * as we port data controller to use ASElementMap. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASMutableElementMap : NSObject - -- (instancetype)init __unavailable; - -- (instancetype)initWithSections:(NSArray *)sections items:(ASCollectionElementTwoDimensionalArray *)items supplementaryElements:(ASSupplementaryElementDictionary *)supplementaryElements; - -- (void)insertSection:(ASSection *)section atIndex:(NSInteger)index; - -- (void)removeAllSections; - -/// Only modifies the array of ASSection * objects -- (void)removeSectionsAtIndexes:(NSIndexSet *)indexes; - -- (void)removeAllElements; - -- (void)removeItemsAtIndexPaths:(NSArray *)indexPaths; - -- (void)removeSectionsOfItems:(NSIndexSet *)itemSections; - -- (void)removeSupplementaryElementsAtIndexPaths:(NSArray *)indexPaths kind:(NSString *)kind; - -- (void)insertEmptySectionsOfItemsAtIndexes:(NSIndexSet *)sections; - -- (void)insertElement:(ASCollectionElement *)element atIndexPath:(NSIndexPath *)indexPath; - -/** - * Update the index paths for all supplementary elements to account for section-level - * deletes, moves, inserts. This must be called before adding new supplementary elements. - * - * This also deletes any supplementary elements in deleted sections. - */ -- (void)migrateSupplementaryElementsWithSectionMapping:(ASIntegerMap *)mapping; - -@end - -@interface ASElementMap (MutableCopying) -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASMutableElementMap.mm b/Example/Pods/Texture/Source/Private/ASMutableElementMap.mm deleted file mode 100644 index f7bf2108..00000000 --- a/Example/Pods/Texture/Source/Private/ASMutableElementMap.mm +++ /dev/null @@ -1,143 +0,0 @@ -// -// ASMutableElementMap.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -typedef NSMutableArray *> ASMutableCollectionElementTwoDimensionalArray; - -typedef NSMutableDictionary *> ASMutableSupplementaryElementDictionary; - -@implementation ASMutableElementMap { - ASMutableSupplementaryElementDictionary *_supplementaryElements; - NSMutableArray *_sections; - ASMutableCollectionElementTwoDimensionalArray *_sectionsOfItems; -} - -- (instancetype)initWithSections:(NSArray *)sections items:(ASCollectionElementTwoDimensionalArray *)items supplementaryElements:(ASSupplementaryElementDictionary *)supplementaryElements -{ - if (self = [super init]) { - _sections = [sections mutableCopy]; - _sectionsOfItems = (ASMutableCollectionElementTwoDimensionalArray *)ASTwoDimensionalArrayDeepMutableCopy(items); - _supplementaryElements = [ASMutableElementMap deepMutableCopyOfElementsDictionary:supplementaryElements]; - } - return self; -} - -- (id)copyWithZone:(NSZone *)zone -{ - return [[ASElementMap alloc] initWithSections:_sections items:_sectionsOfItems supplementaryElements:_supplementaryElements]; -} - -- (void)removeAllSections -{ - [_sections removeAllObjects]; -} - -- (void)insertSection:(ASSection *)section atIndex:(NSInteger)index -{ - [_sections insertObject:section atIndex:index]; -} - -- (void)removeItemsAtIndexPaths:(NSArray *)indexPaths -{ - ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(_sectionsOfItems, indexPaths); -} - -- (void)removeSectionsAtIndexes:(NSIndexSet *)indexes -{ - [_sections removeObjectsAtIndexes:indexes]; -} - -- (void)removeSupplementaryElementsAtIndexPaths:(NSArray *)indexPaths kind:(NSString *)kind -{ - [_supplementaryElements[kind] removeObjectsForKeys:indexPaths]; -} - -- (void)removeAllElements -{ - [_sectionsOfItems removeAllObjects]; - [_supplementaryElements removeAllObjects]; -} - -- (void)removeSectionsOfItems:(NSIndexSet *)itemSections -{ - [_sectionsOfItems removeObjectsAtIndexes:itemSections]; -} - -- (void)insertEmptySectionsOfItemsAtIndexes:(NSIndexSet *)sections -{ - [sections enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) { - [_sectionsOfItems insertObject:[[NSMutableArray alloc] init] atIndex:idx]; - }]; -} - -- (void)insertElement:(ASCollectionElement *)element atIndexPath:(NSIndexPath *)indexPath -{ - NSString *kind = element.supplementaryElementKind; - if (kind == nil) { - [_sectionsOfItems[indexPath.section] insertObject:element atIndex:indexPath.item]; - } else { - NSMutableDictionary *supplementariesForKind = _supplementaryElements[kind]; - if (supplementariesForKind == nil) { - supplementariesForKind = [[NSMutableDictionary alloc] init]; - _supplementaryElements[kind] = supplementariesForKind; - } - supplementariesForKind[indexPath] = element; - } -} - -- (void)migrateSupplementaryElementsWithSectionMapping:(ASIntegerMap *)mapping -{ - // Fast-path, no section changes. - if (mapping == ASIntegerMap.identityMap) { - return; - } - - // For each element kind, - [_supplementaryElements enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSMutableDictionary * _Nonnull supps, BOOL * _Nonnull stop) { - - // For each index path of that kind, move entries into a new dictionary. - // Note: it's tempting to update the dictionary in-place but because of the likely collision between old and new index paths, - // subtle bugs are possible. Note that this process is rare (only on section-level updates), - // that this work is done off-main, and that the typical supplementary element use case is just 1-per-section (header). - NSMutableDictionary *newSupps = [[NSMutableDictionary alloc] init]; - [supps enumerateKeysAndObjectsUsingBlock:^(NSIndexPath * _Nonnull oldIndexPath, ASCollectionElement * _Nonnull obj, BOOL * _Nonnull stop) { - NSInteger oldSection = oldIndexPath.section; - NSInteger newSection = [mapping integerForKey:oldSection]; - - if (oldSection == newSection) { - // Index path stayed the same, just copy it over. - newSupps[oldIndexPath] = obj; - } else if (newSection != NSNotFound) { - // Section index changed, move it. - NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:oldIndexPath.item inSection:newSection]; - newSupps[newIndexPath] = obj; - } - }]; - [supps setDictionary:newSupps]; - }]; -} - -#pragma mark - Helpers - -+ (ASMutableSupplementaryElementDictionary *)deepMutableCopyOfElementsDictionary:(ASSupplementaryElementDictionary *)originalDict -{ - NSMutableDictionary *deepCopy = [[NSMutableDictionary alloc] initWithCapacity:originalDict.count]; - [originalDict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSDictionary * _Nonnull obj, BOOL * _Nonnull stop) { - deepCopy[key] = [obj mutableCopy]; - }]; - - return deepCopy; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASNetworkImageLoadInfo+Private.h b/Example/Pods/Texture/Source/Private/ASNetworkImageLoadInfo+Private.h deleted file mode 100644 index 36e423b5..00000000 --- a/Example/Pods/Texture/Source/Private/ASNetworkImageLoadInfo+Private.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ASNetworkImageLoadInfo+Private.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASNetworkImageLoadInfo () - -- (instancetype)initWithURL:(NSURL *)url - sourceType:(ASNetworkImageSourceType)sourceType - downloadIdentifier:(nullable id)downloadIdentifier - userInfo:(nullable id)userInfo; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASPendingStateController.h b/Example/Pods/Texture/Source/Private/ASPendingStateController.h deleted file mode 100644 index b50a7c1f..00000000 --- a/Example/Pods/Texture/Source/Private/ASPendingStateController.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASPendingStateController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@class ASDisplayNode; - -NS_ASSUME_NONNULL_BEGIN - -/** - A singleton that is responsible for applying changes to - UIView/CALayer properties of display nodes when they - have been set on background threads. - - This controller will enqueue run-loop events to flush changes - but if you need them flushed now you can call `flush` from the main thread. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASPendingStateController : NSObject - -+ (ASPendingStateController *)sharedInstance; - -@property (nonatomic, readonly) BOOL hasChanges; - -/** - Flush all pending states for nodes now. Any UIView/CALayer properties - that have been set in the background will be applied to their - corresponding views/layers before this method returns. - - You must call this method on the main thread. - */ -- (void)flush; - -/** - Register this node as having pending state that needs to be copied - over to the view/layer. This is called automatically by display nodes - when their view/layer properties are set post-load on background threads. - */ -- (void)registerNode:(ASDisplayNode *)node; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASPendingStateController.mm b/Example/Pods/Texture/Source/Private/ASPendingStateController.mm deleted file mode 100644 index 269b37e9..00000000 --- a/Example/Pods/Texture/Source/Private/ASPendingStateController.mm +++ /dev/null @@ -1,102 +0,0 @@ -// -// ASPendingStateController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import // Required for -applyPendingViewState; consider moving this to +FrameworkPrivate - -@interface ASPendingStateController() -{ - AS::Mutex _lock; - - struct ASPendingStateControllerFlags { - unsigned pendingFlush:1; - } _flags; -} - -@property (nonatomic, readonly) ASWeakSet *dirtyNodes; -@end - -@implementation ASPendingStateController - -#pragma mark Lifecycle & Singleton - -- (instancetype)init -{ - self = [super init]; - if (self) { - _dirtyNodes = [[ASWeakSet alloc] init]; - } - return self; -} - -+ (ASPendingStateController *)sharedInstance -{ - static dispatch_once_t onceToken; - static ASPendingStateController *controller = nil; - dispatch_once(&onceToken, ^{ - controller = [[ASPendingStateController alloc] init]; - }); - return controller; -} - -#pragma mark External API - -- (void)registerNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssert(node.nodeLoaded, @"Expected display node to be loaded before it was registered with ASPendingStateController. Node: %@", node); - AS::MutexLocker l(_lock); - [_dirtyNodes addObject:node]; - - [self scheduleFlushIfNeeded]; -} - -- (void)flush -{ - ASDisplayNodeAssertMainThread(); - _lock.lock(); - ASWeakSet *dirtyNodes = _dirtyNodes; - _dirtyNodes = [[ASWeakSet alloc] init]; - _flags.pendingFlush = NO; - _lock.unlock(); - - for (ASDisplayNode *node in dirtyNodes) { - [node applyPendingViewState]; - } -} - - -#pragma mark Private Methods - -/** - This method is assumed to be called with the lock held. - */ -- (void)scheduleFlushIfNeeded -{ - if (_flags.pendingFlush) { - return; - } - - _flags.pendingFlush = YES; - dispatch_async(dispatch_get_main_queue(), ^{ - [self flush]; - }); -} - -@end - -@implementation ASPendingStateController (Testing) - -- (BOOL)test_isFlushScheduled -{ - return _flags.pendingFlush; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.h b/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.h deleted file mode 100644 index dcd2e1c4..00000000 --- a/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ASResponderChainEnumerator.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASResponderChainEnumerator : NSEnumerator - -- (instancetype)initWithResponder:(UIResponder *)responder; - -@end - -@interface UIResponder (ASResponderChainEnumerator) - -- (ASResponderChainEnumerator *)asdk_responderChainEnumerator; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.mm b/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.mm deleted file mode 100644 index bb16e0fc..00000000 --- a/Example/Pods/Texture/Source/Private/ASResponderChainEnumerator.mm +++ /dev/null @@ -1,45 +0,0 @@ -// -// ASResponderChainEnumerator.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASResponderChainEnumerator { - UIResponder *_currentResponder; -} - -- (instancetype)initWithResponder:(UIResponder *)responder -{ - ASDisplayNodeAssertMainThread(); - if (self = [super init]) { - _currentResponder = responder; - } - return self; -} - -#pragma mark - NSEnumerator - -- (id)nextObject -{ - ASDisplayNodeAssertMainThread(); - id result = [_currentResponder nextResponder]; - _currentResponder = result; - return result; -} - -@end - -@implementation UIResponder (ASResponderChainEnumerator) - -- (NSEnumerator *)asdk_responderChainEnumerator -{ - return [[ASResponderChainEnumerator alloc] initWithResponder:self]; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASSection.h b/Example/Pods/Texture/Source/Private/ASSection.h deleted file mode 100644 index 6058ff48..00000000 --- a/Example/Pods/Texture/Source/Private/ASSection.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASSection.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@protocol ASSectionContext; - -NS_ASSUME_NONNULL_BEGIN - -/** - * An object representing the metadata for a section of elements in a collection. - * - * Its sectionID is namespaced to the data controller that created the section. - * - * These are useful for tracking the movement & lifetime of sections, independent of - * their contents. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASSection : NSObject - -@property (readonly) NSInteger sectionID; -@property (nullable, readonly) id context; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithSectionID:(NSInteger)sectionID context:(nullable id)context NS_DESIGNATED_INITIALIZER; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASSection.mm b/Example/Pods/Texture/Source/Private/ASSection.mm deleted file mode 100644 index 16fd73fe..00000000 --- a/Example/Pods/Texture/Source/Private/ASSection.mm +++ /dev/null @@ -1,25 +0,0 @@ -// -// ASSection.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASSection - -- (instancetype)initWithSectionID:(NSInteger)sectionID context:(id)context -{ - self = [super init]; - if (self) { - _sectionID = sectionID; - _context = context; - } - return self; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/ASTableView+Undeprecated.h b/Example/Pods/Texture/Source/Private/ASTableView+Undeprecated.h deleted file mode 100644 index 46c54368..00000000 --- a/Example/Pods/Texture/Source/Private/ASTableView+Undeprecated.h +++ /dev/null @@ -1,298 +0,0 @@ -// -// ASTableView+Undeprecated.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Currently our public table API is on @c ASTableNode and the @c ASTableView - * API is deprecated, but the implementations still live in the view. - * - * This category lets us avoid deprecation warnings everywhere internally. - * In the future, the ASTableView public API will be eliminated and so will this file. - */ -@interface ASTableView (Undeprecated) - -@property (nullable, nonatomic, weak) id asyncDelegate; -@property (nullable, nonatomic, weak) id asyncDataSource; -@property (nonatomic) UIEdgeInsets contentInset; -@property (nonatomic) CGPoint contentOffset; -@property (nonatomic) BOOL automaticallyAdjustsContentOffset; -@property (nonatomic) BOOL inverted; -@property (nullable, nonatomic, readonly) NSArray *indexPathsForVisibleRows; -@property (nullable, nonatomic, readonly) NSArray *indexPathsForSelectedRows; -@property (nullable, nonatomic, readonly) NSIndexPath *indexPathForSelectedRow; - -/** - * The number of screens left to scroll before the delegate -tableView:beginBatchFetchingWithContext: is called. - * - * Defaults to two screenfuls. - */ -@property (nonatomic) CGFloat leadingScreensForBatching; - -/** - * Initializer. - * - * @param frame A rectangle specifying the initial location and size of the table view in its superview’€™s coordinates. - * The frame of the table view changes as table cells are added and deleted. - * - * @param style A constant that specifies the style of the table view. See UITableViewStyle for descriptions of valid constants. - */ -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style; - -/** - * Tuning parameters for a range type in full mode. - * - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in full mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in full mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeType:(ASLayoutRangeType)rangeType; - -/** - * Tuning parameters for a range type in the specified mode. - * - * @param rangeMode The range mode to get the running parameters for. - * @param rangeType The range type to get the tuning parameters for. - * - * @return A tuning parameter value for the given range type in the given mode. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (ASRangeTuningParameters)tuningParametersForRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType AS_WARN_UNUSED_RESULT; - -/** - * Set the tuning parameters for a range type in the specified mode. - * - * @param tuningParameters The tuning parameters to store for a range type. - * @param rangeMode The range mode to set the running parameters for. - * @param rangeType The range type to set the tuning parameters for. - * - * @see ASLayoutRangeMode - * @see ASLayoutRangeType - */ -- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - -- (nullable __kindof UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; - -/** - * Scrolls the table to the given row. - * - * @param indexPath The index path of the row. - * @param scrollPosition Where the row should end up after the scroll. - * @param animated Whether the scroll should be animated or not. - */ -- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; - -- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; - -- (nullable NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point; - -- (nullable NSArray *)indexPathsForRowsInRect:(CGRect)rect; - -/** - * Similar to -visibleCells. - * - * @return an array containing the cell nodes being displayed on screen. - */ -- (NSArray *)visibleNodes AS_WARN_UNUSED_RESULT; - -/** - * Similar to -indexPathForCell:. - * - * @param cellNode a cellNode part of the table view - * - * @return an indexPath for this cellNode - */ -- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT; - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @param completion block to run on completion of asynchronous loading or nil. If supplied, the block is run on - * the main thread. - * @warning This method is substantially more expensive than UITableView's version. - */ --(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion; - -/** - * Reload everything from scratch, destroying the working range and all cached nodes. - * - * @warning This method is substantially more expensive than UITableView's version. - */ -- (void)reloadData; - -/** - * Triggers a relayout of all nodes. - * - * @discussion This method invalidates and lays out every cell node in the table view. - */ -- (void)relayoutItems; - -/** - * Begins a series of method calls that insert, delete, select, or reload rows and sections of the table view, with animation enabled and no completion block. - * - * @discussion You call this method to bracket a series of method calls that ends with endUpdates and that consists of operations - * to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating - * the operations simultaneously. It's important to remember that the ASTableView will be processing the updates asynchronously after this call is completed. - * - * @warning This method must be called from the main thread. - */ -- (void)beginUpdates; - -/** - * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view, with animation enabled and no completion block. - * - * @discussion You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations - * to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating - * the operations simultaneously. It's important to remember that the ASTableView will be processing the updates asynchronously after this call is completed. - * - * @warning This method is must be called from the main thread. - */ -- (void)endUpdates; - -/** - * Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view. - * You call this method to bracket a series of method calls that begins with beginUpdates and that consists of operations - * to insert, delete, select, and reload rows and sections of the table view. When you call endUpdates, ASTableView begins animating - * the operations simultaneously. This method is must be called from the main thread. It's important to remember that the ASTableView will - * be processing the updates asynchronously after this call and are not guaranteed to be reflected in the ASTableView until - * the completion block is executed. - * - * @param animated NO to disable all animations. - * @param completion A completion handler block to execute when all of the operations are finished. This block takes a single - * Boolean parameter that contains the value YES if all of the related animations completed successfully or - * NO if they were interrupted. This parameter may be nil. If supplied, the block is run on the main thread. - */ -- (void)endUpdatesAnimated:(BOOL)animated completion:(void (^ _Nullable)(BOOL completed))completion; - -/** - * Blocks execution of the main thread until all section and row updates are committed. This method must be called from the main thread. - */ -- (void)waitUntilAllUpdatesAreCommitted; - -/** - * Inserts one or more sections, with an option to animate the insertion. - * - * @param sections An index set that specifies the sections to insert. - * - * @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Deletes one or more sections, with an option to animate the deletion. - * - * @param sections An index set that specifies the sections to delete. - * - * @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Reloads the specified sections using a given animation effect. - * - * @param sections An index set that specifies the sections to reload. - * - * @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Moves a section to a new location. - * - * @param section The index of the section to move. - * - * @param newSection The index that is the destination of the move for the section. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; - -/** - * Inserts rows at the locations identified by an array of index paths, with an option to animate the insertion. - * - * @param indexPaths An array of NSIndexPath objects, each representing a row index and section index that together identify a row. - * - * @param animation A constant that indicates how the insertion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Deletes the rows specified by an array of index paths, with an option to animate the deletion. - * - * @param indexPaths An array of NSIndexPath objects identifying the rows to delete. - * - * @param animation A constant that indicates how the deletion is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Reloads the specified rows using a given animation effect. - * - * @param indexPaths An array of NSIndexPath objects identifying the rows to reload. - * - * @param animation A constant that indicates how the reloading is to be animated. See UITableViewRowAnimation. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - -/** - * Moves the row at a specified location to a destination location. - * - * @param indexPath The index path identifying the row to move. - * - * @param newIndexPath The index path that is the destination of the move for the row. - * - * @discussion This method must be called from the main thread. The asyncDataSource must be updated to reflect the changes - * before this method is called. - */ -- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - -- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; - -@end -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASTip.h b/Example/Pods/Texture/Source/Private/ASTip.h deleted file mode 100644 index 5ac6ac18..00000000 --- a/Example/Pods/Texture/Source/Private/ASTip.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// ASTip.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TIPS - -NS_ASSUME_NONNULL_BEGIN - -@class ASDisplayNode; - -typedef NS_ENUM (NSInteger, ASTipKind) { - ASTipKindEnableLayerBacking -}; - -AS_SUBCLASSING_RESTRICTED -@interface ASTip : NSObject - -- (instancetype)initWithNode:(ASDisplayNode *)node - kind:(ASTipKind)kind - format:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4); - -/** - * The kind of tip this is. - */ -@property (nonatomic, readonly) ASTipKind kind; - -/** - * The node that this tip applies to. - */ -@property (nonatomic, readonly) ASDisplayNode *node; - -/** - * The text to show the user. - */ -@property (nonatomic, readonly) NSString *text; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTip.mm b/Example/Pods/Texture/Source/Private/ASTip.mm deleted file mode 100644 index af1d2992..00000000 --- a/Example/Pods/Texture/Source/Private/ASTip.mm +++ /dev/null @@ -1,35 +0,0 @@ -// -// ASTip.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TIPS - -#import - -@implementation ASTip - -- (instancetype)initWithNode:(ASDisplayNode *)node - kind:(ASTipKind)kind - format:(NSString *)format, ... -{ - if (self = [super init]) { - _node = node; - _kind = kind; - va_list args; - va_start(args, format); - _text = [[NSString alloc] initWithFormat:format arguments:args]; - va_end(args); - } - return self; -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipNode.h b/Example/Pods/Texture/Source/Private/ASTipNode.h deleted file mode 100644 index d01637d8..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipNode.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// ASTipNode.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TIPS - -@class ASTip; - -NS_ASSUME_NONNULL_BEGIN - -/** - * ASTipNode will send these up the responder chain. - */ -@protocol ASTipNodeActions -- (void)didTapTipNode:(id)sender; -@end - -AS_SUBCLASSING_RESTRICTED -@interface ASTipNode : ASControlNode - -- (instancetype)initWithTip:(ASTip *)tip NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; - -@property (nonatomic, readonly) ASTip *tip; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipNode.mm b/Example/Pods/Texture/Source/Private/ASTipNode.mm deleted file mode 100644 index dcca908b..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipNode.mm +++ /dev/null @@ -1,28 +0,0 @@ -// -// ASTipNode.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTipNode.h" - -#if AS_ENABLE_TIPS - -@implementation ASTipNode - -- (instancetype)initWithTip:(ASTip *)tip -{ - if (self = [super init]) { - self.backgroundColor = [UIColor colorWithRed:0 green:0.7 blue:0.2 alpha:0.3]; - _tip = tip; - [self addTarget:nil action:@selector(didTapTipNode:) forControlEvents:ASControlNodeEventTouchUpInside]; - } - return self; -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipProvider.h b/Example/Pods/Texture/Source/Private/ASTipProvider.h deleted file mode 100644 index e2aba6c5..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipProvider.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// ASTipProvider.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TIPS - -@class ASDisplayNode, ASTip; - -NS_ASSUME_NONNULL_BEGIN - -/** - * An abstract superclass for all tip providers. - */ -@interface ASTipProvider : NSObject - -/** - * The provider looks at the node's current situation and - * generates a tip, if any, to add to the node. - * - * Subclasses must override this. - */ -- (nullable ASTip *)tipForNode:(ASDisplayNode *)node; - -@end - -@interface ASTipProvider (Lookup) - -@property (class, nonatomic, copy, readonly) NSArray<__kindof ASTipProvider *> *all; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipProvider.mm b/Example/Pods/Texture/Source/Private/ASTipProvider.mm deleted file mode 100644 index 237e83cd..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipProvider.mm +++ /dev/null @@ -1,43 +0,0 @@ -// -// ASTipProvider.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TIPS - -#import - -// Concrete classes -#import - -@implementation ASTipProvider - -- (ASTip *)tipForNode:(ASDisplayNode *)node -{ - ASDisplayNodeFailAssert(@"Subclasses must override %@", NSStringFromSelector(_cmd)); - return nil; -} - -@end - -@implementation ASTipProvider (Lookup) - -+ (NSArray *)all -{ - static NSArray *providers; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - providers = @[ [ASLayerBackingTipProvider new] ]; - }); - return providers; -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipsController.h b/Example/Pods/Texture/Source/Private/ASTipsController.h deleted file mode 100644 index fceeb92f..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipsController.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// ASTipsController.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TIPS - -@class ASDisplayNode; - -NS_ASSUME_NONNULL_BEGIN - -AS_SUBCLASSING_RESTRICTED -@interface ASTipsController : NSObject - -/** - * The shared tip controller instance. - */ -@property (class, readonly) ASTipsController *shared; - -#pragma mark - Node Event Hooks - -/** - * Informs the controller that the sender did enter the visible range. - * - * The controller will run a pass with its tip providers, adding tips as needed. - */ -- (void)nodeDidAppear:(ASDisplayNode *)node; - -@end - -NS_ASSUME_NONNULL_END - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipsController.mm b/Example/Pods/Texture/Source/Private/ASTipsController.mm deleted file mode 100644 index e30a064d..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipsController.mm +++ /dev/null @@ -1,185 +0,0 @@ -// -// ASTipsController.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TIPS - -#import -#import -#import -#import -#import -#import - -@interface ASTipsController () - -/// Nil on init, updates to most recent visible window. -@property (nonatomic) UIWindow *appVisibleWindow; - -/// Nil until an application window has become visible. -@property (nonatomic) ASTipsWindow *tipWindow; - -/// Main-thread-only. -@property (nonatomic, readonly) NSMapTable *nodeToTipStates; - -@property (nonatomic) NSMutableArray *nodesThatAppearedDuringRunLoop; - -@end - -@implementation ASTipsController - -#pragma mark - Singleton - -__attribute__((constructor)) static void ASLoadTipsControllerNotification(void) -{ - [NSNotificationCenter.defaultCenter addObserver:ASTipsController.shared - selector:@selector(windowDidBecomeVisibleWithNotification:) - name:UIWindowDidBecomeVisibleNotification - object:nil]; -} - -+ (ASTipsController *)shared -{ - static ASTipsController *ctrl; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - ctrl = [[ASTipsController alloc] init]; - }); - return ctrl; -} - -#pragma mark - Lifecycle - -- (instancetype)init -{ - ASDisplayNodeAssertMainThread(); - if (self = [super init]) { - _nodeToTipStates = [NSMapTable mapTableWithKeyOptions:(NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPointerPersonality) valueOptions:NSPointerFunctionsStrongMemory]; - _nodesThatAppearedDuringRunLoop = [NSMutableArray array]; - } - return self; -} - -#pragma mark - Event Handling - -- (void)nodeDidAppear:(ASDisplayNode *)node -{ - ASDisplayNodeAssertMainThread(); - // If they disabled tips on this class, bail. - if (![[node class] enableTips]) { - return; - } - - // If this node appeared in some other window (like our tips window) ignore it. - if (ASFindWindowOfLayer(node.layer) != self.appVisibleWindow) { - return; - } - - [_nodesThatAppearedDuringRunLoop addObject:node]; -} - -// If this is a main window, start watching it and clear out our tip window. -- (void)windowDidBecomeVisibleWithNotification:(NSNotification *)notification -{ - ASDisplayNodeAssertMainThread(); - UIWindow *window = notification.object; - - // If this is the same window we're already watching, bail. - if (window == self.appVisibleWindow) { - return; - } - - // Ignore windows that are not at the normal level or have empty bounds - if (window.windowLevel != UIWindowLevelNormal || CGRectIsEmpty(window.bounds)) { - return; - } - - self.appVisibleWindow = window; - - // Create the tip window if needed. - [self createTipWindowIfNeededWithFrame:window.bounds]; - - // Clear out our tip window and reset our states. - self.tipWindow.mainWindow = window; - [_nodeToTipStates removeAllObjects]; -} - -- (void)runLoopDidTick -{ - NSArray *nodes = [_nodesThatAppearedDuringRunLoop copy]; - [_nodesThatAppearedDuringRunLoop removeAllObjects]; - - // Go through the old array, removing any that have tips but aren't still visible. - for (ASDisplayNode *node in [_nodeToTipStates copy]) { - if (!node.visible) { - [_nodeToTipStates removeObjectForKey:node]; - } - } - - for (ASDisplayNode *node in nodes) { - // Get the tip state for the node. - ASDisplayNodeTipState *tipState = [_nodeToTipStates objectForKey:node]; - - // If the node already has a tip, bail. This could change. - if (tipState.tipNode != nil) { - return; - } - - for (ASTipProvider *provider in ASTipProvider.all) { - ASTip *tip = [provider tipForNode:node]; - if (!tip) { continue; } - - if (!tipState) { - tipState = [self createTipStateForNode:node]; - } - tipState.tipNode = [[ASTipNode alloc] initWithTip:tip]; - } - } - self.tipWindow.nodeToTipStates = _nodeToTipStates; - [self.tipWindow setNeedsLayout]; -} - -#pragma mark - Internal - -- (void)createTipWindowIfNeededWithFrame:(CGRect)tipWindowFrame -{ - // Lots of property accesses, but simple safe code, only run once. - if (self.tipWindow == nil) { - self.tipWindow = [[ASTipsWindow alloc] initWithFrame:tipWindowFrame]; - self.tipWindow.hidden = NO; - [self setupRunLoopObserver]; - } -} - -/** - * In order to keep the UI updated, the tips controller registers a run loop observer. - * Before the transaction commit happens, the tips controller calls -setNeedsLayout - * on the view controller's view. It will then layout the main window, and then update the frames - * for tip nodes accordingly. - */ -- (void)setupRunLoopObserver -{ - CFRunLoopObserverRef o = CFRunLoopObserverCreateWithHandler(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) { - [self runLoopDidTick]; - }); - CFRunLoopAddObserver(CFRunLoopGetMain(), o, kCFRunLoopCommonModes); -} - -- (ASDisplayNodeTipState *)createTipStateForNode:(ASDisplayNode *)node -{ - ASDisplayNodeAssertMainThread(); - ASDisplayNodeTipState *tipState = [[ASDisplayNodeTipState alloc] initWithNode:node]; - [_nodeToTipStates setObject:tipState forKey:node]; - return tipState; -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTipsWindow.h b/Example/Pods/Texture/Source/Private/ASTipsWindow.h deleted file mode 100644 index 5354cc91..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipsWindow.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASTipsWindow.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if AS_ENABLE_TIPS - -@class ASDisplayNode, ASDisplayNodeTipState; - -NS_ASSUME_NONNULL_BEGIN - -/** - * A window that shows tips. This was originally meant to be a view controller - * but UIKit will not manage view controllers in non-key windows correctly AT ALL - * as of the time of this writing. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTipsWindow : UIWindow - -/// The main application window that the tips are tracking. -@property (nonatomic, weak) UIWindow *mainWindow; - -@property (nonatomic, copy, nullable) NSMapTable *nodeToTipStates; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/Private/ASTipsWindow.mm b/Example/Pods/Texture/Source/Private/ASTipsWindow.mm deleted file mode 100644 index 01093261..00000000 --- a/Example/Pods/Texture/Source/Private/ASTipsWindow.mm +++ /dev/null @@ -1,98 +0,0 @@ -// -// ASTipsWindow.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#if AS_ENABLE_TIPS - -#import -#import -#import -#import - -@interface ASTipsWindow () -@property (nonatomic, readonly) ASDisplayNode *node; -@end - -@implementation ASTipsWindow - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - /** - * UIKit throws an exception if you don't add a root view controller to a window, - * but if the window isn't key, then it doesn't manage the root view controller correctly! - * - * So we set a dummy root view controller and hide it. - */ - self.rootViewController = [UIViewController new]; - self.rootViewController.view.hidden = YES; - - _node = [[ASDisplayNode alloc] init]; - [self addSubnode:_node]; - - self.windowLevel = UIWindowLevelNormal + 1; - self.opaque = NO; - } - return self; -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - UIView *result = [super hitTest:point withEvent:event]; - // Ignore touches unless they hit one of my node's subnodes - if (result == _node.view) { - return nil; - } - return result; -} - -- (void)setMainWindow:(UIWindow *)mainWindow -{ - _mainWindow = mainWindow; - for (ASDisplayNode *node in _node.subnodes) { - [node removeFromSupernode]; - } -} - -- (void)didTapTipNode:(ASTipNode *)tipNode -{ - ASDisplayNode.tipDisplayBlock(tipNode.tip.node, tipNode.tip.text); -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - _node.frame = self.bounds; - - // Ensure the main window is laid out first. - [self.mainWindow layoutIfNeeded]; - - NSMutableSet *tipNodesToRemove = [NSMutableSet setWithArray:_node.subnodes]; - for (ASDisplayNodeTipState *tipState in [_nodeToTipStates objectEnumerator]) { - ASDisplayNode *node = tipState.node; - ASTipNode *tipNode = tipState.tipNode; - [tipNodesToRemove removeObject:tipNode]; - CGRect rect = node.bounds; - rect = [node.view convertRect:rect toView:nil]; - rect = [self convertRect:rect fromView:nil]; - tipNode.frame = rect; - if (tipNode.supernode != _node) { - [_node addSubnode:tipNode]; - } - } - - // Clean up any tip nodes whose target nodes have disappeared. - for (ASTipNode *tipNode in tipNodesToRemove) { - [tipNode removeFromSupernode]; - } -} - -@end - -#endif // AS_ENABLE_TIPS diff --git a/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.h b/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.h deleted file mode 100644 index 8bddf29e..00000000 --- a/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// ASTwoDimensionalArrayUtils.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Helper functions for two-dimensional array, where the objects of the root array are each arrays. - */ - -/** - * Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy. - * This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need. - */ -ASDK_EXTERN NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) AS_WARN_UNUSED_RESULT; - -/** - * Delete the elements of the mutable two-dimensional array at given index paths – sorted in descending order! - */ -ASDK_EXTERN void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths); - -/** - * Return all the index paths of a two-dimensional array, in ascending order. - */ -ASDK_EXTERN NSArray *ASIndexPathsForTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; - -/** - * Return all the elements of a two-dimensional array, in ascending order. - */ -ASDK_EXTERN NSArray *ASElementsInTwoDimensionalArray(NSArray* twoDimensionalArray) AS_WARN_UNUSED_RESULT; - -/** - * Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds. - */ -ASDK_EXTERN id _Nullable ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.mm b/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.mm deleted file mode 100644 index 2a333349..00000000 --- a/Example/Pods/Texture/Source/Private/ASTwoDimensionalArrayUtils.mm +++ /dev/null @@ -1,121 +0,0 @@ -// -// ASTwoDimensionalArrayUtils.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import - -#import - -// Import UIKit to get [NSIndexPath indexPathForItem:inSection:] which uses -// tagged pointers. - -#pragma mark - Public Methods - -NSMutableArray *ASTwoDimensionalArrayDeepMutableCopy(NSArray *array) -{ - NSMutableArray *newArray = [NSMutableArray arrayWithCapacity:array.count]; - NSInteger i = 0; - for (NSArray *subarray in array) { - ASDisplayNodeCAssert([subarray isKindOfClass:[NSArray class]], @"This function expects NSArray *"); - newArray[i++] = [subarray mutableCopy]; - } - return newArray; -} - -void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray *indexPaths) -{ - if (indexPaths.count == 0) { - return; - } - -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - NSArray *sortedIndexPaths = [indexPaths sortedArrayUsingSelector:@selector(asdk_inverseCompare:)]; - ASDisplayNodeCAssert([sortedIndexPaths isEqualToArray:indexPaths], @"Expected array of index paths to be sorted in descending order."); -#endif - - /** - * It is tempting to do something clever here and collect indexes into ranges or NSIndexSets - * but deep down, __NSArrayM only implements removeObjectAtIndex: and so doing all that extra - * work ends up running the same code. - */ - for (NSIndexPath *indexPath in indexPaths) { - NSInteger section = indexPath.section; - if (section >= mutableArray.count) { - ASDisplayNodeCFailAssert(@"Invalid section index %ld – only %ld sections", (long)section, (long)mutableArray.count); - continue; - } - - NSMutableArray *subarray = mutableArray[section]; - NSInteger item = indexPath.item; - if (item >= subarray.count) { - ASDisplayNodeCFailAssert(@"Invalid item index %ld – only %ld items in section %ld", (long)item, (long)subarray.count, (long)section); - continue; - } - [subarray removeObjectAtIndex:item]; - } -} - -NSArray *ASIndexPathsForTwoDimensionalArray(NSArray * twoDimensionalArray) -{ - NSInteger sectionCount = twoDimensionalArray.count; - NSInteger counts[sectionCount]; - NSInteger totalCount = 0; - NSInteger i = 0; - for (NSArray *subarray in twoDimensionalArray) { - NSInteger count = subarray.count; - counts[i++] = count; - totalCount += count; - } - - // Count could be huge. Use a reserved vector rather than VLA (stack.) - std::vector indexPaths; - indexPaths.reserve(totalCount); - for (NSInteger i = 0; i < sectionCount; i++) { - for (NSInteger j = 0; j < counts[i]; j++) { - indexPaths.push_back([NSIndexPath indexPathForItem:j inSection:i]); - } - } - return [NSArray arrayByTransferring:indexPaths.data() count:totalCount]; -} - -NSArray *ASElementsInTwoDimensionalArray(NSArray * twoDimensionalArray) -{ - NSInteger totalCount = 0; - for (NSArray *subarray in twoDimensionalArray) { - totalCount += subarray.count; - } - - std::vector elements; - elements.reserve(totalCount); - for (NSArray *subarray in twoDimensionalArray) { - for (id object in subarray) { - elements.push_back(object); - } - } - return [NSArray arrayByTransferring:elements.data() count:totalCount]; -} - -id ASGetElementInTwoDimensionalArray(NSArray *array, NSIndexPath *indexPath) -{ - ASDisplayNodeCAssertNotNil(indexPath, @"Expected non-nil index path"); - ASDisplayNodeCAssert(indexPath.length == 2, @"Expected index path of length 2. Index path: %@", indexPath); - NSInteger section = indexPath.section; - if (array.count <= section) { - return nil; - } - - NSArray *innerArray = array[section]; - NSInteger item = indexPath.item; - if (innerArray.count <= item) { - return nil; - } - return innerArray[item]; -} diff --git a/Example/Pods/Texture/Source/Private/ASWeakMap.h b/Example/Pods/Texture/Source/Private/ASWeakMap.h deleted file mode 100644 index 1f413ca7..00000000 --- a/Example/Pods/Texture/Source/Private/ASWeakMap.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// ASWeakMap.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - - -/** - * This class is used in conjunction with ASWeakMap. Instances of this type are returned by an ASWeakMap, - * must retain this value for as long as they want the entry to exist in the map. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASWeakMapEntry : NSObject - -@property (readonly) Value value; - -@end - - -/** - * This is not a full-featured map. It does not support features like `count` and FastEnumeration because there - * is not currently a need. - * - * This is a map that does not retain keys or values added to it. When both getting and setting, the caller is - * returned a ASWeakMapEntry and must retain it for as long as it wishes the key/value to remain in the map. - * We return a single Entry value to the caller to avoid two potential problems: - * - * 1) It's easier for callers to retain one value (the Entry) and not two (a key and a value). - * 2) Key values are tested for `isEqual` equality. If if a caller asks for a key "A" that is equal to a key "B" - * already in the map, then we need the caller to retain key "B" and not key "A". Returning an Entry simplifies - * the semantics. - * - * The underlying storage is a hash table and the Key type should implement `hash` and `isEqual:`. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASWeakMap<__covariant Key, Value> : NSObject - -/** - * Read from the cache. The Value object is accessible from the returned ASWeakMapEntry. - */ -- (nullable ASWeakMapEntry *)entryForKey:(Key)key AS_WARN_UNUSED_RESULT; - -/** - * Put a value into the cache. If an entry with an equal key already exists, then the value is updated on the existing entry. - */ -- (ASWeakMapEntry *)setObject:(Value)value forKey:(Key)key AS_WARN_UNUSED_RESULT; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/ASWeakMap.mm b/Example/Pods/Texture/Source/Private/ASWeakMap.mm deleted file mode 100644 index 3110b13d..00000000 --- a/Example/Pods/Texture/Source/Private/ASWeakMap.mm +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASWeakMap.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface ASWeakMapEntry () -@property (nonatomic, readonly) id key; -@property id value; -@end - -@implementation ASWeakMapEntry - -- (instancetype)initWithKey:(id)key value:(id)value -{ - self = [super init]; - if (self) { - _key = key; - _value = value; - } - return self; -} - -@end - - -@interface ASWeakMap () -@property (nonatomic, readonly) NSMapTable *hashTable; -@end - -/** - * Implementation details: - * - * The retained size of our keys is potentially very large (for example, a UIImage is commonly part of a key). - * Unfortunately, NSMapTable does not make guarantees about how quickly it will dispose of entries where - * either the key or the value is weak and has been disposed. So, a NSMapTable with "strong key to weak value" is - * unsuitable for our purpose because the strong keys are retained longer than the value and for an indefininte period of time. - * More details here: http://cocoamine.net/blog/2013/12/13/nsmaptable-and-zeroing-weak-references/ - * - * Our NSMapTable is "weak key to weak value" where each key maps to an Entry. The Entry object is responsible - * for retaining both the key and value. Our convention is that the caller must retain the Entry object - * in order to keep the key and the value in the cache. - */ -@implementation ASWeakMap - -- (instancetype)init -{ - self = [super init]; - if (self) { - _hashTable = [NSMapTable weakToWeakObjectsMapTable]; - } - return self; -} - -- (ASWeakMapEntry *)entryForKey:(id)key -{ - return [self.hashTable objectForKey:key]; -} - -- (ASWeakMapEntry *)setObject:(id)value forKey:(id)key -{ - ASWeakMapEntry *entry = [self.hashTable objectForKey:key]; - if (entry != nil) { - // Update the value in the existing entry. - entry.value = value; - } else { - entry = [[ASWeakMapEntry alloc] initWithKey:key value:value]; - [self.hashTable setObject:entry forKey:key]; - } - return entry; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/Layout/ASLayoutElementStylePrivate.h b/Example/Pods/Texture/Source/Private/Layout/ASLayoutElementStylePrivate.h deleted file mode 100644 index 69e29824..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASLayoutElementStylePrivate.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ASLayoutElementStylePrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import -#import - -@interface ASLayoutElementStyle () - -/** - * @abstract The object that acts as the delegate of the style. - * - * @discussion The delegate must adopt the ASLayoutElementStyleDelegate protocol. The delegate is not retained. - */ -@property (nullable, nonatomic, weak) id delegate; - -/** - * @abstract A size constraint that should apply to this ASLayoutElement. - */ -@property (nonatomic, readonly) ASLayoutElementSize size; - -@property (nonatomic, assign) ASStackLayoutAlignItems parentAlignStyle; - -@end diff --git a/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecPrivate.h b/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecPrivate.h deleted file mode 100644 index 93023209..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecPrivate.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ASLayoutSpecPrivate.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#if DEBUG - #define AS_DEDUPE_LAYOUT_SPEC_TREE 1 -#else - #define AS_DEDUPE_LAYOUT_SPEC_TREE 0 -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface ASLayoutSpec() { - AS::RecursiveMutex __instanceLock__; - std::atomic _primitiveTraitCollection; - ASLayoutElementStyle *_style; - NSMutableArray *_childrenArray; -} - -#if AS_DEDUPE_LAYOUT_SPEC_TREE -/** - * Recursively search the subtree for elements that occur more than once. - */ -- (nullable NSHashTable> *)findDuplicatedElementsInSubtree; -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecUtilities.h b/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecUtilities.h deleted file mode 100644 index 82e07df1..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASLayoutSpecUtilities.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// ASLayoutSpecUtilities.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -namespace AS { - // adopted from http://stackoverflow.com/questions/14945223/map-function-with-c11-constructs - // Takes an iterable, applies a function to every element, - // and returns a vector of the results - // - template - auto map(const T &iterable, Func &&func) -> std::vector()))> - { - // Some convenience type definitions - typedef decltype(func(std::declval())) value_type; - - // Prepares an output vector of the appropriate size - std::vector res; - res.reserve(iterable.size()); - - // Let std::transform apply `func` to all elements - // (use perfect forwarding for the function object) - std::transform(std::begin(iterable), std::end(iterable), std::back_inserter(res), - std::forward(func)); - - return res; - } - - template - auto map(id collection, Func &&func) -> std::vector()))> - { - std::vector()))> to; - for (id obj in collection) { - to.push_back(func(obj)); - } - return to; - } - - template - auto filter(const T &iterable, Func &&func) -> std::vector - { - std::vector to; - for (auto obj : iterable) { - if (func(obj)) { - to.push_back(obj); - } - } - return to; - } -}; - -inline CGPoint operator+(const CGPoint &p1, const CGPoint &p2) -{ - return { p1.x + p2.x, p1.y + p2.y }; -} - -inline CGPoint operator-(const CGPoint &p1, const CGPoint &p2) -{ - return { p1.x - p2.x, p1.y - p2.y }; -} - -inline CGSize operator+(const CGSize &s1, const CGSize &s2) -{ - return { s1.width + s2.width, s1.height + s2.height }; -} - -inline CGSize operator-(const CGSize &s1, const CGSize &s2) -{ - return { s1.width - s2.width, s1.height - s2.height }; -} - -inline UIEdgeInsets operator+(const UIEdgeInsets &e1, const UIEdgeInsets &e2) -{ - return { e1.top + e2.top, e1.left + e2.left, e1.bottom + e2.bottom, e1.right + e2.right }; -} - -inline UIEdgeInsets operator-(const UIEdgeInsets &e1, const UIEdgeInsets &e2) -{ - return { e1.top - e2.top, e1.left - e2.left, e1.bottom - e2.bottom, e1.right - e2.right }; -} - -inline UIEdgeInsets operator*(const UIEdgeInsets &e1, const UIEdgeInsets &e2) -{ - return { e1.top * e2.top, e1.left * e2.left, e1.bottom * e2.bottom, e1.right * e2.right }; -} - -inline UIEdgeInsets operator-(const UIEdgeInsets &e) -{ - return { -e.top, -e.left, -e.bottom, -e.right }; -} diff --git a/Example/Pods/Texture/Source/Private/Layout/ASStackLayoutSpecUtilities.h b/Example/Pods/Texture/Source/Private/Layout/ASStackLayoutSpecUtilities.h deleted file mode 100644 index 6c708e04..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASStackLayoutSpecUtilities.h +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASStackLayoutSpecUtilities.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -typedef struct { - ASStackLayoutDirection direction; - CGFloat spacing; - ASStackLayoutJustifyContent justifyContent; - ASStackLayoutAlignItems alignItems; - ASStackLayoutFlexWrap flexWrap; - ASStackLayoutAlignContent alignContent; - CGFloat lineSpacing; -} ASStackLayoutSpecStyle; - -inline CGFloat stackDimension(const ASStackLayoutDirection direction, const CGSize size) -{ - return (direction == ASStackLayoutDirectionVertical) ? size.height : size.width; -} - -inline CGFloat crossDimension(const ASStackLayoutDirection direction, const CGSize size) -{ - return (direction == ASStackLayoutDirectionVertical) ? size.width : size.height; -} - -inline BOOL compareCrossDimension(const ASStackLayoutDirection direction, const CGSize a, const CGSize b) -{ - return crossDimension(direction, a) < crossDimension(direction, b); -} - -inline CGPoint directionPoint(const ASStackLayoutDirection direction, const CGFloat stack, const CGFloat cross) -{ - return (direction == ASStackLayoutDirectionVertical) ? CGPointMake(cross, stack) : CGPointMake(stack, cross); -} - -inline CGSize directionSize(const ASStackLayoutDirection direction, const CGFloat stack, const CGFloat cross) -{ - return (direction == ASStackLayoutDirectionVertical) ? CGSizeMake(cross, stack) : CGSizeMake(stack, cross); -} - -inline void setStackValueToPoint(const ASStackLayoutDirection direction, const CGFloat stack, CGPoint &point) { - (direction == ASStackLayoutDirectionVertical) ? (point.y = stack) : (point.x = stack); -} - -inline ASSizeRange directionSizeRange(const ASStackLayoutDirection direction, - const CGFloat stackMin, - const CGFloat stackMax, - const CGFloat crossMin, - const CGFloat crossMax) -{ - return {directionSize(direction, stackMin, crossMin), directionSize(direction, stackMax, crossMax)}; -} - -inline ASStackLayoutAlignItems alignment(ASStackLayoutAlignSelf childAlignment, ASStackLayoutAlignItems stackAlignment) -{ - switch (childAlignment) { - case ASStackLayoutAlignSelfCenter: - return ASStackLayoutAlignItemsCenter; - case ASStackLayoutAlignSelfEnd: - return ASStackLayoutAlignItemsEnd; - case ASStackLayoutAlignSelfStart: - return ASStackLayoutAlignItemsStart; - case ASStackLayoutAlignSelfStretch: - return ASStackLayoutAlignItemsStretch; - case ASStackLayoutAlignSelfAuto: - default: - return stackAlignment; - } -} - -inline ASStackLayoutAlignItems alignment(ASHorizontalAlignment alignment, ASStackLayoutAlignItems defaultAlignment) -{ - switch (alignment) { - case ASHorizontalAlignmentLeft: - return ASStackLayoutAlignItemsStart; - case ASHorizontalAlignmentMiddle: - return ASStackLayoutAlignItemsCenter; - case ASHorizontalAlignmentRight: - return ASStackLayoutAlignItemsEnd; - case ASHorizontalAlignmentNone: - default: - return defaultAlignment; - } -} - -inline ASStackLayoutAlignItems alignment(ASVerticalAlignment alignment, ASStackLayoutAlignItems defaultAlignment) -{ - switch (alignment) { - case ASVerticalAlignmentTop: - return ASStackLayoutAlignItemsStart; - case ASVerticalAlignmentCenter: - return ASStackLayoutAlignItemsCenter; - case ASVerticalAlignmentBottom: - return ASStackLayoutAlignItemsEnd; - case ASVerticalAlignmentNone: - default: - return defaultAlignment; - } -} - -inline ASStackLayoutJustifyContent justifyContent(ASHorizontalAlignment alignment, ASStackLayoutJustifyContent defaultJustifyContent) -{ - switch (alignment) { - case ASHorizontalAlignmentLeft: - return ASStackLayoutJustifyContentStart; - case ASHorizontalAlignmentMiddle: - return ASStackLayoutJustifyContentCenter; - case ASHorizontalAlignmentRight: - return ASStackLayoutJustifyContentEnd; - case ASHorizontalAlignmentNone: - default: - return defaultJustifyContent; - } -} - -inline ASStackLayoutJustifyContent justifyContent(ASVerticalAlignment alignment, ASStackLayoutJustifyContent defaultJustifyContent) -{ - switch (alignment) { - case ASVerticalAlignmentTop: - return ASStackLayoutJustifyContentStart; - case ASVerticalAlignmentCenter: - return ASStackLayoutJustifyContentCenter; - case ASVerticalAlignmentBottom: - return ASStackLayoutJustifyContentEnd; - case ASVerticalAlignmentNone: - default: - return defaultJustifyContent; - } -} diff --git a/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.h b/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.h deleted file mode 100644 index 103ec3a2..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ASStackPositionedLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -/** Represents a set of laid out and positioned stack layout children. */ -struct ASStackPositionedLayout { - const std::vector items; - /** Final size of the stack */ - const CGSize size; - - /** Given an unpositioned layout, computes the positions each child should be placed at. */ - static ASStackPositionedLayout compute(const ASStackUnpositionedLayout &unpositionedLayout, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &constrainedSize); -}; diff --git a/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.mm b/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.mm deleted file mode 100644 index 0e9d896e..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASStackPositionedLayout.mm +++ /dev/null @@ -1,185 +0,0 @@ -// -// ASStackPositionedLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import - -static CGFloat crossOffsetForItem(const ASStackLayoutSpecItem &item, - const ASStackLayoutSpecStyle &style, - const CGFloat crossSize, - const CGFloat baseline) -{ - switch (alignment(item.child.style.alignSelf, style.alignItems)) { - case ASStackLayoutAlignItemsEnd: - return crossSize - crossDimension(style.direction, item.layout.size); - case ASStackLayoutAlignItemsCenter: - return ASFloorPixelValue((crossSize - crossDimension(style.direction, item.layout.size)) / 2); - case ASStackLayoutAlignItemsBaselineFirst: - case ASStackLayoutAlignItemsBaselineLast: - return baseline - ASStackUnpositionedLayout::baselineForItem(style, item); - case ASStackLayoutAlignItemsStart: - case ASStackLayoutAlignItemsStretch: - case ASStackLayoutAlignItemsNotSet: - return 0; - } -} - -static void crossOffsetAndSpacingForEachLine(const std::size_t numOfLines, - const CGFloat crossViolation, - ASStackLayoutAlignContent alignContent, - CGFloat &offset, - CGFloat &spacing) -{ - ASDisplayNodeCAssertTrue(numOfLines > 0); - - // Handle edge cases - if (alignContent == ASStackLayoutAlignContentSpaceBetween && (crossViolation < kViolationEpsilon || numOfLines == 1)) { - alignContent = ASStackLayoutAlignContentStart; - } else if (alignContent == ASStackLayoutAlignContentSpaceAround && (crossViolation < kViolationEpsilon || numOfLines == 1)) { - alignContent = ASStackLayoutAlignContentCenter; - } - - offset = 0; - spacing = 0; - - switch (alignContent) { - case ASStackLayoutAlignContentCenter: - offset = crossViolation / 2; - break; - case ASStackLayoutAlignContentEnd: - offset = crossViolation; - break; - case ASStackLayoutAlignContentSpaceBetween: - // Spacing between the items, no spaces at the edges, evenly distributed - spacing = crossViolation / (numOfLines - 1); - break; - case ASStackLayoutAlignContentSpaceAround: { - // Spacing between items are twice the spacing on the edges - CGFloat spacingUnit = crossViolation / (numOfLines * 2); - offset = spacingUnit; - spacing = spacingUnit * 2; - break; - } - case ASStackLayoutAlignContentStart: - case ASStackLayoutAlignContentStretch: - break; - } -} - -static void stackOffsetAndSpacingForEachItem(const std::size_t numOfItems, - const CGFloat stackViolation, - ASStackLayoutJustifyContent justifyContent, - CGFloat &offset, - CGFloat &spacing) -{ - ASDisplayNodeCAssertTrue(numOfItems > 0); - - // Handle edge cases - if (justifyContent == ASStackLayoutJustifyContentSpaceBetween && (stackViolation < kViolationEpsilon || numOfItems == 1)) { - justifyContent = ASStackLayoutJustifyContentStart; - } else if (justifyContent == ASStackLayoutJustifyContentSpaceAround && (stackViolation < kViolationEpsilon || numOfItems == 1)) { - justifyContent = ASStackLayoutJustifyContentCenter; - } - - offset = 0; - spacing = 0; - - switch (justifyContent) { - case ASStackLayoutJustifyContentCenter: - offset = stackViolation / 2; - break; - case ASStackLayoutJustifyContentEnd: - offset = stackViolation; - break; - case ASStackLayoutJustifyContentSpaceBetween: - // Spacing between the items, no spaces at the edges, evenly distributed - spacing = stackViolation / (numOfItems - 1); - break; - case ASStackLayoutJustifyContentSpaceAround: { - // Spacing between items are twice the spacing on the edges - CGFloat spacingUnit = stackViolation / (numOfItems * 2); - offset = spacingUnit; - spacing = spacingUnit * 2; - break; - } - case ASStackLayoutJustifyContentStart: - break; - } -} - -static void positionItemsInLine(const ASStackUnpositionedLine &line, - const ASStackLayoutSpecStyle &style, - const CGPoint &startingPoint, - const CGFloat stackSpacing) -{ - CGPoint p = startingPoint; - BOOL first = YES; - - for (const auto &item : line.items) { - p = p + directionPoint(style.direction, item.child.style.spacingBefore, 0); - if (!first) { - p = p + directionPoint(style.direction, style.spacing + stackSpacing, 0); - } - first = NO; - item.layout.position = p + directionPoint(style.direction, 0, crossOffsetForItem(item, style, line.crossSize, line.baseline)); - - p = p + directionPoint(style.direction, stackDimension(style.direction, item.layout.size) + item.child.style.spacingAfter, 0); - } -} - -ASStackPositionedLayout ASStackPositionedLayout::compute(const ASStackUnpositionedLayout &layout, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - const auto &lines = layout.lines; - if (lines.empty()) { - return {}; - } - - const auto numOfLines = lines.size(); - const auto direction = style.direction; - const auto alignContent = style.alignContent; - const auto lineSpacing = style.lineSpacing; - const auto justifyContent = style.justifyContent; - const auto crossViolation = ASStackUnpositionedLayout::computeCrossViolation(layout.crossDimensionSum, style, sizeRange); - CGFloat crossOffset; - CGFloat crossSpacing; - crossOffsetAndSpacingForEachLine(numOfLines, crossViolation, alignContent, crossOffset, crossSpacing); - - std::vector positionedItems; - CGPoint p = directionPoint(direction, 0, crossOffset); - BOOL first = YES; - for (const auto &line : lines) { - if (!first) { - p = p + directionPoint(direction, 0, crossSpacing + lineSpacing); - } - first = NO; - - const auto &items = line.items; - const auto stackViolation = ASStackUnpositionedLayout::computeStackViolation(line.stackDimensionSum, style, sizeRange); - CGFloat stackOffset; - CGFloat stackSpacing; - stackOffsetAndSpacingForEachItem(items.size(), stackViolation, justifyContent, stackOffset, stackSpacing); - - setStackValueToPoint(direction, stackOffset, p); - positionItemsInLine(line, style, p, stackSpacing); - std::move(items.begin(), items.end(), std::back_inserter(positionedItems)); - - p = p + directionPoint(direction, -stackOffset, line.crossSize); - } - - const CGSize finalSize = directionSize(direction, layout.stackDimensionSum, layout.crossDimensionSum); - return {std::move(positionedItems), ASSizeRangeClamp(sizeRange, finalSize)}; -} diff --git a/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.h b/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.h deleted file mode 100644 index 68f9421d..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// ASStackUnpositionedLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -/** The threshold that determines if a violation has actually occurred. */ -ASDK_EXTERN CGFloat const kViolationEpsilon; - -struct ASStackLayoutSpecChild { - /** The original source child. */ - id element; - /** Style object of element. */ - ASLayoutElementStyle *style; - /** Size object of the element */ - ASLayoutElementSize size; -}; - -struct ASStackLayoutSpecItem { - /** The original source child. */ - ASStackLayoutSpecChild child; - /** The proposed layout or nil if no is calculated yet. */ - ASLayout *layout; -}; - -struct ASStackUnpositionedLine { - /** The set of proposed children in this line, each contains child layout, not yet positioned. */ - std::vector items; - /** The total size of the children in the stack dimension, including all spacing. */ - CGFloat stackDimensionSum; - /** The size in the cross dimension */ - CGFloat crossSize; - /** The baseline of the stack which baseline aligned children should align to */ - CGFloat baseline; -}; - -/** Represents a set of stack layout children that have their final layout computed, but are not yet positioned. */ -struct ASStackUnpositionedLayout { - /** The set of proposed lines, each contains child layouts, not yet positioned. */ - const std::vector lines; - /** - * In a single line stack (e.g no wrao), this is the total size of the children in the stack dimension, including all spacing. - * In a multi-line stack, this is the largest stack dimension among lines. - */ - const CGFloat stackDimensionSum; - const CGFloat crossDimensionSum; - - /** Given a set of children, computes the unpositioned layouts for those children. */ - static ASStackUnpositionedLayout compute(const std::vector &children, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange, - const BOOL concurrent); - - static CGFloat baselineForItem(const ASStackLayoutSpecStyle &style, - const ASStackLayoutSpecItem &l); - - static CGFloat computeStackViolation(const CGFloat stackDimensionSum, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange); - - static CGFloat computeCrossViolation(const CGFloat crossDimensionSum, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange); -}; diff --git a/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.mm b/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.mm deleted file mode 100644 index 773f8bbf..00000000 --- a/Example/Pods/Texture/Source/Private/Layout/ASStackUnpositionedLayout.mm +++ /dev/null @@ -1,758 +0,0 @@ -// -// ASStackUnpositionedLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -#import -#import -#import - -CGFloat const kViolationEpsilon = 0.01; - -static CGFloat resolveCrossDimensionMaxForStretchChild(const ASStackLayoutSpecStyle &style, - const ASStackLayoutSpecChild &child, - const CGFloat stackMax, - const CGFloat crossMax) -{ - // stretched children may have a cross direction max that is smaller than the minimum size constraint of the parent. - const CGFloat computedMax = (style.direction == ASStackLayoutDirectionVertical ? - ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).max.width : - ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).max.height); - return computedMax == INFINITY ? crossMax : computedMax; -} - -static CGFloat resolveCrossDimensionMinForStretchChild(const ASStackLayoutSpecStyle &style, - const ASStackLayoutSpecChild &child, - const CGFloat stackMax, - const CGFloat crossMin) -{ - // stretched children will have a cross dimension of at least crossMin, unless they explicitly define a child size - // that is smaller than the constraint of the parent. - return (style.direction == ASStackLayoutDirectionVertical ? - ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).min.width : - ASLayoutElementSizeResolve(child.style.size, ASLayoutElementParentSizeUndefined).min.height) ?: crossMin; -} - -/** - Sizes the child given the parameters specified, and returns the computed layout. - */ -static ASLayout *crossChildLayout(const ASStackLayoutSpecChild &child, - const ASStackLayoutSpecStyle &style, - const CGFloat stackMin, - const CGFloat stackMax, - const CGFloat crossMin, - const CGFloat crossMax, - const CGSize parentSize) -{ - const ASStackLayoutAlignItems alignItems = alignment(child.style.alignSelf, style.alignItems); - // stretched children will have a cross dimension of at least crossMin - const CGFloat childCrossMin = (alignItems == ASStackLayoutAlignItemsStretch ? - resolveCrossDimensionMinForStretchChild(style, child, stackMax, crossMin) : - 0); - const CGFloat childCrossMax = (alignItems == ASStackLayoutAlignItemsStretch ? - resolveCrossDimensionMaxForStretchChild(style, child, stackMax, crossMax) : - crossMax); - const ASSizeRange childSizeRange = directionSizeRange(style.direction, stackMin, stackMax, childCrossMin, childCrossMax); - ASLayout *layout = [child.element layoutThatFits:childSizeRange parentSize:parentSize]; - ASDisplayNodeCAssertNotNil(layout, @"ASLayout returned from -layoutThatFits:parentSize: must not be nil: %@", child.element); - return layout ? : [ASLayout layoutWithLayoutElement:child.element size:{0, 0}]; -} - -static void dispatchApplyIfNeeded(size_t iterationCount, BOOL forced, void(^work)(size_t i)) -{ - if (iterationCount == 0) { - return; - } - - if (iterationCount == 1) { - work(0); - return; - } - - // TODO Once the locking situation in ASDisplayNode has improved, always dispatch if on main - if (forced == NO) { - for (size_t i = 0; i < iterationCount; i++) { - work(i); - } - return; - } - - dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); - ASDispatchApply(iterationCount, queue, 0, work); -} - -/** - Computes the consumed cross dimension length for the given vector of lines and stacking style. - - Cross Dimension - +---------------------> - +--------+ +--------+ +--------+ +---------+ - Vertical |Vertical| |Vertical| |Vertical| |Vertical | - Stack | Line 1 | | Line 2 | | Line 3 | | Line 4 | - | | | | | | | | - +--------+ +--------+ +--------+ +---------+ - crossDimensionSum - |------------------------------------------| - - @param lines unpositioned lines - */ -static CGFloat computeLinesCrossDimensionSum(const std::vector &lines, - const ASStackLayoutSpecStyle &style) -{ - return std::accumulate(lines.begin(), lines.end(), - // Start from default spacing between each line: - lines.empty() ? 0 : style.lineSpacing * (lines.size() - 1), - [&](CGFloat x, const ASStackUnpositionedLine &l) { - return x + l.crossSize; - }); -} - - -/** - Computes the violation by comparing a cross dimension sum with the overall allowable size range for the stack. - - Violation is the distance you would have to add to the unbounded cross-direction length of the stack spec's - lines in order to bring the stack within its allowed sizeRange. The diagram below shows 3 vertical stacks, each contains 3-5 vertical lines, - with the different types of violation. - - Cross Dimension - +---------------------> - cross size range - |------------| - +--------+ +--------+ +--------+ +---------+ - - - - - - - - - Vertical |Vertical| |Vertical| |Vertical| |Vertical | | ^ - Stack 1 | Line 1 | | Line 2 | | Line 3 | | Line 4 | (zero violation) | stack size range - | | | | | | | | | | v - +--------+ +--------+ +--------+ +---------+ - - - - - - - - - | | - +--------+ +--------+ +--------+ - - - - - - - - - - - - - Vertical | | | | | | | | ^ - Stack 2 | | | | | |<--> (positive violation) | stack size range - | | | | | | | | v - +--------+ +--------+ +--------+ - - - - - - - - - - - - - | |<------> (negative violation) - +--------+ +--------+ +--------+ +---------+ +-----------+ - - - - Vertical | | | | | | | | | | | | ^ - Stack 3 | | | | | | | | | | | stack size range - | | | | | | | | | | | | v - +--------+ +--------+ +--------+ +---------+ +-----------+ - - - - - @param crossDimensionSum the consumed length of the lines in the stack along the cross dimension - @param style layout style to be applied to all children - @param sizeRange the range of allowable sizes for the stack layout spec - */ -CGFloat ASStackUnpositionedLayout::computeCrossViolation(const CGFloat crossDimensionSum, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - const CGFloat minCrossDimension = crossDimension(style.direction, sizeRange.min); - const CGFloat maxCrossDimension = crossDimension(style.direction, sizeRange.max); - if (crossDimensionSum < minCrossDimension) { - return minCrossDimension - crossDimensionSum; - } else if (crossDimensionSum > maxCrossDimension) { - return maxCrossDimension - crossDimensionSum; - } - return 0; -} - -/** - Stretches children to lay out along the cross axis according to the alignment stretch settings of the children - (child.alignSelf), and the stack layout's alignment settings (style.alignItems). This does not do the actual alignment - of the items once stretched though; ASStackPositionedLayout will do centering etc. - - Finds the maximum cross dimension among child layouts. If that dimension exceeds the minimum cross layout size then - we must stretch any children whose alignItems specify ASStackLayoutAlignItemsStretch. - - The diagram below shows 3 children in a horizontal stack. The second child is larger than the minCrossDimension, so - its height is used as the childCrossMax. Any children that are stretchable (which may be all children if - style.alignItems specifies stretch) like the first child must be stretched to match that maximum. All children must be - at least minCrossDimension in cross dimension size, which is shown by the sizing of the third child. - - Stack Dimension - +---------------------> - + +-+-------------+-+-------------+--+---------------+ + + + - | | child. | | | | | | | | - | | alignSelf | | | | | | | | - Cross | | = stretch | | | +-------+-------+ | | | - Dimension | +-----+-------+ | | | | | | | | - | | | | | | | | | | - | | | | | v | | | | - v +-+- - - - - - -+-+ - - - - - - +--+- - - - - - - -+ | | + minCrossDimension - | | | | | - | v | | | | | - +- - - - - - -+ +-------------+ | + childCrossMax - | - +--------------------------------------------------+ + crossMax - - @param items pre-computed items; modified in-place as needed - @param style the layout style of the overall stack layout - */ -static void stretchItemsAlongCrossDimension(std::vector &items, - const ASStackLayoutSpecStyle &style, - const BOOL concurrent, - const CGSize parentSize, - const CGFloat crossSize) -{ - dispatchApplyIfNeeded(items.size(), concurrent, ^(size_t i) { - auto &item = items[i]; - const ASStackLayoutAlignItems alignItems = alignment(item.child.style.alignSelf, style.alignItems); - if (alignItems == ASStackLayoutAlignItemsStretch) { - const CGFloat cross = crossDimension(style.direction, item.layout.size); - const CGFloat stack = stackDimension(style.direction, item.layout.size); - const CGFloat violation = crossSize - cross; - - // Only stretch if violation is positive. Compare against kViolationEpsilon here to avoid stretching against a tiny violation. - if (violation > kViolationEpsilon) { - item.layout = crossChildLayout(item.child, style, stack, stack, crossSize, crossSize, parentSize); - } - } - }); -} - -/** - * Stretch lines and their items according to alignContent, alignItems and alignSelf. - * https://www.w3.org/TR/css-flexbox-1/#algo-line-stretch - * https://www.w3.org/TR/css-flexbox-1/#algo-stretch - */ -static void stretchLinesAlongCrossDimension(std::vector &lines, - const ASStackLayoutSpecStyle &style, - const BOOL concurrent, - const ASSizeRange &sizeRange, - const CGSize parentSize) -{ - ASDisplayNodeCAssertFalse(lines.empty()); - const std::size_t numOfLines = lines.size(); - const CGFloat violation = ASStackUnpositionedLayout::computeCrossViolation(computeLinesCrossDimensionSum(lines, style), style, sizeRange); - // Don't stretch if the stack is single line, because the line's cross size was clamped against the stack's constrained size. - const BOOL shouldStretchLines = (numOfLines > 1 - && style.alignContent == ASStackLayoutAlignContentStretch - && violation > kViolationEpsilon); - - CGFloat extraCrossSizePerLine = violation / numOfLines; - for (auto &line : lines) { - if (shouldStretchLines) { - line.crossSize += extraCrossSizePerLine; - } - - stretchItemsAlongCrossDimension(line.items, style, concurrent, parentSize, line.crossSize); - } -} - -static BOOL itemIsBaselineAligned(const ASStackLayoutSpecStyle &style, - const ASStackLayoutSpecItem &l) -{ - ASStackLayoutAlignItems alignItems = alignment(l.child.style.alignSelf, style.alignItems); - return alignItems == ASStackLayoutAlignItemsBaselineFirst || alignItems == ASStackLayoutAlignItemsBaselineLast; -} - -CGFloat ASStackUnpositionedLayout::baselineForItem(const ASStackLayoutSpecStyle &style, - const ASStackLayoutSpecItem &item) -{ - switch (alignment(item.child.style.alignSelf, style.alignItems)) { - case ASStackLayoutAlignItemsBaselineFirst: - return item.child.style.ascender; - case ASStackLayoutAlignItemsBaselineLast: - return crossDimension(style.direction, item.layout.size) + item.child.style.descender; - default: - return 0; - } -} - -/** - * Computes cross size and baseline of each line. - * https://www.w3.org/TR/css-flexbox-1/#algo-cross-line - * - * @param lines All items to lay out - * @param style the layout style of the overall stack layout - * @param sizeRange the range of allowable sizes for the stack layout component - */ -static void computeLinesCrossSizeAndBaseline(std::vector &lines, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - ASDisplayNodeCAssertFalse(lines.empty()); - const BOOL isSingleLine = (lines.size() == 1); - - const auto minCrossSize = crossDimension(style.direction, sizeRange.min); - const auto maxCrossSize = crossDimension(style.direction, sizeRange.max); - const BOOL definiteCrossSize = (minCrossSize == maxCrossSize); - - // If the stack is single-line and has a definite cross size, the cross size of the line is the stack's definite cross size. - if (isSingleLine && definiteCrossSize) { - auto &line = lines[0]; - line.crossSize = minCrossSize; - - // We still need to determine the line's baseline - //TODO unit test - for (const auto &item : line.items) { - if (itemIsBaselineAligned(style, item)) { - CGFloat baseline = ASStackUnpositionedLayout::baselineForItem(style, item); - line.baseline = MAX(line.baseline, baseline); - } - } - - return; - } - - for (auto &line : lines) { - const auto &items = line.items; - CGFloat maxStartToBaselineDistance = 0; - CGFloat maxBaselineToEndDistance = 0; - CGFloat maxItemCrossSize = 0; - - for (const auto &item : items) { - if (itemIsBaselineAligned(style, item)) { - // Step 1. Collect all the items whose align-self is baseline. Find the largest of the distances - // between each item’s baseline and its hypothetical outer cross-start edge (aka. its baseline value), - // and the largest of the distances between each item’s baseline and its hypothetical outer cross-end edge, - // and sum these two values. - CGFloat baseline = ASStackUnpositionedLayout::baselineForItem(style, item); - maxStartToBaselineDistance = MAX(maxStartToBaselineDistance, baseline); - maxBaselineToEndDistance = MAX(maxBaselineToEndDistance, crossDimension(style.direction, item.layout.size) - baseline); - } else { - // Step 2. Among all the items not collected by the previous step, find the largest outer hypothetical cross size. - maxItemCrossSize = MAX(maxItemCrossSize, crossDimension(style.direction, item.layout.size)); - } - } - - // Step 3. The used cross-size of the flex line is the largest of the numbers found in the previous two steps and zero. - line.crossSize = MAX(maxStartToBaselineDistance + maxBaselineToEndDistance, maxItemCrossSize); - if (isSingleLine) { - // If the stack is single-line, then clamp the line’s cross-size to be within the stack's min and max cross-size properties. - line.crossSize = MIN(MAX(minCrossSize, line.crossSize), maxCrossSize); - } - - line.baseline = maxStartToBaselineDistance; - } -} - -/** - Returns a lambda that computes the relevant flex factor based on the given violation. - @param violation The amount that the stack layout violates its size range. See header for sign interpretation. - */ -static std::function flexFactorInViolationDirection(const CGFloat violation) -{ - if (std::fabs(violation) < kViolationEpsilon) { - return [](const ASStackLayoutSpecItem &item) { return 0.0; }; - } else if (violation > 0) { - return [](const ASStackLayoutSpecItem &item) { return item.child.style.flexGrow; }; - } else { - return [](const ASStackLayoutSpecItem &item) { return item.child.style.flexShrink; }; - } -} - -static inline CGFloat scaledFlexShrinkFactor(const ASStackLayoutSpecItem &item, - const ASStackLayoutSpecStyle &style, - const CGFloat flexFactorSum) -{ - return stackDimension(style.direction, item.layout.size) * (item.child.style.flexShrink / flexFactorSum); -} - -/** - Returns a lambda that computes a flex shrink adjustment for a given item based on the provided violation. - @param items The unpositioned items from the original unconstrained layout pass. - @param style The layout style to be applied to all children. - @param violation The amount that the stack layout violates its size range. - @param flexFactorSum The sum of each item's flex factor as determined by the provided violation. - @return A lambda capable of computing the flex shrink adjustment, if any, for a particular item. - */ -static std::function flexShrinkAdjustment(const std::vector &items, - const ASStackLayoutSpecStyle &style, - const CGFloat violation, - const CGFloat flexFactorSum) -{ - const CGFloat scaledFlexShrinkFactorSum = std::accumulate(items.begin(), items.end(), 0.0, [&](CGFloat x, const ASStackLayoutSpecItem &item) { - return x + scaledFlexShrinkFactor(item, style, flexFactorSum); - }); - return [style, scaledFlexShrinkFactorSum, violation, flexFactorSum](const ASStackLayoutSpecItem &item) { - if (scaledFlexShrinkFactorSum == 0.0) { - return (CGFloat)0.0; - } - - const CGFloat scaledFlexShrinkFactorRatio = scaledFlexShrinkFactor(item, style, flexFactorSum) / scaledFlexShrinkFactorSum; - // The item should shrink proportionally to the scaled flex shrink factor ratio computed above. - // Unlike the flex grow adjustment the flex shrink adjustment needs to take the size of each item into account. - return -std::fabs(scaledFlexShrinkFactorRatio * violation); - }; -} - -/** - Returns a lambda that computes a flex grow adjustment for a given item based on the provided violation. - @param items The unpositioned items from the original unconstrained layout pass. - @param violation The amount that the stack layout violates its size range. - @param flexFactorSum The sum of each item's flex factor as determined by the provided violation. - @return A lambda capable of computing the flex grow adjustment, if any, for a particular item. - */ -static std::function flexGrowAdjustment(const std::vector &items, - const CGFloat violation, - const CGFloat flexFactorSum) -{ - // To compute the flex grow adjustment distribute the violation proportionally based on each item's flex grow factor. - return [violation, flexFactorSum](const ASStackLayoutSpecItem &item) { - return std::floor(violation * (item.child.style.flexGrow / flexFactorSum)); - }; -} - -/** - Returns a lambda that computes a flex adjustment for a given item based on the provided violation. - @param items The unpositioned items from the original unconstrained layout pass. - @param style The layout style to be applied to all children. - @param violation The amount that the stack layout violates its size range. - @param flexFactorSum The sum of each item's flex factor as determined by the provided violation. - @return A lambda capable of computing the flex adjustment for a particular item. - */ -static std::function flexAdjustmentInViolationDirection(const std::vector &items, - const ASStackLayoutSpecStyle &style, - const CGFloat violation, - const CGFloat flexFactorSum) -{ - if (violation > 0) { - return flexGrowAdjustment(items, violation, flexFactorSum); - } else { - return flexShrinkAdjustment(items, style, violation, flexFactorSum); - } -} - -ASDISPLAYNODE_INLINE BOOL isFlexibleInBothDirections(const ASStackLayoutSpecChild &child) -{ - return child.style.flexGrow > 0 && child.style.flexShrink > 0; -} - -/** - The flexible children may have been left not laid out in the initial layout pass, so we may have to go through and size - these children at zero size so that the children layouts are at least present. - */ -static void layoutFlexibleChildrenAtZeroSize(std::vector &items, - const ASStackLayoutSpecStyle &style, - const BOOL concurrent, - const ASSizeRange &sizeRange, - const CGSize parentSize) -{ - dispatchApplyIfNeeded(items.size(), concurrent, ^(size_t i) { - auto &item = items[i]; - if (isFlexibleInBothDirections(item.child)) { - item.layout = crossChildLayout(item.child, - style, - 0, - 0, - crossDimension(style.direction, sizeRange.min), - crossDimension(style.direction, sizeRange.max), - parentSize); - } - }); -} - -/** - Computes the consumed stack dimension length for the given vector of items and stacking style. - - stackDimensionSum - <-----------------------> - +-----+ +-------+ +---+ - | | | | | | - | | | | | | - +-----+ | | +---+ - +-------+ - - @param items unpositioned layouts for items - @param style the layout style of the overall stack layout - */ -static CGFloat computeItemsStackDimensionSum(const std::vector &items, - const ASStackLayoutSpecStyle &style) -{ - // Sum up the children's spacing - const CGFloat childSpacingSum = std::accumulate(items.begin(), items.end(), - // Start from default spacing between each child: - items.empty() ? 0 : style.spacing * (items.size() - 1), - [&](CGFloat x, const ASStackLayoutSpecItem &l) { - return x + l.child.style.spacingBefore + l.child.style.spacingAfter; - }); - - // Sum up the children's dimensions (including spacing) in the stack direction. - const CGFloat childStackDimensionSum = std::accumulate(items.begin(), items.end(), - childSpacingSum, - [&](CGFloat x, const ASStackLayoutSpecItem &l) { - return x + stackDimension(style.direction, l.layout.size); - }); - return childStackDimensionSum; -} - -//TODO move this up near computeCrossViolation and make both methods share the same code path, to make sure they share the same concept of "negative" and "positive" violations. -/** - Computes the violation by comparing a stack dimension sum with the overall allowable size range for the stack. - - Violation is the distance you would have to add to the unbounded stack-direction length of the stack spec's - children in order to bring the stack within its allowed sizeRange. The diagram below shows 3 horizontal stacks with - the different types of violation. - - sizeRange - |------------| - +------+ +-------+ +-------+ +---------+ - | | | | | | | | | | - | | | | | | | | (zero violation) - | | | | | | | | | | - +------+ +-------+ +-------+ +---------+ - | | - +------+ +-------+ +-------+ - | | | | | | | | - | | | | | |<--> (positive violation) - | | | | | | | | - +------+ +-------+ +-------+ - | |<------> (negative violation) - +------+ +-------+ +-------+ +---------+ +-----------+ - | | | | | | | | | | | | - | | | | | | | | | | - | | | | | | | | | | | | - +------+ +-------+ +-------+ +---------+ +-----------+ - - @param stackDimensionSum the consumed length of the children in the stack along the stack dimension - @param style layout style to be applied to all children - @param sizeRange the range of allowable sizes for the stack layout spec - */ -CGFloat ASStackUnpositionedLayout::computeStackViolation(const CGFloat stackDimensionSum, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - const CGFloat minStackDimension = stackDimension(style.direction, sizeRange.min); - const CGFloat maxStackDimension = stackDimension(style.direction, sizeRange.max); - if (stackDimensionSum < minStackDimension) { - return minStackDimension - stackDimensionSum; - } else if (stackDimensionSum > maxStackDimension) { - return maxStackDimension - stackDimensionSum; - } - return 0; -} - -/** - If we have a single flexible (both shrinkable and growable) child, and our allowed size range is set to a specific - number then we may avoid the first "intrinsic" size calculation. - */ -ASDISPLAYNODE_INLINE BOOL useOptimizedFlexing(const std::vector &children, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - const NSUInteger flexibleChildren = std::count_if(children.begin(), children.end(), isFlexibleInBothDirections); - return ((flexibleChildren == 1) - && (stackDimension(style.direction, sizeRange.min) == - stackDimension(style.direction, sizeRange.max))); -} - -/** - Flexes children in the stack axis to resolve a min or max stack size violation. First, determines which children are - flexible (see computeStackViolation and isFlexibleInViolationDirection). Then computes how much to flex each flexible child - and performs re-layout. Note that there may still be a non-zero violation even after flexing. - - The actual CSS flexbox spec describes an iterative looping algorithm here, which may be adopted in t5837937: - http://www.w3.org/TR/css3-flexbox/#resolve-flexible-lengths - - @param lines reference to unpositioned lines and items from the original, unconstrained layout pass; modified in-place - @param style layout style to be applied to all children - @param sizeRange the range of allowable sizes for the stack layout component - @param parentSize Size of the stack layout component. May be undefined in either or both directions. - */ -static void flexLinesAlongStackDimension(std::vector &lines, - const ASStackLayoutSpecStyle &style, - const BOOL concurrent, - const ASSizeRange &sizeRange, - const CGSize parentSize, - const BOOL useOptimizedFlexing) -{ - for (auto &line : lines) { - auto &items = line.items; - const CGFloat violation = ASStackUnpositionedLayout::computeStackViolation(computeItemsStackDimensionSum(items, style), style, sizeRange); - std::function flexFactor = flexFactorInViolationDirection(violation); - // The flex factor sum is needed to determine if flexing is necessary. - // This value is also needed if the violation is positive and flexible items need to grow, so keep it around. - const CGFloat flexFactorSum = std::accumulate(items.begin(), items.end(), 0.0, [&](CGFloat x, const ASStackLayoutSpecItem &item) { - return x + flexFactor(item); - }); - - // If no items are able to flex then there is nothing left to do with this line. Bail. - if (flexFactorSum == 0) { - // If optimized flexing was used then we have to clean up the unsized items and lay them out at zero size. - if (useOptimizedFlexing) { - layoutFlexibleChildrenAtZeroSize(items, style, concurrent, sizeRange, parentSize); - } - continue; - } - - std::function flexAdjustment = flexAdjustmentInViolationDirection(items, - style, - violation, - flexFactorSum); - // Compute any remaining violation to the first flexible item. - const CGFloat remainingViolation = std::accumulate(items.begin(), items.end(), violation, [&](CGFloat x, const ASStackLayoutSpecItem &item) { - return x - flexAdjustment(item); - }); - - size_t firstFlexItem = -1; - for(size_t i = 0; i < items.size(); i++) { - // Items are consider inflexible if they do not need to make a flex adjustment. - if (flexAdjustment(items[i]) != 0) { - firstFlexItem = i; - break; - } - } - if (firstFlexItem == -1) { - continue; - } - - dispatchApplyIfNeeded(items.size(), concurrent, ^(size_t i) { - auto &item = items[i]; - const CGFloat currentFlexAdjustment = flexAdjustment(item); - // Items are consider inflexible if they do not need to make a flex adjustment. - if (currentFlexAdjustment != 0) { - const CGFloat originalStackSize = stackDimension(style.direction, item.layout.size); - // Only apply the remaining violation for the first flexible item that has a flex grow factor. - const CGFloat flexedStackSize = originalStackSize + currentFlexAdjustment + (i == firstFlexItem && item.child.style.flexGrow > 0 ? remainingViolation : 0); - item.layout = crossChildLayout(item.child, - style, - MAX(flexedStackSize, 0), - MAX(flexedStackSize, 0), - crossDimension(style.direction, sizeRange.min), - crossDimension(style.direction, sizeRange.max), - parentSize); - } - }); - } -} - -/** - https://www.w3.org/TR/css-flexbox-1/#algo-line-break - */ -static std::vector collectChildrenIntoLines(const std::vector &items, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange) -{ - //TODO if infinite max stack size, fast path - if (style.flexWrap == ASStackLayoutFlexWrapNoWrap) { - return std::vector (1, {.items = std::move(items)}); - } - - std::vector lines; - std::vector lineItems; - CGFloat lineStackDimensionSum = 0; - CGFloat interitemSpacing = 0; - - for(auto it = items.begin(); it != items.end(); ++it) { - const auto &item = *it; - const CGFloat itemStackDimension = stackDimension(style.direction, item.layout.size); - const CGFloat itemAndSpacingStackDimension = item.child.style.spacingBefore + itemStackDimension + item.child.style.spacingAfter; - const BOOL negativeViolationIfAddItem = (ASStackUnpositionedLayout::computeStackViolation(lineStackDimensionSum + interitemSpacing + itemAndSpacingStackDimension, style, sizeRange) < 0); - const BOOL breakCurrentLine = negativeViolationIfAddItem && !lineItems.empty(); - - if (breakCurrentLine) { - lines.push_back({.items = std::vector (lineItems)}); - lineItems.clear(); - lineStackDimensionSum = 0; - interitemSpacing = 0; - } - - lineItems.push_back(std::move(item)); - lineStackDimensionSum += interitemSpacing + itemAndSpacingStackDimension; - interitemSpacing = style.spacing; - } - - // Handle last line - lines.push_back({.items = std::vector (lineItems)}); - - return lines; -} - -/** - Performs the first unconstrained layout of the children, generating the unpositioned items that are then flexed and - stretched. - */ -static void layoutItemsAlongUnconstrainedStackDimension(std::vector &items, - const ASStackLayoutSpecStyle &style, - const BOOL concurrent, - const ASSizeRange &sizeRange, - const CGSize parentSize, - const BOOL useOptimizedFlexing) -{ - const CGFloat minCrossDimension = crossDimension(style.direction, sizeRange.min); - const CGFloat maxCrossDimension = crossDimension(style.direction, sizeRange.max); - - dispatchApplyIfNeeded(items.size(), concurrent, ^(size_t i) { - auto &item = items[i]; - if (useOptimizedFlexing && isFlexibleInBothDirections(item.child)) { - item.layout = [ASLayout layoutWithLayoutElement:item.child.element size:{0, 0}]; - } else { - item.layout = crossChildLayout(item.child, - style, - ASDimensionResolve(item.child.style.flexBasis, stackDimension(style.direction, parentSize), 0), - ASDimensionResolve(item.child.style.flexBasis, stackDimension(style.direction, parentSize), INFINITY), - minCrossDimension, - maxCrossDimension, - parentSize); - } - }); -} - -ASStackUnpositionedLayout ASStackUnpositionedLayout::compute(const std::vector &children, - const ASStackLayoutSpecStyle &style, - const ASSizeRange &sizeRange, - const BOOL concurrent) -{ - if (children.empty()) { - return {}; - } - - // If we have a fixed size in either dimension, pass it to children so they can resolve percentages against it. - // Otherwise, we pass ASLayoutElementParentDimensionUndefined since it will depend on the content. - const CGSize parentSize = { - (sizeRange.min.width == sizeRange.max.width) ? sizeRange.min.width : ASLayoutElementParentDimensionUndefined, - (sizeRange.min.height == sizeRange.max.height) ? sizeRange.min.height : ASLayoutElementParentDimensionUndefined, - }; - - // We may be able to avoid some redundant layout passes - const BOOL optimizedFlexing = useOptimizedFlexing(children, style, sizeRange); - - std::vector items = AS::map(children, [&](const ASStackLayoutSpecChild &child) -> ASStackLayoutSpecItem { - return {child, nil}; - }); - - // We do a first pass of all the children, generating an unpositioned layout for each with an unbounded range along - // the stack dimension. This allows us to compute the "intrinsic" size of each child and find the available violation - // which determines whether we must grow or shrink the flexible children. - layoutItemsAlongUnconstrainedStackDimension(items, - style, - concurrent, - sizeRange, - parentSize, - optimizedFlexing); - - // Collect items into lines (https://www.w3.org/TR/css-flexbox-1/#algo-line-break) - std::vector lines = collectChildrenIntoLines(items, style, sizeRange); - - // Resolve the flexible lengths (https://www.w3.org/TR/css-flexbox-1/#resolve-flexible-lengths) - flexLinesAlongStackDimension(lines, style, concurrent, sizeRange, parentSize, optimizedFlexing); - - // Calculate the cross size of each flex line (https://www.w3.org/TR/css-flexbox-1/#algo-cross-line) - computeLinesCrossSizeAndBaseline(lines, style, sizeRange); - - // Handle 'align-content: stretch' (https://www.w3.org/TR/css-flexbox-1/#algo-line-stretch) - // Determine the used cross size of each item (https://www.w3.org/TR/css-flexbox-1/#algo-stretch) - stretchLinesAlongCrossDimension(lines, style, concurrent, sizeRange, parentSize); - - // Compute stack dimension sum of each line and the whole stack - CGFloat layoutStackDimensionSum = 0; - for (auto &line : lines) { - line.stackDimensionSum = computeItemsStackDimensionSum(line.items, style); - // layoutStackDimensionSum is the max stackDimensionSum among all lines - layoutStackDimensionSum = MAX(line.stackDimensionSum, layoutStackDimensionSum); - } - // Compute cross dimension sum of the stack. - // This should be done before `lines` are moved to a new ASStackUnpositionedLayout struct (i.e `std::move(lines)`) - CGFloat layoutCrossDimensionSum = computeLinesCrossDimensionSum(lines, style); - - return {.lines = std::move(lines), .stackDimensionSum = layoutStackDimensionSum, .crossDimensionSum = layoutCrossDimensionSum}; -} diff --git a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.h b/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.h deleted file mode 100644 index 6d7c91e5..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// _ASCollectionGalleryLayoutInfo.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@interface _ASCollectionGalleryLayoutInfo : NSObject - -// Read-only properties -@property (nonatomic, readonly) CGSize itemSize; -@property (nonatomic, readonly) CGFloat minimumLineSpacing; -@property (nonatomic, readonly) CGFloat minimumInteritemSpacing; -@property (nonatomic, readonly) UIEdgeInsets sectionInset; - -- (instancetype)initWithItemSize:(CGSize)itemSize - minimumLineSpacing:(CGFloat)minimumLineSpacing - minimumInteritemSpacing:(CGFloat)minimumInteritemSpacing - sectionInset:(UIEdgeInsets)sectionInset NS_DESIGNATED_INITIALIZER; - -- (instancetype)init NS_UNAVAILABLE; - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.mm b/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.mm deleted file mode 100644 index fec0b528..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutInfo.mm +++ /dev/null @@ -1,68 +0,0 @@ -// -// _ASCollectionGalleryLayoutInfo.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation _ASCollectionGalleryLayoutInfo - -- (instancetype)initWithItemSize:(CGSize)itemSize - minimumLineSpacing:(CGFloat)minimumLineSpacing - minimumInteritemSpacing:(CGFloat)minimumInteritemSpacing - sectionInset:(UIEdgeInsets)sectionInset -{ - self = [super init]; - if (self) { - _itemSize = itemSize; - _minimumLineSpacing = minimumLineSpacing; - _minimumInteritemSpacing = minimumInteritemSpacing; - _sectionInset = sectionInset; - } - return self; -} - -- (BOOL)isEqualToInfo:(_ASCollectionGalleryLayoutInfo *)info -{ - if (info == nil) { - return NO; - } - - return CGSizeEqualToSize(_itemSize, info.itemSize) - && _minimumLineSpacing == info.minimumLineSpacing - && _minimumInteritemSpacing == info.minimumInteritemSpacing - && UIEdgeInsetsEqualToEdgeInsets(_sectionInset, info.sectionInset); -} - -- (BOOL)isEqual:(id)other -{ - if (self == other) { - return YES; - } - if (! [other isKindOfClass:[_ASCollectionGalleryLayoutInfo class]]) { - return NO; - } - return [self isEqualToInfo:other]; -} - -- (NSUInteger)hash -{ - struct { - CGSize itemSize; - CGFloat minimumLineSpacing; - CGFloat minimumInteritemSpacing; - UIEdgeInsets sectionInset; - } data = { - _itemSize, - _minimumLineSpacing, - _minimumInteritemSpacing, - _sectionInset, - }; - return ASHashBytes(&data, sizeof(data)); -} - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.h b/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.h deleted file mode 100644 index ce071bb3..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// _ASCollectionGalleryLayoutItem.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASCollectionElement; - -NS_ASSUME_NONNULL_BEGIN - -/** - * A dummy item that represents a collection element to participate in the collection layout calculation process - * without triggering measurement on the actual node of the collection element. - * - * This item always has a fixed size that is the item size passed to it. - */ -AS_SUBCLASSING_RESTRICTED -@interface _ASGalleryLayoutItem : NSObject - -@property (nonatomic, readonly) CGSize itemSize; -@property (nonatomic, weak, readonly) ASCollectionElement *collectionElement; - -- (instancetype)initWithItemSize:(CGSize)itemSize collectionElement:(ASCollectionElement *)collectionElement; -- (instancetype)init __unavailable; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.mm b/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.mm deleted file mode 100644 index 3e4320e3..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCollectionGalleryLayoutItem.mm +++ /dev/null @@ -1,82 +0,0 @@ -// -// _ASCollectionGalleryLayoutItem.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import - -@interface _ASGalleryLayoutItem () -@property ASPrimitiveTraitCollection primitiveTraitCollection; - -@end - -@implementation _ASGalleryLayoutItem - -@synthesize style; - -- (instancetype)initWithItemSize:(CGSize)itemSize collectionElement:(ASCollectionElement *)collectionElement -{ - self = [super init]; - if (self) { - ASDisplayNodeAssert(! CGSizeEqualToSize(CGSizeZero, itemSize), @"Item size should not be zero"); - ASDisplayNodeAssertNotNil(collectionElement, @"Collection element should not be nil"); - _itemSize = itemSize; - _collectionElement = collectionElement; - } - return self; -} - -ASLayoutElementStyleExtensibilityForwarding - -- (ASTraitCollection *)asyncTraitCollection -{ - ASDisplayNodeAssertNotSupported(); - return nil; -} - -- (ASLayoutElementType)layoutElementType -{ - return ASLayoutElementTypeLayoutSpec; -} - -- (NSArray> *)sublayoutElements -{ - ASDisplayNodeAssertNotSupported(); - return nil; -} - -- (BOOL)implementsLayoutMethod -{ - return YES; -} - -ASLayoutElementLayoutCalculationDefaults - -- (ASLayout *)calculateLayoutThatFits:(ASSizeRange)constrainedSize -{ - ASDisplayNodeAssert(CGSizeEqualToSize(_itemSize, ASSizeRangeClamp(constrainedSize, _itemSize)), - @"Item size %@ can't fit within the bounds of constrained size %@", NSStringFromCGSize(_itemSize), NSStringFromASSizeRange(constrainedSize)); - return [ASLayout layoutWithLayoutElement:self size:_itemSize]; -} - -#pragma mark - ASLayoutElementAsciiArtProtocol - -- (NSString *)asciiArtString -{ - return [ASLayoutSpec asciiArtStringForChildren:@[] parentName:[self asciiArtName]]; -} - -- (NSString *)asciiArtName -{ - return [NSMutableString stringWithCString:object_getClassName(self) encoding:NSASCIIStringEncoding]; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.h b/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.h deleted file mode 100644 index 182bc353..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// _ASCoreAnimationExtras.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import - -// This protocol defines the core properties that ASDisplayNode and CALayer share, for managing contents. -@protocol ASResizableContents -@required -@property id contents; -@property CGRect contentsRect; -@property CGRect contentsCenter; -@property CGFloat contentsScale; -@property CGFloat rasterizationScale; -@property NSString *contentsGravity; -@end - -@interface CALayer (ASResizableContents) -@end -@interface ASDisplayNode (ASResizableContents) -@end - -/** - This function can operate on either an ASDisplayNode (including un-loaded) or CALayer directly. More info about resizing mode: https://github.com/TextureGroup/Texture/issues/439 - - @param obj ASDisplayNode, CALayer or object that conforms to `ASResizableContents` protocol - @param image Image you would like to resize - */ -ASDK_EXTERN void ASDisplayNodeSetResizableContents(id obj, UIImage *image); - -/** - Turns a value of UIViewContentMode to a string for debugging or serialization - @param contentMode Any of the UIViewContentMode constants - @return A human-readable representation of the constant, or the integer value of the constant if not recognized. - */ -ASDK_EXTERN NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); - -/** - Turns a string representing a contentMode into a contentMode - @param string Any of the strings in UIContentModeDescriptionLUT - @return Any of the UIViewContentMode constants, or an int if the string is a number. If the string is not recognized, UIViewContentModeScaleToFill is returned. - */ -ASDK_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); - -/** - Maps a value of UIViewContentMode to a corresponding contentsGravity - It is worth noting that UIKit and CA have inverse definitions of "top" and "bottom" on iOS, so the corresponding contentsGravity for UIViewContentModeTopLeft is kCAContentsGravityBottomLeft - @param contentMode A content mode except for UIViewContentModeRedraw, which has no corresponding contentsGravity (it corresponds to needsDisplayOnBoundsChange = YES) - @return An NSString constant from the documentation, eg kCAGravityCenter... or nil if there is no corresponding contentsGravity. Will assert if contentMode is unknown. - */ -ASDK_EXTERN NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); - -/** - Maps a value of contentsGravity to a corresponding UIViewContentMode - It is worth noting that UIKit and CA have inverse definitions of "top" and "bottom" on iOS, so the corresponding contentMode for kCAContentsGravityBottomLeft is UIViewContentModeTopLeft - @param contentsGravity A contents gravity - @return A UIViewContentMode constant from UIView.h, eg UIViewContentModeCenter..., or UIViewContentModeScaleToFill if contentsGravity is not one of the CA constants. Will assert if the contentsGravity is unknown. - */ -ASDK_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); - -/** - Use this to create a stretchable appropriate to approximate a filled rectangle, but with antialiasing on the edges when not pixel-aligned. It's best to keep the layer this image is added to with contentsScale equal to the scale of the final transform to screen space so it is able to antialias appropriately even when you shrink or grow the layer. - @param color the fill color to use in the center of the image - @param innerSize Unfortunately, 4 seems to be the smallest inner size that works if you're applying this stretchable to a larger box, whereas it does not display correctly for larger boxes. Thus some adjustment is necessary for the size of box you're displaying. If you're showing a 1px horizontal line, pass 1 height and at least 4 width. 2px vertical line: 2px wide, 4px high. Passing an innerSize greater that you desire is wasteful - */ -ASDK_EXTERN UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); - -/** - Checks whether a layer has ongoing animations - @param layer A layer to check if animations are ongoing - @return YES if the layer has ongoing animations, otherwise NO - */ -ASDK_EXTERN BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); - -// This function is a less generalized version of ASDisplayNodeSetResizableContents. -ASDK_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED; diff --git a/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.mm b/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.mm deleted file mode 100644 index e73c3ade..00000000 --- a/Example/Pods/Texture/Source/Private/_ASCoreAnimationExtras.mm +++ /dev/null @@ -1,186 +0,0 @@ -// -// _ASCoreAnimationExtras.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) -{ - ASDisplayNodeSetResizableContents(layer, image); -} - -void ASDisplayNodeSetResizableContents(id obj, UIImage *image) -{ - // FIXME (https://github.com/TextureGroup/Texture/issues/1046): This method does not currently handle UIImageResizingModeTile, which is the default. - // See also https://developer.apple.com/documentation/uikit/uiimage/1624157-resizingmode?language=objc - // I'm not sure of a way to use CALayer directly to perform such tiling on the GPU, though the stretch is handled by the GPU, - // and CALayer.h documents the fact that contentsCenter is used to stretch the pixels. - - if (image) { - ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero), - @"Image insets must be all-zero or resizingMode has to be UIImageResizingModeStretch. XCode assets default value is UIImageResizingModeTile which is not supported by Texture because of GPU-accelerated CALayer features."); - - // Image may not actually be stretchable in one or both dimensions; this is handled - obj.contents = (id)[image CGImage]; - obj.contentsScale = [image scale]; - obj.rasterizationScale = [image scale]; - CGSize imageSize = [image size]; - - UIEdgeInsets insets = [image capInsets]; - - // These are lifted from what UIImageView does by experimentation. Without these exact values, the stretching is slightly off. - const CGFloat halfPixelFudge = 0.49f; - const CGFloat otherPixelFudge = 0.02f; - // Convert to unit coordinates for the contentsCenter property. - CGRect contentsCenter = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); - if (insets.left > 0 || insets.right > 0) { - contentsCenter.origin.x = ((insets.left + halfPixelFudge) / imageSize.width); - contentsCenter.size.width = (imageSize.width - (insets.left + insets.right + 1.f) + otherPixelFudge) / imageSize.width; - } - if (insets.top > 0 || insets.bottom > 0) { - contentsCenter.origin.y = ((insets.top + halfPixelFudge) / imageSize.height); - contentsCenter.size.height = (imageSize.height - (insets.top + insets.bottom + 1.f) + otherPixelFudge) / imageSize.height; - } - obj.contentsGravity = kCAGravityResize; - obj.contentsCenter = contentsCenter; - - } else { - obj.contents = nil; - } -} - - -struct _UIContentModeStringLUTEntry { - UIViewContentMode contentMode; - NSString *const string; -}; - -static const _UIContentModeStringLUTEntry *UIContentModeCAGravityLUT(size_t *count) -{ - // Initialize this in a function (instead of at file level) to avoid - // startup initialization time. - static const _UIContentModeStringLUTEntry sUIContentModeCAGravityLUT[] = { - {UIViewContentModeScaleToFill, kCAGravityResize}, - {UIViewContentModeScaleAspectFit, kCAGravityResizeAspect}, - {UIViewContentModeScaleAspectFill, kCAGravityResizeAspectFill}, - {UIViewContentModeCenter, kCAGravityCenter}, - {UIViewContentModeTop, kCAGravityBottom}, - {UIViewContentModeBottom, kCAGravityTop}, - {UIViewContentModeLeft, kCAGravityLeft}, - {UIViewContentModeRight, kCAGravityRight}, - {UIViewContentModeTopLeft, kCAGravityBottomLeft}, - {UIViewContentModeTopRight, kCAGravityBottomRight}, - {UIViewContentModeBottomLeft, kCAGravityTopLeft}, - {UIViewContentModeBottomRight, kCAGravityTopRight}, - }; - *count = AS_ARRAY_SIZE(sUIContentModeCAGravityLUT); - return sUIContentModeCAGravityLUT; -} - -static const _UIContentModeStringLUTEntry *UIContentModeDescriptionLUT(size_t *count) -{ - // Initialize this in a function (instead of at file level) to avoid - // startup initialization time. - static const _UIContentModeStringLUTEntry sUIContentModeDescriptionLUT[] = { - {UIViewContentModeScaleToFill, @"scaleToFill"}, - {UIViewContentModeScaleAspectFit, @"aspectFit"}, - {UIViewContentModeScaleAspectFill, @"aspectFill"}, - {UIViewContentModeRedraw, @"redraw"}, - {UIViewContentModeCenter, @"center"}, - {UIViewContentModeTop, @"top"}, - {UIViewContentModeBottom, @"bottom"}, - {UIViewContentModeLeft, @"left"}, - {UIViewContentModeRight, @"right"}, - {UIViewContentModeTopLeft, @"topLeft"}, - {UIViewContentModeTopRight, @"topRight"}, - {UIViewContentModeBottomLeft, @"bottomLeft"}, - {UIViewContentModeBottomRight, @"bottomRight"}, - }; - *count = AS_ARRAY_SIZE(sUIContentModeDescriptionLUT); - return sUIContentModeDescriptionLUT; -} - -NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode) -{ - size_t lutSize; - const _UIContentModeStringLUTEntry *lut = UIContentModeDescriptionLUT(&lutSize); - for (size_t i = 0; i < lutSize; ++i) { - if (lut[i].contentMode == contentMode) { - return lut[i].string; - } - } - return [NSString stringWithFormat:@"%d", (int)contentMode]; -} - -UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string) -{ - size_t lutSize; - const _UIContentModeStringLUTEntry *lut = UIContentModeDescriptionLUT(&lutSize); - for (size_t i = 0; i < lutSize; ++i) { - if (ASObjectIsEqual(lut[i].string, string)) { - return lut[i].contentMode; - } - } - return UIViewContentModeScaleToFill; -} - -NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode) -{ - size_t lutSize; - const _UIContentModeStringLUTEntry *lut = UIContentModeCAGravityLUT(&lutSize); - for (size_t i = 0; i < lutSize; ++i) { - if (lut[i].contentMode == contentMode) { - return lut[i].string; - } - } - ASDisplayNodeCAssert(contentMode == UIViewContentModeRedraw, @"Encountered an unknown contentMode %ld. Is this a new version of iOS?", (long)contentMode); - // Redraw is ok to return nil. - return nil; -} - -#define ContentModeCacheSize 10 -UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity) -{ - static int currentCacheIndex = 0; - static NSMutableArray *cachedStrings = [NSMutableArray arrayWithCapacity:ContentModeCacheSize]; - static UIViewContentMode cachedModes[ContentModeCacheSize] = {}; - - NSInteger foundCacheIndex = [cachedStrings indexOfObjectIdenticalTo:contentsGravity]; - if (foundCacheIndex != NSNotFound && foundCacheIndex < ContentModeCacheSize) { - return cachedModes[foundCacheIndex]; - } - - size_t lutSize; - const _UIContentModeStringLUTEntry *lut = UIContentModeCAGravityLUT(&lutSize); - for (size_t i = 0; i < lutSize; ++i) { - if (ASObjectIsEqual(lut[i].string, contentsGravity)) { - UIViewContentMode foundContentMode = lut[i].contentMode; - - if (currentCacheIndex < ContentModeCacheSize) { - // Cache the input value. This is almost always a different pointer than in our LUT and will frequently - // be the same value for an overwhelming majority of inputs. - [cachedStrings addObject:contentsGravity]; - cachedModes[currentCacheIndex] = foundContentMode; - currentCacheIndex++; - } - - return foundContentMode; - } - } - - ASDisplayNodeCAssert(contentsGravity, @"Encountered an unknown contentsGravity \"%@\". Is this a new version of iOS?", contentsGravity); - ASDisplayNodeCAssert(!contentsGravity, @"You passed nil to ASDisplayNodeUIContentModeFromCAContentsGravity. We're falling back to resize, but this is probably a bug."); - // If asserts disabled, fall back to this - return UIViewContentModeScaleToFill; -} - -BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer) -{ - return (layer.animationKeys.count != 0); -} diff --git a/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.h b/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.h deleted file mode 100644 index 66f5966e..00000000 --- a/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.h +++ /dev/null @@ -1,214 +0,0 @@ -// -// _ASHierarchyChangeSet.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NSUInteger ASDataControllerAnimationOptions; - -typedef NS_ENUM(NSInteger, _ASHierarchyChangeType) { - /** - * A reload change, as submitted by the user. When a change set is - * completed, these changes are decomposed into delete-insert pairs - * and combined with the original deletes and inserts of the change. - */ - _ASHierarchyChangeTypeReload, - - /** - * A change that was either an original delete, or the first - * part of a decomposed reload. - */ - _ASHierarchyChangeTypeDelete, - - /** - * A change that was submitted by the user as a delete. - */ - _ASHierarchyChangeTypeOriginalDelete, - - /** - * A change that was either an original insert, or the second - * part of a decomposed reload. - */ - _ASHierarchyChangeTypeInsert, - - /** - * A change that was submitted by the user as an insert. - */ - _ASHierarchyChangeTypeOriginalInsert -}; - -/** - * Returns YES if the given change type is either .Insert or .Delete, NO otherwise. - * Other change types – .Reload, .OriginalInsert, .OriginalDelete – are - * intermediary types used while building the change set. All changes will - * be reduced to either .Insert or .Delete when the change is marked completed. - */ -BOOL ASHierarchyChangeTypeIsFinal(_ASHierarchyChangeType changeType); - -NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType); - -@interface _ASHierarchySectionChange : NSObject - -// FIXME: Generalize this to `changeMetadata` dict? -@property (nonatomic, readonly) ASDataControllerAnimationOptions animationOptions; - -@property (nonatomic, readonly) NSIndexSet *indexSet; - -@property (nonatomic, readonly) _ASHierarchyChangeType changeType; - -/** - * If this is a .OriginalInsert or .OriginalDelete change, this returns a copied change - * with type .Insert or .Delete. Calling this on changes of other types is an error. - */ -- (_ASHierarchySectionChange *)changeByFinalizingType; - -@end - -@interface _ASHierarchyItemChange : NSObject - -@property (nonatomic, readonly) ASDataControllerAnimationOptions animationOptions; - -/// Index paths are sorted descending for changeType .Delete, ascending otherwise -@property (nonatomic, readonly) NSArray *indexPaths; - -@property (nonatomic, readonly) _ASHierarchyChangeType changeType; - -+ (NSDictionary *)sectionToIndexSetMapFromChanges:(NSArray<_ASHierarchyItemChange *> *)changes; - -/** - * If this is a .OriginalInsert or .OriginalDelete change, this returns a copied change - * with type .Insert or .Delete. Calling this on changes of other types is an error. - */ -- (_ASHierarchyItemChange *)changeByFinalizingType; - -@end - -@interface _ASHierarchyChangeSet : NSObject - -/// @precondition The change set must be completed. -@property (nonatomic, readonly) NSIndexSet *deletedSections; - -/// @precondition The change set must be completed. -@property (nonatomic, readonly) NSIndexSet *insertedSections; - -@property (nonatomic, readonly) BOOL completed; - -/// Whether or not changes should be animated. -// TODO: if any update in this chagne set is non-animated, the whole update should be non-animated. -@property (nonatomic) BOOL animated; - -@property (nonatomic, readonly) BOOL includesReloadData; - -/// Indicates whether the change set is empty, that is it includes neither reload data nor per item or section changes. -@property (nonatomic, readonly) BOOL isEmpty; - -/// The count of new ASCellNodes that can undergo async layout calculation. May be zero if all UIKit passthrough cells. -@property (nonatomic, assign) NSUInteger countForAsyncLayout; - -/// The top-level activity for this update. -@property (nonatomic, OS_ACTIVITY_NULLABLE) os_activity_t rootActivity; - -/// The activity for submitting this update i.e. between -beginUpdates and -endUpdates. -@property (nonatomic, OS_ACTIVITY_NULLABLE) os_activity_t submitActivity; - -- (instancetype)initWithOldData:(std::vector)oldItemCounts NS_DESIGNATED_INITIALIZER; - -/** - * Append the given completion handler to the combined @c completionHandler. - * - * @discussion Since batch updates can be nested, we have to support multiple - * completion handlers per update. - * - * @precondition The change set must not be completed. - */ -- (void)addCompletionHandler:(nullable void(^)(BOOL finished))completion; - -/** - * Execute the combined completion handler. - * - * @warning The completion block is discarded after reading because it may have captured - * significant resources that we would like to reclaim as soon as possible. - */ -- (void)executeCompletionHandlerWithFinished:(BOOL)finished; - -/** - * Get the section index after the update for the given section before the update. - * - * @precondition The change set must be completed. - * @return The new section index, or NSNotFound if the given section was deleted. - */ -- (NSUInteger)newSectionForOldSection:(NSUInteger)oldSection; - -/** - * A table that maps old section indexes to new section indexes. - */ -@property (nonatomic, readonly) ASIntegerMap *sectionMapping; - -/** - * A table that maps new section indexes to old section indexes. - */ -@property (nonatomic, readonly) ASIntegerMap *reverseSectionMapping; - -/** - * A table that provides the item mapping for the old section. If the section was deleted - * or is out of bounds, returns the empty table. - */ -- (ASIntegerMap *)itemMappingInSection:(NSInteger)oldSection; - -/** - * A table that provides the reverse item mapping for the new section. If the section was inserted - * or is out of bounds, returns the empty table. - */ -- (ASIntegerMap *)reverseItemMappingInSection:(NSInteger)newSection; - -/** - * Get the old item index path for the given new index path. - * - * @precondition The change set must be completed. - * @return The old index path, or nil if the given item was inserted. - */ -- (nullable NSIndexPath *)oldIndexPathForNewIndexPath:(NSIndexPath *)indexPath; - -/** - * Get the new item index path for the given old index path. - * - * @precondition The change set must be completed. - * @return The new index path, or nil if the given item was deleted. - */ -- (nullable NSIndexPath *)newIndexPathForOldIndexPath:(NSIndexPath *)indexPath; - -/// Call this once the change set has been constructed to prevent future modifications to the changeset. Calling this more than once is a programmer error. -/// NOTE: Calling this method will cause the changeset to convert all reloads into delete/insert pairs. -- (void)markCompletedWithNewItemCounts:(std::vector)newItemCounts; - -- (nullable NSArray <_ASHierarchySectionChange *> *)sectionChangesOfType:(_ASHierarchyChangeType)changeType; - -- (nullable NSArray <_ASHierarchyItemChange *> *)itemChangesOfType:(_ASHierarchyChangeType)changeType; - -/// Returns all item indexes affected by changes of the given type in the given section. -- (NSIndexSet *)indexesForItemChangesOfType:(_ASHierarchyChangeType)changeType inSection:(NSUInteger)section; - -- (void)reloadData; -- (void)deleteSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options; -- (void)insertSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options; -- (void)reloadSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options; -- (void)insertItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options; -- (void)deleteItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options; -- (void)reloadItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options; -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection animationOptions:(ASDataControllerAnimationOptions)options; -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath animationOptions:(ASDataControllerAnimationOptions)options; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.mm b/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.mm deleted file mode 100644 index 825c6b8c..00000000 --- a/Example/Pods/Texture/Source/Private/_ASHierarchyChangeSet.mm +++ /dev/null @@ -1,1009 +0,0 @@ -// -// _ASHierarchyChangeSet.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import -#import -#import - -// If assertions are enabled and they haven't forced us to suppress the exception, -// then throw, otherwise log. -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - #define ASFailUpdateValidation(...)\ - _Pragma("clang diagnostic push")\ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")\ - if ([ASDisplayNode suppressesInvalidCollectionUpdateExceptions]) {\ - NSLog(__VA_ARGS__);\ - } else {\ - NSLog(__VA_ARGS__);\ - [NSException raise:ASCollectionInvalidUpdateException format:__VA_ARGS__];\ - }\ - _Pragma("clang diagnostic pop") -#else - #define ASFailUpdateValidation(...) NSLog(__VA_ARGS__); -#endif - -BOOL ASHierarchyChangeTypeIsFinal(_ASHierarchyChangeType changeType) { - switch (changeType) { - case _ASHierarchyChangeTypeInsert: - case _ASHierarchyChangeTypeDelete: - return YES; - default: - return NO; - } -} - -NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType) -{ - switch (changeType) { - case _ASHierarchyChangeTypeInsert: - return @"Insert"; - case _ASHierarchyChangeTypeOriginalInsert: - return @"OriginalInsert"; - case _ASHierarchyChangeTypeDelete: - return @"Delete"; - case _ASHierarchyChangeTypeOriginalDelete: - return @"OriginalDelete"; - case _ASHierarchyChangeTypeReload: - return @"Reload"; - default: - return @"(invalid)"; - } -} - -@interface _ASHierarchySectionChange () -- (instancetype)initWithChangeType:(_ASHierarchyChangeType)changeType indexSet:(NSIndexSet *)indexSet animationOptions:(ASDataControllerAnimationOptions)animationOptions; - -/** - On return `changes` is sorted according to the change type with changes coalesced by animationOptions - Assumes: `changes` all have the same changeType - */ -+ (void)sortAndCoalesceSectionChanges:(NSMutableArray<_ASHierarchySectionChange *> *)changes; - -/// Returns all the indexes from all the `indexSet`s of the given `_ASHierarchySectionChange` objects. -+ (NSMutableIndexSet *)allIndexesInSectionChanges:(NSArray *)changes; - -+ (NSString *)smallDescriptionForSectionChanges:(NSArray<_ASHierarchySectionChange *> *)changes; -@end - -@interface _ASHierarchyItemChange () -- (instancetype)initWithChangeType:(_ASHierarchyChangeType)changeType indexPaths:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)animationOptions presorted:(BOOL)presorted; - -/** - On return `changes` is sorted according to the change type with changes coalesced by animationOptions - Assumes: `changes` all have the same changeType - */ -+ (void)sortAndCoalesceItemChanges:(NSMutableArray<_ASHierarchyItemChange *> *)changes ignoringChangesInSections:(NSIndexSet *)sections; - -+ (NSString *)smallDescriptionForItemChanges:(NSArray<_ASHierarchyItemChange *> *)changes; - -+ (void)ensureItemChanges:(NSArray<_ASHierarchyItemChange *> *)changes ofSameType:(_ASHierarchyChangeType)changeType; -@end - -@interface _ASHierarchyChangeSet () - -// array index is old section index, map goes oldItem -> newItem -@property (nonatomic, readonly) NSMutableArray *itemMappings; - -// array index is new section index, map goes newItem -> oldItem -@property (nonatomic, readonly) NSMutableArray *reverseItemMappings; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchyItemChange *> *insertItemChanges; -@property (nonatomic, readonly) NSMutableArray<_ASHierarchyItemChange *> *originalInsertItemChanges; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchyItemChange *> *deleteItemChanges; -@property (nonatomic, readonly) NSMutableArray<_ASHierarchyItemChange *> *originalDeleteItemChanges; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchyItemChange *> *reloadItemChanges; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchySectionChange *> *insertSectionChanges; -@property (nonatomic, readonly) NSMutableArray<_ASHierarchySectionChange *> *originalInsertSectionChanges; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchySectionChange *> *deleteSectionChanges; -@property (nonatomic, readonly) NSMutableArray<_ASHierarchySectionChange *> *originalDeleteSectionChanges; - -@property (nonatomic, readonly) NSMutableArray<_ASHierarchySectionChange *> *reloadSectionChanges; - -@end - -@implementation _ASHierarchyChangeSet { - NSUInteger _countForAsyncLayout; - std::vector _oldItemCounts; - std::vector _newItemCounts; - void (^_completionHandler)(BOOL finished); -} -@synthesize sectionMapping = _sectionMapping; -@synthesize reverseSectionMapping = _reverseSectionMapping; -@synthesize itemMappings = _itemMappings; -@synthesize reverseItemMappings = _reverseItemMappings; -@synthesize countForAsyncLayout = _countForAsyncLayout; - -- (instancetype)init -{ - ASFailUpdateValidation(@"_ASHierarchyChangeSet: -init is not supported. Call -initWithOldData:"); - return [self initWithOldData:std::vector()]; -} - -- (instancetype)initWithOldData:(std::vector)oldItemCounts -{ - self = [super init]; - if (self) { - _oldItemCounts = oldItemCounts; - - _originalInsertItemChanges = [[NSMutableArray alloc] init]; - _insertItemChanges = [[NSMutableArray alloc] init]; - _originalDeleteItemChanges = [[NSMutableArray alloc] init]; - _deleteItemChanges = [[NSMutableArray alloc] init]; - _reloadItemChanges = [[NSMutableArray alloc] init]; - - _originalInsertSectionChanges = [[NSMutableArray alloc] init]; - _insertSectionChanges = [[NSMutableArray alloc] init]; - _originalDeleteSectionChanges = [[NSMutableArray alloc] init]; - _deleteSectionChanges = [[NSMutableArray alloc] init]; - _reloadSectionChanges = [[NSMutableArray alloc] init]; - } - return self; -} - -#pragma mark External API - -- (BOOL)isEmpty -{ - return (! _includesReloadData) && (! [self _includesPerItemOrSectionChanges]); -} - -- (void)addCompletionHandler:(void (^)(BOOL))completion -{ - [self _ensureNotCompleted]; - if (completion == nil) { - return; - } - - void (^oldCompletionHandler)(BOOL finished) = _completionHandler; - _completionHandler = ^(BOOL finished) { - if (oldCompletionHandler != nil) { - oldCompletionHandler(finished); - } - completion(finished); - }; -} - -- (void)executeCompletionHandlerWithFinished:(BOOL)finished -{ - if (_completionHandler != nil) { - _completionHandler(finished); - _completionHandler = nil; - } -} - -- (void)markCompletedWithNewItemCounts:(std::vector)newItemCounts -{ - NSAssert(!_completed, @"Attempt to mark already-completed changeset as completed."); - _completed = YES; - _newItemCounts = newItemCounts; - [self _sortAndCoalesceChangeArrays]; - [self _validateUpdate]; -} - -- (NSArray *)sectionChangesOfType:(_ASHierarchyChangeType)changeType -{ - [self _ensureCompleted]; - switch (changeType) { - case _ASHierarchyChangeTypeInsert: - return _insertSectionChanges; - case _ASHierarchyChangeTypeReload: - return _reloadSectionChanges; - case _ASHierarchyChangeTypeDelete: - return _deleteSectionChanges; - case _ASHierarchyChangeTypeOriginalDelete: - return _originalDeleteSectionChanges; - case _ASHierarchyChangeTypeOriginalInsert: - return _originalInsertSectionChanges; - default: - NSAssert(NO, @"Request for section changes with invalid type: %lu", (long)changeType); - return nil; - } -} - -- (NSArray *)itemChangesOfType:(_ASHierarchyChangeType)changeType -{ - [self _ensureCompleted]; - switch (changeType) { - case _ASHierarchyChangeTypeInsert: - return _insertItemChanges; - case _ASHierarchyChangeTypeReload: - return _reloadItemChanges; - case _ASHierarchyChangeTypeDelete: - return _deleteItemChanges; - case _ASHierarchyChangeTypeOriginalInsert: - return _originalInsertItemChanges; - case _ASHierarchyChangeTypeOriginalDelete: - return _originalDeleteItemChanges; - default: - NSAssert(NO, @"Request for item changes with invalid type: %lu", (long)changeType); - return nil; - } -} - -- (NSIndexSet *)indexesForItemChangesOfType:(_ASHierarchyChangeType)changeType inSection:(NSUInteger)section -{ - [self _ensureCompleted]; - const auto result = [[NSMutableIndexSet alloc] init]; - for (_ASHierarchyItemChange *change in [self itemChangesOfType:changeType]) { - [result addIndexes:[NSIndexSet as_indexSetFromIndexPaths:change.indexPaths inSection:section]]; - } - return result; -} - -- (NSUInteger)newSectionForOldSection:(NSUInteger)oldSection -{ - return [self.sectionMapping integerForKey:oldSection]; -} - -- (NSUInteger)oldSectionForNewSection:(NSUInteger)newSection -{ - return [self.reverseSectionMapping integerForKey:newSection]; -} - -- (ASIntegerMap *)sectionMapping -{ - ASDisplayNodeAssertNotNil(_deletedSections, @"Cannot call %s before `markCompleted` returns.", sel_getName(_cmd)); - ASDisplayNodeAssertNotNil(_insertedSections, @"Cannot call %s before `markCompleted` returns.", sel_getName(_cmd)); - [self _ensureCompleted]; - if (_sectionMapping == nil) { - _sectionMapping = [ASIntegerMap mapForUpdateWithOldCount:_oldItemCounts.size() deleted:_deletedSections inserted:_insertedSections]; - } - return _sectionMapping; -} - -- (ASIntegerMap *)reverseSectionMapping -{ - if (_reverseSectionMapping == nil) { - _reverseSectionMapping = [self.sectionMapping inverseMap]; - } - return _reverseSectionMapping; -} - -- (NSMutableArray *)itemMappings -{ - [self _ensureCompleted]; - - if (_itemMappings == nil) { - _itemMappings = [[NSMutableArray alloc] init]; - const auto insertMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalInsertItemChanges]; - const auto deleteMap = [_ASHierarchyItemChange sectionToIndexSetMapFromChanges:_originalDeleteItemChanges]; - NSInteger oldSection = 0; - for (NSInteger oldCount : _oldItemCounts) { - NSInteger newSection = [self newSectionForOldSection:oldSection]; - ASIntegerMap *table; - if (newSection == NSNotFound) { - table = ASIntegerMap.emptyMap; - } else { - table = [ASIntegerMap mapForUpdateWithOldCount:oldCount deleted:deleteMap[@(oldSection)] inserted:insertMap[@(newSection)]]; - } - _itemMappings[oldSection] = table; - oldSection++; - } - } - return _itemMappings; -} - -- (NSMutableArray *)reverseItemMappings -{ - [self _ensureCompleted]; - - if (_reverseItemMappings == nil) { - _reverseItemMappings = [[NSMutableArray alloc] init]; - for (NSInteger newSection = 0; newSection < _newItemCounts.size(); newSection++) { - NSInteger oldSection = [self oldSectionForNewSection:newSection]; - ASIntegerMap *table; - if (oldSection == NSNotFound) { - table = ASIntegerMap.emptyMap; - } else { - table = [[self itemMappingInSection:oldSection] inverseMap]; - } - _reverseItemMappings[newSection] = table; - } - } - return _reverseItemMappings; -} - -- (ASIntegerMap *)itemMappingInSection:(NSInteger)oldSection -{ - if (self.includesReloadData || oldSection >= _oldItemCounts.size()) { - return ASIntegerMap.emptyMap; - } - return self.itemMappings[oldSection]; -} - -- (ASIntegerMap *)reverseItemMappingInSection:(NSInteger)newSection -{ - if (self.includesReloadData || newSection >= _newItemCounts.size()) { - return ASIntegerMap.emptyMap; - } - return self.reverseItemMappings[newSection]; -} - -- (NSIndexPath *)oldIndexPathForNewIndexPath:(NSIndexPath *)indexPath -{ - [self _ensureCompleted]; - NSInteger newSection = indexPath.section; - NSInteger oldSection = [self oldSectionForNewSection:newSection]; - if (oldSection == NSNotFound) { - return nil; - } - NSInteger oldItem = [[self reverseItemMappingInSection:newSection] integerForKey:indexPath.item]; - if (oldItem == NSNotFound) { - return nil; - } - return [NSIndexPath indexPathForItem:oldItem inSection:oldSection]; -} - -- (NSIndexPath *)newIndexPathForOldIndexPath:(NSIndexPath *)indexPath -{ - [self _ensureCompleted]; - NSInteger oldSection = indexPath.section; - NSInteger newSection = [self newSectionForOldSection:oldSection]; - if (newSection == NSNotFound) { - return nil; - } - NSInteger newItem = [[self itemMappingInSection:oldSection] integerForKey:indexPath.item]; - if (newItem == NSNotFound) { - return nil; - } - return [NSIndexPath indexPathForItem:newItem inSection:newSection]; -} - -- (void)reloadData -{ - [self _ensureNotCompleted]; - NSAssert(_includesReloadData == NO, @"Attempt to reload data multiple times %@", self); - _includesReloadData = YES; -} - -- (void)deleteItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchyItemChange *change = [[_ASHierarchyItemChange alloc] initWithChangeType:_ASHierarchyChangeTypeOriginalDelete indexPaths:indexPaths animationOptions:options presorted:NO]; - [_originalDeleteItemChanges addObject:change]; -} - -- (void)deleteSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchySectionChange *change = [[_ASHierarchySectionChange alloc] initWithChangeType:_ASHierarchyChangeTypeOriginalDelete indexSet:sections animationOptions:options]; - [_originalDeleteSectionChanges addObject:change]; -} - -- (void)insertItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchyItemChange *change = [[_ASHierarchyItemChange alloc] initWithChangeType:_ASHierarchyChangeTypeOriginalInsert indexPaths:indexPaths animationOptions:options presorted:NO]; - [_originalInsertItemChanges addObject:change]; -} - -- (void)insertSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchySectionChange *change = [[_ASHierarchySectionChange alloc] initWithChangeType:_ASHierarchyChangeTypeOriginalInsert indexSet:sections animationOptions:options]; - [_originalInsertSectionChanges addObject:change]; -} - -- (void)reloadItems:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchyItemChange *change = [[_ASHierarchyItemChange alloc] initWithChangeType:_ASHierarchyChangeTypeReload indexPaths:indexPaths animationOptions:options presorted:NO]; - [_reloadItemChanges addObject:change]; -} - -- (void)reloadSections:(NSIndexSet *)sections animationOptions:(ASDataControllerAnimationOptions)options -{ - [self _ensureNotCompleted]; - _ASHierarchySectionChange *change = [[_ASHierarchySectionChange alloc] initWithChangeType:_ASHierarchyChangeTypeReload indexSet:sections animationOptions:options]; - [_reloadSectionChanges addObject:change]; -} - -- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath animationOptions:(ASDataControllerAnimationOptions)options -{ - /** - * TODO: Proper move implementation. - */ - [self deleteItems:@[ indexPath ] animationOptions:options]; - [self insertItems:@[ newIndexPath ] animationOptions:options]; -} - -- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection animationOptions:(ASDataControllerAnimationOptions)options -{ - /** - * TODO: Proper move implementation. - */ - [self deleteSections:[NSIndexSet indexSetWithIndex:section] animationOptions:options]; - [self insertSections:[NSIndexSet indexSetWithIndex:newSection] animationOptions:options]; -} - -#pragma mark Private - -- (BOOL)_ensureNotCompleted -{ - NSAssert(!_completed, @"Attempt to modify completed changeset %@", self); - return !_completed; -} - -- (BOOL)_ensureCompleted -{ - NSAssert(_completed, @"Attempt to process incomplete changeset %@", self); - return _completed; -} - -- (void)_sortAndCoalesceChangeArrays -{ - if (_includesReloadData) { - return; - } - - @autoreleasepool { - - // Split reloaded sections into [delete(oldIndex), insert(newIndex)] - - // Give these their "pre-reloads" values. Once we add in the reloads we'll re-process them. - _deletedSections = [_ASHierarchySectionChange allIndexesInSectionChanges:_originalDeleteSectionChanges]; - _insertedSections = [_ASHierarchySectionChange allIndexesInSectionChanges:_originalInsertSectionChanges]; - for (_ASHierarchySectionChange *originalDeleteSectionChange in _originalDeleteSectionChanges) { - [_deleteSectionChanges addObject:[originalDeleteSectionChange changeByFinalizingType]]; - } - for (_ASHierarchySectionChange *originalInsertSectionChange in _originalInsertSectionChanges) { - [_insertSectionChanges addObject:[originalInsertSectionChange changeByFinalizingType]]; - } - - for (_ASHierarchySectionChange *change in _reloadSectionChanges) { - NSIndexSet *newSections = [change.indexSet as_indexesByMapping:^(NSUInteger idx) { - NSUInteger newSec = [self newSectionForOldSection:idx]; - ASDisplayNodeAssert(newSec != NSNotFound, @"Request to reload and delete same section %tu", idx); - return newSec; - }]; - - _ASHierarchySectionChange *deleteChange = [[_ASHierarchySectionChange alloc] initWithChangeType:_ASHierarchyChangeTypeDelete indexSet:change.indexSet animationOptions:change.animationOptions]; - [_deleteSectionChanges addObject:deleteChange]; - - _ASHierarchySectionChange *insertChange = [[_ASHierarchySectionChange alloc] initWithChangeType:_ASHierarchyChangeTypeInsert indexSet:newSections animationOptions:change.animationOptions]; - [_insertSectionChanges addObject:insertChange]; - } - - [_ASHierarchySectionChange sortAndCoalesceSectionChanges:_deleteSectionChanges]; - [_ASHierarchySectionChange sortAndCoalesceSectionChanges:_insertSectionChanges]; - _deletedSections = [_ASHierarchySectionChange allIndexesInSectionChanges:_deleteSectionChanges]; - _insertedSections = [_ASHierarchySectionChange allIndexesInSectionChanges:_insertSectionChanges]; - - // Split reloaded items into [delete(oldIndexPath), insert(newIndexPath)] - for (_ASHierarchyItemChange *originalDeleteItemChange in _originalDeleteItemChanges) { - [_deleteItemChanges addObject:[originalDeleteItemChange changeByFinalizingType]]; - } - for (_ASHierarchyItemChange *originalInsertItemChange in _originalInsertItemChanges) { - [_insertItemChanges addObject:[originalInsertItemChange changeByFinalizingType]]; - } - - [_ASHierarchyItemChange ensureItemChanges:_insertItemChanges ofSameType:_ASHierarchyChangeTypeInsert]; - [_ASHierarchyItemChange ensureItemChanges:_deleteItemChanges ofSameType:_ASHierarchyChangeTypeDelete]; - - for (_ASHierarchyItemChange *change in _reloadItemChanges) { - NSAssert(change.changeType == _ASHierarchyChangeTypeReload, @"It must be a reload change to be in here"); - - const auto newIndexPaths = ASArrayByFlatMapping(change.indexPaths, NSIndexPath *indexPath, [self newIndexPathForOldIndexPath:indexPath]); - - // All reload changes are translated into deletes and inserts - // We delete the items that needs reload together with other deleted items, at their original index - _ASHierarchyItemChange *deleteItemChangeFromReloadChange = [[_ASHierarchyItemChange alloc] initWithChangeType:_ASHierarchyChangeTypeDelete indexPaths:change.indexPaths animationOptions:change.animationOptions presorted:NO]; - [_deleteItemChanges addObject:deleteItemChangeFromReloadChange]; - // We insert the items that needs reload together with other inserted items, at their future index - _ASHierarchyItemChange *insertItemChangeFromReloadChange = [[_ASHierarchyItemChange alloc] initWithChangeType:_ASHierarchyChangeTypeInsert indexPaths:newIndexPaths animationOptions:change.animationOptions presorted:NO]; - [_insertItemChanges addObject:insertItemChangeFromReloadChange]; - } - - // Ignore item deletes in reloaded/deleted sections. - [_ASHierarchyItemChange sortAndCoalesceItemChanges:_deleteItemChanges ignoringChangesInSections:_deletedSections]; - - // Ignore item inserts in reloaded(new)/inserted sections. - [_ASHierarchyItemChange sortAndCoalesceItemChanges:_insertItemChanges ignoringChangesInSections:_insertedSections]; - } -} - -- (void)_validateUpdate -{ - // If reloadData exists, ignore other changes - if (_includesReloadData) { - if ([self _includesPerItemOrSectionChanges]) { - NSLog(@"Warning: A reload data shouldn't be used in conjuntion with other updates."); - } - return; - } - - NSIndexSet *allReloadedSections = [_ASHierarchySectionChange allIndexesInSectionChanges:_reloadSectionChanges]; - - NSInteger newSectionCount = _newItemCounts.size(); - NSInteger oldSectionCount = _oldItemCounts.size(); - - NSInteger insertedSectionCount = _insertedSections.count; - NSInteger deletedSectionCount = _deletedSections.count; - // Assert that the new section count is correct. - if (newSectionCount != oldSectionCount + insertedSectionCount - deletedSectionCount) { - ASFailUpdateValidation(@"Invalid number of sections. The number of sections after the update (%ld) must be equal to the number of sections before the update (%ld) plus or minus the number of sections inserted or deleted (%ld inserted, %ld deleted)", (long)newSectionCount, (long)oldSectionCount, (long)insertedSectionCount, (long)deletedSectionCount); - return; - } - - // Assert that no invalid deletes/reloads happened. - NSInteger invalidSectionDelete = NSNotFound; - if (oldSectionCount == 0) { - invalidSectionDelete = _deletedSections.firstIndex; - } else { - invalidSectionDelete = [_deletedSections indexGreaterThanIndex:oldSectionCount - 1]; - } - if (invalidSectionDelete != NSNotFound) { - ASFailUpdateValidation(@"Attempt to delete section %ld but there are only %ld sections before the update.", (long)invalidSectionDelete, (long)oldSectionCount); - return; - } - - for (_ASHierarchyItemChange *change in _deleteItemChanges) { - for (NSIndexPath *indexPath in change.indexPaths) { - // Assert that item delete happened in a valid section. - NSInteger section = indexPath.section; - NSInteger item = indexPath.item; - if (section >= oldSectionCount) { - ASFailUpdateValidation(@"Attempt to delete item %ld from section %ld, but there are only %ld sections before the update.", (long)item, (long)section, (long)oldSectionCount); - return; - } - - // Assert that item delete happened to a valid item. - NSInteger oldItemCount = _oldItemCounts[section]; - if (item >= oldItemCount) { - ASFailUpdateValidation(@"Attempt to delete item %ld from section %ld, which only contains %ld items before the update.", (long)item, (long)section, (long)oldItemCount); - return; - } - } - } - - for (_ASHierarchyItemChange *change in _insertItemChanges) { - for (NSIndexPath *indexPath in change.indexPaths) { - NSInteger section = indexPath.section; - NSInteger item = indexPath.item; - // Assert that item insert happened in a valid section. - if (section >= newSectionCount) { - ASFailUpdateValidation(@"Attempt to insert item %ld into section %ld, but there are only %ld sections after the update.", (long)item, (long)section, (long)newSectionCount); - return; - } - - // Assert that item delete happened to a valid item. - NSInteger newItemCount = _newItemCounts[section]; - if (item >= newItemCount) { - ASFailUpdateValidation(@"Attempt to insert item %ld into section %ld, which only contains %ld items after the update.", (long)item, (long)section, (long)newItemCount); - return; - } - } - } - - // Assert that no sections were inserted out of bounds. - NSInteger invalidSectionInsert = NSNotFound; - if (newSectionCount == 0) { - invalidSectionInsert = _insertedSections.firstIndex; - } else { - invalidSectionInsert = [_insertedSections indexGreaterThanIndex:newSectionCount - 1]; - } - if (invalidSectionInsert != NSNotFound) { - ASFailUpdateValidation(@"Attempt to insert section %ld but there are only %ld sections after the update.", (long)invalidSectionInsert, (long)newSectionCount); - return; - } - - for (NSUInteger oldSection = 0; oldSection < oldSectionCount; oldSection++) { - NSInteger oldItemCount = _oldItemCounts[oldSection]; - // If section was reloaded, ignore. - if ([allReloadedSections containsIndex:oldSection]) { - continue; - } - - // If section was deleted, ignore. - NSUInteger newSection = [self newSectionForOldSection:oldSection]; - if (newSection == NSNotFound) { - continue; - } - - NSIndexSet *originalInsertedItems = [self indexesForItemChangesOfType:_ASHierarchyChangeTypeOriginalInsert inSection:newSection]; - NSIndexSet *originalDeletedItems = [self indexesForItemChangesOfType:_ASHierarchyChangeTypeOriginalDelete inSection:oldSection]; - NSIndexSet *reloadedItems = [self indexesForItemChangesOfType:_ASHierarchyChangeTypeReload inSection:oldSection]; - - // Assert that no reloaded items were deleted. - NSInteger deletedReloadedItem = [originalDeletedItems as_intersectionWithIndexes:reloadedItems].firstIndex; - if (deletedReloadedItem != NSNotFound) { - ASFailUpdateValidation(@"Attempt to delete and reload the same item at index path %@", [NSIndexPath indexPathForItem:deletedReloadedItem inSection:oldSection]); - return; - } - - // Assert that the new item count is correct. - NSInteger newItemCount = _newItemCounts[newSection]; - NSInteger insertedItemCount = originalInsertedItems.count; - NSInteger deletedItemCount = originalDeletedItems.count; - if (newItemCount != oldItemCount + insertedItemCount - deletedItemCount) { - ASFailUpdateValidation(@"Invalid number of items in section %ld. The number of items after the update (%ld) must be equal to the number of items before the update (%ld) plus or minus the number of items inserted or deleted (%ld inserted, %ld deleted).", (long)oldSection, (long)newItemCount, (long)oldItemCount, (long)insertedItemCount, (long)deletedItemCount); - return; - } - } -} - -- (BOOL)_includesPerItemOrSectionChanges -{ - return 0 < (_originalDeleteSectionChanges.count + _originalDeleteItemChanges.count - +_originalInsertSectionChanges.count + _originalInsertItemChanges.count - + _reloadSectionChanges.count + _reloadItemChanges.count); -} - -#pragma mark - Debugging (Private) - -- (NSString *)description -{ - return ASObjectDescriptionMakeWithoutObject([self propertiesForDescription]); -} - -- (NSString *)debugDescription -{ - return ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - if (_includesReloadData) { - [result addObject:@{ @"reloadData" : @"YES" }]; - } - if (_reloadSectionChanges.count > 0) { - [result addObject:@{ @"reloadSections" : [_ASHierarchySectionChange smallDescriptionForSectionChanges:_reloadSectionChanges] }]; - } - if (_reloadItemChanges.count > 0) { - [result addObject:@{ @"reloadItems" : [_ASHierarchyItemChange smallDescriptionForItemChanges:_reloadItemChanges] }]; - } - if (_originalDeleteSectionChanges.count > 0) { - [result addObject:@{ @"deleteSections" : [_ASHierarchySectionChange smallDescriptionForSectionChanges:_originalDeleteSectionChanges] }]; - } - if (_originalDeleteItemChanges.count > 0) { - [result addObject:@{ @"deleteItems" : [_ASHierarchyItemChange smallDescriptionForItemChanges:_originalDeleteItemChanges] }]; - } - if (_originalInsertSectionChanges.count > 0) { - [result addObject:@{ @"insertSections" : [_ASHierarchySectionChange smallDescriptionForSectionChanges:_originalInsertSectionChanges] }]; - } - if (_originalInsertItemChanges.count > 0) { - [result addObject:@{ @"insertItems" : [_ASHierarchyItemChange smallDescriptionForItemChanges:_originalInsertItemChanges] }]; - } - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - return [self propertiesForDescription]; -} - -@end - -@implementation _ASHierarchySectionChange - -- (instancetype)initWithChangeType:(_ASHierarchyChangeType)changeType indexSet:(NSIndexSet *)indexSet animationOptions:(ASDataControllerAnimationOptions)animationOptions -{ - self = [super init]; - if (self) { - ASDisplayNodeAssert(indexSet.count > 0, @"Request to create _ASHierarchySectionChange with no sections!"); - _changeType = changeType; - _indexSet = indexSet; - _animationOptions = animationOptions; - } - return self; -} - -- (_ASHierarchySectionChange *)changeByFinalizingType -{ - _ASHierarchyChangeType newType; - switch (_changeType) { - case _ASHierarchyChangeTypeOriginalInsert: - newType = _ASHierarchyChangeTypeInsert; - break; - case _ASHierarchyChangeTypeOriginalDelete: - newType = _ASHierarchyChangeTypeDelete; - break; - default: - ASFailUpdateValidation(@"Attempt to finalize section change of invalid type %@.", NSStringFromASHierarchyChangeType(_changeType)); - return self; - } - return [[_ASHierarchySectionChange alloc] initWithChangeType:newType indexSet:_indexSet animationOptions:_animationOptions]; -} - -+ (void)sortAndCoalesceSectionChanges:(NSMutableArray<_ASHierarchySectionChange *> *)changes -{ - _ASHierarchySectionChange *firstChange = changes.firstObject; - if (firstChange == nil) { - return; - } - _ASHierarchyChangeType type = [firstChange changeType]; - - ASDisplayNodeAssert(ASHierarchyChangeTypeIsFinal(type), @"Attempt to sort and coalesce section changes of intermediary type %@. Why?", NSStringFromASHierarchyChangeType(type)); - - // Lookup table [Int: AnimationOptions] - __block std::unordered_map animationOptions; - - // All changed indexes - NSMutableIndexSet *allIndexes = [NSMutableIndexSet new]; - - for (_ASHierarchySectionChange *change in changes) { - ASDataControllerAnimationOptions options = change.animationOptions; - NSIndexSet *indexes = change.indexSet; - [indexes enumerateRangesUsingBlock:^(NSRange range, BOOL * _Nonnull stop) { - for (NSUInteger i = range.location; i < NSMaxRange(range); i++) { - animationOptions[i] = options; - } - }]; - [allIndexes addIndexes:indexes]; - } - - // Create new changes by grouping sorted changes by animation option - NSMutableArray *result = [[NSMutableArray alloc] init]; - - __block ASDataControllerAnimationOptions currentOptions = 0; - const auto currentIndexes = [[NSMutableIndexSet alloc] init]; - - BOOL reverse = type == _ASHierarchyChangeTypeDelete || type == _ASHierarchyChangeTypeOriginalDelete; - NSEnumerationOptions options = reverse ? NSEnumerationReverse : kNilOptions; - - [allIndexes enumerateRangesWithOptions:options usingBlock:^(NSRange range, BOOL * _Nonnull stop) { - NSInteger increment = reverse ? -1 : 1; - NSUInteger start = reverse ? NSMaxRange(range) - 1 : range.location; - NSInteger limit = reverse ? range.location - 1 : NSMaxRange(range); - for (NSInteger i = start; i != limit; i += increment) { - ASDataControllerAnimationOptions options = animationOptions[i]; - - // End the previous group if needed. - if (options != currentOptions && currentIndexes.count > 0) { - _ASHierarchySectionChange *change = [[_ASHierarchySectionChange alloc] initWithChangeType:type indexSet:[currentIndexes copy] animationOptions:currentOptions]; - [result addObject:change]; - [currentIndexes removeAllIndexes]; - } - - // Start a new group if needed. - if (currentIndexes.count == 0) { - currentOptions = options; - } - - [currentIndexes addIndex:i]; - } - }]; - - // Finish up the last group. - if (currentIndexes.count > 0) { - _ASHierarchySectionChange *change = [[_ASHierarchySectionChange alloc] initWithChangeType:type indexSet:[currentIndexes copy] animationOptions:currentOptions]; - [result addObject:change]; - } - - [changes setArray:result]; -} - -+ (NSMutableIndexSet *)allIndexesInSectionChanges:(NSArray<_ASHierarchySectionChange *> *)changes -{ - const auto indexes = [[NSMutableIndexSet alloc] init]; - for (_ASHierarchySectionChange *change in changes) { - [indexes addIndexes:change.indexSet]; - } - return indexes; -} - -#pragma mark - Debugging (Private) - -+ (NSString *)smallDescriptionForSectionChanges:(NSArray<_ASHierarchySectionChange *> *)changes -{ - NSMutableIndexSet *unionIndexSet = [NSMutableIndexSet indexSet]; - for (_ASHierarchySectionChange *change in changes) { - [unionIndexSet addIndexes:change.indexSet]; - } - return [unionIndexSet as_smallDescription]; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSString *)debugDescription -{ - return ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); -} - -- (NSString *)smallDescription -{ - return [self.indexSet as_smallDescription]; -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"indexes" : [self.indexSet as_smallDescription] }]; - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"anim" : @(_animationOptions) }]; - [result addObject:@{ @"type" : NSStringFromASHierarchyChangeType(_changeType) }]; - [result addObject:@{ @"indexes" : self.indexSet }]; - return result; -} - -@end - -@implementation _ASHierarchyItemChange - -- (instancetype)initWithChangeType:(_ASHierarchyChangeType)changeType indexPaths:(NSArray *)indexPaths animationOptions:(ASDataControllerAnimationOptions)animationOptions presorted:(BOOL)presorted -{ - self = [super init]; - if (self) { - ASDisplayNodeAssert(indexPaths.count > 0, @"Request to create _ASHierarchyItemChange with no items!"); - _changeType = changeType; - if (presorted) { - _indexPaths = indexPaths; - } else { - SEL sorting = changeType == _ASHierarchyChangeTypeDelete ? @selector(asdk_inverseCompare:) : @selector(compare:); - _indexPaths = [indexPaths sortedArrayUsingSelector:sorting]; - } - _animationOptions = animationOptions; - } - return self; -} - -// Create a mapping out of changes indexPaths to a {@section : [indexSet]} fashion -// e.g. changes: (0 - 0), (0 - 1), (2 - 5) -// will become: {@0 : [0, 1], @2 : [5]} -+ (NSDictionary *)sectionToIndexSetMapFromChanges:(NSArray<_ASHierarchyItemChange *> *)changes -{ - NSMutableDictionary *sectionToIndexSetMap = [[NSMutableDictionary alloc] init]; - for (_ASHierarchyItemChange *change in changes) { - for (NSIndexPath *indexPath in change.indexPaths) { - NSNumber *sectionKey = @(indexPath.section); - NSMutableIndexSet *indexSet = sectionToIndexSetMap[sectionKey]; - if (indexSet) { - [indexSet addIndex:indexPath.item]; - } else { - indexSet = [NSMutableIndexSet indexSetWithIndex:indexPath.item]; - sectionToIndexSetMap[sectionKey] = indexSet; - } - } - } - return sectionToIndexSetMap; -} - -+ (void)ensureItemChanges:(NSArray<_ASHierarchyItemChange *> *)changes ofSameType:(_ASHierarchyChangeType)changeType -{ -#if ASDISPLAYNODE_ASSERTIONS_ENABLED - for (_ASHierarchyItemChange *change in changes) { - NSAssert(change.changeType == changeType, @"The map we created must all be of the same changeType as of now"); - } -#endif -} - -- (_ASHierarchyItemChange *)changeByFinalizingType -{ - _ASHierarchyChangeType newType; - switch (_changeType) { - case _ASHierarchyChangeTypeOriginalInsert: - newType = _ASHierarchyChangeTypeInsert; - break; - case _ASHierarchyChangeTypeOriginalDelete: - newType = _ASHierarchyChangeTypeDelete; - break; - default: - ASFailUpdateValidation(@"Attempt to finalize item change of invalid type %@.", NSStringFromASHierarchyChangeType(_changeType)); - return self; - } - return [[_ASHierarchyItemChange alloc] initWithChangeType:newType indexPaths:_indexPaths animationOptions:_animationOptions presorted:YES]; -} - -+ (void)sortAndCoalesceItemChanges:(NSMutableArray<_ASHierarchyItemChange *> *)changes ignoringChangesInSections:(NSIndexSet *)ignoredSections -{ - if (changes.count < 1) { - return; - } - - _ASHierarchyChangeType type = [changes.firstObject changeType]; - ASDisplayNodeAssert(ASHierarchyChangeTypeIsFinal(type), @"Attempt to sort and coalesce item changes of intermediary type %@. Why?", NSStringFromASHierarchyChangeType(type)); - - // Lookup table [NSIndexPath: AnimationOptions] - const auto animationOptions = [[NSMutableDictionary alloc] init]; - - // All changed index paths, sorted - const auto allIndexPaths = [[NSMutableArray alloc] init]; - - for (_ASHierarchyItemChange *change in changes) { - for (NSIndexPath *indexPath in change.indexPaths) { - if (![ignoredSections containsIndex:indexPath.section]) { - animationOptions[indexPath] = @(change.animationOptions); - [allIndexPaths addObject:indexPath]; - } - } - } - - SEL sorting = type == _ASHierarchyChangeTypeDelete ? @selector(asdk_inverseCompare:) : @selector(compare:); - [allIndexPaths sortUsingSelector:sorting]; - - // Create new changes by grouping sorted changes by animation option - const auto result = [[NSMutableArray<_ASHierarchyItemChange *> alloc] init]; - - ASDataControllerAnimationOptions currentOptions = 0; - const auto currentIndexPaths = [[NSMutableArray alloc] init]; - - for (NSIndexPath *indexPath in allIndexPaths) { - ASDataControllerAnimationOptions options = [animationOptions[indexPath] integerValue]; - - // End the previous group if needed. - if (options != currentOptions && currentIndexPaths.count > 0) { - _ASHierarchyItemChange *change = [[_ASHierarchyItemChange alloc] initWithChangeType:type indexPaths:[currentIndexPaths copy] animationOptions:currentOptions presorted:YES]; - [result addObject:change]; - [currentIndexPaths removeAllObjects]; - } - - // Start a new group if needed. - if (currentIndexPaths.count == 0) { - currentOptions = options; - } - - [currentIndexPaths addObject:indexPath]; - } - - // Finish up the last group. - if (currentIndexPaths.count > 0) { - _ASHierarchyItemChange *change = [[_ASHierarchyItemChange alloc] initWithChangeType:type indexPaths:[currentIndexPaths copy] animationOptions:currentOptions presorted:YES]; - [result addObject:change]; - } - - [changes setArray:result]; -} - -#pragma mark - Debugging (Private) - -+ (NSString *)smallDescriptionForItemChanges:(NSArray<_ASHierarchyItemChange *> *)changes -{ - NSDictionary *map = [self sectionToIndexSetMapFromChanges:changes]; - NSMutableString *str = [NSMutableString stringWithString:@"{ "]; - [map enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull section, NSIndexSet * _Nonnull indexSet, BOOL * _Nonnull stop) { - [str appendFormat:@"@%lu : %@ ", (long)section.integerValue, [indexSet as_smallDescription]]; - }]; - [str appendString:@"}"]; - return str; -} - -- (NSString *)description -{ - return ASObjectDescriptionMake(self, [self propertiesForDescription]); -} - -- (NSString *)debugDescription -{ - return ASObjectDescriptionMake(self, [self propertiesForDebugDescription]); -} - -- (NSMutableArray *)propertiesForDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"indexPaths" : self.indexPaths }]; - return result; -} - -- (NSMutableArray *)propertiesForDebugDescription -{ - NSMutableArray *result = [NSMutableArray array]; - [result addObject:@{ @"anim" : @(_animationOptions) }]; - [result addObject:@{ @"type" : NSStringFromASHierarchyChangeType(_changeType) }]; - [result addObject:@{ @"indexPaths" : self.indexPaths }]; - return result; -} - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASPendingState.h b/Example/Pods/Texture/Source/Private/_ASPendingState.h deleted file mode 100644 index 0a96e7a8..00000000 --- a/Example/Pods/Texture/Source/Private/_ASPendingState.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// _ASPendingState.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -/** - - Private header for ASDisplayNode.mm - - _ASPendingState is a proxy for a UIView that has yet to be created. - In response to its setters, it sets an internal property and a flag that indicates that that property has been set. - - When you want to configure a view from this pending state information, just call -applyToView: - */ - -@interface _ASPendingState : NSObject - -// Supports all of the properties included in the ASDisplayNodeViewProperties protocol - -- (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)setFrameDirectly; -- (void)applyToLayer:(CALayer *)layer; - -+ (_ASPendingState *)pendingViewStateFromLayer:(CALayer *)layer; -+ (_ASPendingState *)pendingViewStateFromView:(UIView *)view; - -@property (nonatomic, readonly) BOOL hasSetNeedsLayout; -@property (nonatomic, readonly) BOOL hasSetNeedsDisplay; - -@property (nonatomic, readonly) BOOL hasChanges; - -- (void)clearChanges; - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASPendingState.mm b/Example/Pods/Texture/Source/Private/_ASPendingState.mm deleted file mode 100644 index a9d760e9..00000000 --- a/Example/Pods/Texture/Source/Private/_ASPendingState.mm +++ /dev/null @@ -1,1423 +0,0 @@ -// -// _ASPendingState.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import - -#define __shouldSetNeedsDisplayForView(view) (flags.needsDisplay \ - || (flags.setOpaque && _flags.opaque != (view).opaque)\ - || (flags.setBackgroundColor && ![backgroundColor isEqual:(view).backgroundColor])\ - || (flags.setTintColor && ![tintColor isEqual:(view).tintColor])) - -#define __shouldSetNeedsDisplayForLayer(layer) (flags.needsDisplay \ - || (flags.setOpaque && _flags.opaque != (layer).opaque)\ - || (flags.setBackgroundColor && ![backgroundColor isEqual:[UIColor colorWithCGColor:(layer).backgroundColor]])) - -typedef struct { - // Properties - int needsDisplay:1; - int needsLayout:1; - int layoutIfNeeded:1; - - // Flags indicating that a given property should be applied to the view at creation - int setClipsToBounds:1; - int setOpaque:1; - int setNeedsDisplayOnBoundsChange:1; - int setAutoresizesSubviews:1; - int setAutoresizingMask:1; - int setFrame:1; - int setBounds:1; - int setBackgroundColor:1; - int setTintColor:1; - int setHidden:1; - int setAlpha:1; - int setCornerRadius:1; - int setContentMode:1; - int setNeedsDisplay:1; - int setAnchorPoint:1; - int setPosition:1; - int setZPosition:1; - int setTransform:1; - int setSublayerTransform:1; - int setContents:1; - int setContentsGravity:1; - int setContentsRect:1; - int setContentsCenter:1; - int setContentsScale:1; - int setRasterizationScale:1; - int setUserInteractionEnabled:1; - int setExclusiveTouch:1; - int setShadowColor:1; - int setShadowOpacity:1; - int setShadowOffset:1; - int setShadowRadius:1; - int setBorderWidth:1; - int setBorderColor:1; - int setAsyncTransactionContainer:1; - int setAllowsGroupOpacity:1; - int setAllowsEdgeAntialiasing:1; - int setEdgeAntialiasingMask:1; - int setIsAccessibilityElement:1; - int setAccessibilityLabel:1; - int setAccessibilityAttributedLabel:1; - int setAccessibilityHint:1; - int setAccessibilityAttributedHint:1; - int setAccessibilityValue:1; - int setAccessibilityAttributedValue:1; - int setAccessibilityTraits:1; - int setAccessibilityFrame:1; - int setAccessibilityLanguage:1; - int setAccessibilityElementsHidden:1; - int setAccessibilityViewIsModal:1; - int setShouldGroupAccessibilityChildren:1; - int setAccessibilityIdentifier:1; - int setAccessibilityNavigationStyle:1; - int setAccessibilityCustomActions:1; - int setAccessibilityHeaderElements:1; - int setAccessibilityActivationPoint:1; - int setAccessibilityPath:1; - int setSemanticContentAttribute:1; - int setLayoutMargins:1; - int setPreservesSuperviewLayoutMargins:1; - int setInsetsLayoutMarginsFromSafeArea:1; - int setActions:1; - int setMaskedCorners : 1; -} ASPendingStateFlags; - - -static constexpr ASPendingStateFlags kZeroFlags = {0}; - -@implementation _ASPendingState -{ - @package //Expose all ivars for ASDisplayNode to bypass getters for efficiency - - UIViewAutoresizing autoresizingMask; - CAEdgeAntialiasingMask edgeAntialiasingMask; - CGRect frame; // Frame is only to be used for synchronous views wrapped by nodes (see setFrame:) - CGRect bounds; - UIColor *backgroundColor; - UIColor *tintColor; - CGFloat alpha; - CGFloat cornerRadius; - UIViewContentMode contentMode; - CGPoint anchorPoint; - CGPoint position; - CGFloat zPosition; - CATransform3D transform; - CATransform3D sublayerTransform; - id contents; - NSString *contentsGravity; - CGRect contentsRect; - CGRect contentsCenter; - CGFloat contentsScale; - CGFloat rasterizationScale; - CGColorRef shadowColor; - CGFloat shadowOpacity; - CGSize shadowOffset; - CGFloat shadowRadius; - CGFloat borderWidth; - CGColorRef borderColor; - UIEdgeInsets layoutMargins; - NSString *accessibilityLabel; - NSAttributedString *accessibilityAttributedLabel; - NSString *accessibilityHint; - NSAttributedString *accessibilityAttributedHint; - NSString *accessibilityValue; - NSAttributedString *accessibilityAttributedValue; - UIAccessibilityTraits accessibilityTraits; - CGRect accessibilityFrame; - NSString *accessibilityLanguage; - NSString *accessibilityIdentifier; - UIAccessibilityNavigationStyle accessibilityNavigationStyle; - NSArray *accessibilityCustomActions; - NSArray *accessibilityHeaderElements; - CGPoint accessibilityActivationPoint; - UIBezierPath *accessibilityPath; - UISemanticContentAttribute semanticContentAttribute API_AVAILABLE(ios(9.0), tvos(9.0)); - NSDictionary> *actions; - - ASPendingStateFlags _stateToApplyFlags; - struct { - unsigned int asyncTransactionContainer:1; - unsigned int preservesSuperviewLayoutMargins:1; - unsigned int insetsLayoutMarginsFromSafeArea:1; - unsigned int isAccessibilityElement:1; - unsigned int accessibilityElementsHidden:1; - unsigned int accessibilityViewIsModal:1; - unsigned int shouldGroupAccessibilityChildren:1; - unsigned int clipsToBounds:1; - unsigned int opaque:1; - unsigned int hidden:1; - unsigned int needsDisplayOnBoundsChange:1; - unsigned int allowsGroupOpacity:1; - unsigned int allowsEdgeAntialiasing:1; - unsigned int autoresizesSubviews:1; - unsigned int userInteractionEnabled:1; - unsigned int exclusiveTouch:1; - } _flags; -} - -/** - * Apply the state's frame, bounds, and position to layer. This will not - * be called on synchronous view-backed nodes which require we directly - * call [view setFrame:]. - * - * FIXME: How should we reconcile order-of-operations between setting frame, bounds, position? - * Note we can't read bounds and position in the background, so we have to keep the frame - * value intact until application time (now). - */ -ASDISPLAYNODE_INLINE void ASPendingStateApplyMetricsToLayer(_ASPendingState *state, CALayer *layer) { - ASPendingStateFlags flags = state->_stateToApplyFlags; - if (flags.setFrame) { - CGRect _bounds = CGRectZero; - CGPoint _position = CGPointZero; - ASBoundsAndPositionForFrame(state->frame, layer.bounds.origin, layer.anchorPoint, &_bounds, &_position); - layer.bounds = _bounds; - layer.position = _position; - } else { - if (flags.setBounds) - layer.bounds = state->bounds; - if (flags.setPosition) - layer.position = state->position; - } -} - -@synthesize frame=frame; -@synthesize bounds=bounds; -@synthesize backgroundColor=backgroundColor; -@synthesize edgeAntialiasingMask=edgeAntialiasingMask; -@synthesize autoresizingMask=autoresizingMask; -@synthesize tintColor=tintColor; -@synthesize alpha=alpha; -@synthesize cornerRadius=cornerRadius; -@synthesize contentMode=contentMode; -@synthesize anchorPoint=anchorPoint; -@synthesize position=position; -@synthesize zPosition=zPosition; -@synthesize transform=transform; -@synthesize sublayerTransform=sublayerTransform; -@synthesize contents=contents; -@synthesize contentsGravity=contentsGravity; -@synthesize contentsRect=contentsRect; -@synthesize contentsCenter=contentsCenter; -@synthesize contentsScale=contentsScale; -@synthesize rasterizationScale=rasterizationScale; -@synthesize userInteractionEnabled=userInteractionEnabled; -@synthesize exclusiveTouch=exclusiveTouch; -@synthesize shadowColor=shadowColor; -@synthesize shadowOpacity=shadowOpacity; -@synthesize shadowOffset=shadowOffset; -@synthesize shadowRadius=shadowRadius; -@synthesize borderWidth=borderWidth; -@synthesize borderColor=borderColor; -@synthesize asyncdisplaykit_asyncTransactionContainer=asyncTransactionContainer; -@synthesize semanticContentAttribute=semanticContentAttribute; -@synthesize layoutMargins=layoutMargins; -@synthesize preservesSuperviewLayoutMargins=preservesSuperviewLayoutMargins; -@synthesize insetsLayoutMarginsFromSafeArea=insetsLayoutMarginsFromSafeArea; -@synthesize actions=actions; -@synthesize maskedCorners = maskedCorners; - -static CGColorRef blackColorRef = NULL; - -- (instancetype)init -{ - if (!(self = [super init])) - return nil; - - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // Default UIKit color is an RGB color - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - blackColorRef = CGColorCreate(colorSpace, (CGFloat[]){0,0,0,1} ); - CFRetain(blackColorRef); - CGColorSpaceRelease(colorSpace); - }); - - // Set defaults, these come from the defaults specified in CALayer and UIView - _flags.clipsToBounds = NO; - _flags.opaque = YES; - frame = CGRectZero; - bounds = CGRectZero; - backgroundColor = nil; - tintColor = nil; - _flags.hidden = NO; - _flags.needsDisplayOnBoundsChange = NO; - _flags.allowsGroupOpacity = ASDefaultAllowsGroupOpacity(); - _flags.allowsEdgeAntialiasing = ASDefaultAllowsEdgeAntialiasing(); - _flags.autoresizesSubviews = YES; - alpha = 1.0f; - cornerRadius = 0.0f; - contentMode = UIViewContentModeScaleToFill; - _stateToApplyFlags.needsDisplay = NO; - anchorPoint = CGPointMake(0.5, 0.5); - position = CGPointZero; - zPosition = 0.0; - transform = CATransform3DIdentity; - sublayerTransform = CATransform3DIdentity; - contents = nil; - contentsGravity = kCAGravityResize; - contentsRect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); - contentsCenter = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); - contentsScale = 1.0f; - rasterizationScale = 1.0f; - _flags.userInteractionEnabled = YES; - shadowColor = blackColorRef; - shadowOpacity = 0.0; - shadowOffset = CGSizeMake(0, -3); - shadowRadius = 3; - borderWidth = 0; - borderColor = blackColorRef; - layoutMargins = UIEdgeInsetsMake(8, 8, 8, 8); - _flags.preservesSuperviewLayoutMargins = NO; - _flags.insetsLayoutMarginsFromSafeArea = YES; - _flags.isAccessibilityElement = NO; - accessibilityLabel = nil; - accessibilityAttributedLabel = nil; - accessibilityHint = nil; - accessibilityAttributedHint = nil; - accessibilityValue = nil; - accessibilityAttributedValue = nil; - accessibilityTraits = UIAccessibilityTraitNone; - accessibilityFrame = CGRectZero; - accessibilityLanguage = nil; - _flags.accessibilityElementsHidden = NO; - _flags.accessibilityViewIsModal = NO; - _flags.shouldGroupAccessibilityChildren = NO; - accessibilityIdentifier = nil; - accessibilityNavigationStyle = UIAccessibilityNavigationStyleAutomatic; - accessibilityCustomActions = nil; - accessibilityHeaderElements = nil; - accessibilityActivationPoint = CGPointZero; - accessibilityPath = nil; - edgeAntialiasingMask = (kCALayerLeftEdge | kCALayerRightEdge | kCALayerTopEdge | kCALayerBottomEdge); - semanticContentAttribute = UISemanticContentAttributeUnspecified; - - return self; -} - -- (void)setNeedsDisplay -{ - _stateToApplyFlags.needsDisplay = YES; -} - -- (void)setNeedsLayout -{ - _stateToApplyFlags.needsLayout = YES; -} - -- (void)layoutIfNeeded -{ - _stateToApplyFlags.layoutIfNeeded = YES; -} - -- (void)setClipsToBounds:(BOOL)flag -{ - _flags.clipsToBounds = flag; - _stateToApplyFlags.setClipsToBounds = YES; -} - -- (BOOL)clipsToBounds -{ - return _flags.clipsToBounds; -} - -- (void)setOpaque:(BOOL)flag -{ - _flags.opaque = flag; - _stateToApplyFlags.setOpaque = YES; -} - -- (BOOL)isOpaque -{ - return _flags.opaque; -} - -- (void)setNeedsDisplayOnBoundsChange:(BOOL)flag -{ - _flags.needsDisplayOnBoundsChange = flag; - _stateToApplyFlags.setNeedsDisplayOnBoundsChange = YES; -} - -- (BOOL)needsDisplayOnBoundsChange -{ - return _flags.needsDisplayOnBoundsChange; -} - -- (void)setAllowsGroupOpacity:(BOOL)flag -{ - _flags.allowsGroupOpacity = flag; - _stateToApplyFlags.setAllowsGroupOpacity = YES; -} - -- (BOOL)allowsGroupOpacity -{ - return _flags.allowsGroupOpacity; -} - -- (void)setAllowsEdgeAntialiasing:(BOOL)flag -{ - _flags.allowsEdgeAntialiasing = flag; - _stateToApplyFlags.setAllowsEdgeAntialiasing = YES; -} - -- (BOOL)allowsEdgeAntialiasing -{ - return _flags.allowsEdgeAntialiasing; -} - -- (void)setEdgeAntialiasingMask:(CAEdgeAntialiasingMask)mask -{ - edgeAntialiasingMask = mask; - _stateToApplyFlags.setEdgeAntialiasingMask = YES; -} - -- (void)setAutoresizesSubviews:(BOOL)flag -{ - _flags.autoresizesSubviews = flag; - _stateToApplyFlags.setAutoresizesSubviews = YES; -} - -- (BOOL)autoresizesSubviews -{ - return _flags.autoresizesSubviews; -} - -- (void)setAutoresizingMask:(UIViewAutoresizing)mask -{ - autoresizingMask = mask; - _stateToApplyFlags.setAutoresizingMask = YES; -} - -- (void)setFrame:(CGRect)newFrame -{ - frame = newFrame; - _stateToApplyFlags.setFrame = YES; -} - -- (void)setBounds:(CGRect)newBounds -{ - ASDisplayNodeAssert(!isnan(newBounds.size.width) && !isnan(newBounds.size.height), @"Invalid bounds %@ provided to %@", NSStringFromCGRect(newBounds), self); - if (isnan(newBounds.size.width)) - newBounds.size.width = 0.0; - if (isnan(newBounds.size.height)) - newBounds.size.height = 0.0; - bounds = newBounds; - _stateToApplyFlags.setBounds = YES; -} - -- (UIColor *)backgroundColor -{ - return backgroundColor; -} - -- (void)setBackgroundColor:(UIColor *)color -{ - if ([color isEqual:backgroundColor]) { - return; - } - backgroundColor = color; - _stateToApplyFlags.setBackgroundColor = YES; -} - -- (UIColor *)tintColor -{ - return tintColor; -} - -- (void)setTintColor:(UIColor *)newTintColor -{ - if ([newTintColor isEqual:tintColor]) { - return; - } - tintColor = newTintColor; - _stateToApplyFlags.setTintColor = YES; -} - -- (void)setHidden:(BOOL)flag -{ - _flags.hidden = flag; - _stateToApplyFlags.setHidden = YES; -} - -- (BOOL)isHidden -{ - return _flags.hidden; -} - -- (void)setAlpha:(CGFloat)newAlpha -{ - alpha = newAlpha; - _stateToApplyFlags.setAlpha = YES; -} - -- (void)setCornerRadius:(CGFloat)newCornerRadius -{ - cornerRadius = newCornerRadius; - _stateToApplyFlags.setCornerRadius = YES; -} - -- (void)setMaskedCorners:(CACornerMask)newMaskedCorners -{ - maskedCorners = newMaskedCorners; - _stateToApplyFlags.setMaskedCorners = YES; -} - -- (void)setContentMode:(UIViewContentMode)newContentMode -{ - contentMode = newContentMode; - _stateToApplyFlags.setContentMode = YES; -} - -- (void)setAnchorPoint:(CGPoint)newAnchorPoint -{ - anchorPoint = newAnchorPoint; - _stateToApplyFlags.setAnchorPoint = YES; -} - -- (void)setPosition:(CGPoint)newPosition -{ - ASDisplayNodeAssert(!isnan(newPosition.x) && !isnan(newPosition.y), @"Invalid position %@ provided to %@", NSStringFromCGPoint(newPosition), self); - if (isnan(newPosition.x)) - newPosition.x = 0.0; - if (isnan(newPosition.y)) - newPosition.y = 0.0; - position = newPosition; - _stateToApplyFlags.setPosition = YES; -} - -- (void)setZPosition:(CGFloat)newPosition -{ - zPosition = newPosition; - _stateToApplyFlags.setZPosition = YES; -} - -- (void)setTransform:(CATransform3D)newTransform -{ - transform = newTransform; - _stateToApplyFlags.setTransform = YES; -} - -- (void)setSublayerTransform:(CATransform3D)newSublayerTransform -{ - sublayerTransform = newSublayerTransform; - _stateToApplyFlags.setSublayerTransform = YES; -} - -- (void)setContents:(id)newContents -{ - if (contents == newContents) { - return; - } - - contents = newContents; - _stateToApplyFlags.setContents = YES; -} - -- (void)setContentsGravity:(NSString *)newContentsGravity -{ - contentsGravity = newContentsGravity; - _stateToApplyFlags.setContentsGravity = YES; -} - -- (void)setContentsRect:(CGRect)newContentsRect -{ - contentsRect = newContentsRect; - _stateToApplyFlags.setContentsRect = YES; -} - -- (void)setContentsCenter:(CGRect)newContentsCenter -{ - contentsCenter = newContentsCenter; - _stateToApplyFlags.setContentsCenter = YES; -} - -- (void)setContentsScale:(CGFloat)newContentsScale -{ - contentsScale = newContentsScale; - _stateToApplyFlags.setContentsScale = YES; -} - -- (void)setRasterizationScale:(CGFloat)newRasterizationScale -{ - rasterizationScale = newRasterizationScale; - _stateToApplyFlags.setRasterizationScale = YES; -} - -- (void)setUserInteractionEnabled:(BOOL)flag -{ - _flags.userInteractionEnabled = flag; - _stateToApplyFlags.setUserInteractionEnabled = YES; -} - -- (BOOL)isUserInteractionEnabled -{ - return _flags.userInteractionEnabled; -} - -- (void)setExclusiveTouch:(BOOL)flag -{ - _flags.exclusiveTouch = flag; - _stateToApplyFlags.setExclusiveTouch = YES; -} - -- (BOOL)isExclusiveTouch -{ - return _flags.exclusiveTouch; -} - -- (void)setShadowColor:(CGColorRef)color -{ - if (shadowColor == color) { - return; - } - - if (shadowColor != blackColorRef) { - CGColorRelease(shadowColor); - } - shadowColor = color; - CGColorRetain(shadowColor); - - _stateToApplyFlags.setShadowColor = YES; -} - -- (void)setShadowOpacity:(CGFloat)newOpacity -{ - shadowOpacity = newOpacity; - _stateToApplyFlags.setShadowOpacity = YES; -} - -- (void)setShadowOffset:(CGSize)newOffset -{ - shadowOffset = newOffset; - _stateToApplyFlags.setShadowOffset = YES; -} - -- (void)setShadowRadius:(CGFloat)newRadius -{ - shadowRadius = newRadius; - _stateToApplyFlags.setShadowRadius = YES; -} - -- (void)setBorderWidth:(CGFloat)newWidth -{ - borderWidth = newWidth; - _stateToApplyFlags.setBorderWidth = YES; -} - -- (void)setBorderColor:(CGColorRef)color -{ - if (borderColor == color) { - return; - } - - if (borderColor != blackColorRef) { - CGColorRelease(borderColor); - } - borderColor = color; - CGColorRetain(borderColor); - - _stateToApplyFlags.setBorderColor = YES; -} - -- (void)asyncdisplaykit_setAsyncTransactionContainer:(BOOL)flag -{ - _flags.asyncTransactionContainer = flag; - _stateToApplyFlags.setAsyncTransactionContainer = YES; -} - -- (BOOL)asyncdisplaykit_isAsyncTransactionContainer -{ - return _flags.asyncTransactionContainer; -} - -- (void)setLayoutMargins:(UIEdgeInsets)margins -{ - layoutMargins = margins; - _stateToApplyFlags.setLayoutMargins = YES; -} - -- (void)setPreservesSuperviewLayoutMargins:(BOOL)flag -{ - _flags.preservesSuperviewLayoutMargins = flag; - _stateToApplyFlags.setPreservesSuperviewLayoutMargins = YES; -} - -- (BOOL)preservesSuperviewLayoutMargins -{ - return _flags.preservesSuperviewLayoutMargins; -} - -- (void)setInsetsLayoutMarginsFromSafeArea:(BOOL)flag -{ - _flags.insetsLayoutMarginsFromSafeArea = flag; - _stateToApplyFlags.setInsetsLayoutMarginsFromSafeArea = YES; -} - -- (BOOL)insetsLayoutMarginsFromSafeArea -{ - return _flags.insetsLayoutMarginsFromSafeArea; -} - -- (void)setSemanticContentAttribute:(UISemanticContentAttribute)attribute API_AVAILABLE(ios(9.0), tvos(9.0)) { - semanticContentAttribute = attribute; - _stateToApplyFlags.setSemanticContentAttribute = YES; -} - -- (void)setActions:(NSDictionary> *)actionsArg -{ - actions = [actionsArg copy]; - _stateToApplyFlags.setActions = YES; -} - -- (BOOL)isAccessibilityElement -{ - return _flags.isAccessibilityElement; -} - -- (void)setIsAccessibilityElement:(BOOL)newIsAccessibilityElement -{ - _flags.isAccessibilityElement = newIsAccessibilityElement; - _stateToApplyFlags.setIsAccessibilityElement = YES; -} - -- (NSString *)accessibilityLabel -{ - if (_stateToApplyFlags.setAccessibilityAttributedLabel) { - return accessibilityAttributedLabel.string; - } - return accessibilityLabel; -} - -- (void)setAccessibilityLabel:(NSString *)newAccessibilityLabel -{ - ASCompareAssignCopy(accessibilityLabel, newAccessibilityLabel); - _stateToApplyFlags.setAccessibilityLabel = YES; - _stateToApplyFlags.setAccessibilityAttributedLabel = NO; -} - -- (NSAttributedString *)accessibilityAttributedLabel -{ - if (_stateToApplyFlags.setAccessibilityLabel) { - return [[NSAttributedString alloc] initWithString:accessibilityLabel]; - } - return accessibilityAttributedLabel; -} - -- (void)setAccessibilityAttributedLabel:(NSAttributedString *)newAccessibilityAttributedLabel -{ - ASCompareAssignCopy(accessibilityAttributedLabel, newAccessibilityAttributedLabel); - _stateToApplyFlags.setAccessibilityAttributedLabel = YES; - _stateToApplyFlags.setAccessibilityLabel = NO; -} - -- (NSString *)accessibilityHint -{ - if (_stateToApplyFlags.setAccessibilityAttributedHint) { - return accessibilityAttributedHint.string; - } - return accessibilityHint; -} - -- (void)setAccessibilityHint:(NSString *)newAccessibilityHint -{ - ASCompareAssignCopy(accessibilityHint, newAccessibilityHint); - _stateToApplyFlags.setAccessibilityHint = YES; - _stateToApplyFlags.setAccessibilityAttributedHint = NO; -} - -- (NSAttributedString *)accessibilityAttributedHint -{ - if (_stateToApplyFlags.setAccessibilityHint) { - return [[NSAttributedString alloc] initWithString:accessibilityHint]; - } - return accessibilityAttributedHint; -} - -- (void)setAccessibilityAttributedHint:(NSAttributedString *)newAccessibilityAttributedHint -{ - ASCompareAssignCopy(accessibilityAttributedHint, newAccessibilityAttributedHint); - _stateToApplyFlags.setAccessibilityAttributedHint = YES; - _stateToApplyFlags.setAccessibilityHint = NO; -} - -- (NSString *)accessibilityValue -{ - if (_stateToApplyFlags.setAccessibilityAttributedValue) { - return accessibilityAttributedValue.string; - } - return accessibilityValue; -} - -- (void)setAccessibilityValue:(NSString *)newAccessibilityValue -{ - ASCompareAssignCopy(accessibilityValue, newAccessibilityValue); - _stateToApplyFlags.setAccessibilityValue = YES; - _stateToApplyFlags.setAccessibilityAttributedValue = NO; -} - -- (NSAttributedString *)accessibilityAttributedValue -{ - if (_stateToApplyFlags.setAccessibilityValue) { - return [[NSAttributedString alloc] initWithString:accessibilityValue]; - } - return accessibilityAttributedValue; -} - -- (void)setAccessibilityAttributedValue:(NSAttributedString *)newAccessibilityAttributedValue -{ - ASCompareAssignCopy(accessibilityAttributedValue, newAccessibilityAttributedValue); - _stateToApplyFlags.setAccessibilityAttributedValue = YES; - _stateToApplyFlags.setAccessibilityValue = NO; -} - -- (UIAccessibilityTraits)accessibilityTraits -{ - return accessibilityTraits; -} - -- (void)setAccessibilityTraits:(UIAccessibilityTraits)newAccessibilityTraits -{ - accessibilityTraits = newAccessibilityTraits; - _stateToApplyFlags.setAccessibilityTraits = YES; -} - -- (CGRect)accessibilityFrame -{ - return accessibilityFrame; -} - -- (void)setAccessibilityFrame:(CGRect)newAccessibilityFrame -{ - accessibilityFrame = newAccessibilityFrame; - _stateToApplyFlags.setAccessibilityFrame = YES; -} - -- (NSString *)accessibilityLanguage -{ - return accessibilityLanguage; -} - -- (void)setAccessibilityLanguage:(NSString *)newAccessibilityLanguage -{ - _stateToApplyFlags.setAccessibilityLanguage = YES; - accessibilityLanguage = newAccessibilityLanguage; -} - -- (BOOL)accessibilityElementsHidden -{ - return _flags.accessibilityElementsHidden; -} - -- (void)setAccessibilityElementsHidden:(BOOL)newAccessibilityElementsHidden -{ - _flags.accessibilityElementsHidden = newAccessibilityElementsHidden; - _stateToApplyFlags.setAccessibilityElementsHidden = YES; -} - -- (BOOL)accessibilityViewIsModal -{ - return _flags.accessibilityViewIsModal; -} - -- (void)setAccessibilityViewIsModal:(BOOL)newAccessibilityViewIsModal -{ - _flags.accessibilityViewIsModal = newAccessibilityViewIsModal; - _stateToApplyFlags.setAccessibilityViewIsModal = YES; -} - -- (BOOL)shouldGroupAccessibilityChildren -{ - return _flags.shouldGroupAccessibilityChildren; -} - -- (void)setShouldGroupAccessibilityChildren:(BOOL)newShouldGroupAccessibilityChildren -{ - _flags.shouldGroupAccessibilityChildren = newShouldGroupAccessibilityChildren; - _stateToApplyFlags.setShouldGroupAccessibilityChildren = YES; -} - -- (NSString *)accessibilityIdentifier -{ - return accessibilityIdentifier; -} - -- (void)setAccessibilityIdentifier:(NSString *)newAccessibilityIdentifier -{ - _stateToApplyFlags.setAccessibilityIdentifier = YES; - if (accessibilityIdentifier != newAccessibilityIdentifier) { - accessibilityIdentifier = [newAccessibilityIdentifier copy]; - } -} - -- (UIAccessibilityNavigationStyle)accessibilityNavigationStyle -{ - return accessibilityNavigationStyle; -} - -- (void)setAccessibilityNavigationStyle:(UIAccessibilityNavigationStyle)newAccessibilityNavigationStyle -{ - _stateToApplyFlags.setAccessibilityNavigationStyle = YES; - accessibilityNavigationStyle = newAccessibilityNavigationStyle; -} - -- (NSArray *)accessibilityCustomActions -{ - return accessibilityCustomActions; -} - -- (void)setAccessibilityCustomActions:(NSArray *)newAccessibilityCustomActions -{ - _stateToApplyFlags.setAccessibilityCustomActions = YES; - if (accessibilityCustomActions != newAccessibilityCustomActions) { - accessibilityCustomActions = [newAccessibilityCustomActions copy]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-implementations" -- (NSArray *)accessibilityHeaderElements -{ - return accessibilityHeaderElements; -} - -- (void)setAccessibilityHeaderElements:(NSArray *)newAccessibilityHeaderElements -{ - _stateToApplyFlags.setAccessibilityHeaderElements = YES; - if (accessibilityHeaderElements != newAccessibilityHeaderElements) { - accessibilityHeaderElements = [newAccessibilityHeaderElements copy]; - } -} -#pragma clang diagnostic pop - -- (CGPoint)accessibilityActivationPoint -{ - if (_stateToApplyFlags.setAccessibilityActivationPoint) { - return accessibilityActivationPoint; - } - - // Default == Mid-point of the accessibilityFrame - return CGPointMake(CGRectGetMidX(accessibilityFrame), CGRectGetMidY(accessibilityFrame)); -} - -- (void)setAccessibilityActivationPoint:(CGPoint)newAccessibilityActivationPoint -{ - _stateToApplyFlags.setAccessibilityActivationPoint = YES; - accessibilityActivationPoint = newAccessibilityActivationPoint; -} - -- (UIBezierPath *)accessibilityPath -{ - return accessibilityPath; -} - -- (void)setAccessibilityPath:(UIBezierPath *)newAccessibilityPath -{ - _stateToApplyFlags.setAccessibilityPath = YES; - if (accessibilityPath != newAccessibilityPath) { - accessibilityPath = newAccessibilityPath; - } -} - -- (void)applyToLayer:(CALayer *)layer -{ - ASPendingStateFlags flags = _stateToApplyFlags; - - if (__shouldSetNeedsDisplayForLayer(layer)) { - [layer setNeedsDisplay]; - } - - if (flags.setAnchorPoint) - layer.anchorPoint = anchorPoint; - - if (flags.setZPosition) - layer.zPosition = zPosition; - - if (flags.setTransform) - layer.transform = transform; - - if (flags.setSublayerTransform) - layer.sublayerTransform = sublayerTransform; - - if (flags.setContents) - layer.contents = contents; - - if (flags.setContentsGravity) - layer.contentsGravity = contentsGravity; - - if (flags.setContentsRect) - layer.contentsRect = contentsRect; - - if (flags.setContentsCenter) - layer.contentsCenter = contentsCenter; - - if (flags.setContentsScale) - layer.contentsScale = contentsScale; - - if (flags.setRasterizationScale) - layer.rasterizationScale = rasterizationScale; - - if (flags.setClipsToBounds) - layer.masksToBounds = _flags.clipsToBounds; - - if (flags.setBackgroundColor) - layer.backgroundColor = backgroundColor.CGColor; - - if (flags.setOpaque) - layer.opaque = _flags.opaque; - - if (flags.setHidden) - layer.hidden = _flags.hidden; - - if (flags.setAlpha) - layer.opacity = alpha; - - if (flags.setCornerRadius) - layer.cornerRadius = cornerRadius; - - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - if (flags.setMaskedCorners) { - layer.maskedCorners = maskedCorners; - } - } - - if (flags.setContentMode) - layer.contentsGravity = ASDisplayNodeCAContentsGravityFromUIContentMode(contentMode); - - if (flags.setShadowColor) - layer.shadowColor = shadowColor; - - if (flags.setShadowOpacity) - layer.shadowOpacity = shadowOpacity; - - if (flags.setShadowOffset) - layer.shadowOffset = shadowOffset; - - if (flags.setShadowRadius) - layer.shadowRadius = shadowRadius; - - if (flags.setBorderWidth) - layer.borderWidth = borderWidth; - - if (flags.setBorderColor) - layer.borderColor = borderColor; - - if (flags.setNeedsDisplayOnBoundsChange) - layer.needsDisplayOnBoundsChange = _flags.needsDisplayOnBoundsChange; - - if (flags.setAllowsGroupOpacity) - layer.allowsGroupOpacity = _flags.allowsGroupOpacity; - - if (flags.setAllowsEdgeAntialiasing) - layer.allowsEdgeAntialiasing = _flags.allowsEdgeAntialiasing; - - if (flags.setEdgeAntialiasingMask) - layer.edgeAntialiasingMask = edgeAntialiasingMask; - - if (flags.setAsyncTransactionContainer) - layer.asyncdisplaykit_asyncTransactionContainer = _flags.asyncTransactionContainer; - - if (flags.setOpaque) - ASDisplayNodeAssert(layer.opaque == _flags.opaque, @"Didn't set opaque as desired"); - - if (flags.setActions) - layer.actions = actions; - - ASPendingStateApplyMetricsToLayer(self, layer); - - if (flags.needsLayout) - [layer setNeedsLayout]; - - if (flags.layoutIfNeeded) - [layer layoutIfNeeded]; -} - -- (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPropertiesHandling -{ - /* - Use our convenience setters blah here instead of layer.blah - We were accidentally setting some properties on layer here, but view in UIViewBridgeOptimizations. - - That could easily cause bugs where it mattered whether you set something up on a bg thread on in -didLoad - because a different setter would be called. - */ - - unowned CALayer *layer = view.layer; - - ASPendingStateFlags flags = _stateToApplyFlags; - if (__shouldSetNeedsDisplayForView(view)) { - [view setNeedsDisplay]; - } - - if (flags.setAnchorPoint) - layer.anchorPoint = anchorPoint; - - if (flags.setPosition) - layer.position = position; - - if (flags.setZPosition) - layer.zPosition = zPosition; - - if (flags.setBounds) - view.bounds = bounds; - - if (flags.setTransform) - layer.transform = transform; - - if (flags.setSublayerTransform) - layer.sublayerTransform = sublayerTransform; - - if (flags.setContents) - layer.contents = contents; - - if (flags.setContentsGravity) - layer.contentsGravity = contentsGravity; - - if (flags.setContentsRect) - layer.contentsRect = contentsRect; - - if (flags.setContentsCenter) - layer.contentsCenter = contentsCenter; - - if (flags.setContentsScale) - layer.contentsScale = contentsScale; - - if (flags.setRasterizationScale) - layer.rasterizationScale = rasterizationScale; - - if (flags.setActions) - layer.actions = actions; - - if (flags.setClipsToBounds) - view.clipsToBounds = _flags.clipsToBounds; - - if (flags.setBackgroundColor) { - view.backgroundColor = backgroundColor; - layer.backgroundColor = backgroundColor.CGColor; - } - - if (flags.setTintColor) - view.tintColor = tintColor; - - if (flags.setOpaque) { - view.opaque = _flags.opaque; - layer.opaque = _flags.opaque; - } - - if (flags.setHidden) - view.hidden = _flags.hidden; - - if (flags.setAlpha) - view.alpha = alpha; - - if (flags.setCornerRadius) - layer.cornerRadius = cornerRadius; - - if (flags.setContentMode) - view.contentMode = contentMode; - - if (flags.setUserInteractionEnabled) - view.userInteractionEnabled = _flags.userInteractionEnabled; - - #if TARGET_OS_IOS - if (flags.setExclusiveTouch) - view.exclusiveTouch = _flags.exclusiveTouch; - #endif - - if (flags.setShadowColor) - layer.shadowColor = shadowColor; - - if (flags.setShadowOpacity) - layer.shadowOpacity = shadowOpacity; - - if (flags.setShadowOffset) - layer.shadowOffset = shadowOffset; - - if (flags.setShadowRadius) - layer.shadowRadius = shadowRadius; - - if (flags.setBorderWidth) - layer.borderWidth = borderWidth; - - if (flags.setBorderColor) - layer.borderColor = borderColor; - - if (flags.setAutoresizingMask) - view.autoresizingMask = autoresizingMask; - - if (flags.setAutoresizesSubviews) - view.autoresizesSubviews = _flags.autoresizesSubviews; - - if (flags.setNeedsDisplayOnBoundsChange) - layer.needsDisplayOnBoundsChange = _flags.needsDisplayOnBoundsChange; - - if (flags.setAllowsGroupOpacity) - layer.allowsGroupOpacity = _flags.allowsGroupOpacity; - - if (flags.setAllowsEdgeAntialiasing) - layer.allowsEdgeAntialiasing = _flags.allowsEdgeAntialiasing; - - if (flags.setEdgeAntialiasingMask) - layer.edgeAntialiasingMask = edgeAntialiasingMask; - - if (flags.setAsyncTransactionContainer) - view.asyncdisplaykit_asyncTransactionContainer = _flags.asyncTransactionContainer; - - if (flags.setOpaque) - ASDisplayNodeAssert(layer.opaque == _flags.opaque, @"Didn't set opaque as desired"); - - if (flags.setLayoutMargins) - view.layoutMargins = layoutMargins; - - if (flags.setPreservesSuperviewLayoutMargins) - view.preservesSuperviewLayoutMargins = _flags.preservesSuperviewLayoutMargins; - - if (AS_AVAILABLE_IOS_TVOS(11.0, 11.0)) { - if (flags.setInsetsLayoutMarginsFromSafeArea) { - view.insetsLayoutMarginsFromSafeArea = _flags.insetsLayoutMarginsFromSafeArea; - } - } - - if (flags.setSemanticContentAttribute) { - view.semanticContentAttribute = semanticContentAttribute; - } - - if (flags.setIsAccessibilityElement) - view.isAccessibilityElement = _flags.isAccessibilityElement; - - if (flags.setAccessibilityLabel) - view.accessibilityLabel = accessibilityLabel; - - if (flags.setAccessibilityHint) - view.accessibilityHint = accessibilityHint; - - if (flags.setAccessibilityValue) - view.accessibilityValue = accessibilityValue; - - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - if (flags.setAccessibilityAttributedLabel) { - view.accessibilityAttributedLabel = accessibilityAttributedLabel; - } - if (flags.setAccessibilityAttributedHint) { - view.accessibilityAttributedHint = accessibilityAttributedHint; - } - if (flags.setAccessibilityAttributedValue) { - view.accessibilityAttributedValue = accessibilityAttributedValue; - } - } - - if (flags.setAccessibilityTraits) - view.accessibilityTraits = accessibilityTraits; - - if (flags.setAccessibilityFrame) - view.accessibilityFrame = accessibilityFrame; - - if (flags.setAccessibilityLanguage) - view.accessibilityLanguage = accessibilityLanguage; - - if (flags.setAccessibilityElementsHidden) - view.accessibilityElementsHidden = _flags.accessibilityElementsHidden; - - if (flags.setAccessibilityViewIsModal) - view.accessibilityViewIsModal = _flags.accessibilityViewIsModal; - - if (flags.setShouldGroupAccessibilityChildren) - view.shouldGroupAccessibilityChildren = _flags.shouldGroupAccessibilityChildren; - - if (flags.setAccessibilityIdentifier) - view.accessibilityIdentifier = accessibilityIdentifier; - - if (flags.setAccessibilityNavigationStyle) - view.accessibilityNavigationStyle = accessibilityNavigationStyle; - - if (flags.setAccessibilityCustomActions) { - view.accessibilityCustomActions = accessibilityCustomActions; - } - -#if TARGET_OS_TV - if (flags.setAccessibilityHeaderElements) - view.accessibilityHeaderElements = accessibilityHeaderElements; -#endif - - if (flags.setAccessibilityActivationPoint) - view.accessibilityActivationPoint = accessibilityActivationPoint; - - if (flags.setAccessibilityPath) - view.accessibilityPath = accessibilityPath; - - if (flags.setFrame && specialPropertiesHandling) { - // Frame is only defined when transform is identity because we explicitly diverge from CALayer behavior and define frame without transform -//#if DEBUG -// // Checking if the transform is identity is expensive, so disable when unnecessary. We have assertions on in Release, so DEBUG is the only way I know of. -// ASDisplayNodeAssert(CATransform3DIsIdentity(layer.transform), @"-[ASDisplayNode setFrame:] - self.transform must be identity in order to set the frame property. (From Apple's UIView documentation: If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.)"); -//#endif - view.frame = frame; - } else { - ASPendingStateApplyMetricsToLayer(self, layer); - } - - if (flags.needsLayout) - [view setNeedsLayout]; - - if (flags.layoutIfNeeded) - [view layoutIfNeeded]; -} - -// FIXME: Make this more efficient by tracking which properties are set rather than reading everything. -+ (_ASPendingState *)pendingViewStateFromLayer:(CALayer *)layer -{ - if (!layer) { - return nil; - } - _ASPendingState *pendingState = [[_ASPendingState alloc] init]; - pendingState.anchorPoint = layer.anchorPoint; - pendingState.position = layer.position; - pendingState.zPosition = layer.zPosition; - pendingState.bounds = layer.bounds; - pendingState.transform = layer.transform; - pendingState.sublayerTransform = layer.sublayerTransform; - pendingState.contents = layer.contents; - pendingState.contentsGravity = layer.contentsGravity; - pendingState.contentsRect = layer.contentsRect; - pendingState.contentsCenter = layer.contentsCenter; - pendingState.contentsScale = layer.contentsScale; - pendingState.rasterizationScale = layer.rasterizationScale; - pendingState.clipsToBounds = layer.masksToBounds; - pendingState.backgroundColor = [UIColor colorWithCGColor:layer.backgroundColor]; - pendingState.opaque = layer.opaque; - pendingState.hidden = layer.hidden; - pendingState.alpha = layer.opacity; - pendingState.cornerRadius = layer.cornerRadius; - pendingState.contentMode = ASDisplayNodeUIContentModeFromCAContentsGravity(layer.contentsGravity); - pendingState.shadowColor = layer.shadowColor; - pendingState.shadowOpacity = layer.shadowOpacity; - pendingState.shadowOffset = layer.shadowOffset; - pendingState.shadowRadius = layer.shadowRadius; - pendingState.borderWidth = layer.borderWidth; - pendingState.borderColor = layer.borderColor; - pendingState.needsDisplayOnBoundsChange = layer.needsDisplayOnBoundsChange; - pendingState.allowsGroupOpacity = layer.allowsGroupOpacity; - pendingState.allowsEdgeAntialiasing = layer.allowsEdgeAntialiasing; - pendingState.edgeAntialiasingMask = layer.edgeAntialiasingMask; - return pendingState; -} - -// FIXME: Make this more efficient by tracking which properties are set rather than reading everything. -+ (_ASPendingState *)pendingViewStateFromView:(UIView *)view -{ - if (!view) { - return nil; - } - _ASPendingState *pendingState = [[_ASPendingState alloc] init]; - - CALayer *layer = view.layer; - pendingState.anchorPoint = layer.anchorPoint; - pendingState.position = layer.position; - pendingState.zPosition = layer.zPosition; - pendingState.bounds = view.bounds; - pendingState.transform = layer.transform; - pendingState.sublayerTransform = layer.sublayerTransform; - pendingState.contents = layer.contents; - pendingState.contentsGravity = layer.contentsGravity; - pendingState.contentsRect = layer.contentsRect; - pendingState.contentsCenter = layer.contentsCenter; - pendingState.contentsScale = layer.contentsScale; - pendingState.rasterizationScale = layer.rasterizationScale; - pendingState.clipsToBounds = view.clipsToBounds; - pendingState.backgroundColor = view.backgroundColor; - pendingState.tintColor = view.tintColor; - pendingState.opaque = layer.opaque; - pendingState.hidden = view.hidden; - pendingState.alpha = view.alpha; - pendingState.cornerRadius = layer.cornerRadius; - pendingState.contentMode = view.contentMode; - pendingState.userInteractionEnabled = view.userInteractionEnabled; -#if TARGET_OS_IOS - pendingState.exclusiveTouch = view.exclusiveTouch; -#endif - pendingState.shadowColor = layer.shadowColor; - pendingState.shadowOpacity = layer.shadowOpacity; - pendingState.shadowOffset = layer.shadowOffset; - pendingState.shadowRadius = layer.shadowRadius; - pendingState.borderWidth = layer.borderWidth; - pendingState.borderColor = layer.borderColor; - pendingState.autoresizingMask = view.autoresizingMask; - pendingState.autoresizesSubviews = view.autoresizesSubviews; - pendingState.needsDisplayOnBoundsChange = layer.needsDisplayOnBoundsChange; - pendingState.allowsGroupOpacity = layer.allowsGroupOpacity; - pendingState.allowsEdgeAntialiasing = layer.allowsEdgeAntialiasing; - pendingState.edgeAntialiasingMask = layer.edgeAntialiasingMask; - pendingState.semanticContentAttribute = view.semanticContentAttribute; - pendingState.layoutMargins = view.layoutMargins; - pendingState.preservesSuperviewLayoutMargins = view.preservesSuperviewLayoutMargins; - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - pendingState.insetsLayoutMarginsFromSafeArea = view.insetsLayoutMarginsFromSafeArea; - } - pendingState.isAccessibilityElement = view.isAccessibilityElement; - pendingState.accessibilityLabel = view.accessibilityLabel; - pendingState.accessibilityHint = view.accessibilityHint; - pendingState.accessibilityValue = view.accessibilityValue; - if (AS_AVAILABLE_IOS_TVOS(11, 11)) { - pendingState.accessibilityAttributedLabel = view.accessibilityAttributedLabel; - pendingState.accessibilityAttributedHint = view.accessibilityAttributedHint; - pendingState.accessibilityAttributedValue = view.accessibilityAttributedValue; - } - pendingState.accessibilityTraits = view.accessibilityTraits; - pendingState.accessibilityFrame = view.accessibilityFrame; - pendingState.accessibilityLanguage = view.accessibilityLanguage; - pendingState.accessibilityElementsHidden = view.accessibilityElementsHidden; - pendingState.accessibilityViewIsModal = view.accessibilityViewIsModal; - pendingState.shouldGroupAccessibilityChildren = view.shouldGroupAccessibilityChildren; - pendingState.accessibilityIdentifier = view.accessibilityIdentifier; - pendingState.accessibilityNavigationStyle = view.accessibilityNavigationStyle; - pendingState.accessibilityCustomActions = view.accessibilityCustomActions; -#if TARGET_OS_TV - pendingState.accessibilityHeaderElements = view.accessibilityHeaderElements; -#endif - pendingState.accessibilityActivationPoint = view.accessibilityActivationPoint; - pendingState.accessibilityPath = view.accessibilityPath; - return pendingState; -} - -- (void)clearChanges -{ - _stateToApplyFlags = kZeroFlags; -} - -- (BOOL)hasSetNeedsLayout -{ - return _stateToApplyFlags.needsLayout; -} - -- (BOOL)hasSetNeedsDisplay -{ - return _stateToApplyFlags.needsDisplay; -} - -- (BOOL)hasChanges -{ - return memcmp(&_stateToApplyFlags, &kZeroFlags, sizeof(ASPendingStateFlags)); -} - -- (void)dealloc -{ - if (shadowColor != blackColorRef) { - CGColorRelease(shadowColor); - } - - if (borderColor != blackColorRef) { - CGColorRelease(borderColor); - } -} - -@end diff --git a/Example/Pods/Texture/Source/Private/_ASScopeTimer.h b/Example/Pods/Texture/Source/Private/_ASScopeTimer.h deleted file mode 100644 index 523599dd..00000000 --- a/Example/Pods/Texture/Source/Private/_ASScopeTimer.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// _ASScopeTimer.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -/** - Must compile as c++ for this to work. - - Usage: - // Can be an ivar or local variable - NSTimeInterval placeToStoreTiming; - - { - // some scope - AS::ScopeTimer t(placeToStoreTiming); - DoPotentiallySlowWork(); - MorePotentiallySlowWork(); - } - - */ - -namespace AS { - struct ScopeTimer { - NSTimeInterval begin; - NSTimeInterval &outT; - ScopeTimer(NSTimeInterval &outRef) : outT(outRef) { - begin = CACurrentMediaTime(); - } - ~ScopeTimer() { - outT = CACurrentMediaTime() - begin; - } - }; - - // variant where repeated calls are summed - struct SumScopeTimer { - NSTimeInterval begin; - NSTimeInterval &outT; - BOOL enable; - SumScopeTimer(NSTimeInterval &outRef, BOOL enable = YES) : outT(outRef), enable(enable) { - if (enable) { - begin = CACurrentMediaTime(); - } - } - ~SumScopeTimer() { - if (enable) { - outT += CACurrentMediaTime() - begin; - } - } - }; -} diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.h b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.h deleted file mode 100644 index efa7808c..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// ASTextDebugOption.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@class ASTextDebugOption; - -NS_ASSUME_NONNULL_BEGIN - -/** - The ASTextDebugTarget protocol defines the method a debug target should implement. - A debug target can be add to the global container to receive the shared debug - option changed notification. - */ -@protocol ASTextDebugTarget - -@required -/** - When the shared debug option changed, this method would be called on main thread. - It should return as quickly as possible. The option's property should not be changed - in this method. - - @param option The shared debug option. - */ -- (void)setDebugOption:(nullable ASTextDebugOption *)option; -@end - - - -/** - The debug option for ASText. - */ -@interface ASTextDebugOption : NSObject -@property (nullable, nonatomic) UIColor *baselineColor; ///< baseline color -@property (nullable, nonatomic) UIColor *CTFrameBorderColor; ///< CTFrame path border color -@property (nullable, nonatomic) UIColor *CTFrameFillColor; ///< CTFrame path fill color -@property (nullable, nonatomic) UIColor *CTLineBorderColor; ///< CTLine bounds border color -@property (nullable, nonatomic) UIColor *CTLineFillColor; ///< CTLine bounds fill color -@property (nullable, nonatomic) UIColor *CTLineNumberColor; ///< CTLine line number color -@property (nullable, nonatomic) UIColor *CTRunBorderColor; ///< CTRun bounds border color -@property (nullable, nonatomic) UIColor *CTRunFillColor; ///< CTRun bounds fill color -@property (nullable, nonatomic) UIColor *CTRunNumberColor; ///< CTRun number color -@property (nullable, nonatomic) UIColor *CGGlyphBorderColor; ///< CGGlyph bounds border color -@property (nullable, nonatomic) UIColor *CGGlyphFillColor; ///< CGGlyph bounds fill color - -- (BOOL)needDrawDebug; ///< `YES`: at least one debug color is visible. `NO`: all debug color is invisible/nil. -- (void)clear; ///< Set all debug color to nil. - -/** - Add a debug target. - - @discussion When `setSharedDebugOption:` is called, all added debug target will - receive `setDebugOption:` in main thread. It maintains an unsafe_unretained - reference to this target. The target must to removed before dealloc. - - @param target A debug target. - */ -+ (void)addDebugTarget:(id)target; - -/** - Remove a debug target which is added by `addDebugTarget:`. - - @param target A debug target. - */ -+ (void)removeDebugTarget:(id)target; - -/** - Returns the shared debug option. - - @return The shared debug option, default is nil. - */ -+ (nullable ASTextDebugOption *)sharedDebugOption; - -/** - Set a debug option as shared debug option. - This method must be called on main thread. - - @discussion When call this method, the new option will set to all debug target - which is added by `addDebugTarget:`. - - @param option A new debug option (nil is valid). - */ -+ (void)setSharedDebugOption:(nullable ASTextDebugOption *)option; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.mm b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.mm deleted file mode 100644 index 2565b903..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextDebugOption.mm +++ /dev/null @@ -1,135 +0,0 @@ -// -// ASTextDebugOption.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTextDebugOption.h" -#import - -static pthread_mutex_t _sharedDebugLock; -static CFMutableSetRef _sharedDebugTargets = nil; -static ASTextDebugOption *_sharedDebugOption = nil; - -static const void* _as_sharedDebugSetRetain(CFAllocatorRef allocator, const void *value) { - return value; -} - -static void _as_sharedDebugSetRelease(CFAllocatorRef allocator, const void *value) { -} - -void _as_sharedDebugSetFunction(const void *value, void *context) { - id target = (__bridge id)(value); - [target setDebugOption:_sharedDebugOption]; -} - -static void _initSharedDebug() { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - pthread_mutex_init(&_sharedDebugLock, NULL); - CFSetCallBacks callbacks = kCFTypeSetCallBacks; - callbacks.retain = _as_sharedDebugSetRetain; - callbacks.release = _as_sharedDebugSetRelease; - _sharedDebugTargets = CFSetCreateMutable(CFAllocatorGetDefault(), 0, &callbacks); - }); -} - -static void _setSharedDebugOption(ASTextDebugOption *option) { - _initSharedDebug(); - pthread_mutex_lock(&_sharedDebugLock); - _sharedDebugOption = option.copy; - CFSetApplyFunction(_sharedDebugTargets, _as_sharedDebugSetFunction, NULL); - pthread_mutex_unlock(&_sharedDebugLock); -} - -static ASTextDebugOption *_getSharedDebugOption() { - _initSharedDebug(); - pthread_mutex_lock(&_sharedDebugLock); - ASTextDebugOption *op = _sharedDebugOption; - pthread_mutex_unlock(&_sharedDebugLock); - return op; -} - -static void _addDebugTarget(id target) { - _initSharedDebug(); - pthread_mutex_lock(&_sharedDebugLock); - CFSetAddValue(_sharedDebugTargets, (__bridge const void *)(target)); - pthread_mutex_unlock(&_sharedDebugLock); -} - -static void _removeDebugTarget(id target) { - _initSharedDebug(); - pthread_mutex_lock(&_sharedDebugLock); - CFSetRemoveValue(_sharedDebugTargets, (__bridge const void *)(target)); - pthread_mutex_unlock(&_sharedDebugLock); -} - - -@implementation ASTextDebugOption - -- (id)copyWithZone:(NSZone *)zone { - ASTextDebugOption *op = [self.class new]; - op.baselineColor = self.baselineColor; - op.CTFrameBorderColor = self.CTFrameBorderColor; - op.CTFrameFillColor = self.CTFrameFillColor; - op.CTLineBorderColor = self.CTLineBorderColor; - op.CTLineFillColor = self.CTLineFillColor; - op.CTLineNumberColor = self.CTLineNumberColor; - op.CTRunBorderColor = self.CTRunBorderColor; - op.CTRunFillColor = self.CTRunFillColor; - op.CTRunNumberColor = self.CTRunNumberColor; - op.CGGlyphBorderColor = self.CGGlyphBorderColor; - op.CGGlyphFillColor = self.CGGlyphFillColor; - return op; -} - -- (BOOL)needDrawDebug { - if (self.baselineColor || - self.CTFrameBorderColor || - self.CTFrameFillColor || - self.CTLineBorderColor || - self.CTLineFillColor || - self.CTLineNumberColor || - self.CTRunBorderColor || - self.CTRunFillColor || - self.CTRunNumberColor || - self.CGGlyphBorderColor || - self.CGGlyphFillColor) return YES; - return NO; -} - -- (void)clear { - self.baselineColor = nil; - self.CTFrameBorderColor = nil; - self.CTFrameFillColor = nil; - self.CTLineBorderColor = nil; - self.CTLineFillColor = nil; - self.CTLineNumberColor = nil; - self.CTRunBorderColor = nil; - self.CTRunFillColor = nil; - self.CTRunNumberColor = nil; - self.CGGlyphBorderColor = nil; - self.CGGlyphFillColor = nil; -} - -+ (void)addDebugTarget:(id)target { - if (target) _addDebugTarget(target); -} - -+ (void)removeDebugTarget:(id)target { - if (target) _removeDebugTarget(target); -} - -+ (ASTextDebugOption *)sharedDebugOption { - return _getSharedDebugOption(); -} - -+ (void)setSharedDebugOption:(ASTextDebugOption *)option { - NSAssert([NSThread isMainThread], @"This method must be called on the main thread"); - _setSharedDebugOption(option); -} - -@end - diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.h b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.h deleted file mode 100644 index 9a6cbd13..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// ASTextInput.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - Text position affinity. For example, the offset appears after the last - character on a line is backward affinity, before the first character on - the following line is forward affinity. - */ -typedef NS_ENUM(NSInteger, ASTextAffinity) { - ASTextAffinityForward = 0, ///< offset appears before the character - ASTextAffinityBackward = 1, ///< offset appears after the character -}; - - -/** - A ASTextPosition object represents a position in a text container; in other words, - it is an index into the backing string in a text-displaying view. - - ASTextPosition has the same API as Apple's implementation in UITextView/UITextField, - so you can alse use it to interact with UITextView/UITextField. - */ -@interface ASTextPosition : UITextPosition - -@property (nonatomic, readonly) NSInteger offset; -@property (nonatomic, readonly) ASTextAffinity affinity; - -+ (instancetype)positionWithOffset:(NSInteger)offset NS_RETURNS_RETAINED; -+ (instancetype)positionWithOffset:(NSInteger)offset affinity:(ASTextAffinity) affinity NS_RETURNS_RETAINED; - -- (NSComparisonResult)compare:(id)otherPosition; - -@end - - -/** - A ASTextRange object represents a range of characters in a text container; in other words, - it identifies a starting index and an ending index in string backing a text-displaying view. - - ASTextRange has the same API as Apple's implementation in UITextView/UITextField, - so you can alse use it to interact with UITextView/UITextField. - */ -@interface ASTextRange : UITextRange - -@property (nonatomic, readonly) ASTextPosition *start; -@property (nonatomic, readonly) ASTextPosition *end; -@property (nonatomic, readonly, getter=isEmpty) BOOL empty; - -+ (instancetype)rangeWithRange:(NSRange)range NS_RETURNS_RETAINED; -+ (instancetype)rangeWithRange:(NSRange)range affinity:(ASTextAffinity) affinity NS_RETURNS_RETAINED; -+ (instancetype)rangeWithStart:(ASTextPosition *)start end:(ASTextPosition *)end NS_RETURNS_RETAINED; -+ (instancetype)defaultRange NS_RETURNS_RETAINED; ///< <{0,0} Forward> - -- (NSRange)asRange; - -@end - - -/** - A ASTextSelectionRect object encapsulates information about a selected range of - text in a text-displaying view. - - ASTextSelectionRect has the same API as Apple's implementation in UITextView/UITextField, - so you can alse use it to interact with UITextView/UITextField. - */ -@interface ASTextSelectionRect : UITextSelectionRect - -@property (nonatomic) CGRect rect; -@property (nonatomic) UITextWritingDirection writingDirection; -@property (nonatomic) BOOL containsStart; -@property (nonatomic) BOOL containsEnd; -@property (nonatomic) BOOL isVertical; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.mm b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.mm deleted file mode 100644 index 1cdfe738..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextInput.mm +++ /dev/null @@ -1,150 +0,0 @@ -// -// ASTextInput.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - - -@implementation ASTextPosition - -+ (instancetype)positionWithOffset:(NSInteger)offset NS_RETURNS_RETAINED { - return [self positionWithOffset:offset affinity:ASTextAffinityForward]; -} - -+ (instancetype)positionWithOffset:(NSInteger)offset affinity:(ASTextAffinity)affinity NS_RETURNS_RETAINED { - ASTextPosition *p = [self new]; - p->_offset = offset; - p->_affinity = affinity; - return p; -} - -- (instancetype)copyWithZone:(NSZone *)zone { - return [self.class positionWithOffset:_offset affinity:_affinity]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p> (%@%@)", self.class, self, @(_offset), _affinity == ASTextAffinityForward ? @"F":@"B"]; -} - -- (NSUInteger)hash { - return _offset * 2 + (_affinity == ASTextAffinityForward ? 1 : 0); -} - -- (BOOL)isEqual:(ASTextPosition *)object { - if (!object) return NO; - return _offset == object.offset && _affinity == object.affinity; -} - -- (NSComparisonResult)compare:(ASTextPosition *)otherPosition { - if (!otherPosition) return NSOrderedAscending; - if (_offset < otherPosition.offset) return NSOrderedAscending; - if (_offset > otherPosition.offset) return NSOrderedDescending; - if (_affinity == ASTextAffinityBackward && otherPosition.affinity == ASTextAffinityForward) return NSOrderedAscending; - if (_affinity == ASTextAffinityForward && otherPosition.affinity == ASTextAffinityBackward) return NSOrderedDescending; - return NSOrderedSame; -} - -@end - - - -@implementation ASTextRange { - ASTextPosition *_start; - ASTextPosition *_end; -} - -- (instancetype)init { - self = [super init]; - if (!self) return nil; - _start = [ASTextPosition positionWithOffset:0]; - _end = [ASTextPosition positionWithOffset:0]; - return self; -} - -- (ASTextPosition *)start { - return _start; -} - -- (ASTextPosition *)end { - return _end; -} - -- (BOOL)isEmpty { - return _start.offset == _end.offset; -} - -- (NSRange)asRange { - return NSMakeRange(_start.offset, _end.offset - _start.offset); -} - -+ (instancetype)rangeWithRange:(NSRange)range NS_RETURNS_RETAINED { - return [self rangeWithRange:range affinity:ASTextAffinityForward]; -} - -+ (instancetype)rangeWithRange:(NSRange)range affinity:(ASTextAffinity)affinity NS_RETURNS_RETAINED { - ASTextPosition *start = [ASTextPosition positionWithOffset:range.location affinity:affinity]; - ASTextPosition *end = [ASTextPosition positionWithOffset:range.location + range.length affinity:affinity]; - return [self rangeWithStart:start end:end]; -} - -+ (instancetype)rangeWithStart:(ASTextPosition *)start end:(ASTextPosition *)end NS_RETURNS_RETAINED { - if (!start || !end) return nil; - if ([start compare:end] == NSOrderedDescending) { - ASTEXT_SWAP(start, end); - } - ASTextRange *range = [ASTextRange new]; - range->_start = start; - range->_end = end; - return range; -} - -+ (instancetype)defaultRange NS_RETURNS_RETAINED { - return [self new]; -} - -- (instancetype)copyWithZone:(NSZone *)zone { - return [self.class rangeWithStart:_start end:_end]; -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p> (%@, %@)%@", self.class, self, @(_start.offset), @(_end.offset - _start.offset), _end.affinity == ASTextAffinityForward ? @"F":@"B"]; -} - -- (NSUInteger)hash { - return (sizeof(NSUInteger) == 8 ? OSSwapInt64(_start.hash) : OSSwapInt32(_start.hash)) + _end.hash; -} - -- (BOOL)isEqual:(ASTextRange *)object { - if (!object) return NO; - return [_start isEqual:object.start] && [_end isEqual:object.end]; -} - -@end - - - -@implementation ASTextSelectionRect - -@synthesize rect = _rect; -@synthesize writingDirection = _writingDirection; -@synthesize containsStart = _containsStart; -@synthesize containsEnd = _containsEnd; -@synthesize isVertical = _isVertical; - -- (id)copyWithZone:(NSZone *)zone { - ASTextSelectionRect *one = [self.class new]; - one.rect = _rect; - one.writingDirection = _writingDirection; - one.containsStart = _containsStart; - one.containsEnd = _containsEnd; - one.isVertical = _isVertical; - return one; -} - -@end diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.h b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.h deleted file mode 100644 index 55ac417f..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.h +++ /dev/null @@ -1,547 +0,0 @@ -// -// ASTextLayout.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import "ASTextDebugOption.h" -#import "ASTextLine.h" -#import "ASTextInput.h" - -@protocol ASTextLinePositionModifier; - -NS_ASSUME_NONNULL_BEGIN - -/** - The max text container size in layout. - */ -ASDK_EXTERN const CGSize ASTextContainerMaxSize; - -/** - The ASTextContainer class defines a region in which text is laid out. - ASTextLayout class uses one or more ASTextContainer objects to generate layouts. - - A ASTextContainer defines rectangular regions (`size` and `insets`) or - nonrectangular shapes (`path`), and you can define exclusion paths inside the - text container's bounding rectangle so that text flows around the exclusion - path as it is laid out. - - All methods in this class is thread-safe. - - Example: - - ┌─────────────────────────────┐ <------- container - │ │ - │ asdfasdfasdfasdfasdfa <------------ container insets - │ asdfasdfa asdfasdfa │ - │ asdfas asdasd │ - │ asdfa <----------------------- container exclusion path - │ asdfas adfasd │ - │ asdfasdfa asdfasdfa │ - │ asdfasdfasdfasdfasdfa │ - │ │ - └─────────────────────────────┘ - */ -@interface ASTextContainer : NSObject - -/// Creates a container with the specified size. @param size The size. -+ (instancetype)containerWithSize:(CGSize)size NS_RETURNS_RETAINED; - -/// Creates a container with the specified size and insets. @param size The size. @param insets The text insets. -+ (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets NS_RETURNS_RETAINED; - -/// Creates a container with the specified path. @param path The path. -+ (instancetype)containerWithPath:(nullable UIBezierPath *)path NS_RETURNS_RETAINED; - -/// Mark this immutable, so you get free copies going forward. -- (void)makeImmutable; - -/// The constrained size. (if the size is larger than ASTextContainerMaxSize, it will be clipped) -@property CGSize size; - -/// The insets for constrained size. The inset value should not be negative. Default is UIEdgeInsetsZero. -@property UIEdgeInsets insets; - -/// Custom constrained path. Set this property to ignore `size` and `insets`. Default is nil. -@property (nullable, copy) UIBezierPath *path; - -/// An array of `UIBezierPath` for path exclusion. Default is nil. -@property (nullable, copy) NSArray *exclusionPaths; - -/// Path line width. Default is 0; -@property CGFloat pathLineWidth; - -/// YES:(PathFillEvenOdd) Text is filled in the area that would be painted if the path were given to CGContextEOFillPath. -/// NO: (PathFillWindingNumber) Text is fill in the area that would be painted if the path were given to CGContextFillPath. -/// Default is YES; -@property (getter=isPathFillEvenOdd) BOOL pathFillEvenOdd; - -/// Whether the text is vertical form (may used for CJK text layout). Default is NO. -@property (getter=isVerticalForm) BOOL verticalForm; - -/// Maximum number of rows, 0 means no limit. Default is 0. -@property NSUInteger maximumNumberOfRows; - -/// The line truncation type, default is none. -@property ASTextTruncationType truncationType; - -/// The truncation token. If nil, the layout will use "…" instead. Default is nil. -@property (nullable, copy) NSAttributedString *truncationToken; - -/// This modifier is applied to the lines before the layout is completed, -/// give you a chance to modify the line position. Default is nil. -@property (nullable, copy) id linePositionModifier; -@end - - -/** - The ASTextLinePositionModifier protocol declares the required method to modify - the line position in text layout progress. See `ASTextLinePositionSimpleModifier` for example. - */ -@protocol ASTextLinePositionModifier -@required -/** - This method will called before layout is completed. The method should be thread-safe. - @param lines An array of ASTextLine. - @param text The full text. - @param container The layout container. - */ -- (void)modifyLines:(NSArray *)lines fromText:(NSAttributedString *)text inContainer:(ASTextContainer *)container; -@end - - -/** - A simple implementation of `ASTextLinePositionModifier`. It can fix each line's position - to a specified value, lets each line of height be the same. - */ -@interface ASTextLinePositionSimpleModifier : NSObject -@property CGFloat fixedLineHeight; ///< The fixed line height (distance between two baseline). -@end - - - -/** - ASTextLayout class is a readonly class stores text layout result. - All the property in this class is readonly, and should not be changed. - The methods in this class is thread-safe (except some of the draw methods). - - example: (layout with a circle exclusion path) - - ┌──────────────────────────┐ <------ container - │ [--------Line0--------] │ <- Row0 - │ [--------Line1--------] │ <- Row1 - │ [-Line2-] [-Line3-] │ <- Row2 - │ [-Line4] [Line5-] │ <- Row3 - │ [-Line6-] [-Line7-] │ <- Row4 - │ [--------Line8--------] │ <- Row5 - │ [--------Line9--------] │ <- Row6 - └──────────────────────────┘ - */ -@interface ASTextLayout : NSObject - - -#pragma mark - Generate text layout -///============================================================================= -/// @name Generate text layout -///============================================================================= - -/** - Generate a layout with the given container size and text. - - @param size The text container's size - @param text The text (if nil, returns nil). - @return A new layout, or nil when an error occurs. - */ -+ (nullable ASTextLayout *)layoutWithContainerSize:(CGSize)size text:(NSAttributedString *)text; - -/** - Generate a layout with the given container and text. - - @param container The text container (if nil, returns nil). - @param text The text (if nil, returns nil). - @return A new layout, or nil when an error occurs. - */ -+ (nullable ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttributedString *)text; - -/** - Generate a layout with the given container and text. - - @param container The text container (if nil, returns nil). - @param text The text (if nil, returns nil). - @param range The text range (if out of range, returns nil). If the - length of the range is 0, it means the length is no limit. - @return A new layout, or nil when an error occurs. - */ -+ (nullable ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttributedString *)text range:(NSRange)range; - -/** - Generate layouts with the given containers and text. - - @param containers An array of ASTextContainer object (if nil, returns nil). - @param text The text (if nil, returns nil). - @return An array of ASTextLayout object (the count is same as containers), - or nil when an error occurs. - */ -+ (nullable NSArray *)layoutWithContainers:(NSArray *)containers - text:(NSAttributedString *)text; - -/** - Generate layouts with the given containers and text. - - @param containers An array of ASTextContainer object (if nil, returns nil). - @param text The text (if nil, returns nil). - @param range The text range (if out of range, returns nil). If the - length of the range is 0, it means the length is no limit. - @return An array of ASTextLayout object (the count is same as containers), - or nil when an error occurs. - */ -+ (nullable NSArray *)layoutWithContainers:(NSArray *)containers - text:(NSAttributedString *)text - range:(NSRange)range; - -- (instancetype)init UNAVAILABLE_ATTRIBUTE; -+ (instancetype)new UNAVAILABLE_ATTRIBUTE; - - -#pragma mark - Text layout attributes -///============================================================================= -/// @name Text layout attributes -///============================================================================= - -///< The text container -@property (nonatomic, readonly) ASTextContainer *container; -///< The full text -@property (nonatomic, readonly) NSAttributedString *text; -///< The text range in full text -@property (nonatomic, readonly) NSRange range; -///< CTFrame -@property (nonatomic, readonly) CTFrameRef frame; -///< Array of `ASTextLine`, no truncated -@property (nonatomic, readonly) NSArray *lines; -///< ASTextLine with truncated token, or nil -@property (nullable, nonatomic, readonly) ASTextLine *truncatedLine; -///< Array of `ASTextAttachment` -@property (nullable, nonatomic, readonly) NSArray *attachments; -///< Array of NSRange(wrapped by NSValue) in text -@property (nullable, nonatomic, readonly) NSArray *attachmentRanges; -///< Array of CGRect(wrapped by NSValue) in container -@property (nullable, nonatomic, readonly) NSArray *attachmentRects; -///< Set of Attachment (UIImage/UIView/CALayer) -@property (nullable, nonatomic, readonly) NSSet *attachmentContentsSet; -///< Number of rows -@property (nonatomic, readonly) NSUInteger rowCount; -///< Visible text range -@property (nonatomic, readonly) NSRange visibleRange; -///< Bounding rect (glyphs) -@property (nonatomic, readonly) CGRect textBoundingRect; -///< Bounding size (glyphs and insets, ceil to pixel) -@property (nonatomic, readonly) CGSize textBoundingSize; -///< Has highlight attribute -@property (nonatomic, readonly) BOOL containsHighlight; -///< Has block border attribute -@property (nonatomic, readonly) BOOL needDrawBlockBorder; -///< Has background border attribute -@property (nonatomic, readonly) BOOL needDrawBackgroundBorder; -///< Has shadow attribute -@property (nonatomic, readonly) BOOL needDrawShadow; -///< Has underline attribute -@property (nonatomic, readonly) BOOL needDrawUnderline; -///< Has visible text -@property (nonatomic, readonly) BOOL needDrawText; -///< Has attachment attribute -@property (nonatomic, readonly) BOOL needDrawAttachment; -///< Has inner shadow attribute -@property (nonatomic, readonly) BOOL needDrawInnerShadow; -///< Has strickthrough attribute -@property (nonatomic, readonly) BOOL needDrawStrikethrough; -///< Has border attribute -@property (nonatomic, readonly) BOOL needDrawBorder; - - -#pragma mark - Query information from text layout -///============================================================================= -/// @name Query information from text layout -///============================================================================= - -/** - The first line index for row. - - @param row A row index. - @return The line index, or NSNotFound if not found. - */ -- (NSUInteger)lineIndexForRow:(NSUInteger)row; - -/** - The number of lines for row. - - @param row A row index. - @return The number of lines, or NSNotFound when an error occurs. - */ -- (NSUInteger)lineCountForRow:(NSUInteger)row; - -/** - The row index for line. - - @param line A row index. - - @return The row index, or NSNotFound if not found. - */ -- (NSUInteger)rowIndexForLine:(NSUInteger)line; - -/** - The line index for a specified point. - - @discussion It returns NSNotFound if there's no text at the point. - - @param point A point in the container. - @return The line index, or NSNotFound if not found. - */ -- (NSUInteger)lineIndexForPoint:(CGPoint)point; - -/** - The line index closest to a specified point. - - @param point A point in the container. - @return The line index, or NSNotFound if no line exist in layout. - */ -- (NSUInteger)closestLineIndexForPoint:(CGPoint)point; - -/** - The offset in container for a text position in a specified line. - - @discussion The offset is the text position's baseline point.x. - If the container is vertical form, the offset is the baseline point.y; - - @param position The text position in string. - @param lineIndex The line index. - @return The offset in container, or CGFLOAT_MAX if not found. - */ -- (CGFloat)offsetForTextPosition:(NSUInteger)position lineIndex:(NSUInteger)lineIndex; - -/** - The text position for a point in a specified line. - - @discussion This method just call CTLineGetStringIndexForPosition() and does - NOT consider the emoji, line break character, binding text... - - @param point A point in the container. - @param lineIndex The line index. - @return The text position, or NSNotFound if not found. - */ -- (NSUInteger)textPositionForPoint:(CGPoint)point lineIndex:(NSUInteger)lineIndex; - -/** - The closest text position to a specified point. - - @discussion This method takes into account the restrict of emoji, line break - character, binding text and text affinity. - - @param point A point in the container. - @return A text position, or nil if not found. - */ -- (nullable ASTextPosition *)closestPositionToPoint:(CGPoint)point; - -/** - Returns the new position when moving selection grabber in text view. - - @discussion There are two grabber in the text selection period, user can only - move one grabber at the same time. - - @param point A point in the container. - @param oldPosition The old text position for the moving grabber. - @param otherPosition The other position in text selection view. - - @return A text position, or nil if not found. - */ -- (nullable ASTextPosition *)positionForPoint:(CGPoint)point - oldPosition:(ASTextPosition *)oldPosition - otherPosition:(ASTextPosition *)otherPosition; - -/** - Returns the character or range of characters that is at a given point in the container. - If there is no text at the point, returns nil. - - @discussion This method takes into account the restrict of emoji, line break - character, binding text and text affinity. - - @param point A point in the container. - @return An object representing a range that encloses a character (or characters) - at point. Or nil if not found. - */ -- (nullable ASTextRange *)textRangeAtPoint:(CGPoint)point; - -/** - Returns the closest character or range of characters that is at a given point in - the container. - - @discussion This method takes into account the restrict of emoji, line break - character, binding text and text affinity. - - @param point A point in the container. - @return An object representing a range that encloses a character (or characters) - at point. Or nil if not found. - */ -- (nullable ASTextRange *)closestTextRangeAtPoint:(CGPoint)point; - -/** - If the position is inside an emoji, composed character sequences, line break '\\r\\n' - or custom binding range, then returns the range by extend the position. Otherwise, - returns a zero length range from the position. - - @param position A text-position object that identifies a location in layout. - - @return A text-range object that extend the position. Or nil if an error occurs - */ -- (nullable ASTextRange *)textRangeByExtendingPosition:(ASTextPosition *)position; - -/** - Returns a text range at a given offset in a specified direction from another - text position to its farthest extent in a certain direction of layout. - - @param position A text-position object that identifies a location in layout. - @param direction A constant that indicates a direction of layout (right, left, up, down). - @param offset A character offset from position. - - @return A text-range object that represents the distance from position to the - farthest extent in direction. Or nil if an error occurs. - */ -- (nullable ASTextRange *)textRangeByExtendingPosition:(ASTextPosition *)position - inDirection:(UITextLayoutDirection)direction - offset:(NSInteger)offset; - -/** - Returns the line index for a given text position. - - @discussion This method takes into account the text affinity. - - @param position A text-position object that identifies a location in layout. - @return The line index, or NSNotFound if not found. - */ -- (NSUInteger)lineIndexForPosition:(ASTextPosition *)position; - -/** - Returns the baseline position for a given text position. - - @param position An object that identifies a location in the layout. - @return The baseline position for text, or CGPointZero if not found. - */ -- (CGPoint)linePositionForPosition:(ASTextPosition *)position; - -/** - Returns a rectangle used to draw the caret at a given insertion point. - - @param position An object that identifies a location in the layout. - @return A rectangle that defines the area for drawing the caret. The width is - always zero in normal container, the height is always zero in vertical form container. - If not found, it returns CGRectNull. - */ -- (CGRect)caretRectForPosition:(ASTextPosition *)position; - -/** - Returns the first rectangle that encloses a range of text in the layout. - - @param range An object that represents a range of text in layout. - - @return The first rectangle in a range of text. You might use this rectangle to - draw a correction rectangle. The "first" in the name refers the rectangle - enclosing the first line when the range encompasses multiple lines of text. - If not found, it returns CGRectNull. - */ -- (CGRect)firstRectForRange:(ASTextRange *)range; - -/** - Returns the rectangle union that encloses a range of text in the layout. - - @param range An object that represents a range of text in layout. - - @return A rectangle that defines the area than encloses the range. - If not found, it returns CGRectNull. - */ -- (CGRect)rectForRange:(ASTextRange *)range; - -/** - Returns an array of selection rects corresponding to the range of text. - The start and end rect can be used to show grabber. - - @param range An object representing a range in text. - @return An array of `ASTextSelectionRect` objects that encompass the selection. - If not found, the array is empty. - */ -- (NSArray *)selectionRectsForRange:(ASTextRange *)range; - -/** - Returns an array of selection rects corresponding to the range of text. - - @param range An object representing a range in text. - @return An array of `ASTextSelectionRect` objects that encompass the selection. - If not found, the array is empty. - */ -- (NSArray *)selectionRectsWithoutStartAndEndForRange:(ASTextRange *)range; - -/** - Returns the start and end selection rects corresponding to the range of text. - The start and end rect can be used to show grabber. - - @param range An object representing a range in text. - @return An array of `ASTextSelectionRect` objects contains the start and end to - the selection. If not found, the array is empty. - */ -- (NSArray *)selectionRectsWithOnlyStartAndEndForRange:(ASTextRange *)range; - - -#pragma mark - Draw text layout -///============================================================================= -/// @name Draw text layout -///============================================================================= - -/** - Draw the layout and show the attachments. - - @discussion If the `view` parameter is not nil, then the attachment views will - add to this `view`, and if the `layer` parameter is not nil, then the attachment - layers will add to this `layer`. - - @warning This method should be called on main thread if `view` or `layer` parameter - is not nil and there's UIView or CALayer attachments in layout. - Otherwise, it can be called on any thread. - - @param context The draw context. Pass nil to avoid text and image drawing. - @param size The context size. - @param point The point at which to draw the layout. - @param view The attachment views will add to this view. - @param layer The attachment layers will add to this layer. - @param debug The debug option. Pass nil to avoid debug drawing. - @param cancel The cancel checker block. It will be called in drawing progress. - If it returns YES, the further draw progress will be canceled. - Pass nil to ignore this feature. - */ -- (void)drawInContext:(nullable CGContextRef)context - size:(CGSize)size - point:(CGPoint)point - view:(nullable UIView *)view - layer:(nullable CALayer *)layer - debug:(nullable ASTextDebugOption *)debug - cancel:(nullable BOOL (^)(void))cancel; - -/** - Draw the layout text and image (without view or layer attachments). - - @discussion This method is thread safe and can be called on any thread. - - @param context The draw context. Pass nil to avoid text and image drawing. - @param size The context size. - @param debug The debug option. Pass nil to avoid debug drawing. - */ -- (void)drawInContext:(nullable CGContextRef)context - size:(CGSize)size - debug:(nullable ASTextDebugOption *)debug; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.mm b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.mm deleted file mode 100644 index f01c2590..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLayout.mm +++ /dev/null @@ -1,3483 +0,0 @@ -// -// ASTextLayout.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import -#import -#import -#import -#import -#import - -const CGSize ASTextContainerMaxSize = (CGSize){0x100000, 0x100000}; - -typedef struct { - CGFloat head; - CGFloat foot; -} ASRowEdge; - -static inline CGSize ASTextClipCGSize(CGSize size) { - if (size.width > ASTextContainerMaxSize.width) size.width = ASTextContainerMaxSize.width; - if (size.height > ASTextContainerMaxSize.height) size.height = ASTextContainerMaxSize.height; - return size; -} - -static inline UIEdgeInsets UIEdgeInsetRotateVertical(UIEdgeInsets insets) { - UIEdgeInsets one; - one.top = insets.left; - one.left = insets.bottom; - one.bottom = insets.right; - one.right = insets.top; - return one; -} - -/** - Sometimes CoreText may convert CGColor to UIColor for `kCTForegroundColorAttributeName` - attribute in iOS7. This should be a bug of CoreText, and may cause crash. Here's a workaround. - */ -static CGColorRef ASTextGetCGColor(CGColorRef color) { - static UIColor *defaultColor; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaultColor = [UIColor blackColor]; - }); - if (!color) return defaultColor.CGColor; - if ([((__bridge NSObject *)color) respondsToSelector:@selector(CGColor)]) { - return ((__bridge UIColor *)color).CGColor; - } - return color; -} - -@implementation ASTextLinePositionSimpleModifier -- (void)modifyLines:(NSArray *)lines fromText:(NSAttributedString *)text inContainer:(ASTextContainer *)container { - if (container.verticalForm) { - for (NSUInteger i = 0, max = lines.count; i < max; i++) { - ASTextLine *line = lines[i]; - CGPoint pos = line.position; - pos.x = container.size.width - container.insets.right - line.row * _fixedLineHeight - _fixedLineHeight * 0.9; - line.position = pos; - } - } else { - for (NSUInteger i = 0, max = lines.count; i < max; i++) { - ASTextLine *line = lines[i]; - CGPoint pos = line.position; - pos.y = line.row * _fixedLineHeight + _fixedLineHeight * 0.9 + container.insets.top; - line.position = pos; - } - } -} - -- (id)copyWithZone:(NSZone *)zone { - ASTextLinePositionSimpleModifier *one = [self.class new]; - one.fixedLineHeight = _fixedLineHeight; - return one; -} -@end - - -@implementation ASTextContainer { - @package - BOOL _readonly; ///< used only in ASTextLayout.implementation - dispatch_semaphore_t _lock; - - CGSize _size; - UIEdgeInsets _insets; - UIBezierPath *_path; - NSArray *_exclusionPaths; - BOOL _pathFillEvenOdd; - CGFloat _pathLineWidth; - BOOL _verticalForm; - NSUInteger _maximumNumberOfRows; - ASTextTruncationType _truncationType; - NSAttributedString *_truncationToken; - id _linePositionModifier; -} - -- (NSString *)description -{ - return [NSString - stringWithFormat:@"immutable: %@, insets: %@, size: %@", self->_readonly ? @"YES" : @"NO", - NSStringFromUIEdgeInsets(self->_insets), NSStringFromCGSize(self->_size)]; -} - -+ (instancetype)containerWithSize:(CGSize)size NS_RETURNS_RETAINED { - return [self containerWithSize:size insets:UIEdgeInsetsZero]; -} - -+ (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets NS_RETURNS_RETAINED { - ASTextContainer *one = [self new]; - one.size = ASTextClipCGSize(size); - one.insets = insets; - return one; -} - -+ (instancetype)containerWithPath:(UIBezierPath *)path NS_RETURNS_RETAINED { - ASTextContainer *one = [self new]; - one.path = path; - return one; -} - -- (instancetype)init { - self = [super init]; - if (!self) return nil; - _lock = dispatch_semaphore_create(1); - _pathFillEvenOdd = YES; - return self; -} - -- (id)copyForced:(BOOL)forceCopy -{ - dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); - if (_readonly && !forceCopy) { - dispatch_semaphore_signal(_lock); - return self; - } - - ASTextContainer *one = [self.class new]; - one->_size = _size; - one->_insets = _insets; - one->_path = _path; - one->_exclusionPaths = [_exclusionPaths copy]; - one->_pathFillEvenOdd = _pathFillEvenOdd; - one->_pathLineWidth = _pathLineWidth; - one->_verticalForm = _verticalForm; - one->_maximumNumberOfRows = _maximumNumberOfRows; - one->_truncationType = _truncationType; - one->_truncationToken = [_truncationToken copy]; - one->_linePositionModifier = [(NSObject *)_linePositionModifier copy]; - dispatch_semaphore_signal(_lock); - return one; -} - -- (id)copyWithZone:(NSZone *)zone { - return [self copyForced:NO]; -} - -- (id)mutableCopyWithZone:(NSZone *)zone { - return [self copyForced:YES]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:[NSValue valueWithCGSize:_size] forKey:@"size"]; - [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:_insets] forKey:@"insets"]; - [aCoder encodeObject:_path forKey:@"path"]; - [aCoder encodeObject:_exclusionPaths forKey:@"exclusionPaths"]; - [aCoder encodeBool:_pathFillEvenOdd forKey:@"pathFillEvenOdd"]; - [aCoder encodeDouble:_pathLineWidth forKey:@"pathLineWidth"]; - [aCoder encodeBool:_verticalForm forKey:@"verticalForm"]; - [aCoder encodeInteger:_maximumNumberOfRows forKey:@"maximumNumberOfRows"]; - [aCoder encodeInteger:_truncationType forKey:@"truncationType"]; - [aCoder encodeObject:_truncationToken forKey:@"truncationToken"]; - if ([_linePositionModifier respondsToSelector:@selector(encodeWithCoder:)] && - [_linePositionModifier respondsToSelector:@selector(initWithCoder:)]) { - [aCoder encodeObject:_linePositionModifier forKey:@"linePositionModifier"]; - } -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [self init]; - _size = ((NSValue *)[aDecoder decodeObjectForKey:@"size"]).CGSizeValue; - _insets = ((NSValue *)[aDecoder decodeObjectForKey:@"insets"]).UIEdgeInsetsValue; - _path = [aDecoder decodeObjectForKey:@"path"]; - _exclusionPaths = [aDecoder decodeObjectForKey:@"exclusionPaths"]; - _pathFillEvenOdd = [aDecoder decodeBoolForKey:@"pathFillEvenOdd"]; - _pathLineWidth = [aDecoder decodeDoubleForKey:@"pathLineWidth"]; - _verticalForm = [aDecoder decodeBoolForKey:@"verticalForm"]; - _maximumNumberOfRows = [aDecoder decodeIntegerForKey:@"maximumNumberOfRows"]; - _truncationType = (ASTextTruncationType)[aDecoder decodeIntegerForKey:@"truncationType"]; - _truncationToken = [aDecoder decodeObjectForKey:@"truncationToken"]; - _linePositionModifier = [aDecoder decodeObjectForKey:@"linePositionModifier"]; - return self; -} - -- (void)makeImmutable -{ - dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); - _readonly = YES; - dispatch_semaphore_signal(_lock); -} - -#define Getter(...) \ -dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \ -__VA_ARGS__; \ -dispatch_semaphore_signal(_lock); - -#define Setter(...) \ -dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \ -if (__builtin_expect(_readonly, NO)) { \ - ASDisplayNodeFailAssert(@"Attempt to modify immutable text container."); \ - dispatch_semaphore_signal(_lock); \ - return; \ -} \ -__VA_ARGS__; \ -dispatch_semaphore_signal(_lock); - -- (CGSize)size { - Getter(CGSize size = _size) return size; -} - -- (void)setSize:(CGSize)size { - Setter(if(!_path) _size = ASTextClipCGSize(size)); -} - -- (UIEdgeInsets)insets { - Getter(UIEdgeInsets insets = _insets) return insets; -} - -- (void)setInsets:(UIEdgeInsets)insets { - Setter(if(!_path){ - if (insets.top < 0) insets.top = 0; - if (insets.left < 0) insets.left = 0; - if (insets.bottom < 0) insets.bottom = 0; - if (insets.right < 0) insets.right = 0; - _insets = insets; - }); -} - -- (UIBezierPath *)path { - Getter(UIBezierPath *path = _path) return path; -} - -- (void)setPath:(UIBezierPath *)path { - Setter( - _path = path.copy; - if (_path) { - CGRect bounds = _path.bounds; - CGSize size = bounds.size; - UIEdgeInsets insets = UIEdgeInsetsZero; - if (bounds.origin.x < 0) size.width += bounds.origin.x; - if (bounds.origin.x > 0) insets.left = bounds.origin.x; - if (bounds.origin.y < 0) size.height += bounds.origin.y; - if (bounds.origin.y > 0) insets.top = bounds.origin.y; - _size = size; - _insets = insets; - } - ); -} - -- (NSArray *)exclusionPaths { - Getter(NSArray *paths = _exclusionPaths) return paths; -} - -- (void)setExclusionPaths:(NSArray *)exclusionPaths { - Setter(_exclusionPaths = exclusionPaths.copy); -} - -- (BOOL)isPathFillEvenOdd { - Getter(BOOL is = _pathFillEvenOdd) return is; -} - -- (void)setPathFillEvenOdd:(BOOL)pathFillEvenOdd { - Setter(_pathFillEvenOdd = pathFillEvenOdd); -} - -- (CGFloat)pathLineWidth { - Getter(CGFloat width = _pathLineWidth) return width; -} - -- (void)setPathLineWidth:(CGFloat)pathLineWidth { - Setter(_pathLineWidth = pathLineWidth); -} - -- (BOOL)isVerticalForm { - Getter(BOOL v = _verticalForm) return v; -} - -- (void)setVerticalForm:(BOOL)verticalForm { - Setter(_verticalForm = verticalForm); -} - -- (NSUInteger)maximumNumberOfRows { - Getter(NSUInteger num = _maximumNumberOfRows) return num; -} - -- (void)setMaximumNumberOfRows:(NSUInteger)maximumNumberOfRows { - Setter(_maximumNumberOfRows = maximumNumberOfRows); -} - -- (ASTextTruncationType)truncationType { - Getter(ASTextTruncationType type = _truncationType) return type; -} - -- (void)setTruncationType:(ASTextTruncationType)truncationType { - Setter(_truncationType = truncationType); -} - -- (NSAttributedString *)truncationToken { - Getter(NSAttributedString *token = _truncationToken) return token; -} - -- (void)setTruncationToken:(NSAttributedString *)truncationToken { - Setter(_truncationToken = truncationToken.copy); -} - -- (void)setLinePositionModifier:(id)linePositionModifier { - Setter(_linePositionModifier = [(NSObject *)linePositionModifier copy]); -} - -- (id)linePositionModifier { - Getter(id m = _linePositionModifier) return m; -} - -#undef Getter -#undef Setter -@end - - - - -@interface ASTextLayout () - -@property (nonatomic) ASTextContainer *container; -@property (nonatomic) NSAttributedString *text; -@property (nonatomic) NSRange range; - -@property (nonatomic) CTFrameRef frame; -@property (nonatomic) NSArray *lines; -@property (nonatomic) ASTextLine *truncatedLine; -@property (nonatomic) NSArray *attachments; -@property (nonatomic) NSArray *attachmentRanges; -@property (nonatomic) NSArray *attachmentRects; -@property (nonatomic) NSSet *attachmentContentsSet; -@property (nonatomic) NSUInteger rowCount; -@property (nonatomic) NSRange visibleRange; -@property (nonatomic) CGRect textBoundingRect; -@property (nonatomic) CGSize textBoundingSize; - -@property (nonatomic) BOOL containsHighlight; -@property (nonatomic) BOOL needDrawBlockBorder; -@property (nonatomic) BOOL needDrawBackgroundBorder; -@property (nonatomic) BOOL needDrawShadow; -@property (nonatomic) BOOL needDrawUnderline; -@property (nonatomic) BOOL needDrawText; -@property (nonatomic) BOOL needDrawAttachment; -@property (nonatomic) BOOL needDrawInnerShadow; -@property (nonatomic) BOOL needDrawStrikethrough; -@property (nonatomic) BOOL needDrawBorder; - -@property (nonatomic) NSUInteger *lineRowsIndex; -@property (nonatomic) ASRowEdge *lineRowsEdge; ///< top-left origin - -@end - - - -@implementation ASTextLayout - -#pragma mark - Layout - -- (instancetype)_init { - self = [super init]; - return self; -} - -- (NSString *)description -{ - return [NSString stringWithFormat:@"lines: %ld, visibleRange:%@, textBoundingRect:%@", - (long)[self.lines count], - NSStringFromRange(self.visibleRange), - NSStringFromCGRect(self.textBoundingRect)]; -} - -+ (ASTextLayout *)layoutWithContainerSize:(CGSize)size text:(NSAttributedString *)text { - ASTextContainer *container = [ASTextContainer containerWithSize:size]; - return [self layoutWithContainer:container text:text]; -} - -+ (ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttributedString *)text { - return [self layoutWithContainer:container text:text range:NSMakeRange(0, text.length)]; -} - -+ (ASTextLayout *)layoutWithContainer:(ASTextContainer *)container text:(NSAttributedString *)text range:(NSRange)range { - ASTextLayout *layout = NULL; - CGPathRef cgPath = nil; - CGRect cgPathBox = {0}; - BOOL isVerticalForm = NO; - BOOL rowMaySeparated = NO; - NSMutableDictionary *frameAttrs = nil; - CTFramesetterRef ctSetter = NULL; - CTFrameRef ctFrame = NULL; - CFArrayRef ctLines = nil; - CGPoint *lineOrigins = NULL; - NSUInteger lineCount = 0; - NSMutableArray *lines = nil; - NSMutableArray *attachments = nil; - NSMutableArray *attachmentRanges = nil; - NSMutableArray *attachmentRects = nil; - NSMutableSet *attachmentContentsSet = nil; - BOOL needTruncation = NO; - NSAttributedString *truncationToken = nil; - ASTextLine *truncatedLine = nil; - ASRowEdge *lineRowsEdge = NULL; - NSUInteger *lineRowsIndex = NULL; - NSRange visibleRange; - NSUInteger maximumNumberOfRows = 0; - BOOL constraintSizeIsExtended = NO; - CGRect constraintRectBeforeExtended = {0}; -#define FAIL_AND_RETURN {\ - if (cgPath) CFRelease(cgPath); \ - if (ctSetter) CFRelease(ctSetter); \ - if (ctFrame) CFRelease(ctFrame); \ - if (lineOrigins) free(lineOrigins); \ - if (lineRowsEdge) free(lineRowsEdge); \ - if (lineRowsIndex) free(lineRowsIndex); \ - return nil; } - - container = [container copy]; - if (!text || !container) return nil; - if (range.location + range.length > text.length) return nil; - [container makeImmutable]; - maximumNumberOfRows = container.maximumNumberOfRows; - - // It may use larger constraint size when create CTFrame with - // CTFramesetterCreateFrame in iOS 10. - BOOL needFixLayoutSizeBug = AS_AT_LEAST_IOS10; - - layout = [[ASTextLayout alloc] _init]; - layout.text = text; - layout.container = container; - layout.range = range; - isVerticalForm = container.verticalForm; - - // set cgPath and cgPathBox - if (container.path == nil && container.exclusionPaths.count == 0) { - if (container.size.width <= 0 || container.size.height <= 0) FAIL_AND_RETURN - CGRect rect = (CGRect) {CGPointZero, container.size }; - if (needFixLayoutSizeBug) { - constraintSizeIsExtended = YES; - constraintRectBeforeExtended = UIEdgeInsetsInsetRect(rect, container.insets); - constraintRectBeforeExtended = CGRectStandardize(constraintRectBeforeExtended); - if (container.isVerticalForm) { - rect.size.width = ASTextContainerMaxSize.width; - } else { - rect.size.height = ASTextContainerMaxSize.height; - } - } - rect = UIEdgeInsetsInsetRect(rect, container.insets); - rect = CGRectStandardize(rect); - cgPathBox = rect; - rect = CGRectApplyAffineTransform(rect, CGAffineTransformMakeScale(1, -1)); - cgPath = CGPathCreateWithRect(rect, NULL); // let CGPathIsRect() returns true - } else if (container.path && CGPathIsRect(container.path.CGPath, &cgPathBox) && container.exclusionPaths.count == 0) { - CGRect rect = CGRectApplyAffineTransform(cgPathBox, CGAffineTransformMakeScale(1, -1)); - cgPath = CGPathCreateWithRect(rect, NULL); // let CGPathIsRect() returns true - } else { - rowMaySeparated = YES; - CGMutablePathRef path = NULL; - if (container.path) { - path = CGPathCreateMutableCopy(container.path.CGPath); - } else { - CGRect rect = (CGRect) {CGPointZero, container.size }; - rect = UIEdgeInsetsInsetRect(rect, container.insets); - CGPathRef rectPath = CGPathCreateWithRect(rect, NULL); - if (rectPath) { - path = CGPathCreateMutableCopy(rectPath); - CGPathRelease(rectPath); - } - } - if (path) { - [layout.container.exclusionPaths enumerateObjectsUsingBlock: ^(UIBezierPath *onePath, NSUInteger idx, BOOL *stop) { - CGPathAddPath(path, NULL, onePath.CGPath); - }]; - - cgPathBox = CGPathGetPathBoundingBox(path); - CGAffineTransform trans = CGAffineTransformMakeScale(1, -1); - CGMutablePathRef transPath = CGPathCreateMutableCopyByTransformingPath(path, &trans); - CGPathRelease(path); - path = transPath; - } - cgPath = path; - } - if (!cgPath) FAIL_AND_RETURN - - // frame setter config - frameAttrs = [[NSMutableDictionary alloc] init]; - if (container.isPathFillEvenOdd == NO) { - frameAttrs[(id)kCTFramePathFillRuleAttributeName] = @(kCTFramePathFillWindingNumber); - } - if (container.pathLineWidth > 0) { - frameAttrs[(id)kCTFramePathWidthAttributeName] = @(container.pathLineWidth); - } - if (container.isVerticalForm == YES) { - frameAttrs[(id)kCTFrameProgressionAttributeName] = @(kCTFrameProgressionRightToLeft); - } - - /* - * Framesetter cache. - * Framesetters can only be used by one thread at a time. - * Create a CFSet with no callbacks (raw pointers) to keep track of which - * framesetters are in use on other threads. If the one for our string is already in use, - * just create a new one. This should be pretty rare. - */ - static pthread_mutex_t busyFramesettersLock = PTHREAD_MUTEX_INITIALIZER; - static NSCache *framesetterCache; - static CFMutableSetRef busyFramesetters; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if (ASActivateExperimentalFeature(ASExperimentalFramesetterCache)) { - framesetterCache = [[NSCache alloc] init]; - framesetterCache.name = @"org.TextureGroup.Texture.framesetterCache"; - busyFramesetters = CFSetCreateMutable(NULL, 0, NULL); - } - }); - - BOOL haveCached = NO, useCached = NO; - if (framesetterCache) { - // Check if there's one in the cache. - ctSetter = (__bridge_retained CTFramesetterRef)[framesetterCache objectForKey:text]; - - if (ctSetter) { - haveCached = YES; - - // Check-and-set busy on the cached one. - pthread_mutex_lock(&busyFramesettersLock); - BOOL busy = CFSetContainsValue(busyFramesetters, ctSetter); - if (!busy) { - CFSetAddValue(busyFramesetters, ctSetter); - useCached = YES; - } - pthread_mutex_unlock(&busyFramesettersLock); - - // Release if it was busy. - if (busy) { - CFRelease(ctSetter); - ctSetter = NULL; - } - } - } - - // Create a framesetter if needed. - if (!ctSetter) { - ctSetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)text); - } - - if (!ctSetter) FAIL_AND_RETURN - ctFrame = CTFramesetterCreateFrame(ctSetter, ASTextCFRangeFromNSRange(range), cgPath, (CFDictionaryRef)frameAttrs); - - // Return to cache. - if (framesetterCache) { - if (useCached) { - // If reused: mark available. - pthread_mutex_lock(&busyFramesettersLock); - CFSetRemoveValue(busyFramesetters, ctSetter); - pthread_mutex_unlock(&busyFramesettersLock); - } else if (!haveCached) { - // If first framesetter, add to cache. - [framesetterCache setObject:(__bridge id)ctSetter forKey:text]; - } - } - - if (!ctFrame) FAIL_AND_RETURN - lines = [NSMutableArray new]; - ctLines = CTFrameGetLines(ctFrame); - lineCount = CFArrayGetCount(ctLines); - if (lineCount > 0) { - lineOrigins = (CGPoint *)malloc(lineCount * sizeof(CGPoint)); - if (lineOrigins == NULL) FAIL_AND_RETURN - CTFrameGetLineOrigins(ctFrame, CFRangeMake(0, lineCount), lineOrigins); - } - - CGRect textBoundingRect = CGRectZero; - CGSize textBoundingSize = CGSizeZero; - NSInteger rowIdx = -1; - NSUInteger rowCount = 0; - CGRect lastRect = CGRectMake(0, -FLT_MAX, 0, 0); - CGPoint lastPosition = CGPointMake(0, -FLT_MAX); - if (isVerticalForm) { - lastRect = CGRectMake(FLT_MAX, 0, 0, 0); - lastPosition = CGPointMake(FLT_MAX, 0); - } - - // calculate line frame - NSUInteger lineCurrentIdx = 0; - BOOL measuringBeyondConstraints = NO; - for (NSUInteger i = 0; i < lineCount; i++) { - CTLineRef ctLine = (CTLineRef)CFArrayGetValueAtIndex(ctLines, i); - CFArrayRef ctRuns = CTLineGetGlyphRuns(ctLine); - if (!ctRuns || CFArrayGetCount(ctRuns) == 0) continue; - - // CoreText coordinate system - CGPoint ctLineOrigin = lineOrigins[i]; - - // UIKit coordinate system - CGPoint position; - position.x = cgPathBox.origin.x + ctLineOrigin.x; - position.y = cgPathBox.size.height + cgPathBox.origin.y - ctLineOrigin.y; - - ASTextLine *line = [ASTextLine lineWithCTLine:ctLine position:position vertical:isVerticalForm]; - - [lines addObject:line]; - } - - // Give user a chance to modify the line's position. - [container.linePositionModifier modifyLines:lines fromText:text inContainer:container]; - - BOOL first = YES; - for (ASTextLine *line in lines) { - CGPoint position = line.position; - CGRect rect = line.bounds; - if (constraintSizeIsExtended) { - if (isVerticalForm) { - if (rect.origin.x + rect.size.width > - constraintRectBeforeExtended.origin.x + - constraintRectBeforeExtended.size.width) { - measuringBeyondConstraints = YES; - } - } else { - if (rect.origin.y + rect.size.height > - constraintRectBeforeExtended.origin.y + - constraintRectBeforeExtended.size.height) { - measuringBeyondConstraints = YES; - } - } - } - - BOOL newRow = !measuringBeyondConstraints; - if (newRow && rowMaySeparated && position.x != lastPosition.x) { - if (isVerticalForm) { - if (rect.size.width > lastRect.size.width) { - if (rect.origin.x > lastPosition.x && lastPosition.x > rect.origin.x - rect.size.width) newRow = NO; - } else { - if (lastRect.origin.x > position.x && position.x > lastRect.origin.x - lastRect.size.width) newRow = NO; - } - } else { - if (rect.size.height > lastRect.size.height) { - if (rect.origin.y < lastPosition.y && lastPosition.y < rect.origin.y + rect.size.height) newRow = NO; - } else { - if (lastRect.origin.y < position.y && position.y < lastRect.origin.y + lastRect.size.height) newRow = NO; - } - } - } - - if (newRow) rowIdx++; - lastRect = rect; - lastPosition = position; - - line.index = lineCurrentIdx; - line.row = rowIdx; - - rowCount = rowIdx + 1; - lineCurrentIdx ++; - - if (first) { - first = NO; - textBoundingRect = rect; - } else if (!measuringBeyondConstraints) { - if (maximumNumberOfRows == 0 || rowIdx < maximumNumberOfRows) { - textBoundingRect = CGRectUnion(textBoundingRect, rect); - } - } - } - - { - NSMutableArray *removedLines = [NSMutableArray new]; - if (rowCount > 0) { - if (maximumNumberOfRows > 0) { - if (rowCount > maximumNumberOfRows) { - needTruncation = YES; - rowCount = maximumNumberOfRows; - do { - ASTextLine *line = lines.lastObject; - if (!line) break; - if (line.row < rowCount) break; // we have removed down to an allowed # of lines now - [lines removeLastObject]; - [removedLines addObject:line]; - } while (1); - } - } - ASTextLine *lastLine = rowCount < lines.count ? lines[rowCount - 1] : lines.lastObject; - if (!needTruncation && lastLine.range.location + lastLine.range.length < text.length) { - needTruncation = YES; - while (lines.count > rowCount) { - ASTextLine *line = lines.lastObject; - [lines removeLastObject]; - [removedLines addObject:line]; - } - } - - lineRowsEdge = (ASRowEdge *) calloc(rowCount, sizeof(ASRowEdge)); - if (lineRowsEdge == NULL) FAIL_AND_RETURN - lineRowsIndex = (NSUInteger *) calloc(rowCount, sizeof(NSUInteger)); - if (lineRowsIndex == NULL) FAIL_AND_RETURN - NSInteger lastRowIdx = -1; - CGFloat lastHead = 0; - CGFloat lastFoot = 0; - for (NSUInteger i = 0, max = lines.count; i < max; i++) { - ASTextLine *line = lines[i]; - CGRect rect = line.bounds; - if ((NSInteger) line.row != lastRowIdx) { - if (lastRowIdx >= 0) { - lineRowsEdge[lastRowIdx] = (ASRowEdge) {.head = lastHead, .foot = lastFoot}; - } - lastRowIdx = line.row; - lineRowsIndex[lastRowIdx] = i; - if (isVerticalForm) { - lastHead = rect.origin.x + rect.size.width; - lastFoot = lastHead - rect.size.width; - } else { - lastHead = rect.origin.y; - lastFoot = lastHead + rect.size.height; - } - } else { - if (isVerticalForm) { - lastHead = MAX(lastHead, rect.origin.x + rect.size.width); - lastFoot = MIN(lastFoot, rect.origin.x); - } else { - lastHead = MIN(lastHead, rect.origin.y); - lastFoot = MAX(lastFoot, rect.origin.y + rect.size.height); - } - } - } - lineRowsEdge[lastRowIdx] = (ASRowEdge) {.head = lastHead, .foot = lastFoot}; - - for (NSUInteger i = 1; i < rowCount; i++) { - ASRowEdge v0 = lineRowsEdge[i - 1]; - ASRowEdge v1 = lineRowsEdge[i]; - lineRowsEdge[i - 1].foot = lineRowsEdge[i].head = (v0.foot + v1.head) * 0.5; - } - } - - { // calculate bounding size - CGRect rect = textBoundingRect; - if (container.path) { - if (container.pathLineWidth > 0) { - CGFloat inset = container.pathLineWidth / 2; - rect = CGRectInset(rect, -inset, -inset); - } - } else { - rect = UIEdgeInsetsInsetRect(rect, ASTextUIEdgeInsetsInvert(container.insets)); - } - rect = CGRectStandardize(rect); - CGSize size = rect.size; - if (container.verticalForm) { - size.width += container.size.width - (rect.origin.x + rect.size.width); - } else { - size.width += rect.origin.x; - } - size.height += rect.origin.y; - if (size.width < 0) size.width = 0; - if (size.height < 0) size.height = 0; - size.width = ceil(size.width); - size.height = ceil(size.height); - textBoundingSize = size; - } - - visibleRange = ASTextNSRangeFromCFRange(CTFrameGetVisibleStringRange(ctFrame)); - if (needTruncation) { - ASTextLine *lastLine = lines.lastObject; - NSRange lastRange = lastLine.range; - visibleRange.length = lastRange.location + lastRange.length - visibleRange.location; - - // create truncated line - if (container.truncationType != ASTextTruncationTypeNone) { - CTLineRef truncationTokenLine = NULL; - if (container.truncationToken) { - truncationToken = container.truncationToken; - truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef) truncationToken); - } else { - CFArrayRef runs = CTLineGetGlyphRuns(lastLine.CTLine); - NSUInteger runCount = CFArrayGetCount(runs); - NSMutableDictionary *attrs = nil; - if (runCount > 0) { - CTRunRef run = (CTRunRef) CFArrayGetValueAtIndex(runs, runCount - 1); - attrs = (id) CTRunGetAttributes(run); - attrs = attrs ? attrs.mutableCopy : [NSMutableArray new]; - [attrs removeObjectsForKeys:[NSMutableAttributedString as_allDiscontinuousAttributeKeys]]; - CTFontRef font = (__bridge CTFontRef) attrs[(id) kCTFontAttributeName]; - CGFloat fontSize = font ? CTFontGetSize(font) : 12.0; - UIFont *uiFont = [UIFont systemFontOfSize:fontSize * 0.9]; - if (uiFont) { - font = CTFontCreateWithName((__bridge CFStringRef) uiFont.fontName, uiFont.pointSize, NULL); - } else { - font = NULL; - } - if (font) { - attrs[(id) kCTFontAttributeName] = (__bridge id) (font); - uiFont = nil; - CFRelease(font); - } - CGColorRef color = (__bridge CGColorRef) (attrs[(id) kCTForegroundColorAttributeName]); - if (color && CFGetTypeID(color) == CGColorGetTypeID() && CGColorGetAlpha(color) == 0) { - // ignore clear color - [attrs removeObjectForKey:(id) kCTForegroundColorAttributeName]; - } - if (!attrs) attrs = [NSMutableDictionary new]; - } - truncationToken = [[NSAttributedString alloc] initWithString:ASTextTruncationToken attributes:attrs]; - truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef) truncationToken); - } - if (truncationTokenLine) { - CTLineTruncationType type = kCTLineTruncationEnd; - if (container.truncationType == ASTextTruncationTypeStart) { - type = kCTLineTruncationStart; - } else if (container.truncationType == ASTextTruncationTypeMiddle) { - type = kCTLineTruncationMiddle; - } - NSMutableAttributedString *lastLineText = [text attributedSubstringFromRange:lastLine.range].mutableCopy; - CGFloat truncatedWidth = lastLine.width; - CGFloat atLeastOneLine = lastLine.width; - CGRect cgPathRect = CGRectZero; - if (CGPathIsRect(cgPath, &cgPathRect)) { - if (isVerticalForm) { - truncatedWidth = cgPathRect.size.height; - } else { - truncatedWidth = cgPathRect.size.width; - } - } - int i = 0; - if (type != kCTLineTruncationStart) { // Middle or End/Tail wants to collect some text (at least one line's - // worth) preceding the truncated content, with which to construct a "truncated line". - i = (int)removedLines.count - 1; - while (atLeastOneLine < truncatedWidth && i >= 0) { - if (lastLineText.length > 0 && [lastLineText.string characterAtIndex:lastLineText.string.length - 1] == '\n') { // Explicit newlines are always "long enough". - [lastLineText deleteCharactersInRange:NSMakeRange(lastLineText.string.length - 1, 1)]; - break; - } - [lastLineText appendAttributedString:[text attributedSubstringFromRange:removedLines[i].range]]; - atLeastOneLine += removedLines[i--].width; - } - [lastLineText appendAttributedString:truncationToken]; - } - if (type != kCTLineTruncationEnd && removedLines.count > 0) { // Middle or Start/Head wants to collect some - // text following the truncated content. - i = 0; - atLeastOneLine = removedLines[i].width; - while (atLeastOneLine < truncatedWidth && i < removedLines.count) { - atLeastOneLine += removedLines[i++].width; - } - for (i--; i >= 0; i--) { - NSAttributedString *nextLine = [text attributedSubstringFromRange:removedLines[i].range]; - if ([nextLine.string characterAtIndex:nextLine.string.length - 1] == '\n') { // Explicit newlines are always "long enough". - lastLineText = [NSMutableAttributedString new]; - } else { - [lastLineText appendAttributedString:nextLine]; - } - } - if (type == kCTLineTruncationStart) { - [lastLineText insertAttributedString:truncationToken atIndex:0]; - } - } - - CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((CFAttributedStringRef) lastLineText); - if (ctLastLineExtend) { - CTLineRef ctTruncatedLine = CTLineCreateTruncatedLine(ctLastLineExtend, truncatedWidth, type, truncationTokenLine); - CFRelease(ctLastLineExtend); - if (ctTruncatedLine) { - truncatedLine = [ASTextLine lineWithCTLine:ctTruncatedLine position:lastLine.position vertical:isVerticalForm]; - truncatedLine.index = lastLine.index; - truncatedLine.row = lastLine.row; - CFRelease(ctTruncatedLine); - } - } - CFRelease(truncationTokenLine); - } - } - } - } - - if (isVerticalForm) { - NSCharacterSet *rotateCharset = ASTextVerticalFormRotateCharacterSet(); - NSCharacterSet *rotateMoveCharset = ASTextVerticalFormRotateAndMoveCharacterSet(); - - void (^lineBlock)(ASTextLine *) = ^(ASTextLine *line){ - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - if (!runs) return; - NSUInteger runCount = CFArrayGetCount(runs); - if (runCount == 0) return; - NSMutableArray *lineRunRanges = [NSMutableArray new]; - line.verticalRotateRange = lineRunRanges; - for (NSUInteger r = 0; r < runCount; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - NSMutableArray *runRanges = [NSMutableArray new]; - [lineRunRanges addObject:runRanges]; - NSUInteger glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - - CFIndex runStrIdx[glyphCount + 1]; - CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx); - CFRange runStrRange = CTRunGetStringRange(run); - runStrIdx[glyphCount] = runStrRange.location + runStrRange.length; - CFDictionaryRef runAttrs = CTRunGetAttributes(run); - CTFontRef font = (CTFontRef)CFDictionaryGetValue(runAttrs, kCTFontAttributeName); - BOOL isColorGlyph = ASTextCTFontContainsColorBitmapGlyphs(font); - - NSUInteger prevIdx = 0; - ASTextRunGlyphDrawMode prevMode = ASTextRunGlyphDrawModeHorizontal; - NSString *layoutStr = layout.text.string; - for (NSUInteger g = 0; g < glyphCount; g++) { - BOOL glyphRotate = 0, glyphRotateMove = NO; - CFIndex runStrLen = runStrIdx[g + 1] - runStrIdx[g]; - if (isColorGlyph) { - glyphRotate = YES; - } else if (runStrLen == 1) { - unichar c = [layoutStr characterAtIndex:runStrIdx[g]]; - glyphRotate = [rotateCharset characterIsMember:c]; - if (glyphRotate) glyphRotateMove = [rotateMoveCharset characterIsMember:c]; - } else if (runStrLen > 1){ - NSString *glyphStr = [layoutStr substringWithRange:NSMakeRange(runStrIdx[g], runStrLen)]; - BOOL glyphRotate = [glyphStr rangeOfCharacterFromSet:rotateCharset].location != NSNotFound; - if (glyphRotate) glyphRotateMove = [glyphStr rangeOfCharacterFromSet:rotateMoveCharset].location != NSNotFound; - } - - ASTextRunGlyphDrawMode mode = glyphRotateMove ? ASTextRunGlyphDrawModeVerticalRotateMove : (glyphRotate ? ASTextRunGlyphDrawModeVerticalRotate : ASTextRunGlyphDrawModeHorizontal); - if (g == 0) { - prevMode = mode; - } else if (mode != prevMode) { - ASTextRunGlyphRange *aRange = [ASTextRunGlyphRange rangeWithRange:NSMakeRange(prevIdx, g - prevIdx) drawMode:prevMode]; - [runRanges addObject:aRange]; - prevIdx = g; - prevMode = mode; - } - } - if (prevIdx < glyphCount) { - ASTextRunGlyphRange *aRange = [ASTextRunGlyphRange rangeWithRange:NSMakeRange(prevIdx, glyphCount - prevIdx) drawMode:prevMode]; - [runRanges addObject:aRange]; - } - - } - }; - for (ASTextLine *line in lines) { - lineBlock(line); - } - if (truncatedLine) lineBlock(truncatedLine); - } - - if (visibleRange.length > 0) { - layout.needDrawText = YES; - - void (^block)(NSDictionary *attrs, NSRange range, BOOL *stop) = ^(NSDictionary *attrs, NSRange range, BOOL *stop) { - if (attrs[ASTextHighlightAttributeName]) layout.containsHighlight = YES; - if (attrs[ASTextBlockBorderAttributeName]) layout.needDrawBlockBorder = YES; - if (attrs[ASTextBackgroundBorderAttributeName]) layout.needDrawBackgroundBorder = YES; - if (attrs[ASTextShadowAttributeName] || attrs[NSShadowAttributeName]) layout.needDrawShadow = YES; - if (attrs[ASTextUnderlineAttributeName]) layout.needDrawUnderline = YES; - if (attrs[ASTextAttachmentAttributeName]) layout.needDrawAttachment = YES; - if (attrs[ASTextInnerShadowAttributeName]) layout.needDrawInnerShadow = YES; - if (attrs[ASTextStrikethroughAttributeName]) layout.needDrawStrikethrough = YES; - if (attrs[ASTextBorderAttributeName]) layout.needDrawBorder = YES; - }; - - [layout.text enumerateAttributesInRange:visibleRange options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:block]; - if (truncatedLine) { - [truncationToken enumerateAttributesInRange:NSMakeRange(0, truncationToken.length) options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:block]; - } - } - for (NSUInteger i = 0, max = lines.count; i < max; i++) { - ASTextLine *line = lines[i]; - if (truncatedLine && line.index == truncatedLine.index) line = truncatedLine; - if (line.attachments.count > 0) { - if (!attachments) { - attachments = [[NSMutableArray alloc] init]; - attachmentRanges = [[NSMutableArray alloc] init]; - attachmentRects = [[NSMutableArray alloc] init]; - attachmentContentsSet = [[NSMutableSet alloc] init]; - } - [attachments addObjectsFromArray:line.attachments]; - [attachmentRanges addObjectsFromArray:line.attachmentRanges]; - [attachmentRects addObjectsFromArray:line.attachmentRects]; - for (ASTextAttachment *attachment in line.attachments) { - if (attachment.content) { - [attachmentContentsSet addObject:attachment.content]; - } - } - } - } - - layout.frame = ctFrame; - layout.lines = lines; - layout.truncatedLine = truncatedLine; - layout.attachments = attachments; - layout.attachmentRanges = attachmentRanges; - layout.attachmentRects = attachmentRects; - layout.attachmentContentsSet = attachmentContentsSet; - layout.rowCount = rowCount; - layout.visibleRange = visibleRange; - layout.textBoundingRect = textBoundingRect; - layout.textBoundingSize = textBoundingSize; - layout.lineRowsEdge = lineRowsEdge; - layout.lineRowsIndex = lineRowsIndex; - CFRelease(cgPath); - CFRelease(ctSetter); - CFRelease(ctFrame); - if (lineOrigins) free(lineOrigins); - return layout; -} - -+ (NSArray *)layoutWithContainers:(NSArray *)containers text:(NSAttributedString *)text { - return [self layoutWithContainers:containers text:text range:NSMakeRange(0, text.length)]; -} - -+ (NSArray *)layoutWithContainers:(NSArray *)containers text:(NSAttributedString *)text range:(NSRange)range { - if (!containers || !text) return nil; - if (range.location + range.length > text.length) return nil; - NSMutableArray *layouts = [[NSMutableArray alloc] init]; - for (NSUInteger i = 0, max = containers.count; i < max; i++) { - ASTextContainer *container = containers[i]; - ASTextLayout *layout = [self layoutWithContainer:container text:text range:range]; - if (!layout) return nil; - NSInteger length = (NSInteger)range.length - (NSInteger)layout.visibleRange.length; - if (length <= 0) { - range.length = 0; - range.location = text.length; - } else { - range.length = length; - range.location += layout.visibleRange.length; - } - } - return layouts; -} - -- (void)setFrame:(CTFrameRef)frame { - if (_frame != frame) { - if (frame) CFRetain(frame); - if (_frame) CFRelease(_frame); - _frame = frame; - } -} - -- (void)dealloc { - if (_frame) CFRelease(_frame); - if (_lineRowsIndex) free(_lineRowsIndex); - if (_lineRowsEdge) free(_lineRowsEdge); -} - -#pragma mark - Copying - -- (id)copyWithZone:(NSZone *)zone { - return self; // readonly object -} - - -#pragma mark - Query - -/** - Get the row index with 'edge' distance. - - @param edge The distance from edge to the point. - If vertical form, the edge is left edge, otherwise the edge is top edge. - - @return Returns NSNotFound if there's no row at the point. - */ -- (NSUInteger)_rowIndexForEdge:(CGFloat)edge { - if (_rowCount == 0) return NSNotFound; - BOOL isVertical = _container.verticalForm; - NSUInteger lo = 0, hi = _rowCount - 1, mid = 0; - NSUInteger rowIdx = NSNotFound; - while (lo <= hi) { - mid = (lo + hi) / 2; - ASRowEdge oneEdge = _lineRowsEdge[mid]; - if (isVertical ? - (oneEdge.foot <= edge && edge <= oneEdge.head) : - (oneEdge.head <= edge && edge <= oneEdge.foot)) { - rowIdx = mid; - break; - } - if ((isVertical ? (edge > oneEdge.head) : (edge < oneEdge.head))) { - if (mid == 0) break; - hi = mid - 1; - } else { - lo = mid + 1; - } - } - return rowIdx; -} - -/** - Get the closest row index with 'edge' distance. - - @param edge The distance from edge to the point. - If vertical form, the edge is left edge, otherwise the edge is top edge. - - @return Returns NSNotFound if there's no line. - */ -- (NSUInteger)_closestRowIndexForEdge:(CGFloat)edge { - if (_rowCount == 0) return NSNotFound; - NSUInteger rowIdx = [self _rowIndexForEdge:edge]; - if (rowIdx == NSNotFound) { - if (_container.verticalForm) { - if (edge > _lineRowsEdge[0].head) { - rowIdx = 0; - } else if (edge < _lineRowsEdge[_rowCount - 1].foot) { - rowIdx = _rowCount - 1; - } - } else { - if (edge < _lineRowsEdge[0].head) { - rowIdx = 0; - } else if (edge > _lineRowsEdge[_rowCount - 1].foot) { - rowIdx = _rowCount - 1; - } - } - } - return rowIdx; -} - -/** - Get a CTRun from a line position. - - @param line The text line. - @param position The position in the whole text. - - @return Returns NULL if not found (no CTRun at the position). - */ -- (CTRunRef)_runForLine:(ASTextLine *)line position:(ASTextPosition *)position { - if (!line || !position) return NULL; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger i = 0, max = CFArrayGetCount(runs); i < max; i++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, i); - CFRange range = CTRunGetStringRange(run); - if (position.affinity == ASTextAffinityBackward) { - if (range.location < position.offset && position.offset <= range.location + range.length) { - return run; - } - } else { - if (range.location <= position.offset && position.offset < range.location + range.length) { - return run; - } - } - } - return NULL; -} - -/** - Whether the position is inside a composed character sequence. - - @param line The text line. - @param position Text text position in whole text. - @param block The block to be executed before returns YES. - left: left X offset - right: right X offset - prev: left position - next: right position - */ -- (BOOL)_insideComposedCharacterSequences:(ASTextLine *)line position:(NSUInteger)position block:(void (^)(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next))block { - NSRange range = line.range; - if (range.length == 0) return NO; - __block BOOL inside = NO; - __block NSUInteger _prev, _next; - [_text.string enumerateSubstringsInRange:range options:NSStringEnumerationByComposedCharacterSequences usingBlock: ^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { - NSUInteger prev = substringRange.location; - NSUInteger next = substringRange.location + substringRange.length; - if (prev == position || next == position) { - *stop = YES; - } - if (prev < position && position < next) { - inside = YES; - _prev = prev; - _next = next; - *stop = YES; - } - }]; - if (inside && block) { - CGFloat left = [self offsetForTextPosition:_prev lineIndex:line.index]; - CGFloat right = [self offsetForTextPosition:_next lineIndex:line.index]; - block(left, right, _prev, _next); - } - return inside; -} - -/** - Whether the position is inside an emoji (such as National Flag Emoji). - - @param line The text line. - @param position Text text position in whole text. - @param block Yhe block to be executed before returns YES. - left: emoji's left X offset - right: emoji's right X offset - prev: emoji's left position - next: emoji's right position - */ -- (BOOL)_insideEmoji:(ASTextLine *)line position:(NSUInteger)position block:(void (^)(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next))block { - if (!line) return NO; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - NSUInteger glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - CFRange range = CTRunGetStringRange(run); - if (range.length <= 1) continue; - if (position <= range.location || position >= range.location + range.length) continue; - CFDictionaryRef attrs = CTRunGetAttributes(run); - CTFontRef font = (CTFontRef)CFDictionaryGetValue(attrs, kCTFontAttributeName); - if (!ASTextCTFontContainsColorBitmapGlyphs(font)) continue; - - // Here's Emoji runs (larger than 1 unichar), and position is inside the range. - CFIndex indices[glyphCount]; - CTRunGetStringIndices(run, CFRangeMake(0, glyphCount), indices); - for (NSUInteger g = 0; g < glyphCount; g++) { - CFIndex prev = indices[g]; - CFIndex next = g + 1 < glyphCount ? indices[g + 1] : range.location + range.length; - if (position == prev) break; // Emoji edge - if (prev < position && position < next) { // inside an emoji (such as National Flag Emoji) - CGPoint pos = CGPointZero; - CGSize adv = CGSizeZero; - CTRunGetPositions(run, CFRangeMake(g, 1), &pos); - CTRunGetAdvances(run, CFRangeMake(g, 1), &adv); - if (block) { - block(line.position.x + pos.x, - line.position.x + pos.x + adv.width, - prev, next); - } - return YES; - } - } - } - return NO; -} -/** - Whether the write direction is RTL at the specified point - - @param line The text line - @param point The point in layout. - - @return YES if RTL. - */ -- (BOOL)_isRightToLeftInLine:(ASTextLine *)line atPoint:(CGPoint)point { - if (!line) return NO; - // get write direction - BOOL RTL = NO; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, max = CFArrayGetCount(runs); r < max; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CGPoint glyphPosition; - CTRunGetPositions(run, CFRangeMake(0, 1), &glyphPosition); - if (_container.verticalForm) { - CGFloat runX = glyphPosition.x; - runX += line.position.y; - CGFloat runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL); - if (runX <= point.y && point.y <= runX + runWidth) { - if (CTRunGetStatus(run) & kCTRunStatusRightToLeft) RTL = YES; - break; - } - } else { - CGFloat runX = glyphPosition.x; - runX += line.position.x; - CGFloat runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL); - if (runX <= point.x && point.x <= runX + runWidth) { - if (CTRunGetStatus(run) & kCTRunStatusRightToLeft) RTL = YES; - break; - } - } - } - return RTL; -} - -/** - Correct the range's edge. - */ -- (ASTextRange *)_correctedRangeWithEdge:(ASTextRange *)range { - NSRange visibleRange = self.visibleRange; - ASTextPosition *start = range.start; - ASTextPosition *end = range.end; - - if (start.offset == visibleRange.location && start.affinity == ASTextAffinityBackward) { - start = [ASTextPosition positionWithOffset:start.offset affinity:ASTextAffinityForward]; - } - - if (end.offset == visibleRange.location + visibleRange.length && start.affinity == ASTextAffinityForward) { - end = [ASTextPosition positionWithOffset:end.offset affinity:ASTextAffinityBackward]; - } - - if (start != range.start || end != range.end) { - range = [ASTextRange rangeWithStart:start end:end]; - } - return range; -} - -- (NSUInteger)lineIndexForRow:(NSUInteger)row { - if (row >= _rowCount) return NSNotFound; - return _lineRowsIndex[row]; -} - -- (NSUInteger)lineCountForRow:(NSUInteger)row { - if (row >= _rowCount) return NSNotFound; - if (row == _rowCount - 1) { - return _lines.count - _lineRowsIndex[row]; - } else { - return _lineRowsIndex[row + 1] - _lineRowsIndex[row]; - } -} - -- (NSUInteger)rowIndexForLine:(NSUInteger)line { - if (line >= _lines.count) return NSNotFound; - return ((ASTextLine *)_lines[line]).row; -} - -- (NSUInteger)lineIndexForPoint:(CGPoint)point { - if (_lines.count == 0 || _rowCount == 0) return NSNotFound; - NSUInteger rowIdx = [self _rowIndexForEdge:_container.verticalForm ? point.x : point.y]; - if (rowIdx == NSNotFound) return NSNotFound; - - NSUInteger lineIdx0 = _lineRowsIndex[rowIdx]; - NSUInteger lineIdx1 = rowIdx == _rowCount - 1 ? _lines.count - 1 : _lineRowsIndex[rowIdx + 1] - 1; - for (NSUInteger i = lineIdx0; i <= lineIdx1; i++) { - CGRect bounds = ((ASTextLine *)_lines[i]).bounds; - if (CGRectContainsPoint(bounds, point)) return i; - } - - return NSNotFound; -} - -- (NSUInteger)closestLineIndexForPoint:(CGPoint)point { - BOOL isVertical = _container.verticalForm; - if (_lines.count == 0 || _rowCount == 0) return NSNotFound; - NSUInteger rowIdx = [self _closestRowIndexForEdge:isVertical ? point.x : point.y]; - if (rowIdx == NSNotFound) return NSNotFound; - - NSUInteger lineIdx0 = _lineRowsIndex[rowIdx]; - NSUInteger lineIdx1 = rowIdx == _rowCount - 1 ? _lines.count - 1 : _lineRowsIndex[rowIdx + 1] - 1; - if (lineIdx0 == lineIdx1) return lineIdx0; - - CGFloat minDistance = CGFLOAT_MAX; - NSUInteger minIndex = lineIdx0; - for (NSUInteger i = lineIdx0; i <= lineIdx1; i++) { - CGRect bounds = ((ASTextLine *)_lines[i]).bounds; - if (isVertical) { - if (bounds.origin.y <= point.y && point.y <= bounds.origin.y + bounds.size.height) return i; - CGFloat distance; - if (point.y < bounds.origin.y) { - distance = bounds.origin.y - point.y; - } else { - distance = point.y - (bounds.origin.y + bounds.size.height); - } - if (distance < minDistance) { - minDistance = distance; - minIndex = i; - } - } else { - if (bounds.origin.x <= point.x && point.x <= bounds.origin.x + bounds.size.width) return i; - CGFloat distance; - if (point.x < bounds.origin.x) { - distance = bounds.origin.x - point.x; - } else { - distance = point.x - (bounds.origin.x + bounds.size.width); - } - if (distance < minDistance) { - minDistance = distance; - minIndex = i; - } - } - } - return minIndex; -} - -- (CGFloat)offsetForTextPosition:(NSUInteger)position lineIndex:(NSUInteger)lineIndex { - if (lineIndex >= _lines.count) return CGFLOAT_MAX; - ASTextLine *line = _lines[lineIndex]; - CFRange range = CTLineGetStringRange(line.CTLine); - if (position < range.location || position > range.location + range.length) return CGFLOAT_MAX; - - CGFloat offset = CTLineGetOffsetForStringIndex(line.CTLine, position, NULL); - return _container.verticalForm ? (offset + line.position.y) : (offset + line.position.x); -} - -- (NSUInteger)textPositionForPoint:(CGPoint)point lineIndex:(NSUInteger)lineIndex { - if (lineIndex >= _lines.count) return NSNotFound; - ASTextLine *line = _lines[lineIndex]; - if (_container.verticalForm) { - point.x = point.y - line.position.y; - point.y = 0; - } else { - point.x -= line.position.x; - point.y = 0; - } - CFIndex idx = CTLineGetStringIndexForPosition(line.CTLine, point); - if (idx == kCFNotFound) return NSNotFound; - - /* - If the emoji contains one or more variant form (such as ☔️ "\u2614\uFE0F") - and the font size is smaller than 379/15, then each variant form ("\uFE0F") - will rendered as a single blank glyph behind the emoji glyph. Maybe it's a - bug in CoreText? Seems iOS8.3 fixes this problem. - - If the point hit the blank glyph, the CTLineGetStringIndexForPosition() - returns the position before the emoji glyph, but it should returns the - position after the emoji and variant form. - - Here's a workaround. - */ - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, max = CFArrayGetCount(runs); r < max; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFRange range = CTRunGetStringRange(run); - if (range.location <= idx && idx < range.location + range.length) { - NSUInteger glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) break; - CFDictionaryRef attrs = CTRunGetAttributes(run); - CTFontRef font = (CTFontRef)CFDictionaryGetValue(attrs, kCTFontAttributeName); - if (!ASTextCTFontContainsColorBitmapGlyphs(font)) break; - - CFIndex indices[glyphCount]; - CGPoint positions[glyphCount]; - CTRunGetStringIndices(run, CFRangeMake(0, glyphCount), indices); - CTRunGetPositions(run, CFRangeMake(0, glyphCount), positions); - for (NSUInteger g = 0; g < glyphCount; g++) { - NSUInteger gIdx = indices[g]; - if (gIdx == idx && g + 1 < glyphCount) { - CGFloat right = positions[g + 1].x; - if (point.x < right) break; - NSUInteger next = indices[g + 1]; - do { - if (next == range.location + range.length) break; - unichar c = [_text.string characterAtIndex:next]; - if ((c == 0xFE0E || c == 0xFE0F)) { // unicode variant form for emoji style - next++; - } else break; - } - while (1); - if (next != indices[g + 1]) idx = next; - break; - } - } - break; - } - } - return idx; -} - -- (ASTextPosition *)closestPositionToPoint:(CGPoint)point { - BOOL isVertical = _container.verticalForm; - // When call CTLineGetStringIndexForPosition() on ligature such as 'fi', - // and the point `hit` the glyph's left edge, it may get the ligature inside offset. - // I don't know why, maybe it's a bug of CoreText. Try to avoid it. - if (isVertical) point.y += 0.00001234; - else point.x += 0.00001234; - - NSUInteger lineIndex = [self closestLineIndexForPoint:point]; - if (lineIndex == NSNotFound) return nil; - ASTextLine *line = _lines[lineIndex]; - __block NSUInteger position = [self textPositionForPoint:point lineIndex:lineIndex]; - if (position == NSNotFound) position = line.range.location; - if (position <= _visibleRange.location) { - return [ASTextPosition positionWithOffset:_visibleRange.location affinity:ASTextAffinityForward]; - } else if (position >= _visibleRange.location + _visibleRange.length) { - return [ASTextPosition positionWithOffset:_visibleRange.location + _visibleRange.length affinity:ASTextAffinityBackward]; - } - - ASTextAffinity finalAffinity = ASTextAffinityForward; - BOOL finalAffinityDetected = NO; - - // binding range - NSRange bindingRange; - ASTextBinding *binding = [_text attribute:ASTextBindingAttributeName atIndex:position longestEffectiveRange:&bindingRange inRange:NSMakeRange(0, _text.length)]; - if (binding && bindingRange.length > 0) { - NSUInteger headLineIdx = [self lineIndexForPosition:[ASTextPosition positionWithOffset:bindingRange.location]]; - NSUInteger tailLineIdx = [self lineIndexForPosition:[ASTextPosition positionWithOffset:bindingRange.location + bindingRange.length affinity:ASTextAffinityBackward]]; - if (headLineIdx == lineIndex && lineIndex == tailLineIdx) { // all in same line - CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:lineIndex]; - CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:lineIndex]; - if (left != CGFLOAT_MAX && right != CGFLOAT_MAX) { - if (_container.isVerticalForm) { - if (fabs(point.y - left) < fabs(point.y - right)) { - position = bindingRange.location; - finalAffinity = ASTextAffinityForward; - } else { - position = bindingRange.location + bindingRange.length; - finalAffinity = ASTextAffinityBackward; - } - } else { - if (fabs(point.x - left) < fabs(point.x - right)) { - position = bindingRange.location; - finalAffinity = ASTextAffinityForward; - } else { - position = bindingRange.location + bindingRange.length; - finalAffinity = ASTextAffinityBackward; - } - } - } else if (left != CGFLOAT_MAX) { - position = left; - finalAffinity = ASTextAffinityForward; - } else if (right != CGFLOAT_MAX) { - position = right; - finalAffinity = ASTextAffinityBackward; - } - finalAffinityDetected = YES; - } else if (headLineIdx == lineIndex) { - CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:lineIndex]; - if (left != CGFLOAT_MAX) { - position = bindingRange.location; - finalAffinity = ASTextAffinityForward; - finalAffinityDetected = YES; - } - } else if (tailLineIdx == lineIndex) { - CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:lineIndex]; - if (right != CGFLOAT_MAX) { - position = bindingRange.location + bindingRange.length; - finalAffinity = ASTextAffinityBackward; - finalAffinityDetected = YES; - } - } else { - BOOL onLeft = NO, onRight = NO; - if (headLineIdx != NSNotFound && tailLineIdx != NSNotFound) { - if (abs((int)headLineIdx - (int)lineIndex) < abs((int)tailLineIdx - (int)lineIndex)) onLeft = YES; - else onRight = YES; - } else if (headLineIdx != NSNotFound) { - onLeft = YES; - } else if (tailLineIdx != NSNotFound) { - onRight = YES; - } - - if (onLeft) { - CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:headLineIdx]; - if (left != CGFLOAT_MAX) { - lineIndex = headLineIdx; - line = _lines[headLineIdx]; - position = bindingRange.location; - finalAffinity = ASTextAffinityForward; - finalAffinityDetected = YES; - } - } else if (onRight) { - CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:tailLineIdx]; - if (right != CGFLOAT_MAX) { - lineIndex = tailLineIdx; - line = _lines[tailLineIdx]; - position = bindingRange.location + bindingRange.length; - finalAffinity = ASTextAffinityBackward; - finalAffinityDetected = YES; - } - } - } - } - - // empty line - if (line.range.length == 0) { - BOOL behind = (_lines.count > 1 && lineIndex == _lines.count - 1); //end line - return [ASTextPosition positionWithOffset:line.range.location affinity:behind ? ASTextAffinityBackward:ASTextAffinityForward]; - } - - // detect weather the line is a linebreak token - if (line.range.length <= 2) { - NSString *str = [_text.string substringWithRange:line.range]; - if (ASTextIsLinebreakString(str)) { // an empty line ("\r", "\n", "\r\n") - return [ASTextPosition positionWithOffset:line.range.location]; - } - } - - // above whole text frame - if (lineIndex == 0 && (isVertical ? (point.x > line.right) : (point.y < line.top))) { - position = 0; - finalAffinity = ASTextAffinityForward; - finalAffinityDetected = YES; - } - // below whole text frame - if (lineIndex == _lines.count - 1 && (isVertical ? (point.x < line.left) : (point.y > line.bottom))) { - position = line.range.location + line.range.length; - finalAffinity = ASTextAffinityBackward; - finalAffinityDetected = YES; - } - - // There must be at least one non-linebreak char, - // ignore the linebreak characters at line end if exists. - if (position >= line.range.location + line.range.length - 1) { - if (position > line.range.location) { - unichar c1 = [_text.string characterAtIndex:position - 1]; - if (ASTextIsLinebreakChar(c1)) { - position--; - if (position > line.range.location) { - unichar c0 = [_text.string characterAtIndex:position - 1]; - if (ASTextIsLinebreakChar(c0)) { - position--; - } - } - } - } - } - if (position == line.range.location) { - return [ASTextPosition positionWithOffset:position]; - } - if (position == line.range.location + line.range.length) { - return [ASTextPosition positionWithOffset:position affinity:ASTextAffinityBackward]; - } - - [self _insideComposedCharacterSequences:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) { - if (isVertical) { - position = fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next); - } else { - position = fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next); - } - }]; - - [self _insideEmoji:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) { - if (isVertical) { - position = fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next); - } else { - position = fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next); - } - }]; - - if (position < _visibleRange.location) position = _visibleRange.location; - else if (position > _visibleRange.location + _visibleRange.length) position = _visibleRange.location + _visibleRange.length; - - if (!finalAffinityDetected) { - CGFloat ofs = [self offsetForTextPosition:position lineIndex:lineIndex]; - if (ofs != CGFLOAT_MAX) { - BOOL RTL = [self _isRightToLeftInLine:line atPoint:point]; - if (position >= line.range.location + line.range.length) { - finalAffinity = RTL ? ASTextAffinityForward : ASTextAffinityBackward; - } else if (position <= line.range.location) { - finalAffinity = RTL ? ASTextAffinityBackward : ASTextAffinityForward; - } else { - finalAffinity = (ofs < (isVertical ? point.y : point.x) && !RTL) ? ASTextAffinityForward : ASTextAffinityBackward; - } - } - } - - return [ASTextPosition positionWithOffset:position affinity:finalAffinity]; -} - -- (ASTextPosition *)positionForPoint:(CGPoint)point - oldPosition:(ASTextPosition *)oldPosition - otherPosition:(ASTextPosition *)otherPosition { - if (!oldPosition || !otherPosition) { - return oldPosition; - } - ASTextPosition *newPos = [self closestPositionToPoint:point]; - if (!newPos) return oldPosition; - if ([newPos compare:otherPosition] == [oldPosition compare:otherPosition] && - newPos.offset != otherPosition.offset) { - return newPos; - } - NSUInteger lineIndex = [self lineIndexForPosition:otherPosition]; - if (lineIndex == NSNotFound) return oldPosition; - ASTextLine *line = _lines[lineIndex]; - ASRowEdge vertical = _lineRowsEdge[line.row]; - if (_container.verticalForm) { - point.x = (vertical.head + vertical.foot) * 0.5; - } else { - point.y = (vertical.head + vertical.foot) * 0.5; - } - newPos = [self closestPositionToPoint:point]; - if ([newPos compare:otherPosition] == [oldPosition compare:otherPosition] && - newPos.offset != otherPosition.offset) { - return newPos; - } - - if (_container.isVerticalForm) { - if ([oldPosition compare:otherPosition] == NSOrderedAscending) { // search backward - ASTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionUp offset:1]; - if (range) return range.start; - } else { // search forward - ASTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionDown offset:1]; - if (range) return range.end; - } - } else { - if ([oldPosition compare:otherPosition] == NSOrderedAscending) { // search backward - ASTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionLeft offset:1]; - if (range) return range.start; - } else { // search forward - ASTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionRight offset:1]; - if (range) return range.end; - } - } - - return oldPosition; -} - -- (ASTextRange *)textRangeAtPoint:(CGPoint)point { - NSUInteger lineIndex = [self lineIndexForPoint:point]; - if (lineIndex == NSNotFound) return nil; - NSUInteger textPosition = [self textPositionForPoint:point lineIndex:[self lineIndexForPoint:point]]; - if (textPosition == NSNotFound) return nil; - ASTextPosition *pos = [self closestPositionToPoint:point]; - if (!pos) return nil; - - // get write direction - BOOL RTL = [self _isRightToLeftInLine:_lines[lineIndex] atPoint:point]; - CGRect rect = [self caretRectForPosition:pos]; - if (CGRectIsNull(rect)) return nil; - - if (_container.verticalForm) { - ASTextRange *range = [self textRangeByExtendingPosition:pos inDirection:(rect.origin.y >= point.y && !RTL) ? UITextLayoutDirectionUp:UITextLayoutDirectionDown offset:1]; - return range; - } else { - ASTextRange *range = [self textRangeByExtendingPosition:pos inDirection:(rect.origin.x >= point.x && !RTL) ? UITextLayoutDirectionLeft:UITextLayoutDirectionRight offset:1]; - return range; - } -} - -- (ASTextRange *)closestTextRangeAtPoint:(CGPoint)point { - ASTextPosition *pos = [self closestPositionToPoint:point]; - if (!pos) return nil; - NSUInteger lineIndex = [self lineIndexForPosition:pos]; - if (lineIndex == NSNotFound) return nil; - ASTextLine *line = _lines[lineIndex]; - BOOL RTL = [self _isRightToLeftInLine:line atPoint:point]; - CGRect rect = [self caretRectForPosition:pos]; - if (CGRectIsNull(rect)) return nil; - - UITextLayoutDirection direction = UITextLayoutDirectionRight; - if (pos.offset >= line.range.location + line.range.length) { - if (direction != RTL) { - direction = _container.verticalForm ? UITextLayoutDirectionUp : UITextLayoutDirectionLeft; - } else { - direction = _container.verticalForm ? UITextLayoutDirectionDown : UITextLayoutDirectionRight; - } - } else if (pos.offset <= line.range.location) { - if (direction != RTL) { - direction = _container.verticalForm ? UITextLayoutDirectionDown : UITextLayoutDirectionRight; - } else { - direction = _container.verticalForm ? UITextLayoutDirectionUp : UITextLayoutDirectionLeft; - } - } else { - if (_container.verticalForm) { - direction = (rect.origin.y >= point.y && !RTL) ? UITextLayoutDirectionUp:UITextLayoutDirectionDown; - } else { - direction = (rect.origin.x >= point.x && !RTL) ? UITextLayoutDirectionLeft:UITextLayoutDirectionRight; - } - } - - ASTextRange *range = [self textRangeByExtendingPosition:pos inDirection:direction offset:1]; - return range; -} - -- (ASTextRange *)textRangeByExtendingPosition:(ASTextPosition *)position { - NSUInteger visibleStart = _visibleRange.location; - NSUInteger visibleEnd = _visibleRange.location + _visibleRange.length; - - if (!position) return nil; - if (position.offset < visibleStart || position.offset > visibleEnd) return nil; - - // head or tail, returns immediately - if (position.offset == visibleStart) { - return [ASTextRange rangeWithRange:NSMakeRange(position.offset, 0)]; - } else if (position.offset == visibleEnd) { - return [ASTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:ASTextAffinityBackward]; - } - - // binding range - NSRange tRange; - ASTextBinding *binding = [_text attribute:ASTextBindingAttributeName atIndex:position.offset longestEffectiveRange:&tRange inRange:_visibleRange]; - if (binding && tRange.length > 0 && tRange.location < position.offset) { - return [ASTextRange rangeWithRange:tRange]; - } - - // inside emoji or composed character sequences - NSUInteger lineIndex = [self lineIndexForPosition:position]; - if (lineIndex != NSNotFound) { - __block NSUInteger _prev, _next; - BOOL emoji = NO, seq = NO; - - ASTextLine *line = _lines[lineIndex]; - emoji = [self _insideEmoji:line position:position.offset block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) { - _prev = prev; - _next = next; - }]; - if (!emoji) { - seq = [self _insideComposedCharacterSequences:line position:position.offset block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) { - _prev = prev; - _next = next; - }]; - } - if (emoji || seq) { - return [ASTextRange rangeWithRange:NSMakeRange(_prev, _next - _prev)]; - } - } - - // inside linebreak '\r\n' - if (position.offset > visibleStart && position.offset < visibleEnd) { - unichar c0 = [_text.string characterAtIndex:position.offset - 1]; - if ((c0 == '\r') && position.offset < visibleEnd) { - unichar c1 = [_text.string characterAtIndex:position.offset]; - if (c1 == '\n') { - return [ASTextRange rangeWithStart:[ASTextPosition positionWithOffset:position.offset - 1] end:[ASTextPosition positionWithOffset:position.offset + 1]]; - } - } - if (ASTextIsLinebreakChar(c0) && position.affinity == ASTextAffinityBackward) { - NSString *str = [_text.string substringToIndex:position.offset]; - NSUInteger len = ASTextLinebreakTailLength(str); - return [ASTextRange rangeWithStart:[ASTextPosition positionWithOffset:position.offset - len] end:[ASTextPosition positionWithOffset:position.offset]]; - } - } - - return [ASTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:position.affinity]; -} - -- (ASTextRange *)textRangeByExtendingPosition:(ASTextPosition *)position - inDirection:(UITextLayoutDirection)direction - offset:(NSInteger)offset { - NSInteger visibleStart = _visibleRange.location; - NSInteger visibleEnd = _visibleRange.location + _visibleRange.length; - - if (!position) return nil; - if (position.offset < visibleStart || position.offset > visibleEnd) return nil; - if (offset == 0) return [self textRangeByExtendingPosition:position]; - - BOOL isVerticalForm = _container.verticalForm; - BOOL verticalMove, forwardMove; - - if (isVerticalForm) { - verticalMove = direction == UITextLayoutDirectionLeft || direction == UITextLayoutDirectionRight; - forwardMove = direction == UITextLayoutDirectionLeft || direction == UITextLayoutDirectionDown; - } else { - verticalMove = direction == UITextLayoutDirectionUp || direction == UITextLayoutDirectionDown; - forwardMove = direction == UITextLayoutDirectionDown || direction == UITextLayoutDirectionRight; - } - - if (offset < 0) { - forwardMove = !forwardMove; - offset = -offset; - } - - // head or tail, returns immediately - if (!forwardMove && position.offset == visibleStart) { - return [ASTextRange rangeWithRange:NSMakeRange(_visibleRange.location, 0)]; - } else if (forwardMove && position.offset == visibleEnd) { - return [ASTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:ASTextAffinityBackward]; - } - - // extend from position - ASTextRange *fromRange = [self textRangeByExtendingPosition:position]; - if (!fromRange) return nil; - ASTextRange *allForward = [ASTextRange rangeWithStart:fromRange.start end:[ASTextPosition positionWithOffset:visibleEnd]]; - ASTextRange *allBackward = [ASTextRange rangeWithStart:[ASTextPosition positionWithOffset:visibleStart] end:fromRange.end]; - - if (verticalMove) { // up/down in text layout - NSInteger lineIndex = [self lineIndexForPosition:position]; - if (lineIndex == NSNotFound) return nil; - - ASTextLine *line = _lines[lineIndex]; - NSInteger moveToRowIndex = (NSInteger)line.row + (forwardMove ? offset : -offset); - if (moveToRowIndex < 0) return allBackward; - else if (moveToRowIndex >= (NSInteger)_rowCount) return allForward; - - CGFloat ofs = [self offsetForTextPosition:position.offset lineIndex:lineIndex]; - if (ofs == CGFLOAT_MAX) return nil; - - NSUInteger moveToLineFirstIndex = [self lineIndexForRow:moveToRowIndex]; - NSUInteger moveToLineCount = [self lineCountForRow:moveToRowIndex]; - if (moveToLineFirstIndex == NSNotFound || moveToLineCount == NSNotFound || moveToLineCount == 0) return nil; - CGFloat mostLeft = CGFLOAT_MAX, mostRight = -CGFLOAT_MAX; - ASTextLine *mostLeftLine = nil, *mostRightLine = nil; - NSUInteger insideIndex = NSNotFound; - for (NSUInteger i = 0; i < moveToLineCount; i++) { - NSUInteger lineIndex = moveToLineFirstIndex + i; - ASTextLine *line = _lines[lineIndex]; - if (isVerticalForm) { - if (line.top <= ofs && ofs <= line.bottom) { - insideIndex = line.index; - break; - } - if (line.top < mostLeft) { - mostLeft = line.top; - mostLeftLine = line; - } - if (line.bottom > mostRight) { - mostRight = line.bottom; - mostRightLine = line; - } - } else { - if (line.left <= ofs && ofs <= line.right) { - insideIndex = line.index; - break; - } - if (line.left < mostLeft) { - mostLeft = line.left; - mostLeftLine = line; - } - if (line.right > mostRight) { - mostRight = line.right; - mostRightLine = line; - } - } - } - BOOL afinityEdge = NO; - if (insideIndex == NSNotFound) { - if (ofs <= mostLeft) { - insideIndex = mostLeftLine.index; - } else { - insideIndex = mostRightLine.index; - } - afinityEdge = YES; - } - ASTextLine *insideLine = _lines[insideIndex]; - NSUInteger pos; - if (isVerticalForm) { - pos = [self textPositionForPoint:CGPointMake(insideLine.position.x, ofs) lineIndex:insideIndex]; - } else { - pos = [self textPositionForPoint:CGPointMake(ofs, insideLine.position.y) lineIndex:insideIndex]; - } - if (pos == NSNotFound) return nil; - ASTextPosition *extPos; - if (afinityEdge) { - if (pos == insideLine.range.location + insideLine.range.length) { - NSString *subStr = [_text.string substringWithRange:insideLine.range]; - NSUInteger lineBreakLen = ASTextLinebreakTailLength(subStr); - extPos = [ASTextPosition positionWithOffset:pos - lineBreakLen]; - } else { - extPos = [ASTextPosition positionWithOffset:pos]; - } - } else { - extPos = [ASTextPosition positionWithOffset:pos]; - } - ASTextRange *ext = [self textRangeByExtendingPosition:extPos]; - if (!ext) return nil; - if (forwardMove) { - return [ASTextRange rangeWithStart:fromRange.start end:ext.end]; - } else { - return [ASTextRange rangeWithStart:ext.start end:fromRange.end]; - } - - } else { // left/right in text layout - ASTextPosition *toPosition = [ASTextPosition positionWithOffset:position.offset + (forwardMove ? offset : -offset)]; - if (toPosition.offset <= visibleStart) return allBackward; - else if (toPosition.offset >= visibleEnd) return allForward; - - ASTextRange *toRange = [self textRangeByExtendingPosition:toPosition]; - if (!toRange) return nil; - - NSInteger start = MIN(fromRange.start.offset, toRange.start.offset); - NSInteger end = MAX(fromRange.end.offset, toRange.end.offset); - return [ASTextRange rangeWithRange:NSMakeRange(start, end - start)]; - } -} - -- (NSUInteger)lineIndexForPosition:(ASTextPosition *)position { - if (!position) return NSNotFound; - if (_lines.count == 0) return NSNotFound; - NSUInteger location = position.offset; - NSInteger lo = 0, hi = _lines.count - 1, mid = 0; - if (position.affinity == ASTextAffinityBackward) { - while (lo <= hi) { - mid = (lo + hi) / 2; - ASTextLine *line = _lines[mid]; - NSRange range = line.range; - if (range.location < location && location <= range.location + range.length) { - return mid; - } - if (location <= range.location) { - hi = mid - 1; - } else { - lo = mid + 1; - } - } - } else { - while (lo <= hi) { - mid = (lo + hi) / 2; - ASTextLine *line = _lines[mid]; - NSRange range = line.range; - if (range.location <= location && location < range.location + range.length) { - return mid; - } - if (location < range.location) { - hi = mid - 1; - } else { - lo = mid + 1; - } - } - } - return NSNotFound; -} - -- (CGPoint)linePositionForPosition:(ASTextPosition *)position { - NSUInteger lineIndex = [self lineIndexForPosition:position]; - if (lineIndex == NSNotFound) return CGPointZero; - ASTextLine *line = _lines[lineIndex]; - CGFloat offset = [self offsetForTextPosition:position.offset lineIndex:lineIndex]; - if (offset == CGFLOAT_MAX) return CGPointZero; - if (_container.verticalForm) { - return CGPointMake(line.position.x, offset); - } else { - return CGPointMake(offset, line.position.y); - } -} - -- (CGRect)caretRectForPosition:(ASTextPosition *)position { - NSUInteger lineIndex = [self lineIndexForPosition:position]; - if (lineIndex == NSNotFound) return CGRectNull; - ASTextLine *line = _lines[lineIndex]; - CGFloat offset = [self offsetForTextPosition:position.offset lineIndex:lineIndex]; - if (offset == CGFLOAT_MAX) return CGRectNull; - if (_container.verticalForm) { - return CGRectMake(line.bounds.origin.x, offset, line.bounds.size.width, 0); - } else { - return CGRectMake(offset, line.bounds.origin.y, 0, line.bounds.size.height); - } -} - -- (CGRect)firstRectForRange:(ASTextRange *)range { - range = [self _correctedRangeWithEdge:range]; - - NSUInteger startLineIndex = [self lineIndexForPosition:range.start]; - NSUInteger endLineIndex = [self lineIndexForPosition:range.end]; - if (startLineIndex == NSNotFound || endLineIndex == NSNotFound) return CGRectNull; - if (startLineIndex > endLineIndex) return CGRectNull; - ASTextLine *startLine = _lines[startLineIndex]; - ASTextLine *endLine = _lines[endLineIndex]; - NSMutableArray *lines = [NSMutableArray new]; - for (NSUInteger i = startLineIndex; i <= startLineIndex; i++) { - ASTextLine *line = _lines[i]; - if (line.row != startLine.row) break; - [lines addObject:line]; - } - if (_container.verticalForm) { - if (lines.count == 1) { - CGFloat top = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CGFloat bottom; - if (startLine == endLine) { - bottom = [self offsetForTextPosition:range.end.offset lineIndex:startLineIndex]; - } else { - bottom = startLine.bottom; - } - if (top == CGFLOAT_MAX || bottom == CGFLOAT_MAX) return CGRectNull; - if (top > bottom) ASTEXT_SWAP(top, bottom); - return CGRectMake(startLine.left, top, startLine.width, bottom - top); - } else { - CGFloat top = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CGFloat bottom = startLine.bottom; - if (top == CGFLOAT_MAX || bottom == CGFLOAT_MAX) return CGRectNull; - if (top > bottom) ASTEXT_SWAP(top, bottom); - CGRect rect = CGRectMake(startLine.left, top, startLine.width, bottom - top); - for (NSUInteger i = 1; i < lines.count; i++) { - ASTextLine *line = lines[i]; - rect = CGRectUnion(rect, line.bounds); - } - return rect; - } - } else { - if (lines.count == 1) { - CGFloat left = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CGFloat right; - if (startLine == endLine) { - right = [self offsetForTextPosition:range.end.offset lineIndex:startLineIndex]; - } else { - right = startLine.right; - } - if (left == CGFLOAT_MAX || right == CGFLOAT_MAX) return CGRectNull; - if (left > right) ASTEXT_SWAP(left, right); - return CGRectMake(left, startLine.top, right - left, startLine.height); - } else { - CGFloat left = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CGFloat right = startLine.right; - if (left == CGFLOAT_MAX || right == CGFLOAT_MAX) return CGRectNull; - if (left > right) ASTEXT_SWAP(left, right); - CGRect rect = CGRectMake(left, startLine.top, right - left, startLine.height); - for (NSUInteger i = 1; i < lines.count; i++) { - ASTextLine *line = lines[i]; - rect = CGRectUnion(rect, line.bounds); - } - return rect; - } - } -} - -- (CGRect)rectForRange:(ASTextRange *)range { - NSArray *rects = [self selectionRectsForRange:range]; - if (rects.count == 0) return CGRectNull; - CGRect rectUnion = ((ASTextSelectionRect *)rects.firstObject).rect; - for (NSUInteger i = 1; i < rects.count; i++) { - ASTextSelectionRect *rect = rects[i]; - rectUnion = CGRectUnion(rectUnion, rect.rect); - } - return rectUnion; -} - -- (NSArray *)selectionRectsForRange:(ASTextRange *)range { - range = [self _correctedRangeWithEdge:range]; - - BOOL isVertical = _container.verticalForm; - NSMutableArray *rects = [[NSMutableArray alloc] init]; - if (!range) return rects; - - NSUInteger startLineIndex = [self lineIndexForPosition:range.start]; - NSUInteger endLineIndex = [self lineIndexForPosition:range.end]; - if (startLineIndex == NSNotFound || endLineIndex == NSNotFound) return rects; - if (startLineIndex > endLineIndex) ASTEXT_SWAP(startLineIndex, endLineIndex); - ASTextLine *startLine = _lines[startLineIndex]; - ASTextLine *endLine = _lines[endLineIndex]; - CGFloat offsetStart = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CGFloat offsetEnd = [self offsetForTextPosition:range.end.offset lineIndex:endLineIndex]; - - ASTextSelectionRect *start = [ASTextSelectionRect new]; - if (isVertical) { - start.rect = CGRectMake(startLine.left, offsetStart, startLine.width, 0); - } else { - start.rect = CGRectMake(offsetStart, startLine.top, 0, startLine.height); - } - start.containsStart = YES; - start.isVertical = isVertical; - [rects addObject:start]; - - ASTextSelectionRect *end = [ASTextSelectionRect new]; - if (isVertical) { - end.rect = CGRectMake(endLine.left, offsetEnd, endLine.width, 0); - } else { - end.rect = CGRectMake(offsetEnd, endLine.top, 0, endLine.height); - } - end.containsEnd = YES; - end.isVertical = isVertical; - [rects addObject:end]; - - if (startLine.row == endLine.row) { // same row - if (offsetStart > offsetEnd) ASTEXT_SWAP(offsetStart, offsetEnd); - ASTextSelectionRect *rect = [ASTextSelectionRect new]; - if (isVertical) { - rect.rect = CGRectMake(startLine.bounds.origin.x, offsetStart, MAX(startLine.width, endLine.width), offsetEnd - offsetStart); - } else { - rect.rect = CGRectMake(offsetStart, startLine.bounds.origin.y, offsetEnd - offsetStart, MAX(startLine.height, endLine.height)); - } - rect.isVertical = isVertical; - [rects addObject:rect]; - - } else { // more than one row - - // start line select rect - ASTextSelectionRect *topRect = [ASTextSelectionRect new]; - topRect.isVertical = isVertical; - CGFloat topOffset = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex]; - CTRunRef topRun = [self _runForLine:startLine position:range.start]; - if (topRun && (CTRunGetStatus(topRun) & kCTRunStatusRightToLeft)) { - if (isVertical) { - topRect.rect = CGRectMake(startLine.left, _container.path ? startLine.top : _container.insets.top, startLine.width, topOffset - startLine.top); - } else { - topRect.rect = CGRectMake(_container.path ? startLine.left : _container.insets.left, startLine.top, topOffset - startLine.left, startLine.height); - } - topRect.writingDirection = UITextWritingDirectionRightToLeft; - } else { - if (isVertical) { - topRect.rect = CGRectMake(startLine.left, topOffset, startLine.width, (_container.path ? startLine.bottom : _container.size.height - _container.insets.bottom) - topOffset); - } else { - // TODO: Fixes highlighting first row only to the end of the text and not highlight - // the while line to the end. Needs to brought over to multiline support - topRect.rect = CGRectMake(topOffset, startLine.top, (_container.path ? startLine.right : _container.size.width - _container.insets.right) - topOffset - (_container.size.width - _container.insets.right - startLine.right), startLine.height); - } - } - [rects addObject:topRect]; - - // end line select rect - ASTextSelectionRect *bottomRect = [ASTextSelectionRect new]; - bottomRect.isVertical = isVertical; - CGFloat bottomOffset = [self offsetForTextPosition:range.end.offset lineIndex:endLineIndex]; - CTRunRef bottomRun = [self _runForLine:endLine position:range.end]; - if (bottomRun && (CTRunGetStatus(bottomRun) & kCTRunStatusRightToLeft)) { - if (isVertical) { - bottomRect.rect = CGRectMake(endLine.left, bottomOffset, endLine.width, (_container.path ? endLine.bottom : _container.size.height - _container.insets.bottom) - bottomOffset); - } else { - bottomRect.rect = CGRectMake(bottomOffset, endLine.top, (_container.path ? endLine.right : _container.size.width - _container.insets.right) - bottomOffset, endLine.height); - } - bottomRect.writingDirection = UITextWritingDirectionRightToLeft; - } else { - if (isVertical) { - CGFloat top = _container.path ? endLine.top : _container.insets.top; - bottomRect.rect = CGRectMake(endLine.left, top, endLine.width, bottomOffset - top); - } else { - CGFloat left = _container.path ? endLine.left : _container.insets.left; - bottomRect.rect = CGRectMake(left, endLine.top, bottomOffset - left, endLine.height); - } - } - [rects addObject:bottomRect]; - - if (endLineIndex - startLineIndex >= 2) { - CGRect r = CGRectZero; - BOOL startLineDetected = NO; - for (NSUInteger l = startLineIndex + 1; l < endLineIndex; l++) { - ASTextLine *line = _lines[l]; - if (line.row == startLine.row || line.row == endLine.row) continue; - if (!startLineDetected) { - r = line.bounds; - startLineDetected = YES; - } else { - r = CGRectUnion(r, line.bounds); - } - } - if (startLineDetected) { - if (isVertical) { - if (!_container.path) { - r.origin.y = _container.insets.top; - r.size.height = _container.size.height - _container.insets.bottom - _container.insets.top; - } - r.size.width = CGRectGetMinX(topRect.rect) - CGRectGetMaxX(bottomRect.rect); - r.origin.x = CGRectGetMaxX(bottomRect.rect); - } else { - if (!_container.path) { - r.origin.x = _container.insets.left; - r.size.width = _container.size.width - _container.insets.right - _container.insets.left; - } - r.origin.y = CGRectGetMaxY(topRect.rect); - r.size.height = bottomRect.rect.origin.y - r.origin.y; - } - - ASTextSelectionRect *rect = [ASTextSelectionRect new]; - rect.rect = r; - rect.isVertical = isVertical; - [rects addObject:rect]; - } - } else { - if (isVertical) { - CGRect r0 = bottomRect.rect; - CGRect r1 = topRect.rect; - CGFloat mid = (CGRectGetMaxX(r0) + CGRectGetMinX(r1)) * 0.5; - r0.size.width = mid - r0.origin.x; - CGFloat r1ofs = r1.origin.x - mid; - r1.origin.x -= r1ofs; - r1.size.width += r1ofs; - topRect.rect = r1; - bottomRect.rect = r0; - } else { - CGRect r0 = topRect.rect; - CGRect r1 = bottomRect.rect; - CGFloat mid = (CGRectGetMaxY(r0) + CGRectGetMinY(r1)) * 0.5; - r0.size.height = mid - r0.origin.y; - CGFloat r1ofs = r1.origin.y - mid; - r1.origin.y -= r1ofs; - r1.size.height += r1ofs; - topRect.rect = r0; - bottomRect.rect = r1; - } - } - } - return rects; -} - -- (NSArray *)selectionRectsWithoutStartAndEndForRange:(ASTextRange *)range { - NSMutableArray *rects = [self selectionRectsForRange:range].mutableCopy; - for (NSInteger i = 0, max = rects.count; i < max; i++) { - ASTextSelectionRect *rect = rects[i]; - if (rect.containsStart || rect.containsEnd) { - [rects removeObjectAtIndex:i]; - i--; - max--; - } - } - return rects; -} - -- (NSArray *)selectionRectsWithOnlyStartAndEndForRange:(ASTextRange *)range { - NSMutableArray *rects = [self selectionRectsForRange:range].mutableCopy; - for (NSInteger i = 0, max = rects.count; i < max; i++) { - ASTextSelectionRect *rect = rects[i]; - if (!rect.containsStart && !rect.containsEnd) { - [rects removeObjectAtIndex:i]; - i--; - max--; - } - } - return rects; -} - - -#pragma mark - Draw - - -typedef NS_OPTIONS(NSUInteger, ASTextDecorationType) { - ASTextDecorationTypeUnderline = 1 << 0, - ASTextDecorationTypeStrikethrough = 1 << 1, -}; - -typedef NS_OPTIONS(NSUInteger, ASTextBorderType) { - ASTextBorderTypeBackgound = 1 << 0, - ASTextBorderTypeNormal = 1 << 1, -}; - -static CGRect ASTextMergeRectInSameLine(CGRect rect1, CGRect rect2, BOOL isVertical) { - if (isVertical) { - CGFloat top = MIN(rect1.origin.y, rect2.origin.y); - CGFloat bottom = MAX(rect1.origin.y + rect1.size.height, rect2.origin.y + rect2.size.height); - CGFloat width = MAX(rect1.size.width, rect2.size.width); - return CGRectMake(rect1.origin.x, top, width, bottom - top); - } else { - CGFloat left = MIN(rect1.origin.x, rect2.origin.x); - CGFloat right = MAX(rect1.origin.x + rect1.size.width, rect2.origin.x + rect2.size.width); - CGFloat height = MAX(rect1.size.height, rect2.size.height); - return CGRectMake(left, rect1.origin.y, right - left, height); - } -} - -static void ASTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness) { - CGFloat maxXHeight = 0; - CGFloat maxUnderlinePos = 0; - CGFloat maxLineThickness = 0; - for (NSUInteger i = 0, max = CFArrayGetCount(runs); i < max; i++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, i); - CFDictionaryRef attrs = CTRunGetAttributes(run); - if (attrs) { - CTFontRef font = (CTFontRef)CFDictionaryGetValue(attrs, kCTFontAttributeName); - if (font) { - CGFloat xHeight = CTFontGetXHeight(font); - if (xHeight > maxXHeight) maxXHeight = xHeight; - CGFloat underlinePos = CTFontGetUnderlinePosition(font); - if (underlinePos < maxUnderlinePos) maxUnderlinePos = underlinePos; - CGFloat lineThickness = CTFontGetUnderlineThickness(font); - if (lineThickness > maxLineThickness) maxLineThickness = lineThickness; - } - } - } - if (xHeight) *xHeight = maxXHeight; - if (underlinePosition) *underlinePosition = maxUnderlinePos; - if (lineThickness) *lineThickness = maxLineThickness; -} - -static void ASTextDrawRun(ASTextLine *line, CTRunRef run, CGContextRef context, CGSize size, BOOL isVertical, NSArray *runRanges, CGFloat verticalOffset) { - CGAffineTransform runTextMatrix = CTRunGetTextMatrix(run); - BOOL runTextMatrixIsID = CGAffineTransformIsIdentity(runTextMatrix); - - CFDictionaryRef runAttrs = CTRunGetAttributes(run); - NSValue *glyphTransformValue = (NSValue *)CFDictionaryGetValue(runAttrs, (__bridge const void *)(ASTextGlyphTransformAttributeName)); - if (!isVertical && !glyphTransformValue) { // draw run - if (!runTextMatrixIsID) { - CGContextSaveGState(context); - CGAffineTransform trans = CGContextGetTextMatrix(context); - CGContextSetTextMatrix(context, CGAffineTransformConcat(trans, runTextMatrix)); - } - CTRunDraw(run, context, CFRangeMake(0, 0)); - if (!runTextMatrixIsID) { - CGContextRestoreGState(context); - } - } else { // draw glyph - CTFontRef runFont = (CTFontRef)CFDictionaryGetValue(runAttrs, kCTFontAttributeName); - if (!runFont) return; - NSUInteger glyphCount = CTRunGetGlyphCount(run); - if (glyphCount <= 0) return; - - CGGlyph glyphs[glyphCount]; - CGPoint glyphPositions[glyphCount]; - CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs); - CTRunGetPositions(run, CFRangeMake(0, 0), glyphPositions); - - CGColorRef fillColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTForegroundColorAttributeName); - fillColor = ASTextGetCGColor(fillColor); - NSNumber *strokeWidth = (NSNumber *)CFDictionaryGetValue(runAttrs, kCTStrokeWidthAttributeName); - - CGContextSaveGState(context); { - CGContextSetFillColorWithColor(context, fillColor); - if (!strokeWidth || strokeWidth.floatValue == 0) { - CGContextSetTextDrawingMode(context, kCGTextFill); - } else { - CGColorRef strokeColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTStrokeColorAttributeName); - if (!strokeColor) strokeColor = fillColor; - CGContextSetStrokeColorWithColor(context, strokeColor); - CGContextSetLineWidth(context, CTFontGetSize(runFont) * fabs(strokeWidth.floatValue * 0.01)); - if (strokeWidth.floatValue > 0) { - CGContextSetTextDrawingMode(context, kCGTextStroke); - } else { - CGContextSetTextDrawingMode(context, kCGTextFillStroke); - } - } - - if (isVertical) { - CFIndex runStrIdx[glyphCount + 1]; - CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx); - CFRange runStrRange = CTRunGetStringRange(run); - runStrIdx[glyphCount] = runStrRange.location + runStrRange.length; - CGSize glyphAdvances[glyphCount]; - CTRunGetAdvances(run, CFRangeMake(0, 0), glyphAdvances); - CGFloat ascent = CTFontGetAscent(runFont); - CGFloat descent = CTFontGetDescent(runFont); - CGAffineTransform glyphTransform = glyphTransformValue.CGAffineTransformValue; - CGPoint zeroPoint = CGPointZero; - - for (ASTextRunGlyphRange *oneRange in runRanges) { - NSRange range = oneRange.glyphRangeInRun; - NSUInteger rangeMax = range.location + range.length; - ASTextRunGlyphDrawMode mode = oneRange.drawMode; - - for (NSUInteger g = range.location; g < rangeMax; g++) { - CGContextSaveGState(context); { - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - if (glyphTransformValue) { - CGContextSetTextMatrix(context, glyphTransform); - } - if (mode) { // CJK glyph, need rotated - CGFloat ofs = (ascent - descent) * 0.5; - CGFloat w = glyphAdvances[g].width * 0.5; - CGFloat x = line.position.x + verticalOffset + glyphPositions[g].y + (ofs - w); - CGFloat y = -line.position.y + size.height - glyphPositions[g].x - (ofs + w); - if (mode == ASTextRunGlyphDrawModeVerticalRotateMove) { - x += w; - y += w; - } - CGContextSetTextPosition(context, x, y); - } else { - CGContextRotateCTM(context, -M_PI_2); - CGContextSetTextPosition(context, - line.position.y - size.height + glyphPositions[g].x, - line.position.x + verticalOffset + glyphPositions[g].y); - } - - if (ASTextCTFontContainsColorBitmapGlyphs(runFont)) { - CTFontDrawGlyphs(runFont, glyphs + g, &zeroPoint, 1, context); - } else { - CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL); - CGContextSetFont(context, cgFont); - CGContextSetFontSize(context, CTFontGetSize(runFont)); - CGContextShowGlyphsAtPositions(context, glyphs + g, &zeroPoint, 1); - CGFontRelease(cgFont); - } - } CGContextRestoreGState(context); - } - } - } else { // not vertical - if (glyphTransformValue) { - CFIndex runStrIdx[glyphCount + 1]; - CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx); - CFRange runStrRange = CTRunGetStringRange(run); - runStrIdx[glyphCount] = runStrRange.location + runStrRange.length; - CGSize glyphAdvances[glyphCount]; - CTRunGetAdvances(run, CFRangeMake(0, 0), glyphAdvances); - CGAffineTransform glyphTransform = glyphTransformValue.CGAffineTransformValue; - CGPoint zeroPoint = CGPointZero; - - for (NSUInteger g = 0; g < glyphCount; g++) { - CGContextSaveGState(context); { - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - CGContextSetTextMatrix(context, glyphTransform); - CGContextSetTextPosition(context, - line.position.x + glyphPositions[g].x, - size.height - (line.position.y + glyphPositions[g].y)); - - if (ASTextCTFontContainsColorBitmapGlyphs(runFont)) { - CTFontDrawGlyphs(runFont, glyphs + g, &zeroPoint, 1, context); - } else { - CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL); - CGContextSetFont(context, cgFont); - CGContextSetFontSize(context, CTFontGetSize(runFont)); - CGContextShowGlyphsAtPositions(context, glyphs + g, &zeroPoint, 1); - CGFontRelease(cgFont); - } - } CGContextRestoreGState(context); - } - } else { - if (ASTextCTFontContainsColorBitmapGlyphs(runFont)) { - CTFontDrawGlyphs(runFont, glyphs, glyphPositions, glyphCount, context); - } else { - CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL); - CGContextSetFont(context, cgFont); - CGContextSetFontSize(context, CTFontGetSize(runFont)); - CGContextShowGlyphsAtPositions(context, glyphs, glyphPositions, glyphCount); - CGFontRelease(cgFont); - } - } - } - - } CGContextRestoreGState(context); - } -} - -static void ASTextSetLinePatternInContext(ASTextLineStyle style, CGFloat width, CGFloat phase, CGContextRef context){ - CGContextSetLineWidth(context, width); - CGContextSetLineCap(context, kCGLineCapButt); - CGContextSetLineJoin(context, kCGLineJoinMiter); - - CGFloat dash = 12, dot = 5, space = 3; - NSUInteger pattern = style & 0xF00; - if (pattern == ASTextLineStylePatternSolid) { - CGContextSetLineDash(context, phase, NULL, 0); - } else if (pattern == ASTextLineStylePatternDot) { - CGFloat lengths[2] = {width * dot, width * space}; - CGContextSetLineDash(context, phase, lengths, 2); - } else if (pattern == ASTextLineStylePatternDash) { - CGFloat lengths[2] = {width * dash, width * space}; - CGContextSetLineDash(context, phase, lengths, 2); - } else if (pattern == ASTextLineStylePatternDashDot) { - CGFloat lengths[4] = {width * dash, width * space, width * dot, width * space}; - CGContextSetLineDash(context, phase, lengths, 4); - } else if (pattern == ASTextLineStylePatternDashDotDot) { - CGFloat lengths[6] = {width * dash, width * space,width * dot, width * space, width * dot, width * space}; - CGContextSetLineDash(context, phase, lengths, 6); - } else if (pattern == ASTextLineStylePatternCircleDot) { - CGFloat lengths[2] = {width * 0, width * 3}; - CGContextSetLineDash(context, phase, lengths, 2); - CGContextSetLineCap(context, kCGLineCapRound); - CGContextSetLineJoin(context, kCGLineJoinRound); - } -} - - -static void ASTextDrawBorderRects(CGContextRef context, CGSize size, ASTextBorder *border, NSArray *rects, BOOL isVertical) { - if (rects.count == 0) return; - - ASTextShadow *shadow = border.shadow; - if (shadow.color) { - CGContextSaveGState(context); - CGContextSetShadowWithColor(context, shadow.offset, shadow.radius, shadow.color.CGColor); - CGContextBeginTransparencyLayer(context, NULL); - } - - NSMutableArray *paths = [NSMutableArray new]; - for (NSValue *value in rects) { - CGRect rect = value.CGRectValue; - if (isVertical) { - rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(border.insets)); - } else { - rect = UIEdgeInsetsInsetRect(rect, border.insets); - } - rect = ASTextCGRectPixelRound(rect); - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius]; - [path closePath]; - [paths addObject:path]; - } - - if (border.fillColor) { - CGContextSaveGState(context); - CGContextSetFillColorWithColor(context, border.fillColor.CGColor); - for (UIBezierPath *path in paths) { - CGContextAddPath(context, path.CGPath); - } - CGContextFillPath(context); - CGContextRestoreGState(context); - } - - if (border.strokeColor && border.lineStyle > 0 && border.strokeWidth > 0) { - - //-------------------------- single line ------------------------------// - CGContextSaveGState(context); - for (UIBezierPath *path in paths) { - CGRect bounds = CGRectUnion(path.bounds, (CGRect){CGPointZero, size}); - bounds = CGRectInset(bounds, -2 * border.strokeWidth, -2 * border.strokeWidth); - CGContextAddRect(context, bounds); - CGContextAddPath(context, path.CGPath); - CGContextEOClip(context); - } - [border.strokeColor setStroke]; - ASTextSetLinePatternInContext(border.lineStyle, border.strokeWidth, 0, context); - CGFloat inset = -border.strokeWidth * 0.5; - if ((border.lineStyle & 0xFF) == ASTextLineStyleThick) { - inset *= 2; - CGContextSetLineWidth(context, border.strokeWidth * 2); - } - CGFloat radiusDelta = -inset; - if (border.cornerRadius <= 0) { - radiusDelta = 0; - } - CGContextSetLineJoin(context, border.lineJoin); - for (NSValue *value in rects) { - CGRect rect = value.CGRectValue; - if (isVertical) { - rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(border.insets)); - } else { - rect = UIEdgeInsetsInsetRect(rect, border.insets); - } - rect = CGRectInset(rect, inset, inset); - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + radiusDelta]; - [path closePath]; - CGContextAddPath(context, path.CGPath); - } - CGContextStrokePath(context); - CGContextRestoreGState(context); - - //------------------------- second line ------------------------------// - if ((border.lineStyle & 0xFF) == ASTextLineStyleDouble) { - CGContextSaveGState(context); - CGFloat inset = -border.strokeWidth * 2; - for (NSValue *value in rects) { - CGRect rect = value.CGRectValue; - rect = UIEdgeInsetsInsetRect(rect, border.insets); - rect = CGRectInset(rect, inset, inset); - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + 2 * border.strokeWidth]; - [path closePath]; - - CGRect bounds = CGRectUnion(path.bounds, (CGRect){CGPointZero, size}); - bounds = CGRectInset(bounds, -2 * border.strokeWidth, -2 * border.strokeWidth); - CGContextAddRect(context, bounds); - CGContextAddPath(context, path.CGPath); - CGContextEOClip(context); - } - CGContextSetStrokeColorWithColor(context, border.strokeColor.CGColor); - ASTextSetLinePatternInContext(border.lineStyle, border.strokeWidth, 0, context); - CGContextSetLineJoin(context, border.lineJoin); - inset = -border.strokeWidth * 2.5; - radiusDelta = border.strokeWidth * 2; - if (border.cornerRadius <= 0) { - radiusDelta = 0; - } - for (NSValue *value in rects) { - CGRect rect = value.CGRectValue; - rect = UIEdgeInsetsInsetRect(rect, border.insets); - rect = CGRectInset(rect, inset, inset); - UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + radiusDelta]; - [path closePath]; - CGContextAddPath(context, path.CGPath); - } - CGContextStrokePath(context); - CGContextRestoreGState(context); - } - } - - if (shadow.color) { - CGContextEndTransparencyLayer(context); - CGContextRestoreGState(context); - } -} - -static void ASTextDrawLineStyle(CGContextRef context, CGFloat length, CGFloat lineWidth, ASTextLineStyle style, CGPoint position, CGColorRef color, BOOL isVertical) { - NSUInteger styleBase = style & 0xFF; - if (styleBase == 0) return; - - CGContextSaveGState(context); { - if (isVertical) { - CGFloat x, y1, y2, w; - y1 = ASRoundPixelValue(position.y); - y2 = ASRoundPixelValue(position.y + length); - w = (styleBase == ASTextLineStyleThick ? lineWidth * 2 : lineWidth); - - CGFloat linePixel = ASTextCGFloatToPixel(w); - if (fabs(linePixel - floor(linePixel)) < 0.1) { - int iPixel = linePixel; - if (iPixel == 0 || (iPixel % 2)) { // odd line pixel - x = ASTextCGFloatPixelHalf(position.x); - } else { - x = ASFloorPixelValue(position.x); - } - } else { - x = position.x; - } - - CGContextSetStrokeColorWithColor(context, color); - ASTextSetLinePatternInContext(style, lineWidth, position.y, context); - CGContextSetLineWidth(context, w); - if (styleBase == ASTextLineStyleSingle) { - CGContextMoveToPoint(context, x, y1); - CGContextAddLineToPoint(context, x, y2); - CGContextStrokePath(context); - } else if (styleBase == ASTextLineStyleThick) { - CGContextMoveToPoint(context, x, y1); - CGContextAddLineToPoint(context, x, y2); - CGContextStrokePath(context); - } else if (styleBase == ASTextLineStyleDouble) { - CGContextMoveToPoint(context, x - w, y1); - CGContextAddLineToPoint(context, x - w, y2); - CGContextStrokePath(context); - CGContextMoveToPoint(context, x + w, y1); - CGContextAddLineToPoint(context, x + w, y2); - CGContextStrokePath(context); - } - } else { - CGFloat x1, x2, y, w; - x1 = ASRoundPixelValue(position.x); - x2 = ASRoundPixelValue(position.x + length); - w = (styleBase == ASTextLineStyleThick ? lineWidth * 2 : lineWidth); - - CGFloat linePixel = ASTextCGFloatToPixel(w); - if (fabs(linePixel - floor(linePixel)) < 0.1) { - int iPixel = linePixel; - if (iPixel == 0 || (iPixel % 2)) { // odd line pixel - y = ASTextCGFloatPixelHalf(position.y); - } else { - y = ASFloorPixelValue(position.y); - } - } else { - y = position.y; - } - - CGContextSetStrokeColorWithColor(context, color); - ASTextSetLinePatternInContext(style, lineWidth, position.x, context); - CGContextSetLineWidth(context, w); - if (styleBase == ASTextLineStyleSingle) { - CGContextMoveToPoint(context, x1, y); - CGContextAddLineToPoint(context, x2, y); - CGContextStrokePath(context); - } else if (styleBase == ASTextLineStyleThick) { - CGContextMoveToPoint(context, x1, y); - CGContextAddLineToPoint(context, x2, y); - CGContextStrokePath(context); - } else if (styleBase == ASTextLineStyleDouble) { - CGContextMoveToPoint(context, x1, y - w); - CGContextAddLineToPoint(context, x2, y - w); - CGContextStrokePath(context); - CGContextMoveToPoint(context, x1, y + w); - CGContextAddLineToPoint(context, x2, y + w); - CGContextStrokePath(context); - } - } - } CGContextRestoreGState(context); -} - -static void ASTextDrawText(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) { - CGContextSaveGState(context); { - - CGContextTranslateCTM(context, point.x, point.y); - CGContextTranslateCTM(context, 0, size.height); - CGContextScaleCTM(context, 1, -1); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - NSArray *lines = layout.lines; - for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) { - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - NSArray *lineRunRanges = line.verticalRotateRange; - CGFloat posX = line.position.x + verticalOffset; - CGFloat posY = size.height - line.position.y; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - CGContextSetTextPosition(context, posX, posY); - ASTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset); - } - if (cancel && cancel()) break; - } - - // Use this to draw frame for test/debug. - // CGContextTranslateCTM(context, verticalOffset, size.height); - // CTFrameDraw(layout.frame, context); - - } CGContextRestoreGState(context); -} - -static void ASTextDrawBlockBorder(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) { - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - NSArray *lines = layout.lines; - for (NSInteger l = 0, lMax = lines.count; l < lMax; l++) { - if (cancel && cancel()) break; - - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFIndex glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextBorder *border = attrs[ASTextBlockBorderAttributeName]; - if (!border) continue; - - NSUInteger lineStartIndex = line.index; - while (lineStartIndex > 0) { - if (((ASTextLine *)lines[lineStartIndex - 1]).row == line.row) lineStartIndex--; - else break; - } - - CGRect unionRect = CGRectZero; - NSUInteger lineStartRow = ((ASTextLine *)lines[lineStartIndex]).row; - NSUInteger lineContinueIndex = lineStartIndex; - NSUInteger lineContinueRow = lineStartRow; - do { - ASTextLine *one = lines[lineContinueIndex]; - if (lineContinueIndex == lineStartIndex) { - unionRect = one.bounds; - } else { - unionRect = CGRectUnion(unionRect, one.bounds); - } - if (lineContinueIndex + 1 == lMax) break; - ASTextLine *next = lines[lineContinueIndex + 1]; - if (next.row != lineContinueRow) { - ASTextBorder *nextBorder = [layout.text as_attribute:ASTextBlockBorderAttributeName atIndex:next.range.location]; - if ([nextBorder isEqual:border]) { - lineContinueRow++; - } else { - break; - } - } - lineContinueIndex++; - } while (true); - - if (isVertical) { - UIEdgeInsets insets = layout.container.insets; - unionRect.origin.y = insets.top; - unionRect.size.height = layout.container.size.height -insets.top - insets.bottom; - } else { - UIEdgeInsets insets = layout.container.insets; - unionRect.origin.x = insets.left; - unionRect.size.width = layout.container.size.width -insets.left - insets.right; - } - unionRect.origin.x += verticalOffset; - ASTextDrawBorderRects(context, size, border, @[[NSValue valueWithCGRect:unionRect]], isVertical); - - l = lineContinueIndex; - break; - } - } - - - CGContextRestoreGState(context); -} - -static void ASTextDrawBorder(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, ASTextBorderType type, BOOL (^cancel)(void)) { - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - NSArray *lines = layout.lines; - NSString *borderKey = (type == ASTextBorderTypeNormal ? ASTextBorderAttributeName : ASTextBackgroundBorderAttributeName); - - BOOL needJumpRun = NO; - NSUInteger jumpRunIndex = 0; - - for (NSInteger l = 0, lMax = lines.count; l < lMax; l++) { - if (cancel && cancel()) break; - - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - if (needJumpRun) { - needJumpRun = NO; - r = jumpRunIndex + 1; - if (r >= rMax) break; - } - - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFIndex glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextBorder *border = attrs[borderKey]; - if (!border) continue; - - CFRange runRange = CTRunGetStringRange(run); - if (runRange.location == kCFNotFound || runRange.length == 0) continue; - if (runRange.location + runRange.length > layout.text.length) continue; - - NSMutableArray *runRects = [NSMutableArray new]; - NSInteger endLineIndex = l; - NSInteger endRunIndex = r; - BOOL endFound = NO; - for (NSInteger ll = l; ll < lMax; ll++) { - if (endFound) break; - ASTextLine *iLine = lines[ll]; - CFArrayRef iRuns = CTLineGetGlyphRuns(iLine.CTLine); - - CGRect extLineRect = CGRectNull; - for (NSInteger rr = (ll == l) ? r : 0, rrMax = CFArrayGetCount(iRuns); rr < rrMax; rr++) { - CTRunRef iRun = (CTRunRef)CFArrayGetValueAtIndex(iRuns, rr); - NSDictionary *iAttrs = (id)CTRunGetAttributes(iRun); - ASTextBorder *iBorder = iAttrs[borderKey]; - if (![border isEqual:iBorder]) { - endFound = YES; - break; - } - endLineIndex = ll; - endRunIndex = rr; - - CGPoint iRunPosition = CGPointZero; - CTRunGetPositions(iRun, CFRangeMake(0, 1), &iRunPosition); - CGFloat ascent, descent; - CGFloat iRunWidth = CTRunGetTypographicBounds(iRun, CFRangeMake(0, 0), &ascent, &descent, NULL); - - if (isVertical) { - ASTEXT_SWAP(iRunPosition.x, iRunPosition.y); - iRunPosition.y += iLine.position.y; - CGRect iRect = CGRectMake(verticalOffset + line.position.x - descent, iRunPosition.y, ascent + descent, iRunWidth); - if (CGRectIsNull(extLineRect)) { - extLineRect = iRect; - } else { - extLineRect = CGRectUnion(extLineRect, iRect); - } - } else { - iRunPosition.x += iLine.position.x; - CGRect iRect = CGRectMake(iRunPosition.x, iLine.position.y - ascent, iRunWidth, ascent + descent); - if (CGRectIsNull(extLineRect)) { - extLineRect = iRect; - } else { - extLineRect = CGRectUnion(extLineRect, iRect); - } - } - } - - if (!CGRectIsNull(extLineRect)) { - [runRects addObject:[NSValue valueWithCGRect:extLineRect]]; - } - } - - NSMutableArray *drawRects = [NSMutableArray new]; - CGRect curRect= ((NSValue *)[runRects firstObject]).CGRectValue; - for (NSInteger re = 0, reMax = runRects.count; re < reMax; re++) { - CGRect rect = ((NSValue *)runRects[re]).CGRectValue; - if (isVertical) { - if (fabs(rect.origin.x - curRect.origin.x) < 1) { - curRect = ASTextMergeRectInSameLine(rect, curRect, isVertical); - } else { - [drawRects addObject:[NSValue valueWithCGRect:curRect]]; - curRect = rect; - } - } else { - if (fabs(rect.origin.y - curRect.origin.y) < 1) { - curRect = ASTextMergeRectInSameLine(rect, curRect, isVertical); - } else { - [drawRects addObject:[NSValue valueWithCGRect:curRect]]; - curRect = rect; - } - } - } - if (!CGRectEqualToRect(curRect, CGRectZero)) { - [drawRects addObject:[NSValue valueWithCGRect:curRect]]; - } - - ASTextDrawBorderRects(context, size, border, drawRects, isVertical); - - if (l == endLineIndex) { - r = endRunIndex; - } else { - l = endLineIndex - 1; - needJumpRun = YES; - jumpRunIndex = endRunIndex; - break; - } - - } - } - - CGContextRestoreGState(context); -} - -static void ASTextDrawDecoration(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, ASTextDecorationType type, BOOL (^cancel)(void)) { - NSArray *lines = layout.lines; - - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - CGContextTranslateCTM(context, verticalOffset, 0); - - for (NSUInteger l = 0, lMax = layout.lines.count; l < lMax; l++) { - if (cancel && cancel()) break; - - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFIndex glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextDecoration *underline = attrs[ASTextUnderlineAttributeName]; - ASTextDecoration *strikethrough = attrs[ASTextStrikethroughAttributeName]; - - BOOL needDrawUnderline = NO, needDrawStrikethrough = NO; - if ((type & ASTextDecorationTypeUnderline) && underline.style > 0) { - needDrawUnderline = YES; - } - if ((type & ASTextDecorationTypeStrikethrough) && strikethrough.style > 0) { - needDrawStrikethrough = YES; - } - if (!needDrawUnderline && !needDrawStrikethrough) continue; - - CFRange runRange = CTRunGetStringRange(run); - if (runRange.location == kCFNotFound || runRange.length == 0) continue; - if (runRange.location + runRange.length > layout.text.length) continue; - NSString *runStr = [layout.text attributedSubstringFromRange:NSMakeRange(runRange.location, runRange.length)].string; - if (ASTextIsLinebreakString(runStr)) continue; // may need more checks... - - CGFloat xHeight, underlinePosition, lineThickness; - ASTextGetRunsMaxMetric(runs, &xHeight, &underlinePosition, &lineThickness); - - CGPoint underlineStart, strikethroughStart; - CGFloat length; - - if (isVertical) { - underlineStart.x = line.position.x + underlinePosition; - strikethroughStart.x = line.position.x + xHeight / 2; - - CGPoint runPosition = CGPointZero; - CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition); - underlineStart.y = strikethroughStart.y = runPosition.x + line.position.y; - length = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL); - - } else { - underlineStart.y = line.position.y - underlinePosition; - strikethroughStart.y = line.position.y - xHeight / 2; - - CGPoint runPosition = CGPointZero; - CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition); - underlineStart.x = strikethroughStart.x = runPosition.x + line.position.x; - length = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL); - } - - if (needDrawUnderline) { - CGColorRef color = underline.color.CGColor; - if (!color) { - color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]); - color = ASTextGetCGColor(color); - } - CGFloat thickness = underline.width ? underline.width.floatValue : lineThickness; - ASTextShadow *shadow = underline.shadow; - while (shadow) { - if (!shadow.color) { - shadow = shadow.subShadow; - continue; - } - CGFloat offsetAlterX = size.width + 0xFFFF; - CGContextSaveGState(context); { - CGSize offset = shadow.offset; - offset.width -= offsetAlterX; - CGContextSaveGState(context); { - CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor); - CGContextSetBlendMode(context, shadow.blendMode); - CGContextTranslateCTM(context, offsetAlterX, 0); - ASTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical); - } CGContextRestoreGState(context); - } CGContextRestoreGState(context); - shadow = shadow.subShadow; - } - ASTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical); - } - - if (needDrawStrikethrough) { - CGColorRef color = strikethrough.color.CGColor; - if (!color) { - color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]); - color = ASTextGetCGColor(color); - } - CGFloat thickness = strikethrough.width ? strikethrough.width.floatValue : lineThickness; - ASTextShadow *shadow = underline.shadow; - while (shadow) { - if (!shadow.color) { - shadow = shadow.subShadow; - continue; - } - CGFloat offsetAlterX = size.width + 0xFFFF; - CGContextSaveGState(context); { - CGSize offset = shadow.offset; - offset.width -= offsetAlterX; - CGContextSaveGState(context); { - CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor); - CGContextSetBlendMode(context, shadow.blendMode); - CGContextTranslateCTM(context, offsetAlterX, 0); - ASTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical); - } CGContextRestoreGState(context); - } CGContextRestoreGState(context); - shadow = shadow.subShadow; - } - ASTextDrawLineStyle(context, length, thickness, strikethrough.style, strikethroughStart, color, isVertical); - } - } - } - CGContextRestoreGState(context); -} - -static void ASTextDrawAttachment(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, UIView *targetView, CALayer *targetLayer, BOOL (^cancel)(void)) { - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - for (NSUInteger i = 0, max = layout.attachments.count; i < max; i++) { - ASTextAttachment *a = layout.attachments[i]; - if (!a.content) continue; - - UIImage *image = nil; - UIView *view = nil; - CALayer *layer = nil; - if ([a.content isKindOfClass:[UIImage class]]) { - image = a.content; - } else if ([a.content isKindOfClass:[UIView class]]) { - view = a.content; - } else if ([a.content isKindOfClass:[CALayer class]]) { - layer = a.content; - } - if (!image && !view && !layer) continue; - if (image && !context) continue; - if (view && !targetView) continue; - if (layer && !targetLayer) continue; - if (cancel && cancel()) break; - - CGSize asize = image ? image.size : view ? view.frame.size : layer.frame.size; - CGRect rect = ((NSValue *)layout.attachmentRects[i]).CGRectValue; - if (isVertical) { - rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(a.contentInsets)); - } else { - rect = UIEdgeInsetsInsetRect(rect, a.contentInsets); - } - rect = ASTextCGRectFitWithContentMode(rect, asize, a.contentMode); - rect = ASTextCGRectPixelRound(rect); - rect = CGRectStandardize(rect); - rect.origin.x += point.x + verticalOffset; - rect.origin.y += point.y; - if (image) { - CGImageRef ref = image.CGImage; - if (ref) { - CGContextSaveGState(context); - CGContextTranslateCTM(context, 0, CGRectGetMaxY(rect) + CGRectGetMinY(rect)); - CGContextScaleCTM(context, 1, -1); - CGContextDrawImage(context, rect, ref); - CGContextRestoreGState(context); - } - } else if (view) { - view.frame = rect; - [targetView addSubview:view]; - } else if (layer) { - layer.frame = rect; - [targetLayer addSublayer:layer]; - } - } -} - -static void ASTextDrawShadow(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) { - //move out of context. (0xFFFF is just a random large number) - CGFloat offsetAlterX = size.width + 0xFFFF; - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - CGContextSaveGState(context); { - CGContextTranslateCTM(context, point.x, point.y); - CGContextTranslateCTM(context, 0, size.height); - CGContextScaleCTM(context, 1, -1); - NSArray *lines = layout.lines; - for (NSUInteger l = 0, lMax = layout.lines.count; l < lMax; l++) { - if (cancel && cancel()) break; - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - NSArray *lineRunRanges = line.verticalRotateRange; - CGFloat linePosX = line.position.x; - CGFloat linePosY = size.height - line.position.y; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - CGContextSetTextPosition(context, linePosX, linePosY); - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextShadow *shadow = attrs[ASTextShadowAttributeName]; - ASTextShadow *nsShadow = [ASTextShadow shadowWithNSShadow:attrs[NSShadowAttributeName]]; // NSShadow compatible - if (nsShadow) { - nsShadow.subShadow = shadow; - shadow = nsShadow; - } - while (shadow) { - if (!shadow.color) { - shadow = shadow.subShadow; - continue; - } - CGSize offset = shadow.offset; - offset.width -= offsetAlterX; - CGContextSaveGState(context); { - CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor); - CGContextSetBlendMode(context, shadow.blendMode); - CGContextTranslateCTM(context, offsetAlterX, 0); - ASTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset); - } CGContextRestoreGState(context); - shadow = shadow.subShadow; - } - } - } - } CGContextRestoreGState(context); -} - -static void ASTextDrawInnerShadow(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) { - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - CGContextTranslateCTM(context, 0, size.height); - CGContextScaleCTM(context, 1, -1); - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - - NSArray *lines = layout.lines; - for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) { - if (cancel && cancel()) break; - - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - NSArray *lineRunRanges = line.verticalRotateRange; - CGFloat linePosX = line.position.x; - CGFloat linePosY = size.height - line.position.y; - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - if (CTRunGetGlyphCount(run) == 0) continue; - CGContextSetTextMatrix(context, CGAffineTransformIdentity); - CGContextSetTextPosition(context, linePosX, linePosY); - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextShadow *shadow = attrs[ASTextInnerShadowAttributeName]; - while (shadow) { - if (!shadow.color) { - shadow = shadow.subShadow; - continue; - } - CGPoint runPosition = CGPointZero; - CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition); - CGRect runImageBounds = CTRunGetImageBounds(run, context, CFRangeMake(0, 0)); - runImageBounds.origin.x += runPosition.x; - if (runImageBounds.size.width < 0.1 || runImageBounds.size.height < 0.1) continue; - - CFDictionaryRef runAttrs = CTRunGetAttributes(run); - NSValue *glyphTransformValue = (NSValue *)CFDictionaryGetValue(runAttrs, (__bridge const void *)(ASTextGlyphTransformAttributeName)); - if (glyphTransformValue) { - runImageBounds = CGRectMake(0, 0, size.width, size.height); - } - - // text inner shadow - CGContextSaveGState(context); { - CGContextSetBlendMode(context, shadow.blendMode); - CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL); - CGContextSetAlpha(context, CGColorGetAlpha(shadow.color.CGColor)); - CGContextClipToRect(context, runImageBounds); - CGContextBeginTransparencyLayer(context, NULL); { - UIColor *opaqueShadowColor = [shadow.color colorWithAlphaComponent:1]; - CGContextSetShadowWithColor(context, shadow.offset, shadow.radius, opaqueShadowColor.CGColor); - CGContextSetFillColorWithColor(context, opaqueShadowColor.CGColor); - CGContextSetBlendMode(context, kCGBlendModeSourceOut); - CGContextBeginTransparencyLayer(context, NULL); { - CGContextFillRect(context, runImageBounds); - CGContextSetBlendMode(context, kCGBlendModeDestinationIn); - CGContextBeginTransparencyLayer(context, NULL); { - ASTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset); - } CGContextEndTransparencyLayer(context); - } CGContextEndTransparencyLayer(context); - } CGContextEndTransparencyLayer(context); - } CGContextRestoreGState(context); - shadow = shadow.subShadow; - } - } - } - - CGContextRestoreGState(context); -} - -static void ASTextDrawDebug(ASTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, ASTextDebugOption *op) { - UIGraphicsPushContext(context); - CGContextSaveGState(context); - CGContextTranslateCTM(context, point.x, point.y); - CGContextSetLineWidth(context, 1.0 / ASScreenScale()); - CGContextSetLineDash(context, 0, NULL, 0); - CGContextSetLineJoin(context, kCGLineJoinMiter); - CGContextSetLineCap(context, kCGLineCapButt); - - BOOL isVertical = layout.container.verticalForm; - CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0; - CGContextTranslateCTM(context, verticalOffset, 0); - - if (op.CTFrameBorderColor || op.CTFrameFillColor) { - UIBezierPath *path = layout.container.path; - if (!path) { - CGRect rect = (CGRect){CGPointZero, layout.container.size}; - rect = UIEdgeInsetsInsetRect(rect, layout.container.insets); - if (op.CTFrameBorderColor) rect = ASTextCGRectPixelHalf(rect); - else rect = ASTextCGRectPixelRound(rect); - path = [UIBezierPath bezierPathWithRect:rect]; - } - [path closePath]; - - for (UIBezierPath *ex in layout.container.exclusionPaths) { - [path appendPath:ex]; - } - if (op.CTFrameFillColor) { - [op.CTFrameFillColor setFill]; - if (layout.container.pathLineWidth > 0) { - CGContextSaveGState(context); { - CGContextBeginTransparencyLayer(context, NULL); { - CGContextAddPath(context, path.CGPath); - if (layout.container.pathFillEvenOdd) { - CGContextEOFillPath(context); - } else { - CGContextFillPath(context); - } - CGContextSetBlendMode(context, kCGBlendModeDestinationOut); - [[UIColor blackColor] setFill]; - CGPathRef cgPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL, layout.container.pathLineWidth, kCGLineCapButt, kCGLineJoinMiter, 0); - if (cgPath) { - CGContextAddPath(context, cgPath); - CGContextFillPath(context); - } - CGPathRelease(cgPath); - } CGContextEndTransparencyLayer(context); - } CGContextRestoreGState(context); - } else { - CGContextAddPath(context, path.CGPath); - if (layout.container.pathFillEvenOdd) { - CGContextEOFillPath(context); - } else { - CGContextFillPath(context); - } - } - } - if (op.CTFrameBorderColor) { - CGContextSaveGState(context); { - if (layout.container.pathLineWidth > 0) { - CGContextSetLineWidth(context, layout.container.pathLineWidth); - } - [op.CTFrameBorderColor setStroke]; - CGContextAddPath(context, path.CGPath); - CGContextStrokePath(context); - } CGContextRestoreGState(context); - } - } - - NSArray *lines = layout.lines; - for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) { - ASTextLine *line = lines[l]; - if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine; - CGRect lineBounds = line.bounds; - if (op.CTLineFillColor) { - [op.CTLineFillColor setFill]; - CGContextAddRect(context, ASTextCGRectPixelRound(lineBounds)); - CGContextFillPath(context); - } - if (op.CTLineBorderColor) { - [op.CTLineBorderColor setStroke]; - CGContextAddRect(context, ASTextCGRectPixelHalf(lineBounds)); - CGContextStrokePath(context); - } - if (op.baselineColor) { - [op.baselineColor setStroke]; - if (isVertical) { - CGFloat x = ASTextCGFloatPixelHalf(line.position.x); - CGFloat y1 = ASTextCGFloatPixelHalf(line.top); - CGFloat y2 = ASTextCGFloatPixelHalf(line.bottom); - CGContextMoveToPoint(context, x, y1); - CGContextAddLineToPoint(context, x, y2); - CGContextStrokePath(context); - } else { - CGFloat x1 = ASTextCGFloatPixelHalf(lineBounds.origin.x); - CGFloat x2 = ASTextCGFloatPixelHalf(lineBounds.origin.x + lineBounds.size.width); - CGFloat y = ASTextCGFloatPixelHalf(line.position.y); - CGContextMoveToPoint(context, x1, y); - CGContextAddLineToPoint(context, x2, y); - CGContextStrokePath(context); - } - } - if (op.CTLineNumberColor) { - [op.CTLineNumberColor set]; - NSMutableAttributedString *num = [[NSMutableAttributedString alloc] initWithString:@(l).description]; - num.as_color = op.CTLineNumberColor; - num.as_font = [UIFont systemFontOfSize:6]; - [num drawAtPoint:CGPointMake(line.position.x, line.position.y - (isVertical ? 1 : 6))]; - } - if (op.CTRunFillColor || op.CTRunBorderColor || op.CTRunNumberColor || op.CGGlyphFillColor || op.CGGlyphBorderColor) { - CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine); - for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFIndex glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - - CGPoint glyphPositions[glyphCount]; - CTRunGetPositions(run, CFRangeMake(0, glyphCount), glyphPositions); - - CGSize glyphAdvances[glyphCount]; - CTRunGetAdvances(run, CFRangeMake(0, glyphCount), glyphAdvances); - - CGPoint runPosition = glyphPositions[0]; - if (isVertical) { - ASTEXT_SWAP(runPosition.x, runPosition.y); - runPosition.x = line.position.x; - runPosition.y += line.position.y; - } else { - runPosition.x += line.position.x; - runPosition.y = line.position.y - runPosition.y; - } - - CGFloat ascent, descent, leading; - CGFloat width = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), &ascent, &descent, &leading); - CGRect runTypoBounds; - if (isVertical) { - runTypoBounds = CGRectMake(runPosition.x - descent, runPosition.y, ascent + descent, width); - } else { - runTypoBounds = CGRectMake(runPosition.x, line.position.y - ascent, width, ascent + descent); - } - - if (op.CTRunFillColor) { - [op.CTRunFillColor setFill]; - CGContextAddRect(context, ASTextCGRectPixelRound(runTypoBounds)); - CGContextFillPath(context); - } - if (op.CTRunBorderColor) { - [op.CTRunBorderColor setStroke]; - CGContextAddRect(context, ASTextCGRectPixelHalf(runTypoBounds)); - CGContextStrokePath(context); - } - if (op.CTRunNumberColor) { - [op.CTRunNumberColor set]; - NSMutableAttributedString *num = [[NSMutableAttributedString alloc] initWithString:@(r).description]; - num.as_color = op.CTRunNumberColor; - num.as_font = [UIFont systemFontOfSize:6]; - [num drawAtPoint:CGPointMake(runTypoBounds.origin.x, runTypoBounds.origin.y - 1)]; - } - if (op.CGGlyphBorderColor || op.CGGlyphFillColor) { - for (NSUInteger g = 0; g < glyphCount; g++) { - CGPoint pos = glyphPositions[g]; - CGSize adv = glyphAdvances[g]; - CGRect rect; - if (isVertical) { - ASTEXT_SWAP(pos.x, pos.y); - pos.x = runPosition.x; - pos.y += line.position.y; - rect = CGRectMake(pos.x - descent, pos.y, runTypoBounds.size.width, adv.width); - } else { - pos.x += line.position.x; - pos.y = runPosition.y; - rect = CGRectMake(pos.x, pos.y - ascent, adv.width, runTypoBounds.size.height); - } - if (op.CGGlyphFillColor) { - [op.CGGlyphFillColor setFill]; - CGContextAddRect(context, ASTextCGRectPixelRound(rect)); - CGContextFillPath(context); - } - if (op.CGGlyphBorderColor) { - [op.CGGlyphBorderColor setStroke]; - CGContextAddRect(context, ASTextCGRectPixelHalf(rect)); - CGContextStrokePath(context); - } - } - } - } - } - } - CGContextRestoreGState(context); - UIGraphicsPopContext(); -} - - -- (void)drawInContext:(CGContextRef)context - size:(CGSize)size - point:(CGPoint)point - view:(UIView *)view - layer:(CALayer *)layer - debug:(ASTextDebugOption *)debug - cancel:(BOOL (^)(void))cancel{ - @autoreleasepool { - if (self.needDrawBlockBorder && context) { - if (cancel && cancel()) return; - ASTextDrawBlockBorder(self, context, size, point, cancel); - } - if (self.needDrawBackgroundBorder && context) { - if (cancel && cancel()) return; - ASTextDrawBorder(self, context, size, point, ASTextBorderTypeBackgound, cancel); - } - if (self.needDrawShadow && context) { - if (cancel && cancel()) return; - ASTextDrawShadow(self, context, size, point, cancel); - } - if (self.needDrawUnderline && context) { - if (cancel && cancel()) return; - ASTextDrawDecoration(self, context, size, point, ASTextDecorationTypeUnderline, cancel); - } - if (self.needDrawText && context) { - if (cancel && cancel()) return; - ASTextDrawText(self, context, size, point, cancel); - } - if (self.needDrawAttachment && (context || view || layer)) { - if (cancel && cancel()) return; - ASTextDrawAttachment(self, context, size, point, view, layer, cancel); - } - if (self.needDrawInnerShadow && context) { - if (cancel && cancel()) return; - ASTextDrawInnerShadow(self, context, size, point, cancel); - } - if (self.needDrawStrikethrough && context) { - if (cancel && cancel()) return; - ASTextDrawDecoration(self, context, size, point, ASTextDecorationTypeStrikethrough, cancel); - } - if (self.needDrawBorder && context) { - if (cancel && cancel()) return; - ASTextDrawBorder(self, context, size, point, ASTextBorderTypeNormal, cancel); - } - if (debug.needDrawDebug && context) { - if (cancel && cancel()) return; - ASTextDrawDebug(self, context, size, point, debug); - } - } -} - -- (void)drawInContext:(CGContextRef)context - size:(CGSize)size - debug:(ASTextDebugOption *)debug { - [self drawInContext:context size:size point:CGPointZero view:nil layer:nil debug:debug cancel:nil]; -} - -@end diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.h b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.h deleted file mode 100644 index acb02e99..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// ASTextLine.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -@class ASTextRunGlyphRange; - -NS_ASSUME_NONNULL_BEGIN - -/** - A text line object wrapped `CTLineRef`, see `ASTextLayout` for more. - */ -@interface ASTextLine : NSObject - -+ (instancetype)lineWithCTLine:(CTLineRef)CTLine position:(CGPoint)position vertical:(BOOL)isVertical NS_RETURNS_RETAINED; - -@property (nonatomic) NSUInteger index; ///< line index -@property (nonatomic) NSUInteger row; ///< line row -@property (nullable, nonatomic) NSArray *> *verticalRotateRange; ///< Run rotate range - -@property (nonatomic, readonly) CTLineRef CTLine; ///< CoreText line -@property (nonatomic, readonly) NSRange range; ///< string range -@property (nonatomic, readonly) BOOL vertical; ///< vertical form - -@property (nonatomic, readonly) CGRect bounds; ///< bounds (ascent + descent) -@property (nonatomic, readonly) CGSize size; ///< bounds.size -@property (nonatomic, readonly) CGFloat width; ///< bounds.size.width -@property (nonatomic, readonly) CGFloat height; ///< bounds.size.height -@property (nonatomic, readonly) CGFloat top; ///< bounds.origin.y -@property (nonatomic, readonly) CGFloat bottom; ///< bounds.origin.y + bounds.size.height -@property (nonatomic, readonly) CGFloat left; ///< bounds.origin.x -@property (nonatomic, readonly) CGFloat right; ///< bounds.origin.x + bounds.size.width - -@property (nonatomic) CGPoint position; ///< baseline position -@property (nonatomic, readonly) CGFloat ascent; ///< line ascent -@property (nonatomic, readonly) CGFloat descent; ///< line descent -@property (nonatomic, readonly) CGFloat leading; ///< line leading -@property (nonatomic, readonly) CGFloat lineWidth; ///< line width -@property (nonatomic, readonly) CGFloat trailingWhitespaceWidth; - -@property (nullable, nonatomic, readonly) NSArray *attachments; ///< ASTextAttachment -@property (nullable, nonatomic, readonly) NSArray *attachmentRanges; ///< NSRange(NSValue) -@property (nullable, nonatomic, readonly) NSArray *attachmentRects; ///< CGRect(NSValue) - -@end - - -typedef NS_ENUM(NSUInteger, ASTextRunGlyphDrawMode) { - /// No rotate. - ASTextRunGlyphDrawModeHorizontal = 0, - - /// Rotate vertical for single glyph. - ASTextRunGlyphDrawModeVerticalRotate = 1, - - /// Rotate vertical for single glyph, and move the glyph to a better position, - /// such as fullwidth punctuation. - ASTextRunGlyphDrawModeVerticalRotateMove = 2, -}; - -/** - A range in CTRun, used for vertical form. - */ -@interface ASTextRunGlyphRange : NSObject -@property (nonatomic) NSRange glyphRangeInRun; -@property (nonatomic) ASTextRunGlyphDrawMode drawMode; -+ (instancetype)rangeWithRange:(NSRange)range drawMode:(ASTextRunGlyphDrawMode)mode NS_RETURNS_RETAINED; -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.mm b/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.mm deleted file mode 100644 index 37c68e02..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Component/ASTextLine.mm +++ /dev/null @@ -1,169 +0,0 @@ -// -// ASTextLine.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -@implementation ASTextLine { - CGFloat _firstGlyphPos; // first glyph position for baseline, typically 0. -} - -+ (instancetype)lineWithCTLine:(CTLineRef)CTLine position:(CGPoint)position vertical:(BOOL)isVertical NS_RETURNS_RETAINED { - if (!CTLine) return nil; - ASTextLine *line = [self new]; - line->_position = position; - line->_vertical = isVertical; - [line setCTLine:CTLine]; - return line; -} - -- (void)dealloc { - if (_CTLine) CFRelease(_CTLine); -} - -- (void)setCTLine:(_Nonnull CTLineRef)CTLine { - if (_CTLine != CTLine) { - if (CTLine) CFRetain(CTLine); - if (_CTLine) CFRelease(_CTLine); - _CTLine = CTLine; - if (_CTLine) { - _lineWidth = CTLineGetTypographicBounds(_CTLine, &_ascent, &_descent, &_leading); - CFRange range = CTLineGetStringRange(_CTLine); - _range = NSMakeRange(range.location, range.length); - if (CTLineGetGlyphCount(_CTLine) > 0) { - CFArrayRef runs = CTLineGetGlyphRuns(_CTLine); - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, 0); - CGPoint pos; - CTRunGetPositions(run, CFRangeMake(0, 1), &pos); - _firstGlyphPos = pos.x; - } else { - _firstGlyphPos = 0; - } - _trailingWhitespaceWidth = CTLineGetTrailingWhitespaceWidth(_CTLine); - } else { - _lineWidth = _ascent = _descent = _leading = _firstGlyphPos = _trailingWhitespaceWidth = 0; - _range = NSMakeRange(0, 0); - } - [self reloadBounds]; - } -} - -- (void)setPosition:(CGPoint)position { - _position = position; - [self reloadBounds]; -} - -- (void)reloadBounds { - if (_vertical) { - _bounds = CGRectMake(_position.x - _descent, _position.y, _ascent + _descent, _lineWidth); - _bounds.origin.y += _firstGlyphPos; - } else { - _bounds = CGRectMake(_position.x, _position.y - _ascent, _lineWidth, _ascent + _descent); - _bounds.origin.x += _firstGlyphPos; - } - - _attachments = nil; - _attachmentRanges = nil; - _attachmentRects = nil; - if (!_CTLine) return; - CFArrayRef runs = CTLineGetGlyphRuns(_CTLine); - NSUInteger runCount = CFArrayGetCount(runs); - if (runCount == 0) return; - - NSMutableArray *attachments = nil; - NSMutableArray *attachmentRanges = nil; - NSMutableArray *attachmentRects = nil; - for (NSUInteger r = 0; r < runCount; r++) { - CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runs, r); - CFIndex glyphCount = CTRunGetGlyphCount(run); - if (glyphCount == 0) continue; - NSDictionary *attrs = (id)CTRunGetAttributes(run); - ASTextAttachment *attachment = attrs[ASTextAttachmentAttributeName]; - if (attachment) { - CGPoint runPosition = CGPointZero; - CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition); - - CGFloat ascent, descent, leading, runWidth; - CGRect runTypoBounds; - runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), &ascent, &descent, &leading); - - if (_vertical) { - ASTEXT_SWAP(runPosition.x, runPosition.y); - runPosition.y = _position.y + runPosition.y; - runTypoBounds = CGRectMake(_position.x + runPosition.x - descent, runPosition.y , ascent + descent, runWidth); - } else { - runPosition.x += _position.x; - runPosition.y = _position.y - runPosition.y; - runTypoBounds = CGRectMake(runPosition.x, runPosition.y - ascent, runWidth, ascent + descent); - } - - NSRange runRange = ASTextNSRangeFromCFRange(CTRunGetStringRange(run)); - if (!attachments) { - attachments = [[NSMutableArray alloc] init]; - attachmentRanges = [[NSMutableArray alloc] init]; - attachmentRects = [[NSMutableArray alloc] init]; - } - [attachments addObject:attachment]; - [attachmentRanges addObject:[NSValue valueWithRange:runRange]]; - [attachmentRects addObject:[NSValue valueWithCGRect:runTypoBounds]]; - } - } - _attachments = attachments; - _attachmentRanges = attachmentRanges; - _attachmentRects = attachmentRects; -} - -- (CGSize)size { - return _bounds.size; -} - -- (CGFloat)width { - return CGRectGetWidth(_bounds); -} - -- (CGFloat)height { - return CGRectGetHeight(_bounds); -} - -- (CGFloat)top { - return CGRectGetMinY(_bounds); -} - -- (CGFloat)bottom { - return CGRectGetMaxY(_bounds); -} - -- (CGFloat)left { - return CGRectGetMinX(_bounds); -} - -- (CGFloat)right { - return CGRectGetMaxX(_bounds); -} - -- (NSString *)description { - NSMutableString *desc = @"".mutableCopy; - NSRange range = self.range; - [desc appendFormat:@" row:%ld range:%tu,%tu", self, (long)self.row, range.location, range.length]; - [desc appendFormat:@" position:%@",NSStringFromCGPoint(self.position)]; - [desc appendFormat:@" bounds:%@",NSStringFromCGRect(self.bounds)]; - return desc; -} - -@end - - -@implementation ASTextRunGlyphRange -+ (instancetype)rangeWithRange:(NSRange)range drawMode:(ASTextRunGlyphDrawMode)mode NS_RETURNS_RETAINED { - ASTextRunGlyphRange *one = [self new]; - one.glyphRangeInRun = range; - one.drawMode = mode; - return one; -} -@end diff --git a/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.h b/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.h deleted file mode 100644 index 571334ed..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.h +++ /dev/null @@ -1,346 +0,0 @@ -// -// ASTextAttribute.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -#pragma mark - Enum Define - -/// The attribute type -typedef NS_OPTIONS(NSInteger, ASTextAttributeType) { - ASTextAttributeTypeNone = 0, - ASTextAttributeTypeUIKit = 1 << 0, ///< UIKit attributes, such as UILabel/UITextField/drawInRect. - ASTextAttributeTypeCoreText = 1 << 1, ///< CoreText attributes, used by CoreText. - ASTextAttributeTypeASText = 1 << 2, ///< ASText attributes, used by ASText. -}; - -/// Get the attribute type from an attribute name. -ASDK_EXTERN ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); - -/** - Line style in ASText (similar to NSUnderlineStyle). - */ -typedef NS_OPTIONS (NSInteger, ASTextLineStyle) { - // basic style (bitmask:0xFF) - ASTextLineStyleNone = 0x00, ///< ( ) Do not draw a line (Default). - ASTextLineStyleSingle = 0x01, ///< (──────) Draw a single line. - ASTextLineStyleThick = 0x02, ///< (━━━━━━━) Draw a thick line. - ASTextLineStyleDouble = 0x09, ///< (══════) Draw a double line. - - // style pattern (bitmask:0xF00) - ASTextLineStylePatternSolid = 0x000, ///< (────────) Draw a solid line (Default). - ASTextLineStylePatternDot = 0x100, ///< (‑ ‑ ‑ ‑ ‑ ‑) Draw a line of dots. - ASTextLineStylePatternDash = 0x200, ///< (— — — —) Draw a line of dashes. - ASTextLineStylePatternDashDot = 0x300, ///< (— ‑ — ‑ — ‑) Draw a line of alternating dashes and dots. - ASTextLineStylePatternDashDotDot = 0x400, ///< (— ‑ ‑ — ‑ ‑) Draw a line of alternating dashes and two dots. - ASTextLineStylePatternCircleDot = 0x900, ///< (••••••••••••) Draw a line of small circle dots. -}; - -/** - Text vertical alignment. - */ -typedef NS_ENUM(NSInteger, ASTextVerticalAlignment) { - ASTextVerticalAlignmentTop = 0, ///< Top alignment. - ASTextVerticalAlignmentCenter = 1, ///< Center alignment. - ASTextVerticalAlignmentBottom = 2, ///< Bottom alignment. -}; - -/** - The direction define in ASText. - */ -typedef NS_OPTIONS(NSUInteger, ASTextDirection) { - ASTextDirectionNone = 0, - ASTextDirectionTop = 1 << 0, - ASTextDirectionRight = 1 << 1, - ASTextDirectionBottom = 1 << 2, - ASTextDirectionLeft = 1 << 3, -}; - -/** - The trunction type, tells the truncation engine which type of truncation is being requested. - */ -typedef NS_ENUM (NSUInteger, ASTextTruncationType) { - /// No truncate. - ASTextTruncationTypeNone = 0, - - /// Truncate at the beginning of the line, leaving the end portion visible. - ASTextTruncationTypeStart = 1, - - /// Truncate at the end of the line, leaving the start portion visible. - ASTextTruncationTypeEnd = 2, - - /// Truncate in the middle of the line, leaving both the start and the end portions visible. - ASTextTruncationTypeMiddle = 3, -}; - - - -#pragma mark - Attribute Name Defined in ASText - -/// The value of this attribute is a `ASTextBackedString` object. -/// Use this attribute to store the original plain text if it is replaced by something else (such as attachment). -UIKIT_EXTERN NSString *const ASTextBackedStringAttributeName; - -/// The value of this attribute is a `ASTextBinding` object. -/// Use this attribute to bind a range of text together, as if it was a single charactor. -UIKIT_EXTERN NSString *const ASTextBindingAttributeName; - -/// The value of this attribute is a `ASTextShadow` object. -/// Use this attribute to add shadow to a range of text. -/// Shadow will be drawn below text glyphs. Use ASTextShadow.subShadow to add multi-shadow. -UIKIT_EXTERN NSString *const ASTextShadowAttributeName; - -/// The value of this attribute is a `ASTextShadow` object. -/// Use this attribute to add inner shadow to a range of text. -/// Inner shadow will be drawn above text glyphs. Use ASTextShadow.subShadow to add multi-shadow. -UIKIT_EXTERN NSString *const ASTextInnerShadowAttributeName; - -/// The value of this attribute is a `ASTextDecoration` object. -/// Use this attribute to add underline to a range of text. -/// The underline will be drawn below text glyphs. -UIKIT_EXTERN NSString *const ASTextUnderlineAttributeName; - -/// The value of this attribute is a `ASTextDecoration` object. -/// Use this attribute to add strikethrough (delete line) to a range of text. -/// The strikethrough will be drawn above text glyphs. -UIKIT_EXTERN NSString *const ASTextStrikethroughAttributeName; - -/// The value of this attribute is a `ASTextBorder` object. -/// Use this attribute to add cover border or cover color to a range of text. -/// The border will be drawn above the text glyphs. -UIKIT_EXTERN NSString *const ASTextBorderAttributeName; - -/// The value of this attribute is a `ASTextBorder` object. -/// Use this attribute to add background border or background color to a range of text. -/// The border will be drawn below the text glyphs. -UIKIT_EXTERN NSString *const ASTextBackgroundBorderAttributeName; - -/// The value of this attribute is a `ASTextBorder` object. -/// Use this attribute to add a code block border to one or more line of text. -/// The border will be drawn below the text glyphs. -UIKIT_EXTERN NSString *const ASTextBlockBorderAttributeName; - -/// The value of this attribute is a `ASTextAttachment` object. -/// Use this attribute to add attachment to text. -/// It should be used in conjunction with a CTRunDelegate. -UIKIT_EXTERN NSString *const ASTextAttachmentAttributeName; - -/// The value of this attribute is a `ASTextHighlight` object. -/// Use this attribute to add a touchable highlight state to a range of text. -UIKIT_EXTERN NSString *const ASTextHighlightAttributeName; - -/// The value of this attribute is a `NSValue` object stores CGAffineTransform. -/// Use this attribute to add transform to each glyph in a range of text. -UIKIT_EXTERN NSString *const ASTextGlyphTransformAttributeName; - - - -#pragma mark - String Token Define - -UIKIT_EXTERN NSString *const ASTextAttachmentToken; ///< Object replacement character (U+FFFC), used for text attachment. -UIKIT_EXTERN NSString *const ASTextTruncationToken; ///< Horizontal ellipsis (U+2026), used for text truncation "…". - - - -#pragma mark - Attribute Value Define - -/** - The tap/long press action callback defined in ASText. - - @param containerView The text container view (such as ASLabel/ASTextView). - @param text The whole text. - @param range The text range in `text` (if no range, the range.location is NSNotFound). - @param rect The text frame in `containerView` (if no data, the rect is CGRectNull). - */ -typedef void(^ASTextAction)(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect); - - -/** - ASTextBackedString objects are used by the NSAttributedString class cluster - as the values for text backed string attributes (stored in the attributed - string under the key named ASTextBackedStringAttributeName). - - It may used for copy/paste plain text from attributed string. - Example: If :) is replace by a custom emoji (such as😊), the backed string can be set to @":)". - */ -@interface ASTextBackedString : NSObject -+ (instancetype)stringWithString:(nullable NSString *)string NS_RETURNS_RETAINED; -@property (nullable, nonatomic, copy) NSString *string; ///< backed string -@end - - -/** - ASTextBinding objects are used by the NSAttributedString class cluster - as the values for shadow attributes (stored in the attributed string under - the key named ASTextBindingAttributeName). - - Add this to a range of text will make the specified characters 'binding together'. - ASTextView will treat the range of text as a single character during text - selection and edit. - */ -@interface ASTextBinding : NSObject -+ (instancetype)bindingWithDeleteConfirm:(BOOL)deleteConfirm NS_RETURNS_RETAINED; -@property (nonatomic) BOOL deleteConfirm; ///< confirm the range when delete in ASTextView -@end - - -/** - ASTextShadow objects are used by the NSAttributedString class cluster - as the values for shadow attributes (stored in the attributed string under - the key named ASTextShadowAttributeName or ASTextInnerShadowAttributeName). - - It's similar to `NSShadow`, but offers more options. - */ -@interface ASTextShadow : NSObject -+ (instancetype)shadowWithColor:(nullable UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius NS_RETURNS_RETAINED; - -@property (nullable, nonatomic) UIColor *color; ///< shadow color -@property (nonatomic) CGSize offset; ///< shadow offset -@property (nonatomic) CGFloat radius; ///< shadow blur radius -@property (nonatomic) CGBlendMode blendMode; ///< shadow blend mode -@property (nullable, nonatomic) ASTextShadow *subShadow; ///< a sub shadow which will be added above the parent shadow - -+ (instancetype)shadowWithNSShadow:(NSShadow *)nsShadow NS_RETURNS_RETAINED; ///< convert NSShadow to ASTextShadow -- (NSShadow *)nsShadow; ///< convert ASTextShadow to NSShadow -@end - - -/** - ASTextDecorationLine objects are used by the NSAttributedString class cluster - as the values for decoration line attributes (stored in the attributed string under - the key named ASTextUnderlineAttributeName or ASTextStrikethroughAttributeName). - - When it's used as underline, the line is drawn below text glyphs; - when it's used as strikethrough, the line is drawn above text glyphs. - */ -@interface ASTextDecoration : NSObject -+ (instancetype)decorationWithStyle:(ASTextLineStyle)style NS_RETURNS_RETAINED; -+ (instancetype)decorationWithStyle:(ASTextLineStyle)style width:(nullable NSNumber *)width color:(nullable UIColor *)color NS_RETURNS_RETAINED; -@property (nonatomic) ASTextLineStyle style; ///< line style -@property (nullable, nonatomic) NSNumber *width; ///< line width (nil means automatic width) -@property (nullable, nonatomic) UIColor *color; ///< line color (nil means automatic color) -@property (nullable, nonatomic) ASTextShadow *shadow; ///< line shadow -@end - - -/** - ASTextBorder objects are used by the NSAttributedString class cluster - as the values for border attributes (stored in the attributed string under - the key named ASTextBorderAttributeName or ASTextBackgroundBorderAttributeName). - - It can be used to draw a border around a range of text, or draw a background - to a range of text. - - Example: - ╭──────╮ - │ Text │ - ╰──────╯ - */ -@interface ASTextBorder : NSObject -+ (instancetype)borderWithLineStyle:(ASTextLineStyle)lineStyle lineWidth:(CGFloat)width strokeColor:(nullable UIColor *)color NS_RETURNS_RETAINED; -+ (instancetype)borderWithFillColor:(nullable UIColor *)color cornerRadius:(CGFloat)cornerRadius NS_RETURNS_RETAINED; -@property (nonatomic) ASTextLineStyle lineStyle; ///< border line style -@property (nonatomic) CGFloat strokeWidth; ///< border line width -@property (nullable, nonatomic) UIColor *strokeColor; ///< border line color -@property (nonatomic) CGLineJoin lineJoin; ///< border line join -@property (nonatomic) UIEdgeInsets insets; ///< border insets for text bounds -@property (nonatomic) CGFloat cornerRadius; ///< border corder radius -@property (nullable, nonatomic) ASTextShadow *shadow; ///< border shadow -@property (nullable, nonatomic) UIColor *fillColor; ///< inner fill color -@end - - -/** - ASTextAttachment objects are used by the NSAttributedString class cluster - as the values for attachment attributes (stored in the attributed string under - the key named ASTextAttachmentAttributeName). - - When display an attributed string which contains `ASTextAttachment` object, - the content will be placed in text metric. If the content is `UIImage`, - then it will be drawn to CGContext; if the content is `UIView` or `CALayer`, - then it will be added to the text container's view or layer. - */ -@interface ASTextAttachment : NSObject -+ (instancetype)attachmentWithContent:(nullable id)content NS_RETURNS_RETAINED; -@property (nullable, nonatomic) id content; ///< Supported type: UIImage, UIView, CALayer -@property (nonatomic) UIViewContentMode contentMode; ///< Content display mode. -@property (nonatomic) UIEdgeInsets contentInsets; ///< The insets when drawing content. -@property (nullable, nonatomic) NSDictionary *userInfo; ///< The user information dictionary. -@end - - -/** - ASTextHighlight objects are used by the NSAttributedString class cluster - as the values for touchable highlight attributes (stored in the attributed string - under the key named ASTextHighlightAttributeName). - - When display an attributed string in `ASLabel` or `ASTextView`, the range of - highlight text can be toucheds down by users. If a range of text is turned into - highlighted state, the `attributes` in `ASTextHighlight` will be used to modify - (set or remove) the original attributes in the range for display. - */ -@interface ASTextHighlight : NSObject - -/** - Attributes that you can apply to text in an attributed string when highlight. - Key: Same as CoreText/ASText Attribute Name. - Value: Modify attribute value when highlight (NSNull for remove attribute). - */ -@property (nullable, nonatomic, copy) NSDictionary *attributes; - -/** - Creates a highlight object with specified attributes. - - @param attributes The attributes which will replace original attributes when highlight, - If the value is NSNull, it will removed when highlight. - */ -+ (instancetype)highlightWithAttributes:(nullable NSDictionary *)attributes NS_RETURNS_RETAINED; - -/** - Convenience methods to create a default highlight with the specifeid background color. - - @param color The background border color. - */ -+ (instancetype)highlightWithBackgroundColor:(nullable UIColor *)color NS_RETURNS_RETAINED; - -// Convenience methods below to set the `attributes`. -- (void)setFont:(nullable UIFont *)font; -- (void)setColor:(nullable UIColor *)color; -- (void)setStrokeWidth:(nullable NSNumber *)width; -- (void)setStrokeColor:(nullable UIColor *)color; -- (void)setShadow:(nullable ASTextShadow *)shadow; -- (void)setInnerShadow:(nullable ASTextShadow *)shadow; -- (void)setUnderline:(nullable ASTextDecoration *)underline; -- (void)setStrikethrough:(nullable ASTextDecoration *)strikethrough; -- (void)setBackgroundBorder:(nullable ASTextBorder *)border; -- (void)setBorder:(nullable ASTextBorder *)border; -- (void)setAttachment:(nullable ASTextAttachment *)attachment; - -/** - The user information dictionary, default is nil. - */ -@property (nullable, nonatomic, copy) NSDictionary *userInfo; - -/** - Tap action when user tap the highlight, default is nil. - If the value is nil, ASTextView or ASLabel will ask it's delegate to handle the tap action. - */ -@property (nullable, nonatomic) ASTextAction tapAction; - -/** - Long press action when user long press the highlight, default is nil. - If the value is nil, ASTextView or ASLabel will ask it's delegate to handle the long press action. - */ -@property (nullable, nonatomic) ASTextAction longPressAction; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.mm b/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.mm deleted file mode 100644 index 8af43227..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/String/ASTextAttribute.mm +++ /dev/null @@ -1,487 +0,0 @@ -// -// ASTextAttribute.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTextAttribute.h" -#import -#import - -NSString *const ASTextBackedStringAttributeName = @"ASTextBackedString"; -NSString *const ASTextBindingAttributeName = @"ASTextBinding"; -NSString *const ASTextShadowAttributeName = @"ASTextShadow"; -NSString *const ASTextInnerShadowAttributeName = @"ASTextInnerShadow"; -NSString *const ASTextUnderlineAttributeName = @"ASTextUnderline"; -NSString *const ASTextStrikethroughAttributeName = @"ASTextStrikethrough"; -NSString *const ASTextBorderAttributeName = @"ASTextBorder"; -NSString *const ASTextBackgroundBorderAttributeName = @"ASTextBackgroundBorder"; -NSString *const ASTextBlockBorderAttributeName = @"ASTextBlockBorder"; -NSString *const ASTextAttachmentAttributeName = @"ASTextAttachment"; -NSString *const ASTextHighlightAttributeName = @"ASTextHighlight"; -NSString *const ASTextGlyphTransformAttributeName = @"ASTextGlyphTransform"; - -NSString *const ASTextAttachmentToken = @"\uFFFC"; -NSString *const ASTextTruncationToken = @"\u2026"; - - -ASTextAttributeType ASTextAttributeGetType(NSString *name){ - if (name.length == 0) return ASTextAttributeTypeNone; - - static NSMutableDictionary *dic; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - dic = [NSMutableDictionary new]; - NSNumber *All = @(ASTextAttributeTypeUIKit | ASTextAttributeTypeCoreText | ASTextAttributeTypeASText); - NSNumber *CoreText_ASText = @(ASTextAttributeTypeCoreText | ASTextAttributeTypeASText); - NSNumber *UIKit_ASText = @(ASTextAttributeTypeUIKit | ASTextAttributeTypeASText); - NSNumber *UIKit_CoreText = @(ASTextAttributeTypeUIKit | ASTextAttributeTypeCoreText); - NSNumber *UIKit = @(ASTextAttributeTypeUIKit); - NSNumber *CoreText = @(ASTextAttributeTypeCoreText); - NSNumber *ASText = @(ASTextAttributeTypeASText); - - dic[NSFontAttributeName] = All; - dic[NSKernAttributeName] = All; - dic[NSForegroundColorAttributeName] = UIKit; - dic[(id)kCTForegroundColorAttributeName] = CoreText; - dic[(id)kCTForegroundColorFromContextAttributeName] = CoreText; - dic[NSBackgroundColorAttributeName] = UIKit; - dic[NSStrokeWidthAttributeName] = All; - dic[NSStrokeColorAttributeName] = UIKit; - dic[(id)kCTStrokeColorAttributeName] = CoreText_ASText; - dic[NSShadowAttributeName] = UIKit_ASText; - dic[NSStrikethroughStyleAttributeName] = UIKit; - dic[NSUnderlineStyleAttributeName] = UIKit_CoreText; - dic[(id)kCTUnderlineColorAttributeName] = CoreText; - dic[NSLigatureAttributeName] = All; - dic[(id)kCTSuperscriptAttributeName] = UIKit; //it's a CoreText attrubite, but only supported by UIKit... - dic[NSVerticalGlyphFormAttributeName] = All; - dic[(id)kCTGlyphInfoAttributeName] = CoreText_ASText; -#if TARGET_OS_IOS -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - dic[(id)kCTCharacterShapeAttributeName] = CoreText_ASText; -#pragma clang diagnostic pop -#endif - dic[(id)kCTRunDelegateAttributeName] = CoreText_ASText; - dic[(id)kCTBaselineClassAttributeName] = CoreText_ASText; - dic[(id)kCTBaselineInfoAttributeName] = CoreText_ASText; - dic[(id)kCTBaselineReferenceInfoAttributeName] = CoreText_ASText; - dic[(id)kCTWritingDirectionAttributeName] = CoreText_ASText; - dic[NSParagraphStyleAttributeName] = All; - - dic[NSStrikethroughColorAttributeName] = UIKit; - dic[NSUnderlineColorAttributeName] = UIKit; - dic[NSTextEffectAttributeName] = UIKit; - dic[NSObliquenessAttributeName] = UIKit; - dic[NSExpansionAttributeName] = UIKit; - dic[(id)kCTLanguageAttributeName] = CoreText_ASText; - dic[NSBaselineOffsetAttributeName] = UIKit; - dic[NSWritingDirectionAttributeName] = All; - dic[NSAttachmentAttributeName] = UIKit; - dic[NSLinkAttributeName] = UIKit; - dic[(id)kCTRubyAnnotationAttributeName] = CoreText; - - dic[ASTextBackedStringAttributeName] = ASText; - dic[ASTextBindingAttributeName] = ASText; - dic[ASTextShadowAttributeName] = ASText; - dic[ASTextInnerShadowAttributeName] = ASText; - dic[ASTextUnderlineAttributeName] = ASText; - dic[ASTextStrikethroughAttributeName] = ASText; - dic[ASTextBorderAttributeName] = ASText; - dic[ASTextBackgroundBorderAttributeName] = ASText; - dic[ASTextBlockBorderAttributeName] = ASText; - dic[ASTextAttachmentAttributeName] = ASText; - dic[ASTextHighlightAttributeName] = ASText; - dic[ASTextGlyphTransformAttributeName] = ASText; - }); - NSNumber *num = dic[name]; - if (num) return num.integerValue; - return ASTextAttributeTypeNone; -} - - -@implementation ASTextBackedString - -+ (instancetype)stringWithString:(NSString *)string NS_RETURNS_RETAINED { - ASTextBackedString *one = [self new]; - one.string = string; - return one; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:self.string forKey:@"string"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _string = [aDecoder decodeObjectForKey:@"string"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.string = self.string; - return one; -} - -@end - - -@implementation ASTextBinding - -+ (instancetype)bindingWithDeleteConfirm:(BOOL)deleteConfirm NS_RETURNS_RETAINED { - ASTextBinding *one = [self new]; - one.deleteConfirm = deleteConfirm; - return one; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:@(self.deleteConfirm) forKey:@"deleteConfirm"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _deleteConfirm = ((NSNumber *)[aDecoder decodeObjectForKey:@"deleteConfirm"]).boolValue; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.deleteConfirm = self.deleteConfirm; - return one; -} - -@end - - -@implementation ASTextShadow - -+ (instancetype)shadowWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius NS_RETURNS_RETAINED { - ASTextShadow *one = [self new]; - one.color = color; - one.offset = offset; - one.radius = radius; - return one; -} - -+ (instancetype)shadowWithNSShadow:(NSShadow *)nsShadow NS_RETURNS_RETAINED { - if (!nsShadow) return nil; - ASTextShadow *shadow = [self new]; - shadow.offset = nsShadow.shadowOffset; - shadow.radius = nsShadow.shadowBlurRadius; - id color = nsShadow.shadowColor; - if (color) { - if (CGColorGetTypeID() == CFGetTypeID((__bridge CFTypeRef)(color))) { - color = [UIColor colorWithCGColor:(__bridge CGColorRef)(color)]; - } - if ([color isKindOfClass:[UIColor class]]) { - shadow.color = color; - } - } - return shadow; -} - -- (NSShadow *)nsShadow { - NSShadow *shadow = [NSShadow new]; - shadow.shadowOffset = self.offset; - shadow.shadowBlurRadius = self.radius; - shadow.shadowColor = self.color; - return shadow; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:self.color forKey:@"color"]; - [aCoder encodeObject:@(self.radius) forKey:@"radius"]; - [aCoder encodeObject:[NSValue valueWithCGSize:self.offset] forKey:@"offset"]; - [aCoder encodeObject:self.subShadow forKey:@"subShadow"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _color = [aDecoder decodeObjectForKey:@"color"]; - _radius = ((NSNumber *)[aDecoder decodeObjectForKey:@"radius"]).floatValue; - _offset = ((NSValue *)[aDecoder decodeObjectForKey:@"offset"]).CGSizeValue; - _subShadow = [aDecoder decodeObjectForKey:@"subShadow"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.color = self.color; - one.radius = self.radius; - one.offset = self.offset; - one.subShadow = self.subShadow.copy; - return one; -} - -@end - - -@implementation ASTextDecoration - -- (instancetype)init { - self = [super init]; - _style = ASTextLineStyleSingle; - return self; -} - -+ (instancetype)decorationWithStyle:(ASTextLineStyle)style NS_RETURNS_RETAINED { - ASTextDecoration *one = [self new]; - one.style = style; - return one; -} -+ (instancetype)decorationWithStyle:(ASTextLineStyle)style width:(NSNumber *)width color:(UIColor *)color NS_RETURNS_RETAINED { - ASTextDecoration *one = [self new]; - one.style = style; - one.width = width; - one.color = color; - return one; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:@(self.style) forKey:@"style"]; - [aCoder encodeObject:self.width forKey:@"width"]; - [aCoder encodeObject:self.color forKey:@"color"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - self.style = ((NSNumber *)[aDecoder decodeObjectForKey:@"style"]).unsignedIntegerValue; - self.width = [aDecoder decodeObjectForKey:@"width"]; - self.color = [aDecoder decodeObjectForKey:@"color"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.style = self.style; - one.width = self.width; - one.color = self.color; - return one; -} - -@end - - -@implementation ASTextBorder - -+ (instancetype)borderWithLineStyle:(ASTextLineStyle)lineStyle lineWidth:(CGFloat)width strokeColor:(UIColor *)color NS_RETURNS_RETAINED { - ASTextBorder *one = [self new]; - one.lineStyle = lineStyle; - one.strokeWidth = width; - one.strokeColor = color; - return one; -} - -+ (instancetype)borderWithFillColor:(UIColor *)color cornerRadius:(CGFloat)cornerRadius NS_RETURNS_RETAINED { - ASTextBorder *one = [self new]; - one.fillColor = color; - one.cornerRadius = cornerRadius; - one.insets = UIEdgeInsetsMake(-2, 0, 0, -2); - return one; -} - -- (instancetype)init { - self = [super init]; - self.lineStyle = ASTextLineStyleSingle; - return self; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:@(self.lineStyle) forKey:@"lineStyle"]; - [aCoder encodeObject:@(self.strokeWidth) forKey:@"strokeWidth"]; - [aCoder encodeObject:self.strokeColor forKey:@"strokeColor"]; - [aCoder encodeObject:@(self.lineJoin) forKey:@"lineJoin"]; - [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:self.insets] forKey:@"insets"]; - [aCoder encodeObject:@(self.cornerRadius) forKey:@"cornerRadius"]; - [aCoder encodeObject:self.shadow forKey:@"shadow"]; - [aCoder encodeObject:self.fillColor forKey:@"fillColor"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _lineStyle = ((NSNumber *)[aDecoder decodeObjectForKey:@"lineStyle"]).unsignedIntegerValue; - _strokeWidth = ((NSNumber *)[aDecoder decodeObjectForKey:@"strokeWidth"]).doubleValue; - _strokeColor = [aDecoder decodeObjectForKey:@"strokeColor"]; - _lineJoin = (CGLineJoin)((NSNumber *)[aDecoder decodeObjectForKey:@"join"]).unsignedIntegerValue; - _insets = ((NSValue *)[aDecoder decodeObjectForKey:@"insets"]).UIEdgeInsetsValue; - _cornerRadius = ((NSNumber *)[aDecoder decodeObjectForKey:@"cornerRadius"]).doubleValue; - _shadow = [aDecoder decodeObjectForKey:@"shadow"]; - _fillColor = [aDecoder decodeObjectForKey:@"fillColor"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.lineStyle = self.lineStyle; - one.strokeWidth = self.strokeWidth; - one.strokeColor = self.strokeColor; - one.lineJoin = self.lineJoin; - one.insets = self.insets; - one.cornerRadius = self.cornerRadius; - one.shadow = self.shadow.copy; - one.fillColor = self.fillColor; - return one; -} - -@end - - -@implementation ASTextAttachment - -+ (instancetype)attachmentWithContent:(id)content NS_RETURNS_RETAINED { - ASTextAttachment *one = [self new]; - one.content = content; - return one; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:self.content forKey:@"content"]; - [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:self.contentInsets] forKey:@"contentInsets"]; - [aCoder encodeObject:self.userInfo forKey:@"userInfo"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _content = [aDecoder decodeObjectForKey:@"content"]; - _contentInsets = ((NSValue *)[aDecoder decodeObjectForKey:@"contentInsets"]).UIEdgeInsetsValue; - _userInfo = [aDecoder decodeObjectForKey:@"userInfo"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - if ([self.content respondsToSelector:@selector(copy)]) { - one.content = [self.content copy]; - } else { - one.content = self.content; - } - one.contentInsets = self.contentInsets; - one.userInfo = self.userInfo.copy; - return one; -} - -@end - - -@implementation ASTextHighlight - -+ (instancetype)highlightWithAttributes:(NSDictionary *)attributes NS_RETURNS_RETAINED { - ASTextHighlight *one = [self new]; - one.attributes = attributes; - return one; -} - -+ (instancetype)highlightWithBackgroundColor:(UIColor *)color NS_RETURNS_RETAINED { - ASTextBorder *highlightBorder = [ASTextBorder new]; - highlightBorder.insets = UIEdgeInsetsMake(-2, -1, -2, -1); - highlightBorder.cornerRadius = 3; - highlightBorder.fillColor = color; - - ASTextHighlight *one = [self new]; - [one setBackgroundBorder:highlightBorder]; - return one; -} - -- (void)setAttributes:(NSDictionary *)attributes { - _attributes = attributes.mutableCopy; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.attributes = self.attributes.mutableCopy; - return one; -} - -- (void)_makeMutableAttributes { - if (!_attributes) { - _attributes = [NSMutableDictionary new]; - } else if (![_attributes isKindOfClass:[NSMutableDictionary class]]) { - _attributes = _attributes.mutableCopy; - } -} - -- (void)setFont:(UIFont *)font { - [self _makeMutableAttributes]; - if (font == (id)[NSNull null] || font == nil) { - ((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = [NSNull null]; - } else { - CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL); - if (ctFont) { - ((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = (__bridge id)(ctFont); - CFRelease(ctFont); - } - } -} - -- (void)setColor:(UIColor *)color { - [self _makeMutableAttributes]; - if (color == (id)[NSNull null] || color == nil) { - ((NSMutableDictionary *)_attributes)[(id)kCTForegroundColorAttributeName] = [NSNull null]; - ((NSMutableDictionary *)_attributes)[NSForegroundColorAttributeName] = [NSNull null]; - } else { - ((NSMutableDictionary *)_attributes)[(id)kCTForegroundColorAttributeName] = (__bridge id)(color.CGColor); - ((NSMutableDictionary *)_attributes)[NSForegroundColorAttributeName] = color; - } -} - -- (void)setStrokeWidth:(NSNumber *)width { - [self _makeMutableAttributes]; - if (width == (id)[NSNull null] || width == nil) { - ((NSMutableDictionary *)_attributes)[(id)kCTStrokeWidthAttributeName] = [NSNull null]; - } else { - ((NSMutableDictionary *)_attributes)[(id)kCTStrokeWidthAttributeName] = width; - } -} - -- (void)setStrokeColor:(UIColor *)color { - [self _makeMutableAttributes]; - if (color == (id)[NSNull null] || color == nil) { - ((NSMutableDictionary *)_attributes)[(id)kCTStrokeColorAttributeName] = [NSNull null]; - ((NSMutableDictionary *)_attributes)[NSStrokeColorAttributeName] = [NSNull null]; - } else { - ((NSMutableDictionary *)_attributes)[(id)kCTStrokeColorAttributeName] = (__bridge id)(color.CGColor); - ((NSMutableDictionary *)_attributes)[NSStrokeColorAttributeName] = color; - } -} - -- (void)setTextAttribute:(NSString *)attribute value:(id)value { - [self _makeMutableAttributes]; - if (value == nil) value = [NSNull null]; - ((NSMutableDictionary *)_attributes)[attribute] = value; -} - -- (void)setShadow:(ASTextShadow *)shadow { - [self setTextAttribute:ASTextShadowAttributeName value:shadow]; -} - -- (void)setInnerShadow:(ASTextShadow *)shadow { - [self setTextAttribute:ASTextInnerShadowAttributeName value:shadow]; -} - -- (void)setUnderline:(ASTextDecoration *)underline { - [self setTextAttribute:ASTextUnderlineAttributeName value:underline]; -} - -- (void)setStrikethrough:(ASTextDecoration *)strikethrough { - [self setTextAttribute:ASTextStrikethroughAttributeName value:strikethrough]; -} - -- (void)setBackgroundBorder:(ASTextBorder *)border { - [self setTextAttribute:ASTextBackgroundBorderAttributeName value:border]; -} - -- (void)setBorder:(ASTextBorder *)border { - [self setTextAttribute:ASTextBorderAttributeName value:border]; -} - -- (void)setAttachment:(ASTextAttachment *)attachment { - [self setTextAttribute:ASTextAttachmentAttributeName value:attachment]; -} - -@end - diff --git a/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.h b/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.h deleted file mode 100644 index 973dc5ff..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.h +++ /dev/null @@ -1,65 +0,0 @@ -// -// ASTextRunDelegate.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - Wrapper for CTRunDelegateRef. - - Example: - - ASTextRunDelegate *delegate = [ASTextRunDelegate new]; - delegate.ascent = 20; - delegate.descent = 4; - delegate.width = 20; - CTRunDelegateRef ctRunDelegate = delegate.CTRunDelegate; - if (ctRunDelegate) { - /// add to attributed string - CFRelease(ctRunDelegate); - } - - */ -@interface ASTextRunDelegate : NSObject - -/** - Creates and returns the CTRunDelegate. - - @discussion You need call CFRelease() after used. - The CTRunDelegateRef has a strong reference to this ASTextRunDelegate object. - In CoreText, use CTRunDelegateGetRefCon() to get this ASTextRunDelegate object. - - @return The CTRunDelegate object. - */ -- (nullable CTRunDelegateRef)CTRunDelegate CF_RETURNS_RETAINED; - -/** - Additional information about the the run delegate. - */ -@property (nullable, nonatomic, copy) NSDictionary *userInfo; - -/** - The typographic ascent of glyphs in the run. - */ -@property (nonatomic) CGFloat ascent; - -/** - The typographic descent of glyphs in the run. - */ -@property (nonatomic) CGFloat descent; - -/** - The typographic width of glyphs in the run. - */ -@property (nonatomic) CGFloat width; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.mm b/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.mm deleted file mode 100644 index 1c179b1f..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/String/ASTextRunDelegate.mm +++ /dev/null @@ -1,68 +0,0 @@ -// -// ASTextRunDelegate.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -static void DeallocCallback(void *ref) { - ASTextRunDelegate *self = (__bridge_transfer ASTextRunDelegate *)(ref); - self = nil; // release -} - -static CGFloat GetAscentCallback(void *ref) { - ASTextRunDelegate *self = (__bridge ASTextRunDelegate *)(ref); - return self.ascent; -} - -static CGFloat GetDecentCallback(void *ref) { - ASTextRunDelegate *self = (__bridge ASTextRunDelegate *)(ref); - return self.descent; -} - -static CGFloat GetWidthCallback(void *ref) { - ASTextRunDelegate *self = (__bridge ASTextRunDelegate *)(ref); - return self.width; -} - -@implementation ASTextRunDelegate - -- (CTRunDelegateRef)CTRunDelegate CF_RETURNS_RETAINED { - CTRunDelegateCallbacks callbacks; - callbacks.version = kCTRunDelegateCurrentVersion; - callbacks.dealloc = DeallocCallback; - callbacks.getAscent = GetAscentCallback; - callbacks.getDescent = GetDecentCallback; - callbacks.getWidth = GetWidthCallback; - return CTRunDelegateCreate(&callbacks, (__bridge_retained void *)(self.copy)); -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:@(_ascent) forKey:@"ascent"]; - [aCoder encodeObject:@(_descent) forKey:@"descent"]; - [aCoder encodeObject:@(_width) forKey:@"width"]; - [aCoder encodeObject:_userInfo forKey:@"userInfo"]; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super init]; - _ascent = ((NSNumber *)[aDecoder decodeObjectForKey:@"ascent"]).floatValue; - _descent = ((NSNumber *)[aDecoder decodeObjectForKey:@"descent"]).floatValue; - _width = ((NSNumber *)[aDecoder decodeObjectForKey:@"width"]).floatValue; - _userInfo = [aDecoder decodeObjectForKey:@"userInfo"]; - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - __typeof__(self) one = [self.class new]; - one.ascent = self.ascent; - one.descent = self.descent; - one.width = self.width; - one.userInfo = self.userInfo; - return one; -} - -@end diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.h b/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.h deleted file mode 100644 index 2ba0f09f..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.h +++ /dev/null @@ -1,315 +0,0 @@ -// -// ASTextUtilities.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - - -#ifndef ASTEXT_CLAMP // return the clamped value -#define ASTEXT_CLAMP(_x_, _low_, _high_) (((_x_) > (_high_)) ? (_high_) : (((_x_) < (_low_)) ? (_low_) : (_x_))) -#endif - -#ifndef ASTEXT_SWAP // swap two value -#define ASTEXT_SWAP(_a_, _b_) do { __typeof__(_a_) _tmp_ = (_a_); (_a_) = (_b_); (_b_) = _tmp_; } while (0) -#endif - -NS_ASSUME_NONNULL_BEGIN - -/** - Whether the character is 'line break char': - U+000D (\\r or CR) - U+2028 (Unicode line separator) - U+000A (\\n or LF) - U+2029 (Unicode paragraph separator) - - @param c A character - @return YES or NO. - */ -static inline BOOL ASTextIsLinebreakChar(unichar c) { - switch (c) { - case 0x000D: - case 0x2028: - case 0x000A: - case 0x2029: - return YES; - default: - return NO; - } -} - -/** - Whether the string is a 'line break': - U+000D (\\r or CR) - U+2028 (Unicode line separator) - U+000A (\\n or LF) - U+2029 (Unicode paragraph separator) - \\r\\n, in that order (also known as CRLF) - - @param str A string - @return YES or NO. - */ -static inline BOOL ASTextIsLinebreakString(NSString * _Nullable str) { - if (str.length > 2 || str.length == 0) return NO; - if (str.length == 1) { - unichar c = [str characterAtIndex:0]; - return ASTextIsLinebreakChar(c); - } else { - return ([str characterAtIndex:0] == '\r') && ([str characterAtIndex:1] == '\n'); - } -} - -/** - If the string has a 'line break' suffix, return the 'line break' length. - - @param str A string. - @return The length of the tail line break: 0, 1 or 2. - */ -static inline NSUInteger ASTextLinebreakTailLength(NSString * _Nullable str) { - if (str.length >= 2) { - unichar c2 = [str characterAtIndex:str.length - 1]; - if (ASTextIsLinebreakChar(c2)) { - unichar c1 = [str characterAtIndex:str.length - 2]; - if (c1 == '\r' && c2 == '\n') return 2; - else return 1; - } else { - return 0; - } - } else if (str.length == 1) { - return ASTextIsLinebreakChar([str characterAtIndex:0]) ? 1 : 0; - } else { - return 0; - } -} - -/** - Whether the font contains color bitmap glyphs. - - @discussion Only `AppleColorEmoji` contains color bitmap glyphs in iOS system fonts. - @param font A font. - @return YES: the font contains color bitmap glyphs, NO: the font has no color bitmap glyph. - */ -static inline BOOL ASTextCTFontContainsColorBitmapGlyphs(CTFontRef font) { - return (CTFontGetSymbolicTraits(font) & kCTFontTraitColorGlyphs) != 0; -} - -/** - Get the `AppleColorEmoji` font's ascent with a specified font size. - It may used to create custom emoji. - - @param fontSize The specified font size. - @return The font ascent. - */ -static inline CGFloat ASTextEmojiGetAscentWithFontSize(CGFloat fontSize) { - if (fontSize < 16) { - return 1.25 * fontSize; - } else if (16 <= fontSize && fontSize <= 24) { - return 0.5 * fontSize + 12; - } else { - return fontSize; - } -} - -/** - Get the `AppleColorEmoji` font's descent with a specified font size. - It may used to create custom emoji. - - @param fontSize The specified font size. - @return The font descent. - */ -static inline CGFloat ASTextEmojiGetDescentWithFontSize(CGFloat fontSize) { - if (fontSize < 16) { - return 0.390625 * fontSize; - } else if (16 <= fontSize && fontSize <= 24) { - return 0.15625 * fontSize + 3.75; - } else { - return 0.3125 * fontSize; - } -} - -/** - Get the `AppleColorEmoji` font's glyph bounding rect with a specified font size. - It may used to create custom emoji. - - @param fontSize The specified font size. - @return The font glyph bounding rect. - */ -static inline CGRect ASTextEmojiGetGlyphBoundingRectWithFontSize(CGFloat fontSize) { - CGRect rect; - rect.origin.x = 0.75; - rect.size.width = rect.size.height = ASTextEmojiGetAscentWithFontSize(fontSize); - if (fontSize < 16) { - rect.origin.y = -0.2525 * fontSize; - } else if (16 <= fontSize && fontSize <= 24) { - rect.origin.y = 0.1225 * fontSize -6; - } else { - rect.origin.y = -0.1275 * fontSize; - } - return rect; -} - - -/** - Get the character set which should rotate in vertical form. - @return The shared character set. - */ -NSCharacterSet *ASTextVerticalFormRotateCharacterSet(void); - -/** - Get the character set which should rotate and move in vertical form. - @return The shared character set. - */ -NSCharacterSet *ASTextVerticalFormRotateAndMoveCharacterSet(void); - - -/// Get the transform rotation. -/// @return the rotation in radians [-PI,PI] ([-180°,180°]) -static inline CGFloat ASTextCGAffineTransformGetRotation(CGAffineTransform transform) { - return atan2(transform.b, transform.a); -} - -/// Negates/inverts a UIEdgeInsets. -static inline UIEdgeInsets ASTextUIEdgeInsetsInvert(UIEdgeInsets insets) { - return UIEdgeInsetsMake(-insets.top, -insets.left, -insets.bottom, -insets.right); -} - -/** - Returns a rectangle to fit `rect` with specified content mode. - - @param rect The constraint rect - @param size The content size - @param mode The content mode - @return A rectangle for the given content mode. - @discussion UIViewContentModeRedraw is same as UIViewContentModeScaleToFill. - */ -CGRect ASTextCGRectFitWithContentMode(CGRect rect, CGSize size, UIViewContentMode mode); - -/// Returns the center for the rectangle. -static inline CGPoint ASTextCGRectGetCenter(CGRect rect) { - return CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); -} - -/// Returns the area of the rectangle. -static inline CGFloat ASTextCGRectGetArea(CGRect rect) { - if (CGRectIsNull(rect)) return 0; - rect = CGRectStandardize(rect); - return rect.size.width * rect.size.height; -} - -/// Returns the minmium distance between a point to a rectangle. -static inline CGFloat ASTextCGPointGetDistanceToRect(CGPoint p, CGRect r) { - r = CGRectStandardize(r); - if (CGRectContainsPoint(r, p)) return 0; - CGFloat distV, distH; - if (CGRectGetMinY(r) <= p.y && p.y <= CGRectGetMaxY(r)) { - distV = 0; - } else { - distV = p.y < CGRectGetMinY(r) ? CGRectGetMinY(r) - p.y : p.y - CGRectGetMaxY(r); - } - if (CGRectGetMinX(r) <= p.x && p.x <= CGRectGetMaxX(r)) { - distH = 0; - } else { - distH = p.x < CGRectGetMinX(r) ? CGRectGetMinX(r) - p.x : p.x - CGRectGetMaxX(r); - } - return MAX(distV, distH); -} - -/// Convert point to pixel. -static inline CGFloat ASTextCGFloatToPixel(CGFloat value) { - return value * ASScreenScale(); -} - -/// Convert pixel to point. -static inline CGFloat ASTextCGFloatFromPixel(CGFloat value) { - return value / ASScreenScale(); -} - -/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned) -static inline CGFloat ASTextCGFloatPixelHalf(CGFloat value) { - CGFloat scale = ASScreenScale(); - return (floor(value * scale) + 0.5) / scale; -} - -/// floor point value for pixel-aligned -static inline CGPoint ASTextCGPointPixelFloor(CGPoint point) { - CGFloat scale = ASScreenScale(); - return CGPointMake(floor(point.x * scale) / scale, - floor(point.y * scale) / scale); -} - -/// round point value for pixel-aligned -static inline CGPoint ASTextCGPointPixelRound(CGPoint point) { - CGFloat scale = ASScreenScale(); - return CGPointMake(round(point.x * scale) / scale, - round(point.y * scale) / scale); -} - -/// ceil point value for pixel-aligned -static inline CGPoint ASTextCGPointPixelCeil(CGPoint point) { - CGFloat scale = ASScreenScale(); - return CGPointMake(ceil(point.x * scale) / scale, - ceil(point.y * scale) / scale); -} - -/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned) -static inline CGPoint ASTextCGPointPixelHalf(CGPoint point) { - CGFloat scale = ASScreenScale(); - return CGPointMake((floor(point.x * scale) + 0.5) / scale, - (floor(point.y * scale) + 0.5) / scale); -} - -/// round point value for pixel-aligned -static inline CGRect ASTextCGRectPixelRound(CGRect rect) { - CGPoint origin = ASTextCGPointPixelRound(rect.origin); - CGPoint corner = ASTextCGPointPixelRound(CGPointMake(rect.origin.x + rect.size.width, - rect.origin.y + rect.size.height)); - return CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y); -} - -/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned) -static inline CGRect ASTextCGRectPixelHalf(CGRect rect) { - CGPoint origin = ASTextCGPointPixelHalf(rect.origin); - CGPoint corner = ASTextCGPointPixelHalf(CGPointMake(rect.origin.x + rect.size.width, - rect.origin.y + rect.size.height)); - return CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y); -} - - -static inline UIFont * _Nullable ASTextFontWithBold(UIFont *font) { - return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:font.pointSize]; -} - -static inline UIFont * _Nullable ASTextFontWithItalic(UIFont *font) { - return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic] size:font.pointSize]; -} - -static inline UIFont * _Nullable ASTextFontWithBoldItalic(UIFont *font) { - return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold | UIFontDescriptorTraitItalic] size:font.pointSize]; -} - - - -/** - Convert CFRange to NSRange - @param range CFRange @return NSRange - */ -static inline NSRange ASTextNSRangeFromCFRange(CFRange range) { - return NSMakeRange(range.location, range.length); -} - -/** - Convert NSRange to CFRange - @param range NSRange @return CFRange - */ -static inline CFRange ASTextCFRangeFromNSRange(NSRange range) { - return CFRangeMake(range.location, range.length); -} - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.mm b/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.mm deleted file mode 100644 index 7194dadd..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/ASTextUtilities.mm +++ /dev/null @@ -1,142 +0,0 @@ -// -// ASTextUtilities.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "ASTextUtilities.h" - -NSCharacterSet *ASTextVerticalFormRotateCharacterSet() { - static NSMutableCharacterSet *set; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - set = [NSMutableCharacterSet new]; - [set addCharactersInRange:NSMakeRange(0x1100, 256)]; // Hangul Jamo - [set addCharactersInRange:NSMakeRange(0x2460, 160)]; // Enclosed Alphanumerics - [set addCharactersInRange:NSMakeRange(0x2600, 256)]; // Miscellaneous Symbols - [set addCharactersInRange:NSMakeRange(0x2700, 192)]; // Dingbats - [set addCharactersInRange:NSMakeRange(0x2E80, 128)]; // CJK Radicals Supplement - [set addCharactersInRange:NSMakeRange(0x2F00, 224)]; // Kangxi Radicals - [set addCharactersInRange:NSMakeRange(0x2FF0, 16)]; // Ideographic Description Characters - [set addCharactersInRange:NSMakeRange(0x3000, 64)]; // CJK Symbols and Punctuation - [set removeCharactersInRange:NSMakeRange(0x3008, 10)]; - [set removeCharactersInRange:NSMakeRange(0x3014, 12)]; - [set addCharactersInRange:NSMakeRange(0x3040, 96)]; // Hiragana - [set addCharactersInRange:NSMakeRange(0x30A0, 96)]; // Katakana - [set addCharactersInRange:NSMakeRange(0x3100, 48)]; // Bopomofo - [set addCharactersInRange:NSMakeRange(0x3130, 96)]; // Hangul Compatibility Jamo - [set addCharactersInRange:NSMakeRange(0x3190, 16)]; // Kanbun - [set addCharactersInRange:NSMakeRange(0x31A0, 32)]; // Bopomofo Extended - [set addCharactersInRange:NSMakeRange(0x31C0, 48)]; // CJK Strokes - [set addCharactersInRange:NSMakeRange(0x31F0, 16)]; // Katakana Phonetic Extensions - [set addCharactersInRange:NSMakeRange(0x3200, 256)]; // Enclosed CJK Letters and Months - [set addCharactersInRange:NSMakeRange(0x3300, 256)]; // CJK Compatibility - [set addCharactersInRange:NSMakeRange(0x3400, 2582)]; // CJK Unified Ideographs Extension A - [set addCharactersInRange:NSMakeRange(0x4E00, 20941)]; // CJK Unified Ideographs - [set addCharactersInRange:NSMakeRange(0xAC00, 11172)]; // Hangul Syllables - [set addCharactersInRange:NSMakeRange(0xD7B0, 80)]; // Hangul Jamo Extended-B - [set addCharactersInString:@""]; // U+F8FF (Private Use Area) - [set addCharactersInRange:NSMakeRange(0xF900, 512)]; // CJK Compatibility Ideographs - [set addCharactersInRange:NSMakeRange(0xFE10, 16)]; // Vertical Forms - [set addCharactersInRange:NSMakeRange(0xFF00, 240)]; // Halfwidth and Fullwidth Forms - [set addCharactersInRange:NSMakeRange(0x1F200, 256)]; // Enclosed Ideographic Supplement - [set addCharactersInRange:NSMakeRange(0x1F300, 768)]; // Enclosed Ideographic Supplement - [set addCharactersInRange:NSMakeRange(0x1F600, 80)]; // Emoticons (Emoji) - [set addCharactersInRange:NSMakeRange(0x1F680, 128)]; // Transport and Map Symbols - - // See http://unicode-table.com/ for more information. - }); - return set; -} - -NSCharacterSet *ASTextVerticalFormRotateAndMoveCharacterSet() { - static NSMutableCharacterSet *set; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - set = [NSMutableCharacterSet new]; - [set addCharactersInString:@",。、."]; - }); - return set; -} - -CGRect ASTextCGRectFitWithContentMode(CGRect rect, CGSize size, UIViewContentMode mode) { - rect = CGRectStandardize(rect); - size.width = size.width < 0 ? -size.width : size.width; - size.height = size.height < 0 ? -size.height : size.height; - CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); - switch (mode) { - case UIViewContentModeScaleAspectFit: - case UIViewContentModeScaleAspectFill: { - if (rect.size.width < 0.01 || rect.size.height < 0.01 || - size.width < 0.01 || size.height < 0.01) { - rect.origin = center; - rect.size = CGSizeZero; - } else { - CGFloat scale; - if (mode == UIViewContentModeScaleAspectFit) { - if (size.width / size.height < rect.size.width / rect.size.height) { - scale = rect.size.height / size.height; - } else { - scale = rect.size.width / size.width; - } - } else { - if (size.width / size.height < rect.size.width / rect.size.height) { - scale = rect.size.width / size.width; - } else { - scale = rect.size.height / size.height; - } - } - size.width *= scale; - size.height *= scale; - rect.size = size; - rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5); - } - } break; - case UIViewContentModeCenter: { - rect.size = size; - rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5); - } break; - case UIViewContentModeTop: { - rect.origin.x = center.x - size.width * 0.5; - rect.size = size; - } break; - case UIViewContentModeBottom: { - rect.origin.x = center.x - size.width * 0.5; - rect.origin.y += rect.size.height - size.height; - rect.size = size; - } break; - case UIViewContentModeLeft: { - rect.origin.y = center.y - size.height * 0.5; - rect.size = size; - } break; - case UIViewContentModeRight: { - rect.origin.y = center.y - size.height * 0.5; - rect.origin.x += rect.size.width - size.width; - rect.size = size; - } break; - case UIViewContentModeTopLeft: { - rect.size = size; - } break; - case UIViewContentModeTopRight: { - rect.origin.x += rect.size.width - size.width; - rect.size = size; - } break; - case UIViewContentModeBottomLeft: { - rect.origin.y += rect.size.height - size.height; - rect.size = size; - } break; - case UIViewContentModeBottomRight: { - rect.origin.x += rect.size.width - size.width; - rect.origin.y += rect.size.height - size.height; - rect.size = size; - } break; - case UIViewContentModeScaleToFill: - case UIViewContentModeRedraw: - default: { - rect = rect; - } - } - return rect; -} diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.h b/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.h deleted file mode 100644 index ef44fb4f..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.h +++ /dev/null @@ -1,1375 +0,0 @@ -// -// NSAttributedString+ASText.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - Get pre-defined attributes from attributed string. - All properties defined in UIKit, CoreText and ASText are included. - */ -@interface NSAttributedString (ASText) - -#pragma mark - Retrieving character attribute information -///============================================================================= -/// @name Retrieving character attribute information -///============================================================================= - -/** - Returns the attributes at first charactor. - */ -@property (nullable, nonatomic, copy, readonly) NSDictionary *as_attributes; - -/** - Returns the attributes for the character at a given index. - - @discussion Raises an `NSRangeException` if index lies beyond the end of the - receiver's characters. - - @param index The index for which to return attributes. - This value must lie within the bounds of the receiver. - - @return The attributes for the character at index. - */ -- (nullable NSDictionary *)as_attributesAtIndex:(NSUInteger)index; - -/** - Returns the value for an attribute with a given name of the character at a given index. - - @discussion Raises an `NSRangeException` if index lies beyond the end of the - receiver's characters. - - @param attributeName The name of an attribute. - @param index The index for which to return attributes. - This value must not exceed the bounds of the receiver. - - @return The value for the attribute named `attributeName` of the character at - index `index`, or nil if there is no such attribute. - */ -- (nullable id)as_attribute:(NSString *)attributeName atIndex:(NSUInteger)index; - - -#pragma mark - Get character attribute as property -///============================================================================= -/// @name Get character attribute as property -///============================================================================= - -/** - The font of the text. (read-only) - - @discussion Default is Helvetica (Neue) 12. - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) UIFont *as_font; -- (nullable UIFont *)as_fontAtIndex:(NSUInteger)index; - -/** - A kerning adjustment. (read-only) - - @discussion Default is standard kerning. The kerning attribute indicate how many - points the following character should be shifted from its default offset as - defined by the current character's font in points; a positive kern indicates a - shift farther along and a negative kern indicates a shift closer to the current - character. If this attribute is not present, standard kerning will be used. - If this attribute is set to 0.0, no kerning will be done at all. - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_kern; -- (nullable NSNumber *)as_kernAtIndex:(NSUInteger)index; - -/** - The foreground color. (read-only) - - @discussion Default is Black. - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) UIColor *as_color; -- (nullable UIColor *)as_colorAtIndex:(NSUInteger)index; - -/** - The background color. (read-only) - - @discussion Default is nil (or no background). - @discussion Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nullable, nonatomic, readonly) UIColor *as_backgroundColor; -- (nullable UIColor *)as_backgroundColorAtIndex:(NSUInteger)index; - -/** - The stroke width. (read-only) - - @discussion Default value is 0.0 (no stroke). This attribute, interpreted as - a percentage of font point size, controls the text drawing mode: positive - values effect drawing with stroke only; negative values are for stroke and fill. - A typical value for outlined text is 3.0. - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_strokeWidth; -- (nullable NSNumber *)as_strokeWidthAtIndex:(NSUInteger)index; - -/** - The stroke color. (read-only) - - @discussion Default value is nil (same as foreground color). - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 - */ -@property (nullable, nonatomic, readonly) UIColor *as_strokeColor; -- (nullable UIColor *)as_strokeColorAtIndex:(NSUInteger)index; - -/** - The text shadow. (read-only) - - @discussion Default value is nil (no shadow). - @discussion Get this property returns the first character's attribute. - @since UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) NSShadow *as_shadow; -- (nullable NSShadow *)as_shadowAtIndex:(NSUInteger)index; - -/** - The strikethrough style. (read-only) - - @discussion Default value is NSUnderlineStyleNone (no strikethrough). - @discussion Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nonatomic, readonly) NSUnderlineStyle as_strikethroughStyle; -- (NSUnderlineStyle)as_strikethroughStyleAtIndex:(NSUInteger)index; - -/** - The strikethrough color. (read-only) - - @discussion Default value is nil (same as foreground color). - @discussion Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) UIColor *as_strikethroughColor; -- (nullable UIColor *)as_strikethroughColorAtIndex:(NSUInteger)index; - -/** - The underline style. (read-only) - - @discussion Default value is NSUnderlineStyleNone (no underline). - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 - */ -@property (nonatomic, readonly) NSUnderlineStyle as_underlineStyle; -- (NSUnderlineStyle)as_underlineStyleAtIndex:(NSUInteger)index; - -/** - The underline color. (read-only) - - @discussion Default value is nil (same as foreground color). - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) UIColor *as_underlineColor; -- (nullable UIColor *)as_underlineColorAtIndex:(NSUInteger)index; - -/** - Ligature formation control. (read-only) - - @discussion Default is int value 1. The ligature attribute determines what kinds - of ligatures should be used when displaying the string. A value of 0 indicates - that only ligatures essential for proper rendering of text should be used, - 1 indicates that standard ligatures should be used, and 2 indicates that all - available ligatures should be used. Which ligatures are standard depends on the - script and possibly the font. - @discussion Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_ligature; -- (nullable NSNumber *)as_ligatureAtIndex:(NSUInteger)index; - -/** - The text effect. (read-only) - - @discussion Default is nil (no effect). The only currently supported value - is NSTextEffectLetterpressStyle. - @discussion Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) NSString *as_textEffect; -- (nullable NSString *)as_textEffectAtIndex:(NSUInteger)index; - -/** - The skew to be applied to glyphs. (read-only) - - @discussion Default is 0 (no skew). - @discussion Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_obliqueness; -- (nullable NSNumber *)as_obliquenessAtIndex:(NSUInteger)index; - -/** - The log of the expansion factor to be applied to glyphs. (read-only) - - @discussion Default is 0 (no expansion). - @discussion Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_expansion; -- (nullable NSNumber *)as_expansionAtIndex:(NSUInteger)index; - -/** - The character's offset from the baseline, in points. (read-only) - - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic, readonly) NSNumber *as_baselineOffset; -- (nullable NSNumber *)as_baselineOffsetAtIndex:(NSUInteger)index; - -/** - Glyph orientation control. (read-only) - - @discussion Default is NO. A value of NO indicates that horizontal glyph forms - are to be used, YES indicates that vertical glyph forms are to be used. - @discussion Get this property returns the first character's attribute. - @since CoreText:4.3 ASText:6.0 - */ -@property (nonatomic, readonly) BOOL as_verticalGlyphForm; -- (BOOL)as_verticalGlyphFormAtIndex:(NSUInteger)index; - -/** - Specifies text language. (read-only) - - @discussion Value must be a NSString containing a locale identifier. Default is - unset. When this attribute is set to a valid identifier, it will be used to select - localized glyphs (if supported by the font) and locale-specific line breaking rules. - @discussion Get this property returns the first character's attribute. - @since CoreText:7.0 ASText:7.0 - */ -@property (nullable, nonatomic, readonly) NSString *as_language; -- (nullable NSString *)as_languageAtIndex:(NSUInteger)index; - -/** - Specifies a bidirectional override or embedding. (read-only) - - @discussion See alse NSWritingDirection and NSWritingDirectionAttributeName. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:7.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) NSArray *as_writingDirection; -- (nullable NSArray *)as_writingDirectionAtIndex:(NSUInteger)index; - -/** - An NSParagraphStyle object which is used to specify things like - line alignment, tab rulers, writing direction, etc. (read-only) - - @discussion Default is nil ([NSParagraphStyle defaultParagraphStyle]). - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic, readonly) NSParagraphStyle *as_paragraphStyle; -- (nullable NSParagraphStyle *)as_paragraphStyleAtIndex:(NSUInteger)index; - -#pragma mark - Get paragraph attribute as property -///============================================================================= -/// @name Get paragraph attribute as property -///============================================================================= - -/** - The text alignment (A wrapper for NSParagraphStyle). (read-only) - - @discussion Natural text alignment is realized as left or right alignment - depending on the line sweep direction of the first script contained in the paragraph. - @discussion Default is NSTextAlignmentNatural. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) NSTextAlignment as_alignment; -- (NSTextAlignment)as_alignmentAtIndex:(NSUInteger)index; - -/** - The mode that should be used to break lines (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the line break mode to be used laying out the paragraph's text. - @discussion Default is NSLineBreakByWordWrapping. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) NSLineBreakMode as_lineBreakMode; -- (NSLineBreakMode)as_lineBreakModeAtIndex:(NSUInteger)index; - -/** - The distance in points between the bottom of one line fragment and the top of the next. - (A wrapper for NSParagraphStyle) (read-only) - - @discussion This value is always nonnegative. This value is included in the line - fragment heights in the layout manager. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_lineSpacing; -- (CGFloat)as_lineSpacingAtIndex:(NSUInteger)index; - -/** - The space after the end of the paragraph (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the space (measured in points) added at the - end of the paragraph to separate it from the following paragraph. This value must - be nonnegative. The space between paragraphs is determined by adding the previous - paragraph's paragraphSpacing and the current paragraph's paragraphSpacingBefore. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_paragraphSpacing; -- (CGFloat)as_paragraphSpacingAtIndex:(NSUInteger)index; - -/** - The distance between the paragraph's top and the beginning of its text content. - (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the space (measured in points) between the - paragraph's top and the beginning of its text content. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_paragraphSpacingBefore; -- (CGFloat)as_paragraphSpacingBeforeAtIndex:(NSUInteger)index; - -/** - The indentation of the first line (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the distance (in points) from the leading margin - of a text container to the beginning of the paragraph's first line. This value - is always nonnegative. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_firstLineHeadIndent; -- (CGFloat)as_firstLineHeadIndentAtIndex:(NSUInteger)index; - -/** - The indentation of the receiver's lines other than the first. (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the distance (in points) from the leading margin - of a text container to the beginning of lines other than the first. This value is - always nonnegative. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_headIndent; -- (CGFloat)as_headIndentAtIndex:(NSUInteger)index; - -/** - The trailing indentation (A wrapper for NSParagraphStyle). (read-only) - - @discussion If positive, this value is the distance from the leading margin - (for example, the left margin in left-to-right text). If 0 or negative, it's the - distance from the trailing margin. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_tailIndent; -- (CGFloat)as_tailIndentAtIndex:(NSUInteger)index; - -/** - The receiver's minimum height (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the minimum height in points that any line in - the receiver will occupy, regardless of the font size or size of any attached graphic. - This value must be nonnegative. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_minimumLineHeight; -- (CGFloat)as_minimumLineHeightAtIndex:(NSUInteger)index; - -/** - The receiver's maximum line height (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the maximum height in points that any line in - the receiver will occupy, regardless of the font size or size of any attached graphic. - This value is always nonnegative. Glyphs and graphics exceeding this height will - overlap neighboring lines; however, a maximum height of 0 implies no line height limit. - Although this limit applies to the line itself, line spacing adds extra space between adjacent lines. - @discussion Default is 0 (no limit). - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_maximumLineHeight; -- (CGFloat)as_maximumLineHeightAtIndex:(NSUInteger)index; - -/** - The line height multiple (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property contains the line break mode to be used laying out the paragraph's text. - @discussion Default is 0 (no multiple). - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) CGFloat as_lineHeightMultiple; -- (CGFloat)as_lineHeightMultipleAtIndex:(NSUInteger)index; - -/** - The base writing direction (A wrapper for NSParagraphStyle). (read-only) - - @discussion If you specify NSWritingDirectionNaturalDirection, the receiver resolves - the writing direction to either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft, - depending on the direction for the user's `language` preference setting. - @discussion Default is NSWritingDirectionNatural. - @discussion Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic, readonly) NSWritingDirection as_baseWritingDirection; -- (NSWritingDirection)as_baseWritingDirectionAtIndex:(NSUInteger)index; - -/** - The paragraph's threshold for hyphenation. (A wrapper for NSParagraphStyle). (read-only) - - @discussion Valid values lie between 0.0 and 1.0 inclusive. Hyphenation is attempted - when the ratio of the text width (as broken without hyphenation) to the width of the - line fragment is less than the hyphenation factor. When the paragraph's hyphenation - factor is 0.0, the layout manager's hyphenation factor is used instead. When both - are 0.0, hyphenation is disabled. - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nonatomic, readonly) float as_hyphenationFactor; -- (float)as_hyphenationFactorAtIndex:(NSUInteger)index; - -/** - The document-wide default tab interval (A wrapper for NSParagraphStyle). (read-only) - - @discussion This property represents the default tab interval in points. Tabs after the - last specified in tabStops are placed at integer multiples of this distance (if positive). - @discussion Default is 0. - @discussion Get this property returns the first character's attribute. - @since CoreText:7.0 UIKit:7.0 ASText:7.0 - */ -@property (nonatomic, readonly) CGFloat as_defaultTabInterval; -- (CGFloat)as_defaultTabIntervalAtIndex:(NSUInteger)index; - -/** - An array of NSTextTab objects representing the receiver's tab stops. - (A wrapper for NSParagraphStyle). (read-only) - - @discussion The NSTextTab objects, sorted by location, define the tab stops for - the paragraph style. - @discussion Default is 12 TabStops with 28.0 tab interval. - @discussion Get this property returns the first character's attribute. - @since CoreText:7.0 UIKit:7.0 ASText:7.0 - */ -@property (nullable, nonatomic, copy, readonly) NSArray *as_tabStops; -- (nullable NSArray *)as_tabStopsAtIndex:(NSUInteger)index; - -#pragma mark - Get ASText attribute as property -///============================================================================= -/// @name Get ASText attribute as property -///============================================================================= - -/** - The text shadow. (read-only) - - @discussion Default value is nil (no shadow). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextShadow *as_textShadow; -- (nullable ASTextShadow *)as_textShadowAtIndex:(NSUInteger)index; - -/** - The text inner shadow. (read-only) - - @discussion Default value is nil (no shadow). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextShadow *as_textInnerShadow; -- (nullable ASTextShadow *)as_textInnerShadowAtIndex:(NSUInteger)index; - -/** - The text underline. (read-only) - - @discussion Default value is nil (no underline). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextDecoration *as_textUnderline; -- (nullable ASTextDecoration *)as_textUnderlineAtIndex:(NSUInteger)index; - -/** - The text strikethrough. (read-only) - - @discussion Default value is nil (no strikethrough). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextDecoration *as_textStrikethrough; -- (nullable ASTextDecoration *)as_textStrikethroughAtIndex:(NSUInteger)index; - -/** - The text border. (read-only) - - @discussion Default value is nil (no border). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextBorder *as_textBorder; -- (nullable ASTextBorder *)as_textBorderAtIndex:(NSUInteger)index; - -/** - The text background border. (read-only) - - @discussion Default value is nil (no background border). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic, readonly) ASTextBorder *as_textBackgroundBorder; -- (nullable ASTextBorder *)as_textBackgroundBorderAtIndex:(NSUInteger)index; - -/** - The glyph transform. (read-only) - - @discussion Default value is CGAffineTransformIdentity (no transform). - @discussion Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nonatomic, readonly) CGAffineTransform as_textGlyphTransform; -- (CGAffineTransform)as_textGlyphTransformAtIndex:(NSUInteger)index; - - -#pragma mark - Query for ASText -///============================================================================= -/// @name Query for ASText -///============================================================================= - -/** - Returns the plain text from a range. - If there's `ASTextBackedStringAttributeName` attribute, the backed string will - replace the attributed string range. - - @param range A range in receiver. - @return The plain text. - */ -- (nullable NSString *)as_plainTextForRange:(NSRange)range; - - -#pragma mark - Create attachment string for ASText -///============================================================================= -/// @name Create attachment string for ASText -///============================================================================= - -/** - Creates and returns an attachment. - - @param content The attachment (UIImage/UIView/CALayer). - @param contentMode The attachment's content mode. - @param width The attachment's container width in layout. - @param ascent The attachment's container ascent in layout. - @param descent The attachment's container descent in layout. - - @return An attributed string, or nil if an error occurs. - @since ASText:6.0 - */ -+ (NSMutableAttributedString *)as_attachmentStringWithContent:(nullable id)content - contentMode:(UIViewContentMode)contentMode - width:(CGFloat)width - ascent:(CGFloat)ascent - descent:(CGFloat)descent; - -/** - Creates and returns an attachment. - - - Example: ContentMode:bottom Alignment:Top. - - The text The attachment holder - ↓ ↓ - ─────────┌──────────────────────┐─────── - / \ │ │ / ___| - / _ \ │ │| | - / ___ \ │ │| |___ ←── The text line - /_/ \_\│ ██████████████ │ \____| - ─────────│ ██████████████ │─────── - │ ██████████████ │ - │ ██████████████ ←───────────────── The attachment content - │ ██████████████ │ - └──────────────────────┘ - - @param content The attachment (UIImage/UIView/CALayer). - @param contentMode The attachment's content mode in attachment holder - @param attachmentSize The attachment holder's size in text layout. - @param font The attachment will align to this font. - @param alignment The attachment holder's alignment to text line. - - @return An attributed string, or nil if an error occurs. - @since ASText:6.0 - */ -+ (NSMutableAttributedString *)as_attachmentStringWithContent:(nullable id)content - contentMode:(UIViewContentMode)contentMode - attachmentSize:(CGSize)attachmentSize - alignToFont:(UIFont *)font - alignment:(ASTextVerticalAlignment)alignment; - -/** - Creates and returns an attahment from a fourquare image as if it was an emoji. - - @param image A fourquare image. - @param fontSize The font size. - - @return An attributed string, or nil if an error occurs. - @since ASText:6.0 - */ -+ (nullable NSMutableAttributedString *)as_attachmentStringWithEmojiImage:(UIImage *)image - fontSize:(CGFloat)fontSize; - -#pragma mark - Utility -///============================================================================= -/// @name Utility -///============================================================================= - -/** - Returns NSMakeRange(0, self.length). - */ -- (NSRange)as_rangeOfAll; - -/** - If YES, it share the same attribute in entire text range. - */ -- (BOOL)as_isSharedAttributesInAllRange; - -/** - If YES, it can be drawn with the [drawWithRect:options:context:] method or displayed with UIKit. - If NO, it should be drawn with CoreText or ASText. - - @discussion If the method returns NO, it means that there's at least one attribute - which is not supported by UIKit (such as CTParagraphStyleRef). If display this string - in UIKit, it may lose some attribute, or even crash the app. - */ -- (BOOL)as_canDrawWithUIKit; - -@end - - - - -/** - Set pre-defined attributes to attributed string. - All properties defined in UIKit, CoreText and ASText are included. - */ -@interface NSMutableAttributedString (ASText) - -#pragma mark - Set character attribute -///============================================================================= -/// @name Set character attribute -///============================================================================= - -/** - Sets the attributes to the entire text string. - - @discussion The old attributes will be removed. - - @param attributes A dictionary containing the attributes to set, or nil to remove all attributes. - */ -- (void)as_setAttributes:(nullable NSDictionary *)attributes; -- (void)setAs_attributes:(nullable NSDictionary *)attributes; - -/** - Sets an attribute with the given name and value to the entire text string. - - @param name A string specifying the attribute name. - @param value The attribute value associated with name. Pass `nil` or `NSNull` to - remove the attribute. - */ -- (void)as_setAttribute:(NSString *)name value:(nullable id)value; - -/** - Sets an attribute with the given name and value to the characters in the specified range. - - @param name A string specifying the attribute name. - @param value The attribute value associated with name. Pass `nil` or `NSNull` to - remove the attribute. - @param range The range of characters to which the specified attribute/value pair applies. - */ -- (void)as_setAttribute:(NSString *)name value:(nullable id)value range:(NSRange)range; - -/** - Removes all attributes in the specified range. - - @param range The range of characters. - */ -- (void)as_removeAttributesInRange:(NSRange)range; - - -#pragma mark - Set character attribute as property -///============================================================================= -/// @name Set character attribute as property -///============================================================================= - -/** - The font of the text. - - @discussion Default is Helvetica (Neue) 12. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) UIFont *as_font; -- (void)as_setFont:(nullable UIFont *)font range:(NSRange)range; - -/** - A kerning adjustment. - - @discussion Default is standard kerning. The kerning attribute indicate how many - points the following character should be shifted from its default offset as - defined by the current character's font in points; a positive kern indicates a - shift farther along and a negative kern indicates a shift closer to the current - character. If this attribute is not present, standard kerning will be used. - If this attribute is set to 0.0, no kerning will be done at all. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSNumber *as_kern; -- (void)as_setKern:(nullable NSNumber *)kern range:(NSRange)range; - -/** - The foreground color. - - @discussion Default is Black. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) UIColor *as_color; -- (void)as_setColor:(nullable UIColor *)color range:(NSRange)range; - -/** - The background color. - - @discussion Default is nil (or no background). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nullable, nonatomic) UIColor *as_backgroundColor; -- (void)as_setBackgroundColor:(nullable UIColor *)backgroundColor range:(NSRange)range; - -/** - The stroke width. - - @discussion Default value is 0.0 (no stroke). This attribute, interpreted as - a percentage of font point size, controls the text drawing mode: positive - values effect drawing with stroke only; negative values are for stroke and fill. - A typical value for outlined text is 3.0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSNumber *as_strokeWidth; -- (void)as_setStrokeWidth:(nullable NSNumber *)strokeWidth range:(NSRange)range; - -/** - The stroke color. - - @discussion Default value is nil (same as foreground color). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) UIColor *as_strokeColor; -- (void)as_setStrokeColor:(nullable UIColor *)strokeColor range:(NSRange)range; - -/** - The text shadow. - - @discussion Default value is nil (no shadow). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSShadow *as_shadow; -- (void)as_setShadow:(nullable NSShadow *)shadow range:(NSRange)range; - -/** - The strikethrough style. - - @discussion Default value is NSUnderlineStyleNone (no strikethrough). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nonatomic) NSUnderlineStyle as_strikethroughStyle; -- (void)as_setStrikethroughStyle:(NSUnderlineStyle)strikethroughStyle range:(NSRange)range; - -/** - The strikethrough color. - - @discussion Default value is nil (same as foreground color). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic) UIColor *as_strikethroughColor; -- (void)as_setStrikethroughColor:(nullable UIColor *)strikethroughColor range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - The underline style. - - @discussion Default value is NSUnderlineStyleNone (no underline). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 - */ -@property (nonatomic) NSUnderlineStyle as_underlineStyle; -- (void)as_setUnderlineStyle:(NSUnderlineStyle)underlineStyle range:(NSRange)range; - -/** - The underline color. - - @discussion Default value is nil (same as foreground color). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:7.0 - */ -@property (nullable, nonatomic) UIColor *as_underlineColor; -- (void)as_setUnderlineColor:(nullable UIColor *)underlineColor range:(NSRange)range; - -/** - Ligature formation control. - - @discussion Default is int value 1. The ligature attribute determines what kinds - of ligatures should be used when displaying the string. A value of 0 indicates - that only ligatures essential for proper rendering of text should be used, - 1 indicates that standard ligatures should be used, and 2 indicates that all - available ligatures should be used. Which ligatures are standard depends on the - script and possibly the font. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:3.2 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSNumber *as_ligature; -- (void)as_setLigature:(nullable NSNumber *)ligature range:(NSRange)range; - -/** - The text effect. - - @discussion Default is nil (no effect). The only currently supported value - is NSTextEffectLetterpressStyle. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic) NSString *as_textEffect; -- (void)as_setTextEffect:(nullable NSString *)textEffect range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - The skew to be applied to glyphs. - - @discussion Default is 0 (no skew). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic) NSNumber *as_obliqueness; -- (void)as_setObliqueness:(nullable NSNumber *)obliqueness range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - The log of the expansion factor to be applied to glyphs. - - @discussion Default is 0 (no expansion). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic) NSNumber *as_expansion; -- (void)as_setExpansion:(nullable NSNumber *)expansion range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - The character's offset from the baseline, in points. - - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:7.0 - */ -@property (nullable, nonatomic) NSNumber *as_baselineOffset; -- (void)as_setBaselineOffset:(nullable NSNumber *)baselineOffset range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - Glyph orientation control. - - @discussion Default is NO. A value of NO indicates that horizontal glyph forms - are to be used, YES indicates that vertical glyph forms are to be used. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:4.3 ASText:6.0 - */ -@property (nonatomic) BOOL as_verticalGlyphForm; -- (void)as_setVerticalGlyphForm:(BOOL)verticalGlyphForm range:(NSRange)range; - -/** - Specifies text language. - - @discussion Value must be a NSString containing a locale identifier. Default is - unset. When this attribute is set to a valid identifier, it will be used to select - localized glyphs (if supported by the font) and locale-specific line breaking rules. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:7.0 ASText:7.0 - */ -@property (nullable, nonatomic) NSString *as_language; -- (void)as_setLanguage:(nullable NSString *)language range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - Specifies a bidirectional override or embedding. - - @discussion See alse NSWritingDirection and NSWritingDirectionAttributeName. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:7.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSArray *as_writingDirection; -- (void)as_setWritingDirection:(nullable NSArray *)writingDirection range:(NSRange)range; - -/** - An NSParagraphStyle object which is used to specify things like - line alignment, tab rulers, writing direction, etc. - - @discussion Default is nil ([NSParagraphStyle defaultParagraphStyle]). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nullable, nonatomic) NSParagraphStyle *as_paragraphStyle; -- (void)as_setParagraphStyle:(nullable NSParagraphStyle *)paragraphStyle range:(NSRange)range; - - -#pragma mark - Set paragraph attribute as property -///============================================================================= -/// @name Set paragraph attribute as property -///============================================================================= - -/** - The text alignment (A wrapper for NSParagraphStyle). - - @discussion Natural text alignment is realized as left or right alignment - depending on the line sweep direction of the first script contained in the paragraph. - @discussion Default is NSTextAlignmentNatural. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) NSTextAlignment as_alignment; -- (void)as_setAlignment:(NSTextAlignment)alignment range:(NSRange)range; - -/** - The mode that should be used to break lines (A wrapper for NSParagraphStyle). - - @discussion This property contains the line break mode to be used laying out the paragraph's text. - @discussion Default is NSLineBreakByWordWrapping. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) NSLineBreakMode as_lineBreakMode; -- (void)as_setLineBreakMode:(NSLineBreakMode)lineBreakMode range:(NSRange)range; - -/** - The distance in points between the bottom of one line fragment and the top of the next. - (A wrapper for NSParagraphStyle) - - @discussion This value is always nonnegative. This value is included in the line - fragment heights in the layout manager. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_lineSpacing; -- (void)as_setLineSpacing:(CGFloat)lineSpacing range:(NSRange)range; - -/** - The space after the end of the paragraph (A wrapper for NSParagraphStyle). - - @discussion This property contains the space (measured in points) added at the - end of the paragraph to separate it from the following paragraph. This value must - be nonnegative. The space between paragraphs is determined by adding the previous - paragraph's paragraphSpacing and the current paragraph's paragraphSpacingBefore. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_paragraphSpacing; -- (void)as_setParagraphSpacing:(CGFloat)paragraphSpacing range:(NSRange)range; - -/** - The distance between the paragraph's top and the beginning of its text content. - (A wrapper for NSParagraphStyle). - - @discussion This property contains the space (measured in points) between the - paragraph's top and the beginning of its text content. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_paragraphSpacingBefore; -- (void)as_setParagraphSpacingBefore:(CGFloat)paragraphSpacingBefore range:(NSRange)range; - -/** - The indentation of the first line (A wrapper for NSParagraphStyle). - - @discussion This property contains the distance (in points) from the leading margin - of a text container to the beginning of the paragraph's first line. This value - is always nonnegative. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_firstLineHeadIndent; -- (void)as_setFirstLineHeadIndent:(CGFloat)firstLineHeadIndent range:(NSRange)range; - -/** - The indentation of the receiver's lines other than the first. (A wrapper for NSParagraphStyle). - - @discussion This property contains the distance (in points) from the leading margin - of a text container to the beginning of lines other than the first. This value is - always nonnegative. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_headIndent; -- (void)as_setHeadIndent:(CGFloat)headIndent range:(NSRange)range; - -/** - The trailing indentation (A wrapper for NSParagraphStyle). - - @discussion If positive, this value is the distance from the leading margin - (for example, the left margin in left-to-right text). If 0 or negative, it's the - distance from the trailing margin. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_tailIndent; -- (void)as_setTailIndent:(CGFloat)tailIndent range:(NSRange)range; - -/** - The receiver's minimum height (A wrapper for NSParagraphStyle). - - @discussion This property contains the minimum height in points that any line in - the receiver will occupy, regardless of the font size or size of any attached graphic. - This value must be nonnegative. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_minimumLineHeight; -- (void)as_setMinimumLineHeight:(CGFloat)minimumLineHeight range:(NSRange)range; - -/** - The receiver's maximum line height (A wrapper for NSParagraphStyle). - - @discussion This property contains the maximum height in points that any line in - the receiver will occupy, regardless of the font size or size of any attached graphic. - This value is always nonnegative. Glyphs and graphics exceeding this height will - overlap neighboring lines; however, a maximum height of 0 implies no line height limit. - Although this limit applies to the line itself, line spacing adds extra space between adjacent lines. - @discussion Default is 0 (no limit). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_maximumLineHeight; -- (void)as_setMaximumLineHeight:(CGFloat)maximumLineHeight range:(NSRange)range; - -/** - The line height multiple (A wrapper for NSParagraphStyle). - - @discussion This property contains the line break mode to be used laying out the paragraph's text. - @discussion Default is 0 (no multiple). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) CGFloat as_lineHeightMultiple; -- (void)as_setLineHeightMultiple:(CGFloat)lineHeightMultiple range:(NSRange)range; - -/** - The base writing direction (A wrapper for NSParagraphStyle). - - @discussion If you specify NSWritingDirectionNaturalDirection, the receiver resolves - the writing direction to either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft, - depending on the direction for the user's `language` preference setting. - @discussion Default is NSWritingDirectionNatural. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:6.0 UIKit:6.0 ASText:6.0 - */ -@property (nonatomic) NSWritingDirection as_baseWritingDirection; -- (void)as_setBaseWritingDirection:(NSWritingDirection)baseWritingDirection range:(NSRange)range; - -/** - The paragraph's threshold for hyphenation. (A wrapper for NSParagraphStyle). - - @discussion Valid values lie between 0.0 and 1.0 inclusive. Hyphenation is attempted - when the ratio of the text width (as broken without hyphenation) to the width of the - line fragment is less than the hyphenation factor. When the paragraph's hyphenation - factor is 0.0, the layout manager's hyphenation factor is used instead. When both - are 0.0, hyphenation is disabled. - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since UIKit:6.0 - */ -@property (nonatomic) float as_hyphenationFactor; -- (void)as_setHyphenationFactor:(float)hyphenationFactor range:(NSRange)range; - -/** - The document-wide default tab interval (A wrapper for NSParagraphStyle). - - @discussion This property represents the default tab interval in points. Tabs after the - last specified in tabStops are placed at integer multiples of this distance (if positive). - @discussion Default is 0. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:7.0 UIKit:7.0 ASText:7.0 - */ -@property (nonatomic) CGFloat as_defaultTabInterval; -- (void)as_setDefaultTabInterval:(CGFloat)defaultTabInterval range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -/** - An array of NSTextTab objects representing the receiver's tab stops. - (A wrapper for NSParagraphStyle). - - @discussion The NSTextTab objects, sorted by location, define the tab stops for - the paragraph style. - @discussion Default is 12 TabStops with 28.0 tab interval. - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since CoreText:7.0 UIKit:7.0 ASText:7.0 - */ -@property (nullable, nonatomic, copy) NSArray *as_tabStops; -- (void)as_setTabStops:(nullable NSArray *)tabStops range:(NSRange)range NS_AVAILABLE_IOS(7_0); - -#pragma mark - Set ASText attribute as property -///============================================================================= -/// @name Set ASText attribute as property -///============================================================================= - -/** - The text shadow. - - @discussion Default value is nil (no shadow). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextShadow *as_textShadow; -- (void)as_setTextShadow:(nullable ASTextShadow *)textShadow range:(NSRange)range; - -/** - The text inner shadow. - - @discussion Default value is nil (no shadow). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextShadow *as_textInnerShadow; -- (void)as_setTextInnerShadow:(nullable ASTextShadow *)textInnerShadow range:(NSRange)range; - -/** - The text underline. - - @discussion Default value is nil (no underline). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextDecoration *as_textUnderline; -- (void)as_setTextUnderline:(nullable ASTextDecoration *)textUnderline range:(NSRange)range; - -/** - The text strikethrough. - - @discussion Default value is nil (no strikethrough). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextDecoration *as_textStrikethrough; -- (void)as_setTextStrikethrough:(nullable ASTextDecoration *)textStrikethrough range:(NSRange)range; - -/** - The text border. - - @discussion Default value is nil (no border). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextBorder *as_textBorder; -- (void)as_setTextBorder:(nullable ASTextBorder *)textBorder range:(NSRange)range; - -/** - The text background border. - - @discussion Default value is nil (no background border). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nullable, nonatomic) ASTextBorder *as_textBackgroundBorder; -- (void)as_setTextBackgroundBorder:(nullable ASTextBorder *)textBackgroundBorder range:(NSRange)range; - -/** - The glyph transform. - - @discussion Default value is CGAffineTransformIdentity (no transform). - @discussion Set this property applies to the entire text string. - Get this property returns the first character's attribute. - @since ASText:6.0 - */ -@property (nonatomic) CGAffineTransform as_textGlyphTransform; -- (void)as_setTextGlyphTransform:(CGAffineTransform)textGlyphTransform range:(NSRange)range; - - -#pragma mark - Set discontinuous attribute for range -///============================================================================= -/// @name Set discontinuous attribute for range -///============================================================================= - -- (void)as_setSuperscript:(nullable NSNumber *)superscript range:(NSRange)range; -- (void)as_setGlyphInfo:(nullable CTGlyphInfoRef)glyphInfo range:(NSRange)range; -- (void)as_setCharacterShape:(nullable NSNumber *)characterShape range:(NSRange)range __TVOS_PROHIBITED; -- (void)as_setRunDelegate:(nullable CTRunDelegateRef)runDelegate range:(NSRange)range; -- (void)as_setBaselineClass:(nullable CFStringRef)baselineClass range:(NSRange)range; -- (void)as_setBaselineInfo:(nullable CFDictionaryRef)baselineInfo range:(NSRange)range; -- (void)as_setBaselineReferenceInfo:(nullable CFDictionaryRef)referenceInfo range:(NSRange)range; -- (void)as_setRubyAnnotation:(nullable CTRubyAnnotationRef)ruby range:(NSRange)range NS_AVAILABLE_IOS(8_0); -- (void)as_setAttachment:(nullable NSTextAttachment *)attachment range:(NSRange)range NS_AVAILABLE_IOS(7_0); -- (void)as_setLink:(nullable id)link range:(NSRange)range NS_AVAILABLE_IOS(7_0); -- (void)as_setTextBackedString:(nullable ASTextBackedString *)textBackedString range:(NSRange)range; -- (void)as_setTextBinding:(nullable ASTextBinding *)textBinding range:(NSRange)range; -- (void)as_setTextAttachment:(nullable ASTextAttachment *)textAttachment range:(NSRange)range; -- (void)as_setTextHighlight:(nullable ASTextHighlight *)textHighlight range:(NSRange)range; -- (void)as_setTextBlockBorder:(nullable ASTextBorder *)textBlockBorder range:(NSRange)range; - - -#pragma mark - Convenience methods for text highlight -///============================================================================= -/// @name Convenience methods for text highlight -///============================================================================= - -/** - Convenience method to set text highlight - - @param range text range - @param color text color (pass nil to ignore) - @param backgroundColor text background color when highlight - @param userInfo user information dictionary (pass nil to ignore) - @param tapAction tap action when user tap the highlight (pass nil to ignore) - @param longPressAction long press action when user long press the highlight (pass nil to ignore) - */ -- (void)as_setTextHighlightRange:(NSRange)range - color:(nullable UIColor *)color - backgroundColor:(nullable UIColor *)backgroundColor - userInfo:(nullable NSDictionary *)userInfo - tapAction:(nullable ASTextAction)tapAction - longPressAction:(nullable ASTextAction)longPressAction; - -/** - Convenience method to set text highlight - - @param range text range - @param color text color (pass nil to ignore) - @param backgroundColor text background color when highlight - @param tapAction tap action when user tap the highlight (pass nil to ignore) - */ -- (void)as_setTextHighlightRange:(NSRange)range - color:(nullable UIColor *)color - backgroundColor:(nullable UIColor *)backgroundColor - tapAction:(nullable ASTextAction)tapAction; - -/** - Convenience method to set text highlight - - @param range text range - @param color text color (pass nil to ignore) - @param backgroundColor text background color when highlight - @param userInfo tap action when user tap the highlight (pass nil to ignore) - */ -- (void)as_setTextHighlightRange:(NSRange)range - color:(nullable UIColor *)color - backgroundColor:(nullable UIColor *)backgroundColor - userInfo:(nullable NSDictionary *)userInfo; - -#pragma mark - Utilities -///============================================================================= -/// @name Utilities -///============================================================================= - -/** - Inserts into the receiver the characters of a given string at a given location. - The new string inherit the attributes of the first replaced character from location. - - @param string The string to insert into the receiver, must not be nil. - @param location The location at which string is inserted. The location must not - exceed the bounds of the receiver. - @throw Raises an NSRangeException if the location out of bounds. - */ -- (void)as_insertString:(NSString *)string atIndex:(NSUInteger)location; - -/** - Adds to the end of the receiver the characters of a given string. - The new string inherit the attributes of the receiver's tail. - - @param string The string to append to the receiver, must not be nil. - */ -- (void)as_appendString:(NSString *)string; - -/** - Removes all discontinuous attributes in a specified range. - See `allDiscontinuousAttributeKeys`. - - @param range A text range. - */ -- (void)as_removeDiscontinuousAttributesInRange:(NSRange)range; - -/** - Returns all discontinuous attribute keys, such as RunDelegate/Attachment/Ruby. - - @discussion These attributes can only set to a specified range of text, and - should not extend to other range when editing text. - */ -+ (NSArray *)as_allDiscontinuousAttributeKeys; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.mm b/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.mm deleted file mode 100644 index 39f62815..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/NSAttributedString+ASText.mm +++ /dev/null @@ -1,1208 +0,0 @@ -// -// NSAttributedString+ASText.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import -#import -#import - - -// Dummy class for category -@interface NSAttributedString_ASText : NSObject @end -@implementation NSAttributedString_ASText @end - - -@implementation NSAttributedString (ASText) - -- (NSDictionary *)as_attributesAtIndex:(NSUInteger)index { - if (index > self.length || self.length == 0) return nil; - if (self.length > 0 && index == self.length) index--; - return [self attributesAtIndex:index effectiveRange:NULL]; -} - -- (id)as_attribute:(NSString *)attributeName atIndex:(NSUInteger)index { - if (!attributeName) return nil; - if (index > self.length || self.length == 0) return nil; - if (self.length > 0 && index == self.length) index--; - return [self attribute:attributeName atIndex:index effectiveRange:NULL]; -} - -- (NSDictionary *)as_attributes { - return [self as_attributesAtIndex:0]; -} - -- (UIFont *)as_font { - return [self as_fontAtIndex:0]; -} - -- (UIFont *)as_fontAtIndex:(NSUInteger)index { - return [self as_attribute:NSFontAttributeName atIndex:index]; -} - -- (NSNumber *)as_kern { - return [self as_kernAtIndex:0]; -} - -- (NSNumber *)as_kernAtIndex:(NSUInteger)index { - return [self as_attribute:NSKernAttributeName atIndex:index]; -} - -- (UIColor *)as_color { - return [self as_colorAtIndex:0]; -} - -- (UIColor *)as_colorAtIndex:(NSUInteger)index { - UIColor *color = [self as_attribute:NSForegroundColorAttributeName atIndex:index]; - if (!color) { - CGColorRef ref = (__bridge CGColorRef)([self as_attribute:(NSString *)kCTForegroundColorAttributeName atIndex:index]); - color = [UIColor colorWithCGColor:ref]; - } - if (color && ![color isKindOfClass:[UIColor class]]) { - if (CFGetTypeID((__bridge CFTypeRef)(color)) == CGColorGetTypeID()) { - color = [UIColor colorWithCGColor:(__bridge CGColorRef)(color)]; - } else { - color = nil; - } - } - return color; -} - -- (UIColor *)as_backgroundColor { - return [self as_backgroundColorAtIndex:0]; -} - -- (UIColor *)as_backgroundColorAtIndex:(NSUInteger)index { - return [self as_attribute:NSBackgroundColorAttributeName atIndex:index]; -} - -- (NSNumber *)as_strokeWidth { - return [self as_strokeWidthAtIndex:0]; -} - -- (NSNumber *)as_strokeWidthAtIndex:(NSUInteger)index { - return [self as_attribute:NSStrokeWidthAttributeName atIndex:index]; -} - -- (UIColor *)as_strokeColor { - return [self as_strokeColorAtIndex:0]; -} - -- (UIColor *)as_strokeColorAtIndex:(NSUInteger)index { - UIColor *color = [self as_attribute:NSStrokeColorAttributeName atIndex:index]; - if (!color) { - CGColorRef ref = (__bridge CGColorRef)([self as_attribute:(NSString *)kCTStrokeColorAttributeName atIndex:index]); - color = [UIColor colorWithCGColor:ref]; - } - return color; -} - -- (NSShadow *)as_shadow { - return [self as_shadowAtIndex:0]; -} - -- (NSShadow *)as_shadowAtIndex:(NSUInteger)index { - return [self as_attribute:NSShadowAttributeName atIndex:index]; -} - -- (NSUnderlineStyle)as_strikethroughStyle { - return [self as_strikethroughStyleAtIndex:0]; -} - -- (NSUnderlineStyle)as_strikethroughStyleAtIndex:(NSUInteger)index { - NSNumber *style = [self as_attribute:NSStrikethroughStyleAttributeName atIndex:index]; - return (NSUnderlineStyle)style.integerValue; -} - -- (UIColor *)as_strikethroughColor { - return [self as_strikethroughColorAtIndex:0]; -} - -- (UIColor *)as_strikethroughColorAtIndex:(NSUInteger)index { - return [self as_attribute:NSStrikethroughColorAttributeName atIndex:index]; -} - -- (NSUnderlineStyle)as_underlineStyle { - return [self as_underlineStyleAtIndex:0]; -} - -- (NSUnderlineStyle)as_underlineStyleAtIndex:(NSUInteger)index { - NSNumber *style = [self as_attribute:NSUnderlineStyleAttributeName atIndex:index]; - return (NSUnderlineStyle)style.integerValue; -} - -- (UIColor *)as_underlineColor { - return [self as_underlineColorAtIndex:0]; -} - -- (UIColor *)as_underlineColorAtIndex:(NSUInteger)index { - UIColor *color = [self as_attribute:NSUnderlineColorAttributeName atIndex:index]; - if (!color) { - CGColorRef ref = (__bridge CGColorRef)([self as_attribute:(NSString *)kCTUnderlineColorAttributeName atIndex:index]); - color = [UIColor colorWithCGColor:ref]; - } - return color; -} - -- (NSNumber *)as_ligature { - return [self as_ligatureAtIndex:0]; -} - -- (NSNumber *)as_ligatureAtIndex:(NSUInteger)index { - return [self as_attribute:NSLigatureAttributeName atIndex:index]; -} - -- (NSString *)as_textEffect { - return [self as_textEffectAtIndex:0]; -} - -- (NSString *)as_textEffectAtIndex:(NSUInteger)index { - return [self as_attribute:NSTextEffectAttributeName atIndex:index]; -} - -- (NSNumber *)as_obliqueness { - return [self as_obliquenessAtIndex:0]; -} - -- (NSNumber *)as_obliquenessAtIndex:(NSUInteger)index { - return [self as_attribute:NSObliquenessAttributeName atIndex:index]; -} - -- (NSNumber *)as_expansion { - return [self as_expansionAtIndex:0]; -} - -- (NSNumber *)as_expansionAtIndex:(NSUInteger)index { - return [self as_attribute:NSExpansionAttributeName atIndex:index]; -} - -- (NSNumber *)as_baselineOffset { - return [self as_baselineOffsetAtIndex:0]; -} - -- (NSNumber *)as_baselineOffsetAtIndex:(NSUInteger)index { - return [self as_attribute:NSBaselineOffsetAttributeName atIndex:index]; -} - -- (BOOL)as_verticalGlyphForm { - return [self as_verticalGlyphFormAtIndex:0]; -} - -- (BOOL)as_verticalGlyphFormAtIndex:(NSUInteger)index { - NSNumber *num = [self as_attribute:NSVerticalGlyphFormAttributeName atIndex:index]; - return num.boolValue; -} - -- (NSString *)as_language { - return [self as_languageAtIndex:0]; -} - -- (NSString *)as_languageAtIndex:(NSUInteger)index { - return [self as_attribute:(id)kCTLanguageAttributeName atIndex:index]; -} - -- (NSArray *)as_writingDirection { - return [self as_writingDirectionAtIndex:0]; -} - -- (NSArray *)as_writingDirectionAtIndex:(NSUInteger)index { - return [self as_attribute:(id)kCTWritingDirectionAttributeName atIndex:index]; -} - -- (NSParagraphStyle *)as_paragraphStyle { - return [self as_paragraphStyleAtIndex:0]; -} - -- (NSParagraphStyle *)as_paragraphStyleAtIndex:(NSUInteger)index { - /* - NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef. - - CoreText can use both NSParagraphStyle and CTParagraphStyleRef, - but UILabel/UITextView can only use NSParagraphStyle. - - We use NSParagraphStyle in both CoreText and UIKit. - */ - NSParagraphStyle *style = [self as_attribute:NSParagraphStyleAttributeName atIndex:index]; - if (style) { - if (CFGetTypeID((__bridge CFTypeRef)(style)) == CTParagraphStyleGetTypeID()) { \ - style = [NSParagraphStyle as_styleWithCTStyle:(__bridge CTParagraphStyleRef)(style)]; - } - } - return style; -} - -#define ParagraphAttribute(_attr_) \ -NSParagraphStyle *style = self.as_paragraphStyle; \ -if (!style) style = [NSParagraphStyle defaultParagraphStyle]; \ -return style. _attr_; - -#define ParagraphAttributeAtIndex(_attr_) \ -NSParagraphStyle *style = [self as_paragraphStyleAtIndex:index]; \ -if (!style) style = [NSParagraphStyle defaultParagraphStyle]; \ -return style. _attr_; - -- (NSTextAlignment)as_alignment { - ParagraphAttribute(alignment); -} - -- (NSLineBreakMode)as_lineBreakMode { - ParagraphAttribute(lineBreakMode); -} - -- (CGFloat)as_lineSpacing { - ParagraphAttribute(lineSpacing); -} - -- (CGFloat)as_paragraphSpacing { - ParagraphAttribute(paragraphSpacing); -} - -- (CGFloat)as_paragraphSpacingBefore { - ParagraphAttribute(paragraphSpacingBefore); -} - -- (CGFloat)as_firstLineHeadIndent { - ParagraphAttribute(firstLineHeadIndent); -} - -- (CGFloat)as_headIndent { - ParagraphAttribute(headIndent); -} - -- (CGFloat)as_tailIndent { - ParagraphAttribute(tailIndent); -} - -- (CGFloat)as_minimumLineHeight { - ParagraphAttribute(minimumLineHeight); -} - -- (CGFloat)as_maximumLineHeight { - ParagraphAttribute(maximumLineHeight); -} - -- (CGFloat)as_lineHeightMultiple { - ParagraphAttribute(lineHeightMultiple); -} - -- (NSWritingDirection)as_baseWritingDirection { - ParagraphAttribute(baseWritingDirection); -} - -- (float)as_hyphenationFactor { - ParagraphAttribute(hyphenationFactor); -} - -- (CGFloat)as_defaultTabInterval { - ParagraphAttribute(defaultTabInterval); -} - -- (NSArray *)as_tabStops { - ParagraphAttribute(tabStops); -} - -- (NSTextAlignment)as_alignmentAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(alignment); -} - -- (NSLineBreakMode)as_lineBreakModeAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(lineBreakMode); -} - -- (CGFloat)as_lineSpacingAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(lineSpacing); -} - -- (CGFloat)as_paragraphSpacingAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(paragraphSpacing); -} - -- (CGFloat)as_paragraphSpacingBeforeAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(paragraphSpacingBefore); -} - -- (CGFloat)as_firstLineHeadIndentAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(firstLineHeadIndent); -} - -- (CGFloat)as_headIndentAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(headIndent); -} - -- (CGFloat)as_tailIndentAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(tailIndent); -} - -- (CGFloat)as_minimumLineHeightAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(minimumLineHeight); -} - -- (CGFloat)as_maximumLineHeightAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(maximumLineHeight); -} - -- (CGFloat)as_lineHeightMultipleAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(lineHeightMultiple); -} - -- (NSWritingDirection)as_baseWritingDirectionAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(baseWritingDirection); -} - -- (float)as_hyphenationFactorAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(hyphenationFactor); -} - -- (CGFloat)as_defaultTabIntervalAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(defaultTabInterval); -} - -- (NSArray *)as_tabStopsAtIndex:(NSUInteger)index { - ParagraphAttributeAtIndex(tabStops); -} - -#undef ParagraphAttribute -#undef ParagraphAttributeAtIndex - -- (ASTextShadow *)as_textShadow { - return [self as_textShadowAtIndex:0]; -} - -- (ASTextShadow *)as_textShadowAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextShadowAttributeName atIndex:index]; -} - -- (ASTextShadow *)as_textInnerShadow { - return [self as_textInnerShadowAtIndex:0]; -} - -- (ASTextShadow *)as_textInnerShadowAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextInnerShadowAttributeName atIndex:index]; -} - -- (ASTextDecoration *)as_textUnderline { - return [self as_textUnderlineAtIndex:0]; -} - -- (ASTextDecoration *)as_textUnderlineAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextUnderlineAttributeName atIndex:index]; -} - -- (ASTextDecoration *)as_textStrikethrough { - return [self as_textStrikethroughAtIndex:0]; -} - -- (ASTextDecoration *)as_textStrikethroughAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextStrikethroughAttributeName atIndex:index]; -} - -- (ASTextBorder *)as_textBorder { - return [self as_textBorderAtIndex:0]; -} - -- (ASTextBorder *)as_textBorderAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextBorderAttributeName atIndex:index]; -} - -- (ASTextBorder *)as_textBackgroundBorder { - return [self as_textBackgroundBorderAtIndex:0]; -} - -- (ASTextBorder *)as_textBackgroundBorderAtIndex:(NSUInteger)index { - return [self as_attribute:ASTextBackedStringAttributeName atIndex:index]; -} - -- (CGAffineTransform)as_textGlyphTransform { - return [self as_textGlyphTransformAtIndex:0]; -} - -- (CGAffineTransform)as_textGlyphTransformAtIndex:(NSUInteger)index { - NSValue *value = [self as_attribute:ASTextGlyphTransformAttributeName atIndex:index]; - if (!value) return CGAffineTransformIdentity; - return [value CGAffineTransformValue]; -} - -- (NSString *)as_plainTextForRange:(NSRange)range { - if (range.location == NSNotFound ||range.length == NSNotFound) return nil; - NSMutableString *result = [NSMutableString string]; - if (range.length == 0) return result; - NSString *string = self.string; - [self enumerateAttribute:ASTextBackedStringAttributeName inRange:range options:kNilOptions usingBlock:^(id value, NSRange range, BOOL *stop) { - ASTextBackedString *backed = value; - if (backed && backed.string) { - [result appendString:backed.string]; - } else { - [result appendString:[string substringWithRange:range]]; - } - }]; - return result; -} - -+ (NSMutableAttributedString *)as_attachmentStringWithContent:(id)content - contentMode:(UIViewContentMode)contentMode - width:(CGFloat)width - ascent:(CGFloat)ascent - descent:(CGFloat)descent { - NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:ASTextAttachmentToken]; - - ASTextAttachment *attach = [ASTextAttachment new]; - attach.content = content; - attach.contentMode = contentMode; - [atr as_setTextAttachment:attach range:NSMakeRange(0, atr.length)]; - - ASTextRunDelegate *delegate = [ASTextRunDelegate new]; - delegate.width = width; - delegate.ascent = ascent; - delegate.descent = descent; - CTRunDelegateRef delegateRef = delegate.CTRunDelegate; - [atr as_setRunDelegate:delegateRef range:NSMakeRange(0, atr.length)]; - if (delegate) CFRelease(delegateRef); - - return atr; -} - -+ (NSMutableAttributedString *)as_attachmentStringWithContent:(id)content - contentMode:(UIViewContentMode)contentMode - attachmentSize:(CGSize)attachmentSize - alignToFont:(UIFont *)font - alignment:(ASTextVerticalAlignment)alignment { - NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:ASTextAttachmentToken]; - - ASTextAttachment *attach = [ASTextAttachment new]; - attach.content = content; - attach.contentMode = contentMode; - [atr as_setTextAttachment:attach range:NSMakeRange(0, atr.length)]; - - ASTextRunDelegate *delegate = [ASTextRunDelegate new]; - delegate.width = attachmentSize.width; - switch (alignment) { - case ASTextVerticalAlignmentTop: { - delegate.ascent = font.ascender; - delegate.descent = attachmentSize.height - font.ascender; - if (delegate.descent < 0) { - delegate.descent = 0; - delegate.ascent = attachmentSize.height; - } - } break; - case ASTextVerticalAlignmentCenter: { - CGFloat fontHeight = font.ascender - font.descender; - CGFloat yOffset = font.ascender - fontHeight * 0.5; - delegate.ascent = attachmentSize.height * 0.5 + yOffset; - delegate.descent = attachmentSize.height - delegate.ascent; - if (delegate.descent < 0) { - delegate.descent = 0; - delegate.ascent = attachmentSize.height; - } - } break; - case ASTextVerticalAlignmentBottom: { - delegate.ascent = attachmentSize.height + font.descender; - delegate.descent = -font.descender; - if (delegate.ascent < 0) { - delegate.ascent = 0; - delegate.descent = attachmentSize.height; - } - } break; - default: { - delegate.ascent = attachmentSize.height; - delegate.descent = 0; - } break; - } - - CTRunDelegateRef delegateRef = delegate.CTRunDelegate; - [atr as_setRunDelegate:delegateRef range:NSMakeRange(0, atr.length)]; - if (delegate) CFRelease(delegateRef); - - return atr; -} - -+ (NSMutableAttributedString *)as_attachmentStringWithEmojiImage:(UIImage *)image - fontSize:(CGFloat)fontSize { - if (!image || fontSize <= 0) return nil; - - BOOL hasAnim = NO; - if (image.images.count > 1) { - hasAnim = YES; - } else if (NSProtocolFromString(@"ASAnimatedImage") && - [image conformsToProtocol:NSProtocolFromString(@"ASAnimatedImage")]) { - NSNumber *frameCount = [image valueForKey:@"animatedImageFrameCount"]; - if (frameCount.intValue > 1) hasAnim = YES; - } - - CGFloat ascent = ASTextEmojiGetAscentWithFontSize(fontSize); - CGFloat descent = ASTextEmojiGetDescentWithFontSize(fontSize); - CGRect bounding = ASTextEmojiGetGlyphBoundingRectWithFontSize(fontSize); - - ASTextRunDelegate *delegate = [ASTextRunDelegate new]; - delegate.ascent = ascent; - delegate.descent = descent; - delegate.width = bounding.size.width + 2 * bounding.origin.x; - - ASTextAttachment *attachment = [ASTextAttachment new]; - attachment.contentMode = UIViewContentModeScaleAspectFit; - attachment.contentInsets = UIEdgeInsetsMake(ascent - (bounding.size.height + bounding.origin.y), bounding.origin.x, descent + bounding.origin.y, bounding.origin.x); - if (hasAnim) { - Class imageClass = NSClassFromString(@"ASAnimatedImageView"); - if (!imageClass) imageClass = [UIImageView class]; - UIImageView *view = (id)[imageClass new]; - view.frame = bounding; - view.image = image; - view.contentMode = UIViewContentModeScaleAspectFit; - attachment.content = view; - } else { - attachment.content = image; - } - - NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:ASTextAttachmentToken]; - [atr as_setTextAttachment:attachment range:NSMakeRange(0, atr.length)]; - CTRunDelegateRef ctDelegate = delegate.CTRunDelegate; - [atr as_setRunDelegate:ctDelegate range:NSMakeRange(0, atr.length)]; - if (ctDelegate) CFRelease(ctDelegate); - - return atr; -} - -- (NSRange)as_rangeOfAll { - return NSMakeRange(0, self.length); -} - -- (BOOL)as_isSharedAttributesInAllRange { - __block BOOL shared = YES; - __block NSDictionary *firstAttrs = nil; - [self enumerateAttributesInRange:self.as_rangeOfAll options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) { - if (range.location == 0) { - firstAttrs = attrs; - } else { - if (firstAttrs.count != attrs.count) { - shared = NO; - *stop = YES; - } else if (firstAttrs) { - if (![firstAttrs isEqualToDictionary:attrs]) { - shared = NO; - *stop = YES; - } - } - } - }]; - return shared; -} - -- (BOOL)as_canDrawWithUIKit { - static NSMutableSet *failSet; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - failSet = [NSMutableSet new]; - [failSet addObject:(id)kCTGlyphInfoAttributeName]; -#if TARGET_OS_IOS -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [failSet addObject:(id)kCTCharacterShapeAttributeName]; -#pragma clang diagnostic pop -#endif - [failSet addObject:(id)kCTLanguageAttributeName]; - [failSet addObject:(id)kCTRunDelegateAttributeName]; - [failSet addObject:(id)kCTBaselineClassAttributeName]; - [failSet addObject:(id)kCTBaselineInfoAttributeName]; - [failSet addObject:(id)kCTBaselineReferenceInfoAttributeName]; - [failSet addObject:(id)kCTRubyAnnotationAttributeName]; - [failSet addObject:ASTextShadowAttributeName]; - [failSet addObject:ASTextInnerShadowAttributeName]; - [failSet addObject:ASTextUnderlineAttributeName]; - [failSet addObject:ASTextStrikethroughAttributeName]; - [failSet addObject:ASTextBorderAttributeName]; - [failSet addObject:ASTextBackgroundBorderAttributeName]; - [failSet addObject:ASTextBlockBorderAttributeName]; - [failSet addObject:ASTextAttachmentAttributeName]; - [failSet addObject:ASTextHighlightAttributeName]; - [failSet addObject:ASTextGlyphTransformAttributeName]; - }); - -#define Fail { result = NO; *stop = YES; return; } - __block BOOL result = YES; - [self enumerateAttributesInRange:self.as_rangeOfAll options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) { - if (attrs.count == 0) return; - for (NSString *str in attrs.allKeys) { - if ([failSet containsObject:str]) Fail; - } - if (attrs[(id)kCTForegroundColorAttributeName] && !attrs[NSForegroundColorAttributeName]) Fail; - if (attrs[(id)kCTStrokeColorAttributeName] && !attrs[NSStrokeColorAttributeName]) Fail; - if (attrs[(id)kCTUnderlineColorAttributeName]) { - if (!attrs[NSUnderlineColorAttributeName]) Fail; - } - NSParagraphStyle *style = attrs[NSParagraphStyleAttributeName]; - if (style && CFGetTypeID((__bridge CFTypeRef)(style)) == CTParagraphStyleGetTypeID()) Fail; - }]; - return result; -#undef Fail -} - -@end - -@implementation NSMutableAttributedString (ASText) - -- (void)as_setAttributes:(NSDictionary *)attributes { - [self setAs_attributes:attributes]; -} - -- (void)setAs_attributes:(NSDictionary *)attributes { - if (attributes == (id)[NSNull null]) attributes = nil; - [self setAttributes:@{} range:NSMakeRange(0, self.length)]; - [attributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - [self as_setAttribute:key value:obj]; - }]; -} - -- (void)as_setAttribute:(NSString *)name value:(id)value { - [self as_setAttribute:name value:value range:NSMakeRange(0, self.length)]; -} - -- (void)as_setAttribute:(NSString *)name value:(id)value range:(NSRange)range { - if (!name || [NSNull isEqual:name]) return; - if (value && ![NSNull isEqual:value]) [self addAttribute:name value:value range:range]; - else [self removeAttribute:name range:range]; -} - -- (void)as_removeAttributesInRange:(NSRange)range { - [self setAttributes:nil range:range]; -} - -#pragma mark - Property Setter - -- (void)setAs_font:(UIFont *)font { - /* - In iOS7 and later, UIFont is toll-free bridged to CTFontRef, - although Apple does not mention it in documentation. - - In iOS6, UIFont is a wrapper for CTFontRef, so CoreText can alse use UIfont, - but UILabel/UITextView cannot use CTFontRef. - - We use UIFont for both CoreText and UIKit. - */ - [self as_setFont:font range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_kern:(NSNumber *)kern { - [self as_setKern:kern range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_color:(UIColor *)color { - [self as_setColor:color range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_backgroundColor:(UIColor *)backgroundColor { - [self as_setBackgroundColor:backgroundColor range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_strokeWidth:(NSNumber *)strokeWidth { - [self as_setStrokeWidth:strokeWidth range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_strokeColor:(UIColor *)strokeColor { - [self as_setStrokeColor:strokeColor range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_shadow:(NSShadow *)shadow { - [self as_setShadow:shadow range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_strikethroughStyle:(NSUnderlineStyle)strikethroughStyle { - [self as_setStrikethroughStyle:strikethroughStyle range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_strikethroughColor:(UIColor *)strikethroughColor { - [self as_setStrikethroughColor:strikethroughColor range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_underlineStyle:(NSUnderlineStyle)underlineStyle { - [self as_setUnderlineStyle:underlineStyle range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_underlineColor:(UIColor *)underlineColor { - [self as_setUnderlineColor:underlineColor range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_ligature:(NSNumber *)ligature { - [self as_setLigature:ligature range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textEffect:(NSString *)textEffect { - [self as_setTextEffect:textEffect range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_obliqueness:(NSNumber *)obliqueness { - [self as_setObliqueness:obliqueness range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_expansion:(NSNumber *)expansion { - [self as_setExpansion:expansion range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_baselineOffset:(NSNumber *)baselineOffset { - [self as_setBaselineOffset:baselineOffset range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_verticalGlyphForm:(BOOL)verticalGlyphForm { - [self as_setVerticalGlyphForm:verticalGlyphForm range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_language:(NSString *)language { - [self as_setLanguage:language range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_writingDirection:(NSArray *)writingDirection { - [self as_setWritingDirection:writingDirection range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_paragraphStyle:(NSParagraphStyle *)paragraphStyle { - /* - NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef. - - CoreText can use both NSParagraphStyle and CTParagraphStyleRef, - but UILabel/UITextView can only use NSParagraphStyle. - - We use NSParagraphStyle in both CoreText and UIKit. - */ - [self as_setParagraphStyle:paragraphStyle range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_alignment:(NSTextAlignment)alignment { - [self as_setAlignment:alignment range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_baseWritingDirection:(NSWritingDirection)baseWritingDirection { - [self as_setBaseWritingDirection:baseWritingDirection range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_lineSpacing:(CGFloat)lineSpacing { - [self as_setLineSpacing:lineSpacing range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_paragraphSpacing:(CGFloat)paragraphSpacing { - [self as_setParagraphSpacing:paragraphSpacing range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_paragraphSpacingBefore:(CGFloat)paragraphSpacingBefore { - [self as_setParagraphSpacing:paragraphSpacingBefore range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_firstLineHeadIndent:(CGFloat)firstLineHeadIndent { - [self as_setFirstLineHeadIndent:firstLineHeadIndent range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_headIndent:(CGFloat)headIndent { - [self as_setHeadIndent:headIndent range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_tailIndent:(CGFloat)tailIndent { - [self as_setTailIndent:tailIndent range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_lineBreakMode:(NSLineBreakMode)lineBreakMode { - [self as_setLineBreakMode:lineBreakMode range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_minimumLineHeight:(CGFloat)minimumLineHeight { - [self as_setMinimumLineHeight:minimumLineHeight range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_maximumLineHeight:(CGFloat)maximumLineHeight { - [self as_setMaximumLineHeight:maximumLineHeight range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_lineHeightMultiple:(CGFloat)lineHeightMultiple { - [self as_setLineHeightMultiple:lineHeightMultiple range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_hyphenationFactor:(float)hyphenationFactor { - [self as_setHyphenationFactor:hyphenationFactor range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_defaultTabInterval:(CGFloat)defaultTabInterval { - [self as_setDefaultTabInterval:defaultTabInterval range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_tabStops:(NSArray *)tabStops { - [self as_setTabStops:tabStops range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textShadow:(ASTextShadow *)textShadow { - [self as_setTextShadow:textShadow range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textInnerShadow:(ASTextShadow *)textInnerShadow { - [self as_setTextInnerShadow:textInnerShadow range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textUnderline:(ASTextDecoration *)textUnderline { - [self as_setTextUnderline:textUnderline range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textStrikethrough:(ASTextDecoration *)textStrikethrough { - [self as_setTextStrikethrough:textStrikethrough range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textBorder:(ASTextBorder *)textBorder { - [self as_setTextBorder:textBorder range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textBackgroundBorder:(ASTextBorder *)textBackgroundBorder { - [self as_setTextBackgroundBorder:textBackgroundBorder range:NSMakeRange(0, self.length)]; -} - -- (void)setAs_textGlyphTransform:(CGAffineTransform)textGlyphTransform { - [self as_setTextGlyphTransform:textGlyphTransform range:NSMakeRange(0, self.length)]; -} - -#pragma mark - Range Setter - -- (void)as_setFont:(UIFont *)font range:(NSRange)range { - [self as_setAttribute:NSFontAttributeName value:font range:range]; -} - -- (void)as_setKern:(NSNumber *)kern range:(NSRange)range { - [self as_setAttribute:NSKernAttributeName value:kern range:range]; -} - -- (void)as_setColor:(UIColor *)color range:(NSRange)range { - [self as_setAttribute:(id)kCTForegroundColorAttributeName value:(id)color.CGColor range:range]; - [self as_setAttribute:NSForegroundColorAttributeName value:color range:range]; -} - -- (void)as_setBackgroundColor:(UIColor *)backgroundColor range:(NSRange)range { - [self as_setAttribute:NSBackgroundColorAttributeName value:backgroundColor range:range]; -} - -- (void)as_setStrokeWidth:(NSNumber *)strokeWidth range:(NSRange)range { - [self as_setAttribute:NSStrokeWidthAttributeName value:strokeWidth range:range]; -} - -- (void)as_setStrokeColor:(UIColor *)strokeColor range:(NSRange)range { - [self as_setAttribute:(id)kCTStrokeColorAttributeName value:(id)strokeColor.CGColor range:range]; - [self as_setAttribute:NSStrokeColorAttributeName value:strokeColor range:range]; -} - -- (void)as_setShadow:(NSShadow *)shadow range:(NSRange)range { - [self as_setAttribute:NSShadowAttributeName value:shadow range:range]; -} - -- (void)as_setStrikethroughStyle:(NSUnderlineStyle)strikethroughStyle range:(NSRange)range { - NSNumber *style = strikethroughStyle == 0 ? nil : @(strikethroughStyle); - [self as_setAttribute:NSStrikethroughStyleAttributeName value:style range:range]; -} - -- (void)as_setStrikethroughColor:(UIColor *)strikethroughColor range:(NSRange)range { - [self as_setAttribute:NSStrikethroughColorAttributeName value:strikethroughColor range:range]; -} - -- (void)as_setUnderlineStyle:(NSUnderlineStyle)underlineStyle range:(NSRange)range { - NSNumber *style = underlineStyle == 0 ? nil : @(underlineStyle); - [self as_setAttribute:NSUnderlineStyleAttributeName value:style range:range]; -} - -- (void)as_setUnderlineColor:(UIColor *)underlineColor range:(NSRange)range { - [self as_setAttribute:(id)kCTUnderlineColorAttributeName value:(id)underlineColor.CGColor range:range]; - [self as_setAttribute:NSUnderlineColorAttributeName value:underlineColor range:range]; -} - -- (void)as_setLigature:(NSNumber *)ligature range:(NSRange)range { - [self as_setAttribute:NSLigatureAttributeName value:ligature range:range]; -} - -- (void)as_setTextEffect:(NSString *)textEffect range:(NSRange)range { - [self as_setAttribute:NSTextEffectAttributeName value:textEffect range:range]; -} - -- (void)as_setObliqueness:(NSNumber *)obliqueness range:(NSRange)range { - [self as_setAttribute:NSObliquenessAttributeName value:obliqueness range:range]; -} - -- (void)as_setExpansion:(NSNumber *)expansion range:(NSRange)range { - [self as_setAttribute:NSExpansionAttributeName value:expansion range:range]; -} - -- (void)as_setBaselineOffset:(NSNumber *)baselineOffset range:(NSRange)range { - [self as_setAttribute:NSBaselineOffsetAttributeName value:baselineOffset range:range]; -} - -- (void)as_setVerticalGlyphForm:(BOOL)verticalGlyphForm range:(NSRange)range { - NSNumber *v = verticalGlyphForm ? @(YES) : nil; - [self as_setAttribute:NSVerticalGlyphFormAttributeName value:v range:range]; -} - -- (void)as_setLanguage:(NSString *)language range:(NSRange)range { - [self as_setAttribute:(id)kCTLanguageAttributeName value:language range:range]; -} - -- (void)as_setWritingDirection:(NSArray *)writingDirection range:(NSRange)range { - [self as_setAttribute:(id)kCTWritingDirectionAttributeName value:writingDirection range:range]; -} - -- (void)as_setParagraphStyle:(NSParagraphStyle *)paragraphStyle range:(NSRange)range { - /* - NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef. - - CoreText can use both NSParagraphStyle and CTParagraphStyleRef, - but UILabel/UITextView can only use NSParagraphStyle. - - We use NSParagraphStyle in both CoreText and UIKit. - */ - [self as_setAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; -} - -#define ParagraphStyleSet(_attr_) \ -[self enumerateAttribute:NSParagraphStyleAttributeName \ -inRange:range \ -options:kNilOptions \ -usingBlock: ^(NSParagraphStyle *value, NSRange subRange, BOOL *stop) { \ -NSMutableParagraphStyle *style = nil; \ -if (value) { \ -if (CFGetTypeID((__bridge CFTypeRef)(value)) == CTParagraphStyleGetTypeID()) { \ -value = [NSParagraphStyle as_styleWithCTStyle:(__bridge CTParagraphStyleRef)(value)]; \ -} \ -if (value. _attr_ == _attr_) return; \ -if ([value isKindOfClass:[NSMutableParagraphStyle class]]) { \ -style = (id)value; \ -} else { \ -style = value.mutableCopy; \ -} \ -} else { \ -if ([NSParagraphStyle defaultParagraphStyle]. _attr_ == _attr_) return; \ -style = [NSParagraphStyle defaultParagraphStyle].mutableCopy; \ -} \ -style. _attr_ = _attr_; \ -[self as_setParagraphStyle:style range:subRange]; \ -}]; - -- (void)as_setAlignment:(NSTextAlignment)alignment range:(NSRange)range { - ParagraphStyleSet(alignment); -} - -- (void)as_setBaseWritingDirection:(NSWritingDirection)baseWritingDirection range:(NSRange)range { - ParagraphStyleSet(baseWritingDirection); -} - -- (void)as_setLineSpacing:(CGFloat)lineSpacing range:(NSRange)range { - ParagraphStyleSet(lineSpacing); -} - -- (void)as_setParagraphSpacing:(CGFloat)paragraphSpacing range:(NSRange)range { - ParagraphStyleSet(paragraphSpacing); -} - -- (void)as_setParagraphSpacingBefore:(CGFloat)paragraphSpacingBefore range:(NSRange)range { - ParagraphStyleSet(paragraphSpacingBefore); -} - -- (void)as_setFirstLineHeadIndent:(CGFloat)firstLineHeadIndent range:(NSRange)range { - ParagraphStyleSet(firstLineHeadIndent); -} - -- (void)as_setHeadIndent:(CGFloat)headIndent range:(NSRange)range { - ParagraphStyleSet(headIndent); -} - -- (void)as_setTailIndent:(CGFloat)tailIndent range:(NSRange)range { - ParagraphStyleSet(tailIndent); -} - -- (void)as_setLineBreakMode:(NSLineBreakMode)lineBreakMode range:(NSRange)range { - ParagraphStyleSet(lineBreakMode); -} - -- (void)as_setMinimumLineHeight:(CGFloat)minimumLineHeight range:(NSRange)range { - ParagraphStyleSet(minimumLineHeight); -} - -- (void)as_setMaximumLineHeight:(CGFloat)maximumLineHeight range:(NSRange)range { - ParagraphStyleSet(maximumLineHeight); -} - -- (void)as_setLineHeightMultiple:(CGFloat)lineHeightMultiple range:(NSRange)range { - ParagraphStyleSet(lineHeightMultiple); -} - -- (void)as_setHyphenationFactor:(float)hyphenationFactor range:(NSRange)range { - ParagraphStyleSet(hyphenationFactor); -} - -- (void)as_setDefaultTabInterval:(CGFloat)defaultTabInterval range:(NSRange)range { - ParagraphStyleSet(defaultTabInterval); -} - -- (void)as_setTabStops:(NSArray *)tabStops range:(NSRange)range { - ParagraphStyleSet(tabStops); -} - -#undef ParagraphStyleSet - -- (void)as_setSuperscript:(NSNumber *)superscript range:(NSRange)range { - if ([superscript isEqualToNumber:@(0)]) { - superscript = nil; - } - [self as_setAttribute:(id)kCTSuperscriptAttributeName value:superscript range:range]; -} - -- (void)as_setGlyphInfo:(CTGlyphInfoRef)glyphInfo range:(NSRange)range { - [self as_setAttribute:(id)kCTGlyphInfoAttributeName value:(__bridge id)glyphInfo range:range]; -} - -- (void)as_setCharacterShape:(NSNumber *)characterShape range:(NSRange)range { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self as_setAttribute:(id)kCTCharacterShapeAttributeName value:characterShape range:range]; -#pragma clang diagnostic pop -} - -- (void)as_setRunDelegate:(CTRunDelegateRef)runDelegate range:(NSRange)range { - [self as_setAttribute:(id)kCTRunDelegateAttributeName value:(__bridge id)runDelegate range:range]; -} - -- (void)as_setBaselineClass:(CFStringRef)baselineClass range:(NSRange)range { - [self as_setAttribute:(id)kCTBaselineClassAttributeName value:(__bridge id)baselineClass range:range]; -} - -- (void)as_setBaselineInfo:(CFDictionaryRef)baselineInfo range:(NSRange)range { - [self as_setAttribute:(id)kCTBaselineInfoAttributeName value:(__bridge id)baselineInfo range:range]; -} - -- (void)as_setBaselineReferenceInfo:(CFDictionaryRef)referenceInfo range:(NSRange)range { - [self as_setAttribute:(id)kCTBaselineReferenceInfoAttributeName value:(__bridge id)referenceInfo range:range]; -} - -- (void)as_setRubyAnnotation:(CTRubyAnnotationRef)ruby range:(NSRange)range { - [self as_setAttribute:(id)kCTRubyAnnotationAttributeName value:(__bridge id)ruby range:range]; -} - -- (void)as_setAttachment:(NSTextAttachment *)attachment range:(NSRange)range { - [self as_setAttribute:NSAttachmentAttributeName value:attachment range:range]; -} - -- (void)as_setLink:(id)link range:(NSRange)range { - [self as_setAttribute:NSLinkAttributeName value:link range:range]; -} - -- (void)as_setTextBackedString:(ASTextBackedString *)textBackedString range:(NSRange)range { - [self as_setAttribute:ASTextBackedStringAttributeName value:textBackedString range:range]; -} - -- (void)as_setTextBinding:(ASTextBinding *)textBinding range:(NSRange)range { - [self as_setAttribute:ASTextBindingAttributeName value:textBinding range:range]; -} - -- (void)as_setTextShadow:(ASTextShadow *)textShadow range:(NSRange)range { - [self as_setAttribute:ASTextShadowAttributeName value:textShadow range:range]; -} - -- (void)as_setTextInnerShadow:(ASTextShadow *)textInnerShadow range:(NSRange)range { - [self as_setAttribute:ASTextInnerShadowAttributeName value:textInnerShadow range:range]; -} - -- (void)as_setTextUnderline:(ASTextDecoration *)textUnderline range:(NSRange)range { - [self as_setAttribute:ASTextUnderlineAttributeName value:textUnderline range:range]; -} - -- (void)as_setTextStrikethrough:(ASTextDecoration *)textStrikethrough range:(NSRange)range { - [self as_setAttribute:ASTextStrikethroughAttributeName value:textStrikethrough range:range]; -} - -- (void)as_setTextBorder:(ASTextBorder *)textBorder range:(NSRange)range { - [self as_setAttribute:ASTextBorderAttributeName value:textBorder range:range]; -} - -- (void)as_setTextBackgroundBorder:(ASTextBorder *)textBackgroundBorder range:(NSRange)range { - [self as_setAttribute:ASTextBackgroundBorderAttributeName value:textBackgroundBorder range:range]; -} - -- (void)as_setTextAttachment:(ASTextAttachment *)textAttachment range:(NSRange)range { - [self as_setAttribute:ASTextAttachmentAttributeName value:textAttachment range:range]; -} - -- (void)as_setTextHighlight:(ASTextHighlight *)textHighlight range:(NSRange)range { - [self as_setAttribute:ASTextHighlightAttributeName value:textHighlight range:range]; -} - -- (void)as_setTextBlockBorder:(ASTextBorder *)textBlockBorder range:(NSRange)range { - [self as_setAttribute:ASTextBlockBorderAttributeName value:textBlockBorder range:range]; -} - -- (void)as_setTextGlyphTransform:(CGAffineTransform)textGlyphTransform range:(NSRange)range { - NSValue *value = CGAffineTransformIsIdentity(textGlyphTransform) ? nil : [NSValue valueWithCGAffineTransform:textGlyphTransform]; - [self as_setAttribute:ASTextGlyphTransformAttributeName value:value range:range]; -} - -- (void)as_setTextHighlightRange:(NSRange)range - color:(UIColor *)color - backgroundColor:(UIColor *)backgroundColor - userInfo:(NSDictionary *)userInfo - tapAction:(ASTextAction)tapAction - longPressAction:(ASTextAction)longPressAction { - ASTextHighlight *highlight = [ASTextHighlight highlightWithBackgroundColor:backgroundColor]; - highlight.userInfo = userInfo; - highlight.tapAction = tapAction; - highlight.longPressAction = longPressAction; - if (color) [self as_setColor:color range:range]; - [self as_setTextHighlight:highlight range:range]; -} - -- (void)as_setTextHighlightRange:(NSRange)range - color:(UIColor *)color - backgroundColor:(UIColor *)backgroundColor - tapAction:(ASTextAction)tapAction { - [self as_setTextHighlightRange:range - color:color - backgroundColor:backgroundColor - userInfo:nil - tapAction:tapAction - longPressAction:nil]; -} - -- (void)as_setTextHighlightRange:(NSRange)range - color:(UIColor *)color - backgroundColor:(UIColor *)backgroundColor - userInfo:(NSDictionary *)userInfo { - [self as_setTextHighlightRange:range - color:color - backgroundColor:backgroundColor - userInfo:userInfo - tapAction:nil - longPressAction:nil]; -} - -- (void)as_insertString:(NSString *)string atIndex:(NSUInteger)location { - [self replaceCharactersInRange:NSMakeRange(location, 0) withString:string]; - [self as_removeDiscontinuousAttributesInRange:NSMakeRange(location, string.length)]; -} - -- (void)as_appendString:(NSString *)string { - NSUInteger length = self.length; - [self replaceCharactersInRange:NSMakeRange(length, 0) withString:string]; - [self as_removeDiscontinuousAttributesInRange:NSMakeRange(length, string.length)]; -} - -- (void)as_removeDiscontinuousAttributesInRange:(NSRange)range { - NSArray *keys = [NSMutableAttributedString as_allDiscontinuousAttributeKeys]; - for (NSString *key in keys) { - [self removeAttribute:key range:range]; - } -} - -+ (NSArray *)as_allDiscontinuousAttributeKeys { - static NSArray *keys; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - keys = @[(id)kCTSuperscriptAttributeName, - (id)kCTRunDelegateAttributeName, - ASTextBackedStringAttributeName, - ASTextBindingAttributeName, - ASTextAttachmentAttributeName, - (id)kCTRubyAnnotationAttributeName, - NSAttachmentAttributeName]; - }); - return keys; -} - -@end diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.h b/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.h deleted file mode 100644 index a7c0aec5..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// NSParagraphStyle+ASText.h -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - Provides extensions for `NSParagraphStyle` to work with CoreText. - */ -@interface NSParagraphStyle (ASText) - -/** - Creates a new NSParagraphStyle object from the CoreText Style. - - @param CTStyle CoreText Paragraph Style. - - @return a new NSParagraphStyle - */ -+ (nullable NSParagraphStyle *)as_styleWithCTStyle:(CTParagraphStyleRef)CTStyle; - -/** - Creates and returns a CoreText Paragraph Style. (need call CFRelease() after used) - */ -- (nullable CTParagraphStyleRef)as_CTStyle CF_RETURNS_RETAINED; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.mm b/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.mm deleted file mode 100644 index bc19fd23..00000000 --- a/Example/Pods/Texture/Source/TextExperiment/Utility/NSParagraphStyle+ASText.mm +++ /dev/null @@ -1,219 +0,0 @@ -// -// NSParagraphStyle+ASText.mm -// Texture -// -// Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -// Dummy class for category -@interface NSParagraphStyle_ASText : NSObject @end -@implementation NSParagraphStyle_ASText @end - - -@implementation NSParagraphStyle (ASText) - -+ (NSParagraphStyle *)as_styleWithCTStyle:(CTParagraphStyleRef)CTStyle { - if (CTStyle == NULL) return nil; - - NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - -#if TARGET_OS_IOS -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CGFloat lineSpacing; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineSpacing, sizeof(CGFloat), &lineSpacing)) { - style.lineSpacing = lineSpacing; - } -#pragma clang diagnostic pop -#endif - - CGFloat paragraphSpacing; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacing, sizeof(CGFloat), ¶graphSpacing)) { - style.paragraphSpacing = paragraphSpacing; - } - - CTTextAlignment alignment; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment)) { - style.alignment = NSTextAlignmentFromCTTextAlignment(alignment); - } - - CGFloat firstLineHeadIndent; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierFirstLineHeadIndent, sizeof(CGFloat), &firstLineHeadIndent)) { - style.firstLineHeadIndent = firstLineHeadIndent; - } - - CGFloat headIndent; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierHeadIndent, sizeof(CGFloat), &headIndent)) { - style.headIndent = headIndent; - } - - CGFloat tailIndent; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierTailIndent, sizeof(CGFloat), &tailIndent)) { - style.tailIndent = tailIndent; - } - - CTLineBreakMode lineBreakMode; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineBreakMode, sizeof(CTLineBreakMode), &lineBreakMode)) { - style.lineBreakMode = (NSLineBreakMode)lineBreakMode; - } - - CGFloat minimumLineHeight; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierMinimumLineHeight, sizeof(CGFloat), &minimumLineHeight)) { - style.minimumLineHeight = minimumLineHeight; - } - - CGFloat maximumLineHeight; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierMaximumLineHeight, sizeof(CGFloat), &maximumLineHeight)) { - style.maximumLineHeight = maximumLineHeight; - } - - CTWritingDirection baseWritingDirection; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierBaseWritingDirection, sizeof(CTWritingDirection), &baseWritingDirection)) { - style.baseWritingDirection = (NSWritingDirection)baseWritingDirection; - } - - CGFloat lineHeightMultiple; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineHeightMultiple, sizeof(CGFloat), &lineHeightMultiple)) { - style.lineHeightMultiple = lineHeightMultiple; - } - - CGFloat paragraphSpacingBefore; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacingBefore, sizeof(CGFloat), ¶graphSpacingBefore)) { - style.paragraphSpacingBefore = paragraphSpacingBefore; - } - - CFArrayRef tabStops; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierTabStops, sizeof(CFArrayRef), &tabStops)) { - NSMutableArray *tabs = [NSMutableArray new]; - [((__bridge NSArray *)(tabStops))enumerateObjectsUsingBlock : ^(id obj, NSUInteger idx, BOOL *stop) { - CTTextTabRef ctTab = (__bridge CTTextTabRef)obj; - - NSTextTab *tab = [[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentFromCTTextAlignment(CTTextTabGetAlignment(ctTab)) location:CTTextTabGetLocation(ctTab) options:(__bridge id)CTTextTabGetOptions(ctTab)]; - [tabs addObject:tab]; - }]; - if (tabs.count) { - style.tabStops = tabs; - } - } - - CGFloat defaultTabInterval; - if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierDefaultTabInterval, sizeof(CGFloat), &defaultTabInterval)) { - style.defaultTabInterval = defaultTabInterval; - } - - return style; -} - -- (CTParagraphStyleRef)as_CTStyle CF_RETURNS_RETAINED { - CTParagraphStyleSetting set[kCTParagraphStyleSpecifierCount] = { }; - int count = 0; - -#if TARGET_OS_IOS -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - CGFloat lineSpacing = self.lineSpacing; - set[count].spec = kCTParagraphStyleSpecifierLineSpacing; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &lineSpacing; - count++; -#pragma clang diagnostic pop -#endif - - CGFloat paragraphSpacing = self.paragraphSpacing; - set[count].spec = kCTParagraphStyleSpecifierParagraphSpacing; - set[count].valueSize = sizeof(CGFloat); - set[count].value = ¶graphSpacing; - count++; - - CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment(self.alignment); - set[count].spec = kCTParagraphStyleSpecifierAlignment; - set[count].valueSize = sizeof(CTTextAlignment); - set[count].value = &alignment; - count++; - - CGFloat firstLineHeadIndent = self.firstLineHeadIndent; - set[count].spec = kCTParagraphStyleSpecifierFirstLineHeadIndent; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &firstLineHeadIndent; - count++; - - CGFloat headIndent = self.headIndent; - set[count].spec = kCTParagraphStyleSpecifierHeadIndent; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &headIndent; - count++; - - CGFloat tailIndent = self.tailIndent; - set[count].spec = kCTParagraphStyleSpecifierTailIndent; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &tailIndent; - count++; - - CTLineBreakMode paraLineBreak = (CTLineBreakMode)self.lineBreakMode; - set[count].spec = kCTParagraphStyleSpecifierLineBreakMode; - set[count].valueSize = sizeof(CTLineBreakMode); - set[count].value = ¶LineBreak; - count++; - - CGFloat minimumLineHeight = self.minimumLineHeight; - set[count].spec = kCTParagraphStyleSpecifierMinimumLineHeight; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &minimumLineHeight; - count++; - - CGFloat maximumLineHeight = self.maximumLineHeight; - set[count].spec = kCTParagraphStyleSpecifierMaximumLineHeight; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &maximumLineHeight; - count++; - - CTWritingDirection paraWritingDirection = (CTWritingDirection)self.baseWritingDirection; - set[count].spec = kCTParagraphStyleSpecifierBaseWritingDirection; - set[count].valueSize = sizeof(CTWritingDirection); - set[count].value = ¶WritingDirection; - count++; - - CGFloat lineHeightMultiple = self.lineHeightMultiple; - set[count].spec = kCTParagraphStyleSpecifierLineHeightMultiple; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &lineHeightMultiple; - count++; - - CGFloat paragraphSpacingBefore = self.paragraphSpacingBefore; - set[count].spec = kCTParagraphStyleSpecifierParagraphSpacingBefore; - set[count].valueSize = sizeof(CGFloat); - set[count].value = ¶graphSpacingBefore; - count++; - - NSMutableArray *tabs = [NSMutableArray array]; - NSInteger numTabs = self.tabStops.count; - if (numTabs) { - [self.tabStops enumerateObjectsUsingBlock: ^(NSTextTab *tab, NSUInteger idx, BOOL *stop) { - CTTextTabRef ctTab = CTTextTabCreate(NSTextAlignmentToCTTextAlignment(tab.alignment), tab.location, (__bridge CFDictionaryRef)tab.options); - [tabs addObject:(__bridge id)ctTab]; - CFRelease(ctTab); - }]; - - CFArrayRef tabStops = (__bridge CFArrayRef)(tabs); - set[count].spec = kCTParagraphStyleSpecifierTabStops; - set[count].valueSize = sizeof(CFArrayRef); - set[count].value = &tabStops; - count++; - } - - CGFloat defaultTabInterval = self.defaultTabInterval; - set[count].spec = kCTParagraphStyleSpecifierDefaultTabInterval; - set[count].valueSize = sizeof(CGFloat); - set[count].value = &defaultTabInterval; - count++; - - CTParagraphStyleRef style = CTParagraphStyleCreate(set, count); - return style; -} - -@end diff --git a/Example/Pods/Texture/Source/TextKit/ASLayoutManager.h b/Example/Pods/Texture/Source/TextKit/ASLayoutManager.h deleted file mode 100644 index 1396bf20..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASLayoutManager.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ASLayoutManager.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -AS_SUBCLASSING_RESTRICTED -@interface ASLayoutManager : NSLayoutManager - -@end diff --git a/Example/Pods/Texture/Source/TextKit/ASLayoutManager.mm b/Example/Pods/Texture/Source/TextKit/ASLayoutManager.mm deleted file mode 100644 index fbb3b49e..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASLayoutManager.mm +++ /dev/null @@ -1,42 +0,0 @@ -// -// ASLayoutManager.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -@implementation ASLayoutManager - -- (void)showCGGlyphs:(const CGGlyph *)glyphs - positions:(const CGPoint *)positions - count:(NSUInteger)glyphCount - font:(UIFont *)font - matrix:(CGAffineTransform)textMatrix - attributes:(NSDictionary *)attributes - inContext:(CGContextRef)graphicsContext -{ - - // NSLayoutManager has a hard coded internal color for hyperlinks which ignores - // NSForegroundColorAttributeName. To get around this, we force the fill color - // in the current context to match NSForegroundColorAttributeName. - UIColor *foregroundColor = attributes[NSForegroundColorAttributeName]; - - if (foregroundColor) - { - CGContextSetFillColorWithColor(graphicsContext, foregroundColor.CGColor); - } - - [super showCGGlyphs:glyphs - positions:positions - count:glyphCount - font:font - matrix:textMatrix - attributes:attributes - inContext:graphicsContext]; -} - -@end diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.h b/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.h deleted file mode 100644 index cf09ad66..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.h +++ /dev/null @@ -1,134 +0,0 @@ -// -// ASTextKitAttributes.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -ASDK_EXTERN NSString *const ASTextKitTruncationAttributeName; -/** - Use ASTextKitEntityAttribute as the value of this attribute to embed a link or other interactable content inside the - text. - */ -ASDK_EXTERN NSString *const ASTextKitEntityAttributeName; - -/** - All NSObject values in this struct should be copied when passed into the TextComponent. - */ -struct ASTextKitAttributes { - /** - The string to be drawn. ASTextKit will not augment this string with default colors, etc. so this must be complete. - */ - NSAttributedString *attributedString; - /** - The string to use as the truncation string, usually just "...". If you have a range of text you would like to - restrict highlighting to (for instance if you have "... Continue Reading", use the ASTextKitTruncationAttributeName - to mark the specific range of the string that should be highlightable. - */ - NSAttributedString *truncationAttributedString; - /** - This is the character set that ASTextKit should attempt to avoid leaving as a trailing character before your - truncation token. By default this set includes "\s\t\n\r.,!?:;" so you don't end up with ugly looking truncation - text like "Hey, this is some fancy Truncation!\n\n...". Instead it would be truncated as "Hey, this is some fancy - truncation...". This is not always possible. - - Set this to the empty charset if you want to just use the "dumb" truncation behavior. A nil value will be - substituted with the default described above. - */ - NSCharacterSet *avoidTailTruncationSet; - /** - The line-break mode to apply to the text. Since this also impacts how TextKit will attempt to truncate the text - in your string, we only support NSLineBreakByWordWrapping and NSLineBreakByCharWrapping. - */ - NSLineBreakMode lineBreakMode; - /** - The maximum number of lines to draw in the drawable region. Leave blank or set to 0 to define no maximum. - This is required to apply scale factors to shrink text to fit within a number of lines - */ - NSUInteger maximumNumberOfLines; - /** - An array of UIBezierPath objects representing the exclusion paths inside the receiver's bounding rectangle. Default value: nil. - */ - NSArray *exclusionPaths; - /** - The shadow offset for any shadows applied to the text. The coordinate space for this is the same as UIKit, so a - positive width means towards the right, and a positive height means towards the bottom. - */ - CGSize shadowOffset; - /** - The color to use in drawing the text's shadow. - */ - UIColor *shadowColor; - /** - The opacity of the shadow from 0 to 1. - */ - CGFloat shadowOpacity; - /** - The radius that should be applied to the shadow blur. Larger values mean a larger, more blurred shadow. - */ - CGFloat shadowRadius; - /** - An array of scale factors in descending order to apply to the text to try to make it fit into a constrained size. - */ - NSArray *pointSizeScaleFactors; - - /** - The tint color to use in drawing the text foreground color. Only applied if the attributedString does not define foreground color - */ - UIColor *tintColor; - /** - We provide an explicit copy function so we can use aggregate initializer syntax while providing copy semantics for - the NSObjects inside. - */ - const ASTextKitAttributes copy() const - { - return { - [attributedString copy], - [truncationAttributedString copy], - [avoidTailTruncationSet copy], - lineBreakMode, - maximumNumberOfLines, - [exclusionPaths copy], - shadowOffset, - [shadowColor copy], - shadowOpacity, - shadowRadius, - pointSizeScaleFactors, - [tintColor copy] - }; - }; - - bool operator==(const ASTextKitAttributes &other) const - { - // These comparisons are in a specific order to reduce the overall cost of this function. - return lineBreakMode == other.lineBreakMode - && maximumNumberOfLines == other.maximumNumberOfLines - && shadowOpacity == other.shadowOpacity - && shadowRadius == other.shadowRadius - && (pointSizeScaleFactors == other.pointSizeScaleFactors - || [pointSizeScaleFactors isEqualToArray:other.pointSizeScaleFactors]) - && CGSizeEqualToSize(shadowOffset, other.shadowOffset) - && ASObjectIsEqual(exclusionPaths, other.exclusionPaths) - && ASObjectIsEqual(avoidTailTruncationSet, other.avoidTailTruncationSet) - && ASObjectIsEqual(shadowColor, other.shadowColor) - && ASObjectIsEqual(attributedString, other.attributedString) - && ASObjectIsEqual(truncationAttributedString, other.truncationAttributedString) - && ASObjectIsEqual(tintColor, other.tintColor); - } - - size_t hash() const; -}; - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.mm deleted file mode 100644 index 400ef437..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitAttributes.mm +++ /dev/null @@ -1,50 +0,0 @@ -// -// ASTextKitAttributes.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -NSString *const ASTextKitTruncationAttributeName = @"ck_truncation"; -NSString *const ASTextKitEntityAttributeName = @"ck_entity"; - -size_t ASTextKitAttributes::hash() const -{ -#pragma clang diagnostic push -#pragma clang diagnostic warning "-Wpadded" - struct { - NSUInteger attrStringHash; - NSUInteger truncationStringHash; - NSUInteger avoidTrunactionSetHash; - NSLineBreakMode lineBreakMode; - NSUInteger maximumNumberOfLines; - NSUInteger exclusionPathsHash; - CGSize shadowOffset; - NSUInteger shadowColorHash; - CGFloat shadowOpacity; - CGFloat shadowRadius; -#pragma clang diagnostic pop - } data = { - [attributedString hash], - [truncationAttributedString hash], - [avoidTailTruncationSet hash], - lineBreakMode, - maximumNumberOfLines, - [exclusionPaths hash], - shadowOffset, - [shadowColor hash], - shadowOpacity, - shadowRadius, - }; - return ASHashBytes(&data, sizeof(data)); -} - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.h b/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.h deleted file mode 100644 index df89db20..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// ASTextKitComponents.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ASTextKitComponentsTextView : UITextView -- (instancetype)initWithFrame:(CGRect)frame textContainer:(nullable NSTextContainer *)textContainer NS_DESIGNATED_INITIALIZER; -- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder __unavailable; -- (instancetype)init __unavailable; -@end - -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitComponents : NSObject - -/** - @abstract Creates the stack of TextKit components. - @param attributedSeedString The attributed string to seed the returned text storage with, or nil to receive an blank text storage. - @param textContainerSize The size of the text-container. Typically, size specifies the constraining width of the layout, and CGFLOAT_MAX for height. Pass CGSizeZero if these components will be hooked up to a UITextView, which will manage the text container's size itself. - @return An `ASTextKitComponents` containing the created components. The text view component will be nil. - @discussion The returned components will be hooked up together, so they are ready for use as a system upon return. - */ -+ (instancetype)componentsWithAttributedSeedString:(nullable NSAttributedString *)attributedSeedString - textContainerSize:(CGSize)textContainerSize NS_RETURNS_RETAINED; - -/** - @abstract Creates the stack of TextKit components. - @param textStorage The NSTextStorage to use. - @param textContainerSize The size of the text-container. Typically, size specifies the constraining width of the layout, and CGFLOAT_MAX for height. Pass CGSizeZero if these components will be hooked up to a UITextView, which will manage the text container's size itself. - @param layoutManager The NSLayoutManager to use. - @return An `ASTextKitComponents` containing the created components. The text view component will be nil. - @discussion The returned components will be hooked up together, so they are ready for use as a system upon return. - */ -+ (instancetype)componentsWithTextStorage:(NSTextStorage *)textStorage - textContainerSize:(CGSize)textContainerSize - layoutManager:(NSLayoutManager *)layoutManager NS_RETURNS_RETAINED; - -/** - @abstract Returns the bounding size for the text view's text. - @param constrainedWidth The constraining width to be used during text-sizing. Usually, this value should be the receiver's calculated size. - @result A CGSize representing the bounding size for the receiver's text. - */ -- (CGSize)sizeForConstrainedWidth:(CGFloat)constrainedWidth; - -- (CGSize)sizeForConstrainedWidth:(CGFloat)constrainedWidth - forMaxNumberOfLines:(NSInteger)numberOfLines; - -@property (nonatomic, readonly) NSTextStorage *textStorage; -@property (nonatomic, readonly) NSTextContainer *textContainer; -@property (nonatomic, readonly) NSLayoutManager *layoutManager; -@property (nonatomic, nullable) ASTextKitComponentsTextView *textView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.mm deleted file mode 100644 index 95ae1db8..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitComponents.mm +++ /dev/null @@ -1,193 +0,0 @@ -// -// ASTextKitComponents.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -@interface ASTextKitComponentsTextView () { - // Prevent UITextView from updating contentOffset while deallocating: https://github.com/TextureGroup/Texture/issues/860 - BOOL _deallocating; -} -@property CGRect threadSafeBounds; -@end - -@implementation ASTextKitComponentsTextView - -- (instancetype)initWithFrame:(CGRect)frame textContainer:(NSTextContainer *)textContainer -{ - self = [super initWithFrame:frame textContainer:textContainer]; - if (self) { - _threadSafeBounds = self.bounds; - _deallocating = NO; - } - return self; -} - -- (void)dealloc -{ - _deallocating = YES; -} - -- (void)setFrame:(CGRect)frame -{ - ASDisplayNodeAssertMainThread(); - [super setFrame:frame]; - self.threadSafeBounds = self.bounds; -} - -- (void)setBounds:(CGRect)bounds -{ - ASDisplayNodeAssertMainThread(); - [super setBounds:bounds]; - self.threadSafeBounds = bounds; -} - -- (void)setContentOffset:(CGPoint)contentOffset -{ - if (_deallocating) { - return; - } - - [super setContentOffset:contentOffset]; -} - - -@end - -@interface ASTextKitComponents () - -// read-write redeclarations -@property (nonatomic) NSTextStorage *textStorage; -@property (nonatomic) NSTextContainer *textContainer; -@property (nonatomic) NSLayoutManager *layoutManager; - -@end - -@implementation ASTextKitComponents - -#pragma mark - Class - -+ (instancetype)componentsWithAttributedSeedString:(NSAttributedString *)attributedSeedString - textContainerSize:(CGSize)textContainerSize NS_RETURNS_RETAINED -{ - NSTextStorage *textStorage = attributedSeedString ? [[NSTextStorage alloc] initWithAttributedString:attributedSeedString] : [[NSTextStorage alloc] init]; - - return [self componentsWithTextStorage:textStorage - textContainerSize:textContainerSize - layoutManager:[[NSLayoutManager alloc] init]]; -} - -+ (instancetype)componentsWithTextStorage:(NSTextStorage *)textStorage - textContainerSize:(CGSize)textContainerSize - layoutManager:(NSLayoutManager *)layoutManager NS_RETURNS_RETAINED -{ - ASTextKitComponents *components = [[self alloc] init]; - - components.textStorage = textStorage; - - components.layoutManager = layoutManager; - [components.textStorage addLayoutManager:components.layoutManager]; - - components.textContainer = [[NSTextContainer alloc] initWithSize:textContainerSize]; - components.textContainer.lineFragmentPadding = 0.0; // We want the text laid out up to the very edges of the text-view. - [components.layoutManager addTextContainer:components.textContainer]; - - return components; -} - -+ (BOOL)needsMainThreadDeallocation -{ - return YES; -} - -#pragma mark - Lifecycle - -- (void)dealloc -{ - // Nil out all delegates to prevent crash - if (_textView) { - ASDisplayNodeAssertMainThread(); - _textView.delegate = nil; - } - _layoutManager.delegate = nil; -} - -#pragma mark - Sizing - -- (CGSize)sizeForConstrainedWidth:(CGFloat)constrainedWidth -{ - ASTextKitComponents *components = self; - - // If our text-view's width is already the constrained width, we can use our existing TextKit stack for this sizing calculation. - // Otherwise, we create a temporary stack to size for `constrainedWidth`. - if (CGRectGetWidth(components.textView.threadSafeBounds) != constrainedWidth) { - components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth, CGFLOAT_MAX)]; - } - - // Force glyph generation and layout, which may not have happened yet (and isn't triggered by -usedRectForTextContainer:). - [components.layoutManager ensureLayoutForTextContainer:components.textContainer]; - CGSize textSize = [components.layoutManager usedRectForTextContainer:components.textContainer].size; - - return textSize; -} - -- (CGSize)sizeForConstrainedWidth:(CGFloat)constrainedWidth - forMaxNumberOfLines:(NSInteger)maxNumberOfLines -{ - if (maxNumberOfLines == 0) { - return [self sizeForConstrainedWidth:constrainedWidth]; - } - - ASTextKitComponents *components = self; - - // Always use temporary stack in case of threading issues - components = [ASTextKitComponents componentsWithAttributedSeedString:components.textStorage textContainerSize:CGSizeMake(constrainedWidth, CGFLOAT_MAX)]; - - // Force glyph generation and layout, which may not have happened yet (and isn't triggered by - usedRectForTextContainer:). - [components.layoutManager ensureLayoutForTextContainer:components.textContainer]; - - CGFloat width = [components.layoutManager usedRectForTextContainer:components.textContainer].size.width; - - // Calculate height based on line fragments - // Based on calculating number of lines from: http://asciiwwdc.com/2013/sessions/220 - NSRange glyphRange, lineRange = NSMakeRange(0, 0); - CGRect rect = CGRectZero; - CGFloat height = 0; - CGFloat lastOriginY = -1.0; - NSUInteger numberOfLines = 0; - - glyphRange = [components.layoutManager glyphRangeForTextContainer:components.textContainer]; - - while (lineRange.location < NSMaxRange(glyphRange)) { - rect = [components.layoutManager lineFragmentRectForGlyphAtIndex:lineRange.location - effectiveRange:&lineRange]; - - if (CGRectGetMinY(rect) > lastOriginY) { - ++numberOfLines; - if (numberOfLines == maxNumberOfLines) { - height = rect.origin.y + rect.size.height; - break; - } - } - - lastOriginY = CGRectGetMinY(rect); - lineRange.location = NSMaxRange(lineRange); - } - - CGFloat fragmentHeight = rect.origin.y + rect.size.height; - CGFloat finalHeight = std::ceil(std::fmax(height, fragmentHeight)); - - CGSize size = CGSizeMake(width, finalHeight); - - return size; -} - -@end diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitContext.h b/Example/Pods/Texture/Source/TextKit/ASTextKitContext.h deleted file mode 100644 index df9d0a0c..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitContext.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// ASTextKitContext.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -/** - A threadsafe container for the TextKit components that ASTextKit uses to lay out and truncate its text. - - This container is the sole owner and manager of the TextKit classes. This is an important model because of major - thread safety issues inside vanilla TextKit. It provides a central locking location for accessing TextKit methods. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitContext : NSObject - -/** - Initializes a context and its associated TextKit components. - - Initialization of TextKit components is a globally locking operation so be careful of bottlenecks with this class. - */ -- (instancetype)initWithAttributedString:(NSAttributedString *)attributedString - tintColor:(UIColor *)tintColor - lineBreakMode:(NSLineBreakMode)lineBreakMode - maximumNumberOfLines:(NSUInteger)maximumNumberOfLines - exclusionPaths:(NSArray *)exclusionPaths - constrainedSize:(CGSize)constrainedSize; - -/** - All operations on TextKit values MUST occur within this locked context. Simultaneous access (even non-mutative) to - TextKit components may cause crashes. - - The block provided MUST not call out to client code from within its scope or it is possible for this to cause deadlocks - in your application. Use with EXTREME care. - - Callers MUST NOT keep a ref to these internal objects and use them later. This WILL cause crashes in your application. - */ -- (void)performBlockWithLockedTextKitComponents:(AS_NOESCAPE void (^)(NSLayoutManager *layoutManager, - NSTextStorage *textStorage, - NSTextContainer *textContainer))block; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitContext.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitContext.mm deleted file mode 100644 index d0b6708f..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitContext.mm +++ /dev/null @@ -1,102 +0,0 @@ -// -// ASTextKitContext.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import -#import - -@implementation ASTextKitContext -{ - // All TextKit operations (even non-mutative ones) must be executed serially. - std::shared_ptr __instanceLock__; - - NSLayoutManager *_layoutManager; - NSTextStorage *_textStorage; - NSTextContainer *_textContainer; -} - -- (instancetype)initWithAttributedString:(NSAttributedString *)attributedString - tintColor:(UIColor *)tintColor - lineBreakMode:(NSLineBreakMode)lineBreakMode - maximumNumberOfLines:(NSUInteger)maximumNumberOfLines - exclusionPaths:(NSArray *)exclusionPaths - constrainedSize:(CGSize)constrainedSize - -{ - if (self = [super init]) { - static AS::Mutex *mutex = NULL; - static dispatch_once_t onceToken; - - BOOL useGlobalTextKitLock = !ASActivateExperimentalFeature(ASExperimentalDisableGlobalTextkitLock); - if (useGlobalTextKitLock) { - // Concurrently initialising TextKit components crashes (rdar://18448377) so we use a global lock. - dispatch_once(&onceToken, ^{ - mutex = new AS::Mutex(); - }); - if (mutex != NULL) { - mutex->lock(); - } - } - - __instanceLock__ = std::make_shared(); - - // Create the TextKit component stack with our default configuration. - _textStorage = [[NSTextStorage alloc] init]; - _layoutManager = [[ASLayoutManager alloc] init]; - _layoutManager.usesFontLeading = NO; - [_textStorage addLayoutManager:_layoutManager]; - - // Instead of calling [NSTextStorage initWithAttributedString:], setting attributedString just after calling addlayoutManager can fix CJK language layout issues. - // See https://github.com/facebook/AsyncDisplayKit/issues/2894 - if (attributedString && attributedString.length > 0) { - [_textStorage setAttributedString:attributedString]; - - // Apply tint color if specified and if foreground color is undefined for attributedString - NSRange limit = NSMakeRange(0, attributedString.length); - // Look for previous attributes that define foreground color - UIColor *attributeValue = (UIColor *)[attributedString attribute:NSForegroundColorAttributeName atIndex:limit.location effectiveRange:NULL]; - if (attributeValue == nil) { - // None are found, apply tint color if available. Fallback to "black" text color - if (tintColor) { - [_textStorage addAttributes:@{ NSForegroundColorAttributeName : tintColor } range:limit]; - } - } - } - - _textContainer = [[NSTextContainer alloc] initWithSize:constrainedSize]; - // We want the text laid out up to the very edges of the container. - _textContainer.lineFragmentPadding = 0; - _textContainer.lineBreakMode = lineBreakMode; - _textContainer.maximumNumberOfLines = maximumNumberOfLines; - _textContainer.exclusionPaths = exclusionPaths; - [_layoutManager addTextContainer:_textContainer]; - - if (useGlobalTextKitLock && mutex != NULL) { - mutex->unlock(); - } - } - return self; -} - -- (void)performBlockWithLockedTextKitComponents:(NS_NOESCAPE void (^)(NSLayoutManager *, - NSTextStorage *, - NSTextContainer *))block -{ - AS::MutexLocker l(*__instanceLock__); - if (block) { - block(_layoutManager, _textStorage, _textContainer); - } -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.h b/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.h deleted file mode 100644 index 0da484d0..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// ASTextKitCoreTextAdditions.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - @abstract Returns whether a given attribute is an unsupported Core Text attribute. - @param attributeName The name of the attribute - @discussion The following Core Text attributes are not supported on NSAttributedString, and thus will not be preserved during the conversion: - - kCTForegroundColorFromContextAttributeName - - kCTSuperscriptAttributeName - - kCTGlyphInfoAttributeName - - kCTCharacterShapeAttributeName - - kCTLanguageAttributeName - - kCTRunDelegateAttributeName - - kCTBaselineClassAttributeName - - kCTBaselineInfoAttributeName - - kCTBaselineReferenceInfoAttributeName - - kCTWritingDirectionAttributeName - - kCTUnderlineColorAttributeName - @result Whether attributeName is an unsupported Core Text attribute. - */ -ASDK_EXTERN BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); - - -/** - @abstract Returns an attributes dictionary for use by NSAttributedString, given a dictionary of Core Text attributes. - @param coreTextAttributes An NSDictionary whose keys are CFAttributedStringRef attributes. - @discussion The following Core Text attributes are not supported on NSAttributedString, and thus will not be preserved during the conversion: - - kCTForegroundColorFromContextAttributeName - - kCTSuperscriptAttributeName - - kCTGlyphInfoAttributeName - - kCTCharacterShapeAttributeName - - kCTLanguageAttributeName - - kCTRunDelegateAttributeName - - kCTBaselineClassAttributeName - - kCTBaselineInfoAttributeName - - kCTBaselineReferenceInfoAttributeName - - kCTWritingDirectionAttributeName - - kCTUnderlineColorAttributeName - @result An NSDictionary of attributes for use by NSAttributedString. - */ -ASDK_EXTERN NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); - -/** - @abstract Returns an NSAttributedString whose Core Text attributes have been converted, where possible, to NSAttributedString attributes. - @param dirtyAttributedString An NSAttributedString that may contain Core Text attributes. - @result An NSAttributedString that's preserved as many CFAttributedString attributes as possible. - */ -ASDK_EXTERN NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); - -#pragma mark - -#pragma mark - -@interface NSParagraphStyle (ASTextKitCoreTextAdditions) - -/** - @abstract Returns an NSParagraphStyle initialized with the paragraph specifiers from the given CTParagraphStyleRef. - @param coreTextParagraphStyle A Core Text paragraph style. - @discussion It is important to note that not all CTParagraphStyle specifiers are supported by NSParagraphStyle, and consequently, this is a lossy conversion. Notably, the following specifiers will not preserved: - - kCTParagraphStyleSpecifierTabStops - - kCTParagraphStyleSpecifierDefaultTabInterval - - kCTParagraphStyleSpecifierMaximumLineSpacing - - kCTParagraphStyleSpecifierMinimumLineSpacing - - kCTParagraphStyleSpecifierLineSpacingAdjustment - - kCTParagraphStyleSpecifierLineBoundsOptions - @result An NSParagraphStyle initialized with as many of the paragraph specifiers from `coreTextParagraphStyle` as possible. - - */ -+ (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.mm deleted file mode 100644 index a6c72d5d..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitCoreTextAdditions.mm +++ /dev/null @@ -1,330 +0,0 @@ -// -// ASTextKitCoreTextAdditions.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import -#import - -#pragma mark - Public -BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName) -{ - static NSSet *coreTextAttributes; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - coreTextAttributes = [NSSet setWithObjects:(__bridge id)kCTForegroundColorAttributeName, - kCTForegroundColorFromContextAttributeName, - kCTForegroundColorAttributeName, - kCTStrokeColorAttributeName, - kCTUnderlineStyleAttributeName, - kCTVerticalFormsAttributeName, - kCTRunDelegateAttributeName, - kCTBaselineClassAttributeName, - kCTBaselineInfoAttributeName, - kCTBaselineReferenceInfoAttributeName, - kCTUnderlineColorAttributeName, - kCTParagraphStyleAttributeName, - nil]; - }); - return [coreTextAttributes containsObject:attributeName]; -} - -NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes) -{ - NSMutableDictionary *cleanAttributes = [[NSMutableDictionary alloc] initWithCapacity:coreTextAttributes.count]; - - [coreTextAttributes enumerateKeysAndObjectsUsingBlock:^(NSString *coreTextKey, id coreTextValue, BOOL *stop) { - // The following attributes are not supported on NSAttributedString. Should they become available, we should add them. - /* - kCTForegroundColorFromContextAttributeName - kCTSuperscriptAttributeName - kCTGlyphInfoAttributeName - kCTCharacterShapeAttributeName - kCTLanguageAttributeName - kCTRunDelegateAttributeName - kCTBaselineClassAttributeName - kCTBaselineInfoAttributeName - kCTBaselineReferenceInfoAttributeName - kCTWritingDirectionAttributeName - kCTUnderlineColorAttributeName - */ - - // Conversely, the following attributes are not supported on CFAttributedString. Should they become available, we should add them. - /* - NSStrikethroughStyleAttributeName - NSShadowAttributeName - NSBackgroundColorAttributeName - */ - - // kCTFontAttributeName -> NSFontAttributeName - if ([coreTextKey isEqualToString:(NSString *)kCTFontAttributeName]) { - // Its reference type, CTFontRef, is toll-free bridged with UIFont in iOS and NSFont in OS X - CTFontRef coreTextFont = (__bridge CTFontRef)coreTextValue; - cleanAttributes[NSFontAttributeName] = (__bridge UIFont *)coreTextFont; - } - // kCTKernAttributeName -> NSKernAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTKernAttributeName]) { - cleanAttributes[NSKernAttributeName] = (NSNumber *)coreTextValue; - } - // kCTLigatureAttributeName -> NSLigatureAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTLigatureAttributeName]) { - cleanAttributes[NSLigatureAttributeName] = (NSNumber *)coreTextValue; - } - // kCTForegroundColorAttributeName -> NSForegroundColorAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTForegroundColorAttributeName]) { - cleanAttributes[NSForegroundColorAttributeName] = [UIColor colorWithCGColor:(CGColorRef)coreTextValue]; - } - // kCTParagraphStyleAttributeName -> NSParagraphStyleAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTParagraphStyleAttributeName]) { - if ([coreTextValue isKindOfClass:[NSParagraphStyle class]]) { - cleanAttributes[NSParagraphStyleAttributeName] = (NSParagraphStyle *)coreTextValue; - } - else { - cleanAttributes[NSParagraphStyleAttributeName] = [NSParagraphStyle paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextValue]; - } - } - // kCTStrokeWidthAttributeName -> NSStrokeWidthAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTStrokeWidthAttributeName]) { - cleanAttributes[NSStrokeWidthAttributeName] = (NSNumber *)coreTextValue; - } - // kCTStrokeColorAttributeName -> NSStrokeColorAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTStrokeColorAttributeName]) { - cleanAttributes[NSStrokeColorAttributeName] = [UIColor colorWithCGColor:(CGColorRef)coreTextValue]; - } - // kCTUnderlineStyleAttributeName -> NSUnderlineStyleAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTUnderlineStyleAttributeName]) { - cleanAttributes[NSUnderlineStyleAttributeName] = (NSNumber *)coreTextValue; - } - // kCTVerticalFormsAttributeName -> NSVerticalGlyphFormAttributeName - else if ([coreTextKey isEqualToString:(NSString *)kCTVerticalFormsAttributeName]) { - BOOL flag = (BOOL)CFBooleanGetValue((CFBooleanRef)coreTextValue); - cleanAttributes[NSVerticalGlyphFormAttributeName] = @((int)flag); // NSVerticalGlyphFormAttributeName is documented to be an NSNumber with an integer that's either 0 or 1. - } - // Don't filter out any internal text attributes - else if (!ASAttributeWithNameIsUnsupportedCoreTextAttribute(coreTextKey)){ - cleanAttributes[coreTextKey] = coreTextValue; - } - }]; - - return cleanAttributes; -} - -NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString) -{ - if (!dirtyAttributedString) - return nil; - - // First see if there are any core text attributes on the string - __block BOOL containsCoreTextAttributes = NO; - [dirtyAttributedString enumerateAttributesInRange:NSMakeRange(0, dirtyAttributedString.length) - options:0 - usingBlock:^(NSDictionary *dirtyAttributes, NSRange range, BOOL *stop) { - [dirtyAttributes enumerateKeysAndObjectsUsingBlock:^(NSString *coreTextKey, id coreTextValue, BOOL *innerStop) { - if (ASAttributeWithNameIsUnsupportedCoreTextAttribute(coreTextKey)) { - containsCoreTextAttributes = YES; - *innerStop = YES; - } - }]; - *stop = containsCoreTextAttributes; - }]; - if (containsCoreTextAttributes) { - - NSString *plainString = dirtyAttributedString.string; - NSMutableAttributedString *cleanAttributedString = [[NSMutableAttributedString alloc] initWithString:plainString]; - - // Iterate over all of the attributes, cleaning them as appropriate and applying them as we go. - [dirtyAttributedString enumerateAttributesInRange:NSMakeRange(0, plainString.length) - options:0 - usingBlock:^(NSDictionary *dirtyAttributes, NSRange range, BOOL *stop) { - [cleanAttributedString addAttributes:NSAttributedStringAttributesForCoreTextAttributes(dirtyAttributes) range:range]; - }]; - - return cleanAttributedString; - } else { - return [dirtyAttributedString copy]; - } -} - -#pragma mark - -#pragma mark - -@implementation NSParagraphStyle (ASTextKitCoreTextAdditions) - -+ (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED -{ - NSMutableParagraphStyle *newParagraphStyle = [[NSMutableParagraphStyle alloc] init]; - - if (!coreTextParagraphStyle) { - return newParagraphStyle; - } - - // The following paragraph style specifiers are not supported on NSParagraphStyle. Should they become available, we should add them. - /* - kCTParagraphStyleSpecifierTabStops - kCTParagraphStyleSpecifierDefaultTabInterval - kCTParagraphStyleSpecifierMaximumLineSpacing - kCTParagraphStyleSpecifierMinimumLineSpacing - kCTParagraphStyleSpecifierLineSpacingAdjustment - kCTParagraphStyleSpecifierLineBoundsOptions - */ - - // Conversely, the following paragraph styles are not supported on CTParagraphStyle. Should they become available, we should add them. - /* - hyphenationFactor - */ - - // kCTParagraphStyleSpecifierAlignment -> alignment - CTTextAlignment coreTextAlignment; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierAlignment, - sizeof(coreTextAlignment), - &coreTextAlignment)) { - newParagraphStyle.alignment = NSTextAlignmentFromCTTextAlignment(coreTextAlignment); - } - - // kCTParagraphStyleSpecifierFirstLineHeadIndent -> firstLineHeadIndent - CGFloat firstLineHeadIndent; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierFirstLineHeadIndent, - sizeof(firstLineHeadIndent), - &firstLineHeadIndent)) { - newParagraphStyle.firstLineHeadIndent = firstLineHeadIndent; - } - - // kCTParagraphStyleSpecifierHeadIndent -> headIndent - CGFloat headIndent; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierHeadIndent, - sizeof(headIndent), - &headIndent)) { - newParagraphStyle.headIndent = headIndent; - } - - // kCTParagraphStyleSpecifierTailIndent -> tailIndent - CGFloat tailIndent; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierTailIndent, - sizeof(tailIndent), - &tailIndent)) { - newParagraphStyle.tailIndent = tailIndent; - } - - // kCTParagraphStyleSpecifierLineBreakMode -> lineBreakMode - CTLineBreakMode coreTextLineBreakMode; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierLineBreakMode, - sizeof(coreTextLineBreakMode), - &coreTextLineBreakMode)) { - newParagraphStyle.lineBreakMode = (NSLineBreakMode)coreTextLineBreakMode; // They're the same enum. - } - - // kCTParagraphStyleSpecifierLineHeightMultiple -> lineHeightMultiple - CGFloat lineHeightMultiple; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierLineHeightMultiple, - sizeof(lineHeightMultiple), - &lineHeightMultiple)) { - newParagraphStyle.lineHeightMultiple = lineHeightMultiple; - } - - // kCTParagraphStyleSpecifierMaximumLineHeight -> maximumLineHeight - CGFloat maximumLineHeight; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierMaximumLineHeight, - sizeof(maximumLineHeight), - &maximumLineHeight)) { - newParagraphStyle.maximumLineHeight = maximumLineHeight; - } - - // kCTParagraphStyleSpecifierMinimumLineHeight -> minimumLineHeight - CGFloat minimumLineHeight; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierMinimumLineHeight, - sizeof(minimumLineHeight), - &minimumLineHeight)) { - newParagraphStyle.minimumLineHeight = minimumLineHeight; - } - - CGFloat lineSpacing = 0; -#if TARGET_OS_IOS -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - // kCTParagraphStyleSpecifierLineSpacing -> lineSpacing - // Note that kCTParagraphStyleSpecifierLineSpacing is deprecated and will die soon. We should not be using it. - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierLineSpacing, - sizeof(lineSpacing), - &lineSpacing)) { - newParagraphStyle.lineSpacing = lineSpacing; - } -#pragma clang diagnostic pop -#endif - - // Attempt to weakly map the following onto -[NSParagraphStyle lineSpacing]: - // - kCTParagraphStyleSpecifierMinimumLineSpacing - // - kCTParagraphStyleSpecifierMaximumLineSpacing - // - kCTParagraphStyleSpecifierLineSpacingAdjustment - if (fabs(lineSpacing) <= FLT_EPSILON && - CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierMinimumLineSpacing, - sizeof(lineSpacing), - &lineSpacing)) { - newParagraphStyle.lineSpacing = lineSpacing; - } - - if (fabs(lineSpacing) <= FLT_EPSILON && - CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierMaximumLineSpacing, - sizeof(lineSpacing), - &lineSpacing)) { - newParagraphStyle.lineSpacing = lineSpacing; - } - - if (fabs(lineSpacing) <= FLT_EPSILON && - CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierLineSpacingAdjustment, - sizeof(lineSpacing), - &lineSpacing)) { - newParagraphStyle.lineSpacing = lineSpacing; - } - - // kCTParagraphStyleSpecifierParagraphSpacing -> paragraphSpacing - CGFloat paragraphSpacing; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierParagraphSpacing, - sizeof(paragraphSpacing), - ¶graphSpacing)) { - newParagraphStyle.paragraphSpacing = paragraphSpacing; - } - - // kCTParagraphStyleSpecifierParagraphSpacingBefore -> paragraphSpacingBefore - CGFloat paragraphSpacingBefore; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierParagraphSpacingBefore, - sizeof(paragraphSpacingBefore), - ¶graphSpacingBefore)) { - newParagraphStyle.paragraphSpacingBefore = paragraphSpacingBefore; - } - - // kCTParagraphStyleSpecifierBaseWritingDirection -> baseWritingDirection - CTWritingDirection coreTextBaseWritingDirection; - if (CTParagraphStyleGetValueForSpecifier(coreTextParagraphStyle, - kCTParagraphStyleSpecifierBaseWritingDirection, - sizeof(coreTextBaseWritingDirection), - &coreTextBaseWritingDirection)) { - newParagraphStyle.baseWritingDirection = (NSWritingDirection)coreTextBaseWritingDirection; // They're the same enum. - } - - return newParagraphStyle; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.h b/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.h deleted file mode 100644 index 3655138b..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ASTextKitEntityAttribute.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -/** - The object that should be embedded with ASTextKitEntityAttributeName. Please note that the entity you provide MUST - implement a proper hash and isEqual function or your application performance will grind to a halt due to - NSMutableAttributedString's usage of a global hash table of all attributes. This means the entity should NOT be a - Foundation Collection (NSArray, NSDictionary, NSSet, etc.) since their hash function is a simple count of the values - in the collection, which causes pathological performance problems deep inside NSAttributedString's implementation. - - rdar://19352367 - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitEntityAttribute : NSObject - -@property (nonatomic, readonly) id entity; - -- (instancetype)initWithEntity:(id)entity; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.mm deleted file mode 100644 index fb87e9bd..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitEntityAttribute.mm +++ /dev/null @@ -1,43 +0,0 @@ -// -// ASTextKitEntityAttribute.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -@implementation ASTextKitEntityAttribute - -- (instancetype)initWithEntity:(id)entity -{ - if (self = [super init]) { - _entity = entity; - } - return self; -} - -- (NSUInteger)hash -{ - return [_entity hash]; -} - -- (BOOL)isEqual:(id)object -{ - if (self == object) { - return YES; - } - if (![object isKindOfClass:[self class]]) { - return NO; - } - ASTextKitEntityAttribute *other = (ASTextKitEntityAttribute *)object; - return _entity == other.entity || [_entity isEqual:other.entity]; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.h b/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.h deleted file mode 100644 index 1b7b10ff..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// ASTextKitFontSizeAdjuster.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASTextKitContext; - -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitFontSizeAdjuster : NSObject - -@property (nonatomic) CGSize constrainedSize; - -/** - * Creates a class that will return a scale factor the will make a string fit inside the constrained size. - * - * "Fitting" means that both the longest word in the string will fit without breaking in the constrained - * size's width AND that the entire string will try to fit within attribute's maximumLineCount. The amount - * that the string will scale is based upon the attribute's pointSizeScaleFactors. If the string cannot fit - * in the given width/number of lines, the smallest scale factor will be returned. - * - * @param context The text kit context - * @param constrainedSize The constrained size to render into - * @param textComponentAttributes The renderer's text attributes - */ -- (instancetype)initWithContext:(ASTextKitContext *)context - constrainedSize:(CGSize)constrainedSize - textKitAttributes:(const ASTextKitAttributes &)textComponentAttributes; - -/** - * Returns the best fit scale factor for the text - */ -- (CGFloat)scaleFactor; - -/** - * Takes all of the attributed string attributes dealing with size (font size, line spacing, kerning, etc) and - * scales them by the scaleFactor. I wouldn't be surprised if I missed some in here. - */ -+ (void)adjustFontSizeForAttributeString:(NSMutableAttributedString *)attrString withScaleFactor:(CGFloat)scaleFactor; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.mm deleted file mode 100644 index 86465a2f..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitFontSizeAdjuster.mm +++ /dev/null @@ -1,240 +0,0 @@ -// -// ASTextKitFontSizeAdjuster.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -#import -#import -#import - -//#define LOG(...) NSLog(__VA_ARGS__) -#define LOG(...) - -@interface ASTextKitFontSizeAdjuster() -@property (nonatomic, readonly) NSLayoutManager *sizingLayoutManager; -@property (nonatomic, readonly) NSTextContainer *sizingTextContainer; -@end - -@implementation ASTextKitFontSizeAdjuster -{ - __weak ASTextKitContext *_context; - ASTextKitAttributes _attributes; - BOOL _measured; - CGFloat _scaleFactor; - AS::Mutex __instanceLock__; -} - -@synthesize sizingLayoutManager = _sizingLayoutManager; -@synthesize sizingTextContainer = _sizingTextContainer; - -- (instancetype)initWithContext:(ASTextKitContext *)context - constrainedSize:(CGSize)constrainedSize - textKitAttributes:(const ASTextKitAttributes &)textComponentAttributes -{ - if (self = [super init]) { - _context = context; - _constrainedSize = constrainedSize; - _attributes = textComponentAttributes; - } - return self; -} - -+ (void)adjustFontSizeForAttributeString:(NSMutableAttributedString *)attrString withScaleFactor:(CGFloat)scaleFactor -{ - if (scaleFactor == 1.0) return; - - [attrString beginEditing]; - - // scale all the attributes that will change the bounding box - [attrString enumerateAttributesInRange:NSMakeRange(0, attrString.length) options:0 usingBlock:^(NSDictionary * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) { - if (attrs[NSFontAttributeName] != nil) { - UIFont *font = attrs[NSFontAttributeName]; - font = [font fontWithSize:std::round(font.pointSize * scaleFactor)]; - [attrString removeAttribute:NSFontAttributeName range:range]; - [attrString addAttribute:NSFontAttributeName value:font range:range]; - } - - if (attrs[NSKernAttributeName] != nil) { - NSNumber *kerning = attrs[NSKernAttributeName]; - [attrString removeAttribute:NSKernAttributeName range:range]; - [attrString addAttribute:NSKernAttributeName value:@([kerning floatValue] * scaleFactor) range:range]; - } - - if (attrs[NSParagraphStyleAttributeName] != nil) { - NSMutableParagraphStyle *paragraphStyle = [attrs[NSParagraphStyleAttributeName] mutableCopy]; - paragraphStyle.lineSpacing = (paragraphStyle.lineSpacing * scaleFactor); - paragraphStyle.paragraphSpacing = (paragraphStyle.paragraphSpacing * scaleFactor); - paragraphStyle.firstLineHeadIndent = (paragraphStyle.firstLineHeadIndent * scaleFactor); - paragraphStyle.headIndent = (paragraphStyle.headIndent * scaleFactor); - paragraphStyle.tailIndent = (paragraphStyle.tailIndent * scaleFactor); - paragraphStyle.minimumLineHeight = (paragraphStyle.minimumLineHeight * scaleFactor); - paragraphStyle.maximumLineHeight = (paragraphStyle.maximumLineHeight * scaleFactor); - - [attrString removeAttribute:NSParagraphStyleAttributeName range:range]; - [attrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range]; - } - - }]; - - [attrString endEditing]; -} - -- (NSUInteger)lineCountForString:(NSAttributedString *)attributedString -{ - NSUInteger lineCount = 0; - - NSLayoutManager *sizingLayoutManager = [self sizingLayoutManager]; - NSTextContainer *sizingTextContainer = [self sizingTextContainer]; - - NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:attributedString]; - [textStorage addLayoutManager:sizingLayoutManager]; - - [sizingLayoutManager ensureLayoutForTextContainer:sizingTextContainer]; - for (NSRange lineRange = { 0, 0 }; NSMaxRange(lineRange) < [sizingLayoutManager numberOfGlyphs] && lineCount <= _attributes.maximumNumberOfLines; lineCount++) { - [sizingLayoutManager lineFragmentRectForGlyphAtIndex:NSMaxRange(lineRange) effectiveRange:&lineRange]; - } - - [textStorage removeLayoutManager:sizingLayoutManager]; - return lineCount; -} - -- (CGSize)boundingBoxForString:(NSAttributedString *)attributedString -{ - NSLayoutManager *sizingLayoutManager = [self sizingLayoutManager]; - NSTextContainer *sizingTextContainer = [self sizingTextContainer]; - - NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:attributedString]; - [textStorage addLayoutManager:sizingLayoutManager]; - - [sizingLayoutManager ensureLayoutForTextContainer:sizingTextContainer]; - CGRect textRect = [sizingLayoutManager boundingRectForGlyphRange:NSMakeRange(0, [textStorage length]) - inTextContainer:sizingTextContainer]; - [textStorage removeLayoutManager:sizingLayoutManager]; - return textRect.size; -} - -- (NSLayoutManager *)sizingLayoutManager -{ - AS::MutexLocker l(__instanceLock__); - if (_sizingLayoutManager == nil) { - _sizingLayoutManager = [[ASLayoutManager alloc] init]; - _sizingLayoutManager.usesFontLeading = NO; - - if (_sizingTextContainer == nil) { - // make this text container unbounded in height so that the layout manager will compute the total - // number of lines and not stop counting when height runs out. - _sizingTextContainer = [[NSTextContainer alloc] initWithSize:CGSizeMake(_constrainedSize.width, CGFLOAT_MAX)]; - _sizingTextContainer.lineFragmentPadding = 0; - - // use 0 regardless of what is in the attributes so that we get an accurate line count - _sizingTextContainer.maximumNumberOfLines = 0; - - _sizingTextContainer.lineBreakMode = _attributes.lineBreakMode; - _sizingTextContainer.exclusionPaths = _attributes.exclusionPaths; - } - [_sizingLayoutManager addTextContainer:_sizingTextContainer]; - } - - return _sizingLayoutManager; -} - -- (CGFloat)scaleFactor -{ - if (_measured) { - return _scaleFactor; - } - - if ([_attributes.pointSizeScaleFactors count] == 0 || isinf(_constrainedSize.width)) { - _measured = YES; - _scaleFactor = 1.0; - return _scaleFactor; - } - - __block CGFloat adjustedScale = 1.0; - - // We add the scale factor of 1 to our scaleFactors array so that in the first iteration of the loop below, we are - // actually determining if we need to scale at all. If something doesn't fit, we will continue to iterate our scale factors. - NSArray *scaleFactors = [@[@(1)] arrayByAddingObjectsFromArray:_attributes.pointSizeScaleFactors]; - - [_context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - - // Check for two different situations (and correct for both) - // 1. The longest word in the string fits without being wrapped - // 2. The entire text fits in the given constrained size. - - NSString *str = textStorage.string; - NSArray *words = [str componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - NSString *longestWordNeedingResize = @""; - for (NSString *word in words) { - if ([word length] > [longestWordNeedingResize length]) { - longestWordNeedingResize = word; - } - } - - // check to see if we may need to shrink for any of these things - BOOL longestWordFits = [longestWordNeedingResize length] ? NO : YES; - BOOL maxLinesFits = self->_attributes.maximumNumberOfLines > 0 ? NO : YES; - BOOL heightFits = isinf(self->_constrainedSize.height) ? YES : NO; - - CGSize longestWordSize = CGSizeZero; - if (longestWordFits == NO) { - NSRange longestWordRange = [str rangeOfString:longestWordNeedingResize]; - NSAttributedString *attrString = [textStorage attributedSubstringFromRange:longestWordRange]; - longestWordSize = [attrString boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size; - } - - // we may need to shrink for some reason, so let's iterate through our scale factors to see if we actually need to shrink - // Note: the first scale factor in the array is 1.0 so will make sure that things don't fit without shrinking - for (NSNumber *adjustedScaleObj in scaleFactors) { - if (longestWordFits && maxLinesFits && heightFits) { - break; - } - - adjustedScale = [adjustedScaleObj floatValue]; - - if (longestWordFits == NO) { - // we need to check the longest word to make sure it fits - longestWordFits = std::ceil((longestWordSize.width * adjustedScale) <= self->_constrainedSize.width); - } - - // if the longest word fits, go ahead and check max line and height. If it didn't fit continue to the next scale factor - if (longestWordFits == YES) { - - // scale our string by the current scale factor - NSMutableAttributedString *scaledString = [[NSMutableAttributedString alloc] initWithAttributedString:textStorage]; - [[self class] adjustFontSizeForAttributeString:scaledString withScaleFactor:adjustedScale]; - - // check to see if this scaled string fit in the max lines - if (maxLinesFits == NO) { - maxLinesFits = ([self lineCountForString:scaledString] <= self->_attributes.maximumNumberOfLines); - } - - // if max lines still doesn't fit, continue without checking that we fit in the constrained height - if (maxLinesFits == YES && heightFits == NO) { - // max lines fit so make sure that we fit in the constrained height. - CGSize stringSize = [self boundingBoxForString:scaledString]; - heightFits = (stringSize.height <= self->_constrainedSize.height); - } - } - } - - }]; - _measured = YES; - _scaleFactor = adjustedScale; - return _scaleFactor; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.h b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.h deleted file mode 100644 index c8872825..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.h +++ /dev/null @@ -1,106 +0,0 @@ -// -// ASTextKitRenderer+Positioning.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -typedef void (^as_text_component_index_block_t)(NSUInteger characterIndex, - CGRect glyphBoundingRect, - BOOL *stop); - -/** - Measure options are used to specify which type of line height measurement to use. - - ASTextNodeRendererMeasureOptionLineHeight is faster and will give the height from the baseline to the next line. - - ASTextNodeRendererMeasureOptionCapHeight is a more nuanced measure of the glyphs in the given range that attempts to - produce a visually balanced rectangle above and below the glyphs to produce nice looking text highlights. - - ASTextNodeRendererMeasureOptionBlock uses the cap height option to generate each glyph index, but combines all but the - first and last line rect into a single block. Looks nice for multiline selection. - */ -typedef NS_ENUM(NSUInteger, ASTextKitRendererMeasureOption) { - ASTextKitRendererMeasureOptionLineHeight, - ASTextKitRendererMeasureOptionCapHeight, - ASTextKitRendererMeasureOptionBlock -}; - -@interface ASTextKitRenderer (Positioning) - -/** - Returns the bounding rect for the given character range. - - @param textRange The character range for which the bounding rect will be computed. Should be within the range of the - attributedString of this renderer. - - @discussion In the external, shadowed coordinate space. - */ -- (CGRect)frameForTextRange:(NSRange)textRange; - -/** - Returns an array of rects representing the lines in the given character range - - @param textRange The character range for which the rects will be computed. Should be within the range of the - attributedString of this renderer. - @param measureOption The measure option to use for construction of the rects. See ASTextKitRendererMeasureOption - docs for usage. - - @discussion This method is useful for providing highlighting text. Returned rects are in the coordinate space of the - renderer. - - Triggers initialization of textkit components, truncation, and sizing. - */ -- (NSArray *)rectsForTextRange:(NSRange)textRange - measureOption:(ASTextKitRendererMeasureOption)measureOption; - -/** - Enumerate the text character indexes at a position within the coordinate space of the renderer. - - @param position The point in the shadowed coordinate space at which text indexes will be enumerated. - @param block The block that will be executed for each index identified that may correspond to the given position. The - block is given the character index that corresponds to the glyph at each index in question, as well as the bounding - rect for that glyph. - - @discussion Glyph location based on a touch point is not an exact science because user touches are not well-represented - by a simple point, especially in the context of link-heavy text. So we have this method to make it a bit easier. This - method checks a grid of candidate positions around the touch point you give it, and computes the bounding rect of the - glyph corresponding to the character index given. - - The bounding rect of the glyph can be used to identify the best glyph index that corresponds to your touch. For - instance, comparing centroidal distance from the glyph bounding rect to the touch center is useful for identifying - which link a user actually intended to select. - - Triggers initialization of textkit components, truncation, and sizing. - */ -- (void)enumerateTextIndexesAtPosition:(CGPoint)position - usingBlock:(as_text_component_index_block_t)block; - -/** - Returns the single text index whose glyph's centroid is closest to the given position. - - @param position The point in the shadowed coordinate space that should be checked. - - @discussion This will use the grid enumeration function above, `enumerateTextIndexesAtPosition...`, in order to find - the closest glyph, so it is possible that a glyph could be missed, but ultimately unlikely. - */ -- (NSUInteger)nearestTextIndexAtPosition:(CGPoint)position; - -/** - Returns the trailing rect unused by the renderer in the last rendered line. - - @discussion In the external shadowed coordinate space. - - Triggers initialization of textkit components, truncation, and sizing. - */ -- (CGRect)trailingRect; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.mm deleted file mode 100644 index 9dc770e1..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+Positioning.mm +++ /dev/null @@ -1,386 +0,0 @@ -// -// ASTextKitRenderer+Positioning.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import -#import - -#import - -#import -#import - -static const CGFloat ASTextKitRendererGlyphTouchHitSlop = 5.0; -static const CGFloat ASTextKitRendererTextCapHeightPadding = 1.3; - -@implementation ASTextKitRenderer (Tracking) - -- (NSArray *)rectsForTextRange:(NSRange)textRange measureOption:(ASTextKitRendererMeasureOption)measureOption -{ - __block NSArray *textRects = nil; - [self.context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - textRects = [self unlockedRectsForTextRange:textRange measureOptions:measureOption layoutManager:layoutManager textStorage:textStorage textContainer:textContainer]; - }]; - return textRects; -} - -/** - Helper function that should be called within performBlockWithLockedTextKitComponents: in an already locked state to - prevent a deadlock - */ -- (NSArray *)unlockedRectsForTextRange:(NSRange)textRange measureOptions:(ASTextKitRendererMeasureOption)measureOption layoutManager:(NSLayoutManager *)layoutManager textStorage:(NSTextStorage *)textStorage textContainer:(NSTextContainer *)textContainer -{ - NSRange clampedRange = NSIntersectionRange(textRange, NSMakeRange(0, [textStorage length])); - if (clampedRange.location == NSNotFound || clampedRange.length == 0) { - return @[]; - } - - // Used for block measure option - __block CGRect firstRect = CGRectNull; - __block CGRect lastRect = CGRectNull; - __block CGRect blockRect = CGRectNull; - NSMutableArray *mutableTextRects = [NSMutableArray array]; - - NSString *string = textStorage.string; - - NSRange totalGlyphRange = [layoutManager glyphRangeForCharacterRange:clampedRange actualCharacterRange:NULL]; - - [layoutManager enumerateLineFragmentsForGlyphRange:totalGlyphRange usingBlock:^(CGRect rect, - CGRect usedRect, - NSTextContainer *innerTextContainer, - NSRange glyphRange, - BOOL *stop) { - - CGRect lineRect = CGRectNull; - // If we're empty, don't bother looping through glyphs, use the default. - if (CGRectIsEmpty(usedRect)) { - lineRect = usedRect; - } else { - // TextKit's bounding rect computations are just a touch off, so we actually - // compose the rects by hand from the center of the given TextKit bounds and - // imposing the font attributes returned by the glyph's font. - NSRange lineGlyphRange = NSIntersectionRange(totalGlyphRange, glyphRange); - for (NSUInteger i = lineGlyphRange.location; i < NSMaxRange(lineGlyphRange) && i < string.length; i++) { - // We grab the properly sized rect for the glyph - CGRect properGlyphRect = [self _internalRectForGlyphAtIndex:i - measureOption:measureOption - layoutManager:layoutManager - textContainer:textContainer - textStorage:textStorage]; - - // Don't count empty glyphs towards our line rect. - if (!CGRectIsEmpty(properGlyphRect)) { - lineRect = CGRectIsNull(lineRect) ? properGlyphRect - : CGRectUnion(lineRect, properGlyphRect); - } - } - } - - if (!CGRectIsNull(lineRect)) { - if (measureOption == ASTextKitRendererMeasureOptionBlock) { - // For the block measurement option we store the first & last rect as - // special cases, then merge everything else into a single block rect - if (CGRectIsNull(firstRect)) { - // We don't have a firstRect, so we must be on the first line. - firstRect = lineRect; - } else if(CGRectIsNull(lastRect)) { - // We don't have a lastRect, but we do have a firstRect, so we must - // be on the second line. No need to merge in the blockRect just yet - lastRect = lineRect; - } else if(CGRectIsNull(blockRect)) { - // We have both a first and last rect, so we must be on the third line - // we don't have any blockRect to merge it into, so we just set it - // directly. - blockRect = lastRect; - lastRect = lineRect; - } else { - // Everything is already set, so we just merge this line into the - // block. - blockRect = CGRectUnion(blockRect, lastRect); - lastRect = lineRect; - } - } else { - // If the block option isn't being used then each line is being treated - // individually. - [mutableTextRects addObject:[NSValue valueWithCGRect:[self.shadower offsetRectWithInternalRect:lineRect]]]; - } - } - }]; - - if (measureOption == ASTextKitRendererMeasureOptionBlock) { - // Block measure option is handled differently with just 3 vars for the entire range. - if (!CGRectIsNull(firstRect)) { - if (!CGRectIsNull(blockRect)) { - CGFloat rightEdge = MAX(CGRectGetMaxX(blockRect), CGRectGetMaxX(lastRect)); - if (rightEdge > CGRectGetMaxX(firstRect)) { - // Force the right side of the first rect to properly align with the - // right side of the rightmost of the block and last rect - firstRect.size.width += rightEdge - CGRectGetMaxX(firstRect); - } - - // Force the left side of the block rect to properly align with the - // left side of the leftmost of the first and last rect - blockRect.origin.x = MIN(CGRectGetMinX(firstRect), CGRectGetMinX(lastRect)); - // Force the right side of the block rect to properly align with the - // right side of the rightmost of the first and last rect - blockRect.size.width += MAX(CGRectGetMaxX(firstRect), CGRectGetMaxX(lastRect)) - CGRectGetMaxX(blockRect); - } - if (!CGRectIsNull(lastRect)) { - // Force the left edge of the last rect to properly align with the - // left side of the leftmost of the first and block rect, if necessary. - CGFloat leftEdge = MIN(CGRectGetMinX(blockRect), CGRectGetMinX(firstRect)); - CGFloat lastRectNudgeAmount = MAX(CGRectGetMinX(lastRect) - leftEdge, 0); - lastRect.origin.x = MIN(leftEdge, CGRectGetMinX(lastRect)); - lastRect.size.width += lastRectNudgeAmount; - } - - [mutableTextRects addObject:[NSValue valueWithCGRect:[self.shadower offsetRectWithInternalRect:firstRect]]]; - } - if (!CGRectIsNull(blockRect)) { - [mutableTextRects addObject:[NSValue valueWithCGRect:[self.shadower offsetRectWithInternalRect:blockRect]]]; - } - if (!CGRectIsNull(lastRect)) { - [mutableTextRects addObject:[NSValue valueWithCGRect:[self.shadower offsetRectWithInternalRect:lastRect]]]; - } - } - - return [mutableTextRects copy]; -} - -- (NSUInteger)nearestTextIndexAtPosition:(CGPoint)position -{ - // Check in a 9-point region around the actual touch point so we make sure - // we get the best attribute for the touch. - __block CGFloat minimumGlyphDistance = CGFLOAT_MAX; - __block NSUInteger minimumGlyphCharacterIndex = NSNotFound; - - [self enumerateTextIndexesAtPosition:position usingBlock:^(NSUInteger characterIndex, CGRect glyphBoundingRect, BOOL *stop) { - CGPoint glyphLocation = CGPointMake(CGRectGetMidX(glyphBoundingRect), CGRectGetMidY(glyphBoundingRect)); - CGFloat currentDistance = std::sqrt(std::pow(position.x - glyphLocation.x, 2.f) + std::pow(position.y - glyphLocation.y, 2.f)); - if (currentDistance < minimumGlyphDistance) { - minimumGlyphDistance = currentDistance; - minimumGlyphCharacterIndex = characterIndex; - } - }]; - return minimumGlyphCharacterIndex; -} - -/** - Measured from the internal coordinate space of the context, not accounting for shadow offsets. Actually uses CoreText - as an approximation to work around problems in TextKit's glyph sizing. - */ -- (CGRect)_internalRectForGlyphAtIndex:(NSUInteger)glyphIndex - measureOption:(ASTextKitRendererMeasureOption)measureOption - layoutManager:(NSLayoutManager *)layoutManager - textContainer:(NSTextContainer *)textContainer - textStorage:(NSTextStorage *)textStorage -{ - NSUInteger charIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex]; - CGGlyph glyph = [layoutManager glyphAtIndex:glyphIndex]; - CTFontRef font = (__bridge_retained CTFontRef)[textStorage attribute:NSFontAttributeName - atIndex:charIndex - effectiveRange:NULL]; - if (font == nil) { - font = (__bridge_retained CTFontRef)[UIFont systemFontOfSize:12.0]; - } - - // Glyph Advance - // +-------------------------+ - // | | - // | | - // +------------------------+--|-------------------------|--+-----------+-----+ What TextKit returns sometimes - // | | | XXXXXXXXXXX + | | | (approx. correct height, but - // | ---------|--+---------+ XXX XXXX +|-----------|-----| sometimes inaccurate bounding - // | | | XXX XXXXX| | | widths) - // | | | XX XX | | | - // | | | XX | | | - // | | | XXX | | | - // | | | XX | | | - // | | | XXXXXXXXXXX | | | - // | Cap Height->| | XX | | | - // | | | XX | Ascent-->| | - // | | | XX | | | - // | | | XX | | | - // | | | X | | | - // | | | X | | | - // | | | X | | | - // | | | XX | | | - // | | | X | | | - // | ---------|-------+ X +-------------------------------------| - // | | XX | | - // | | X | | - // | | XX Descent------>| | - // | | XXXXXX | | - // | | XXX | | - // +------------------------+-------------------------------------------------+ - // | - // +--+Actual bounding box - - CGRect glyphRect = [layoutManager boundingRectForGlyphRange:NSMakeRange(glyphIndex, 1) - inTextContainer:textContainer]; - - // If it is a NSTextAttachment, we don't have the matched glyph and use width of glyphRect instead of advance. - CGFloat advance = (glyph == kCGFontIndexInvalid) ? glyphRect.size.width : CTFontGetAdvancesForGlyphs(font, kCTFontOrientationHorizontal, &glyph, NULL, 1); - - // We treat the center of the glyph's bounding box as the center of our new rect - CGPoint glyphCenter = CGPointMake(CGRectGetMidX(glyphRect), CGRectGetMidY(glyphRect)); - - CGRect properGlyphRect; - if (measureOption == ASTextKitRendererMeasureOptionCapHeight - || measureOption == ASTextKitRendererMeasureOptionBlock) { - CGFloat ascent = CTFontGetAscent(font); - CGFloat descent = CTFontGetDescent(font); - CGFloat capHeight = CTFontGetCapHeight(font); - CGFloat leading = CTFontGetLeading(font); - CGFloat glyphHeight = ascent + descent; - - // For visual balance, we add the cap height padding above the cap, and - // below the baseline, we scale by the descent so it grows with the size of - // the text. - CGFloat topPadding = ASTextKitRendererTextCapHeightPadding * descent; - CGFloat bottomPadding = topPadding; - - properGlyphRect = CGRectMake(glyphCenter.x - advance * 0.5, - glyphCenter.y - glyphHeight * 0.5 + (ascent - capHeight) - topPadding + leading, - advance, - capHeight + topPadding + bottomPadding); - } else { - // We are just measuring the line heights here, so we can use the - // heights used by TextKit, which tend to be pretty good. - properGlyphRect = CGRectMake(glyphCenter.x - advance * 0.5, - glyphRect.origin.y, - advance, - glyphRect.size.height); - } - - CFRelease(font); - - return properGlyphRect; -} - -- (void)enumerateTextIndexesAtPosition:(CGPoint)externalPosition usingBlock:(as_text_component_index_block_t)block -{ - // This method is a little complex because it has to call out to client code from inside an enumeration that needs - // to achieve a lock on the textkit components. It cannot call out to client code from within that lock so we just - // perform the textkit-locked ops inside the locked context. - ASTextKitContext *lockingContext = self.context; - CGPoint internalPosition = [self.shadower offsetPointWithExternalPoint:externalPosition]; - __block BOOL invalidPosition = NO; - [lockingContext performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - invalidPosition = internalPosition.x > textContainer.size.width - || internalPosition.y > textContainer.size.height - || block == NULL; - }]; - if (invalidPosition) { - // Short circuit if the position is outside the size of this renderer, or if the block is null. - return; - } - - // We break it up into a 44pt box for the touch, and find the closest link attribute-containing glyph to the center of - // the touch. - CGFloat squareSide = 44.f; - // Should be odd if you want to test the center of the touch. - NSInteger pointsOnASide = 3; - - // The distance between any 2 of the adjacent points - CGFloat pointSeparation = squareSide / pointsOnASide; - // These are for tracking which point we're on. We start with -pointsOnASide/2 and go to pointsOnASide/2. So if - // pointsOnASide=3, we go from -1 to 1. - NSInteger endIndex = pointsOnASide / 2; - NSInteger startIndex = -endIndex; - - BOOL stop = NO; - for (NSInteger i = startIndex; i <= endIndex && !stop; i++) { - for (NSInteger j = startIndex; j <= endIndex && !stop; j++) { - CGPoint currentPoint = CGPointMake(internalPosition.x + i * pointSeparation, - internalPosition.y + j * pointSeparation); - - __block NSUInteger characterIndex = NSNotFound; - __block BOOL isValidGlyph = NO; - __block CGRect glyphRect = CGRectNull; - - [lockingContext performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - // We ask the layout manager for the proper glyph at the touch point - NSUInteger glyphIndex = [layoutManager glyphIndexForPoint:currentPoint - inTextContainer:textContainer]; - - // If it's an invalid glyph, quit. - - [layoutManager glyphAtIndex:glyphIndex isValidIndex:&isValidGlyph]; - if (!isValidGlyph) { - return; - } - - characterIndex = [layoutManager characterIndexForGlyphAtIndex:glyphIndex]; - - glyphRect = [self _internalRectForGlyphAtIndex:glyphIndex - measureOption:ASTextKitRendererMeasureOptionLineHeight - layoutManager:layoutManager - textContainer:textContainer - textStorage:textStorage]; - }]; - - // Sometimes TextKit plays jokes on us and returns glyphs that really aren't close to the point in question. - // Silly TextKit... - if (!isValidGlyph || !CGRectContainsPoint(CGRectInset(glyphRect, -ASTextKitRendererGlyphTouchHitSlop, -ASTextKitRendererGlyphTouchHitSlop), currentPoint)) { - continue; - } - - block(characterIndex, [self.shadower offsetRectWithInternalRect:glyphRect], &stop); - } - } -} - -- (CGRect)trailingRect -{ - __block CGRect trailingRect = CGRectNull; - [self.context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - CGSize calculatedSize = textContainer.size; - // If have an empty string, then our whole bounds constitute trailing space. - if ([textStorage length] == 0) { - trailingRect = CGRectMake(0, 0, calculatedSize.width, calculatedSize.height); - return; - } - - // Take everything after our final character as trailing space. - NSRange textRange = NSMakeRange([textStorage length] - 1, 1); - NSArray *finalRects = [self unlockedRectsForTextRange:textRange measureOptions:ASTextKitRendererMeasureOptionLineHeight layoutManager:layoutManager textStorage:textStorage textContainer:textContainer]; - CGRect finalGlyphRect = [[finalRects lastObject] CGRectValue]; - CGPoint origin = CGPointMake(CGRectGetMaxX(finalGlyphRect), CGRectGetMinY(finalGlyphRect)); - CGSize size = CGSizeMake(calculatedSize.width - origin.x, calculatedSize.height - origin.y); - trailingRect = (CGRect){origin, size}; - }]; - return trailingRect; -} - -- (CGRect)frameForTextRange:(NSRange)textRange -{ - __block CGRect textRect = CGRectNull; - [self.context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - // Bail on invalid range. - if (NSMaxRange(textRange) > [textStorage length]) { - ASDisplayNodeCFailAssert(@"Invalid range"); - return; - } - - // Force glyph generation and layout. - [layoutManager ensureLayoutForTextContainer:textContainer]; - - NSRange glyphRange = [layoutManager glyphRangeForCharacterRange:textRange actualCharacterRange:NULL]; - textRect = [layoutManager boundingRectForGlyphRange:glyphRange inTextContainer:textContainer]; - }]; - return textRect; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.h b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.h deleted file mode 100644 index d4ba74fd..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ASTextKitRenderer+TextChecking.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -/** - Application extensions to NSTextCheckingType. We're allowed to do this (see NSTextCheckingAllCustomTypes). - */ -static uint64_t const ASTextKitTextCheckingTypeEntity = 1ULL << 33; -static uint64_t const ASTextKitTextCheckingTypeTruncation = 1ULL << 34; - -@class ASTextKitEntityAttribute; - -@interface ASTextKitTextCheckingResult : NSTextCheckingResult -@property (nonatomic, readonly) ASTextKitEntityAttribute *entityAttribute; -@end - -@interface ASTextKitRenderer (TextChecking) - -- (NSTextCheckingResult *)textCheckingResultAtPoint:(CGPoint)point; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.mm deleted file mode 100644 index e5563935..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer+TextChecking.mm +++ /dev/null @@ -1,104 +0,0 @@ -// -// ASTextKitRenderer+TextChecking.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import -#import -#import - -@implementation ASTextKitTextCheckingResult - -{ - // Be explicit about the fact that we are overriding the super class' implementation of -range and -resultType - // and substituting our own custom values. (We could use @synthesize to make these ivars, but our linter correctly - // complains; it's weird to use @synthesize for properties that are redeclared on top of an original declaration in - // the superclass. We only do it here because NSTextCheckingResult doesn't expose an initializer, which is silly.) - NSRange _rangeOverride; - NSTextCheckingType _resultTypeOverride; -} - -- (instancetype)initWithType:(NSTextCheckingType)type - entityAttribute:(ASTextKitEntityAttribute *)entityAttribute - range:(NSRange)range -{ - if ((self = [super init])) { - _resultTypeOverride = type; - _rangeOverride = range; - _entityAttribute = entityAttribute; - } - return self; -} - -- (NSTextCheckingType)resultType -{ - return _resultTypeOverride; -} - -- (NSRange)range -{ - return _rangeOverride; -} - -@end - -@implementation ASTextKitRenderer (TextChecking) - -- (NSTextCheckingResult *)textCheckingResultAtPoint:(CGPoint)point -{ - __block NSTextCheckingResult *result = nil; - NSAttributedString *attributedString = self.attributes.attributedString; - NSAttributedString *truncationAttributedString = self.attributes.truncationAttributedString; - - // get the index of the last character, so we can handle text in the truncation token - __block NSRange truncationTokenRange = { NSNotFound, 0 }; - - [truncationAttributedString enumerateAttribute:ASTextKitTruncationAttributeName inRange:NSMakeRange(0, truncationAttributedString.length) - options:0 - usingBlock:^(id value, NSRange range, BOOL *stop) { - if (value != nil && range.length > 0) { - truncationTokenRange = range; - } - }]; - - if (truncationTokenRange.location == NSNotFound) { - // The truncation string didn't specify a substring which should be highlighted, so we just highlight it all - truncationTokenRange = { 0, truncationAttributedString.length }; - } - - NSRange visibleRange = self.truncater.firstVisibleRange; - truncationTokenRange.location += NSMaxRange(visibleRange); - - __block CGFloat minDistance = CGFLOAT_MAX; - [self enumerateTextIndexesAtPosition:point usingBlock:^(NSUInteger index, CGRect glyphBoundingRect, BOOL *stop){ - if (index >= truncationTokenRange.location) { - result = [[ASTextKitTextCheckingResult alloc] initWithType:ASTextKitTextCheckingTypeTruncation - entityAttribute:nil - range:truncationTokenRange]; - } else { - NSRange range; - NSDictionary *attributes = [attributedString attributesAtIndex:index effectiveRange:&range]; - ASTextKitEntityAttribute *entityAttribute = attributes[ASTextKitEntityAttributeName]; - CGFloat distance = hypot(CGRectGetMidX(glyphBoundingRect) - point.x, CGRectGetMidY(glyphBoundingRect) - point.y); - if (entityAttribute && distance < minDistance) { - result = [[ASTextKitTextCheckingResult alloc] initWithType:ASTextKitTextCheckingTypeEntity - entityAttribute:entityAttribute - range:range]; - minDistance = distance; - } - } - }]; - return result; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.h b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.h deleted file mode 100644 index 0f0cc00e..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// ASTextKitRenderer.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -#import - -@class ASTextKitContext; -@class ASTextKitShadower; -@class ASTextKitFontSizeAdjuster; -@protocol ASTextKitTruncating; - -/** - ASTextKitRenderer is a modular object that is responsible for laying out and drawing text. - - A renderer will hold onto the TextKit layouts for the given attributes after initialization. This may constitute a - large amount of memory for large enough applications, so care must be taken when keeping many of these around in-memory - at once. - - This object is designed to be modular and simple. All complex maintenance of state should occur in sub-objects or be - derived via pure functions or categories. No touch-related handling belongs in this class. - - ALL sizing and layout information from this class is in the external coordinate space of the TextKit components. This - is an important distinction because all internal sizing and layout operations are carried out within the shadowed - coordinate space. Padding will be added for you in order to ensure clipping does not occur, and additional information - on this transform is available via the shadower should you need it. - */ -@interface ASTextKitRenderer : NSObject - -/** - Designated Initializer - @discussion Sizing will occur as a result of initialization, so be careful when/where you use this. - */ -- (instancetype)initWithTextKitAttributes:(const ASTextKitAttributes &)textComponentAttributes - constrainedSize:(const CGSize)constrainedSize; - -@property (nonatomic, readonly) ASTextKitContext *context; - -@property (nonatomic, readonly) id truncater; - -@property (nonatomic, readonly) ASTextKitFontSizeAdjuster *fontSizeAdjuster; - -@property (nonatomic, readonly) ASTextKitShadower *shadower; - -@property (nonatomic, readonly) ASTextKitAttributes attributes; - -@property (nonatomic, readonly) CGSize constrainedSize; - -@property (nonatomic, readonly) CGFloat currentScaleFactor; - -#pragma mark - Drawing -/** - Draw the renderer's text content into the bounds provided. - - @param bounds The rect in which to draw the contents of the renderer. - */ -- (void)drawInContext:(CGContextRef)context bounds:(CGRect)bounds; - -#pragma mark - Layout - -/** - Returns the computed size of the renderer given the constrained size and other parameters in the initializer. - */ -- (CGSize)size; - -#pragma mark - Text Ranges - -/** - The character range from the original attributedString that is displayed by the renderer given the parameters in the - initializer. - */ -@property (nonatomic, readonly) std::vector visibleRanges; - -/** - The number of lines shown in the string. - */ -- (NSUInteger)lineCount; - -/** - Whether or not the text is truncated. - */ -- (BOOL)isTruncated; - -@end - -@interface ASTextKitRenderer (ASTextKitRendererConvenience) - -/** - Returns the first visible range or an NSRange with location of NSNotFound and size of 0 if no first visible - range exists - */ -@property (nonatomic, readonly) NSRange firstVisibleRange; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.mm deleted file mode 100644 index 30fc33a9..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitRenderer.mm +++ /dev/null @@ -1,294 +0,0 @@ -// -// ASTextKitRenderer.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -#import -#import -#import -#import - -//#define LOG(...) NSLog(__VA_ARGS__) -#define LOG(...) - -static NSCharacterSet *_defaultAvoidTruncationCharacterSet() -{ - static NSCharacterSet *truncationCharacterSet; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSMutableCharacterSet *mutableCharacterSet = [[NSMutableCharacterSet alloc] init]; - [mutableCharacterSet formUnionWithCharacterSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - [mutableCharacterSet addCharactersInString:@".,!?:;"]; - truncationCharacterSet = mutableCharacterSet; - }); - return truncationCharacterSet; -} - -@implementation ASTextKitRenderer { - CGSize _calculatedSize; -} -@synthesize attributes = _attributes, context = _context, shadower = _shadower, truncater = _truncater, fontSizeAdjuster = _fontSizeAdjuster; - -#pragma mark - Initialization - -- (instancetype)initWithTextKitAttributes:(const ASTextKitAttributes &)attributes - constrainedSize:(const CGSize)constrainedSize -{ - if (self = [super init]) { - _constrainedSize = constrainedSize; - _attributes = attributes; - _currentScaleFactor = 1; - - // As the renderer should be thread safe, create all subcomponents in the initialization method - _shadower = [ASTextKitShadower shadowerWithShadowOffset:attributes.shadowOffset - shadowColor:attributes.shadowColor - shadowOpacity:attributes.shadowOpacity - shadowRadius:attributes.shadowRadius]; - - // We must inset the constrained size by the size of the shadower. - CGSize shadowConstrainedSize = [[self shadower] insetSizeWithConstrainedSize:_constrainedSize]; - - _context = [[ASTextKitContext alloc] initWithAttributedString:attributes.attributedString - tintColor:attributes.tintColor - lineBreakMode:attributes.lineBreakMode - maximumNumberOfLines:attributes.maximumNumberOfLines - exclusionPaths:attributes.exclusionPaths - constrainedSize:shadowConstrainedSize]; - - NSCharacterSet *avoidTailTruncationSet = attributes.avoidTailTruncationSet ?: _defaultAvoidTruncationCharacterSet(); - _truncater = [[ASTextKitTailTruncater alloc] initWithContext:[self context] - truncationAttributedString:attributes.truncationAttributedString - avoidTailTruncationSet:avoidTailTruncationSet]; - - ASTextKitAttributes attributes = _attributes; - // We must inset the constrained size by the size of the shadower. - _fontSizeAdjuster = [[ASTextKitFontSizeAdjuster alloc] initWithContext:[self context] - constrainedSize:shadowConstrainedSize - textKitAttributes:attributes]; - - // Calcualate size immediately - [self _calculateSize]; - } - return self; -} - -- (NSStringDrawingContext *)stringDrawingContext -{ - // String drawing contexts are not safe to use from more than one thread. - // i.e. if they are created on one thread, it is unsafe to use them on another. - // Therefore we always need to create a new one. - // - // http://web.archive.org/web/20140703122636/https://developer.apple.com/library/ios/documentation/uikit/reference/NSAttributedString_UIKit_Additions/Reference/Reference.html - NSStringDrawingContext *stringDrawingContext = [[NSStringDrawingContext alloc] init]; - - if (isinf(_constrainedSize.width) == NO && _attributes.maximumNumberOfLines > 0) { - ASDisplayNodeAssert(_attributes.maximumNumberOfLines != 1, @"Max line count 1 is not supported in fast-path."); - [stringDrawingContext setValue:@(_attributes.maximumNumberOfLines) forKey:@"maximumNumberOfLines"]; - } - return stringDrawingContext; -} - -#pragma mark - Sizing - -- (CGSize)size -{ - return _calculatedSize; -} - -- (void)_calculateSize -{ - // if we have no scale factors or an unconstrained width, there is no reason to try to adjust the font size - if (isinf(_constrainedSize.width) == NO && [_attributes.pointSizeScaleFactors count] > 0) { - _currentScaleFactor = [[self fontSizeAdjuster] scaleFactor]; - } - - const CGRect constrainedRect = {CGPointZero, _constrainedSize}; - - // If we do not scale, do exclusion, or do custom truncation, we should just use NSAttributedString drawing for a fast-path. - if (self.canUseFastPath) { - CGRect rect = [_attributes.attributedString boundingRectWithSize:_constrainedSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine context:self.stringDrawingContext]; - // Intersect with constrained rect, in case text kit goes out-of-bounds. - rect = CGRectIntersection(rect, constrainedRect); - _calculatedSize = [self.shadower outsetSizeWithInsetSize:rect.size]; - return; - } - - BOOL isScaled = [self isScaled]; - __block NSTextStorage *scaledTextStorage = nil; - if (isScaled) { - // apply the string scale before truncating or else we may truncate the string after we've done the work to shrink it. - [[self context] performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - NSMutableAttributedString *scaledString = [[NSMutableAttributedString alloc] initWithAttributedString:textStorage]; - [ASTextKitFontSizeAdjuster adjustFontSizeForAttributeString:scaledString withScaleFactor:self->_currentScaleFactor]; - scaledTextStorage = [[NSTextStorage alloc] initWithAttributedString:scaledString]; - - [textStorage removeLayoutManager:layoutManager]; - [scaledTextStorage addLayoutManager:layoutManager]; - }]; - } - - [[self truncater] truncate]; - - __block CGRect boundingRect; - - // Force glyph generation and layout, which may not have happened yet (and isn't triggered by - // -usedRectForTextContainer:). - [[self context] performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - [layoutManager ensureLayoutForTextContainer:textContainer]; - boundingRect = [layoutManager usedRectForTextContainer:textContainer]; - if (isScaled) { - // put the non-scaled version back - [scaledTextStorage removeLayoutManager:layoutManager]; - [textStorage addLayoutManager:layoutManager]; - } - }]; - - // TextKit often returns incorrect glyph bounding rects in the horizontal direction, so we clip to our bounding rect - // to make sure our width calculations aren't being offset by glyphs going beyond the constrained rect. - boundingRect = CGRectIntersection(boundingRect, constrainedRect); - _calculatedSize = [_shadower outsetSizeWithInsetSize:boundingRect.size]; -} - -- (BOOL)isScaled -{ - return (_currentScaleFactor > 0 && _currentScaleFactor < 1.0); -} - -- (BOOL)usesCustomTruncation -{ - // NOTE: This code does not correctly handle if they set `…` with different attributes. - return _attributes.avoidTailTruncationSet != nil || [_attributes.truncationAttributedString.string isEqualToString:@"\u2026"] == NO; -} - -- (BOOL)usesExclusionPaths -{ - return _attributes.exclusionPaths.count > 0; -} - -- (BOOL)canUseFastPath -{ - return NO; -// Fast path is temporarily disabled, because it's crashing in production. -// NOTE: Remember to re-enable testFastPathTruncation when we re-enable this. -// return self.isScaled == NO -// && self.usesCustomTruncation == NO -// && self.usesExclusionPaths == NO -// // NSAttributedString drawing methods ignore usesLineFragmentOrigin if max line count 1, -// // rendering them useless: -// && (_attributes.maximumNumberOfLines != 1 || isinf(_constrainedSize.width)); -} - -#pragma mark - Drawing - -- (void)drawInContext:(CGContextRef)context bounds:(CGRect)bounds -{ - // We add an assertion so we can track the rare conditions where a graphics context is not present - ASDisplayNodeAssertNotNil(context, @"This is no good without a context."); - - bounds = CGRectIntersection(bounds, { .size = _constrainedSize }); - CGRect shadowInsetBounds = [[self shadower] insetRectWithConstrainedRect:bounds]; - - CGContextSaveGState(context); - [[self shadower] setShadowInContext:context]; - UIGraphicsPushContext(context); - - LOG(@"%@, shadowInsetBounds = %@",self, NSStringFromCGRect(shadowInsetBounds)); - - // If we use default options, we can use NSAttributedString for a - // fast path. - if (self.canUseFastPath) { - CGRect drawingBounds = shadowInsetBounds; - [_attributes.attributedString drawWithRect:drawingBounds options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine context:self.stringDrawingContext]; - } else { - BOOL isScaled = [self isScaled]; - [[self context] performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - - NSTextStorage *scaledTextStorage = nil; - - if (isScaled) { - // if we are going to scale the text, swap out the non-scaled text for the scaled version. - NSMutableAttributedString *scaledString = [[NSMutableAttributedString alloc] initWithAttributedString:textStorage]; - [ASTextKitFontSizeAdjuster adjustFontSizeForAttributeString:scaledString withScaleFactor:self->_currentScaleFactor]; - scaledTextStorage = [[NSTextStorage alloc] initWithAttributedString:scaledString]; - - [textStorage removeLayoutManager:layoutManager]; - [scaledTextStorage addLayoutManager:layoutManager]; - } - - LOG(@"usedRect: %@", NSStringFromCGRect([layoutManager usedRectForTextContainer:textContainer])); - - NSRange glyphRange = [layoutManager glyphRangeForBoundingRect:(CGRect){ .size = textContainer.size } inTextContainer:textContainer]; - LOG(@"boundingRect: %@", NSStringFromCGRect([layoutManager boundingRectForGlyphRange:glyphRange inTextContainer:textContainer])); - - [layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:shadowInsetBounds.origin]; - [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:shadowInsetBounds.origin]; - - if (isScaled) { - // put the non-scaled version back - [scaledTextStorage removeLayoutManager:layoutManager]; - [textStorage addLayoutManager:layoutManager]; - } - }]; - } - - UIGraphicsPopContext(); - CGContextRestoreGState(context); -} - -#pragma mark - String Ranges - -- (NSUInteger)lineCount -{ - __block NSUInteger lineCount = 0; - [[self context] performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - for (NSRange lineRange = { 0, 0 }; NSMaxRange(lineRange) < [layoutManager numberOfGlyphs]; lineCount++) { - [layoutManager lineFragmentRectForGlyphAtIndex:NSMaxRange(lineRange) effectiveRange:&lineRange]; - } - }]; - return lineCount; -} - -- (BOOL)isTruncated -{ - if (self.canUseFastPath) { - CGRect boundedRect = [_attributes.attributedString boundingRectWithSize:CGSizeMake(_constrainedSize.width, CGFLOAT_MAX) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine - context:nil]; - return boundedRect.size.height > _constrainedSize.height; - } else { - return self.firstVisibleRange.length < _attributes.attributedString.length; - } -} - -- (std::vector)visibleRanges -{ - return _truncater.visibleRanges; -} - -@end - -@implementation ASTextKitRenderer (ASTextKitRendererConvenience) - -- (NSRange)firstVisibleRange -{ - std::vector visibleRanges = self.visibleRanges; - if (visibleRanges.size() > 0) { - return visibleRanges[0]; - } - - return NSMakeRange(0, 0); -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.h b/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.h deleted file mode 100644 index 2f9c604f..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.h +++ /dev/null @@ -1,78 +0,0 @@ -// -// ASTextKitShadower.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -/** - * @abstract an immutable class for calculating shadow padding drawing a shadowed background for text - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitShadower : NSObject - -+ (ASTextKitShadower *)shadowerWithShadowOffset:(CGSize)shadowOffset - shadowColor:(UIColor *)shadowColor - shadowOpacity:(CGFloat)shadowOpacity - shadowRadius:(CGFloat)shadowRadius; - -/** - * @abstract The offset from the top-left corner at which the shadow starts. - * @discussion A positive width will move the shadow to the right. - * A positive height will move the shadow downwards. - */ -@property (nonatomic, readonly) CGSize shadowOffset; - -//! CGColor in which the shadow is drawn -@property (nonatomic, copy, readonly) UIColor *shadowColor; - -//! Alpha of the shadow -@property (nonatomic, readonly) CGFloat shadowOpacity; - -//! Radius, in pixels -@property (nonatomic, readonly) CGFloat shadowRadius; - -/** - * @abstract The edge insets which represent shadow padding - * @discussion Each edge inset is less than or equal to zero. - * - * Example: - * CGRect boundsWithoutShadowPadding; // Large enough to fit text, not large enough to fit the shadow as well - * UIEdgeInsets shadowPadding = [shadower shadowPadding]; - * CGRect boundsWithShadowPadding = UIEdgeInsetsRect(boundsWithoutShadowPadding, shadowPadding); - */ -- (UIEdgeInsets)shadowPadding; - -- (CGSize)insetSizeWithConstrainedSize:(CGSize)constrainedSize; - -- (CGRect)insetRectWithConstrainedRect:(CGRect)constrainedRect; - -- (CGSize)outsetSizeWithInsetSize:(CGSize)insetSize; - -- (CGRect)outsetRectWithInsetRect:(CGRect)insetRect; - -- (CGRect)offsetRectWithInternalRect:(CGRect)internalRect; - -- (CGPoint)offsetPointWithInternalPoint:(CGPoint)internalPoint; - -- (CGPoint)offsetPointWithExternalPoint:(CGPoint)externalPoint; - -/** - * @abstract draws the shadow for text in the provided CGContext - * @discussion Call within the text node's +drawRect method - */ -- (void)setShadowInContext:(CGContextRef)context; - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.mm deleted file mode 100644 index a2f37f7e..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitShadower.mm +++ /dev/null @@ -1,177 +0,0 @@ -// -// ASTextKitShadower.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -static inline CGSize _insetSize(CGSize size, UIEdgeInsets insets) -{ - size.width -= (insets.left + insets.right); - size.height -= (insets.top + insets.bottom); - return size; -} - -static inline UIEdgeInsets _invertInsets(UIEdgeInsets insets) -{ - return { - .top = -insets.top, - .left = -insets.left, - .bottom = -insets.bottom, - .right = -insets.right - }; -} - -@implementation ASTextKitShadower { - UIEdgeInsets _calculatedShadowPadding; -} - -+ (ASTextKitShadower *)shadowerWithShadowOffset:(CGSize)shadowOffset - shadowColor:(UIColor *)shadowColor - shadowOpacity:(CGFloat)shadowOpacity - shadowRadius:(CGFloat)shadowRadius -{ - /** - * For all cases where no shadow is drawn, we share this singleton shadower to save resources. - */ - static dispatch_once_t onceToken; - static ASTextKitShadower *sharedNonShadower; - dispatch_once(&onceToken, ^{ - sharedNonShadower = [[ASTextKitShadower alloc] initWithShadowOffset:CGSizeZero shadowColor:nil shadowOpacity:0 shadowRadius:0]; - }); - - BOOL hasShadow = shadowOpacity > 0 && (shadowRadius > 0 || CGSizeEqualToSize(shadowOffset, CGSizeZero) == NO) && CGColorGetAlpha(shadowColor.CGColor) > 0; - if (hasShadow == NO) { - return sharedNonShadower; - } else { - return [[ASTextKitShadower alloc] initWithShadowOffset:shadowOffset shadowColor:shadowColor shadowOpacity:shadowOpacity shadowRadius:shadowRadius]; - } -} - -- (instancetype)initWithShadowOffset:(CGSize)shadowOffset - shadowColor:(UIColor *)shadowColor - shadowOpacity:(CGFloat)shadowOpacity - shadowRadius:(CGFloat)shadowRadius -{ - if (self = [super init]) { - _shadowOffset = shadowOffset; - _shadowColor = shadowColor; - _shadowOpacity = shadowOpacity; - _shadowRadius = shadowRadius; - _calculatedShadowPadding = UIEdgeInsetsMake(-INFINITY, -INFINITY, INFINITY, INFINITY); - } - return self; -} - -/* - * This method is duplicated here because it gets called frequently, and we were - * wasting valuable time constructing a state object to ask it. - */ -- (BOOL)_shouldDrawShadow -{ - return _shadowOpacity != 0.0 && (_shadowRadius != 0 || !CGSizeEqualToSize(_shadowOffset, CGSizeZero)) && CGColorGetAlpha(_shadowColor.CGColor) > 0; -} - -- (void)setShadowInContext:(CGContextRef)context -{ - if ([self _shouldDrawShadow]) { - CGColorRef textShadowColor = CGColorRetain(_shadowColor.CGColor); - CGSize textShadowOffset = _shadowOffset; - CGFloat textShadowOpacity = _shadowOpacity; - CGFloat textShadowRadius = _shadowRadius; - - if (textShadowOpacity != 1.0) { - CGFloat inherentAlpha = CGColorGetAlpha(textShadowColor); - - CGColorRef oldTextShadowColor = textShadowColor; - textShadowColor = CGColorCreateCopyWithAlpha(textShadowColor, inherentAlpha * textShadowOpacity); - CGColorRelease(oldTextShadowColor); - } - - CGContextSetShadowWithColor(context, textShadowOffset, textShadowRadius, textShadowColor); - - CGColorRelease(textShadowColor); - } -} - - -- (UIEdgeInsets)shadowPadding -{ - if (_calculatedShadowPadding.top == -INFINITY) { - if (![self _shouldDrawShadow]) { - return UIEdgeInsetsZero; - } - - UIEdgeInsets shadowPadding = UIEdgeInsetsZero; - - // min values are expected to be negative for most typical shadowOffset and - // blurRadius settings: - shadowPadding.top = std::fmin(0.0f, _shadowOffset.height - _shadowRadius); - shadowPadding.left = std::fmin(0.0f, _shadowOffset.width - _shadowRadius); - - shadowPadding.bottom = std::fmin(0.0f, -_shadowOffset.height - _shadowRadius); - shadowPadding.right = std::fmin(0.0f, -_shadowOffset.width - _shadowRadius); - - _calculatedShadowPadding = shadowPadding; - } - - return _calculatedShadowPadding; -} - -- (CGSize)insetSizeWithConstrainedSize:(CGSize)constrainedSize -{ - return _insetSize(constrainedSize, _invertInsets([self shadowPadding])); -} - -- (CGRect)insetRectWithConstrainedRect:(CGRect)constrainedRect -{ - return UIEdgeInsetsInsetRect(constrainedRect, _invertInsets([self shadowPadding])); -} - -- (CGSize)outsetSizeWithInsetSize:(CGSize)insetSize -{ - return _insetSize(insetSize, [self shadowPadding]); -} - -- (CGRect)outsetRectWithInsetRect:(CGRect)insetRect -{ - return UIEdgeInsetsInsetRect(insetRect, [self shadowPadding]); -} - -- (CGRect)offsetRectWithInternalRect:(CGRect)internalRect -{ - return (CGRect){ - .origin = [self offsetPointWithInternalPoint:internalRect.origin], - .size = internalRect.size - }; -} - -- (CGPoint)offsetPointWithInternalPoint:(CGPoint)internalPoint -{ - UIEdgeInsets shadowPadding = [self shadowPadding]; - return (CGPoint){ - internalPoint.x + shadowPadding.left, - internalPoint.y + shadowPadding.top - }; -} - -- (CGPoint)offsetPointWithExternalPoint:(CGPoint)externalPoint -{ - UIEdgeInsets shadowPadding = [self shadowPadding]; - return (CGPoint){ - externalPoint.x - shadowPadding.left, - externalPoint.y - shadowPadding.top - }; -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.h b/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.h deleted file mode 100644 index 70734d9e..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ASTextKitTailTruncater.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -AS_SUBCLASSING_RESTRICTED -@interface ASTextKitTailTruncater : NSObject - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.mm b/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.mm deleted file mode 100644 index 0fd8a1c9..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitTailTruncater.mm +++ /dev/null @@ -1,197 +0,0 @@ -// -// ASTextKitTailTruncater.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -@implementation ASTextKitTailTruncater -{ - __weak ASTextKitContext *_context; - NSAttributedString *_truncationAttributedString; - NSCharacterSet *_avoidTailTruncationSet; -} -@synthesize visibleRanges = _visibleRanges; - -- (instancetype)initWithContext:(ASTextKitContext *)context - truncationAttributedString:(NSAttributedString *)truncationAttributedString - avoidTailTruncationSet:(NSCharacterSet *)avoidTailTruncationSet -{ - if (self = [super init]) { - _context = context; - _truncationAttributedString = truncationAttributedString; - _avoidTailTruncationSet = avoidTailTruncationSet; - } - return self; -} - -/** - Calculates the intersection of the truncation message within the end of the last line. - */ -- (NSUInteger)_calculateCharacterIndexBeforeTruncationMessage:(NSLayoutManager *)layoutManager - textStorage:(NSTextStorage *)textStorage - textContainer:(NSTextContainer *)textContainer -{ - CGRect constrainedRect = (CGRect){ .size = textContainer.size }; - - NSRange visibleGlyphRange = [layoutManager glyphRangeForBoundingRect:constrainedRect - inTextContainer:textContainer]; - NSInteger lastVisibleGlyphIndex = (NSMaxRange(visibleGlyphRange) - 1); - - if (lastVisibleGlyphIndex < 0) { - return NSNotFound; - } - - CGRect lastLineRect = [layoutManager lineFragmentRectForGlyphAtIndex:lastVisibleGlyphIndex - effectiveRange:NULL]; - CGRect lastLineUsedRect = [layoutManager lineFragmentUsedRectForGlyphAtIndex:lastVisibleGlyphIndex - effectiveRange:NULL]; - NSParagraphStyle *paragraphStyle = [textStorage attributesAtIndex:[layoutManager characterIndexForGlyphAtIndex:lastVisibleGlyphIndex] - effectiveRange:NULL][NSParagraphStyleAttributeName]; - - // We assume LTR so long as the writing direction is not - BOOL rtlWritingDirection = paragraphStyle ? paragraphStyle.baseWritingDirection == NSWritingDirectionRightToLeft : NO; - // We only want to treat the truncation rect as left-aligned in the case that we are right-aligned and our writing - // direction is RTL. - BOOL leftAligned = CGRectGetMinX(lastLineRect) == CGRectGetMinX(lastLineUsedRect) || !rtlWritingDirection; - - // Calculate the bounding rectangle for the truncation message - ASTextKitContext *truncationContext = [[ASTextKitContext alloc] initWithAttributedString:_truncationAttributedString - tintColor:nil - lineBreakMode:NSLineBreakByWordWrapping - maximumNumberOfLines:1 - exclusionPaths:nil - constrainedSize:constrainedRect.size]; - __block CGRect truncationUsedRect; - - [truncationContext performBlockWithLockedTextKitComponents:^(NSLayoutManager *truncationLayoutManager, NSTextStorage *truncationTextStorage, NSTextContainer *truncationTextContainer) { - // Size the truncation message - [truncationLayoutManager ensureLayoutForTextContainer:truncationTextContainer]; - NSRange truncationGlyphRange = [truncationLayoutManager glyphRangeForTextContainer:truncationTextContainer]; - truncationUsedRect = [truncationLayoutManager boundingRectForGlyphRange:truncationGlyphRange - inTextContainer:truncationTextContainer]; - }]; - CGFloat truncationOriginX = (leftAligned ? - CGRectGetMaxX(constrainedRect) - truncationUsedRect.size.width : - CGRectGetMinX(constrainedRect)); - CGRect translatedTruncationRect = CGRectMake(truncationOriginX, - CGRectGetMinY(lastLineRect), - truncationUsedRect.size.width, - truncationUsedRect.size.height); - - // Determine which glyph is the first to be clipped / overlaps the truncation message. - CGFloat truncationMessageX = (leftAligned ? - CGRectGetMinX(translatedTruncationRect) : - CGRectGetMaxX(translatedTruncationRect)); - CGPoint beginningOfTruncationMessage = CGPointMake(truncationMessageX, - CGRectGetMidY(translatedTruncationRect)); - NSUInteger firstClippedGlyphIndex = [layoutManager glyphIndexForPoint:beginningOfTruncationMessage - inTextContainer:textContainer - fractionOfDistanceThroughGlyph:NULL]; - // If it didn't intersect with any text then it should just return the last visible character index, since the - // truncation rect can fully fit on the line without clipping any other text. - if (firstClippedGlyphIndex == NSNotFound) { - return [layoutManager characterIndexForGlyphAtIndex:lastVisibleGlyphIndex]; - } - NSUInteger firstCharacterIndexToReplace = [layoutManager characterIndexForGlyphAtIndex:firstClippedGlyphIndex]; - - // Break on word boundaries - return [self _findTruncationInsertionPointAtOrBeforeCharacterIndex:firstCharacterIndexToReplace - layoutManager:layoutManager - textStorage:textStorage]; -} - -/** - Finds the first whitespace at or before the character index do we don't truncate in the middle of words - If there are multiple whitespaces together (say a space and a newline), this will backtrack to the first one - */ -- (NSUInteger)_findTruncationInsertionPointAtOrBeforeCharacterIndex:(NSUInteger)firstCharacterIndexToReplace - layoutManager:(NSLayoutManager *)layoutManager - textStorage:(NSTextStorage *)textStorage -{ - // Don't attempt to truncate beyond the end of the string - if (firstCharacterIndexToReplace >= textStorage.length) { - return 0; - } - - // Find the glyph range of the line fragment containing the first character to replace. - NSRange lineGlyphRange; - [layoutManager lineFragmentRectForGlyphAtIndex:[layoutManager glyphIndexForCharacterAtIndex:firstCharacterIndexToReplace] - effectiveRange:&lineGlyphRange]; - - // Look for the first whitespace from the end of the line, starting from the truncation point - NSUInteger startingSearchIndex = [layoutManager characterIndexForGlyphAtIndex:lineGlyphRange.location]; - NSUInteger endingSearchIndex = firstCharacterIndexToReplace; - NSRange rangeToSearch = NSMakeRange(startingSearchIndex, (endingSearchIndex - startingSearchIndex)); - - NSRange rangeOfLastVisibleAvoidedChars = { .location = NSNotFound }; - if (_avoidTailTruncationSet) { - rangeOfLastVisibleAvoidedChars = [textStorage.string rangeOfCharacterFromSet:_avoidTailTruncationSet - options:NSBackwardsSearch - range:rangeToSearch]; - } - - // Couldn't find a good place to truncate. Might be because there is no whitespace in the text, or we're dealing - // with a foreign language encoding. Settle for truncating at the original place, which may be mid-word. - if (rangeOfLastVisibleAvoidedChars.location == NSNotFound) { - return firstCharacterIndexToReplace; - } else { - return rangeOfLastVisibleAvoidedChars.location; - } -} - -- (void)truncate -{ - [_context performBlockWithLockedTextKitComponents:^(NSLayoutManager *layoutManager, NSTextStorage *textStorage, NSTextContainer *textContainer) { - NSUInteger originalStringLength = textStorage.length; - - [layoutManager ensureLayoutForTextContainer:textContainer]; - - NSRange visibleGlyphRange = [layoutManager glyphRangeForBoundingRect:{ .size = textContainer.size } - inTextContainer:textContainer]; - NSRange visibleCharacterRange = [layoutManager characterRangeForGlyphRange:visibleGlyphRange - actualGlyphRange:NULL]; - - // Check if text is truncated, and if so apply our truncation string - if (visibleCharacterRange.length < originalStringLength && self->_truncationAttributedString.length > 0) { - NSInteger firstCharacterIndexToReplace = [self _calculateCharacterIndexBeforeTruncationMessage:layoutManager - textStorage:textStorage - textContainer:textContainer]; - if (firstCharacterIndexToReplace == 0 || firstCharacterIndexToReplace == NSNotFound) { - return; - } - - // Update/truncate the visible range of text - visibleCharacterRange = NSMakeRange(0, firstCharacterIndexToReplace); - NSRange truncationReplacementRange = NSMakeRange(firstCharacterIndexToReplace, - textStorage.length - firstCharacterIndexToReplace); - // Replace the end of the visible message with the truncation string - [textStorage replaceCharactersInRange:truncationReplacementRange - withAttributedString:self->_truncationAttributedString]; - } - - self->_visibleRanges = { visibleCharacterRange }; - }]; -} - -- (NSRange)firstVisibleRange -{ - std::vector visibleRanges = _visibleRanges; - if (visibleRanges.size() > 0) { - return visibleRanges[0]; - } - - return NSMakeRange(NSNotFound, 0); -} - -@end - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextKitTruncating.h b/Example/Pods/Texture/Source/TextKit/ASTextKitTruncating.h deleted file mode 100644 index 35392fd6..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextKitTruncating.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// ASTextKitTruncating.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#if AS_ENABLE_TEXTNODE - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class ASTextKitContext; - -@protocol ASTextKitTruncating - -/** - The character range from the original attributedString that is displayed by the renderer given the parameters in the - initializer. - */ -@property (nonatomic, readonly) std::vector visibleRanges; - -/** - Returns the first visible range or an NSRange with location of NSNotFound and size of 0 if no first visible - range exists - */ -@property (nonatomic, readonly) NSRange firstVisibleRange; - -/** - A truncater object is initialized with the full state of the text. It is a Single Responsibility Object that is - mutative. It configures the state of the TextKit components (layout manager, text container, text storage) to achieve - the intended truncation, then it stores the resulting state for later fetching. - - The truncater may mutate the state of the text storage such that only the drawn string is actually present in the - text storage itself. - - The truncater should not store a strong reference to the context to prevent retain cycles. - */ -- (instancetype)initWithContext:(ASTextKitContext *)context - truncationAttributedString:(NSAttributedString * _Nullable)truncationAttributedString - avoidTailTruncationSet:(NSCharacterSet * _Nullable)avoidTailTruncationSet; - -/** - Actually do the truncation. - */ -- (void)truncate; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Example/Pods/Texture/Source/TextKit/ASTextNodeTypes.h b/Example/Pods/Texture/Source/TextKit/ASTextNodeTypes.h deleted file mode 100644 index 694d9ca7..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextNodeTypes.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ASTextNodeTypes.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#pragma once - -// Use this attribute name to add "word kerning" -static NSString *const ASTextNodeWordKerningAttributeName = @"ASAttributedStringWordKerning"; diff --git a/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.h b/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.h deleted file mode 100644 index 795c4ea0..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ASTextNodeWordKerner.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - @abstract This class acts as the NSLayoutManagerDelegate for ASTextNode. - @discussion Its current job is word kerning, i.e. adjusting the width of spaces to match the set - wordKernedSpaceWidth. If word kerning is not needed, set the layoutManager's delegate to nil. - */ -AS_SUBCLASSING_RESTRICTED -@interface ASTextNodeWordKerner : NSObject - -/** - The following @optional NSLayoutManagerDelegate methods are implemented: - -- (NSUInteger)layoutManager:(NSLayoutManager *)layoutManager shouldGenerateGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)props characterIndexes:(const NSUInteger *)charIndexes font:(UIFont *)aFont forGlyphRange:(NSRange)glyphRange NS_AVAILABLE_IOS(7_0); - -- (NSControlCharacterAction)layoutManager:(NSLayoutManager *)layoutManager shouldUseAction:(NSControlCharacterAction)action forControlCharacterAtIndex:(NSUInteger)charIndex NS_AVAILABLE_IOS(7_0); - -- (CGRect)layoutManager:(NSLayoutManager *)layoutManager boundingBoxForControlGlyphAtIndex:(NSUInteger)glyphIndex forTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(CGRect)proposedRect glyphPosition:(CGPoint)glyphPosition characterIndex:(NSUInteger)charIndex NS_AVAILABLE_IOS(7_0); - */ - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.mm b/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.mm deleted file mode 100644 index 67e64055..00000000 --- a/Example/Pods/Texture/Source/TextKit/ASTextNodeWordKerner.mm +++ /dev/null @@ -1,130 +0,0 @@ -// -// ASTextNodeWordKerner.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -#import - -@implementation ASTextNodeWordKerner - -#pragma mark - NSLayoutManager Delegate -- (NSUInteger)layoutManager:(NSLayoutManager *)layoutManager shouldGenerateGlyphs:(const CGGlyph *)glyphs properties:(const NSGlyphProperty *)properties characterIndexes:(const NSUInteger *)characterIndexes font:(UIFont *)aFont forGlyphRange:(NSRange)glyphRange -{ - NSUInteger glyphCount = glyphRange.length; - NSGlyphProperty *newGlyphProperties = NULL; - - BOOL usesWordKerning = NO; - - // If our typing attributes specify word kerning, specify the spaces as whitespace control characters so we can customize their width. - // Are any of the characters spaces? - NSString *textStorageString = layoutManager.textStorage.string; - for (NSUInteger arrayIndex = 0; arrayIndex < glyphCount; arrayIndex++) { - NSUInteger characterIndex = characterIndexes[arrayIndex]; - if ([textStorageString characterAtIndex:characterIndex] != ' ') - continue; - - // If we've set the whitespace control character for this space already, we have nothing to do. - if (properties[arrayIndex] == NSGlyphPropertyControlCharacter) { - usesWordKerning = YES; - continue; - } - - // Create new glyph properties, if necessary. - if (!newGlyphProperties) { - newGlyphProperties = (NSGlyphProperty *)malloc(sizeof(NSGlyphProperty) * glyphCount); - memcpy(newGlyphProperties, properties, (sizeof(NSGlyphProperty) * glyphCount)); - } - - // It's a space. Make it a whitespace control character. - newGlyphProperties[arrayIndex] = NSGlyphPropertyControlCharacter; - } - - // If we don't have any custom glyph properties, return 0 to indicate to the layout manager that it should use the standard glyphs+properties. - if (!newGlyphProperties) { - if (usesWordKerning) { - // If the text does use word kerning we have to make sure we return the correct glyphCount, or the layout manager will just use the default properties and ignore our kerning. - [layoutManager setGlyphs:glyphs properties:properties characterIndexes:characterIndexes font:aFont forGlyphRange:glyphRange]; - return glyphCount; - } else { - return 0; - } - } - - // Otherwise, use our custom glyph properties. - [layoutManager setGlyphs:glyphs properties:newGlyphProperties characterIndexes:characterIndexes font:aFont forGlyphRange:glyphRange]; - free(newGlyphProperties); - - return glyphCount; -} - -- (NSControlCharacterAction)layoutManager:(NSLayoutManager *)layoutManager shouldUseAction:(NSControlCharacterAction)defaultAction forControlCharacterAtIndex:(NSUInteger)characterIndex -{ - // If it's a space character and we have custom word kerning, use the whitespace action control character. - if ([layoutManager.textStorage.string characterAtIndex:characterIndex] == ' ') - return NSControlCharacterActionWhitespace; - - return defaultAction; -} - -- (CGRect)layoutManager:(NSLayoutManager *)layoutManager boundingBoxForControlGlyphAtIndex:(NSUInteger)glyphIndex forTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(CGRect)proposedRect glyphPosition:(CGPoint)glyphPosition characterIndex:(NSUInteger)characterIndex -{ - CGFloat wordKernedSpaceWidth = [self _wordKernedSpaceWidthForCharacterAtIndex:characterIndex atGlyphPosition:glyphPosition forTextContainer:textContainer layoutManager:layoutManager]; - return CGRectMake(glyphPosition.x, glyphPosition.y, wordKernedSpaceWidth, CGRectGetHeight(proposedRect)); -} - -- (CGFloat)_wordKernedSpaceWidthForCharacterAtIndex:(NSUInteger)characterIndex atGlyphPosition:(CGPoint)glyphPosition forTextContainer:(NSTextContainer *)textContainer layoutManager:(NSLayoutManager *)layoutManager -{ - // We use a map table for pointer equality and non-copying keys. - static NSMapTable *spaceSizes; - // NSMapTable is a defined thread unsafe class, so we need to synchronize - // access in a light manner. So we use dispatch_sync on this queue for all - // access to the map table. - static dispatch_queue_t mapQueue; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - spaceSizes = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:1]; - mapQueue = dispatch_queue_create("org.AsyncDisplayKit.wordKerningQueue", DISPATCH_QUEUE_SERIAL); - }); - CGFloat ordinarySpaceWidth; - UIFont *font = [layoutManager.textStorage attribute:NSFontAttributeName atIndex:characterIndex effectiveRange:NULL]; - CGFloat wordKerning = [[layoutManager.textStorage attribute:ASTextNodeWordKerningAttributeName atIndex:characterIndex effectiveRange:NULL] floatValue]; - __block NSNumber *ordinarySpaceSizeValue; - dispatch_sync(mapQueue, ^{ - ordinarySpaceSizeValue = [spaceSizes objectForKey:font]; - }); - if (ordinarySpaceSizeValue == nil) { - ordinarySpaceWidth = [@" " sizeWithAttributes:@{ NSFontAttributeName : font }].width; - dispatch_async(mapQueue, ^{ - [spaceSizes setObject:@(ordinarySpaceWidth) forKey:font]; - }); - } else { - ordinarySpaceWidth = [ordinarySpaceSizeValue floatValue]; - } - - CGFloat totalKernedWidth = (ordinarySpaceWidth + wordKerning); - - // TextKit normally handles whitespace by increasing the advance of the previous glyph, rather than displaying an - // actual glyph for the whitespace itself. However, in order to implement word kerning, we explicitly require a - // discrete glyph whose bounding box we can specify. The problem is that TextKit does not know this glyph is - // invisible. From TextKit's perspective, this whitespace glyph is a glyph that MUST be displayed. Thus when it - // comes to determining linebreaks, the width of this trailing whitespace glyph is considered. This causes - // our text to wrap sooner than it otherwise would, as room is allocated at the end of each line for a glyph that - // isn't actually visible. To implement our desired behavior, we check to see if the current whitespace glyph - // would break to the next line. If it breaks to the next line, then this constitutes trailing whitespace, and - // we specify enough room to fill up the remainder of the line, but nothing more. - if (glyphPosition.x + totalKernedWidth > textContainer.size.width) { - return (textContainer.size.width - glyphPosition.x); - } - - return totalKernedWidth; -} - -@end diff --git a/Example/Pods/Texture/Source/UIImage+ASConvenience.h b/Example/Pods/Texture/Source/UIImage+ASConvenience.h deleted file mode 100644 index e662a6a5..00000000 --- a/Example/Pods/Texture/Source/UIImage+ASConvenience.h +++ /dev/null @@ -1,162 +0,0 @@ -// -// UIImage+ASConvenience.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * Dramatically faster version of +[UIImage imageNamed:]. Although it is believed that imageNamed: - * has a cache and is fast, it actually performs expensive asset catalog lookups and is often a - * performance bottleneck (verified on iOS 7 through iOS 10). - * - * Use [UIImage as_imageNamed:] anywhere in your app, even if you aren't using other parts of ASDK. - * Although not the best choice for extremely large assets that are only used once, it is the ideal - * choice for any assets used in tab bars, nav bars, buttons, table or collection cells, etc. - */ - -@interface UIImage (ASDKFastImageNamed) - -/** - * A version of imageNamed that caches results because loading an image is expensive. - * Calling with the same name value will usually return the same object. A UIImage, - * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. - * - * @param imageName The name of the image to load - * @return The loaded image or nil - */ -+ (nullable UIImage *)as_imageNamed:(NSString *)imageName NS_RETURNS_RETAINED; - -/** - * A version of imageNamed that caches results because loading an image is expensive. - * Calling with the same name value will usually return the same object. A UIImage, - * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. - * - * @param imageName The name of the image to load - * @param traitCollection The traits associated with the intended environment for the image. - * @return The loaded image or nil - */ -+ (nullable UIImage *)as_imageNamed:(NSString *)imageName compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection NS_RETURNS_RETAINED; - -@end - -/** - * High-performance flat-colored, rounded-corner resizable images - * - * For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, - * i.e. the background color. - * For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor] - * - * See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation. - */ - -@interface UIImage (ASDKResizableRoundedRects) - -/** - * This generates a flat-color, rounded-corner resizeable image - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(nullable UIColor *)cornerColor - fillColor:(UIColor *)fillColor NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor:traitCollection: instead"); - -/** - * This generates a flat-color, rounded-corner resizeable image - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - * @param traitCollection The trait collection. - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(nullable UIColor *)cornerColor - fillColor:(UIColor *)fillColor - traitCollection:(ASPrimitiveTraitCollection) traitCollection NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * This generates a flat-color, rounded-corner resizeable image with a border - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - * @param borderColor The border color. Set to nil for no border. - * @param borderWidth The border width. Dummy value if borderColor = nil. - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(nullable UIColor *)borderColor - borderWidth:(CGFloat)borderWidth NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor:borderColor:borderWidth:traitCollection: instead"); - -/** - * This generates a flat-color, rounded-corner resizeable image with a border - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - * @param borderColor The border color. Set to nil for no border. - * @param borderWidth The border width. Dummy value if borderColor = nil. - * @param traitCollection The trait collection. - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(nullable UIColor *)borderColor - borderWidth:(CGFloat)borderWidth traitCollection:(ASPrimitiveTraitCollection) traitCollection NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -/** - * This generates a flat-color, rounded-corner resizeable image with a border - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - * @param borderColor The border color. Set to nil for no border. - * @param borderWidth The border width. Dummy value if borderColor = nil. - * @param roundedCorners Select individual or multiple corners to round. Set to UIRectCornerAllCorners to round all 4 corners. - * @param scale The number of pixels per point. Provide 0.0 to use the screen scale. - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(nullable UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(nullable UIColor *)borderColor - borderWidth:(CGFloat)borderWidth - roundedCorners:(UIRectCorner)roundedCorners - scale:(CGFloat)scale NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use as_resizableRoundedImageWithCornerRadius:cornerColor:fillColor:borderColor:borderWidth:roundedCorners:traitCollection: instead"); -; - -/** - * This generates a flat-color, rounded-corner resizeable image with a border - * - * @param cornerRadius The radius of the rounded-corner - * @param cornerColor The fill color of the corners (For Alpha corners use clearColor) - * @param fillColor The fill color of the rounded-corner image - * @param borderColor The border color. Set to nil for no border. - * @param borderWidth The border width. Dummy value if borderColor = nil. - * @param roundedCorners Select individual or multiple corners to round. Set to UIRectCornerAllCorners to round all 4 corners. - * @param scale The number of pixels per point. Provide 0.0 to use the screen scale. - * @param traitCollection The trait collection. - */ -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(nullable UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(nullable UIColor *)borderColor - borderWidth:(CGFloat)borderWidth - roundedCorners:(UIRectCorner)roundedCorners - scale:(CGFloat)scale - traitCollection:(ASPrimitiveTraitCollection) traitCollection -NS_RETURNS_RETAINED AS_WARN_UNUSED_RESULT; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/UIImage+ASConvenience.mm b/Example/Pods/Texture/Source/UIImage+ASConvenience.mm deleted file mode 100644 index cc5896b4..00000000 --- a/Example/Pods/Texture/Source/UIImage+ASConvenience.mm +++ /dev/null @@ -1,225 +0,0 @@ -// -// UIImage+ASConvenience.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import - -#pragma mark - ASDKFastImageNamed - -@implementation UIImage (ASDKFastImageNamed) - -UIImage *cachedImageNamed(NSString *imageName, UITraitCollection *traitCollection) NS_RETURNS_RETAINED -{ - static NSCache *imageCache = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // Because NSCache responds to memory warnings, we do not need an explicit limit. - // all of these objects contain compressed image data and are relatively small - // compared to the backing stores of text and image views. - imageCache = [[NSCache alloc] init]; - }); - - UIImage *image = nil; - if ([imageName length] > 0) { - NSString *imageKey = imageName; - if (traitCollection) { - char imageKeyBuffer[256]; - if (@available(iOS 12.0, tvOS 10.0, *)) { - snprintf(imageKeyBuffer, sizeof(imageKeyBuffer), "%s|%ld|%ld|%ld", imageName.UTF8String, (long)traitCollection.horizontalSizeClass, (long)traitCollection.verticalSizeClass, (long)traitCollection.userInterfaceStyle); - } else { - // Fallback on earlier versions - snprintf(imageKeyBuffer, sizeof(imageKeyBuffer), "%s|%ld|%ld", imageName.UTF8String, (long)traitCollection.horizontalSizeClass, (long)traitCollection.verticalSizeClass); - } - imageKey = [NSString stringWithUTF8String:imageKeyBuffer]; - } - - image = [imageCache objectForKey:imageKey]; - if (!image) { - image = [UIImage imageNamed:imageName inBundle:nil compatibleWithTraitCollection:traitCollection]; - if (image) { - [imageCache setObject:image forKey:imageKey]; - } - } - } - return image; -} - -+ (UIImage *)as_imageNamed:(NSString *)imageName NS_RETURNS_RETAINED -{ - return cachedImageNamed(imageName, nil); -} - -+ (UIImage *)as_imageNamed:(NSString *)imageName compatibleWithTraitCollection:(UITraitCollection *)traitCollection NS_RETURNS_RETAINED -{ - return cachedImageNamed(imageName, traitCollection); -} - -@end - -#pragma mark - ASDKResizableRoundedRects - -@implementation UIImage (ASDKResizableRoundedRects) - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor NS_RETURNS_RETAINED -{ - return [self as_resizableRoundedImageWithCornerRadius:cornerRadius - cornerColor:cornerColor - fillColor:fillColor - borderColor:nil - borderWidth:1.0 - roundedCorners:UIRectCornerAllCorners - scale:0.0]; -} - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - traitCollection:(ASPrimitiveTraitCollection) traitCollection NS_RETURNS_RETAINED -{ - return [self as_resizableRoundedImageWithCornerRadius:cornerRadius - cornerColor:cornerColor - fillColor:fillColor - borderColor:nil - borderWidth:1.0 - roundedCorners:UIRectCornerAllCorners - scale:0.0 - traitCollection:traitCollection]; -} - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(UIColor *)borderColor - borderWidth:(CGFloat)borderWidth - traitCollection:(ASPrimitiveTraitCollection) traitCollection NS_RETURNS_RETAINED { - return [self as_resizableRoundedImageWithCornerRadius:cornerRadius - cornerColor:cornerColor - fillColor:fillColor - borderColor:borderColor - borderWidth:borderWidth - roundedCorners:UIRectCornerAllCorners - scale:0.0 - traitCollection:traitCollection]; -} - - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(UIColor *)borderColor - borderWidth:(CGFloat)borderWidth NS_RETURNS_RETAINED -{ - return [self as_resizableRoundedImageWithCornerRadius:cornerRadius - cornerColor:cornerColor - fillColor:fillColor - borderColor:borderColor - borderWidth:borderWidth - roundedCorners:UIRectCornerAllCorners - scale:0.0]; -} - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(UIColor *)borderColor - borderWidth:(CGFloat)borderWidth - roundedCorners:(UIRectCorner)roundedCorners - scale:(CGFloat)scale NS_RETURNS_RETAINED { - - return [self as_resizableRoundedImageWithCornerRadius:cornerRadius - cornerColor:cornerColor - fillColor:fillColor - borderColor:borderColor - borderWidth:borderWidth - roundedCorners:roundedCorners - scale:scale - traitCollection:ASPrimitiveTraitCollectionMakeDefault()]; -} - - -+ (UIImage *)as_resizableRoundedImageWithCornerRadius:(CGFloat)cornerRadius - cornerColor:(UIColor *)cornerColor - fillColor:(UIColor *)fillColor - borderColor:(UIColor *)borderColor - borderWidth:(CGFloat)borderWidth - roundedCorners:(UIRectCorner)roundedCorners - scale:(CGFloat)scale - traitCollection:(ASPrimitiveTraitCollection) traitCollection NS_RETURNS_RETAINED -{ - static NSCache *__pathCache = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - __pathCache = [[NSCache alloc] init]; - // UIBezierPath objects are fairly small and these are equally sized. 20 should be plenty for many different parameters. - __pathCache.countLimit = 20; - }); - - // Treat clear background color as no background color - if ([cornerColor isEqual:[UIColor clearColor]]) { - cornerColor = nil; - } - - CGFloat dimension = (cornerRadius * 2) + 1; - CGRect bounds = CGRectMake(0, 0, dimension, dimension); - - typedef struct { - UIRectCorner corners; - CGFloat radius; - } PathKey; - PathKey key = { roundedCorners, cornerRadius }; - NSValue *pathKeyObject = [[NSValue alloc] initWithBytes:&key objCType:@encode(PathKey)]; - - CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius); - UIBezierPath *path = [__pathCache objectForKey:pathKeyObject]; - if (path == nil) { - path = [UIBezierPath bezierPathWithRoundedRect:bounds byRoundingCorners:roundedCorners cornerRadii:cornerRadii]; - [__pathCache setObject:path forKey:pathKeyObject]; - } - - // We should probably check if the background color has any alpha component but that - // might be expensive due to needing to check mulitple color spaces. - UIImage *result = ASGraphicsCreateImage(traitCollection, bounds.size, cornerColor != nil, scale, nil, nil, ^{ - BOOL contextIsClean = YES; - if (cornerColor) { - contextIsClean = NO; - [cornerColor setFill]; - // Copy "blend" mode is extra fast because it disregards any value currently in the buffer and overrides directly. - UIRectFillUsingBlendMode(bounds, kCGBlendModeCopy); - } - - BOOL canUseCopy = contextIsClean || (CGColorGetAlpha(fillColor.CGColor) == 1); - [fillColor setFill]; - [path fillWithBlendMode:(canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal) alpha:1]; - - if (borderColor) { - [borderColor setStroke]; - - // Inset border fully inside filled path (not halfway on each side of path) - CGRect strokeRect = CGRectInset(bounds, borderWidth / 2.0, borderWidth / 2.0); - - // It is rarer to have a stroke path, and our cache key only handles rounded rects for the exact-stretchable - // size calculated by cornerRadius, so we won't bother caching this path. Profiling validates this decision. - UIBezierPath *strokePath = [UIBezierPath bezierPathWithRoundedRect:strokeRect - byRoundingCorners:roundedCorners - cornerRadii:cornerRadii]; - [strokePath setLineWidth:borderWidth]; - BOOL canUseCopy = (CGColorGetAlpha(borderColor.CGColor) == 1); - [strokePath strokeWithBlendMode:(canUseCopy ? kCGBlendModeCopy : kCGBlendModeNormal) alpha:1]; - } - }); - - UIEdgeInsets capInsets = UIEdgeInsetsMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius); - result = [result resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch]; - - return result; -} - -@end diff --git a/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.h b/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.h deleted file mode 100644 index 17afab3a..00000000 --- a/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// UIResponder+AsyncDisplayKit.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface UIResponder (AsyncDisplayKit) - -/** - * The nearest view controller above this responder, if one exists. - * - * This property must be accessed on the main thread. - */ -@property (nonatomic, nullable, readonly) __kindof UIViewController *asdk_associatedViewController; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.mm b/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.mm deleted file mode 100644 index 957e64b0..00000000 --- a/Example/Pods/Texture/Source/UIResponder+AsyncDisplayKit.mm +++ /dev/null @@ -1,31 +0,0 @@ -// -// UIResponder+AsyncDisplayKit.m -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import "UIResponder+AsyncDisplayKit.h" - -#import -#import - -@implementation UIResponder (AsyncDisplayKit) - -- (__kindof UIViewController *)asdk_associatedViewController -{ - ASDisplayNodeAssertMainThread(); - - for (UIResponder *responder in [self asdk_responderChainEnumerator]) { - UIViewController *vc = ASDynamicCast(responder, UIViewController); - if (vc) { - return vc; - } - } - return nil; -} - -@end - diff --git a/Example/Pods/Texture/Source/_ASTransitionContext.h b/Example/Pods/Texture/Source/_ASTransitionContext.h deleted file mode 100644 index 44c4906c..00000000 --- a/Example/Pods/Texture/Source/_ASTransitionContext.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// _ASTransitionContext.h -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import - -#import - -@class ASLayout; -@class _ASTransitionContext; - -@protocol _ASTransitionContextLayoutDelegate - -- (NSArray *)currentSubnodesWithTransitionContext:(_ASTransitionContext *)context; - -- (NSArray *)insertedSubnodesWithTransitionContext:(_ASTransitionContext *)context; -- (NSArray *)removedSubnodesWithTransitionContext:(_ASTransitionContext *)context; - -- (ASLayout *)transitionContext:(_ASTransitionContext *)context layoutForKey:(NSString *)key; -- (ASSizeRange)transitionContext:(_ASTransitionContext *)context constrainedSizeForKey:(NSString *)key; - -@end - -@protocol _ASTransitionContextCompletionDelegate - -- (void)transitionContext:(_ASTransitionContext *)context didComplete:(BOOL)didComplete; - -@end - -@interface _ASTransitionContext : NSObject - -@property (nonatomic, readonly, getter=isAnimated) BOOL animated; - -- (instancetype)initWithAnimation:(BOOL)animated - layoutDelegate:(id<_ASTransitionContextLayoutDelegate>)layoutDelegate - completionDelegate:(id<_ASTransitionContextCompletionDelegate>)completionDelegate; - -@end - -@interface _ASAnimatedTransitionContext : NSObject -@property (nonatomic, readonly) ASDisplayNode *node; -@property (nonatomic, readonly) CGFloat alpha; -+ (instancetype)contextForNode:(ASDisplayNode *)node alpha:(CGFloat)alphaValue NS_RETURNS_RETAINED; -@end diff --git a/Example/Pods/Texture/Source/_ASTransitionContext.mm b/Example/Pods/Texture/Source/_ASTransitionContext.mm deleted file mode 100644 index 40a3573c..00000000 --- a/Example/Pods/Texture/Source/_ASTransitionContext.mm +++ /dev/null @@ -1,104 +0,0 @@ -// -// _ASTransitionContext.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#import -#import - - -NSString * const ASTransitionContextFromLayoutKey = @"org.asyncdisplaykit.ASTransitionContextFromLayoutKey"; -NSString * const ASTransitionContextToLayoutKey = @"org.asyncdisplaykit.ASTransitionContextToLayoutKey"; - -@interface _ASTransitionContext () - -@property (weak, nonatomic) id<_ASTransitionContextLayoutDelegate> layoutDelegate; -@property (weak, nonatomic) id<_ASTransitionContextCompletionDelegate> completionDelegate; - -@end - -@implementation _ASTransitionContext - -- (instancetype)initWithAnimation:(BOOL)animated - layoutDelegate:(id<_ASTransitionContextLayoutDelegate>)layoutDelegate - completionDelegate:(id<_ASTransitionContextCompletionDelegate>)completionDelegate -{ - self = [super init]; - if (self) { - _animated = animated; - _layoutDelegate = layoutDelegate; - _completionDelegate = completionDelegate; - } - return self; -} - -#pragma mark - ASContextTransitioning Protocol Implementation - -- (ASLayout *)layoutForKey:(NSString *)key -{ - return [_layoutDelegate transitionContext:self layoutForKey:key]; -} - -- (ASSizeRange)constrainedSizeForKey:(NSString *)key -{ - return [_layoutDelegate transitionContext:self constrainedSizeForKey:key]; -} - -- (CGRect)initialFrameForNode:(ASDisplayNode *)node -{ - return [[self layoutForKey:ASTransitionContextFromLayoutKey] frameForElement:node]; -} - -- (CGRect)finalFrameForNode:(ASDisplayNode *)node -{ - return [[self layoutForKey:ASTransitionContextToLayoutKey] frameForElement:node]; -} - -- (NSArray *)subnodesForKey:(NSString *)key -{ - NSMutableArray *subnodes = [[NSMutableArray alloc] init]; - for (ASLayout *sublayout in [self layoutForKey:key].sublayouts) { - [subnodes addObject:(ASDisplayNode *)sublayout.layoutElement]; - } - return subnodes; -} - -- (NSArray *)insertedSubnodes -{ - return [_layoutDelegate insertedSubnodesWithTransitionContext:self]; -} - -- (NSArray *)removedSubnodes -{ - return [_layoutDelegate removedSubnodesWithTransitionContext:self]; -} - -- (void)completeTransition:(BOOL)didComplete -{ - [_completionDelegate transitionContext:self didComplete:didComplete]; -} - -@end - - -@interface _ASAnimatedTransitionContext () -@property (nonatomic) ASDisplayNode *node; -@property (nonatomic) CGFloat alpha; -@end - -@implementation _ASAnimatedTransitionContext - -+ (instancetype)contextForNode:(ASDisplayNode *)node alpha:(CGFloat)alpha NS_RETURNS_RETAINED -{ - _ASAnimatedTransitionContext *context = [[_ASAnimatedTransitionContext alloc] init]; - context.node = node; - context.alpha = alpha; - return context; -} - -@end diff --git a/Example/Pods/Texture/Source/tvOS/ASControlNode+tvOS.mm b/Example/Pods/Texture/Source/tvOS/ASControlNode+tvOS.mm deleted file mode 100644 index a823d962..00000000 --- a/Example/Pods/Texture/Source/tvOS/ASControlNode+tvOS.mm +++ /dev/null @@ -1,92 +0,0 @@ -// -// ASControlNode+tvOS.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#if TARGET_OS_TV -#import -#import - -@implementation ASControlNode (tvOS) - -#pragma mark - tvOS -- (void)_pressDown -{ - [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ - [self setPressedState]; - } completion:^(BOOL finished) { - if (finished) { - [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ - [self setFocusedState]; - } completion:nil]; - } - }]; -} - -- (BOOL)canBecomeFocused -{ - return YES; -} - -- (BOOL)shouldUpdateFocusInContext:(nonnull UIFocusUpdateContext *)context -{ - return YES; -} - -- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator -{ - //FIXME: This is never valid inside an ASCellNode - if (context.nextFocusedView && context.nextFocusedView == self.view) { - //Focused - [coordinator addCoordinatedAnimations:^{ - [self setFocusedState]; - } completion:nil]; - } else{ - //Not focused - [coordinator addCoordinatedAnimations:^{ - [self setDefaultFocusAppearance]; - } completion:nil]; - } -} - -- (void)setFocusedState -{ - CALayer *layer = self.layer; - layer.shadowOffset = CGSizeMake(2, 10); - [self applyDefaultShadowProperties: layer]; - self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1); -} - -- (void)setPressedState -{ - CALayer *layer = self.layer; - layer.shadowOffset = CGSizeMake(2, 2); - [self applyDefaultShadowProperties: layer]; - self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1, 1); -} - -- (void)applyDefaultShadowProperties:(CALayer *)layer -{ - layer.shadowColor = [UIColor blackColor].CGColor; - layer.shadowRadius = 12.0; - layer.shadowOpacity = 0.45; - layer.shadowPath = [UIBezierPath bezierPathWithRect:self.layer.bounds].CGPath; -} - -- (void)setDefaultFocusAppearance -{ - CALayer *layer = self.layer; - layer.shadowOffset = CGSizeZero; - layer.shadowColor = [UIColor blackColor].CGColor; - layer.shadowRadius = 0; - layer.shadowOpacity = 0; - layer.shadowPath = [UIBezierPath bezierPathWithRect:self.layer.bounds].CGPath; - self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1, 1); -} -@end -#endif diff --git a/Example/Pods/Texture/Source/tvOS/ASImageNode+tvOS.mm b/Example/Pods/Texture/Source/tvOS/ASImageNode+tvOS.mm deleted file mode 100644 index fa760f12..00000000 --- a/Example/Pods/Texture/Source/tvOS/ASImageNode+tvOS.mm +++ /dev/null @@ -1,191 +0,0 @@ -// -// ASImageNode+tvOS.mm -// Texture -// -// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. -// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. -// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 -// - -#import -#if TARGET_OS_TV -#import -#import - -// TODO: Remove this – we don't need to link GLKit just to convert degrees to radians. -#import -#import - -#import - -@implementation ASImageNode (tvOS) - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - self.isDefaultFocusAppearance = NO; - UIView *view = [self getView]; - CALayer *layer = view.layer; - - CGSize targetShadowOffset = CGSizeMake(0.0, self.bounds.size.height/8); - [layer removeAllAnimations]; - [CATransaction begin]; - [CATransaction setCompletionBlock:^{ - layer.shadowOffset = targetShadowOffset; - }]; - - CABasicAnimation *shadowOffsetAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOffset"]; - shadowOffsetAnimation.toValue = [NSValue valueWithCGSize:targetShadowOffset]; - shadowOffsetAnimation.duration = 0.4; - shadowOffsetAnimation.removedOnCompletion = NO; - shadowOffsetAnimation.fillMode = kCAFillModeForwards; - shadowOffsetAnimation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeOut"]; - [layer addAnimation:shadowOffsetAnimation forKey:@"shadowOffset"]; - [CATransaction commit]; - - CABasicAnimation *shadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"]; - shadowOpacityAnimation.toValue = [NSNumber numberWithFloat:0.45]; - shadowOpacityAnimation.duration = 0.4; - shadowOpacityAnimation.removedOnCompletion = false; - shadowOpacityAnimation.fillMode = kCAFillModeForwards; - shadowOpacityAnimation.timingFunction = [CAMediaTimingFunction functionWithName:@"easeOut"]; - [layer addAnimation:shadowOpacityAnimation forKey:@"shadowOpacityAnimation"]; - - view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.25, 1.25); - - [CATransaction commit]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - - // TODO: Clean up, and improve visuals. - - if (!self.isDefaultFocusAppearance) { - // This view may correspond to either self.view - // or our superview if we are in a ASCellNode - UIView *view = [self getView]; - - UITouch *touch = [touches anyObject]; - // Get the specific point that was touched - - // This is quite messy in it's current state so is not ready for production. - // The reason it is here is for others to contribute and to make it clear what is occuring. - - // We get the touch location in self.view because - // we are operating in that coordinate system. - // BUT we apply our transforms to *view since we want to apply - // the transforms to the root view (L: 107) - CGPoint point = [touch locationInView:self.view]; - CGFloat pitch = 0; - CGFloat yaw = 0; - BOOL topHalf = NO; - if (point.y > CGRectGetHeight(self.view.frame)) { - pitch = 15; - } else if (point.y < -CGRectGetHeight(self.view.frame)) { - pitch = -15; - } else { - pitch = (point.y/CGRectGetHeight(self.view.frame))*15; - } - if (pitch < 0) { - topHalf = YES; - } - - if (point.x > CGRectGetWidth(self.view.frame)) { - yaw = 10; - } else if (point.x < -CGRectGetWidth(self.view.frame)) { - yaw = -10; - } else { - yaw = (point.x/CGRectGetWidth(self.view.frame))*10; - } - if (!topHalf) { - if (yaw > 0) { - yaw = -yaw; - } else { - yaw = fabs(yaw); - } - } - - CATransform3D pitchTransform = CATransform3DMakeRotation(GLKMathDegreesToRadians(pitch),1.0,0.0,0.0); - CATransform3D yawTransform = CATransform3DMakeRotation(GLKMathDegreesToRadians(yaw),0.0,1.0,0.0); - CATransform3D transform = CATransform3DConcat(pitchTransform, yawTransform); - CATransform3D scaleAndTransform = CATransform3DConcat(transform, CATransform3DMakeAffineTransform(CGAffineTransformScale(CGAffineTransformIdentity, 1.25, 1.25))); - - [UIView animateWithDuration:0.5 animations:^{ - view.layer.transform = scaleAndTransform; - }]; - } else { - [self setDefaultFocusAppearance]; - } -} - - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [self finishTouches]; -} - -- (void)finishTouches -{ - if (!self.isDefaultFocusAppearance) { - UIView *view = [self getView]; - CALayer *layer = view.layer; - - CGSize targetShadowOffset = CGSizeMake(0.0, self.bounds.size.height/8); - CATransform3D targetScaleTransform = CATransform3DMakeScale(1.2, 1.2, 1.2); - [CATransaction begin]; - [CATransaction setCompletionBlock:^{ - layer.shadowOffset = targetShadowOffset; - }]; - [CATransaction commit]; - - [UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ - view.layer.transform = targetScaleTransform; - } completion:^(BOOL finished) { - if (finished) { - [layer removeAnimationForKey:@"shadowOffset"]; - [layer removeAnimationForKey:@"shadowOpacity"]; - } - }]; - } else { - [self setDefaultFocusAppearance]; - } -} - -- (void)setFocusedState -{ - UIView *view = [self getView]; - CALayer *layer = view.layer; - layer.shadowOffset = CGSizeMake(2, 10); - layer.shadowColor = [UIColor blackColor].CGColor; - layer.shadowRadius = 12.0; - layer.shadowOpacity = 0.45; - layer.shadowPath = [UIBezierPath bezierPathWithRect:self.layer.bounds].CGPath; - view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.25, 1.25); -} - -- (void)setDefaultFocusAppearance -{ - UIView *view = [self getView]; - CALayer *layer = view.layer; - view.transform = CGAffineTransformIdentity; - layer.shadowOpacity = 0; - layer.shadowOffset = CGSizeZero; - layer.shadowRadius = 0; - layer.shadowPath = nil; - [layer removeAnimationForKey:@"shadowOffset"]; - [layer removeAnimationForKey:@"shadowOpacity"]; - self.isDefaultFocusAppearance = YES; -} - -- (UIView *)getView -{ - // TODO: This needs to be re-visited to handle all possibilities. - // If we are inside a ASCellNode, then we need to apply our focus effects to the ASCellNode view/layer rather than the ASImageNode view/layer. - return ASDisplayNodeUltimateParentOfNode(self).view; -} - -@end -#endif diff --git a/Example/QuranEngineApp.xcodeproj/project.pbxproj b/Example/QuranEngineApp.xcodeproj/project.pbxproj index 813a5431..87ee9288 100644 --- a/Example/QuranEngineApp.xcodeproj/project.pbxproj +++ b/Example/QuranEngineApp.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 83F443632E67F32978757C94 /* Pods_QuranEngineApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBF39BBA3A9CEE4575039527 /* Pods_QuranEngineApp.framework */; }; D975EDC62A4791D6009DE942 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D975EDC52A4791D6009DE942 /* AppDelegate.swift */; }; D975EDC82A4791D6009DE942 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D975EDC72A4791D6009DE942 /* SceneDelegate.swift */; }; D975EDCF2A4791D7009DE942 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D975EDCE2A4791D7009DE942 /* Assets.xcassets */; }; @@ -17,14 +16,10 @@ D975EDE72A4796AA009DE942 /* Analytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = D975EDE62A4796AA009DE942 /* Analytics.swift */; }; D975EDEA2A4799A2009DE942 /* reciters.plist in Resources */ = {isa = PBXBuildFile; fileRef = D975EDE92A4799A2009DE942 /* reciters.plist */; }; D98543D32A47C88700F477A2 /* hafs_1405 in Resources */ = {isa = PBXBuildFile; fileRef = D98543D22A47C88700F477A2 /* hafs_1405 */; }; - D98543D72A47E14200F477A2 /* FixedTextNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D98543D62A47E14200F477A2 /* FixedTextNode.m */; }; - D98543D92A47E17800F477A2 /* AsyncTextLabelImplmentation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D98543D82A47E17800F477A2 /* AsyncTextLabelImplmentation.swift */; }; D98543DD2A49095800F477A2 /* words.db in Resources */ = {isa = PBXBuildFile; fileRef = D98543DC2A49095800F477A2 /* words.db */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 4A375AACF010B2D1C89D8774 /* Pods-QuranEngineApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QuranEngineApp.debug.xcconfig"; path = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.debug.xcconfig"; sourceTree = ""; }; - 8D74650D8B96D828EB8F24A1 /* Pods-QuranEngineApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QuranEngineApp.release.xcconfig"; path = "Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp.release.xcconfig"; sourceTree = ""; }; D975EDC22A4791D6009DE942 /* QuranEngineApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuranEngineApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; D975EDC52A4791D6009DE942 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; D975EDC72A4791D6009DE942 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -37,11 +32,7 @@ D975EDE92A4799A2009DE942 /* reciters.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = reciters.plist; sourceTree = ""; }; D98543D22A47C88700F477A2 /* hafs_1405 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = hafs_1405; sourceTree = ""; }; D98543D42A47E14200F477A2 /* QuranEngineApp-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QuranEngineApp-Bridging-Header.h"; sourceTree = ""; }; - D98543D52A47E14200F477A2 /* FixedTextNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedTextNode.h; sourceTree = ""; }; - D98543D62A47E14200F477A2 /* FixedTextNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FixedTextNode.m; sourceTree = ""; }; - D98543D82A47E17800F477A2 /* AsyncTextLabelImplmentation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsyncTextLabelImplmentation.swift; sourceTree = ""; }; D98543DC2A49095800F477A2 /* words.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = words.db; sourceTree = ""; }; - DBF39BBA3A9CEE4575039527 /* Pods_QuranEngineApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_QuranEngineApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -50,7 +41,6 @@ buildActionMask = 2147483647; files = ( D975EDE22A4795BD009DE942 /* AppStructureFeature in Frameworks */, - 83F443632E67F32978757C94 /* Pods_QuranEngineApp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,7 +53,6 @@ D975EDDC2A479335009DE942 /* Packages */, D975EDC42A4791D6009DE942 /* QuranEngineApp */, D975EDC32A4791D6009DE942 /* Products */, - D975EDE02A4795BD009DE942 /* Frameworks */, F21FCED1DC6D36311F7D44C0 /* Pods */, ); sourceTree = ""; @@ -93,10 +82,7 @@ D975EDC72A4791D6009DE942 /* SceneDelegate.swift */, D975EDE42A47960D009DE942 /* Container.swift */, D975EDE62A4796AA009DE942 /* Analytics.swift */, - D98543D52A47E14200F477A2 /* FixedTextNode.h */, - D98543D62A47E14200F477A2 /* FixedTextNode.m */, D98543D42A47E14200F477A2 /* QuranEngineApp-Bridging-Header.h */, - D98543D82A47E17800F477A2 /* AsyncTextLabelImplmentation.swift */, ); path = Classes; sourceTree = ""; @@ -121,19 +107,9 @@ name = Packages; sourceTree = ""; }; - D975EDE02A4795BD009DE942 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DBF39BBA3A9CEE4575039527 /* Pods_QuranEngineApp.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; F21FCED1DC6D36311F7D44C0 /* Pods */ = { isa = PBXGroup; children = ( - 4A375AACF010B2D1C89D8774 /* Pods-QuranEngineApp.debug.xcconfig */, - 8D74650D8B96D828EB8F24A1 /* Pods-QuranEngineApp.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -145,11 +121,9 @@ isa = PBXNativeTarget; buildConfigurationList = D975EDD62A4791D7009DE942 /* Build configuration list for PBXNativeTarget "QuranEngineApp" */; buildPhases = ( - 2F5377374F8AC3E38300E6E3 /* [CP] Check Pods Manifest.lock */, D975EDBE2A4791D6009DE942 /* Sources */, D975EDBF2A4791D6009DE942 /* Frameworks */, D975EDC02A4791D6009DE942 /* Resources */, - BA153C6AB2872699CBE75F30 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -171,7 +145,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1430; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; TargetAttributes = { D975EDC12A4791D6009DE942 = { CreatedOnToolsVersion = 14.3; @@ -212,58 +186,14 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 2F5377374F8AC3E38300E6E3 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-QuranEngineApp-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - BA153C6AB2872699CBE75F30 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-QuranEngineApp/Pods-QuranEngineApp-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ D975EDBE2A4791D6009DE942 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( D975EDC62A4791D6009DE942 /* AppDelegate.swift in Sources */, - D98543D72A47E14200F477A2 /* FixedTextNode.m in Sources */, D975EDE52A47960D009DE942 /* Container.swift in Sources */, D975EDE72A4796AA009DE942 /* Analytics.swift in Sources */, - D98543D92A47E17800F477A2 /* AsyncTextLabelImplmentation.swift in Sources */, D975EDC82A4791D6009DE942 /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -318,6 +248,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -378,6 +309,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -398,7 +330,6 @@ }; D975EDD72A4791D7009DE942 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4A375AACF010B2D1C89D8774 /* Pods-QuranEngineApp.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -406,6 +337,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = MKP73M5X4A; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = QuranEngineApp/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -430,7 +362,6 @@ }; D975EDD82A4791D7009DE942 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8D74650D8B96D828EB8F24A1 /* Pods-QuranEngineApp.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -438,6 +369,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = MKP73M5X4A; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = QuranEngineApp/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; diff --git a/Example/QuranEngineApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/QuranEngineApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index dd77d61b..8d86ab05 100644 --- a/Example/QuranEngineApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/QuranEngineApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,12 +1,12 @@ { "pins" : [ { - "identity" : "downloadbutton", + "identity" : "combine-schedulers", "kind" : "remoteSourceControl", - "location" : "https://github.com/mohamede1945/DownloadButton", + "location" : "https://github.com/pointfreeco/combine-schedulers", "state" : { - "branch" : "master", - "revision" : "5ccde65b5395a3ee48203f5d490afac7da525ba5" + "revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb", + "version" : "1.0.0" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/GenericDataSource/GenericDataSource", "state" : { - "revision" : "b301a090c9fb1aa664e80f3960f0930f224ee217", - "version" : "3.1.2" + "revision" : "8b06dfd564afc80155ab0a30a2613dc8e04be1e9", + "version" : "3.1.3" } }, { @@ -63,6 +63,15 @@ "version" : "1.0.4" } }, + { + "identity" : "swift-concurrency-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-concurrency-extras", + "state" : { + "revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71", + "version" : "1.1.0" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", @@ -90,6 +99,15 @@ "version" : "1.3.7" } }, + { + "identity" : "xctest-dynamic-overlay", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", + "state" : { + "revision" : "b58e6627149808b40634c4552fcf2f44d0b3ca87", + "version" : "1.1.0" + } + }, { "identity" : "zip", "kind" : "remoteSourceControl", diff --git a/Example/QuranEngineApp.xcodeproj/xcshareddata/xcschemes/QuranEngineApp.xcscheme b/Example/QuranEngineApp.xcodeproj/xcshareddata/xcschemes/QuranEngineApp.xcscheme index fae46333..8e3e2d0b 100644 --- a/Example/QuranEngineApp.xcodeproj/xcshareddata/xcschemes/QuranEngineApp.xcscheme +++ b/Example/QuranEngineApp.xcodeproj/xcshareddata/xcschemes/QuranEngineApp.xcscheme @@ -1,6 +1,6 @@ - - - - - - diff --git a/Example/QuranEngineApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/QuranEngineApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/Example/QuranEngineApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Example/QuranEngineApp.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/QuranEngineApp.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 3b190642..00000000 --- a/Example/QuranEngineApp.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,131 +0,0 @@ -{ - "pins" : [ - { - "identity" : "combine-schedulers", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/combine-schedulers", - "state" : { - "revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb", - "version" : "1.0.0" - } - }, - { - "identity" : "genericdatasource", - "kind" : "remoteSourceControl", - "location" : "https://github.com/GenericDataSource/GenericDataSource", - "state" : { - "revision" : "8b06dfd564afc80155ab0a30a2613dc8e04be1e9", - "version" : "3.1.3" - } - }, - { - "identity" : "grdb.swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/groue/GRDB.swift", - "state" : { - "revision" : "f1f8e8438ad815086b48660ddf87c788f9abe966", - "version" : "6.21.0" - } - }, - { - "identity" : "nvactivityindicatorview", - "kind" : "remoteSourceControl", - "location" : "https://github.com/ninjaprox/NVActivityIndicatorView", - "state" : { - "revision" : "bcb52371f2259254bac6690f92bb474a61768c47", - "version" : "5.1.1" - } - }, - { - "identity" : "popover", - "kind" : "remoteSourceControl", - "location" : "https://github.com/mohamede1945/Popover", - "state" : { - "branch" : "master", - "revision" : "9641cb324d61554f7e542acb58df2eba55b3a537" - } - }, - { - "identity" : "swift-async-algorithms", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-async-algorithms", - "state" : { - "revision" : "9cfed92b026c524674ed869a4ff2dcfdeedf8a2a", - "version" : "0.1.0" - } - }, - { - "identity" : "swift-collections", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-collections", - "state" : { - "revision" : "a902f1823a7ff3c9ab2fba0f992396b948eda307", - "version" : "1.0.5" - } - }, - { - "identity" : "swift-concurrency-extras", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-concurrency-extras", - "state" : { - "revision" : "bb5059bde9022d69ac516803f4f227d8ac967f71", - "version" : "1.1.0" - } - }, - { - "identity" : "swift-log", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-log", - "state" : { - "revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed", - "version" : "1.5.3" - } - }, - { - "identity" : "swift-snapshot-testing", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/swift-snapshot-testing", - "state" : { - "revision" : "4862d48562483d274a2ac7522d905c9237a31a48", - "version" : "1.15.0" - } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036", - "version" : "509.0.2" - } - }, - { - "identity" : "whatsnewkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/SvenTiigi/WhatsNewKit.git", - "state" : { - "revision" : "92a9d6f5f6754aba0df972514fd7686f1de03bcc", - "version" : "1.3.7" - } - }, - { - "identity" : "xctest-dynamic-overlay", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", - "state" : { - "revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631", - "version" : "1.0.2" - } - }, - { - "identity" : "zip", - "kind" : "remoteSourceControl", - "location" : "https://github.com/marmelroy/Zip", - "state" : { - "revision" : "67fa55813b9e7b3b9acee9c0ae501def28746d76", - "version" : "2.1.2" - } - } - ], - "version" : 2 -} diff --git a/Example/QuranEngineApp/Classes/AppDelegate.swift b/Example/QuranEngineApp/Classes/AppDelegate.swift index 8bb44cf6..03881893 100644 --- a/Example/QuranEngineApp/Classes/AppDelegate.swift +++ b/Example/QuranEngineApp/Classes/AppDelegate.swift @@ -20,7 +20,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { FontName.registerFonts() LoggingSystem.bootstrap(StreamLogHandler.standardError) - AsyncTextLabelSystem.bootstrap(FixedTextNode.init) Task { // Eagerly load download manager to handle any background downloads. diff --git a/Example/QuranEngineApp/Classes/AsyncTextLabelImplmentation.swift b/Example/QuranEngineApp/Classes/AsyncTextLabelImplmentation.swift deleted file mode 100644 index 6e07a08d..00000000 --- a/Example/QuranEngineApp/Classes/AsyncTextLabelImplmentation.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// AsyncTextLabelImplmentation.swift -// QuranEngineApp -// -// Created by Mohamed Afifi on 2023-06-24. -// - -import NoorUI - -extension FixedTextNode: AsyncTextLabel { - public func sizeThatFits(min: CGSize, max: CGSize) -> CGSize { - layoutThatFits(ASSizeRange(min: min, max: max)).size - } -} diff --git a/Example/QuranEngineApp/Classes/Container.swift b/Example/QuranEngineApp/Classes/Container.swift index e7f2e453..e988775f 100644 --- a/Example/QuranEngineApp/Classes/Container.swift +++ b/Example/QuranEngineApp/Classes/Container.swift @@ -10,6 +10,7 @@ import AppDependencies import BatchDownloader import CoreDataModel import CoreDataPersistence +import Foundation import LastPagePersistence import NotePersistence import PageBookmarkPersistence diff --git a/Example/QuranEngineApp/Classes/FixedTextNode.h b/Example/QuranEngineApp/Classes/FixedTextNode.h deleted file mode 100644 index 47f21943..00000000 --- a/Example/QuranEngineApp/Classes/FixedTextNode.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// FixedTextNode.h -// QuranEngineApp -// -// Created by Mohamed Afifi on 2023-06-24. -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -// Workaround until https://github.com/TextureGroup/Texture/pull/1790 is merged -@interface FixedTextNode : ASTextNode - - -@property (copy, nullable) void (^onDisplayFinished)(void); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/QuranEngineApp/Classes/FixedTextNode.m b/Example/QuranEngineApp/Classes/FixedTextNode.m deleted file mode 100644 index bae87538..00000000 --- a/Example/QuranEngineApp/Classes/FixedTextNode.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// FixedTextNode.m -// QuranEngineApp -// -// Created by Mohamed Afifi on 2023-06-24. -// - -#import "FixedTextNode.h" -#import - -@interface ASDisplayNode(Private) -- (void)displayDidFinish; -@end - -@interface ASTextNode(private) -- (id)_linkAttributeValueAtPoint:(CGPoint)point - attributeName:(out NSString * __autoreleasing *)attributeNameOut - range:(out NSRange *)rangeOut - inAdditionalTruncationMessage:(out BOOL *)inAdditionalTruncationMessageOut - forHighlighting:(BOOL)highlighting; -@end - -@implementation FixedTextNode - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { - ASDisplayNodeAssertMainThread(); - ASLockScopeSelf(); - - if (!self.passthroughNonlinkTouches) { - return [super pointInside:point withEvent:event]; - } - - if (!CGRectContainsPoint(self.bounds, point)){ - return [super pointInside:point withEvent:event]; - } - - NSRange range = NSMakeRange(0, 0); - NSString *linkAttributeName = nil; - BOOL inAdditionalTruncationMessage = NO; - - id linkAttributeValue = [self _linkAttributeValueAtPoint:point - attributeName:&linkAttributeName - range:&range - inAdditionalTruncationMessage:&inAdditionalTruncationMessage - forHighlighting:YES]; - - NSUInteger lastCharIndex = NSIntegerMax; - BOOL linkCrossesVisibleRange = (lastCharIndex > range.location) && (lastCharIndex < NSMaxRange(range) - 1); - - if (self.alwaysHandleTruncationTokenTap && inAdditionalTruncationMessage) { - return YES; - } - - if (range.length > 0 && !linkCrossesVisibleRange && linkAttributeValue != nil && linkAttributeName != nil) { - return YES; - } else { - return NO; - } -} - -- (void)displayDidFinish { - [super displayDidFinish]; - if (self.onDisplayFinished) { - self.onDisplayFinished(); - } -} - -@end diff --git a/Example/QuranEngineApp/Classes/QuranEngineApp-Bridging-Header.h b/Example/QuranEngineApp/Classes/QuranEngineApp-Bridging-Header.h index 72d6f9de..e11d920b 100644 --- a/Example/QuranEngineApp/Classes/QuranEngineApp-Bridging-Header.h +++ b/Example/QuranEngineApp/Classes/QuranEngineApp-Bridging-Header.h @@ -1,5 +1,3 @@ // // Use this file to import your target's public headers that you would like to expose to Swift. // - -#import "FixedTextNode.h" diff --git a/Features/HomeFeature/HomeViewModel.swift b/Features/HomeFeature/HomeViewModel.swift index 0b148c07..a9aacf3e 100644 --- a/Features/HomeFeature/HomeViewModel.swift +++ b/Features/HomeFeature/HomeViewModel.swift @@ -121,7 +121,7 @@ final class HomeViewModel: ObservableObject { ) async -> [Quarter: String] { do { let verses = Array(quarters.map(\.firstVerse)) - let translatedVerses = try await textRetriever.textForVerses(verses, translations: []) + let translatedVerses: TranslatedVerses = try await textRetriever.textForVerses(verses, translations: []) return cleanUpText(quarters: quarters, verses: verses, versesText: translatedVerses.verses) } catch { crasher.recordError(error, reason: "Failed to retrieve quarters text") diff --git a/Features/QuranContentFeature/ContentViewController.swift b/Features/QuranContentFeature/ContentViewController.swift index e12ec8c2..8c7b1e4a 100644 --- a/Features/QuranContentFeature/ContentViewController.swift +++ b/Features/QuranContentFeature/ContentViewController.swift @@ -141,13 +141,6 @@ public final class ContentViewController: UIViewController, UIGestureRecognizerD } private struct PagesView: View { - private struct PagesId: Hashable { - let quranMode: QuranMode - let selectedTranslations: [Translation.ID] - } - - // MARK: Internal - @ObservedObject var viewModel: ContentViewModel var body: some View { @@ -159,7 +152,7 @@ private struct PagesView: View { ) { page in StaticViewControllerRepresentable(viewController: viewModel.pageViewBuilder.build(at: page)) } - .id(PagesId(quranMode: viewModel.quranMode, selectedTranslations: viewModel.selectedTranslations)) + .id(viewModel.quranMode) } } diff --git a/Features/QuranContentFeature/ContentViewModel.swift b/Features/QuranContentFeature/ContentViewModel.swift index 0e6736c1..02fc8968 100644 --- a/Features/QuranContentFeature/ContentViewModel.swift +++ b/Features/QuranContentFeature/ContentViewModel.swift @@ -62,7 +62,6 @@ public final class ContentViewModel: ObservableObject { highlights = deps.highlightsService.highlights twoPagesEnabled = deps.quranContentStatePreferences.twoPagesEnabled quranMode = deps.quranContentStatePreferences.quranMode - selectedTranslations = deps.selectedTranslationsPreferences.selectedTranslations deps.highlightsService.$highlights .sink { [weak self] in self?.highlights = $0 } @@ -73,9 +72,6 @@ public final class ContentViewModel: ObservableObject { deps.quranContentStatePreferences.$quranMode .sink { [weak self] in self?.quranMode = $0 } .store(in: &cancellables) - deps.selectedTranslationsPreferences.$selectedTranslations - .sink { [weak self] in self?.selectedTranslations = $0 } - .store(in: &cancellables) loadNotes() configureInitialPage() @@ -112,7 +108,6 @@ public final class ContentViewModel: ObservableObject { weak var listener: ContentListener? @Published var quranMode: QuranMode - @Published var selectedTranslations: [Translation.ID] @Published var twoPagesEnabled: Bool @Published var highlights: QuranHighlights { @@ -218,12 +213,12 @@ public final class ContentViewModel: ObservableObject { deps.analytics.showing( pages: pages, isTranslation: isTranslationView, - numberOfSelectedTranslations: deps.selectedTranslationsPreferences.selectedTranslations.count, + numberOfSelectedTranslations: deps.selectedTranslationsPreferences.selectedTranslationIds.count, arabicFontSize: deps.fontSizePreferences.arabicFontSize, translationFontSize: deps.fontSizePreferences.translationFontSize ) if isTranslationView { - logger.info("Using translations \(deps.selectedTranslationsPreferences.selectedTranslations)") + logger.info("Using translations \(deps.selectedTranslationsPreferences.selectedTranslationIds)") } updateLastPageTo(pages) diff --git a/Features/QuranPagesFeature/Page+Localization.swift b/Features/QuranPagesFeature/Page+Localization.swift index 413506a0..9b9081d5 100644 --- a/Features/QuranPagesFeature/Page+Localization.swift +++ b/Features/QuranPagesFeature/Page+Localization.swift @@ -12,6 +12,7 @@ import QuranTextKit import UIKit extension Page { + // TODO: Remove public func suraNames() -> NSAttributedString { let suras = verses.map(\.sura).orderedUnique() return suras.reduce(NSMutableAttributedString()) { fullString, sura in @@ -23,6 +24,27 @@ extension Page { return fullString } } + + public func suraNames() -> MultipartText { + let suras = verses.map(\.sura).orderedUnique() + let textArray = suras.map { $0.multipartSuraName() } + + var result: MultipartText = "" + for (index, text) in textArray.enumerated() { + if index == 0 { + result.append(text) + } else { + result.append(" - \(text)") + } + } + return result + } +} + +private extension Sura { + func multipartSuraName() -> MultipartText { + "\(localizedName()) \(sura: arabicSuraName)" + } } extension Page: Pageable { } diff --git a/Features/QuranTranslationFeature/ContentTranslationBuilder.swift b/Features/QuranTranslationFeature/ContentTranslationBuilder.swift index da6fd3ae..2c70f8be 100644 --- a/Features/QuranTranslationFeature/ContentTranslationBuilder.swift +++ b/Features/QuranTranslationFeature/ContentTranslationBuilder.swift @@ -8,69 +8,32 @@ import AnnotationsService import AppDependencies -import Caching -import Foundation import QuranKit import QuranPagesFeature import QuranTextKit -import ReadingService -import UIKit -import Utilities +import TranslationService public struct ContentTranslationBuilder: PageViewBuilder { - // MARK: Lifecycle + private let container: AppDependencies + private let highlightsService: QuranHighlightsService public init(container: AppDependencies, highlightsService: QuranHighlightsService) { self.container = container self.highlightsService = highlightsService - - let reading = ReadingPreferences.shared.reading - let pages = reading.quran.pages - (dataService, selectedTranslationsMonitor) = Self.createElementLoader(pages: pages, container: container) } - // MARK: Public - public func build(at page: Page) -> PageView { - ContentTranslationViewController(dataService: dataService, page: page, highlightsService: highlightsService) - } - - // MARK: Private - - private let container: AppDependencies - private let highlightsService: QuranHighlightsService - private let dataService: PagesCacheableService - private let selectedTranslationsMonitor: SelectedTranslationsMonitor - - private static func createElementLoader( - pages: [Page], - container: AppDependencies - ) -> (PagesCacheableService, SelectedTranslationsMonitor) { - let cache = Cache() - cache.countLimit = 5 - - let translationService = QuranTextDataService( + let dataService = QuranTextDataService( databasesURL: container.databasesURL, quranFileURL: container.quranUthmaniV2Database ) - let operation = { @Sendable (page: Page) in - let texts = try await translationService.textForVerses(page.verses) - let translations = Translations(texts.translations) - let translatedVerses = zip(page.verses, texts.verses).map { verse, text in - TranslatedVerse(verse: verse, text: text, translations: translations) - } - return TranslatedPage(translatedVerses: translatedVerses) - } - let service = PagesCacheableService( - cache: cache, - previousPagesCount: 1, - nextPagesCount: 2, - pages: pages, - operation: operation + let localTranslationsRetriever = LocalTranslationsRetriever(databasesURL: container.databasesURL) + let viewModel = ContentTranslationViewModel( + localTranslationsRetriever: localTranslationsRetriever, + dataService: dataService, + highlightsService: highlightsService ) - - let monitor = SelectedTranslationsMonitor(cache: cache) - return (service, monitor) + return ContentTranslationViewController(page: page, viewModel: viewModel) } } diff --git a/Features/QuranTranslationFeature/ContentTranslationView.swift b/Features/QuranTranslationFeature/ContentTranslationView.swift index 2dd89c88..219b2bc0 100644 --- a/Features/QuranTranslationFeature/ContentTranslationView.swift +++ b/Features/QuranTranslationFeature/ContentTranslationView.swift @@ -1,118 +1,74 @@ // // ContentTranslationView.swift -// Quran // -// Created by Afifi, Mohamed on 12/30/19. -// Copyright © 2019 Quran.com. All rights reserved. +// +// Created by Mohamed Afifi on 2023-12-29. // -import AnnotationsService -import Combine -import Crashing import NoorUI -import QuranAnnotations import QuranKit -import QuranTextKit -import TranslationService -import UIKit +import QuranText +import SwiftUI +import UIx import Utilities -import VLogging - -class ContentTranslationView: UIView { - // MARK: Lifecycle - init(highlightsService: QuranHighlightsService) { - self.highlightsService = highlightsService - collectionView = QuranTranslationDiffableDataSource.translationCollectionView() - dataSource = QuranTranslationDiffableDataSource(collectionView: collectionView, highlightsService: highlightsService) - super.init(frame: .zero) - setUp() - } +public struct ContentTranslationView: View { + @ObservedObject var viewModel: ContentTranslationViewModel - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") + public init(viewModel: ContentTranslationViewModel) { + self.viewModel = viewModel } - // MARK: Internal - - let collectionView: UICollectionView - - // MARK: - PageView - - var page: Page? { - didSet { - logger.info("Quran Translation: set page \(String(describing: page))") + public var body: some View { + ContentTranslationViewBody( + items: viewModel.items, + arabicFontSize: viewModel.arabicFontSize, + translationFontSize: viewModel.translationFontSize, + highlights: viewModel.highlights, + scrollToItem: viewModel.scrollToItem, + tracker: viewModel.tracker, + footnote: $viewModel.footnote, + openURL: { viewModel.openURL($0) } + ) + .task(id: Pair(viewModel.verses, viewModel.selectedTranslations)) { + await viewModel.load() } } +} - func word(at point: CGPoint) -> Word? { - fatalError("Not implemented") - } - - func verse(at point: CGPoint) -> AyahNumber? { - let localPoint = collectionView.convert(point, from: self) - let indexPath = collectionView.indexPathForItem(at: localPoint) - let cell = indexPath.flatMap { collectionView.cellForItem(at: $0) } - let translationCell = cell as? QuranTranslationBaseCollectionViewCell - return translationCell?.ayah - } - - func configure(for page: TranslatedPage) { - setPageText(page) - scrollToVerseIfNeeded() - } +private struct ContentTranslationViewBody: View { + let items: [TranslationItem] - // MARK: Private + let arabicFontSize: FontSize + let translationFontSize: FontSize + let highlights: [AyahNumber: Color] + let scrollToItem: TranslationItemId? + let tracker: CollectionTracker - private let highlightsService: QuranHighlightsService - private let dataSource: QuranTranslationDiffableDataSource - private var lastPage: TranslatedPage? - private var cancellable: AnyCancellable? + @Binding var footnote: TranslationFootnote? - private func setUp() { - addAutoLayoutSubview(collectionView) - collectionView.vc.edges() + let openURL: (TranslationURL) -> Void - cancellable = highlightsService.$highlights - .zip(highlightsService.$highlights.dropFirst()) - .sink { [weak self] oldValue, newValue in - if newValue.needsScrolling(comparingTo: oldValue) { - self?.scrollToVerseIfNeeded() + var body: some View { + ScrollViewReader { scrollView in + List { + ForEach(items) { item in + item + } + } + .listStyle(.plain) + .environment(\.defaultMinListRowHeight, 1) + .populateReadableInsets() + .openTranslationURL(openURL) + .trackCollection(with: tracker) + .sheet(item: $footnote) { $0 } + .onChange(of: scrollToItem) { scrollToItem in + if let scrollToItem { + withAnimation { + scrollView.scrollTo(scrollToItem, anchor: UnitPoint(x: 0.2, y: 0.2)) + } } } - } - - private func setPageText(_ page: TranslatedPage) { - logger.info("Quran Translation: set TranslatedPage") - if page != lastPage { - dataSource.translatedPage = page - collectionView.reloadData() - collectionView.layoutIfNeeded() - } - } - - // MARK: - share specifics - - private func scrollToVerseIfNeededSynchronously() { - logger.info("Quran Translation: scrollToVerseIfNeeded") - // layout views if needed - layoutIfNeeded() - - guard let ayah = highlightsService.highlights.firstScrollingVerse() else { - return - } - guard let indexPath = dataSource.firstIndexPath(forAyah: ayah) else { - return - } - logger.info("Quran Translation: scrollToVerseIfNeeded \(ayah), \(indexPath)") - collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: true) - } - - private func scrollToVerseIfNeeded() { - // Execute in the next runloop to allow the collection view to load. - DispatchQueue.main.async { - self.scrollToVerseIfNeededSynchronously() } } } diff --git a/Features/QuranTranslationFeature/ContentTranslationViewController.swift b/Features/QuranTranslationFeature/ContentTranslationViewController.swift index 6c5e1696..508b3087 100644 --- a/Features/QuranTranslationFeature/ContentTranslationViewController.swift +++ b/Features/QuranTranslationFeature/ContentTranslationViewController.swift @@ -6,28 +6,36 @@ // Copyright © 2020 Quran.com. All rights reserved. // -import AnnotationsService -import Caching -import Combine -import Crashing -import QuranAnnotations import QuranKit import QuranPagesFeature -import QuranTextKit -import TranslationService +import SwiftUI import UIKit -import Utilities -@MainActor +private struct ContentTranslationViewStateHolder: View { + @StateObject var viewModel: ContentTranslationViewModel + + var body: some View { + ContentTranslationView(viewModel: viewModel) + } +} + class ContentTranslationViewController: UIViewController, PageView { // MARK: Lifecycle - init(dataService: PagesCacheableService, page: Page, highlightsService: QuranHighlightsService) { - self.dataService = dataService - contentView = ContentTranslationView(highlightsService: highlightsService) + private let viewModel: ContentTranslationViewModel + + init(page: Page, viewModel: ContentTranslationViewModel) { + self.viewModel = viewModel + self.page = page super.init(nibName: nil, bundle: nil) - contentView.page = page - reloadData() + + viewModel.verses = page.verses + + let view = ContentTranslationViewStateHolder(viewModel: viewModel) + let viewController = UIHostingController(rootView: view) + viewController._disableSafeArea = true + viewController.view.backgroundColor = .clear + addFullScreenChild(viewController) } @available(*, unavailable) @@ -37,44 +45,13 @@ class ContentTranslationViewController: UIViewController, PageView { // MARK: Internal - var page: Page { - contentView.page! - } - - override func loadView() { - view = contentView - } + let page: Page func word(at point: CGPoint) -> Word? { - contentView.word(at: point) + nil } func verse(at point: CGPoint) -> AyahNumber? { - contentView.verse(at: point) - } - - // MARK: Private - - private let contentView: ContentTranslationView - private let dataService: PagesCacheableService - - private func reloadData() { - if let element = dataService.getCached(page) { - configureWithElement(element) - } else { - Task { @MainActor in - do { - let element = try await dataService.get(page) - configureWithElement(element) - } catch { - // TODO: should show error to the user - crasher.recordError(error, reason: "Failed to retrieve quran page details") - } - } - } - } - - private func configureWithElement(_ element: TranslatedPage) { - contentView.configure(for: element) + viewModel.ayahAtPoint(point, from: view) } } diff --git a/Features/QuranTranslationFeature/ContentTranslationViewModel.swift b/Features/QuranTranslationFeature/ContentTranslationViewModel.swift new file mode 100644 index 00000000..d80244a9 --- /dev/null +++ b/Features/QuranTranslationFeature/ContentTranslationViewModel.swift @@ -0,0 +1,293 @@ +// +// ContentTranslationViewModel.swift +// +// +// Created by Mohamed Afifi on 2023-12-29. +// + +import AnnotationsService +import Caching +import Combine +import Crashing +import Foundation +import QuranKit +import QuranText +import QuranTextKit +import SwiftUI +import TranslationService +import UIx +import VLogging + +@MainActor +public final class ContentTranslationViewModel: ObservableObject { + // MARK: Lifecycle + + public init( + localTranslationsRetriever: LocalTranslationsRetriever, + dataService: QuranTextDataService, + highlightsService: QuranHighlightsService + ) { + self.dataService = dataService + self.highlightsService = highlightsService + self.localTranslationsRetriever = localTranslationsRetriever + arabicFontSize = fontSizePreferences.arabicFontSize + translationFontSize = fontSizePreferences.translationFontSize + selectedTranslations = selectedTranslationsPreferences.selectedTranslationIds + highlights = highlightsService.highlights.versesByHighlights().mapValues { Color($0) } + + highlightsService.$highlights + .sink { [weak self] in self?.highlights = $0.versesByHighlights().mapValues { Color($0) } } + .store(in: &cancellables) + + highlightsService.$highlights + .zip(highlightsService.$highlights.dropFirst()) + .sink { [weak self] oldValue, newValue in + if newValue.needsScrolling(comparingTo: oldValue) { + self?.scrollToVerseIfNeeded() + } + } + .store(in: &cancellables) + + fontSizePreferences.$translationFontSize + .sink { [weak self] in self?.translationFontSize = $0 } + .store(in: &cancellables) + + fontSizePreferences.$arabicFontSize + .sink { [weak self] in self?.arabicFontSize = $0 } + .store(in: &cancellables) + + selectedTranslationsPreferences.$selectedTranslationIds + .sink { [weak self] in self?.selectedTranslations = $0 } + .store(in: &cancellables) + } + + // MARK: Public + + @Published public var showHeaderAndFooter = true + @Published public var verses: [AyahNumber] = [] + + // MARK: Internal + + let tracker = CollectionTracker() + + @Published var selectedTranslations: [Translation.ID] + @Published var translations: [Translation] = [] + @Published var verseTexts: [AyahNumber: VerseText] = [:] + @Published var expandedTranslations: [AyahNumber: [Translation: [Range]]] = [:] + + @Published var translationFontSize: FontSize + @Published var arabicFontSize: FontSize + + @Published var highlights: [AyahNumber: Color] + + @Published var footnote: TranslationFootnote? + + @Published var scrollToItem: TranslationItemId? + + var items: [TranslationItem] { + guard let page = verseTexts.first?.key.page else { + return [] + } + guard verseTexts.first?.value.translations.count == translations.count else { + return [] + } + + var items: [TranslationItem] = [] + + for (verse, verseText) in verseTexts.sorted(by: { $0.key < $1.key }) { + let color = highlights[verse] + + // Add sura name, if a new sura + if verse.sura.firstVerse == verse { + items.append(.suraName(TranslationSuraName(sura: verse.sura, arabicFontSize: arabicFontSize), color)) + } + + // Add arabic quran text + let arabicVerseNumber = NumberFormatter.arabicNumberFormatter.format(verse.ayah) + let arabicText = verseText.arabicText + " " + arabicVerseNumber + items.append(.arabicText(TranslationArabicText(verse: verse, text: arabicText, arabicFontSize: arabicFontSize), color)) + + for (index, translation) in translations.enumerated() { + let text = verseText.translations[index] + + switch text { + case .reference(let reference): + items.append( + .translationReferenceVerse( + TranslationReferenceVerse( + verse: verse, + translation: translation, + reference: reference, + translationFontSize: translationFontSize + ), color + ) + ) + case .string(let string): + let chunks: [Range] + let readMore: Bool + if let cutoffChunk = cutoffChunkIfTruncationNeeded(string.text) { + if let expandedChunks = expandedChunks(verse: verse, translation: translation) { + chunks = expandedChunks + readMore = false + } else { + chunks = [cutoffChunk] + readMore = true + } + } else { + chunks = [string.text.startIndex ..< string.text.endIndex] + readMore = false + } + + for chunkIndex in 0 ..< chunks.count { + items.append( + .translationTextChunk( + TranslationTextChunk( + verse: verse, + translation: translation, + text: string, + chunks: chunks, + chunkIndex: chunkIndex, + readMore: chunkIndex == chunks.count - 1 ? readMore : false, // Add read more to the last chunk. + translationFontSize: translationFontSize + ), color + ) + ) + } + } + + // Show translator if showing more than a single translation. + if translations.count > 1 { + items.append( + .translatorText( + TranslatorText( + verse: verse, + translation: translation, + translationFontSize: translationFontSize + ), color + ) + ) + } + } + + let isLastVerseInTheView = verses.last == verse + if !isLastVerseInTheView { + items.append(.verseSeparator(TranslationVerseSeparator(verse: verse), color)) + } + } + + if showHeaderAndFooter { + items.insert(.pageHeader(TranslationPageHeader(page: page)), at: 0) + items.append(.pageFooter(TranslationPageFooter(page: page))) + } + + return items + } + + func load() async { + do { + logger.info("Loading translations data; selectedTranslations='\(selectedTranslations)'; verses='\(verses)'") + let localTranslations = try await localTranslationsRetriever.getLocalTranslations() + translations = selectedTranslationsPreferences.selectedTranslations(from: localTranslations) + + let verses = verses + verseTexts = try await dataService.textForVerses(verses, translations: translations) + + scrollToVerseIfNeeded() + } catch { + // TODO: should show error to the user + crasher.recordError(error, reason: "Failed to retrieve quran page details") + } + } + + func openURL(_ url: TranslationURL) { + switch url { + case .footnote(let translationId, let sura, let ayah, let footnoteIndex): + setFootnoteIfNeeded(translationId: translationId, sura: sura, ayah: ayah, footnoteIndex: footnoteIndex) + + case .readMore(let translationId, let sura, let ayah): + expandTranslationIfNeeded(translationId: translationId, sura: sura, ayah: ayah) + } + } + + func ayahAtPoint(_ point: CGPoint, from: UICoordinateSpace) -> AyahNumber? { + tracker.itemAtPoint(point, from: from)?.ayah + } + + // MARK: Private + + private static let maxChunkSize = 800 + + private var cancellables: Set = [] + private let highlightsService: QuranHighlightsService + private let dataService: QuranTextDataService + private let localTranslationsRetriever: LocalTranslationsRetriever + private let selectedTranslationsPreferences = SelectedTranslationsPreferences.shared + private let fontSizePreferences = FontSizePreferences.shared + + private func cutoffChunkIfTruncationNeeded(_ string: String) -> Range? { + guard let maxUntruncatedIndex = string.index(string.startIndex, offsetBy: Self.maxChunkSize, limitedBy: string.endIndex) else { + return nil + } + let chunkEndIndex = string[.. [Range]? { + expandedTranslations[verse]?[translation] + } + + private func expandTranslationIfNeeded(translationId: Translation.ID, sura: Int, ayah: Int) { + performOnTranslationText(translationId: translationId, sura: sura, ayah: ayah) { ayah, translation, string in + if let cutoffChunk = cutoffChunkIfTruncationNeeded(string.text) { + let truncatedChunks = string.text.chunkRanges(range: cutoffChunk.upperBound ..< string.text.endIndex, maxChunkSize: Self.maxChunkSize) + expandedTranslations[ayah, default: [:]][translation] = [cutoffChunk] + truncatedChunks + } + } + } + + private func setFootnoteIfNeeded(translationId: Translation.ID, sura: Int, ayah: Int, footnoteIndex: Int) { + performOnTranslationText(translationId: translationId, sura: sura, ayah: ayah) { ayah, translation, string in + footnote = TranslationFootnote( + string: string, + footnoteIndex: footnoteIndex, + translation: translation, + translationFontSize: translationFontSize + ) + } + } + + private func performOnTranslationText(translationId: Translation.ID, sura: Int, ayah: Int, _ body: (AyahNumber, Translation, TranslationString) -> Void) { + guard let quran = verses.first?.quran else { + return + } + let ayah = AyahNumber(quran: quran, sura: sura, ayah: ayah) + let translation = translations.first { $0.id == translationId } + let translationIndex = translation.flatMap { translations.firstIndex(of: $0) } + let verseText = ayah.flatMap { ayah in verseTexts[ayah] } + if let ayah, let translation, let translationIndex, let verseText { + if case .string(let string) = verseText.translations[translationIndex] { + body(ayah, translation, string) + } + } + } + + private func scrollToVerseIfNeededSynchronously() { + guard let ayah = highlightsService.highlights.firstScrollingVerse() else { + return + } + for item in items { + if item.id.ayah == ayah { + logger.info("Quran Translation: scrollToVerseIfNeeded \(ayah)") + scrollToItem = item.id + break + } + } + } + + private func scrollToVerseIfNeeded() { + // Execute in the next runloop to allow the highlightsService value to load. + DispatchQueue.main.async { + self.scrollToVerseIfNeededSynchronously() + } + } +} diff --git a/Features/QuranTranslationFeature/QuranTranslationDiffableDataSource.swift b/Features/QuranTranslationFeature/QuranTranslationDiffableDataSource.swift deleted file mode 100644 index 3782501b..00000000 --- a/Features/QuranTranslationFeature/QuranTranslationDiffableDataSource.swift +++ /dev/null @@ -1,155 +0,0 @@ -// -// QuranTranslationDiffableDataSource.swift -// Quran -// -// Created by Mohamed Afifi on 2022-04-23. -// Copyright © 2022 Quran.com. All rights reserved. -// - -import AnnotationsService -import Foundation -import GenericDataSources -import Localization -import QuranAnnotations -import QuranKit -import QuranText -import TranslationService -import UIKit -import UIx -import VLogging - -@MainActor -public class QuranTranslationDiffableDataSource { - public struct TranslationId: Hashable, CustomStringConvertible, Sendable { - // MARK: Public - - public var description: String { - "" - } - - // MARK: Internal - - let verse: AyahNumber - let translation: Translation - } - - // MARK: Lifecycle - - // MARK: - Configuration - - init(collectionView: UICollectionView, highlightsService: QuranHighlightsService) { - self.collectionView = collectionView - cellProvider = TranslationCellProvider
(collapsedNumberOfLines: 10, highlightsService: highlightsService) - dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collectionView, indexPath, itemId in - self?.cellProvider.provideCell(collectionView: collectionView, indexPath: indexPath, itemId: itemId) - } - cellProvider.dataSource = dataSource - cellProvider.collectionView = collectionView - cellProvider.expansionHandler = TranslationExpansionHandler(dataSource: dataSource) - } - - // MARK: Public - - public enum ItemId: Hashable, Sendable { - case header(AyahNumber) - case footer(AyahNumber) - case separator(AyahNumber) - case suraName(AyahNumber) - case arabic(AyahNumber, text: String, alignment: NSTextAlignment) - case translation(TranslationId) - } - - // MARK: - Collection View - - public static func translationCollectionView() -> UICollectionView { - let size = NSCollectionLayoutSize( - widthDimension: NSCollectionLayoutDimension.fractionalWidth(1), - heightDimension: NSCollectionLayoutDimension.estimated(99) - ) - let item = NSCollectionLayoutItem(layoutSize: size) - let group = NSCollectionLayoutGroup.horizontal(layoutSize: size, subitem: item, count: 1) - - let section = NSCollectionLayoutSection(group: group) - section.contentInsets = .zero - section.interGroupSpacing = 0 - - section.contentInsetsReference = .none - let collectionViewLayout = UICollectionViewCompositionalLayout(section: section) - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewLayout) - - collectionView.backgroundColor = .clear - collectionView.contentInsetAdjustmentBehavior = .never - - collectionView.ds_register(cellClass: QuranTranslationSuraNameCollectionViewCell.self) - collectionView.ds_register(cellClass: QuranTranslationVerseSeparatorCollectionViewCell.self) - collectionView.ds_register(cellClass: QuranTranslationArabicTextCollectionViewCell.self) - collectionView.ds_register(cellClass: QuranTranslationTextCollectionViewCell.self) - collectionView.ds_register(cellClass: QuranTranslationHeaderCollectionViewCell.self) - collectionView.ds_register(cellClass: QuranTranslationFooterCollectionViewCell.self) - - return collectionView - } - - // MARK: Internal - - var translatedPage: TranslatedPage? { - didSet { - guard let translatedPage else { - fatalError("Can't set translatedPage to be nil") - } - cellProvider.translatedVerses = translatedPage.translatedVerses - updateItems(with: translatedPage) - } - } - - func firstIndexPath(forAyah ayah: AyahNumber) -> IndexPath? { - if let section = dataSource.snapshot().indexOfSection(.verse(ayah)) { - // first item in the section - return IndexPath(item: 0, section: section) - } - return nil - } - - // MARK: Private - - private enum Section: Hashable { - case header - case footer - case verse(AyahNumber) - } - - private class NoSafeAreaCollectionView: UICollectionView { - override var safeAreaInsets: UIEdgeInsets { - .zero - } - } - - private weak var collectionView: UICollectionView? - private var dataSource: UICollectionViewDiffableDataSource! // swiftlint:disable:this implicitly_unwrapped_optional - private let cellProvider: TranslationCellProvider
- - // MARK: - Data - - private func updateItems(with page: TranslatedPage) { - logger.info("Quran Translation: setting TranslatedPage") - var snapshot = NSDiffableDataSourceSnapshot() - snapshot.appendSections(.header) - snapshot.appendItems(.header(page.translatedVerses[0].verse)) - - for translatedVerse in page.translatedVerses { - let verse = translatedVerse.verse - snapshot.appendSections(.verse(verse)) - cellProvider.add(translatedVerse, to: &snapshot) - - // separator - let isLastVerse = verse.page.verses.last == verse - if !isLastVerse { - snapshot.appendItems(.separator(verse)) - } - } - - snapshot.appendSections(.footer) - snapshot.appendItems(.footer(page.translatedVerses[0].verse)) - dataSource.apply(snapshot, animatingDifferences: false) - } -} diff --git a/Features/QuranTranslationFeature/SelectedTranslationsMonitor.swift b/Features/QuranTranslationFeature/SelectedTranslationsMonitor.swift deleted file mode 100644 index 627cf2ae..00000000 --- a/Features/QuranTranslationFeature/SelectedTranslationsMonitor.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// SelectedTranslationsMonitor.swift -// -// -// Created by Mohamed Afifi on 2023-12-26. -// - -import Caching -import Combine -import QuranKit -import TranslationService - -final class SelectedTranslationsMonitor { - // MARK: Lifecycle - - init(cache: Cache) { - cancellable = selectedTranslationsPreferences.$selectedTranslations - .sink { _ in cache.removeAllObjects() } - } - - // MARK: Internal - - let selectedTranslationsPreferences = SelectedTranslationsPreferences.shared - var cancellable: AnyCancellable? -} diff --git a/Features/QuranTranslationFeature/TranslatedPage.swift b/Features/QuranTranslationFeature/TranslatedPage.swift deleted file mode 100644 index 7c748792..00000000 --- a/Features/QuranTranslationFeature/TranslatedPage.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// TranslatedPage.swift -// Quran -// -// Created by Mohamed Afifi on 2022-02-20. -// Copyright © 2022 Quran.com. All rights reserved. -// - -import Foundation -import QuranKit -import QuranText - -struct TranslatedPage: Equatable { - let translatedVerses: [TranslatedVerse] -} - -public struct TranslatedVerse: Equatable { - // MARK: Lifecycle - - public init(verse: AyahNumber, text: VerseText, translations: Translations) { - self.verse = verse - self.text = text - self.translations = translations - } - - // MARK: Public - - public let verse: AyahNumber - - // MARK: Internal - - let text: VerseText - let translations: Translations -} - -// TODO: Remove -public class Translations: Equatable, CustomStringConvertible { - // MARK: Lifecycle - - public init(_ translations: [Translation]) { - self.translations = translations - } - - // MARK: Public - - public var description: String { - "Translations: \(translations)" - } - - public static func == (lhs: Translations, rhs: Translations) -> Bool { - lhs.translations == rhs.translations - } - - // MARK: Internal - - let translations: [Translation] -} diff --git a/Features/QuranTranslationFeature/Translation+UI.swift b/Features/QuranTranslationFeature/Translation+UI.swift index af821e7b..009625ae 100644 --- a/Features/QuranTranslationFeature/Translation+UI.swift +++ b/Features/QuranTranslationFeature/Translation+UI.swift @@ -8,29 +8,11 @@ import NoorUI import QuranText -import UIKit +import SwiftUI extension Translation { - // TODO: Use SwiftUI.Font - func preferredTextFont(ofSize size: FontSize, factor: CGFloat = 1) -> UIFont { - if languageCode == "am" { - return .amharicTranslation(ofSize: size, factor: factor) - } else if languageCode == "ar" { - return .arabicTranslation(ofSize: size, factor: factor) - } else { - return .englishTranslation(ofSize: size, factor: factor) - } - } - - // TODO: Use SwiftUI.Font - func preferredTranslatorNameFont(ofSize size: FontSize) -> UIFont { - if languageCode == "am" { - return .translatorNameAmharic(ofSize: size) - } else if languageCode == "ar" { - return .translatorNameArabic(ofSize: size) - } else { - return .translatorNameEnglish(ofSize: size) - } + var textFont: Font { + languageCode == "ar" ? .arabicTafseer() : .body } var characterDirection: Locale.LanguageDirection { diff --git a/Features/QuranTranslationFeature/TranslationCellProvider.swift b/Features/QuranTranslationFeature/TranslationCellProvider.swift deleted file mode 100644 index d6b55c87..00000000 --- a/Features/QuranTranslationFeature/TranslationCellProvider.swift +++ /dev/null @@ -1,178 +0,0 @@ -// -// TranslationCellProvider.swift -// Quran -// -// Created by Mohamed Afifi on 2022-10-10. -// Copyright © 2022 Quran.com. All rights reserved. -// - -import AnnotationsService -import Combine -import Foundation -import Localization -import QuranAnnotations -import QuranText -import QuranTextKit -import UIKit - -@MainActor -public class TranslationCellProvider { - public typealias ItemId = QuranTranslationDiffableDataSource.ItemId - typealias TranslationId = QuranTranslationDiffableDataSource.TranslationId - - // MARK: Lifecycle - - public init(collapsedNumberOfLines: UInt, highlightsService: QuranHighlightsService) { - self.collapsedNumberOfLines = collapsedNumberOfLines - self.highlightsService = highlightsService - highlights = highlightsService.highlights - translationFontSize = fontSizePreferences.translationFontSize - arabicFontSize = fontSizePreferences.arabicFontSize - - highlightsService.$highlights - .sink { [weak self] in self?.highlights = $0 } - .store(in: &cancellables) - - fontSizePreferences.$translationFontSize - .sink { [weak self] in self?.translationFontSize = $0 } - .store(in: &cancellables) - - fontSizePreferences.$arabicFontSize - .sink { [weak self] in self?.arabicFontSize = $0 } - .store(in: &cancellables) - } - - // MARK: Public - - public weak var dataSource: UICollectionViewDiffableDataSource? - public weak var collectionView: UICollectionView? - - public var translatedVerses: [TranslatedVerse] = [] - public var expansionHandler: TranslationExpansionHandler
! - - public var highlights: QuranHighlights { - didSet { - reconfigureAllItems() - } - } - - public var translationFontSize: FontSize { - didSet { - reconfigureAllItems() - } - } - - public var arabicFontSize: FontSize { - didSet { - reconfigureAllItems() - } - } - - public func provideCell(collectionView: UICollectionView, indexPath: IndexPath, itemId: ItemId) -> UICollectionViewCell { - let baseCell: QuranTranslationBaseCollectionViewCell - switch itemId { - case .header(let verse): - let cell = collectionView.dequeueReusableCell(QuranTranslationHeaderCollectionViewCell.self, for: indexPath) - cell.configure(with: TranslationPageHeader(verse: verse)) - baseCell = cell - case .footer(let verse): - let cell = collectionView.dequeueReusableCell(QuranTranslationFooterCollectionViewCell.self, for: indexPath) - cell.configure(with: verse.page) - baseCell = cell - case .separator(let verse): - let cell = collectionView.dequeueReusableCell(QuranTranslationVerseSeparatorCollectionViewCell.self, for: indexPath) - cell.ayah = verse - baseCell = cell - case let .suraName(verse): - let cell = collectionView.dequeueReusableCell(QuranTranslationSuraNameCollectionViewCell.self, for: indexPath) - cell.ayah = verse - cell.configure(with: verse.sura.localizedName(withPrefix: false)) - baseCell = cell - case let .arabic(verse, text, alignment): - let cell = collectionView.dequeueReusableCell(QuranTranslationArabicTextCollectionViewCell.self, for: indexPath) - cell.ayah = verse - cell.configure(with: (text: text, alignment: alignment)) - baseCell = cell - case .translation(let translationId): - let cell = collectionView.dequeueReusableCell(QuranTranslationTextCollectionViewCell.self, for: indexPath) - cell.ayah = translationId.verse - configure(cell: cell, translationId: translationId) - baseCell = cell - } - baseCell.highlights = highlights - baseCell.translationFontSize = translationFontSize - baseCell.arabicFontSize = arabicFontSize - return baseCell - } - - public func add( - _ translatedVerse: TranslatedVerse, - to snapshot: inout NSDiffableDataSourceSnapshot - ) { - let verse = translatedVerse.verse - let verseText = translatedVerse.text - - // if a new sura - if verse.ayah == 1 { - snapshot.appendItems(.suraName(verse)) - } - - // add prefixes - snapshot.appendItems(verseText.arabicPrefix.map { .arabic(verse, text: $0, alignment: .center) }) - - // add arabic quran text - let arabicVerseNumber = NumberFormatter.arabicNumberFormatter.format(verse.ayah) - let arabicText = verseText.arabicText + " " + arabicVerseNumber - snapshot.appendItems(.arabic(verse, text: arabicText, alignment: .right)) - - // translations - snapshot.appendItems(translatedVerse.translations.translations.map { .translation(TranslationId(verse: verse, translation: $0)) }) - - // add suffixes - snapshot.appendItems(verseText.arabicSuffix.map { .arabic(verse, text: $0, alignment: .center) }) - } - - // MARK: Private - - private let collapsedNumberOfLines: UInt - private let highlightsService: QuranHighlightsService - private let fontSizePreferences = FontSizePreferences.shared - private var cancellables: Set = [] - - private func reconfigureAllItems() { - guard let dataSource else { - return - } - var snapshot = dataSource.snapshot() - // reconfigure all items - snapshot.reconfigureItems(snapshot.itemIdentifiers) - // animate font size changes - dataSource.apply(snapshot, animatingDifferences: true) - } - - private func configure(cell: QuranTranslationTextCollectionViewCell, translationId: TranslationId) { - let verse = translatedVerses.first { $0.verse == translationId.verse }! - let translationIndex = verse.translations.translations.firstIndex(of: translationId.translation)! - let translationText = verse.text.translations[translationIndex] - cell.configure(with: TranslationTextData( - collapsedNumberOfLines: collapsedNumberOfLines, - verse: translationId.verse, - translation: translationId.translation, - text: translationTextToString(translationText), - isExpanded: expansionHandler.isExpanded(translationId), - showTranslator: verse.translations.translations.count > 1, - translationTapped: { [weak self] _ in - self?.expansionHandler.translationTapped(translationId) - } - )) - } - - private func translationTextToString(_ translationText: TranslationText) -> TranslationString { - switch translationText { - case .reference(let verse): - return TranslationString(text: lFormat("translation.text.see-referenced-verse", verse.ayah), quranRanges: [], footnoteRanges: [], footnotes: []) - case .string(let string): - return string - } - } -} diff --git a/Features/QuranTranslationFeature/TranslationExpansionHandler.swift b/Features/QuranTranslationFeature/TranslationExpansionHandler.swift deleted file mode 100644 index 7a606893..00000000 --- a/Features/QuranTranslationFeature/TranslationExpansionHandler.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// TranslationExpansionHandler.swift -// Quran -// -// Created by Mohamed Afifi on 2022-10-10. -// Copyright © 2022 Quran.com. All rights reserved. -// - -import Foundation -import UIKit -import VLogging - -public class TranslationExpansionHandler { - public typealias ItemId = QuranTranslationDiffableDataSource.ItemId - typealias TranslationId = QuranTranslationDiffableDataSource.TranslationId - - // MARK: Lifecycle - - public init(dataSource: UICollectionViewDiffableDataSource) { - self.dataSource = dataSource - } - - // MARK: Internal - - func isExpanded(_ translationId: TranslationId) -> Bool { - expandedTranslations.contains(translationId) - } - - func translationTapped(_ translationId: TranslationId) { - if expandedTranslations.contains(translationId) { - logger.info("Quran Translation: Collapsing translation \(translationId)") - expandedTranslations.remove(translationId) - } else { - logger.info("Quran Translation: Expanding translation \(translationId)") - expandedTranslations.insert(translationId) - } - - let itemId: ItemId = .translation(translationId) - - var snapshot = dataSource.snapshot() - snapshot.reconfigureItems([itemId]) - dataSource.apply(snapshot, animatingDifferences: false) - } - - // MARK: Private - - private let dataSource: UICollectionViewDiffableDataSource - private var expandedTranslations: Set = [] -} diff --git a/Features/QuranTranslationFeature/TranslationFootnote.swift b/Features/QuranTranslationFeature/TranslationFootnote.swift new file mode 100644 index 00000000..5e0903bf --- /dev/null +++ b/Features/QuranTranslationFeature/TranslationFootnote.swift @@ -0,0 +1,105 @@ +// +// TranslationFootnote.swift +// +// +// Created by Mohamed Afifi on 2024-01-20. +// + +import Localization +import QuranText +import SwiftUI + +struct TranslationFootnote: View, Identifiable { + struct Id: Hashable { + let string: TranslationString + let footnoteIndex: Int + + let translation: Translation + let translationFontSize: FontSize + } + + var id: Id { Id(string: string, footnoteIndex: footnoteIndex, translation: translation, translationFontSize: translationFontSize) } + + var text: String { + let text = string.footnotes[footnoteIndex] + return text.trimmingCharacters(in: CharacterSet(charactersIn: "[]")) + } + + let string: TranslationString + let footnoteIndex: Int + + let translation: Translation + let translationFontSize: FontSize + + @Environment(\.dismiss) private var dismiss + + var body: some View { + NavigationView { + ScrollView { + Text(text) + .font(translation.textFont) + .dynamicTypeSize(translationFontSize.dynamicTypeSize) + .padding() + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + .background(Color(.reading)) + .navigationBarTitleDisplayMode(.inline) + .navigationTitle(lFormat("translation.text.footnote-title", footnoteIndex + 1)) + .toolbar { + Button { + dismiss() + } label: { + Text(l("button.done")) + .bold() + } + } + } + .sheetPresentationDetents([.medium, .large]) + } +} + +private struct TranslationFootnotePreview: View { + static let string = TranslationString( + text: "", + quranRanges: [], + footnoteRanges: [], + footnotes: ["Footnote # 1", "Footnote # 2"] + ) + + static var translation: Translation { + Translation( + id: 1, + displayName: "", + translator: "", + translatorForeign: "Khan & Hilai", + fileURL: URL(validURL: "a"), + fileName: "quran.en.khanhilali.db", + languageCode: "", + version: 5, + installedVersion: 5 + ) + } + + @State var footnote: TranslationFootnote? = buildFootnote(index: 0) + + var body: some View { + List { + ForEach(0 ..< Self.string.footnotes.count, id: \.self) { index in + Button { + footnote = Self.buildFootnote(index: index) + } label: { + Text("Footnote \(index + 1)") + } + } + } + .sheet(item: $footnote) { $0 } + } + + private static func buildFootnote(index: Int) -> TranslationFootnote { + TranslationFootnote(string: string, footnoteIndex: index, translation: translation, translationFontSize: .medium) + } +} + +#Preview { + TranslationFootnotePreview() +} diff --git a/Features/QuranTranslationFeature/TranslationItem+View.swift b/Features/QuranTranslationFeature/TranslationItem+View.swift new file mode 100644 index 00000000..f2915813 --- /dev/null +++ b/Features/QuranTranslationFeature/TranslationItem+View.swift @@ -0,0 +1,300 @@ +// +// TranslationItem+View.swift +// +// +// Created by Mohamed Afifi on 2023-12-28. +// + +import Localization +import NoorUI +import QuranKit +import QuranText +import SwiftUI + +extension TranslationPageHeader: View { + var body: some View { + HStack { + Text(page.localizedQuarterName) + Spacer() + page.suraNames() + .view(ofSize: .footnote, alignment: .trailing) + } + .readableInsetsPadding([.top, .horizontal]) + .padding(.bottom, ContentDimension.interSpacing) + } +} + +extension TranslationPageFooter: View { + var body: some View { + HStack { + Spacer() + Text(page.localizedNumber) + Spacer() + } + .padding(.top, ContentDimension.interSpacing) + .readableInsetsPadding([.bottom, .horizontal]) + } +} + +extension TranslationVerseSeparator: View { + var body: some View { + Rectangle() + .fill(Color.systemGray4) + .frame(height: 1) + .frame(maxWidth: .infinity, alignment: .trailing) + .padding(.top, ContentDimension.interSpacing) + } +} + +struct TranslationSuraNameView: View { + @ScaledMetric var bottomPadding = 5 + @ScaledMetric var topPadding = 10 + + let suraName: TranslationSuraName + + var body: some View { + VStack { + NoorImage.suraHeader.image.resizable() + .aspectRatio(contentMode: .fit) + .overlay { + Text(suraName.sura.localizedName(withPrefix: false)) + .font(.title3) + .lineLimit(1) + .minimumScaleFactor(0.3) + } + Text(suraName.sura.quran.arabicBesmAllah) + .font(.quran()) + .dynamicTypeSize(suraName.arabicFontSize.dynamicTypeSize) + } + .padding(.bottom, bottomPadding) + .padding(.top, topPadding) + .readableInsetsPadding(.horizontal) + } +} + +struct TranslationArabicTextView: View { + @ScaledMetric var bottomPadding = 5 + @ScaledMetric var topPadding = 10 + + let arabicText: TranslationArabicText + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + Text(lFormat("translation.text.ayah-number", arabicText.verse.sura.suraNumber, arabicText.verse.ayah)) + .padding(8) + .foregroundColor(.secondaryLabel) + .background( + RoundedRectangle(cornerRadius: 6) + .fill(Color.systemGray5.opacity(0.5)) + ) + + Text(arabicText.text) + .font(.quran()) + .dynamicTypeSize(arabicText.arabicFontSize.dynamicTypeSize) + .textAlignment(follows: .rightToLeft) + } + .padding(.bottom, bottomPadding) + .padding(.top, topPadding) + .readableInsetsPadding(.horizontal) + } +} + +struct TranslationTextChunkView: View { + @ScaledMetric var topPadding = 10 + @ScaledMetric var baselineOffset = 5 + + let chunk: TranslationTextChunk + + var body: some View { + Text(string) + .font(chunk.translation.textFont) + .dynamicTypeSize(chunk.translationFontSize.dynamicTypeSize) + .textAlignment(follows: chunk.translation.characterDirection) + .padding(.top, chunk.chunkIndex == 0 ? topPadding : 0) + .readableInsetsPadding(.horizontal) + } + + private var string: AttributedString { + let chunkRange = chunk.chunks[chunk.chunkIndex] + let chunkText = chunk.text.text[chunkRange] + + var string = AttributedString(chunkText) + for (index, footnoteRange) in chunk.text.footnoteRanges.enumerated() { + if let range = string.range(from: footnoteRange, overallRange: chunkRange, overallText: chunk.text.text) { + string[range].link = TranslationURL.footnote( + translationId: chunk.translation.id, + sura: chunk.verse.sura.suraNumber, + ayah: chunk.verse.ayah, + footnoteIndex: index + ).url + string[range].font = .footnote + string[range].baselineOffset = baselineOffset + } + } + + for quranRange in chunk.text.quranRanges { + if let range = string.range(from: quranRange, overallRange: chunkRange, overallText: chunk.text.text) { + string[range].foregroundColor = .accentColor + } + } + + if chunk.readMore { + var readMore = AttributedString("\n\(l("translation.text.read-more"))") + readMore.foregroundColor = .accentColor + readMore.link = TranslationURL.readMore( + translationId: chunk.translation.id, + sura: chunk.verse.sura.suraNumber, + ayah: chunk.verse.ayah + ).url + readMore.font = .body + string.append(readMore) + } + + return string + } +} + +struct TranslationReferenceVerseView: View { + @ScaledMetric var topPadding = 10 + let referenceVerse: TranslationReferenceVerse + + var body: some View { + Text(lFormat("translation.text.see-referenced-verse", referenceVerse.reference.ayah)) + .font(.body) + .dynamicTypeSize(referenceVerse.translationFontSize.dynamicTypeSize) + .textAlignment(follows: referenceVerse.translation.characterDirection) + .padding(.top, topPadding) + .readableInsetsPadding(.horizontal) + } +} + +struct TranslatorTextView: View { + @ScaledMetric var bottomPadding = 10 + let translator: TranslatorText + var body: some View { + Text(verbatim: "- \(translator.translation.translationName)") + .foregroundColor(.secondaryLabel) + .font(.body) + .dynamicTypeSize(translator.translationFontSize.dynamicTypeSize) + .textAlignment(follows: translator.translation.characterDirection) + .padding(.bottom, bottomPadding) + .readableInsetsPadding(.horizontal) + } +} + +extension TranslationItem: View { + var body: some View { + VStack { + switch self { + case .pageHeader(let pageHeader): + pageHeader + case .pageFooter(let pageFooter): + pageFooter + case .verseSeparator(let separator, _): + separator + case .suraName(let suraName, _): + TranslationSuraNameView(suraName: suraName) + case .arabicText(let arabicText, _): + TranslationArabicTextView(arabicText: arabicText) + case .translationTextChunk(let translationTextChunk, _): + TranslationTextChunkView(chunk: translationTextChunk) + case .translationReferenceVerse(let translationReferenceVerse, _): + TranslationReferenceVerseView(referenceVerse: translationReferenceVerse) + case .translatorText(let translatorText, _): + TranslatorTextView(translator: translatorText) + } + } + .font(.footnote) + .listRowSeparator(.hidden) + .listRowInsets(.zero) + .listRowBackground(Color.clear) + .background(color) + .trackingTarget(item: id) + } +} + +import NoorFont + +#Preview { + ContentTranslationPreview() +} + +private struct ContentTranslationPreview: View { + @State var readMore: Bool = true + + let quran = Quran.hafsMadani1405 + + let fontSize = FontSize.medium + + var translation: Translation { + Translation( + id: 1, + displayName: "", + translator: "", + translatorForeign: "Khan & Hilai", + fileURL: URL(validURL: "a"), + fileName: "quran.en.khanhilali.db", + languageCode: "", + version: 5, + installedVersion: 5 + ) + } + + var translationText: String { + """ + Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + """ + } + + var chunks: [Range] { + translationText.chunkRanges(maxChunkSize: 70) + } + + var body: some View { + ZStack(alignment: .bottomTrailing) { + List { + TranslationItem.pageHeader(.init(page: quran.pages[0])) + TranslationItem.suraName(.init(sura: quran.firstSura, arabicFontSize: fontSize), nil) + TranslationItem.arabicText(.init( + verse: quran.firstVerse, text: quran.arabicBesmAllah, arabicFontSize: fontSize + ), nil) + ForEach(0 ..< (readMore ? 1 : chunks.count), id: \.self) { chunkIndex in + TranslationItem.translationTextChunk( + .init( + verse: quran.firstVerse, + translation: translation, + text: .init(text: translationText, quranRanges: [], footnoteRanges: [], footnotes: []), + chunks: chunks, + chunkIndex: chunkIndex, + readMore: readMore && chunkIndex == 0, + translationFontSize: fontSize + ), nil + ) + } + TranslationItem.translatorText(.init(verse: quran.firstVerse, translation: translation, translationFontSize: fontSize), nil) + TranslationItem.verseSeparator(.init(verse: quran.firstVerse), nil) + + TranslationItem.translationReferenceVerse(.init(verse: quran.firstVerse, translation: translation, reference: quran.lastVerse, translationFontSize: .medium), nil) + TranslationItem.verseSeparator(.init(verse: quran.firstVerse), nil) + + TranslationItem.pageFooter(.init(page: quran.firstVerse.page)) + } + .listStyle(.plain) + .environment(\.defaultMinListRowHeight, 1) + .populateReadableInsets() + + Button { + readMore.toggle() + } label: { + Text("Toggle Read more") + } + .buttonStyle(.borderedProminent) + .padding() + .padding() + } + .ignoresSafeArea() + .onAppear { + FontName.registerFonts() + } + } +} diff --git a/Features/QuranTranslationFeature/TranslationItem.swift b/Features/QuranTranslationFeature/TranslationItem.swift new file mode 100644 index 00000000..f45a782b --- /dev/null +++ b/Features/QuranTranslationFeature/TranslationItem.swift @@ -0,0 +1,140 @@ +// +// TranslationItem.swift +// +// +// Created by Mohamed Afifi on 2023-12-29. +// + +import QuranKit +import QuranText +import SwiftUI + +enum TranslationItemId: Hashable, Sendable { + case pageHeader(Page) + case pageFooter(Page) + case separator(AyahNumber) + case suraName(Sura) + case arabic(AyahNumber) + case translator(AyahNumber, translationId: Translation.ID) + case translationReference(AyahNumber, translationId: Translation.ID) + case translationTextChunk(AyahNumber, translationId: Translation.ID, chunkIndex: Int) + + var ayah: AyahNumber? { + switch self { + case .pageHeader, .pageFooter: + nil + case .suraName(let sura): + sura.firstVerse + case .separator(let ayahNumber), + .arabic(let ayahNumber), + .translator(let ayahNumber, _), + .translationReference(let ayahNumber, _), + .translationTextChunk(let ayahNumber, _, _): + ayahNumber + } + } +} + +struct TranslationPageHeader: Identifiable & Hashable { + let page: Page + + var id: TranslationItemId { .pageHeader(page) } +} + +struct TranslationPageFooter: Identifiable & Hashable { + let page: Page + + var id: TranslationItemId { .pageFooter(page) } +} + +struct TranslationVerseSeparator: Identifiable & Hashable { + let verse: AyahNumber + + var id: TranslationItemId { .separator(verse) } +} + +struct TranslationSuraName: Identifiable & Hashable { + let sura: Sura + let arabicFontSize: FontSize + + var id: TranslationItemId { .suraName(sura) } +} + +struct TranslationArabicText: Identifiable & Hashable { + let verse: AyahNumber + let text: String + let arabicFontSize: FontSize + + var id: TranslationItemId { .arabic(verse) } +} + +struct TranslationTextChunk: Identifiable & Hashable { + let verse: AyahNumber + let translation: Translation + let text: TranslationString + let chunks: [Range] + let chunkIndex: Int + let readMore: Bool + + let translationFontSize: FontSize + + var id: TranslationItemId { .translationTextChunk(verse, translationId: translation.id, chunkIndex: chunkIndex) } +} + +struct TranslationReferenceVerse: Identifiable & Hashable { + let verse: AyahNumber + + let translation: Translation + let reference: AyahNumber + + let translationFontSize: FontSize + + var id: TranslationItemId { .translationReference(verse, translationId: translation.id) } +} + +struct TranslatorText: Identifiable & Hashable { + let verse: AyahNumber + let translation: Translation + + let translationFontSize: FontSize + + var id: TranslationItemId { .translator(verse, translationId: translation.id) } +} + +enum TranslationItem: Identifiable & Hashable { + case pageHeader(TranslationPageHeader) + case pageFooter(TranslationPageFooter) + case verseSeparator(TranslationVerseSeparator, Color?) + case suraName(TranslationSuraName, Color?) + case arabicText(TranslationArabicText, Color?) + case translationTextChunk(TranslationTextChunk, Color?) + case translationReferenceVerse(TranslationReferenceVerse, Color?) + case translatorText(TranslatorText, Color?) + + var id: TranslationItemId { + switch self { + case .pageHeader(let item): return item.id + case .pageFooter(let item): return item.id + case .verseSeparator(let item, _): return item.id + case .suraName(let item, _): return item.id + case .arabicText(let item, _): return item.id + case .translationTextChunk(let item, _): return item.id + case .translationReferenceVerse(let item, _): return item.id + case .translatorText(let item, _): return item.id + } + } + + var color: Color? { + switch self { + case .pageHeader, .pageFooter: + return nil + case .verseSeparator(_, let color), + .suraName(_, let color), + .arabicText(_, let color), + .translationTextChunk(_, let color), + .translationReferenceVerse(_, let color), + .translatorText(_, let color): + return color + } + } +} diff --git a/Features/QuranTranslationFeature/TranslationReadableInsets.swift b/Features/QuranTranslationFeature/TranslationReadableInsets.swift new file mode 100644 index 00000000..9bd986d7 --- /dev/null +++ b/Features/QuranTranslationFeature/TranslationReadableInsets.swift @@ -0,0 +1,53 @@ +// +// TranslationReadableInsets.swift +// +// +// Created by Mohamed Afifi on 2024-01-19. +// + +import NoorUI +import SwiftUI + +private extension EnvironmentValues { + var translationReadableInsets: EdgeInsets { + get { self[TranslationReadableInsetsKey.self] } + set { self[TranslationReadableInsetsKey.self] = newValue } + } +} + +private struct TranslationReadableInsetsKey: EnvironmentKey { + static let defaultValue = EdgeInsets() +} + +private struct TranslationReadableInsetsModifier: ViewModifier { + @State var windowSafeAreaInsets: EdgeInsets = .zero + + func body(content: Content) -> some View { + content + .readWindowSafeAreaInsets($windowSafeAreaInsets) + .environment(\.translationReadableInsets, ContentDimension.readableInsets(of: windowSafeAreaInsets)) + } +} + +private struct ReadableInsetsPadding: ViewModifier { + @Environment(\.translationReadableInsets) var readableInsets + let edges: Edge.Set + + func body(content: Content) -> some View { + content + .padding(.top, edges.contains(.top) ? readableInsets.top : 0) + .padding(.bottom, edges.contains(.bottom) ? readableInsets.bottom : 0) + .padding(.leading, edges.contains(.leading) ? readableInsets.leading : 0) + .padding(.trailing, edges.contains(.trailing) ? readableInsets.trailing : 0) + } +} + +extension View { + func populateReadableInsets() -> some View { + modifier(TranslationReadableInsetsModifier()) + } + + func readableInsetsPadding(_ edges: Edge.Set = .all) -> some View { + modifier(ReadableInsetsPadding(edges: edges)) + } +} diff --git a/Features/QuranTranslationFeature/TranslationURL.swift b/Features/QuranTranslationFeature/TranslationURL.swift new file mode 100644 index 00000000..95a18f08 --- /dev/null +++ b/Features/QuranTranslationFeature/TranslationURL.swift @@ -0,0 +1,63 @@ +// +// TranslationURL.swift +// +// +// Created by Mohamed Afifi on 2024-01-24. +// + +import Foundation +import QuranKit +import QuranText +import SwiftUI +import UIx + +enum TranslationURL: Codable { + case footnote(translationId: Translation.ID, sura: Int, ayah: Int, footnoteIndex: Int) + case readMore(translationId: Translation.ID, sura: Int, ayah: Int) + + private static let scheme = "quran-ios" + private static let host = "translationURL" + private static let data = "data" + + var url: URL { + let encoder = JSONEncoder() + let jsonData = try! encoder.encode(self) + let jsonString = String(data: jsonData, encoding: .utf8)? + .addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) + + var components = URLComponents() + components.scheme = Self.scheme + components.host = Self.host + components.queryItems = [URLQueryItem(name: Self.data, value: jsonString)] + return components.url! + } + + init?(url: URL) { + guard let components = URLComponents(url: url, resolvingAgainstBaseURL: true), + components.scheme == Self.scheme, + components.host == Self.host, + let queryItems = components.queryItems, + let dataItem = queryItems.first(where: { $0.name == Self.data }), + let dataString = dataItem.value, + let jsonData = dataString.removingPercentEncoding?.data(using: .utf8) + else { + return nil + } + + let decoder = JSONDecoder() + self = try! decoder.decode(TranslationURL.self, from: jsonData) + } +} + +extension View { + func openTranslationURL(_ openURL: @escaping (TranslationURL) -> Void) -> some View { + tryOpenURL { url in + if let translationURL = TranslationURL(url: url) { + openURL(translationURL) + return .handled + } else { + return .systemAction + } + } + } +} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationArabicTextCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationArabicTextCollectionViewCell.swift deleted file mode 100644 index 02f811f8..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationArabicTextCollectionViewCell.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// QuranTranslationArabicTextCollectionViewCell.swift -// Quran -// -// Created by Mohamed Afifi on 3/31/17. -// -// Quran for iOS is a Quran reading application for iOS. -// Copyright (C) 2017 Quran.com -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// - -import UIKit - -class QuranTranslationArabicTextCollectionViewCell: QuranTranslationItemCollectionViewCell<(text: String, alignment: NSTextAlignment)> { - // MARK: Internal - - let label = UILabel() - - override func setUp() { - label.numberOfLines = 0 - label.textColor = .label - - contentView.addAutoLayoutSubview(label) - label.vc.verticalEdges(top: Self.topPadding, bottom: Self.bottomPadding) - snapToReadableLeadingEdge(label) - snapToReadableTrailingEdge(label) - } - - override func configure(with item: (text: String, alignment: NSTextAlignment)) { - super.configure(with: item) - label.attributedText = NSAttributedString(string: item.text, attributes: [ - .font: UIFont.arabicQuranText(ofSize: arabicFontSize), - ]) - label.textAlignment = item.alignment - } - - // MARK: Private - - private static let topPadding: CGFloat = 10 - private static let bottomPadding: CGFloat = 5 -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationBaseCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationBaseCollectionViewCell.swift deleted file mode 100644 index bd60eecb..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationBaseCollectionViewCell.swift +++ /dev/null @@ -1,124 +0,0 @@ -// -// QuranTranslationBaseCollectionViewCell.swift -// Quran -// -// Created by Mohamed Afifi on 3/31/17. -// -// Quran for iOS is a Quran reading application for iOS. -// Copyright (C) 2017 Quran.com -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// - -import NoorUI -import QuranAnnotations -import QuranKit -import QuranText -import UIKit - -class QuranTranslationBaseCollectionViewCell: UICollectionViewCell { - // MARK: Lifecycle - - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override init(frame: CGRect) { - super.init(frame: frame) - setUp() - } - - // MARK: Internal - - var ayah: AyahNumber? - - var translationFontSize: FontSize = .xSmall - var arabicFontSize: FontSize = .xSmall - - var highlights = QuranHighlights() { - didSet { - let versesByHighlights = highlights.versesByHighlights() - backgroundColor = ayah.flatMap { versesByHighlights[$0] } - } - } - - func setUp() { - } - - func snapToReadableLeadingEdge(_ view: UIView) { - let insets = ContentDimension.insets(of: self) - snappedToReadableLeadingConstraints.append(view.vc.leading(by: insets.leading).constraint) - } - - func snapToReadableTrailingEdge(_ view: UIView) { - let insets = ContentDimension.insets(of: self) - snappedToReadableLeadingConstraints.append(view.vc.trailing(by: insets.trailing).constraint) - } - - override func layoutSubviews() { - super.layoutSubviews() - updateHorizontalConstraints() - } - - override func didMoveToSuperview() { - super.didMoveToSuperview() - updateHorizontalConstraints() - } - - // MARK: Private - - private var snappedToReadableLeadingConstraints: [NSLayoutConstraint] = [] - private var snappedToReadableTrailingConstraints: [NSLayoutConstraint] = [] - - private func updateHorizontalConstraints() { - let insets = ContentDimension.insets(of: self) - for constraint in snappedToReadableLeadingConstraints { - constraint.constant = insets.leading - } - for constraint in snappedToReadableTrailingConstraints { - constraint.constant = insets.trailing - } - } -} - -class QuranTranslationItemCollectionViewCell: QuranTranslationBaseCollectionViewCell { - var item: Item? - - override var arabicFontSize: FontSize { - didSet { - if arabicFontSize != oldValue { - if let item { - configure(with: item) - } - } - } - } - - override var translationFontSize: FontSize { - didSet { - if translationFontSize != oldValue { - if let item { - configure(with: item) - } - } - } - } - - override func prepareForReuse() { - super.prepareForReuse() - item = nil - } - - func configure(with item: Item) { - self.item = item - } -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationFooterCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationFooterCollectionViewCell.swift deleted file mode 100644 index 9491227d..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationFooterCollectionViewCell.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// QuranTranslationFooterCollectionViewCell.swift -// Quran -// -// Created by Afifi, Mohamed on 1/13/20. -// Copyright © 2020 Quran.com. All rights reserved. -// - -import NoorUI -import QuranKit -import UIKit - -class QuranTranslationFooterCollectionViewCell: QuranTranslationBaseCollectionViewCell { - // MARK: Internal - - override func setUp() { - label.textColor = .label - label.textAlignment = .center - label.font = Self.font - - contentView.addAutoLayoutSubview(label) - label.vc.top(by: Self.topPadding) - snapToReadableLeadingEdge(label) - snapToReadableTrailingEdge(label) - } - - func configure(with page: Page) { - label.text = page.localizedNumber - } - - override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - layoutIfNeeded() - let insets = ContentDimension.insets(of: self) - layoutAttributes.size.height = insets.bottom + label.bounds.height + Self.topPadding + Self.bottomPadding - return layoutAttributes - } - - // MARK: Private - - private static let topPadding: CGFloat = ContentDimension.interSpacing - private static let bottomPadding: CGFloat = 0 - - private static var font: UIFont { - .systemFont(ofSize: 14) - } - - private let label = UILabel() -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationHeaderCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationHeaderCollectionViewCell.swift deleted file mode 100644 index 92710b3c..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationHeaderCollectionViewCell.swift +++ /dev/null @@ -1,66 +0,0 @@ -// -// QuranTranslationHeaderCollectionViewCell.swift -// Quran -// -// Created by Afifi, Mohamed on 1/13/20. -// Copyright © 2020 Quran.com. All rights reserved. -// - -import Localization -import NoorUI -import QuranKit -import UIKit - -struct TranslationPageHeader { - let verse: AyahNumber -} - -class QuranTranslationHeaderCollectionViewCell: QuranTranslationBaseCollectionViewCell { - // MARK: Internal - - override func setUp() { - let contentView = UIView() - leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) - leftLabel.setContentCompressionResistancePriority(.defaultHigh + 2, for: .horizontal) - rightLabel.textAlignment = .natural - - for label in [leftLabel, rightLabel] { - label.textColor = .label - label.font = Self.font - contentView.addAutoLayoutSubview(label) - label.vc.verticalEdges() - } - leftLabel.vc.leading() - rightLabel.vc.trailing() - leftLabel.trailingAnchor.constraint(lessThanOrEqualTo: rightLabel.leadingAnchor, constant: -40).isActive = true - - self.contentView.addAutoLayoutSubview(contentView) - contentView.vc.bottom(by: Self.bottomPadding) - snapToReadableLeadingEdge(contentView) - snapToReadableTrailingEdge(contentView) - } - - func configure(with header: TranslationPageHeader) { - leftLabel.text = header.verse.page.localizedQuarterName - rightLabel.attributedText = header.verse.page.suraNames() - } - - override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - layoutIfNeeded() - let insets = ContentDimension.insets(of: self) - layoutAttributes.size.height = insets.top + max(leftLabel.bounds.height, rightLabel.bounds.height) + Self.topPadding + Self.bottomPadding - return layoutAttributes - } - - // MARK: Private - - private static let topPadding: CGFloat = 0 - private static let bottomPadding: CGFloat = ContentDimension.interSpacing - - private static var font: UIFont { - .systemFont(ofSize: 14) - } - - private let leftLabel = UILabel() - private let rightLabel = UILabel() -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationSuraNameCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationSuraNameCollectionViewCell.swift deleted file mode 100644 index 5d604ed6..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationSuraNameCollectionViewCell.swift +++ /dev/null @@ -1,112 +0,0 @@ -// -// QuranTranslationSuraNameCollectionViewCell.swift -// Quran -// -// Created by Mohamed Afifi on 3/31/17. -// -// Quran for iOS is a Quran reading application for iOS. -// Copyright (C) 2017 Quran.com -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// - -import NoorUI -import UIKit - -class QuranTranslationSuraNameCollectionViewCell: QuranTranslationBaseCollectionViewCell { - // MARK: Internal - - let label = UILabel() - - override func setUp() { - let contentView = UIView() - - let leftImage = decorationSideImage(themedImage(NoorImage.suraDecorationLeft.uiImage)) - let rightImage = decorationSideImage(themedImage(NoorImage.suraDecorationRight.uiImage)) - let middleImage = UIImageView(image: themedImage(NoorImage.suraDecorationMiddle.uiImage)) - - contentView.addAutoLayoutSubview(leftImage) - leftImage.vc.verticalEdges() - leftImage.vc.leading() - - contentView.addAutoLayoutSubview(rightImage) - rightImage.vc.verticalEdges() - rightImage.vc.trailing() - - contentView.addAutoLayoutSubview(middleImage) - middleImage.vc.verticalEdges() - leftImage.vc.horizontalLine(middleImage, by: 1) - middleImage.vc.horizontalLine(rightImage, by: 1) - - label.textColor = .label - label.textAlignment = .center - label.font = .systemFont(ofSize: 20) - label.adjustsFontSizeToFitWidth = true - - contentView.addAutoLayoutSubview(label) - label.vc.leading(to: middleImage) - label.vc.trailing(to: middleImage) - label.vc.top(to: middleImage) - label.vc.bottom(to: middleImage) - - self.contentView.addAutoLayoutSubview(contentView) - contentView.vc - .bottom() - .height(by: Self.contentHeight) - - snapToReadableLeadingEdge(contentView) - snapToReadableTrailingEdge(contentView) - leftImageView = leftImage - rightImageView = rightImage - middleImageView = middleImage - } - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - guard previousTraitCollection?.userInterfaceStyle != traitCollection.userInterfaceStyle else { - return - } - leftImageView?.image = themedImage(NoorImage.suraDecorationLeft.uiImage) - rightImageView?.image = themedImage(NoorImage.suraDecorationRight.uiImage) - middleImageView?.image = themedImage(NoorImage.suraDecorationMiddle.uiImage) - } - - func configure(with text: String) { - label.text = text - } - - override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - layoutAttributes.size.height = Self.topPadding + Self.contentHeight - return layoutAttributes - } - - // MARK: Private - - private static var contentHeight: CGFloat = 50 - private static var topPadding: CGFloat = 10 - - private var leftImageView: UIImageView? - private var rightImageView: UIImageView? - private var middleImageView: UIImageView? - - private func themedImage(_ image: UIImage) -> UIImage { - if traitCollection.userInterfaceStyle == .dark { - return image.inverted() - } - return image - } - - private func decorationSideImage(_ image: UIImage) -> UIImageView { - let imageView = UIImageView(image: image) - imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: image.size.height / image.size.width).isActive = true - return imageView - } -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationTextCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationTextCollectionViewCell.swift deleted file mode 100644 index a0f89f8c..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationTextCollectionViewCell.swift +++ /dev/null @@ -1,234 +0,0 @@ -// -// QuranTranslationTextCollectionViewCell.swift -// Quran -// -// Created by Mohamed Afifi on 3/31/17. -// -// Quran for iOS is a Quran reading application for iOS. -// Copyright (C) 2017 Quran.com -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// - -import Localization -import NoorUI -import QuranKit -import QuranText -import UIKit -import UIx - -struct TranslationTextData { - let collapsedNumberOfLines: UInt - let verse: AyahNumber - let translation: Translation - let text: TranslationString - var isExpanded: Bool - let showTranslator: Bool - let translationTapped: (Translation) -> Void -} - -class QuranTranslationTextCollectionViewCell: QuranTranslationItemCollectionViewCell { - // MARK: Public - - public static let maxNumberOfLines = 10 - - // MARK: Internal - - override var backgroundColor: UIColor? { - didSet { - shadow.fillColor = backgroundColor ?? UIColor.reading - } - } - - override func prepareForReuse() { - super.prepareForReuse() - translationLabel.prepareForReuse() - } - - override func setUp() { - textStack.axis = .vertical - textStack.distribution = .fill - textStack.alignment = .fill - textStack.spacing = Self.textSpacing - - // shadow - shadow.cornerRadius = 10.0 - shadow.shadowOpacity = 0.2 - shadow.shadowRadius = 3 - shadow.shadowOffset = .zero - contentView.addAutoLayoutSubview(shadow) - shadow.vc.verticalEdges(top: Self.shadowTopPadding, bottom: Self.shadowBottomPadding) - snapToReadableLeadingEdge(shadow) - snapToReadableTrailingEdge(shadow) - - // stack - shadow.addAutoLayoutSubview(textStack) - textStack.vc.edges( - leading: Self.textHorizontalPadding, - trailing: Self.textHorizontalPadding, - top: Self.textTopPadding, - bottom: Self.textBottomPadding - ) - - // translator - translatorLabel.textColor = .secondaryLabel - textStack.addArrangedSubview(translatorLabel) - - // translation - textStack.addArrangedSubview(translationLabel.view) - - setUpReadMoreTapped() - } - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { - if let item { - configure(with: item) - } - } - } - - override func configure(with item: TranslationTextData) { - super.configure(with: item) - shadow.shadowColor = UIColor.label - - translatorLabel.isHidden = !item.showTranslator - translatorLabel.font = item.translation.preferredTranslatorNameFont(ofSize: translationFontSize) - translatorLabel.text = item.translation.translationName - - translationLabel.collapsedNumberOfLines = item.collapsedNumberOfLines - translationLabel.showAsExpanded(item.isExpanded) - translationLabel.attributedText = attributedText( - verse: item.verse, - translation: item.translation, - text: item.text - ) - translationLabel.truncationAttributedText = truncationAttributedText(translation: item.translation) - } - - override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - let insets = ContentDimension.insets(of: self) - let width = layoutAttributes.size.width - insets.leading - insets.trailing - Self.textHorizontalPadding * 2 - let translationLabelHeight = translationLabel.heightThatFits(width: width) - layoutAttributes.size.height = Self.shadowTopPadding - + Self.textTopPadding - + ceil(translationLabelHeight) - + Self.textBottomPadding - + Self.shadowBottomPadding - - if !translatorLabel.isHidden { - let translatorSize = (translatorLabel.text ?? "").size(withFont: translatorLabel.font) - layoutAttributes.size.height += ceil(translatorSize.height) + Self.textSpacing - } - return layoutAttributes - } - - // MARK: Private - - private static let shadowTopPadding: CGFloat = 15 - private static let shadowBottomPadding: CGFloat = 15 - - private static let textTopPadding: CGFloat = 10 - private static let textBottomPadding: CGFloat = 10 - private static let textHorizontalPadding: CGFloat = 10 - private static let textSpacing: CGFloat = 5 - - private let textStack = UIStackView() - private let translatorLabel = UILabel() - private let translationLabel = ExpandableLabel() - - private let shadow = RoundedShadowView() - - private func setUpReadMoreTapped() { - translationLabel.onExpandCollapseButtonTapped = { [weak self] in - if let item = self?.item { - item.translationTapped(item.translation) - } - } - } - - private func truncationAttributedText(translation: Translation) -> NSAttributedString { - let attributes: [NSAttributedString.Key: Any] = [ - .paragraphStyle: paragraphStyle(translation: translation), - .font: truncationLabelFont(translation: translation), - .foregroundColor: UIColor.secondaryLabel.resolvedColor(with: traitCollection), - ] - let ellipsis = NSAttributedString(string: "\u{2026}", attributes: attributes) - let readMore = NSAttributedString(string: l("translation.text.read-more"), attributes: attributes) - - let text = NSMutableAttributedString(attributedString: ellipsis) - text.mutableString.append(" ") - text.append(readMore) - return text - } - - private func paragraphStyle(translation: Translation) -> NSParagraphStyle { - let style = NSMutableParagraphStyle() - if translation.characterDirection == .rightToLeft { - style.alignment = .right - } else { - style.alignment = .left - } - return style - } - - private func truncationLabelFont(translation: Translation) -> UIFont { - textFont(translation: translation) - } - - private func textFont(translation: Translation) -> UIFont { - translation.preferredTextFont(ofSize: translationFontSize) - } - - private func footerFont(translation: Translation) -> UIFont { - translation.preferredTextFont(ofSize: translationFontSize, factor: 0.7) - } - - private func attributedText( - verse: AyahNumber, - translation: Translation, - text: TranslationString - ) -> NSAttributedString { - let color = UIColor.label.resolvedColor(with: traitCollection) - let footerColor = UIColor.secondaryLabel.resolvedColor(with: traitCollection) - let quranColor = UIColor.appIdentity.resolvedColor(with: traitCollection) - let font = textFont(translation: translation) - let footerFont = footerFont(translation: translation) - - let attributes: [NSAttributedString.Key: Any] = [ - .paragraphStyle: paragraphStyle(translation: translation), - .font: font, - .foregroundColor: color, - ] - let attributedString = NSMutableAttributedString(string: text.text, attributes: attributes) - - for range in text.footnoteRanges { - attributedString.addAttributes([ - .font: footerFont, - .foregroundColor: footerColor, - ], range: NSRange(range, in: text.text)) - } - - for range in text.quranRanges { - attributedString.addAttributes([ - .foregroundColor: quranColor, - ], range: NSRange(range, in: text.text)) - } - - // add verse number - let formatter = NumberFormatter() - formatter.locale = Locale(identifier: translation.languageCode) - let translationVerseNumber = formatter.format(verse.ayah) - attributedString.insert(NSAttributedString(string: translationVerseNumber + ". ", attributes: attributes), at: 0) - - return attributedString - } -} diff --git a/Features/QuranTranslationFeature/cells/QuranTranslationVerseSeparatorCollectionViewCell.swift b/Features/QuranTranslationFeature/cells/QuranTranslationVerseSeparatorCollectionViewCell.swift deleted file mode 100644 index 62bfa40a..00000000 --- a/Features/QuranTranslationFeature/cells/QuranTranslationVerseSeparatorCollectionViewCell.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// QuranTranslationVerseSeparatorCollectionViewCell.swift -// Quran -// -// Created by Mohamed Afifi on 3/31/17. -// -// Quran for iOS is a Quran reading application for iOS. -// Copyright (C) 2017 Quran.com -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// - -import NoorUI -import UIKit - -class QuranTranslationVerseSeparatorCollectionViewCell: QuranTranslationBaseCollectionViewCell { - // MARK: Internal - - let fillColor = UIView() - let shadowImage = UIImageView(image: NoorImage.innerShadow.uiImage) - - override var backgroundColor: UIColor? { - didSet { - super.backgroundColor = nil - } - } - - override func setUp() { - // shadow image - contentView.addAutoLayoutSubview(shadowImage) - shadowImage.vc.edges() - - fillColor.backgroundColor = .systemGray5 - contentView.addAutoLayoutSubview(fillColor) - fillColor.vc.edges() - - updateVisibleUI() - } - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - updateVisibleUI() - } - - func configure(with item: Void) {} - - override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - layoutAttributes.size.height = Self.cellHeight - return layoutAttributes - } - - // MARK: Private - - private static let lineHeight: CGFloat = 1 - private static let cellHeight: CGFloat = 10 - - private func updateVisibleUI() { - fillColor.isHidden = traitCollection.userInterfaceStyle == .light - shadowImage.isHidden = !fillColor.isHidden - } -} diff --git a/Features/QuranViewFeature/QuranInteractor.swift b/Features/QuranViewFeature/QuranInteractor.swift index 154d7052..cb87f5e4 100644 --- a/Features/QuranViewFeature/QuranInteractor.swift +++ b/Features/QuranViewFeature/QuranInteractor.swift @@ -160,7 +160,7 @@ final class QuranInteractor: WordPointerListener, ContentListener, NoteEditorLis } func onQuranModeUpdated() { - let noTranslationsSelected = selectedTranslationsPreferences.selectedTranslations.isEmpty + let noTranslationsSelected = selectedTranslationsPreferences.selectedTranslationIds.isEmpty if quranMode == .translation, noTranslationsSelected { presentTranslationsSelection() } diff --git a/Features/SearchFeature/SearchViewModel.swift b/Features/SearchFeature/SearchViewModel.swift index a7ef666f..a5b5cf3a 100644 --- a/Features/SearchFeature/SearchViewModel.swift +++ b/Features/SearchFeature/SearchViewModel.swift @@ -60,10 +60,10 @@ final class SearchViewModel: ObservableObject { case .quran: break case .translation(let translation): contentStatePreferences.quranMode = .translation - var translationIds = selectedTranslationsPreferences.selectedTranslations + var translationIds = selectedTranslationsPreferences.selectedTranslationIds if !translationIds.contains(translation.id) { translationIds.append(translation.id) - selectedTranslationsPreferences.selectedTranslations = translationIds + selectedTranslationsPreferences.selectedTranslationIds = translationIds } } diff --git a/Features/TranslationVerseFeature/TranslationVerseBuilder.swift b/Features/TranslationVerseFeature/TranslationVerseBuilder.swift index 04421cd7..aef046c4 100644 --- a/Features/TranslationVerseFeature/TranslationVerseBuilder.swift +++ b/Features/TranslationVerseFeature/TranslationVerseBuilder.swift @@ -14,6 +14,7 @@ import MoreMenuFeature import QuranAnnotations import QuranKit import QuranTextKit +import TranslationService import TranslationsFeature import UIKit @@ -32,13 +33,12 @@ public struct TranslationVerseBuilder { databasesURL: container.databasesURL, quranFileURL: container.quranUthmaniV2Database ) - let viewModel = TranslationVerseViewModel(startingVerse: startingVerse, dataService: dataService, actions: actions) + let localTranslationsRetriever = LocalTranslationsRetriever(databasesURL: container.databasesURL) + let viewModel = TranslationVerseViewModel(startingVerse: startingVerse, localTranslationsRetriever: localTranslationsRetriever, dataService: dataService, actions: actions) let viewController = TranslationVerseViewController( viewModel: viewModel, moreMenuBuilder: MoreMenuBuilder(), - translationsSelectionBuilder: TranslationsListBuilder(container: container), - // Pass a new highlights service that will always be empty - highlightsService: QuranHighlightsService() + translationsSelectionBuilder: TranslationsListBuilder(container: container) ) let navigationController = UINavigationController(rootViewController: viewController) return navigationController diff --git a/Features/TranslationVerseFeature/TranslationVerseDataSource.swift b/Features/TranslationVerseFeature/TranslationVerseDataSource.swift deleted file mode 100644 index 6615bba1..00000000 --- a/Features/TranslationVerseFeature/TranslationVerseDataSource.swift +++ /dev/null @@ -1,68 +0,0 @@ -// -// TranslationVerseDataSource.swift -// Quran -// -// Created by Mohamed Afifi on 2022-10-09. -// Copyright © 2022 Quran.com. All rights reserved. -// - -import AnnotationsService -import Foundation -import Localization -import QuranAnnotations -import QuranKit -import QuranTextKit -import QuranTranslationFeature -import TranslationService -import UIKit -import UIx -import VLogging - -@MainActor -class TranslationVerseDataSource { - private typealias ItemId = QuranTranslationDiffableDataSource.ItemId - private typealias Section = DefaultSection - - // MARK: Lifecycle - - // MARK: - Configuration - - init(collectionView: UICollectionView, highlightsService: QuranHighlightsService) { - self.collectionView = collectionView - cellProvider = TranslationCellProvider
(collapsedNumberOfLines: 10, highlightsService: highlightsService) - dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] collectionView, indexPath, itemId in - self?.cellProvider.provideCell(collectionView: collectionView, indexPath: indexPath, itemId: itemId) - } - cellProvider.dataSource = dataSource - cellProvider.collectionView = collectionView - cellProvider.expansionHandler = TranslationExpansionHandler(dataSource: dataSource) - } - - // MARK: Internal - - var translatedVerse: TranslatedVerse? { - didSet { - guard let translatedVerse else { - fatalError("Can't set translatedVerse to be nil") - } - cellProvider.translatedVerses = [translatedVerse] - updateItems(with: translatedVerse) - } - } - - // MARK: Private - - private weak var collectionView: UICollectionView? - private var dataSource: UICollectionViewDiffableDataSource! // swiftlint:disable:this implicitly_unwrapped_optional - private let cellProvider: TranslationCellProvider
- - // MARK: - Data - - private func updateItems(with translatedVerse: TranslatedVerse) { - logger.info("Quran Translation: setting translatedVerse") - var snapshot = NSDiffableDataSourceSnapshot() - snapshot.appendSections(.default) - cellProvider.add(translatedVerse, to: &snapshot) - dataSource.apply(snapshot, animatingDifferences: false) - } -} diff --git a/Features/TranslationVerseFeature/TranslationVerseView.swift b/Features/TranslationVerseFeature/TranslationVerseView.swift new file mode 100644 index 00000000..c6439297 --- /dev/null +++ b/Features/TranslationVerseFeature/TranslationVerseView.swift @@ -0,0 +1,17 @@ +// +// TranslationVerseView.swift +// +// +// Created by Mohamed Afifi on 2024-02-01. +// + +import QuranTranslationFeature +import SwiftUI + +struct TranslationVerseView: View { + @StateObject var viewModel: TranslationVerseViewModel + + var body: some View { + ContentTranslationView(viewModel: viewModel.translationViewModel) + } +} diff --git a/Features/TranslationVerseFeature/TranslationVerseViewController.swift b/Features/TranslationVerseFeature/TranslationVerseViewController.swift index be43d980..d2defb84 100644 --- a/Features/TranslationVerseFeature/TranslationVerseViewController.swift +++ b/Features/TranslationVerseFeature/TranslationVerseViewController.swift @@ -6,33 +6,30 @@ // Copyright © 2022 Quran.com. All rights reserved. // -import AnnotationsService import Combine import MoreMenuFeature import NoorUI -import QuranKit -import QuranTranslationFeature +import SwiftUI import TranslationService import TranslationsFeature -import UIKit import UIx import VLogging -class TranslationVerseViewController: UIViewController { +class TranslationVerseViewController: UIHostingController { // MARK: Lifecycle init( viewModel: TranslationVerseViewModel, moreMenuBuilder: MoreMenuBuilder, - translationsSelectionBuilder: TranslationsListBuilder, - highlightsService: QuranHighlightsService + translationsSelectionBuilder: TranslationsListBuilder ) { self.viewModel = viewModel self.moreMenuBuilder = moreMenuBuilder self.translationsSelectionBuilder = translationsSelectionBuilder - collectionView = QuranTranslationDiffableDataSource.translationCollectionView() - dataSource = TranslationVerseDataSource(collectionView: collectionView, highlightsService: highlightsService) - super.init(nibName: nil, bundle: nil) + + let viewModel = self.viewModel + let view = TranslationVerseView(viewModel: viewModel) + super.init(rootView: view) } @available(*, unavailable) @@ -46,29 +43,21 @@ class TranslationVerseViewController: UIViewController { super.viewDidLoad() view.backgroundColor = UIColor.reading - configureCollectionView() configureNavigationBar() - configureSettingsObservers() - - viewModel.$translatedVerse - .receive(on: DispatchQueue.main) - .sink { [weak self] _ in - self?.updateUI() - } - .store(in: &cancellables) viewModel.$currentVerse .receive(on: DispatchQueue.main) .sink { [weak self] verse in self?.nextButton?.isEnabled = verse.next != nil self?.previousButton?.isEnabled = verse.previous != nil + self?.updateTitle() } .store(in: &cancellables) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - let noTranslationsSelected = selectedTranslationsPreferences.selectedTranslations.isEmpty + let noTranslationsSelected = selectedTranslationsPreferences.selectedTranslationIds.isEmpty if firstTime && noTranslationsSelected { presentTranslationsSelection() } @@ -77,9 +66,6 @@ class TranslationVerseViewController: UIViewController { // MARK: Private - private let collectionView: UICollectionView - - private let dataSource: TranslationVerseDataSource private let viewModel: TranslationVerseViewModel private var cancellables: Set = [] @@ -93,12 +79,6 @@ class TranslationVerseViewController: UIViewController { private var firstTime = true - private func configureCollectionView() { - collectionView.contentInsetAdjustmentBehavior = .automatic - view.addAutoLayoutSubview(collectionView) - collectionView.vc.edges() - } - private func configureNavigationBar() { navigationItem.rightBarButtonItems?.append( UIBarButtonItem( @@ -151,12 +131,6 @@ class TranslationVerseViewController: UIViewController { presentPopover(viewController, pointingTo: item, permittedArrowDirections: [.up, .down]) } - private func configureSettingsObservers() { - selectedTranslationsPreferences.$selectedTranslations - .sink { [weak self] _ in self?.viewModel.reload() } - .store(in: &cancellables) - } - @objc private func nextTapped() { viewModel.next() @@ -167,18 +141,11 @@ class TranslationVerseViewController: UIViewController { viewModel.previous() } - private func updateUI() { - guard let translatedVerse = viewModel.translatedVerse else { - return - } - logger.info("Verse Translation: set TranslatedVerse") + private func updateTitle() { updateTitle( - firstLine: translatedVerse.verse.sura.localizedName(withNumber: true), - secondLine: translatedVerse.verse.localizedAyahNumber + firstLine: viewModel.currentVerse.sura.localizedName(withNumber: true), + secondLine: viewModel.currentVerse.localizedAyahNumber ) - dataSource.translatedVerse = translatedVerse - collectionView.reloadData() - collectionView.layoutIfNeeded() } private func updateTitle(firstLine: String, secondLine: String) { diff --git a/Features/TranslationVerseFeature/TranslationVerseViewModel.swift b/Features/TranslationVerseFeature/TranslationVerseViewModel.swift index 9f102092..6204fa49 100644 --- a/Features/TranslationVerseFeature/TranslationVerseViewModel.swift +++ b/Features/TranslationVerseFeature/TranslationVerseViewModel.swift @@ -6,61 +6,66 @@ // Copyright © 2022 Quran.com. All rights reserved. // -import Crashing -import Foundation +import AnnotationsService +import Combine import QuranKit +import QuranText import QuranTextKit import QuranTranslationFeature +import TranslationService import VLogging public struct TranslationVerseActions { // MARK: Lifecycle - public init(updateCurrentVerseTo: @escaping (_: AyahNumber) -> Void) { + public init(updateCurrentVerseTo: @escaping (AyahNumber) -> Void) { self.updateCurrentVerseTo = updateCurrentVerseTo } // MARK: Internal - let updateCurrentVerseTo: (_ verse: AyahNumber) -> Void + let updateCurrentVerseTo: (AyahNumber) -> Void } @MainActor -class TranslationVerseViewModel { +class TranslationVerseViewModel: ObservableObject { // MARK: Lifecycle - init(startingVerse: AyahNumber, dataService: QuranTextDataService, actions: TranslationVerseActions) { + init(startingVerse: AyahNumber, localTranslationsRetriever: LocalTranslationsRetriever, dataService: QuranTextDataService, actions: TranslationVerseActions) { currentVerse = startingVerse self.dataService = dataService self.actions = actions - retieveTranslatedVerse(verse: startingVerse) + + let noOpHighlightingService = QuranHighlightsService() + translationViewModel = ContentTranslationViewModel(localTranslationsRetriever: localTranslationsRetriever, dataService: dataService, highlightsService: noOpHighlightingService) + translationViewModel.showHeaderAndFooter = false + translationViewModel.verses = [startingVerse] } // MARK: Internal - @Published var translatedVerse: TranslatedVerse? + private var cancellables: Set = [] + + let translationViewModel: ContentTranslationViewModel @Published var currentVerse: AyahNumber { didSet { + translationViewModel.verses = [currentVerse] actions.updateCurrentVerseTo(currentVerse) } } - func reload() { - retieveTranslatedVerse(verse: currentVerse) - } - func next() { logger.info("Verse Translation: moving to next verse currentVerse:\(currentVerse)") if let next = currentVerse.next { - retieveTranslatedVerse(verse: next) + currentVerse = next } } func previous() { logger.info("Verse Translation: moving to previous verse currentVerse:\(currentVerse)") if let previous = currentVerse.previous { - retieveTranslatedVerse(verse: previous) + currentVerse = previous } } @@ -69,26 +74,4 @@ class TranslationVerseViewModel { private let dataService: QuranTextDataService private let actions: TranslationVerseActions - - private func retieveTranslatedVerse(verse: AyahNumber) { - currentVerse = verse - Task { - do { - let texts = try await dataService.textForVerses([verse]) - let translations = Translations(texts.translations) - let translatedVerse = zip([verse], texts.verses).map { verse, text in - TranslatedVerse(verse: verse, text: text, translations: translations) - } - - updateTranslatedVerse(translatedVerse) - } catch { - // TODO: Show an error to the user - crasher.recordError(error, reason: "Failed to retrieve translation text verse \(verse)") - } - } - } - - private func updateTranslatedVerse(_ translatedVerses: [TranslatedVerse]) { - translatedVerse = translatedVerses.first - } } diff --git a/Features/TranslationsFeature/TranslationItem.swift b/Features/TranslationsFeature/TranslationItem.swift index 1fa99839..6a3d7660 100644 --- a/Features/TranslationsFeature/TranslationItem.swift +++ b/Features/TranslationsFeature/TranslationItem.swift @@ -26,17 +26,6 @@ extension Translation { var localizedLanguage: String? { Locale.localizedLanguage(forCode: languageCode) } - - // TODO: Reuse in QuranTranslationTranslatorNameCollectionViewCell - func preferredTranslatorNameFont(ofSize size: FontSize) -> UIFont { - if languageCode == "am" { - return .translatorNameAmharic(ofSize: size) - } else if languageCode == "ar" { - return .translatorNameArabic(ofSize: size) - } else { - return .translatorNameEnglish(ofSize: size) - } - } } extension Locale { diff --git a/Features/TranslationsFeature/TranslationsListViewModel.swift b/Features/TranslationsFeature/TranslationsListViewModel.swift index 2c18ee15..a79d3464 100644 --- a/Features/TranslationsFeature/TranslationsListViewModel.swift +++ b/Features/TranslationsFeature/TranslationsListViewModel.swift @@ -39,8 +39,8 @@ final class TranslationsListViewModel: ObservableObject { ) self.downloadsObserver = downloadsObserver - selectedTranslationsPreferences.$selectedTranslations - .prepend(selectedTranslationsPreferences.selectedTranslations) + selectedTranslationsPreferences.$selectedTranslationIds + .prepend(selectedTranslationsPreferences.selectedTranslationIds) .receive(on: DispatchQueue.main) .sink { [weak self] in self?.selectedTranslationIds = $0 } .store(in: &cancellables) @@ -88,7 +88,7 @@ final class TranslationsListViewModel: ObservableObject { } func moveSelectedTranslations(at indexSet: IndexSet, to destination: Int) { - selectedTranslationsPreferences.selectedTranslations.move(fromOffsets: indexSet, toOffset: destination) + selectedTranslationsPreferences.selectedTranslationIds.move(fromOffsets: indexSet, toOffset: destination) } func selectTranslation(_ translation: TranslationItem) async { diff --git a/Model/QuranText/FontSize.swift b/Model/QuranText/FontSize.swift index 0248c71b..03408835 100644 --- a/Model/QuranText/FontSize.swift +++ b/Model/QuranText/FontSize.swift @@ -5,6 +5,8 @@ // Created by Mohamed Afifi on 5/2/18. // +import SwiftUI + public enum FontSize: Int, CaseIterable, CustomStringConvertible { case xxLarge = -1 case xLarge = 0 @@ -28,3 +30,17 @@ public enum FontSize: Int, CaseIterable, CustomStringConvertible { } } } + +extension FontSize { + public var dynamicTypeSize: DynamicTypeSize { + switch self { + case .xxLarge: .xxxLarge + case .xLarge: .xxLarge + case .large: .xLarge + case .medium: .large + case .small: .medium + case .xSmall: .small + case .xxSmall: .xSmall + } + } +} diff --git a/Model/QuranText/TranslatedVerses.swift b/Model/QuranText/TranslatedVerses.swift index e5d54710..81a89430 100644 --- a/Model/QuranText/TranslatedVerses.swift +++ b/Model/QuranText/TranslatedVerses.swift @@ -62,6 +62,7 @@ public struct VerseText: Equatable { public let arabicSuffix: [String] } +// TODO: Remove public struct TranslatedVerses: Equatable { // MARK: Lifecycle diff --git a/UI/NoorFont/FontName.swift b/UI/NoorFont/FontName.swift index 87bde15a..5750e1f1 100644 --- a/UI/NoorFont/FontName.swift +++ b/UI/NoorFont/FontName.swift @@ -12,9 +12,6 @@ public enum FontName: CaseIterable { /// Used in Arabic tafseer case arabic - /// Used in Amharic translation - case amharic - /// Used in quran text in translation view case quran @@ -37,12 +34,6 @@ public enum FontName: CaseIterable { family: "Kitab", fileName: "Kitab-Regular.ttf" ) - case .amharic: - return FontDetails( - name: "AbyssinicaSIL", - family: "Abyssinica SIL", - fileName: "AbyssinicaSIL-R.ttf" - ) case .quran: return FontDetails( name: "KFGQPCHAFSUthmanicScript-Bold", @@ -59,11 +50,6 @@ public enum FontName: CaseIterable { } } -private let arabicQuranTextFontSize: CGFloat = 24 -private let arabicTranslationTextFontSize: CGFloat = 24 -private let englishTranslationTextFontSize: CGFloat = 20 -private let amharicTranslationTextFontSize: CGFloat = 20 - public extension Font { static func custom(_ name: FontName, size: CGFloat) -> Font { custom(name.details.name, size: size) diff --git a/UI/NoorFont/Resources/AbyssinicaSIL-R.ttf b/UI/NoorFont/Resources/AbyssinicaSIL-R.ttf deleted file mode 100755 index bccfbb79a8dd8945c3bf3d64773555983a560558..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 602664 zcmeEP2VfM%`k$FCxg>X&OYYKpB>{vGLPu&S(t8Ifp@o0}V+>7cA|Oo!L3e^7@4lJe%r|}Jo7tV68A1smp&&Au zp3(ZD20#FG9#m8P-aT@APNH>-2vuNu+MJLqIv6QcFc$czDP*O z>;|pd)(L)Xz-NR+jw8ex(IC4=F1@kt8A3`eBqZfvgX~9oJ-Kw|bA+_bh4+r;t;?oG zbk6*dkggNpU-#Div-^D0zJC+o^Ms7p3YBKBANCdd!N7dfTpxH1 za6-R zkB@>ia5|B=9X$gq0atL@Uk3K-l~=Bk3*P|t0j})Ci~w7JtGKWU*w!mAE!Bl>z;@tr zPXAd5a1d}smwf_oSg*YDx_xQjNZ>S=eP!U-UU})MF88&76M$XuXH9^Ufpz{iz@>m) z@n>Ct%K+=)WdfH2uI%zJ8#oIXFdsz1~~s1B&X;17X56#59L;ZS3sM!`H9 z`grK$pe6w)LSF*<6sRSkmWKKO)Ur@hp{7AC548eRO(Mxm zW~ePP{N}mN|2`yxvNs!5OBLB!EJw_kr!T5u6f0}totI^OP>2cq1s0lkL| zB4L8Y4D2yv07(+GGx9u!)E8BvigXB=$s&qS!w0mXe)vBBO<8WEJNZ|*(*XMk@G z{tI+|*2d?O&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8>N_`hfeHX^WU!=YZ<>pYTiz73XIxmzu zFO)hjlsYezIxmzuFO)hjl$%K@K9I!|%nw=@;bd9NczHWR0kvNM#jGnBG3 zl(IAAvNIY=i5NOQGz_IQ45c&-r8EqsiVD5Qd&No>6-pHqN);7K6%}^#87`D6DdZ|Cljh9} ztqXp%PH$+PVbMC@N9&RiS{M9i9X+&;Z?w+I&^q5n>tX_}O9E(}Z=-d-jn*ZxOolgE zwC;L3#>pX#U6G8Oj`1d)j&c2h)~$oqt%KIBgVwEsR_Jj3l8z-DpXpeeTQ42s8?xy( z))!hQA6h3@I>t94(=krAz?b=KXV4QmDH-SESsEF{@rzh>Z5!(e>S8%s*{{%NzFXO^ z&}Y6|*{{%d`T;-A9%u!h{R?X6@mBV)wD=ub9&hJlo^I!4j@H=|*I7>SOZ1(6(X!m) zm+13);&ZD;>MpXF_5e@M6Up#-h)$7g=@dHr@iU7+v$ z3oY~0E_P_=!vMzF?(KXSK%ed2&W8c?+3xLp7(k!x(9WAA^dR%uzriQV*~WJTpl6=n z#&-p9J%h(f@LbOw?x`Ykxuzdp!&3;C>pKCw7thPg;u)P7o;q4~`JJi>&j4*v=c^5P q%7{i3{Y2nGB!h=|uE3)}m#Om@=?*-lgkS5t918{M$K=mVDfQpA50f1L diff --git a/UI/NoorUI/Components/MultipartText.swift b/UI/NoorUI/Components/MultipartText.swift index 8ddc926c..f4b8b765 100644 --- a/UI/NoorUI/Components/MultipartText.swift +++ b/UI/NoorUI/Components/MultipartText.swift @@ -178,16 +178,16 @@ public struct MultipartText: ExpressibleByStringInterpolation { parts.append(contentsOf: other.parts) } + public func view(ofSize size: FontSize, alignment: Alignment = .leading) -> some View { + MultiPartTextView(text: self, size: size, alignment: alignment) + } + // MARK: Internal var rawValue: String { parts.map(\.rawValue).joined() } - func view(ofSize size: FontSize) -> some View { - MultiPartTextView(text: self, size: size) - } - // MARK: Fileprivate fileprivate var parts: [TextPart] @@ -199,18 +199,14 @@ extension MultipartText { } } -public struct MultiPartTextView: View { +private struct MultiPartTextView: View { // MARK: Lifecycle - public init(text: MultipartText, size: MultipartText.FontSize, alignment: Alignment = .leading) { - self.text = text - self.size = size - self.alignment = alignment - } - - // MARK: Public + let text: MultipartText + let size: MultipartText.FontSize + let alignment: Alignment - public var body: some View { + var body: some View { wrap { ForEach(0 ..< text.parts.count, id: \.self) { i in TextPartView(part: text.parts[i], size: size) @@ -218,14 +214,6 @@ public struct MultiPartTextView: View { } } - // MARK: Internal - - let text: MultipartText - let size: MultipartText.FontSize - let alignment: Alignment - - // MARK: Private - @ViewBuilder private func wrap(@ViewBuilder content: () -> some View) -> some View { if #available(iOS 16.0, *) { diff --git a/UI/NoorUI/Features/QuranTranslation/AsyncTextLabel.swift b/UI/NoorUI/Features/QuranTranslation/AsyncTextLabel.swift deleted file mode 100644 index a35c1f65..00000000 --- a/UI/NoorUI/Features/QuranTranslation/AsyncTextLabel.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// AsyncTextLabel.swift -// -// -// Created by Mohamed Afifi on 2023-06-20. -// - -import UIKit - -// TODO: Remove when Texture supports swift package manager. - -public protocol AsyncTextLabel { - init() - var view: UIView { get } - - var maximumNumberOfLines: UInt { get set } - var attributedText: NSAttributedString? { get set } - var truncationAttributedText: NSAttributedString? { get set } - - var onDisplayFinished: (() -> Void)? { get set } - - var isTruncated: Bool { get } - var lineCount: UInt { get } - - func setNeedsLayout() - func clearContents() - func sizeThatFits(min: CGSize, max: CGSize) -> CGSize -} - -public enum AsyncTextLabelSystem { - // MARK: Public - - public static func bootstrap(_ factory: @escaping () -> AsyncTextLabel) { - lock.sync { - precondition(!initialized, "AsyncTextLabelSystem can only be initialized once.") - self.factory = factory - initialized = true - } - } - - // MARK: Internal - - private(set) static var factory: (() -> AsyncTextLabel)! - - // MARK: Private - - private static let lock = NSLock() - private static var initialized = false -} diff --git a/UI/NoorUI/Features/QuranTranslation/ExpandableLabel.swift b/UI/NoorUI/Features/QuranTranslation/ExpandableLabel.swift deleted file mode 100644 index 570e568d..00000000 --- a/UI/NoorUI/Features/QuranTranslation/ExpandableLabel.swift +++ /dev/null @@ -1,170 +0,0 @@ -// -// ExpandableLabel.swift -// Quran -// -// Created by Afifi, Mohamed on 10/23/21. -// Copyright © 2021 Quran.com. All rights reserved. -// - -import UIKit -import UIx - -private enum ExpandState { - case initial - case expanded - case collapsed -} - -@MainActor -public class ExpandableLabel { - // MARK: Lifecycle - - public init() { - // add the button - button.normalBackground = .clear - button.disabledBackground = .clear - button.highlightedBackground = .systemGray5 - button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) - view.addAutoLayoutSubview(button) - button.vc.edges() - - // configure the label - label.onDisplayFinished = { [weak self] in - self?.isDisplayingSnapshot = false - self?.updateButtonAvailability() - } - view.addAutoLayoutSubview(label.view) - label.view.vc.edges() - } - - // MARK: Public - - public let view = UIView() - - public var onExpandCollapseButtonTapped: (() -> Void)? - public var collapsedNumberOfLines: UInt = 0 - - public var attributedText: NSAttributedString? { - get { label.attributedText } - set { label.attributedText = newValue } - } - - public var truncationAttributedText: NSAttributedString? { - get { label.truncationAttributedText } - set { label.truncationAttributedText = newValue } - } - - public func prepareForReuse() { - expandState = .initial - - isDisplayingSnapshot = false - snapshot?.removeFromSuperview() - snapshot = nil - - label.clearContents() - label.view.isHidden = false - } - - public func showAsExpanded(_ isExpanded: Bool) { - switch expandState { - case .initial: - break - case .collapsed: - isDisplayingSnapshot = isExpanded - case .expanded: - isDisplayingSnapshot = !isExpanded - } - label.maximumNumberOfLines = isExpanded ? 0 : collapsedNumberOfLines - label.setNeedsLayout() - expandState = isExpanded ? .expanded : .collapsed - } - - public func heightThatFits(width: CGFloat) -> CGFloat { - let min = CGSize(width: width, height: 0) - let max = CGSize(width: width, height: .infinity) - let size = label.sizeThatFits(min: min, max: max) - return size.height - } - - // MARK: Internal - - var isTruncated: Bool { - label.isTruncated - } - - var lineCount: UInt { - label.lineCount - } - - // MARK: Private - - private let button = BackgroundColorButton() - private var label = AsyncTextLabelSystem.factory() - - private var snapshot: UIView? - private var expandState: ExpandState = .initial - - private var isDisplayingSnapshot = false { - didSet { - if isDisplayingSnapshot == oldValue { - return - } - if isDisplayingSnapshot { - showSnapshot() - } else { - removeSnapshot() - } - } - } - - private func expand() { - switch expandState { - case .initial, .expanded: - break - case .collapsed: - isDisplayingSnapshot = true - } - } - - private func collapse() { - switch expandState { - case .initial, .collapsed: - break - case .expanded: - isDisplayingSnapshot = true - } - } - - // MARK: - Snapshot - - private func showSnapshot() { - label.view.isHidden = true - if isDisplayingSnapshot { - if let snapshot = label.view.snapshotView(afterScreenUpdates: false) { - label.view.superview?.addAutoLayoutSubview(snapshot) - snapshot.vc.leading(to: label.view) - snapshot.vc.trailing(to: label.view) - snapshot.vc.top(to: label.view) - snapshot.vc.height(by: label.view.bounds.height) // fix the height as label will change height - self.snapshot = snapshot - } - } - } - - private func removeSnapshot() { - label.view.isHidden = false - snapshot?.removeFromSuperview() - snapshot = nil - } - - // MARK: - Button - - private func updateButtonAvailability() { - button.isEnabled = collapsedNumberOfLines != 0 && (label.isTruncated || label.lineCount > collapsedNumberOfLines) - } - - @objc - private func buttonTapped() { - onExpandCollapseButtonTapped?() - } -} diff --git a/UI/NoorUI/Font/FontName++.swift b/UI/NoorUI/Font/FontName++.swift index 016a8bf0..5af5097e 100644 --- a/UI/NoorUI/Font/FontName++.swift +++ b/UI/NoorUI/Font/FontName++.swift @@ -12,50 +12,16 @@ import NoorFont import QuranText import SwiftUI -private let arabicQuranTextFontSize: CGFloat = 24 -private let arabicTranslationTextFontSize: CGFloat = 24 -private let englishTranslationTextFontSize: CGFloat = 20 -private let amharicTranslationTextFontSize: CGFloat = 20 +private let arabicQuranTextFontSize: CGFloat = 17 +private let arabicTafseerTextFontSize: CGFloat = 21 public extension Font { - static func quran(ofSize size: FontSize) -> Font { - custom(.quran, size: size.fontSize(forMediumSize: arabicQuranTextFontSize)) - } -} - -public extension UIFont { - // MARK: Translator - - static func translatorNameArabic(ofSize size: FontSize) -> UIFont { - UIFont(.arabic, size: size.fontSize(forMediumSize: 20)) - } - - static func translatorNameEnglish(ofSize size: FontSize) -> UIFont { - .systemFont(ofSize: size.fontSize(forMediumSize: 17)) - } - - static func translatorNameAmharic(ofSize size: FontSize) -> UIFont { - UIFont(.amharic, size: size.fontSize(forMediumSize: 17)) - } - - // MARK: Quran - - static func arabicQuranText(ofSize size: FontSize) -> UIFont { - UIFont(.quran, size: size.fontSize(forMediumSize: arabicQuranTextFontSize)) - } - - // MARK: Translations - - static func arabicTranslation(ofSize size: FontSize, factor: CGFloat) -> UIFont { - UIFont(.arabic, size: size.fontSize(forMediumSize: arabicTranslationTextFontSize) * factor) - } - - static func englishTranslation(ofSize size: FontSize, factor: CGFloat) -> UIFont { - .systemFont(ofSize: size.fontSize(forMediumSize: englishTranslationTextFontSize) * factor) + static func quran(ofSize size: FontSize? = nil) -> Font { + custom(.quran, size: size?.fontSize(forMediumSize: arabicQuranTextFontSize) ?? arabicQuranTextFontSize) } - static func amharicTranslation(ofSize size: FontSize, factor: CGFloat) -> UIFont { - UIFont(.amharic, size: size.fontSize(forMediumSize: amharicTranslationTextFontSize) * factor) + static func arabicTafseer() -> Font { + custom(.arabic, size: arabicTafseerTextFontSize) } } diff --git a/UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/Contents.json b/UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/Contents.json deleted file mode 100644 index 6f98ef2c..00000000 --- a/UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "inner-shadow.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/inner-shadow.png b/UI/NoorUI/Images/Images.xcassets/inner-shadow.imageset/inner-shadow.png deleted file mode 100644 index 31866953f887795f3adf69a057cd0038f71123b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 844 zcmeAS@N?(olHy`uVBq!ia0vp^j6f{M!3HGXPAxeOq*&4&eH|GXHuiJ>Nn{1`6_P!I zd>I(3)EF2VS{N990fib~Fff!FFfhDIU|_JC!N4G1FlSew4NxK=HNrE^*Ox&H$mU>R zViaOv2C^7Imb7Owuz=YN3_z2BfO!EULUsWYT$XVGGn_34QpoAQc{2k8lSyVsL`j6N zk5zJhu3lnFep0GlMQ#B|0fSA26_A;mT9T+xk(-lOY*k^a1Xf`MWP^nDl@!2AO0sR0 zB76fBob!uP70mPu^bC~jxD*r=Y>HCStb$zJpxS{vTcwPWk^(Dz{qpj1y>er{{GxPy zLrY6beFGzXBO_g)3f~lV22EkeHlmX9(4TB!r|I z(jqRdoapn`%9q#Q#Gs@_H)6s}0&42eXrC@>c7xNP*{DZ-AcMgAo>Fp*e$x;Tb# z$i{XbFVdQ&MBb@04ZPX2><{9 diff --git a/UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/Contents.json b/UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/Contents.json deleted file mode 100644 index 317e348f..00000000 --- a/UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "sura-decoration-left.png", - "language-direction" : "left-to-right", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "language-direction" : "left-to-right" - }, - { - "idiom" : "universal", - "scale" : "3x", - "language-direction" : "left-to-right" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/sura-decoration-left.png b/UI/NoorUI/Images/Images.xcassets/sura-decoration-left.imageset/sura-decoration-left.png deleted file mode 100644 index ace7de74146c99eb8d074625d1bed368adb00bb6..0000000000000000000000000000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/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/Contents.json b/UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/Contents.json deleted file mode 100644 index e06a8f5c..00000000 --- a/UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "sura-decoration-middle.png", - "language-direction" : "left-to-right", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "language-direction" : "left-to-right" - }, - { - "idiom" : "universal", - "scale" : "3x", - "language-direction" : "left-to-right" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/sura-decoration-middle.png b/UI/NoorUI/Images/Images.xcassets/sura-decoration-middle.imageset/sura-decoration-middle.png deleted file mode 100644 index e518e50ff59d049d23afe5d8ce9866a341a6ccf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 528 zcmeAS@N?(olHy`uVBq!ia0vp^j6mGS!3HEhd`@ZsQY`6?zK#qG8~eHcB(ehe3dtTp zz6=aiY77hwK>1%lp@tU>45bDP46hOx7_4S6Fo+k-*%fF5G%GSQB%&n3*T*V3KUXg? zB|j-uuOhbqsDpvQrosxy%uOvxRH(?!$t$+1uvG%9umZ9{!um=IU?nBlwn`Dc0SeCf zMX3s=dM0`XN_Jcd3JNwwDQQ+gE^bimK%T8qMoCG5mA-y?dAVM>v0i>ry1t>MrKP@s zk-m|UE>MMTab;dfVufyAu`tKo-FP#GNIX zX$YJ0ilN>DdQcxEqi?8Zpbs}2sMQ7}YUN*)nF_QSWWJrD4Ok_L7}OpceURlyj)C|T zEDH3h9hZ$hJlO2Gd=9Bc0z=Zw)5S4FLo|89^y&Z4GqC)h>7XLCvHpME1dc)lJ3G0X vBGuK^kG}M-l2TM;@bNvt*-{e!*mpU@O;y2|Pv@ETf+EAy)z4*}Q$iB}>pz}= diff --git a/UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/Contents.json b/UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/Contents.json deleted file mode 100644 index 6d4135b4..00000000 --- a/UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "sura-decoration-right.png", - "language-direction" : "left-to-right", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "language-direction" : "left-to-right" - }, - { - "idiom" : "universal", - "scale" : "3x", - "language-direction" : "left-to-right" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/sura-decoration-right.png b/UI/NoorUI/Images/Images.xcassets/sura-decoration-right.imageset/sura-decoration-right.png deleted file mode 100644 index 37e9c1996d722b73bc544f4dff12924df6edf888..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15749 zcmY+r2UJr{*EWm=P${_;=}kb20-<*TDoRuYq)6{AKD$+|t6r=`;QiK4Z_gg`As@)dPOelTt7K%} zqGV+27Gz}dU&+WA-7@O56tA2aI_MgB8K}RJw{~>~TH3f;*#iBX-L6`YktzDgUlpBg zy(}O2IXk&{%KL%1|6?J4RsL5k!u{YsCSFhww}JZG2P&=}whyF$l0Z>zr8^HEJW%wo zv6I(+uKGXCuWBG}doM3Hc@Ys`UtgfF1klw3A|fUyCnq8*E+Q^2d}Sf*>F?rY=_l;s z$@5<)|HsdBTTg2b2RAPVSC`n9xj_4WdBbN?IYe~Ltpzgl@s4+q<;$p89R5>xz-<^QAmpE!yl{|5iRI`iL={zrQ?RHZwL zBLDl?l9^2ILVxO(67vD<$|hrH?hXsTL-x6OZH zR(F~1On3fYDZGB^d&m9%7;%yhQXMPFBegWh|CQORn$vro(0@hY(au2d#XgdE1Q~om zIy&8MZa&}b=B$5qxs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_NF!Imph?- zNx>KMJQv0l0_wGKd6xyx4?uI8|DmrcC0#cs@Q?AXz|Y{-*oRxG8~o5qdi9RP(-WIn@yMP3vRCu2=eGDSWTF3uILrSpCsyMb((=EY*rrF90Smed|7Ec1 f&ePsGQ?~iU-8C;scg2?`BYX8i<9YEji}(K@8}ax4 diff --git a/UI/NoorUI/Images/NoorImage.swift b/UI/NoorUI/Images/NoorImage.swift index c0e87c25..d73aff2e 100644 --- a/UI/NoorUI/Images/NoorImage.swift +++ b/UI/NoorUI/Images/NoorImage.swift @@ -10,16 +10,12 @@ import UIKit public enum NoorImage: String { case ayahEnd = "ayah-end" - case innerShadow = "inner-shadow" case pointer = "pointer-25" case rotateToLandscape = "rotate_to_landscape-25" case rotateToPortrait = "rotate_to_portrait-25" case settings = "settings-25" case settingsFilled = "settings_filled-25" case suraHeader = "sura_header" - case suraDecorationLeft = "sura-decoration-left" - case suraDecorationMiddle = "sura-decoration-middle" - case suraDecorationRight = "sura-decoration-right" // MARK: Public diff --git a/UI/UIx/SwiftUI/Miscellaneous/View+URL.swift b/UI/UIx/SwiftUI/Miscellaneous/View+URL.swift new file mode 100644 index 00000000..d7e62997 --- /dev/null +++ b/UI/UIx/SwiftUI/Miscellaneous/View+URL.swift @@ -0,0 +1,14 @@ +// +// View+URL.swift +// +// +// Created by Mohamed Afifi on 2024-02-02. +// + +import SwiftUI + +extension View { + public func tryOpenURL(_ handler: @escaping (URL) -> OpenURLAction.Result) -> some View { + environment(\.openURL, OpenURLAction(handler: handler)) + } +} diff --git a/UI/UIx/SwiftUI/Mutate.swift b/UI/UIx/SwiftUI/Mutate.swift index d5c7cd88..f54f7d9e 100644 --- a/UI/UIx/SwiftUI/Mutate.swift +++ b/UI/UIx/SwiftUI/Mutate.swift @@ -8,7 +8,7 @@ import SwiftUI extension View { - func mutateSelf(_ body: (inout Self) -> Void) -> Self { + public func mutateSelf(_ body: (inout Self) -> Void) -> Self { var copy = self body(©) return copy diff --git a/UI/UIx/SwiftUI/ViewModel/ValueViewModel.swift b/UI/UIx/SwiftUI/ViewModel/ValueViewModel.swift deleted file mode 100644 index 698013ee..00000000 --- a/UI/UIx/SwiftUI/ViewModel/ValueViewModel.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// ValueViewModel.swift -// -// -// Created by Mohamed Afifi on 2022-03-01. -// - -import Combine -import Foundation - -@MainActor -public final class ValueViewModel: ObservableObject { - // MARK: Lifecycle - - public init(_ value: V) { - self.value = value - } - - // MARK: Public - - @Published public var value: V -} diff --git a/UI/UIx/SwiftUI/ViewModel/ViewModelContainer.swift b/UI/UIx/SwiftUI/ViewModel/ViewModelContainer.swift deleted file mode 100644 index 64811411..00000000 --- a/UI/UIx/SwiftUI/ViewModel/ViewModelContainer.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// ViewModelContainer.swift -// -// -// Created by Afifi, Mohamed on 9/6/21. -// - -import Combine -import Foundation -import SwiftUI - -public struct ViewModelContainer: View { - // MARK: Lifecycle - - public init(_ viewModel: ViewModel, content: @escaping (ObservedObject.Wrapper) -> Content) { - self.viewModel = viewModel - self.content = { wrapper, _ in content(wrapper) } - } - - public init(_ viewModel: ViewModel, content: @escaping (ViewModel) -> Content) { - self.viewModel = viewModel - self.content = { _, vm in content(vm) } - } - - // MARK: Public - - public var body: some View { - content($viewModel, viewModel) - } - - // MARK: Internal - - @ObservedObject var viewModel: ViewModel - let content: (ObservedObject.Wrapper, ViewModel) -> Content -} diff --git a/UI/UIx/SwiftUI/Views/AttributedString++.swift b/UI/UIx/SwiftUI/Views/AttributedString++.swift new file mode 100644 index 00000000..6d53a2c0 --- /dev/null +++ b/UI/UIx/SwiftUI/Views/AttributedString++.swift @@ -0,0 +1,28 @@ +// +// AttributedString++.swift +// +// +// Created by Mohamed Afifi on 2024-01-20. +// + +import SwiftUI + +extension AttributedString { + public func range( + from range: Range, + overallRange: Range, + overallText: String + ) -> Range? { + let clampedRange = range.clamped(to: overallRange) + if clampedRange.lowerBound >= clampedRange.upperBound { + return nil + } + + let startDistance = overallText.distance(from: overallRange.lowerBound, to: clampedRange.lowerBound) + let endDistance = overallText.distance(from: overallRange.lowerBound, to: clampedRange.upperBound) + + let start = index(startIndex, offsetByCharacters: startDistance) + let end = index(startIndex, offsetByCharacters: endDistance) + return start ..< end + } +} diff --git a/UI/UIx/SwiftUI/Views/CollectionTracker.swift b/UI/UIx/SwiftUI/Views/CollectionTracker.swift new file mode 100644 index 00000000..78335e40 --- /dev/null +++ b/UI/UIx/SwiftUI/Views/CollectionTracker.swift @@ -0,0 +1,107 @@ +// +// CollectionTracker.swift +// +// +// Created by Mohamed Afifi on 2024-01-27. +// + +import SwiftUI + +// MARK: - TrackingView + +private class TrackingTargetView: UIView { + var item: Item + + init(item: Item) { + self.item = item + super.init(frame: .zero) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +private struct TrackingTargetViewRepresentable: UIViewRepresentable { + let item: Item + + func makeUIView(context: Context) -> TrackingTargetView { + TrackingTargetView(item: item) + } + + func updateUIView(_ view: TrackingTargetView, context: Context) { + view.item = item + } +} + +private struct TrackingTargetModifier: ViewModifier { + let item: Item + + func body(content: Content) -> some View { + content + .background(TrackingTargetViewRepresentable(item: item)) + } +} + +// MARK: - TrackingContainer + +private class CollectionTrackerView: UIView {} + +private struct CollectionTrackerViewRepresentable: UIViewRepresentable { + let tracker: CollectionTracker + + func makeUIView(context: Context) -> CollectionTrackerView { + let view = CollectionTrackerView() + updateUIView(view, context: context) + return view + } + + func updateUIView(_ view: CollectionTrackerView, context: Context) { + tracker.view = view + } +} + +public final class CollectionTracker { + fileprivate weak var view: CollectionTrackerView? + + public init() {} + + private var visibleViews: [TrackingTargetView] { + for viewToTry in [view, view?.superview, view?.superview?.superview] { + if let visibleViews = viewToTry?.findVisibleSubviews(ofType: TrackingTargetView.self), !visibleViews.isEmpty { + return visibleViews + } + } + return [] + } + + public func itemAtPoint(_ point: CGPoint, from: UICoordinateSpace) -> Item? { + for visibleView in visibleViews { + let localPoint = visibleView.convert(point, from: from) + if visibleView.point(inside: localPoint, with: nil) { + return visibleView.item + } + } + return nil + } +} + +private struct CollectionTrackerModifier: ViewModifier { + let tracker: CollectionTracker + + func body(content: Content) -> some View { + content + .background(CollectionTrackerViewRepresentable(tracker: tracker)) + } +} + +extension View { + public func trackingTarget(item: some Hashable) -> some View { + modifier(TrackingTargetModifier(item: item)) + } + + public func trackCollection(with tracker: CollectionTracker) -> some View { + modifier(CollectionTrackerModifier(tracker: tracker)) + } +} diff --git a/UI/UIx/SwiftUI/Views/InvertInDarkModeModifier.swift b/UI/UIx/SwiftUI/Views/InvertInDarkModeModifier.swift new file mode 100644 index 00000000..8c674834 --- /dev/null +++ b/UI/UIx/SwiftUI/Views/InvertInDarkModeModifier.swift @@ -0,0 +1,26 @@ +// +// InvertInDarkModeModifier.swift +// +// +// Created by Mohamed Afifi on 2024-01-20. +// + +import SwiftUI + +private struct InvertInDarkModeModifier: ViewModifier { + @Environment(\.colorScheme) var colorScheme + + func body(content: Content) -> some View { + if colorScheme == .dark { + content.colorInvert() + } else { + content + } + } +} + +extension View { + public func invertInDarkMode() -> some View { + modifier(InvertInDarkModeModifier()) + } +} diff --git a/UI/UIx/SwiftUI/Views/PreferredContentSizeMatchesScrollView.swift b/UI/UIx/SwiftUI/Views/PreferredContentSizeMatchesScrollView.swift index c55904f1..0334568f 100644 --- a/UI/UIx/SwiftUI/Views/PreferredContentSizeMatchesScrollView.swift +++ b/UI/UIx/SwiftUI/Views/PreferredContentSizeMatchesScrollView.swift @@ -34,7 +34,7 @@ public extension ScrollView { } private struct PreferredContentSizeMatchesScrollViewBody: UIViewControllerRepresentable { - class PreferredContentSizeMatchesScrollViewController: UIHostingController { + class PreferredContentSizeMatchesScrollViewController: UIHostingController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) view.backgroundColor = nil @@ -56,11 +56,11 @@ private struct PreferredContentSizeMatchesScrollViewBody PreferredContentSizeMatchesScrollViewController { + func makeUIViewController(context: Context) -> PreferredContentSizeMatchesScrollViewController { PreferredContentSizeMatchesScrollViewController(rootView: content) } - func updateUIViewController(_ view: PreferredContentSizeMatchesScrollViewController, context: Context) { + func updateUIViewController(_ view: PreferredContentSizeMatchesScrollViewController, context: Context) { view.rootView = content } } diff --git a/UI/UIx/SwiftUI/Views/SheetPresentationDetents.swift b/UI/UIx/SwiftUI/Views/SheetPresentationDetents.swift new file mode 100644 index 00000000..13d04f92 --- /dev/null +++ b/UI/UIx/SwiftUI/Views/SheetPresentationDetents.swift @@ -0,0 +1,48 @@ +// +// SheetPresentationDetents.swift +// +// +// Created by Mohamed Afifi on 2024-01-20. +// + +import SwiftUI + +public enum SheetPresentationDetent { + case large + case medium + + @available(iOS 16.0, *) + var presentationDetent: PresentationDetent { + switch self { + case .large: .large + case .medium: .medium + } + } +} + +private struct SheetPresentationDetents: ViewModifier { + let detents: [SheetPresentationDetent] + + func body(content: Content) -> some View { + if #available(iOS 16.0, *) { + content + .presentationDetents(presentationDetents) + } else { + content + } + } + + @available(iOS 16.0, *) + private var presentationDetents: Set { + let presentationDetents = detents.map { detent in + detent.presentationDetent + } + return Set(presentationDetents) + } +} + +extension View { + public func sheetPresentationDetents(_ detents: [SheetPresentationDetent]) -> some View { + modifier(SheetPresentationDetents(detents: detents)) + } +} diff --git a/UI/UIx/SwiftUI/Views/TextAlignmentModifier.swift b/UI/UIx/SwiftUI/Views/TextAlignmentModifier.swift new file mode 100644 index 00000000..dc4718ff --- /dev/null +++ b/UI/UIx/SwiftUI/Views/TextAlignmentModifier.swift @@ -0,0 +1,26 @@ +// +// TextAlignmentModifier.swift +// +// +// Created by Mohamed Afifi on 2024-01-20. +// + +import Foundation +import SwiftUI + +extension View { + public func textAlignment(follows characterDirection: Locale.LanguageDirection) -> some View { + multilineTextAlignment(characterDirection.textAlignment) + .frame(maxWidth: .infinity, alignment: characterDirection.alignment) + } +} + +private extension Locale.LanguageDirection { + var alignment: Alignment { + self == .rightToLeft ? .trailing : .leading + } + + var textAlignment: TextAlignment { + self == .rightToLeft ? .trailing : .leading + } +} diff --git a/UI/UIx/SwiftUI/Views/WindowSafeAreaInsetsReaderViewModifier.swift b/UI/UIx/SwiftUI/Views/WindowSafeAreaInsetsReaderViewModifier.swift new file mode 100644 index 00000000..4cc2573e --- /dev/null +++ b/UI/UIx/SwiftUI/Views/WindowSafeAreaInsetsReaderViewModifier.swift @@ -0,0 +1,91 @@ +// +// WindowSafeAreaInsetsReaderViewModifier.swift +// +// +// Created by Mohamed Afifi on 2023-12-29. +// + +import SwiftUI + +extension View { + public func readWindowSafeAreaInsets(_ safeAreaInsets: Binding) -> some View { + modifier(WindowSafeAreaInsetsReaderViewModifier(safeAreaInsets: safeAreaInsets)) + } +} + +private struct WindowSafeAreaInsetsReaderViewModifier: ViewModifier { + @Binding var safeAreaInsets: EdgeInsets + + func body(content: Content) -> some View { + content + .background( + WindowSafeAreaInsetsReader(safeAreaInsets: $safeAreaInsets) + .frame(maxWidth: .infinity) + .frame(height: 0.5) + .accessibility(hidden: true) + .allowsHitTesting(false) + ) + } +} + +private struct WindowSafeAreaInsetsReader: UIViewRepresentable { + class WindowSafeAreaInsetsReaderView: UIView { + // MARK: Lifecycle + + init(safeAreaInsets: Binding) { + _safeAreaInsetsBinding = safeAreaInsets + super.init(frame: .zero) + backgroundColor = UIColor.clear + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: Internal + + @Binding var safeAreaInsetsBinding: EdgeInsets + + override func layoutSubviews() { + super.layoutSubviews() + updateWindowSafeAreaInsetsIfNeeded() + } + + private func updateWindowSafeAreaInsetsIfNeeded() { + if let window { + let insets = window.safeAreaInsets + let newInsets = EdgeInsets( + top: insets.top, + leading: insets.left, + bottom: insets.bottom, + trailing: insets.right + ) + if safeAreaInsetsBinding != newInsets { + safeAreaInsetsBinding = newInsets + } + } + } + + override func systemLayoutSizeFitting(_ targetSize: CGSize) -> CGSize { + .zero + } + + override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize { + .zero + } + } + + @Binding var safeAreaInsets: EdgeInsets + + func makeUIView(context: Context) -> UIView { + let view = WindowSafeAreaInsetsReaderView(safeAreaInsets: $safeAreaInsets) + view.isAccessibilityElement = false + view.isHidden = true + view.isOpaque = true + view.isUserInteractionEnabled = false + return view + } + + func updateUIView(_ view: UIView, context: Context) {} +} diff --git a/UI/UIx/UIKit/Extensions/UIView+Extension.swift b/UI/UIx/UIKit/Extensions/UIView+Extension.swift index b329e930..68c415b6 100644 --- a/UI/UIx/UIKit/Extensions/UIView+Extension.swift +++ b/UI/UIx/UIKit/Extensions/UIView+Extension.swift @@ -96,6 +96,32 @@ extension UIView { } return result } + + /// Finds all visible subviews of a specific type in the view hierarchy. + /// - Parameter type: The type of subviews to find. + /// - Returns: An array of visible subviews of the specified type. + public func findVisibleSubviews(ofType type: T.Type) -> [T] { + findSubviews(ofType: T.self) { subview in + subview.isHidden == false && subview.alpha > 0 && subview.frame.size != .zero + } + } + + private func findSubviews(ofType type: T.Type, include: (UIView) -> Bool) -> [T] { + var filteredSubviews: [T] = [] + + // Function to recursively search for subviews of the specified type. + func findInView(_ view: UIView) { + for subview in view.subviews where include(subview) { + if let typedSubview = subview as? T { + filteredSubviews.append(typedSubview) + } + findInView(subview) // Recursively search in the subview. + } + } + + findInView(self) // Start the search from the current view. + return filteredSubviews + } } extension UIView {