Skip to content

Commit 7f53558

Browse files
authored
Added a Username Copy Button (#149)
* Added a Username Copy Button A Button to directly copy user and discrim from the mini profile page. * Removed Trailing Whitespace
1 parent b94bd97 commit 7f53558

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Swiftcord/Views/User/Profile/MiniUserProfileView.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import CachedAsyncImage
1212

1313
struct MiniUserProfileView<RichContentSlot: View>: View {
1414
let user: User
15+
let pasteboard = NSPasteboard.general
1516
@Binding var profile: UserProfile?
1617
var guildRoles: [Role]?
1718
var isWebhook: Bool = false
@@ -90,6 +91,15 @@ struct MiniUserProfileView<RichContentSlot: View>: View {
9091
NonUserBadge(flags: user.public_flags, isWebhook: isWebhook)
9192
}
9293
Spacer()
94+
Button(action: {
95+
pasteboard.declareTypes([.string], owner: nil)
96+
pasteboard.setString("\(user.username)#\(user.discriminator)", forType: .string)
97+
}, label: {
98+
Image(systemName: "square.on.square")
99+
})
100+
.buttonStyle(.plain)
101+
.padding()
102+
.frame(width: 20, height: 20)
93103
}
94104

95105
// Custom status

0 commit comments

Comments
 (0)