Skip to content

Commit

Permalink
Support other bundle than main MarkerView.viewFromXib() (ChartsOrg#3215)
Browse files Browse the repository at this point in the history
* - Added optional  in bundle to the viewFromXib()

* Small styling fix

* Keep only one method with Optional load from a bundle

* Fixed new method signature in Obj-C Demo
  • Loading branch information
charlymr authored and Konstantin Zyrianov committed Feb 20, 2018
1 parent ec1dc52 commit c5395c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ChartsDemo/Objective-C/Demos/RadarChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ - (void)viewDidLoad
_chartView.innerWebColor = UIColor.lightGrayColor;
_chartView.webAlpha = 1.0;

RadarMarkerView *marker = (RadarMarkerView *)[RadarMarkerView viewFromXib];
RadarMarkerView *marker = (RadarMarkerView *)[RadarMarkerView viewFromXibIn:[NSBundle mainBundle]];
marker.chartView = _chartView;
_chartView.marker = marker;

Expand Down
6 changes: 3 additions & 3 deletions Source/Charts/Components/MarkerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ open class MarkerView: NSUIView, Marker
}

@objc
open class func viewFromXib() -> MarkerView?
open class func viewFromXib(in bundle: Bundle = .main) -> MarkerView?
{
#if !os(OSX)
return Bundle.main.loadNibNamed(
return bundle.loadNibNamed(
String(describing: self),
owner: nil,
options: nil)?[0] as? MarkerView
Expand All @@ -84,7 +84,7 @@ open class MarkerView: NSUIView, Marker
var loadedObjects = NSArray()
let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer<NSArray?>(&loadedObjects)

if Bundle.main.loadNibNamed(
if bundle.loadNibNamed(
NSNib.Name(String(describing: self)),
owner: nil,
topLevelObjects: loadedObjectsPointer)
Expand Down

0 comments on commit c5395c8

Please sign in to comment.