Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL (Right to left) problem and suggestion to solve it + asking for new option #18

Open
Idomo opened this issue Aug 2, 2018 · 12 comments

Comments

@Idomo
Copy link

Idomo commented Aug 2, 2018

When using the library with device that it's main language is RTL (right to left) the right/left arrows are replacing positions and it's a little bit confusing.
Beside fix the arrows to not be language directional, I'd like to suggest add an configuration option to use up/down arrows thats won't make this problem with RTL languages to be so visible and also allow choose different appearance.
It will be awesome if this configuration will be in the AppDelegate.swift so it will change it all over the application.

In additional to the last sentence I'd like to ask adding an option to change the buttons as UIBarButtonItem and not just as text, so we will be able to change it to buttons like Done, Save etc. that already found as default in the iOS and also translating automatically and make the button bold in some cases, right now the only way to do that is to config it manually to each UITextField, it will be much better to have an option to change that at the AppDelegate.swift.

Thanks,
Ido.

@T-Pham
Copy link
Owner

T-Pham commented Aug 3, 2018

  • I tried changing the language to Arabic but couldn't reproduce the issue where the left and right button are swapped position. Is there any other settings that I need to change to make it happen?

  • The fact that one can change button titles system-wide and custom each instance using UIBarButtonItem is by-design. I wanted to make it easy for common case (changing titles, in case of localisation, for example), while open for customisation (advanced usage like using UIBarButtonItem).
    But there are workarounds to help you achieve what you want. You can create helper method for example. Or you can subclass UITextField and UITextView, in the subclasses, you can customize the navigationFieldToolbar as you want.

@Idomo
Copy link
Author

Idomo commented Aug 3, 2018

@T-Pham the issue is that the buttons are swapped where it shouldn’t (and in my case I’m using Hebrew as the device language).
Note that in safari for example, there are up/down buttons and the “Done” button is bold like it should be, it’s better UI/UX for iOS users.

You right, I didn’t thought about this option, thanks (:

@T-Pham
Copy link
Owner

T-Pham commented Aug 4, 2018

This is a bit confusing to me. So, in Hebrew:

  • Should the buttons be placed as < > or > < to be considered correct?
  • Should the > button navigate to nextNavigationField or previousNavigationField?

@T-Pham
Copy link
Owner

T-Pham commented Aug 4, 2018

This is really interesting in fact. Just tried to change my phone language to Hebrew. Now in Safari, the < button goes back one page and the > goes forward one page. The ^ and v buttons do not change behaviour though.

@Idomo
Copy link
Author

Idomo commented Aug 4, 2018

@T-Pham It should be like in any language, directions are international.
I’m not sure if the right arrow should move to the next/prev, thats why I think up/down buttons will be much easier to understand and also will look more native as you can see them in safari, mail and etc.

@Idomo
Copy link
Author

Idomo commented Aug 4, 2018

img_1437

@T-Pham
Copy link
Owner

T-Pham commented Aug 5, 2018

Fixed the button labels for RTL languages in version 4.1.

I will look into the issue with up/down icons later as this will require adding a bundle to the library because the up/down icons are images.

@Idomo
Copy link
Author

Idomo commented Sep 25, 2018

@T-Pham

I will look into the issue with up/down icons later as this will require adding a bundle to the library because the up/down icons are images.

Hi, I'v found those characters for up/down arrows, but I think if you can add images that will match safari, mail and etc. (as you can see in the image I'v posted here) it will be better.

UITextField_Navigation.Config.nextButtonTitle = "∨"//⤺
UITextField_Navigation.Config.previousButtonTitle = "∧"//⤻

@Idomo
Copy link
Author

Idomo commented Oct 16, 2018

@T-Pham one more thing I think I'v missed in this thread is asking you the add an option to make the buttons (or at least the Done button) bold, when changing their values from the AppDelegate instead of doing that in each page manually (delete all the buttons and then add all of them again just for bold text is too much work).
BTW, what about the up/down arrows addition?

@T-Pham
Copy link
Owner

T-Pham commented Oct 18, 2018

Actually I think the problem with having to repeatedly make the Done button bold in each page can be solved by refactoring on the app side. We can create helpers or subclasses or something else depending on the actual case. The thing is the library does provide a way to make the Done button bold, best practises like DRY can be achieved on the app side.

@T-Pham
Copy link
Owner

T-Pham commented Oct 18, 2018

I didn't have time to look into the up/down arrow issue.
I would also need to consider the fact that we would need to include a bundle with image files into the library, which I probably don't want to.

@Idomo
Copy link
Author

Idomo commented Oct 18, 2018

Actually I think the problem with having to repeatedly make the Done button bold in each page can be solved by refactoring on the app side. We can create helpers or subclasses or something else depending on the actual case. The thing is the library does provide a way to make the Done button bold, best practises like DRY can be achieved on the app side.

Now I remembered that you told me something about doing this via extension.
You can add to the README some example like this if someone will be interested in this like me:

extension NavigationFieldToolbar {
  public override func didAddSubview(_ subview: UIView) {
    doneButton.style = .done
    previousButton.image = FASOcticons().chevronUpIcon(size: 22).image
    nextButton.image = FASOcticons().chevronDownIcon(size: 22).image
  }
}

I think using this library would be helpful: pod 'FontAwesomeSwift/Octicons'
https://github.com/charles-oder/FontAwesomeSwift/blob/master/FontAwesomeSwift/Octicons/FASOcticons.swift
It's a very small library (only 3 files) and it doesn't have too much icons, but it is have the up/down arrows icons! (see all of them here: https://octicons.github.com/)
So just use octicon-chevron-up/down and thats it, you don't have to add any photo to your library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants