Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Link π
#5023
Goals β½
Make
MarkerViewwork in MacOS, and add an example of it into the MacOS sample app.Implementation Details π§
MarkerViewdidSetinchartViewproperty, which calls a new functiondidAddToChart(_:).didAddToChart(_:)only does anything in OSX. It adds theMarkerViewas an off-screen subview of thechartView's containing view. This is necessary because theMarkerViewwould not render in OSX without it having been added to a view already. See this SO answer for more context.viewFromXib(in:)to returnSelfrather thanMarkerViewso that subclasses will return as their own type rather than the base class.viewFromXib(in:)to find the first instance ofSelfin the loaded objects from the xib rather than assuming that the first object in that array was the one we'd be looking for. In MacOS this was a problem because the view was often second in the xib's loaded objects rather than the first.viewFromXib(in:), setwantsLayerto true for the resulting view, which was also necessary to render the view duringdraw(context:point:)as referenced in previous StackOverflow answer.Testing Details π
RadarMarkerViewMacin the MacOS sample app, which is nearly identical to theRadarMarkerViewin the iOS sample app.RadarMarkerViewMacas the marker in the MacOS sample'sRadarDemoViewController.RadarDemoViewControllerdisplayed the marker as expected.