Skip to content

Commit

Permalink
Update CodeExt.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Nov 14, 2023
1 parent 27e2f18 commit 96d5cb9
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions DarockBili Watch App/Extension/CodeExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import OSLog
import SwiftUI
//import Dynamic
import Dynamic
import CryptoKit
import Alamofire
import Foundation
Expand Down Expand Up @@ -123,8 +123,8 @@ public func getMemory() -> Float {
/// 切换时间显示
/// - Parameter b: 是否显示
public func hideDigitalTime(_ b: Bool) {
// let app = Dynamic.PUICApplication.sharedPUICApplication()
// app._setStatusBarTimeHidden(b, animated: true, completion: nil)
let app = Dynamic.PUICApplication.sharedPUICApplication()
app._setStatusBarTimeHidden(b, animated: true, completion: nil)
}

public class WbiSign: ObservableObject {
Expand Down Expand Up @@ -211,16 +211,52 @@ public class WbiSign: ObservableObject {

postfix operator ++
postfix operator --
prefix operator ++
prefix operator --
extension Int {
@discardableResult
static postfix func ++ (num: inout Int) -> Int {
num += 1
return num
return num - 1
}

@discardableResult
static postfix func -- (num: inout Int) -> Int {
num -= 1
return num + 1
}

@discardableResult
static prefix func ++ (num: inout Int) -> Int {
num += 1
return num
}

@discardableResult
static prefix func -- (num: inout Int) -> Int {
num -= 1
return num
}
}

postfix operator ?
extension Optional {
static postfix func ? (opt: Int?) -> Int {
return opt ?? 0
}
static postfix func ? (opt: String?) -> String {
return opt ?? ""
}
static postfix func ? (opt: Double?) -> Double {
return opt ?? 0.0
}
static postfix func ? (opt: Float?) -> Float {
return opt ?? 0.0
}
static postfix func ? (opt: Bool?) -> Bool {
return opt ?? false
}
}



0 comments on commit 96d5cb9

Please sign in to comment.