-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extends example app to include edit and delete functionality in `.moc…
…k` and `.live` mode
- Loading branch information
1 parent
80e0a40
commit 83ef89a
Showing
7 changed files
with
327 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Example/AblyChatExample/MessageViews/DeletedMessageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import SwiftUI | ||
|
||
struct DeletedMessageView: View { | ||
var item: MessageListItem | ||
|
||
var body: some View { | ||
HStack(alignment: .firstTextBaseline) { | ||
VStack { | ||
Text("\(item.message.clientID):") | ||
.foregroundColor(.blue) | ||
.bold() | ||
} | ||
VStack { | ||
Text("This message was deleted.") | ||
.foregroundStyle(.secondary) | ||
.italic() | ||
} | ||
} | ||
#if !os(tvOS) | ||
.listRowSeparator(.hidden) | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SwiftUI | ||
|
||
struct MenuButtonView: View { | ||
var onEdit: () -> Void | ||
var onDelete: () -> Void | ||
|
||
var body: some View { | ||
Menu { | ||
Button(action: onEdit) { | ||
Label("Edit", systemImage: "pencil") | ||
} | ||
|
||
Button(role: .destructive, action: onDelete) { | ||
Label("Delete", systemImage: "trash") | ||
} | ||
} label: { | ||
Image(systemName: "ellipsis.circle") | ||
} | ||
} | ||
} |
Oops, something went wrong.