diff --git a/Sources/OversizeCore/Extensions/Swift/Calendar+Extension.swift b/Sources/OversizeCore/Extensions/Swift/Calendar+Extension.swift index 0a823a9..9713633 100644 --- a/Sources/OversizeCore/Extensions/Swift/Calendar+Extension.swift +++ b/Sources/OversizeCore/Extensions/Swift/Calendar+Extension.swift @@ -1,6 +1,6 @@ // // Copyright © 2023 Aleksandr Romanov -// File.swift, created on 02.04.2023 +// Calendar+Extension.swift, created on 02.04.2023 // diff --git a/Sources/OversizeCore/Extensions/Swift/Decimal+Extension.swift b/Sources/OversizeCore/Extensions/Swift/Decimal+Extension.swift index 316beb6..6403ad9 100644 --- a/Sources/OversizeCore/Extensions/Swift/Decimal+Extension.swift +++ b/Sources/OversizeCore/Extensions/Swift/Decimal+Extension.swift @@ -12,7 +12,6 @@ public extension Decimal { /// - scale: How many decimal places. /// - roundingMode: How should number be rounded. Defaults to `.plain`. /// - Returns: The new rounded number. - func rounded(_ scale: Int, roundingMode: RoundingMode = .plain) -> Decimal { var value = self var result: Decimal = 0 diff --git a/Sources/OversizeCore/Extensions/Swift/String+Extension.swift b/Sources/OversizeCore/Extensions/Swift/String+Extension.swift index 135c595..945d91e 100644 --- a/Sources/OversizeCore/Extensions/Swift/String+Extension.swift +++ b/Sources/OversizeCore/Extensions/Swift/String+Extension.swift @@ -175,12 +175,6 @@ extension String { func width(font: UIFont) -> CGFloat { size(font: font).width } - -// func height(width: CGFloat, withFont font: UIFont) -> CGFloat { -// let constraintRect: CGSize = .init(width: width, height: CGFloat.greatestFiniteMagnitude) -// let boundingBox = boundingRect(with: constraintRect, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: font], context: nil) -// return ceil(boundingBox.height) + 1 -// } } public extension NSAttributedString { diff --git a/Sources/OversizeCore/Global/Log.swift b/Sources/OversizeCore/Global/Log.swift index 0d6a519..3b687a5 100644 --- a/Sources/OversizeCore/Global/Log.swift +++ b/Sources/OversizeCore/Global/Log.swift @@ -7,16 +7,16 @@ import Foundation public func log(_ objects: Any...) { #if DEBUG - log(objects.map { "\($0)" }.joined(separator: " ")) + log(objects.map { "\($0)" }.joined(separator: ", ")) #endif } public func log(_ object: Any?) { #if DEBUG if let object { - log("⚪️ \(object)") + log(object) } else { - log("⚪️ \(String(describing: object))") + log(String(describing: object)) } #endif } @@ -27,9 +27,10 @@ public func log(_ object: Any?) { #endif } -public func logWithTime(_: String, terminator: String? = nil) { +public func logWithTime(_ text: String, terminator: String? = nil) { #if DEBUG - let textWithTime: String = Date().formatted(.dateTime) + let textTime: String = Date().formatted(.dateTime) + let textWithTime = "\(textTime): \(text)" terminator == nil ? print(textWithTime) : print(textWithTime, terminator: terminator!) #endif } diff --git a/Sources/OversizeCore/ViewModifier/OnFirstAppear.swift b/Sources/OversizeCore/ViewModifier/OnFirstAppear.swift deleted file mode 100644 index c1604d5..0000000 --- a/Sources/OversizeCore/ViewModifier/OnFirstAppear.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright © 2022 Alexander Romanov -// OnFirstAppear.swift -// - -import SwiftUI - -private struct FirstAppear: ViewModifier { - let action: () -> Void - - @State private var hasAppeared = false - - func body(content: Content) -> some View { - content.onAppear { - guard !hasAppeared else { return } - hasAppeared = true - action() - } - } -} - -public extension View { - func onFirstAppear(_ action: @escaping () -> Void) -> some View { - modifier(FirstAppear(action: action)) - } -}