Skip to content

Commit

Permalink
Fix swift6
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Dec 27, 2024
1 parent 437c040 commit 4fb66e9
Show file tree
Hide file tree
Showing 35 changed files with 1,838 additions and 1,796 deletions.
42 changes: 23 additions & 19 deletions Sources/OversizeComponents/Activity/ActivityViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@
//

#if os(iOS)
import SwiftUI
import UIKit
import SwiftUI
import UIKit

public struct ActivityViewController: UIViewControllerRepresentable {
public init(activityItems: [Any], applicationActivities: [UIActivity]? = nil) {
self.activityItems = activityItems
self.applicationActivities = applicationActivities
}

var activityItems: [Any]
var applicationActivities: [UIActivity]?
public struct ActivityViewController: UIViewControllerRepresentable {
public init(activityItems: [Any], applicationActivities: [UIActivity]? = nil) {
self.activityItems = activityItems
self.applicationActivities = applicationActivities
}

public func makeUIViewController(context _: UIViewControllerRepresentableContext<ActivityViewController>)
-> UIActivityViewController
{
let controller = UIActivityViewController(activityItems: activityItems,
applicationActivities: applicationActivities)
return controller
}
var activityItems: [Any]
var applicationActivities: [UIActivity]?

public func updateUIViewController(_: UIActivityViewController,
context _: UIViewControllerRepresentableContext<ActivityViewController>) {}
public func makeUIViewController(context _: UIViewControllerRepresentableContext<ActivityViewController>)
-> UIActivityViewController
{
let controller = UIActivityViewController(
activityItems: activityItems,
applicationActivities: applicationActivities
)
return controller
}

public func updateUIViewController(
_: UIActivityViewController,
context _: UIViewControllerRepresentableContext<ActivityViewController>
) {}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import SwiftUI

public struct AsyncIllustrationView: View {
#if os(iOS) || os(macOS)
@Environment(\.controlSize) var controlSize: ControlSize
@Environment(\.controlSize) var controlSize: ControlSize
#endif

#if os(iOS)
let scale = UIScreen.main.scale
let scale = UIScreen.main.scale
#else
let scale: CGFloat = 2
let scale: CGFloat = 2
#endif

let path: String
Expand All @@ -40,28 +40,28 @@ public struct AsyncIllustrationView: View {

var scaleLabel: String {
if scale == 3 {
return "@\(String(format: "%.0f", scale))x"
"@\(String(format: "%.0f", scale))x"
} else {
return ""
""
}
}

var illustrationSize: CGFloat {
#if os(iOS) || os(macOS)
switch controlSize {
case .mini:
return 16
case .small:
return 24
case .regular:
return 32
case .large, .extraLarge:
return 48
@unknown default:
return 24
}
#else
switch controlSize {
case .mini:
return 16
case .small:
return 24
case .regular:
return 32
case .large, .extraLarge:
return 48
@unknown default:
return 24
}
#else
return 24
#endif
}
}
21 changes: 11 additions & 10 deletions Sources/OversizeComponents/FieldScreen/FieldScreenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ public struct FieldScreenView: View {

@Environment(\.dismiss) var dismiss

public init(_ label: String,
placeholder: String,
text: Binding<String>,
helperText: Binding<String> = .constant(""),
showHelper: Binding<Bool> = .constant(false),
leadingImage: IconsNames = .none,
trallingImage: IconsNames = .none,
buttonText: String = "Save",
buttonAction: @escaping () -> Void)
{
public init(
_ label: String,
placeholder: String,
text: Binding<String>,
helperText: Binding<String> = .constant(""),
showHelper: Binding<Bool> = .constant(false),
leadingImage: IconsNames = .none,
trallingImage: IconsNames = .none,
buttonText: String = "Save",
buttonAction: @escaping () -> Void
) {
self.label = label
self.placeholder = placeholder
_text = text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public struct FloatingTabBar<Content: View>: View {
}
.ignoresSafeArea()
.onPreferenceChange(TabItemPreferenceKey.self) { value in
tabs = value
Task { @MainActor in
tabs = value
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeComponents/FloatingTabBar/TabItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import SwiftUI

public struct TabItem: Identifiable, Equatable {
public struct TabItem: Identifiable, Equatable, Sendable {
public var id = UUID()
public var text: String?
public var icon: Image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import SwiftUI

struct TabItemPreferenceKey: PreferenceKey {
struct TabItemPreferenceKey: PreferenceKey, Sendable {
static var defaultValue: [TabItem] {
[]
}
Expand Down
Loading

0 comments on commit 4fb66e9

Please sign in to comment.