-
-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathView+Helper.swift
More file actions
30 lines (25 loc) · 650 Bytes
/
Copy pathView+Helper.swift
File metadata and controls
30 lines (25 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
// View+Helper.swift
// SwiftUIPager
//
// Created by Fernando Moya de Rivas on 19/01/2020.
// Copyright © 2020 Fernando Moya de Rivas. All rights reserved.
//
import SwiftUI
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)
extension View {
func frame(size: CGSize) -> some View {
frame(width: size.width, height: size.height)
}
func eraseToAny() -> AnyView {
AnyView(self)
}
@ViewBuilder
func `if`<Content: View>(_ conditional: Bool, content: (Self) -> Content) -> some View {
if conditional {
content(self)
} else {
self
}
}
}