Skip to content

Commit

Permalink
Realm removed
Browse files Browse the repository at this point in the history
- Carthage removed
  • Loading branch information
JohnCoates committed Jun 13, 2017
1 parent c5f5df8 commit df41980
Show file tree
Hide file tree
Showing 19 changed files with 17 additions and 537 deletions.
1 change: 0 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ ratings:

exclude_paths:
- "Pods/**/*"
- "Carthage/**/*"
- "Resources/Images/**/*"
3 changes: 1 addition & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ disabled_rules:
- closure_parameter_position
- identifier_name
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Source/UI/Capture/Code Icons
- Source/UI/Capture/Permissions/Code Icons
- Resources/Images/Vector Images
variable_name:
min_length:
warning: 2
error: 2
error: 2
type_name:
min_length: 2
max_length:
Expand Down
1 change: 0 additions & 1 deletion .tailor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
exclude:
- Carthage # Ignore Swift files under "Source/Carthage/"
- Pods # Ignore Swift files under "Source/Pods/"
- Resources/Images/Vector Images
except:
Expand Down
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ osx_image: xcode8.3
cache:
bundler: true
cocoapods: true
directories:
- Carthage
- $HOME/Library/Caches/carthage_cache
before_install:
- xcrun swift -version
#- brew update
install:
- bundle install --without development
- carthage_cache install -b slate-cache || ((travis_wait 30 carthage bootstrap --platform iOS --no-use-binaries) && carthage_cache publish -b slate-cache) #--verbose
- pod install
after_success:
- bash <(curl -s https://codecov.io/bash) -J 'Slate'
Expand Down
1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion Cartfile.resolved

This file was deleted.

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ group :development do
# gem install sys-proctable --platform darwin
end

gem 'carthage_cache'
gem 'xcpretty'
16 changes: 0 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,12 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.5)
aws-sdk (2.9.17)
aws-sdk-resources (= 2.9.17)
aws-sdk-core (2.9.17)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.9.17)
aws-sdk-core (= 2.9.17)
aws-sigv4 (1.0.0)
carthage_cache (0.8.3)
aws-sdk (~> 2.0)
commander (~> 4.3)
claide (1.0.1)
clamp (0.6.5)
colored2 (3.1.2)
colorize (0.8.1)
commander (4.4.3)
highline (~> 1.7.2)
equatable (0.5.0)
ffi (1.9.18)
highline (1.7.8)
jmespath (1.3.1)
nanaimo (0.2.3)
pastel (0.7.1)
equatable (~> 0.5.0)
Expand Down Expand Up @@ -50,7 +35,6 @@ PLATFORMS
x86_64-darwin-16

DEPENDENCIES
carthage_cache
synx
sys-proctable
tty-command
Expand Down
179 changes: 15 additions & 164 deletions Slate.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions Source/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#if !SKIP_FABRIC
Fabric.with([Crashlytics.self])
#endif

RealmMigrator.migrate()

let window = DebugWindow(frame: UIScreen.main.bounds)
window.backgroundColor = UIColor.white
Expand Down
57 changes: 0 additions & 57 deletions Source/Controllers/Realm/RealmMigrator.swift

This file was deleted.

22 changes: 0 additions & 22 deletions Source/Extensions/Realm/Ream+Filtering.swift

This file was deleted.

68 changes: 0 additions & 68 deletions Source/UI/Capture/Components/Controllers/Kit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
//

import Foundation
import RealmSwift
import CoreData

