-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8af2ddb
commit 97220d1
Showing
11 changed files
with
273 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// | ||
// Copyright © 2024 Alexander Romanov | ||
// LeadingVStack.swift, created on 28.10.2024 | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct LeadingVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .leading, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} | ||
|
||
public struct TrailingVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .trailing, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} | ||
|
||
public struct CenterVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .center, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} | ||
|
||
public struct LeadingLazyVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
LazyVStack(alignment: .leading, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} | ||
|
||
public struct TrailingLazyVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
LazyVStack(alignment: .trailing, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} | ||
|
||
public struct CenterLazyVStack<Content: View>: View { | ||
private let spacing: Space | ||
private let content: Content | ||
|
||
public init(spacing: Space = .zero, @ViewBuilder content: () -> Content) { | ||
self.spacing = spacing | ||
self.content = content() | ||
} | ||
|
||
public var body: some View { | ||
LazyVStack(alignment: .center, spacing: spacing.rawValue) { | ||
content | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.