├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── Brewfile ├── CHANGELOG.md ├── Cartfile.private ├── Cartfile.resolved ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── ExampleUITests │ ├── ExampleUITests.swift │ └── Info.plist └── Playground.playground │ ├── Contents.swift │ └── contents.xcplayground ├── LICENSE ├── Noti.podspec ├── Noti.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── Noti.xcscheme ├── Noti.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── README.md ├── Scripts └── generate_sourcery.sh ├── Sources ├── Core │ ├── DataTransformer.swift │ ├── Definition │ │ ├── Foundation.swift │ │ └── UIKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── NotificationCenter+Noti.swift │ ├── NotificationPayload.swift │ ├── NotificationToken.swift │ ├── TypedNotification.swift │ └── sourcery.yml ├── Info.plist ├── Noti+AVFoundation │ ├── Definition │ │ └── AVFoundation.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiAVFoundation.h │ └── sourcery.yml ├── Noti+Accounts │ ├── Definition │ │ └── Accounts.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiAccounts.h │ └── sourcery.yml ├── Noti+CloudKit │ ├── Definition │ │ └── CloudKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiCloudKit.h │ └── sourcery.yml ├── Noti+Contacts │ ├── Definition │ │ └── Contacts.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiContacts.h │ └── sourcery.yml ├── Noti+CoreData │ ├── Definition │ │ └── CoreData.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiCoreData.h │ └── sourcery.yml ├── Noti+EventKit │ ├── Definition │ │ └── EventKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiEventKit.h │ └── sourcery.yml ├── Noti+GameController │ ├── Definition │ │ └── GameController.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiGameController.h │ └── sourcery.yml ├── Noti+HealthKit │ ├── Definition │ │ └── HealthKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiHealthKit.h │ └── sourcery.yml ├── Noti+HomeKit │ ├── Definition │ │ └── HomeKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiHomeKit.h │ └── sourcery.yml ├── Noti+NetworkExtension │ ├── Definition │ │ └── NetworkExtension.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiNetworkExtension.h │ └── sourcery.yml ├── Noti+PDFKit │ ├── Definition │ │ └── PDFKit.swift │ ├── Generated │ │ ├── NotificationPayload.generated.swift │ │ └── TypedNotification.generated.swift │ ├── Info.plist │ ├── NotiPDFKit.h │ └── sourcery.yml └── Noti.h ├── Templates ├── NotificationPayload.stencil └── TypedNotification.stencil └── Tests ├── DataTransformerTests.swift ├── Info.plist └── NotiTests.swift /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing Guidelines 2 | -------------------------------------------------- 3 | 4 | This document provides general guidelines about how to contribute to the project. Keep in mind these important things before you start contributing. 5 | 6 | ### Asking Questions 7 | 8 | We do not use github issues for general library support. We think this questions should be posted on stack overflow using [Noti](http://http://stackoverflow.com/questions/tagged/Noti) tag. 9 | 10 | ### Reporting issues 11 | 12 | * Use [github issues](https://github.com/onevcat/Noti/issues) to report a bug. 13 | * Before creating a new issue: 14 | * Make sure you are using the [latest release](https://github.com/onevcat/Noti/releases). 15 | * Check if the issue was [already reported or fixed](https://github.com/onevcat/Noti/issues?utf8=%E2%9C%93&q=is%3Aissue). Notice that it may not be released yet. 16 | * If you found a match add a brief comment "I have the same problem" or "+1". This helps prioritize the issues addressing the most common and critical first. If possible add additional information to help us reproduce and fix the issue. Please use your best judgement. 17 | * Reporting issues: 18 | * Please include the following information to help maintainers to fix the problem faster: 19 | * Xcode version you are using. 20 | * iOS version you are targeting. 21 | * Full Xcode console output of stack trace or code compilation error. 22 | * Any other additional detail you think it would be useful to understand and solve the problem. 23 | 24 | 25 | ### Pull requests 26 | 27 | The easiest way to start contributing is searching open issues by `help wanted` tag. We also add a `difficulty` tag (difficulty: easy, difficulty: moderate, difficulty: hard) in order to give an idea of how complex it can be to implement the feature according maintainers project experience. 28 | 29 | * Add test coverage to the feature or fix. We only accept new feature pull requests that have related test coverage. This allows us to keep the library stable as we move forward. 30 | * Remember to document the new feature. We do not accept new feature pull requests without its associated documentation. 31 | * In case of a new feature please update the example project showing the feature. 32 | * Please only one fix or feature per pull request. This will increase the chances your feature will be merged. 33 | 34 | 35 | ###### Suggested git workflow to contribute 36 | 37 | 1. Fork the Noti repository. 38 | 2. Clone your forked project into your developer machine: `git clone git@github.com:/Noti.git` 39 | 3. Add the original project repo as upstream repository in your forked project: `git remote add upstream git@github.com:onevcat/Noti.git` 40 | 4. Before starting a new feature make sure your forked master branch is synchronized upstream master branch. Considering you do not mere your pull request into master you can run: `git checkout master` and then `git pull upstream master`. Optionally `git push origin master`. 41 | 5. Create a new branch. Note that the starting point is the upstream master branch HEAD. `git checkout -b my-feature-name` 42 | 6. Stage all your changes `git add .` and commit them `git commit -m "Your commit message"` 43 | 7. Make sure your branch is up to date with upstream master, `git pull --rebase upstream master`, resolve conflicts if necessary. This will move your commit to the top of git stack. 44 | 8. Squash your commits into one commit. `git rebase -i HEAD~6` considering you did 6 commits. 45 | 9. Push your branch into your forked remote repository. 46 | 10. Create a new pull request adding any useful comment. 47 | 48 | 49 | ###### Code style and conventions 50 | 51 | We try to follow our [swift style guide](https://github.com/onevcat/Swift-Style-Guide). Following it is not strictly necessary to contribute and to have a pull request accepted but project maintainers try to follow it. We would love to hear your ideas to improve our code style and conventions. Feel free to contribute. 52 | 53 | 54 | ### Feature proposal 55 | 56 | We would love to hear your ideas and make a discussions about it. 57 | 58 | * Use github issues to make feature proposals. 59 | * We use `type: feature request` label to mark all [feature request issues](https://github.com/onevcat/Noti/labels/type%3A%20feature%20request). 60 | * Before submitting your proposal make sure there is no similar feature request. If you found a match feel free to join the discussion or just add a brief "+1" if you think the feature is worth implementing. 61 | * Be as specific as possible providing a precise explanation of feature request so anyone can understand the problem and the benefits of solving it. 62 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Before submitting issues ... 2 | 3 | - Make sure you are using Noti's [latest release](https://github.com/xmartlabs/Noti/releases) or master branch version. 4 | - Make sure your Xcode version is the latest stable one. 5 | - Check if the issue was [already reported or fixed](https://github.com/xmartlabs/Noti/issues?utf8=%E2%9C%93&q=is%3Aissue). We add labels to each issue in order to easily find related issues. If you found a match add a brief comment "I have the same problem" or "+1". 6 | 7 | When submitting issues, please provide the following information to help maintainers to fix the problem faster: 8 | 9 | - Environment: Noti, Xcode and iOS version you are using. 10 | - In case of reporting errors, provide Xcode console output of stack trace or code compilation error. 11 | - Any other additional detail such as your eureka form/section/row code that you think it would be useful to understand and solve the problem. 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Fixes #issue(s) . 2 | 3 | Changes proposed in this request: 4 | * 5 | * 6 | * 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## OS X Finder 2 | .DS_Store 3 | 4 | ## Build generated 5 | build/ 6 | DerivedData 7 | 8 | ## Various settings 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | 19 | ## Other 20 | *.xccheckout 21 | *.moved-aside 22 | *.xcuserstate 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | 29 | ## Playgrounds 30 | timeline.xctimeline 31 | playground.xcworkspace 32 | 33 | # Swift Package Manager 34 | # 35 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 36 | # Packages/ 37 | .build/ 38 | 39 | # CocoaPods 40 | # 41 | # We recommend against adding the Pods directory to your .gitignore. However 42 | # you should judge for yourself, the pros and cons are mentioned at: 43 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 44 | # 45 | # Pods/ 46 | 47 | # Carthage 48 | # 49 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 50 | 51 | Carthage/ 52 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode9 3 | env: 4 | - DESTINATION="OS=11.0,name=iPhone 7" SCHEME="Noti" SDK=iphonesimulator 5 | 6 | before_install: 7 | - brew update 8 | - brew outdated carthage || brew upgrade carthage 9 | - carthage update --platform iOS 10 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet 11 | 12 | script: 13 | - xcodebuild clean build -project Noti.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c 14 | - xcodebuild test -project Noti.xcodeproj -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c 15 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "sourcery" -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to Noti will be documented in this file. 3 | 4 | ### [1.0.0](https://github.com/onevcat/Noti/releases/tag/1.0.0) 5 | 6 | 7 | * This is the initial version. 8 | 9 | [xmartlabs]: https://xmartlabs.com 10 | -------------------------------------------------------------------------------- /Cartfile.private: -------------------------------------------------------------------------------- 1 | github "Quick/Quick" 2 | github "Quick/Nimble" 3 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "Quick/Nimble" "v7.1.1" 2 | github "Quick/Quick" "v1.3.0" 3 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 287D0A721C4B7877004566D6 /* ExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287D0A711C4B7877004566D6 /* ExampleUITests.swift */; }; 11 | 28F828D01C4B714D00330CF4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F828CF1C4B714D00330CF4 /* AppDelegate.swift */; }; 12 | 28F828D21C4B714D00330CF4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F828D11C4B714D00330CF4 /* ViewController.swift */; }; 13 | 28F828D51C4B714D00330CF4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28F828D31C4B714D00330CF4 /* Main.storyboard */; }; 14 | 28F828D71C4B714D00330CF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28F828D61C4B714D00330CF4 /* Assets.xcassets */; }; 15 | 28F828DA1C4B714D00330CF4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28F828D81C4B714D00330CF4 /* LaunchScreen.storyboard */; }; 16 | 4BFAFCC120A533AB00855D80 /* Noti.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8F9CAB221D89C756006E1824 /* Noti.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 28F828E11C4B714D00330CF4 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 28F828C41C4B714D00330CF4 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 28F828CB1C4B714D00330CF4; 25 | remoteInfo = Example; 26 | }; 27 | 4BFAFCBF20A533A000855D80 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 28F8287C1C494B2C00330CF4; 32 | remoteInfo = Noti; 33 | }; 34 | 8F9CAB211D89C756006E1824 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */; 37 | proxyType = 2; 38 | remoteGlobalIDString = 28F8287D1C494B2C00330CF4; 39 | remoteInfo = Noti; 40 | }; 41 | 8F9CAB231D89C756006E1824 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */; 44 | proxyType = 2; 45 | remoteGlobalIDString = 28F828871C494B2C00330CF4; 46 | remoteInfo = NotiTests; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXCopyFilesBuildPhase section */ 51 | 287D0A811C4B7B55004566D6 /* Embed Frameworks */ = { 52 | isa = PBXCopyFilesBuildPhase; 53 | buildActionMask = 2147483647; 54 | dstPath = ""; 55 | dstSubfolderSpec = 10; 56 | files = ( 57 | 4BFAFCC120A533AB00855D80 /* Noti.framework in Embed Frameworks */, 58 | ); 59 | name = "Embed Frameworks"; 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXCopyFilesBuildPhase section */ 63 | 64 | /* Begin PBXFileReference section */ 65 | 287D0A711C4B7877004566D6 /* ExampleUITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleUITests.swift; sourceTree = ""; }; 66 | 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Noti.xcodeproj; path = ../Noti.xcodeproj; sourceTree = ""; }; 67 | 28F828CC1C4B714D00330CF4 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | 28F828CF1C4B714D00330CF4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Example/AppDelegate.swift; sourceTree = ""; }; 69 | 28F828D11C4B714D00330CF4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ViewController.swift; path = Example/ViewController.swift; sourceTree = ""; }; 70 | 28F828D41C4B714D00330CF4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 71 | 28F828D61C4B714D00330CF4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Example/Assets.xcassets; sourceTree = ""; }; 72 | 28F828D91C4B714D00330CF4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 73 | 28F828DB1C4B714D00330CF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 74 | 28F828E01C4B714D00330CF4 /* ExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | 28F828E61C4B714D00330CF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 28F828C91C4B714D00330CF4 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 28F828DD1C4B714D00330CF4 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 28F828C31C4B714D00330CF4 = { 97 | isa = PBXGroup; 98 | children = ( 99 | 28F828CE1C4B714D00330CF4 /* Example */, 100 | 28F828E31C4B714D00330CF4 /* ExampleUITests */, 101 | 28F828CD1C4B714D00330CF4 /* Products */, 102 | 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 28F828CD1C4B714D00330CF4 /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 28F828CC1C4B714D00330CF4 /* Example.app */, 110 | 28F828E01C4B714D00330CF4 /* ExampleUITests.xctest */, 111 | ); 112 | name = Products; 113 | sourceTree = ""; 114 | }; 115 | 28F828CE1C4B714D00330CF4 /* Example */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 28F828CF1C4B714D00330CF4 /* AppDelegate.swift */, 119 | 28F828D11C4B714D00330CF4 /* ViewController.swift */, 120 | 28F828D31C4B714D00330CF4 /* Main.storyboard */, 121 | 28F828D61C4B714D00330CF4 /* Assets.xcassets */, 122 | 28F828D81C4B714D00330CF4 /* LaunchScreen.storyboard */, 123 | 28F828DB1C4B714D00330CF4 /* Info.plist */, 124 | ); 125 | name = Example; 126 | sourceTree = ""; 127 | }; 128 | 28F828E31C4B714D00330CF4 /* ExampleUITests */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 28F828E61C4B714D00330CF4 /* Info.plist */, 132 | 287D0A711C4B7877004566D6 /* ExampleUITests.swift */, 133 | ); 134 | path = ExampleUITests; 135 | sourceTree = ""; 136 | }; 137 | 8F9CAB1D1D89C755006E1824 /* Products */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 8F9CAB221D89C756006E1824 /* Noti.framework */, 141 | 8F9CAB241D89C756006E1824 /* NotiTests.xctest */, 142 | ); 143 | name = Products; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | 28F828CB1C4B714D00330CF4 /* Example */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 28F828E91C4B714D00330CF4 /* Build configuration list for PBXNativeTarget "Example" */; 152 | buildPhases = ( 153 | 28F828C81C4B714D00330CF4 /* Sources */, 154 | 28F828C91C4B714D00330CF4 /* Frameworks */, 155 | 28F828CA1C4B714D00330CF4 /* Resources */, 156 | 287D0A811C4B7B55004566D6 /* Embed Frameworks */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | 4BFAFCC020A533A000855D80 /* PBXTargetDependency */, 162 | ); 163 | name = Example; 164 | productName = Example; 165 | productReference = 28F828CC1C4B714D00330CF4 /* Example.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | 28F828DF1C4B714D00330CF4 /* ExampleUITests */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 28F828EC1C4B714D00330CF4 /* Build configuration list for PBXNativeTarget "ExampleUITests" */; 171 | buildPhases = ( 172 | 28F828DC1C4B714D00330CF4 /* Sources */, 173 | 28F828DD1C4B714D00330CF4 /* Frameworks */, 174 | 28F828DE1C4B714D00330CF4 /* Resources */, 175 | ); 176 | buildRules = ( 177 | ); 178 | dependencies = ( 179 | 28F828E21C4B714D00330CF4 /* PBXTargetDependency */, 180 | ); 181 | name = ExampleUITests; 182 | productName = ExampleUITests; 183 | productReference = 28F828E01C4B714D00330CF4 /* ExampleUITests.xctest */; 184 | productType = "com.apple.product-type.bundle.ui-testing"; 185 | }; 186 | /* End PBXNativeTarget section */ 187 | 188 | /* Begin PBXProject section */ 189 | 28F828C41C4B714D00330CF4 /* Project object */ = { 190 | isa = PBXProject; 191 | attributes = { 192 | LastSwiftUpdateCheck = 0720; 193 | LastUpgradeCheck = 0930; 194 | TargetAttributes = { 195 | 28F828CB1C4B714D00330CF4 = { 196 | CreatedOnToolsVersion = 7.2; 197 | DevelopmentTeam = T499X543T7; 198 | LastSwiftMigration = 0800; 199 | ProvisioningStyle = Automatic; 200 | }; 201 | 28F828DF1C4B714D00330CF4 = { 202 | CreatedOnToolsVersion = 7.2; 203 | LastSwiftMigration = 0800; 204 | ProvisioningStyle = Manual; 205 | TestTargetID = 28F828CB1C4B714D00330CF4; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = 28F828C71C4B714D00330CF4 /* Build configuration list for PBXProject "Example" */; 210 | compatibilityVersion = "Xcode 3.2"; 211 | developmentRegion = English; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | Base, 216 | ); 217 | mainGroup = 28F828C31C4B714D00330CF4; 218 | productRefGroup = 28F828CD1C4B714D00330CF4 /* Products */; 219 | projectDirPath = ""; 220 | projectReferences = ( 221 | { 222 | ProductGroup = 8F9CAB1D1D89C755006E1824 /* Products */; 223 | ProjectRef = 287D0A741C4B7B26004566D6 /* Noti.xcodeproj */; 224 | }, 225 | ); 226 | projectRoot = ""; 227 | targets = ( 228 | 28F828CB1C4B714D00330CF4 /* Example */, 229 | 28F828DF1C4B714D00330CF4 /* ExampleUITests */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXReferenceProxy section */ 235 | 8F9CAB221D89C756006E1824 /* Noti.framework */ = { 236 | isa = PBXReferenceProxy; 237 | fileType = wrapper.framework; 238 | path = Noti.framework; 239 | remoteRef = 8F9CAB211D89C756006E1824 /* PBXContainerItemProxy */; 240 | sourceTree = BUILT_PRODUCTS_DIR; 241 | }; 242 | 8F9CAB241D89C756006E1824 /* NotiTests.xctest */ = { 243 | isa = PBXReferenceProxy; 244 | fileType = wrapper.cfbundle; 245 | path = NotiTests.xctest; 246 | remoteRef = 8F9CAB231D89C756006E1824 /* PBXContainerItemProxy */; 247 | sourceTree = BUILT_PRODUCTS_DIR; 248 | }; 249 | /* End PBXReferenceProxy section */ 250 | 251 | /* Begin PBXResourcesBuildPhase section */ 252 | 28F828CA1C4B714D00330CF4 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | 28F828DA1C4B714D00330CF4 /* LaunchScreen.storyboard in Resources */, 257 | 28F828D71C4B714D00330CF4 /* Assets.xcassets in Resources */, 258 | 28F828D51C4B714D00330CF4 /* Main.storyboard in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | 28F828DE1C4B714D00330CF4 /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | /* End PBXResourcesBuildPhase section */ 270 | 271 | /* Begin PBXSourcesBuildPhase section */ 272 | 28F828C81C4B714D00330CF4 /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | 28F828D21C4B714D00330CF4 /* ViewController.swift in Sources */, 277 | 28F828D01C4B714D00330CF4 /* AppDelegate.swift in Sources */, 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | 28F828DC1C4B714D00330CF4 /* Sources */ = { 282 | isa = PBXSourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 287D0A721C4B7877004566D6 /* ExampleUITests.swift in Sources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXSourcesBuildPhase section */ 290 | 291 | /* Begin PBXTargetDependency section */ 292 | 28F828E21C4B714D00330CF4 /* PBXTargetDependency */ = { 293 | isa = PBXTargetDependency; 294 | target = 28F828CB1C4B714D00330CF4 /* Example */; 295 | targetProxy = 28F828E11C4B714D00330CF4 /* PBXContainerItemProxy */; 296 | }; 297 | 4BFAFCC020A533A000855D80 /* PBXTargetDependency */ = { 298 | isa = PBXTargetDependency; 299 | name = Noti; 300 | targetProxy = 4BFAFCBF20A533A000855D80 /* PBXContainerItemProxy */; 301 | }; 302 | /* End PBXTargetDependency section */ 303 | 304 | /* Begin PBXVariantGroup section */ 305 | 28F828D31C4B714D00330CF4 /* Main.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 28F828D41C4B714D00330CF4 /* Base */, 309 | ); 310 | name = Main.storyboard; 311 | path = Example; 312 | sourceTree = ""; 313 | }; 314 | 28F828D81C4B714D00330CF4 /* LaunchScreen.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 28F828D91C4B714D00330CF4 /* Base */, 318 | ); 319 | name = LaunchScreen.storyboard; 320 | path = Example; 321 | sourceTree = ""; 322 | }; 323 | /* End PBXVariantGroup section */ 324 | 325 | /* Begin XCBuildConfiguration section */ 326 | 28F828E71C4B714D00330CF4 /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 331 | CLANG_CXX_LIBRARY = "libc++"; 332 | CLANG_ENABLE_MODULES = YES; 333 | CLANG_ENABLE_OBJC_ARC = YES; 334 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 335 | CLANG_WARN_BOOL_CONVERSION = YES; 336 | CLANG_WARN_COMMA = YES; 337 | CLANG_WARN_CONSTANT_CONVERSION = YES; 338 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 346 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 349 | CLANG_WARN_STRICT_PROTOTYPES = YES; 350 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 351 | CLANG_WARN_UNREACHABLE_CODE = YES; 352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 354 | COPY_PHASE_STRIP = NO; 355 | DEBUG_INFORMATION_FORMAT = dwarf; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | ENABLE_TESTABILITY = YES; 358 | GCC_C_LANGUAGE_STANDARD = gnu99; 359 | GCC_DYNAMIC_NO_PIC = NO; 360 | GCC_NO_COMMON_BLOCKS = YES; 361 | GCC_OPTIMIZATION_LEVEL = 0; 362 | GCC_PREPROCESSOR_DEFINITIONS = ( 363 | "DEBUG=1", 364 | "$(inherited)", 365 | ); 366 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 367 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 368 | GCC_WARN_UNDECLARED_SELECTOR = YES; 369 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 370 | GCC_WARN_UNUSED_FUNCTION = YES; 371 | GCC_WARN_UNUSED_VARIABLE = YES; 372 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 373 | MTL_ENABLE_DEBUG_INFO = YES; 374 | ONLY_ACTIVE_ARCH = YES; 375 | SDKROOT = iphoneos; 376 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 377 | }; 378 | name = Debug; 379 | }; 380 | 28F828E81C4B714D00330CF4 /* Release */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_SEARCH_USER_PATHS = NO; 384 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 385 | CLANG_CXX_LIBRARY = "libc++"; 386 | CLANG_ENABLE_MODULES = YES; 387 | CLANG_ENABLE_OBJC_ARC = YES; 388 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_COMMA = YES; 391 | CLANG_WARN_CONSTANT_CONVERSION = YES; 392 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_EMPTY_BODY = YES; 395 | CLANG_WARN_ENUM_CONVERSION = YES; 396 | CLANG_WARN_INFINITE_RECURSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 399 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 400 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 403 | CLANG_WARN_STRICT_PROTOTYPES = YES; 404 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 405 | CLANG_WARN_UNREACHABLE_CODE = YES; 406 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 407 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 408 | COPY_PHASE_STRIP = NO; 409 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 410 | ENABLE_NS_ASSERTIONS = NO; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | GCC_C_LANGUAGE_STANDARD = gnu99; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 416 | GCC_WARN_UNDECLARED_SELECTOR = YES; 417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 418 | GCC_WARN_UNUSED_FUNCTION = YES; 419 | GCC_WARN_UNUSED_VARIABLE = YES; 420 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 421 | MTL_ENABLE_DEBUG_INFO = NO; 422 | SDKROOT = iphoneos; 423 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 424 | VALIDATE_PRODUCT = YES; 425 | }; 426 | name = Release; 427 | }; 428 | 28F828EA1C4B714D00330CF4 /* Debug */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | CODE_SIGN_IDENTITY = "iPhone Developer"; 434 | CODE_SIGN_STYLE = Automatic; 435 | DEVELOPMENT_TEAM = T499X543T7; 436 | INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.Example; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | PROVISIONING_PROFILE_SPECIFIER = ""; 441 | SWIFT_VERSION = 4.0; 442 | }; 443 | name = Debug; 444 | }; 445 | 28F828EB1C4B714D00330CF4 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 450 | CODE_SIGN_IDENTITY = "iPhone Developer"; 451 | CODE_SIGN_STYLE = Automatic; 452 | DEVELOPMENT_TEAM = T499X543T7; 453 | INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; 454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 455 | PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.Example; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | PROVISIONING_PROFILE_SPECIFIER = ""; 458 | SWIFT_VERSION = 4.0; 459 | }; 460 | name = Release; 461 | }; 462 | 28F828ED1C4B714D00330CF4 /* Debug */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | CLANG_ENABLE_MODULES = YES; 466 | CODE_SIGN_STYLE = Manual; 467 | DEVELOPMENT_TEAM = ""; 468 | INFOPLIST_FILE = ExampleUITests/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 470 | PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.ExampleUITests; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | PROVISIONING_PROFILE_SPECIFIER = ""; 473 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 474 | SWIFT_VERSION = 4.0; 475 | TEST_TARGET_NAME = Example; 476 | USES_XCTRUNNER = YES; 477 | }; 478 | name = Debug; 479 | }; 480 | 28F828EE1C4B714D00330CF4 /* Release */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | CLANG_ENABLE_MODULES = YES; 484 | CODE_SIGN_STYLE = Manual; 485 | DEVELOPMENT_TEAM = ""; 486 | INFOPLIST_FILE = ExampleUITests/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 488 | PRODUCT_BUNDLE_IDENTIFIER = com.onevcat.ExampleUITests; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | PROVISIONING_PROFILE_SPECIFIER = ""; 491 | SWIFT_VERSION = 4.0; 492 | TEST_TARGET_NAME = Example; 493 | USES_XCTRUNNER = YES; 494 | }; 495 | name = Release; 496 | }; 497 | /* End XCBuildConfiguration section */ 498 | 499 | /* Begin XCConfigurationList section */ 500 | 28F828C71C4B714D00330CF4 /* Build configuration list for PBXProject "Example" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | 28F828E71C4B714D00330CF4 /* Debug */, 504 | 28F828E81C4B714D00330CF4 /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | 28F828E91C4B714D00330CF4 /* Build configuration list for PBXNativeTarget "Example" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | 28F828EA1C4B714D00330CF4 /* Debug */, 513 | 28F828EB1C4B714D00330CF4 /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | 28F828EC1C4B714D00330CF4 /* Build configuration list for PBXNativeTarget "ExampleUITests" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 28F828ED1C4B714D00330CF4 /* Debug */, 522 | 28F828EE1C4B714D00330CF4 /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | /* End XCConfigurationList section */ 528 | }; 529 | rootObject = 28F828C41C4B714D00330CF4 /* Project object */; 530 | } 531 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 23 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(_ application: UIApplication) { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(_ application: UIApplication) { 32 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | func applicationDidBecomeActive(_ application: UIApplication) { 36 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 37 | } 38 | 39 | func applicationWillTerminate(_ application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/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 | 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 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | import Noti 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | } 17 | 18 | override func didReceiveMemoryWarning() { 19 | super.didReceiveMemoryWarning() 20 | // Dispose of any resources that can be recreated. 21 | } 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Example/ExampleUITests/ExampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleUITests.swift 3 | // ExampleUITests 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | import XCTest 9 | 10 | class ExampleUITests: XCTestCase { 11 | 12 | override func setUp() { 13 | super.setUp() 14 | 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | 17 | // In UI tests it is usually best to stop immediately when a failure occurs. 18 | continueAfterFailure = false 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // 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. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | super.tearDown() 28 | } 29 | 30 | func testExample() { 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Example/ExampleUITests/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 | -------------------------------------------------------------------------------- /Example/Playground.playground/Contents.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Playground.playground 3 | // Noti 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | //: Playground - noun: a place where people can play 9 | 10 | import UIKit 11 | 12 | // For Request and Response defination, see https://onevcat.com/2016/12/pop-cocoa-2/ 13 | 14 | // Define the possible requests 15 | protocol Request { 16 | // Every request should have a corresponding Response 17 | // Here we want all response could contain error cases 18 | associatedtype Response: ErrorResponsable & Decodable 19 | //... 20 | } 21 | 22 | // A response which could contain error case. 23 | protocol ErrorResponsable { 24 | // Error Responsable require a definition of a 25 | // structured representation of error, eg, it could be a JSON 26 | associatedtype Error: ResponseError 27 | } 28 | 29 | protocol ResponseError { 30 | // A method to parse response data to error 31 | static func parse(from data: Data) -> Self? 32 | } 33 | 34 | // Shortcut for those errors could be represented by `Decodable` 35 | extension ResponseError where Self: Decodable { 36 | static func parse(from data: Data) -> Self? { 37 | return try? JSONDecoder().decode(Self.self, from: data) 38 | } 39 | } 40 | 41 | // Response of User Request. 42 | // Normal: {id: 1, name: "Wei Wang"} 43 | // Possible Error: {"statusCode": 404, "message": "not found"} or {"statusCode": 401, "message": "Permission Denied"} 44 | struct User: ErrorResponsable, Decodable { 45 | 46 | // Possible error of User 47 | struct Error: ResponseError, Decodable { 48 | let statusCode: Int 49 | let message: String 50 | } 51 | 52 | let id: Int 53 | let name: String 54 | } 55 | 56 | struct GetUserRequest: Request { 57 | typealias Response = User 58 | // ... 59 | init(id: Int) { /*...*/ } 60 | } 61 | 62 | 63 | GetUserRequest(id: 1).send() 64 | .then { user in 65 | print(user.name) 66 | }.catch { error in 67 | // .responseParsingError is thrown by response parser, when the HTTP response body data 68 | // cannot be parsed to normal User object. When it happens, it might be due to server returning 69 | // an error response. This error is associated with the response data so we could handle it. 70 | if case .responseParsingError(let data) = error, 71 | let userError = User.Error.parse(from: data) // Parse the error from data 72 | { 73 | print(userError.statusCode) 74 | } else { 75 | // Not responseParsingError or cannot be parsed to User.Error. Something else happened. 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Example/Playground.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 OneV's Den 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 | -------------------------------------------------------------------------------- /Noti.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Noti" 3 | s.version = "1.0.0" 4 | s.summary = "A short description of Noti." 5 | s.homepage = "https://github.com/onevcat/Noti" 6 | s.license = { type: 'MIT', file: 'LICENSE' } 7 | s.author = { "onevcat" => "onevcat@gmail.com" } 8 | s.source = { git: "https://github.com/onevcat/Noti.git", tag: s.version.to_s } 9 | s.social_media_url = 'https://twitter.com/onevcat' 10 | s.ios.deployment_target = '9.0' 11 | s.requires_arc = true 12 | s.ios.source_files = 'Noti/Sources/**/*.{swift}' 13 | # s.resource_bundles = { 14 | # 'Noti' => ['Noti/Sources/**/*.xib'] 15 | # } 16 | # s.ios.frameworks = 'UIKit', 'Foundation' 17 | # s.dependency 'Eureka', '~> 4.0' 18 | end 19 | -------------------------------------------------------------------------------- /Noti.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Noti.xcodeproj/xcshareddata/xcschemes/Noti.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Noti.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Noti.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Noti 2 | 3 |

