Skip to content

Commit 498d34b

Browse files
committed
Enabled throwing from custom invitation closure
1 parent 699578b commit 498d34b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Sources/MultipeerKit/Internal API/MultipeerConnection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ extension MultipeerConnection: MCNearbyServiceBrowserDelegate {
178178
case .automatic:
179179
browser.invitePeer(peerID, to: session, withContext: nil, timeout: 10.0)
180180
case .custom(let inviter):
181-
guard let invite = inviter(peer) else {
181+
guard let invite = try inviter(peer) else {
182182
os_log("Custom invite not sent for peer %@", log: self.log, type: .error, String(describing: peer))
183183
return
184184
}
@@ -221,7 +221,7 @@ extension MultipeerConnection: MCNearbyServiceAdvertiserDelegate {
221221

222222
configuration.security.invitationHandler(peer, context, { [weak self] decision in
223223
guard let self = self else { return }
224-
224+
225225
invitationHandler(decision, decision ? self.session : nil)
226226
})
227227
}

Sources/MultipeerKit/Public API/MultipeerConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public struct MultipeerConfiguration {
1212
case automatic
1313
/// Use `.custom` when you want to control the invitation of new peers to your session,
1414
/// but still invite them at the time of discovery.
15-
case custom((Peer) -> (context: Data, timeout: TimeInterval)?)
15+
case custom((Peer) throws -> (context: Data, timeout: TimeInterval)?)
1616
/// Use `.none` when you want to manually invite peers by calling `invite` in `MultipeerTransceiver`.
1717
case none
1818
}

0 commit comments

Comments
 (0)