mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Improve About page layout
This commit is contained in:
37
iOS/SwiftUI Extensions/AttributedStringView.swift
Normal file
37
iOS/SwiftUI Extensions/AttributedStringView.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// AttributedStringView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AttributedStringView: UIViewRepresentable {
|
||||
|
||||
let string: NSAttributedString
|
||||
let preferredMaxLayoutWidth: CGFloat
|
||||
|
||||
func makeUIView(context: Context) -> UILabel {
|
||||
return UILabel()
|
||||
}
|
||||
|
||||
func updateUIView(_ view: UILabel, context: Context) {
|
||||
view.attributedText = string
|
||||
|
||||
view.numberOfLines = 0
|
||||
view.lineBreakMode = .byWordWrapping
|
||||
view.preferredMaxLayoutWidth = preferredMaxLayoutWidth
|
||||
|
||||
view.adjustsFontForContentSizeCategory = true
|
||||
view.font = .preferredFont(forTextStyle: .body)
|
||||
view.textColor = UIColor.label
|
||||
view.tintColor = AppAssets.secondaryAccentColor
|
||||
view.backgroundColor = UIColor.secondarySystemGroupedBackground
|
||||
|
||||
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
view.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user