Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit f7e51f4

Browse files
authored
Update README.md
1 parent 52f9575 commit f7e51f4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,38 @@ WeLoop.invoke()
7373

7474
```
7575

76+
### Delegate methods
77+
78+
You can set up a delegate to listen for some events returned by the SDK with the following method: `WeLoop.set(delegate: self)`
79+
80+
You can then implement the following optional delegate methods:
81+
82+
````swift
83+
extension AppDelegate: WeLoopDelegate {
84+
85+
func initializationSuccessful() {
86+
// From this point forward, we can safely invoke the Widget manually
87+
}
88+
89+
func initializationFailed(with error: Error) {
90+
// Initialization Failed (no network for example). Based on the error you'll have to retry the initialization later.
91+
print(error)
92+
}
93+
94+
func failedToLaunch(with error: Error) {
95+
// The widget could not be launched. Most likely is that the initialization process failed, or the user is missing in autoAuthentication
96+
print(error)
97+
}
98+
99+
func notificationCountUpdated(newCount: Int) {
100+
// Set the new count on your custom view
101+
print(newCount)
102+
}
103+
}
104+
````
105+
106+
107+
76108
### Updating your plist
77109

78110
Since WeLoop offers the possibility to upload photos from the user photo gallery and from the camera, you will have to add the following entries to your plist, if they are not already present:

0 commit comments

Comments
 (0)