Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in progress #9

Open
25 of 27 tasks
shaps80 opened this issue Jul 4, 2022 · 14 comments
Open
25 of 27 tasks

Work in progress #9

shaps80 opened this issue Jul 4, 2022 · 14 comments
Labels
enhancement New feature or request

Comments

@shaps80
Copy link
Owner

shaps80 commented Jul 4, 2022

In order to keep everyone up-to-date with what I'm working on and to avoid duplication, here's a list of the currently planned additions/backports. Some just require documentation and cleanup (since they were developed some time ago), others are not yet in development. If you need a feature and want to know if you should start on it yourself, please check with me first to ensure we reach a similar solution.

WIP

  • scrollBounceBehaviour

Up next

Version 2.0.0

  • FocusState
  • onSubmit
  • submitLabel
  • presentationBackgroundInteraction
  • presentationContentInteraction
  • presentationCornerRadius
  • TextEditor

Version `1.13.0

  • UniformTypeIdentifiers

Version 1.12.0

  • PhotosPicker

Version 1.11.0

  • Toolbar (limited)

Version 1.10.0

Version 1.9.0

  • ImageRenderer
  • ShareLink

Version 1.5.0

  • Table Hosting

Version 1.5.0

  • LabelledContent
  • quickLookPreview

Version 1.4.0

  • ScrollDismissesKeyboard
  • ScrollIndicators
  • ScrollEnabled

Version 1.3.1

  • List Pull-to-Refresh

Version 1.2.0

  • Dismiss (environment)
  • DynamicTypeSize
  • AppStore Review
  • OpenURL modifier
@shaps80 shaps80 added the enhancement New feature or request label Jul 4, 2022
@shaps80 shaps80 pinned this issue Jul 18, 2022
@shaps80 shaps80 changed the title Upcoming Additions Work in progress Jul 18, 2022
@schiewe
Copy link
Contributor

schiewe commented Aug 31, 2022

Hi @shaps80, great work! Are there any plans to backport the iOS 16 PhotosPicker?

@shaps80
Copy link
Owner Author

shaps80 commented Aug 31, 2022

Potentially, I've done a similar thing in the past, including property wrappers that make fetching way easier and thus far simpler to build custom UI rapidly. Feel free to check it out: https://github.com/SwiftUI-Plus/Media

@pblondin
Copy link

Hi @shaps80, thanks a lot for your work! This is really helpful!

I'm curious, do you think it would be possible to backport the @AccessibilityFocusState wrapper? I honestly have not clue if it's even possible.

Thanks in advance! 🙏

@shaps80
Copy link
Owner Author

shaps80 commented Sep 19, 2022

To be honest, I have no clue, and I don't have the time at the moment to investigate. Feel free to look into it yourself and comment here with more details and then I can have a deeper discussion about it. I just don't have the time myself at the moment, sorry

@tazmancoder
Copy link

Hi @shaps80, thanks for putting in all the work on this. I have a question regarding the new ShareLink. I currently use ActivitiyView, but I noticed in my fork there's a message at the top with the following:

This backport is now available as Backport.ShareLink, in a single Backports library, with a LOT more additions. This should simply my efforts and allow me and others to contribute more backports in the near future. SwiftUI Backports

But when I added the back ports library ShareLink wasn't there, when will this be there?
Also, will you be adding extra functionality like ActivityView has where there's an onComplete. I need this because I update my CoreData Store when the share is complete.

@shaps80
Copy link
Owner Author

shaps80 commented Sep 28, 2022

Hey! Thanks for reaching out. Yeah sorry about the left in comment. I had to pull that because it didn't work close enough to expectation. I had planned to revisit the implementation but hadn't found the time atm.

Regarding additional features I've only done this in a few key areas where the API was relevant. This would be a little more difficult to define given it's not supposed to be used in that way (at least currently).

That being said when I revisit this I'll have a think about those things. Tbh it'd be nice to support custom activity's etc too.

But perhaps my SwiftUI+ lib would be better suited for this. Let me see what I can come up with 👍

@tazmancoder
Copy link

tazmancoder commented Sep 28, 2022 via email

@shaps80
Copy link
Owner Author

shaps80 commented Sep 28, 2022

Yep ActivityView is def sticking around since its super useful. I’ll take another crack at ShareLink at some point, will keep this Issue open a little longer so I can reply to you if I manage something earlier 👍

@shaps80
Copy link
Owner Author

shaps80 commented Sep 29, 2022

@tazmancoder great news, I found the old branch and realised I'd gone a lot further than I'd expected. I've filled in the blanks and it's pretty close now. Including iOS and macOS support.

I had to include something like Transferable but its obviously not a complete backport.

However there's a new API in the CoreTransferable that allows you to get progress and feedback when an NSItemProvider has finished loading some resource. I'm thinking this could be a nice approach for knowing when 'sharing' has completed, that's not directly connected to ShareLink which is a UI element.

This would likely suit your needs as well, since updating your model should occur once the resource has actually been shared, not when some UI has been dismissed.

Will keep you updated, but should have a branch, including this ShareLink implementation, by tomorrow 👍

Side note, in order to support arbitrary view's for preview's etc I also back ported the new ImageRenderer so that'll be included in the backports as well 👍

@tazmancoder
Copy link

tazmancoder commented Sep 29, 2022 via email

@shaps80
Copy link
Owner Author

shaps80 commented Sep 30, 2022

FYI I’ve fallen sick today, will get to this very soon, just need a couple days 👍🏻

@shaps80
Copy link
Owner Author

shaps80 commented Oct 3, 2022

@tazmancoder ok so if you point to main you can try out the initial ShareLink implementation. It currently support String, URL, Image and UI/NS Image types.

In order to support custom previews and things like import/export including knowledge about transfers, I plan to also backport Tranferable. More specifically this will bring support for arbitrary Data and Codable types, making it far more useful without having to do the copying to file (for example) manually.

This will take a while longer but the current implementation is pretty usable for the most use-cases.

main also now includes a full implementation of ImageRenderer however its currently only for iOS (macOS support coming soon)

For a rough example, these all work perfectly.

VStack(spacing: 40) {
    Backport.ShareLink(item: "Hello, world!") {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundColor(.accentColor)
            Text("Hello, world!")
        }
    }
    .buttonStyle(.plain)

    Backport.ShareLink(item: "Some text to share")
    Backport.ShareLink("Benkau", item: URL(string: "https://benkau.com")!)
}

Even a few hidden extras 'just work' – like the right Label style is used in toolbar buttons so you don't see the text for example. And also the title support localization keys, etc. as expected too.


Final note

The share sheet implementation here is far better than ActivityView, since it makes use of the newer APIs and ensures the sheet presents as quickly as possible regardless of the content. Its also macOS supported!

If you don't find what you're looking for in ShareLink and want to use that directly, you can just copy/paste the new implementation I wrote for this for presenting the sheet itself.

It's called ShareSheet and it uses ActivityItem to control presentation. I will not be providing those types publicly here since they're not 'backports' but you can absolutely copy/paste them for now if you want a more performant implementation that feels more familiar to the previous library.

I will later update ActivityView to use this new approach, will take a while longer though and it'll be a 2.0 for that lib, deprecating the existing APIs in favour of the new one.

@tazmancoder
Copy link

tazmancoder commented Nov 15, 2022 via email

@shaps80
Copy link
Owner Author

shaps80 commented Feb 6, 2023

@tazmancoder as mentioned above, this package does not use that implementation so I hope you don't think I'm ignoring the question but I don't want to flood this ticket which was honestly just for my own tracking of work in progress, in a transparent way.

Thanks.

Repository owner locked as off-topic and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants