├── .github ├── ISSUE_TEMPLATE.md └── stale.yml ├── .gitignore ├── .hound.yml ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── .travis.yml ├── Assets ├── PopupDialog01.gif ├── PopupDialog02.gif ├── PopupDialog03.gif ├── PopupDialogDark01.png ├── PopupDialogDark02.png └── PopupDialogLogo.png ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cartfile ├── Cartfile.resolved ├── Example ├── .swiftlint.yml ├── Podfile ├── Podfile.lock ├── Pods │ ├── DynamicBlurView │ │ ├── DynamicBlurView │ │ │ ├── BlurLayer.swift │ │ │ ├── CGContext+CGImage.swift │ │ │ ├── CGImage+Accelerate.swift │ │ │ ├── CaptureQuality.swift │ │ │ ├── DynamicBlurView.h │ │ │ ├── DynamicBlurView.swift │ │ │ ├── TrackingMode.swift │ │ │ └── UIImage+Blur.swift │ │ ├── LICENSE │ │ └── README.md │ ├── Local Podspecs │ │ ├── PopupDialog.podspec.json │ │ └── iOSSnapshotTestCase.podspec.json │ ├── Manifest.lock │ ├── Nimble │ │ ├── Carthage │ │ │ └── Checkouts │ │ │ │ ├── CwlCatchException │ │ │ │ └── Sources │ │ │ │ │ ├── CwlCatchException │ │ │ │ │ └── CwlCatchException.swift │ │ │ │ │ └── CwlCatchExceptionSupport │ │ │ │ │ ├── CwlCatchException.m │ │ │ │ │ └── include │ │ │ │ │ └── CwlCatchException.h │ │ │ │ └── CwlPreconditionTesting │ │ │ │ └── Sources │ │ │ │ ├── CwlMachBadInstructionHandler │ │ │ │ ├── CwlMachBadInstructionHandler.m │ │ │ │ ├── include │ │ │ │ │ └── CwlMachBadInstructionHandler.h │ │ │ │ ├── mach_excServer.c │ │ │ │ └── mach_excServer.h │ │ │ │ └── CwlPreconditionTesting │ │ │ │ ├── CwlBadInstructionException.swift │ │ │ │ ├── CwlCatchBadInstruction.swift │ │ │ │ ├── CwlDarwinDefinitions.swift │ │ │ │ └── Mach │ │ │ │ └── CwlPreconditionTesting.h │ │ ├── LICENSE │ │ ├── README.md │ │ └── Sources │ │ │ ├── Nimble │ │ │ ├── Adapters │ │ │ │ ├── AdapterProtocols.swift │ │ │ │ ├── AssertionDispatcher.swift │ │ │ │ ├── AssertionRecorder.swift │ │ │ │ ├── NMBExpectation.swift │ │ │ │ ├── NMBObjCMatcher.swift │ │ │ │ ├── NimbleEnvironment.swift │ │ │ │ └── NimbleXCTestHandler.swift │ │ │ ├── DSL+Wait.swift │ │ │ ├── DSL.swift │ │ │ ├── Expectation.swift │ │ │ ├── ExpectationMessage.swift │ │ │ ├── Expression.swift │ │ │ ├── FailureMessage.swift │ │ │ ├── Matchers │ │ │ │ ├── AllPass.swift │ │ │ │ ├── Async.swift │ │ │ │ ├── BeAKindOf.swift │ │ │ │ ├── BeAnInstanceOf.swift │ │ │ │ ├── BeCloseTo.swift │ │ │ │ ├── BeEmpty.swift │ │ │ │ ├── BeGreaterThan.swift │ │ │ │ ├── BeGreaterThanOrEqualTo.swift │ │ │ │ ├── BeIdenticalTo.swift │ │ │ │ ├── BeLessThan.swift │ │ │ │ ├── BeLessThanOrEqual.swift │ │ │ │ ├── BeLogical.swift │ │ │ │ ├── BeNil.swift │ │ │ │ ├── BeVoid.swift │ │ │ │ ├── BeginWith.swift │ │ │ │ ├── Contain.swift │ │ │ │ ├── ContainElementSatisfying.swift │ │ │ │ ├── EndWith.swift │ │ │ │ ├── Equal.swift │ │ │ │ ├── HaveCount.swift │ │ │ │ ├── Match.swift │ │ │ │ ├── MatchError.swift │ │ │ │ ├── MatcherFunc.swift │ │ │ │ ├── MatcherProtocols.swift │ │ │ │ ├── PostNotification.swift │ │ │ │ ├── Predicate.swift │ │ │ │ ├── RaisesException.swift │ │ │ │ ├── SatisfyAllOf.swift │ │ │ │ ├── SatisfyAnyOf.swift │ │ │ │ ├── ThrowAssertion.swift │ │ │ │ ├── ThrowError.swift │ │ │ │ └── ToSucceed.swift │ │ │ ├── Nimble.h │ │ │ └── Utils │ │ │ │ ├── Await.swift │ │ │ │ ├── Errors.swift │ │ │ │ ├── Functional.swift │ │ │ │ ├── SourceLocation.swift │ │ │ │ └── Stringers.swift │ │ │ └── NimbleObjectiveC │ │ │ ├── DSL.h │ │ │ ├── DSL.m │ │ │ ├── NMBExceptionCapture.h │ │ │ ├── NMBExceptionCapture.m │ │ │ ├── NMBStringify.h │ │ │ ├── NMBStringify.m │ │ │ └── XCTestObservationCenter+Register.m │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── PopupDialog.xcscheme │ ├── SwiftLint │ │ ├── LICENSE │ │ └── swiftlint │ ├── Target Support Files │ │ ├── DynamicBlurView │ │ │ ├── DynamicBlurView-Info.plist │ │ │ ├── DynamicBlurView-dummy.m │ │ │ ├── DynamicBlurView-prefix.pch │ │ │ ├── DynamicBlurView-umbrella.h │ │ │ ├── DynamicBlurView.modulemap │ │ │ ├── DynamicBlurView.xcconfig │ │ │ └── Info.plist │ │ ├── Nimble │ │ │ ├── Info.plist │ │ │ ├── Nimble-Info.plist │ │ │ ├── Nimble-dummy.m │ │ │ ├── Nimble-prefix.pch │ │ │ ├── Nimble-umbrella.h │ │ │ ├── Nimble.modulemap │ │ │ └── Nimble.xcconfig │ │ ├── Pods-PopupDialog_Example │ │ │ ├── Info.plist │ │ │ ├── Pods-PopupDialog_Example-Info.plist │ │ │ ├── Pods-PopupDialog_Example-acknowledgements.markdown │ │ │ ├── Pods-PopupDialog_Example-acknowledgements.plist │ │ │ ├── Pods-PopupDialog_Example-dummy.m │ │ │ ├── Pods-PopupDialog_Example-frameworks.sh │ │ │ ├── Pods-PopupDialog_Example-resources.sh │ │ │ ├── Pods-PopupDialog_Example-umbrella.h │ │ │ ├── Pods-PopupDialog_Example.debug.xcconfig │ │ │ ├── Pods-PopupDialog_Example.modulemap │ │ │ └── Pods-PopupDialog_Example.release.xcconfig │ │ ├── Pods-PopupDialog_Tests │ │ │ ├── Info.plist │ │ │ ├── Pods-PopupDialog_Tests-Info.plist │ │ │ ├── Pods-PopupDialog_Tests-acknowledgements.markdown │ │ │ ├── Pods-PopupDialog_Tests-acknowledgements.plist │ │ │ ├── Pods-PopupDialog_Tests-dummy.m │ │ │ ├── Pods-PopupDialog_Tests-frameworks.sh │ │ │ ├── Pods-PopupDialog_Tests-resources.sh │ │ │ ├── Pods-PopupDialog_Tests-umbrella.h │ │ │ ├── Pods-PopupDialog_Tests.debug.xcconfig │ │ │ ├── Pods-PopupDialog_Tests.modulemap │ │ │ └── Pods-PopupDialog_Tests.release.xcconfig │ │ ├── PopupDialog │ │ │ ├── Info.plist │ │ │ ├── PopupDialog-Info.plist │ │ │ ├── PopupDialog-dummy.m │ │ │ ├── PopupDialog-prefix.pch │ │ │ ├── PopupDialog-umbrella.h │ │ │ ├── PopupDialog.modulemap │ │ │ └── PopupDialog.xcconfig │ │ ├── SwiftLint │ │ │ └── SwiftLint.xcconfig │ │ └── iOSSnapshotTestCase │ │ │ ├── Info.plist │ │ │ ├── iOSSnapshotTestCase-Info.plist │ │ │ ├── iOSSnapshotTestCase-dummy.m │ │ │ ├── iOSSnapshotTestCase-prefix.pch │ │ │ ├── iOSSnapshotTestCase-umbrella.h │ │ │ ├── iOSSnapshotTestCase.modulemap │ │ │ └── iOSSnapshotTestCase.xcconfig │ └── iOSSnapshotTestCase │ │ ├── FBSnapshotTestCase │ │ ├── Categories │ │ │ ├── UIImage+Compare.h │ │ │ ├── UIImage+Compare.m │ │ │ ├── UIImage+Diff.h │ │ │ ├── UIImage+Diff.m │ │ │ ├── UIImage+Snapshot.h │ │ │ └── UIImage+Snapshot.m │ │ ├── FBSnapshotTestCase.h │ │ ├── FBSnapshotTestCase.m │ │ ├── FBSnapshotTestCasePlatform.h │ │ ├── FBSnapshotTestCasePlatform.m │ │ ├── FBSnapshotTestController.h │ │ ├── FBSnapshotTestController.m │ │ └── SwiftSupport.swift │ │ ├── LICENSE │ │ └── README.md ├── PopupDialog.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── PopupDialog-Example.xcscheme ├── PopupDialog.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── PopupDialog │ ├── .gitignore │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CosmosDistrib.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-1024.png │ │ │ ├── Icon-120.png │ │ │ ├── Icon-121.png │ │ │ ├── Icon-152.png │ │ │ ├── Icon-167.png │ │ │ ├── Icon-180.png │ │ │ ├── Icon-20.png │ │ │ ├── Icon-29.png │ │ │ ├── Icon-40.png │ │ │ ├── Icon-41.png │ │ │ ├── Icon-42.png │ │ │ ├── Icon-58.png │ │ │ ├── Icon-59.png │ │ │ ├── Icon-60.png │ │ │ ├── Icon-76.png │ │ │ ├── Icon-80.png │ │ │ ├── Icon-81.png │ │ │ └── Icon-87.png │ │ ├── Contents.json │ │ ├── colorful.imageset │ │ │ ├── Contents.json │ │ │ ├── colorful.png │ │ │ ├── colorful@2x.png │ │ │ └── colorful@3x.png │ │ └── colorful_background.imageset │ │ │ ├── Contents.json │ │ │ ├── colorful_background.png │ │ │ ├── colorful_background@2x.png │ │ │ └── colorful_background@3x.png │ ├── Info.plist │ ├── RatingViewController.swift │ ├── RatingViewController.xib │ └── ViewController.swift └── devimages.cer ├── LICENSE ├── Package.resolved ├── Package.swift ├── PopupDialog.podspec ├── PopupDialog ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── InteractiveTransition.swift │ ├── PopupDialog+Keyboard.swift │ ├── PopupDialog.swift │ ├── PopupDialogButton.swift │ ├── PopupDialogContainerView.swift │ ├── PopupDialogDefaultButtons.swift │ ├── PopupDialogDefaultView.swift │ ├── PopupDialogDefaultViewController.swift │ ├── PopupDialogOverlayView.swift │ ├── PresentationController.swift │ ├── PresentationManager.swift │ ├── TransitionAnimations.swift │ ├── TransitionAnimator.swift │ ├── UIImageView+Calculations.swift │ ├── UIView+Animations.swift │ └── UIViewController+Visibility.swift ├── README.md ├── Tests ├── AppearanceTests.swift ├── CustomViewController.swift ├── Info.plist ├── ReferenceImages_64 │ └── PopupDialog_Tests.SnapshotTests │ │ ├── testCustomDialog_iPad_11_1_768x1024.png │ │ ├── testCustomDialog_iPad_11_1_768x1024@2x.png │ │ ├── testCustomDialog_iPhone_10_2_375x667.png │ │ ├── testCustomDialog_iPhone_10_2_375x667@2x.png │ │ ├── testCustomDialog_iPhone_12_2_414x896.png │ │ ├── testCustomDialog_iPhone_12_2_414x896@2x.png │ │ ├── testInitialView_iPad_11_1_768x1024.png │ │ ├── testInitialView_iPad_11_1_768x1024@2x.png │ │ ├── testInitialView_iPhone_10_2_375x667.png │ │ ├── testInitialView_iPhone_10_2_375x667@2x.png │ │ ├── testInitialView_iPhone_12_2_414x896.png │ │ ├── testInitialView_iPhone_12_2_414x896@2x.png │ │ ├── testStandardDialogWithImage_iPad_11_1_768x1024.png │ │ ├── testStandardDialogWithImage_iPad_11_1_768x1024@2x.png │ │ ├── testStandardDialogWithImage_iPhone_10_2_375x667.png │ │ ├── testStandardDialogWithImage_iPhone_10_2_375x667@2x.png │ │ ├── testStandardDialogWithImage_iPhone_12_2_414x896.png │ │ ├── testStandardDialogWithImage_iPhone_12_2_414x896@2x.png │ │ ├── testStandardDialogWithoutImage_iPad_11_1_768x1024.png │ │ ├── testStandardDialogWithoutImage_iPad_11_1_768x1024@2x.png │ │ ├── testStandardDialogWithoutImage_iPhone_10_2_375x667.png │ │ ├── testStandardDialogWithoutImage_iPhone_10_2_375x667@2x.png │ │ ├── testStandardDialogWithoutImage_iPhone_12_2_414x896.png │ │ └── testStandardDialogWithoutImage_iPhone_12_2_414x896@2x.png ├── SnapshotTests.swift └── Tests.swift └── UITests ├── Info.plist └── Tests.swift /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | > Please fill out this template when filing an issue. 2 | > All ℹ symbols should be replaced with information on the issue. 3 | > Please remove this line and all above before submitting. 4 | 5 | # Report 6 | 7 | ## Environment 8 | Please provide information on your development environment, so we can build with the same scenario. 9 | 10 | - Xcode version (e.g. 9.1): ℹ 11 | - PopupDialog version (e.g. 0.5.0): ℹ 12 | - Minimum deployment target (e.g. 9.0): ℹ 13 | - Language (Objective-C / Swift): ℹ 14 | - In case of Swift - Version (e.g. 4): ℹ 15 | 16 | ## Dependency management 17 | If you are not using any dependency managers, you can remove this section. 18 | 19 | - Dependency manager (e.g. CocoaPods): ℹ 20 | - Version (e.g. 1.3.1): ℹ 21 | 22 | ## What did you do? 23 | 24 | ℹ Please replace this with what you did. 25 | 26 | ## What did you expect to happen? 27 | 28 | ℹ Please replace this with what you expected to happen. 29 | 30 | ## What happened instead? 31 | 32 | ℹ Please replace this with of what happened instead. 33 | 34 | ## Project that demonstrates the issue 35 | 36 | ℹ In complex cases, it might be useful to link to a sample project. If you don't provide an example, you can delete this section. -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - guide 8 | - pinned 9 | - security 10 | # Label to use when marking an issue as stale 11 | staleLabel: wontfix 12 | # Comment to post when marking an issue as stale. Set to `false` to disable 13 | markComment: > 14 | This issue has been automatically marked as stale because it has not had 15 | recent activity. It will be closed if no further activity occurs. Thank you 16 | for your contributions. 17 | # Comment to post when closing a stale issue. Set to `false` to disable 18 | closeComment: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Carthage 26 | 27 | # We recommend against adding the Pods directory to your .gitignore. However 28 | # you should judge for yourself, the pros and cons are mentioned at: 29 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 30 | # 31 | # Note: if you ignore the Pods directory, make sure to uncomment 32 | # `pod install` in .travis.yml 33 | # 34 | # Pods/ 35 | .idea 36 | /Tests/FailureDiffs 37 | xcshareddata 38 | .build 39 | -------------------------------------------------------------------------------- /.hound.yml: -------------------------------------------------------------------------------- 1 | swift: 2 | config_file: Example/.swiftlint.yml 3 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10.2 3 | env: 4 | global: 5 | - WORKSPACE=Example/PopupDialog.xcworkspace 6 | - IOS_FRAMEWORK_SCHEME="PopupDialog-Example" 7 | - IOS_SDK=iphonesimulator12.2 8 | matrix: 9 | - DESTINATION="OS=12.2,name=iPhone Xʀ" SIMNAME="com.apple.CoreSimulator.SimDeviceType.iPhone-Xʀ, 12.2" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" POD_LINT="YES" 10 | - DESTINATION="OS=10.2,name=iPhone 6" SIMNAME="com.apple.CoreSimulator.SimDeviceType.iPhone-6, 10.2" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" POD_LINT="NO" 11 | - DESTINATION="OS=11.1,name=iPad Air 2" SIMNAME="com.apple.CoreSimulator.SimDeviceType.iPad-Air-2, 11.1" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" POD_LINT="NO" 12 | before_install: 13 | - npm install ios-sim -g 14 | - gem install cocoapods --no-document --quiet 15 | - pod install --project-directory=./Example --repo-update 16 | script: 17 | - set -o pipefail 18 | - xcodebuild -version 19 | - xcodebuild -showsdks 20 | - xcrun simctl list 21 | 22 | # "Prewarm" simulators as of https://github.com/travis-ci/travis-ci/issues/6675 23 | # - ios-sim start --devicetypeid "$SIMNAME" 24 | 25 | # Build Framework in Debug and run tests 26 | - xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c; 27 | 28 | # Run `pod lib lint` if specified 29 | - if [ $POD_LINT == "YES" ]; then 30 | pod lib lint; 31 | fi 32 | -------------------------------------------------------------------------------- /Assets/PopupDialog01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialog01.gif -------------------------------------------------------------------------------- /Assets/PopupDialog02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialog02.gif -------------------------------------------------------------------------------- /Assets/PopupDialog03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialog03.gif -------------------------------------------------------------------------------- /Assets/PopupDialogDark01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialogDark01.png -------------------------------------------------------------------------------- /Assets/PopupDialogDark02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialogDark02.png -------------------------------------------------------------------------------- /Assets/PopupDialogLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Assets/PopupDialogLogo.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | * **1.1.1** Updates dependencies to Swift 5 3 | * **1.1.0** Swift 5 support 4 | * **1.0.0** Pinned Swift version to 4.2
Dropped iOS 9 support as of moving to ios-snapshot-test-case 5 | * **0.9.2** Fixes crash when presenting dialog while app is inactive 6 | * **0.9.1** Fixes Carthage support 7 | * **0.9.0** Swift 4.2 support 8 | * **0.8.1** Added shadow appearance properties 9 | * **0.8.0** Separated tap and pan gesture dismissal 10 | * **0.7.1** Fixes Objective-C compatability
Improved Carthage handling 11 | * **0.7.0** Removed FXBlurView while switching to DynamicBlurView 12 | * **0.6.2** Added preferredWidth option for iPads 13 | * **0.6.1** Added shake animation
Introduced hideStatusBar option 14 | * **0.6.0** Swift 4 support
Dropped iOS8 compatibility 15 | * **0.5.4** Fixed bug where blur view would reveal hidden layer
Improved view controller lifecycle handling
Scroll views can now be used with gesture dismissal 16 | * **0.5.3** Fixed memory leak with custom view controllers
Added UI automation & snapshot tests 17 | * **0.5.2** Fixed image scaling for default view 18 | * **0.5.1** Introduced custom button height parameter
Reintroduced iOS8 compatibility 19 | * **0.5.0** Swift 3 compatibility / removed iOS8 20 | * **0.4.0** iOS 8 compatibility 21 | * **0.3.3** Fixes buttons being added multiple times 22 | * **0.3.2** Dialog repositioning when interacting with keyboard
Non dismissable buttons option
Additional completion handler when dialog is dismissed 23 | * **0.3.1** Fixed Carthage issues 24 | * **0.3.0** Objective-C compatibility 25 | * **0.2.2** Turned off liveBlur by default to increase performance 26 | * **0.2.1** Dismiss via background tap or swipe down transition 27 | * **0.2.0** You can now pass custom view controllers to the dialog. This introduces breaking changes. 28 | * **0.1.6** Defer button action until animation completes 29 | * **0.1.5** Exposed dialog properties
(titleText, messageText, image, buttonAlignment, transitionStyle) 30 | * **0.1.4** Pick transition animation style 31 | * **0.1.3** Big screen support
Exposed basic shadow appearance 32 | * **0.1.2** Exposed blur and overlay appearance 33 | * **0.1.1** Added themeing example 34 | * **0.1.0** Intitial version 35 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mwfire@mwfire.de. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you so much for contributing to PopupDialog! We have put together a few things that are important for us and are hoprefully helpful for you. 4 | 5 | ## Adding new features 6 | 7 | We try to keep this project as simple and easy to use as possible. That is why we also try to stick to adding only functionality that a broader group of people can benefit from. Consequently, not all feature ideas might make it to the library. A good place to discuss new features, improvements and enhancements is the GitHub issue tracker. 8 | 9 | ## Breaking changes 10 | Gernerally speaking, try not to introduce breaking changes for small updates. On the other hand, do not fear to introduce them where it makes sense either. Please be aware, however, that breaking changes are released as major versions, so it might be necessary to be a bit more patient until all features for a major release are gathered. 11 | 12 | ## Style 13 | PopupDialog uses Swiftlint to enforce best practices and warns you about violations early in the process. PopupDialog should build with zero warnings. 14 | 15 | ## Testing 16 | * Before doing a PR please ensure changes did not break any existing tests. 17 | * Updating existing unit tests / writing unit tests for new functionality is mandatory. 18 | * PopupDialog uses FBSnapshot test cases to ensure there are no user interface regressions. If your changes affect the appearance of PopupDialog, make sure to run Snapshot test cases in record mode first. The devices and OS versions required for reference images can be found in the .travis.yml file. 19 | * If applicable, add UI tests for UI related PopupDialog features. 20 | 21 | ## Documentation 22 | When adding or changing functionality, please help us with updating the docs, that is README and CHANGELOG, to reflect the latest updates. 23 | 24 | ### Thank you! Happy contributing :) 25 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "KyoheiG3/DynamicBlurView" ~> 3.0 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "KyoheiG3/DynamicBlurView" "3.0.1" 2 | -------------------------------------------------------------------------------- /Example/.swiftlint.yml: -------------------------------------------------------------------------------- 1 | 2 | included: 3 | - ../PopupDialog 4 | 5 | excluded: 6 | - Carthage 7 | - Pods 8 | - External 9 | 10 | disabled_rules: 11 | - line_length 12 | - type_name 13 | - todo 14 | - valid_docs 15 | - conditional_binding_cascade 16 | - trailing_newline 17 | - trailing_whitespace 18 | 19 | opt_in_rules: 20 | - empty_count 21 | - force_unwrapping 22 | 23 | force_cast: warning 24 | 25 | vertical_whitespace: 26 | max_empty_lines: 2 27 | 28 | function_parameter_count: 29 | - 6 #warning 30 | - 8 #error 31 | 32 | cyclomatic_complexity: 33 | - 20 #warning 34 | - 35 #error 35 | 36 | file_length: 37 | - 400 #warning 38 | - 600 #error 39 | 40 | function_body_length: 41 | - 40 #warning 42 | - 80 #error 43 | 44 | line_length: 45 | - 300 #warning 46 | - 350 #error 47 | 48 | type_body_length: 49 | - 400 #warning 50 | - 500 #error 51 | 52 | identifier_name: 53 | excluded: 54 | - id 55 | - vc 56 | - to 57 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '10.0' 2 | use_frameworks! 3 | 4 | ENV['COCOAPODS_DISABLE_STATS'] = "true" ## This disabled the Sending Stats when running Pod install in terminal 5 | 6 | target 'PopupDialog_Example' do 7 | 8 | pod 'PopupDialog', :path => '../' 9 | pod 'SwiftLint', '~> 0.35' 10 | 11 | target 'PopupDialog_Tests' do 12 | inherit! :search_paths 13 | 14 | pod 'Nimble', '~> 7.3.1' 15 | pod 'iOSSnapshotTestCase', '~> 6.0.2' 16 | 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DynamicBlurView (4.0.0) 3 | - iOSSnapshotTestCase (6.0.3): 4 | - iOSSnapshotTestCase/SwiftSupport (= 6.0.3) 5 | - iOSSnapshotTestCase/Core (6.0.3) 6 | - iOSSnapshotTestCase/SwiftSupport (6.0.3): 7 | - iOSSnapshotTestCase/Core 8 | - Nimble (7.3.4) 9 | - PopupDialog (1.1.1): 10 | - DynamicBlurView (~> 4.0) 11 | - SwiftLint (0.35.0) 12 | 13 | DEPENDENCIES: 14 | - iOSSnapshotTestCase (~> 6.0.2) 15 | - Nimble (~> 7.3.1) 16 | - PopupDialog (from `../`) 17 | - SwiftLint (~> 0.35) 18 | 19 | SPEC REPOS: 20 | trunk: 21 | - DynamicBlurView 22 | - iOSSnapshotTestCase 23 | - Nimble 24 | - SwiftLint 25 | 26 | EXTERNAL SOURCES: 27 | PopupDialog: 28 | :path: "../" 29 | 30 | SPEC CHECKSUMS: 31 | DynamicBlurView: ccf9acd2b20c883cc2c72e3524a04d8d3ee20533 32 | iOSSnapshotTestCase: 944a73f6d9676302811a86c0cf35f0e6ef5ab2a0 33 | Nimble: 051e3d8912d40138fa5591c78594f95fb172af37 34 | PopupDialog: 720c92befd8bc23c13442254945213db5612f149 35 | SwiftLint: 5553187048b900c91aa03552807681bb6b027846 36 | 37 | PODFILE CHECKSUM: 07c617a2f6b270e1e612e31d4f4d376badedc104 38 | 39 | COCOAPODS: 1.8.1 40 | -------------------------------------------------------------------------------- /Example/Pods/DynamicBlurView/DynamicBlurView/CGContext+CGImage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGContext+CGImage.swift 3 | // DynamicBlurView 4 | // 5 | // Created by Kyohei Ito on 2017/08/17. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | extension CGContext { 10 | static func imageContext(with quality: CaptureQuality, rect: CGRect, opaque: Bool) -> CGContext? { 11 | UIGraphicsBeginImageContextWithOptions(rect.size, opaque, quality.imageScale) 12 | guard let context = UIGraphicsGetCurrentContext() else { 13 | return nil 14 | } 15 | 16 | context.translateBy(x: -rect.origin.x, y: -rect.origin.y) 17 | context.interpolationQuality = quality.interpolationQuality 18 | 19 | return context 20 | } 21 | 22 | func makeImage(with blendColor: UIColor?, blendMode: CGBlendMode, size: CGSize) -> CGImage? { 23 | if let color = blendColor { 24 | setFillColor(color.cgColor) 25 | setBlendMode(blendMode) 26 | fill(CGRect(origin: .zero, size: size)) 27 | } 28 | 29 | return makeImage() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/DynamicBlurView/DynamicBlurView/CGImage+Accelerate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGImage+Accelerate.swift 3 | // DynamicBlurView 4 | // 5 | // Created by Kyohei Ito on 2017/08/17. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | import Accelerate 10 | 11 | extension CGImage { 12 | var area: Int { 13 | return width * height 14 | } 15 | 16 | private var size: CGSize { 17 | return CGSize(width: width, height: height) 18 | } 19 | 20 | private var bytes: Int { 21 | return bytesPerRow * height 22 | } 23 | 24 | private func imageBuffer(from data: UnsafeMutableRawPointer!) -> vImage_Buffer { 25 | return vImage_Buffer(data: data, height: vImagePixelCount(height), width: vImagePixelCount(width), rowBytes: bytesPerRow) 26 | } 27 | 28 | func blurred(with boxSize: UInt32, iterations: Int, blendColor: UIColor?, blendMode: CGBlendMode) -> CGImage? { 29 | guard let providerData = dataProvider?.data else { 30 | return nil 31 | } 32 | 33 | let inData = malloc(bytes) 34 | var inBuffer = imageBuffer(from: inData) 35 | 36 | let outData = malloc(bytes) 37 | var outBuffer = imageBuffer(from: outData) 38 | 39 | let tempSize = vImageBoxConvolve_ARGB8888(&inBuffer, &outBuffer, nil, 0, 0, boxSize, boxSize, nil, vImage_Flags(kvImageEdgeExtend + kvImageGetTempBufferSize)) 40 | let tempData = malloc(tempSize) 41 | 42 | defer { 43 | free(inData) 44 | free(outData) 45 | free(tempData) 46 | } 47 | 48 | let source = CFDataGetBytePtr(providerData) 49 | memcpy(inBuffer.data, source, bytes) 50 | 51 | for _ in 0.. 10 | 11 | //! Project version number for DynamicBlurView. 12 | FOUNDATION_EXPORT double DynamicBlurViewVersionNumber; 13 | 14 | //! Project version string for DynamicBlurView. 15 | FOUNDATION_EXPORT const unsigned char DynamicBlurViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/Pods/DynamicBlurView/DynamicBlurView/TrackingMode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TrackingMode.swift 3 | // DynamicBlurView 4 | // 5 | // Created by Kyohei Ito on 2017/08/17. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | public enum TrackingMode: CustomStringConvertible { 10 | case tracking 11 | case common 12 | case none 13 | 14 | public var description: String { 15 | switch self { 16 | case .tracking: 17 | return RunLoop.Mode.tracking.rawValue 18 | case .common: 19 | return RunLoop.Mode.common.rawValue 20 | case .none: 21 | return "" 22 | } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Example/Pods/DynamicBlurView/DynamicBlurView/UIImage+Blur.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Blur.swift 3 | // DynamicBlurView 4 | // 5 | // Created by Kyohei Ito on 2017/08/11. 6 | // Copyright © 2017年 kyohei_ito. All rights reserved. 7 | // 8 | 9 | public extension UIImage { 10 | func blurred(radius: CGFloat, iterations: Int, ratio: CGFloat, blendColor color: UIColor?, blendMode mode: CGBlendMode) -> UIImage? { 11 | guard let cgImage = cgImage else { 12 | return nil 13 | } 14 | 15 | if cgImage.area <= 0 || radius <= 0 { 16 | return self 17 | } 18 | 19 | var boxSize = UInt32(radius * scale * ratio) 20 | if boxSize % 2 == 0 { 21 | boxSize += 1 22 | } 23 | 24 | return cgImage.blurred(with: boxSize, iterations: iterations, blendColor: color, blendMode: mode).map { 25 | UIImage(cgImage: $0, scale: scale, orientation: imageOrientation) 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example/Pods/DynamicBlurView/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kyohei Ito 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/PopupDialog.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PopupDialog", 3 | "version": "1.1.1", 4 | "summary": "A simple custom popup dialog view controller", 5 | "homepage": "https://github.com/orderella/PopupDialog", 6 | "license": { 7 | "type": "MIT", 8 | "file": "LICENSE" 9 | }, 10 | "authors": { 11 | "Martin Wildfeuer": "mwfire@mwfire.de" 12 | }, 13 | "source": { 14 | "git": "https://github.com/orderella/PopupDialog.git", 15 | "tag": "1.1.1" 16 | }, 17 | "social_media_url": "https://twitter.com/theMWFire", 18 | "platforms": { 19 | "ios": "10.0" 20 | }, 21 | "source_files": "PopupDialog/Classes/**/*", 22 | "swift_versions": "5.0", 23 | "dependencies": { 24 | "DynamicBlurView": [ 25 | "~> 4.0" 26 | ] 27 | }, 28 | "swift_version": "5.0" 29 | } 30 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/iOSSnapshotTestCase.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "iOSSnapshotTestCase", 3 | "module_name": "FBSnapshotTestCase", 4 | "version": "6.0.2", 5 | "summary": "Snapshot view unit tests for iOS", 6 | "description": "A \"snapshot test case\" takes a configured UIView or CALayer\nand uses the renderInContext: method to get an image snapshot\nof its contents. It compares this snapshot to a \"reference image\"\nstored in your source code repository and fails the test if the\ntwo images don't match.", 7 | "homepage": "https://github.com/uber/ios-snapshot-test-case", 8 | "license": "MIT", 9 | "authors": "Uber", 10 | "source": { 11 | "git": "https://github.com/uber/ios-snapshot-test-case.git", 12 | "tag": "6.0.2" 13 | }, 14 | "platforms": { 15 | "ios": "10.0", 16 | "tvos": "9.0" 17 | }, 18 | "requires_arc": true, 19 | "frameworks": [ 20 | "XCTest", 21 | "UIKit", 22 | "Foundation", 23 | "QuartzCore" 24 | ], 25 | "pod_target_xcconfig": { 26 | "ENABLE_BITCODE": "NO" 27 | }, 28 | "user_target_xcconfig": { 29 | "FRAMEWORK_SEARCH_PATHS": "$(PLATFORM_DIR)/Developer/Library/Frameworks" 30 | }, 31 | "default_subspecs": "SwiftSupport", 32 | "subspecs": [ 33 | { 34 | "name": "Core", 35 | "source_files": [ 36 | "FBSnapshotTestCase/**/*.{h,m}", 37 | "FBSnapshotTestCase/*.{h,m}" 38 | ], 39 | "public_header_files": [ 40 | "FBSnapshotTestCase/FBSnapshotTestCase.h", 41 | "FBSnapshotTestCase/FBSnapshotTestCasePlatform.h", 42 | "FBSnapshotTestCase/FBSnapshotTestController.h" 43 | ], 44 | "private_header_files": [ 45 | "FBSnapshotTestCase/Categories/UIImage+Compare.h", 46 | "FBSnapshotTestCase/Categories/UIImage+Diff.h", 47 | "FBSnapshotTestCase/Categories/UIImage+Snapshot.h" 48 | ] 49 | }, 50 | { 51 | "name": "SwiftSupport", 52 | "dependencies": { 53 | "iOSSnapshotTestCase/Core": [ 54 | 55 | ] 56 | }, 57 | "source_files": "FBSnapshotTestCase/**/*.swift" 58 | } 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - DynamicBlurView (4.0.0) 3 | - iOSSnapshotTestCase (6.0.3): 4 | - iOSSnapshotTestCase/SwiftSupport (= 6.0.3) 5 | - iOSSnapshotTestCase/Core (6.0.3) 6 | - iOSSnapshotTestCase/SwiftSupport (6.0.3): 7 | - iOSSnapshotTestCase/Core 8 | - Nimble (7.3.4) 9 | - PopupDialog (1.1.1): 10 | - DynamicBlurView (~> 4.0) 11 | - SwiftLint (0.35.0) 12 | 13 | DEPENDENCIES: 14 | - iOSSnapshotTestCase (~> 6.0.2) 15 | - Nimble (~> 7.3.1) 16 | - PopupDialog (from `../`) 17 | - SwiftLint (~> 0.35) 18 | 19 | SPEC REPOS: 20 | trunk: 21 | - DynamicBlurView 22 | - iOSSnapshotTestCase 23 | - Nimble 24 | - SwiftLint 25 | 26 | EXTERNAL SOURCES: 27 | PopupDialog: 28 | :path: "../" 29 | 30 | SPEC CHECKSUMS: 31 | DynamicBlurView: ccf9acd2b20c883cc2c72e3524a04d8d3ee20533 32 | iOSSnapshotTestCase: 944a73f6d9676302811a86c0cf35f0e6ef5ab2a0 33 | Nimble: 051e3d8912d40138fa5591c78594f95fb172af37 34 | PopupDialog: 720c92befd8bc23c13442254945213db5612f149 35 | SwiftLint: 5553187048b900c91aa03552807681bb6b027846 36 | 37 | PODFILE CHECKSUM: 07c617a2f6b270e1e612e31d4f4d376badedc104 38 | 39 | COCOAPODS: 1.8.1 40 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchException/CwlCatchException.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CwlCatchException.swift 3 | // CwlAssertionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | import Foundation 22 | 23 | #if SWIFT_PACKAGE 24 | import CwlCatchExceptionSupport 25 | #endif 26 | 27 | private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { 28 | return catchExceptionOfKind(type, block) as? T 29 | } 30 | 31 | extension NSException { 32 | public static func catchException(in block: () -> Void) -> Self? { 33 | return catchReturnTypeConverter(self, block: block) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/CwlCatchException.m: -------------------------------------------------------------------------------- 1 | // 2 | // CwlCatchException.m 3 | // CwlAssertionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | #import "CwlCatchException.h" 22 | 23 | #if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE 24 | __attribute__((visibility("hidden"))) 25 | #endif 26 | NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)) { 27 | @try { 28 | inBlock(); 29 | } @catch (NSException *exception) { 30 | if ([exception isKindOfClass:type]) { 31 | return exception; 32 | } else { 33 | @throw; 34 | } 35 | } 36 | return nil; 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlCatchException/Sources/CwlCatchExceptionSupport/include/CwlCatchException.h: -------------------------------------------------------------------------------- 1 | // 2 | // CwlCatchException.h 3 | // CwlCatchException 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | #import 22 | 23 | //! Project version number for CwlCatchException. 24 | FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; 25 | 26 | //! Project version string for CwlCatchException. 27 | FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; 28 | 29 | #if !SWIFT_PACKAGE && NON_SWIFT_PACKAGE 30 | __attribute__((visibility("hidden"))) 31 | #endif 32 | NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)(void)); 33 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/CwlMachBadInstructionHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CwlMachBadExceptionHandler.m 3 | // CwlPreconditionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | #if defined(__x86_64__) 22 | 23 | #import "mach_excServer.h" 24 | #import "CwlMachBadInstructionHandler.h" 25 | 26 | @protocol BadInstructionReply 27 | +(NSNumber *)receiveReply:(NSValue *)value; 28 | @end 29 | 30 | /// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. 31 | kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { 32 | bad_instruction_exception_reply_t reply = { exception_port, exception, code, codeCnt, flavor, old_state, old_stateCnt, new_state, new_stateCnt }; 33 | Class badInstructionClass = NSClassFromString(@"BadInstructionException"); 34 | NSValue *value = [NSValue valueWithBytes: &reply objCType: @encode(bad_instruction_exception_reply_t)]; 35 | return [[badInstructionClass performSelector: @selector(receiveReply:) withObject: value] intValue]; 36 | } 37 | 38 | // The mach port should be configured so that this function is never used. 39 | kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { 40 | assert(false); 41 | return KERN_FAILURE; 42 | } 43 | 44 | // The mach port should be configured so that this function is never used. 45 | kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { 46 | assert(false); 47 | return KERN_FAILURE; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlMachBadInstructionHandler/include/CwlMachBadInstructionHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CwlMachBadInstructionHandler.h 3 | // CwlPreconditionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | #import 22 | #import 23 | 24 | NS_ASSUME_NONNULL_BEGIN 25 | 26 | extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); 27 | 28 | // The request_mach_exception_raise_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. 29 | typedef struct 30 | { 31 | mach_msg_header_t Head; 32 | /* start of the kernel processed data */ 33 | mach_msg_body_t msgh_body; 34 | mach_msg_port_descriptor_t thread; 35 | mach_msg_port_descriptor_t task; 36 | /* end of the kernel processed data */ 37 | NDR_record_t NDR; 38 | exception_type_t exception; 39 | mach_msg_type_number_t codeCnt; 40 | int64_t code[2]; 41 | int flavor; 42 | mach_msg_type_number_t old_stateCnt; 43 | natural_t old_state[224]; 44 | } request_mach_exception_raise_t; 45 | 46 | // The reply_mach_exception_raise_state_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. 47 | typedef struct 48 | { 49 | mach_msg_header_t Head; 50 | NDR_record_t NDR; 51 | kern_return_t RetCode; 52 | int flavor; 53 | mach_msg_type_number_t new_stateCnt; 54 | natural_t new_state[224]; 55 | } reply_mach_exception_raise_state_t; 56 | 57 | typedef struct 58 | { 59 | mach_port_t exception_port; 60 | exception_type_t exception; 61 | mach_exception_data_type_t const * _Nullable code; 62 | mach_msg_type_number_t codeCnt; 63 | int32_t * _Nullable flavor; 64 | natural_t const * _Nullable old_state; 65 | mach_msg_type_number_t old_stateCnt; 66 | thread_state_t _Nullable new_state; 67 | mach_msg_type_number_t * _Nullable new_stateCnt; 68 | } bad_instruction_exception_reply_t; 69 | 70 | NS_ASSUME_NONNULL_END 71 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/CwlDarwinDefinitions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CwlDarwinDefinitions.swift 3 | // CwlPreconditionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | import Darwin 22 | 23 | #if arch(x86_64) 24 | 25 | // From /usr/include/mach/message.h 26 | // #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ 27 | // #define MACH_MSGH_BITS_REMOTE(bits) \ 28 | // ((bits) & MACH_MSGH_BITS_REMOTE_MASK) 29 | // #define MACH_MSGH_BITS(remote, local) /* legacy */ \ 30 | // ((remote) | ((local) << 8)) 31 | public let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 32 | public func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } 33 | public func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } 34 | 35 | // From /usr/include/mach/exception_types.h 36 | // #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ 37 | // #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) 38 | public let EXC_BAD_INSTRUCTION: UInt32 = 2 39 | public let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION 40 | 41 | // From /usr/include/mach/i386/thread_status.h 42 | // #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ 43 | // ( sizeof (x86_thread_state64_t) / sizeof (int) )) 44 | public let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) 45 | 46 | public let EXC_TYPES_COUNT = 14 47 | public struct execTypesCountTuple { 48 | // From /usr/include/mach/i386/exception.h 49 | // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ 50 | public var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 51 | public init() { 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h: -------------------------------------------------------------------------------- 1 | // 2 | // CwlPreconditionTesting.h 3 | // CwlPreconditionTesting 4 | // 5 | // Created by Matt Gallagher on 2016/01/10. 6 | // Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. 7 | // 8 | // Permission to use, copy, modify, and/or distribute this software for any 9 | // purpose with or without fee is hereby granted, provided that the above 10 | // copyright notice and this permission notice appear in all copies. 11 | // 12 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 15 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 18 | // IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | // 20 | 21 | #import 22 | 23 | extern bool _swift_reportFatalErrorsToDebugger; 24 | 25 | //! Project version number for CwlUtils. 26 | FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; 27 | 28 | //! Project version string for CwlUtils. 29 | FOUNDATION_EXPORT const unsigned char CwlAssertingTestingVersionString[]; 30 | 31 | #include "CwlMachBadInstructionHandler.h" 32 | #include "CwlCatchException.h" 33 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Protocol for the assertion handler that Nimble uses for all expectations. 4 | public protocol AssertionHandler { 5 | func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) 6 | } 7 | 8 | /// Global backing interface for assertions that Nimble creates. 9 | /// Defaults to a private test handler that passes through to XCTest. 10 | /// 11 | /// If XCTest is not available, you must assign your own assertion handler 12 | /// before using any matchers, otherwise Nimble will abort the program. 13 | /// 14 | /// @see AssertionHandler 15 | public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in 16 | return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() 17 | }() 18 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift: -------------------------------------------------------------------------------- 1 | /// AssertionDispatcher allows multiple AssertionHandlers to receive 2 | /// assertion messages. 3 | /// 4 | /// @warning Does not fully dispatch if one of the handlers raises an exception. 5 | /// This is possible with XCTest-based assertion handlers. 6 | /// 7 | public class AssertionDispatcher: AssertionHandler { 8 | let handlers: [AssertionHandler] 9 | 10 | public init(handlers: [AssertionHandler]) { 11 | self.handlers = handlers 12 | } 13 | 14 | public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { 15 | for handler in handlers { 16 | handler.assert(assertion, message: message, location: location) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift: -------------------------------------------------------------------------------- 1 | import Dispatch 2 | import Foundation 3 | 4 | /// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this 5 | /// class' existence 6 | internal class NimbleEnvironment: NSObject { 7 | static var activeInstance: NimbleEnvironment { 8 | get { 9 | let env = Thread.current.threadDictionary["NimbleEnvironment"] 10 | if let env = env as? NimbleEnvironment { 11 | return env 12 | } else { 13 | let newEnv = NimbleEnvironment() 14 | self.activeInstance = newEnv 15 | return newEnv 16 | } 17 | } 18 | set { 19 | Thread.current.threadDictionary["NimbleEnvironment"] = newValue 20 | } 21 | } 22 | 23 | // TODO: eventually migrate the global to this environment value 24 | var assertionHandler: AssertionHandler { 25 | get { return NimbleAssertionHandler } 26 | set { NimbleAssertionHandler = newValue } 27 | } 28 | 29 | var suppressTVOSAssertionWarning: Bool = false 30 | var awaiter: Awaiter 31 | 32 | override init() { 33 | let timeoutQueue: DispatchQueue 34 | if #available(OSX 10.10, *) { 35 | timeoutQueue = DispatchQueue.global(qos: .userInitiated) 36 | } else { 37 | timeoutQueue = DispatchQueue.global(priority: .high) 38 | } 39 | 40 | awaiter = Awaiter( 41 | waitLock: AssertionWaitLock(), 42 | asyncQueue: .main, 43 | timeoutQueue: timeoutQueue 44 | ) 45 | 46 | super.init() 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/DSL.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Make an expectation on a given actual value. The value given is lazily evaluated. 4 | public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { 5 | return Expectation( 6 | expression: Expression( 7 | expression: expression, 8 | location: SourceLocation(file: file, line: line), 9 | isClosure: true)) 10 | } 11 | 12 | /// Make an expectation on a given actual value. The closure is lazily invoked. 13 | public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation { 14 | return Expectation( 15 | expression: Expression( 16 | expression: expression, 17 | location: SourceLocation(file: file, line: line), 18 | isClosure: true)) 19 | } 20 | 21 | /// Always fails the test with a message and a specified location. 22 | public func fail(_ message: String, location: SourceLocation) { 23 | let handler = NimbleEnvironment.activeInstance.assertionHandler 24 | handler.assert(false, message: FailureMessage(stringValue: message), location: location) 25 | } 26 | 27 | /// Always fails the test with a message. 28 | public func fail(_ message: String, file: FileString = #file, line: UInt = #line) { 29 | fail(message, location: SourceLocation(file: file, line: line)) 30 | } 31 | 32 | /// Always fails the test. 33 | public func fail(_ file: FileString = #file, line: UInt = #line) { 34 | fail("fail() always fails", file: file, line: line) 35 | } 36 | 37 | /// Like Swift's precondition(), but raises NSExceptions instead of sigaborts 38 | internal func nimblePrecondition( 39 | _ expr: @autoclosure() -> Bool, 40 | _ name: @autoclosure() -> String, 41 | _ message: @autoclosure() -> String, 42 | file: StaticString = #file, 43 | line: UInt = #line) { 44 | let result = expr() 45 | if !result { 46 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 47 | let e = NSException( 48 | name: NSExceptionName(name()), 49 | reason: message(), 50 | userInfo: nil) 51 | e.raise() 52 | #else 53 | preconditionFailure("\(name()) - \(message())", file: file, line: line) 54 | #endif 55 | } 56 | } 57 | 58 | internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { 59 | fatalError( 60 | "Nimble Bug Found: \(msg) at \(file):\(line).\n" + 61 | "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + 62 | "code snippet that caused this error." 63 | ) 64 | } 65 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/FailureMessage.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// Encapsulates the failure message that matchers can report to the end user. 4 | /// 5 | /// This is shared state between Nimble and matchers that mutate this value. 6 | public class FailureMessage: NSObject { 7 | public var expected: String = "expected" 8 | public var actualValue: String? = "" // empty string -> use default; nil -> exclude 9 | public var to: String = "to" 10 | public var postfixMessage: String = "match" 11 | public var postfixActual: String = "" 12 | /// An optional message that will be appended as a new line and provides additional details 13 | /// about the failure. This message will only be visible in the issue navigator / in logs but 14 | /// not directly in the source editor since only a single line is presented there. 15 | public var extendedMessage: String? 16 | public var userDescription: String? 17 | 18 | public var stringValue: String { 19 | get { 20 | if let value = _stringValueOverride { 21 | return value 22 | } else { 23 | return computeStringValue() 24 | } 25 | } 26 | set { 27 | _stringValueOverride = newValue 28 | } 29 | } 30 | 31 | internal var _stringValueOverride: String? 32 | internal var hasOverriddenStringValue: Bool { 33 | return _stringValueOverride != nil 34 | } 35 | 36 | public override init() { 37 | } 38 | 39 | public init(stringValue: String) { 40 | _stringValueOverride = stringValue 41 | } 42 | 43 | internal func stripNewlines(_ str: String) -> String { 44 | let whitespaces = CharacterSet.whitespacesAndNewlines 45 | return str 46 | .components(separatedBy: "\n") 47 | .map { line in line.trimmingCharacters(in: whitespaces) } 48 | .joined(separator: "") 49 | } 50 | 51 | internal func computeStringValue() -> String { 52 | var value = "\(expected) \(to) \(postfixMessage)" 53 | if let actualValue = actualValue { 54 | value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" 55 | } 56 | value = stripNewlines(value) 57 | 58 | if let extendedMessage = extendedMessage { 59 | value += "\n\(stripNewlines(extendedMessage))" 60 | } 61 | 62 | if let userDescription = userDescription { 63 | return "\(userDescription)\n\(value)" 64 | } 65 | 66 | return value 67 | } 68 | 69 | internal func appendMessage(_ msg: String) { 70 | if hasOverriddenStringValue { 71 | stringValue += "\(msg)" 72 | } else if actualValue != nil { 73 | postfixActual += msg 74 | } else { 75 | postfixMessage += msg 76 | } 77 | } 78 | 79 | internal func appendDetails(_ msg: String) { 80 | if hasOverriddenStringValue { 81 | if let desc = userDescription { 82 | stringValue = "\(desc)\n\(stringValue)" 83 | } 84 | stringValue += "\n\(msg)" 85 | } else { 86 | if let desc = userDescription { 87 | userDescription = desc 88 | } 89 | extendedMessage = msg 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | private func matcherMessage(forType expectedType: T.Type) -> String { 4 | return "be a kind of \(String(describing: expectedType))" 5 | } 6 | private func matcherMessage(forClass expectedClass: AnyClass) -> String { 7 | return "be a kind of \(String(describing: expectedClass))" 8 | } 9 | 10 | /// A Nimble matcher that succeeds when the actual value is an instance of the given class. 11 | public func beAKindOf(_ expectedType: T.Type) -> Predicate { 12 | return Predicate.define { actualExpression in 13 | let message: ExpectationMessage 14 | 15 | let instance = try actualExpression.evaluate() 16 | guard let validInstance = instance else { 17 | message = .expectedCustomValueTo(matcherMessage(forType: expectedType), "") 18 | return PredicateResult(status: .fail, message: message) 19 | } 20 | message = .expectedCustomValueTo( 21 | "be a kind of \(String(describing: expectedType))", 22 | "<\(String(describing: type(of: validInstance))) instance>" 23 | ) 24 | 25 | return PredicateResult( 26 | bool: validInstance is T, 27 | message: message 28 | ) 29 | } 30 | } 31 | 32 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 33 | 34 | /// A Nimble matcher that succeeds when the actual value is an instance of the given class. 35 | /// @see beAnInstanceOf if you want to match against the exact class 36 | public func beAKindOf(_ expectedClass: AnyClass) -> Predicate { 37 | return Predicate.define { actualExpression in 38 | let message: ExpectationMessage 39 | let status: PredicateStatus 40 | 41 | let instance = try actualExpression.evaluate() 42 | if let validInstance = instance { 43 | status = PredicateStatus(bool: instance != nil && instance!.isKind(of: expectedClass)) 44 | message = .expectedCustomValueTo( 45 | matcherMessage(forClass: expectedClass), 46 | "<\(String(describing: type(of: validInstance))) instance>" 47 | ) 48 | } else { 49 | status = .fail 50 | message = .expectedCustomValueTo( 51 | matcherMessage(forClass: expectedClass), 52 | "" 53 | ) 54 | } 55 | 56 | return PredicateResult(status: status, message: message) 57 | } 58 | } 59 | 60 | extension NMBObjCMatcher { 61 | @objc public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { 62 | return NMBPredicate { actualExpression in 63 | return try beAKindOf(expected).satisfies(actualExpression).toObjectiveC() 64 | } 65 | } 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is an _exact_ instance of the given class. 4 | public func beAnInstanceOf(_ expectedType: T.Type) -> Predicate { 5 | let errorMessage = "be an instance of \(String(describing: expectedType))" 6 | return Predicate.define { actualExpression in 7 | let instance = try actualExpression.evaluate() 8 | guard let validInstance = instance else { 9 | return PredicateResult( 10 | status: .doesNotMatch, 11 | message: .expectedActualValueTo(errorMessage) 12 | ) 13 | } 14 | 15 | let actualString = "<\(String(describing: type(of: validInstance))) instance>" 16 | 17 | return PredicateResult( 18 | status: PredicateStatus(bool: type(of: validInstance) == expectedType), 19 | message: .expectedCustomValueTo(errorMessage, actualString) 20 | ) 21 | } 22 | } 23 | 24 | /// A Nimble matcher that succeeds when the actual value is an instance of the given class. 25 | /// @see beAKindOf if you want to match against subclasses 26 | public func beAnInstanceOf(_ expectedClass: AnyClass) -> Predicate { 27 | let errorMessage = "be an instance of \(String(describing: expectedClass))" 28 | return Predicate.define { actualExpression in 29 | let instance = try actualExpression.evaluate() 30 | let actualString: String 31 | if let validInstance = instance { 32 | actualString = "<\(String(describing: type(of: validInstance))) instance>" 33 | } else { 34 | actualString = "" 35 | } 36 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 37 | let matches = instance != nil && instance!.isMember(of: expectedClass) 38 | #else 39 | let matches = instance != nil && type(of: instance!) == expectedClass 40 | #endif 41 | return PredicateResult( 42 | status: PredicateStatus(bool: matches), 43 | message: .expectedCustomValueTo(errorMessage, actualString) 44 | ) 45 | } 46 | } 47 | 48 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 49 | extension NMBObjCMatcher { 50 | @objc public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { 51 | return NMBPredicate { actualExpression in 52 | return try beAnInstanceOf(expected).satisfies(actualExpression).toObjectiveC() 53 | } 54 | } 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 4 | public func beGreaterThan(_ expectedValue: T?) -> Predicate { 5 | let errorMessage = "be greater than <\(stringify(expectedValue))>" 6 | return Predicate.simple(errorMessage) { actualExpression in 7 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 8 | return PredicateStatus(bool: actual > expected) 9 | } 10 | return .fail 11 | } 12 | } 13 | 14 | /// A Nimble matcher that succeeds when the actual value is greater than the expected value. 15 | public func beGreaterThan(_ expectedValue: NMBComparable?) -> Predicate { 16 | let errorMessage = "be greater than <\(stringify(expectedValue))>" 17 | return Predicate.simple(errorMessage) { actualExpression in 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue != nil 20 | && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending 21 | return PredicateStatus(bool: matches) 22 | } 23 | } 24 | 25 | public func >(lhs: Expectation, rhs: T) { 26 | lhs.to(beGreaterThan(rhs)) 27 | } 28 | 29 | public func > (lhs: Expectation, rhs: NMBComparable?) { 30 | lhs.to(beGreaterThan(rhs)) 31 | } 32 | 33 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 34 | extension NMBObjCMatcher { 35 | @objc public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 36 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 37 | let expr = actualExpression.cast { $0 as? NMBComparable } 38 | return try beGreaterThan(expected).matches(expr, failureMessage: failureMessage) 39 | } 40 | } 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is greater than 4 | /// or equal to the expected value. 5 | public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { 6 | let message = "be greater than or equal to <\(stringify(expectedValue))>" 7 | return Predicate.simple(message) { actualExpression in 8 | let actualValue = try actualExpression.evaluate() 9 | if let actual = actualValue, let expected = expectedValue { 10 | return PredicateStatus(bool: actual >= expected) 11 | } 12 | return .fail 13 | } 14 | } 15 | 16 | /// A Nimble matcher that succeeds when the actual value is greater than 17 | /// or equal to the expected value. 18 | public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> Predicate { 19 | let message = "be greater than or equal to <\(stringify(expectedValue))>" 20 | return Predicate.simple(message) { actualExpression in 21 | let actualValue = try actualExpression.evaluate() 22 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending 23 | return PredicateStatus(bool: matches) 24 | } 25 | } 26 | 27 | public func >=(lhs: Expectation, rhs: T) { 28 | lhs.to(beGreaterThanOrEqualTo(rhs)) 29 | } 30 | 31 | public func >=(lhs: Expectation, rhs: T) { 32 | lhs.to(beGreaterThanOrEqualTo(rhs)) 33 | } 34 | 35 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 36 | extension NMBObjCMatcher { 37 | @objc public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 38 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 39 | let expr = actualExpression.cast { $0 as? NMBComparable } 40 | return try beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 41 | } 42 | } 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is the same instance 4 | /// as the expected instance. 5 | public func beIdenticalTo(_ expected: Any?) -> Predicate { 6 | return Predicate.define { actualExpression in 7 | #if os(Linux) 8 | #if swift(>=4.0) 9 | #if !swift(>=4.1.50) 10 | let actual = try actualExpression.evaluate() as? AnyObject 11 | #else 12 | let actual = try actualExpression.evaluate() as AnyObject? 13 | #endif 14 | #else 15 | #if !swift(>=3.4) 16 | let actual = try actualExpression.evaluate() as? AnyObject 17 | #else 18 | let actual = try actualExpression.evaluate() as AnyObject? 19 | #endif 20 | #endif 21 | #else 22 | let actual = try actualExpression.evaluate() as AnyObject? 23 | #endif 24 | 25 | let bool: Bool 26 | #if os(Linux) 27 | #if swift(>=4.0) 28 | #if !swift(>=4.1.50) 29 | bool = actual === (expected as? AnyObject) && actual !== nil 30 | #else 31 | bool = actual === (expected as AnyObject?) && actual !== nil 32 | #endif 33 | #else 34 | #if !swift(>=3.4) 35 | bool = actual === (expected as? AnyObject) && actual !== nil 36 | #else 37 | bool = actual === (expected as AnyObject?) && actual !== nil 38 | #endif 39 | #endif 40 | #else 41 | bool = actual === (expected as AnyObject?) && actual !== nil 42 | #endif 43 | return PredicateResult( 44 | bool: bool, 45 | message: .expectedCustomValueTo( 46 | "be identical to \(identityAsString(expected))", 47 | "\(identityAsString(actual))" 48 | ) 49 | ) 50 | } 51 | } 52 | 53 | public func === (lhs: Expectation, rhs: Any?) { 54 | lhs.to(beIdenticalTo(rhs)) 55 | } 56 | public func !== (lhs: Expectation, rhs: Any?) { 57 | lhs.toNot(beIdenticalTo(rhs)) 58 | } 59 | 60 | /// A Nimble matcher that succeeds when the actual value is the same instance 61 | /// as the expected instance. 62 | /// 63 | /// Alias for "beIdenticalTo". 64 | public func be(_ expected: Any?) -> Predicate { 65 | return beIdenticalTo(expected) 66 | } 67 | 68 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 69 | extension NMBObjCMatcher { 70 | @objc public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { 71 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 72 | let aExpr = actualExpression.cast { $0 as Any? } 73 | return try beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) 74 | } 75 | } 76 | } 77 | #endif 78 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 4 | public func beLessThan(_ expectedValue: T?) -> Predicate { 5 | let message = "be less than <\(stringify(expectedValue))>" 6 | return Predicate.simple(message) { actualExpression in 7 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 8 | return PredicateStatus(bool: actual < expected) 9 | } 10 | return .fail 11 | } 12 | } 13 | 14 | /// A Nimble matcher that succeeds when the actual value is less than the expected value. 15 | public func beLessThan(_ expectedValue: NMBComparable?) -> Predicate { 16 | let message = "be less than <\(stringify(expectedValue))>" 17 | return Predicate.simple(message) { actualExpression in 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending 20 | return PredicateStatus(bool: matches) 21 | } 22 | } 23 | 24 | public func <(lhs: Expectation, rhs: T) { 25 | lhs.to(beLessThan(rhs)) 26 | } 27 | 28 | public func < (lhs: Expectation, rhs: NMBComparable?) { 29 | lhs.to(beLessThan(rhs)) 30 | } 31 | 32 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 33 | extension NMBObjCMatcher { 34 | @objc public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 35 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 36 | let expr = actualExpression.cast { $0 as? NMBComparable } 37 | return try beLessThan(expected).matches(expr, failureMessage: failureMessage) 38 | } 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is less than 4 | /// or equal to the expected value. 5 | public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { 6 | return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in 7 | if let actual = try actualExpression.evaluate(), let expected = expectedValue { 8 | return PredicateStatus(bool: actual <= expected) 9 | } 10 | return .fail 11 | } 12 | } 13 | 14 | /// A Nimble matcher that succeeds when the actual value is less than 15 | /// or equal to the expected value. 16 | public func beLessThanOrEqualTo(_ expectedValue: T?) -> Predicate { 17 | return Predicate.simple("be less than or equal to <\(stringify(expectedValue))>") { actualExpression in 18 | let actualValue = try actualExpression.evaluate() 19 | let matches = actualValue.map { $0.NMB_compare(expectedValue) != .orderedDescending } ?? false 20 | return PredicateStatus(bool: matches) 21 | } 22 | } 23 | 24 | public func <=(lhs: Expectation, rhs: T) { 25 | lhs.to(beLessThanOrEqualTo(rhs)) 26 | } 27 | 28 | public func <=(lhs: Expectation, rhs: T) { 29 | lhs.to(beLessThanOrEqualTo(rhs)) 30 | } 31 | 32 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 33 | extension NMBObjCMatcher { 34 | @objc public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { 35 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 36 | let expr = actualExpression.cast { $0 as? NMBComparable } 37 | return try beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) 38 | } 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is nil. 4 | public func beNil() -> Predicate { 5 | return Predicate.simpleNilable("be nil") { actualExpression in 6 | let actualValue = try actualExpression.evaluate() 7 | return PredicateStatus(bool: actualValue == nil) 8 | } 9 | } 10 | 11 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 12 | extension NMBObjCMatcher { 13 | @objc public class func beNilMatcher() -> NMBObjCMatcher { 14 | return NMBObjCMatcher { actualExpression, failureMessage in 15 | return try beNil().matches(actualExpression, failureMessage: failureMessage) 16 | } 17 | } 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value is Void. 4 | public func beVoid() -> Predicate<()> { 5 | return Predicate.simpleNilable("be void") { actualExpression in 6 | let actualValue: ()? = try actualExpression.evaluate() 7 | return PredicateStatus(bool: actualValue != nil) 8 | } 9 | } 10 | 11 | public func == (lhs: Expectation<()>, rhs: ()) { 12 | lhs.to(beVoid()) 13 | } 14 | 15 | public func != (lhs: Expectation<()>, rhs: ()) { 16 | lhs.toNot(beVoid()) 17 | } 18 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual sequence's first element 4 | /// is equal to the expected value. 5 | public func beginWith(_ startingElement: T) -> Predicate 6 | where S.Iterator.Element == T { 7 | return Predicate.simple("begin with <\(startingElement)>") { actualExpression in 8 | if let actualValue = try actualExpression.evaluate() { 9 | var actualGenerator = actualValue.makeIterator() 10 | return PredicateStatus(bool: actualGenerator.next() == startingElement) 11 | } 12 | return .fail 13 | } 14 | } 15 | 16 | /// A Nimble matcher that succeeds when the actual collection's first element 17 | /// is equal to the expected object. 18 | public func beginWith(_ startingElement: Any) -> Predicate { 19 | return Predicate.simple("begin with <\(startingElement)>") { actualExpression in 20 | guard let collection = try actualExpression.evaluate() else { return .fail } 21 | guard collection.count > 0 else { return .doesNotMatch } 22 | #if os(Linux) 23 | guard let collectionValue = collection.object(at: 0) as? NSObject else { 24 | return .fail 25 | } 26 | #else 27 | let collectionValue = collection.object(at: 0) as AnyObject 28 | #endif 29 | return PredicateStatus(bool: collectionValue.isEqual(startingElement)) 30 | } 31 | } 32 | 33 | /// A Nimble matcher that succeeds when the actual string contains expected substring 34 | /// where the expected substring's location is zero. 35 | public func beginWith(_ startingSubstring: String) -> Predicate { 36 | return Predicate.simple("begin with <\(startingSubstring)>") { actualExpression in 37 | if let actual = try actualExpression.evaluate() { 38 | return PredicateStatus(bool: actual.hasPrefix(startingSubstring)) 39 | } 40 | return .fail 41 | } 42 | } 43 | 44 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 45 | extension NMBObjCMatcher { 46 | @objc public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { 47 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 48 | let actual = try actualExpression.evaluate() 49 | if (actual as? String) != nil { 50 | let expr = actualExpression.cast { $0 as? String } 51 | return try beginWith(expected as! String).matches(expr, failureMessage: failureMessage) 52 | } else { 53 | let expr = actualExpression.cast { $0 as? NMBOrderedCollection } 54 | return try beginWith(expected).matches(expr, failureMessage: failureMessage) 55 | } 56 | } 57 | } 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> Predicate where S.Iterator.Element == T { 4 | 5 | return Predicate.define { actualExpression in 6 | let message: ExpectationMessage 7 | if predicateDescription == "" { 8 | message = .expectedTo("find object in collection that satisfies predicate") 9 | } else { 10 | message = .expectedTo("find object in collection \(predicateDescription)") 11 | } 12 | 13 | if let sequence = try actualExpression.evaluate() { 14 | for object in sequence { 15 | if predicate(object) { 16 | return PredicateResult(bool: true, message: message) 17 | } 18 | } 19 | 20 | return PredicateResult(bool: false, message: message) 21 | } 22 | 23 | return PredicateResult(status: .fail, message: message) 24 | } 25 | } 26 | 27 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 28 | extension NMBObjCMatcher { 29 | @objc public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { 30 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 31 | let value = try actualExpression.evaluate() 32 | guard let enumeration = value as? NSFastEnumeration else { 33 | // swiftlint:disable:next line_length 34 | failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" 35 | failureMessage.actualValue = nil 36 | failureMessage.expected = "" 37 | failureMessage.to = "" 38 | return false 39 | } 40 | 41 | var iterator = NSFastEnumerationIterator(enumeration) 42 | while let item = iterator.next() { 43 | guard let object = item as? NSObject else { 44 | continue 45 | } 46 | 47 | if predicate(object) { 48 | return true 49 | } 50 | } 51 | 52 | failureMessage.actualValue = nil 53 | failureMessage.postfixMessage = "find object in collection that satisfies predicate" 54 | return false 55 | } 56 | } 57 | } 58 | #endif 59 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual sequence's last element 4 | /// is equal to the expected value. 5 | public func endWith(_ endingElement: T) -> Predicate 6 | where S.Iterator.Element == T { 7 | return Predicate.simple("end with <\(endingElement)>") { actualExpression in 8 | if let actualValue = try actualExpression.evaluate() { 9 | var actualGenerator = actualValue.makeIterator() 10 | var lastItem: T? 11 | var item: T? 12 | repeat { 13 | lastItem = item 14 | item = actualGenerator.next() 15 | } while(item != nil) 16 | 17 | return PredicateStatus(bool: lastItem == endingElement) 18 | } 19 | return .fail 20 | } 21 | } 22 | 23 | /// A Nimble matcher that succeeds when the actual collection's last element 24 | /// is equal to the expected object. 25 | public func endWith(_ endingElement: Any) -> Predicate { 26 | return Predicate.simple("end with <\(endingElement)>") { actualExpression in 27 | guard let collection = try actualExpression.evaluate() else { return .fail } 28 | guard collection.count > 0 else { return PredicateStatus(bool: false) } 29 | #if os(Linux) 30 | guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { 31 | return .fail 32 | } 33 | #else 34 | let collectionValue = collection.object(at: collection.count - 1) as AnyObject 35 | #endif 36 | 37 | return PredicateStatus(bool: collectionValue.isEqual(endingElement)) 38 | } 39 | } 40 | 41 | /// A Nimble matcher that succeeds when the actual string contains the expected substring 42 | /// where the expected substring's location is the actual string's length minus the 43 | /// expected substring's length. 44 | public func endWith(_ endingSubstring: String) -> Predicate { 45 | return Predicate.simple("end with <\(endingSubstring)>") { actualExpression in 46 | if let collection = try actualExpression.evaluate() { 47 | return PredicateStatus(bool: collection.hasSuffix(endingSubstring)) 48 | } 49 | return .fail 50 | } 51 | } 52 | 53 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 54 | extension NMBObjCMatcher { 55 | @objc public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { 56 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 57 | let actual = try actualExpression.evaluate() 58 | if (actual as? String) != nil { 59 | let expr = actualExpression.cast { $0 as? String } 60 | return try endWith(expected as! String).matches(expr, failureMessage: failureMessage) 61 | } else { 62 | let expr = actualExpression.cast { $0 as? NMBOrderedCollection } 63 | return try endWith(expected).matches(expr, failureMessage: failureMessage) 64 | } 65 | } 66 | } 67 | } 68 | #endif 69 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // The `haveCount` matchers do not print the full string representation of the collection value, 4 | // instead they only print the type name and the expected count. This makes it easier to understand 5 | // the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. 6 | // The representation of the collection content is provided in a new line as an `extendedMessage`. 7 | 8 | /// A Nimble matcher that succeeds when the actual Collection's count equals 9 | /// the expected value 10 | public func haveCount(_ expectedValue: T.IndexDistance) -> Predicate { 11 | return Predicate.define { actualExpression in 12 | if let actualValue = try actualExpression.evaluate() { 13 | let message = ExpectationMessage 14 | .expectedCustomValueTo( 15 | "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", 16 | "\(actualValue.count)" 17 | ) 18 | .appended(details: "Actual Value: \(stringify(actualValue))") 19 | 20 | let result = expectedValue == actualValue.count 21 | return PredicateResult(bool: result, message: message) 22 | } else { 23 | return PredicateResult(status: .fail, message: .fail("")) 24 | } 25 | } 26 | } 27 | 28 | /// A Nimble matcher that succeeds when the actual collection's count equals 29 | /// the expected value 30 | public func haveCount(_ expectedValue: Int) -> Predicate { 31 | return Predicate { actualExpression in 32 | if let actualValue = try actualExpression.evaluate() { 33 | let message = ExpectationMessage 34 | .expectedCustomValueTo( 35 | "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))", 36 | "\(actualValue.count)" 37 | ) 38 | .appended(details: "Actual Value: \(stringify(actualValue))") 39 | 40 | let result = expectedValue == actualValue.count 41 | return PredicateResult(bool: result, message: message) 42 | } else { 43 | return PredicateResult(status: .fail, message: .fail("")) 44 | } 45 | } 46 | } 47 | 48 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 49 | extension NMBObjCMatcher { 50 | @objc public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { 51 | return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in 52 | let location = actualExpression.location 53 | let actualValue = try actualExpression.evaluate() 54 | if let value = actualValue as? NMBCollection { 55 | let expr = Expression(expression: ({ value as NMBCollection}), location: location) 56 | return try haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) 57 | } else if let actualValue = actualValue { 58 | failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" 59 | failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" 60 | } 61 | return false 62 | } 63 | } 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/Match.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual string satisfies the regular expression 4 | /// described by the expected string. 5 | public func match(_ expectedValue: String?) -> Predicate { 6 | return Predicate.simple("match <\(stringify(expectedValue))>") { actualExpression in 7 | if let actual = try actualExpression.evaluate() { 8 | if let regexp = expectedValue { 9 | let bool = actual.range(of: regexp, options: .regularExpression) != nil 10 | return PredicateStatus(bool: bool) 11 | } 12 | } 13 | 14 | return .fail 15 | } 16 | } 17 | 18 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 19 | 20 | extension NMBObjCMatcher { 21 | @objc public class func matchMatcher(_ expected: NSString) -> NMBMatcher { 22 | return NMBPredicate { actualExpression in 23 | let actual = actualExpression.cast { $0 as? String } 24 | return try match(expected.description).satisfies(actual).toObjectiveC() 25 | } 26 | } 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual expression evaluates to an 4 | /// error from the specified case. 5 | /// 6 | /// Errors are tried to be compared by their implementation of Equatable, 7 | /// otherwise they fallback to comparison by _domain and _code. 8 | public func matchError(_ error: T) -> Predicate { 9 | return Predicate.define { actualExpression in 10 | let actualError = try actualExpression.evaluate() 11 | 12 | let failureMessage = FailureMessage() 13 | setFailureMessageForError( 14 | failureMessage, 15 | postfixMessageVerb: "match", 16 | actualError: actualError, 17 | error: error 18 | ) 19 | 20 | var matches = false 21 | if let actualError = actualError, errorMatchesExpectedError(actualError, expectedError: error) { 22 | matches = true 23 | } 24 | 25 | return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) 26 | } 27 | } 28 | 29 | /// A Nimble matcher that succeeds when the actual expression evaluates to an 30 | /// error from the specified case. 31 | /// 32 | /// Errors are tried to be compared by their implementation of Equatable, 33 | /// otherwise they fallback to comparision by _domain and _code. 34 | public func matchError(_ error: T) -> Predicate { 35 | return Predicate.define { actualExpression in 36 | let actualError = try actualExpression.evaluate() 37 | 38 | let failureMessage = FailureMessage() 39 | setFailureMessageForError( 40 | failureMessage, 41 | postfixMessageVerb: "match", 42 | actualError: actualError, 43 | error: error 44 | ) 45 | 46 | var matches = false 47 | if let actualError = actualError as? T, error == actualError { 48 | matches = true 49 | } 50 | 51 | return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) 52 | } 53 | } 54 | 55 | /// A Nimble matcher that succeeds when the actual expression evaluates to an 56 | /// error of the specified type 57 | public func matchError(_ errorType: T.Type) -> Predicate { 58 | return Predicate.define { actualExpression in 59 | let actualError = try actualExpression.evaluate() 60 | 61 | let failureMessage = FailureMessage() 62 | setFailureMessageForError( 63 | failureMessage, 64 | postfixMessageVerb: "match", 65 | actualError: actualError, 66 | errorType: errorType 67 | ) 68 | 69 | var matches = false 70 | if actualError as? T != nil { 71 | matches = true 72 | } 73 | 74 | return PredicateResult(bool: matches, message: failureMessage.toExpectationMessage()) 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAllOf.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | /// A Nimble matcher that succeeds when the actual value matches with all of the matchers 4 | /// provided in the variable list of matchers. 5 | public func satisfyAllOf(_ matchers: U...) -> Predicate 6 | where U: Matcher, U.ValueType == T { 7 | return satisfyAllOf(matchers.map { $0.predicate }) 8 | } 9 | 10 | internal func satisfyAllOf(_ predicates: [Predicate]) -> Predicate { 11 | return Predicate.define { actualExpression in 12 | var postfixMessages = [String]() 13 | var matches = true 14 | for predicate in predicates { 15 | let result = try predicate.satisfies(actualExpression) 16 | if result.toBoolean(expectation: .toNotMatch) { 17 | matches = false 18 | } 19 | postfixMessages.append("{\(result.message.expectedMessage)}") 20 | } 21 | 22 | var msg: ExpectationMessage 23 | if let actualValue = try actualExpression.evaluate() { 24 | msg = .expectedCustomValueTo( 25 | "match all of: " + postfixMessages.joined(separator: ", and "), 26 | "\(actualValue)" 27 | ) 28 | } else { 29 | msg = .expectedActualValueTo( 30 | "match all of: " + postfixMessages.joined(separator: ", and ") 31 | ) 32 | } 33 | 34 | return PredicateResult(bool: matches, message: msg) 35 | } 36 | } 37 | 38 | public func && (left: Predicate, right: Predicate) -> Predicate { 39 | return satisfyAllOf(left, right) 40 | } 41 | 42 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 43 | extension NMBObjCMatcher { 44 | @objc public class func satisfyAllOfMatcher(_ matchers: [NMBMatcher]) -> NMBPredicate { 45 | return NMBPredicate { actualExpression in 46 | if matchers.isEmpty { 47 | return NMBPredicateResult( 48 | status: NMBPredicateStatus.fail, 49 | message: NMBExpectationMessage( 50 | fail: "satisfyAllOf must be called with at least one matcher" 51 | ) 52 | ) 53 | } 54 | 55 | var elementEvaluators = [Predicate]() 56 | for matcher in matchers { 57 | let elementEvaluator = Predicate { expression in 58 | if let predicate = matcher as? NMBPredicate { 59 | // swiftlint:disable:next line_length 60 | return predicate.satisfies({ try expression.evaluate() }, location: actualExpression.location).toSwift() 61 | } else { 62 | let failureMessage = FailureMessage() 63 | // swiftlint:disable:next line_length 64 | let success = matcher.matches({ try! expression.evaluate() }, failureMessage: failureMessage, location: actualExpression.location) 65 | return PredicateResult(bool: success, message: failureMessage.toExpectationMessage()) 66 | } 67 | } 68 | 69 | elementEvaluators.append(elementEvaluator) 70 | } 71 | 72 | return try satisfyAllOf(elementEvaluators).satisfies(actualExpression).toObjectiveC() 73 | } 74 | } 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public func throwAssertion() -> Predicate { 4 | return Predicate { actualExpression in 5 | #if arch(x86_64) && (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) && !SWIFT_PACKAGE 6 | let message = ExpectationMessage.expectedTo("throw an assertion") 7 | 8 | var actualError: Error? 9 | let caughtException: BadInstructionException? = catchBadInstruction { 10 | #if os(tvOS) 11 | if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { 12 | print() 13 | print("[Nimble Warning]: If you're getting stuck on a debugger breakpoint for a " + 14 | "fatal error while using throwAssertion(), please disable 'Debug Executable' " + 15 | "in your scheme. Go to 'Edit Scheme > Test > Info' and uncheck " + 16 | "'Debug Executable'. If you've already done that, suppress this warning " + 17 | "by setting `NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true`. " + 18 | "This is required because the standard methods of catching assertions " + 19 | "(mach APIs) are unavailable for tvOS. Instead, the same mechanism the " + 20 | "debugger uses is the fallback method for tvOS." 21 | ) 22 | print() 23 | NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true 24 | } 25 | #endif 26 | do { 27 | try actualExpression.evaluate() 28 | } catch { 29 | actualError = error 30 | } 31 | } 32 | 33 | if let actualError = actualError { 34 | return PredicateResult( 35 | bool: false, 36 | message: message.appended(message: "; threw error instead <\(actualError)>") 37 | ) 38 | } else { 39 | return PredicateResult(bool: caughtException != nil, message: message) 40 | } 41 | #elseif SWIFT_PACKAGE 42 | fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + 43 | " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + 44 | " conditional statement") 45 | #else 46 | fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + 47 | "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + 48 | "by placing the test case inside an #if arch(x86_64) or (os(macOS) || os(iOS) || os(tvOS) || os(watchOS)) conditional statement") 49 | // swiftlint:disable:previous line_length 50 | #endif 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Matchers/ToSucceed.swift: -------------------------------------------------------------------------------- 1 | /** 2 | Used by the `toSucceed` matcher. 3 | 4 | This is the return type for the closure. 5 | */ 6 | public enum ToSucceedResult { 7 | case succeeded 8 | case failed(reason: String) 9 | } 10 | 11 | /** 12 | A Nimble matcher that takes in a closure for validation. 13 | 14 | Return `.succeeded` when the validation succeeds. 15 | Return `.failed` with a failure reason when the validation fails. 16 | */ 17 | public func succeed() -> Predicate<() -> ToSucceedResult> { 18 | return Predicate.define { actualExpression in 19 | let optActual = try actualExpression.evaluate() 20 | guard let actual = optActual else { 21 | return PredicateResult(status: .fail, message: .fail("expected a closure, got ")) 22 | } 23 | 24 | switch actual() { 25 | case .succeeded: 26 | return PredicateResult( 27 | bool: true, 28 | message: .expectedCustomValueTo("succeed", "") 29 | ) 30 | case .failed(let reason): 31 | return PredicateResult( 32 | bool: false, 33 | message: .expectedCustomValueTo("succeed", " because <\(reason)>") 34 | ) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Nimble.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "NMBExceptionCapture.h" 3 | #import "NMBStringify.h" 4 | #import "DSL.h" 5 | 6 | #if TARGET_OS_TV 7 | #import "CwlPreconditionTesting_POSIX.h" 8 | #else 9 | #import "CwlPreconditionTesting.h" 10 | #endif 11 | 12 | FOUNDATION_EXPORT double NimbleVersionNumber; 13 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; 14 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/Errors.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Generic 4 | 5 | internal func setFailureMessageForError( 6 | _ failureMessage: FailureMessage, 7 | postfixMessageVerb: String = "throw", 8 | actualError: Error?, 9 | error: T? = nil, 10 | errorType: T.Type? = nil, 11 | closure: ((T) -> Void)? = nil) { 12 | failureMessage.postfixMessage = "\(postfixMessageVerb) error" 13 | 14 | if let error = error { 15 | failureMessage.postfixMessage += " <\(error)>" 16 | } else if errorType != nil || closure != nil { 17 | failureMessage.postfixMessage += " from type <\(T.self)>" 18 | } 19 | if closure != nil { 20 | failureMessage.postfixMessage += " that satisfies block" 21 | } 22 | if error == nil && errorType == nil && closure == nil { 23 | failureMessage.postfixMessage = "\(postfixMessageVerb) any error" 24 | } 25 | 26 | if let actualError = actualError { 27 | failureMessage.actualValue = "<\(actualError)>" 28 | } else { 29 | failureMessage.actualValue = "no error" 30 | } 31 | } 32 | 33 | internal func errorMatchesExpectedError( 34 | _ actualError: Error, 35 | expectedError: T) -> Bool { 36 | return actualError._domain == expectedError._domain 37 | && actualError._code == expectedError._code 38 | } 39 | 40 | // Non-generic 41 | 42 | internal func setFailureMessageForError( 43 | _ failureMessage: FailureMessage, 44 | actualError: Error?, 45 | closure: ((Error) -> Void)?) { 46 | failureMessage.postfixMessage = "throw error" 47 | 48 | if closure != nil { 49 | failureMessage.postfixMessage += " that satisfies block" 50 | } else { 51 | failureMessage.postfixMessage = "throw any error" 52 | } 53 | 54 | if let actualError = actualError { 55 | failureMessage.actualValue = "<\(actualError)>" 56 | } else { 57 | failureMessage.actualValue = "no error" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/Functional.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension Sequence { 4 | internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { 5 | for item in self { 6 | if !fn(item) { 7 | return false 8 | } 9 | } 10 | return true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Ideally we would always use `StaticString` as the type for tracking the file name 4 | // that expectations originate from, for consistency with `assert` etc. from the 5 | // stdlib, and because recent versions of the XCTest overlay require `StaticString` 6 | // when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we 7 | // have to use `String` instead because StaticString can't be generated from Objective-C 8 | #if SWIFT_PACKAGE 9 | public typealias FileString = StaticString 10 | #else 11 | public typealias FileString = String 12 | #endif 13 | 14 | public final class SourceLocation: NSObject { 15 | public let file: FileString 16 | public let line: UInt 17 | 18 | override init() { 19 | file = "Unknown File" 20 | line = 0 21 | } 22 | 23 | init(file: FileString, line: UInt) { 24 | self.file = file 25 | self.line = line 26 | } 27 | 28 | override public var description: String { 29 | return "\(file):\(line)" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface NMBExceptionCapture : NSObject 5 | 6 | - (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally; 7 | - (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); 8 | 9 | @end 10 | 11 | typedef void(^NMBSourceCallbackBlock)(BOOL successful); 12 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m: -------------------------------------------------------------------------------- 1 | #import "NMBExceptionCapture.h" 2 | 3 | @interface NMBExceptionCapture () 4 | @property (nonatomic, copy) void(^ _Nullable handler)(NSException * _Nullable); 5 | @property (nonatomic, copy) void(^ _Nullable finally)(void); 6 | @end 7 | 8 | @implementation NMBExceptionCapture 9 | 10 | - (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)(void))finally { 11 | self = [super init]; 12 | if (self) { 13 | self.handler = handler; 14 | self.finally = finally; 15 | } 16 | return self; 17 | } 18 | 19 | - (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)(void))unsafeBlock { 20 | @try { 21 | unsafeBlock(); 22 | } 23 | @catch (NSException *exception) { 24 | if (self.handler) { 25 | self.handler(exception); 26 | } 27 | } 28 | @finally { 29 | if (self.finally) { 30 | self.finally(); 31 | } 32 | } 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h: -------------------------------------------------------------------------------- 1 | @class NSString; 2 | 3 | /** 4 | * Returns a string appropriate for displaying in test output 5 | * from the provided value. 6 | * 7 | * @param anyObject A value that will show up in a test's output. 8 | * 9 | * @return The string that is returned can be 10 | * customized per type by conforming a type to the `TestOutputStringConvertible` 11 | * protocol. When stringifying a non-`TestOutputStringConvertible` type, this 12 | * function will return the value's debug description and then its 13 | * normal description if available and in that order. Otherwise it 14 | * will return the result of constructing a string from the value. 15 | * 16 | * @see `TestOutputStringConvertible` 17 | */ 18 | extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); 19 | -------------------------------------------------------------------------------- /Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m: -------------------------------------------------------------------------------- 1 | #import "NMBStringify.h" 2 | 3 | #if __has_include("Nimble-Swift.h") 4 | #import "Nimble-Swift.h" 5 | #else 6 | #import 7 | #endif 8 | 9 | NSString *_Nonnull NMBStringify(id _Nullable anyObject) { 10 | return [NMBStringer stringify:anyObject]; 11 | } 12 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/PopupDialog.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Example/Pods/SwiftLint/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Realm Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Example/Pods/SwiftLint/swiftlint: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/Pods/SwiftLint/swiftlint -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 4.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_DynamicBlurView : NSObject 3 | @end 4 | @implementation PodsDummy_DynamicBlurView 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "DynamicBlurView.h" 14 | 15 | FOUNDATION_EXPORT double DynamicBlurViewVersionNumber; 16 | FOUNDATION_EXPORT const unsigned char DynamicBlurViewVersionString[]; 17 | 18 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView.modulemap: -------------------------------------------------------------------------------- 1 | framework module DynamicBlurView { 2 | umbrella header "DynamicBlurView-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/DynamicBlurView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "UIKit" 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/DynamicBlurView 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/DynamicBlurView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.0.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 7.3.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 7.3.4 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Nimble : NSObject 3 | @end 4 | @implementation PodsDummy_Nimble 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "Nimble.h" 14 | #import "DSL.h" 15 | #import "NMBExceptionCapture.h" 16 | #import "NMBStringify.h" 17 | #import "CwlCatchException.h" 18 | #import "CwlMachBadInstructionHandler.h" 19 | #import "mach_excServer.h" 20 | #import "CwlPreconditionTesting.h" 21 | 22 | FOUNDATION_EXPORT double NimbleVersionNumber; 23 | FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble.modulemap: -------------------------------------------------------------------------------- 1 | framework module Nimble { 2 | umbrella header "Nimble-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Nimble/Nimble.xcconfig: -------------------------------------------------------------------------------- 1 | APPLICATION_EXTENSION_API_ONLY = YES 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Nimble 3 | ENABLE_BITCODE = NO 4 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 5 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 6 | OTHER_LDFLAGS = $(inherited) -Xlinker -no_application_extension -weak-lswiftXCTest -weak_framework "XCTest" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS $(inherited) -suppress-warnings 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_ROOT = ${SRCROOT} 11 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Nimble 12 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 13 | SKIP_INSTALL = YES 14 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 15 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_PopupDialog_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_PopupDialog_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_PopupDialog_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_PopupDialog_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView/DynamicBlurView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog/PopupDialog.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "DynamicBlurView" -framework "PopupDialog" -framework "UIKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_PopupDialog_Example { 2 | umbrella header "Pods-PopupDialog_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Example/Pods-PopupDialog_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView/DynamicBlurView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog/PopupDialog.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "DynamicBlurView" -framework "PopupDialog" -framework "UIKit" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_PopupDialog_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_PopupDialog_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_PopupDialog_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_PopupDialog_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog" "${PODS_CONFIGURATION_BUILD_DIR}/iOSSnapshotTestCase" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView/DynamicBlurView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog/PopupDialog.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/iOSSnapshotTestCase/FBSnapshotTestCase.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "DynamicBlurView" -framework "FBSnapshotTestCase" -framework "Foundation" -framework "Nimble" -framework "PopupDialog" -framework "QuartzCore" -framework "UIKit" -framework "XCTest" -weak_framework "XCTest" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_PopupDialog_Tests { 2 | umbrella header "Pods-PopupDialog_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PopupDialog_Tests/Pods-PopupDialog_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog" "${PODS_CONFIGURATION_BUILD_DIR}/iOSSnapshotTestCase" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView/DynamicBlurView.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Nimble/Nimble.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog/PopupDialog.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/iOSSnapshotTestCase/FBSnapshotTestCase.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Accelerate" -framework "DynamicBlurView" -framework "FBSnapshotTestCase" -framework "Foundation" -framework "Nimble" -framework "PopupDialog" -framework "QuartzCore" -framework "UIKit" -framework "XCTest" -weak_framework "XCTest" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PopupDialog : NSObject 3 | @end 4 | @implementation PodsDummy_PopupDialog 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double PopupDialogVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char PopupDialogVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog.modulemap: -------------------------------------------------------------------------------- 1 | framework module PopupDialog { 2 | umbrella header "PopupDialog-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PopupDialog/PopupDialog.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PopupDialog 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DynamicBlurView" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SwiftLint/SwiftLint.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftLint 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | PODS_BUILD_DIR = ${BUILD_DIR} 4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 5 | PODS_ROOT = ${SRCROOT} 6 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftLint 7 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 8 | SKIP_INSTALL = YES 9 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 6.0.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 6.0.3 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_iOSSnapshotTestCase : NSObject 3 | @end 4 | @implementation PodsDummy_iOSSnapshotTestCase 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "FBSnapshotTestCase.h" 14 | #import "FBSnapshotTestCasePlatform.h" 15 | #import "FBSnapshotTestController.h" 16 | 17 | FOUNDATION_EXPORT double FBSnapshotTestCaseVersionNumber; 18 | FOUNDATION_EXPORT const unsigned char FBSnapshotTestCaseVersionString[]; 19 | 20 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase.modulemap: -------------------------------------------------------------------------------- 1 | framework module FBSnapshotTestCase { 2 | umbrella header "iOSSnapshotTestCase-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/iOSSnapshotTestCase/iOSSnapshotTestCase.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/iOSSnapshotTestCase 2 | ENABLE_BITCODE = NO 3 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 5 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "QuartzCore" -framework "UIKit" -framework "XCTest" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_ROOT = ${SRCROOT} 10 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/iOSSnapshotTestCase 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Compare.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Gabriel Handford on 3/1/09. 3 | // Copyright 2009-2013. All rights reserved. 4 | // Created by John Boiles on 10/20/11. 5 | // Copyright (c) 2011. All rights reserved 6 | // Modified by Felix Schulze on 2/11/13. 7 | // Copyright 2013. All rights reserved. 8 | // 9 | // Permission is hereby granted, free of charge, to any person 10 | // obtaining a copy of this software and associated documentation 11 | // files (the "Software"), to deal in the Software without 12 | // restriction, including without limitation the rights to use, 13 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the 15 | // Software is furnished to do so, subject to the following 16 | // conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be 19 | // included in all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | // OTHER DEALINGS IN THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | NS_ASSUME_NONNULL_BEGIN 34 | 35 | @interface UIImage (Compare) 36 | 37 | /** 38 | Compares the image against another given image. 39 | 40 | @param image The other image to compare against. 41 | @param perPixelTolerance How much (in percentage) any given pixel's colors are allowed to change from the pixel in the reference image. 42 | @param overallTolerance The overall percentage of pixels that are allowed to change from the pixels in the reference image. 43 | @return A BOOL which represents if the image is the same or not. 44 | */ 45 | - (BOOL)fb_compareWithImage:(UIImage *)image perPixelTolerance:(CGFloat)perPixelTolerance overallTolerance:(CGFloat)overallTolerance; 46 | 47 | @end 48 | 49 | NS_ASSUME_NONNULL_END 50 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Diff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Gabriel Handford on 3/1/09. 3 | // Copyright 2009-2013. All rights reserved. 4 | // Created by John Boiles on 10/20/11. 5 | // Copyright (c) 2011. All rights reserved 6 | // Modified by Felix Schulze on 2/11/13. 7 | // Copyright 2013. All rights reserved. 8 | // 9 | // Permission is hereby granted, free of charge, to any person 10 | // obtaining a copy of this software and associated documentation 11 | // files (the "Software"), to deal in the Software without 12 | // restriction, including without limitation the rights to use, 13 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the 15 | // Software is furnished to do so, subject to the following 16 | // conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be 19 | // included in all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | // OTHER DEALINGS IN THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | NS_ASSUME_NONNULL_BEGIN 34 | 35 | @interface UIImage (Diff) 36 | 37 | - (UIImage *)fb_diffWithImage:(UIImage *)image; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Diff.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Gabriel Handford on 3/1/09. 3 | // Copyright 2009-2013. All rights reserved. 4 | // Created by John Boiles on 10/20/11. 5 | // Copyright (c) 2011. All rights reserved 6 | // Modified by Felix Schulze on 2/11/13. 7 | // Copyright 2013. All rights reserved. 8 | // 9 | // Permission is hereby granted, free of charge, to any person 10 | // obtaining a copy of this software and associated documentation 11 | // files (the "Software"), to deal in the Software without 12 | // restriction, including without limitation the rights to use, 13 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the 15 | // Software is furnished to do so, subject to the following 16 | // conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be 19 | // included in all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | // OTHER DEALINGS IN THE SOFTWARE. 29 | // 30 | 31 | #import 32 | 33 | @implementation UIImage (Diff) 34 | 35 | - (UIImage *)fb_diffWithImage:(UIImage *)image 36 | { 37 | if (!image) { 38 | return nil; 39 | } 40 | CGSize imageSize = CGSizeMake(MAX(self.size.width, image.size.width), MAX(self.size.height, image.size.height)); 41 | UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0); 42 | CGContextRef context = UIGraphicsGetCurrentContext(); 43 | [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)]; 44 | CGContextSetAlpha(context, 0.5); 45 | CGContextBeginTransparencyLayer(context, NULL); 46 | [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; 47 | CGContextSetBlendMode(context, kCGBlendModeDifference); 48 | CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); 49 | CGContextFillRect(context, CGRectMake(0, 0, self.size.width, self.size.height)); 50 | CGContextEndTransparencyLayer(context); 51 | UIImage *returnImage = UIGraphicsGetImageFromCurrentImageContext(); 52 | UIGraphicsEndImageContext(); 53 | return returnImage; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Snapshot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Uber Technologies, Inc. 3 | * Copyright (c) 2015-2018, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | */ 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface UIImage (Snapshot) 15 | 16 | /// Uses renderInContext: to get a snapshot of the layer. 17 | + (nullable UIImage *)fb_imageForLayer:(CALayer *)layer; 18 | 19 | /// Uses renderInContext: to get a snapshot of the view layer. 20 | + (nullable UIImage *)fb_imageForViewLayer:(UIView *)view; 21 | 22 | /// Uses drawViewHierarchyInRect: to get a snapshot of the view and adds the view into a window if needed. 23 | + (nullable UIImage *)fb_imageForView:(UIView *)view; 24 | 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/Categories/UIImage+Snapshot.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Uber Technologies, Inc. 3 | * Copyright (c) 2015-2018, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | */ 9 | 10 | #import 11 | 12 | @implementation UIImage (Snapshot) 13 | 14 | + (UIImage *)fb_imageForLayer:(CALayer *)layer 15 | { 16 | CGRect bounds = layer.bounds; 17 | NSAssert1(CGRectGetWidth(bounds), @"Zero width for layer %@", layer); 18 | NSAssert1(CGRectGetHeight(bounds), @"Zero height for layer %@", layer); 19 | 20 | UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); 21 | CGContextRef context = UIGraphicsGetCurrentContext(); 22 | NSAssert1(context, @"Could not generate context for layer %@", layer); 23 | CGContextSaveGState(context); 24 | [layer layoutIfNeeded]; 25 | [layer renderInContext:context]; 26 | CGContextRestoreGState(context); 27 | 28 | UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); 29 | UIGraphicsEndImageContext(); 30 | return snapshot; 31 | } 32 | 33 | + (UIImage *)fb_imageForViewLayer:(UIView *)view 34 | { 35 | [view layoutIfNeeded]; 36 | return [self fb_imageForLayer:view.layer]; 37 | } 38 | 39 | + (UIImage *)fb_imageForView:(UIView *)view 40 | { 41 | // If the input view is already a UIWindow, then just use that. Otherwise wrap in a window. 42 | UIWindow *window = [view isKindOfClass:[UIWindow class]] ? (UIWindow *)view : view.window; 43 | BOOL removeFromSuperview = NO; 44 | if (!window) { 45 | window = [[UIApplication sharedApplication] keyWindow]; 46 | } 47 | 48 | if (!view.window && view != window) { 49 | [window addSubview:view]; 50 | removeFromSuperview = YES; 51 | } 52 | 53 | [view layoutIfNeeded]; 54 | 55 | CGRect bounds = view.bounds; 56 | NSAssert1(CGRectGetWidth(bounds), @"Zero width for view %@", view); 57 | NSAssert1(CGRectGetHeight(bounds), @"Zero height for view %@", view); 58 | 59 | UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); 60 | [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; 61 | 62 | UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); 63 | UIGraphicsEndImageContext(); 64 | 65 | if (removeFromSuperview) { 66 | [view removeFromSuperview]; 67 | } 68 | 69 | return snapshot; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCasePlatform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Uber Technologies, Inc. 3 | * Copyright (c) 2015-2018, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | 18 | /** 19 | An option mask that allows you to cherry pick which parts you want to include in the snapshot file name. 20 | 21 | - FBSnapshotTestCaseFileNameIncludeOptionNone: Don't include any of these options at all. 22 | - FBSnapshotTestCaseFileNameIncludeOptionDevice: The file name should include the device name, as returned by UIDevice.currentDevice.model. 23 | - FBSnapshotTestCaseFileNameIncludeOptionOS: The file name should include the OS version, as returned by UIDevice.currentDevice.systemVersion. 24 | - FBSnapshotTestCaseFileNameIncludeOptionScreenSize: The file name should include the screen size of the current keyWindow, as returned by UIApplication.sharedApplication.keyWindow.bounds.size. 25 | - FBSnapshotTestCaseFileNameIncludeOptionScreenScale: The file name should include the scale of the current device, as returned by UIScreen.mainScreen.scale. 26 | */ 27 | typedef NS_OPTIONS(NSUInteger, FBSnapshotTestCaseFileNameIncludeOption) { 28 | FBSnapshotTestCaseFileNameIncludeOptionNone = 1 << 0, 29 | FBSnapshotTestCaseFileNameIncludeOptionDevice = 1 << 1, 30 | FBSnapshotTestCaseFileNameIncludeOptionOS = 1 << 2, 31 | FBSnapshotTestCaseFileNameIncludeOptionScreenSize = 1 << 3, 32 | FBSnapshotTestCaseFileNameIncludeOptionScreenScale = 1 << 4 33 | }; 34 | 35 | /** 36 | Returns a Boolean value that indicates whether the snapshot test is running in 64Bit. 37 | This method is a convenience for creating the suffixes set based on the architecture 38 | that the test is running. 39 | 40 | @returns @c YES if the test is running in 64bit, otherwise @c NO. 41 | */ 42 | BOOL FBSnapshotTestCaseIs64Bit(void); 43 | 44 | /** 45 | Returns a default set of strings that is used to append a suffix based on the architectures. 46 | @warning Do not modify this function, you can create your own and use it with @c FBSnapshotVerifyViewWithOptions() 47 | 48 | @returns An @c NSOrderedSet object containing strings that are appended to the reference images directory. 49 | */ 50 | NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void); 51 | 52 | /** 53 | Returns a fully normalized file name as per the provided option mask. Strips punctuation and spaces and replaces them with @c _. 54 | 55 | @param fileName The file name to normalize. 56 | @param option File Name Include options to use before normalization. 57 | @return An @c NSString object containing the passed @c fileName and optionally, with the device model and/or OS and/or screen size and/or screen scale appended at the end. 58 | */ 59 | NSString *FBFileNameIncludeNormalizedFileNameFromOption(NSString *fileName, FBSnapshotTestCaseFileNameIncludeOption option); 60 | 61 | NS_ASSUME_NONNULL_END 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/FBSnapshotTestCase/FBSnapshotTestCasePlatform.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Uber Technologies, Inc. 3 | * Copyright (c) 2015-2018, Facebook, Inc. 4 | * 5 | * This source code is licensed under the MIT license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | * 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | BOOL FBSnapshotTestCaseIs64Bit(void) 14 | { 15 | #if __LP64__ 16 | return YES; 17 | #else 18 | return NO; 19 | #endif 20 | } 21 | 22 | NSOrderedSet *FBSnapshotTestCaseDefaultSuffixes(void) 23 | { 24 | NSMutableOrderedSet *suffixesSet = [[NSMutableOrderedSet alloc] init]; 25 | [suffixesSet addObject:@"_32"]; 26 | [suffixesSet addObject:@"_64"]; 27 | if (FBSnapshotTestCaseIs64Bit()) { 28 | return [suffixesSet reversedOrderedSet]; 29 | } 30 | return [suffixesSet copy]; 31 | } 32 | 33 | NSString *FBFileNameIncludeNormalizedFileNameFromOption(NSString *fileName, FBSnapshotTestCaseFileNameIncludeOption option) 34 | { 35 | if ((option & FBSnapshotTestCaseFileNameIncludeOptionDevice) == FBSnapshotTestCaseFileNameIncludeOptionDevice) { 36 | UIDevice *device = [UIDevice currentDevice]; 37 | fileName = [fileName stringByAppendingFormat:@"_%@", device.model]; 38 | } 39 | 40 | if ((option & FBSnapshotTestCaseFileNameIncludeOptionOS) == FBSnapshotTestCaseFileNameIncludeOptionOS) { 41 | UIDevice *device = [UIDevice currentDevice]; 42 | NSString *os = device.systemVersion; 43 | fileName = [fileName stringByAppendingFormat:@"_%@", os]; 44 | } 45 | 46 | if ((option & FBSnapshotTestCaseFileNameIncludeOptionScreenSize) == FBSnapshotTestCaseFileNameIncludeOptionScreenSize) { 47 | UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow]; 48 | CGSize screenSize = keyWindow.bounds.size; 49 | fileName = [fileName stringByAppendingFormat:@"_%.0fx%.0f", screenSize.width, screenSize.height]; 50 | } 51 | 52 | NSMutableCharacterSet *invalidCharacters = [NSMutableCharacterSet new]; 53 | [invalidCharacters formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]]; 54 | [invalidCharacters formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]]; 55 | NSArray *validComponents = [fileName componentsSeparatedByCharactersInSet:invalidCharacters]; 56 | fileName = [validComponents componentsJoinedByString:@"_"]; 57 | 58 | if ((option & FBSnapshotTestCaseFileNameIncludeOptionScreenScale) == FBSnapshotTestCaseFileNameIncludeOptionScreenScale) { 59 | CGFloat screenScale = [[UIScreen mainScreen] scale]; 60 | fileName = [fileName stringByAppendingFormat:@"@%.fx", screenScale]; 61 | } 62 | 63 | return fileName; 64 | } 65 | -------------------------------------------------------------------------------- /Example/Pods/iOSSnapshotTestCase/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2018, Uber Technologies, Inc. 4 | Copyright (c) 2013-2018, Facebook, Inc. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /Example/PopupDialog.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/PopupDialog.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/PopupDialog.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/PopupDialog/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ -------------------------------------------------------------------------------- /Example/PopupDialog/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-41.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-60.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-58.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-87.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-81.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-120.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-121.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-180.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "Icon-20.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-42.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-29.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-59.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-40.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-80.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-76.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-152.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-167.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "Icon-1024.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-1024.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-120.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-121.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-121.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-152.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-167.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-180.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-20.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-29.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-41.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-42.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-58.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-59.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-60.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-76.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-80.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-81.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-81.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/AppIcon.appiconset/Icon-87.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "colorful.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "colorful@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "colorful@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful.imageset/colorful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful.imageset/colorful.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful.imageset/colorful@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful.imageset/colorful@2x.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful.imageset/colorful@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful.imageset/colorful@3x.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful_background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "colorful_background.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "colorful_background@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "colorful_background@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background@2x.png -------------------------------------------------------------------------------- /Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Example/PopupDialog/Images.xcassets/colorful_background.imageset/colorful_background@3x.png -------------------------------------------------------------------------------- /Example/PopupDialog/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIRequiresFullScreen 34 | 35 | UIStatusBarHidden 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Example/PopupDialog/RatingViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RatingViewController.swift 3 | // PopupDialog 4 | // 5 | // Created by Martin Wildfeuer on 11.07.16. 6 | // Copyright © 2016 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class RatingViewController: UIViewController { 12 | 13 | @IBOutlet weak var cosmosStarRating: CosmosView! 14 | 15 | @IBOutlet weak var commentTextField: UITextField! 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | commentTextField.delegate = self 21 | view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(endEditing))) 22 | } 23 | 24 | override func didReceiveMemoryWarning() { 25 | super.didReceiveMemoryWarning() 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | @objc func endEditing() { 30 | view.endEditing(true) 31 | } 32 | } 33 | 34 | extension RatingViewController: UITextFieldDelegate { 35 | 36 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 37 | endEditing() 38 | return true 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/devimages.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIGZzCCBU+gAwIBAgIQYrvhu6G9Fgcasgl2TZl5mzANBgkqhkiG9w0BAQsFADB+ 3 | MQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAd 4 | BgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxLzAtBgNVBAMTJlN5bWFudGVj 5 | IENsYXNzIDMgU2VjdXJlIFNlcnZlciBDQSAtIEc0MB4XDTE3MDkyNjAwMDAwMFoX 6 | DTE4MTIyNjIzNTk1OVowdDELMAkGA1UEBhMCVVMxFjAUBgNVBAgMDU1hc3NhY2h1 7 | c2V0dHMxEjAQBgNVBAcMCUNhbWJyaWRnZTEcMBoGA1UECgwTQWthbWFpIFRlY2hu 8 | b2xvZ2llczEbMBkGA1UEAwwSKi50ZXN0LmVkZ2VrZXkubmV0MIIBIjANBgkqhkiG 9 | 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA543ND2cSh+1DD3y2Q8Yk+5uy32/CBL+kUOlE 10 | cJjRZFKAjoqp91WQHB934PxeNwl6rimn3/JsTCMoWw0QkK2o96egzg7+lYwxKCsx 11 | iWuXtT7xQ9r3vnp7rKgEkrWIx0DjvCvKqi0oTreK4pvwMhC4A6J/eH7v7mHa6Ind 12 | Sq61jx7iejaq76lRAogEQchN5/rPT3wgiCv8xhoQ4kUD70/ewge4c0J9eIyamTcj 13 | z26ZO0faoDhIsdLJcCIFXuPLXOpIqtLVTFCz3mVnZcpxfE/ucmpQhK9ZVsDoTptJ 14 | g1D3Do+D2gCuQoU63ywSyR3O0Z4AUBQcuNtADyTDW8Ky0s1DiwIDAQABo4IC6TCC 15 | AuUwHQYDVR0RBBYwFIISKi50ZXN0LmVkZ2VrZXkubmV0MAkGA1UdEwQCMAAwDgYD 16 | VR0PAQH/BAQDAgWgMGEGA1UdIARaMFgwVgYGZ4EMAQICMEwwIwYIKwYBBQUHAgEW 17 | F2h0dHBzOi8vZC5zeW1jYi5jb20vY3BzMCUGCCsGAQUFBwICMBkMF2h0dHBzOi8v 18 | ZC5zeW1jYi5jb20vcnBhMCsGA1UdHwQkMCIwIKAeoByGGmh0dHA6Ly9zcy5zeW1j 19 | Yi5jb20vc3MuY3JsMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNV 20 | HSMEGDAWgBRfYM9hkFXfhEMUimAqsvV69EMY7zBXBggrBgEFBQcBAQRLMEkwHwYI 21 | KwYBBQUHMAGGE2h0dHA6Ly9zcy5zeW1jZC5jb20wJgYIKwYBBQUHMAKGGmh0dHA6 22 | Ly9zcy5zeW1jYi5jb20vc3MuY3J0MIIBfgYKKwYBBAHWeQIEAgSCAW4EggFqAWgA 23 | dgDd6x0reg1PpiCLga2BaHB+Lo6dAdVciI09EcTNtuy+zAAAAV6+8+BXAAAEAwBH 24 | MEUCIQD/wY5p3ev/vlWuL/v3Kad3+R9gy24Ii8vsMps4PY12RAIgDp/YWIVUcBdc 25 | 738Kvh7I6nSqyZTJzLXSHFXa9pM8lqcAdwCkuQmQtBhYFIe7E6LMZ3AKPDWYBPkb 26 | 37jjd80OyA3cEAAAAV6+8+CLAAAEAwBIMEYCIQDUmj2JR8YZP+cbltnLvtn5yOGY 27 | v3P/gSYqxp8+6vTw2QIhAIvmh0+pvmByCULkY4oMU+lkhhrEOWOc31Sb4PX1wLVX 28 | AHUA7ku9t3XOYLrhQmkfq+GeZqMPfl+wctiDAMR7iXqo/csAAAFevvPiUAAABAMA 29 | RjBEAiBZeCv/pcdIiigjx5pYYVjGfoaaTD/welV0kSIaj4fGnAIgHsb/YbkFPX02 30 | l7m0nje19lR6fX50yz8mZlrpM5L3mOMwDQYJKoZIhvcNAQELBQADggEBAESx37oX 31 | fI1YGQls5pta65Sf3OYMWeqeMgSavGxic1NR+KzI99lEEyn8D/pNmKNSIsmABhEF 32 | sdiKb861IBQfiXA2ah77EcQMuHunfY5dqjBjJ/hAuKnbX3sEjuuDekS7QhZckWFz 33 | rVCUQRQOSGG2ySFid0YkQ9ONG1FryJC9Y6lV7cgfeetjDH9VTegiGi+TvrW4EnpO 34 | 63rIp1+JyLphrtlASezBLiinReClJHoz7dVBbAljLFghyowyIPVX8fz5Cz+qaODI 35 | C/NidRACLvLBCyByalAT1/T5mkjU+VEePVgQDoxn/PUrmQR7GNG05mdQ2ZHs3kT+ 36 | NNorNDMd1NF7ToY= 37 | -----END CERTIFICATE----- 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 2 | Author - Martin Wildfeuer (http://www.mwfire.de) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "DynamicBlurView", 6 | "repositoryURL": "https://github.com/KyoheiG3/DynamicBlurView.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "fbf91352ff3defee8e1fc7525696404bc3740a86", 10 | "version": "5.0.4" 11 | } 12 | } 13 | ] 14 | }, 15 | "version": 1 16 | } 17 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | // This comment is necessary, and every Package.swift file 4 | // must start with it. 5 | // It tells SPM which version to use. 6 | // It doesn't have to be the same version as your code, 7 | // but it should be compatible. 8 | 9 | import PackageDescription 10 | 11 | let package = Package( 12 | name: "PopupDialog", 13 | // Which platforms and minimum deployment targets are supported 14 | // See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#supportedplatform 15 | platforms: [ 16 | .iOS(.v12) 17 | ], 18 | // The externaly visible build artifacts 19 | // See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#product 20 | products: [ 21 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 22 | // The library that you can actually import 23 | .library( 24 | name: "PopupDialog", 25 | targets: ["PopupDialog"]) 26 | ], 27 | // Your package might need other packages. 28 | // Due to being decentralized you have to tell SPM where to look. 29 | dependencies: [ 30 | // Dependencies declare other packages that this package depends on. 31 | // .package(url: /* package url */, from: "1.0.0"), 32 | .package(url: "https://github.com/KyoheiG3/DynamicBlurView.git", from: "5.0.0") 33 | ], 34 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 35 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 36 | // See: https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#target 37 | targets: [ 38 | 39 | .target( 40 | name: "PopupDialog", 41 | dependencies:[ 42 | .product(name: "DynamicBlurView", package: "DynamicBlurView") 43 | ], 44 | path: "PopupDialog/Classes") 45 | ] 46 | ) 47 | -------------------------------------------------------------------------------- /PopupDialog.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PopupDialog' 3 | s.version = '1.1.1' 4 | s.summary = 'A simple custom popup dialog view controller' 5 | s.homepage = 'https://github.com/orderella/PopupDialog' 6 | s.license = { :type => 'MIT', :file => 'LICENSE' } 7 | s.author = { 'Martin Wildfeuer' => 'mwfire@mwfire.de' } 8 | s.source = { :git => 'https://github.com/orderella/PopupDialog.git', :tag => s.version.to_s } 9 | s.social_media_url = 'https://twitter.com/theMWFire' 10 | 11 | s.ios.deployment_target = '10.0' 12 | s.source_files = 'PopupDialog/Classes/**/*' 13 | s.swift_version = '5.0' 14 | 15 | s.dependency 'DynamicBlurView', '~> 4.0' 16 | end 17 | -------------------------------------------------------------------------------- /PopupDialog/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/PopupDialog/Assets/.gitkeep -------------------------------------------------------------------------------- /PopupDialog/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/PopupDialog/Classes/.gitkeep -------------------------------------------------------------------------------- /PopupDialog/Classes/InteractiveTransition.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PopupDialogInteractiveTransition.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | // Handles interactive transition triggered via pan gesture recognizer on dialog 30 | final internal class InteractiveTransition: UIPercentDrivenInteractiveTransition { 31 | 32 | // If the interactive transition was started 33 | var hasStarted = false 34 | 35 | // If the interactive transition 36 | var shouldFinish = false 37 | 38 | // The view controller containing the views 39 | // with attached gesture recognizers 40 | weak var viewController: UIViewController? 41 | 42 | @objc func handlePan(_ sender: UIPanGestureRecognizer) { 43 | 44 | guard let vc = viewController else { return } 45 | 46 | guard let progress = calculateProgress(sender: sender) else { return } 47 | 48 | switch sender.state { 49 | case .began: 50 | hasStarted = true 51 | vc.dismiss(animated: true, completion: nil) 52 | case .changed: 53 | shouldFinish = progress > 0.3 54 | update(progress) 55 | case .cancelled: 56 | hasStarted = false 57 | cancel() 58 | case .ended: 59 | hasStarted = false 60 | completionSpeed = 0.55 61 | shouldFinish ? finish() : cancel() 62 | default: 63 | break 64 | } 65 | } 66 | } 67 | 68 | internal extension InteractiveTransition { 69 | 70 | /*! 71 | Translates the pan gesture recognizer position to the progress percentage 72 | - parameter sender: A UIPanGestureRecognizer 73 | - returns: Progress 74 | */ 75 | func calculateProgress(sender: UIPanGestureRecognizer) -> CGFloat? { 76 | guard let vc = viewController else { return nil } 77 | 78 | // http://www.thorntech.com/2016/02/ios-tutorial-close-modal-dragging/ 79 | let translation = sender.translation(in: vc.view) 80 | let verticalMovement = translation.y / vc.view.bounds.height 81 | let downwardMovement = fmaxf(Float(verticalMovement), 0.0) 82 | let downwardMovementPercent = fminf(downwardMovement, 1.0) 83 | let progress = CGFloat(downwardMovementPercent) 84 | 85 | return progress 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /PopupDialog/Classes/PopupDialogDefaultButtons.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PopupDialogDefaultButtons.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | // MARK: Default button 30 | 31 | /// Represents the default button for the popup dialog 32 | public final class DefaultButton: PopupDialogButton {} 33 | 34 | // MARK: Cancel button 35 | 36 | /// Represents a cancel button for the popup dialog 37 | public final class CancelButton: PopupDialogButton { 38 | 39 | override public func setupView() { 40 | defaultTitleColor = UIColor.lightGray 41 | super.setupView() 42 | } 43 | } 44 | 45 | // MARK: destructive button 46 | 47 | /// Represents a destructive button for the popup dialog 48 | public final class DestructiveButton: PopupDialogButton { 49 | 50 | override public func setupView() { 51 | defaultTitleColor = UIColor.red 52 | super.setupView() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /PopupDialog/Classes/PresentationController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PopupDialogPresentationController.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | final internal class PresentationController: UIPresentationController { 30 | 31 | private lazy var overlay: PopupDialogOverlayView = { 32 | return PopupDialogOverlayView(frame: .zero) 33 | }() 34 | 35 | override func presentationTransitionWillBegin() { 36 | 37 | guard let containerView = containerView else { return } 38 | 39 | overlay.frame = containerView.bounds 40 | containerView.insertSubview(overlay, at: 0) 41 | 42 | presentedViewController.transitionCoordinator?.animate(alongsideTransition: { [weak self] _ in 43 | self?.overlay.alpha = 1.0 44 | }, completion: nil) 45 | } 46 | 47 | override func dismissalTransitionWillBegin() { 48 | presentedViewController.transitionCoordinator?.animate(alongsideTransition: { [weak self] _ in 49 | self?.overlay.alpha = 0.0 50 | }, completion: nil) 51 | } 52 | 53 | override func containerViewWillLayoutSubviews() { 54 | 55 | guard let presentedView = presentedView else { return } 56 | 57 | presentedView.frame = frameOfPresentedViewInContainerView 58 | overlay.blurView.refresh() 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /PopupDialog/Classes/TransitionAnimator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PopupDialogTransitionAnimator.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | /// Base class for custom transition animations 30 | internal class TransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning { 31 | 32 | var to: UIViewController! 33 | var from: UIViewController! 34 | let inDuration: TimeInterval 35 | let outDuration: TimeInterval 36 | let direction: AnimationDirection 37 | 38 | init(inDuration: TimeInterval, outDuration: TimeInterval, direction: AnimationDirection) { 39 | self.inDuration = inDuration 40 | self.outDuration = outDuration 41 | self.direction = direction 42 | super.init() 43 | } 44 | 45 | internal func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { 46 | return direction == .in ? inDuration : outDuration 47 | } 48 | 49 | internal func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { 50 | switch direction { 51 | case .in: 52 | guard let to = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to), 53 | let from = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from) else { return } 54 | 55 | self.to = to 56 | self.from = from 57 | 58 | let container = transitionContext.containerView 59 | container.addSubview(to.view) 60 | case .out: 61 | guard let to = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to), 62 | let from = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from) else { return } 63 | 64 | self.to = to 65 | self.from = from 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /PopupDialog/Classes/UIImageView+Calculations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+Calculations.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | internal extension UIImageView { 30 | 31 | /*! 32 | Calculates the height of the the UIImageView has to 33 | have so the image is displayed correctly 34 | - returns: Height to set on the imageView 35 | */ 36 | func pv_heightForImageView() -> CGFloat { 37 | guard let image = image, image.size.height > 0 else { 38 | return 0.0 39 | } 40 | let width = bounds.size.width 41 | let ratio = image.size.height / image.size.width 42 | return width * ratio 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /PopupDialog/Classes/UIView+Animations.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Animations.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | /*! 30 | The intended direction of the animation 31 | - in: Animate in 32 | - out: Animate out 33 | */ 34 | internal enum AnimationDirection { 35 | case `in` // swiftlint:disable:this identifier_name 36 | case out 37 | } 38 | 39 | internal extension UIView { 40 | 41 | /// The key for the fade animation 42 | var fadeKey: String { return "FadeAnimation" } 43 | var shakeKey: String { return "ShakeAnimation" } 44 | 45 | func pv_fade(_ direction: AnimationDirection, _ value: Float, duration: CFTimeInterval = 0.08) { 46 | layer.removeAnimation(forKey: fadeKey) 47 | let animation = CABasicAnimation(keyPath: "opacity") 48 | animation.duration = duration 49 | animation.fromValue = layer.presentation()?.opacity 50 | layer.opacity = value 51 | animation.fillMode = CAMediaTimingFillMode.forwards 52 | layer.add(animation, forKey: fadeKey) 53 | } 54 | 55 | func pv_layoutIfNeededAnimated(duration: CFTimeInterval = 0.08) { 56 | UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: { 57 | self.layoutIfNeeded() 58 | }, completion: nil) 59 | } 60 | 61 | // As found at https://gist.github.com/mourad-brahim/cf0bfe9bec5f33a6ea66#file-uiview-animations-swift-L9 62 | // Slightly modified 63 | func pv_shake() { 64 | layer.removeAnimation(forKey: shakeKey) 65 | let vals: [Double] = [-2, 2, -2, 2, 0] 66 | 67 | let translation = CAKeyframeAnimation(keyPath: "transform.translation.x") 68 | translation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) 69 | translation.values = vals 70 | 71 | let rotation = CAKeyframeAnimation(keyPath: "transform.rotation.z") 72 | rotation.values = vals.map { (degrees: Double) in 73 | let radians: Double = (Double.pi * degrees) / 180.0 74 | return radians 75 | } 76 | 77 | let shakeGroup: CAAnimationGroup = CAAnimationGroup() 78 | shakeGroup.animations = [translation, rotation] 79 | shakeGroup.duration = 0.3 80 | self.layer.add(shakeGroup, forKey: shakeKey) 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /PopupDialog/Classes/UIViewController+Visibility.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Visibility.swift 3 | // 4 | // Copyright (c) 2016 Orderella Ltd. (http://orderella.co.uk) 5 | // Author - Martin Wildfeuer (http://www.mwfire.de) 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | import Foundation 27 | import UIKit 28 | 29 | // http://stackoverflow.com/questions/2777438/how-to-tell-if-uiviewcontrollers-view-is-visible 30 | internal extension UIViewController { 31 | 32 | var isTopAndVisible: Bool { 33 | return isVisible && isTopViewController 34 | } 35 | 36 | var isVisible: Bool { 37 | if isViewLoaded { 38 | return view.window != nil 39 | } 40 | return false 41 | } 42 | 43 | var isTopViewController: Bool { 44 | if self.navigationController != nil { 45 | return self.navigationController?.visibleViewController === self 46 | } else if self.tabBarController != nil { 47 | return self.tabBarController?.selectedViewController == self && self.presentedViewController == nil 48 | } else { 49 | return self.presentedViewController == nil && self.isVisible 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Tests/CustomViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class CustomViewController: UIViewController { 4 | var testProperty = "I am a test" 5 | } 6 | -------------------------------------------------------------------------------- /Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPad_11_1_768x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPad_11_1_768x1024.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPad_11_1_768x1024@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPad_11_1_768x1024@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_10_2_375x667.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_10_2_375x667.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_10_2_375x667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_10_2_375x667@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_12_2_414x896.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_12_2_414x896.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_12_2_414x896@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testCustomDialog_iPhone_12_2_414x896@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPad_11_1_768x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPad_11_1_768x1024.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPad_11_1_768x1024@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPad_11_1_768x1024@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_10_2_375x667.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_10_2_375x667.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_10_2_375x667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_10_2_375x667@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_12_2_414x896.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_12_2_414x896.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_12_2_414x896@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testInitialView_iPhone_12_2_414x896@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPad_11_1_768x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPad_11_1_768x1024.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPad_11_1_768x1024@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPad_11_1_768x1024@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_10_2_375x667.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_10_2_375x667.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_10_2_375x667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_10_2_375x667@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_12_2_414x896.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_12_2_414x896.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_12_2_414x896@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithImage_iPhone_12_2_414x896@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPad_11_1_768x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPad_11_1_768x1024.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPad_11_1_768x1024@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPad_11_1_768x1024@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_10_2_375x667.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_10_2_375x667.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_10_2_375x667@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_10_2_375x667@2x.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_12_2_414x896.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_12_2_414x896.png -------------------------------------------------------------------------------- /Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_12_2_414x896@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Orderella/PopupDialog/d41ac7c7fa7b940c355490281ea8b2fc39c8f599/Tests/ReferenceImages_64/PopupDialog_Tests.SnapshotTests/testStandardDialogWithoutImage_iPhone_12_2_414x896@2x.png -------------------------------------------------------------------------------- /Tests/SnapshotTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import UIKit 3 | import PopupDialog 4 | import FBSnapshotTestCase 5 | 6 | class SnapshotTests: FBSnapshotTestCase { 7 | 8 | var vc: ViewController! 9 | var window: UIWindow! 10 | 11 | override func setUp() { 12 | super.setUp() 13 | 14 | recordMode = false 15 | fileNameOptions = [.device, .OS, .screenSize, .screenScale] 16 | 17 | let bundle = Bundle(for: self.classForCoder) 18 | let sb = UIStoryboard(name: "Main", bundle: bundle) 19 | vc = sb.instantiateViewController(withIdentifier: "ViewController") as? ViewController 20 | XCTAssertNotNil(vc.view) 21 | 22 | window = UIWindow(frame: UIScreen.main.bounds) 23 | window.rootViewController = vc 24 | window.makeKeyAndVisible() 25 | } 26 | 27 | func testInitialView() { 28 | FBSnapshotVerifyView(window) 29 | } 30 | 31 | func testStandardDialogWithImage() { 32 | vc.showImageDialog(animated: false) 33 | let date = Date(timeIntervalSinceNow: 1) 34 | RunLoop.current.run(mode: RunLoop.Mode.default, before: date) 35 | FBSnapshotVerifyView(window) 36 | } 37 | 38 | func testStandardDialogWithoutImage() { 39 | vc.showStandardDialog(animated: false) 40 | let date = Date(timeIntervalSinceNow: 1) 41 | RunLoop.current.run(mode: RunLoop.Mode.default, before: date) 42 | FBSnapshotVerifyView(window) 43 | } 44 | 45 | func testCustomDialog() { 46 | vc.showCustomDialog(animated: false) 47 | let date = Date(timeIntervalSinceNow: 1) 48 | RunLoop.current.run(mode: RunLoop.Mode.default, before: date) 49 | FBSnapshotVerifyView(window) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /UITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIViewControllerBasedStatusBarAppearance 6 | 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /UITests/Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class UITests: XCTestCase { 4 | 5 | let app = XCUIApplication() 6 | 7 | override func setUp() { 8 | super.setUp() 9 | 10 | // Put setup code here. This method is called before the invocation of each test method in the class. 11 | 12 | // In UI tests it is usually best to stop immediately when a failure occurs. 13 | continueAfterFailure = false 14 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 15 | XCUIApplication().launch() 16 | 17 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 18 | } 19 | 20 | override func tearDown() { 21 | // Put teardown code here. This method is called after the invocation of each test method in the class. 22 | super.tearDown() 23 | } 24 | 25 | func testDefaultDialogWithImage() { 26 | XCTAssert(app.staticTexts["Tap the buttons!"].exists) 27 | 28 | app.buttons["Show Image Dialog"].tap() 29 | app.buttons["OK"].tap() 30 | XCTAssert(app.staticTexts["You ok'd the image dialog"].exists) 31 | 32 | app.buttons["Show Image Dialog"].tap() 33 | app.buttons["CANCEL"].tap() 34 | XCTAssert(app.staticTexts["You canceled the image dialog"].exists) 35 | } 36 | 37 | func testDefaultDialogWithoutImage() { 38 | XCTAssert(app.staticTexts["Tap the buttons!"].exists) 39 | 40 | app.buttons["Show Standard Dialog"].tap() 41 | app.buttons["OK"].tap() 42 | XCTAssert(app.staticTexts["You ok'd the default dialog"].exists) 43 | 44 | app.buttons["Show Standard Dialog"].tap() 45 | app.buttons["CANCEL"].tap() 46 | XCTAssert(app.staticTexts["You canceled the default dialog"].exists) 47 | } 48 | 49 | func testCustomDialog() { 50 | XCTAssert(app.staticTexts["Tap the buttons!"].exists) 51 | 52 | let showCustomDialogButton = app.buttons["Show Custom Dialog"] 53 | 54 | showCustomDialogButton.tap() 55 | app.buttons["CANCEL"].tap() 56 | XCTAssert(app.staticTexts["You canceled the rating dialog"].exists) 57 | 58 | showCustomDialogButton.tap() 59 | app.otherElements["Rating"].tap() 60 | app.buttons["RATE"].tap() 61 | XCTAssert(app.staticTexts["You rated 3.0 stars"].exists) 62 | } 63 | 64 | } 65 | --------------------------------------------------------------------------------