-
-
Save sturdysturge/eac16e783ddc83ee484edbe561a6f406 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import SwiftUI | |
| extension HorizontalAlignment { | |
| public var name: String { | |
| if #available(iOS 16.0, *) { | |
| switch self { | |
| case .trailing: | |
| return ".trailing" | |
| case .center: | |
| return ".center" | |
| case .leading: | |
| return ".leading" | |
| case .listRowSeparatorLeading: | |
| return ".listRowSeparatorLeading" | |
| case .listRowSeparatorTrailing: | |
| return ".listRowSeparatorTrailing" | |
| default: | |
| fatalError("No name for unknown type \(self)") | |
| } | |
| } else { | |
| switch self { | |
| case .trailing: | |
| return ".trailing" | |
| case .center: | |
| return ".center" | |
| case .leading: | |
| return ".leading" | |
| default: | |
| fatalError("No name for unknown type \(self)") | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment