Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS app slows down or crashes when not matching #70

Open
AegerBorder opened this issue Dec 21, 2017 · 0 comments
Open

iOS app slows down or crashes when not matching #70

AegerBorder opened this issue Dec 21, 2017 · 0 comments

Comments

@AegerBorder
Copy link

AegerBorder commented Dec 21, 2017

Hi,

I'm using FuzzyMatchingSwift for a while now and in general it works really nice. I've experienced two things I wanted to share. Maybe I've been using it wrong but here's the issue:

I've integrated an SQLite Database into my iOS project. It's a movie quiz where the user has to guess the name of a movie and type it in a text field. Then the code scans the "fuzzyness" from the answer and executes an action. Here's my code:

let precission = self.guess.text?.confidenceScore(movieName)
            
            if precission! <= 0.25 {
                self.result.text = "You're right! It was \(movieName)"
      } else {
                self.result.text = "No, that's not the one. Try again!"
}

Sometimes when the "no" answer is triggered the app seems to be freezing for 2-3 seconds before the result is displayed. Sometimes even the whole app crashes.

Edit:
I tested a change and it seems that the crashes are gone but the reaction is still slow. Could it be possible that the following changes prevent the app from crashing?

let precission = Double((self.guess.text?.confidenceScore(movieName))!) //changed to Double
           
          if precission <= 0.25 {                   //deleted unwrap "!"
                self.result.text = "You're right! It was \(movieName)"
      } else {
                self.result.text = "No, that's not the one. Try again!"
}

Do you have an idea how I could improve my code here?

Thanks and regards, have a great holiday season
Patrick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant