I want to be able to have social icons in a scrollView, which when clicked, functions the same way it would if I had clicked on them after presenting a UIActivityViewController.
Actually I did exactly the same, but this solution need you to also implement side server for continues support for new apps that pops on AppStore (without update your app for everytime you need/want to add/remove new app to/from the list)
1st: You need to decide what are you going to share on other apps
2nd: you need to find out the URL Scheme that apps work with,
example for instagram -> "instagram://user?username=your_username"
3rd: now the logic behind the process
let's say i want to show facebook, twitter, slack and instagram,
let's set dictionary with relevant URLs:
["facebook":"facebook://blablabla", "twitter":"twitter://blabla", "slack":"slack://blabla", "instagram":"instagram://blabla"]
ALSO YOU NEED TO HOLD THE APP's ICONS (locally or server/firebase/cloud) - to display later on your scrollview(horizontaly collectionview or what ever you decide to use)
4rd: you need to check if that apps are installed on the device:
So just loop on your apps array/dictionary (or what ever you decide to hold your info and check for availability like that:
let instagramHooks = "instagram://user?username=your_username"
let instagramUrl = URL(string: instagramHooks)
if UIApplication.shared.canOpenURL(instagramUrl! as URL)
{
//The app are installed you can show her
} else {
//The app doesn't installed -> don't show it on the list
}
After that you just need to put their icons to UICollectionView / UIScrollView and when user tap on icon you go and open that scheme:
UIApplication.shared.open(instagramUrl!)
About how the target app will show the dialog (like UIActivityViewController action or actually open the app i don't now), but I'm sure you can find here someone that help you with that
Hop you understand my steps, if not you can contact with me for more explanation
Short: That’s not possible.
Every App runs inside their own "playground" and the Apps get entire focus of the device.
I assume that the User recreated the Interface of those Apps and got the Information out of an API. For example, we get the Content, from an Whatsapp API and recreate the UI, to make it feel like we're inside Whatsapp. But you should not do that, since you might get in conflict with copyright infringements.
But in general Apps don’t know about each other.
And the only possibility to run a 3rd party App, as you already know, is the URL Scheme. If you would want to run an App inside your App like in a UIWebView
, you would need to emulate a whole iOS. So impossible.
However, it might be possible with jailbroken iPhones, but I have no idea about that.
Yodel : They have made their own custom view, and they have picked some common apps like whatsapp,snapchat,messenger etc for which openurl common, they have checked each one by using "canOpenUrl" to check whether given app is available on user's mobile. If available then show its icon. When user clicks on it, it will open given app by using "openUrl".
Here, In yodel you can see that, it is not able to take all the available sharing apps, it is only able to predefined fix apps they have defined. For other apps, they have added "more button" at end, which on clicking will open UIActivityViewController .