-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Support other bundle than main MarkerView.viewFromXib() #3215
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,10 +72,15 @@ open class MarkerView: NSUIView, IMarker | |
} | ||
|
||
@objc | ||
open class func viewFromXib() -> MarkerView? | ||
open class func viewFromXib() -> MarkerView? { | ||
return viewFromXib(in: Bundle.main) | ||
} | ||
|
||
@objc | ||
open class func viewFromXib(in bundle: Bundle) -> MarkerView? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be one method: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's what I was thinking in the first place, however if someone is overriding that method it will break his code. (@objc) is declared as well here. So even more important! What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main reason to override this method is to change the bundle. If it breaks their code, this is a very minor change and we will have a few possible minor code breaking changes in 3.1. Let's make this one method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And keep the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All done. Thanks. Great job by the way :) |
||
{ | ||
#if !os(OSX) | ||
return Bundle.main.loadNibNamed( | ||
return bundle.loadNibNamed( | ||
String(describing: self), | ||
owner: nil, | ||
options: nil)?[0] as? MarkerView | ||
|
@@ -84,7 +89,7 @@ open class MarkerView: NSUIView, IMarker | |
var loadedObjects = NSArray() | ||
let loadedObjectsPointer = AutoreleasingUnsafeMutablePointer<NSArray?>(&loadedObjects) | ||
|
||
if Bundle.main.loadNibNamed( | ||
if bundle.loadNibNamed( | ||
NSNib.Name(String(describing: self)), | ||
owner: nil, | ||
topLevelObjects: loadedObjectsPointer) | ||
|
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.
please put the
{
on a new line.