Skip to content

Commit 6c28586

Browse files
authored
chore(predictions): resolve swiftformat errors and warnings (#3851)
* chore(predictions): resolve swiftformat errors and warnings * updated swiftformat rules * remove duplicate import statement
1 parent b10caf8 commit 6c28586

File tree

97 files changed

+371
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+371
-329
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin+Configure.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77

88
@_spi(InternalAmplifyConfiguration) import Amplify
9-
import Foundation
109
import AWSPluginsCore
10+
import Foundation
1111

1212
extension AWSPredictionsPlugin {
1313
/// Configures AWSPredictionsPlugin with the specified configuration.
@@ -68,7 +68,7 @@ extension AWSPredictionsPlugin {
6868
config: PredictionsPluginConfiguration
6969
) {
7070
self.predictionsService = predictionsService
71-
self.coreMLService = coreMLSerivce
71+
coreMLService = coreMLSerivce
7272
self.authService = authService
7373
self.config = config
7474
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin+Convert.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
9+
import Foundation
1010
@_spi(PredictionsConvertRequestKind) import Amplify
1111
import AWSPolly
1212

1313
extension AWSPredictionsPlugin {
1414

15-
public func convert<Input, Options, Output>(
16-
_ request: Predictions.Convert.Request<Input, Options, Output>,
15+
public func convert<Options, Output>(
16+
_ request: Predictions.Convert.Request<some Any, Options, Output>,
1717
options: Options?
1818
) async throws -> Output {
1919
switch request.kind {
@@ -102,7 +102,7 @@ extension AWSPredictionsPlugin {
102102
voice: Predictions.Voice?,
103103
config: PredictionsPluginConfiguration
104104
) -> PollyClientTypes.VoiceId {
105-
if let voice = voice,
105+
if let voice,
106106
let pollyVoiceID = PollyClientTypes.VoiceId(rawValue: voice.id) {
107107
return pollyVoiceID
108108
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin+Identify.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
9+
import Foundation
1010
@_spi(PredictionsConvertRequestKind) import Amplify
1111
import AWSPolly
1212

13-
extension AWSPredictionsPlugin {
14-
public func identify<Output>(
13+
public extension AWSPredictionsPlugin {
14+
func identify<Output>(
1515
_ request: Predictions.Identify.Request<Output>,
1616
in image: URL,
1717
options: Predictions.Identify.Options?

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin+Interpret.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
9+
import Foundation
1010
@_spi(PredictionsConvertRequestKind) import Amplify
1111

12-
extension AWSPredictionsPlugin {
12+
public extension AWSPredictionsPlugin {
1313
/// Interprets the input text and detects sentiment, language, syntax, and key phrases
1414
///
1515
/// - Parameter text: input text
1616
/// - Parameter options: Option for the plugin
1717
/// - Parameter resultListener: Listener to which events are send
18-
public func interpret(
18+
func interpret(
1919
text: String,
2020
options: Predictions.Interpret.Options?
2121
) async throws -> Predictions.Interpret.Result {

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin+Reset.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
9+
import Foundation
1010

11-
extension AWSPredictionsPlugin {
12-
public func reset() async {
11+
public extension AWSPredictionsPlugin {
12+
func reset() async {
1313
if predictionsService != nil {
1414
let resettable = predictionsService as Resettable
1515
await resettable.reset()

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
//
77

88
import Amplify
9-
import Foundation
109
import AWSPluginsCore
10+
import Foundation
1111

12-
final public class AWSPredictionsPlugin: PredictionsCategoryPlugin {
12+
public final class AWSPredictionsPlugin: PredictionsCategoryPlugin {
1313
let awsPredictionsPluginKey = "awsPredictionsPlugin"
1414

1515
/// An instance of the predictions service

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Configuration/IdentifyConfiguration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension IdentifyLabelsConfiguration: Decodable {
119119

120120
public init(from decoder: Decoder) throws {
121121
let values = try decoder.container(keyedBy: CodingKeys.self)
122-
type = try values.decode(Predictions.LabelType.self, forKey: .type)
122+
self.type = try values.decode(Predictions.LabelType.self, forKey: .type)
123123
}
124124
}
125125

@@ -151,7 +151,7 @@ extension IdentifyTextConfiguration: Decodable {
151151

152152
public init(from decoder: Decoder) throws {
153153
let values = try decoder.container(keyedBy: CodingKeys.self)
154-
format = try values.decode(Predictions.TextFormatType.self, forKey: .format)
154+
self.format = try values.decode(Predictions.TextFormatType.self, forKey: .format)
155155
}
156156
}
157157

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/AWSTranscribeStreamingAdapter.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
9+
import AWSClientRuntime
1010
import AWSPluginsCore
1111
import AWSTranscribeStreaming
12-
import AWSClientRuntime
12+
import Foundation
1313

1414
class AWSTranscribeStreamingAdapter: AWSTranscribeStreamingBehavior {
1515

@@ -62,7 +62,7 @@ class AWSTranscribeStreamingAdapter: AWSTranscribeStreamingBehavior {
6262
var components = URLComponents()
6363
components.scheme = "wss"
6464
components.host = "transcribestreaming.\(region).amazonaws.com"
65-
components.port = 8443
65+
components.port = 8_443
6666
components.path = "/stream-transcription-websocket"
6767

6868
components.queryItems = [
@@ -95,7 +95,7 @@ class AWSTranscribeStreamingAdapter: AWSTranscribeStreamingBehavior {
9595
var currentEnd = min(chunkSize, audioDataSize - currentStart)
9696

9797
while currentStart < audioDataSize {
98-
let dataChunk = input.audioStream[currentStart..<currentEnd]
98+
let dataChunk = input.audioStream[currentStart ..< currentEnd]
9999
let encodedChunk = EventStream.Encoder().encode(payload: dataChunk, headers: headers)
100100

101101
webSocket.send(message: .data(encodedChunk), onError: { _ in })

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/AWSTranscribeStreamingBehavior.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
109
import AWSTranscribeStreaming
10+
import Foundation
1111

1212
protocol AWSTranscribeStreamingBehavior {
1313
func startStreamTranscription(

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Events/Date+EpochMillis.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import Foundation
99

1010
extension Date {
1111
var epochMilliseconds: UInt64 {
12-
UInt64(self.timeIntervalSince1970 * 1_000)
12+
UInt64(timeIntervalSince1970 * 1_000)
1313
}
1414
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Events/LivenessFinalCientEvent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public struct FinalClientEvent {
2424
let videoEndTimeStamp: UInt64
2525
}
2626

27-
extension LivenessEvent where T == FinalClientEvent {
27+
public extension LivenessEvent where T == FinalClientEvent {
2828
@_spi(PredictionsFaceLiveness)
29-
public static func final(event: FinalClientEvent) throws -> Self {
29+
static func final(event: FinalClientEvent) throws -> Self {
3030

3131
let clientEvent = ClientSessionInformationEvent(
3232
challenge: .init(

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Events/LivenessFreshnessEvent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public struct FreshnessEvent {
2424
}
2525
}
2626

27-
extension LivenessEvent where T == FreshnessEvent {
27+
public extension LivenessEvent where T == FreshnessEvent {
2828
@_spi(PredictionsFaceLiveness)
29-
public static func freshness(event: FreshnessEvent) throws -> Self {
29+
static func freshness(event: FreshnessEvent) throws -> Self {
3030
let clientEvent = ClientSessionInformationEvent(
3131
challenge: .init(
3232
faceMovementAndLightChallenge: .init(

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Events/LivenessInitialClientEvent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public struct InitialClientEvent {
2424
let videoStartTimestamp: UInt64
2525
}
2626

27-
extension LivenessEvent where T == InitialClientEvent {
27+
public extension LivenessEvent where T == InitialClientEvent {
2828
@_spi(PredictionsFaceLiveness)
29-
public static func initialFaceDetected(event: InitialClientEvent) throws -> Self {
29+
static func initialFaceDetected(event: InitialClientEvent) throws -> Self {
3030
let initialFace = InitialFace(
3131
boundingBox: .init(boundingBox: event.initialFaceLocation.boundingBox),
3232
initialFaceDetectedTimeStamp: event.initialFaceLocation.startTimestamp

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Events/LivenessVideoEvent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public struct VideoEvent {
1818
}
1919
}
2020

21-
extension LivenessEvent where T == VideoEvent {
21+
public extension LivenessEvent where T == VideoEvent {
2222
@_spi(PredictionsFaceLiveness)
23-
public static func video(event: VideoEvent) throws -> Self {
23+
static func video(event: VideoEvent) throws -> Self {
2424
let clientEvent = LivenessVideoEvent(
2525
timestampMillis: event.timestamp,
2626
videoChunk: event.chunk

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Model/DTOMapping.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func ovalChallenge(from event: ServerSessionInformationEvent) -> FaceLivenessSes
4040
func colorChallenge(from event: ServerSessionInformationEvent) -> FaceLivenessSession.ColorChallenge {
4141
let displayColors = event.sessionInformation.challenge
4242
.faceMovementAndLightChallenge.colorSequences
43-
.map({ color -> FaceLivenessSession.DisplayColor in
43+
.map { color -> FaceLivenessSession.DisplayColor in
4444

4545
let duration: Double
4646
let shouldScroll: Bool
@@ -71,7 +71,7 @@ func colorChallenge(from event: ServerSessionInformationEvent) -> FaceLivenessSe
7171
duration: duration,
7272
shouldScroll: shouldScroll
7373
)
74-
})
74+
}
7575
return .init(
7676
colors: displayColors
7777
)

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Model/FaceLivenessSession+BoundingBox.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import Foundation
99

1010
// swiftlint:disable identifier_name
11-
extension FaceLivenessSession {
11+
public extension FaceLivenessSession {
1212
@_spi(PredictionsFaceLiveness)
13-
public struct BoundingBox: Codable {
13+
struct BoundingBox: Codable {
1414
public let x: Double
1515
public let y: Double
1616
public let width: Double

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Model/FaceLivenessSession+ColorChallenge.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import Foundation
99

10-
extension FaceLivenessSession {
10+
public extension FaceLivenessSession {
1111
@_spi(PredictionsFaceLiveness)
12-
public struct ColorChallenge {
12+
struct ColorChallenge {
1313
public let colors: [DisplayColor]
1414

1515
public init(colors: [DisplayColor]) {
@@ -18,9 +18,9 @@ extension FaceLivenessSession {
1818
}
1919
}
2020
// swiftlint:disable identifier_name
21-
extension FaceLivenessSession {
21+
public extension FaceLivenessSession {
2222
@_spi(PredictionsFaceLiveness)
23-
public struct DisplayColor {
23+
struct DisplayColor {
2424
public let rgb: RGB
2525
public let duration: Double
2626
public let shouldScroll: Bool
@@ -33,7 +33,7 @@ extension FaceLivenessSession {
3333
}
3434

3535
@_spi(PredictionsFaceLiveness)
36-
public struct RGB {
36+
struct RGB {
3737
public let _values: [Int]
3838
public let red: Double
3939
public let green: Double

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Model/FaceLivenessSession+OvalMatchChallenge.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import Foundation
99

10-
extension FaceLivenessSession {
10+
public extension FaceLivenessSession {
1111
@_spi(PredictionsFaceLiveness)
12-
public struct OvalMatchChallenge {
12+
struct OvalMatchChallenge {
1313
public let faceDetectionThreshold: Double
1414
public let face: Face
1515
public let oval: Oval
@@ -22,9 +22,9 @@ extension FaceLivenessSession {
2222
}
2323
}
2424

25-
extension FaceLivenessSession.OvalMatchChallenge {
25+
public extension FaceLivenessSession.OvalMatchChallenge {
2626
@_spi(PredictionsFaceLiveness)
27-
public struct Face {
27+
struct Face {
2828
public let distanceThreshold: Double
2929
public let distanceThresholdMax: Double
3030
public let distanceThresholdMin: Double
@@ -47,9 +47,9 @@ extension FaceLivenessSession.OvalMatchChallenge {
4747
}
4848
}
4949

50-
extension FaceLivenessSession.OvalMatchChallenge {
50+
public extension FaceLivenessSession.OvalMatchChallenge {
5151
@_spi(PredictionsFaceLiveness)
52-
public struct Oval {
52+
struct Oval {
5353
public let boundingBox: FaceLivenessSession.BoundingBox
5454
public let heightWidthRatio: Double
5555
public let iouThreshold: Double

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Model/FaceLivenessSession+SessionConfiguration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import Foundation
99

10-
extension FaceLivenessSession {
10+
public extension FaceLivenessSession {
1111
@_spi(PredictionsFaceLiveness)
12-
public struct SessionConfiguration {
12+
struct SessionConfiguration {
1313
public let colorChallenge: ColorChallenge
1414
public let ovalMatchChallenge: OvalMatchChallenge
1515

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/AWSPredictionsPlugin+Liveness.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
109
import AWSPluginsCore
10+
import Foundation
1111

12-
extension AWSPredictionsPlugin {
12+
public extension AWSPredictionsPlugin {
1313
@_spi(PredictionsFaceLiveness)
14-
public static func startFaceLivenessSession(
14+
static func startFaceLivenessSession(
1515
withID sessionID: String,
1616
credentialsProvider: AWSCredentialsProvider? = nil,
1717
region: String,
@@ -45,9 +45,9 @@ extension AWSPredictionsPlugin {
4545
}
4646
}
4747

48-
extension FaceLivenessSession {
48+
public extension FaceLivenessSession {
4949
@_spi(PredictionsFaceLiveness)
50-
public struct Options {
50+
struct Options {
5151
public init() {}
5252
}
5353
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/SPI/LivenessCredentials.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
import Foundation
98
import Amplify
109
import AWSPluginsCore
10+
import Foundation
1111

1212
func credential(from credentialsProvider: AWSCredentialsProvider?) async throws -> SigV4Signer.Credential {
1313
let credentials: AWSCredentials
1414

15-
if let credentialsProvider = credentialsProvider {
15+
if let credentialsProvider {
1616
let providedCredentials = try await credentialsProvider.fetchAWSCredentials()
1717
credentials = providedCredentials
1818
} else {

0 commit comments

Comments
 (0)