class Kit {
var name: String = "Default Kit"
var components = [Component]()
var realmKey: Int?
var coreDataID: NSManagedObjectID?

func addComponent(component: Component) {
Expand All @@ -28,70 +26,6 @@ class Kit {

}

// MARK: - Realm

class KitRealm: Object {
dynamic var key = 0
dynamic var name = "?"
let components = List<ComponentUnionRealm>()

func instance() -> Kit {
let kit = Kit()
kit.name = name
kit.components = components.map {$0.instance()}
return kit
}

override static func primaryKey() -> String? {
return "key"
}

}

extension Kit {

func saveKitRealm() {
let realm: Realm
do {
realm = try Realm()
} catch let error as NSError {
print("Failed to create realm: \(error)")
return
}

try? realm.write {
let key: Int
if let realmKey = realmKey {
key = realmKey
} else {
key = nextKey(realm: realm)
}
let realmKit = KitRealm()
realmKit.key = key
realmKit.name = name

for component in components {
let unionObject = ComponentUnionRealm()
unionObject.configure(withComponent: component)
realmKit.components.append(unionObject)
}

realm.add(realmKit, update: true)
}
}

func nextKey(realm: Realm) -> Int {
let allKits = realm.objects(KitRealm.self)
let maxOptional = allKits.max(ofProperty: KitRealm.primaryKey()!) as Int?
if let max = maxOptional {
return max
} else {
return 0
}
}

}

// MARK: - Core Data

extension Kit {
Expand Down Expand Up @@ -125,8 +59,6 @@ extension Kit {
return dbComponent
}

print("saving components: \(components)")

object.components = Set(components.map { $0.databaseObject(in: context) })
}
}
Expand Down
15 changes: 1 addition & 14 deletions Source/UI/Capture/Components/Controllers/KitManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,9 @@
//

import Foundation
import RealmSwift
import CoreData

class KitManager {
static let currentKitRealm: Kit = {
guard let realm = try? Realm() else {
print("Failed to create realm")
return Kit()
}

let kits: Results<KitRealm> = realm.objects(KitRealm.self)
if kits.count == 0 {
return Kit()
}

return kits[0].instance()
}()

static let currentKit: Kit = {
let context = DataManager.context
Expand All @@ -44,4 +30,5 @@ class KitManager {
let kit = results[0].instance()
return kit
}()

}
24 changes: 0 additions & 24 deletions Source/UI/Capture/Components/Models/Capture/CaptureComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import UIKit
import RealmSwift
import CoreData

fileprivate typealias LocalClass = CaptureComponent
Expand Down Expand Up @@ -57,29 +56,6 @@ EditRounding, EditSize, EditPosition, EditOpacity {
return createTypedView()
}

func createRealmObject() -> ComponentRealm {
let object = RealmObject()
configureWithStandardProperties(realmObject: object)
return object
}

}

// MARK: - Realm Object

fileprivate typealias RealmObject = CaptureComponentRealm
class CaptureComponentRealm: ComponentRealm, EditRounding, EditOpacity {

dynamic var rounding: Float = LocalClass.defaultRounding
dynamic var opacity: Float = LocalClass.defaultOpacity

override func instance() -> Component {
let instance = LocalClass()
configureWithStandardProperies(instance: instance)

return instance
}

}

// MARK: - Core Data
Expand Down
18 changes: 0 additions & 18 deletions Source/UI/Capture/Components/Models/Protocols/Component.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import UIKit
import RealmSwift
import CoreData

protocol Component: class {
Expand All @@ -18,9 +17,6 @@ protocol Component: class {
var frame: CGRect { get set }
var view: UIView { get }

func createRealmObject() -> ComponentRealm
func configureWithStandardProperties(realmObject: ComponentRealm)

static func createInstance() -> Component
static func createView() -> UIView
}
Expand All @@ -44,20 +40,6 @@ extension Component {
return self.init()
}

func configureWithStandardProperties(realmObject: ComponentRealm) {
if let component = self as? EditRounding,
let realm = realmObject as? EditRounding {
realm.rounding = component.rounding
}

if let component = self as? EditOpacity,
let realm = realmObject as? EditOpacity {
realm.opacity = component.opacity
}

realmObject.frame = self.frame
}

}

// MARK: - Core Data
Expand Down
Loading

0 comments on commit df41980

Please sign in to comment.