taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 0df6b05f1b40650f12517d11636e669cc439d530
parent a9f37010a880fd2291ff300491bd35abc6afc78d
Author: Marc Stibane <marc@taler.net>
Date:   Sun, 19 Nov 2023 13:29:40 +0100

tabbed button strings

Diffstat:
MTalerWallet1/Helper/TalerStrings.swift | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/TalerWallet1/Helper/TalerStrings.swift b/TalerWallet1/Helper/TalerStrings.swift @@ -40,6 +40,15 @@ extension StringProtocol { } extension String { + func tabbed(oneLine: Bool) -> String { + let fragments = self.components(separatedBy: "\t") + if fragments.count > 1 { + let separator = oneLine ? " " : "\n" + return fragments.joined(separator: separator) + } + return self + } + func widthOfString(usingUIFont font: UIFont) -> CGFloat { let fontAttributes = [NSAttributedString.Key.font: font] let size = self.size(withAttributes: fontAttributes)