We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I switched the language to ar and adjusted the card demo, and found that the rtl layout is not supported. Is there any plan to support it?
// CardViewController.swift private class CardView: UIView { let titleLabel: UILabel = { let label = UILabel() label.font = UIFont.boldSystemFont(ofSize: 22) label.backgroundColor = .red return label }() let subtitleLabel: UILabel = { let label = UILabel() label.font = UIFont.systemFont(ofSize: 16) label.backgroundColor = .green return label }() let leadingLabel: UILabel = { let label = UILabel() label.text = "Leading" label.font = UIFont.systemFont(ofSize: 16) label.backgroundColor = .gray return label }() let trailingLabel: UILabel = { let label = UILabel() label.text = "Trailing" label.font = UIFont.systemFont(ofSize: 16) label.backgroundColor = .orange return label }() var onTap: (() -> Void)? var data: CardData? { didSet { titleLabel.text = data?.title subtitleLabel.text = data?.subtitle } } override init(frame: CGRect) { super.init(frame: frame) backgroundColor = .blue layer.cornerRadius = 8 layer.shadowColor = UIColor.black.cgColor layer.shadowRadius = 4 layer.shadowOpacity = 0.2 layer.shadowOffset = CGSize(width: 0, height: 2) addSubview(titleLabel) addSubview(subtitleLabel) addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTap))) addSubview(leadingLabel) addSubview(trailingLabel) leadingLabel.translatesAutoresizingMaskIntoConstraints = false trailingLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ leadingLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 20), leadingLabel.topAnchor.constraint(equalTo: subtitleLabel.bottomAnchor, constant: 8), trailingLabel.leadingAnchor.constraint(equalTo: leadingLabel.trailingAnchor, constant: 8), trailingLabel.topAnchor.constraint(equalTo: subtitleLabel.bottomAnchor, constant: 8), ]) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @objc func didTap() { onTap?() } override func layoutSubviews() { super.layoutSubviews() titleLabel.frame = CGRect(x: 20, y: 12, width: bounds.width - 40, height: 30) subtitleLabel.frame = CGRect(x: 20, y: 40, width: bounds.width - 40, height: 30) } } private struct CardComponent: Component { let data: CardData let onTap: () -> Void func layout(_ constraint: Constraint) -> CardRenderNode { CardRenderNode(data: data, onTap: onTap, size: CGSize(width: constraint.maxSize.width, height: 80 + 30)) } }
// CardViewController3.swift private struct Card: ComponentBuilder { let card: CardData let onTap: () -> Void func build() -> some Component { VStack(spacing: 8) { Text(card.title).font(UIFont.boldSystemFont(ofSize: 22)) .size(width: .fill) .backgroundColor(.red) Text(card.subtitle) .backgroundColor(.green) HStack(spacing: 8) { Text("Leading") .backgroundColor(.gray) Text("Trailing") .backgroundColor(.orange) } } .inset(top: 16, left: 20, bottom: 16, right: 50).size(width: .fill).tappableView(onTap).id(card.id) .backgroundColor(.blue) .with(\.layer.shadowColor, UIColor.black.cgColor) .with(\.layer.shadowRadius, 4) .with(\.layer.shadowOffset, CGSize(width: 0, height: 2)) .with(\.layer.shadowOpacity, 0.2) .with(\.layer.cornerRadius, 8) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I switched the language to ar and adjusted the card demo, and found that the rtl layout is not supported. Is there any plan to support it?
The text was updated successfully, but these errors were encountered: