Compare commits

...

7 Commits
1.5.3 ... 1.5.4

Author SHA1 Message Date
John Estropia
928585029d XCode 7.3 full support 2016-03-23 12:39:11 +09:00
John Estropia
dc6d22b6ff updated travis XCode version 2016-03-23 12:14:34 +09:00
John Estropia
5ca0f657cb XCode 7.3 fixes 2016-03-23 12:07:31 +09:00
John Rommel Estropia
c323a28c19 fix warnings in demo app 2016-03-12 09:27:59 +09:00
John Estropia
64ad7b3bfd Update README.md 2016-03-11 20:59:52 +09:00
John Estropia
df441c5d04 Update README.md 2016-03-11 20:58:33 +09:00
John Estropia
3c2fb28644 added Packaged.swift 2016-03-01 19:42:28 +09:00
19 changed files with 102 additions and 56 deletions

View File

@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.2
osx_image: xcode7.3
sudo: false
git:
submodules: false
@@ -10,15 +10,15 @@ env:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
matrix:
- DESTINATION="OS=9.2,name=iPhone 6s" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 6" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.2,name=iPhone 5" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.2 RUN_TESTS="YES" POD_LINT="YES"
- DESTINATION="OS=9.3,name=iPhone 6s" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.4,name=iPhone 6" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.2,name=iPhone 5" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="CoreStore iOS" SDK=iphonesimulator9.3 RUN_TESTS="YES" POD_LINT="YES"
- DESTINATION="arch=x86_64" SCHEME="CoreStore OSX" SDK=macosx10.11 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=2.1,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator2.1 RUN_TESTS="NO" POD_LINT="NO"
- DESTINATION="OS=9.1,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator9.1 RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=2.2,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator2.2 RUN_TESTS="NO" POD_LINT="NO"
- DESTINATION="OS=9.2,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator9.2 RUN_TESTS="YES" POD_LINT="NO"
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
@@ -35,8 +35,8 @@ script:
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
fi
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.2" -destination "OS=9.2,name=iPhone 6s" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.2" -destination "OS=9.2,name=iPhone 6s" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.3" -destination "OS=9.3,name=iPhone 6s" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStore iOS" -sdk "iphonesimulator9.3" -destination "OS=9.3,name=iPhone 6s" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
- if [ $POD_LINT == "YES" ]; then
pod lib lint --quick;
fi

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CoreStore"
s.version = "1.5.3"
s.version = "1.5.4"
s.license = "MIT"
s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift"
s.homepage = "https://github.com/JohnEstropia/CoreStore"
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' }
s.dependency "GCDKit", "1.1.7"
s.dependency "GCDKit", "1.2.1"
end

View File

@@ -1 +1 @@
github "JohnEstropia/GCDKit" == 1.1.7
github "JohnEstropia/GCDKit" == 1.2.1

View File

@@ -53,7 +53,7 @@ public protocol ImportableObject: class {
/**
The data type for the import source. This is most commonly an `NSDictionary` or another external source such as an `NSUserDefaults`.
*/
typealias ImportSource
associatedtype ImportSource
/**
Return `true` if an object should be created from `source`. Return `false` to ignore and skip `source`. The default implementation returns `true`.

View File

@@ -54,12 +54,12 @@ public protocol ImportableUniqueObject: ImportableObject {
/**
The data type for the import source. This is most commonly an `NSDictionary` or another external source such as an `NSUserDefaults`.
*/
typealias ImportSource
associatedtype ImportSource
/**
The data type for the entity's unique ID attribute
*/
typealias UniqueIDType: NSObject
associatedtype UniqueIDType: NSObject
/**
The keyPath to the entity's unique ID attribute

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.3</string>
<string>1.5.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -154,12 +154,13 @@ internal extension NSManagedObjectModel {
}
@nonobjc internal func entityTypesMapping() -> [String: NSManagedObject.Type] {
return self.entityNameMapping.reduce([:]) { (var mapping, pair) in
var mapping = [String: NSManagedObject.Type]()
self.entityNameMapping.forEach { (className, entityName) in
mapping[pair.1] = (NSClassFromString(pair.0)! as! NSManagedObject.Type)
return mapping
mapping[entityName] = (NSClassFromString(className)! as! NSManagedObject.Type)
}
return mapping
}
@nonobjc internal func mergedModels() -> [NSManagedObjectModel] {
@@ -249,15 +250,16 @@ internal extension NSManagedObjectModel {
return mapping as! [String: String]
}
let mapping = self.entities.reduce([String: String]()) {
(var mapping, entityDescription) -> [String: String] in
var mapping = [String: String]()
self.entities.forEach {
if let entityName = entityDescription.name {
guard let entityName = $0.name else {
let className = entityDescription.managedObjectClassName
mapping[className] = entityName
return
}
return mapping
let className = $0.managedObjectClassName
mapping[className] = entityName
}
setAssociatedCopiedObject(
mapping as NSDictionary,

View File

@@ -38,7 +38,7 @@ public extension CoreStore {
// MARK: Internal
internal static func log(level: LogLevel, message: String, fileName: StaticString = __FILE__, lineNumber: Int = __LINE__, functionName: StaticString = __FUNCTION__) {
internal static func log(level: LogLevel, message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.log(
level: level,
@@ -49,7 +49,7 @@ public extension CoreStore {
)
}
internal static func handleError(error: NSError, _ message: String, fileName: StaticString = __FILE__, lineNumber: Int = __LINE__, functionName: StaticString = __FUNCTION__) {
internal static func handleError(error: NSError, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.handleError(
error: error,
@@ -60,7 +60,7 @@ public extension CoreStore {
)
}
internal static func assert(@autoclosure condition: () -> Bool, _ message: String, fileName: StaticString = __FILE__, lineNumber: Int = __LINE__, functionName: StaticString = __FUNCTION__) {
internal static func assert(@autoclosure condition: () -> Bool, _ message: String, fileName: StaticString = #file, lineNumber: Int = #line, functionName: StaticString = #function) {
self.logger.assert(
condition,

View File

@@ -111,22 +111,24 @@ public struct MigrationChain: NilLiteralConvertible, StringLiteralConvertible, D
public init(dictionaryLiteral elements: (String, String)...) {
var valid = true
let versionTree = elements.reduce([String: String]()) { (var versionTree, tuple: (String, String)) -> [String: String] in
var versionTree = [String: String]()
elements.forEach { (sourceVersion, destinationVersion) in
if let _ = versionTree.updateValue(tuple.1, forKey: tuple.0) {
guard let _ = versionTree.updateValue(destinationVersion, forKey: sourceVersion) else {
CoreStore.assert(false, "\(typeName(MigrationChain))'s migration chain could not be created due to ambiguous version paths.")
valid = false
return
}
return versionTree
CoreStore.assert(false, "\(typeName(MigrationChain))'s migration chain could not be created due to ambiguous version paths.")
valid = false
}
let leafVersions = Set(
elements.filter { (tuple: (String, String)) -> Bool in
return versionTree[tuple.1] == nil
}.map { $1 }
}.map { $1 }
)
let isVersionAmbiguous = { (start: String) -> Bool in

View File

@@ -45,7 +45,7 @@ public protocol ListObserver: class {
/**
The `NSManagedObject` type for the observed list
*/
typealias ListEntityType: NSManagedObject
associatedtype ListEntityType: NSManagedObject
/**
Handles processing just before a change to the observed list occurs

View File

@@ -42,7 +42,7 @@ public protocol ObjectObserver: class {
/**
The `NSManagedObject` type for the observed object
*/
typealias ObjectEntityType: NSManagedObject
associatedtype ObjectEntityType: NSManagedObject
/**
Handles processing just before a change to the observed `object` occurs

View File

@@ -37,7 +37,7 @@ private struct Static {
cachedTimeZone.daylightSavingTimeOffset = rawTimeZone.daylightSavingTimeOffset
}
transaction.commit()
transaction.commitAndWait()
}
return dataStack

View File

@@ -61,7 +61,7 @@ class ObjectObserverDemoViewController: UIViewController, ObjectObserver {
let palette = transaction.create(Into(Palette))
palette.setInitialValues()
transaction.commit()
transaction.commitAndWait()
}
let palette = CoreStore.fetchOne(From(Palette), OrderBy(.Ascending("hue")))!

View File

@@ -43,7 +43,7 @@ private struct Static {
account2.name = "Jane Doe HCD"
account2.friends = 314
transaction.commit()
transaction.commitAndWait()
}
return dataStack
@@ -77,7 +77,7 @@ private struct Static {
account2.name = "#janedoe_hcd"
account2.friends = 100
transaction.commit()
transaction.commitAndWait()
}
return dataStack

View File

@@ -32,7 +32,7 @@ private struct Static {
let place = transaction.create(Into(Place))
place.setInitialValues()
transaction.commit()
transaction.commitAndWait()
}
place = CoreStore.fetchOne(From(Place))
}
@@ -178,7 +178,7 @@ class TransactionsDemoViewController: UIViewController, MKMapViewDelegate, Objec
let place = transaction.edit(Static.placeController.object)
place?.setInitialValues()
transaction.commit()
transaction.commitAndWait()
}
}

View File

@@ -265,7 +265,7 @@ class CoreStoreTests: XCTestCase {
)
XCTAssertTrue(numberOfDeletedObjects2 == 2, "numberOfDeletedObjects2 == 2 (actual: \(numberOfDeletedObjects2))")
transaction.commit()
transaction.commitAndWait()
}
CoreStore.beginSynchronous({ (transaction) -> Void in
@@ -277,7 +277,7 @@ class CoreStoreTests: XCTestCase {
obj.testEntityID = oldID
}
transaction.commit()
transaction.commitAndWait()
})
let objs1 = CoreStore.fetchAll(From(TestEntity1))
@@ -351,7 +351,7 @@ class CoreStoreTests: XCTestCase {
let obj5 = transaction.edit(obj5)
transaction.delete(obj5, obj6)
transaction.commit()
transaction.commitAndWait()
}
let count2 = CoreStore.queryValue(

30
Package.swift Normal file
View File

@@ -0,0 +1,30 @@
//
// Package.swift
// CoreStore
//
// Copyright © 2016 John Rommel Estropia
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// 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.
//
import PackageDescription
let package = Package(
name: "CoreStore"
)

View File

@@ -6,7 +6,7 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
Unleashing the real power of Core Data with the elegance and safety of Swift
* Swift 2.1 (Xcode 7.1), iOS 8+/OSX 10.10+ (or try out the [iOS 7 branch](https://github.com/JohnEstropia/CoreStore/tree/ios7_support_alpha))
* Swift 2.2 (Xcode 7.3), iOS 8+/OSX 10.10+ (or try out the [iOS 7 branch](https://github.com/JohnEstropia/CoreStore/tree/ios7_support_alpha))
[Click here for a wiki version of this README](https://github.com/JohnEstropia/CoreStore/wiki)
@@ -65,6 +65,9 @@ Unleashing the real power of Core Data with the elegance and safety of Swift
- [Installation](#installation)
- [Changesets](#changesets)
- [Upgrading from v0.2.0 to 1.0.0](#upgrading-from-v020-to-100)
- [Contact](#contact)
- [Who uses CoreStore?](#who-uses-corestore)
- [License](#license)
@@ -1214,11 +1217,20 @@ The protocols above had their methods renamed as well, to retain the natural lan
- New migration utilities! (README still pending) Check out *DataStack+Migration.swift* and *CoreStore+Migration.swift* for the new methods, as well as *DataStack.swift* for its new initializer.
# Contributions
While CoreStore's design is pretty solid and the unit test and demo app work well, CoreStore is pretty much still in its early stage. With more exposure to production code usage and criticisms from the developer community, CoreStore hopes to mature as well.
Please feel free to report any issues, suggestions, or criticisms!
日本語で連絡していただいても構いません!
# Contact
Questions? Suggestions?
## License
Reach me on Twitter [@JohnEstropia](https://twitter.com/JohnEstropia)
or tag your Stackoverflow question with **corestore**
日本語の対応も可能なので是非!
# Who uses CoreStore?
Did CoreStore serve you well? I'd love to hear about your app :)
# License
CoreStore is released under an MIT license. See the LICENSE file for more information