From 49fa5ce305bae144d9ba058bc0356ad147e28f4c Mon Sep 17 00:00:00 2001 From: Arunav Sanyal Date: Sat, 25 Aug 2018 19:21:49 -0700 Subject: [PATCH] Reverting certain swift 4.1 mandatory changes. --- .travis.yml | 2 +- Sources/ArrayExtensions.swift | 2 +- Sources/EZSwiftFunctions.swift | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e72973d..0b588edd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -osx_image: xcode9.3 +osx_image: xcode9.2 language: objective-c rvm: 2.2.2 cache: cocoapods diff --git a/Sources/ArrayExtensions.swift b/Sources/ArrayExtensions.swift index 43e1ec15..ade0127e 100644 --- a/Sources/ArrayExtensions.swift +++ b/Sources/ArrayExtensions.swift @@ -114,7 +114,7 @@ extension Array where Element: Equatable { /// EZSE: Returns the indexes of the object public func indexes(of element: Element) -> [Int] { - return enumerated().compactMap { ($0.element == element) ? $0.offset : nil } + return enumerated().flatMap { ($0.element == element) ? $0.offset : nil } } /// EZSE: Returns the last index of the object diff --git a/Sources/EZSwiftFunctions.swift b/Sources/EZSwiftFunctions.swift index 00cecdff..4325923c 100644 --- a/Sources/EZSwiftFunctions.swift +++ b/Sources/EZSwiftFunctions.swift @@ -78,7 +78,7 @@ public struct ez { /// EZSE: Returns true if its simulator and not a device //TODO: Add to readme public static var isSimulator: Bool { - #if targetEnvironment(simulator) + #if (arch(i386) || arch(x86_64)) && os(iOS) return true #else return false @@ -87,7 +87,7 @@ public struct ez { /// EZSE: Returns true if its on a device and not a simulator //TODO: Add to readme public static var isDevice: Bool { - #if targetEnvironment(simulator) + #if (arch(i386) || arch(x86_64)) && os(iOS) return false #else return true