Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SwiftLint Errors #9

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e0e4130
Fix Swift Lint Errors
ShawnBaek Dec 30, 2018
12e1ac7
Set Travis target to xcode10
ShawnBaek Dec 30, 2018
a723b27
Rollback podspec
ShawnBaek Dec 30, 2018
710d707
Add @discardableResult
ShawnBaek Dec 30, 2018
600fa81
Fix Test Cases
ShawnBaek Dec 30, 2018
d774249
Acted on Reviers comment
ShawnBaek Dec 30, 2018
e527903
Add subscript function for [Any] to fix ParseSwiftTests cases
ShawnBaek Dec 31, 2018
05a86e7
Update Podspec
ShawnBaek Dec 31, 2018
378248c
Revert for @discardableResult
ShawnBaek Jan 1, 2019
7399d37
Acted on @mooshee feedback
ShawnBaek Jan 1, 2019
f866536
remove discardableResult for removeAllObjects
ShawnBaek Jan 1, 2019
15c1d9a
Update Pod Script : pod lib lint --verbose --no-clean
ShawnBaek Jan 2, 2019
e6aeec0
Revert KeychainStore.swift
ShawnBaek Jan 2, 2019
f487baf
Revert travis.yml
ShawnBaek Jan 2, 2019
868ec78
Adds more verbose logs for pod lib lint
flovilmart Jan 5, 2019
f2e18e3
Add Codable Structure to set and get complexObject.
ShawnBaek Jan 6, 2019
dca1bc2
Merge branch 'upstream-master' of github.com:ShawnBaek/Parse-Swift in…
ShawnBaek Jan 6, 2019
fed6eb7
declare ComplexObject Struct in Class
ShawnBaek Jan 6, 2019
e776abb
set IPHONE_DEPLOYMENT_TARGET = 10.0
ShawnBaek Jan 6, 2019
fe0d859
Add test spec in PodSpec
ShawnBaek Jan 6, 2019
47c0932
Revert podspec, print cocoapods version
flovilmart Jan 6, 2019
3b81390
Use cocoapods > 1.6.0 in order to workaround lint issue
flovilmart Jan 6, 2019
3ba6ee4
Revert "set IPHONE_DEPLOYMENT_TARGET = 10.0"
flovilmart Jan 6, 2019
9eb914e
lower pod iOS deployment target
flovilmart Jan 6, 2019
5927703
Revert
ShawnBaek Jan 7, 2019
5899b5a
Merge branch 'upstream-master' of github.com:ShawnBaek/Parse-Swift in…
ShawnBaek Jan 7, 2019
1eee004
revert testSetComplexObject
ShawnBaek Jan 7, 2019
5310345
Add AnyCodable
ShawnBaek Feb 16, 2019
18aae3e
Apply AnyCodable
ShawnBaek Feb 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode9
osx_image: xcode10
language: objective-c
stage: Build
env:
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.6.0.beta.2'
76 changes: 76 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.11)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.6.0.beta.2)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.0.beta.2)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.3, >= 1.3.1)
xcodeproj (>= 1.7.0, < 2.0)
cocoapods-core (1.6.0.beta.2)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.4)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.3.1)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.7.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.6.0.beta.2)

BUNDLED WITH
1.16.2
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ do {
acl?.publicWrite = true
loggedIn.ACL = acl
try loggedIn.save()
} catch let e {
e
e.localizedDescription
fatalError("\(e.localizedDescription)")
} catch let error {
fatalError("\(error.localizedDescription)")
}

