Skip to content

Commit

Permalink
Xcode 11, Swift 5.1, release 9.0 prep, +more (#137)
Browse files Browse the repository at this point in the history
* [Swiftlint] update 0.35, new rules
* [travis ci] update travis
* [Gems] Update cocoapods 1.7.5, danger 6.0
* Update Xcode11, convert Swift 5.1, update headers
* update file header templates
* Fix project/build settings
* update README
* Update podspec
* [9.0] bump version numbers
* Change save to saveSync/Async, Remove SaveResul
* Update example project
* Remove StackResult type in favor of Swift.Result
* Rename CoreDataStackFactory to CoreDataStackProvider
* update Getting Started guide
* remove carthage. it doesn't work right now
* [9.0] gen docs
  • Loading branch information
jessesquires committed Sep 22, 2019
1 parent 3677371 commit d0da796
Show file tree
Hide file tree
Showing 72 changed files with 616 additions and 1,346 deletions.
9 changes: 9 additions & 0 deletions .swiftlint.yml
Expand Up @@ -26,6 +26,10 @@ opt_in_rules:
- sorted_first_last
- contains_over_first_not_nil
- last_where
- reduce_into
- contains_over_filter_count
- contains_over_filter_is_empty
- empty_collection_literal

# idiomatic
- fatal_error_message
Expand All @@ -41,6 +45,7 @@ opt_in_rules:
- static_operator
- toggle_bool
- unavailable_function
- no_space_in_method_call

# style
- attributes
Expand Down Expand Up @@ -70,6 +75,10 @@ opt_in_rules:
- prohibited_super_call
- unused_import
- unused_private_declaration
- unused_capture_list
- duplicate_enum_cases
- legacy_multiple
- unused_declaration

line_length: 200
file_length: 600
Expand Down
56 changes: 30 additions & 26 deletions .travis.yml
@@ -1,5 +1,5 @@
os: osx
osx_image: xcode10.1
osx_image: xcode11
rvm: 2.6.0

addons:
Expand All @@ -21,10 +21,10 @@ env:
global:
- PROJECT="JSQCoreDataKit.xcodeproj"
- SCHEME="JSQCoreDataKit"
- OSX_SDK=macosx10.14
- IOS_SDK=iphonesimulator12.1
- TVOS_SDK=appletvsimulator12.1
- WATCHOS_SDK=watchsimulator5.1
- OSX_SDK=macosx10.15
- IOS_SDK=iphonesimulator13.0
- TVOS_SDK=appletvsimulator13.0
- WATCHOS_SDK=watchsimulator6.0

before_install:
- pip3 install proselint
Expand All @@ -35,8 +35,8 @@ jobs:
include:
- &test
stage: test
name: iOS 11.4
env: DESTINATION="OS=11.4,name=iPhone X" SDK="$IOS_SDK"
name: iOS 11.1
env: DESTINATION="OS=11.1,name=iPhone X" SDK="$IOS_SDK"
script:
- set -o pipefail
- xcodebuild -version -sdk
Expand All @@ -46,50 +46,54 @@ jobs:
- bash <(curl -s https://codecov.io/bash)

- <<: *test
name: iOS 12.1
env: DESTINATION="OS=12.1,name=iPhone X" SDK="$IOS_SDK"

name: iOS 12.0
env: DESTINATION="OS=12.0,name=iPhone X" SDK="$IOS_SDK"

- <<: *test
name: iOS 13.0
env: DESTINATION="OS=13.0,name=iPhone 11" SDK="$IOS_SDK"

- <<: *test
name: macOS
env: DESTINATION="arch=x86_64" SDK="$OSX_SDK"

- <<: *test
name: tvOS 12.1
env: DESTINATION="OS=12.1,name=Apple TV" SDK="$TVOS_SDK"
name: tvOS 12.0
env: DESTINATION="OS=12.0,name=Apple TV" SDK="$TVOS_SDK"

- <<: *test
name: tvOS 13.0
env: DESTINATION="OS=12.0,name=Apple TV" SDK="$TVOS_SDK"

- stage: build only
name: watchOS 5.1
env: DESTINATION="OS=5.1,name=Apple Watch Series 4 - 40mm" SDK="$WATCHOS_SDK"
name: watchOS 6.0
env: DESTINATION="OS=6.0,name=Apple Watch Series 5 - 40mm" SDK="$WATCHOS_SDK"
script:
- xcodebuild clean build -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c;

- &build-examples
stage: build examples
name: iOS 11.4
env: DESTINATION="OS=11.4,name=iPhone X" SDK="$IOS_SDK"
name: iOS 11.1
env: DESTINATION="OS=11.1,name=iPhone X" SDK="$IOS_SDK"
script:
- set -o pipefail
- xcodebuild -version -sdk
- xcodebuild clean build -project Example/ExampleApp.xcodeproj -scheme ExampleApp -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c;

- <<: *build-examples
name: iOS 12.1
env: DESTINATION="OS=12.1,name=iPhone X" SDK="$IOS_SDK"
name: iOS 12.0
env: DESTINATION="OS=12.0,name=iPhone X" SDK="$IOS_SDK"

- <<: *build-examples
name: iOS 13.0
env: DESTINATION="OS=13.0,name=iPhone 11" SDK="$IOS_SDK"

- stage: lint
name: pod lint
script: bundle exec pod lib lint

# - stage: carthage
# osx_image: xcode10.1
# name: carthage
# os: osx
# script: carthage build --no-skip-current --configuration Release

stages:
- test
- build only
- build examples
- lint
# - carthage

27 changes: 27 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,33 @@ The changelog for `JSQCoreDataKit`. Also see the [releases](https://github.com/j

--------------------------------------

9.0.0
-----

This release closes the [9.0.0 milestone](https://github.com/jessesquires/JSQCoreDataKit/milestone/17?closed=1).

### Breaking

- Removed `NSManagedObjectContext` extension `func save(wait:, completion:)`. Replaced with two new extension methods, `func saveAsync(completion:)` and `func saveSync(completion:)`.

- Removed `SaveResult` type in favor of Swift's new generic `Result` type.

- Removed `StackResult` type in favor of Swift's new generic `Result` type.

- Renamed `CoreDataStackFactory` to `CoreDataStackProvider`

### New

- Added `typealias SaveResult = Result<NSManagedObjectContext, Error>` (Replaces the former `SaveResult` type.)

- Added `typealias StackResult = Result<CoreDataStack, Error>` (Replaces the former `StackResult` type.)

### Changed

- Upgraded to Swift 5.1
- Update to Xcode 11
- Update SwiftLint to 0.35.0, add new rules

8.0.0
-----

Expand Down
16 changes: 8 additions & 8 deletions Example/ExampleApp.xcodeproj/project.pbxproj
Expand Up @@ -211,7 +211,7 @@
885394151BC9E9DE00699506 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = "Hexed Bits";
TargetAttributes = {
8853941C1BC9E9DE00699506 = {
Expand All @@ -230,7 +230,7 @@
};
buildConfigurationList = 885394181BC9E9DE00699506 /* Build configuration list for PBXProject "ExampleApp" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -354,6 +354,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -401,7 +402,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -410,6 +411,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -449,7 +451,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -469,7 +471,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -488,22 +489,21 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
};
name = Release;
};
8853943E1BC9E9DE00699506 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ExampleAppTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ExampleAppTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExampleApp.app/ExampleApp";
};
name = Debug;
Expand All @@ -512,6 +512,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ExampleAppTests/Info.plist;
Expand All @@ -520,7 +521,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExampleApp.app/ExampleApp";
};
name = Release;
Expand Down
Expand Up @@ -17,7 +17,7 @@
//
//
// License
// Copyright © 2015 Jesse Squires
// Copyright © 2015-present Jesse Squires
// Released under an MIT license: https://opensource.org/licenses/MIT
// </string>
</dict>
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8853941C1BC9E9DE00699506"
BuildableName = "ExampleApp.app"
BlueprintName = "ExampleApp"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8853941C1BC9E9DE00699506"
BuildableName = "ExampleApp.app"
BlueprintName = "ExampleApp"
ReferencedContainer = "container:ExampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand Down Expand Up @@ -77,8 +75,6 @@
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion Example/ExampleApp/AppDelegate.swift
Expand Up @@ -12,7 +12,7 @@
//
//
// License
// Copyright © 2015 Jesse Squires
// Copyright © 2015-present Jesse Squires
// Released under an MIT license: https://opensource.org/licenses/MIT
//

Expand Down
14 changes: 8 additions & 6 deletions Example/ExampleApp/CompanyViewController.swift
Expand Up @@ -12,7 +12,7 @@
//
//
// License
// Copyright © 2015 Jesse Squires
// Copyright © 2015-present Jesse Squires
// Released under an MIT license: https://opensource.org/licenses/MIT
//

Expand All @@ -36,9 +36,9 @@ final class CompanyViewController: UITableViewController, NSFetchedResultsContro
showSpinner()

let model = CoreDataModel(name: modelName, bundle: modelBundle)
let factory = CoreDataStackFactory(model: model)
let factory = CoreDataStackProvider(model: model)

factory.createStack { (result: StackResult) -> Void in
factory.createStack { result in
switch result {
case .success(let s):
self.stack = s
Expand Down Expand Up @@ -103,7 +103,7 @@ final class CompanyViewController: UITableViewController, NSFetchedResultsContro
func didTapAddButton(_ sender: UIBarButtonItem) {
stack.mainContext.performAndWait {
_ = Company.newCompany(self.stack.mainContext)
self.stack.mainContext.save(wait: true)
self.stack.mainContext.saveSync()
}
}

Expand All @@ -116,7 +116,7 @@ final class CompanyViewController: UITableViewController, NSFetchedResultsContro
for each in objects {
backgroundChildContext.delete(each)
}
backgroundChildContext.save(wait: true)
backgroundChildContext.saveSync()
} catch {
print("Error deleting objects: \(error)")
}
Expand Down Expand Up @@ -162,7 +162,7 @@ final class CompanyViewController: UITableViewController, NSFetchedResultsContro
stack.mainContext.performAndWait {
self.stack.mainContext.delete(obj)
}
stack.mainContext.save(wait: true)
stack.mainContext.saveSync()
}
}

Expand Down Expand Up @@ -206,6 +206,8 @@ final class CompanyViewController: UITableViewController, NSFetchedResultsContro
case .move:
tableView.deleteRows(at: [indexPath!], with: .fade)
tableView.insertRows(at: [newIndexPath!], with: .fade)
@unknown default:
fatalError("Unknown change type \(type)")
}
}

Expand Down

0 comments on commit d0da796

Please sign in to comment.