Giter VIP home page Giter VIP logo

customkeyboardkit's People

Contributors

fraune avatar narsail avatar paescebu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

customkeyboardkit's Issues

Performance issues with "many" custom keyboard elements

I'm working on an app that requires to display substantial amount of TextField inputs to user on a single page (think 30+ in a grid that can be visible all at once). While utalizing default keyboard and quickly entering / deleting values in each of the fields, everything works as expected.

Once I switched to using my custom keyboard via attaching .customKeyboard to each of the text fields, I started noticing big performance issues.

Opening custom keyboard on first textfield works as expected, then things start to degrade rapidly when opening custom keyboards and entering values in more and more fields. Typing becomes laggy, animations suffer.

Is there any chance that every time a custom keyboard is shown, it never gets offloaded from memory / rendering tree when another TextField is focused, thus accumulating something over time that could be causing these rendering issues?

I know swift introspect library also adds some views on top of this to perform it's functionality, maybe that might play a role here as well?

Strange padding above the CustomKeyboard

There is a strange padding on the top of the keyboard. Is there any way to remove it?

Simplified Code

extension TextField {
    func useDecimalPickerStyle() -> some View {
        self.customKeyboard(.decimalPicker)
    }
}
extension CustomKeyboard {
    static var decimalPicker: CustomKeyboard {
        CustomKeyboardBuilder { textDocumentProxy, submit, playSystemFeedback in
            DecimalPicker(handler:textDocumentProxy)
        }
    }
}

struct DecimalPicker: View {
    
    var body: some View {
        VStack(alignment:.leading) {
            HStack {
                Button(action: {
                }) {
                    Text(self.isWheel ? "キーボード入力に切り替える" : "ピッカー入力に切り替える").foregroundColor(Color.blue).font(Font.system(size: 18))
                }
                .padding()
                Spacer()
                Button(action: {
                }) {
                    Text("完了").foregroundColor(Color.blue).font(Font.system(size: 18))
                }
                .padding()
            }.background(Color(red: 245/255, green: 245/255, blue: 245/255))
        }
        .background(Color.white)
    }
}

スクリーンショット 2024-04-10 14 21 07

Missing important keys

in custom keyboard has no delete button, case change button & no dismiss or done button

SwiftUI GeometryReader not Working with .customKeyboard

I've attempted to use a GeometryReader for a little bit more fine-tuned control over the keyboard and have not had any success. I tried outside and inside of the .customKeyboard modifier within a view, and both screw it up as to be completely unrecognizable.

Add onDismiss callback when keyboard dismissed

Thanks for your hard work on this library, it's really useful!

I wonder if you can add an onDismiss callback when custom keyboard dismissed?

When I click on other text fields (with default keyboard) while typing with custom keyboard, I need to handle something before dismissal and change the text.

Let me know if you need more details, thanks.

Possibility to "relax" exact version of swiftui-introspect library?

Started using CustomKeyboardKit today and it's a really pleasant library to work with! I was wondering if you would be open to possibility of relaxing version requirement of swiftui-introspect dependency from exact to "next major" or at least "next minor"?

Mainly, working in a project right now that uses latest version of this dependency 1.1.3 so it would be nice to share between libraries.

Alternatively, would you be open / what would it take to completely remove dependency on swiftui-introspect? If this is a viable idea, I'd be down to having a stab at this, with some help (i.e. bullet points of what needs to be done).

Custom keyboard does not show when axis argument is provided (iOS 16+)

Hello there! First off, thanks for your work on this package :)

I've been poking around with the library, and have found that when supplying the axis argument to a TextField, the custom keyboard no longer shows, falling back on the standard keyboard.

I created a repo which should clearly demonstrate the issue: https://github.com/fraune/CustomKeyboardKit_TextFieldAxis_BugDemo

I forked this repo to see if I could figure it out myself, but I don't have as much experience with introspect. I'd love to hear if you have some thoughts on how we can work through this issue.

Cheers,
–Fraune

Unable to pass conditionals or state variables in/out of the custom keyboard

I am attempting to implement something a "Shift" key so that I can shift over to so alternate characters being shown by clicking it. However, anytime I try and use a state variable from within the custom keyboard it fails completely. I tested my code in a simple view and it worked fine, but not within the custom keyboard modifier.

`struct KeyboardView: View {

@State private var isShiftHeld = false

let fullTexts = ["SHIFT", "A", "B", "C", "D", "E", "", "7", "8", "9", "F", "G", "H", "I", "J", "K", "", "4", "5", "6", "L", "M", "N", "O", "P", "Q", "", "1", "2", "3", "R", "S", "T", "U", "V", "W", "", "-", "0", ".", "X", "Y", "Z", ":", "(", ")", "", "CANCEL", "SPACE", "ENTER"]
let fullAltTexts = ["SHIFT", "A", "B", "C", "D", "E", "", "&", "@", ":", "F", "G", "H", "I", "J", "K", "", "%", "$", "!", "L", "M", "N", "O", "P", "Q", "", "*", ",", "?", "R", "S", "T", "U", "V", "W", "", "+", "=", "#", "X", "Y", "Z", ":", "[", "]", "", "CANCEL", "SPACE", "ENTER"]

let fullGrid = Array(repeating: GridItem(), count: 10)

var body: some View {
    Text(isShiftHeld ? "true" : "false")
    LazyVGrid(columns: fullGrid) {
        ForEach(fullTexts.indices, id: \.self) { index in
            Button(action: {
                if index == 0 {
                    isShiftHeld.toggle()
                }
            }) {
                Text(isShiftHeld ? fullAltTexts[index] : fullTexts[index])
                    .frame(width: 60, height: 60)
                    .foregroundColor(.white)
                    .background(.blue)
                    .cornerRadius(8)
            }
            .padding()
        }
    }
    .padding()
}

}

#Preview {
KeyboardView()
}`

[Question] playing different feedback sounds i.e input and delete

Hi 👋

Not sure if issues is correct place to ask this, as it is more of a question, but is it possible to somehow define which feedback sound needs to be played? As of now, it seems like "Input" sound is the only available option, but playing around with ios default keyboard there are 3 distinctive sounds for

  1. Clicking on letters
  2. Clicking on space / shift / done
  3. Clicking on delete / backspace

Would it be possible to add an argument to playSystemFeedback function that allows to define which sound should be played for custom keyboards?

Only calls one 'onSubmitCustomKeyboard'

This is such a help....thank you so much for posting it. You're absolutely right to say it is the easiest way to add a custom keyboard to SwiftUI.

I've been having one issue: only one onSubmitCustomKeyboard is called, even if I have multiple instances with a few different text fields. I thought at first it might be something in my code, so here's what I did to check: I started a new project in Xcode, installed the package, and copied the code of your sample yesnt keyboard. Then I only slightly modified your sample implementation:

struct ContentView: View {

    @State var text1: String = ""
    @State var text2: String = ""
    @State var text3: String = ""

        var body: some View {
            VStack {
                Text("Textfield #1:")
                TextField("", text: $text1)
                    .customKeyboard(.yesnt)
                    .onSubmitCustomKeyboard {
                        print("Textfield #1 submit")
                    }
                    .textFieldStyle(RoundedBorderTextFieldStyle())
                Text("Textfield #2")
                TextField("", text: $text2)
                    .customKeyboard(.yesnt)
                    .onSubmitCustomKeyboard {
                        print("Textfield #2 submit")
                    }
                    .textFieldStyle(RoundedBorderTextFieldStyle())
                Text("Textfield #3")
                TextField("", text: $text3)
                    .customKeyboard(.yesnt)
                    .onSubmitCustomKeyboard {
                        print("Textfield #3 submit")
                    }
                    .textFieldStyle(RoundedBorderTextFieldStyle())
            }
        }
    }

When run, only the first onSubmitCustomKeyboard is ever called ("Textfield #1 submit"), even when submit?() is called in Textfield #2 or Textfield #3.

Is that how it is supposed to work? In my own actual project, for some reason it is oddly calling the third instance of onSubmitCustomKeyboard every time, and I can't make sense of why.

Access textDocumentProxy from TextField code block

Hi @paescebu,

Sorry to bother you again.

I want to create a custom number keyboard which has calculator function, so I need to store some states for operator or result.

Is there any way I can access textDocumentProxy from TextField code block?

Code example:

struct NumberTextField: View {
    @Binding var amountText: String
    let placeholder: String?
    let isAmountEditing: FocusState<Bool>.Binding
    let onEditingChanged: (Bool) -> Void
    
    // Some states for calculation
    @State private var number = Double.zero
    @State private var buttonType = AHNumberButtonType.none
    @State private var operation = AHOperationType.none
    @State private var isInputting = false
    
    var body: some View {
        TextField("", text: $amountText, onEditingChanged: onEditingChanged)
            .customKeyboard(.numberPad)
            .onInputChanged { textDocumentProxy, submit, playSystemFeedback in
                 // I want to access textDocumentProxy from here and do some calculation
            }
            .multilineTextAlignment(.trailing)
            .focused(isAmountEditing)                           
    }
}

IMG_2522FC2B3F80-1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.