Detecting screen interaction outside of the component in SwiftUI - ios

I'm building my own custom list using LazyVStack with swipeable actions thanks to this tutorial: https://prafullkumar77.medium.com/swiftui-how-to-make-custom-swipe-able-cell-727a27abdddd
It isn't half bad as long as you read through it and understand it instead of just copying and pasting. However, much like all the currently available open-source frameworks out there, it is missing a core feature that I don't know if people are just forgetting about or it's just not possible so I thought I'd ask because I can't figure it out.
In a native list in UIKit, if you drag a list item to the semi-open state and have one of the list item actions visible but then interact anywhere else in the list via drag or tap, it will dismiss the currently visible list item action. Dismissing the action is the easy part, it's telling it to dismiss which puzzles me.
I know there are many things apple can do that isn't publicly available but this does seem like something that should theoretically be possible. I'd like to figure this out and make it publicly available as these swipeable actions are a key feature apple seemingly forgot to add before deciding to move towards these lazy stacks.

Related

Bringing Wiki page up on IOS

I am trying to get a wiki page to display on IOS. This is the first assignment in my 8-week course and I am completely lost. I have only worked with Java, Swift is a completely new language and I cant seem to find a starting point. My professor has only showed us how to bring objects into the view controller such as segmented control bars and buttons, but has not showed us how to implement code into program to interact with the objects.
I know this is a long shot, and I have exhausted all other options (even bought an IOS 9 book) but if anyone can provide a starting amount of code for me to see and work with I would be extremely grateful. I am not asking for the whole project, I just need to be able to see an example of some starting code that I can hopefully follow and progress with.
Project Details /
Project Example Images
From reading the instructions, it seems like you'll need to have a multi-component UIPickerView (this is a basic tutorial, you can use it to get the delegate methods used to interact with the pickerView, here's a more in depth tutorial) and definitely will need to use multiple UIViewControllers in order to achieve the desired result. Add BarButton Items to the bottom of the view, and control+drag on those to connect them to additional ViewControllers which can be used to select Plant/Animal Name, and to change the textColor.
On the initial viewContoller, you'll need a WKWebView above your imageView, learn more about their implementation here (note that this shows a programmatic approach, your wkWebView will likely be connected to your code from Interface Builder using an IBOutlet).
Continue to ask questions as they arise.

How to make a sheet that is partially shown when not presented in SwiftUI? (like the one in the Shortcuts app)

While many UI-elements are easy to create in SwiftUI, there´s one I'm struggling with. I don't know what it's called, but I'm talking about the bottom-search bar which turns into a full-blown sheet akin to the one shown when calling .sheet(isPresented:) when dragged up.
Here's a visual:
Screencap of the mentioned UI-element in the Shortcuts app
I realize there's a good chance this isn't possible yet, but I thought asking was worth the shot :)

Swift Drag&Drop - Move multiple items at once within the same collectionView

I'm currently trying to implement Drag&Drop in my app. I've watched this:
https://developer.apple.com/videos/play/wwdc2017/223/
(There's also a downloadable project that exactly showcases what I'm about to ask)
There's one thing I don't understand and that's this:
When I drag one item, I can drop it within the same collection view. However, that's not working anymore when I drag multiple items. No "gap" is created and when I drop the items, they just go back to their old positions.
Does this have any specific reason I'm not seeing? Because I'd love to have this feature.
I mean, I probably could implement the actual "moving the data" part (it's just a case that the demo project is not considering), but I see no way of adding this "gap" while hovering over the items.
Thanks for any advice :)
This is currently not supported with the latest set of APIs (as of iOS 13). It's possible to do by returning a proposal with intent .unspecified and drawing a drop indicator manually.
See tweet reply from Tyler Fox, Apple engineer.
I haven’t tried moving multiple items before, but the way you “create space” for a single item is by using collectionView.beginInteractiveMovementForItem(at: IndexPath) and it’s companion functions. https://developer.apple.com/documentation/uikit/uicollectionview/1618019-begininteractivemovementforitem

Replicate iOS Pattern: Instagram Search-Style Swiping Tabs

I'm starting a new iOS project in Swift, and my experience programming native iOS applications is minimal, so please bear with me if I use some whacky terminology or overlook some simple solutions.
I'm looking to replicate a pattern in the Instagram application, as seen here:
Selected Tab
Swiping Transition
For those who don't use Instagram, what's essentially going on here is something like a UIPageViewController (with swiping functionality), but with the tabs on top indicating the selected page.
Like in Instagram, I'm planning to have this functionality within a child UIViewController of a UITabBarController (you can see the "main" tabs on the bottom).
What I started out doing was creating static tabs and adding left and right gesture recognizers to the child UIViewController, which would change the page and update the indicator of the selected page on the tabs.
This works but I'm not really loving the way it looks, nor the way it's written. I don't like the idea of needing 2 instances of the tabs, and that certainly doesn't seem to be the way Instagram is doing it, because as shown in the second image, the indicator slides between the tabs.
I've searched a fair bit, but all references to replicating Instagram patterns seem to be outdated and don't address this specific element. Like I said, though, I haven't been programming native iOS for very long (I'm an Android developer and have used Xamarin for iOS), so it's possible I'm just not using the right keywords.
I'd appreciate any help y'all can offer!
Thanks

finding UI objects in xcode UI object library

this is a serious newbie question
i was just in xcode and had a detail table view (or possibly a cell within it) in a detail view controller highlighted...i had the code snippet library up in the Utilities panel. i switched to the objects library, and lo and behold were a bunch UI objects i had never seen in the list...these included radio buttons, a color well, and on and on...very useful stuff i had never seen in that list before. i navigated back to the storyboard and then came back to the object library, and this useful stuff was gone, replaced by the usual View Controller, Table View Controller, Collection View Controller, etc. list. i pulled down the Objects dropdown at the top of the object library, and saw no way to navigate to that prior list of very useful objects...
i searched using google, at stackoverflow, and the apple site and still haven't found, apparently, the right way to ask the question. apparently the object list in the Utilities pane is context sensitive, but try though i might, i have not yet figured out what needs to be highlighted in the storyboard to give me back that very valuable list of UI objects...any help deeply, and embarassedly (if that is a word) appreciated.
May be that was Mac OS controls. Sometimes it show up. Me too don't know when exactly it comes up. but if you are creating iOS app then you don't need that. it can't be used in iOS app. so its good that you leave that.
Cheers!!

Resources