-
-
Notifications
You must be signed in to change notification settings - Fork 22
feat: catch objc exceptions, fix: int array literal #393
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
Conversation
josxha
commented
Nov 1, 2025
- Ios catch objc exceptions (parseExpression() exceptions coming from C++, so most won't get catched)
- improve parseException()
Deploying flutter-maplibre with
|
| Latest commit: |
f212c44
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0e2e69ef.flutter-maplibre.pages.dev |
| Branch Preview URL: | https://ios-catch-objc-exceptions.flutter-maplibre.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors error handling in the iOS helper methods by replacing Swift's do-catch blocks with Objective-C exception catching using the CwlCatchException library. This change addresses the fact that setValue(forKey:) can throw Objective-C exceptions rather than Swift errors, which cannot be caught by Swift's native error handling.
- Integrated CwlCatchException library for proper Objective-C exception handling
- Refactored
parseExpression()to use early returns and a result variable pattern - Enhanced error messages with warning emoji and more descriptive context
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Helpers.swift | Replaced Swift do-catch with NSException.catchException for proper Objective-C exception handling; improved error messages and control flow in parseExpression() |
| Package.swift | Added CwlCatchException dependency to Swift Package Manager configuration |
| maplibre_ios.podspec | Added CwlCatchException dependency to CocoaPods specification |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maplibre_ios/ios/maplibre_ios/Sources/maplibre_ios/Helpers.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maplibre_ios/ios/maplibre_ios/Sources/maplibre_ios/Helpers.swift
Outdated
Show resolved
Hide resolved
maplibre_ios/ios/maplibre_ios/Sources/maplibre_ios/Helpers.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let keyword = offset.first as? String, | ||
| keyword == "literal", | ||
| offset.count == 2, | ||
| let vector = offset.last as? [Any], | ||
| vector.count == 2, | ||
| let x = vector.first as? Double, | ||
| let y = vector.last as? Double |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The nested conditional chain for parsing vector literals is difficult to follow. Consider extracting this logic into a separate helper method like parseVectorLiteral(from: [Any]) -> NSExpression? to improve readability and testability.