iOS UILabel.appearance().textColor不可用

iOS UILabel.appearance().textColor不可用,ios,swift,swift4,uiappearance,Ios,Swift,Swift4,Uiappearance,我正在尝试更改应用程序中所有标签的默认文本颜色。我已尝试使用UILabel.appearance().textColor,但它不适用于我。有人能告诉我我做错了什么吗?我查了很多问题,最近的一个是。根据描述,它是可用的 如果我改变了背景颜色-它的工作。试图更改色彩-无效。为什么?它是否已从UIP协议中删除 @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCent

我正在尝试更改应用程序中所有标签的默认文本颜色。我已尝试使用
UILabel.appearance().textColor
,但它不适用于我。有人能告诉我我做错了什么吗?我查了很多问题,最近的一个是。根据描述,它是可用的

如果我改变了背景颜色-它的工作。试图更改
色彩
-无效。为什么?它是否已从UIP协议中删除

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
    var window: UIWindow?
    var smStore: SMStore?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // UIAppearance configuring
            let tintColor = UIColor.white
            //let backgroundColor = UIColor(red: 5, green: 72, blue: 149, alpha: 1)
            let backgroundColor = UIColor.black

            // Global tintColor
            window?.tintColor = tintColor

            // UIViews
            UIView.appearance().tintColor = tintColor
            UIView.appearance().backgroundColor = backgroundColor

            // UINavigationBars
            UINavigationBar.appearance().tintColor = tintColor
            UINavigationBar.appearance().backgroundColor = tintColor

            // UITableViews
            UITableView.appearance().backgroundColor = backgroundColor
            UITableViewCell.appearance().backgroundColor = backgroundColor
            UITableViewCell.appearance().tintColor = tintColor

            // UILabels
            UILabel.appearance().backgroundColor = UIColor.green
            ...
        }

Xcode 9,Swift 4.

只需键入即可。它编译

UILabel.appearance().textColor = .red

这是自动完成故障吗?