Skip to content

Commit

Permalink
chore: Do not use SwiftUIMacros
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinperignon committed Jul 30, 2024
1 parent d1d6b53 commit 9a8afea
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 33 deletions.
18 changes: 0 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,6 @@
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
"version" : "510.0.2"
}
},
{
"identity" : "swiftui-macros",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Wouter01/SwiftUI-Macros.git",
"state" : {
"revision" : "a7d9eeaec29c2d46fa1ada18f3a54a13ddf043b0",
"version" : "1.2.0"
}
}
],
"version" : 2
Expand Down
6 changes: 2 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ let package = Package(
.package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "11.0.0")),
.package(url: "https://github.com/Infomaniak/SnackBar.swift", .upToNextMajor(from: "1.2.0")),
.package(url: "https://github.com/onevcat/Kingfisher", .upToNextMajor(from: "7.10.0")),
.package(url: "https://github.com/matomo-org/matomo-sdk-ios", .upToNextMajor(from: "7.5.2")),
.package(url: "https://github.com/Wouter01/SwiftUI-Macros.git", .upToNextMajor(from: "1.2.0"))
.package(url: "https://github.com/matomo-org/matomo-sdk-ios", .upToNextMajor(from: "7.5.2"))
],
targets: [
.target(
Expand All @@ -27,8 +26,7 @@ let package = Package(
"Kingfisher",
.product(name: "MatomoTracker", package: "matomo-sdk-ios"),
.product(name: "InfomaniakCore", package: "ios-core"),
.product(name: "SnackBar", package: "SnackBar.swift"),
.product(name: "SwiftUIMacros", package: "SwiftUI-Macros")
.product(name: "SnackBar", package: "SnackBar.swift")
]),
.testTarget(
name: "InfomaniakCoreUITests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ enum IKButtonHeight {
static let medium: CGFloat = 40

static func convert(controlSize: ControlSize) -> CGFloat {
switch controlSize {
case .large:
if controlSize == .large {
return IKButtonHeight.large
default:
} else {
return IKButtonHeight.medium
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,88 @@
*/

import SwiftUI
import SwiftUIMacros

// MARK: - EnvironmentValues

@available(iOS 15.0, *)
@EnvironmentValues public extension EnvironmentValues {
var ikButtonPrimaryStyle: any ShapeStyle = TintShapeStyle.tint
var ikButtonSecondaryStyle: any ShapeStyle = Color.primary
public extension EnvironmentValues {
// MARK: IKButtonPrimaryStyleKey

var ikButtonPrimaryStyle: any ShapeStyle {
get {
self[IKButtonPrimaryStyleKey.self]
}
set {
self[IKButtonPrimaryStyleKey.self] = newValue
}
}

private struct IKButtonPrimaryStyleKey: EnvironmentKey {
static let defaultValue: any ShapeStyle = TintShapeStyle.tint
}

// MARK: IKButtonSecondaryStyleKey

var ikButtonSecondaryStyle: any ShapeStyle {
get {
self[IKButtonSecondaryStyleKey.self]
}
set {
self[IKButtonSecondaryStyleKey.self] = newValue
}
}

private struct IKButtonSecondaryStyleKey: EnvironmentKey {
static let defaultValue: any ShapeStyle = Color.primary
}

// MARK: IKButtonThemeKey

var ikButtonTheme = IKButtonTheme.defaultTheme
var ikButtonTheme: IKButtonTheme {
get {
self[IKButtonThemeKey.self]
}
set {
self[IKButtonThemeKey.self] = newValue
}
}

private struct IKButtonThemeKey: EnvironmentKey {
static let defaultValue = IKButtonTheme.defaultTheme
}

var ikButtonFullWidth = false
// MARK: IKButtonFullWidthKey

var ikButtonLoading = false
var ikButtonFullWidth: Bool {
get {
self[IKButtonFullWidthKey.self]
}
set {
self[IKButtonFullWidthKey.self] = newValue
}
}

private struct IKButtonFullWidthKey: EnvironmentKey {
static let defaultValue = false
}

// MARK: IKButtonLoadingKey

var ikButtonLoading: Bool {
get {
self[IKButtonLoadingKey.self]
}
set {
self[IKButtonLoadingKey.self] = newValue
}
}

private struct IKButtonLoadingKey: EnvironmentKey {
static let defaultValue = false
}
}

// MARK: - View functions
// MARK: - View extension

@available(iOS 15.0, *)
public extension View {
Expand Down

0 comments on commit 9a8afea

Please sign in to comment.