Sharing text with NewLine issues in whatsapp iOS swift

Solution:

If you are used to share the text with common sharing with \n whatsapp will not accept it.Other sharing apps will be allow \n character.So try the following method to share the data in Whatsapp.

    func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: String) -> Any {
        
        if activityType.contains("WhatsApp") {
            sharetext = sharetext.replacingOccurrences(of: "\n", with: "<\n   >")
        }
        return sharetext
    } 

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift