damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 0d2ab6aff39ef53e4888d77d19f13b6ebd00c0e5
parent e3732b3adc8a68f6ed126470c0349b558b1d89d9
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  2 Jan 2023 12:41:28 -0800

NostrResponse: add sub_id helper

Handy to guard on this

Diffstat:
Mdamus/Nostr/NostrResponse.swift | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/damus/Nostr/NostrResponse.swift b/damus/Nostr/NostrResponse.swift @@ -11,6 +11,17 @@ enum NostrResponse: Decodable { case event(String, NostrEvent) case notice(String) case eose(String) + + var subid: String? { + switch self { + case .event(let sub_id, _): + return sub_id + case .eose(let sub_id): + return sub_id + case .notice: + return nil + } + } init(from decoder: Decoder) throws { var container = try decoder.unkeyedContainer()