Skip to content

Commit

Permalink
Updated for Swift 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Aug 16, 2023
1 parent e8b89b4 commit 7e6d089
Show file tree
Hide file tree
Showing 23 changed files with 18 additions and 1,220 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion Cartfile.resolved

This file was deleted.

19 changes: 3 additions & 16 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.1
// swift-tools-version:5.7
import PackageDescription

let package = Package(
Expand All @@ -15,16 +15,10 @@ let package = Package(
targets: [
"CoreDataModel"
]
),
.library(
name: "SQLiteModel",
targets: [
"SQLiteModel"
]
)
],
dependencies: [
.package(url: "https://github.com/PureSwift/Predicate.git", .branch("master"))
.package(url: "https://github.com/PureSwift/Predicate.git", branch: "master")
],
targets: [
.target(
Expand All @@ -39,18 +33,11 @@ let package = Package(
"CoreModel"
]
),
.target(
name: "SQLiteModel",
dependencies: [
"CoreModel"
]
),
.testTarget(
name: "CoreModelTests",
dependencies: [
"CoreModel"
]
)
],
swiftLanguageVersions: [4]
]
)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# CoreModel

[![Swift](https://img.shields.io/badge/swift-4.1-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Swift](https://img.shields.io/badge/swift-5.7-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](https://tldrlegal.com/license/mit-license)
[![Release](https://img.shields.io/github/release/pureswift/CoreModel.svg)](https://github.com/PureSwift/CoreModel/releases)
[![Build Status](https://travis-ci.org/PureSwift/CoreModel.svg?branch=master)](https://travis-ci.org/PureSwift/CoreModel)

[![SPM compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://github.com/apple/swift-package-manager)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Swift Object Graph
11 changes: 5 additions & 6 deletions Sources/CoreModel/Entity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ public struct Entity: Codable, Equatable {

public var relationships: [Relationship]

public init(name: String,
attributes: [Attribute],
relationships: [Relationship]) {

public init(
name: String,
attributes: [Attribute],
relationships: [Relationship]
) {
self.name = name
self.attributes = attributes
self.relationships = relationships
Expand All @@ -28,12 +29,10 @@ public struct Entity: Codable, Equatable {
public extension Entity {

subscript (attribute propertyName: String) -> Attribute? {

return attributes.first { $0.name == propertyName }
}

subscript (relationship propertyName: String) -> Relationship? {

return relationships.first { $0.name == propertyName }
}
}
15 changes: 5 additions & 10 deletions Sources/CoreModel/InMemoryStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public final class InMemoryStore: StoreProtocol {
private var data = [Identifier: Cache]()

public init(model: Model) {

self.model = model
}

Expand All @@ -26,12 +25,10 @@ public final class InMemoryStore: StoreProtocol {
var identifiers = data.keys.filter { $0.entity == fetchRequest.entity }

if fetchRequest.fetchOffset > 0 {

identifiers = Array(identifiers.suffix(fetchRequest.fetchOffset))
}

if fetchRequest.fetchLimit > 0 {

identifiers = Array(identifiers.prefix(fetchRequest.fetchLimit))
}

Expand Down Expand Up @@ -94,14 +91,14 @@ public final class InMemoryStore: StoreProtocol {

public extension InMemoryStore {

public struct Identifier: Equatable, Hashable {
struct Identifier: Equatable, Hashable {

public let entity: String

public let uuid: UUID
}

public final class ManagedObject: CoreModel.ManagedObject {
final class ManagedObject: CoreModel.ManagedObject {

public private(set) weak var store: InMemoryStore?

Expand Down Expand Up @@ -277,9 +274,8 @@ public extension InMemoryStore {

}

public var hashValue: Int {

return identifier.hashValue
public func hash(into hasher: inout Hasher) {
identifier.hash(into: &hasher)
}

public static func == (lhs: ManagedObject, rhs: ManagedObject) -> Bool {
Expand Down Expand Up @@ -308,7 +304,6 @@ private extension InMemoryStore {
extension InMemoryStore.ManagedObject: PredicateEvaluatable {

public func evaluate(with predicate: Predicate) throws -> Bool {


false
}
}
4 changes: 2 additions & 2 deletions Sources/CoreModel/ManagedObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import Foundation

/// CoreModel Managed Object
public protocol ManagedObject: class, Hashable {
public protocol ManagedObject: AnyObject, Hashable {

/// Whether the object has been deleted.
var isDeleted: Bool { get }

Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreModel/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

/// CoreModel Store Protocol
public protocol StoreProtocol: class {
public protocol StoreProtocol: AnyObject {

associatedtype ManagedObject: CoreModel.ManagedObject

Expand Down
1 change: 0 additions & 1 deletion Sources/SQLiteModel/SQLite.swift

This file was deleted.

6 changes: 0 additions & 6 deletions Tests/LinuxMain.swift

This file was deleted.

Loading

0 comments on commit 7e6d089

Please sign in to comment.