-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settle up and multiple split option support
- Loading branch information
1 parent
2c9f48a
commit 43a990a
Showing
134 changed files
with
7,145 additions
and
1,853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// OtpTextInputView.swift | ||
// BaseStyle | ||
// | ||
// Created by Amisha Italiya on 20/06/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct OtpTextInputView: View { | ||
|
||
private let OTP_TOTAL_CHARACTERS = 6 | ||
|
||
@Binding var text: String | ||
|
||
var isFocused: FocusState<Bool>.Binding | ||
var keyboardType: UIKeyboardType | ||
|
||
var onOtpVerify: (() -> Void)? | ||
|
||
public init(text: Binding<String>, isFocused: FocusState<Bool>.Binding, | ||
keyboardType: UIKeyboardType = .numberPad, onOtpVerify: ( () -> Void)? = nil) { | ||
self._text = text | ||
self.isFocused = isFocused | ||
self.keyboardType = keyboardType | ||
self.onOtpVerify = onOtpVerify | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .center, spacing: 10) { | ||
TextField("", text: $text) | ||
.kerning(16) | ||
.tint(primaryColor) | ||
.font(.subTitle1(34)) | ||
.foregroundColor(primaryText) | ||
.multilineTextAlignment(.center) | ||
.keyboardType(keyboardType) | ||
.textContentType(.oneTimeCode) | ||
.disableAutocorrection(true) | ||
.focused(isFocused) | ||
.onChange(of: text) { newValue in | ||
if newValue.count == OTP_TOTAL_CHARACTERS { | ||
onOtpVerify?() | ||
UIApplication.shared.endEditing() | ||
} | ||
} | ||
|
||
Divider() | ||
.background(outlineColor) | ||
.padding(.horizontal, 60) | ||
} | ||
.onAppear { | ||
if text.isEmpty { | ||
isFocused.wrappedValue = true | ||
} else { | ||
isFocused.wrappedValue = false | ||
UIApplication.shared.endEditing() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.