SwiftUI: Missing actions from share sheet when using ShareLink with SharePreview - ios

I am currently having issues with the implementation of a SwiftUI share sheet for an iOS16 application that I want to develop. I Implemented the share sheet using ShareLink that I want to customize with a SharePreview. The item I want to share is a simple link.
I implemented the share sheet exactly like described in Apple's documentation:
ShareLink(
item: URL(string: "https://developer.apple.com/xcode/swiftui/")!,
preview: SharePreview(
"SwiftUI",
image: Image("SwiftUI")
)
)
This, results in a weird share sheet that only has one action for creating a "New Quick Note".
What I want to achieve, however, is a "normal" share sheet with all available share options. But I was only able to make this happen by deleting the custom SharePreview, as shown below.
ShareLink(
item: URL(string: "https://developer.apple.com/xcode/swiftui/")!
)
So: Is this the bug or am I doing something wrong here? Any help is much appreciated :)

Related

How to modify a ShareViewController so that choosing an app in the share sheet results in saving media and launching the selected app?

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.

iOS Share Extension, get title of shared Item

Does anyone know if it is possible to access the title of a shared item in a share extension.
I know that it is possible to get title and some other attributes by JavaScript. The problem is I want to get the title of items shared from the YouTube App for example. In the Image below it would be the string "Welcome G2.."
Thanks for your help.
I believe it is only possible by supplying URL as shared item to the UIActivityViewController. The header will configure itself with appropriate icon, title and domain. It looks like the example you have provided, YouTube app, uses exactly that.
UPDATE: to retrive title you can use URLSession, try this approach.

Why does images in Google spreadsheet often change their place?

I am currently working with Google Script which accepts the user input and store in the other spreadsheet. This logic works ok but to facilitate this, I have created a form like provision on my worksheet and placed some images which look like buttons. When I (and other collaborators) open this spreadsheet, we often observe that images are not on their place as shown below,
Note: See above, buttons (images) 'Get Case Details' & 'Deletegate Tasks' are not on their original positions. Ideally, they should appear as below,
As a workaround, I just go to some other tab/worksheet and come back to mine which shows the image location correctly.
I checked this discussion on Google Doc forum but looks like a known issue, no answer yet.
Does anyone have any idea? Has anyone come across this problem?
Besides the discussion that you linked, there a lot of other similar reports over the years on the Google Docs Help Forum and other places on the web.
One alternative is to increase the whitespace around the buttons. Another alternative is to use another UI element like custom menus, a side panel or dialogs.

How create a Slide-out Sidebar in iOS

I want create slide-out sidebar. but I want to do, like in google map or other material design app of google.
If anyone has sample code, please share them with.
Example
http://cdn.pttrns.com/pttrns/3304/original/IMG_0015.PNG
There's a lot of libraries that you can use to implement this. I suggest you to visit Cocoacontrols and find the one that you like the most.
Anyway, try using REFrostedViewController: https://github.com/romaonthego/REFrostedViewController
My solution for this would be using this awesome controller.
https://github.com/pkluz/PKRevealController

How can we update a cell in Google Spreadsheet through a URL parameter?

I have a Google Spreadsheet that is intended for public access. However, I'd like to allow for URL parameter(s) through a user's browser that can help modify one or more cells of the spreadsheet before the entire spreadsheet is presented on the screen.
See the example here.
Is something like this possible?
https://spreadsheets.google.com/ccc?key=0AgvcQSA3jj3ydGlQV2E4bndaaWNEbnVqbU5hbk1Va0E&hl=en?B4=8
Can something like the URL above succeed in changing B4 to 8 before the spreadsheet is presented to the requesting user?
See this question. The question
I'm not sure if you can do it and open the spreadsheet with the same link (I've asked a question about that too), but if you read the answer by Serge insas (on the first question linked), mainly edit 2, you'll see how to use HTTP Get to edit cells with a link.

Resources