saner
saner

Reputation: 821

Social Framework For Facebook - Placeholder Text in Swift

As stated by facebook, prefill is not allowed anymore with the social framework. But as the statement below;

Your app’s composer can include a call-to-action that disappears when people start to write a post. For example, Facebook's composer uses grey scale text to ask “What's on your mind?” that disappears when people start to write.

Can we put a placeholder text that dissapears when a user starts to write text via the social framework facebook share?

Currently my initial text code which is below is not working.

    func facebookShareFunc() {


    let shareToFacebook : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)


    shareToFacebook.setInitialText(“Initial text here”)


    shareToFacebook.completionHandler = {
        (result:SLComposeViewControllerResult) in


        let getResult = result as SLComposeViewControllerResult;
        switch(getResult.rawValue) {
        case SLComposeViewControllerResult.Cancelled.rawValue: print("User cancelled post")
        case SLComposeViewControllerResult.Done.rawValue: self.workingFunc()
        default: print("Shouldn't happen")

        }


    }

    self.presentViewController(shareToFacebook, animated: true, completion: nil)


} 

Upvotes: 2

Views: 358

Answers (0)

Related Questions