ra1028 / Carbon

🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

Home Page:https://ra1028.github.io/Carbon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass focus between components with keyboard's return key

leoparenti opened this issue · comments

Description

I'll describe you my scenario. I have a form made in Carbon with two text fields. I want to be able to change the focused component by pressing keyboard's return key. When I reach the last one I want to display Done or Send (it depends on the specific scenario).

Proposed Solution

Taken the idea from here: https://medium.com/swift2go/swift-move-to-the-next-uitextfield-by-hitting-return-c3ce44ee9591

and implemented in Example project of my fork: https://github.com/leoparenti/Carbon

You can clone it and check it.

This solution uses tags and viewWithTag and it works, but I understand it's not the Carbon way of doing things, but I haven't find a better way to do it. Do you have better ideas or solutions to achieve the same final result, but with something more compliant to Carbon? Thank you in advance.

Hi @leoparenti ,
Sorry for my late response.

Carbon, like frameworks such as IGListKit, doesn't support complex features other than rendering list elements.
Also, Carbon is implemented with no magic, so you can implement it in the same way as for the normal case for the UITableView.
Your implementation is an effective one, and you can also select other way referring to the existing great material published by the pioneers.