-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Label ios14 #80
base: master
Are you sure you want to change the base?
Label ios14 #80
Conversation
/// - Parameters: | ||
/// - title: The LocalizedStringKey of right part text of the label | ||
/// - icon: The visual representation of left part image of the label | ||
@available(iOS 14.0, *) |
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.
Why are these 3 inits iOS14 available? I think you should be able to remove this constraint.
private func setupView(_ view: UIStackView, context: Context) { | ||
guard let labelStyleType = context.viewValues?.labelStyle?.labelStyleType else { return } | ||
|
||
context.viewOperationQueue.addOperation { |
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.
It's not necessary to use the operation queue in this case.
Note: The operation queue main purpose is to flatten view hierarchy updates that would add strain to the call stack causing potential stack overflows. Usually this is used when you want to call updateView
of children views.
|
||
public func createView(context: Context) -> UIView { | ||
let hstack = HStack { | ||
Spacer() |
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.
It seems this view always expands horizontally and always centered. Please confirm this behavior.
import UIKit | ||
|
||
@available(iOS 14.0, *) | ||
public typealias LocalizedStringKey = String |
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.
I think you can remove the constraint for this typealias
implement ios 14 Label
https://developer.apple.com/documentation/swiftui/label