Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ DEPENDENCIES:
- RxDataSources (~> 3.0)
- RxSwift (~> 4.2)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Differentiator
- RxCocoa
- RxDataSources
- RxSwift

EXTERNAL SOURCES:
RxCoreData:
:path: ../
:path: "../"

SPEC CHECKSUMS:
Differentiator: ffe513ce1ea4e7198b89fac94d6e281c673055a9
Expand All @@ -29,4 +36,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 2301a0f899260fdadebbe33712ceb07d8d35af52

COCOAPODS: 1.4.0
COCOAPODS: 1.5.3
108 changes: 40 additions & 68 deletions Example/RxCoreData.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
objects = {

/* Begin PBXBuildFile section */
3F313EA6210C94FB00D9D0F8 /* NSManagedObjectContext+ObserveObjectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F9F75E4210C948B00E834AD /* NSManagedObjectContext+ObserveObjectTests.swift */; };
3F8A3384210C5BCD00250BCB /* Contacts.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 3F8A3383210C5BCD00250BCB /* Contacts.xcdatamodel */; };
3F8A3385210C5CBE00250BCB /* Bundle+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8A337C210C5AD900250BCB /* Bundle+Test.swift */; };
3F8A3386210C5CC100250BCB /* NSManagedObject+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8A337E210C5AFB00250BCB /* NSManagedObject+Extensions.swift */; };
3F8A3387210C5CC500250BCB /* NSManagedObjectContext+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8A3380210C5B1000250BCB /* NSManagedObjectContext+Test.swift */; };
3F9F75E3210C939800E834AD /* NSManagedObjectContext+ObserveContextTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F9F75E1210C935900E834AD /* NSManagedObjectContext+ObserveContextTests.swift */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
75696D6E47EF4301137E83D3 /* Pods_RxCoreData_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D9B39454206D1A0C6433F6A /* Pods_RxCoreData_Tests.framework */; };
CF5023D00F002ADEF58941A0 /* Pods_RxCoreData_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C2097B9C8F7CECFD35D972D /* Pods_RxCoreData_Example.framework */; };
D2AE78A51CF32FBA00D8411E /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2AE78A31CF32FBA00D8411E /* Event.swift */; };
Expand All @@ -33,6 +38,12 @@
/* Begin PBXFileReference section */
1312AE6406B7B9929CF4EE12 /* Pods-RxCoreData_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxCoreData_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxCoreData_Example/Pods-RxCoreData_Example.release.xcconfig"; sourceTree = "<group>"; };
3D9B39454206D1A0C6433F6A /* Pods_RxCoreData_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxCoreData_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3F8A337C210C5AD900250BCB /* Bundle+Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Test.swift"; sourceTree = "<group>"; };
3F8A337E210C5AFB00250BCB /* NSManagedObject+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Extensions.swift"; sourceTree = "<group>"; };
3F8A3380210C5B1000250BCB /* NSManagedObjectContext+Test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Test.swift"; sourceTree = "<group>"; };
3F8A3383210C5BCD00250BCB /* Contacts.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Contacts.xcdatamodel; sourceTree = "<group>"; };
3F9F75E1210C935900E834AD /* NSManagedObjectContext+ObserveContextTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+ObserveContextTests.swift"; sourceTree = "<group>"; };
3F9F75E4210C948B00E834AD /* NSManagedObjectContext+ObserveObjectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+ObserveObjectTests.swift"; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* RxCoreData_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxCoreData_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -41,7 +52,6 @@
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
607FACE51AFB9204008FA782 /* RxCoreData_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RxCoreData_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
609891BD0E152693BAEB65CA /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
694D2F970D4D6C2D5B237BCA /* LICENSE.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = LICENSE.md; path = ../LICENSE.md; sourceTree = "<group>"; };
6C2097B9C8F7CECFD35D972D /* Pods_RxCoreData_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxCoreData_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -75,6 +85,24 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3F8A337B210C5AC000250BCB /* Utils */ = {
isa = PBXGroup;
children = (
3F8A337C210C5AD900250BCB /* Bundle+Test.swift */,
3F8A337E210C5AFB00250BCB /* NSManagedObject+Extensions.swift */,
3F8A3380210C5B1000250BCB /* NSManagedObjectContext+Test.swift */,
);
name = Utils;
sourceTree = "<group>";
};
3F8A3382210C5BB100250BCB /* Resources */ = {
isa = PBXGroup;
children = (
3F8A3383210C5BCD00250BCB /* Contacts.xcdatamodel */,
);
name = Resources;
sourceTree = "<group>";
};
607FACC71AFB9204008FA782 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -124,8 +152,11 @@
607FACE81AFB9204008FA782 /* Tests */ = {
isa = PBXGroup;
children = (
607FACEB1AFB9204008FA782 /* Tests.swift */,
3F8A3382210C5BB100250BCB /* Resources */,
3F8A337B210C5AC000250BCB /* Utils */,
607FACE91AFB9204008FA782 /* Supporting Files */,
3F9F75E1210C935900E834AD /* NSManagedObjectContext+ObserveContextTests.swift */,
3F9F75E4210C948B00E834AD /* NSManagedObjectContext+ObserveObjectTests.swift */,
);
path = Tests;
sourceTree = "<group>";
Expand Down Expand Up @@ -182,8 +213,6 @@
607FACCE1AFB9204008FA782 /* Resources */,
77EECB9E50343E5362FDE498 /* [CP] Embed Pods Frameworks */,
2E6B561F32E09B2E7FC48B85 /* 📦 Embed Pods Frameworks */,
3A8ED13CDBE777B8BAAC4601 /* 📦 Copy Pods Resources */,
81B1497C1DE64D3DEB2F0161 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -205,8 +234,6 @@
607FACE31AFB9204008FA782 /* Resources */,
BE3F737842926DCBAEF33B1C /* [CP] Embed Pods Frameworks */,
25D10640889A11CBC96C9A36 /* 📦 Embed Pods Frameworks */,
2124F1C4EBA2827C0B8EF670 /* 📦 Copy Pods Resources */,
CD0F33E6F629F0617CA25311 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -279,21 +306,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
2124F1C4EBA2827C0B8EF670 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Tests/Pods-RxCoreData_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
25D10640889A11CBC96C9A36 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -324,21 +336,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Example/Pods-RxCoreData_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
3A8ED13CDBE777B8BAAC4601 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Example/Pods-RxCoreData_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3F4867CBB9D45E1759703C4B /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -398,21 +395,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Example/Pods-RxCoreData_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
81B1497C1DE64D3DEB2F0161 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Example/Pods-RxCoreData_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8B149104208C41903E8E6A77 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -451,21 +433,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Tests/Pods-RxCoreData_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CD0F33E6F629F0617CA25311 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxCoreData_Tests/Pods-RxCoreData_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CF5EA17E47B30114DF76F5C2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -500,7 +467,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
3F8A3384210C5BCD00250BCB /* Contacts.xcdatamodel in Sources */,
3F9F75E3210C939800E834AD /* NSManagedObjectContext+ObserveContextTests.swift in Sources */,
3F8A3386210C5CC100250BCB /* NSManagedObject+Extensions.swift in Sources */,
3F313EA6210C94FB00D9D0F8 /* NSManagedObjectContext+ObserveObjectTests.swift in Sources */,
3F8A3385210C5CBE00250BCB /* Bundle+Test.swift in Sources */,
3F8A3387210C5CC500250BCB /* NSManagedObjectContext+Test.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
17 changes: 17 additions & 0 deletions Example/Tests/Bundle+Test.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Bundle+Test.swift
// RxCoreData_Tests
//
// Created by Krunoslav Zaher on 7/28/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//

import Foundation

private class Test {}

extension Bundle {
static var test: Bundle {
return Bundle(for: Test.self)
}
}
20 changes: 20 additions & 0 deletions Example/Tests/Contacts.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14133" systemVersion="17E199" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Contact" representedClassName="Contact" syncable="YES" codeGenerationType="class">
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="phoneNumbers" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="PhoneNumber" syncable="YES"/>
</entity>
<entity name="Group" representedClassName="Group" syncable="YES" codeGenerationType="class">
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="contacts" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Contact" syncable="YES"/>
</entity>
<entity name="PhoneNumber" representedClassName="PhoneNumber" syncable="YES" codeGenerationType="class">
<attribute name="phoneNumber" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<elements>
<element name="Contact" positionX="-54" positionY="-9" width="128" height="75"/>
<element name="Group" positionX="-63" positionY="-18" width="128" height="75"/>
<element name="PhoneNumber" positionX="-54" positionY="9" width="128" height="75"/>
</elements>
</model>
22 changes: 22 additions & 0 deletions Example/Tests/NSManagedObject+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// NSManagedObject+Extensions.swift
// RxCoreData_Tests
//
// Created by Krunoslav Zaher on 7/28/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//

import Foundation
import CoreData

extension NSManagedObject {

class func new(in managedObjectContext: NSManagedObjectContext) -> Self {
return generateObject(type: self, in: managedObjectContext)
}

private class func generateObject<T>(type: T.Type, in managedObjectContext: NSManagedObjectContext) -> T {
return NSEntityDescription.insertNewObject(forEntityName: String(describing: self), into: managedObjectContext) as! T
}

}
Loading