URL(string: "instagram-stories://share")! func share() { guard UIApplication.shared.canOpenURL(self.urlScheme) else { return } let item: [String: Any] = [ "com.instagram.sharedSticker.backgroundImage": UIImage(named: "StoryBackgroundImage")!.pngData()!, "com.instagram.sharedSticker.stickerImage": UIImage(named: "StoryStickerImage")!.pngData()! ] let options = [UIPasteboard.OptionsKey.expirationDate: Date().addingTimeInterval(60 * 5)] UIPasteboard.general.setItems([item], options: options) UIApplication.shared.open(self.urlScheme, options: [:], completionHandler: nil) } }