From a4b45b7839b00d3f6dc18bdcbd15086092db425b Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Sat, 13 Jul 2024 19:31:54 +0800 Subject: [PATCH 1/5] feat: Allows custom `SectionEdgeInsets.groupCard` spacing --- Sources/Epoxy/CollectionView/Tools/SectionEdgeInsets.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Epoxy/CollectionView/Tools/SectionEdgeInsets.swift b/Sources/Epoxy/CollectionView/Tools/SectionEdgeInsets.swift index 2faec01..7abd07e 100644 --- a/Sources/Epoxy/CollectionView/Tools/SectionEdgeInsets.swift +++ b/Sources/Epoxy/CollectionView/Tools/SectionEdgeInsets.swift @@ -40,7 +40,7 @@ public enum SectionEdgeInsets { /// Same spacing as `.insetGrouped` style `UITableView` /// /// (top: 0, leading: 20, bottom: 35, trailing: 20) - case groupCard + case groupCard(horizontal: CGFloat = 20, bottom: CGFloat = 35) /// Fully customized using `EdgeInsets`. case custom(RAKCore.EdgeInsets) @@ -72,8 +72,8 @@ extension SectionEdgeInsets { case .all(let top, let leading, let bottom, let trailing): .init(top: top, leading: leading, bottom: bottom, trailing: trailing) - case .groupCard: - .init(top: 0, leading: 20, bottom: 35, trailing: 20) + case .groupCard(let horizontal, let bottom): + .init(top: 0, leading: horizontal, bottom: bottom, trailing: horizontal) case .custom(let edge): edge.directionalEdgeInsets From 12e656b1cbde1df7950a0e55ec46137b77a6a7bc Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Sat, 13 Jul 2024 19:34:31 +0800 Subject: [PATCH 2/5] feat: Enhance UIColor extension --- Sources/Core/Extensions/UIColor+RAK.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/Core/Extensions/UIColor+RAK.swift b/Sources/Core/Extensions/UIColor+RAK.swift index 255f708..2af0ad2 100644 --- a/Sources/Core/Extensions/UIColor+RAK.swift +++ b/Sources/Core/Extensions/UIColor+RAK.swift @@ -9,8 +9,13 @@ import UIKit extension Extendable where Base: UIColor { - public static func random(alpha: CGFloat = 1.0) -> UIColor { - UIColor( + public static var groupTableHeaderFooterTextColor: Base? { + let value = Base.perform(Selector(("_groupTableHeaderFooterTextColor"))) + return value?.takeUnretainedValue() as? Base + } + + public static func random(alpha: CGFloat = 1.0) -> Base { + .init( red: CGFloat.random(in: 0 ..< 256) / CGFloat(255.0), green: CGFloat.random(in: 0 ..< 256) / CGFloat(255.0), blue: CGFloat.random(in: 0 ..< 256) / CGFloat(255.0), From cc2f763221d969bec1e041ec8c4a080da79046b0 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Sat, 13 Jul 2024 19:37:42 +0800 Subject: [PATCH 3/5] feat: `UIView.ContentMode` conforms to the `CaseIterable` protocol --- Sources/Core/Extensions/ContentMode+RAK.swift | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Sources/Core/Extensions/ContentMode+RAK.swift diff --git a/Sources/Core/Extensions/ContentMode+RAK.swift b/Sources/Core/Extensions/ContentMode+RAK.swift new file mode 100644 index 0000000..f5651fe --- /dev/null +++ b/Sources/Core/Extensions/ContentMode+RAK.swift @@ -0,0 +1,31 @@ +// +// ContentMode+RAK.swift +// RakuyoKit +// +// Created by Rakuyo on 2024/6/12. +// Copyright © 2024 LenticularStickers. All rights reserved. +// + +import UIKit + +#if DEBUG +extension UIView.ContentMode: CaseIterable { + public static var allCases: [UIView.ContentMode] { + [ + .scaleToFill, + .scaleAspectFit, + .scaleAspectFill, + .redraw, + .center, + .top, + .bottom, + .left, + .right, + .topLeft, + .topRight, + .bottomLeft, + .bottomRight, + ] + } +} +#endif From 4a519e6b7f47f3517826fd9b10f6ca45e1d78257 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Sat, 13 Jul 2024 19:43:08 +0800 Subject: [PATCH 4/5] feat: Allows you to set the connector for date and time in DateFormat --- Sources/Core/Utilities/DateFormat.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Sources/Core/Utilities/DateFormat.swift b/Sources/Core/Utilities/DateFormat.swift index 72768a9..3cadb8d 100644 --- a/Sources/Core/Utilities/DateFormat.swift +++ b/Sources/Core/Utilities/DateFormat.swift @@ -94,7 +94,7 @@ public struct DateFormat: Equatable { /// public let format: String - public init(date: Date? = nil, time: Time? = nil) { + public init(date: Date? = nil, time: Time? = nil, separator: Separator? = nil) { switch (date, time) { case (.some(let value), nil): format = value.format @@ -103,7 +103,7 @@ public struct DateFormat: Equatable { format = value.format case (.some(let dateValue), .some(let timeValue)): - format = dateValue.format + " " + timeValue.format + format = dateValue.format + (separator?.rawValue ?? " ") + timeValue.format case (nil, nil): format = "" @@ -152,6 +152,15 @@ extension DateFormat { public static var h_m: Self { .init(time: .init([.hour, .minute])) } + + /// `yyyy_MM_dd_HH_mm_ss` + public static var fullTimeForFileName: Self { + .init( + date: .init(separator: .underscores), + time: .init(separator: .underscores), + separator: .underscores + ) + } } // MARK: - From a68536e426f8a8fe0be22c21facf150ee5d46c12 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Sat, 13 Jul 2024 19:45:02 +0800 Subject: [PATCH 5/5] feat: Add `AnyImageContent+Accessory.swift` --- .../ImageRow/AnyImageContent+Accessory.swift | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Sources/Epoxy/Row/ImageRow/AnyImageContent+Accessory.swift diff --git a/Sources/Epoxy/Row/ImageRow/AnyImageContent+Accessory.swift b/Sources/Epoxy/Row/ImageRow/AnyImageContent+Accessory.swift new file mode 100644 index 0000000..17fd7d2 --- /dev/null +++ b/Sources/Epoxy/Row/ImageRow/AnyImageContent+Accessory.swift @@ -0,0 +1,36 @@ +// +// AnyImageContent+Accessory.swift +// RakuyoKit +// +// Created by Rakuyo on 2024/7/8. +// Copyright © 2024 LenticularStickers. All rights reserved. +// + +#if !os(watchOS) +import UIKit + +import RAKConfig +import RAKCore + +extension AnyImageContent { + public static func accessory() -> Self { + .sfSymbols( + name: "chevron.forward", + color: Config.color.text.tertiary, + configuration: .init( + textStyle: .init(rawValue: "UICTFontTextStyleEmphasizedBody"), + scale: .small + ) + ) + } +} + +extension ImageRow.Style { + public static func accessory() -> Self { + .init( + size: .init(width: 10 + .rak.halfPoint, height: 20 + .rak.halfPoint), + contentMode: .scaleAspectFit + ) + } +} +#endif