Compare commits
5 Commits
master
...
feature/on
| Author | SHA1 | Date |
|---|---|---|
|
|
4dc4e05ffc | |
|
|
add4d6a436 | |
|
|
31f4ba57cc | |
|
|
47a0cde1cf | |
|
|
74fb0a2a3d |
|
|
@ -1 +0,0 @@
|
|||
github "realm/realm-cocoa" "v10.1.4"
|
||||
|
|
@ -0,0 +1 @@
|
|||
github "realm/realm-cocoa"
|
||||
|
|
@ -0,0 +1 @@
|
|||
github "realm/realm-cocoa" "v2.9.1"
|
||||
|
|
@ -0,0 +1,461 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
AA0664561F31C97100AFED02 /* DAO.h in Headers */ = {isa = PBXBuildFile; fileRef = AA0664541F31C97100AFED02 /* DAO.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AA06647A1F31CA1F00AFED02 /* DAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664651F31CA1F00AFED02 /* DAO.swift */; };
|
||||
AA06647B1F31CA1F00AFED02 /* Entity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664661F31CA1F00AFED02 /* Entity.swift */; };
|
||||
AA06647C1F31CA1F00AFED02 /* CoreDataConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664691F31CA1F00AFED02 /* CoreDataConfiguration.swift */; };
|
||||
AA06647D1F31CA1F00AFED02 /* CoreDataDAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA06646B1F31CA1F00AFED02 /* CoreDataDAO.swift */; };
|
||||
AA06647E1F31CA1F00AFED02 /* CoreDataTranslator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA06646D1F31CA1F00AFED02 /* CoreDataTranslator.swift */; };
|
||||
AA06647F1F31CA1F00AFED02 /* RealmConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664701F31CA1F00AFED02 /* RealmConfiguration.swift */; };
|
||||
AA0664801F31CA1F00AFED02 /* RealmDAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664721F31CA1F00AFED02 /* RealmDAO.swift */; };
|
||||
AA0664811F31CA1F00AFED02 /* CascadeDeletionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664741F31CA1F00AFED02 /* CascadeDeletionProtocol.swift */; };
|
||||
AA0664821F31CA1F00AFED02 /* RLMEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664751F31CA1F00AFED02 /* RLMEntry.swift */; };
|
||||
AA0664831F31CA1F00AFED02 /* RLMTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664761F31CA1F00AFED02 /* RLMTypes.swift */; };
|
||||
AA0664841F31CA1F00AFED02 /* RealmTranslator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0664781F31CA1F00AFED02 /* RealmTranslator.swift */; };
|
||||
AA0664881F31CF1100AFED02 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA0664861F31CF1100AFED02 /* Realm.framework */; };
|
||||
AA0664891F31CF1100AFED02 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA0664871F31CF1100AFED02 /* RealmSwift.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
AA0664511F31C97100AFED02 /* DAO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DAO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AA0664541F31C97100AFED02 /* DAO.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DAO.h; sourceTree = "<group>"; };
|
||||
AA0664551F31C97100AFED02 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
AA0664651F31CA1F00AFED02 /* DAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DAO.swift; sourceTree = "<group>"; };
|
||||
AA0664661F31CA1F00AFED02 /* Entity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entity.swift; sourceTree = "<group>"; };
|
||||
AA0664691F31CA1F00AFED02 /* CoreDataConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataConfiguration.swift; sourceTree = "<group>"; };
|
||||
AA06646B1F31CA1F00AFED02 /* CoreDataDAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDAO.swift; sourceTree = "<group>"; };
|
||||
AA06646D1F31CA1F00AFED02 /* CoreDataTranslator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataTranslator.swift; sourceTree = "<group>"; };
|
||||
AA0664701F31CA1F00AFED02 /* RealmConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmConfiguration.swift; sourceTree = "<group>"; };
|
||||
AA0664721F31CA1F00AFED02 /* RealmDAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmDAO.swift; sourceTree = "<group>"; };
|
||||
AA0664741F31CA1F00AFED02 /* CascadeDeletionProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CascadeDeletionProtocol.swift; sourceTree = "<group>"; };
|
||||
AA0664751F31CA1F00AFED02 /* RLMEntry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMEntry.swift; sourceTree = "<group>"; };
|
||||
AA0664761F31CA1F00AFED02 /* RLMTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMTypes.swift; sourceTree = "<group>"; };
|
||||
AA0664781F31CA1F00AFED02 /* RealmTranslator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmTranslator.swift; sourceTree = "<group>"; };
|
||||
AA0664861F31CF1100AFED02 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = Carthage/Build/iOS/Realm.framework; sourceTree = "<group>"; };
|
||||
AA0664871F31CF1100AFED02 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = Carthage/Build/iOS/RealmSwift.framework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
AA06644D1F31C97100AFED02 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA0664881F31CF1100AFED02 /* Realm.framework in Frameworks */,
|
||||
AA0664891F31CF1100AFED02 /* RealmSwift.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
AA0664471F31C97100AFED02 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664531F31C97100AFED02 /* DAO */,
|
||||
AA0664521F31C97100AFED02 /* Products */,
|
||||
AA0664851F31CF1100AFED02 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664521F31C97100AFED02 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664511F31C97100AFED02 /* DAO.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664531F31C97100AFED02 /* DAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664621F31CA1F00AFED02 /* Classes */,
|
||||
AA0664541F31C97100AFED02 /* DAO.h */,
|
||||
AA0664551F31C97100AFED02 /* Info.plist */,
|
||||
);
|
||||
path = DAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664621F31CA1F00AFED02 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664641F31CA1F00AFED02 /* Core */,
|
||||
AA0664671F31CA1F00AFED02 /* CoreDataDAO */,
|
||||
AA06646E1F31CA1F00AFED02 /* RealmDAO */,
|
||||
);
|
||||
name = Classes;
|
||||
path = ../../DAO/Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664641F31CA1F00AFED02 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664651F31CA1F00AFED02 /* DAO.swift */,
|
||||
AA0664661F31CA1F00AFED02 /* Entity.swift */,
|
||||
);
|
||||
path = Core;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664671F31CA1F00AFED02 /* CoreDataDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664681F31CA1F00AFED02 /* Configuration */,
|
||||
AA06646A1F31CA1F00AFED02 /* DAO */,
|
||||
AA06646C1F31CA1F00AFED02 /* Translator */,
|
||||
);
|
||||
path = CoreDataDAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664681F31CA1F00AFED02 /* Configuration */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664691F31CA1F00AFED02 /* CoreDataConfiguration.swift */,
|
||||
);
|
||||
path = Configuration;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA06646A1F31CA1F00AFED02 /* DAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA06646B1F31CA1F00AFED02 /* CoreDataDAO.swift */,
|
||||
);
|
||||
path = DAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA06646C1F31CA1F00AFED02 /* Translator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA06646D1F31CA1F00AFED02 /* CoreDataTranslator.swift */,
|
||||
);
|
||||
path = Translator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA06646E1F31CA1F00AFED02 /* RealmDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA06646F1F31CA1F00AFED02 /* Configuration */,
|
||||
AA0664711F31CA1F00AFED02 /* DAO */,
|
||||
AA0664731F31CA1F00AFED02 /* Model */,
|
||||
AA0664771F31CA1F00AFED02 /* Translator */,
|
||||
);
|
||||
path = RealmDAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA06646F1F31CA1F00AFED02 /* Configuration */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664701F31CA1F00AFED02 /* RealmConfiguration.swift */,
|
||||
);
|
||||
path = Configuration;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664711F31CA1F00AFED02 /* DAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664721F31CA1F00AFED02 /* RealmDAO.swift */,
|
||||
);
|
||||
path = DAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664731F31CA1F00AFED02 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664741F31CA1F00AFED02 /* CascadeDeletionProtocol.swift */,
|
||||
AA0664751F31CA1F00AFED02 /* RLMEntry.swift */,
|
||||
AA0664761F31CA1F00AFED02 /* RLMTypes.swift */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664771F31CA1F00AFED02 /* Translator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664781F31CA1F00AFED02 /* RealmTranslator.swift */,
|
||||
);
|
||||
path = Translator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA0664851F31CF1100AFED02 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA0664861F31CF1100AFED02 /* Realm.framework */,
|
||||
AA0664871F31CF1100AFED02 /* RealmSwift.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
AA06644E1F31C97100AFED02 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA0664561F31C97100AFED02 /* DAO.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
AA0664501F31C97100AFED02 /* DAO */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AA0664591F31C97100AFED02 /* Build configuration list for PBXNativeTarget "DAO" */;
|
||||
buildPhases = (
|
||||
AA06644C1F31C97100AFED02 /* Sources */,
|
||||
AA06644D1F31C97100AFED02 /* Frameworks */,
|
||||
AA06644E1F31C97100AFED02 /* Headers */,
|
||||
AA06644F1F31C97100AFED02 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = DAO;
|
||||
productName = DAO;
|
||||
productReference = AA0664511F31C97100AFED02 /* DAO.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
AA0664481F31C97100AFED02 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = RedMadRobot;
|
||||
TargetAttributes = {
|
||||
AA0664501F31C97100AFED02 = {
|
||||
CreatedOnToolsVersion = 8.3.2;
|
||||
DevelopmentTeam = 42LRQS6X44;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = AA06644B1F31C97100AFED02 /* Build configuration list for PBXProject "DAO" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = AA0664471F31C97100AFED02;
|
||||
productRefGroup = AA0664521F31C97100AFED02 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
AA0664501F31C97100AFED02 /* DAO */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
AA06644F1F31C97100AFED02 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
AA06644C1F31C97100AFED02 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA06647C1F31CA1F00AFED02 /* CoreDataConfiguration.swift in Sources */,
|
||||
AA06647B1F31CA1F00AFED02 /* Entity.swift in Sources */,
|
||||
AA0664811F31CA1F00AFED02 /* CascadeDeletionProtocol.swift in Sources */,
|
||||
AA06647A1F31CA1F00AFED02 /* DAO.swift in Sources */,
|
||||
AA0664841F31CA1F00AFED02 /* RealmTranslator.swift in Sources */,
|
||||
AA06647E1F31CA1F00AFED02 /* CoreDataTranslator.swift in Sources */,
|
||||
AA0664831F31CA1F00AFED02 /* RLMTypes.swift in Sources */,
|
||||
AA0664821F31CA1F00AFED02 /* RLMEntry.swift in Sources */,
|
||||
AA06647F1F31CA1F00AFED02 /* RealmConfiguration.swift in Sources */,
|
||||
AA0664801F31CA1F00AFED02 /* RealmDAO.swift in Sources */,
|
||||
AA06647D1F31CA1F00AFED02 /* CoreDataDAO.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
AA0664571F31C97100AFED02 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AA0664581F31C97100AFED02 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AA06645A1F31C97100AFED02 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
INFOPLIST_FILE = DAO/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.DAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AA06645B1F31C97100AFED02 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
INFOPLIST_FILE = DAO/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.DAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
AA06644B1F31C97100AFED02 /* Build configuration list for PBXProject "DAO" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AA0664571F31C97100AFED02 /* Debug */,
|
||||
AA0664581F31C97100AFED02 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AA0664591F31C97100AFED02 /* Build configuration list for PBXNativeTarget "DAO" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AA06645A1F31C97100AFED02 /* Debug */,
|
||||
AA06645B1F31C97100AFED02 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = AA0664481F31C97100AFED02 /* Project object */;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1120"
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "CC7411E3237412650032D352"
|
||||
BuildableName = "CoreDataDAO.framework"
|
||||
BlueprintName = "CoreDataDAO"
|
||||
BlueprintIdentifier = "AA0664501F31C97100AFED02"
|
||||
BuildableName = "DAO.framework"
|
||||
BlueprintName = "DAO"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
|
|
@ -29,6 +29,8 @@
|
|||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
|
|
@ -40,6 +42,17 @@
|
|||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "AA0664501F31C97100AFED02"
|
||||
BuildableName = "DAO.framework"
|
||||
BlueprintName = "DAO"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
|
@ -50,9 +63,9 @@
|
|||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "CC7411E3237412650032D352"
|
||||
BuildableName = "CoreDataDAO.framework"
|
||||
BlueprintName = "CoreDataDAO"
|
||||
BlueprintIdentifier = "AA0664501F31C97100AFED02"
|
||||
BuildableName = "DAO.framework"
|
||||
BlueprintName = "DAO"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// DAO.h
|
||||
// DAO
|
||||
//
|
||||
// Created by Ivan Vavilov on 8/2/17.
|
||||
// Copyright © 2017 RedMadRobot. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for DAO.
|
||||
FOUNDATION_EXPORT double DAOVersionNumber;
|
||||
|
||||
//! Project version string for DAO.
|
||||
FOUNDATION_EXPORT const unsigned char DAOVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <DAO/PublicHeader.h>
|
||||
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
|
@ -13,10 +13,12 @@
|
|||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
14
DAO.podspec
14
DAO.podspec
|
|
@ -1,22 +1,20 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'DAO'
|
||||
s.version = '1.6.1'
|
||||
s.version = '1.0.3'
|
||||
s.summary = 'DAO Library'
|
||||
s.description = 'Library provides easy way to cache entities.'
|
||||
s.homepage = 'https://github.com/RedMadRobot/DAO'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'vani2' => 'iv@redmadrobot.com', 'hoppus' => 'e.popov@redmadrobot.com' }
|
||||
s.source = { :git => 'https://github.com/RedMadRobot/DAO.git', :tag => s.version, :submodules => true }
|
||||
s.author = { 'vani2' => 'iv@redmadrobot.com' }
|
||||
s.source = { :git => 'https://github.com/RedMadRobot/DAO.git', :tag => '1.0.3', :submodules => true }
|
||||
s.platform = :ios, '9.0'
|
||||
s.swift_version = '5.3'
|
||||
s.source_files = 'DAO/Classes/Core/**/*'
|
||||
|
||||
|
||||
s.subspec 'Realm' do |r|
|
||||
r.source_files = 'DAO/Classes/RealmDAO/**/*', 'DAO/Classes/Core/**/*'
|
||||
r.dependency "Realm", '~> 10.1'
|
||||
r.dependency "RealmSwift", '~> 10.1'
|
||||
r.dependency "RealmSwift"
|
||||
end
|
||||
|
||||
|
||||
s.subspec 'CoreData' do |cd|
|
||||
cd.source_files = 'DAO/Classes/CoreDataDAO/**/*', 'DAO/Classes/Core/**/*'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,802 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
48BC874C4FE8134679B29670 /* Pods_CoreDataDAO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E8A9BAF7ECAEC811F5ACE3C /* Pods_CoreDataDAO.framework */; };
|
||||
A5A85A8625ADBD73B3EEA43F /* Pods_RealmDAO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CA293F66C575881DDE04B1E /* Pods_RealmDAO.framework */; };
|
||||
CC741223237414070032D352 /* RealmConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC741218237414070032D352 /* RealmConfiguration.swift */; };
|
||||
CC741224237414070032D352 /* RealmDAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74121A237414070032D352 /* RealmDAO.swift */; };
|
||||
CC741225237414070032D352 /* RealmTranslator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74121C237414070032D352 /* RealmTranslator.swift */; };
|
||||
CC741226237414070032D352 /* CascadeDeletionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74121E237414070032D352 /* CascadeDeletionProtocol.swift */; };
|
||||
CC741227237414070032D352 /* RLMEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74121F237414070032D352 /* RLMEntry.swift */; };
|
||||
CC741228237414070032D352 /* Entity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC741221237414070032D352 /* Entity.swift */; };
|
||||
CC741229237414070032D352 /* DAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC741222237414070032D352 /* DAO.swift */; };
|
||||
CC741234237414420032D352 /* Entity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74122B237414420032D352 /* Entity.swift */; };
|
||||
CC741235237414420032D352 /* DAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74122C237414420032D352 /* DAO.swift */; };
|
||||
CC741236237414420032D352 /* CoreDataConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC74122F237414420032D352 /* CoreDataConfiguration.swift */; };
|
||||
CC741237237414420032D352 /* CoreDataDAO.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC741231237414420032D352 /* CoreDataDAO.swift */; };
|
||||
CC741238237414420032D352 /* CoreDataTranslator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC741233237414420032D352 /* CoreDataTranslator.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
CC741207237412EB0032D352 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2E8A9BAF7ECAEC811F5ACE3C /* Pods_CoreDataDAO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CoreDataDAO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3CA293F66C575881DDE04B1E /* Pods_RealmDAO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmDAO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
50E6127A1CFFD5C64BD5C4C0 /* Pods-RealmDAO.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDAO.debug.xcconfig"; path = "Target Support Files/Pods-RealmDAO/Pods-RealmDAO.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
5EEB202F6918AB3DB4D5F157 /* Pods-CoreDataDAO.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataDAO.release.xcconfig"; path = "Target Support Files/Pods-CoreDataDAO/Pods-CoreDataDAO.release.xcconfig"; sourceTree = "<group>"; };
|
||||
B2C2591874CB39D025BA9678 /* Pods-CoreDataDAO.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataDAO.debug.xcconfig"; path = "Target Support Files/Pods-CoreDataDAO/Pods-CoreDataDAO.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
BB6593BCAA1FA4DC2224EB94 /* Pods-RealmDAO.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDAO.release.xcconfig"; path = "Target Support Files/Pods-RealmDAO/Pods-RealmDAO.release.xcconfig"; sourceTree = "<group>"; };
|
||||
CC7411D62374124D0032D352 /* RealmDAO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RealmDAO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CC7411E4237412650032D352 /* CoreDataDAO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreDataDAO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CC741218237414070032D352 /* RealmConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmConfiguration.swift; sourceTree = "<group>"; };
|
||||
CC74121A237414070032D352 /* RealmDAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmDAO.swift; sourceTree = "<group>"; };
|
||||
CC74121C237414070032D352 /* RealmTranslator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmTranslator.swift; sourceTree = "<group>"; };
|
||||
CC74121E237414070032D352 /* CascadeDeletionProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CascadeDeletionProtocol.swift; sourceTree = "<group>"; };
|
||||
CC74121F237414070032D352 /* RLMEntry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMEntry.swift; sourceTree = "<group>"; };
|
||||
CC741221237414070032D352 /* Entity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entity.swift; sourceTree = "<group>"; };
|
||||
CC741222237414070032D352 /* DAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DAO.swift; sourceTree = "<group>"; };
|
||||
CC74122B237414420032D352 /* Entity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entity.swift; sourceTree = "<group>"; };
|
||||
CC74122C237414420032D352 /* DAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DAO.swift; sourceTree = "<group>"; };
|
||||
CC74122F237414420032D352 /* CoreDataConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataConfiguration.swift; sourceTree = "<group>"; };
|
||||
CC741231237414420032D352 /* CoreDataDAO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDAO.swift; sourceTree = "<group>"; };
|
||||
CC741233237414420032D352 /* CoreDataTranslator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataTranslator.swift; sourceTree = "<group>"; };
|
||||
CC74123923741CB20032D352 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = Carthage/Build/iOS/RealmSwift.framework; sourceTree = "<group>"; };
|
||||
CCF3733D2375451600536DE9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "DAO/Supporting Files/Info.plist"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
CC7411D32374124D0032D352 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A5A85A8625ADBD73B3EEA43F /* Pods_RealmDAO.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
CC7411E1237412650032D352 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
48BC874C4FE8134679B29670 /* Pods_CoreDataDAO.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9BBD4E66B9CEA0C2F7995438 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B2C2591874CB39D025BA9678 /* Pods-CoreDataDAO.debug.xcconfig */,
|
||||
5EEB202F6918AB3DB4D5F157 /* Pods-CoreDataDAO.release.xcconfig */,
|
||||
50E6127A1CFFD5C64BD5C4C0 /* Pods-RealmDAO.debug.xcconfig */,
|
||||
BB6593BCAA1FA4DC2224EB94 /* Pods-RealmDAO.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC7411CA2374116F0032D352 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CCF3733D2375451600536DE9 /* Info.plist */,
|
||||
CC7411D82374124D0032D352 /* RealmDAO */,
|
||||
CC7411E5237412650032D352 /* CoreDataDAO */,
|
||||
CC7411D72374124D0032D352 /* Products */,
|
||||
CC7411FD237412E30032D352 /* Frameworks */,
|
||||
9BBD4E66B9CEA0C2F7995438 /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC7411D72374124D0032D352 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC7411D62374124D0032D352 /* RealmDAO.framework */,
|
||||
CC7411E4237412650032D352 /* CoreDataDAO.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC7411D82374124D0032D352 /* RealmDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741220237414070032D352 /* Core */,
|
||||
CC741216237414070032D352 /* RealmDAO */,
|
||||
);
|
||||
name = RealmDAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC7411E5237412650032D352 /* CoreDataDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74122A237414420032D352 /* Core */,
|
||||
CC74122D237414420032D352 /* CoreDataDAO */,
|
||||
);
|
||||
name = CoreDataDAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC7411FD237412E30032D352 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74123923741CB20032D352 /* RealmSwift.framework */,
|
||||
2E8A9BAF7ECAEC811F5ACE3C /* Pods_CoreDataDAO.framework */,
|
||||
3CA293F66C575881DDE04B1E /* Pods_RealmDAO.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC741216237414070032D352 /* RealmDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741217237414070032D352 /* Configuration */,
|
||||
CC741219237414070032D352 /* DAO */,
|
||||
CC74121B237414070032D352 /* Translator */,
|
||||
CC74121D237414070032D352 /* Model */,
|
||||
);
|
||||
name = RealmDAO;
|
||||
path = DAO/Classes/RealmDAO;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
CC741217237414070032D352 /* Configuration */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741218237414070032D352 /* RealmConfiguration.swift */,
|
||||
);
|
||||
path = Configuration;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC741219237414070032D352 /* DAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74121A237414070032D352 /* RealmDAO.swift */,
|
||||
);
|
||||
path = DAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC74121B237414070032D352 /* Translator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74121C237414070032D352 /* RealmTranslator.swift */,
|
||||
);
|
||||
path = Translator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC74121D237414070032D352 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74121E237414070032D352 /* CascadeDeletionProtocol.swift */,
|
||||
CC74121F237414070032D352 /* RLMEntry.swift */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC741220237414070032D352 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741221237414070032D352 /* Entity.swift */,
|
||||
CC741222237414070032D352 /* DAO.swift */,
|
||||
);
|
||||
name = Core;
|
||||
path = DAO/Classes/Core;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
CC74122A237414420032D352 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74122B237414420032D352 /* Entity.swift */,
|
||||
CC74122C237414420032D352 /* DAO.swift */,
|
||||
);
|
||||
name = Core;
|
||||
path = DAO/Classes/Core;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
CC74122D237414420032D352 /* CoreDataDAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74122E237414420032D352 /* Configuration */,
|
||||
CC741230237414420032D352 /* DAO */,
|
||||
CC741232237414420032D352 /* Translator */,
|
||||
);
|
||||
name = CoreDataDAO;
|
||||
path = DAO/Classes/CoreDataDAO;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
CC74122E237414420032D352 /* Configuration */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC74122F237414420032D352 /* CoreDataConfiguration.swift */,
|
||||
);
|
||||
path = Configuration;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC741230237414420032D352 /* DAO */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741231237414420032D352 /* CoreDataDAO.swift */,
|
||||
);
|
||||
path = DAO;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CC741232237414420032D352 /* Translator */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CC741233237414420032D352 /* CoreDataTranslator.swift */,
|
||||
);
|
||||
path = Translator;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
CC7411D12374124D0032D352 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
CC7411DF237412650032D352 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
CC7411D52374124D0032D352 /* RealmDAO */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = CC7411DE2374124D0032D352 /* Build configuration list for PBXNativeTarget "RealmDAO" */;
|
||||
buildPhases = (
|
||||
17FFAD6DEDF561AB3CECEB03 /* [CP] Check Pods Manifest.lock */,
|
||||
CC7411D12374124D0032D352 /* Headers */,
|
||||
CC7411D22374124D0032D352 /* Sources */,
|
||||
CC7411D32374124D0032D352 /* Frameworks */,
|
||||
CC7411D42374124D0032D352 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = RealmDAO;
|
||||
productName = RealmDAO;
|
||||
productReference = CC7411D62374124D0032D352 /* RealmDAO.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
CC7411E3237412650032D352 /* CoreDataDAO */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = CC7411E9237412650032D352 /* Build configuration list for PBXNativeTarget "CoreDataDAO" */;
|
||||
buildPhases = (
|
||||
FEB9F6DAC170B0F648B677DE /* [CP] Check Pods Manifest.lock */,
|
||||
CC7411DF237412650032D352 /* Headers */,
|
||||
CC7411E0237412650032D352 /* Sources */,
|
||||
CC7411E1237412650032D352 /* Frameworks */,
|
||||
CC7411E2237412650032D352 /* Resources */,
|
||||
CC741207237412EB0032D352 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CoreDataDAO;
|
||||
productName = CoreDataDAO;
|
||||
productReference = CC7411E4237412650032D352 /* CoreDataDAO.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
CC7411CB2374116F0032D352 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1120;
|
||||
TargetAttributes = {
|
||||
CC7411D52374124D0032D352 = {
|
||||
CreatedOnToolsVersion = 11.2;
|
||||
};
|
||||
CC7411E3237412650032D352 = {
|
||||
CreatedOnToolsVersion = 11.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = CC7411CE2374116F0032D352 /* Build configuration list for PBXProject "DAO" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = CC7411CA2374116F0032D352;
|
||||
productRefGroup = CC7411D72374124D0032D352 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
CC7411D52374124D0032D352 /* RealmDAO */,
|
||||
CC7411E3237412650032D352 /* CoreDataDAO */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
CC7411D42374124D0032D352 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
CC7411E2237412650032D352 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
17FFAD6DEDF561AB3CECEB03 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RealmDAO-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FEB9F6DAC170B0F648B677DE /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-CoreDataDAO-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
CC7411D22374124D0032D352 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CC741229237414070032D352 /* DAO.swift in Sources */,
|
||||
CC741225237414070032D352 /* RealmTranslator.swift in Sources */,
|
||||
CC741224237414070032D352 /* RealmDAO.swift in Sources */,
|
||||
CC741228237414070032D352 /* Entity.swift in Sources */,
|
||||
CC741226237414070032D352 /* CascadeDeletionProtocol.swift in Sources */,
|
||||
CC741227237414070032D352 /* RLMEntry.swift in Sources */,
|
||||
CC741223237414070032D352 /* RealmConfiguration.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
CC7411E0237412650032D352 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CC741236237414420032D352 /* CoreDataConfiguration.swift in Sources */,
|
||||
CC741235237414420032D352 /* DAO.swift in Sources */,
|
||||
CC741234237414420032D352 /* Entity.swift in Sources */,
|
||||
CC741238237414420032D352 /* CoreDataTranslator.swift in Sources */,
|
||||
CC741237237414420032D352 /* CoreDataDAO.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
CC7411CF2374116F0032D352 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CC7411D02374116F0032D352 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
CC7411DC2374124D0032D352 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 50E6127A1CFFD5C64BD5C4C0 /* Pods-RealmDAO.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/DAO/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.redmadrobot.RealmDAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CC7411DD2374124D0032D352 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = BB6593BCAA1FA4DC2224EB94 /* Pods-RealmDAO.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/iOS",
|
||||
);
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/DAO/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.redmadrobot.RealmDAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
CC7411EA237412650032D352 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = B2C2591874CB39D025BA9678 /* Pods-CoreDataDAO.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/DAO/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.redmadrobot.CoreDataDAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CC7411EB237412650032D352 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5EEB202F6918AB3DB4D5F157 /* Pods-CoreDataDAO.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/DAO/Supporting Files/Info.plist";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ru.redmadrobot.CoreDataDAO;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
CC7411CE2374116F0032D352 /* Build configuration list for PBXProject "DAO" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
CC7411CF2374116F0032D352 /* Debug */,
|
||||
CC7411D02374116F0032D352 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
CC7411DE2374124D0032D352 /* Build configuration list for PBXNativeTarget "RealmDAO" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
CC7411DC2374124D0032D352 /* Debug */,
|
||||
CC7411DD2374124D0032D352 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
CC7411E9237412650032D352 /* Build configuration list for PBXNativeTarget "CoreDataDAO" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
CC7411EA237412650032D352 /* Debug */,
|
||||
CC7411EB237412650032D352 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = CC7411CB2374116F0032D352 /* Project object */;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1120"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "CC7411D52374124D0032D352"
|
||||
BuildableName = "RealmDAO.framework"
|
||||
BlueprintName = "RealmDAO"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "CC7411D52374124D0032D352"
|
||||
BuildableName = "RealmDAO.framework"
|
||||
BlueprintName = "RealmDAO"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:DAO.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -14,18 +14,18 @@ import Foundation
|
|||
open class Entity: Hashable {
|
||||
|
||||
/// Hash value for compare entities.
|
||||
open func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(entityId)
|
||||
open var hashValue: Int {
|
||||
get {
|
||||
return self.entityId.hashValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Unique entity identifer.
|
||||
open var entityId: String
|
||||
open var entityId: String = ""
|
||||
|
||||
|
||||
required public init() {
|
||||
entityId = UUID().uuidString
|
||||
}
|
||||
required public init() {}
|
||||
|
||||
|
||||
/// Creates an instance with identifier.
|
||||
|
|
@ -36,7 +36,7 @@ open class Entity: Hashable {
|
|||
}
|
||||
|
||||
|
||||
/// Redefine this function in child class for proper equality.
|
||||
/// Function to redefine it in children for proper equality.
|
||||
///
|
||||
/// - Parameter other: entity compare with.
|
||||
/// - Returns: result of comparison.
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ public struct CoreDataConfiguration {
|
|||
/// Options for persistence store
|
||||
public let options: [String: NSObject]
|
||||
|
||||
/// URL of persistent store file
|
||||
public let persistentStoreURL:URL?
|
||||
|
||||
|
||||
/// Create an instance with specified `containerName`, `storeType`, `options`.
|
||||
///
|
||||
|
|
@ -34,21 +31,15 @@ public struct CoreDataConfiguration {
|
|||
/// - containerName: name. See above.
|
||||
/// - storeType: store type. See above.
|
||||
/// - options: persistence store options.
|
||||
/// - persistentStoreURL: URL of persistent store file.
|
||||
public init(
|
||||
containerName: String,
|
||||
storeType: String = NSSQLiteStoreType,
|
||||
options: [String : NSObject] =
|
||||
[
|
||||
NSMigratePersistentStoresAutomaticallyOption: true as NSObject,
|
||||
NSInferMappingModelAutomaticallyOption: true as NSObject
|
||||
],
|
||||
persistentStoreURL:URL? = nil) {
|
||||
|
||||
[NSMigratePersistentStoresAutomaticallyOption: true as NSObject,
|
||||
NSInferMappingModelAutomaticallyOption: true as NSObject]) {
|
||||
self.containerName = containerName
|
||||
self.storeType = storeType
|
||||
self.options = options
|
||||
self.persistentStoreURL = persistentStoreURL
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import CoreData
|
|||
|
||||
|
||||
/// `DAO` pattern implementation for `CoreData`.
|
||||
open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
||||
open class CoreDataDAO<CDModel: NSManagedObject, Model: Entity> : DAO<Model> {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// Translator for current `Model` and `CDModel` types.
|
||||
private var translator: CoreDataTranslator<Model, CDModel>
|
||||
/// Translator for current `CDModel` and `Model` types.
|
||||
private var translator: CoreDataTranslator<CDModel, Model>
|
||||
|
||||
|
||||
/// Persistent store cooridnator. Can be configured by `CoreDataConfiguration`.
|
||||
|
|
@ -25,9 +25,9 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
/// Managed object context. Context is created every transaction due to current queue –
|
||||
/// main or background.
|
||||
private var context: NSManagedObjectContext {
|
||||
let context = Thread.isMainThread
|
||||
? NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
|
||||
: NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
|
||||
let context = Thread.isMainThread ?
|
||||
NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) :
|
||||
NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType)
|
||||
|
||||
context.persistentStoreCoordinator = persistentStoreCoordinator
|
||||
context.shouldDeleteInaccessibleFaults = true
|
||||
|
|
@ -43,12 +43,12 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
/// Creates an instance with specified `translator` and `configuration`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `CDModel` types.
|
||||
/// - translator: translator for current `CDModel` and `Model` types.
|
||||
/// - configuration: configuration. See also `CoreDataConfiguration`.
|
||||
/// - Throws: error if loading or adding persistence store is failed.
|
||||
public convenience init(
|
||||
_ translator: CoreDataTranslator<Model, CDModel>,
|
||||
configuration: CoreDataConfiguration) throws {
|
||||
public init(_ translator: CoreDataTranslator<CDModel, Model>,
|
||||
configuration: CoreDataConfiguration) throws {
|
||||
self.translator = translator
|
||||
|
||||
if #available(iOS 10, *) {
|
||||
let persistentContainer = NSPersistentContainer(name: configuration.containerName)
|
||||
|
|
@ -60,10 +60,6 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
description.setOption($0.value, forKey: $0.key)
|
||||
}
|
||||
description.type = configuration.storeType
|
||||
|
||||
if configuration.persistentStoreURL != nil {
|
||||
description.url = configuration.persistentStoreURL
|
||||
}
|
||||
}
|
||||
|
||||
var error: Error?
|
||||
|
|
@ -74,58 +70,22 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
|
||||
if let error = error { throw error }
|
||||
|
||||
self.init(translator, persistentContainer: persistentContainer)
|
||||
persistentStoreCoordinator = persistentContainer.persistentStoreCoordinator
|
||||
} else {
|
||||
let url = Bundle(for: CDModel.self).url(
|
||||
forResource: configuration.containerName,
|
||||
withExtension: "momd"
|
||||
)!
|
||||
withExtension: "momd")!
|
||||
|
||||
let persistentStoreCoordinator = NSPersistentStoreCoordinator(
|
||||
managedObjectModel: NSManagedObjectModel(contentsOf: url)!
|
||||
)
|
||||
|
||||
let persistentStoreUrl = configuration.persistentStoreURL
|
||||
?? CoreDataDAO.url(storeName: "\(configuration.containerName).db")
|
||||
persistentStoreCoordinator = NSPersistentStoreCoordinator(
|
||||
managedObjectModel: NSManagedObjectModel(contentsOf: url)!)
|
||||
|
||||
try persistentStoreCoordinator.addPersistentStore(
|
||||
ofType: configuration.storeType,
|
||||
configurationName: nil,
|
||||
at: persistentStoreUrl,
|
||||
at: CoreDataDAO.url(storeName: "\(configuration.containerName).db"),
|
||||
options: configuration.options)
|
||||
|
||||
self.init(translator, persistentStoreCoordinator: persistentStoreCoordinator)
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates an instance with specified `translator` and `persistentContainer`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `CDModel` types.
|
||||
/// - persistentContainer: initialized NSPersistentContainer with loaded persistent stores
|
||||
@available(iOS 10.0, *)
|
||||
public convenience init(
|
||||
_ translator: CoreDataTranslator<Model, CDModel>,
|
||||
persistentContainer: NSPersistentContainer) {
|
||||
|
||||
self.init(
|
||||
translator,
|
||||
persistentStoreCoordinator: persistentContainer.persistentStoreCoordinator
|
||||
)
|
||||
}
|
||||
|
||||
/// Creates an instance with specified `translator` and `persistentStoreCoordinator`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `CDModel` types.
|
||||
/// - persistentStoreCoordinator: initialized NSPersistentStoreCoordinator with loaded persistent stores
|
||||
public init(
|
||||
_ translator: CoreDataTranslator<Model, CDModel>,
|
||||
persistentStoreCoordinator: NSPersistentStoreCoordinator) {
|
||||
|
||||
self.translator = translator
|
||||
self.persistentStoreCoordinator = persistentStoreCoordinator
|
||||
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
|
@ -190,24 +150,16 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
|
||||
|
||||
open override func read(_ entityId: String) -> Model? {
|
||||
|
||||
let context = self.context
|
||||
var entity: Model?
|
||||
|
||||
context.performAndWait { [weak self] in
|
||||
guard
|
||||
let `self` = self,
|
||||
let entries = try? context.fetch(self.request(entityId)),
|
||||
let entry = entries.first
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
let model = Model()
|
||||
self.translator.fill(model, fromEntry: entry)
|
||||
entity = model
|
||||
guard let entries = try? context.fetch(request(entityId)),
|
||||
!entries.isEmpty,
|
||||
let entry = entries.first
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let entity = Model()
|
||||
translator.fill(entity, fromEntry: entry)
|
||||
|
||||
return entity
|
||||
}
|
||||
|
||||
|
|
@ -229,24 +181,14 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
|
||||
let sortDescriptors = field != nil ? [NSSortDescriptor(key: field, ascending: ascending)] : []
|
||||
|
||||
let context = self.context
|
||||
var models: [Model]?
|
||||
|
||||
context.performAndWait { [weak self] in
|
||||
guard let `self` = self else { return }
|
||||
|
||||
models = self.fetchEntries(
|
||||
predicate,
|
||||
sortDescriptors: sortDescriptors,
|
||||
inContext: context)
|
||||
.compactMap {
|
||||
let entity = Model()
|
||||
self.translator.fill(entity, fromEntry: $0)
|
||||
return entity
|
||||
return fetchEntries(predicate, sortDescriptors: sortDescriptors, inContext: context)
|
||||
.flatMap {
|
||||
let entity = Model()
|
||||
|
||||
self.translator.fill(entity, fromEntry: $0)
|
||||
|
||||
return entity
|
||||
}
|
||||
}
|
||||
|
||||
return models ?? []
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -264,7 +206,9 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
guard let `self` = self else { return }
|
||||
|
||||
self.fetchEntries(inContext: context)
|
||||
.forEach(context.delete)
|
||||
.forEach {
|
||||
context.delete($0)
|
||||
}
|
||||
|
||||
do {
|
||||
try context.save()
|
||||
|
|
@ -287,7 +231,9 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
guard let `self` = self else { return }
|
||||
|
||||
self.fetchEntries(entityId, inContext: context)
|
||||
.forEach(context.delete)
|
||||
.forEach {
|
||||
context.delete($0)
|
||||
}
|
||||
do {
|
||||
try context.save()
|
||||
} catch let e {
|
||||
|
|
@ -306,10 +252,11 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
private func fetchEntries(
|
||||
_ entryId: String,
|
||||
inContext context: NSManagedObjectContext) -> [CDModel] {
|
||||
|
||||
let request = self.request(entryId)
|
||||
let entries = try? context.fetch(request)
|
||||
return entries ?? []
|
||||
if let entries = try? context.fetch(request(entryId)) {
|
||||
return entries
|
||||
} else {
|
||||
return [CDModel]()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -317,10 +264,11 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
_ predicate: NSPredicate? = nil,
|
||||
sortDescriptors: [NSSortDescriptor] = [],
|
||||
inContext context: NSManagedObjectContext) -> [CDModel] {
|
||||
|
||||
let request = self.request(predicate, sortDescriptors: sortDescriptors)
|
||||
let entries = try? context.fetch(request)
|
||||
return entries ?? []
|
||||
if let entries = try? context.fetch(request(predicate, sortDescriptors: sortDescriptors)) {
|
||||
return entries
|
||||
} else {
|
||||
return [CDModel]()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -332,10 +280,8 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
}
|
||||
|
||||
|
||||
private func request(
|
||||
_ predicate: NSPredicate?,
|
||||
sortDescriptors: [NSSortDescriptor]) -> NSFetchRequest<CDModel> {
|
||||
|
||||
private func request(_ predicate: NSPredicate?,
|
||||
sortDescriptors: [NSSortDescriptor]) -> NSFetchRequest<CDModel> {
|
||||
let request = NSFetchRequest<CDModel>(entityName: translator.entryClassName)
|
||||
request.predicate = predicate
|
||||
request.sortDescriptors = sortDescriptors
|
||||
|
|
@ -349,9 +295,8 @@ open class CoreDataDAO<Model: Entity, CDModel: NSManagedObject> : DAO<Model> {
|
|||
private func isEntryExist(
|
||||
_ entryId: String,
|
||||
inContext context: NSManagedObjectContext) -> Bool {
|
||||
|
||||
let existingEntries = fetchEntries(entryId, inContext: context)
|
||||
return !existingEntries.isEmpty
|
||||
return existingEntries.count > 0
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import CoreData
|
|||
|
||||
/// Parent class for `CoreData` translators.
|
||||
/// Translators fill properties of new/existant entities from entries and other way.
|
||||
open class CoreDataTranslator<Model: Entity, CDModel: NSManagedObject> {
|
||||
open class CoreDataTranslator<CDModel: NSManagedObject, Model: Entity> {
|
||||
|
||||
/// Helper property for `CoreDataDAO`.
|
||||
open var entryClassName: String {
|
||||
|
|
@ -59,7 +59,7 @@ open class CoreDataTranslator<Model: Entity, CDModel: NSManagedObject> {
|
|||
in context: NSManagedObjectContext) {
|
||||
|
||||
fromEntities
|
||||
.compactMap { entity -> (CDModel, Model)? in
|
||||
.flatMap { entity -> (CDModel, Model)? in
|
||||
if let entry = NSEntityDescription.insertNewObject(
|
||||
forEntityName: self.entryClassName,
|
||||
into: context) as? CDModel {
|
||||
|
|
@ -78,7 +78,7 @@ open class CoreDataTranslator<Model: Entity, CDModel: NSManagedObject> {
|
|||
/// All properties of entries will be overridden by entities properties.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - entities: array of instances of `Model` type.
|
||||
/// - entities: array of instances of `CDModel` type.
|
||||
/// - fromEntries: array of instances of `CDModel` type.
|
||||
open func fill(_ entities: inout [Model], fromEntries: Set<CDModel>?) {
|
||||
entities.removeAll()
|
||||
|
|
|
|||
|
|
@ -10,56 +10,31 @@ import RealmSwift
|
|||
/// Incapsulates basic settings.
|
||||
/// Used to initialize `Realm DAO`.
|
||||
public struct RealmConfiguration {
|
||||
|
||||
|
||||
/// Name of database file name.
|
||||
public let databaseFileName: String
|
||||
|
||||
/// Version of database.
|
||||
public let databaseVersion: UInt64
|
||||
|
||||
/// URL of database.
|
||||
public let databaseURL: URL?
|
||||
|
||||
/// Migration block for manual migration.
|
||||
public let migrationBlock: MigrationBlock?
|
||||
|
||||
/// Key to encrypt data.
|
||||
public let encryptionKey: Data?
|
||||
|
||||
/**
|
||||
A block called when opening a Realm for the first time during the life
|
||||
of a process to determine if it should be compacted before being returned
|
||||
to the user. It is passed the total file size (data + free space) and the total
|
||||
bytes used by data in the file.
|
||||
|
||||
Return `true` to indicate that an attempt to compact the file should be made.
|
||||
The compaction will be skipped if another process is accessing it.
|
||||
*/
|
||||
public let shouldCompactOnLaunch: ((Int, Int) -> Bool)?
|
||||
|
||||
|
||||
/// Create an instance with specified `databaseFileName`, `dataBaseURL`, `databaseVersion`, `migrationBlock`.
|
||||
/// Create an instance with specified `databaseFileName`, `databaseVersion`, `migrationBlock`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - databaseFileName: name. See above.
|
||||
/// - databaseURL: url. See above.
|
||||
/// - databaseVersion: version. See above.
|
||||
/// - migrationBlock: migration block. See above.
|
||||
/// - encryptionKey: encryption key. See above.
|
||||
public init(
|
||||
databaseFileName: String = "Database.realm",
|
||||
databaseURL: URL? = nil,
|
||||
databaseVersion: UInt64 = 1,
|
||||
migrationBlock: MigrationBlock? = nil,
|
||||
encryptionKey: Data? = nil,
|
||||
shouldCompactOnLaunch: ((Int, Int) -> Bool)? = nil) {
|
||||
migrationBlock: MigrationBlock? = nil) {
|
||||
|
||||
self.databaseFileName = databaseFileName
|
||||
self.databaseURL = databaseURL
|
||||
self.databaseVersion = databaseVersion
|
||||
self.migrationBlock = migrationBlock
|
||||
self.encryptionKey = encryptionKey
|
||||
self.shouldCompactOnLaunch = shouldCompactOnLaunch
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,93 +13,44 @@ import RealmSwift
|
|||
|
||||
/// `DAO` pattern implementation for `Realm`.
|
||||
open class RealmDAO<Model: Entity, RealmModel: RLMEntry>: DAO<Model> {
|
||||
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// Translator for current `RLMEntry` and `RealmModel` types.
|
||||
private let translator: RealmTranslator<Model, RealmModel>
|
||||
private let configuration: Realm.Configuration
|
||||
/// In-memory Realm instance.
|
||||
private var inMemoryRealm: Realm?
|
||||
|
||||
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
/// Creates an instance with specified `translator` and `configuration`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `RealmModel` types.
|
||||
/// - configuration: configuration. See also `Realm.Configuration`.
|
||||
public init(
|
||||
_ translator: RealmTranslator<Model, RealmModel>,
|
||||
configuration: Realm.Configuration) {
|
||||
|
||||
self.translator = translator
|
||||
self.configuration = configuration
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
/// Creates an instance with specified `translator` and `configuration`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `RealmModel` types.
|
||||
/// - configuration: configuration. See also `RealmConfiguration`.
|
||||
public init(
|
||||
_ translator: RealmTranslator<Model, RealmModel>,
|
||||
configuration: RealmConfiguration) {
|
||||
|
||||
public init(_ translator: RealmTranslator<Model, RealmModel>,
|
||||
configuration: RealmConfiguration) {
|
||||
self.translator = translator
|
||||
self.configuration = RealmDAO.makeRealmConfiguration(configuration)
|
||||
super.init()
|
||||
loadDefaultRealm(configuration: configuration)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// Creates an instance with specified `translator` and default configuration.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - translator: translator for current `Model` and `RealmModel` types.
|
||||
public convenience init(
|
||||
_ translator: RealmTranslator<Model, RealmModel>) {
|
||||
|
||||
self.init(translator, configuration: RealmConfiguration())
|
||||
public convenience init(_ translator: RealmTranslator<Model, RealmModel>) {
|
||||
self.init(translator,
|
||||
configuration: RealmConfiguration())
|
||||
}
|
||||
|
||||
|
||||
static func makeRealmConfiguration(_ configuration: RealmConfiguration) -> Realm.Configuration {
|
||||
|
||||
var config = Realm.Configuration.defaultConfiguration
|
||||
|
||||
guard let path = configuration.databaseURL ?? self.pathForFileName(configuration.databaseFileName) else {
|
||||
fatalError("Cant find path for DB with filename: \(configuration.databaseFileName)"
|
||||
+ " v.\(configuration.databaseVersion)")
|
||||
}
|
||||
config.fileURL = path
|
||||
config.schemaVersion = configuration.databaseVersion
|
||||
config.migrationBlock = configuration.migrationBlock
|
||||
config.encryptionKey = configuration.encryptionKey
|
||||
config.shouldCompactOnLaunch = configuration.shouldCompactOnLaunch
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
public static func pathForFileName(_ fileName: String) -> URL? {
|
||||
let documentDirectory = NSSearchPathForDirectoriesInDomains(
|
||||
.documentDirectory,
|
||||
.userDomainMask,
|
||||
true).first as NSString?
|
||||
|
||||
guard let realmPath = documentDirectory?.appendingPathComponent(fileName) else {
|
||||
return nil
|
||||
}
|
||||
return URL(string: realmPath)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//MARK: - DAO
|
||||
|
||||
|
||||
override open func persist(_ entity: Model) throws {
|
||||
if let entry = try readFromRealm(entity.entityId) {
|
||||
if let entry = readFromRealm(entity.entityId) {
|
||||
try autoreleasepool {
|
||||
try realm().beginWrite()
|
||||
realm().beginWrite()
|
||||
translator.fill(entry, fromEntity: entity)
|
||||
try realm().commitWrite()
|
||||
}
|
||||
|
|
@ -109,95 +60,77 @@ open class RealmDAO<Model: Entity, RealmModel: RLMEntry>: DAO<Model> {
|
|||
try write(entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
open override func persist(_ entities: [Model]) throws {
|
||||
|
||||
let entries = List<RealmModel>()
|
||||
for entity in entities {
|
||||
if let entry = try? readFromRealm(entity.entityId) {
|
||||
entries.append(entry)
|
||||
}
|
||||
}
|
||||
|
||||
let realm = try self.realm()
|
||||
let entries = List<RealmModel>(entities.flatMap {
|
||||
self.readFromRealm($0.entityId)
|
||||
})
|
||||
|
||||
try autoreleasepool {
|
||||
realm.beginWrite()
|
||||
realm().beginWrite()
|
||||
translator.fill(entries, fromEntities: entities)
|
||||
|
||||
entries.forEach {
|
||||
realm.create(RealmModel.self, value: $0, update: .all)
|
||||
self.realm().create(RealmModel.self, value: $0, update: true)
|
||||
}
|
||||
|
||||
try realm.commitWrite()
|
||||
try realm().commitWrite()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override open func read(_ entityId: String) -> Model? {
|
||||
|
||||
guard let entry = try? readFromRealm(entityId) else { return nil }
|
||||
|
||||
guard let entry = readFromRealm(entityId) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let entity = Model()
|
||||
translator.fill(entity, fromEntry: entry)
|
||||
|
||||
|
||||
return entity
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
open override func read() -> [Model] {
|
||||
do {
|
||||
let results = try readFromRealm()
|
||||
return results.map {
|
||||
let entity = Model()
|
||||
self.translator.fill(entity, fromEntry: $0)
|
||||
return entity
|
||||
}
|
||||
} catch {
|
||||
return []
|
||||
return readFromRealm().map {
|
||||
let entity = Model()
|
||||
self.translator.fill(entity, fromEntry: $0)
|
||||
return entity
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
open override func read(predicatedBy predicate: NSPredicate?) -> [Model] {
|
||||
return read(predicatedBy: predicate, orderedBy: nil)
|
||||
}
|
||||
|
||||
|
||||
open override func read(
|
||||
orderedBy field: String?,
|
||||
ascending: Bool) -> [Model] {
|
||||
|
||||
|
||||
|
||||
open override func read(orderedBy field: String?,
|
||||
ascending: Bool) -> [Model] {
|
||||
return read(predicatedBy: nil, orderedBy: field, ascending: ascending)
|
||||
}
|
||||
|
||||
|
||||
open override func read(
|
||||
predicatedBy predicate: NSPredicate?,
|
||||
orderedBy field: String?,
|
||||
ascending: Bool = true) -> [Model] {
|
||||
|
||||
var entries: Results<RealmModel>
|
||||
do {
|
||||
entries = try readFromRealm(predicate)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
|
||||
open override func read(predicatedBy predicate: NSPredicate?,
|
||||
orderedBy field: String?,
|
||||
ascending: Bool = true) -> [Model] {
|
||||
var entries = readFromRealm(predicate)
|
||||
|
||||
if let field = field {
|
||||
entries = entries.sorted(byKeyPath: field, ascending: ascending)
|
||||
}
|
||||
|
||||
|
||||
return entries.map {
|
||||
let entity = Model()
|
||||
self.translator.fill(entity, fromEntry: $0)
|
||||
return entity
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override open func erase() throws {
|
||||
let results = try readFromRealm()
|
||||
let results = readFromRealm()
|
||||
let entries: List<RealmModel> = List<RealmModel>()
|
||||
|
||||
entries.append(objectsIn: results.map {
|
||||
|
|
@ -206,58 +139,54 @@ open class RealmDAO<Model: Entity, RealmModel: RLMEntry>: DAO<Model> {
|
|||
|
||||
try self.delete(entries)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override open func erase(_ entityId: String) throws {
|
||||
guard let entry = try readFromRealm(entityId) else {
|
||||
guard let entry = readFromRealm(entityId) else {
|
||||
return
|
||||
}
|
||||
try delete(entry)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
|
||||
private func write(_ entry: RealmModel) throws {
|
||||
let realm = try self.realm()
|
||||
try realm.write {
|
||||
realm.create(RealmModel.self, value: entry, update: .all)
|
||||
try self.realm().write {
|
||||
self.realm().create(RealmModel.self, value: entry, update: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private func write(_ entries: List<RealmModel>) throws {
|
||||
let realm = try self.realm()
|
||||
try realm.write {
|
||||
try self.realm().write {
|
||||
entries.forEach { (e: RealmModel) -> () in
|
||||
realm.create(RealmModel.self, value: e, update: .all)
|
||||
self.realm().create(RealmModel.self, value: e, update: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func readFromRealm(_ entryId: String) throws -> RealmModel? {
|
||||
let realm = try self.realm()
|
||||
return realm.object(ofType: RealmModel.self, forPrimaryKey: entryId)
|
||||
|
||||
|
||||
private func readFromRealm(_ entryId: String) -> RealmModel? {
|
||||
return self.realm().object(ofType: RealmModel.self, forPrimaryKey: entryId)
|
||||
}
|
||||
|
||||
|
||||
|
||||
private func readFromRealm(_ predicate: NSPredicate? = nil) throws -> Results<RealmModel> {
|
||||
let realm = try self.realm()
|
||||
let results: Results<RealmModel> = realm.objects(RealmModel.self)
|
||||
private func readFromRealm(_ predicate: NSPredicate? = nil) -> Results<RealmModel> {
|
||||
let results: Results<RealmModel> = self.realm().objects(RealmModel.self)
|
||||
guard let predicate = predicate else {
|
||||
return results
|
||||
}
|
||||
return results.filter(predicate)
|
||||
}
|
||||
|
||||
|
||||
|
||||
private func delete(_ entry: RealmModel) throws {
|
||||
try self.realm().write {
|
||||
cascadeDelete(entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private func delete(_ entries: List<RealmModel>) throws {
|
||||
try self.realm().write {
|
||||
|
|
@ -265,35 +194,75 @@ open class RealmDAO<Model: Entity, RealmModel: RLMEntry>: DAO<Model> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private func cascadeDelete(_ object: Any?) {
|
||||
switch object {
|
||||
case let listObject as List<RealmModel>:
|
||||
for object in listObject {
|
||||
|
||||
private func cascadeDelete(_ object: AnyObject?) {
|
||||
if let deletable = object as? CascadeDeletionProtocol {
|
||||
deletable.objectsToDelete.forEach { child in
|
||||
cascadeDelete(child)
|
||||
}
|
||||
}
|
||||
|
||||
if let realmArray = object as? ListBase {
|
||||
for i in 0..<realmArray.count {
|
||||
let object = realmArray._rlmArray[UInt(i)]
|
||||
cascadeDelete(object)
|
||||
}
|
||||
}
|
||||
|
||||
case let object as Object:
|
||||
if !object.isInvalidated, let deletable = object as? CascadeDeletionProtocol {
|
||||
deletable.objectsToDelete.forEach { child in
|
||||
cascadeDelete(child)
|
||||
}
|
||||
|
||||
try? self.realm().delete(object)
|
||||
}
|
||||
default:
|
||||
break
|
||||
if let realmObject = object as? Object {
|
||||
self.realm().delete(realmObject)
|
||||
}
|
||||
}
|
||||
|
||||
private func realm() throws -> Realm {
|
||||
let realm = try Realm(configuration: configuration)
|
||||
|
||||
if configuration.inMemoryIdentifier != nil {
|
||||
inMemoryRealm = realm
|
||||
|
||||
private func realm() -> Realm {
|
||||
return try! Realm()
|
||||
}
|
||||
|
||||
|
||||
private func defaultRealmPathIsEqualToPath(_ path: URL?) -> Bool {
|
||||
guard let path = path else {
|
||||
return false
|
||||
}
|
||||
|
||||
return realm
|
||||
return Realm.Configuration.defaultConfiguration.fileURL == path
|
||||
}
|
||||
|
||||
|
||||
private func loadDefaultRealm(configuration: RealmConfiguration) {
|
||||
guard let path = self.pathForFileName(configuration.databaseFileName) else {
|
||||
fatalError("Cant find path for DB with filename: \(configuration.databaseFileName)" +
|
||||
" v.\(configuration.databaseVersion)")
|
||||
}
|
||||
if defaultRealmPathIsEqualToPath(path) {
|
||||
return
|
||||
}
|
||||
|
||||
assignDefaultRealmPath(path)
|
||||
migrateDefaultRealmToCurrentVersion(configuration: configuration)
|
||||
}
|
||||
|
||||
|
||||
private func pathForFileName(_ fileName: String) -> URL? {
|
||||
let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first as NSString?
|
||||
guard let realmPath = documentDirectory?.appendingPathComponent(fileName) else {
|
||||
return nil
|
||||
}
|
||||
return URL(string: realmPath)
|
||||
}
|
||||
|
||||
|
||||
private func assignDefaultRealmPath(_ path: URL) {
|
||||
var configuration = Realm.Configuration.defaultConfiguration
|
||||
configuration.fileURL = path
|
||||
Realm.Configuration.defaultConfiguration = configuration
|
||||
}
|
||||
|
||||
|
||||
private func migrateDefaultRealmToCurrentVersion(configuration: RealmConfiguration) {
|
||||
var config = Realm.Configuration.defaultConfiguration
|
||||
config.schemaVersion = configuration.databaseVersion
|
||||
config.migrationBlock = configuration.migrationBlock
|
||||
Realm.Configuration.defaultConfiguration = config
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
import Realm
|
||||
|
||||
|
||||
/// Parent class for `Realm` entries.
|
||||
open class RLMEntry: Object {
|
||||
|
||||
/// Entry identifier. Must be unique.
|
||||
@objc dynamic open var entryId: String
|
||||
dynamic open var entryId: String
|
||||
|
||||
|
||||
/// Creates an instance with specified `entryId`.
|
||||
|
|
@ -28,12 +29,34 @@ open class RLMEntry: Object {
|
|||
|
||||
|
||||
/// Creates an instance with emppty `entryId`.
|
||||
public required override init() {
|
||||
public required init() {
|
||||
self.entryId = ""
|
||||
super.init()
|
||||
}
|
||||
|
||||
open override class func primaryKey() -> String? {
|
||||
|
||||
|
||||
/// Creates an instance with specified `realm` and `schema`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - realm: instance of RLMRealm.
|
||||
/// - schema: instance of RLMObjectSchema.
|
||||
required public init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
self.entryId = ""
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
|
||||
/// Creates an instance with specified `value` and `schema`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - value: value.
|
||||
/// - schema: instance of `RLMSchema`.
|
||||
required public init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
override open class func primaryKey() -> String? {
|
||||
return "entryId"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,211 @@
|
|||
//
|
||||
// RLMTypes.swift
|
||||
// DAO
|
||||
//
|
||||
// Created by Ivan Vavilov on 5/17/17.
|
||||
// Copyright © 2017 RedMadRobot LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import RealmSwift
|
||||
import Realm
|
||||
|
||||
|
||||
/// Protocol for implement wrappers for standard types that Realm can't save now.
|
||||
/// Use it if you want to save collection of standard type in Realm.
|
||||
public protocol RLMPrimitiveType: class {
|
||||
|
||||
associatedtype A
|
||||
|
||||
var value: A { get set }
|
||||
|
||||
init(val: A)
|
||||
}
|
||||
|
||||
|
||||
/// String wrapper
|
||||
open class RLMString: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: String) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = String
|
||||
|
||||
public dynamic var value: String = ""
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Integer wrapper
|
||||
open class RLMInteger: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Int) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Int
|
||||
|
||||
public dynamic var value: Int = 0
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Double wrapper
|
||||
open class RLMDouble: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Double) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Double
|
||||
|
||||
public dynamic var value: Double = 0.0
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Float wrapper
|
||||
open class RLMFloat: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Float) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Float
|
||||
|
||||
public dynamic var value: Float = 0.0
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Bool wrapper
|
||||
open class RLMBool: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Bool) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Bool
|
||||
|
||||
public dynamic var value: Bool = false
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Date wrapper
|
||||
open class RLMDate: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Date) {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Date
|
||||
|
||||
public dynamic var value: Date = Date()
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Data wrapper
|
||||
open class RLMData: Object, RLMPrimitiveType {
|
||||
|
||||
public required init(val: Data) {
|
||||
value = val
|
||||
super.init()
|
||||
}
|
||||
|
||||
public required init(value: Any, schema: RLMSchema) {
|
||||
fatalError("init(value:schema:) has not been implemented")
|
||||
}
|
||||
|
||||
public required init(realm: RLMRealm, schema: RLMObjectSchema) {
|
||||
super.init(realm: realm, schema: schema)
|
||||
}
|
||||
|
||||
required public init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
public typealias A = Data
|
||||
|
||||
public dynamic var value: Data = Data()
|
||||
|
||||
}
|
||||
|
|
@ -33,36 +33,25 @@ open class RealmTranslator<Model: Entity, RealmModel: RLMEntry> {
|
|||
/// - entries: list of instances of `RealmModel` type.
|
||||
/// - fromEntities: array of instances of `Model` type.
|
||||
open func fill(_ entries: List<RealmModel>, fromEntities: [Model]) {
|
||||
var newEntries = [RealmModel]()
|
||||
let oldEntries = entries.map { $0 }
|
||||
|
||||
fromEntities
|
||||
.map { entity -> (RealmModel, Model) in
|
||||
let entry = entries.first { $0.entryId == entity.entityId }
|
||||
let entry = oldEntries
|
||||
.filter { $0.entryId == entity.entityId }
|
||||
.first
|
||||
|
||||
if let entry = entry {
|
||||
return (entry, entity)
|
||||
} else {
|
||||
let entry = RealmModel()
|
||||
newEntries.append(entry)
|
||||
entries.append(entry)
|
||||
return (entry, entity)
|
||||
}
|
||||
}
|
||||
.forEach {
|
||||
self.fill($0.0, fromEntity: $0.1)
|
||||
}
|
||||
|
||||
if fromEntities.count < entries.count {
|
||||
let entityIds = fromEntities.map { $0.entityId }
|
||||
let deletedEntriesIndexes = entries
|
||||
.filter { !entityIds.contains($0.entryId) }
|
||||
deletedEntriesIndexes.forEach {
|
||||
if let index = entries.index(of: $0) {
|
||||
entries.remove(at: index)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
entries.append(objectsIn: newEntries)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,35 +14,28 @@ import CoreData
|
|||
|
||||
final class CoreDataDAOEntityTests: XCTestCase {
|
||||
|
||||
private var dao: CoreDataDAO<Entity, CDEntity>!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let translator = CDEntityTranslator()
|
||||
let configuration = CoreDataConfiguration(
|
||||
let dao = try! CoreDataDAO(
|
||||
CDEntityTranslator(),
|
||||
configuration: CoreDataConfiguration(
|
||||
containerName: "Model",
|
||||
storeType: NSInMemoryStoreType
|
||||
)
|
||||
|
||||
dao = try! CoreDataDAO(
|
||||
translator,
|
||||
configuration: configuration
|
||||
)
|
||||
}
|
||||
storeType: NSInMemoryStoreType))
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
func testReadById() {
|
||||
let entity = Entity(entityId: "2")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Read by id is failed")
|
||||
XCTAssertEqual(dao.read("2")?.entityId, entity.entityId, "Read by id is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch _ {
|
||||
XCTFail("Read by id is failed")
|
||||
}
|
||||
|
||||
|
||||
if let savedEntity = dao.read("2") {
|
||||
XCTAssertEqual(savedEntity.entityId, entity.entityId)
|
||||
} else {
|
||||
XCTFail("Read by id is failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -51,23 +44,42 @@ final class CoreDataDAOEntityTests: XCTestCase {
|
|||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
|
||||
XCTAssertNotNil(try? self.dao.persist(entity), "Async read by id is failed")
|
||||
do {
|
||||
try self.dao.persist(entity)
|
||||
} catch _ {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertEqual(self.dao.read("2_back")?.entityId, entity.entityId, "Async read by id is failed")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if let savedEntity = self.dao.read("2_back") {
|
||||
XCTAssertEqual(savedEntity.entityId, entity.entityId)
|
||||
} else {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
exp.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testPersist() {
|
||||
let entity = Entity(entityId: "1")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch _ {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Persist is failed")
|
||||
|
||||
XCTAssert(true)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -75,43 +87,82 @@ final class CoreDataDAOEntityTests: XCTestCase {
|
|||
let firstEntity = Entity(entityId: "2")
|
||||
let secondEntity = Entity(entityId: "3")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist([firstEntity, secondEntity]), "Persist All is failed")
|
||||
do {
|
||||
try dao.persist([firstEntity, secondEntity])
|
||||
} catch _ {
|
||||
XCTFail("Persist All is failed")
|
||||
}
|
||||
|
||||
XCTAssert(true)
|
||||
}
|
||||
|
||||
|
||||
func testAsyncPersist() {
|
||||
let entity = Entity(entityId: "1_back")
|
||||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertNotNil(try? self.dao.persist(entity), "Saving entity in background is failed")
|
||||
let entity = Entity(entityId: "1_back")
|
||||
|
||||
do {
|
||||
try self.dao.persist(entity)
|
||||
} catch _ {
|
||||
XCTFail("Saving entity in background is failed")
|
||||
}
|
||||
|
||||
exp.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Saving entity in background is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testEraseById() {
|
||||
let entity = Entity(entityId: "3")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Erase is failed")
|
||||
XCTAssertNoThrow(try dao.erase("3"), "Erase is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
try dao.erase("3")
|
||||
} catch _ {
|
||||
XCTFail("Erase is failed")
|
||||
}
|
||||
|
||||
XCTAssert(true)
|
||||
}
|
||||
|
||||
|
||||
func testAsyncEraseById() {
|
||||
let entity = Entity(entityId: "2_back")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Async erase by id is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch _ {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
|
||||
|
||||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertNotNil(try? self.dao.erase("2_back"), "Async erase by id is failed")
|
||||
do {
|
||||
try self.dao.erase("2_back")
|
||||
} catch _ {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
|
||||
exp.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,37 +14,30 @@ import CoreData
|
|||
|
||||
final class CoreDataDAOFoldersTests: XCTestCase {
|
||||
|
||||
private var dao: CoreDataDAO<Folder, CDFolder>!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let translator = CDFolderTranslator()
|
||||
let configuration = CoreDataConfiguration(
|
||||
let dao = try! CoreDataDAO(
|
||||
CDFolderTranslator(),
|
||||
configuration: CoreDataConfiguration(
|
||||
containerName: "Model",
|
||||
storeType: NSInMemoryStoreType
|
||||
)
|
||||
|
||||
dao = try! CoreDataDAO(
|
||||
translator,
|
||||
configuration: configuration
|
||||
)
|
||||
}
|
||||
storeType: NSInMemoryStoreType))
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
func testPersistMessages() {
|
||||
let message1 = Message(entityId: "abc", text: "text1")
|
||||
let message2 = Message(entityId: "bcc", text: "text2")
|
||||
|
||||
let folder = Folder(entityId: "fld", name: "Home", messages: [message1, message2])
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(folder), "Persist folder is failed")
|
||||
XCTAssertEqual(dao.read(folder.entityId)?.messages.count, folder.messages.count)
|
||||
do {
|
||||
try dao.persist(folder)
|
||||
} catch _ {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
if let savedFolder = dao.read(folder.entityId) {
|
||||
XCTAssertEqual(folder.messages.count, savedFolder.messages.count)
|
||||
} else {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,46 +14,30 @@ import CoreData
|
|||
|
||||
final class CoreDataDAOManyDAOTests: XCTestCase {
|
||||
|
||||
private var messagesDAO: CoreDataDAO<Message, CDMessage>!
|
||||
private var folderDAO: CoreDataDAO<Folder, CDFolder>!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let configuration = CoreDataConfiguration(
|
||||
let messagesDAO = try! CoreDataDAO(
|
||||
CDMessageTranslator(),
|
||||
configuration: CoreDataConfiguration(
|
||||
containerName: "Model",
|
||||
storeType: NSInMemoryStoreType
|
||||
)
|
||||
|
||||
let messageTranslator = CDMessageTranslator()
|
||||
messagesDAO = try! CoreDataDAO(
|
||||
messageTranslator,
|
||||
configuration: configuration
|
||||
)
|
||||
|
||||
let folderTranslator = CDFolderTranslator()
|
||||
folderDAO = try! CoreDataDAO(
|
||||
folderTranslator,
|
||||
configuration: configuration
|
||||
)
|
||||
}
|
||||
storeType: NSInMemoryStoreType))
|
||||
|
||||
let folderDAO = try! CoreDataDAO(
|
||||
CDFolderTranslator(),
|
||||
configuration: CoreDataConfiguration(
|
||||
containerName: "Model",
|
||||
storeType: NSInMemoryStoreType))
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! messagesDAO.erase()
|
||||
try! folderDAO.erase()
|
||||
|
||||
messagesDAO = nil
|
||||
folderDAO = nil
|
||||
}
|
||||
|
||||
func testPersistMessage() {
|
||||
let message = Message(entityId: "abc", text: "text")
|
||||
let folder = Folder(entityId: "fld", name: "folder", messages: [])
|
||||
|
||||
XCTAssertNoThrow(try messagesDAO.persist(message), "Persist message is failed")
|
||||
XCTAssertNoThrow(try folderDAO.persist(folder), "Persist message is failed")
|
||||
do {
|
||||
try messagesDAO.persist(message)
|
||||
try folderDAO.persist(folder)
|
||||
} catch _ {
|
||||
XCTFail("Persist message is failed")
|
||||
}
|
||||
|
||||
XCTAssertEqual(message, messagesDAO.read(message.entityId))
|
||||
XCTAssertEqual(folder, folderDAO.read(folder.entityId))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,50 +14,52 @@ import CoreData
|
|||
|
||||
final class CoreDataDAOMessagesTests: XCTestCase {
|
||||
|
||||
private var dao: CoreDataDAO<Message, CDMessage>!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let translator = CDMessageTranslator()
|
||||
let configuration = CoreDataConfiguration(
|
||||
let dao = try! CoreDataDAO(
|
||||
CDMessageTranslator(),
|
||||
configuration: CoreDataConfiguration(
|
||||
containerName: "Model",
|
||||
storeType: NSInMemoryStoreType
|
||||
)
|
||||
|
||||
dao = try! CoreDataDAO(
|
||||
translator,
|
||||
configuration: configuration
|
||||
)
|
||||
}
|
||||
storeType: NSInMemoryStoreType))
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
func testPersistMessage() {
|
||||
let message = Message(entityId: "abc", text: "text")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Persist message is failed")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
} catch _ {
|
||||
XCTFail("Persist message is failed")
|
||||
}
|
||||
|
||||
XCTAssertEqual(message, dao.read(message.entityId))
|
||||
}
|
||||
|
||||
|
||||
func testReadMessage() {
|
||||
let message = Message(entityId: "def", text: "text 2")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Read message is failed")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
} catch _ {
|
||||
XCTFail("Read message is failed")
|
||||
}
|
||||
|
||||
XCTAssertEqual(message, dao.read("def"))
|
||||
}
|
||||
|
||||
|
||||
func testEraseMessage() {
|
||||
let message = Message(entityId: "ghi", text: "text 2")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Erase message is failed")
|
||||
XCTAssertNoThrow(try dao.erase("ghi"), "Erase message is failed")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
try dao.erase("ghi")
|
||||
} catch _ {
|
||||
XCTFail("Erase message is failed")
|
||||
}
|
||||
|
||||
XCTAssertNil(dao.read("ghi"))
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
02160229232A36ED0036116E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 02160228232A36ED0036116E /* Assets.xcassets */; };
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
|
||||
63EBBC5B24D75059B9ADA532 /* Pods_RealmDAOTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0DCA2A834AEC013372828BE4 /* Pods_RealmDAOTests.framework */; };
|
||||
78A211B7C1B6D6AF282EBB71 /* Pods_DAO_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A944DFD46BDAF9137BA01D6 /* Pods_DAO_Example.framework */; };
|
||||
|
|
@ -40,6 +39,9 @@
|
|||
AA3525971EEFDD13009C4375 /* CoreDataDAOFoldersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3525931EEFDD13009C4375 /* CoreDataDAOFoldersTests.swift */; };
|
||||
AA3525981EEFDD13009C4375 /* CoreDataDAOManyDAOTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3525941EEFDD13009C4375 /* CoreDataDAOManyDAOTests.swift */; };
|
||||
AA3525991EEFDD13009C4375 /* CoreDataDAOMessagesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3525951EEFDD13009C4375 /* CoreDataDAOMessagesTests.swift */; };
|
||||
AAE52ABC1F56E0DC00D2FE3D /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE52ABB1F56E0DC00D2FE3D /* User.swift */; };
|
||||
AAE52ABE1F56E18C00D2FE3D /* DBUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE52ABD1F56E18C00D2FE3D /* DBUser.swift */; };
|
||||
AAE52AC01F56E26B00D2FE3D /* RLMUserTranslator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE52ABF1F56E26B00D2FE3D /* RLMUserTranslator.swift */; };
|
||||
E6862F802F1820084726DEB8 /* Pods_CoreDataDAOTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F42144986137E1707B5FAC0 /* Pods_CoreDataDAOTests.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
|
|
@ -61,7 +63,6 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
02160228232A36ED0036116E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
048D2FC052C450E7600E2FA9 /* Pods-RealmDAOTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDAOTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDAOTests/Pods-RealmDAOTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
0DCA2A834AEC013372828BE4 /* Pods_RealmDAOTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmDAOTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1DD31E834DFA3BE6198A94A4 /* Pods-CoreDataDAOTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataDAOTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataDAOTests/Pods-CoreDataDAOTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
|
|
@ -72,7 +73,7 @@
|
|||
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
6B14B1EA7DC79FC4DC1DE526 /* Pods-DAO_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DAO_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-DAO_Example/Pods-DAO_Example.release.xcconfig"; sourceTree = "<group>"; };
|
||||
6F42144986137E1707B5FAC0 /* Pods_CoreDataDAOTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CoreDataDAOTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7AA81098C68FE90BF55455CC /* DAO.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = DAO.podspec; path = ../DAO.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
|
||||
7AA81098C68FE90BF55455CC /* DAO.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = DAO.podspec; path = ../DAO.podspec; sourceTree = "<group>"; };
|
||||
8FB85F7F7AE5E16EDA09AF5A /* Pods-RealmDAOTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmDAOTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RealmDAOTests/Pods-RealmDAOTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9096125064B44D5035341130 /* Pods-DAO_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DAO_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DAO_Example/Pods-DAO_Example.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
A0C0C1D67BC9E557747CBD93 /* Pods-DAO_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DAO_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DAO_Tests/Pods-DAO_Tests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
|
|
@ -111,6 +112,9 @@
|
|||
AA3525931EEFDD13009C4375 /* CoreDataDAOFoldersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDAOFoldersTests.swift; sourceTree = "<group>"; };
|
||||
AA3525941EEFDD13009C4375 /* CoreDataDAOManyDAOTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDAOManyDAOTests.swift; sourceTree = "<group>"; };
|
||||
AA3525951EEFDD13009C4375 /* CoreDataDAOMessagesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataDAOMessagesTests.swift; sourceTree = "<group>"; };
|
||||
AAE52ABB1F56E0DC00D2FE3D /* User.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
|
||||
AAE52ABD1F56E18C00D2FE3D /* DBUser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DBUser.swift; sourceTree = "<group>"; };
|
||||
AAE52ABF1F56E26B00D2FE3D /* RLMUserTranslator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RLMUserTranslator.swift; sourceTree = "<group>"; };
|
||||
B3F6075B730F33239A8C0C16 /* Pods-DAO_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DAO_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DAO_Tests/Pods-DAO_Tests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
B83929C10B53857ABAEBA293 /* Pods-CoreDataDAOTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataDAOTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataDAOTests/Pods-CoreDataDAOTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
BF445E2FB5382CAF4125954E /* Pods_DAO_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DAO_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -262,6 +266,7 @@
|
|||
AA3525581EEFDBE2009C4375 /* RLMEntityTranslator.swift */,
|
||||
AA3525591EEFDBE2009C4375 /* RLMFolderTranslator.swift */,
|
||||
AA35255A1EEFDBE2009C4375 /* RLMMessageTranslator.swift */,
|
||||
AAE52ABF1F56E26B00D2FE3D /* RLMUserTranslator.swift */,
|
||||
);
|
||||
path = RealmTranslator;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -274,6 +279,7 @@
|
|||
AA3525641EEFDBE2009C4375 /* Folder.swift */,
|
||||
AA3525651EEFDBE2009C4375 /* Message.swift */,
|
||||
AA3525661EEFDBE2009C4375 /* RealmDatabase */,
|
||||
AAE52ABB1F56E0DC00D2FE3D /* User.swift */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -298,6 +304,7 @@
|
|||
AA3525681EEFDBE2009C4375 /* DBEntity.swift */,
|
||||
AA3525691EEFDBE2009C4375 /* DBFolder.swift */,
|
||||
AA35256A1EEFDBE2009C4375 /* DBMessage.swift */,
|
||||
AAE52ABD1F56E18C00D2FE3D /* DBUser.swift */,
|
||||
);
|
||||
path = RealmDatabase;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -306,7 +313,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
AA3525801EEFDC24009C4375 /* Model.xcdatamodeld */,
|
||||
02160228232A36ED0036116E /* Assets.xcassets */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -362,6 +368,7 @@
|
|||
607FACCD1AFB9204008FA782 /* Frameworks */,
|
||||
607FACCE1AFB9204008FA782 /* Resources */,
|
||||
A3C342A12354181FB1CDC888 /* [CP] Embed Pods Frameworks */,
|
||||
FBB72B6CB6EF1FFF9E33FE93 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
|
@ -380,6 +387,8 @@
|
|||
AA10ECA61EEFE039001228A1 /* Sources */,
|
||||
AA10ECA71EEFE039001228A1 /* Frameworks */,
|
||||
AA10ECA81EEFE039001228A1 /* Resources */,
|
||||
C31918995F93713C33A15BCA /* [CP] Embed Pods Frameworks */,
|
||||
525D7AFD3BD0F596CBD437B0 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
|
@ -399,6 +408,8 @@
|
|||
AA3525831EEFDCE6009C4375 /* Sources */,
|
||||
AA3525841EEFDCE6009C4375 /* Frameworks */,
|
||||
AA3525851EEFDCE6009C4375 /* Resources */,
|
||||
6E99BAE18868857CA3143787 /* [CP] Embed Pods Frameworks */,
|
||||
E809FAD87FAC0879AF2B934A /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
|
@ -417,24 +428,24 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 1030;
|
||||
LastUpgradeCheck = 0820;
|
||||
ORGANIZATIONNAME = CocoaPods;
|
||||
TargetAttributes = {
|
||||
607FACCF1AFB9204008FA782 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
LastSwiftMigration = 1030;
|
||||
LastSwiftMigration = 0820;
|
||||
};
|
||||
AA10ECA91EEFE039001228A1 = {
|
||||
CreatedOnToolsVersion = 8.3.2;
|
||||
DevelopmentTeam = 42LRQS6X44;
|
||||
LastSwiftMigration = 1030;
|
||||
LastSwiftMigration = 0830;
|
||||
ProvisioningStyle = Automatic;
|
||||
TestTargetID = 607FACCF1AFB9204008FA782;
|
||||
};
|
||||
AA3525861EEFDCE6009C4375 = {
|
||||
CreatedOnToolsVersion = 8.3.2;
|
||||
DevelopmentTeam = 42LRQS6X44;
|
||||
LastSwiftMigration = 1030;
|
||||
LastSwiftMigration = 0830;
|
||||
ProvisioningStyle = Automatic;
|
||||
TestTargetID = 607FACCF1AFB9204008FA782;
|
||||
};
|
||||
|
|
@ -442,7 +453,7 @@
|
|||
};
|
||||
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "DAO" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = en;
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
|
|
@ -465,7 +476,6 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
02160229232A36ED0036116E /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -492,16 +502,43 @@
|
|||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-DAO_Example-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
525D7AFD3BD0F596CBD437B0 /* [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-RealmDAOTests/Pods-RealmDAOTests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
6E99BAE18868857CA3143787 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreDataDAOTests/Pods-CoreDataDAOTests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
847A3AC11FE1C324C80B4DFC /* [CP] Check Pods Manifest.lock */ = {
|
||||
|
|
@ -510,16 +547,13 @@
|
|||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RealmDAOTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
A3C342A12354181FB1CDC888 /* [CP] Embed Pods Frameworks */ = {
|
||||
|
|
@ -528,20 +562,43 @@
|
|||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-DAO_Example/Pods-DAO_Example-frameworks.sh",
|
||||
"${BUILT_PRODUCTS_DIR}/DAO/DAO.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Realm/Realm.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DAO.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DAO_Example/Pods-DAO_Example-frameworks.sh\"\n";
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DAO_Example/Pods-DAO_Example-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
C31918995F93713C33A15BCA /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmDAOTests/Pods-RealmDAOTests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E809FAD87FAC0879AF2B934A /* [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-CoreDataDAOTests/Pods-CoreDataDAOTests-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
EC8476E3A4C369B6B36446A1 /* [CP] Check Pods Manifest.lock */ = {
|
||||
|
|
@ -550,16 +607,28 @@
|
|||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-CoreDataDAOTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
FBB72B6CB6EF1FFF9E33FE93 /* [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-DAO_Example/Pods-DAO_Example-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
|
@ -581,6 +650,8 @@
|
|||
AA3525821EEFDC24009C4375 /* Model.xcdatamodeld in Sources */,
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
|
||||
AA35257B1EEFDBE2009C4375 /* DBBook.swift in Sources */,
|
||||
AAE52ABE1F56E18C00D2FE3D /* DBUser.swift in Sources */,
|
||||
AAE52AC01F56E26B00D2FE3D /* RLMUserTranslator.swift in Sources */,
|
||||
AA3525701EEFDBE2009C4375 /* RLMFolderTranslator.swift in Sources */,
|
||||
AA35257E1EEFDBE2009C4375 /* DBMessage.swift in Sources */,
|
||||
AA35256F1EEFDBE2009C4375 /* RLMEntityTranslator.swift in Sources */,
|
||||
|
|
@ -591,6 +662,7 @@
|
|||
AA35256B1EEFDBE2009C4375 /* CDEntityTranslator.swift in Sources */,
|
||||
AA3525751EEFDBE2009C4375 /* CDFolder+CoreDataProperties.swift in Sources */,
|
||||
AA3525711EEFDBE2009C4375 /* RLMMessageTranslator.swift in Sources */,
|
||||
AAE52ABC1F56E0DC00D2FE3D /* User.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -636,27 +708,18 @@
|
|||
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;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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_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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
|
@ -692,27 +755,18 @@
|
|||
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;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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_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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
|
|
@ -742,15 +796,13 @@
|
|||
baseConfigurationReference = 9096125064B44D5035341130 /* Pods-DAO_Example.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
INFOPLIST_FILE = DAO/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -759,15 +811,13 @@
|
|||
baseConfigurationReference = 6B14B1EA7DC79FC4DC1DE526 /* Pods-DAO_Example.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
|
||||
INFOPLIST_FILE = DAO/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
@ -783,14 +833,14 @@
|
|||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
INFOPLIST_FILE = RealmDAOTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RealmDAOTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "RealmDAOTests/RealmDAOTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DAO_Example.app/DAO_Example";
|
||||
};
|
||||
name = Debug;
|
||||
|
|
@ -806,12 +856,12 @@
|
|||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
INFOPLIST_FILE = RealmDAOTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.RealmDAOTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "RealmDAOTests/RealmDAOTests-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DAO_Example.app/DAO_Example";
|
||||
};
|
||||
name = Release;
|
||||
|
|
@ -828,14 +878,14 @@
|
|||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
INFOPLIST_FILE = CoreDataDAOTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.CoreDataDAOTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "CoreDataDAOTests/CoreDataDAOTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DAO_Example.app/DAO_Example";
|
||||
};
|
||||
name = Debug;
|
||||
|
|
@ -851,12 +901,12 @@
|
|||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
DEVELOPMENT_TEAM = 42LRQS6X44;
|
||||
INFOPLIST_FILE = CoreDataDAOTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.CoreDataDAOTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "CoreDataDAOTests/CoreDataDAOTests-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DAO_Example.app/DAO_Example";
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:DAO.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1030"
|
||||
LastUpgradeVersion = "0820"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
@ -20,6 +20,20 @@
|
|||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "DAO_Tests.xctest"
|
||||
BlueprintName = "DAO_Tests"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
|
|
@ -28,6 +42,16 @@
|
|||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "607FACE41AFB9204008FA782"
|
||||
BuildableName = "DAO_Tests.xctest"
|
||||
BlueprintName = "DAO_Tests"
|
||||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
|
|
@ -81,12 +105,6 @@
|
|||
ReferencedContainer = "container:DAO.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "-com.apple.CoreData.ConcurrencyDebug 1"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -11,7 +11,7 @@ import UIKit
|
|||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
import DAO
|
||||
import CoreData
|
||||
|
||||
class CDEntityTranslator: CoreDataTranslator<Entity, CDEntity> {
|
||||
class CDEntityTranslator: CoreDataTranslator<CDEntity, Entity> {
|
||||
|
||||
override func fill(_ entity: Entity, fromEntry: CDEntity) {
|
||||
entity.entityId = fromEntry.entryId
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import DAO
|
|||
import CoreData
|
||||
|
||||
|
||||
class CDFolderTranslator: CoreDataTranslator<Folder, CDFolder> {
|
||||
class CDFolderTranslator: CoreDataTranslator<CDFolder, Folder> {
|
||||
|
||||
required init() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import DAO
|
|||
import CoreData
|
||||
|
||||
|
||||
class CDMessageTranslator: CoreDataTranslator<Message, CDMessage> {
|
||||
class CDMessageTranslator: CoreDataTranslator<CDMessage, Message> {
|
||||
|
||||
override func fill(_ entity: Message?, fromEntry entry: CDMessage) {
|
||||
entity?.entityId = entry.entryId
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class RLMBookTranslator: RealmTranslator<Book, DBBook> {
|
|||
override func fill(_ entity: Book, fromEntry: DBBook) {
|
||||
entity.entityId = fromEntry.entryId
|
||||
entity.name = fromEntry.name
|
||||
entity.authors = fromEntry.authors.map { $0 }
|
||||
entity.dates = fromEntry.dates.map { $0 }
|
||||
entity.pages = fromEntry.pages.map { $0 }
|
||||
entity.attachments = fromEntry.attachments.map { $0 }
|
||||
entity.authors = fromEntry.authors.map { $0.value }
|
||||
entity.dates = fromEntry.dates.map { $0.value }
|
||||
entity.pages = fromEntry.pages.map { $0.value }
|
||||
entity.attachments = fromEntry.attachments.map { $0.value }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -36,10 +36,15 @@ class RLMBookTranslator: RealmTranslator<Book, DBBook> {
|
|||
entry.pages.removeAll()
|
||||
entry.attachments.removeAll()
|
||||
|
||||
entry.authors.append(objectsIn: fromEntity.authors)
|
||||
entry.dates.append(objectsIn: fromEntity.dates)
|
||||
entry.pages.append(objectsIn: fromEntity.pages)
|
||||
entry.attachments.append(objectsIn: fromEntity.attachments)
|
||||
let authors = fromEntity.authors.map { RLMString(val: $0) }
|
||||
let dates = fromEntity.dates.map { RLMDate(val: $0) }
|
||||
let pages = fromEntity.pages.map { RLMInteger(val: $0) }
|
||||
let attachments = fromEntity.attachments.map { RLMData(val: $0) }
|
||||
|
||||
entry.authors.append(objectsIn: authors)
|
||||
entry.dates.append(objectsIn: dates)
|
||||
entry.pages.append(objectsIn: pages)
|
||||
entry.attachments.append(objectsIn: attachments)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ class RLMFolderTranslator: RealmTranslator<Folder, DBFolder> {
|
|||
entity.entityId = fromEntry.entryId
|
||||
entity.name = fromEntry.name
|
||||
|
||||
if let creator = fromEntry.creator {
|
||||
entity.creator = User(entityId: creator.entryId, name: creator.name)
|
||||
}
|
||||
|
||||
RLMMessageTranslator().fill(&entity.messages, fromEntries: fromEntry.messages)
|
||||
}
|
||||
|
||||
|
|
@ -28,6 +32,16 @@ class RLMFolderTranslator: RealmTranslator<Folder, DBFolder> {
|
|||
}
|
||||
entry.name = fromEntity.name
|
||||
|
||||
if let creator = fromEntity.creator {
|
||||
if let dbCreator = entry.creator, creator.entityId == dbCreator.entryId {
|
||||
dbCreator.name = creator.name
|
||||
} else {
|
||||
entry.creator = DBUser.userWithId(creator.entityId, name: creator.name)
|
||||
}
|
||||
} else {
|
||||
entry.creator = nil
|
||||
}
|
||||
|
||||
RLMMessageTranslator().fill(entry.messages, fromEntities: fromEntity.messages)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// RLMUserTranslator.swift
|
||||
// DAO
|
||||
//
|
||||
// Created by Ivan Vavilov on 8/30/17.
|
||||
// Copyright © 2017 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import DAO
|
||||
|
||||
class RLMUserTranslator: RealmTranslator<User, DBUser> {
|
||||
|
||||
required init() {}
|
||||
|
||||
|
||||
override func fill(_ entity: User, fromEntry: DBUser) {
|
||||
entity.entityId = fromEntry.entryId
|
||||
entity.name = fromEntry.name
|
||||
}
|
||||
|
||||
|
||||
override func fill(_ entry: DBUser, fromEntity: User) {
|
||||
if entry.entryId != fromEntity.entityId {
|
||||
entry.entryId = fromEntity.entityId
|
||||
}
|
||||
|
||||
entry.name = fromEntity.name
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,11 +13,13 @@ import DAO
|
|||
class Folder: Entity {
|
||||
|
||||
var name: String = ""
|
||||
var creator: User?
|
||||
var messages = [Message]()
|
||||
|
||||
|
||||
init(entityId: String, name: String, messages: [Message]) {
|
||||
init(entityId: String, name: String, creator: User? = nil, messages: [Message]) {
|
||||
self.name = name
|
||||
self.creator = creator
|
||||
self.messages = messages
|
||||
|
||||
super.init(entityId: entityId)
|
||||
|
|
@ -28,16 +30,17 @@ class Folder: Entity {
|
|||
super.init()
|
||||
}
|
||||
|
||||
override func equals<T>(_ other: T) -> Bool where T : Entity {
|
||||
guard let other = other as? Folder else { return false }
|
||||
return super.equals(other) && name == other.name && messagesArrayEquals(other.messages)
|
||||
|
||||
override func equals<T>(_ other: T) -> Bool where T : Folder {
|
||||
return (super.equals(other)) && self.name == other.name && self.messagesArrayEquals(other.messages)
|
||||
}
|
||||
|
||||
|
||||
fileprivate func messagesArrayEquals(_ otherMessages: [Message]) -> Bool {
|
||||
if messages.count != otherMessages.count { return false }
|
||||
if (self.messages.count != otherMessages.count) { return false }
|
||||
|
||||
for message in otherMessages {
|
||||
if !messages.contains(message) { return false }
|
||||
if (!messages.contains(message)) { return false }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,19 @@ class Message: Entity {
|
|||
|
||||
var text: String?
|
||||
|
||||
init(entityId: String, text: String?) {
|
||||
init(entityId: String, text: String?)
|
||||
{
|
||||
self.text = text
|
||||
super.init(entityId: entityId)
|
||||
}
|
||||
|
||||
required init() {
|
||||
required init()
|
||||
{
|
||||
super.init()
|
||||
}
|
||||
|
||||
override func equals<T>(_ other: T) -> Bool where T: Entity {
|
||||
guard let other = other as? Message else { return false }
|
||||
override func equals<T>(_ other: T) -> Bool where T: Message
|
||||
{
|
||||
return super.equals(other) && self.text == other.text
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,16 +10,25 @@ import DAO
|
|||
import RealmSwift
|
||||
|
||||
|
||||
final class DBBook: DBEntity {
|
||||
final class DBBook: DBEntity, CascadeDeletionProtocol {
|
||||
|
||||
@objc dynamic var name: String = ""
|
||||
dynamic var name: String = ""
|
||||
|
||||
let authors = List<String>()
|
||||
let authors = List<RLMString>()
|
||||
|
||||
let dates = List<Date>()
|
||||
let dates = List<RLMDate>()
|
||||
|
||||
let pages = List<Int>()
|
||||
let pages = List<RLMInteger>()
|
||||
|
||||
let attachments = List<Data>()
|
||||
let attachments = List<RLMData>()
|
||||
|
||||
var objectsToDelete: [Object] {
|
||||
let authors = Array(self.authors) as [Object]
|
||||
let dates = Array(self.dates) as [Object]
|
||||
let pages = Array(self.pages) as [Object]
|
||||
let attachments = Array(self.attachments) as [Object]
|
||||
|
||||
return authors + dates + pages + attachments
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,16 @@ import RealmSwift
|
|||
|
||||
class DBFolder: DBEntity, CascadeDeletionProtocol {
|
||||
|
||||
@objc dynamic var name: String = ""
|
||||
dynamic var name: String = ""
|
||||
dynamic var creator: DBUser?
|
||||
var messages = List<DBMessage>()
|
||||
|
||||
|
||||
class func folderWithId(_ entryId: String, name: String, messages: List<DBMessage>) -> DBFolder {
|
||||
class func folderWithId(_ entryId: String, name: String, creator: DBUser? = nil, messages: List<DBMessage>) -> DBFolder {
|
||||
let folder = DBFolder()
|
||||
folder.entryId = entryId
|
||||
folder.name = name
|
||||
folder.creator = creator
|
||||
folder.messages.append(objectsIn: messages)
|
||||
return folder
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import DAO
|
|||
|
||||
class DBMessage: DBEntity {
|
||||
|
||||
@objc dynamic var text: String?
|
||||
dynamic var text: String?
|
||||
|
||||
class func messageWithId(_ entityId: String, text: String?) -> DBMessage {
|
||||
let message = DBMessage()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// DBUser.swift
|
||||
// DAO
|
||||
//
|
||||
// Created by Ivan Vavilov on 8/30/17.
|
||||
// Copyright © 2017 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class DBUser: DBEntity {
|
||||
|
||||
dynamic var name: String = ""
|
||||
|
||||
|
||||
class func userWithId(_ entryId: String, name: String) -> DBUser {
|
||||
let user = DBUser()
|
||||
user.entryId = entryId
|
||||
user.name = name
|
||||
return user
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// User.swift
|
||||
// DAO
|
||||
//
|
||||
// Created by Ivan Vavilov on 8/30/17.
|
||||
// Copyright © 2017 CocoaPods. All rights reserved.
|
||||
//
|
||||
|
||||
import DAO
|
||||
|
||||
class User: Entity {
|
||||
|
||||
var name: String = ""
|
||||
|
||||
init(entityId: String, name: String) {
|
||||
self.name = name
|
||||
|
||||
super.init(entityId: entityId)
|
||||
}
|
||||
|
||||
|
||||
required init() {
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
override func equals<T>(_ other: T) -> Bool where T : User {
|
||||
return super.equals(other) && self.name == other.name
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,10 +6,6 @@
|
|||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict/>
|
||||
<key>CFBundleIcons~ipad</key>
|
||||
<dict/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
|
|
@ -19,7 +15,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<string>1.0.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "12.0",
|
||||
"subtype" : "2688h",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "12.0",
|
||||
"subtype" : "1792h",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "11.0",
|
||||
"subtype" : "2436h",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "8.0",
|
||||
"subtype" : "736h",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"extent" : "full-screen",
|
||||
"minimum-system-version" : "8.0",
|
||||
"subtype" : "667h",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,28 @@
|
|||
PODS:
|
||||
- DAO (1.6.0):
|
||||
- DAO/CoreData (= 1.6.0)
|
||||
- DAO/Realm (= 1.6.0)
|
||||
- DAO/CoreData (1.6.0)
|
||||
- DAO/Realm (1.6.0):
|
||||
- RealmSwift (~> 10.1)
|
||||
- Realm (10.1.4):
|
||||
- Realm/Headers (= 10.1.4)
|
||||
- Realm/Headers (10.1.4)
|
||||
- RealmSwift (10.1.4):
|
||||
- Realm (= 10.1.4)
|
||||
- DAO (1.0.3):
|
||||
- DAO/CoreData (= 1.0.3)
|
||||
- DAO/Realm (= 1.0.3)
|
||||
- DAO/CoreData (1.0.3)
|
||||
- DAO/Realm (1.0.3):
|
||||
- RealmSwift
|
||||
- Realm (2.9.1):
|
||||
- Realm/Headers (= 2.9.1)
|
||||
- Realm/Headers (2.9.1)
|
||||
- RealmSwift (2.9.1):
|
||||
- Realm (= 2.9.1)
|
||||
|
||||
DEPENDENCIES:
|
||||
- DAO (from `../`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Realm
|
||||
- RealmSwift
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
DAO:
|
||||
:path: "../"
|
||||
:path: ../
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
DAO: de381bf3ef4af1592f5e9cbb5e157d3bb02b4e73
|
||||
Realm: 80f4fb2971ccb9adc27a47d0955ae8e533a7030b
|
||||
RealmSwift: 0e566ca714edb377bba8ea0811eafcea0b93734e
|
||||
DAO: 375828ee8ea8d0479a2e094229ff9a353b7a8344
|
||||
Realm: f91fb43bd474c4f731a116ebf7392c75dd015920
|
||||
RealmSwift: 207f12a4a36b696c5183c60a1c06d70234a23e56
|
||||
|
||||
PODFILE CHECKSUM: 304d7b9f54070467c355fe795db431630f017f61
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
COCOAPODS: 1.2.1
|
||||
|
|
|
|||
|
|
@ -11,41 +11,33 @@ import DAO
|
|||
@testable import DAO_Example
|
||||
|
||||
|
||||
final class RealmDAOBookTests: XCTestCase {
|
||||
class RealmDAOBookTests: XCTestCase {
|
||||
|
||||
private var dao: RealmDAO<Book, DBBook>!
|
||||
let dao = RealmDAO(RLMBookTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
dao = RealmDAO(RLMBookTranslator())
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
func testPersist() {
|
||||
let book = Book(
|
||||
entityId: "book1",
|
||||
name: "Swift",
|
||||
authors: ["Chris Lattner"],
|
||||
dates: [Date(timeIntervalSince1970: 1000000)],
|
||||
pages: [100, 200],
|
||||
attachments: [Data()]
|
||||
)
|
||||
let book = Book(entityId: "book1", name: "Swift", authors: ["Chris Lattner"],
|
||||
dates: [Date(timeIntervalSince1970: 1000000)],
|
||||
pages: [100, 200], attachments: [Data()])
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(book), "Persist is failed")
|
||||
XCTAssertEqual(book, dao.read(book.entityId), "Persist is failed")
|
||||
XCTAssertFalse((dao.read(book.entityId)?.authors.isEmpty) == true, "Persist is failed")
|
||||
XCTAssertEqual(dao.read(book.entityId)?.authors.first, "Chris Lattner", "Persist is failed")
|
||||
XCTAssertFalse((dao.read(book.entityId)?.dates.isEmpty) == true, "Persist is failed")
|
||||
XCTAssertFalse((dao.read(book.entityId)?.pages.isEmpty) == true, "Persist is failed")
|
||||
XCTAssertEqual(dao.read(book.entityId)?.pages.count, 2, "Persist is failed")
|
||||
XCTAssertFalse((dao.read(book.entityId)?.attachments.isEmpty) == true, "Persist is failed")
|
||||
do {
|
||||
try dao.persist(book)
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
if let savedBook = dao.read(book.entityId) {
|
||||
XCTAssertEqual(book, savedBook)
|
||||
XCTAssertFalse(savedBook.authors.isEmpty)
|
||||
XCTAssertEqual(savedBook.authors.first, "Chris Lattner")
|
||||
XCTAssertFalse(savedBook.dates.isEmpty)
|
||||
XCTAssertFalse(savedBook.pages.isEmpty)
|
||||
XCTAssertEqual(savedBook.pages.count, 2)
|
||||
XCTAssertFalse(savedBook.attachments.isEmpty)
|
||||
} else {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,28 +12,23 @@ import DAO
|
|||
|
||||
|
||||
final class RealmDAOEntityTests: XCTestCase {
|
||||
|
||||
private var dao: RealmDAO<Entity, DBEntity>!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
dao = RealmDAO(RLMEntityTranslator())
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
let dao = RealmDAO(RLMEntityTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
|
||||
|
||||
func testReadById() {
|
||||
let entity = Entity(entityId: "2")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Persist is failed")
|
||||
XCTAssertEqual(entity, dao.read("2"), "Read is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
if let savedEntity = dao.read("2") {
|
||||
XCTAssertEqual(entity, savedEntity)
|
||||
} else {
|
||||
XCTFail("Read is failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -42,64 +37,120 @@ final class RealmDAOEntityTests: XCTestCase {
|
|||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertNotNil(try? self.dao.persist(entity), "Async read by id is failed")
|
||||
do {
|
||||
try self.dao.persist(entity)
|
||||
} catch {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertEqual(self.dao.read("2_back")?.entityId, entity.entityId, "Async read by id is failed")
|
||||
DispatchQueue.main.async {
|
||||
if let savedEntity = self.dao.read("2_back") {
|
||||
XCTAssertEqual(savedEntity.entityId, entity.entityId)
|
||||
} else {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
exp.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Async read by id is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testPersist() {
|
||||
let entity = Entity(entityId: "1")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch {
|
||||
XCTFail("Saving entity is failed")
|
||||
}
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Saving entity is failed")
|
||||
XCTAssert(true)
|
||||
}
|
||||
|
||||
|
||||
func testPersistAll() {
|
||||
let firstEntity = Entity(entityId: "2")
|
||||
let secondEntity = Entity(entityId: "3")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist([firstEntity, secondEntity]), "Saving entities is failed")
|
||||
do {
|
||||
try dao.persist([firstEntity, secondEntity])
|
||||
} catch {
|
||||
XCTFail("Saving entities is failed")
|
||||
}
|
||||
|
||||
XCTAssert(true)
|
||||
}
|
||||
|
||||
|
||||
func testAsyncPersist() {
|
||||
let entity = Entity(entityId: "1_back")
|
||||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertNotNil(try? self.dao.persist(entity), "Saving entity in background is failed")
|
||||
let entity = Entity(entityId: "1_back")
|
||||
do {
|
||||
try self.dao.persist(entity)
|
||||
} catch {
|
||||
XCTFail("Saving entity in background is failed")
|
||||
}
|
||||
|
||||
exp.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Saving entity in background is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testEraseById() {
|
||||
let entity = Entity(entityId: "3")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Erase is failed")
|
||||
XCTAssertNoThrow(try dao.erase("3"), "Erase is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
try dao.erase("3")
|
||||
} catch {
|
||||
XCTFail("Erase is failed")
|
||||
}
|
||||
|
||||
XCTAssertNil(dao.read("3"))
|
||||
}
|
||||
|
||||
|
||||
func testAsyncEraseById() {
|
||||
let entity = Entity(entityId: "2_back")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(entity), "Async erase by id is failed")
|
||||
do {
|
||||
try dao.persist(entity)
|
||||
} catch {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
|
||||
let exp = expectation(description: "")
|
||||
|
||||
DispatchQueue.global().async {
|
||||
XCTAssertNotNil(try? self.dao.erase("2_back"), "Async erase by id is failed")
|
||||
do {
|
||||
try self.dao.erase("2_back")
|
||||
} catch {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
|
||||
exp.fulfill()
|
||||
}
|
||||
|
||||
waitForExpectations(timeout: 5)
|
||||
waitForExpectations(timeout: 5) { error in
|
||||
if error != nil {
|
||||
XCTFail("Async erase by id is failed")
|
||||
}
|
||||
XCTAssert(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,34 +13,116 @@ import DAO
|
|||
|
||||
final class RealmDAOFolderTests: XCTestCase {
|
||||
|
||||
private var messageDAO: RealmDAO<Message, DBMessage>!
|
||||
private var folderDAO: RealmDAO<Folder, DBFolder>!
|
||||
let messageDAO = RealmDAO(RLMMessageTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
let folderDAO = RealmDAO(RLMFolderTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
let userDAO = RealmDAO(RLMUserTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
messageDAO = RealmDAO(RLMMessageTranslator())
|
||||
folderDAO = RealmDAO(RLMFolderTranslator())
|
||||
try? messageDAO.erase()
|
||||
try? folderDAO.erase()
|
||||
try? userDAO.erase()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
func testUserRelationship() {
|
||||
let user = User(entityId: "U1", name: "Vova")
|
||||
let folder = Folder(entityId: "F1", name: "Created", creator: user, messages: [])
|
||||
|
||||
try! messageDAO.erase()
|
||||
try! folderDAO.erase()
|
||||
do {
|
||||
try folderDAO.persist(folder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
let savedFolder = folderDAO.read("F1")
|
||||
|
||||
XCTAssertNotNil(savedFolder?.creator)
|
||||
}
|
||||
|
||||
func testUpdateUserInRelationship() {
|
||||
let user = User(entityId: "U1", name: "Vova")
|
||||
let folder = Folder(entityId: "F1", name: "Created", creator: user, messages: [])
|
||||
|
||||
do {
|
||||
try folderDAO.persist(folder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
let savedFolder = folderDAO.read("F1")!
|
||||
savedFolder.creator = nil
|
||||
|
||||
do {
|
||||
try folderDAO.persist(savedFolder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
if let savedFolder = folderDAO.read("F1") {
|
||||
XCTAssertNil(savedFolder.creator)
|
||||
} else {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
let user2 = User(entityId: "U2", name: "Vova")
|
||||
|
||||
savedFolder.creator = user2
|
||||
|
||||
do {
|
||||
try folderDAO.persist(savedFolder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
if let savedFolder = folderDAO.read("F1") {
|
||||
XCTAssertEqual(savedFolder.creator?.entityId, "U2")
|
||||
} else {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
do {
|
||||
try userDAO.erase()
|
||||
} catch {
|
||||
XCTFail("Erase user is failed")
|
||||
}
|
||||
|
||||
savedFolder.creator = user
|
||||
|
||||
do {
|
||||
try folderDAO.persist(savedFolder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
if let savedFolder = folderDAO.read("F1") {
|
||||
XCTAssertEqual(savedFolder.creator?.entityId, "U1")
|
||||
} else {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
messageDAO = nil
|
||||
folderDAO = nil
|
||||
}
|
||||
|
||||
func testCascadeErase() {
|
||||
let message = Message(entityId: "V.message", text: "V.message.text")
|
||||
let folder = Folder(entityId: "V", name: "Delete", messages: [message])
|
||||
|
||||
XCTAssertNoThrow(try folderDAO.persist(folder), "Persist folder is failed")
|
||||
XCTAssertNotNil(messageDAO.read("V.message"))
|
||||
XCTAssertNoThrow(try folderDAO.erase("V"), "Erase folder is failed")
|
||||
do {
|
||||
try folderDAO.persist(folder)
|
||||
} catch {
|
||||
XCTFail("Persist folder is failed")
|
||||
}
|
||||
|
||||
let savedMessage = messageDAO.read("V.message")
|
||||
|
||||
XCTAssertNotNil(savedMessage)
|
||||
|
||||
do {
|
||||
try folderDAO.erase("V")
|
||||
} catch {
|
||||
XCTFail("Erase folder is failed")
|
||||
}
|
||||
|
||||
XCTAssertNil(messageDAO.read("V.message"))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,40 +13,48 @@ import DAO
|
|||
|
||||
final class RealmDAOMessagesTests: XCTestCase {
|
||||
|
||||
private var dao: RealmDAO<Message, DBMessage>!
|
||||
let dao = RealmDAO(RLMMessageTranslator(), configuration: RealmConfiguration(databaseVersion: 2))
|
||||
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
dao = RealmDAO(RLMMessageTranslator())
|
||||
try? dao.erase()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
|
||||
try! dao.erase()
|
||||
dao = nil
|
||||
}
|
||||
|
||||
func testPersistMessage() {
|
||||
let message = Message(entityId: "abc", text: "text")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Persist is failed")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
XCTAssertEqual(message, dao.read(message.entityId))
|
||||
}
|
||||
|
||||
|
||||
func testReadMessage() {
|
||||
let message = Message(entityId: "def", text: "text 2")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Persist is failed")
|
||||
XCTAssertEqual(message, dao.read("def"))
|
||||
}
|
||||
|
||||
|
||||
func testEraseMessage() {
|
||||
let message = Message(entityId: "ghi", text: "text 2")
|
||||
do {
|
||||
try dao.persist(message)
|
||||
try dao.erase("ghi")
|
||||
} catch {
|
||||
XCTFail("Persist or erase is failed")
|
||||
}
|
||||
|
||||
XCTAssertNoThrow(try dao.persist(message), "Persist or erase is failed")
|
||||
XCTAssertNoThrow(try dao.erase("ghi"), "Persist or erase is failed")
|
||||
XCTAssertNil(dao.read("ghi"))
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +65,13 @@ final class RealmDAOMessagesTests: XCTestCase {
|
|||
let message2 = Message(entityId: "2", text: "2")
|
||||
let message3 = Message(entityId: "3", text: "3")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist([message1, message2, message3]), "Persist is failed")
|
||||
let threeMessages = dao.read(orderedBy: "entryId", ascending: true)
|
||||
do {
|
||||
try dao.persist([message1, message2, message3])
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
let threeMessages = dao.read()
|
||||
|
||||
XCTAssertEqual(threeMessages.count, 3)
|
||||
XCTAssertEqual(threeMessages[0].entityId, "1")
|
||||
|
|
@ -68,9 +81,13 @@ final class RealmDAOMessagesTests: XCTestCase {
|
|||
let message55 = Message(entityId: "55", text: "55")
|
||||
let message66 = Message(entityId: "66", text: "66")
|
||||
|
||||
XCTAssertNoThrow(try dao.persist([message1, message2, message3, message55, message66]), "Persist is failed")
|
||||
do {
|
||||
try dao.persist([message1, message2, message3, message55, message66])
|
||||
} catch {
|
||||
XCTFail("Persist is failed")
|
||||
}
|
||||
|
||||
let fiveMessages = dao.read(orderedBy: "entryId", ascending: true)
|
||||
let fiveMessages = dao.read()
|
||||
|
||||
XCTAssertEqual(fiveMessages.count, 5)
|
||||
XCTAssertEqual(fiveMessages[0].entityId, "1")
|
||||
|
|
|
|||
14
Podfile
14
Podfile
|
|
@ -1,14 +0,0 @@
|
|||
source "https://cdn.cocoapods.org/"
|
||||
|
||||
platform :ios, '9.0'
|
||||
inhibit_all_warnings!
|
||||
use_frameworks!
|
||||
|
||||
target 'CoreDataDAO' do
|
||||
# nothing
|
||||
end
|
||||
|
||||
target 'RealmDAO' do
|
||||
pod "Realm"
|
||||
pod "RealmSwift"
|
||||
end
|
||||
23
Podfile.lock
23
Podfile.lock
|
|
@ -1,23 +0,0 @@
|
|||
PODS:
|
||||
- Realm (10.1.4):
|
||||
- Realm/Headers (= 10.1.4)
|
||||
- Realm/Headers (10.1.4)
|
||||
- RealmSwift (10.1.4):
|
||||
- Realm (= 10.1.4)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Realm
|
||||
- RealmSwift
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Realm
|
||||
- RealmSwift
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Realm: 80f4fb2971ccb9adc27a47d0955ae8e533a7030b
|
||||
RealmSwift: 0e566ca714edb377bba8ea0811eafcea0b93734e
|
||||
|
||||
PODFILE CHECKSUM: e04c82ad38fec22650d3fead6f618fe0e4c5a783
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
58
README.md
58
README.md
|
|
@ -1,6 +1,6 @@
|
|||
[](https://img.shields.io/github/issues/RedMadRobot/DAO.svg)
|
||||
[](https://img.shields.io/badge/pod-1.6.0-blue.svg)
|
||||
[](https://img.shields.io/badge/swift-5.3-red.svg)
|
||||
[](https://img.shields.io/badge/pod-1.0.1-blue.svg)
|
||||
[](https://img.shields.io/badge/swift-3.0-red.svg)
|
||||
[](https://img.shields.io/badge/license-MIT-blue.svg)
|
||||
|
||||
|
||||
|
|
@ -32,54 +32,6 @@ Or with Realm:
|
|||
pod 'DAO/Realm'
|
||||
```
|
||||
|
||||
Carthage
|
||||
|
||||
Make the following entry in your Cartfile:
|
||||
|
||||
```
|
||||
github "RedMadRobot/DAO"
|
||||
```
|
||||
|
||||
Then run `carthage update`.
|
||||
|
||||
At last, you need to set up your Xcode project manually to add the framework:
|
||||
|
||||
1. On “General” settings tab of your target, in the “Linked Frameworks and Libraries” section add each framework you want to use from Carthage/Build folder.
|
||||
|
||||
2. On “Build Phases” settings tab of your target, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:
|
||||
|
||||
```
|
||||
/usr/local/bin/carthage copy-frameworks
|
||||
```
|
||||
|
||||
3. Add the paths to the frameworks you want to use under “Input Files”:
|
||||
|
||||
3.1. For using with CoreData:
|
||||
|
||||
```
|
||||
$(SRCROOT)/Carthage/Build/iOS/CoreDataDAO.framework
|
||||
```
|
||||
|
||||
3.2. Or with Realm:
|
||||
|
||||
```
|
||||
$(SRCROOT)/Carthage/Build/iOS/RealmDAO.framework
|
||||
```
|
||||
|
||||
4. Add the paths to the copied frameworks to the “Output Files”:
|
||||
|
||||
4.1. For using with CoreData:
|
||||
|
||||
```
|
||||
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/CoreDataDAO.framework
|
||||
```
|
||||
|
||||
4.2. Or with Realm
|
||||
|
||||
```
|
||||
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/RealmDAO.framework
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```swift
|
||||
|
|
@ -106,13 +58,13 @@ Please look at the example project for more information.
|
|||
## When not recommended to use
|
||||
|
||||
- If you have big and complex database schema. Many entities, many relationships.
|
||||
- If you want to use specific features of database. Realm Mobile Platform, for instance is not compatible with DAO implementation.
|
||||
- If you want to use many features of database. Realm Mobile Platform, for instance is not compatible with this implementation.
|
||||
- If you have thousands of objects (> 10-20K). Performance can be the issue.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Xcode 11
|
||||
- Swift 5
|
||||
- Xcode 8
|
||||
- Swift 3
|
||||
- iOS 9
|
||||
|
||||
## Authors
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Example/Pods/Pods.xcodeproj
|
||||
Loading…
Reference in New Issue