installsStandardGestureForInteractiveMovement on UICollectionView in ViewController - swift3

I want to implement reordering of collection view cells in a collection view inside a View Controller, but the moveItemAt method is not being called since I can't seem to access the installsStandardGestureForInteractiveMovement property of the CollectionViewController.
I want to know if this property is exclusive to UICollectionViewController or I can somehow access it in UIViewController currently hosting it?

Related

How to send an event from two different view branches in SwiftUI?

I'm building a SwiftUI app for macOS, then I came with the following challenge.
Given a view hierarchy like:
Which basically shows a collection of elements in ElementListView. Then the FiltersView is used to search new elements to possibly add to the element list, the results of that search are shown in rows like FilterRow.
When a user clicks on FilterRow, that means I want to add a new element to the ElementListView, but I am not sure of How to propagate events between the two branches of the view hierarchy in SwiftUI?
If I were to implement this in pure AppKit, I would probably use the responder chain, but I guess it's not the SwiftUI way of doing it.
You can have a shared ObservableObject for filters and list views. As soon as ObservableObject changes SwiftUI updates views connected to it.

How to perform action only when tabbar access view controller swift 3?

So, I have a view controller in which I have a UISegmentedControl connected to do a choice.
However, I want to set that UISegementedControl to unselected only if that view controller is accessed by pressing the tab bar to go to it. If it is accessed any other way, it can perform the standard viewWillAppear function that I have set, but only if it is accessed through the tab bar controller, I want the selection to be empty.
How would this be done?
Define a class variable in your controller, for e.g. isShownFromTabBar with true as the default value.
If you are showing the controller from a segue or from a code, set this variable to false.

When or in which controller should i load external data?

Say i have two controllers and probably a stupid question.
UITableView -> loads cell items from external HTTP resource
UIViewController -> loads information from external HTTP resource based on the cell that was tabbed
Should i/ Does one load the data needed in 2. within the table view class 1. and send it to the view controller, or load it in the view controller class 2. that gets shown when cell has been tabbed?
NB: When a cell item is tabbed, i will be using ActivityIndicator to show a loading screen.
Your question isn't super clear.
A view controller contains a view (and subviews, like your UITableView), so many developers typically use their subclassed UIViewController as a UITableViewDataSource for a table view that it's displaying.
If you have a more complicated architecture, perhaps you can designate another object to be your table view's data source.
If you select (or tab) on a different cell in the table, you can use UITableViewDelegate methods to detect another cell was selected and then adjust the data source and reload the data.

How Can i put more of 5 tabs in a Tab Bar Controller?

:D
i'm have a storyboard with a TabBarController but when i do the relationship with my others seven view controllers in mi tab bar appears a "more" Tab, How can i put this seven tabs in one tabbar?
I´ll have to do manually? with a tabbarcontroller class? or implementing Tabbar Delegate in a uiviewcontroller, But i dont have any idea how to do this.
Thank You Soo much!
Please Help Me.
Thanks Again.
I believe Apple actively discourages people from doing this in their apps, and so do I. It is never done in the iOS itself, and I have never seen it in any third-party apps either, so users will probably be confused.
If you add more than five items to the viewControllers property, the
tab bar controller automatically inserts a special view controller
(called the More view controller) to handle the display of the
additional items. The More view controller provides a custom interface
that lists the additional view controllers in a table, which can
expand to accommodate any number of view controllers. The More view
controller cannot be customized or selected and does not appear in any
of the view controller lists managed by the tab bar controller. For
the most part, it appears automatically when it is needed and is
separate from your custom content. You can get a reference to it
though by accessing the moreNavigationController property of
UITabBarController.
Also refer this link for a possible workaround!
You can use any open source custom UITabbarControler or can create your own.
As created in this open source code. JFTabBarController a custom tabbar controller on Cocoa Controls

Presenting several times the same ViewController in a TabBar inside a storyboard

Hullo,
I would like to use the same view controller to present various information from within a tabbarcontroller. The number of view controllers will be established programmatically. I found a way to do it by initiating the other viewControllers with their nib, but by using StoryBoarding I have no cue about how to get the nib identifier of a viewController.
Is it possible to use this technique, or Segues give an alternative?
Thanks, Fabrizio