File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11Pod ::Spec . new do |s |
22 s . name = "Shouter"
3- s . version = "0.4.1 "
3+ s . version = "0.5.0 "
44 s . summary = "A type safe, thread safe and memory safe alternative for NotificationCenter"
55 s . homepage = "https://github.com/ChaosCoder/Shouter"
66 s . license = { :type => 'MIT' , :file => 'LICENSE.md' }
Original file line number Diff line number Diff line change 88
99import Foundation
1010
11- public class Shouter {
11+ public protocol ShouterType {
12+ func register< T> ( _ type: T . Type , observer: T )
13+ func unregister< T> ( _ type: T . Type , observer: T )
14+ func unregister< T> ( _ type: T . Type )
15+ func notify< T> ( _ type: T . Type , block: ( T ) -> Void )
16+ }
17+
18+ public class Shouter : ShouterType {
1219
1320 public static let `default` = Shouter ( )
1421
1522 fileprivate typealias Key = String
1623 fileprivate var observers : [ Key : NSHashTable < AnyObject > ] = [ : ]
17- fileprivate let notificationQueue = DispatchQueue ( label: " com.swift.notification.center.dispatch.queue " , attributes: . concurrent)
24+ fileprivate let notificationQueue : DispatchQueue
25+
26+ public init ( notificationQueue: DispatchQueue = DispatchQueue ( label: " de.chaosspace.Shouter.dispatch.queue " , attributes: . concurrent) ) {
27+ self . notificationQueue = notificationQueue
28+ }
1829
1930 public func register< T> ( _ type: T . Type , observer: T ) {
2031 notificationQueue. sync ( flags: . barrier) {
You can’t perform that action at this time.
0 commit comments