Skip to content

Commit e85a728

Browse files
committed
update README.md
1 parent 07b683e commit e85a728

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
11
# SCFNotification
22

3-
A description of this package.
3+
Swift wrapper of `CFNotificationCenter`.
4+
No more tedious type conversions using pointers.
5+
6+
## Usage
7+
import
8+
```swift
9+
import SCFNotification
10+
```
11+
12+
addObserver
13+
```swift
14+
SCFNotificationCenter
15+
.addObserver(center: .local,
16+
observer: self,
17+
name: .init("local.notification" as CFString),
18+
suspensionBehavior: .deliverImmediately) { center, `self`, name, object, userInfo in
19+
print(center, name, object, userInfo)
20+
}
21+
```
22+
23+
postNotification
24+
```swift
25+
SCFNotificationCenter
26+
.postNotification(center: .local,
27+
name: .init("local.notification" as CFString),
28+
userInfo: [:] as CFDictionary,
29+
deliverImmediately: true
30+
)
31+
32+
```
33+
34+
removeObserver
35+
```swift
36+
SCFNotificationCenter
37+
.removeObserver(center: .local,
38+
observer: self,
39+
name: .init("local.notification" as CFString)
40+
)
41+
```

0 commit comments

Comments
 (0)