-
Notifications
You must be signed in to change notification settings - Fork 40
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
[MOB-14384] - API to modify Floating button image #633
Changes from 2 commits
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 |
---|---|---|
|
@@ -63,6 +63,17 @@ public class FloatingButton: NSObject, FloatingButtonPresentable { | |
} | ||
} | ||
|
||
/// Set the Image for the floating button. | ||
/// The size of the floating button is 60x60 (width x height), provide the image data accordingly | ||
/// - Parameters: | ||
/// - imageData : The `Data` representation of a UIImage | ||
public func setButtonImage(imageData: Data) { | ||
DispatchQueue.main.async { | ||
let image = UIImage(data: imageData) | ||
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. Any reason we can't just take in a 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. taking in +1 for moving UIImage creation outside the main thread |
||
self.buttonImageView?.image = image | ||
} | ||
} | ||
|
||
private func initFloatingButton() -> Bool { | ||
guard let newFrame: CGRect = getImageFrame() else { | ||
Log.debug(label: LOG_PREFIX, "Floating button couldn't be displayed, failed to create a new frame.") | ||
|
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.
My personal opinion here: But I don't think it is necessary to include doc comments on functions where the doc comment is defined in the protocol for the function.
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.
Agreed it was repetitive