Skip to content

Commit 3394b0a

Browse files
Merge pull request #327 from Iterable/feature/mob-1373-replace-iterableresult
[MOB-1373] - Replace iterableResult
2 parents cbb29ce + eae97e6 commit 3394b0a

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

swift-sdk/Internal/InAppHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct InAppHelper {
9393
}
9494

9595
// process each parseResult and consumes failed message, if messageId is present
96-
private static func process(parseResult: IterableResult<IterableInAppMessage, InAppMessageParser.ParseError>, apiClient: ApiClientProtocol) -> IterableInAppMessage? {
96+
private static func process(parseResult: Result<IterableInAppMessage, InAppMessageParser.ParseError>, apiClient: ApiClientProtocol) -> IterableInAppMessage? {
9797
switch parseResult {
9898
case let .failure(parseError):
9999
switch parseError {

swift-sdk/Internal/InAppMessageParser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct InAppMessageParser {
1212

1313
/// Given json payload, It will construct array of IterableInAppMessage or ParseError
1414
/// The caller needs to make sure to consume errored out messages
15-
static func parse(payload: [AnyHashable: Any]) -> [IterableResult<IterableInAppMessage, ParseError>] {
15+
static func parse(payload: [AnyHashable: Any]) -> [Result<IterableInAppMessage, ParseError>] {
1616
return getInAppDicts(fromPayload: payload).map {
1717
let oneJson = preProcessOneJson(fromJson: $0)
1818

@@ -77,7 +77,7 @@ struct InAppMessageParser {
7777
}
7878
}
7979

80-
private static func parseOneMessage(fromJson json: [AnyHashable: Any]) -> IterableResult<IterableInAppMessage, ParseError> {
80+
private static func parseOneMessage(fromJson json: [AnyHashable: Any]) -> Result<IterableInAppMessage, ParseError> {
8181
guard let messageId = json[JsonKey.messageId.jsonKey] as? String else {
8282
return .failure(.parseFailed(reason: "no messageId", messageId: nil))
8383
}

swift-sdk/Internal/IterableUtil.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import Foundation
77
import os
88
import UIKit
99

10-
/// Functionality such as this will be built in for Swift 5.0. This will help with the transition
11-
enum IterableResult<T, E> {
12-
case success(T)
13-
case failure(E)
14-
}
15-
1610
@objc final class IterableUtil: NSObject {
1711
static var rootViewController: UIViewController? {
1812
if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController {

tests/common/Common.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct InAppTestHelper {
4545
return InAppMessageParser.parse(payload: payload).compactMap(parseResultToOptionalMessage)
4646
}
4747

48-
private static func parseResultToOptionalMessage(result: IterableResult<IterableInAppMessage, InAppMessageParser.ParseError>) -> IterableInAppMessage? {
48+
private static func parseResultToOptionalMessage(result: Result<IterableInAppMessage, InAppMessageParser.ParseError>) -> IterableInAppMessage? {
4949
switch result {
5050
case .failure:
5151
return nil

0 commit comments

Comments
 (0)