4 | Build status 5 | Platform iOS 6 | Swift 4 compatible 7 | Carthage compatible 8 | CocoaPods compatible 9 | License: MIT 10 |

11 | 12 | By [OneV's Den](http://onevcat.com). 13 | 14 | ## Introduction 15 | 16 | Noti is a library to ....... 17 | 18 | 19 | 20 | ## Usage 21 | 22 | ```swift 23 | import Noti 24 | // ... 25 | ``` 26 | 27 | ## Requirements 28 | 29 | * iOS 9.0+ 30 | * Xcode 8.0+ 31 | 32 | ## Getting involved 33 | 34 | * If you **want to contribute** please feel free to **submit pull requests**. 35 | * If you **have a feature request** please **open an issue**. 36 | * If you **found a bug** or **need help** please **check older issues, [FAQ](#faq) and threads on [StackOverflow](http://stackoverflow.com/questions/tagged/Noti) (Tag 'Noti') before submitting an issue**. 37 | 38 | Before contribute check the [CONTRIBUTING](https://github.com/onevcat/Noti/blob/master/CONTRIBUTING.md) file for more info. 39 | 40 | If you use **Noti** in your app We would love to hear about it! Drop us a line on [Twitter](https://twitter.com/onevcat). 41 | 42 | ## Examples 43 | 44 | Follow these 3 steps to run Example project: clone Noti repository, open Noti workspace and run the *Example* project. 45 | 46 | You can also experiment and learn with the *Noti Playground* which is contained in *Noti.workspace*. 47 | 48 | ## Installation 49 | 50 | ### CocoaPods 51 | 52 | [CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. 53 | 54 | To install Noti, simply add the following line to your Podfile: 55 | 56 | ```ruby 57 | pod 'Noti', '~> 1.0' 58 | ``` 59 | 60 | ### Carthage 61 | 62 | [Carthage](https://github.com/Carthage/Carthage) is a simple, decentralized dependency manager for Cocoa. 63 | 64 | To install Noti, simply add the following line to your Cartfile: 65 | 66 | ```ogdl 67 | github "onevcat/Noti" ~> 1.0 68 | ``` 69 | 70 | ## Author 71 | 72 | * [OneV's Den](https://github.com/onevcat) ([@onevcat](https://twitter.com/onevcat)) 73 | 74 | ## FAQ 75 | 76 | ### How to ..... 77 | 78 | You can do it by conforming to ..... 79 | 80 | # Changelog 81 | 82 | See [CHANGELOG](CHANGELOG.md). 83 | -------------------------------------------------------------------------------- /Scripts/generate_sourcery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin 4 | brew bundle 5 | sourcery --config ./Sources/$1/sourcery.yml 6 | -------------------------------------------------------------------------------- /Sources/Core/DataTransformer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataTransformer.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct DataTransformer { 11 | #if canImport(UIKit) 12 | public static func to(from number: NSNumber) -> UIViewAnimationCurve { 13 | return UIViewAnimationCurve(rawValue: number.intValue) ?? .easeIn 14 | } 15 | 16 | public static func to(from curve: UIViewAnimationCurve) -> NSNumber { 17 | return NSNumber(value: curve.rawValue) 18 | } 19 | #endif 20 | 21 | public static func to(from number: NSNumber) -> Int { 22 | return number.intValue 23 | } 24 | 25 | public static func to(from number: NSNumber) -> Bool { 26 | return number.boolValue 27 | } 28 | 29 | public static func to(from number: NSNumber) -> Float { 30 | return number.floatValue 31 | } 32 | 33 | public static func to(from number: NSNumber) -> Double { 34 | return number.doubleValue 35 | } 36 | 37 | public static func to(from value: NSValue) -> CGRect { 38 | return value.cgRectValue 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Sources/Core/Definition/Foundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Bundle.swift 3 | // Noti 4 | // 5 | // Created by 王 巍 on 2018/5/14. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct NSBundleResourceRequestLowDiskSpaceNotification: AutoPassiveTypedNotification {} 11 | public struct NSCalendarDayChangedNotification: AutoPassiveTypedNotification {} 12 | 13 | public struct NSDidBecomeSingleThreadedNotification: AutoPassiveTypedNotification {} 14 | public struct NSWillBecomeMultiThreadedNotification: AutoPassiveTypedNotification {} 15 | 16 | public struct NSExtensionHostNotificationPayload: AutoPassiveNotificationPayload { 17 | //sourcery: object = true 18 | public let context: NSExtensionContext 19 | } 20 | //sourcery: payload = "NSExtensionHostNotificationPayload" 21 | public struct NSExtensionHostDidBecomeActiveNotification: AutoPassiveTypedNotification {} 22 | //sourcery: payload = "NSExtensionHostNotificationPayload" 23 | public struct NSExtensionHostDidEnterBackgroundNotification: AutoPassiveTypedNotification {} 24 | //sourcery: payload = "NSExtensionHostNotificationPayload" 25 | public struct NSExtensionHostWillEnterForegroundNotification: AutoPassiveTypedNotification {} 26 | //sourcery: payload = "NSExtensionHostNotificationPayload" 27 | public struct NSExtensionHostWillResignActiveNotification: AutoPassiveTypedNotification {} 28 | 29 | public struct NSFileHandleConnectionAcceptedNotification: AutoPassiveTypedNotification { 30 | public struct Payload: PassiveNotificationPayload { 31 | public let sender: FileHandle 32 | public let nearEnd: FileHandle? 33 | public let error: NSNumber? 34 | 35 | public init(_ notification: Notification) { 36 | sender = notification.object as! FileHandle 37 | nearEnd = notification.userInfo?[NSFileHandleNotificationFileHandleItem] as? FileHandle 38 | error = notification.userInfo?["NSFileHandleError"] as? NSNumber 39 | } 40 | } 41 | } 42 | 43 | public struct NSFileHandleDataAvailableNotification: AutoPassiveTypedNotification { 44 | public struct Payload: AutoPassiveNotificationPayload { 45 | //sourcery: object = true 46 | public let sender: FileHandle 47 | } 48 | } 49 | 50 | public struct NSFileHandleReadToEndOfFileCompletionNotification: AutoPassiveTypedNotification { 51 | public struct Payload: PassiveNotificationPayload { 52 | public let sender: FileHandle 53 | public let data: Data? 54 | public let error: NSNumber? 55 | 56 | public init(_ notification: Notification) { 57 | sender = notification.object as! FileHandle 58 | data = notification.userInfo?[NSFileHandleNotificationDataItem] as? Data 59 | error = notification.userInfo?["NSFileHandleError"] as? NSNumber 60 | } 61 | } 62 | } 63 | 64 | public struct NSHTTPCookieManagerAcceptPolicyChangedNotification: AutoPassiveTypedNotification { 65 | public struct Payload: AutoPassiveNotificationPayload { 66 | //sourcery: object = true 67 | public let storage: HTTPCookieStorage 68 | } 69 | } 70 | 71 | public struct NSHTTPCookieManagerCookiesChangedNotification: AutoPassiveTypedNotification { 72 | public struct Payload: AutoPassiveNotificationPayload { 73 | //sourcery: object = true 74 | public let storage: HTTPCookieStorage 75 | } 76 | } 77 | 78 | public struct NSMetadataQueryDidFinishGatheringNotification: AutoPassiveTypedNotification {} 79 | public struct NSMetadataQueryDidStartGatheringNotification: AutoPassiveTypedNotification {} 80 | public struct NSMetadataQueryDidUpdateNotification: AutoPassiveTypedNotification {} 81 | public struct NSMetadataQueryGatheringProgressNotification: AutoPassiveTypedNotification {} 82 | 83 | public struct NSProcessInfoPowerStateDidChangeNotification: AutoPassiveTypedNotification { 84 | public struct Payload: AutoPassiveNotificationPayload { 85 | //sourcery: object = true 86 | public let processInfo: ProcessInfo 87 | } 88 | } 89 | 90 | public struct NSSystemClockDidChangeNotification: AutoPassiveTypedNotification {} 91 | public struct NSSystemTimeZoneDidChangeNotification: AutoPassiveTypedNotification {} 92 | 93 | public struct NSThreadWillExitNotification: AutoPassiveTypedNotification { 94 | public struct Payload: AutoPassiveNotificationPayload { 95 | //sourcery: object = true 96 | public let thread: Thread 97 | } 98 | } 99 | 100 | public struct NSURLCredentialStorageChangedNotification: AutoPassiveTypedNotification { 101 | public struct Payload: AutoPassiveNotificationPayload { 102 | //sourcery: object = true 103 | public let storage: URLCredentialStorage 104 | } 105 | } 106 | 107 | public struct NSUbiquityIdentityDidChangeNotification: AutoPassiveTypedNotification {} 108 | 109 | 110 | public struct UndoManagerNotificationPayload: AutoPassiveNotificationPayload { 111 | //sourcery: object = true 112 | public let manager: UndoManager 113 | } 114 | //sourcery: payload = "UndoManagerNotificationPayload" 115 | public struct NSUndoManagerCheckpointNotification: AutoPassiveTypedNotification {} 116 | //sourcery: payload = "UndoManagerNotificationPayload" 117 | public struct NSUndoManagerDidCloseUndoGroupNotification: AutoPassiveTypedNotification {} 118 | //sourcery: payload = "UndoManagerNotificationPayload" 119 | public struct NSUndoManagerDidOpenUndoGroupNotification: AutoPassiveTypedNotification {} 120 | //sourcery: payload = "UndoManagerNotificationPayload" 121 | public struct NSUndoManagerDidRedoChangeNotification: AutoPassiveTypedNotification {} 122 | //sourcery: payload = "UndoManagerNotificationPayload" 123 | public struct NSUndoManagerDidUndoChangeNotification: AutoPassiveTypedNotification {} 124 | //sourcery: payload = "UndoManagerNotificationPayload" 125 | public struct NSUndoManagerWillCloseUndoGroupNotification: AutoPassiveTypedNotification {} 126 | //sourcery: payload = "UndoManagerNotificationPayload" 127 | public struct NSUndoManagerWillRedoChangeNotification: AutoPassiveTypedNotification {} 128 | //sourcery: payload = "UndoManagerNotificationPayload" 129 | public struct NSUndoManagerWillUndoChangeNotification: AutoPassiveTypedNotification {} 130 | -------------------------------------------------------------------------------- /Sources/Core/Definition/UIKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIKit.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | import UIKit 8 | 9 | public struct UIAccessibilityAnnouncementDidFinishNotification: AutoPassiveTypedNotification { 10 | public struct Payload: AutoPassiveNotificationPayload { 11 | //sourcery: key = "UIAccessibilityAnnouncementKeyStringValue" 12 | public let announcement: String 13 | //sourcery: key = "UIAccessibilityAnnouncementKeyWasSuccessful" 14 | //sourcery: type = "NSNumber" 15 | public let wasSuccessful: Bool 16 | } 17 | } 18 | 19 | public struct UIAccessibilityElementFocusedNotification: AutoPassiveTypedNotification { 20 | public struct Payload: AutoPassiveNotificationPayload { 21 | //sourcery: key = "UIAccessibilityFocusedElementKey" 22 | public let element: Any 23 | } 24 | } 25 | 26 | public struct UIKeyboardNotificationPayload: AutoPassiveNotificationPayload { 27 | //sourcery: key = "UIKeyboardAnimationCurveUserInfoKey" 28 | //sourcery: type = "NSNumber" 29 | public let animationCurve: UIViewAnimationCurve 30 | //sourcery: key = "UIKeyboardAnimationDurationUserInfoKey" 31 | //sourcery: type = "NSNumber" 32 | public let animationDuration: TimeInterval 33 | //sourcery: key = "UIKeyboardIsLocalUserInfoKey" 34 | //sourcery: type = "NSNumber" 35 | public let isLocal: Bool 36 | //sourcery: key = "UIKeyboardFrameBeginUserInfoKey" 37 | //sourcery: type = "NSValue" 38 | public let frameBegin: CGRect 39 | //sourcery: key = "UIKeyboardFrameEndUserInfoKey" 40 | //sourcery: type = "NSValue" 41 | public let frameEnd: CGRect 42 | } 43 | 44 | //sourcery: payload = "UIKeyboardNotificationPayload" 45 | public struct UIKeyboardDidChangeFrameNotification: AutoPassiveTypedNotification {} 46 | //sourcery: payload = "UIKeyboardNotificationPayload" 47 | public struct UIKeyboardDidHideNotification: AutoPassiveTypedNotification {} 48 | //sourcery: payload = "UIKeyboardNotificationPayload" 49 | public struct UIKeyboardDidShowNotification: AutoPassiveTypedNotification {} 50 | //sourcery: payload = "UIKeyboardNotificationPayload" 51 | public struct UIKeyboardWillChangeFrameNotification: AutoPassiveTypedNotification {} 52 | //sourcery: payload = "UIKeyboardNotificationPayload" 53 | public struct UIKeyboardWillHideNotification: AutoPassiveTypedNotification {} 54 | //sourcery: payload = "UIKeyboardNotificationPayload" 55 | public struct UIKeyboardWillShowNotification: AutoPassiveTypedNotification {} 56 | -------------------------------------------------------------------------------- /Sources/Core/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | 6 | extension NSExtensionHostNotificationPayload: PassiveNotificationPayload { 7 | public init(_ notification: Notification) { 8 | context = notification.object as! NSExtensionContext 9 | } 10 | } 11 | 12 | extension NSFileHandleDataAvailableNotification.Payload: PassiveNotificationPayload { 13 | public init(_ notification: Notification) { 14 | sender = notification.object as! FileHandle 15 | } 16 | } 17 | 18 | extension NSHTTPCookieManagerAcceptPolicyChangedNotification.Payload: PassiveNotificationPayload { 19 | public init(_ notification: Notification) { 20 | storage = notification.object as! HTTPCookieStorage 21 | } 22 | } 23 | 24 | extension NSHTTPCookieManagerCookiesChangedNotification.Payload: PassiveNotificationPayload { 25 | public init(_ notification: Notification) { 26 | storage = notification.object as! HTTPCookieStorage 27 | } 28 | } 29 | 30 | extension NSProcessInfoPowerStateDidChangeNotification.Payload: PassiveNotificationPayload { 31 | public init(_ notification: Notification) { 32 | processInfo = notification.object as! ProcessInfo 33 | } 34 | } 35 | 36 | extension NSThreadWillExitNotification.Payload: PassiveNotificationPayload { 37 | public init(_ notification: Notification) { 38 | thread = notification.object as! Thread 39 | } 40 | } 41 | 42 | extension NSURLCredentialStorageChangedNotification.Payload: PassiveNotificationPayload { 43 | public init(_ notification: Notification) { 44 | storage = notification.object as! URLCredentialStorage 45 | } 46 | } 47 | 48 | extension UIAccessibilityAnnouncementDidFinishNotification.Payload: PassiveNotificationPayload { 49 | public init(_ notification: Notification) { 50 | announcement = notification.extract(key: UIAccessibilityAnnouncementKeyStringValue, type: String.self) 51 | wasSuccessful = notification.extract(key: UIAccessibilityAnnouncementKeyWasSuccessful, type: NSNumber.self, transform: DataTransformer.to) 52 | } 53 | } 54 | 55 | extension UIAccessibilityElementFocusedNotification.Payload: PassiveNotificationPayload { 56 | public init(_ notification: Notification) { 57 | element = notification.extract(key: UIAccessibilityFocusedElementKey, type: Any.self) 58 | } 59 | } 60 | 61 | extension UIKeyboardNotificationPayload: PassiveNotificationPayload { 62 | public init(_ notification: Notification) { 63 | animationCurve = notification.extract(key: UIKeyboardAnimationCurveUserInfoKey, type: NSNumber.self, transform: DataTransformer.to) 64 | animationDuration = notification.extract(key: UIKeyboardAnimationDurationUserInfoKey, type: NSNumber.self, transform: DataTransformer.to) 65 | isLocal = notification.extract(key: UIKeyboardIsLocalUserInfoKey, type: NSNumber.self, transform: DataTransformer.to) 66 | frameBegin = notification.extract(key: UIKeyboardFrameBeginUserInfoKey, type: NSValue.self, transform: DataTransformer.to) 67 | frameEnd = notification.extract(key: UIKeyboardFrameEndUserInfoKey, type: NSValue.self, transform: DataTransformer.to) 68 | } 69 | } 70 | 71 | extension UndoManagerNotificationPayload: PassiveNotificationPayload { 72 | public init(_ notification: Notification) { 73 | manager = notification.object as! UndoManager 74 | } 75 | } 76 | 77 | -------------------------------------------------------------------------------- /Sources/Core/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | 6 | extension NSBundleResourceRequestLowDiskSpaceNotification: EmptyPayloadPassiveTypedNotification { 7 | public static let name: Notification.Name = .NSBundleResourceRequestLowDiskSpace 8 | } 9 | 10 | extension NSCalendarDayChangedNotification: EmptyPayloadPassiveTypedNotification { 11 | public static let name: Notification.Name = .NSCalendarDayChanged 12 | } 13 | 14 | extension NSDidBecomeSingleThreadedNotification: EmptyPayloadPassiveTypedNotification { 15 | public static let name: Notification.Name = .NSDidBecomeSingleThreaded 16 | } 17 | 18 | extension NSExtensionHostDidBecomeActiveNotification: PassiveTypedNotification { 19 | public typealias Payload = NSExtensionHostNotificationPayload 20 | public static let name: Notification.Name = .NSExtensionHostDidBecomeActive 21 | } 22 | 23 | extension NSExtensionHostDidEnterBackgroundNotification: PassiveTypedNotification { 24 | public typealias Payload = NSExtensionHostNotificationPayload 25 | public static let name: Notification.Name = .NSExtensionHostDidEnterBackground 26 | } 27 | 28 | extension NSExtensionHostWillEnterForegroundNotification: PassiveTypedNotification { 29 | public typealias Payload = NSExtensionHostNotificationPayload 30 | public static let name: Notification.Name = .NSExtensionHostWillEnterForeground 31 | } 32 | 33 | extension NSExtensionHostWillResignActiveNotification: PassiveTypedNotification { 34 | public typealias Payload = NSExtensionHostNotificationPayload 35 | public static let name: Notification.Name = .NSExtensionHostWillResignActive 36 | } 37 | 38 | extension NSFileHandleConnectionAcceptedNotification: PassiveTypedNotification { 39 | public static let name: Notification.Name = .NSFileHandleConnectionAccepted 40 | } 41 | 42 | extension NSFileHandleDataAvailableNotification: PassiveTypedNotification { 43 | public static let name: Notification.Name = .NSFileHandleDataAvailable 44 | } 45 | 46 | extension NSFileHandleReadToEndOfFileCompletionNotification: PassiveTypedNotification { 47 | public static let name: Notification.Name = .NSFileHandleReadToEndOfFileCompletion 48 | } 49 | 50 | extension NSHTTPCookieManagerAcceptPolicyChangedNotification: PassiveTypedNotification { 51 | public static let name: Notification.Name = .NSHTTPCookieManagerAcceptPolicyChanged 52 | } 53 | 54 | extension NSHTTPCookieManagerCookiesChangedNotification: PassiveTypedNotification { 55 | public static let name: Notification.Name = .NSHTTPCookieManagerCookiesChanged 56 | } 57 | 58 | extension NSMetadataQueryDidFinishGatheringNotification: EmptyPayloadPassiveTypedNotification { 59 | public static let name: Notification.Name = .NSMetadataQueryDidFinishGathering 60 | } 61 | 62 | extension NSMetadataQueryDidStartGatheringNotification: EmptyPayloadPassiveTypedNotification { 63 | public static let name: Notification.Name = .NSMetadataQueryDidStartGathering 64 | } 65 | 66 | extension NSMetadataQueryDidUpdateNotification: EmptyPayloadPassiveTypedNotification { 67 | public static let name: Notification.Name = .NSMetadataQueryDidUpdate 68 | } 69 | 70 | extension NSMetadataQueryGatheringProgressNotification: EmptyPayloadPassiveTypedNotification { 71 | public static let name: Notification.Name = .NSMetadataQueryGatheringProgress 72 | } 73 | 74 | extension NSProcessInfoPowerStateDidChangeNotification: PassiveTypedNotification { 75 | public static let name: Notification.Name = .NSProcessInfoPowerStateDidChange 76 | } 77 | 78 | extension NSSystemClockDidChangeNotification: EmptyPayloadPassiveTypedNotification { 79 | public static let name: Notification.Name = .NSSystemClockDidChange 80 | } 81 | 82 | extension NSSystemTimeZoneDidChangeNotification: EmptyPayloadPassiveTypedNotification { 83 | public static let name: Notification.Name = .NSSystemTimeZoneDidChange 84 | } 85 | 86 | extension NSThreadWillExitNotification: PassiveTypedNotification { 87 | public static let name: Notification.Name = .NSThreadWillExit 88 | } 89 | 90 | extension NSURLCredentialStorageChangedNotification: PassiveTypedNotification { 91 | public static let name: Notification.Name = .NSURLCredentialStorageChanged 92 | } 93 | 94 | extension NSUbiquityIdentityDidChangeNotification: EmptyPayloadPassiveTypedNotification { 95 | public static let name: Notification.Name = .NSUbiquityIdentityDidChange 96 | } 97 | 98 | extension NSUndoManagerCheckpointNotification: PassiveTypedNotification { 99 | public typealias Payload = UndoManagerNotificationPayload 100 | public static let name: Notification.Name = .NSUndoManagerCheckpoint 101 | } 102 | 103 | extension NSUndoManagerDidCloseUndoGroupNotification: PassiveTypedNotification { 104 | public typealias Payload = UndoManagerNotificationPayload 105 | public static let name: Notification.Name = .NSUndoManagerDidCloseUndoGroup 106 | } 107 | 108 | extension NSUndoManagerDidOpenUndoGroupNotification: PassiveTypedNotification { 109 | public typealias Payload = UndoManagerNotificationPayload 110 | public static let name: Notification.Name = .NSUndoManagerDidOpenUndoGroup 111 | } 112 | 113 | extension NSUndoManagerDidRedoChangeNotification: PassiveTypedNotification { 114 | public typealias Payload = UndoManagerNotificationPayload 115 | public static let name: Notification.Name = .NSUndoManagerDidRedoChange 116 | } 117 | 118 | extension NSUndoManagerDidUndoChangeNotification: PassiveTypedNotification { 119 | public typealias Payload = UndoManagerNotificationPayload 120 | public static let name: Notification.Name = .NSUndoManagerDidUndoChange 121 | } 122 | 123 | extension NSUndoManagerWillCloseUndoGroupNotification: PassiveTypedNotification { 124 | public typealias Payload = UndoManagerNotificationPayload 125 | public static let name: Notification.Name = .NSUndoManagerWillCloseUndoGroup 126 | } 127 | 128 | extension NSUndoManagerWillRedoChangeNotification: PassiveTypedNotification { 129 | public typealias Payload = UndoManagerNotificationPayload 130 | public static let name: Notification.Name = .NSUndoManagerWillRedoChange 131 | } 132 | 133 | extension NSUndoManagerWillUndoChangeNotification: PassiveTypedNotification { 134 | public typealias Payload = UndoManagerNotificationPayload 135 | public static let name: Notification.Name = .NSUndoManagerWillUndoChange 136 | } 137 | 138 | extension NSWillBecomeMultiThreadedNotification: EmptyPayloadPassiveTypedNotification { 139 | public static let name: Notification.Name = .NSWillBecomeMultiThreaded 140 | } 141 | 142 | extension UIAccessibilityAnnouncementDidFinishNotification: PassiveTypedNotification { 143 | public static let name: Notification.Name = .UIAccessibilityAnnouncementDidFinish 144 | } 145 | 146 | extension UIAccessibilityElementFocusedNotification: PassiveTypedNotification { 147 | public static let name: Notification.Name = .UIAccessibilityElementFocused 148 | } 149 | 150 | extension UIKeyboardDidChangeFrameNotification: PassiveTypedNotification { 151 | public typealias Payload = UIKeyboardNotificationPayload 152 | public static let name: Notification.Name = .UIKeyboardDidChangeFrame 153 | } 154 | 155 | extension UIKeyboardDidHideNotification: PassiveTypedNotification { 156 | public typealias Payload = UIKeyboardNotificationPayload 157 | public static let name: Notification.Name = .UIKeyboardDidHide 158 | } 159 | 160 | extension UIKeyboardDidShowNotification: PassiveTypedNotification { 161 | public typealias Payload = UIKeyboardNotificationPayload 162 | public static let name: Notification.Name = .UIKeyboardDidShow 163 | } 164 | 165 | extension UIKeyboardWillChangeFrameNotification: PassiveTypedNotification { 166 | public typealias Payload = UIKeyboardNotificationPayload 167 | public static let name: Notification.Name = .UIKeyboardWillChangeFrame 168 | } 169 | 170 | extension UIKeyboardWillHideNotification: PassiveTypedNotification { 171 | public typealias Payload = UIKeyboardNotificationPayload 172 | public static let name: Notification.Name = .UIKeyboardWillHide 173 | } 174 | 175 | extension UIKeyboardWillShowNotification: PassiveTypedNotification { 176 | public typealias Payload = UIKeyboardNotificationPayload 177 | public static let name: Notification.Name = .UIKeyboardWillShow 178 | } 179 | 180 | -------------------------------------------------------------------------------- /Sources/Core/NotificationCenter+Noti.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationCenter+Noti.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | extension NotificationCenter { 11 | public func addObserver( 12 | forType notificationType: T.Type, 13 | on observer: Observer, 14 | object: Any? = nil, 15 | queue: OperationQueue? = nil, 16 | using block: @escaping (Observer, T.Payload) -> Void) -> NotificationToken 17 | { 18 | let token = addObserver(forName: T.name, object: object, queue: queue) { [weak observer] noti in 19 | guard let observer = observer else { return } 20 | let payload = T.Payload(noti) 21 | block(observer, payload) 22 | } 23 | return .init(token: token, in: self) 24 | } 25 | 26 | public func addObserver( 27 | forType notificationType: T.Type, 28 | on observer: Observer, 29 | object: Any? = nil, 30 | queue: OperationQueue? = nil, 31 | using block: @escaping (Observer, T.Payload) -> Void) -> NotificationToken 32 | { 33 | let token = addObserver(forName: T.name, object: object, queue: queue) { noti in 34 | let payload = T.Payload(noti) 35 | block(observer, payload) 36 | } 37 | return .init(token: token, in: self) 38 | } 39 | 40 | public func addObserver( 41 | forType notificationType: T.Type, 42 | on observer: Observer, 43 | object: Any? = nil, 44 | queue: OperationQueue? = nil, 45 | using block: @escaping (Observer) -> Void) -> NotificationToken where T.Payload == EmptyNotificationPayload 46 | { 47 | let token = addObserver(forName: T.name, object: object, queue: queue) { [weak observer] noti in 48 | guard let observer = observer else { return } 49 | block(observer) 50 | } 51 | return .init(token: token, in: self) 52 | } 53 | 54 | public func addObserver( 55 | forType notificationType: T.Type, 56 | on observer: Observer, 57 | object: Any? = nil, 58 | queue: OperationQueue? = nil, 59 | using block: @escaping (Observer) -> Void) -> NotificationToken where T.Payload == EmptyNotificationPayload 60 | { 61 | let token = addObserver(forName: T.name, object: object, queue: queue) { noti in 62 | block(observer) 63 | } 64 | return .init(token: token, in: self) 65 | } 66 | 67 | public func post(typedNotification notification: T, object: Any? = nil) { 68 | let userInfo = notification.payload.userInfo 69 | post(name: T.name, object: object, userInfo: userInfo) 70 | } 71 | 72 | public func post(typedNotification notification: T.Type, object: Any? = nil) 73 | where T.Payload == EmptyNotificationPayload 74 | { 75 | post(name: T.name, object: object, userInfo: nil) 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /Sources/Core/NotificationPayload.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationPayload.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | private let payloadEncoder = JSONEncoder() 11 | private let payloadDecoder = JSONDecoder() 12 | 13 | public protocol PassiveNotificationPayload { 14 | init(_ notification: Notification) 15 | } 16 | 17 | public protocol NotificationPayload: PassiveNotificationPayload { 18 | var userInfo: [AnyHashable: Any] { get } 19 | } 20 | 21 | extension NotificationPayload where Self: Decodable { 22 | public init(_ notification: Notification) { 23 | guard let userInfo = notification.userInfo else { 24 | fatalError(""" 25 | [Noti] Received a `nil` userInfo. Maybe you are sending a customized notification with untyped API. 26 | Please send typed notifications with Noti APIs instead of plain Cocoa APIs. 27 | """) 28 | } 29 | 30 | do { 31 | let data = try JSONSerialization.data(withJSONObject: userInfo, options: []) 32 | self = try payloadDecoder.decode(Self.self, from: data) 33 | } catch { 34 | fatalError("[Noti] Trying to decode a notification but something wrong happens: \(error)") 35 | } 36 | } 37 | } 38 | 39 | extension NotificationPayload where Self: Encodable { 40 | var userInfo: [AnyHashable: Any] { 41 | let data = try! payloadEncoder.encode(self) 42 | return try! JSONSerialization.jsonObject(with: data, options: []) as! [AnyHashable: Any] 43 | } 44 | } 45 | 46 | public struct EmptyNotificationPayload: NotificationPayload { 47 | private init() {} 48 | static let empty = EmptyNotificationPayload() 49 | 50 | public init(_ notification: Notification) {} 51 | public var userInfo: [AnyHashable: Any] { return [:] } 52 | } 53 | 54 | extension Notification { 55 | public func extract(key: String, type: T.Type) -> T { 56 | return userInfo![key] as! T 57 | } 58 | 59 | public func extract(key: String, type: T.Type, transform: (T) -> U) -> U { 60 | let value = extract(key: key, type: type) 61 | return transform(value) 62 | } 63 | } 64 | 65 | // For auto generating of payload 66 | public protocol AutoPassiveNotificationPayload {} 67 | -------------------------------------------------------------------------------- /Sources/Core/NotificationToken.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationToken.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | public class NotificationToken { 11 | let token: NSObjectProtocol 12 | let center: NotificationCenter 13 | 14 | init(token: NSObjectProtocol, in center: NotificationCenter) { 15 | self.token = token 16 | self.center = center 17 | } 18 | 19 | deinit { 20 | center.removeObserver(token) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/Core/TypedNotification.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TypedNotification.swift 3 | // Noti 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol PassiveTypedNotification { 11 | associatedtype Payload: PassiveNotificationPayload 12 | static var name: Notification.Name { get } 13 | } 14 | 15 | extension PassiveTypedNotification { 16 | static var name: Notification.Name { 17 | return .init(rawValue: String(reflecting: Self.self)) 18 | } 19 | } 20 | 21 | public protocol TypedNotification: PassiveTypedNotification 22 | where Payload: NotificationPayload 23 | { 24 | var payload: Payload { get } 25 | } 26 | 27 | public protocol EmptyPayloadPassiveTypedNotification: PassiveTypedNotification 28 | where Payload == EmptyNotificationPayload { } 29 | 30 | public protocol EmptyPayloadTypedNotification: TypedNotification 31 | where Payload == EmptyNotificationPayload { } 32 | extension EmptyPayloadTypedNotification { 33 | public var payload: Payload { return .empty } 34 | } 35 | 36 | // For auto generating of notification 37 | public protocol AutoPassiveTypedNotification {} 38 | -------------------------------------------------------------------------------- /Sources/Core/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | templates: 5 | - ../../Templates 6 | output: 7 | ./Generated -------------------------------------------------------------------------------- /Sources/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 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/Definition/AVFoundation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AVFoundation.swift 3 | // Noti 4 | // 5 | // Created by 王 巍 on 2018/5/12. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | import AVFoundation 11 | 12 | public struct AVAudioEngineConfigurationChangeNotification: AutoPassiveTypedNotification {} 13 | public struct AVAudioSessionInterruptionNotification: AutoPassiveTypedNotification { 14 | public struct Payload: PassiveNotificationPayload { 15 | public enum InterruptionType { 16 | case began(wasSuspended: Bool) 17 | case ended(options: AVAudioSessionInterruptionOptions) 18 | } 19 | 20 | public let type: InterruptionType 21 | 22 | public init(_ notification: Notification) { 23 | let userInfo = notification.userInfo! 24 | let type = (userInfo[AVAudioSessionInterruptionTypeKey] as! NSNumber).uintValue 25 | switch AVAudioSessionInterruptionType(rawValue: type)! { 26 | case .began: 27 | let wasSuspended: Bool 28 | if #available(iOS 10.3, *) { 29 | wasSuspended = (userInfo[AVAudioSessionInterruptionWasSuspendedKey] as! NSNumber).boolValue 30 | } else { 31 | wasSuspended = false 32 | } 33 | self.type = .began(wasSuspended: wasSuspended) 34 | case .ended: 35 | let optionsFlag = (userInfo[AVAudioSessionInterruptionOptionKey] as! NSNumber).uintValue 36 | self.type = .ended(options: AVAudioSessionInterruptionOptions(rawValue: optionsFlag)) 37 | } 38 | } 39 | } 40 | } 41 | 42 | public struct AVAudioSessionMediaServicesWereLostNotification: AutoPassiveTypedNotification {} 43 | 44 | public struct AVAudioSessionMediaServicesWereResetNotification: AutoPassiveTypedNotification {} 45 | 46 | public struct AVAudioSessionRouteChangeNotification: AutoPassiveTypedNotification { 47 | public struct Payload: AutoPassiveNotificationPayload { 48 | //sourcery: key = "AVAudioSessionRouteChangeReasonKey" 49 | //sourcery: type = "NSNumber" 50 | public let changeReason: AVAudioSessionRouteChangeReason 51 | //sourcery: key = "AVAudioSessionRouteChangePreviousRouteKey" 52 | public let routeDescription: AVAudioSessionRouteDescription 53 | } 54 | } 55 | extension DataTransformer { 56 | static func to(from value: NSNumber) -> AVAudioSessionRouteChangeReason { 57 | return AVAudioSessionRouteChangeReason(rawValue: value.uintValue) ?? .unknown 58 | } 59 | } 60 | 61 | public struct AVAudioSessionSilenceSecondaryAudioHintNotification: AutoPassiveTypedNotification { 62 | public struct Payload: AutoPassiveNotificationPayload { 63 | //sourcery: key = "AVAudioSessionSilenceSecondaryAudioHintTypeKey" 64 | //sourcery: type = "NSNumber" 65 | public let type: AVAudioSessionSilenceSecondaryAudioHintType 66 | } 67 | } 68 | extension DataTransformer { 69 | static func to(from value: NSNumber) -> AVAudioSessionSilenceSecondaryAudioHintType { 70 | return AVAudioSessionSilenceSecondaryAudioHintType(rawValue: value.uintValue)! 71 | } 72 | } 73 | 74 | public struct AVAudioUnitComponentTagsDidChangeNotification: AutoPassiveTypedNotification { 75 | public struct Payload: PassiveNotificationPayload { 76 | public let component: AVAudioUnitComponent 77 | public init(_ notification: Notification) { 78 | component = notification.object as! AVAudioUnitComponent 79 | } 80 | } 81 | } 82 | 83 | public struct AVAssetChapterMetadataGroupsDidChangeNotification: AutoPassiveTypedNotification {} 84 | public struct AVAssetDurationDidChange: AutoPassiveTypedNotification {} 85 | public struct AVAssetMediaSelectionGroupsDidChange: AutoPassiveTypedNotification {} 86 | public struct AVAssetTrackSegmentsDidChange: AutoPassiveTypedNotification {} 87 | public struct AVAssetTrackTimeRangeDidChange: AutoPassiveTypedNotification {} 88 | public struct AVAssetTrackTrackAssociationsDidChange: AutoPassiveTypedNotification {} 89 | 90 | public struct AVCaptureDeviceNotificationPayload: AutoPassiveNotificationPayload { 91 | //sourcery: object = true 92 | public let device: AVCaptureDevice 93 | } 94 | //sourcery: payload = "AVCaptureDeviceNotificationPayload" 95 | public struct AVCaptureDeviceWasConnectedNotification: AutoPassiveTypedNotification {} 96 | //sourcery: payload = "AVCaptureDeviceNotificationPayload" 97 | public struct AVCaptureDeviceWasDisconnectedNotification: AutoPassiveTypedNotification {} 98 | 99 | public struct AVCaptureInputPortFormatDescriptionDidChangeNotification: AutoPassiveTypedNotification {} 100 | public struct AVCaptureSessionDidStartRunningNotification: AutoPassiveTypedNotification {} 101 | public struct AVCaptureSessionDidStopRunningNotification: AutoPassiveTypedNotification {} 102 | public struct AVCaptureSessionRuntimeErrorNotification: AutoPassiveTypedNotification { 103 | public struct Payload: AutoPassiveNotificationPayload { 104 | //sourcery: key = "AVCaptureSessionErrorKey" 105 | public let error: Error 106 | } 107 | } 108 | 109 | public struct AVPlayerItemNotificationPayload: AutoPassiveNotificationPayload { 110 | //sourcery: object = true 111 | public let item: AVPlayerItem 112 | } 113 | //sourcery: payload = "AVPlayerItemNotificationPayload" 114 | public struct AVPlayerItemDidPlayToEndTimeNotification: AutoPassiveTypedNotification {} 115 | 116 | public struct AVPlayerItemFailedToPlayToEndTimeNotification: AutoPassiveTypedNotification { 117 | public struct Payload: AutoPassiveNotificationPayload { 118 | //sourcery: object = true 119 | public let item: AVPlayerItem 120 | //sourcery: key = "AVPlayerItemFailedToPlayToEndTimeErrorKey" 121 | public let error: Error 122 | } 123 | } 124 | //sourcery: payload = "AVPlayerItemNotificationPayload" 125 | public struct AVPlayerItemNewAccessLogEntryNotification: AutoPassiveTypedNotification {} 126 | //sourcery: payload = "AVPlayerItemNotificationPayload" 127 | public struct AVPlayerItemNewErrorLogEntryNotification: AutoPassiveTypedNotification {} 128 | //sourcery: payload = "AVPlayerItemNotificationPayload" 129 | public struct AVPlayerItemPlaybackStalledNotification: AutoPassiveTypedNotification {} 130 | //sourcery: payload = "AVPlayerItemNotificationPayload" 131 | public struct AVPlayerItemTimeJumpedNotification: AutoPassiveTypedNotification {} 132 | 133 | public struct AVSampleBufferDisplayLayerFailedToDecodeNotification: AutoPassiveTypedNotification { 134 | public struct Payload: AutoPassiveNotificationPayload { 135 | //sourcery: key = "AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey" 136 | public let error: NSError 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import AVFoundation 7 | 8 | extension AVAudioSessionRouteChangeNotification.Payload: PassiveNotificationPayload { 9 | public init(_ notification: Notification) { 10 | changeReason = notification.extract(key: AVAudioSessionRouteChangeReasonKey, type: NSNumber.self, transform: DataTransformer.to) 11 | routeDescription = notification.extract(key: AVAudioSessionRouteChangePreviousRouteKey, type: AVAudioSessionRouteDescription.self) 12 | } 13 | } 14 | 15 | extension AVAudioSessionSilenceSecondaryAudioHintNotification.Payload: PassiveNotificationPayload { 16 | public init(_ notification: Notification) { 17 | type = notification.extract(key: AVAudioSessionSilenceSecondaryAudioHintTypeKey, type: NSNumber.self, transform: DataTransformer.to) 18 | } 19 | } 20 | 21 | extension AVCaptureDeviceNotificationPayload: PassiveNotificationPayload { 22 | public init(_ notification: Notification) { 23 | device = notification.object as! AVCaptureDevice 24 | } 25 | } 26 | 27 | extension AVCaptureSessionRuntimeErrorNotification.Payload: PassiveNotificationPayload { 28 | public init(_ notification: Notification) { 29 | error = notification.extract(key: AVCaptureSessionErrorKey, type: Error.self) 30 | } 31 | } 32 | 33 | extension AVPlayerItemFailedToPlayToEndTimeNotification.Payload: PassiveNotificationPayload { 34 | public init(_ notification: Notification) { 35 | item = notification.object as! AVPlayerItem 36 | error = notification.extract(key: AVPlayerItemFailedToPlayToEndTimeErrorKey, type: Error.self) 37 | } 38 | } 39 | 40 | extension AVPlayerItemNotificationPayload: PassiveNotificationPayload { 41 | public init(_ notification: Notification) { 42 | item = notification.object as! AVPlayerItem 43 | } 44 | } 45 | 46 | extension AVSampleBufferDisplayLayerFailedToDecodeNotification.Payload: PassiveNotificationPayload { 47 | public init(_ notification: Notification) { 48 | error = notification.extract(key: AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey, type: NSError.self) 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import AVFoundation 7 | 8 | extension AVAssetChapterMetadataGroupsDidChangeNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .AVAssetChapterMetadataGroupsDidChange 10 | } 11 | 12 | extension AVAssetDurationDidChange: EmptyPayloadPassiveTypedNotification { 13 | public static let name: Notification.Name = .AVAssetDurationDidChange 14 | } 15 | 16 | extension AVAssetMediaSelectionGroupsDidChange: EmptyPayloadPassiveTypedNotification { 17 | public static let name: Notification.Name = .AVAssetMediaSelectionGroupsDidChange 18 | } 19 | 20 | extension AVAssetTrackSegmentsDidChange: EmptyPayloadPassiveTypedNotification { 21 | public static let name: Notification.Name = .AVAssetTrackSegmentsDidChange 22 | } 23 | 24 | extension AVAssetTrackTimeRangeDidChange: EmptyPayloadPassiveTypedNotification { 25 | public static let name: Notification.Name = .AVAssetTrackTimeRangeDidChange 26 | } 27 | 28 | extension AVAssetTrackTrackAssociationsDidChange: EmptyPayloadPassiveTypedNotification { 29 | public static let name: Notification.Name = .AVAssetTrackTrackAssociationsDidChange 30 | } 31 | 32 | extension AVAudioEngineConfigurationChangeNotification: EmptyPayloadPassiveTypedNotification { 33 | public static let name: Notification.Name = .AVAudioEngineConfigurationChange 34 | } 35 | 36 | extension AVAudioSessionInterruptionNotification: PassiveTypedNotification { 37 | public static let name: Notification.Name = .AVAudioSessionInterruption 38 | } 39 | 40 | extension AVAudioSessionMediaServicesWereLostNotification: EmptyPayloadPassiveTypedNotification { 41 | public static let name: Notification.Name = .AVAudioSessionMediaServicesWereLost 42 | } 43 | 44 | extension AVAudioSessionMediaServicesWereResetNotification: EmptyPayloadPassiveTypedNotification { 45 | public static let name: Notification.Name = .AVAudioSessionMediaServicesWereReset 46 | } 47 | 48 | extension AVAudioSessionRouteChangeNotification: PassiveTypedNotification { 49 | public static let name: Notification.Name = .AVAudioSessionRouteChange 50 | } 51 | 52 | extension AVAudioSessionSilenceSecondaryAudioHintNotification: PassiveTypedNotification { 53 | public static let name: Notification.Name = .AVAudioSessionSilenceSecondaryAudioHint 54 | } 55 | 56 | extension AVAudioUnitComponentTagsDidChangeNotification: PassiveTypedNotification { 57 | public static let name: Notification.Name = .AVAudioUnitComponentTagsDidChange 58 | } 59 | 60 | extension AVCaptureDeviceWasConnectedNotification: PassiveTypedNotification { 61 | public typealias Payload = AVCaptureDeviceNotificationPayload 62 | public static let name: Notification.Name = .AVCaptureDeviceWasConnected 63 | } 64 | 65 | extension AVCaptureDeviceWasDisconnectedNotification: PassiveTypedNotification { 66 | public typealias Payload = AVCaptureDeviceNotificationPayload 67 | public static let name: Notification.Name = .AVCaptureDeviceWasDisconnected 68 | } 69 | 70 | extension AVCaptureInputPortFormatDescriptionDidChangeNotification: EmptyPayloadPassiveTypedNotification { 71 | public static let name: Notification.Name = .AVCaptureInputPortFormatDescriptionDidChange 72 | } 73 | 74 | extension AVCaptureSessionDidStartRunningNotification: EmptyPayloadPassiveTypedNotification { 75 | public static let name: Notification.Name = .AVCaptureSessionDidStartRunning 76 | } 77 | 78 | extension AVCaptureSessionDidStopRunningNotification: EmptyPayloadPassiveTypedNotification { 79 | public static let name: Notification.Name = .AVCaptureSessionDidStopRunning 80 | } 81 | 82 | extension AVCaptureSessionRuntimeErrorNotification: PassiveTypedNotification { 83 | public static let name: Notification.Name = .AVCaptureSessionRuntimeError 84 | } 85 | 86 | extension AVPlayerItemDidPlayToEndTimeNotification: PassiveTypedNotification { 87 | public typealias Payload = AVPlayerItemNotificationPayload 88 | public static let name: Notification.Name = .AVPlayerItemDidPlayToEndTime 89 | } 90 | 91 | extension AVPlayerItemFailedToPlayToEndTimeNotification: PassiveTypedNotification { 92 | public static let name: Notification.Name = .AVPlayerItemFailedToPlayToEndTime 93 | } 94 | 95 | extension AVPlayerItemNewAccessLogEntryNotification: PassiveTypedNotification { 96 | public typealias Payload = AVPlayerItemNotificationPayload 97 | public static let name: Notification.Name = .AVPlayerItemNewAccessLogEntry 98 | } 99 | 100 | extension AVPlayerItemNewErrorLogEntryNotification: PassiveTypedNotification { 101 | public typealias Payload = AVPlayerItemNotificationPayload 102 | public static let name: Notification.Name = .AVPlayerItemNewErrorLogEntry 103 | } 104 | 105 | extension AVPlayerItemPlaybackStalledNotification: PassiveTypedNotification { 106 | public typealias Payload = AVPlayerItemNotificationPayload 107 | public static let name: Notification.Name = .AVPlayerItemPlaybackStalled 108 | } 109 | 110 | extension AVPlayerItemTimeJumpedNotification: PassiveTypedNotification { 111 | public typealias Payload = AVPlayerItemNotificationPayload 112 | public static let name: Notification.Name = .AVPlayerItemTimeJumped 113 | } 114 | 115 | extension AVSampleBufferDisplayLayerFailedToDecodeNotification: PassiveTypedNotification { 116 | public static let name: Notification.Name = .AVSampleBufferDisplayLayerFailedToDecode 117 | } 118 | 119 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/NotiAVFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiAVFoundation.h 3 | // NotiAVFoundation 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiAVFoundation. 11 | FOUNDATION_EXPORT double NotiAVFoundationVersionNumber; 12 | 13 | //! Project version string for NotiAVFoundation. 14 | FOUNDATION_EXPORT const unsigned char NotiAVFoundationVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+AVFoundation/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - AVFoundation 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+Accounts/Definition/Accounts.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Accounts.swift 3 | // NotiAccounts 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | 11 | public struct ACAccountStoreDidChangeNotification: AutoPassiveTypedNotification {} 12 | -------------------------------------------------------------------------------- /Sources/Noti+Accounts/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import Accounts 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+Accounts/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import Accounts 7 | 8 | extension ACAccountStoreDidChangeNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .ACAccountStoreDidChange 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+Accounts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+Accounts/NotiAccounts.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiAccounts.h 3 | // NotiAccounts 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiAccounts. 11 | FOUNDATION_EXPORT double NotiAccountsVersionNumber; 12 | 13 | //! Project version string for NotiAccounts. 14 | FOUNDATION_EXPORT const unsigned char NotiAccountsVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+Accounts/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - Accounts 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/Definition/CloudKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CloudKit.swift 3 | // NotiAVFoundation 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | 11 | public struct CKAccountChangedNotification: AutoPassiveTypedNotification {} 12 | -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import CloudKit 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import CloudKit 7 | 8 | extension CKAccountChangedNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .CKAccountChanged 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/NotiCloudKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiCloudKit.h 3 | // NotiCloudKit 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiCloudKit. 11 | FOUNDATION_EXPORT double NotiCloudKitVersionNumber; 12 | 13 | //! Project version string for NotiCloudKit. 14 | FOUNDATION_EXPORT const unsigned char NotiCloudKitVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+CloudKit/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - CloudKit 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+Contacts/Definition/Contacts.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Contacts.swift 3 | // NotiContacts 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | import Noti 9 | 10 | public struct CNContactStoreDidChangeNotification: AutoPassiveTypedNotification {} 11 | -------------------------------------------------------------------------------- /Sources/Noti+Contacts/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import Contacts 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+Contacts/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import Contacts 7 | 8 | extension CNContactStoreDidChangeNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .CNContactStoreDidChange 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+Contacts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+Contacts/NotiContacts.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiContacts.h 3 | // NotiContacts 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiContacts. 11 | FOUNDATION_EXPORT double NotiContactsVersionNumber; 12 | 13 | //! Project version string for NotiContacts. 14 | FOUNDATION_EXPORT const unsigned char NotiContactsVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+Contacts/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - Contacts 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+CoreData/Definition/CoreData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoreData.swift 3 | // NotiCoreData 4 | // 5 | // Created by 王 巍 on 2018/5/14. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | import CoreData 11 | 12 | public struct NSManagedObjectContextPayload: PassiveNotificationPayload { 13 | public let notification: Notification 14 | public let context: NSManagedObjectContext 15 | public let inserted: Set 16 | public let updated: Set 17 | public let deleted: Set 18 | 19 | public init(_ notification: Notification) { 20 | self.notification = notification 21 | context = notification.object as! NSManagedObjectContext 22 | inserted = notification.userInfo?[NSInsertedObjectsKey] as? Set ?? [] 23 | updated = notification.userInfo?[NSUpdatedObjectsKey] as? Set ?? [] 24 | deleted = notification.userInfo?[NSDeletedObjectsKey] as? Set ?? [] 25 | } 26 | } 27 | 28 | //sourcery: payload = "NSManagedObjectContextPayload" 29 | public struct NSManagedObjectContextDidSaveNotification: AutoPassiveTypedNotification {} 30 | //sourcery: payload = "NSManagedObjectContextPayload" 31 | public struct NSManagedObjectContextObjectsDidChangeNotification: AutoPassiveTypedNotification {} 32 | 33 | public struct NSManagedObjectContextWillSaveNotification: AutoPassiveTypedNotification { 34 | public struct Payload: AutoPassiveNotificationPayload { 35 | //sourcery: object = true 36 | public let context: NSManagedObjectContext 37 | } 38 | } 39 | 40 | public struct NSPersistentStoreCoordinatorStoresDidChangeNotification: AutoPassiveTypedNotification { 41 | public struct Payload: PassiveNotificationPayload { 42 | public let coordinator: NSPersistentStoreCoordinator 43 | public let added: [NSPersistentStore] 44 | public let removed: [NSPersistentStore] 45 | public let UUIDChanged: [NSPersistentStore] 46 | 47 | public init(_ notification: Notification) { 48 | self.coordinator = notification.object as! NSPersistentStoreCoordinator 49 | self.added = notification.userInfo?[NSAddedPersistentStoresKey] as? [NSPersistentStore] ?? [] 50 | self.removed = notification.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore] ?? [] 51 | self.UUIDChanged = notification.userInfo?[NSUUIDChangedPersistentStoresKey] as? [NSPersistentStore] ?? [] 52 | } 53 | } 54 | } 55 | 56 | public struct NSPersistentStoreCoordinatorStoresWillChangeNotification: AutoPassiveTypedNotification { 57 | public struct Payload: AutoPassiveNotificationPayload { 58 | //sourcery: object = true 59 | public let coordinator: NSPersistentStoreCoordinator 60 | } 61 | } 62 | 63 | public struct NSPersistentStoreCoordinatorWillRemoveStoreNotification: AutoPassiveTypedNotification { 64 | public struct Payload: AutoPassiveNotificationPayload { 65 | //sourcery: object = true 66 | public let coordinator: NSPersistentStoreCoordinator 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /Sources/Noti+CoreData/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import CoreData 7 | 8 | extension NSManagedObjectContextWillSaveNotification.Payload: PassiveNotificationPayload { 9 | public init(_ notification: Notification) { 10 | context = notification.object as! NSManagedObjectContext 11 | } 12 | } 13 | 14 | extension NSPersistentStoreCoordinatorStoresWillChangeNotification.Payload: PassiveNotificationPayload { 15 | public init(_ notification: Notification) { 16 | coordinator = notification.object as! NSPersistentStoreCoordinator 17 | } 18 | } 19 | 20 | extension NSPersistentStoreCoordinatorWillRemoveStoreNotification.Payload: PassiveNotificationPayload { 21 | public init(_ notification: Notification) { 22 | coordinator = notification.object as! NSPersistentStoreCoordinator 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Sources/Noti+CoreData/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import CoreData 7 | 8 | extension NSManagedObjectContextDidSaveNotification: PassiveTypedNotification { 9 | public typealias Payload = NSManagedObjectContextPayload 10 | public static let name: Notification.Name = .NSManagedObjectContextDidSave 11 | } 12 | 13 | extension NSManagedObjectContextObjectsDidChangeNotification: PassiveTypedNotification { 14 | public typealias Payload = NSManagedObjectContextPayload 15 | public static let name: Notification.Name = .NSManagedObjectContextObjectsDidChange 16 | } 17 | 18 | extension NSManagedObjectContextWillSaveNotification: PassiveTypedNotification { 19 | public static let name: Notification.Name = .NSManagedObjectContextWillSave 20 | } 21 | 22 | extension NSPersistentStoreCoordinatorStoresDidChangeNotification: PassiveTypedNotification { 23 | public static let name: Notification.Name = .NSPersistentStoreCoordinatorStoresDidChange 24 | } 25 | 26 | extension NSPersistentStoreCoordinatorStoresWillChangeNotification: PassiveTypedNotification { 27 | public static let name: Notification.Name = .NSPersistentStoreCoordinatorStoresWillChange 28 | } 29 | 30 | extension NSPersistentStoreCoordinatorWillRemoveStoreNotification: PassiveTypedNotification { 31 | public static let name: Notification.Name = .NSPersistentStoreCoordinatorWillRemoveStore 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Sources/Noti+CoreData/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+CoreData/NotiCoreData.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiCoreData.h 3 | // NotiCoreData 4 | // 5 | // Created by 王 巍 on 2018/5/14. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiCoreData. 11 | FOUNDATION_EXPORT double NotiCoreDataVersionNumber; 12 | 13 | //! Project version string for NotiCoreData. 14 | FOUNDATION_EXPORT const unsigned char NotiCoreDataVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+CoreData/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - CoreData 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+EventKit/Definition/EventKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventKit.swift 3 | // NotiContacts 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | import Noti 9 | 10 | public struct EKEventStoreChangedNotification: AutoPassiveTypedNotification {} 11 | -------------------------------------------------------------------------------- /Sources/Noti+EventKit/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import EventKit 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+EventKit/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import EventKit 7 | 8 | extension EKEventStoreChangedNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .EKEventStoreChanged 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+EventKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+EventKit/NotiEventKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiEventKit.h 3 | // NotiEventKit 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiEventKit. 11 | FOUNDATION_EXPORT double NotiEventKitVersionNumber; 12 | 13 | //! Project version string for NotiEventKit. 14 | FOUNDATION_EXPORT const unsigned char NotiEventKitVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+EventKit/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - EventKit 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+GameController/Definition/GameController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameController.swift 3 | // NotiGameController 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | import GameController 11 | 12 | public struct GCControllerNotificationPayload: AutoPassiveNotificationPayload { 13 | //sourcery: object = true 14 | public let controller: GCController 15 | } 16 | 17 | //sourcery: payload = "GCControllerNotificationPayload" 18 | public struct GCControllerDidConnectNotification: AutoPassiveTypedNotification {} 19 | //sourcery: payload = "GCControllerNotificationPayload" 20 | public struct GCControllerDidDisconnectNotification: AutoPassiveTypedNotification {} 21 | -------------------------------------------------------------------------------- /Sources/Noti+GameController/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import GameController 7 | 8 | extension GCControllerNotificationPayload: PassiveNotificationPayload { 9 | public init(_ notification: Notification) { 10 | controller = notification.object as! GCController 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Sources/Noti+GameController/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import GameController 7 | 8 | extension GCControllerDidConnectNotification: PassiveTypedNotification { 9 | public typealias Payload = GCControllerNotificationPayload 10 | public static let name: Notification.Name = .GCControllerDidConnect 11 | } 12 | 13 | extension GCControllerDidDisconnectNotification: PassiveTypedNotification { 14 | public typealias Payload = GCControllerNotificationPayload 15 | public static let name: Notification.Name = .GCControllerDidDisconnect 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Sources/Noti+GameController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+GameController/NotiGameController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiGameController.h 3 | // NotiGameController 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiGameController. 11 | FOUNDATION_EXPORT double NotiGameControllerVersionNumber; 12 | 13 | //! Project version string for NotiGameController. 14 | FOUNDATION_EXPORT const unsigned char NotiGameControllerVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+GameController/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - GameController 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/Definition/HealthKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HealthKit.swift 3 | // NotiContacts 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | import Noti 9 | 10 | public struct HKUserPreferencesDidChangeNotification: AutoPassiveTypedNotification {} 11 | -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import HealthKit 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import HealthKit 7 | 8 | extension HKUserPreferencesDidChangeNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .HKUserPreferencesDidChange 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/NotiHealthKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiHealthKit.h 3 | // NotiHealthKit 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiHealthKit. 11 | FOUNDATION_EXPORT double NotiHealthKitVersionNumber; 12 | 13 | //! Project version string for NotiHealthKit. 14 | FOUNDATION_EXPORT const unsigned char NotiHealthKitVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+HealthKit/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - HealthKit 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/Definition/HomeKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeKit.swift 3 | // NotiContacts 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | import Noti 9 | 10 | public struct HMCharacteristicPropertySupportsEventNotification: AutoPassiveTypedNotification {} 11 | -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import HomeKit 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import HomeKit 7 | 8 | extension HMCharacteristicPropertySupportsEventNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .HMCharacteristicPropertySupportsEvent 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/NotiHomeKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiHomeKit.h 3 | // NotiHomeKit 4 | // 5 | // Created by 王 巍 on 2018/5/13. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiHomeKit. 11 | FOUNDATION_EXPORT double NotiHomeKitVersionNumber; 12 | 13 | //! Project version string for NotiHomeKit. 14 | FOUNDATION_EXPORT const unsigned char NotiHomeKitVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+HomeKit/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - HomeKit 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/Definition/NetworkExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkExtension.swift 3 | // NotiNetworkExtension 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | import Foundation 9 | import Noti 10 | 11 | public struct NEFilterConfigurationDidChangeNotification: AutoPassiveTypedNotification {} 12 | public struct NEVPNConfigurationChangeNotification: AutoPassiveTypedNotification {} 13 | public struct NEVPNStatusDidChangeNotification: AutoPassiveTypedNotification {} 14 | -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import NetworkExtension 7 | 8 | -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import NetworkExtension 7 | 8 | extension NEFilterConfigurationDidChangeNotification: EmptyPayloadPassiveTypedNotification { 9 | public static let name: Notification.Name = .NEFilterConfigurationDidChange 10 | } 11 | 12 | extension NEVPNConfigurationChangeNotification: EmptyPayloadPassiveTypedNotification { 13 | public static let name: Notification.Name = .NEVPNConfigurationChange 14 | } 15 | 16 | extension NEVPNStatusDidChangeNotification: EmptyPayloadPassiveTypedNotification { 17 | public static let name: Notification.Name = .NEVPNStatusDidChange 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/NotiNetworkExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiNetworkExtension.h 3 | // NotiNetworkExtension 4 | // 5 | // Created by Wang Wei on 2018/5/15. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiNetworkExtension. 11 | FOUNDATION_EXPORT double NotiNetworkExtensionVersionNumber; 12 | 13 | //! Project version string for NotiNetworkExtension. 14 | FOUNDATION_EXPORT const unsigned char NotiNetworkExtensionVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+NetworkExtension/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - NetworkExtension 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/Definition/PDFKit.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PDFKit.swift 3 | // NotiPDFKit 4 | // 5 | // Created by Wang Wei on 2018/5/21. 6 | // 7 | 8 | import Foundation 9 | import PDFKit 10 | import Noti 11 | 12 | public struct PDFDocumentNotificationPayload: AutoPassiveNotificationPayload { 13 | //sourcery: object = true 14 | public let document: PDFDocument 15 | } 16 | 17 | let PDFDocumentPageIndex = "PDFDocumentPageIndex" 18 | public struct PDFDocumentPageNotificationPayload: AutoPassiveNotificationPayload { 19 | //sourcery: object = true 20 | public let document: PDFDocument 21 | //sourcery: key = "PDFDocumentPageIndex" 22 | //sourcery: type = "NSNumber" 23 | public let pageIndex: Int 24 | } 25 | 26 | public struct PDFDocumentViewNotificationPayload: AutoPassiveNotificationPayload { 27 | //sourcery: object = true 28 | public let view: PDFView 29 | } 30 | 31 | //sourcery: payload = "PDFDocumentNotificationPayload" 32 | public struct PDFDocumentDidBeginFindNotification: AutoPassiveTypedNotification {} 33 | //sourcery: payload = "PDFDocumentNotificationPayload" 34 | public struct PDFDocumentDidEndFindNotification: AutoPassiveTypedNotification {} 35 | //sourcery: payload = "PDFDocumentNotificationPayload" 36 | public struct PDFDocumentDidBeginWriteNotification: AutoPassiveTypedNotification {} 37 | //sourcery: payload = "PDFDocumentNotificationPayload" 38 | public struct PDFDocumentDidEndWriteNotification: AutoPassiveTypedNotification {} 39 | //sourcery: payload = "PDFDocumentNotificationPayload" 40 | public struct PDFDocumentDidUnlockNotification: AutoPassiveTypedNotification {} 41 | 42 | //sourcery: payload = "PDFDocumentPageNotificationPayload" 43 | public struct PDFDocumentDidBeginPageFindNotification: AutoPassiveTypedNotification {} 44 | //sourcery: payload = "PDFDocumentPageNotificationPayload" 45 | public struct PDFDocumentDidEndPageFindNotification: AutoPassiveTypedNotification {} 46 | //sourcery: payload = "PDFDocumentPageNotificationPayload" 47 | public struct PDFDocumentDidBeginPageWriteNotification: AutoPassiveTypedNotification {} 48 | //sourcery: payload = "PDFDocumentPageNotificationPayload" 49 | public struct PDFDocumentDidEndPageWriteNotification: AutoPassiveTypedNotification {} 50 | 51 | let PDFDocumentFoundSelection = "PDFDocumentFoundSelection" 52 | public struct PDFDocumentDidFindMatchNotification: AutoPassiveTypedNotification { 53 | public struct Payload: AutoPassiveNotificationPayload { 54 | //sourcery: object = true 55 | public let document: PDFDocument 56 | //sourcery: key = "PDFDocumentFoundSelection" 57 | public let selection: PDFSelection 58 | } 59 | } 60 | 61 | public struct PDFThumbnailViewDocumentEditedNotification: AutoPassiveTypedNotification {} 62 | public struct PDFViewVisiblePagesChangedNotification: AutoPassiveTypedNotification {} 63 | 64 | let PDFAnnotationHit = "PDFAnnotationHit" 65 | public struct PDFViewAnnotationHitNotification: AutoPassiveTypedNotification { 66 | public struct Payload: AutoPassiveNotificationPayload { 67 | //sourcery: object = true 68 | public let view: PDFView 69 | //sourcery: key = "PDFAnnotationHit" 70 | public let annotationHit: PDFAnnotation 71 | } 72 | } 73 | 74 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 75 | public struct PDFViewAnnotationWillHitNotification: AutoPassiveTypedNotification {} 76 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 77 | public struct PDFViewChangedHistoryNotification: AutoPassiveTypedNotification {} 78 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 79 | public struct PDFViewCopyPermissionNotification: AutoPassiveTypedNotification {} 80 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 81 | public struct PDFViewDisplayBoxChangedNotification: AutoPassiveTypedNotification {} 82 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 83 | public struct PDFViewDisplayModeChangedNotification: AutoPassiveTypedNotification {} 84 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 85 | public struct PDFViewDocumentChangedNotification: AutoPassiveTypedNotification {} 86 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 87 | public struct PDFViewPageChangedNotification: AutoPassiveTypedNotification {} 88 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 89 | public struct PDFViewPrintPermissionNotification: AutoPassiveTypedNotification {} 90 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 91 | public struct PDFViewScaleChangedNotification: AutoPassiveTypedNotification {} 92 | //sourcery: payload = "PDFDocumentViewNotificationPayload" 93 | public struct PDFViewSelectionChangedNotification: AutoPassiveTypedNotification {} 94 | 95 | -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/Generated/NotificationPayload.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import PDFKit 7 | 8 | extension PDFDocumentDidFindMatchNotification.Payload: PassiveNotificationPayload { 9 | public init(_ notification: Notification) { 10 | document = notification.object as! PDFDocument 11 | selection = notification.extract(key: PDFDocumentFoundSelection, type: PDFSelection.self) 12 | } 13 | } 14 | 15 | extension PDFDocumentNotificationPayload: PassiveNotificationPayload { 16 | public init(_ notification: Notification) { 17 | document = notification.object as! PDFDocument 18 | } 19 | } 20 | 21 | extension PDFDocumentPageNotificationPayload: PassiveNotificationPayload { 22 | public init(_ notification: Notification) { 23 | document = notification.object as! PDFDocument 24 | pageIndex = notification.extract(key: PDFDocumentPageIndex, type: NSNumber.self, transform: DataTransformer.to) 25 | } 26 | } 27 | 28 | extension PDFDocumentViewNotificationPayload: PassiveNotificationPayload { 29 | public init(_ notification: Notification) { 30 | view = notification.object as! PDFView 31 | } 32 | } 33 | 34 | extension PDFViewAnnotationHitNotification.Payload: PassiveNotificationPayload { 35 | public init(_ notification: Notification) { 36 | view = notification.object as! PDFView 37 | annotationHit = notification.extract(key: PDFAnnotationHit, type: PDFAnnotation.self) 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/Generated/TypedNotification.generated.swift: -------------------------------------------------------------------------------- 1 | // Generated using Sourcery 0.11.2 — https://github.com/krzysztofzablocki/Sourcery 2 | // DO NOT EDIT 3 | 4 | 5 | import Noti 6 | import PDFKit 7 | 8 | extension PDFDocumentDidBeginFindNotification: PassiveTypedNotification { 9 | public typealias Payload = PDFDocumentNotificationPayload 10 | public static let name: Notification.Name = .PDFDocumentDidBeginFind 11 | } 12 | 13 | extension PDFDocumentDidBeginPageFindNotification: PassiveTypedNotification { 14 | public typealias Payload = PDFDocumentPageNotificationPayload 15 | public static let name: Notification.Name = .PDFDocumentDidBeginPageFind 16 | } 17 | 18 | extension PDFDocumentDidBeginPageWriteNotification: PassiveTypedNotification { 19 | public typealias Payload = PDFDocumentPageNotificationPayload 20 | public static let name: Notification.Name = .PDFDocumentDidBeginPageWrite 21 | } 22 | 23 | extension PDFDocumentDidBeginWriteNotification: PassiveTypedNotification { 24 | public typealias Payload = PDFDocumentNotificationPayload 25 | public static let name: Notification.Name = .PDFDocumentDidBeginWrite 26 | } 27 | 28 | extension PDFDocumentDidEndFindNotification: PassiveTypedNotification { 29 | public typealias Payload = PDFDocumentNotificationPayload 30 | public static let name: Notification.Name = .PDFDocumentDidEndFind 31 | } 32 | 33 | extension PDFDocumentDidEndPageFindNotification: PassiveTypedNotification { 34 | public typealias Payload = PDFDocumentPageNotificationPayload 35 | public static let name: Notification.Name = .PDFDocumentDidEndPageFind 36 | } 37 | 38 | extension PDFDocumentDidEndPageWriteNotification: PassiveTypedNotification { 39 | public typealias Payload = PDFDocumentPageNotificationPayload 40 | public static let name: Notification.Name = .PDFDocumentDidEndPageWrite 41 | } 42 | 43 | extension PDFDocumentDidEndWriteNotification: PassiveTypedNotification { 44 | public typealias Payload = PDFDocumentNotificationPayload 45 | public static let name: Notification.Name = .PDFDocumentDidEndWrite 46 | } 47 | 48 | extension PDFDocumentDidFindMatchNotification: PassiveTypedNotification { 49 | public static let name: Notification.Name = .PDFDocumentDidFindMatch 50 | } 51 | 52 | extension PDFDocumentDidUnlockNotification: PassiveTypedNotification { 53 | public typealias Payload = PDFDocumentNotificationPayload 54 | public static let name: Notification.Name = .PDFDocumentDidUnlock 55 | } 56 | 57 | extension PDFThumbnailViewDocumentEditedNotification: EmptyPayloadPassiveTypedNotification { 58 | public static let name: Notification.Name = .PDFThumbnailViewDocumentEdited 59 | } 60 | 61 | extension PDFViewAnnotationHitNotification: PassiveTypedNotification { 62 | public static let name: Notification.Name = .PDFViewAnnotationHit 63 | } 64 | 65 | extension PDFViewAnnotationWillHitNotification: PassiveTypedNotification { 66 | public typealias Payload = PDFDocumentViewNotificationPayload 67 | public static let name: Notification.Name = .PDFViewAnnotationWillHit 68 | } 69 | 70 | extension PDFViewChangedHistoryNotification: PassiveTypedNotification { 71 | public typealias Payload = PDFDocumentViewNotificationPayload 72 | public static let name: Notification.Name = .PDFViewChangedHistory 73 | } 74 | 75 | extension PDFViewCopyPermissionNotification: PassiveTypedNotification { 76 | public typealias Payload = PDFDocumentViewNotificationPayload 77 | public static let name: Notification.Name = .PDFViewCopyPermission 78 | } 79 | 80 | extension PDFViewDisplayBoxChangedNotification: PassiveTypedNotification { 81 | public typealias Payload = PDFDocumentViewNotificationPayload 82 | public static let name: Notification.Name = .PDFViewDisplayBoxChanged 83 | } 84 | 85 | extension PDFViewDisplayModeChangedNotification: PassiveTypedNotification { 86 | public typealias Payload = PDFDocumentViewNotificationPayload 87 | public static let name: Notification.Name = .PDFViewDisplayModeChanged 88 | } 89 | 90 | extension PDFViewDocumentChangedNotification: PassiveTypedNotification { 91 | public typealias Payload = PDFDocumentViewNotificationPayload 92 | public static let name: Notification.Name = .PDFViewDocumentChanged 93 | } 94 | 95 | extension PDFViewPageChangedNotification: PassiveTypedNotification { 96 | public typealias Payload = PDFDocumentViewNotificationPayload 97 | public static let name: Notification.Name = .PDFViewPageChanged 98 | } 99 | 100 | extension PDFViewPrintPermissionNotification: PassiveTypedNotification { 101 | public typealias Payload = PDFDocumentViewNotificationPayload 102 | public static let name: Notification.Name = .PDFViewPrintPermission 103 | } 104 | 105 | extension PDFViewScaleChangedNotification: PassiveTypedNotification { 106 | public typealias Payload = PDFDocumentViewNotificationPayload 107 | public static let name: Notification.Name = .PDFViewScaleChanged 108 | } 109 | 110 | extension PDFViewSelectionChangedNotification: PassiveTypedNotification { 111 | public typealias Payload = PDFDocumentViewNotificationPayload 112 | public static let name: Notification.Name = .PDFViewSelectionChanged 113 | } 114 | 115 | extension PDFViewVisiblePagesChangedNotification: EmptyPayloadPassiveTypedNotification { 116 | public static let name: Notification.Name = .PDFViewVisiblePagesChanged 117 | } 118 | 119 | -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/NotiPDFKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotiPDFKit.h 3 | // NotiPDFKit 4 | // 5 | // Created by Wang Wei on 2018/5/21. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for NotiPDFKit. 11 | FOUNDATION_EXPORT double NotiPDFKitVersionNumber; 12 | 13 | //! Project version string for NotiPDFKit. 14 | FOUNDATION_EXPORT const unsigned char NotiPDFKitVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Sources/Noti+PDFKit/sourcery.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | include: 3 | - ./ 4 | - ../Core 5 | exclude: 6 | - ../Core/Definition 7 | args: 8 | imports: 9 | - Noti 10 | - PDFKit 11 | templates: 12 | - ../../Templates 13 | output: 14 | ./Generated -------------------------------------------------------------------------------- /Sources/Noti.h: -------------------------------------------------------------------------------- 1 | // 2 | // Noti.h 3 | // Noti 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | //! Project version number for Noti. 11 | FOUNDATION_EXPORT double NotiVersionNumber; 12 | 13 | //! Project version string for Noti. 14 | FOUNDATION_EXPORT const unsigned char NotiVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | 19 | -------------------------------------------------------------------------------- /Templates/NotificationPayload.stencil: -------------------------------------------------------------------------------- 1 | {% for framework in argument.imports %} 2 | import {{framework}} 3 | {% endfor %} 4 | 5 | {% for payload in types.implementing.AutoPassiveNotificationPayload %} 6 | 7 | extension {{payload.name}}: PassiveNotificationPayload { 8 | public init(_ notification: Notification) { 9 | {% for val in payload.storedVariables %} 10 | {% if val.annotations.object %} 11 | {{val.name}} = notification.object as! {{val.typeName}} 12 | {% elif val.annotations.type %} 13 | {{val.name}} = notification.extract(key: {{val.annotations.key}}, type: {{val.annotations.type}}.self, transform: DataTransformer.to) 14 | {% else %} 15 | {{val.name}} = notification.extract(key: {{val.annotations.key}}, type: {{val.typeName}}.self) 16 | {% endif %} 17 | {% endfor %} 18 | } 19 | } 20 | 21 | {% endfor %} 22 | -------------------------------------------------------------------------------- /Templates/TypedNotification.stencil: -------------------------------------------------------------------------------- 1 | {% for framework in argument.imports %} 2 | import {{framework}} 3 | {% endfor %} 4 | 5 | {% for notification in types.implementing.AutoPassiveTypedNotification %} 6 | {%if notification.annotations.payload or notification.containedType.Payload %} 7 | extension {{notification.name}}: PassiveTypedNotification { 8 | {%if notification.annotations.payload %} 9 | public typealias Payload = {{notification.annotations.payload}} 10 | {%else%} 11 | {% endif %} 12 | {% else %} 13 | extension {{notification.name}}: EmptyPayloadPassiveTypedNotification { 14 | {% endif %} 15 | {%if notification.annotations.name %} 16 | {% else %} 17 | public static let name: Notification.Name = .{{notification.name | replace:"Notification",""}} 18 | {% endif %} 19 | } 20 | 21 | {% endfor %} -------------------------------------------------------------------------------- /Tests/DataTransformerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataTransformerTests.swift 3 | // NotiTests 4 | // 5 | // Created by Wang Wei on 2018/5/11. 6 | // 7 | 8 | import Foundation 9 | 10 | import XCTest 11 | @testable import Noti 12 | 13 | class DataTransformerTests: XCTestCase { 14 | 15 | func testNSNumberBoolTransform() { 16 | let numbers = [0, 1] 17 | let resultBools: [Bool] = numbers.map(NSNumber.init).map(DataTransformer.to) 18 | XCTAssertEqual(resultBools, [false, true]) 19 | 20 | let bools = [false, true] 21 | let resultNumbers = bools.map { $0 as NSNumber } 22 | XCTAssertEqual(resultNumbers[0].boolValue, false) 23 | XCTAssertEqual(resultNumbers[1].boolValue, true) 24 | } 25 | 26 | func testNSNumberIntTransform() { 27 | let numbers = [123, -123] 28 | let resultInts: [Int] = numbers.map(NSNumber.init).map(DataTransformer.to) 29 | XCTAssertEqual(resultInts, [123, -123]) 30 | 31 | let ints = [456, -456] 32 | let resultNumbers = ints.map { $0 as NSNumber } 33 | XCTAssertEqual(resultNumbers[0].intValue, 456) 34 | XCTAssertEqual(resultNumbers[1].intValue, -456) 35 | } 36 | 37 | func testNSNumberFloatTransform() { 38 | let numbers = [123.4, -123.4] 39 | let resultFloats: [Float] = numbers.map(NSNumber.init).map(DataTransformer.to) 40 | XCTAssertEqual(resultFloats, [123.4, -123.4]) 41 | 42 | let ints = [456.7, -456.7] 43 | let resultNumbers = ints.map { $0 as NSNumber } 44 | XCTAssertEqual(resultNumbers[0].floatValue, 456.7) 45 | XCTAssertEqual(resultNumbers[1].floatValue, -456.7) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /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/NotiTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotiTests.swift 3 | // NotiTests 4 | // 5 | // Copyright © 2016 OneV's Den. All rights reserved. 6 | // 7 | 8 | import XCTest 9 | @testable import Noti 10 | 11 | class NotiTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | // Use XCTAssert and related functions to verify your tests produce the correct results. 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measure { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | --------------------------------------------------------------------------------