Skip to content
This repository was archived by the owner on Feb 28, 2020. It is now read-only.

Commit 59df2b0

Browse files
committed
Merge branch 'release/5.1'
2 parents bcc1cec + 8ebc28b commit 59df2b0

File tree

17 files changed

+124
-84
lines changed

17 files changed

+124
-84
lines changed

AlecrimCoreData.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "AlecrimCoreData"
4-
s.version = "5.0"
4+
s.version = "5.1"
55
s.summary = "A powerful and simple Core Data wrapper framework written in Swift."
66
s.homepage = "https://github.com/Alecrim/AlecrimCoreData"
77

Examples/ACD Alarm (iOS)/ACD Alarm.xcodeproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
isa = PBXProject;
161161
attributes = {
162162
LastSwiftUpdateCheck = 0800;
163-
LastUpgradeCheck = 0820;
163+
LastUpgradeCheck = 0920;
164164
ORGANIZATIONNAME = Alecrim;
165165
TargetAttributes = {
166166
14B2B1D81D5D285A0073C1C2 = {
@@ -253,15 +253,21 @@
253253
CLANG_CXX_LIBRARY = "libc++";
254254
CLANG_ENABLE_MODULES = YES;
255255
CLANG_ENABLE_OBJC_ARC = YES;
256+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
256257
CLANG_WARN_BOOL_CONVERSION = YES;
258+
CLANG_WARN_COMMA = YES;
257259
CLANG_WARN_CONSTANT_CONVERSION = YES;
258260
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
259261
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
260262
CLANG_WARN_EMPTY_BODY = YES;
261263
CLANG_WARN_ENUM_CONVERSION = YES;
262264
CLANG_WARN_INFINITE_RECURSION = YES;
263265
CLANG_WARN_INT_CONVERSION = YES;
266+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
267+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
264268
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
269+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
270+
CLANG_WARN_STRICT_PROTOTYPES = YES;
265271
CLANG_WARN_SUSPICIOUS_MOVE = YES;
266272
CLANG_WARN_SUSPICIOUS_MOVES = YES;
267273
CLANG_WARN_UNREACHABLE_CODE = YES;
@@ -304,15 +310,21 @@
304310
CLANG_CXX_LIBRARY = "libc++";
305311
CLANG_ENABLE_MODULES = YES;
306312
CLANG_ENABLE_OBJC_ARC = YES;
313+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
307314
CLANG_WARN_BOOL_CONVERSION = YES;
315+
CLANG_WARN_COMMA = YES;
308316
CLANG_WARN_CONSTANT_CONVERSION = YES;
309317
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
310318
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
311319
CLANG_WARN_EMPTY_BODY = YES;
312320
CLANG_WARN_ENUM_CONVERSION = YES;
313321
CLANG_WARN_INFINITE_RECURSION = YES;
314322
CLANG_WARN_INT_CONVERSION = YES;
323+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
324+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
315325
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
326+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
327+
CLANG_WARN_STRICT_PROTOTYPES = YES;
316328
CLANG_WARN_SUSPICIOUS_MOVE = YES;
317329
CLANG_WARN_SUSPICIOUS_MOVES = YES;
318330
CLANG_WARN_UNREACHABLE_CODE = YES;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![AlecrimCoreData](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/master/AlecrimCoreData.png)
22

3-
[![Language: Swift](https://img.shields.io/badge/lang-Swift 3-orange.svg?style=flat)](https://developer.apple.com/swift/)
3+
[![Language: Swift](https://img.shields.io/badge/Swift-3.2-orange.svg?style=flat)](https://developer.apple.com/swift/)
44
[![Platform](https://img.shields.io/cocoapods/p/AlecrimCoreData.svg?style=flat)](http://cocoadocs.org/docsets/AlecrimCoreData)
55
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/develop/LICENSE)
66
[![CocoaPods](https://img.shields.io/cocoapods/v/AlecrimCoreData.svg?style=flat)](http://cocoapods.org)

Source/AlecrimCoreData.xcodeproj/project.pbxproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
isa = PBXProject;
239239
attributes = {
240240
LastSwiftUpdateCheck = 0700;
241-
LastUpgradeCheck = 0810;
241+
LastUpgradeCheck = 0920;
242242
ORGANIZATIONNAME = Alecrim;
243243
TargetAttributes = {
244244
1447ADCB1B52B2F000ADEAED = {
@@ -318,14 +318,20 @@
318318
CLANG_CXX_LIBRARY = "libc++";
319319
CLANG_ENABLE_MODULES = YES;
320320
CLANG_ENABLE_OBJC_ARC = YES;
321+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
321322
CLANG_WARN_BOOL_CONVERSION = YES;
323+
CLANG_WARN_COMMA = YES;
322324
CLANG_WARN_CONSTANT_CONVERSION = YES;
323325
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
324326
CLANG_WARN_EMPTY_BODY = YES;
325327
CLANG_WARN_ENUM_CONVERSION = YES;
326328
CLANG_WARN_INFINITE_RECURSION = YES;
327329
CLANG_WARN_INT_CONVERSION = YES;
330+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
331+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
328332
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
334+
CLANG_WARN_STRICT_PROTOTYPES = YES;
329335
CLANG_WARN_SUSPICIOUS_MOVE = YES;
330336
CLANG_WARN_UNREACHABLE_CODE = YES;
331337
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -357,6 +363,7 @@
357363
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator";
358364
SWIFT_INSTALL_OBJC_HEADER = NO;
359365
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
366+
SWIFT_VERSION = 3.0;
360367
TVOS_DEPLOYMENT_TARGET = 9.0;
361368
VALID_ARCHS = "x86_64 arm64 armv7 armv7s armv7k";
362369
VERSIONING_SYSTEM = "apple-generic";
@@ -373,14 +380,20 @@
373380
CLANG_CXX_LIBRARY = "libc++";
374381
CLANG_ENABLE_MODULES = YES;
375382
CLANG_ENABLE_OBJC_ARC = YES;
383+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
376384
CLANG_WARN_BOOL_CONVERSION = YES;
385+
CLANG_WARN_COMMA = YES;
377386
CLANG_WARN_CONSTANT_CONVERSION = YES;
378387
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
379388
CLANG_WARN_EMPTY_BODY = YES;
380389
CLANG_WARN_ENUM_CONVERSION = YES;
381390
CLANG_WARN_INFINITE_RECURSION = YES;
382391
CLANG_WARN_INT_CONVERSION = YES;
392+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
393+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
383394
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
395+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
396+
CLANG_WARN_STRICT_PROTOTYPES = YES;
384397
CLANG_WARN_SUSPICIOUS_MOVE = YES;
385398
CLANG_WARN_UNREACHABLE_CODE = YES;
386399
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;

Source/AlecrimCoreData.xcodeproj/xcshareddata/xcschemes/AlecrimCoreData.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0820"
3+
LastUpgradeVersion = "0920"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -36,6 +37,7 @@
3637
buildConfiguration = "Debug"
3738
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3839
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
3941
launchStyle = "0"
4042
useCustomWorkingDirectory = "NO"
4143
ignoresPersistentStateOnLaunch = "NO"

Source/AlecrimCoreData/Core/Classes/CustomPersistentContainer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ internal class CustomPersistentContainer: NSObject, UnderlyingPersistentContaine
9696

9797
// MARK: -
9898

99-
internal required init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type) {
99+
internal required init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type, directoryURL: URL) {
100100
self.contextType = contextType
101101

102102
self.name = name
@@ -105,7 +105,7 @@ internal class CustomPersistentContainer: NSObject, UnderlyingPersistentContaine
105105
self.viewContext = self.contextType.init(concurrencyType: .mainQueueConcurrencyType)
106106
self.viewContext.persistentStoreCoordinator = self.persistentStoreCoordinator
107107

108-
self.alc_persistentStoreDescriptions = [CustomPersistentStoreDescription(url: type(of: self).defaultDirectoryURL().appendingPathComponent("\(name).sqlite"))]
108+
self.alc_persistentStoreDescriptions = [CustomPersistentStoreDescription(url: directoryURL.appendingPathComponent("\(name).sqlite"))]
109109
}
110110

111111
// MARK: -

Source/AlecrimCoreData/Core/Classes/NativePersistentContainer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ internal class NativePersistentContainer: NSPersistentContainer, UnderlyingPersi
2020

2121
internal override var viewContext: NSManagedObjectContext { return self._viewContext }
2222

23-
internal required init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type) {
23+
internal required init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type, directoryURL: URL) {
2424
self.contextType = contextType
2525
self._viewContext = self.contextType.init(concurrencyType: .mainQueueConcurrencyType)
2626

2727
super.init(name: name, managedObjectModel: model)
28-
28+
self.persistentStoreDescriptions = [NSPersistentStoreDescription(url: directoryURL.appendingPathComponent("\(name).sqlite"))]
2929
self._viewContext.persistentStoreCoordinator = self.persistentStoreCoordinator
3030
}
3131

Source/AlecrimCoreData/Core/Classes/PersistentContainer.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ internal protocol UnderlyingPersistentContainer: class {
5555

5656
func configureDefaults(for context: NSManagedObjectContext)
5757

58-
init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type)
58+
init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type, directoryURL: URL)
5959
}
6060

6161
// MARK: -
@@ -64,7 +64,7 @@ open class GenericPersistentContainer<ContextType: NSManagedObjectContext> {
6464

6565
// MARK: -
6666

67-
open class func defaultDirectoryURL() -> URL {
67+
open class func directoryURL() -> URL {
6868
if #available(iOS 10.0, macOSApplicationExtension 10.12, iOSApplicationExtension 10.0, tvOSApplicationExtension 10.0, watchOSApplicationExtension 3.0, *) {
6969
return NativePersistentContainer.defaultDirectoryURL()
7070
}
@@ -122,12 +122,20 @@ open class GenericPersistentContainer<ContextType: NSManagedObjectContext> {
122122

123123

124124
public init(name: String, managedObjectModel model: NSManagedObjectModel, automaticallyLoadPersistentStores: Bool) {
125+
let directoryURL = type(of: self).directoryURL()
126+
127+
do {
128+
try FileManager.default.createDirectory(atPath: directoryURL.path, withIntermediateDirectories: true, attributes: nil)
129+
} catch {
130+
AlecrimCoreDataError.handleError(error)
131+
}
132+
125133
//
126134
if #available(iOS 10.0, macOSApplicationExtension 10.12, iOSApplicationExtension 10.0, tvOSApplicationExtension 10.0, watchOSApplicationExtension 3.0, *) {
127-
self.underlyingPersistentContainer = NativePersistentContainer(name: name, managedObjectModel: model, contextType: ContextType.self)
135+
self.underlyingPersistentContainer = NativePersistentContainer(name: name, managedObjectModel: model, contextType: ContextType.self, directoryURL: directoryURL)
128136
}
129137
else {
130-
self.underlyingPersistentContainer = CustomPersistentContainer(name: name, managedObjectModel: model, contextType: ContextType.self)
138+
self.underlyingPersistentContainer = CustomPersistentContainer(name: name, managedObjectModel: model, contextType: ContextType.self, directoryURL: directoryURL)
131139
}
132140

133141
//

Source/AlecrimCoreData/Core/Extensions/NSManagedObjectExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension NSManagedObject {
2222

2323
let otherManagedObject = try otherContext.existingObject(with: self.objectID)
2424

25-
return unsafeBitCast(otherManagedObject, to: type(of: self))
25+
return unsafeDowncast(otherManagedObject, to: type(of: self))
2626
}
2727

2828
}

Source/AlecrimCoreData/Core/Extensions/UICollectionViewExtensions.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@
113113
}
114114
}
115115
}
116-
.didChangeContent { [unowned collectionView] in
116+
.didChangeContent { [weak collectionView] in
117+
guard let collectionView = collectionView else {
118+
reset()
119+
return
120+
}
121+
117122
if reloadData {
118123
collectionView.reloadData()
119124
reset()

0 commit comments

Comments
 (0)