[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 56/204: innerHeight
From: |
gnunet |
Subject: |
[taler-taler-ios] 56/204: innerHeight |
Date: |
Thu, 05 Dec 2024 23:50:24 +0100 |
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 0e5a0788e715b1d94f89858795911098c7dbea5a
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Oct 12 22:45:50 2024 +0200
innerHeight
---
.../Views/HelperViews/View+fixedInnerHeight.swift | 61 ++++++++++++++++++----
1 file changed, 52 insertions(+), 9 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/View+fixedInnerHeight.swift
b/TalerWallet1/Views/HelperViews/View+fixedInnerHeight.swift
index 36a010d..27d213d 100644
--- a/TalerWallet1/Views/HelperViews/View+fixedInnerHeight.swift
+++ b/TalerWallet1/Views/HelperViews/View+fixedInnerHeight.swift
@@ -20,26 +20,69 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE
* SOFTWARE.
*/
+/**
+ * @author Marc Stibane
+ */
import SwiftUI
-import UIKit
-struct InnerHeightPreferenceKey: PreferenceKey {
- static var defaultValue: CGFloat = .zero
+fileprivate struct InnerHeightKey: PreferenceKey {
+ static var defaultValue: CGFloat { 10 }
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value = nextValue()
}
}
+fileprivate struct InnerWidthKey: PreferenceKey {
+ static var defaultValue: CGFloat { 10 }
+ static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
+ value = nextValue()
+ }
+}
+
+fileprivate struct InnerSizeKey: PreferenceKey {
+ static var defaultValue: CGSize { CGSize(width: 10, height: 10) }
+ static func reduce(value: inout CGSize, nextValue: () -> CGSize) {
+ value = nextValue()
+ }
+}
+
extension View {
func innerHeight(_ height: Binding<CGFloat>) -> some View {
overlay { // background doesn't work for sheets
- GeometryReader { proxy in
- Color.clear.preference(key: InnerHeightPreferenceKey.self,
value: proxy.size.height)
- }
+ GeometryReader { proxy in
+ Color.clear
+ .preference(key: InnerHeightKey.self, value:
proxy.size.height)
+ }
+ }
+ .onPreferenceChange(InnerHeightKey.self) { newValue in
+ print("❗️InnerHeight \(newValue)❗️")
+ height.wrappedValue = newValue
+ }
+ }
+
+ func innerWidth(_ width: Binding<CGFloat>) -> some View {
+ overlay { // background doesn't work for sheets
+ GeometryReader { proxy in
+ Color.clear
+ .preference(key: InnerWidthKey.self, value:
proxy.size.width)
}
- .onPreferenceChange(InnerHeightPreferenceKey.self) { newHeight in
-// print("InnerHeightPreferenceKey \(newHeight)")
- height.wrappedValue = newHeight
+ }
+ .onPreferenceChange(InnerWidthKey.self) { newValue in
+ print("❗️InnerWidth \(newValue)❗️")
+ width.wrappedValue = newValue
+ }
+ }
+
+ func innerSize(_ size: Binding<CGSize>) -> some View {
+ overlay { // background doesn't work for sheets
+ GeometryReader { proxy in
+ Color.clear
+ .preference(key: InnerSizeKey.self, value: proxy.size)
}
+ }
+ .onPreferenceChange(InnerSizeKey.self) { newValue in
+ print("❗️InnerSize \(newValue)❗️")
+ size.wrappedValue = newValue
+ }
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 50/204: amountLastUsed, (continued)
- [taler-taler-ios] 50/204: amountLastUsed, gnunet, 2024/12/05
- [taler-taler-ios] 18/204: Unsuccessfull trial to fix TX-Detailview jump onAppear, gnunet, 2024/12/05
- [taler-taler-ios] 26/204: hide TabBarView, gnunet, 2024/12/05
- [taler-taler-ios] 40/204: EMPTYSTRING, gnunet, 2024/12/05
- [taler-taler-ios] 30/204: QrButton in Actions, gnunet, 2024/12/05
- [taler-taler-ios] 43/204: no Cancel for sheets, gnunet, 2024/12/05
- [taler-taler-ios] 51/204: scope, gnunet, 2024/12/05
- [taler-taler-ios] 45/204: pull-to-refresh haptics, gnunet, 2024/12/05
- [taler-taler-ios] 47/204: RotatingTaler for demo money, gnunet, 2024/12/05
- [taler-taler-ios] 49/204: wording, gnunet, 2024/12/05
- [taler-taler-ios] 56/204: innerHeight,
gnunet <=
- [taler-taler-ios] 60/204: Bump version to 0.13.4 (0.13.6), gnunet, 2024/12/05
- [taler-taler-ios] 55/204: cleanup, docu, gnunet, 2024/12/05
- [taler-taler-ios] 59/204: Layout, wording, gnunet, 2024/12/05
- [taler-taler-ios] 61/204: arrrow names & icons, gnunet, 2024/12/05
- [taler-taler-ios] 34/204: hideSpendingHint, gnunet, 2024/12/05
- [taler-taler-ios] 65/204: ScopeDropDown, gnunet, 2024/12/05
- [taler-taler-ios] 66/204: cleanup, remove warning, gnunet, 2024/12/05
- [taler-taler-ios] 28/204: dropBar, padding, gnunet, 2024/12/05
- [taler-taler-ios] 27/204: dismiss, gnunet, 2024/12/05
- [taler-taler-ios] 25/204: layout - smaller font, gnunet, 2024/12/05