Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sourcery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ configurations:
args:
autoMockableImports: [Combine, SparkTheming]
autoMockableSPIImports: [SparkCommon, SparkCommonTesting, SparkThemingTesting]
autoMockableTestableImports: [SparkButton]
autoMockableTestableImports: [SparkComponentButton]
14 changes: 7 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import PackageDescription

// swiftlint:disable all
let package = Package(
name: "SparkButton",
name: "SparkComponentButton",
platforms: [
.iOS(.v16)
],
products: [
.library(
name: "SparkButton",
targets: ["SparkButton"]
name: "SparkComponentButton",
targets: ["SparkComponentButton"]
),
.library(
name: "SparkButtonTesting",
Expand All @@ -33,7 +33,7 @@ let package = Package(
],
targets: [
.target(
name: "SparkButton",
name: "SparkComponentButton",
dependencies: [
.product(
name: "SparkCommon",
Expand All @@ -49,7 +49,7 @@ let package = Package(
.target(
name: "SparkButtonTesting",
dependencies: [
"SparkButton",
"SparkComponentButton",
.product(
name: "SparkCommon",
package: "spark-ios-common"
Expand All @@ -72,7 +72,7 @@ let package = Package(
.testTarget(
name: "SparkButtonUnitTests",
dependencies: [
"SparkButton",
"SparkComponentButton",
"SparkButtonTesting",
.product(
name: "SparkCommonTesting",
Expand All @@ -88,7 +88,7 @@ let package = Package(
.testTarget(
name: "SparkButtonSnapshotTests",
dependencies: [
"SparkButton",
"SparkComponentButton",
"SparkButtonTesting",
.product(
name: "SparkCommonSnapshotTesting",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ You are a developer ? A technical documentation in _DocC_ is available [here](ht

### Swift Package Manager

_Note: Instructions below are for using **SPM** without the Xcode UI. It's the easiest to go to your Project Settings -> Swift Packages and add SparkButton from there._
_Note: Instructions below are for using **SPM** without the Xcode UI. It's the easiest to go to your Project Settings -> Swift Packages and add SparkComponentButton from there._

To integrate using Apple's Swift package manager, without Xcode integration, add the following as a dependency to your `Package.swift`:

```swift
.package(url: "https://github.com/leboncoin/spark-ios-component-button.git", .upToNextMajor(from: "1.0.0"))
```

and then specify `SparkButton` as a dependency of the Target in which you wish to use the SparkButton.
and then specify `SparkComponentButton` as a dependency of the Target in which you wish to use the SparkComponentButton.

Here's an example `Package.swift`:

Expand Down Expand Up @@ -55,7 +55,7 @@ let package = Package(
name: "MyPackage",
dependencies: [
.product(
name: "SparkButton",
name: "SparkComponentButton",
package: "spark-ios-component-button"
),
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonAccessibilityIdentifier.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Constants/ButtonConstants.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonConstants.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 28/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Enum/Internal/ButtonType.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonType.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 09/11/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Enum/Public/Alignment/ButtonAlignment.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonAlignment.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Enum/Public/ButtonShape.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonShape.swift
// SparkButton
// SparkComponentButton
//
// Created by janniklas.freundt.ext on 08.05.23.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Properties/Internal/Border/ButtonBorder.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonBorder.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 23/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonCurrentColors.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Properties/Internal/Sizes/ButtonSizes.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonSizes.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 30/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonSpacings.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 23/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Properties/Internal/State/ButtonState.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonState.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
6 changes: 3 additions & 3 deletions Sources/Core/UseCase/GetBorder/ButtonGetBorderUseCase.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetBorderUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 23/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand All @@ -13,7 +13,7 @@ import SparkTheming
protocol ButtonGetBorderUseCaseable {
// sourcery: border = "Identical"
func execute(shape: ButtonShape,
border: Border,
border: any Border,
variant: ButtonVariant) -> ButtonBorder
}

Expand All @@ -23,7 +23,7 @@ struct ButtonGetBorderUseCase: ButtonGetBorderUseCaseable {

func execute(
shape: ButtonShape,
border: Border,
border: any Border,
variant: ButtonVariant
) -> ButtonBorder {
let radius: CGFloat
Expand Down
24 changes: 12 additions & 12 deletions Sources/Core/UseCase/GetColors/ButtonGetColorsUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SparkTheming
// sourcery: AutoMockable, AutoMockTest
protocol ButtonGetColorsUseCaseable {
// sourcery: theme = "Identical"
func execute(theme: Theme,
func execute(theme: any Theme,
intent: ButtonIntent,
variant: ButtonVariant) -> ButtonColors
}
Expand All @@ -20,20 +20,20 @@ struct ButtonGetColorsUseCase: ButtonGetColorsUseCaseable {

// MARK: - Private properties

private let getContrastUseCase: ButtonGetVariantUseCaseable
private let getFilledUseCase: ButtonGetVariantUseCaseable
private let getGhostUseCase: ButtonGetVariantUseCaseable
private let getOutlinedUseCase: ButtonGetVariantUseCaseable
private let getTintedUseCase: ButtonGetVariantUseCaseable
private let getContrastUseCase: any ButtonGetVariantUseCaseable
private let getFilledUseCase: any ButtonGetVariantUseCaseable
private let getGhostUseCase: any ButtonGetVariantUseCaseable
private let getOutlinedUseCase: any ButtonGetVariantUseCaseable
private let getTintedUseCase: any ButtonGetVariantUseCaseable

// MARK: - Initialization

init(
getContrastUseCase: ButtonGetVariantUseCaseable = ButtonVariantGetContrastUseCase(),
getFilledUseCase: ButtonGetVariantUseCaseable = ButtonGetVariantFilledUseCase(),
getGhostUseCase: ButtonGetVariantUseCaseable = ButtonGetVariantGhostUseCase(),
getOutlinedUseCase: ButtonGetVariantUseCaseable = ButtonGetVariantOutlinedUseCase(),
getTintedUseCase: ButtonGetVariantUseCaseable = ButtonGetVariantTintedUseCase()
getContrastUseCase: any ButtonGetVariantUseCaseable = ButtonVariantGetContrastUseCase(),
getFilledUseCase: any ButtonGetVariantUseCaseable = ButtonGetVariantFilledUseCase(),
getGhostUseCase: any ButtonGetVariantUseCaseable = ButtonGetVariantGhostUseCase(),
getOutlinedUseCase: any ButtonGetVariantUseCaseable = ButtonGetVariantOutlinedUseCase(),
getTintedUseCase: any ButtonGetVariantUseCaseable = ButtonGetVariantTintedUseCase()
) {
self.getContrastUseCase = getContrastUseCase
self.getFilledUseCase = getFilledUseCase
Expand All @@ -44,7 +44,7 @@ struct ButtonGetColorsUseCase: ButtonGetColorsUseCaseable {

// MARK: - Methods
func execute(
theme: Theme,
theme: any Theme,
intent: ButtonIntent,
variant: ButtonVariant
) -> ButtonColors {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetCurrentColorsUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/UseCase/GetSizes/ButtonGetSizesUseCase.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetSizesUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 23/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetSpacingsUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 23/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand All @@ -11,14 +11,14 @@ import SparkTheming
// sourcery: AutoMockable, AutoMockTest
protocol ButtonGetSpacingsUseCaseable {
// sourcery: spacing = "Identical"
func execute(spacing: LayoutSpacing) -> ButtonSpacings
func execute(spacing: any LayoutSpacing) -> ButtonSpacings
}

struct ButtonGetSpacingsUseCase: ButtonGetSpacingsUseCaseable {

// MARK: - Methods

func execute(spacing: LayoutSpacing) -> ButtonSpacings {
func execute(spacing: any LayoutSpacing) -> ButtonSpacings {
return .init(
horizontalSpacing: spacing.large,
horizontalPadding: spacing.medium
Expand Down
6 changes: 3 additions & 3 deletions Sources/Core/UseCase/GetState/ButtonGetStateUseCase.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetStateUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 27/06/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand All @@ -12,7 +12,7 @@ import SparkTheming
protocol ButtonGetStateUseCaseable {
// sourcery: dims = "Identical"
func execute(isEnabled: Bool,
dims: Dims) -> ButtonState
dims: any Dims) -> ButtonState
}

struct ButtonGetStateUseCase: ButtonGetStateUseCaseable {
Expand All @@ -21,7 +21,7 @@ struct ButtonGetStateUseCase: ButtonGetStateUseCaseable {

func execute(
isEnabled: Bool,
dims: Dims
dims: any Dims
) -> ButtonState {
let opacity = isEnabled ? dims.none : dims.dim3

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonVariantGetContrastUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by janniklas.freundt.ext on 16.05.23.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand All @@ -14,8 +14,8 @@ struct ButtonVariantGetContrastUseCase: ButtonGetVariantUseCaseable {

func execute(
intent: ButtonIntent,
colors: Colors,
dims: Dims
colors: any Colors,
dims: any Dims
) -> ButtonColors {
let borderColor = ColorTokenDefault.clear
let pressedBorderColor = ColorTokenDefault.clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct ButtonGetVariantFilledUseCase: ButtonGetVariantUseCaseable {

func execute(
intent: ButtonIntent,
colors: Colors,
dims: Dims
colors: any Colors,
dims: any Dims
) -> ButtonColors {
let borderColor = ColorTokenDefault.clear
let pressedBorderColor = ColorTokenDefault.clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct ButtonGetVariantGhostUseCase: ButtonGetVariantUseCaseable {

func execute(
intent: ButtonIntent,
colors: Colors,
dims: Dims
colors: any Colors,
dims: any Dims
) -> ButtonColors {
let borderColor = ColorTokenDefault.clear
let pressedBorderColor = ColorTokenDefault.clear
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonGetVariantOutlinedUseCase.swift
// SparkButton
// SparkComponentButton
//
// Created by janniklas.freundt.ext on 16.05.23.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand All @@ -14,8 +14,8 @@ struct ButtonGetVariantOutlinedUseCase: ButtonGetVariantUseCaseable {

func execute(
intent: ButtonIntent,
colors: Colors,
dims: Dims
colors: any Colors,
dims: any Dims
) -> ButtonColors {
let dim5 = dims.dim5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct ButtonGetVariantTintedUseCase: ButtonGetVariantUseCaseable {

func execute(
intent: ButtonIntent,
colors: Colors,
dims: Dims
colors: any Colors,
dims: any Dims
) -> ButtonColors {
let borderColor = ColorTokenDefault.clear
let pressedBorderColor = ColorTokenDefault.clear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import SparkTheming
// sourcery: AutoMockable, AutoMockTest
protocol ButtonGetVariantUseCaseable {
// sourcery: colors = "Identical", dims = "Identical"
func execute(intent: ButtonIntent, colors: Colors, dims: Dims) -> ButtonColors
func execute(intent: ButtonIntent, colors: any Colors, dims: any Dims) -> ButtonColors
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ButtonContainerView.swift
// SparkButton
// SparkComponentButton
//
// Created by robin.lemaire on 24/11/2023.
// Copyright © 2023 Leboncoin. All rights reserved.
Expand Down
Loading