-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add LabelDisplayable protocol, add Button+SFSymbol extension, Update & reorganize constants extensions * Bump minimum version for iOS, macOS, tvOS & watchOS, add support for visionOS * Update README content * fix Button+SFSymbol extension encapsulation * fix LabelDisplayable encapsulation * Add Setting protocol
- Loading branch information
Showing
12 changed files
with
138 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Setting.swift | ||
// Caffeine | ||
// | ||
// Created by Jota Uribe on 30/01/25. | ||
// | ||
|
||
import Foundation | ||
|
||
@available(iOS 16, *) | ||
@available(macOS 13, *) | ||
@available(tvOS 16, *) | ||
@available(watchOS 9, *) | ||
public protocol Setting: Hashable, LabelDisplayable { | ||
static var key: String { get } | ||
static var localizedDescription: LocalizedStringResource { get } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...Caffeine/Extensions/CGFloat+Spacing.swift → ...affeine/Constants/CGFloat+Constants.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// CGSize+Constants.swift | ||
// Caffeine | ||
// | ||
// Created by Jota Uribe on 1/11/24. | ||
// | ||
|
||
import struct CoreGraphics.CGFloat | ||
import struct CoreGraphics.CGSize | ||
|
||
/// Mainly intended for icons size usage | ||
public extension CGSize { | ||
/// 16x16 | ||
static let small: CGSize = .init(width: 16, height: 16) | ||
/// 24x24 | ||
static let regular: CGSize = .init(width: 24, height: 24) | ||
/// 32x32 | ||
static let large: CGSize = .init(width: 32, height: 32) | ||
} | ||
|
||
public extension CGSize { | ||
static let infinity = CGSize(width: CGFloat.infinity, height: CGFloat.infinity) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Button+SFSymbol.swift | ||
// Caffeine | ||
// | ||
// Created by Jota Uribe on 1/11/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@available(iOS 16, *) | ||
@available(macOS 13, *) | ||
@available(tvOS 16, *) | ||
@available(watchOS 9, *) | ||
public extension Button where Label == SwiftUI.Label<Text, Image> { | ||
init(role: ButtonRole? = .none, action: @escaping () -> Void, title: LocalizedStringResource, symbol: SFSymbol) { | ||
self.init(role: role, action: action, label: { Label(title, symbol: symbol) }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// LabelDisplayable.swift | ||
// Caffeine | ||
// | ||
// Created by Jota Uribe on 1/11/24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
@available(iOS 16, *) | ||
@available(macOS 13, *) | ||
@available(tvOS 16, *) | ||
@available(watchOS 9, *) | ||
public protocol LabelDisplayable { | ||
var localizedValue: LocalizedStringResource { get } | ||
var symbol: SFSymbol { get } | ||
} | ||
|
||
@available(iOS 16, *) | ||
@available(macOS 13, *) | ||
@available(tvOS 16, *) | ||
@available(watchOS 9, *) | ||
public extension LabelDisplayable { | ||
func button(role: ButtonRole? = .none, action: @escaping () -> Void) -> Button<Label<Text, Image>> { | ||
Button(role: role, action: action, title: localizedValue, symbol: symbol) | ||
} | ||
|
||
func image() -> Image { | ||
Image(symbol) | ||
} | ||
|
||
func label() -> Label<Text, Image> { | ||
Label(localizedValue, symbol: symbol) | ||
} | ||
} |