Skip to content

Commit b0ee146

Browse files
authored
Merge pull request SwiftKickMobile#136 from allaire/patch-1
Clarify how to use multiple instances of SwiftMessages
2 parents 7957603 + 7c20e60 commit b0ee146

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,18 @@ SwiftMessages.hide(id: someId)
202202
SwiftMessages.hideCounted(id: someId)
203203
````
204204

205-
Multiple instances of `SwiftMessages` can be used to show more than one message at a time. Note that the static `SwiftMessages.show()` and other static APIs on `SwiftMessage` are just convenience wrappers around the shared instance `SwiftMessages.sharedInstance`):
205+
Multiple instances of `SwiftMessages` can be used to show more than one message at a time. Note that the static `SwiftMessages.show()` and other static APIs on `SwiftMessage` are just convenience wrappers around the shared instance `SwiftMessages.sharedInstance`). Instances must be retained, thus it should be a property of something (e.g. your view controller):
206206

207207
````swift
208-
let otherMessages = SwiftMessages()
209-
SwiftMessages.show(...)
210-
otherMessages.show(...)
208+
class SomeViewController: UIViewController {
209+
static var otherMessages = SwiftMessages()
210+
211+
212+
func someMethod() {
213+
SwiftMessages.show(...)
214+
otherMessages.show(...)
215+
}
216+
}
211217
````
212218

213219
### Retrieving Messages

0 commit comments

Comments
 (0)