Simple fix to ensure all characters are shown without clipping... while I could try to figure a more robust solution but it feels like there are bigger fish to fry

This commit is contained in:
Chad Sykes 2020-12-26 16:02:35 -07:00
parent 8c5ae40b1e
commit cce80ae012

View file

@ -27,9 +27,9 @@ struct PinCodeTextField: NSViewRepresentable {
struct PinCodeTextField_Previews: PreviewProvider { struct PinCodeTextField_Previews: PreviewProvider {
struct PreviewContainer: View { struct PreviewContainer: View {
@State private var code = "123" @State private var code = "1234567890"
var body: some View { var body: some View {
PinCodeTextField(code: $code, numberOfDigits: 6) PinCodeTextField(code: $code, numberOfDigits: 11)
.padding() .padding()
} }
} }
@ -215,7 +215,7 @@ class PinCodeCharacterTextField: NSTextField {
) )
.size() .size()
// I guess the cell should probably be doing this sizing in order to take into account everything outside of simply the text's frame, but for some reason I can't find a way to do that which works... // I guess the cell should probably be doing this sizing in order to take into account everything outside of simply the text's frame, but for some reason I can't find a way to do that which works...
size.width += 8 size.width += 16
size.height += 8 size.height += 8
return size return size
} }