lnlink

iOS app for connecting to lightning nodes
git clone git://jb55.com/lnlink
Log | Files | Refs | Submodules | README | LICENSE

commit 4c2651d242c50bf75cd4c4d2e029d105353eedef
parent 364abfca2b0771c093ff375db9c8011712c11f6b
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 31 Mar 2022 08:44:54 -0700

ocd amount_view alignment

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mlightninglink/Views/ContentView.swift | 4++--
Mlightninglink/Views/PayView.swift | 14+++++++++++++-
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lightninglink/Views/ContentView.swift b/lightninglink/Views/ContentView.swift @@ -133,8 +133,8 @@ struct ContentView: View { func main_content() -> some View { NavigationView { - VStack { - VStack { + VStack(alignment: .hcentered) { + VStack{ HStack { VStack { Text(self.dashboard.info.alias) diff --git a/lightninglink/Views/PayView.swift b/lightninglink/Views/PayView.swift @@ -143,7 +143,7 @@ struct PayView: View { } func MainView() -> some View { - return VStack { + return VStack(alignment: .hcentered) { Text("Confirm Payment") .font(.largeTitle) .padding() @@ -875,6 +875,9 @@ func amount_view(_ msats: Int64, rate mrate: ExchangeRate?) -> some View { Text(sep.0) .font(.largeTitle) .fontWeight(.bold) + .alignmentGuide(.hcentered) { + $0.width / 2.0 + } Text(sep.1) .font(.subheadline) @@ -887,3 +890,12 @@ func amount_view(_ msats: Int64, rate mrate: ExchangeRate?) -> some View { } } } + +extension HorizontalAlignment { + private enum HCenterAlignment: AlignmentID { + static func defaultValue(in dimensions: ViewDimensions) -> CGFloat { + return dimensions[HorizontalAlignment.center] + } + } + static let hcentered = HorizontalAlignment(HCenterAlignment.self) +}