UIViewControllerRepresentable: Navigation Title and Bar Button Items Ignored in NavigationView

Solved! Problem and Expectation SwiftUI uses a UINavigationController under the hood. So, if I push a UIViewController onto a SwiftUI NavigationView using UIViewControllerRepresentable, then I would expect the navigation item and toolbar items of that view controller to be used by said navigation controller. As I mention above, they are ignored. Root Cause It turns … Read more

How to add custom views in the new NavigationView

The new support library 23.1 allows using a custom view for the items in Navigation View using app:actionLayout or using MenuItemCompat.setActionView(). Here’s how I managed to display a SwitchCompat menu_nav.xml <?xml version=”1.0″ encoding=”utf-8″?> <menu xmlns:android=”http://schemas.android.com/apk/res/android”> <group android:id=”@+id/first” android:checkableBehavior=”single”> <item android:id=”@+id/navi_item_1″ android:icon=”@drawable/ic_feed_grey_500_24dp” android:title=”Feed” /> <item android:id=”@+id/navi_item_2″ android:icon=”@drawable/ic_explore_grey_500_24dp” android:title=”Explore” /> <item android:id=”@+id/navi_item_4″ android:icon=”@drawable/ic_settings_grey_500_24dp” android:title=”Settings” /> </group> <group … Read more

Is there a SwiftUI equivalent for viewWillDisappear(_:) or detect when a view is about to be removed?

Here is approach that works for me, it is not pure-SwiftUI but I assume worth posting Usage: SomeView() .onDisappear { print(“x Default disappear”) } .onWillDisappear { // << order does NOT matter print(“>>> going to disappear”) } Code: struct WillDisappearHandler: UIViewControllerRepresentable { func makeCoordinator() -> WillDisappearHandler.Coordinator { Coordinator(onWillDisappear: onWillDisappear) } let onWillDisappear: () -> Void … Read more

How can I change separator color in NavigationView?

just apply following line on style.xml <item name=”android:listDivider”>your_color</item> The below is just information for your knowledge … If you have seen design support library .. they are using following layout for NavigationView seprator.. <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content”> <View android:layout_width=”match_parent” android:layout_height=”1dp” android:background=”?android:attr/listDivider”/> </FrameLayout> here, you can see android:background=”?android:attr/listDivider” .. So enjoy … and here is my … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)