How to make a ShareLink send an uneditable message - SwiftUI

104 views Asked by At

I have a ShareLink that I want users to be able to share uneditable messages to others. This is in case the ShareLink is sending important data that could be misleading if it were to be edited by the sender (settings, high scores, etc.). Obviously the sender should still be able to choose if the message as is will be sent out or not.

struct ShareButton : View {
let link = URL(string: "https://google.com")!
var relevantVariable : Int = 8
var example : Text? = Text("example text")
var body : some View {
    ZStack {
        ShareLink(
            item: link,
            subject: Text("Make this message uneditable \(relevantVariable)!"),
            message: Text("Make this text uneditable \(relevantVariable)!")+Text("\n")+Text("**examples: **")+(example ?? Text(" ")),
            preview: SharePreview(
                "Make this uneditable \(relevantVariable)!",
                image: Image("")
            )
        )
    }
}
}

Any ideas? I remember reading that it is possible to take and send screenshots, but ideally I need text written up. Help would be greatly appreciated!

0

There are 0 answers