Switch to gRPC client in Swift app
This commit is contained in:
parent
25a0f7c421
commit
083ec73613
93 changed files with 1666 additions and 1327 deletions
38
Apple/UI/NetworkView.swift
Normal file
38
Apple/UI/NetworkView.swift
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import SwiftUI
|
||||
|
||||
struct NetworkView<Content: View>: View {
|
||||
var color: Color
|
||||
var content: () -> Content
|
||||
|
||||
private var gradient: LinearGradient {
|
||||
LinearGradient(
|
||||
colors: [
|
||||
color.opacity(0.8),
|
||||
color
|
||||
],
|
||||
startPoint: .init(x: 0.2, y: 0),
|
||||
endPoint: .init(x: 0.8, y: 1)
|
||||
)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
content()
|
||||
.frame(maxWidth: .infinity, minHeight: 175, maxHeight: 175)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(gradient)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(.white)
|
||||
)
|
||||
)
|
||||
.shadow(color: .black.opacity(0.1), radius: 3.0, x: 0, y: 2)
|
||||
}
|
||||
}
|
||||
|
||||
extension NetworkView where Content == AnyView {
|
||||
init(network: any Network) {
|
||||
color = network.backgroundColor
|
||||
content = { AnyView(network.label) }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue