Skip to content

Commit

Permalink
Fix errors on xcode_16 with swift 6 (#309)
Browse files Browse the repository at this point in the history
* Fix errors on xcode_16 with swift 6

* Fix tests build
  • Loading branch information
etoledom authored Jul 9, 2024
1 parent 6ecd7fc commit 9a2114d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Demo/Demo/Gravatar-Demo/DemoFetchProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class DemoFetchProfileViewController: UIViewController {
title = "Fetch Profile"
view.backgroundColor = .white

[segmentedControl, emailField, fetchProfileButton, activityIndicator, profileTextView].forEach(rootStackView.addArrangedSubview)
for view in [segmentedControl, emailField, fetchProfileButton, activityIndicator, profileTextView] {
rootStackView.addArrangedSubview(view)
}
view.addSubview(rootStackView)

NSLayoutConstraint.activate([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class DemoProfilePresentationStylesViewController: DemoBaseProfileViewController
override func viewDidLoad() {
super.viewDidLoad()
title = "Profile View Controller"
[emailField, profileStylesButton, paletteButton, customizeAvatarSwitchWithLabel, showBottomSheetButton].forEach(rootStackView.addArrangedSubview)
for view in [emailField, profileStylesButton, paletteButton, customizeAvatarSwitchWithLabel, showBottomSheetButton] {
rootStackView.addArrangedSubview(view)
}
rootStackView.alignment = .center
}

Expand Down
4 changes: 3 additions & 1 deletion Demo/Demo/Gravatar-Demo/DemoProfileViewsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class DemoProfileViewsViewController: DemoBaseProfileViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = "Fetch Profile"
[emailField, paletteButton, fetchProfileButton, activityIndictorSwitchWithLabel, largeProfileView, largeProfileSummaryView, profileView, profileSummaryView].forEach(rootStackView.addArrangedSubview)
for view in [emailField, paletteButton, fetchProfileButton, activityIndictorSwitchWithLabel, largeProfileView, largeProfileSummaryView, profileView, profileSummaryView] {
rootStackView.addArrangedSubview(view)
}
}

@objc func toggleLoadingState() {
Expand Down
4 changes: 3 additions & 1 deletion Demo/Demo/Gravatar-Demo/DemoUploadImageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class DemoUploadImageViewController: UIViewController {
title = "Upload Image"
view.backgroundColor = .white

[emailField, tokenField, selectImageButton, avatarImageView, uploadImageButton, activityIndicator, resultLabel].forEach(rootStackView.addArrangedSubview)
for view in [emailField, tokenField, selectImageButton, avatarImageView, uploadImageButton, activityIndicator, resultLabel] {
rootStackView.addArrangedSubview(view)
}
view.addSubview(rootStackView)

NSLayoutConstraint.activate([
Expand Down
2 changes: 1 addition & 1 deletion Sources/Gravatar/Network/Services/AvatarService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UIKit
/// A service to perform uploading and downloading of avatars.
///
/// An avatar is a profile image of a Gravatar user. See [the avatar docs](https://support.gravatar.com/profiles/avatars/) for more info.
public struct AvatarService {
public struct AvatarService: Sendable {
private let imageDownloader: ImageDownloader
private let imageUploader: ImageUploader

Expand Down
2 changes: 1 addition & 1 deletion Sources/Gravatar/Network/Services/ImageUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import UIKit
typealias HTTPHeaderField = (name: String, value: String)

/// Represents a type which can be used by Gravatar to upload an image to Gravatar.
protocol ImageUploader {
protocol ImageUploader: Sendable {
/// Uploads an image to be used as the user's Gravatar profile image, and returns the `URLResponse` of the network tasks asynchronously. Throws
/// `ImageUploadError`.
/// - Parameters:
Expand Down
1 change: 1 addition & 0 deletions Sources/GravatarUI/ProfileView/BaseProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ open class BaseProfileView: UIView, UIContentView {
}

/// Methods for managing actions on the profile view.
@MainActor
public protocol ProfileViewDelegate: NSObjectProtocol {
/// Tells the delegate that the profile action button of the view has been tapped.
///
Expand Down
6 changes: 3 additions & 3 deletions Tests/GravatarUITests/ProfileButtonsActionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import SnapshotTesting
import XCTest

final class ProfileViewActionsTests: XCTestCase {
var delegate = TestProfileViewDelegate()
var delegate: TestProfileViewDelegate!

override func setUp() async throws {
delegate = TestProfileViewDelegate()
delegate = await TestProfileViewDelegate()
}

@MainActor
Expand Down Expand Up @@ -93,7 +93,7 @@ final class ProfileViewActionsTests: XCTestCase {
}
}

class TestProfileViewDelegate: NSObject, ProfileViewDelegate {
class TestProfileViewDelegate: NSObject, ProfileViewDelegate, Sendable {
var profileButtonActions: [(style: ProfileButtonStyle, url: URL?)] = []
var accountButtonActions: [AccountModel] = []

Expand Down

0 comments on commit 9a2114d

Please sign in to comment.