[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 13/32: width of rendered string
From: |
gnunet |
Subject: |
[taler-taler-ios] 13/32: width of rendered string |
Date: |
Mon, 16 Oct 2023 00:03:11 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 8b08e6e2c4df24682ed10ffb8ddb98f7bf523697
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Oct 13 10:31:38 2023 +0200
width of rendered string
---
TalerWallet1/Helper/TalerStrings.swift | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/TalerWallet1/Helper/TalerStrings.swift
b/TalerWallet1/Helper/TalerStrings.swift
index d1443b4..6c39f67 100644
--- a/TalerWallet1/Helper/TalerStrings.swift
+++ b/TalerWallet1/Helper/TalerStrings.swift
@@ -3,9 +3,9 @@
* See LICENSE.md
*/
import Foundation
+import UIKit
extension StringProtocol {
-
func trimURL() -> String {
if let url = URL(string: String(self)) {
if let host = url.host {
@@ -15,3 +15,14 @@ extension StringProtocol {
return String(self)
}
}
+
+extension String {
+ func widthOfString(usingUIFont font: UIFont) -> CGFloat {
+ let fontAttributes = [NSAttributedString.Key.font: font]
+ let size = self.size(withAttributes: fontAttributes)
+ return size.width
+ }
+}
+// This would be used like so:
+// let uiFont = UIFont.systemFont(ofSize: 17, weight: .bold)
+// let width = "SomeString".widthOfString(usingUIFont: uiFont)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (bb640f0 -> 65313c5), gnunet, 2023/10/15
- [taler-taler-ios] 04/32: CallStack, gnunet, 2023/10/15
- [taler-taler-ios] 19/32: AccessibilityNotification.Announcement, gnunet, 2023/10/15
- [taler-taler-ios] 01/32: products seem no longer mandatory, gnunet, 2023/10/15
- [taler-taler-ios] 18/32: updateExchange, gnunet, 2023/10/15
- [taler-taler-ios] 14/32: fix bars, gnunet, 2023/10/15
- [taler-taler-ios] 03/32: Debugging, gnunet, 2023/10/15
- [taler-taler-ios] 17/32: getCurrencySpecification, gnunet, 2023/10/15
- [taler-taler-ios] 02/32: Layout for QR-View and ThreeAmounts, gnunet, 2023/10/15
- [taler-taler-ios] 08/32: cleanup, gnunet, 2023/10/15
- [taler-taler-ios] 13/32: width of rendered string,
gnunet <=
- [taler-taler-ios] 10/32: secret token, gnunet, 2023/10/15
- [taler-taler-ios] 15/32: TwoRowButtons, gnunet, 2023/10/15
- [taler-taler-ios] 05/32: No spellout, gnunet, 2023/10/15
- [taler-taler-ios] 09/32: TabBar for Taler Wallet - GNU Taler stays on SideView, gnunet, 2023/10/15
- [taler-taler-ios] 16/32: Source of Truth for balances, gnunet, 2023/10/15
- [taler-taler-ios] 30/32: font, gnunet, 2023/10/15
- [taler-taler-ios] 27/32: SingleAxisGeometryReader, gnunet, 2023/10/15
- [taler-taler-ios] 06/32: More CallStack for Debugging, gnunet, 2023/10/15
- [taler-taler-ios] 07/32: AsyncSemaphore, gnunet, 2023/10/15
- [taler-taler-ios] 23/32: fix for broken scalable font (not finished), gnunet, 2023/10/15