<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sonal Bellani on Medium]]></title>
        <description><![CDATA[Stories by Sonal Bellani on Medium]]></description>
        <link>https://medium.com/@sonal-bellani?source=rss-8f1f708b868c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MSVmGLIFXBFwFXsRrohnlA.jpeg</url>
            <title>Stories by Sonal Bellani on Medium</title>
            <link>https://medium.com/@sonal-bellani?source=rss-8f1f708b868c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:32:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sonal-bellani/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Adding Custom Activity in UIActivityController]]></title>
            <link>https://medium.com/healthify-tech/adding-custom-activity-in-uiactivitycontroller-ed16e721ec82?source=rss-8f1f708b868c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed16e721ec82</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[uiactivityviewcontroller]]></category>
            <category><![CDATA[custom-activity]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Sonal Bellani]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 15:53:56 GMT</pubDate>
            <atom:updated>2020-11-18T17:20:27.764Z</atom:updated>
            <content:encoded><![CDATA[<h3>Adding Custom Activity in UIActivityViewController</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*Z-NEcmUUxrM8nO3E2txeqQ.png" /></figure><p>Almost every iOS app developer knows about UIActivityViewController, in our iOS apps we often need to share content to external apps for which we use UIActivityViewController. But do you know, you can easily share content within your app through UIActivityViewController just by adding a custom activity to it. You can also add custom activity to have other functionalities as well apart from sharing such as archive content, reverse string, etc.</p><p>Basic code of UIActivityViewController:</p><pre>let text = “Share Achievement”<br>let image = UIImage(named:”shareImg”)<br>let activityC = UIActivityViewController(activityItems: [image, text], applicationActivities:nil)</pre><p>The initializer method of UIActivityViewController has two arguments named <strong>activityItems: </strong>and <strong>applicationActivities: </strong>. In the first parameter we must pass the array of items to share. Have you ever thought, what to pass inside applicationActivities in the above code?</p><p>So, this <strong>applicationActivities: </strong>is the place where we pass our custom activity. First let’s talk about how to create custom activity.</p><p>To create an application activity we subclass the <strong>UIActivity</strong> and override the methods and properties of <strong>UIActivity</strong> class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f2011f1b6148377292a944c9d4d67c5/href">https://medium.com/media/8f2011f1b6148377292a944c9d4d67c5/href</a></iframe><p>To use this in <strong>UIActivityViewController</strong> pass the instance of <strong>CustomActivity</strong> to the <strong>applicationActivities</strong> parameter of the initializer method of <strong>UIActivityViewController.</strong></p><pre>let activityC = UIActivityViewController(activityItems: [image, text], applicationActivities:CustomActivity())</pre><p>Congratulations, you have created your first custom activity. That was so easy, isn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*gBhBmmHp8MDu6t17ZkEwNg.png" /></figure><p>In HealthifyMe iOS app, we have used custom activity to add “HealthifyMe Groups” option which let user to share their achievements within the app in different groups.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed16e721ec82" width="1" height="1" alt=""><hr><p><a href="https://medium.com/healthify-tech/adding-custom-activity-in-uiactivitycontroller-ed16e721ec82">Adding Custom Activity in UIActivityController</a> was originally published in <a href="https://medium.com/healthify-tech">HealthifyMe Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>