├── logo.png ├── Example ├── Example │ ├── Example-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── first.imageset │ │ │ ├── first.pdf │ │ │ └── Contents.json │ │ ├── second.imageset │ │ │ ├── second.pdf │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── SecondViewController.swift │ ├── ThirdViewController.swift │ ├── FirstViewController.swift │ ├── NotificationProtocol.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── AppDelegate.swift │ └── Main.storyboard └── Example.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ └── project.pbxproj ├── SwiftNotificationCenter.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ └── SwiftNotificationCenter.xcscheme └── project.pbxproj ├── SwiftNotificationCenter ├── SwiftNotificationCenter.h ├── Info.plist ├── WeakObjectSet.swift └── SwiftNotificationCenter.swift ├── SwiftNotificationCenter.podspec ├── SwiftNotificationCenterTests ├── Info.plist └── SwiftNotificationCenterTests.swift ├── LICENSE.txt ├── README.md └── .gitignore /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/100mango/SwiftNotificationCenter/HEAD/logo.png -------------------------------------------------------------------------------- /Example/Example/Example-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/first.imageset/first.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/100mango/SwiftNotificationCenter/HEAD/Example/Example/Assets.xcassets/first.imageset/first.pdf -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/second.imageset/second.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/100mango/SwiftNotificationCenter/HEAD/Example/Example/Assets.xcassets/second.imageset/second.pdf -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/first.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "first.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/second.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "second.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /SwiftNotificationCenter.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/SecondViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecondViewController.swift 3 | // SwiftNotificationCenterExample 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SecondViewController: UIViewController, UpdateTitle { 12 | 13 | @IBOutlet weak var titleLabel: UILabel! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | Broadcaster.register(UpdateTitle.self, observer: self) 18 | } 19 | 20 | func updateWithNewTitle(title: String) { 21 | titleLabel.text = title 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Example/Example/ThirdViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThirdViewController.swift 3 | // SwiftNotificationCenterExample 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ThirdViewController: UIViewController, UpdateTitle { 12 | 13 | @IBOutlet weak var titleLabel: UILabel! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | Broadcaster.register(UpdateTitle.self, observer: self) 18 | } 19 | 20 | func updateWithNewTitle(title: String) { 21 | titleLabel.text = title 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SwiftNotificationCenter/SwiftNotificationCenter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftNotificationCenter.h 3 | // SwiftNotificationCenter 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SwiftNotificationCenter. 12 | FOUNDATION_EXPORT double SwiftNotificationCenterVersionNumber; 13 | 14 | //! Project version string for SwiftNotificationCenter. 15 | FOUNDATION_EXPORT const unsigned char SwiftNotificationCenterVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SwiftNotificationCenter.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "SwiftNotificationCenter" 3 | s.version = "1.0.5" 4 | s.summary = "A Type Safe, Thread Safe, ARC Safe Protocol Oriented NotificationCenter" 5 | s.homepage = "https://github.com/100mango/SwiftNotificationCenter" 6 | s.license = { :type => 'MIT', :file => 'LICENSE.txt' } 7 | s.author = { "100mango" => "https://github.com/100mango" } 8 | s.ios.deployment_target = "8.0" 9 | s.osx.deployment_target = "10.9" 10 | s.source = { :git => "https://github.com/100mango/SwiftNotificationCenter.git", :tag => s.version } 11 | s.source_files = "SwiftNotificationCenter/*.swift" 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /SwiftNotificationCenterTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SwiftNotificationCenter/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 100mango 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Example/Example/FirstViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirstViewController.swift 3 | // SwiftNotificationCenterExample 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FirstViewController: UIViewController, UpdateTitle { 12 | 13 | @IBOutlet weak var titleLabel: UILabel! 14 | @IBOutlet weak var textField: UITextField! 15 | 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | Broadcaster.register(UpdateTitle.self, observer: self) 20 | Broadcaster.register(UIKeyboardManage.self, observer: self) 21 | } 22 | 23 | func updateWithNewTitle(title: String) { 24 | titleLabel.text = title 25 | } 26 | 27 | @IBAction func updateTitle(sender: UIButton) { 28 | Broadcaster.notify(UpdateTitle.self) { 29 | $0.updateWithNewTitle(title: self.textField.text ?? "") 30 | } 31 | } 32 | 33 | } 34 | 35 | extension FirstViewController: UIKeyboardManage { 36 | func UIKeyboardWillShow(beginFrame: CGRect, endFrame: CGRect) { 37 | print("beginFrame:\(beginFrame)") 38 | print("endFrame:\(endFrame)") 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "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/Example/NotificationProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationProtocol.swift 3 | // SwiftNotificationCenterExample 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol UpdateTitle: class { 12 | 13 | func updateWithNewTitle(title: String) 14 | 15 | } 16 | 17 | protocol UIKeyboardManage { 18 | func UIKeyboardWillShow(beginFrame: CGRect, endFrame: CGRect) 19 | } 20 | 21 | 22 | class UIKeyboardSystemNotifictionMediator { 23 | 24 | static let mediator = UIKeyboardSystemNotifictionMediator() 25 | 26 | 27 | @objc func handleKeyboardNotification(notification: NSNotification) { 28 | guard notification.name == UIResponder.keyboardWillShowNotification 29 | else { return } 30 | 31 | guard let beginFrame = (notification 32 | .userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue 33 | else { return } 34 | 35 | guard let endFrame = (notification 36 | .userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue 37 | else { return } 38 | 39 | Broadcaster.notify(UIKeyboardManage.self) { 40 | $0.UIKeyboardWillShow(beginFrame: beginFrame, endFrame: endFrame) 41 | } 42 | } 43 | 44 | static let register: () = { 45 | NotificationCenter.default.addObserver(mediator, selector: #selector(handleKeyboardNotification(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) 46 | }() 47 | 48 | } 49 | -------------------------------------------------------------------------------- /SwiftNotificationCenterTests/SwiftNotificationCenterTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftNotificationCenterTests.swift 3 | // SwiftNotificationCenterTests 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import SwiftNotificationCenter 11 | 12 | class SwiftNotificationCenterTests: 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 | 25 | func testNotify() { 26 | let object = MockClass() 27 | 28 | Broadcaster.register(MockProtocol.self, observer: object) 29 | Broadcaster.notify(MockProtocol.self) { observer in 30 | let string = observer.hello() 31 | XCTAssertTrue(string == "hello") 32 | } 33 | } 34 | 35 | func testRemove() { 36 | let object = MockClass() 37 | Broadcaster.register(MockProtocol.self, observer: object) 38 | Broadcaster.unregister(MockProtocol.self, observer: object) 39 | Broadcaster.notify(MockProtocol.self) { observer in 40 | XCTFail() 41 | } 42 | XCTAssertTrue(true) 43 | } 44 | } 45 | 46 | protocol MockProtocol { 47 | func hello() -> String 48 | } 49 | 50 | extension MockProtocol { 51 | func hello() -> String { 52 | return "hello" 53 | } 54 | } 55 | 56 | class MockClass: MockProtocol { 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/Example/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 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationPortraitUpsideDown 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftNotificationCenterExample 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func applicationDidFinishLaunching(_ application: UIApplication) { 17 | UIKeyboardSystemNotifictionMediator.register 18 | } 19 | 20 | func applicationWillResignActive(_ application: UIApplication) { 21 | // 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. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | func applicationDidEnterBackground(_ application: UIApplication) { 26 | // 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. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | func applicationWillEnterForeground(_ application: UIApplication) { 31 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 32 | } 33 | 34 | func applicationDidBecomeActive(_ application: UIApplication) { 35 | // 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. 36 | } 37 | 38 | func applicationWillTerminate(_ application: UIApplication) { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SwiftNotificationCenter/WeakObjectSet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WeakObjectSet.swift 3 | // SwiftNotificationCenter 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct WeakObject: Equatable, Hashable { 12 | private let identifier: ObjectIdentifier 13 | weak var object: T? 14 | init(_ object: T) { 15 | self.object = object 16 | self.identifier = ObjectIdentifier(object) 17 | } 18 | 19 | func hash(into hasher: inout Hasher) { 20 | hasher.combine(self.identifier) 21 | } 22 | 23 | static func == (lhs: WeakObject, rhs: WeakObject) -> Bool { 24 | return lhs.identifier == rhs.identifier 25 | } 26 | } 27 | 28 | struct WeakObjectSet: Sequence { 29 | 30 | var objects: Set> 31 | 32 | init() { 33 | self.objects = Set>([]) 34 | } 35 | 36 | init(_ object: T) { 37 | self.objects = Set>([WeakObject(object)]) 38 | } 39 | 40 | init(_ objects: [T]) { 41 | self.objects = Set>(objects.map { WeakObject($0) }) 42 | } 43 | 44 | var allObjects: [T] { 45 | return objects.compactMap { $0.object } 46 | } 47 | 48 | func contains(_ object: T) -> Bool { 49 | return self.objects.contains(WeakObject(object)) 50 | } 51 | 52 | mutating func add(_ object: T) { 53 | //prevent ObjectIdentifier be reused 54 | if self.contains(object) { 55 | self.remove(object) 56 | } 57 | self.objects.insert(WeakObject(object)) 58 | } 59 | 60 | mutating func add(_ objects: [T]) { 61 | objects.forEach { self.add($0) } 62 | } 63 | 64 | mutating func remove(_ object: T) { 65 | self.objects.remove(WeakObject(object)) 66 | } 67 | 68 | mutating func remove(_ objects: [T]) { 69 | objects.forEach { self.remove($0) } 70 | } 71 | 72 | func makeIterator() -> AnyIterator { 73 | let objects = self.allObjects 74 | var index = 0 75 | return AnyIterator { 76 | defer { index += 1 } 77 | return index < objects.count ? objects[index] : nil 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SwiftNotificationCenter/SwiftNotificationCenter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftNotificationCenter.swift 3 | // SwiftNotificationCenter 4 | // 5 | // Created by Mango on 16/5/5. 6 | // Copyright © 2016年 Mango. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class Broadcaster { 12 | 13 | fileprivate static var observersDic = [String: Any]() 14 | 15 | fileprivate static let notificationQueue = DispatchQueue(label: "com.swift.notification.center.dispatch.queue", attributes: .concurrent) 16 | 17 | 18 | public static func register(_ protocolType: T.Type, observer: T) { 19 | let key = "\(protocolType)" 20 | safeSet(key: key, object: observer as AnyObject) 21 | } 22 | 23 | public static func unregister(_ protocolType: T.Type, observer: T) { 24 | let key = "\(protocolType)" 25 | safeRemove(key: key, object: observer as AnyObject) 26 | } 27 | 28 | 29 | /// Remove all observers which comform to the protocol 30 | public static func unregister(_ protocolType: T.Type) { 31 | let key = "\(protocolType)" 32 | safeRemove(key: key) 33 | } 34 | 35 | public static func notify(_ protocolType: T.Type, block: (T) -> Void ) { 36 | 37 | let key = "\(protocolType)" 38 | guard let objectSet = safeGetObjectSet(key: key) else { 39 | return 40 | } 41 | 42 | for observer in objectSet { 43 | if let observer = observer as? T { 44 | block(observer) 45 | } 46 | } 47 | } 48 | } 49 | 50 | private extension Broadcaster { 51 | 52 | static func safeSet(key: String, object: AnyObject) { 53 | notificationQueue.async(flags: .barrier) { 54 | if var set = observersDic[key] as? WeakObjectSet { 55 | set.add(object) 56 | observersDic[key] = set 57 | }else{ 58 | observersDic[key] = WeakObjectSet(object) 59 | } 60 | } 61 | } 62 | 63 | static func safeRemove(key: String, object: AnyObject) { 64 | notificationQueue.async(flags: .barrier) { 65 | if var set = observersDic[key] as? WeakObjectSet { 66 | set.remove(object) 67 | observersDic[key] = set 68 | } 69 | } 70 | } 71 | 72 | static func safeRemove(key: String) { 73 | notificationQueue.async(flags: .barrier) { 74 | observersDic.removeValue(forKey: key) 75 | } 76 | } 77 | 78 | static func safeGetObjectSet(key: String) -> WeakObjectSet? { 79 | var objectSet: WeakObjectSet? 80 | notificationQueue.sync { 81 | objectSet = observersDic[key] as? WeakObjectSet 82 | } 83 | return objectSet 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 |
4 | 5 | ![](http://img.shields.io/badge/Swift-5.0-blue.svg) 6 | 7 | 8 | 9 | A Protocol-Oriented NotificationCenter which is type safe, thread safe and with memory safety. 10 | 11 | - Type Safe 12 | 13 | No more `userInfo` dictionary and Downcasting, just deliver the concrete type value to the observer. 14 | 15 | - Thread Safe 16 | 17 | You can `register`, `notify`, `unregister` in any thread without crash and data corruption. 18 | 19 | - Memory Safety 20 | 21 | `SwiftNotificationCenter` store the observer as a zeroing-weak reference. No crash and no need to `unregister` manually. 22 | 23 | It's simple, safe, lightweight and easy to use for `one-to-many` communication. 24 | 25 | 26 | ## Usage 27 | 28 | Define protocol and observer: 29 | 30 | ~~~swift 31 | protocol Update { 32 | func updateTitle(title: String) 33 | } 34 | 35 | extension ViewController: Update { 36 | func updateTitle(title: String) { 37 | self.titleLabel.text = title 38 | } 39 | } 40 | let vc = ViewController() 41 | ~~~ 42 | 43 | Register: 44 | 45 | ~~~swift 46 | Broadcaster.register(Update.self, observer: vc) 47 | ~~~ 48 | 49 | Broadcast: 50 | 51 | ~~~swift 52 | Broadcaster.notify(Update.self) { 53 | $0.updateTitle("new title") 54 | } 55 | ~~~ 56 | 57 | Unregister: 58 | 59 | ~~~swift 60 | Broadcaster.unregister(Update.self, observer: self) 61 | ~~~ 62 | 63 |
64 | 65 | Compare with `NSNotificationCenter` : 66 | 67 | For example, handle `UIKeyboardWillShowNotification` 68 | 69 | ~~~swift 70 | @objc func handleKeyboardNotification(notification: NSNotification) { 71 | guard notification.name == NSNotification.Name.UIKeyboardWillShow 72 | else { return } 73 | 74 | guard let beginFrame = (notification 75 | .userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue 76 | else { return } 77 | 78 | guard let endFrame = (notification 79 | .userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue 80 | else { return } 81 | // use beginFrame, endFrame 82 | } 83 | ~~~ 84 | 85 | `SwiftNotificationCenter` way: 86 | 87 | ~~~swift 88 | /* 89 | If you want to observe the system built in notifications like this. 90 | You can declare a protocol and the relevant method, and use a singleton as a mediator to observe system's notification, then notify our observers. 91 | Please check the refactor example in SwiftNotificationCenterExample Project. 92 | */ 93 | func UIKeyboardWillShow(beginFrame: CGRect, endFrame: CGRect) { 94 | } 95 | ~~~ 96 | 97 | ## Installation 98 | 99 | CocoaPods: 100 | 101 | ~~~ 102 | pod 'SwiftNotificationCenter' 103 | ~~~ 104 | 105 | Carthage: 106 | 107 | ~~~ 108 | github "100mango/SwiftNotificationCenter" 109 | ~~~ 110 | 111 | Manually: 112 | 113 | Just copy source files in the SwiftNotificationCenter folder into your project. 114 | 115 | 116 | ## License 117 | 118 | `SwiftNotificationCenter` is under the MIT license. 119 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/swift 3 | # Edit at https://www.gitignore.io/?templates=swift 4 | 5 | ### Swift ### 6 | # Xcode 7 | # 8 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 9 | 10 | ## Build generated 11 | build/ 12 | DerivedData/ 13 | 14 | ## Various settings 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata/ 24 | 25 | ## Other 26 | *.moved-aside 27 | *.xccheckout 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | *.dSYM.zip 34 | *.dSYM 35 | 36 | ## Playgrounds 37 | timeline.xctimeline 38 | playground.xcworkspace 39 | 40 | # Swift Package Manager 41 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 42 | # Packages/ 43 | # Package.pins 44 | # Package.resolved 45 | .build/ 46 | 47 | # CocoaPods 48 | # We recommend against adding the Pods directory to your .gitignore. However 49 | # you should judge for yourself, the pros and cons are mentioned at: 50 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 51 | # Pods/ 52 | # Add this line if you want to avoid checking in source code from the Xcode workspace 53 | # *.xcworkspace 54 | 55 | # Carthage 56 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 57 | # Carthage/Checkouts 58 | 59 | Carthage/Build 60 | 61 | # fastlane 62 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 63 | # screenshots whenever they are needed. 64 | # For more information about the recommended setup visit: 65 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 66 | 67 | fastlane/report.xml 68 | fastlane/Preview.html 69 | fastlane/screenshots/**/*.png 70 | fastlane/test_output 71 | 72 | # Code Injection 73 | # After new code Injection tools there's a generated folder /iOSInjectionProject 74 | # https://github.com/johnno1962/injectionforxcode 75 | 76 | iOSInjectionProject/ 77 | 78 | # End of https://www.gitignore.io/api/swift 79 | 80 | 81 | ### Xcode ### 82 | # Xcode 83 | # 84 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 85 | 86 | ## User settings 87 | xcuserdata/ 88 | 89 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 90 | *.xcscmblueprint 91 | *.xccheckout 92 | 93 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 94 | build/ 95 | DerivedData/ 96 | *.moved-aside 97 | *.pbxuser 98 | !default.pbxuser 99 | *.mode1v3 100 | !default.mode1v3 101 | *.mode2v3 102 | !default.mode2v3 103 | *.perspectivev3 104 | !default.perspectivev3 105 | 106 | ### Xcode Patch ### 107 | *.xcodeproj/* 108 | !*.xcodeproj/project.pbxproj 109 | !*.xcodeproj/xcshareddata/ 110 | !*.xcworkspace/contents.xcworkspacedata 111 | /*.gcno 112 | **/xcshareddata/WorkspaceSettings.xcsettings 113 | 114 | # End of https://www.gitignore.io/api/xcode -------------------------------------------------------------------------------- /SwiftNotificationCenter.xcodeproj/xcshareddata/xcschemes/SwiftNotificationCenter.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 | -------------------------------------------------------------------------------- /Example/Example/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 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 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BF7FBC751D7576C000809DB0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF7FBC741D7576C000809DB0 /* Assets.xcassets */; }; 11 | BF7FBC781D7576C000809DB0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF7FBC761D7576C000809DB0 /* LaunchScreen.storyboard */; }; 12 | BF7FBC861D75773900809DB0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC801D75773900809DB0 /* AppDelegate.swift */; }; 13 | BF7FBC871D75773900809DB0 /* NotificationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC811D75773900809DB0 /* NotificationProtocol.swift */; }; 14 | BF7FBC881D75773900809DB0 /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC821D75773900809DB0 /* FirstViewController.swift */; }; 15 | BF7FBC891D75773900809DB0 /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC831D75773900809DB0 /* SecondViewController.swift */; }; 16 | BF7FBC8A1D75773900809DB0 /* ThirdViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC841D75773900809DB0 /* ThirdViewController.swift */; }; 17 | BF7FBC8B1D75773900809DB0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF7FBC851D75773900809DB0 /* Main.storyboard */; }; 18 | BF7FBC8E1D7577BB00809DB0 /* SwiftNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC8C1D7577BB00809DB0 /* SwiftNotificationCenter.swift */; }; 19 | BF7FBC8F1D7577BB00809DB0 /* WeakObjectSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7FBC8D1D7577BB00809DB0 /* WeakObjectSet.swift */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | BF7FBC681D7576C000809DB0 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | BF7FBC741D7576C000809DB0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | BF7FBC771D7576C000809DB0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | BF7FBC791D7576C000809DB0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | BF7FBC7F1D75773800809DB0 /* Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example-Bridging-Header.h"; sourceTree = ""; }; 28 | BF7FBC801D75773900809DB0 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 29 | BF7FBC811D75773900809DB0 /* NotificationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationProtocol.swift; sourceTree = ""; }; 30 | BF7FBC821D75773900809DB0 /* FirstViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; }; 31 | BF7FBC831D75773900809DB0 /* SecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; }; 32 | BF7FBC841D75773900809DB0 /* ThirdViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThirdViewController.swift; sourceTree = ""; }; 33 | BF7FBC851D75773900809DB0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 34 | BF7FBC8C1D7577BB00809DB0 /* SwiftNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftNotificationCenter.swift; path = ../SwiftNotificationCenter/SwiftNotificationCenter.swift; sourceTree = ""; }; 35 | BF7FBC8D1D7577BB00809DB0 /* WeakObjectSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WeakObjectSet.swift; path = ../SwiftNotificationCenter/WeakObjectSet.swift; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | BF7FBC651D7576C000809DB0 /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | BF7FBC5F1D7576C000809DB0 = { 50 | isa = PBXGroup; 51 | children = ( 52 | BF7FBC901D7578D700809DB0 /* SwiftNotificationCenter */, 53 | BF7FBC6A1D7576C000809DB0 /* Example */, 54 | BF7FBC691D7576C000809DB0 /* Products */, 55 | ); 56 | sourceTree = ""; 57 | }; 58 | BF7FBC691D7576C000809DB0 /* Products */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | BF7FBC681D7576C000809DB0 /* Example.app */, 62 | ); 63 | name = Products; 64 | sourceTree = ""; 65 | }; 66 | BF7FBC6A1D7576C000809DB0 /* Example */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | BF7FBC801D75773900809DB0 /* AppDelegate.swift */, 70 | BF7FBC811D75773900809DB0 /* NotificationProtocol.swift */, 71 | BF7FBC821D75773900809DB0 /* FirstViewController.swift */, 72 | BF7FBC831D75773900809DB0 /* SecondViewController.swift */, 73 | BF7FBC841D75773900809DB0 /* ThirdViewController.swift */, 74 | BF7FBC851D75773900809DB0 /* Main.storyboard */, 75 | BF7FBC741D7576C000809DB0 /* Assets.xcassets */, 76 | BF7FBC761D7576C000809DB0 /* LaunchScreen.storyboard */, 77 | BF7FBC791D7576C000809DB0 /* Info.plist */, 78 | BF7FBC7F1D75773800809DB0 /* Example-Bridging-Header.h */, 79 | ); 80 | path = Example; 81 | sourceTree = ""; 82 | }; 83 | BF7FBC901D7578D700809DB0 /* SwiftNotificationCenter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | BF7FBC8C1D7577BB00809DB0 /* SwiftNotificationCenter.swift */, 87 | BF7FBC8D1D7577BB00809DB0 /* WeakObjectSet.swift */, 88 | ); 89 | name = SwiftNotificationCenter; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXNativeTarget section */ 95 | BF7FBC671D7576C000809DB0 /* Example */ = { 96 | isa = PBXNativeTarget; 97 | buildConfigurationList = BF7FBC7C1D7576C000809DB0 /* Build configuration list for PBXNativeTarget "Example" */; 98 | buildPhases = ( 99 | BF7FBC641D7576C000809DB0 /* Sources */, 100 | BF7FBC651D7576C000809DB0 /* Frameworks */, 101 | BF7FBC661D7576C000809DB0 /* Resources */, 102 | ); 103 | buildRules = ( 104 | ); 105 | dependencies = ( 106 | ); 107 | name = Example; 108 | productName = Example; 109 | productReference = BF7FBC681D7576C000809DB0 /* Example.app */; 110 | productType = "com.apple.product-type.application"; 111 | }; 112 | /* End PBXNativeTarget section */ 113 | 114 | /* Begin PBXProject section */ 115 | BF7FBC601D7576C000809DB0 /* Project object */ = { 116 | isa = PBXProject; 117 | attributes = { 118 | LastSwiftUpdateCheck = 0800; 119 | LastUpgradeCheck = 1020; 120 | ORGANIZATIONNAME = mangofang; 121 | TargetAttributes = { 122 | BF7FBC671D7576C000809DB0 = { 123 | CreatedOnToolsVersion = 8.0; 124 | LastSwiftMigration = 1020; 125 | ProvisioningStyle = Automatic; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = BF7FBC631D7576C000809DB0 /* Build configuration list for PBXProject "Example" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = en; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = BF7FBC5F1D7576C000809DB0; 138 | productRefGroup = BF7FBC691D7576C000809DB0 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | BF7FBC671D7576C000809DB0 /* Example */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | BF7FBC661D7576C000809DB0 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | BF7FBC8B1D75773900809DB0 /* Main.storyboard in Resources */, 153 | BF7FBC781D7576C000809DB0 /* LaunchScreen.storyboard in Resources */, 154 | BF7FBC751D7576C000809DB0 /* Assets.xcassets in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | BF7FBC641D7576C000809DB0 /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | BF7FBC891D75773900809DB0 /* SecondViewController.swift in Sources */, 166 | BF7FBC881D75773900809DB0 /* FirstViewController.swift in Sources */, 167 | BF7FBC8A1D75773900809DB0 /* ThirdViewController.swift in Sources */, 168 | BF7FBC8E1D7577BB00809DB0 /* SwiftNotificationCenter.swift in Sources */, 169 | BF7FBC871D75773900809DB0 /* NotificationProtocol.swift in Sources */, 170 | BF7FBC861D75773900809DB0 /* AppDelegate.swift in Sources */, 171 | BF7FBC8F1D7577BB00809DB0 /* WeakObjectSet.swift in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin PBXVariantGroup section */ 178 | BF7FBC761D7576C000809DB0 /* LaunchScreen.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | BF7FBC771D7576C000809DB0 /* Base */, 182 | ); 183 | name = LaunchScreen.storyboard; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | BF7FBC7A1D7576C000809DB0 /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 194 | CLANG_ANALYZER_NONNULL = YES; 195 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 196 | CLANG_CXX_LIBRARY = "libc++"; 197 | CLANG_ENABLE_MODULES = YES; 198 | CLANG_ENABLE_OBJC_ARC = YES; 199 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_COMMA = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INFINITE_RECURSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 212 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 214 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 215 | CLANG_WARN_STRICT_PROTOTYPES = YES; 216 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 217 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 218 | CLANG_WARN_UNREACHABLE_CODE = YES; 219 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 220 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 221 | COPY_PHASE_STRIP = NO; 222 | DEBUG_INFORMATION_FORMAT = dwarf; 223 | ENABLE_STRICT_OBJC_MSGSEND = YES; 224 | ENABLE_TESTABILITY = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_NO_COMMON_BLOCKS = YES; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 240 | MTL_ENABLE_DEBUG_INFO = YES; 241 | ONLY_ACTIVE_ARCH = YES; 242 | SDKROOT = iphoneos; 243 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 244 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 245 | TARGETED_DEVICE_FAMILY = "1,2"; 246 | }; 247 | name = Debug; 248 | }; 249 | BF7FBC7B1D7576C000809DB0 /* Release */ = { 250 | isa = XCBuildConfiguration; 251 | buildSettings = { 252 | ALWAYS_SEARCH_USER_PATHS = NO; 253 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 256 | CLANG_CXX_LIBRARY = "libc++"; 257 | CLANG_ENABLE_MODULES = YES; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 260 | CLANG_WARN_BOOL_CONVERSION = YES; 261 | CLANG_WARN_COMMA = YES; 262 | CLANG_WARN_CONSTANT_CONVERSION = YES; 263 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 266 | CLANG_WARN_EMPTY_BODY = YES; 267 | CLANG_WARN_ENUM_CONVERSION = YES; 268 | CLANG_WARN_INFINITE_RECURSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 271 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 272 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 273 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 274 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 275 | CLANG_WARN_STRICT_PROTOTYPES = YES; 276 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 277 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 278 | CLANG_WARN_UNREACHABLE_CODE = YES; 279 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 280 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 281 | COPY_PHASE_STRIP = NO; 282 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 283 | ENABLE_NS_ASSERTIONS = NO; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu99; 286 | GCC_NO_COMMON_BLOCKS = YES; 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 294 | MTL_ENABLE_DEBUG_INFO = NO; 295 | SDKROOT = iphoneos; 296 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 297 | TARGETED_DEVICE_FAMILY = "1,2"; 298 | VALIDATE_PRODUCT = YES; 299 | }; 300 | name = Release; 301 | }; 302 | BF7FBC7D1D7576C000809DB0 /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | CLANG_ENABLE_MODULES = YES; 307 | INFOPLIST_FILE = Example/Info.plist; 308 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 309 | PRODUCT_BUNDLE_IDENTIFIER = mango.Example; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h"; 312 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 313 | SWIFT_VERSION = 5.0; 314 | }; 315 | name = Debug; 316 | }; 317 | BF7FBC7E1D7576C000809DB0 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 321 | CLANG_ENABLE_MODULES = YES; 322 | INFOPLIST_FILE = Example/Info.plist; 323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 324 | PRODUCT_BUNDLE_IDENTIFIER = mango.Example; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Example/Example-Bridging-Header.h"; 327 | SWIFT_VERSION = 5.0; 328 | }; 329 | name = Release; 330 | }; 331 | /* End XCBuildConfiguration section */ 332 | 333 | /* Begin XCConfigurationList section */ 334 | BF7FBC631D7576C000809DB0 /* Build configuration list for PBXProject "Example" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | BF7FBC7A1D7576C000809DB0 /* Debug */, 338 | BF7FBC7B1D7576C000809DB0 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | BF7FBC7C1D7576C000809DB0 /* Build configuration list for PBXNativeTarget "Example" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | BF7FBC7D1D7576C000809DB0 /* Debug */, 347 | BF7FBC7E1D7576C000809DB0 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | /* End XCConfigurationList section */ 353 | }; 354 | rootObject = BF7FBC601D7576C000809DB0 /* Project object */; 355 | } 356 | -------------------------------------------------------------------------------- /SwiftNotificationCenter.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DB79898F1CDB2C8A00419114 /* SwiftNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = DB79898E1CDB2C8A00419114 /* SwiftNotificationCenter.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | DB7989961CDB2C8A00419114 /* SwiftNotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB79898B1CDB2C8A00419114 /* SwiftNotificationCenter.framework */; }; 12 | DB79899B1CDB2C8A00419114 /* SwiftNotificationCenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB79899A1CDB2C8A00419114 /* SwiftNotificationCenterTests.swift */; }; 13 | DB7989A61CDB304C00419114 /* WeakObjectSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7989A51CDB304C00419114 /* WeakObjectSet.swift */; }; 14 | DB7989A81CDB30D700419114 /* SwiftNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7989A71CDB30D700419114 /* SwiftNotificationCenter.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXContainerItemProxy section */ 18 | DB7989971CDB2C8A00419114 /* PBXContainerItemProxy */ = { 19 | isa = PBXContainerItemProxy; 20 | containerPortal = DB7989821CDB2C8A00419114 /* Project object */; 21 | proxyType = 1; 22 | remoteGlobalIDString = DB79898A1CDB2C8A00419114; 23 | remoteInfo = SwiftNotificationCenter; 24 | }; 25 | /* End PBXContainerItemProxy section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | DB79898B1CDB2C8A00419114 /* SwiftNotificationCenter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftNotificationCenter.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | DB79898E1CDB2C8A00419114 /* SwiftNotificationCenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftNotificationCenter.h; sourceTree = ""; }; 30 | DB7989901CDB2C8A00419114 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | DB7989951CDB2C8A00419114 /* SwiftNotificationCenterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftNotificationCenterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | DB79899A1CDB2C8A00419114 /* SwiftNotificationCenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftNotificationCenterTests.swift; sourceTree = ""; }; 33 | DB79899C1CDB2C8A00419114 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | DB7989A51CDB304C00419114 /* WeakObjectSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeakObjectSet.swift; sourceTree = ""; }; 35 | DB7989A71CDB30D700419114 /* SwiftNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftNotificationCenter.swift; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | DB7989871CDB2C8A00419114 /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | DB7989921CDB2C8A00419114 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | DB7989961CDB2C8A00419114 /* SwiftNotificationCenter.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | DB7989811CDB2C8A00419114 = { 58 | isa = PBXGroup; 59 | children = ( 60 | DB79898D1CDB2C8A00419114 /* SwiftNotificationCenter */, 61 | DB7989991CDB2C8A00419114 /* SwiftNotificationCenterTests */, 62 | DB79898C1CDB2C8A00419114 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | DB79898C1CDB2C8A00419114 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | DB79898B1CDB2C8A00419114 /* SwiftNotificationCenter.framework */, 70 | DB7989951CDB2C8A00419114 /* SwiftNotificationCenterTests.xctest */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | DB79898D1CDB2C8A00419114 /* SwiftNotificationCenter */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | DB79898E1CDB2C8A00419114 /* SwiftNotificationCenter.h */, 79 | DB7989901CDB2C8A00419114 /* Info.plist */, 80 | DB7989A51CDB304C00419114 /* WeakObjectSet.swift */, 81 | DB7989A71CDB30D700419114 /* SwiftNotificationCenter.swift */, 82 | ); 83 | path = SwiftNotificationCenter; 84 | sourceTree = ""; 85 | }; 86 | DB7989991CDB2C8A00419114 /* SwiftNotificationCenterTests */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | DB79899A1CDB2C8A00419114 /* SwiftNotificationCenterTests.swift */, 90 | DB79899C1CDB2C8A00419114 /* Info.plist */, 91 | ); 92 | path = SwiftNotificationCenterTests; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXHeadersBuildPhase section */ 98 | DB7989881CDB2C8A00419114 /* Headers */ = { 99 | isa = PBXHeadersBuildPhase; 100 | buildActionMask = 2147483647; 101 | files = ( 102 | DB79898F1CDB2C8A00419114 /* SwiftNotificationCenter.h in Headers */, 103 | ); 104 | runOnlyForDeploymentPostprocessing = 0; 105 | }; 106 | /* End PBXHeadersBuildPhase section */ 107 | 108 | /* Begin PBXNativeTarget section */ 109 | DB79898A1CDB2C8A00419114 /* SwiftNotificationCenter */ = { 110 | isa = PBXNativeTarget; 111 | buildConfigurationList = DB79899F1CDB2C8A00419114 /* Build configuration list for PBXNativeTarget "SwiftNotificationCenter" */; 112 | buildPhases = ( 113 | DB7989861CDB2C8A00419114 /* Sources */, 114 | DB7989871CDB2C8A00419114 /* Frameworks */, 115 | DB7989881CDB2C8A00419114 /* Headers */, 116 | DB7989891CDB2C8A00419114 /* Resources */, 117 | ); 118 | buildRules = ( 119 | ); 120 | dependencies = ( 121 | ); 122 | name = SwiftNotificationCenter; 123 | productName = SwiftNotificationCenter; 124 | productReference = DB79898B1CDB2C8A00419114 /* SwiftNotificationCenter.framework */; 125 | productType = "com.apple.product-type.framework"; 126 | }; 127 | DB7989941CDB2C8A00419114 /* SwiftNotificationCenterTests */ = { 128 | isa = PBXNativeTarget; 129 | buildConfigurationList = DB7989A21CDB2C8A00419114 /* Build configuration list for PBXNativeTarget "SwiftNotificationCenterTests" */; 130 | buildPhases = ( 131 | DB7989911CDB2C8A00419114 /* Sources */, 132 | DB7989921CDB2C8A00419114 /* Frameworks */, 133 | DB7989931CDB2C8A00419114 /* Resources */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | DB7989981CDB2C8A00419114 /* PBXTargetDependency */, 139 | ); 140 | name = SwiftNotificationCenterTests; 141 | productName = SwiftNotificationCenterTests; 142 | productReference = DB7989951CDB2C8A00419114 /* SwiftNotificationCenterTests.xctest */; 143 | productType = "com.apple.product-type.bundle.unit-test"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | DB7989821CDB2C8A00419114 /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastSwiftUpdateCheck = 0730; 152 | LastUpgradeCheck = 1020; 153 | ORGANIZATIONNAME = Mango; 154 | TargetAttributes = { 155 | DB79898A1CDB2C8A00419114 = { 156 | CreatedOnToolsVersion = 7.3.1; 157 | LastSwiftMigration = 1020; 158 | }; 159 | DB7989941CDB2C8A00419114 = { 160 | CreatedOnToolsVersion = 7.3.1; 161 | LastSwiftMigration = 1020; 162 | }; 163 | }; 164 | }; 165 | buildConfigurationList = DB7989851CDB2C8A00419114 /* Build configuration list for PBXProject "SwiftNotificationCenter" */; 166 | compatibilityVersion = "Xcode 3.2"; 167 | developmentRegion = en; 168 | hasScannedForEncodings = 0; 169 | knownRegions = ( 170 | en, 171 | Base, 172 | ); 173 | mainGroup = DB7989811CDB2C8A00419114; 174 | productRefGroup = DB79898C1CDB2C8A00419114 /* Products */; 175 | projectDirPath = ""; 176 | projectRoot = ""; 177 | targets = ( 178 | DB79898A1CDB2C8A00419114 /* SwiftNotificationCenter */, 179 | DB7989941CDB2C8A00419114 /* SwiftNotificationCenterTests */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | DB7989891CDB2C8A00419114 /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | DB7989931CDB2C8A00419114 /* Resources */ = { 193 | isa = PBXResourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | }; 199 | /* End PBXResourcesBuildPhase section */ 200 | 201 | /* Begin PBXSourcesBuildPhase section */ 202 | DB7989861CDB2C8A00419114 /* Sources */ = { 203 | isa = PBXSourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | DB7989A61CDB304C00419114 /* WeakObjectSet.swift in Sources */, 207 | DB7989A81CDB30D700419114 /* SwiftNotificationCenter.swift in Sources */, 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | DB7989911CDB2C8A00419114 /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | DB79899B1CDB2C8A00419114 /* SwiftNotificationCenterTests.swift in Sources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXSourcesBuildPhase section */ 220 | 221 | /* Begin PBXTargetDependency section */ 222 | DB7989981CDB2C8A00419114 /* PBXTargetDependency */ = { 223 | isa = PBXTargetDependency; 224 | target = DB79898A1CDB2C8A00419114 /* SwiftNotificationCenter */; 225 | targetProxy = DB7989971CDB2C8A00419114 /* PBXContainerItemProxy */; 226 | }; 227 | /* End PBXTargetDependency section */ 228 | 229 | /* Begin XCBuildConfiguration section */ 230 | DB79899D1CDB2C8A00419114 /* Debug */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 235 | CLANG_ANALYZER_NONNULL = YES; 236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 237 | CLANG_CXX_LIBRARY = "libc++"; 238 | CLANG_ENABLE_MODULES = YES; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 241 | CLANG_WARN_BOOL_CONVERSION = YES; 242 | CLANG_WARN_COMMA = YES; 243 | CLANG_WARN_CONSTANT_CONVERSION = YES; 244 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 245 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 246 | CLANG_WARN_EMPTY_BODY = YES; 247 | CLANG_WARN_ENUM_CONVERSION = YES; 248 | CLANG_WARN_INFINITE_RECURSION = YES; 249 | CLANG_WARN_INT_CONVERSION = YES; 250 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 251 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 252 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 253 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 254 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 255 | CLANG_WARN_STRICT_PROTOTYPES = YES; 256 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 257 | CLANG_WARN_UNREACHABLE_CODE = YES; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 260 | COPY_PHASE_STRIP = NO; 261 | CURRENT_PROJECT_VERSION = 1; 262 | DEBUG_INFORMATION_FORMAT = dwarf; 263 | ENABLE_STRICT_OBJC_MSGSEND = YES; 264 | ENABLE_TESTABILITY = YES; 265 | GCC_C_LANGUAGE_STANDARD = gnu99; 266 | GCC_DYNAMIC_NO_PIC = NO; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_OPTIMIZATION_LEVEL = 0; 269 | GCC_PREPROCESSOR_DEFINITIONS = ( 270 | "DEBUG=1", 271 | "$(inherited)", 272 | ); 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 280 | MTL_ENABLE_DEBUG_INFO = YES; 281 | ONLY_ACTIVE_ARCH = YES; 282 | SDKROOT = iphoneos; 283 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 284 | TARGETED_DEVICE_FAMILY = "1,2"; 285 | VERSIONING_SYSTEM = "apple-generic"; 286 | VERSION_INFO_PREFIX = ""; 287 | }; 288 | name = Debug; 289 | }; 290 | DB79899E1CDB2C8A00419114 /* Release */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | ALWAYS_SEARCH_USER_PATHS = NO; 294 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 295 | CLANG_ANALYZER_NONNULL = YES; 296 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 297 | CLANG_CXX_LIBRARY = "libc++"; 298 | CLANG_ENABLE_MODULES = YES; 299 | CLANG_ENABLE_OBJC_ARC = YES; 300 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_COMMA = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 305 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 306 | CLANG_WARN_EMPTY_BODY = YES; 307 | CLANG_WARN_ENUM_CONVERSION = YES; 308 | CLANG_WARN_INFINITE_RECURSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 311 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 312 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 313 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 314 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 315 | CLANG_WARN_STRICT_PROTOTYPES = YES; 316 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 317 | CLANG_WARN_UNREACHABLE_CODE = YES; 318 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 319 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 320 | COPY_PHASE_STRIP = NO; 321 | CURRENT_PROJECT_VERSION = 1; 322 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 323 | ENABLE_NS_ASSERTIONS = NO; 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_NO_COMMON_BLOCKS = YES; 327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 328 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 329 | GCC_WARN_UNDECLARED_SELECTOR = YES; 330 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 331 | GCC_WARN_UNUSED_FUNCTION = YES; 332 | GCC_WARN_UNUSED_VARIABLE = YES; 333 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 334 | MTL_ENABLE_DEBUG_INFO = NO; 335 | SDKROOT = iphoneos; 336 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 337 | TARGETED_DEVICE_FAMILY = "1,2"; 338 | VALIDATE_PRODUCT = YES; 339 | VERSIONING_SYSTEM = "apple-generic"; 340 | VERSION_INFO_PREFIX = ""; 341 | }; 342 | name = Release; 343 | }; 344 | DB7989A01CDB2C8A00419114 /* Debug */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | CLANG_ENABLE_MODULES = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 349 | DEFINES_MODULE = YES; 350 | DYLIB_COMPATIBILITY_VERSION = 1; 351 | DYLIB_CURRENT_VERSION = 1; 352 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 353 | INFOPLIST_FILE = SwiftNotificationCenter/Info.plist; 354 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 355 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 356 | PRODUCT_BUNDLE_IDENTIFIER = Mango.SwiftNotificationCenter; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | SKIP_INSTALL = YES; 359 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 360 | SWIFT_VERSION = 5.0; 361 | }; 362 | name = Debug; 363 | }; 364 | DB7989A11CDB2C8A00419114 /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | CLANG_ENABLE_MODULES = YES; 368 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 369 | DEFINES_MODULE = YES; 370 | DYLIB_COMPATIBILITY_VERSION = 1; 371 | DYLIB_CURRENT_VERSION = 1; 372 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 373 | INFOPLIST_FILE = SwiftNotificationCenter/Info.plist; 374 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 376 | PRODUCT_BUNDLE_IDENTIFIER = Mango.SwiftNotificationCenter; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | SKIP_INSTALL = YES; 379 | SWIFT_VERSION = 5.0; 380 | }; 381 | name = Release; 382 | }; 383 | DB7989A31CDB2C8A00419114 /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | DEVELOPMENT_TEAM = ""; 387 | INFOPLIST_FILE = SwiftNotificationCenterTests/Info.plist; 388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 389 | PRODUCT_BUNDLE_IDENTIFIER = Mango.SwiftNotificationCenterTests; 390 | PRODUCT_NAME = "$(TARGET_NAME)"; 391 | SWIFT_VERSION = 5.0; 392 | }; 393 | name = Debug; 394 | }; 395 | DB7989A41CDB2C8A00419114 /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | DEVELOPMENT_TEAM = ""; 399 | INFOPLIST_FILE = SwiftNotificationCenterTests/Info.plist; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 401 | PRODUCT_BUNDLE_IDENTIFIER = Mango.SwiftNotificationCenterTests; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | SWIFT_VERSION = 5.0; 404 | }; 405 | name = Release; 406 | }; 407 | /* End XCBuildConfiguration section */ 408 | 409 | /* Begin XCConfigurationList section */ 410 | DB7989851CDB2C8A00419114 /* Build configuration list for PBXProject "SwiftNotificationCenter" */ = { 411 | isa = XCConfigurationList; 412 | buildConfigurations = ( 413 | DB79899D1CDB2C8A00419114 /* Debug */, 414 | DB79899E1CDB2C8A00419114 /* Release */, 415 | ); 416 | defaultConfigurationIsVisible = 0; 417 | defaultConfigurationName = Release; 418 | }; 419 | DB79899F1CDB2C8A00419114 /* Build configuration list for PBXNativeTarget "SwiftNotificationCenter" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | DB7989A01CDB2C8A00419114 /* Debug */, 423 | DB7989A11CDB2C8A00419114 /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | DB7989A21CDB2C8A00419114 /* Build configuration list for PBXNativeTarget "SwiftNotificationCenterTests" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | DB7989A31CDB2C8A00419114 /* Debug */, 432 | DB7989A41CDB2C8A00419114 /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | defaultConfigurationName = Release; 436 | }; 437 | /* End XCConfigurationList section */ 438 | }; 439 | rootObject = DB7989821CDB2C8A00419114 /* Project object */; 440 | } 441 | --------------------------------------------------------------------------------