Skip to content

Commit

Permalink
✨ :: onSuccess 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
HongSJae committed Apr 26, 2024
1 parent 3823cb7 commit 42f064c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Projects/Shared/ViewUtil/Sources/View+onSuccess.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import SwiftUI

public extension View {
func onSuccess(of value: Bool, _ action: () -> Void) -> some View {
if value { action() }
return self
func onSuccess(of value: Bool, _ action: @escaping () -> Void) -> some View {
self.onChange(of: value) { changedValue in
if changedValue {
action()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public struct KGTextField: View {
lineWidth: 1
)
}
.onTapGesture {
self.isFocused = true
}

if !description.isEmpty || isErrorAndNotEmpty {
Text(isErrorAndNotEmpty ? errorMessage : description)
Expand Down

0 comments on commit 42f064c

Please sign in to comment.