From 33cd5cd2976ac58aac1538fb1a4cd08439eb2d46 Mon Sep 17 00:00:00 2001 From: tsuzukihashi Date: Fri, 20 Mar 2020 23:00:47 +0900 Subject: [PATCH] Change Frame size to Optional --- .../CustomViews/NeumorphismBindingButton.swift | 16 ++++++++-------- Sources/CustomViews/NeumorphismButton.swift | 16 ++++++++-------- .../CustomViews/NeumorphismCircleDentView.swift | 8 ++++---- Sources/CustomViews/NeumorphismDentView.swift | 8 ++++---- Sources/CustomViews/NeumorphismLabelButton.swift | 8 ++++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Sources/CustomViews/NeumorphismBindingButton.swift b/Sources/CustomViews/NeumorphismBindingButton.swift index 2252f9f..6994017 100644 --- a/Sources/CustomViews/NeumorphismBindingButton.swift +++ b/Sources/CustomViews/NeumorphismBindingButton.swift @@ -8,10 +8,10 @@ public struct NeumorphismBindingButton: View { private var shapeType: ShapeType private var normalImage: Image private var selectedImage: Image - private var width: CGFloat - private var height: CGFloat - private var imageWidth: CGFloat - private var imageHeight: CGFloat + private var width: CGFloat? + private var height: CGFloat? + private var imageWidth: CGFloat? + private var imageHeight: CGFloat? private var shadowRadius: CGFloat private var handler: (() -> Void)? @@ -21,10 +21,10 @@ public struct NeumorphismBindingButton: View { shapeType: ShapeType = .circle, normalImage: Image = Image(systemName: "heart"), selectedImage: Image = Image(systemName: "heart.fill"), - width: CGFloat = 100, - height: CGFloat = 100, - imageWidth: CGFloat = 60, - imageHeight: CGFloat = 60, + width: CGFloat? = nil, + height: CGFloat? = nil, + imageWidth: CGFloat? = nil, + imageHeight: CGFloat? = nil, shadowRadius: CGFloat = 8, handler: (() -> Void)? = nil ) { diff --git a/Sources/CustomViews/NeumorphismButton.swift b/Sources/CustomViews/NeumorphismButton.swift index be0be60..3ff20a1 100644 --- a/Sources/CustomViews/NeumorphismButton.swift +++ b/Sources/CustomViews/NeumorphismButton.swift @@ -8,10 +8,10 @@ public struct NeumorphismButton: View { private var shapeType: ShapeType private var normalImage: Image private var selectedImage: Image - private var width: CGFloat - private var height: CGFloat - private var imageWidth: CGFloat - private var imageHeight: CGFloat + private var width: CGFloat? + private var height: CGFloat? + private var imageWidth: CGFloat? + private var imageHeight: CGFloat? private var shadowRadius: CGFloat private var handler: (() -> Void)? @@ -20,10 +20,10 @@ public struct NeumorphismButton: View { shapeType: ShapeType = .circle, normalImage: Image = Image(systemName: "heart"), selectedImage: Image = Image(systemName: "heart.fill"), - width: CGFloat = 100, - height: CGFloat = 100, - imageWidth: CGFloat = 60, - imageHeight: CGFloat = 60, + width: CGFloat? = nil, + height: CGFloat? = nil, + imageWidth: CGFloat? = nil, + imageHeight: CGFloat? = nil, shadowRadius: CGFloat = 8, handler: (() -> Void)? = nil ) { diff --git a/Sources/CustomViews/NeumorphismCircleDentView.swift b/Sources/CustomViews/NeumorphismCircleDentView.swift index 0fe8ce1..14c206c 100644 --- a/Sources/CustomViews/NeumorphismCircleDentView.swift +++ b/Sources/CustomViews/NeumorphismCircleDentView.swift @@ -4,12 +4,12 @@ import SwiftUI public struct NeumorphismCircleDentView: View { @EnvironmentObject var neumorphism: NeumorphismManager - private let width: CGFloat - private let height: CGFloat + private let width: CGFloat? + private let height: CGFloat? public init( - width: CGFloat = 100, - height: CGFloat = 100 + width: CGFloat? = nil, + height: CGFloat? = nil ) { self.width = width self.height = height diff --git a/Sources/CustomViews/NeumorphismDentView.swift b/Sources/CustomViews/NeumorphismDentView.swift index 19638b5..a7223b4 100644 --- a/Sources/CustomViews/NeumorphismDentView.swift +++ b/Sources/CustomViews/NeumorphismDentView.swift @@ -4,13 +4,13 @@ import SwiftUI public struct NeumorphismDentView: View { @EnvironmentObject var neumorphism: NeumorphismManager - private let width: CGFloat - private let height: CGFloat + private let width: CGFloat? + private let height: CGFloat? private let cornerRadius: CGFloat public init( - width: CGFloat = 100, - height: CGFloat = 100, + width: CGFloat? = nil, + height: CGFloat? = nil, cornerRadius: CGFloat = 16 ) { self.width = width diff --git a/Sources/CustomViews/NeumorphismLabelButton.swift b/Sources/CustomViews/NeumorphismLabelButton.swift index a58bf10..b835bfc 100644 --- a/Sources/CustomViews/NeumorphismLabelButton.swift +++ b/Sources/CustomViews/NeumorphismLabelButton.swift @@ -7,8 +7,8 @@ public struct NeumorphismLabelButton: View { private var text: String private var font: Font? private var color: Color? - private var width: CGFloat - private var height: CGFloat + private var width: CGFloat? + private var height: CGFloat? private var cornerRadius: CGFloat private var handler: (() -> Void)? @@ -17,8 +17,8 @@ public struct NeumorphismLabelButton: View { text: String = "Button", font: Font? = nil, color: Color? = nil, - width: CGFloat = 100, - height: CGFloat = 100, + width: CGFloat? = nil, + height: CGFloat? = nil, cornerRadius: CGFloat = 10, handler: (() -> Void)? = nil ) {