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

Bugfix: Fix force unwraps that lead to crashes #88

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

btxsqdr
Copy link

@btxsqdr btxsqdr commented Jul 18, 2019

Hey @zjfjack

It can happen that the framework crashes due to too many forceReloads at the same time (2-3x per second), which should not occur, of course, but the framework should also not crash.

Crash root cause are unnecessary force_unwraps. I've tried to remove those, without changing the logic much and causing new issues. The framework is more stable now.

Hint: Technically, there is no reason to use force_unwrap in Swift, except for @IBOutlet or when .dequeueReusableCell() is in use (though it can be avoided for cells). See SwiftLint and coding guidelines by Google, for instance, see https://google.github.io/swift/#force-unwrapping-and-force-casts and also the point about https://google.github.io/swift/#implicitly-unwrapped-optionals

@@ -3,28 +3,28 @@
// JZCalendarWeekView
//
// Created by Jeff Zhang on 26/4/18.
// Copyright © 2018 Jeff Zhang. All rights reserved.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was the xcode formatter, apparently. sure, let me remove it.

@zjfjack
Copy link
Owner

zjfjack commented Jul 26, 2019

Hi,
Thanks for helping me to improve this project.

Can you remove all the indents change from SwiftLint in this pull request? I think it is really confused in this pull request. If it is necessary, I will apply SwiftLint in another day and remove all the indents in this project in one commit.

Thanks again

@zjfjack
Copy link
Owner

zjfjack commented Aug 18, 2019

Hi,

In order to improve this project, I applied Swiftlint and update to Swift 5. Could you rebase the master branch and push again?

Thanks

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

Successfully merging this pull request may close these issues.

2 participants