How the title and description parts of the header on UIActivityViewController works by default on iOS and other platforms? In cases, where there's no customization and any other works done to set them, how these 2 elements are generated by the system.
There can be multiple scenarios according to the type of element that's being shared and their related attributes. So, understanding this default mechanisms of the system requires trial and error attempts to figure them out. It would be better to have a common system design of it.
For iOS13+ it is possible with LPLinkMetadata for UIActivityViewController. Check this tutorial for full info: Composing Rich Link Previews Using LinkPresentation in Swift
Related
I am trying to log in to the app using two options one is OTP based and the other is QR based. I am looking for an option where I can have multiple AWSconfiguration.json files in one project and the AWSMobileClient can choose from one depending on the type of login in the Login View controller. I tried solutions given on some of the StackOverflow links but unfortunately, not getting the expected result.
Thanks In Advance
The ability to import media files from various apps (like Photos, Files, WhatsApp) to an app I am building (referred to as "My App" from hereon) using a share button is what I am seeking to achieve.
The user interaction process should be as follows:
Step 1: Select media file from any app
Step 2: tap share button which should list "My App" among others
So far, I have been able to get my app listed on the sharesheet sorted based on this article. I have also looked at this post that makes use of SLComposeServiceViewController which caters to the more of a social media like popup from a sharesheet. Neither of these have helped reach a solution.
However, I am unable to achieve my desired outcome from user action of selecting "My App" from the sharesheet, which is:
a. have selected media copied into a directory accessible to "My App"; and
b. launch "My App" in the View that shows the contents of this directory. (As the capitalisation of View demonstrates, I am writing "My App" in SwiftUI.)
Working through the aforementioned tutorial, I was unable to figure out how to achieve the described outcome; this might have to with my quite limited experience of to manipulating UIViewControllers, which I have managed to avoid so far with SwiftUI.
Any guidance on this matter would be highly appreciated.
For those looking for a pure SwiftUI and code-only approach way of solving the problem of importing media/data into your app, the most straightforward solution I found was to use .fileImporter in a View. An excellent explanation and example code is available here. The only drawback is that your app is not on the sharesheet but that is okay, in my opinion/use case.
The beauty of this solution is that:
It is code only and doesn't require you to mess around with the info.plist file to define the UTI as per this tutorial
better yet, you do not deal with the Share Extensions and the corresponding ShareViewController, which is no fun to figure out for a purely SwiftUI-based developer.
I know this is possible and is something many big apps do, but I can't figure out among UTIs, extensions, UIActivityTypes, etc. which spell I need to use for this in particular. I'm trying to add my app to the list of apps that appear when you hit the export button in the Notes app on iOS because I want to be able to take a bunch of text inside a note and repeatedly and safely send it into my app.
I want my app to appear in this list, exporting directly from Notes. There appear to be duplicates of this question that are very old claiming that "exporting from Notes app is not possible for third party apps", but I think they're either now wrong or answering a different question because as you can see in the above screenshot, Messenger is plainly able to do this.
It does not look like registering UTIs gets this done for me. I went ahead and registered my app to all sorts of UTIs, but all that happens is my app ends up in popups like this one, which appears when trying to open a txt file, which is not what I'm looking for. Unless there is some other UTI that does not conform to public.data or public.content which I need to be using, in which case I'd be happy to hear it.
I used one of my allotted support requests to ask Apple, and after some time and back and forth I was able to get my answer! Here is what they said:
Your project is missing a Share app extension. Start by reviewing the
App Extension Programming Guide:
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214-CH20-SW1
Information specific to the Share extension point:
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Share.html#//apple_ref/doc/uid/TP40014214-CH12-SW1
You don’t need to register the text content type in your
CFBundleDocumentTypes. as you’ve done in your sample. However, you
will need to provide an activation rule for the extension point, such
as the one shown in this section of the document (the section titled
Declaring Supported Data Types for a Share or Action Extension):
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1
See specifically the predicate example that activates the extension if
an attachment with the com.adobe.pdf UTI is present. You will need to
do something similar, to cover the UTIs for content you would like
your share extension to consume. As a starting point, you can consume
text with the public.text UTI. For more common UTIs, please see this
document:
https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1
I also found the bits about providing an activation rule to be super confusing, and this answer helped that: How do I set NSExtensionActivationRule predicates?
I wanted to know the technology decision behind the iOS Google app.
As we can see, in the app's Google Now feature it renders many different card templates for different scenarios, and those templates seems to be very flexible based on server inputs.
I was wondering if this is implemented all based on HTML5? or they just have many templates built in and render them locally? I'd vote for the HTML5 route but not sure if this still involved some native code to make it more responsive?
Thanks!
As we (well, most of the community) are not Google employees we can't tell you what they really did, but I'd say that it is possible to do this dynamically in the app.
We did develop something similar that responds to definitions sent by the server and transforms them to custom designed forms following basic rules.
Google reuses the design of those cards for different plattforms, the easiest solution should be showing some WebView and using HTML5.
I agree with Kevin, as this answer is entirely based on personal opinion, too.
The way I would go is to create a card class which will load some JSON data and format it with HTML and CSS. Looking at each card it would be hell to format things that way natively. I mean, attributed strings is not the way to go. Too much logic for deciding which card get a bigger text or a picture.
Additionally, the top header is most likely "localized" as well, so you get the location and load a localized image. But that is Google by nature.
I am trying to create a simple Today Extension. I was able to add a label wherein the value can be updated via the main app. Now, I am exploring the possibility to update the value in main app via the extension. However, when I tried to add a textfield, I cannot input anything.
Is this a limitation of the extension? If not, can you please guide me how to accomplish this? Thank you very much!
Unfortunately, it is a limitation.
It says in Apple's extension programming guide:
Because user interaction with Today widgets is quick and limited, you should design a simple, streamlined UI that highlights the information users are interested in. In general, it’s a good idea to limit the number of interactive items in a widget. In particular, note that iOS widgets don’t support keyboard entry.
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Today.html#//apple_ref/doc/uid/TP40014214-CH11-SW1