cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement FUISidebar?

12-01-2021 11:29 AM
perage Participant
951 views 6 comments
0 Likes
SAP Managed Tags
Subscribe

Hi,

Can anyone give some hints on how to completely implement the FUISidebar? I've looked at the reference guide found here, but it is only partial (gives no clues on how to show/hide it and if it needs to be part of a FUIFormTableViewcontroller or something else?

I've tried to initialize it and add it with view.addSubview(sidebar) inside ViewDidLoad() but nothing happened.

Both in Xcode docu and in the link above, this code is mentioned

        let sidebar = FUISideBar(data: items,
                                 children: \.children,
                                 rowContent: { item in
                                   FUISideBarListItem(icon: item.icon, title: item.title, subtitle: item.subtitle, accessoryIcon: item.status)
                                 },
                                 selectedItem: items.first)<br>

but FUISideBarListItem takes not arguments in its init()

Xcode compiler:<br>Argument passed to call that takes no arguments<br>Remove '(icon: item.icon, title: item.title, subtitle: item.subtitle, accessoryIcon: item.status)'
0 Likes

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Likes

Please note that the side bar needs to be added to the root nav view controller.

UIApplication.shared.windows.first?.rootViewController

0 Likes

FYI that we created a functional side bar example and please kindly find the implementation in the source code:

https://github.wdf.sap.corp/Tango/com.sap.mobile.platform.client.hcp.sdk.ios.ui/tree/a755b94a09dbd50...

perage
Participant
0 Likes

Thanks justinguo! The link is unfortunately not available for the public:(

0 Likes

We will update the header doc aligned with latest implementation. Stay tuned and I will post when a new version is available.

0 Likes

Dear Colleague,

Thanks for the question and happy to help.

You are right, FUISideBarListItem takes no arguments in initialization since they can be update on-demand after initialization. Please kindly refer to the following example:

FUISideBar(footer: isPad ? footer : nil, data: items, children: \.children,

rowContent: { item in

let v = FUISideBarListItem()

v.title.text = item.title

v.subtitle.text = item.subtitle

v.leadingImageView.image = item.icon?.withRenderingMode(.alwaysTemplate)

v.trailingImageView.image = item.status?.withRenderingMode(.alwaysTemplate)

return v},

selectedItem: initialSelection)

perage
Participant
0 Likes

Thanks justinguo !

Any info on how to add it to the view/Vc and hide/show?

Looking forward to the update 🙂