Share with the Share Dialog

You can create a share dialog with any one of the sharing content types that are supported in the Facebook SDK for Swift.

You can download a sample project from GitHub.

Share dialogs can be customized by setting the following properties of the ShareDialog object:

Property Description


Specifies how the share dialog is presented.


Specifies whether the receiver should fail if it finds an error with the share content.

The following code example demonstrates how to display a native share dialog that will fail for invalid data:

import FacebookShare

func showShareDialog<Content: SharingContent>(
    _ content: C, 
    mode: ShareDialog.Mode = .automatic
    ) {    
    let dialog = ShareDialog(
        fromViewController: self, 
        content: content, 
        delegate: self
    dialog.mode = mode