//var acl = ACL()
Expand Down
3 changes: 2 additions & 1 deletion ParseSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Pod::Spec.new do |s|
:git => "#{s.homepage}.git",
:tag => "#{s.version}",
}
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.tvos.deployment_target = "9.0"
Expand All @@ -23,4 +24,4 @@ Pod::Spec.new do |s|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
LICENSE
}
end
end
27 changes: 16 additions & 11 deletions ParseSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0900;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = Parse;
TargetAttributes = {
4AA807571F794242008CD551 = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
4AB8B4F31F254AE10070F682 = {
Expand Down Expand Up @@ -673,7 +674,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -687,7 +688,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -706,13 +707,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -747,7 +750,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -767,13 +770,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -800,7 +805,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -823,7 +828,7 @@
PRODUCT_NAME = ParseSwift;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -844,7 +849,7 @@
PRODUCT_NAME = ParseSwift;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -857,7 +862,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost";
};
Expand All @@ -871,7 +876,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwiftTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/TestHost";
};
Expand All @@ -896,7 +901,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -919,7 +924,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -57,7 +56,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions Sources/ParseSwift/API/API+Commands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ extension API.Command where T: ObjectType {
}

static func batch(commands: [API.Command<T, T>]) -> RESTBatchCommandType<T> {
let commands = commands.flatMap { (command) -> API.Command<T, T>? in
let commands = commands.compactMap { (command) -> API.Command<T, T>? in
let path = ParseConfiguration.mountPath + command.path.urlComponent
guard let body = command.body else {
return nil
}
return API.Command<T, T>(method: command.method, path: .any(path),
body: body, mapper: command.mapper)
}
let bodies = commands.flatMap { (command) -> T? in
let bodies = commands.compactMap { (command) -> T? in
return command.body
}
let mapper = { (data: Data) -> [(T, ParseError?)] in
Expand Down
4 changes: 2 additions & 2 deletions Sources/ParseSwift/Asynchronous.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ private func runAsync<T>(options: API.Options,
queue.async {
do {
callback(try function(options), nil)
} catch let e {
callback(nil, e)
} catch let error {
callback(nil, error)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/ParseSwift/Objects Protocols/ObjectType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ internal extension ObjectType {
extension ObjectType {
// Parse ClassName inference
public static var className: String {
let t = "\(type(of: self))"
return t.components(separatedBy: ".").first! // strip .Type
let classType = "\(type(of: self))"
return classType.components(separatedBy: ".").first! // strip .Type
}
public var className: String {
return Self.className
Expand Down Expand Up @@ -115,7 +115,7 @@ let dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .custom({ (dec) ->
let container = try dec.singleValueContainer()
let decodedString = try container.decode(String.self)
return dateFormatter.date(from: decodedString)!
} catch let e {
} catch let error {
let container = try dec.container(keyedBy: DateEncodingKeys.self)
if let decoded = try container.decodeIfPresent(String.self, forKey: .iso) {
return dateFormatter.date(from: decoded)!
Expand Down
6 changes: 2 additions & 4 deletions Sources/ParseSwift/Storage/KeychainStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
//

import Foundation

func getKeychainQueryTemplate(forService service: String) -> [String: String] {
var query = [String: String]()
if service.characters.count > 0 {
if service.count > 0 {
query[kSecAttrService as String] = service
}
query[kSecClass as String] = kSecClassGenericPassword as String
Expand All @@ -25,7 +24,7 @@ struct KeychainStore: SecureStorage {
synchronizationQueue = DispatchQueue(label: "com.parse.keychain.\(service)",
qos: .default,
attributes: .concurrent,
autoreleaseFrequency:.inherit,
autoreleaseFrequency: .inherit,
target: nil)
keychainQueryTemplate = getKeychainQueryTemplate(forService: service)
}
Expand All @@ -35,7 +34,6 @@ struct KeychainStore: SecureStorage {
query[kSecAttrAccount as String] = key
return query
}

func object<T>(forKey key: String) -> T? where T: Decodable {
guard let data = synchronizationQueue.sync(execute: { () -> Data? in
return self.data(forKey: key)
Expand Down
3 changes: 1 addition & 2 deletions Sources/ParseSwift/Storage/SecureStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import Foundation

protocol SecureStorage {
init(service: String)
func object<T>(forKey: String) -> T? where T: Decodable
func object<T>(forKey key: String) -> T? where T: Decodable
func set<T>(object: T?, forKey: String) -> Bool where T: Encodable

subscript <T>(key: String) -> T? where T: Codable { get }
func removeObject(forKey: String) -> Bool
func removeAllObjects() -> Bool
Expand Down
Loading