├── .gitignore ├── .travis.yml ├── Example ├── NoticeObserveKit.playground │ ├── Contents.swift │ └── contents.xcplayground ├── NoticeObserveKitSample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── NoticeObserveKitSample.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── NoticeObserveKitSample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── Notice │ │ ├── Navigation │ │ │ ├── NavigationControllerContent.swift │ │ │ ├── NavigationControllerDidShow.swift │ │ │ └── NavigationControllerWillShow.swift │ │ └── UIKeyboard │ │ │ └── UIKeyboardInfo.swift │ └── ViewController │ │ ├── NextViewController.swift │ │ └── ViewController.swift ├── NoticeObserveKitSampleTests │ ├── Info.plist │ └── NoticeObserveKitSampleTests.swift ├── Podfile └── Podfile.lock ├── LICENSE ├── NoticeObserveKit.podspec ├── NoticeObserveKit.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── NoticeObserveKit_iOS.xcscheme │ ├── NoticeObserveKit_macOS.xcscheme │ ├── NoticeObserveKit_tvOS.xcscheme │ └── NoticeObserveKit_watchOS.xcscheme ├── NoticeObserveKit.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── NoticeObserveKit ├── Info.plist ├── Notice.swift └── NoticeObserveKit.h ├── NoticeObserveKitTests ├── Info.plist └── NoticeObserveKitTests.swift ├── README.md └── documents └── v0_4_0.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | Carthage 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Note: if you ignore the Pods directory, make sure to uncomment 31 | # `pod install` in .travis.yml 32 | # 33 | Pods/ 34 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode9 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -workspace Example/NoticeObserveKit.xcworkspace -scheme NoticeObserveKit-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/NoticeObserveKit.playground/Contents.swift: -------------------------------------------------------------------------------- 1 | import NoticeObserveKit 2 | import PlaygroundSupport 3 | 4 | PlaygroundPage.current.needsIndefiniteExecution = true 5 | 6 | extension Notice.Names { 7 | static let sample = Notice.Name(name: "sample-notification") 8 | } 9 | 10 | NotificationCenter.default.nok.observe(name: .sample) { value in 11 | print(value) 12 | PlaygroundPage.current.finishExecution() 13 | } 14 | 15 | NotificationCenter.default.nok.post(name: .sample, with: "This is sample notification!") 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/NoticeObserveKit.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 97ABB59A20A41BFEABDC15EE /* Pods_NoticeObserveKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41082EE42AB19FC192CB9CAC /* Pods_NoticeObserveKitSample.framework */; }; 11 | ED5526E51E137C3C0071668D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5526E41E137C3C0071668D /* ViewController.swift */; }; 12 | ED5526E71E137C590071668D /* NextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED5526E61E137C590071668D /* NextViewController.swift */; }; 13 | ED94F24F1E12127300E36EDE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED94F24E1E12127300E36EDE /* AppDelegate.swift */; }; 14 | ED94F2541E12127400E36EDE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ED94F2521E12127300E36EDE /* Main.storyboard */; }; 15 | ED94F2561E12127400E36EDE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ED94F2551E12127400E36EDE /* Assets.xcassets */; }; 16 | ED94F2591E12127400E36EDE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ED94F2571E12127400E36EDE /* LaunchScreen.storyboard */; }; 17 | ED94F2641E12127400E36EDE /* NoticeObserveKitSampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED94F2631E12127400E36EDE /* NoticeObserveKitSampleTests.swift */; }; 18 | EDF64E251E1348EF0099C226 /* UIKeyboardInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64E221E1348EF0099C226 /* UIKeyboardInfo.swift */; }; 19 | EDF64E2A1E13491B0099C226 /* NavigationControllerWillShow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64E291E13491A0099C226 /* NavigationControllerWillShow.swift */; }; 20 | EDF64E2C1E1349440099C226 /* NavigationControllerDidShow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64E2B1E1349440099C226 /* NavigationControllerDidShow.swift */; }; 21 | EDF64E2E1E1349620099C226 /* NavigationControllerContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF64E2D1E1349620099C226 /* NavigationControllerContent.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | ED94F2601E12127400E36EDE /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = ED94F2431E12127300E36EDE /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = ED94F24A1E12127300E36EDE; 30 | remoteInfo = NoticeObserveKitSample; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 030E7ED44C37FE7E552406DD /* Pods-NoticeObserveKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NoticeObserveKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NoticeObserveKitSample/Pods-NoticeObserveKitSample.debug.xcconfig"; sourceTree = ""; }; 36 | 41082EE42AB19FC192CB9CAC /* Pods_NoticeObserveKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NoticeObserveKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | C5A8A8ABA48079CE37689E6E /* Pods-NoticeObserveKitSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NoticeObserveKitSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-NoticeObserveKitSample/Pods-NoticeObserveKitSample.release.xcconfig"; sourceTree = ""; }; 38 | ED5526E41E137C3C0071668D /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 39 | ED5526E61E137C590071668D /* NextViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NextViewController.swift; sourceTree = ""; }; 40 | ED94F24B1E12127300E36EDE /* NoticeObserveKitSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NoticeObserveKitSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | ED94F24E1E12127300E36EDE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | ED94F2531E12127300E36EDE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | ED94F2551E12127400E36EDE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | ED94F2581E12127400E36EDE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | ED94F25A1E12127400E36EDE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | ED94F25F1E12127400E36EDE /* NoticeObserveKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NoticeObserveKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | ED94F2631E12127400E36EDE /* NoticeObserveKitSampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeObserveKitSampleTests.swift; sourceTree = ""; }; 48 | ED94F2651E12127400E36EDE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | EDEC8CB7782DC1A1DF3D32E4 /* Pods_NoticeObserveKitSampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NoticeObserveKitSampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | EDF64E221E1348EF0099C226 /* UIKeyboardInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKeyboardInfo.swift; sourceTree = ""; }; 51 | EDF64E291E13491A0099C226 /* NavigationControllerWillShow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationControllerWillShow.swift; sourceTree = ""; }; 52 | EDF64E2B1E1349440099C226 /* NavigationControllerDidShow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationControllerDidShow.swift; sourceTree = ""; }; 53 | EDF64E2D1E1349620099C226 /* NavigationControllerContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationControllerContent.swift; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | ED94F2481E12127300E36EDE /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 97ABB59A20A41BFEABDC15EE /* Pods_NoticeObserveKitSample.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | ED94F25C1E12127400E36EDE /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | B1C01B8E41E4D7A7FDA9B080 /* Pods */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 030E7ED44C37FE7E552406DD /* Pods-NoticeObserveKitSample.debug.xcconfig */, 79 | C5A8A8ABA48079CE37689E6E /* Pods-NoticeObserveKitSample.release.xcconfig */, 80 | ); 81 | name = Pods; 82 | sourceTree = ""; 83 | }; 84 | D3D230337B721D2383600477 /* Frameworks */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 41082EE42AB19FC192CB9CAC /* Pods_NoticeObserveKitSample.framework */, 88 | EDEC8CB7782DC1A1DF3D32E4 /* Pods_NoticeObserveKitSampleTests.framework */, 89 | ); 90 | name = Frameworks; 91 | sourceTree = ""; 92 | }; 93 | ED5526E31E137C3C0071668D /* ViewController */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | ED5526E41E137C3C0071668D /* ViewController.swift */, 97 | ED5526E61E137C590071668D /* NextViewController.swift */, 98 | ); 99 | path = ViewController; 100 | sourceTree = ""; 101 | }; 102 | ED94F2421E12127300E36EDE = { 103 | isa = PBXGroup; 104 | children = ( 105 | ED94F24D1E12127300E36EDE /* NoticeObserveKitSample */, 106 | ED94F2621E12127400E36EDE /* NoticeObserveKitSampleTests */, 107 | ED94F24C1E12127300E36EDE /* Products */, 108 | B1C01B8E41E4D7A7FDA9B080 /* Pods */, 109 | D3D230337B721D2383600477 /* Frameworks */, 110 | ); 111 | sourceTree = ""; 112 | }; 113 | ED94F24C1E12127300E36EDE /* Products */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | ED94F24B1E12127300E36EDE /* NoticeObserveKitSample.app */, 117 | ED94F25F1E12127400E36EDE /* NoticeObserveKitSampleTests.xctest */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | ED94F24D1E12127300E36EDE /* NoticeObserveKitSample */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | ED94F24E1E12127300E36EDE /* AppDelegate.swift */, 126 | ED94F2521E12127300E36EDE /* Main.storyboard */, 127 | ED5526E31E137C3C0071668D /* ViewController */, 128 | EDF64E1A1E122BA70099C226 /* Notice */, 129 | ED94F2551E12127400E36EDE /* Assets.xcassets */, 130 | ED94F2571E12127400E36EDE /* LaunchScreen.storyboard */, 131 | ED94F25A1E12127400E36EDE /* Info.plist */, 132 | ); 133 | path = NoticeObserveKitSample; 134 | sourceTree = ""; 135 | }; 136 | ED94F2621E12127400E36EDE /* NoticeObserveKitSampleTests */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | ED94F2631E12127400E36EDE /* NoticeObserveKitSampleTests.swift */, 140 | ED94F2651E12127400E36EDE /* Info.plist */, 141 | ); 142 | path = NoticeObserveKitSampleTests; 143 | sourceTree = ""; 144 | }; 145 | EDF64E1A1E122BA70099C226 /* Notice */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | EDF64E281E13490A0099C226 /* Navigation */, 149 | EDF64E211E1348EF0099C226 /* UIKeyboard */, 150 | ); 151 | path = Notice; 152 | sourceTree = ""; 153 | }; 154 | EDF64E211E1348EF0099C226 /* UIKeyboard */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | EDF64E221E1348EF0099C226 /* UIKeyboardInfo.swift */, 158 | ); 159 | path = UIKeyboard; 160 | sourceTree = ""; 161 | }; 162 | EDF64E281E13490A0099C226 /* Navigation */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | EDF64E291E13491A0099C226 /* NavigationControllerWillShow.swift */, 166 | EDF64E2B1E1349440099C226 /* NavigationControllerDidShow.swift */, 167 | EDF64E2D1E1349620099C226 /* NavigationControllerContent.swift */, 168 | ); 169 | path = Navigation; 170 | sourceTree = ""; 171 | }; 172 | /* End PBXGroup section */ 173 | 174 | /* Begin PBXNativeTarget section */ 175 | ED94F24A1E12127300E36EDE /* NoticeObserveKitSample */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = ED94F2681E12127400E36EDE /* Build configuration list for PBXNativeTarget "NoticeObserveKitSample" */; 178 | buildPhases = ( 179 | 812A6F7ED6BB150D3E9B26DB /* [CP] Check Pods Manifest.lock */, 180 | ED94F2471E12127300E36EDE /* Sources */, 181 | ED94F2481E12127300E36EDE /* Frameworks */, 182 | ED94F2491E12127300E36EDE /* Resources */, 183 | AEFD696D0706F46B03BD4BD7 /* [CP] Embed Pods Frameworks */, 184 | ); 185 | buildRules = ( 186 | ); 187 | dependencies = ( 188 | ); 189 | name = NoticeObserveKitSample; 190 | productName = NoticeObserveKitSample; 191 | productReference = ED94F24B1E12127300E36EDE /* NoticeObserveKitSample.app */; 192 | productType = "com.apple.product-type.application"; 193 | }; 194 | ED94F25E1E12127400E36EDE /* NoticeObserveKitSampleTests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = ED94F26B1E12127400E36EDE /* Build configuration list for PBXNativeTarget "NoticeObserveKitSampleTests" */; 197 | buildPhases = ( 198 | ED94F25B1E12127400E36EDE /* Sources */, 199 | ED94F25C1E12127400E36EDE /* Frameworks */, 200 | ED94F25D1E12127400E36EDE /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ED94F2611E12127400E36EDE /* PBXTargetDependency */, 206 | ); 207 | name = NoticeObserveKitSampleTests; 208 | productName = NoticeObserveKitSampleTests; 209 | productReference = ED94F25F1E12127400E36EDE /* NoticeObserveKitSampleTests.xctest */; 210 | productType = "com.apple.product-type.bundle.unit-test"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | ED94F2431E12127300E36EDE /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastSwiftUpdateCheck = 0820; 219 | LastUpgradeCheck = 1010; 220 | ORGANIZATIONNAME = "marty-suzuki"; 221 | TargetAttributes = { 222 | ED94F24A1E12127300E36EDE = { 223 | CreatedOnToolsVersion = 8.2.1; 224 | ProvisioningStyle = Automatic; 225 | }; 226 | ED94F25E1E12127400E36EDE = { 227 | CreatedOnToolsVersion = 8.2.1; 228 | LastSwiftMigration = 1100; 229 | ProvisioningStyle = Automatic; 230 | TestTargetID = ED94F24A1E12127300E36EDE; 231 | }; 232 | }; 233 | }; 234 | buildConfigurationList = ED94F2461E12127300E36EDE /* Build configuration list for PBXProject "NoticeObserveKitSample" */; 235 | compatibilityVersion = "Xcode 3.2"; 236 | developmentRegion = English; 237 | hasScannedForEncodings = 0; 238 | knownRegions = ( 239 | English, 240 | en, 241 | Base, 242 | ); 243 | mainGroup = ED94F2421E12127300E36EDE; 244 | productRefGroup = ED94F24C1E12127300E36EDE /* Products */; 245 | projectDirPath = ""; 246 | projectRoot = ""; 247 | targets = ( 248 | ED94F24A1E12127300E36EDE /* NoticeObserveKitSample */, 249 | ED94F25E1E12127400E36EDE /* NoticeObserveKitSampleTests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXResourcesBuildPhase section */ 255 | ED94F2491E12127300E36EDE /* Resources */ = { 256 | isa = PBXResourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ED94F2591E12127400E36EDE /* LaunchScreen.storyboard in Resources */, 260 | ED94F2561E12127400E36EDE /* Assets.xcassets in Resources */, 261 | ED94F2541E12127400E36EDE /* Main.storyboard in Resources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | ED94F25D1E12127400E36EDE /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXResourcesBuildPhase section */ 273 | 274 | /* Begin PBXShellScriptBuildPhase section */ 275 | 812A6F7ED6BB150D3E9B26DB /* [CP] Check Pods Manifest.lock */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputPaths = ( 281 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 282 | "${PODS_ROOT}/Manifest.lock", 283 | ); 284 | name = "[CP] Check Pods Manifest.lock"; 285 | outputPaths = ( 286 | "$(DERIVED_FILE_DIR)/Pods-NoticeObserveKitSample-checkManifestLockResult.txt", 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | shellPath = /bin/sh; 290 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 291 | showEnvVarsInLog = 0; 292 | }; 293 | AEFD696D0706F46B03BD4BD7 /* [CP] Embed Pods Frameworks */ = { 294 | isa = PBXShellScriptBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | ); 298 | inputPaths = ( 299 | "${PODS_ROOT}/Target Support Files/Pods-NoticeObserveKitSample/Pods-NoticeObserveKitSample-frameworks.sh", 300 | "${BUILT_PRODUCTS_DIR}/NoticeObserveKit/NoticeObserveKit.framework", 301 | ); 302 | name = "[CP] Embed Pods Frameworks"; 303 | outputPaths = ( 304 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NoticeObserveKit.framework", 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | shellPath = /bin/sh; 308 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NoticeObserveKitSample/Pods-NoticeObserveKitSample-frameworks.sh\"\n"; 309 | showEnvVarsInLog = 0; 310 | }; 311 | /* End PBXShellScriptBuildPhase section */ 312 | 313 | /* Begin PBXSourcesBuildPhase section */ 314 | ED94F2471E12127300E36EDE /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | EDF64E2C1E1349440099C226 /* NavigationControllerDidShow.swift in Sources */, 319 | EDF64E2E1E1349620099C226 /* NavigationControllerContent.swift in Sources */, 320 | EDF64E251E1348EF0099C226 /* UIKeyboardInfo.swift in Sources */, 321 | ED5526E51E137C3C0071668D /* ViewController.swift in Sources */, 322 | ED94F24F1E12127300E36EDE /* AppDelegate.swift in Sources */, 323 | EDF64E2A1E13491B0099C226 /* NavigationControllerWillShow.swift in Sources */, 324 | ED5526E71E137C590071668D /* NextViewController.swift in Sources */, 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | ED94F25B1E12127400E36EDE /* Sources */ = { 329 | isa = PBXSourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | ED94F2641E12127400E36EDE /* NoticeObserveKitSampleTests.swift in Sources */, 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | }; 336 | /* End PBXSourcesBuildPhase section */ 337 | 338 | /* Begin PBXTargetDependency section */ 339 | ED94F2611E12127400E36EDE /* PBXTargetDependency */ = { 340 | isa = PBXTargetDependency; 341 | target = ED94F24A1E12127300E36EDE /* NoticeObserveKitSample */; 342 | targetProxy = ED94F2601E12127400E36EDE /* PBXContainerItemProxy */; 343 | }; 344 | /* End PBXTargetDependency section */ 345 | 346 | /* Begin PBXVariantGroup section */ 347 | ED94F2521E12127300E36EDE /* Main.storyboard */ = { 348 | isa = PBXVariantGroup; 349 | children = ( 350 | ED94F2531E12127300E36EDE /* Base */, 351 | ); 352 | name = Main.storyboard; 353 | sourceTree = ""; 354 | }; 355 | ED94F2571E12127400E36EDE /* LaunchScreen.storyboard */ = { 356 | isa = PBXVariantGroup; 357 | children = ( 358 | ED94F2581E12127400E36EDE /* Base */, 359 | ); 360 | name = LaunchScreen.storyboard; 361 | sourceTree = ""; 362 | }; 363 | /* End PBXVariantGroup section */ 364 | 365 | /* Begin XCBuildConfiguration section */ 366 | ED94F2661E12127400E36EDE /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 370 | ALWAYS_SEARCH_USER_PATHS = NO; 371 | CLANG_ANALYZER_NONNULL = YES; 372 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 373 | CLANG_CXX_LIBRARY = "libc++"; 374 | CLANG_ENABLE_MODULES = YES; 375 | CLANG_ENABLE_OBJC_ARC = YES; 376 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 377 | CLANG_WARN_BOOL_CONVERSION = YES; 378 | CLANG_WARN_COMMA = YES; 379 | CLANG_WARN_CONSTANT_CONVERSION = YES; 380 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 381 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 382 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 389 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 392 | CLANG_WARN_STRICT_PROTOTYPES = YES; 393 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = dwarf; 399 | ENABLE_STRICT_OBJC_MSGSEND = YES; 400 | ENABLE_TESTABILITY = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu99; 402 | GCC_DYNAMIC_NO_PIC = NO; 403 | GCC_NO_COMMON_BLOCKS = YES; 404 | GCC_OPTIMIZATION_LEVEL = 0; 405 | GCC_PREPROCESSOR_DEFINITIONS = ( 406 | "DEBUG=1", 407 | "$(inherited)", 408 | ); 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 416 | MTL_ENABLE_DEBUG_INFO = YES; 417 | ONLY_ACTIVE_ARCH = YES; 418 | SDKROOT = iphoneos; 419 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 420 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | ED94F2671E12127400E36EDE /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 429 | ALWAYS_SEARCH_USER_PATHS = NO; 430 | CLANG_ANALYZER_NONNULL = YES; 431 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 432 | CLANG_CXX_LIBRARY = "libc++"; 433 | CLANG_ENABLE_MODULES = YES; 434 | CLANG_ENABLE_OBJC_ARC = YES; 435 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 436 | CLANG_WARN_BOOL_CONVERSION = YES; 437 | CLANG_WARN_COMMA = YES; 438 | CLANG_WARN_CONSTANT_CONVERSION = YES; 439 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 440 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 441 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 442 | CLANG_WARN_EMPTY_BODY = YES; 443 | CLANG_WARN_ENUM_CONVERSION = YES; 444 | CLANG_WARN_INFINITE_RECURSION = YES; 445 | CLANG_WARN_INT_CONVERSION = YES; 446 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 448 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 449 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 450 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 451 | CLANG_WARN_STRICT_PROTOTYPES = YES; 452 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 453 | CLANG_WARN_UNREACHABLE_CODE = YES; 454 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 455 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 456 | COPY_PHASE_STRIP = NO; 457 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 458 | ENABLE_NS_ASSERTIONS = NO; 459 | ENABLE_STRICT_OBJC_MSGSEND = YES; 460 | GCC_C_LANGUAGE_STANDARD = gnu99; 461 | GCC_NO_COMMON_BLOCKS = YES; 462 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 463 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 464 | GCC_WARN_UNDECLARED_SELECTOR = YES; 465 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 466 | GCC_WARN_UNUSED_FUNCTION = YES; 467 | GCC_WARN_UNUSED_VARIABLE = YES; 468 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 469 | MTL_ENABLE_DEBUG_INFO = NO; 470 | SDKROOT = iphoneos; 471 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 472 | TARGETED_DEVICE_FAMILY = "1,2"; 473 | VALIDATE_PRODUCT = YES; 474 | }; 475 | name = Release; 476 | }; 477 | ED94F2691E12127400E36EDE /* Debug */ = { 478 | isa = XCBuildConfiguration; 479 | baseConfigurationReference = 030E7ED44C37FE7E552406DD /* Pods-NoticeObserveKitSample.debug.xcconfig */; 480 | buildSettings = { 481 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 482 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 483 | INFOPLIST_FILE = NoticeObserveKitSample/Info.plist; 484 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 485 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 486 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitSample"; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | SWIFT_VERSION = 5.0; 489 | }; 490 | name = Debug; 491 | }; 492 | ED94F26A1E12127400E36EDE /* Release */ = { 493 | isa = XCBuildConfiguration; 494 | baseConfigurationReference = C5A8A8ABA48079CE37689E6E /* Pods-NoticeObserveKitSample.release.xcconfig */; 495 | buildSettings = { 496 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 497 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 498 | INFOPLIST_FILE = NoticeObserveKitSample/Info.plist; 499 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitSample"; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | SWIFT_VERSION = 5.0; 504 | }; 505 | name = Release; 506 | }; 507 | ED94F26C1E12127400E36EDE /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | buildSettings = { 510 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 511 | BUNDLE_LOADER = "$(TEST_HOST)"; 512 | INFOPLIST_FILE = NoticeObserveKitSampleTests/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitSampleTests"; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | SWIFT_VERSION = 5.0; 517 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NoticeObserveKitSample.app/NoticeObserveKitSample"; 518 | }; 519 | name = Debug; 520 | }; 521 | ED94F26D1E12127400E36EDE /* Release */ = { 522 | isa = XCBuildConfiguration; 523 | buildSettings = { 524 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 525 | BUNDLE_LOADER = "$(TEST_HOST)"; 526 | INFOPLIST_FILE = NoticeObserveKitSampleTests/Info.plist; 527 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 528 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitSampleTests"; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | SWIFT_VERSION = 5.0; 531 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NoticeObserveKitSample.app/NoticeObserveKitSample"; 532 | }; 533 | name = Release; 534 | }; 535 | /* End XCBuildConfiguration section */ 536 | 537 | /* Begin XCConfigurationList section */ 538 | ED94F2461E12127300E36EDE /* Build configuration list for PBXProject "NoticeObserveKitSample" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | ED94F2661E12127400E36EDE /* Debug */, 542 | ED94F2671E12127400E36EDE /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | defaultConfigurationName = Release; 546 | }; 547 | ED94F2681E12127400E36EDE /* Build configuration list for PBXNativeTarget "NoticeObserveKitSample" */ = { 548 | isa = XCConfigurationList; 549 | buildConfigurations = ( 550 | ED94F2691E12127400E36EDE /* Debug */, 551 | ED94F26A1E12127400E36EDE /* Release */, 552 | ); 553 | defaultConfigurationIsVisible = 0; 554 | defaultConfigurationName = Release; 555 | }; 556 | ED94F26B1E12127400E36EDE /* Build configuration list for PBXNativeTarget "NoticeObserveKitSampleTests" */ = { 557 | isa = XCConfigurationList; 558 | buildConfigurations = ( 559 | ED94F26C1E12127400E36EDE /* Debug */, 560 | ED94F26D1E12127400E36EDE /* Release */, 561 | ); 562 | defaultConfigurationIsVisible = 0; 563 | defaultConfigurationName = Release; 564 | }; 565 | /* End XCConfigurationList section */ 566 | }; 567 | rootObject = ED94F2431E12127300E36EDE /* Project object */; 568 | } 569 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/27. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import NoticeObserveKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | if let rootVC = window?.rootViewController as? UINavigationController { 20 | rootVC.delegate = self 21 | } 22 | return true 23 | } 24 | 25 | func applicationWillResignActive(_ application: UIApplication) { 26 | // 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. 27 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 28 | } 29 | 30 | func applicationDidEnterBackground(_ application: UIApplication) { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | func applicationWillEnterForeground(_ application: UIApplication) { 36 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 37 | } 38 | 39 | func applicationDidBecomeActive(_ application: UIApplication) { 40 | // 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. 41 | } 42 | 43 | func applicationWillTerminate(_ application: UIApplication) { 44 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 45 | } 46 | } 47 | 48 | extension AppDelegate: UINavigationControllerDelegate { 49 | func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { 50 | let content = NavigationControllerContent(viewController: viewController, animated: animated) 51 | Notice.Center.default.post(name: .navigationControllerDidShow, with: content) 52 | } 53 | 54 | func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { 55 | let content = NavigationControllerContent(viewController: viewController, animated: animated) 56 | Notice.Center.default.post(name: .navigationControllerWillShow, with: content) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/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/NoticeObserveKitSample/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/Notice/Navigation/NavigationControllerContent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationControllerContent.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/28. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import NoticeObserveKit 10 | 11 | struct NavigationControllerContent { 12 | let viewController: UIViewController 13 | let animated: Bool 14 | } 15 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/Notice/Navigation/NavigationControllerDidShow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationControllerDidShow.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/28. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import NoticeObserveKit 10 | 11 | extension Notice.Names { 12 | static let navigationControllerDidShow = Notice.Name(name: "navigationControllerDidShow") 13 | } 14 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/Notice/Navigation/NavigationControllerWillShow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationControllerWillShow.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/28. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import NoticeObserveKit 10 | 11 | extension Notice.Names { 12 | static let navigationControllerWillShow = Notice.Name(name: "navigationControllerWillShow") 13 | } 14 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/Notice/UIKeyboard/UIKeyboardInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIKeyboardInfo.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/27. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import NoticeObserveKit 10 | 11 | struct UIKeyboardInfo { 12 | let frame: CGRect 13 | let animationDuration: TimeInterval 14 | let animationCurve: UIView.AnimationOptions 15 | 16 | init(info: [AnyHashable : Any]) throws { 17 | guard 18 | let frame = (info[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, 19 | let duration = info[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval, 20 | let curve = info[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt 21 | else { 22 | throw DecodeError() 23 | } 24 | self.frame = frame 25 | self.animationDuration = duration 26 | self.animationCurve = UIView.AnimationOptions(rawValue: curve) 27 | } 28 | 29 | struct DecodeError: Swift.Error {} 30 | } 31 | 32 | extension Notice.Names { 33 | static let keyboardWillShow = Notice.Name( 34 | UIResponder.keyboardWillShowNotification, 35 | decode: UIKeyboardInfo.init(info:) 36 | ) 37 | static let keyboardWillHide = Notice.Name( 38 | UIResponder.keyboardWillHideNotification, 39 | decode: UIKeyboardInfo.init(info:) 40 | ) 41 | } 42 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/ViewController/NextViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NextViewController.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/28. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class NextViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | // Do any additional setup after loading the view. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | 25 | /* 26 | // MARK: - Navigation 27 | 28 | // In a storyboard-based application, you will often want to do a little preparation before navigation 29 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 30 | // Get the new view controller using segue.destinationViewController. 31 | // Pass the selected object to the new view controller. 32 | } 33 | */ 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSample/ViewController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // NoticeObserveKitSample 4 | // 5 | // Created by 鈴木大貴 on 2016/12/27. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import NoticeObserveKit 11 | 12 | class ViewController: UIViewController { 13 | 14 | private struct Const { 15 | static let textViewMinBottom: CGFloat = 12 16 | } 17 | 18 | private let searchBar = UISearchBar(frame: .zero) 19 | private lazy var cancelButton: UIBarButtonItem = { 20 | let selector = #selector(ViewController.didTapCancelButton(_:)) 21 | return UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: selector) 22 | }() 23 | 24 | private var tasks: [Task] = [] 25 | 26 | @IBOutlet weak var textView: UITextView! 27 | @IBOutlet weak var textViewBottomConstraint: NSLayoutConstraint! 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | // Do any additional setup after loading the view, typically from a nib. 32 | navigationItem.titleView = searchBar 33 | navigationItem.rightBarButtonItem = cancelButton 34 | 35 | textView.layoutManager.allowsNonContiguousLayout = false 36 | 37 | configureObservers() 38 | } 39 | 40 | private func configureObservers() { 41 | let nok = NotificationCenter.default.nok 42 | 43 | tasks.append(Task { [unowned self] in 44 | for try await keybordInfo in nok.notifications(named: .keyboardWillShow) { 45 | self.view.layoutIfNeeded() 46 | self.textViewBottomConstraint.constant = keybordInfo.frame.size.height + Const.textViewMinBottom 47 | UIView.animate(withDuration: keybordInfo.animationDuration, delay: 0, options: keybordInfo.animationCurve, animations: { 48 | self.view.layoutIfNeeded() 49 | }, completion: nil) 50 | self.setText("UIKeyboard will show = \(keybordInfo)") 51 | } 52 | }) 53 | 54 | tasks.append(Task { [unowned self] in 55 | for try await keybordInfo in nok.notifications(named: .keyboardWillHide) { 56 | self.view.layoutIfNeeded() 57 | self.textViewBottomConstraint.constant = Const.textViewMinBottom 58 | UIView.animate(withDuration: keybordInfo.animationDuration, delay: 0, options: keybordInfo.animationCurve, animations: { 59 | self.view.layoutIfNeeded() 60 | }, completion: nil) 61 | self.setText("UIKeyboard will hide = \(keybordInfo)") 62 | } 63 | }) 64 | 65 | tasks.append(Task { [unowned self] in 66 | for try await value in nok.notifications(named: .navigationControllerDidShow) { 67 | self.setText("UINavigationController did show = \(value)") 68 | } 69 | }) 70 | 71 | tasks.append(Task { [unowned self] in 72 | for try await value in nok.notifications(named: .navigationControllerWillShow) { 73 | if value.viewController is NextViewController { 74 | value.viewController.title = "Dummy VC" 75 | } 76 | self.setText("UINavigationController will show = \(value)") 77 | } 78 | }) 79 | } 80 | 81 | @objc private func didTapCancelButton(_ sender: UIBarButtonItem) { 82 | searchBar.resignFirstResponder() 83 | } 84 | 85 | @IBAction func didTapDisposeButton(_ sender: UIButton) { 86 | tasks.forEach { $0.cancel() } 87 | tasks.removeAll() 88 | } 89 | 90 | private func setText(_ text: String) { 91 | let newText = (textView.text ?? "") + text + "\n\n" 92 | textView.text = newText 93 | textView.scrollRangeToVisible(NSRange(location: newText.count, length: 0)) 94 | } 95 | 96 | override func didReceiveMemoryWarning() { 97 | super.didReceiveMemoryWarning() 98 | // Dispose of any resources that can be recreated. 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSampleTests/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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/NoticeObserveKitSampleTests/NoticeObserveKitSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NoticeObserveKitSampleTests.swift 3 | // NoticeObserveKitSampleTests 4 | // 5 | // Created by 鈴木大貴 on 2016/12/27. 6 | // Copyright © 2016年 marty-suzuki. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import NoticeObserveKitSample 11 | 12 | class NoticeObserveKitSampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'NoticeObserveKitSample' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for NoticeObserveKitSample 9 | pod 'NoticeObserveKit', :path => '../' 10 | 11 | # target 'NoticeObserveKitSampleTests' do 12 | # inherit! :search_paths 13 | # Pods for testing 14 | # end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - NoticeObserveKit (0.13.0) 3 | 4 | DEPENDENCIES: 5 | - NoticeObserveKit (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | NoticeObserveKit: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | NoticeObserveKit: 2b79817e5baeb5be0b25b9c0f5bcc3311d3ed0f1 13 | 14 | PODFILE CHECKSUM: dfc22d33353e73a20c66a6f310ab9f90fe1138a6 15 | 16 | COCOAPODS: 1.11.3 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 marty-suzuki 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /NoticeObserveKit.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint NoticeObserveKit.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'NoticeObserveKit' 11 | s.version = '0.13.0' 12 | s.summary = 'NoticeObserveKit is type-safe NotificationCenter wrapper.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | # s.description = <<-DESC 21 | #TODO: Add long description of the pod here. 22 | # DESC 23 | 24 | s.homepage = 'https://github.com/marty-suzuki/NoticeObserveKit' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'Taiki Suzuki' => 's1180183@gmail.com' } 28 | s.source = { :git => 'https://github.com/marty-suzuki/NoticeObserveKit.git', :tag => s.version.to_s } 29 | s.social_media_url = 'https://twitter.com/marty_suzuki' 30 | 31 | s.ios.deployment_target = '10.0' 32 | s.osx.deployment_target = '10.10' 33 | s.tvos.deployment_target = '10.0' 34 | s.watchos.deployment_target = '3.0' 35 | s.swift_version = '5.0' 36 | 37 | s.source_files = 'NoticeObserveKit/*.{swift}' 38 | 39 | # s.resource_bundles = { 40 | # 'NoticeObserveKit' => ['NoticeObserveKit/Assets/*.png'] 41 | # } 42 | 43 | # s.public_header_files = 'Pod/Classes/**/*.h' 44 | s.frameworks = 'Foundation' 45 | # s.dependency 'AFNetworking', '~> 2.3' 46 | end 47 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9DA77C7F2217BD2100E32ED2 /* NoticeObserveKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DA77C752217BD2100E32ED2 /* NoticeObserveKit.framework */; }; 11 | 9DA77C842217BD2100E32ED2 /* NoticeObserveKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA77C832217BD2100E32ED2 /* NoticeObserveKitTests.swift */; }; 12 | 9DA77C862217BD2100E32ED2 /* NoticeObserveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 9DA77C922217BD5300E32ED2 /* Notice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA77C902217BD5300E32ED2 /* Notice.swift */; }; 14 | ED5025B72217EA8100FE6FEA /* NoticeObserveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15 | ED5025D22217EB5500FE6FEA /* NoticeObserveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | ED5025D32217EB5600FE6FEA /* NoticeObserveKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 9DA77C802217BD2100E32ED2 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 9DA77C6C2217BD2100E32ED2 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 9DA77C742217BD2100E32ED2; 25 | remoteInfo = NoticeObserveKit; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 9DA77C752217BD2100E32ED2 /* NoticeObserveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NoticeObserveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoticeObserveKit.h; sourceTree = ""; }; 32 | 9DA77C792217BD2100E32ED2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 9DA77C7E2217BD2100E32ED2 /* NoticeObserveKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NoticeObserveKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 9DA77C832217BD2100E32ED2 /* NoticeObserveKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeObserveKitTests.swift; sourceTree = ""; }; 35 | 9DA77C852217BD2100E32ED2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 9DA77C902217BD5300E32ED2 /* Notice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Notice.swift; sourceTree = ""; }; 37 | ED5025AF2217E98900FE6FEA /* NoticeObserveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NoticeObserveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | ED5025BD2217EAD400FE6FEA /* NoticeObserveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NoticeObserveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | ED5025CA2217EAE600FE6FEA /* NoticeObserveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NoticeObserveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | 9DA77C722217BD2100E32ED2 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | 9DA77C7B2217BD2100E32ED2 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 9DA77C7F2217BD2100E32ED2 /* NoticeObserveKit.framework in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | ED5025AC2217E98900FE6FEA /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | ED5025BA2217EAD400FE6FEA /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | ED5025C72217EAE600FE6FEA /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | /* End PBXFrameworksBuildPhase section */ 80 | 81 | /* Begin PBXGroup section */ 82 | 9DA77C6B2217BD2100E32ED2 = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9DA77C772217BD2100E32ED2 /* NoticeObserveKit */, 86 | 9DA77C822217BD2100E32ED2 /* NoticeObserveKitTests */, 87 | 9DA77C762217BD2100E32ED2 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 9DA77C762217BD2100E32ED2 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 9DA77C752217BD2100E32ED2 /* NoticeObserveKit.framework */, 95 | 9DA77C7E2217BD2100E32ED2 /* NoticeObserveKitTests.xctest */, 96 | ED5025AF2217E98900FE6FEA /* NoticeObserveKit.framework */, 97 | ED5025BD2217EAD400FE6FEA /* NoticeObserveKit.framework */, 98 | ED5025CA2217EAE600FE6FEA /* NoticeObserveKit.framework */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 9DA77C772217BD2100E32ED2 /* NoticeObserveKit */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 9DA77C902217BD5300E32ED2 /* Notice.swift */, 107 | 9DA77C782217BD2100E32ED2 /* NoticeObserveKit.h */, 108 | 9DA77C792217BD2100E32ED2 /* Info.plist */, 109 | ); 110 | path = NoticeObserveKit; 111 | sourceTree = ""; 112 | }; 113 | 9DA77C822217BD2100E32ED2 /* NoticeObserveKitTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 9DA77C832217BD2100E32ED2 /* NoticeObserveKitTests.swift */, 117 | 9DA77C852217BD2100E32ED2 /* Info.plist */, 118 | ); 119 | path = NoticeObserveKitTests; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXHeadersBuildPhase section */ 125 | 9DA77C702217BD2100E32ED2 /* Headers */ = { 126 | isa = PBXHeadersBuildPhase; 127 | buildActionMask = 2147483647; 128 | files = ( 129 | 9DA77C862217BD2100E32ED2 /* NoticeObserveKit.h in Headers */, 130 | ); 131 | runOnlyForDeploymentPostprocessing = 0; 132 | }; 133 | ED5025AA2217E98900FE6FEA /* Headers */ = { 134 | isa = PBXHeadersBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | ED5025B72217EA8100FE6FEA /* NoticeObserveKit.h in Headers */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | ED5025B82217EAD400FE6FEA /* Headers */ = { 142 | isa = PBXHeadersBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | ED5025D22217EB5500FE6FEA /* NoticeObserveKit.h in Headers */, 146 | ); 147 | runOnlyForDeploymentPostprocessing = 0; 148 | }; 149 | ED5025C52217EAE600FE6FEA /* Headers */ = { 150 | isa = PBXHeadersBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | ED5025D32217EB5600FE6FEA /* NoticeObserveKit.h in Headers */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXHeadersBuildPhase section */ 158 | 159 | /* Begin PBXNativeTarget section */ 160 | 9DA77C742217BD2100E32ED2 /* NoticeObserveKit_iOS */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = 9DA77C892217BD2100E32ED2 /* Build configuration list for PBXNativeTarget "NoticeObserveKit_iOS" */; 163 | buildPhases = ( 164 | 9DA77C702217BD2100E32ED2 /* Headers */, 165 | 9DA77C712217BD2100E32ED2 /* Sources */, 166 | 9DA77C722217BD2100E32ED2 /* Frameworks */, 167 | 9DA77C732217BD2100E32ED2 /* Resources */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | ); 173 | name = NoticeObserveKit_iOS; 174 | productName = NoticeObserveKit; 175 | productReference = 9DA77C752217BD2100E32ED2 /* NoticeObserveKit.framework */; 176 | productType = "com.apple.product-type.framework"; 177 | }; 178 | 9DA77C7D2217BD2100E32ED2 /* NoticeObserveKitTests */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = 9DA77C8C2217BD2100E32ED2 /* Build configuration list for PBXNativeTarget "NoticeObserveKitTests" */; 181 | buildPhases = ( 182 | 9DA77C7A2217BD2100E32ED2 /* Sources */, 183 | 9DA77C7B2217BD2100E32ED2 /* Frameworks */, 184 | 9DA77C7C2217BD2100E32ED2 /* Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | 9DA77C812217BD2100E32ED2 /* PBXTargetDependency */, 190 | ); 191 | name = NoticeObserveKitTests; 192 | productName = NoticeObserveKitTests; 193 | productReference = 9DA77C7E2217BD2100E32ED2 /* NoticeObserveKitTests.xctest */; 194 | productType = "com.apple.product-type.bundle.unit-test"; 195 | }; 196 | ED5025AE2217E98900FE6FEA /* NoticeObserveKit_watchOS */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = ED5025B42217E98900FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_watchOS" */; 199 | buildPhases = ( 200 | ED5025AA2217E98900FE6FEA /* Headers */, 201 | ED5025AB2217E98900FE6FEA /* Sources */, 202 | ED5025AC2217E98900FE6FEA /* Frameworks */, 203 | ED5025AD2217E98900FE6FEA /* Resources */, 204 | ); 205 | buildRules = ( 206 | ); 207 | dependencies = ( 208 | ); 209 | name = NoticeObserveKit_watchOS; 210 | productName = NoticeObserveKit_watchOS; 211 | productReference = ED5025AF2217E98900FE6FEA /* NoticeObserveKit.framework */; 212 | productType = "com.apple.product-type.framework"; 213 | }; 214 | ED5025BC2217EAD400FE6FEA /* NoticeObserveKit_tvOS */ = { 215 | isa = PBXNativeTarget; 216 | buildConfigurationList = ED5025C22217EAD400FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_tvOS" */; 217 | buildPhases = ( 218 | ED5025B82217EAD400FE6FEA /* Headers */, 219 | ED5025B92217EAD400FE6FEA /* Sources */, 220 | ED5025BA2217EAD400FE6FEA /* Frameworks */, 221 | ED5025BB2217EAD400FE6FEA /* Resources */, 222 | ); 223 | buildRules = ( 224 | ); 225 | dependencies = ( 226 | ); 227 | name = NoticeObserveKit_tvOS; 228 | productName = NoticeObserveKit_tvOS; 229 | productReference = ED5025BD2217EAD400FE6FEA /* NoticeObserveKit.framework */; 230 | productType = "com.apple.product-type.framework"; 231 | }; 232 | ED5025C92217EAE600FE6FEA /* NoticeObserveKit_macOS */ = { 233 | isa = PBXNativeTarget; 234 | buildConfigurationList = ED5025CF2217EAE700FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_macOS" */; 235 | buildPhases = ( 236 | ED5025C52217EAE600FE6FEA /* Headers */, 237 | ED5025C62217EAE600FE6FEA /* Sources */, 238 | ED5025C72217EAE600FE6FEA /* Frameworks */, 239 | ED5025C82217EAE600FE6FEA /* Resources */, 240 | ); 241 | buildRules = ( 242 | ); 243 | dependencies = ( 244 | ); 245 | name = NoticeObserveKit_macOS; 246 | productName = NoticeObserveKit_macOS; 247 | productReference = ED5025CA2217EAE600FE6FEA /* NoticeObserveKit.framework */; 248 | productType = "com.apple.product-type.framework"; 249 | }; 250 | /* End PBXNativeTarget section */ 251 | 252 | /* Begin PBXProject section */ 253 | 9DA77C6C2217BD2100E32ED2 /* Project object */ = { 254 | isa = PBXProject; 255 | attributes = { 256 | LastSwiftUpdateCheck = 1010; 257 | LastUpgradeCheck = 1010; 258 | ORGANIZATIONNAME = "marty-suzuki"; 259 | TargetAttributes = { 260 | 9DA77C742217BD2100E32ED2 = { 261 | CreatedOnToolsVersion = 10.1; 262 | LastSwiftMigration = 1010; 263 | }; 264 | 9DA77C7D2217BD2100E32ED2 = { 265 | CreatedOnToolsVersion = 10.1; 266 | }; 267 | ED5025AE2217E98900FE6FEA = { 268 | CreatedOnToolsVersion = 10.1; 269 | }; 270 | ED5025BC2217EAD400FE6FEA = { 271 | CreatedOnToolsVersion = 10.1; 272 | }; 273 | ED5025C92217EAE600FE6FEA = { 274 | CreatedOnToolsVersion = 10.1; 275 | }; 276 | }; 277 | }; 278 | buildConfigurationList = 9DA77C6F2217BD2100E32ED2 /* Build configuration list for PBXProject "NoticeObserveKit" */; 279 | compatibilityVersion = "Xcode 9.3"; 280 | developmentRegion = en; 281 | hasScannedForEncodings = 0; 282 | knownRegions = ( 283 | en, 284 | ); 285 | mainGroup = 9DA77C6B2217BD2100E32ED2; 286 | productRefGroup = 9DA77C762217BD2100E32ED2 /* Products */; 287 | projectDirPath = ""; 288 | projectRoot = ""; 289 | targets = ( 290 | 9DA77C742217BD2100E32ED2 /* NoticeObserveKit_iOS */, 291 | 9DA77C7D2217BD2100E32ED2 /* NoticeObserveKitTests */, 292 | ED5025AE2217E98900FE6FEA /* NoticeObserveKit_watchOS */, 293 | ED5025BC2217EAD400FE6FEA /* NoticeObserveKit_tvOS */, 294 | ED5025C92217EAE600FE6FEA /* NoticeObserveKit_macOS */, 295 | ); 296 | }; 297 | /* End PBXProject section */ 298 | 299 | /* Begin PBXResourcesBuildPhase section */ 300 | 9DA77C732217BD2100E32ED2 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 9DA77C7C2217BD2100E32ED2 /* Resources */ = { 308 | isa = PBXResourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | ED5025AD2217E98900FE6FEA /* Resources */ = { 315 | isa = PBXResourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | ED5025BB2217EAD400FE6FEA /* Resources */ = { 322 | isa = PBXResourcesBuildPhase; 323 | buildActionMask = 2147483647; 324 | files = ( 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | ED5025C82217EAE600FE6FEA /* Resources */ = { 329 | isa = PBXResourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXResourcesBuildPhase section */ 336 | 337 | /* Begin PBXSourcesBuildPhase section */ 338 | 9DA77C712217BD2100E32ED2 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 9DA77C922217BD5300E32ED2 /* Notice.swift in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | 9DA77C7A2217BD2100E32ED2 /* Sources */ = { 347 | isa = PBXSourcesBuildPhase; 348 | buildActionMask = 2147483647; 349 | files = ( 350 | 9DA77C842217BD2100E32ED2 /* NoticeObserveKitTests.swift in Sources */, 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | }; 354 | ED5025AB2217E98900FE6FEA /* Sources */ = { 355 | isa = PBXSourcesBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | runOnlyForDeploymentPostprocessing = 0; 360 | }; 361 | ED5025B92217EAD400FE6FEA /* Sources */ = { 362 | isa = PBXSourcesBuildPhase; 363 | buildActionMask = 2147483647; 364 | files = ( 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | }; 368 | ED5025C62217EAE600FE6FEA /* Sources */ = { 369 | isa = PBXSourcesBuildPhase; 370 | buildActionMask = 2147483647; 371 | files = ( 372 | ); 373 | runOnlyForDeploymentPostprocessing = 0; 374 | }; 375 | /* End PBXSourcesBuildPhase section */ 376 | 377 | /* Begin PBXTargetDependency section */ 378 | 9DA77C812217BD2100E32ED2 /* PBXTargetDependency */ = { 379 | isa = PBXTargetDependency; 380 | target = 9DA77C742217BD2100E32ED2 /* NoticeObserveKit_iOS */; 381 | targetProxy = 9DA77C802217BD2100E32ED2 /* PBXContainerItemProxy */; 382 | }; 383 | /* End PBXTargetDependency section */ 384 | 385 | /* Begin XCBuildConfiguration section */ 386 | 9DA77C872217BD2100E32ED2 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ALWAYS_SEARCH_USER_PATHS = NO; 390 | CLANG_ANALYZER_NONNULL = YES; 391 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_ENABLE_OBJC_WEAK = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 416 | CLANG_WARN_UNREACHABLE_CODE = YES; 417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 418 | CODE_SIGN_IDENTITY = "iPhone Developer"; 419 | COPY_PHASE_STRIP = NO; 420 | CURRENT_PROJECT_VERSION = 1; 421 | DEBUG_INFORMATION_FORMAT = dwarf; 422 | ENABLE_STRICT_OBJC_MSGSEND = YES; 423 | ENABLE_TESTABILITY = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu11; 425 | GCC_DYNAMIC_NO_PIC = NO; 426 | GCC_NO_COMMON_BLOCKS = YES; 427 | GCC_OPTIMIZATION_LEVEL = 0; 428 | GCC_PREPROCESSOR_DEFINITIONS = ( 429 | "DEBUG=1", 430 | "$(inherited)", 431 | ); 432 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 433 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 434 | GCC_WARN_UNDECLARED_SELECTOR = YES; 435 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 436 | GCC_WARN_UNUSED_FUNCTION = YES; 437 | GCC_WARN_UNUSED_VARIABLE = YES; 438 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 439 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 440 | MTL_FAST_MATH = YES; 441 | ONLY_ACTIVE_ARCH = YES; 442 | SDKROOT = iphoneos; 443 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 444 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 445 | VERSIONING_SYSTEM = "apple-generic"; 446 | VERSION_INFO_PREFIX = ""; 447 | }; 448 | name = Debug; 449 | }; 450 | 9DA77C882217BD2100E32ED2 /* Release */ = { 451 | isa = XCBuildConfiguration; 452 | buildSettings = { 453 | ALWAYS_SEARCH_USER_PATHS = NO; 454 | CLANG_ANALYZER_NONNULL = YES; 455 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 456 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 457 | CLANG_CXX_LIBRARY = "libc++"; 458 | CLANG_ENABLE_MODULES = YES; 459 | CLANG_ENABLE_OBJC_ARC = YES; 460 | CLANG_ENABLE_OBJC_WEAK = YES; 461 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 462 | CLANG_WARN_BOOL_CONVERSION = YES; 463 | CLANG_WARN_COMMA = YES; 464 | CLANG_WARN_CONSTANT_CONVERSION = YES; 465 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 466 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 467 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 468 | CLANG_WARN_EMPTY_BODY = YES; 469 | CLANG_WARN_ENUM_CONVERSION = YES; 470 | CLANG_WARN_INFINITE_RECURSION = YES; 471 | CLANG_WARN_INT_CONVERSION = YES; 472 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 473 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 474 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 475 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 476 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 477 | CLANG_WARN_STRICT_PROTOTYPES = YES; 478 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 479 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 480 | CLANG_WARN_UNREACHABLE_CODE = YES; 481 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 482 | CODE_SIGN_IDENTITY = "iPhone Developer"; 483 | COPY_PHASE_STRIP = NO; 484 | CURRENT_PROJECT_VERSION = 1; 485 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 486 | ENABLE_NS_ASSERTIONS = NO; 487 | ENABLE_STRICT_OBJC_MSGSEND = YES; 488 | GCC_C_LANGUAGE_STANDARD = gnu11; 489 | GCC_NO_COMMON_BLOCKS = YES; 490 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 491 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 492 | GCC_WARN_UNDECLARED_SELECTOR = YES; 493 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 494 | GCC_WARN_UNUSED_FUNCTION = YES; 495 | GCC_WARN_UNUSED_VARIABLE = YES; 496 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 497 | MTL_ENABLE_DEBUG_INFO = NO; 498 | MTL_FAST_MATH = YES; 499 | SDKROOT = iphoneos; 500 | SWIFT_COMPILATION_MODE = wholemodule; 501 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 502 | VALIDATE_PRODUCT = YES; 503 | VERSIONING_SYSTEM = "apple-generic"; 504 | VERSION_INFO_PREFIX = ""; 505 | }; 506 | name = Release; 507 | }; 508 | 9DA77C8A2217BD2100E32ED2 /* Debug */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | CLANG_ENABLE_MODULES = YES; 512 | CODE_SIGN_IDENTITY = ""; 513 | CODE_SIGN_STYLE = Manual; 514 | DEFINES_MODULE = YES; 515 | DEVELOPMENT_TEAM = ""; 516 | DYLIB_COMPATIBILITY_VERSION = 1; 517 | DYLIB_CURRENT_VERSION = 1; 518 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 519 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 520 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 521 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 522 | LD_RUNPATH_SEARCH_PATHS = ( 523 | "$(inherited)", 524 | "@executable_path/Frameworks", 525 | "@loader_path/Frameworks", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit"; 528 | PRODUCT_NAME = NoticeObserveKit; 529 | PROVISIONING_PROFILE_SPECIFIER = ""; 530 | SKIP_INSTALL = YES; 531 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 532 | SWIFT_VERSION = 5.0; 533 | TARGETED_DEVICE_FAMILY = "1,2"; 534 | }; 535 | name = Debug; 536 | }; 537 | 9DA77C8B2217BD2100E32ED2 /* Release */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | CLANG_ENABLE_MODULES = YES; 541 | CODE_SIGN_IDENTITY = ""; 542 | CODE_SIGN_STYLE = Manual; 543 | DEFINES_MODULE = YES; 544 | DEVELOPMENT_TEAM = ""; 545 | DYLIB_COMPATIBILITY_VERSION = 1; 546 | DYLIB_CURRENT_VERSION = 1; 547 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 548 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 549 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 550 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 551 | LD_RUNPATH_SEARCH_PATHS = ( 552 | "$(inherited)", 553 | "@executable_path/Frameworks", 554 | "@loader_path/Frameworks", 555 | ); 556 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit"; 557 | PRODUCT_NAME = NoticeObserveKit; 558 | PROVISIONING_PROFILE_SPECIFIER = ""; 559 | SKIP_INSTALL = YES; 560 | SWIFT_VERSION = 5.0; 561 | TARGETED_DEVICE_FAMILY = "1,2"; 562 | }; 563 | name = Release; 564 | }; 565 | 9DA77C8D2217BD2100E32ED2 /* Debug */ = { 566 | isa = XCBuildConfiguration; 567 | buildSettings = { 568 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 569 | CODE_SIGN_STYLE = Manual; 570 | DEVELOPMENT_TEAM = ""; 571 | INFOPLIST_FILE = NoticeObserveKitTests/Info.plist; 572 | LD_RUNPATH_SEARCH_PATHS = ( 573 | "$(inherited)", 574 | "@executable_path/Frameworks", 575 | "@loader_path/Frameworks", 576 | ); 577 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitTests"; 578 | PRODUCT_NAME = "$(TARGET_NAME)"; 579 | PROVISIONING_PROFILE_SPECIFIER = ""; 580 | SWIFT_VERSION = 5.0; 581 | TARGETED_DEVICE_FAMILY = "1,2"; 582 | }; 583 | name = Debug; 584 | }; 585 | 9DA77C8E2217BD2100E32ED2 /* Release */ = { 586 | isa = XCBuildConfiguration; 587 | buildSettings = { 588 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 589 | CODE_SIGN_STYLE = Manual; 590 | DEVELOPMENT_TEAM = ""; 591 | INFOPLIST_FILE = NoticeObserveKitTests/Info.plist; 592 | LD_RUNPATH_SEARCH_PATHS = ( 593 | "$(inherited)", 594 | "@executable_path/Frameworks", 595 | "@loader_path/Frameworks", 596 | ); 597 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKitTests"; 598 | PRODUCT_NAME = "$(TARGET_NAME)"; 599 | PROVISIONING_PROFILE_SPECIFIER = ""; 600 | SWIFT_VERSION = 5.0; 601 | TARGETED_DEVICE_FAMILY = "1,2"; 602 | }; 603 | name = Release; 604 | }; 605 | ED5025B52217E98900FE6FEA /* Debug */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | APPLICATION_EXTENSION_API_ONLY = YES; 609 | CODE_SIGN_IDENTITY = ""; 610 | CODE_SIGN_STYLE = Manual; 611 | DEFINES_MODULE = YES; 612 | DEVELOPMENT_TEAM = ""; 613 | DYLIB_COMPATIBILITY_VERSION = 1; 614 | DYLIB_CURRENT_VERSION = 1; 615 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 616 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 617 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 618 | LD_RUNPATH_SEARCH_PATHS = ( 619 | "$(inherited)", 620 | "@executable_path/Frameworks", 621 | "@loader_path/Frameworks", 622 | ); 623 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-watchOS"; 624 | PRODUCT_NAME = NoticeObserveKit; 625 | PROVISIONING_PROFILE_SPECIFIER = ""; 626 | SDKROOT = watchos; 627 | SKIP_INSTALL = YES; 628 | SWIFT_VERSION = 5; 629 | TARGETED_DEVICE_FAMILY = 4; 630 | WATCHOS_DEPLOYMENT_TARGET = 3.0; 631 | }; 632 | name = Debug; 633 | }; 634 | ED5025B62217E98900FE6FEA /* Release */ = { 635 | isa = XCBuildConfiguration; 636 | buildSettings = { 637 | APPLICATION_EXTENSION_API_ONLY = YES; 638 | CODE_SIGN_IDENTITY = ""; 639 | CODE_SIGN_STYLE = Manual; 640 | DEFINES_MODULE = YES; 641 | DEVELOPMENT_TEAM = ""; 642 | DYLIB_COMPATIBILITY_VERSION = 1; 643 | DYLIB_CURRENT_VERSION = 1; 644 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 645 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 646 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 647 | LD_RUNPATH_SEARCH_PATHS = ( 648 | "$(inherited)", 649 | "@executable_path/Frameworks", 650 | "@loader_path/Frameworks", 651 | ); 652 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-watchOS"; 653 | PRODUCT_NAME = NoticeObserveKit; 654 | PROVISIONING_PROFILE_SPECIFIER = ""; 655 | SDKROOT = watchos; 656 | SKIP_INSTALL = YES; 657 | SWIFT_VERSION = 5; 658 | TARGETED_DEVICE_FAMILY = 4; 659 | WATCHOS_DEPLOYMENT_TARGET = 3.0; 660 | }; 661 | name = Release; 662 | }; 663 | ED5025C32217EAD400FE6FEA /* Debug */ = { 664 | isa = XCBuildConfiguration; 665 | buildSettings = { 666 | CODE_SIGN_IDENTITY = ""; 667 | CODE_SIGN_STYLE = Manual; 668 | DEFINES_MODULE = YES; 669 | DEVELOPMENT_TEAM = ""; 670 | DYLIB_COMPATIBILITY_VERSION = 1; 671 | DYLIB_CURRENT_VERSION = 1; 672 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 673 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 674 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 675 | LD_RUNPATH_SEARCH_PATHS = ( 676 | "$(inherited)", 677 | "@executable_path/Frameworks", 678 | "@loader_path/Frameworks", 679 | ); 680 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-tvOS"; 681 | PRODUCT_NAME = NoticeObserveKit; 682 | PROVISIONING_PROFILE_SPECIFIER = ""; 683 | SDKROOT = appletvos; 684 | SKIP_INSTALL = YES; 685 | SWIFT_VERSION = 5; 686 | TARGETED_DEVICE_FAMILY = 3; 687 | TVOS_DEPLOYMENT_TARGET = 10.0; 688 | }; 689 | name = Debug; 690 | }; 691 | ED5025C42217EAD400FE6FEA /* Release */ = { 692 | isa = XCBuildConfiguration; 693 | buildSettings = { 694 | CODE_SIGN_IDENTITY = ""; 695 | CODE_SIGN_STYLE = Manual; 696 | DEFINES_MODULE = YES; 697 | DEVELOPMENT_TEAM = ""; 698 | DYLIB_COMPATIBILITY_VERSION = 1; 699 | DYLIB_CURRENT_VERSION = 1; 700 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 701 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 702 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 703 | LD_RUNPATH_SEARCH_PATHS = ( 704 | "$(inherited)", 705 | "@executable_path/Frameworks", 706 | "@loader_path/Frameworks", 707 | ); 708 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-tvOS"; 709 | PRODUCT_NAME = NoticeObserveKit; 710 | PROVISIONING_PROFILE_SPECIFIER = ""; 711 | SDKROOT = appletvos; 712 | SKIP_INSTALL = YES; 713 | SWIFT_VERSION = 5; 714 | TARGETED_DEVICE_FAMILY = 3; 715 | TVOS_DEPLOYMENT_TARGET = 10.0; 716 | }; 717 | name = Release; 718 | }; 719 | ED5025D02217EAE700FE6FEA /* Debug */ = { 720 | isa = XCBuildConfiguration; 721 | buildSettings = { 722 | CODE_SIGN_IDENTITY = "-"; 723 | CODE_SIGN_STYLE = Automatic; 724 | COMBINE_HIDPI_IMAGES = YES; 725 | DEFINES_MODULE = YES; 726 | DYLIB_COMPATIBILITY_VERSION = 1; 727 | DYLIB_CURRENT_VERSION = 1; 728 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 729 | FRAMEWORK_VERSION = A; 730 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 731 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 732 | LD_RUNPATH_SEARCH_PATHS = ( 733 | "$(inherited)", 734 | "@executable_path/../Frameworks", 735 | "@loader_path/Frameworks", 736 | ); 737 | MACOSX_DEPLOYMENT_TARGET = 10.10; 738 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-macOS"; 739 | PRODUCT_NAME = NoticeObserveKit; 740 | SDKROOT = macosx; 741 | SKIP_INSTALL = YES; 742 | SWIFT_VERSION = 5; 743 | }; 744 | name = Debug; 745 | }; 746 | ED5025D12217EAE700FE6FEA /* Release */ = { 747 | isa = XCBuildConfiguration; 748 | buildSettings = { 749 | CODE_SIGN_IDENTITY = "-"; 750 | CODE_SIGN_STYLE = Automatic; 751 | COMBINE_HIDPI_IMAGES = YES; 752 | DEFINES_MODULE = YES; 753 | DYLIB_COMPATIBILITY_VERSION = 1; 754 | DYLIB_CURRENT_VERSION = 1; 755 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 756 | FRAMEWORK_VERSION = A; 757 | INFOPLIST_FILE = NoticeObserveKit/Info.plist; 758 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 759 | LD_RUNPATH_SEARCH_PATHS = ( 760 | "$(inherited)", 761 | "@executable_path/../Frameworks", 762 | "@loader_path/Frameworks", 763 | ); 764 | MACOSX_DEPLOYMENT_TARGET = 10.10; 765 | PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.NoticeObserveKit-macOS"; 766 | PRODUCT_NAME = NoticeObserveKit; 767 | SDKROOT = macosx; 768 | SKIP_INSTALL = YES; 769 | SWIFT_VERSION = 5; 770 | }; 771 | name = Release; 772 | }; 773 | /* End XCBuildConfiguration section */ 774 | 775 | /* Begin XCConfigurationList section */ 776 | 9DA77C6F2217BD2100E32ED2 /* Build configuration list for PBXProject "NoticeObserveKit" */ = { 777 | isa = XCConfigurationList; 778 | buildConfigurations = ( 779 | 9DA77C872217BD2100E32ED2 /* Debug */, 780 | 9DA77C882217BD2100E32ED2 /* Release */, 781 | ); 782 | defaultConfigurationIsVisible = 0; 783 | defaultConfigurationName = Release; 784 | }; 785 | 9DA77C892217BD2100E32ED2 /* Build configuration list for PBXNativeTarget "NoticeObserveKit_iOS" */ = { 786 | isa = XCConfigurationList; 787 | buildConfigurations = ( 788 | 9DA77C8A2217BD2100E32ED2 /* Debug */, 789 | 9DA77C8B2217BD2100E32ED2 /* Release */, 790 | ); 791 | defaultConfigurationIsVisible = 0; 792 | defaultConfigurationName = Release; 793 | }; 794 | 9DA77C8C2217BD2100E32ED2 /* Build configuration list for PBXNativeTarget "NoticeObserveKitTests" */ = { 795 | isa = XCConfigurationList; 796 | buildConfigurations = ( 797 | 9DA77C8D2217BD2100E32ED2 /* Debug */, 798 | 9DA77C8E2217BD2100E32ED2 /* Release */, 799 | ); 800 | defaultConfigurationIsVisible = 0; 801 | defaultConfigurationName = Release; 802 | }; 803 | ED5025B42217E98900FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_watchOS" */ = { 804 | isa = XCConfigurationList; 805 | buildConfigurations = ( 806 | ED5025B52217E98900FE6FEA /* Debug */, 807 | ED5025B62217E98900FE6FEA /* Release */, 808 | ); 809 | defaultConfigurationIsVisible = 0; 810 | defaultConfigurationName = Release; 811 | }; 812 | ED5025C22217EAD400FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_tvOS" */ = { 813 | isa = XCConfigurationList; 814 | buildConfigurations = ( 815 | ED5025C32217EAD400FE6FEA /* Debug */, 816 | ED5025C42217EAD400FE6FEA /* Release */, 817 | ); 818 | defaultConfigurationIsVisible = 0; 819 | defaultConfigurationName = Release; 820 | }; 821 | ED5025CF2217EAE700FE6FEA /* Build configuration list for PBXNativeTarget "NoticeObserveKit_macOS" */ = { 822 | isa = XCConfigurationList; 823 | buildConfigurations = ( 824 | ED5025D02217EAE700FE6FEA /* Debug */, 825 | ED5025D12217EAE700FE6FEA /* Release */, 826 | ); 827 | defaultConfigurationIsVisible = 0; 828 | defaultConfigurationName = Release; 829 | }; 830 | /* End XCConfigurationList section */ 831 | }; 832 | rootObject = 9DA77C6C2217BD2100E32ED2 /* Project object */; 833 | } 834 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/xcshareddata/xcschemes/NoticeObserveKit_iOS.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 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/xcshareddata/xcschemes/NoticeObserveKit_macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/xcshareddata/xcschemes/NoticeObserveKit_tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 72 | 73 | 79 | 80 | 81 | 82 | 84 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcodeproj/xcshareddata/xcschemes/NoticeObserveKit_watchOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 72 | 73 | 79 | 80 | 81 | 82 | 84 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NoticeObserveKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NoticeObserveKit/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 | 22 | 23 | -------------------------------------------------------------------------------- /NoticeObserveKit/Notice.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Notice.swift 3 | // NoticeObserveKit 4 | // 5 | // Created by marty-suzuki on 2019/01/25. 6 | // 7 | 8 | #if canImport(Combine) 9 | import Combine 10 | #endif 11 | import Foundation 12 | 13 | // MARK: - Notice definition 14 | 15 | public enum Notice { 16 | 17 | public final class Center { 18 | 19 | @available(iOS, deprecated: 10, renamed: "NotificationCenter.default.nok") 20 | @available(watchOS, deprecated: 3, renamed: "NotificationCenter.default.nok") 21 | @available(tvOS, deprecated: 10, renamed: "NotificationCenter.default.nok") 22 | @available(OSX, deprecated: 10.10, renamed: "NotificationCenter.default.nok") 23 | public static let `default` = Center(center: .default) 24 | 25 | let center: NotificationCenter 26 | 27 | init(center: NotificationCenter) { 28 | self.center = center 29 | } 30 | 31 | public convenience init() { 32 | self.init(center: .init()) 33 | } 34 | } 35 | 36 | public class Names { 37 | fileprivate init() {} 38 | } 39 | 40 | public final class Name: Names { 41 | 42 | let raw: Notification.Name 43 | let decode: (([AnyHashable: Any]) throws -> Value)? 44 | 45 | public convenience init(name: String) { 46 | self.init(name: Notification.Name(name), decode: nil) 47 | } 48 | 49 | public convenience init( 50 | _ name: Notification.Name, 51 | decode: @escaping ([AnyHashable: Any]) throws -> Value 52 | ) { 53 | self.init(name: name, decode: decode) 54 | } 55 | 56 | internal init( 57 | name: Notification.Name, 58 | decode: (([AnyHashable: Any]) throws -> Value)? 59 | ) { 60 | self.raw = name 61 | self.decode = decode 62 | super.init() 63 | } 64 | } 65 | 66 | @available(iOS, deprecated: 10) 67 | @available(watchOS, deprecated: 3) 68 | @available(tvOS, deprecated: 10) 69 | @available(OSX, deprecated: 10.10) 70 | public final class Observer { 71 | 72 | private(set) weak var center: NotificationCenter? 73 | let raw: NSObjectProtocol 74 | 75 | init(center: NotificationCenter, raw: NSObjectProtocol) { 76 | self.center = center 77 | self.raw = raw 78 | } 79 | } 80 | 81 | @available(iOS, deprecated: 10) 82 | @available(watchOS, deprecated: 3) 83 | @available(tvOS, deprecated: 10) 84 | @available(OSX, deprecated: 10.10) 85 | public class ObserverPool { 86 | private(set) var observers: [Observer] = [] 87 | private(set) var mutex: pthread_mutex_t = pthread_mutex_t() 88 | 89 | public init() { 90 | pthread_mutex_init(&mutex, nil) 91 | } 92 | 93 | deinit { 94 | pthread_mutex_lock(&mutex) 95 | observers.forEach { 96 | $0.invalidate() 97 | } 98 | observers.removeAll() 99 | pthread_mutex_unlock(&mutex) 100 | pthread_mutex_destroy(&mutex) 101 | } 102 | 103 | func adding(_ observer: Observer) { 104 | pthread_mutex_lock(&mutex) 105 | observers = Array([observers, [observer]].joined()) 106 | pthread_mutex_unlock(&mutex) 107 | } 108 | } 109 | 110 | public struct InvalidUserInfError: Swift.Error { 111 | public let message: String 112 | public let userInfo: [AnyHashable: Any]? 113 | } 114 | } 115 | 116 | extension Notice.Name where Value == Void { 117 | 118 | public convenience init(_ name: Notification.Name) { 119 | self.init(name: name, decode: nil) 120 | } 121 | } 122 | 123 | // MARK: - Notice.Center 124 | 125 | extension Notice.Center { 126 | 127 | enum Const { 128 | static let infoKey = "noice-info-key" 129 | } 130 | 131 | public func post(name: Notice.Name, with value: Value, from object: Any? = nil) { 132 | let userInfo: [AnyHashable : Any] = [Const.infoKey : value] 133 | center.post(name: name.raw, object: object, userInfo: userInfo) 134 | } 135 | 136 | public func post(name: Notice.Name, from object: Any? = nil) { 137 | center.post(name: name.raw, object: object, userInfo: nil) 138 | } 139 | 140 | @available(iOS, deprecated: 10) 141 | @available(watchOS, deprecated: 3) 142 | @available(tvOS, deprecated: 10) 143 | @available(OSX, deprecated: 10.10) 144 | public func observe(name: Notice.Name, 145 | object: Any? = nil, 146 | queue: OperationQueue? = nil, 147 | using: @escaping (Value) -> Void) -> Notice.Observer { 148 | let observer = center.addObserver(forName: name.raw, object: object, queue: queue) { notification in 149 | guard let userInfo = notification.userInfo else { 150 | return 151 | } 152 | 153 | if let decode = name.decode, let value = try? decode(userInfo) { 154 | using(value) 155 | } else if let value = notification.userInfo?[Const.infoKey] as? Value { 156 | using(value) 157 | } 158 | } 159 | return Notice.Observer(center: center, raw: observer) 160 | } 161 | 162 | @available(iOS, deprecated: 10) 163 | @available(watchOS, deprecated: 3) 164 | @available(tvOS, deprecated: 10) 165 | @available(OSX, deprecated: 10.10) 166 | public func observe( 167 | name: Notice.Name, 168 | object: Any? = nil, 169 | queue: OperationQueue? = nil, 170 | using: @escaping () -> Void 171 | ) -> Notice.Observer { 172 | let observer = center.addObserver(forName: name.raw, object: object, queue: queue) { _ in 173 | using() 174 | } 175 | return Notice.Observer(center: center, raw: observer) 176 | } 177 | 178 | #if canImport(Combine) 179 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 180 | public func publisher( 181 | for name: Notice.Name, 182 | object: AnyObject? = nil 183 | ) -> AnyPublisher { 184 | center 185 | .publisher(for: name.raw, object: object) 186 | .setFailureType(to: Notice.InvalidUserInfError.self) 187 | .flatMap { notification -> AnyPublisher in 188 | guard let userInfo = notification.userInfo else { 189 | return Fail( 190 | error: Notice.InvalidUserInfError( 191 | message: "userInfo is nil", 192 | userInfo: notification.userInfo 193 | ) 194 | ).eraseToAnyPublisher() 195 | } 196 | 197 | if let decode = name.decode, let value = try? decode(userInfo) { 198 | return Just(value) 199 | .setFailureType(to: Notice.InvalidUserInfError.self) 200 | .eraseToAnyPublisher() 201 | } else if let value = notification.userInfo?[Const.infoKey] as? Value { 202 | return Just(value) 203 | .setFailureType(to: Notice.InvalidUserInfError.self) 204 | .eraseToAnyPublisher() 205 | } else { 206 | return Fail( 207 | error: Notice.InvalidUserInfError( 208 | message: "info-key not found in userInfo", 209 | userInfo: notification.userInfo 210 | ) 211 | ).eraseToAnyPublisher() 212 | } 213 | } 214 | .eraseToAnyPublisher() 215 | } 216 | 217 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 218 | public func publisher( 219 | for name: Notice.Name, 220 | object: AnyObject? = nil 221 | ) -> AnyPublisher { 222 | center 223 | .publisher(for: name.raw, object: object) 224 | .map { _ in } 225 | .eraseToAnyPublisher() 226 | } 227 | #endif 228 | 229 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 230 | public func notifications( 231 | named name: Notice.Name, 232 | object: AnyObject? = nil 233 | ) -> AsyncThrowingPublisher> { 234 | AsyncThrowingPublisher(publisher(for: name, object: object)) 235 | } 236 | 237 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 238 | public func notifications( 239 | named name: Notice.Name, 240 | object: AnyObject? = nil 241 | ) -> AsyncPublisher> { 242 | AsyncPublisher(publisher(for: name, object: object)) 243 | } 244 | } 245 | 246 | // MARK: - Notice.Observer 247 | 248 | @available(iOS, deprecated: 10) 249 | @available(watchOS, deprecated: 3) 250 | @available(tvOS, deprecated: 10) 251 | @available(OSX, deprecated: 10.10) 252 | extension Notice.Observer { 253 | public func invalidate() { 254 | center?.removeObserver(raw) 255 | } 256 | 257 | public func invalidated(by pool: Notice.ObserverPool) { 258 | pool.adding(self) 259 | } 260 | } 261 | 262 | // MARK: - NotificationCenter extension 263 | 264 | extension Notice { 265 | public struct Extension { 266 | let base: Notice.Center 267 | } 268 | } 269 | 270 | extension NotificationCenter { 271 | public var nok: Notice.Extension { 272 | return Notice.Extension(base: Notice.Center(center: self)) 273 | } 274 | } 275 | 276 | extension Notice.Extension { 277 | public func post(name: Notice.Name, with value: Value, from object: Any? = nil) { 278 | base.post(name: name, with: value, from: object) 279 | } 280 | 281 | public func post(name: Notice.Name, from object: Any? = nil) { 282 | base.post(name: name, from: object) 283 | } 284 | 285 | @available(iOS, deprecated: 10) 286 | @available(watchOS, deprecated: 3) 287 | @available(tvOS, deprecated: 10) 288 | @available(OSX, deprecated: 10.10) 289 | public func observe(name: Notice.Name, 290 | object: Any? = nil, 291 | queue: OperationQueue? = nil, 292 | using: @escaping (Value) -> Void) -> Notice.Observer { 293 | return base.observe(name: name, 294 | object: object, 295 | queue: queue, using: using) 296 | } 297 | 298 | @available(iOS, deprecated: 10) 299 | @available(watchOS, deprecated: 3) 300 | @available(tvOS, deprecated: 10) 301 | @available(OSX, deprecated: 10.10) 302 | public func observe( 303 | name: Notice.Name, 304 | object: Any? = nil, 305 | queue: OperationQueue? = nil, 306 | using: @escaping () -> Void 307 | ) -> Notice.Observer { 308 | base.observe(name: name, object: object, queue: queue, using: using) 309 | } 310 | 311 | 312 | #if canImport(Combine) 313 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 314 | public func publisher( 315 | for name: Notice.Name, 316 | object: AnyObject? = nil 317 | ) -> AnyPublisher { 318 | base.publisher(for: name, object: object) 319 | } 320 | 321 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 322 | public func publisher( 323 | for name: Notice.Name, 324 | object: AnyObject? = nil 325 | ) -> AnyPublisher { 326 | base.publisher(for: name, object: object) 327 | } 328 | #endif 329 | 330 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 331 | public func notifications( 332 | named name: Notice.Name, 333 | object: AnyObject? = nil 334 | ) -> AsyncThrowingPublisher> { 335 | base.notifications(named: name, object: object) 336 | } 337 | 338 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 339 | public func notifications( 340 | named name: Notice.Name, 341 | object: AnyObject? = nil 342 | ) -> AsyncPublisher> { 343 | base.notifications(named: name, object: object) 344 | } 345 | } 346 | -------------------------------------------------------------------------------- /NoticeObserveKit/NoticeObserveKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // NoticeObserveKit.h 3 | // NoticeObserveKit 4 | // 5 | // Created by marty-suzuki on 2019/02/16. 6 | // Copyright © 2019 marty-suzuki. All rights reserved. 7 | // 8 | 9 | #import "TargetConditionals.h" 10 | 11 | #if TARGET_OS_WATCH 12 | #import 13 | #elif TARGET_OS_IOS || TARGET_OS_TV 14 | #import 15 | #else 16 | #import 17 | #endif 18 | 19 | 20 | 21 | //! Project version number for NoticeObserveKit. 22 | FOUNDATION_EXPORT double NoticeObserveKitVersionNumber; 23 | 24 | //! Project version string for NoticeObserveKit. 25 | FOUNDATION_EXPORT const unsigned char NoticeObserveKitVersionString[]; 26 | 27 | // In this header, you should import all the public headers of your framework using statements like #import 28 | 29 | 30 | -------------------------------------------------------------------------------- /NoticeObserveKitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NoticeObserveKitTests/NoticeObserveKitTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NoticeObserveKitTests.swift 3 | // NoticeObserveKitTests 4 | // 5 | // Created by marty-suzuki on 2019/02/16. 6 | // Copyright © 2019 marty-suzuki. All rights reserved. 7 | // 8 | 9 | #if canImport(Combine) 10 | import Combine 11 | #endif 12 | import XCTest 13 | @testable import NoticeObserveKit 14 | 15 | class NoticeObserveKitTests: XCTestCase { 16 | 17 | func testSingleCenter() { 18 | let name = "test-notification" 19 | let noticeName = Notice.Name(name: name) 20 | let center = Notice.Center() 21 | let intValue = Int.random(in: Int.min...Int.max) 22 | 23 | var called = false 24 | let observer = center.observe(name: noticeName) { receiving in 25 | XCTAssertEqual(intValue, receiving) 26 | called = true 27 | } 28 | 29 | center.post(name: noticeName, with: intValue) 30 | 31 | XCTAssertTrue(called) 32 | 33 | observer.invalidate() 34 | } 35 | 36 | func testMultipleCenter() { 37 | let name = "test-notification" 38 | let noticeName = Notice.Name(name: name) 39 | 40 | let center1 = Notice.Center() 41 | let center2 = Notice.Center() 42 | let intValue = Int.random(in: Int.min...Int.max) 43 | 44 | var called1 = false 45 | let observer1 = center1.observe(name: noticeName) { receiving in 46 | XCTAssertEqual(intValue, receiving) 47 | called1 = true 48 | } 49 | 50 | var called2 = false 51 | let observer2 = center2.observe(name: noticeName) { receiving in 52 | called2 = true 53 | } 54 | 55 | center1.post(name: noticeName, with: intValue) 56 | 57 | XCTAssertTrue(called1) 58 | XCTAssertFalse(called2) 59 | 60 | observer1.invalidate() 61 | observer2.invalidate() 62 | } 63 | 64 | func testSingleCenterAndMultipleName() { 65 | let noticeName1 = Notice.Name(name: "test-notification1") 66 | let noticeName2 = Notice.Name(name: "test-notification2") 67 | 68 | let center = Notice.Center() 69 | let intValue = Int.random(in: Int.min...Int.max) 70 | 71 | var calledCount: Int = 0 72 | let observer = center.observe(name: noticeName1) { receiving in 73 | XCTAssertEqual(intValue, receiving) 74 | calledCount += 1 75 | } 76 | 77 | center.post(name: noticeName1, with: intValue) 78 | center.post(name: noticeName2, with: intValue) 79 | 80 | XCTAssertEqual(calledCount, 1) 81 | 82 | observer.invalidate() 83 | } 84 | 85 | func testInvalidate() { 86 | let name = "test-notification" 87 | let noticeName = Notice.Name(name: name) 88 | let center = Notice.Center() 89 | let intValue = Int.random(in: Int.min...Int.max) 90 | 91 | var calledCount: Int = 0 92 | let observer = center.observe(name: noticeName) { _ in 93 | calledCount += 1 94 | } 95 | 96 | center.post(name: noticeName, with: intValue) 97 | observer.invalidate() 98 | center.post(name: noticeName, with: intValue) 99 | 100 | XCTAssertEqual(calledCount, 1) 101 | } 102 | 103 | func testInvalidatedByObserverPool() { 104 | let name = "test-notification" 105 | let noticeName = Notice.Name(name: name) 106 | let center = Notice.Center() 107 | let intValue = Int.random(in: Int.min...Int.max) 108 | 109 | var pool = Notice.ObserverPool() 110 | var calledCount: Int = 0 111 | center.observe(name: noticeName) { _ in 112 | calledCount += 1 113 | }.invalidated(by: pool) 114 | 115 | center.post(name: noticeName, with: intValue) 116 | pool = Notice.ObserverPool() 117 | center.post(name: noticeName, with: intValue) 118 | 119 | XCTAssertEqual(calledCount, 1) 120 | } 121 | 122 | func testNotificationCenterExtension() { 123 | let name = "test-notification" 124 | let noticeName = Notice.Name(name: name) 125 | let center = NotificationCenter() 126 | let intValue = Int.random(in: Int.min...Int.max) 127 | 128 | var called = false 129 | let observer = center.nok.observe(name: noticeName) { receiving in 130 | XCTAssertEqual(intValue, receiving) 131 | called = true 132 | } 133 | 134 | center.nok.post(name: noticeName, with: intValue) 135 | 136 | XCTAssertTrue(called) 137 | 138 | observer.invalidate() 139 | } 140 | 141 | #if canImport(Combine) 142 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 143 | func testPublisherForValue() { 144 | let name = "test-notification" 145 | let noticeName = Notice.Name(name: name) 146 | let center = NotificationCenter() 147 | let intValue = Int.random(in: Int.min...Int.max) 148 | 149 | var called = false 150 | let cancellable = center.nok.publisher(for: noticeName) 151 | .sink( 152 | receiveCompletion: { _ in }, 153 | receiveValue: { receiving in 154 | XCTAssertEqual(intValue, receiving) 155 | called = true 156 | } 157 | ) 158 | 159 | center.nok.post(name: noticeName, with: intValue) 160 | 161 | XCTAssertTrue(called) 162 | 163 | cancellable.cancel() 164 | } 165 | 166 | @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) 167 | func testPublisherForVoid() { 168 | let name = "test-notification" 169 | let noticeName = Notice.Name(name: name) 170 | let center = NotificationCenter() 171 | 172 | var called = false 173 | let cancellable = center.nok.publisher(for: noticeName) 174 | .sink { 175 | called = true 176 | } 177 | 178 | center.nok.post(name: noticeName) 179 | 180 | XCTAssertTrue(called) 181 | 182 | cancellable.cancel() 183 | } 184 | #endif 185 | 186 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 187 | func testSwiftConcurrencyForValue() async throws { 188 | let name = "test-notification" 189 | let noticeName = Notice.Name(name: name) 190 | let center = NotificationCenter() 191 | let intValue = Int.random(in: Int.min...Int.max) 192 | 193 | var iterator = center.nok.notifications(named: noticeName).makeAsyncIterator() 194 | 195 | Task.detached(priority: .low) { 196 | center.nok.post(name: noticeName, with: intValue) 197 | } 198 | 199 | let receiving = try await iterator.next() 200 | XCTAssertEqual(intValue, receiving) 201 | } 202 | 203 | @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *) 204 | func testSwiftConcurrencyForVoid() async { 205 | let name = "test-notification" 206 | let noticeName = Notice.Name(name: name) 207 | let center = NotificationCenter() 208 | 209 | var iterator = center.nok.notifications(named: noticeName).makeAsyncIterator() 210 | 211 | Task.detached(priority: .low) { 212 | center.nok.post(name: noticeName) 213 | } 214 | 215 | let value: Void? = await iterator.next() 216 | XCTAssertNotNil(value) 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NoticeObserveKit 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/NoticeObserveKit.svg?style=flat)](http://cocoapods.org/pods/NoticeObserveKit) 4 | [![License](https://img.shields.io/cocoapods/l/NoticeObserveKit.svg?style=flat)](http://cocoapods.org/pods/NoticeObserveKit) 5 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 6 | [![Platform](https://img.shields.io/cocoapods/p/NoticeObserveKit.svg?style=flat)](http://cocoapods.org/pods/NoticeObserveKit) 7 | 8 | NoticeObserveKit is type-safe NotificationCenter wrapper. 9 | 10 | Swift Concurrency (since macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0) 11 | 12 | ```swift 13 | Task { 14 | // .keyboardWillShow is a static property. 15 | for try await keyboardInfo in NotificationCenter.default.nok.notifications(named: .keyboardWillShow) { 16 | // In this case, keyboardInfo is UIKeyboardInfo type. 17 | // It is inferred from a generic parameter of Notice.Name. 18 | print(keyboardInfo) 19 | } 20 | } 21 | ``` 22 | 23 | Combine (since macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0) 24 | 25 | ```swift 26 | // .keyboardWillShow is a static property. 27 | NotificationCenter.default.nok.publisher(for: .keyboardWillShow) 28 | .sink( 29 | receiveCompletion: { _ in }, 30 | receiveValue: { keyboardInfo in 31 | // In this case, keyboardInfo is UIKeyboardInfo type. 32 | // It is inferred from a generic parameter of Notice.Name. 33 | print(keyboardInfo) 34 | } 35 | ) 36 | .store(in: &cancellables) 37 | ``` 38 | 39 | NoticeObserveKit original 40 | 41 | ```swift 42 | // .keyboardWillShow is a static property. 43 | NotificationCenter.default.nok.observe(name: .keyboardWillShow) { keyboardInfo in 44 | // In this case, keyboardInfo is UIKeyboardInfo type. 45 | // It is inferred from a generic parameter of Notice.Name. 46 | print(keyboardInfo) 47 | } 48 | // pool is Notice.ObserverPool. 49 | // If pool is released, Notice.Observes are automatically removed. 50 | .invalidated(by: pool) 51 | ``` 52 | 53 | ## Usage 54 | 55 | First of all, you need to implement `Notice.Name` like this. 56 | `T` is type of value in notification.userInfo. 57 | 58 | ```swift 59 | extension Notice.Names { 60 | static let keyboardWillShow = Notice.Name( 61 | UIResponder.keyboardWillShowNotification 62 | ) { userInfo in 63 | // Implementing decode is only required if you want to use an already defined Notification.Name (e.g. UIResponder.keyboardWillShowNotification). 64 | guard 65 | let frame = (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, 66 | let duration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval, 67 | let curve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? UInt 68 | else { 69 | throw DecodeError() 70 | } 71 | 72 | return UIKeyboardInfo( 73 | frame: frame, 74 | animationDuration: duration, 75 | animationCurve: UIViewAnimationOptions(rawValue: curve) 76 | ) 77 | } 78 | } 79 | ``` 80 | 81 | ## Customization 82 | 83 | If you can post custom Notification like this. 84 | 85 | ```swift 86 | extension Notice.Names { 87 | // If you define your own custom Notification.Name, no implementation of decode is required. 88 | static let navigationControllerDidShow = Notice.Name(name: "navigationControllerDidShow") 89 | } 90 | 91 | let content = NavigationControllerContent(viewController: viewController, animated: animated) 92 | NotificationCenter.default.nok.post(name: .navigationControllerDidShow, value: content) 93 | ``` 94 | 95 | You can invalidate manually like this. 96 | 97 | ```swift 98 | let observer = NotificationCenter.default.nok.observe(name: .keyboardWillShow) { keyboardInfo in 99 | print(keyboardInfo) 100 | } 101 | observer.invalidate() 102 | ``` 103 | 104 | ## Sample 105 | 106 | ```swift 107 | import UIKit 108 | import NoticeObserveKit 109 | 110 | class ViewController: UIViewController { 111 | private let searchBar = UISearchBar(frame: .zero) 112 | private lazy var keyboardNotificationTasks: [Task] = [ 113 | Task { 114 | for try await value in NotificationCenter.default.nok.notifications(named: .keyboardWillShow) { 115 | print("UIKeyboard will show = \(value)") 116 | } 117 | }, 118 | Task { 119 | for try await value in NotificationCenter.default.nok.notifications(named: .keyboardWillHide) { 120 | print("UIKeyboard will hide = \(value)") 121 | } 122 | } 123 | ] 124 | 125 | override func viewDidLoad() { 126 | super.viewDidLoad() 127 | // Do any additional setup after loading the view, typically from a nib. 128 | navigationItem.titleView = searchBar 129 | 130 | configureObservers() 131 | } 132 | 133 | private func configureObservers() { 134 | _ = keyboardNotificationTasks 135 | } 136 | } 137 | ``` 138 | 139 | ## Requirements 140 | 141 | - Swift 5 142 | - Xcode 15.0 or greater 143 | - iOS 10.0 or greater 144 | - tvOS 10.0 or greater 145 | - macOS 10.10 or greater 146 | - watchOS 3.0 or greater 147 | 148 | ## Installation 149 | 150 | #### CocoaPods 151 | 152 | NoticeObserveKit is available through [CocoaPods](http://cocoapods.org). To install 153 | it, simply add the following line to your Podfile: 154 | 155 | ```ruby 156 | pod "NoticeObserveKit" 157 | ``` 158 | 159 | #### Carthage 160 | 161 | If you’re using [Carthage](https://github.com/Carthage/Carthage), simply add 162 | NoticeObserveKit to your `Cartfile`: 163 | 164 | ``` 165 | github "marty-suzuki/NoticeObserveKit" 166 | ``` 167 | 168 | Make sure to add `NoticeObserveKit.framework` to "Linked Frameworks and Libraries" and "copy-frameworks" Build Phases. 169 | 170 | ## Author 171 | 172 | marty-suzuki, s1180183@gmail.com 173 | 174 | ## License 175 | 176 | NoticeObserveKit is available under the MIT license. See the LICENSE file for more info. 177 | -------------------------------------------------------------------------------- /documents/v0_4_0.md: -------------------------------------------------------------------------------- 1 | ## Usage below v0.4.0 2 | 3 | First of all, you need to implement `InfoType` and `name` with `NoticeType` protocol. 4 | `InfoType` means value type of element in `userInfo` of `Notification`. 5 | 6 | ```swift 7 | struct UIKeyboardWillShow: NoticeType { 8 | typealias InfoType = UIKeyboardInfo 9 | static let name: Notification.Name = .UIKeyboardWillShow 10 | } 11 | ``` 12 | 13 | If you define custom object as `InfoType`, you need to implement that with `NoticeUserInfoDecodable` protocol. To confirm this protocol, you must implement `init?(info: [AnyHashable : Any])` and `func dictionaryRepresentation() -> [AnyHashable : Any]`. 14 | 15 | ```swift 16 | struct UIKeyboardInfo: NoticeUserInfoDecodable { 17 | let frame: CGRect 18 | let animationDuration: TimeInterval 19 | let animationCurve: UIViewAnimationOptions 20 | 21 | init?(info: [AnyHashable : Any]) { 22 | guard 23 | let frame = (info[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, 24 | let duration = info[UIKeyboardAnimationDurationUserInfoKey] as? TimeInterval, 25 | let curve = info[UIKeyboardAnimationCurveUserInfoKey] as? UInt 26 | else { 27 | return nil 28 | } 29 | self.frame = frame 30 | self.animationDuration = duration 31 | self.animationCurve = UIViewAnimationOptions(rawValue: curve) 32 | } 33 | } 34 | ``` 35 | 36 | ## Customization 37 | 38 | If you want to receive `Notification`, you can use receiving parameter. 39 | 40 | ```swift 41 | UIKeyboardWillShow.observe(recieving: { notification in 42 | print(notification) 43 | }) { keyboardInfo in 44 | print(keyboardInfo) 45 | }.addObserverTo(pool) 46 | ``` 47 | 48 | If you want to get specific value from `userInfo` of `Notification`, please implement `infoKey`. 49 | 50 | ```swift 51 | struct UIKeyboardWillShow: NoticeType { 52 | typealias InfoType = NSValue 53 | static let infoKey: String = UIKeyboardFrameEndUserInfoKey 54 | static let name: Notification.Name = .UIKeyboardWillShow 55 | } 56 | ``` 57 | 58 | If you can post custom Notification like this. 59 | 60 | ```swift 61 | struct NavigationControllerDidShow: NoticeType { 62 | typealias InfoType = NavigationControllerContent 63 | static var name = Notification.Name("navigationControllerDidShow") 64 | } 65 | 66 | let content = NavigationControllerContent(viewController: viewController, animated: animated) 67 | NavigationControllerWillShow.post(info: content) 68 | ``` 69 | 70 | You can dispose manually like this. 71 | 72 | ```swift 73 | let observer = UIKeyboardWillShow.observe { keyboardInfo in 74 | print(keyboardInfo) 75 | } 76 | 77 | observer.dispose() 78 | ``` 79 | 80 | ## Sample 81 | 82 | ```swift 83 | import UIKit 84 | import NoticeObserveKit 85 | 86 | class ViewController: UIViewController { 87 | private let searchBar = UISearchBar(frame: .zero) 88 | private var pool = NoticeObserverPool() 89 | 90 | override func viewDidLoad() { 91 | super.viewDidLoad() 92 | // Do any additional setup after loading the view, typically from a nib. 93 | navigationItem.titleView = searchBar 94 | 95 | configureObservers() 96 | } 97 | 98 | private func configureObservers() { 99 | UIKeyboardWillShow.observe { [unowned self] in 100 | print("UIKeyboard will show = \($0)") 101 | }.addObserverTo(pool) 102 | 103 | UIKeyboardWillHide.observe { [unowned self] in 104 | print("UIKeyboard will hide = \($0)") 105 | }.addObserverTo(pool) 106 | } 107 | } 108 | ``` 109 | --------------------------------------------------------------------------------