How to set alignment for WKInterface Label using setAttributedText
You need to use NSMutableParagraphStyle
:
var paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = NSTextAlignment.CenterTextAlignment
How to get the text out of a WKInterfaceLabel
WKInterfacLabel
has only setter
property and no getter
property as defined by Apple.
Check this WKInterfaceLabel
class declaration :
Related Topics
Swift: Print Name of a Function Stored in a Variable
Swift: Nstextfield Allow Only Specified Characters
Migration from Swift 3 to Swift 4 - Cannot Convert String to Expected String.Element
Phase 1 and Phase 2 Initialization in Swift
How to Import Googleanalytics Header into a Library Framework
Rotate a Text View and Its Frame in Swiftui
Using Decodable with Inheritance Raises an Exception
Generic Within a Generic in Swift
Swift/Cloudkit: After Record Changed, Upload Triggers "Service Record Changed"
Ios: Ambiguous Use of Init(Cgimage)
Is .Playground a Swift File? Who Can 'See' It
Xcode Playgrounds Shared Directory Not Working
How to Switch an Xcode Project to Use Swift Version 1.2 in the Xcode 7 Beta
Set Custom Uiview Frame in Uiviewrepresentable Swiftui
How to Add 3D Shapes in Swift Ui