NetNewsWire/iOS/SwiftUI Extensions/VibrantButtonStyle.swift

26 lines
849 B
Swift
Raw Normal View History

2019-09-16 17:57:27 +02:00
//
// VibrantButtonStyle.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 9/16/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import SwiftUI
struct VibrantButtonStyle: ButtonStyle {
2019-09-16 18:35:09 +02:00
let alignment: Alignment
2019-09-16 17:57:27 +02:00
func makeBody(configuration: Configuration) -> some View {
GeometryReader { geometry in
configuration.label
2019-09-16 18:35:09 +02:00
.frame(width: geometry.size.width, height: geometry.size.height, alignment: self.alignment)
2019-09-16 17:57:27 +02:00
}
.foregroundColor(configuration.isPressed ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
.listRowBackground(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
.background(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
}
}