![]() While tapping the new deck, you would want to create a dismissal process to go back to ShareViewController. Now, when you run the app it would be updated. By selecting the default one, update it inside configurationItems(). You will need to update it by creating a property for storing the selected deck. Hence, running the app will enable you to see the table view of dummy data as you tap on the configuration cell.īut the cell is still named as Deck Title. Running an app after every update is essential for mobile app testing. Finally, create an instance of ShareSelectViewController for the newly built configuration Item inside tapHandler. For adding it to the view, create a property for tableview for storing dummy data. So now, create a new file from UIViewController and name it as ShareSelectViewController.swift. ![]() To display the extension in a tabular view, you will need to configure it in a way that when you tap on the cell, it switches to that view. So, create a simple model named Deck.swift that you will need in the further stages for passing the data across view controllers. Configuration Items will require a basic model, that you will have to create. Inserting the snippet will give you SLComposeSheetConfigurationItem. When you created share extension, there is a boilerplate that includes a tool with which you can supply configuration Items, as an option. Also, you can make it run a JavaScript code that will help you in fetching the URL from browser while sending it to the server. This is done to save the configuration on dedicated existing Decks. You can customize the design by adding Configuration Items at the bottom of the share sheet. Customizing and Adding Configuration Cells Now, when you run the extension, the URL will be printed on the console. Import kUTTypePropertyList under the function, viewDidLoad. For retrieving that data, run the code block in ShareViewController.swift. The above JavaScript file will be now scraping the data from it. For more in-depth details, you can refer to the Apple documentation guide. Now, the OS will be looking for an object with the name ExtensionProcessingJS that will be performing at the runtime. Next, make an addition of another row from dictionary NSExtensionActivationRule containing the key NSExtensionActivationSupportsWebURLWithMaxCount.Ĭopy and paste the image you have selected to share into GetURL.js. Select the key named NSExtensionJavascriptProcessingFile with the created value “GetURL” (without the extension. The extension file ist needs editing with a key from the dictionary named NSExtensionAttributes available in NSExtension. Under it, on the Other tab, you will find Empty and then tap Next to rename the file “GetURL.js” So, go to your extensions folder in Xcode and select a New File. Hence, here you might want to run a JavaScript file for parsing the document and attain some more information. However, you would need more information than what is provided in the sheet. It receives the page title and then sets that information as the body text. Once the extension is enabled, the share sheet is able to retrieve all the information automatically for streamlining the sharing process in mobile app development. As you click on the icon, you will be presented with the default implementation associated with SLComposeServiceViewController. If its not there, click on the More button to enable it. The extension name you have created earlier should appear on the list. You can then test whatever you have done till now by running the project on Safari or any other option you have selected.Īs you open Safari, click on the icon displaying “Share”. This will allow you to test your extension. Now, activate the option of running the app on a browser like Safari or any other you have selected, to enable a smoother and responsive app design. Select the iOS tab, click on Share Extension and then Next. ![]() You can either choose to open a new project to start adding share extension from scratch or open an existing one you want to add the extension. This helps a user in switching easily from one app to another. It enables displaying an icon on the common share sheet associated with the main mobile app while handling the content sharing as requested by a user. ![]() Building a share extension in iOS with Swift programming language is pretty easy and simplifies some essential tasks. The main aim behind building a share extension is enabling an app to save a URL as rich content and to configure some options. In this post, we will be describing the process by using Swift 4.0. In our earlier post, we explained how to build a Share Extension using Swift 3.0. ![]()
0 Comments
Leave a Reply. |