Skip to content

Support RTL Language #22

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SOTabBar/Classes/SOTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public class SOTabBar: UIView {
}

private func drawConstraint() {
if SOTabBarSetting.isRTL {
self.stackView.layer.setAffineTransform(CGAffineTransform(scaleX: -1, y: 1))
}
addSubview(stackView)
addSubview(innerCircleView)

Expand Down
3 changes: 3 additions & 0 deletions SOTabBar/Classes/SOTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ open class SOTabBarController: UIViewController, SOTabBarDelegate {
self.view.addSubview(containerView)
self.view.addSubview(tabBar)
self.view.bringSubviewToFront(tabBar)
if SOTabBarSetting.isRTL {
self.tabBar.layer.setAffineTransform(CGAffineTransform(scaleX: -1, y: 1))
}
self.drawConstraint()
}

Expand Down
6 changes: 3 additions & 3 deletions SOTabBar/Classes/SOTabBarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class SOTabBarItem: UIView {
let image: UIImage
let title: String

private lazy var titleLabel: UILabel = {
lazy var titleLabel: UILabel = {
let lbl = UILabel()
lbl.text = self.title
lbl.font = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.semibold)
lbl.textColor = UIColor.darkGray
lbl.font = SOTabBarSetting.tabbarFont
lbl.textColor = SOTabBarSetting.tabBarTextColor
lbl.textAlignment = .center
lbl.translatesAutoresizingMaskIntoConstraints = false
return lbl
Expand Down
3 changes: 3 additions & 0 deletions SOTabBar/Classes/SOTabBarSetting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import Foundation
// Here you can customize the tab bar to meet your neededs
public struct SOTabBarSetting {

public static var isRTL: Bool = false
public static var tabbarFont: UIFont = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.semibold)
public static var tabBarHeight: CGFloat = 66
public static var tabBarTintColor: UIColor = UIColor(red: 250/255, green: 51/255, blue: 24/255, alpha: 1)
public static var tabBarBackground: UIColor = UIColor.white
public static var tabBarTextColor: UIColor = UIColor.white
public static var tabBarCircleSize = CGSize(width: 65, height: 65)
public static var tabBarSizeImage: CGFloat = 25
public static var tabBarShadowColor = UIColor.lightGray.cgColor
Expand Down