diff --git a/Realm Object Editor.xcodeproj/project.pbxproj b/Realm Object Editor.xcodeproj/project.pbxproj
old mode 100644
new mode 100755
index 562bb28..e0bc969
--- a/Realm Object Editor.xcodeproj/project.pbxproj
+++ b/Realm Object Editor.xcodeproj/project.pbxproj
@@ -234,11 +234,12 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
- LastUpgradeCheck = 0700;
+ LastUpgradeCheck = 0940;
ORGANIZATIONNAME = "Ahmed Ali";
TargetAttributes = {
60BE92E91A4CE0EC00019B4F = {
CreatedOnToolsVersion = 6.1.1;
+ LastSwiftMigration = 0940;
};
};
};
@@ -331,13 +332,23 @@
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;
CODE_SIGN_IDENTITY = "-";
@@ -346,6 +357,7 @@
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",
@@ -374,13 +386,23 @@
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;
CODE_SIGN_IDENTITY = "-";
@@ -389,6 +411,7 @@
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;
@@ -398,6 +421,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
@@ -410,6 +434,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "eng.ahmed.ali.awad-gmail.com.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -422,6 +447,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "eng.ahmed.ali.awad-gmail.com.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 4.0;
};
name = Release;
};
diff --git a/Realm Object Editor/AttributeDescriptor.swift b/Realm Object Editor/AttributeDescriptor.swift
index 23dfba0..7baa053 100644
--- a/Realm Object Editor/AttributeDescriptor.swift
+++ b/Realm Object Editor/AttributeDescriptor.swift
@@ -54,8 +54,8 @@ class AttributeDescriptor: NSObject {
"hasDefault" : hasDefault,
"defaultValue" : defaultValue,
"typeName" : type.typeName
- ]
+ ] as [String : Any]
- return dictionary
+ return dictionary as NSDictionary
}
-}
\ No newline at end of file
+}
diff --git a/Realm Object Editor/AttributeNameCell.swift b/Realm Object Editor/AttributeNameCell.swift
index 6b9fd39..a9bedb3 100644
--- a/Realm Object Editor/AttributeNameCell.swift
+++ b/Realm Object Editor/AttributeNameCell.swift
@@ -8,7 +8,7 @@
import Cocoa
protocol AttributeNameCellDelegate : class{
- func attributeNameDidChange(attribute: AttributeDescriptor!, newName: String)
+ func attributeNameDidChange(_ attribute: AttributeDescriptor!, newName: String)
}
class AttributeNameCell: ClickableCell {
@@ -30,7 +30,7 @@ class AttributeNameCell: ClickableCell {
}
- override func nameDidChange(newName: String)
+ override func nameDidChange(_ newName: String)
{
super.nameDidChange(newName)
delegate?.attributeNameDidChange(attribute, newName: newName)
diff --git a/Realm Object Editor/AttributeType.swift b/Realm Object Editor/AttributeType.swift
index 1b0d20d..2eb9a57 100644
--- a/Realm Object Editor/AttributeType.swift
+++ b/Realm Object Editor/AttributeType.swift
@@ -39,7 +39,7 @@ let arrayOfSupportedTypes : [TypeDescriptor] = [InvalidType(),
BinaryDataType(),
BoolType()]
-func indexOfType(type : TypeDescriptor) -> Int?
+func indexOfType(_ type : TypeDescriptor) -> Int?
{
for i in 0 ..< arrayOfSupportedTypes.count{
let t = arrayOfSupportedTypes[i]
@@ -61,7 +61,7 @@ func supportedTypesAsStringsArray() -> [String]
return typesAsStrings
}
-func findTypeByTypeName(typeName: String) -> TypeDescriptor?
+func findTypeByTypeName(_ typeName: String) -> TypeDescriptor?
{
for type in arrayOfSupportedTypes{
if type.typeName == typeName{
diff --git a/Realm Object Editor/AttributeTypeCell.swift b/Realm Object Editor/AttributeTypeCell.swift
index 3e87c4d..7f0487d 100644
--- a/Realm Object Editor/AttributeTypeCell.swift
+++ b/Realm Object Editor/AttributeTypeCell.swift
@@ -10,7 +10,7 @@ import Cocoa
protocol AttributeTypeCellDelegate : class
{
- func attributeTypeDidChange(attribute attribute: AttributeDescriptor)
+ func attributeTypeDidChange(attribute: AttributeDescriptor)
}
class AttributeTypeCell: NSTableCellView {
@@ -20,7 +20,7 @@ class AttributeTypeCell: NSTableCellView {
var attribute : AttributeDescriptor!{
didSet{
- typesPopupButton.selectItemWithTitle(attribute.type.typeName)
+ typesPopupButton.selectItem(withTitle: attribute.type.typeName)
}
}
@@ -29,11 +29,11 @@ class AttributeTypeCell: NSTableCellView {
override func awakeFromNib() {
super.awakeFromNib()
typesPopupButton.removeAllItems()
- typesPopupButton.addItemsWithTitles(supportedTypesAsStringsArray())
+ typesPopupButton.addItems(withTitles: supportedTypesAsStringsArray())
}
- @IBAction func changeType(sender: AnyObject)
+ @IBAction func changeType(_ sender: AnyObject)
{
attribute.type = arrayOfSupportedTypes[typesPopupButton.indexOfSelectedItem]
delegate?.attributeTypeDidChange(attribute: attribute)
diff --git a/Realm Object Editor/ClickableCell.swift b/Realm Object Editor/ClickableCell.swift
old mode 100644
new mode 100755
index 22cd6a8..dc00651
--- a/Realm Object Editor/ClickableCell.swift
+++ b/Realm Object Editor/ClickableCell.swift
@@ -19,12 +19,12 @@ class ClickableCell: NSTableCellView, NSTextFieldDelegate{
var allowsEmptyValue = false
var prevName : String = ""
- override func mouseUp(theEvent: NSEvent) {
+ override func mouseUp(with theEvent: NSEvent) {
if editableLabel == nil{
return
}
let globalLocation = theEvent.locationInWindow
- let localLocation = convertPoint(globalLocation, fromView: nil)
+ let localLocation = convert(globalLocation, from: nil)
if NSPointInRect(localLocation, editableLabel.frame){
beginEditing()
@@ -37,39 +37,39 @@ class ClickableCell: NSTableCellView, NSTextFieldDelegate{
func beginEditing()
{
prevName = editableLabel.stringValue
- editableLabel.editable = true
+ editableLabel.isEditable = true
window?.makeFirstResponder(editableLabel)
}
func endEditing()
{
- editableLabel.editable = false
+ editableLabel.isEditable = false
window?.resignFirstResponder()
- if prevName != editableLabel.stringValue && prevName.characters.count > 0{
+ if prevName != editableLabel.stringValue && prevName.count > 0{
nameDidChange(editableLabel.stringValue)
}
}
- func nameDidChange(newName: String)
+ func nameDidChange(_ newName: String)
{
prevName = editableLabel.stringValue
}
//MARK: - NSTextFieldDelegate
- func control(control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool
+ func control(_ control: NSControl, textShouldBeginEditing fieldEditor: NSText) -> Bool
{
return true
}
- func control(control: NSControl, textShouldEndEditing fieldEditor: NSText) -> Bool
+ func control(_ control: NSControl, textShouldEndEditing fieldEditor: NSText) -> Bool
{
if allowsEmptyValue{
endEditing()
return true
}
- if editableLabel.stringValue.characters.count == 0{
+ if editableLabel.stringValue.count == 0{
showEmptyNameError()
return false
}
@@ -84,10 +84,10 @@ class ClickableCell: NSTableCellView, NSTextFieldDelegate{
{
let alert = NSAlert()
alert.messageText = "Name must contain characters"
- alert.addButtonWithTitle("Ok")
- alert.addButtonWithTitle("Discard changes")
+ alert.addButton(withTitle: "Ok")
+ alert.addButton(withTitle: "Discard changes")
let response = alert.runModal()
- if response == NSAlertSecondButtonReturn{
+ if response == NSApplication.ModalResponse.alertSecondButtonReturn{
//discard changes
editableLabel.stringValue = prevName
editableLabel.endEditing(NSText())
diff --git a/Realm Object Editor/ClickableTableView.swift b/Realm Object Editor/ClickableTableView.swift
index db2250b..5eae25a 100644
--- a/Realm Object Editor/ClickableTableView.swift
+++ b/Realm Object Editor/ClickableTableView.swift
@@ -10,22 +10,22 @@ import Cocoa
protocol ExtendedTableViewDelegate : class
{
- func tableView(tableView: ClickableTableView, didClickOnRow row: Int)
+ func tableView(_ tableView: ClickableTableView, didClickOnRow row: Int)
}
class ClickableTableView: NSTableView {
weak var extendedDelegate : ExtendedTableViewDelegate!
- private var prevSelectedRow = -1
- override func mouseDown(theEvent: NSEvent) {
+ fileprivate var prevSelectedRow = -1
+ override func mouseDown(with theEvent: NSEvent) {
let globalLocation = theEvent.locationInWindow
- let localLocation = convertPoint(globalLocation, fromView: nil)
- let clickedRow = rowAtPoint(localLocation)
+ let localLocation = convert(globalLocation, from: nil)
+ let clickedRow = row(at: localLocation)
// super.mouseDown(theEvent)
prevSelectedRow = selectedRow
if clickedRow > -1{
- selectRowIndexes(NSIndexSet(index: clickedRow), byExtendingSelection: false)
+ selectRowIndexes(IndexSet(integer: clickedRow), byExtendingSelection: false)
extendedDelegate?.tableView(self, didClickOnRow: clickedRow)
}
@@ -33,11 +33,11 @@ class ClickableTableView: NSTableView {
}
- override func keyDown(theEvent: NSEvent) {
+ override func keyDown(with theEvent: NSEvent) {
//36 enter button is down
//53 is the esc button
if selectedRow > -1{
- if let cell = viewAtColumn(0, row: selectedRow, makeIfNecessary: false) as? ClickableCell{
+ if let cell = view(atColumn: 0, row: selectedRow, makeIfNecessary: false) as? ClickableCell{
if theEvent.keyCode == 36{
cell.beginEditing()
}else if theEvent.keyCode == 53{
@@ -47,20 +47,20 @@ class ClickableTableView: NSTableView {
}
}
- override func mouseUp(theEvent: NSEvent) {
+ override func mouseUp(with theEvent: NSEvent) {
let globalLocation = theEvent.locationInWindow
- let localLocation = convertPoint(globalLocation, fromView: nil)
- let clickedRow = rowAtPoint(localLocation)
+ let localLocation = convert(globalLocation, from: nil)
+ let clickedRow = row(at: localLocation)
if clickedRow == prevSelectedRow && clickedRow > -1{
- if let cell = viewAtColumn(0, row: clickedRow, makeIfNecessary: false) as? ClickableCell{
+ if let cell = view(atColumn: 0, row: clickedRow, makeIfNecessary: false) as? ClickableCell{
//forward the touch event...
- cell.mouseUp(theEvent)
+ cell.mouseUp(with: theEvent)
}
}else{
//ask previous cell to stop editing
if prevSelectedRow > -1{
- if let cell = viewAtColumn(0, row: prevSelectedRow, makeIfNecessary: false) as? ClickableCell{
+ if let cell = view(atColumn: 0, row: prevSelectedRow, makeIfNecessary: false) as? ClickableCell{
cell.endEditing()
}
prevSelectedRow = clickedRow
@@ -68,6 +68,6 @@ class ClickableTableView: NSTableView {
}
- super.mouseUp(theEvent)
+ super.mouseUp(with: theEvent)
}
}
diff --git a/Realm Object Editor/ColorableView.swift b/Realm Object Editor/ColorableView.swift
old mode 100644
new mode 100755
index 4ec0b48..c4a3a7e
--- a/Realm Object Editor/ColorableView.swift
+++ b/Realm Object Editor/ColorableView.swift
@@ -12,7 +12,7 @@ import Cocoa
class ColorableView: NSView {
@IBInspectable
- var backgroundColor: NSColor = NSColor.whiteColor(){
+ var backgroundColor: NSColor = NSColor.white{
didSet{
needsDisplay = true
}
@@ -26,7 +26,7 @@ class ColorableView: NSView {
}
@IBInspectable
- var topSeperatorColor: NSColor = NSColor.whiteColor(){
+ var topSeperatorColor: NSColor = NSColor.white{
didSet{
needsDisplay = true
}
@@ -40,7 +40,7 @@ class ColorableView: NSView {
}
@IBInspectable
- var leftSeperatorColor: NSColor = NSColor.whiteColor(){
+ var leftSeperatorColor: NSColor = NSColor.white{
didSet{
needsDisplay = true
}
@@ -54,7 +54,7 @@ class ColorableView: NSView {
}
@IBInspectable
- var bottomSeperatorColor: NSColor = NSColor.whiteColor(){
+ var bottomSeperatorColor: NSColor = NSColor.white{
didSet{
needsDisplay = true
}
@@ -68,7 +68,7 @@ class ColorableView: NSView {
}
@IBInspectable
- var rightSeperatorColor: NSColor = NSColor.whiteColor(){
+ var rightSeperatorColor: NSColor = NSColor.white{
didSet{
needsDisplay = true
}
@@ -91,17 +91,17 @@ class ColorableView: NSView {
}
@IBInspectable
- var borderColor : NSColor = NSColor.clearColor(){
+ var borderColor : NSColor = NSColor.clear{
didSet{
wantsLayer = true
needsDisplay = true
}
}
- override func drawRect(dirtyRect: NSRect) {
- super.drawRect(dirtyRect)
+ override func draw(_ dirtyRect: NSRect) {
+ super.draw(dirtyRect)
backgroundColor.setFill()
- NSRectFill(self.bounds)
+ self.bounds.fill()
if topSeperatorWidth > 0{
drawTopSep(dirtyRect)
}
@@ -117,38 +117,38 @@ class ColorableView: NSView {
if rightSeperatorWidth > 0{
drawRightSep(dirtyRect)
}
- layer?.edgeAntialiasingMask = [.LayerBottomEdge, .LayerTopEdge, .LayerLeftEdge, .LayerRightEdge]
- layer?.borderColor = borderColor.CGColor
+ layer?.edgeAntialiasingMask = [.layerBottomEdge, .layerTopEdge, .layerLeftEdge, .layerRightEdge]
+ layer?.borderColor = borderColor.cgColor
layer?.cornerRadius = cornerRadius
layer?.borderWidth = borderWidth
}
- func drawTopSep(rect: NSRect)
+ func drawTopSep(_ rect: NSRect)
{
topSeperatorColor.setFill()
let y = rect.origin.y + rect.size.height - topSeperatorWidth
- NSRectFill(NSMakeRect(rect.origin.x, y, rect.size.width, topSeperatorWidth))
+ NSMakeRect(rect.origin.x, y, rect.size.width, topSeperatorWidth).fill()
}
- func drawLeftSep(rect: NSRect)
+ func drawLeftSep(_ rect: NSRect)
{
leftSeperatorColor.setFill()
- NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, leftSeperatorWidth, rect.size.height))
+ NSMakeRect(rect.origin.x, rect.origin.y, leftSeperatorWidth, rect.size.height).fill()
}
- func drawBottomSep(rect: NSRect)
+ func drawBottomSep(_ rect: NSRect)
{
bottomSeperatorColor.setFill()
- NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, bottomSeperatorWidth))
+ NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, bottomSeperatorWidth).fill()
}
- func drawRightSep(rect: NSRect)
+ func drawRightSep(_ rect: NSRect)
{
rightSeperatorColor.setFill()
let x = rect.origin.x + rect.size.width - rightSeperatorWidth
- NSRectFill(NSMakeRect(x, rect.origin.y, rightSeperatorWidth, rect.size.height))
+ NSMakeRect(x, rect.origin.y, rightSeperatorWidth, rect.size.height).fill()
}
}
diff --git a/Realm Object Editor/Document.swift b/Realm Object Editor/Document.swift
old mode 100644
new mode 100755
index 1b9e3cb..7bd1041
--- a/Realm Object Editor/Document.swift
+++ b/Realm Object Editor/Document.swift
@@ -18,19 +18,19 @@ class Document: NSDocument {
// Add your subclass-specific initialization here.
}
- override func windowControllerDidLoadNib(aController: NSWindowController) {
+ override func windowControllerDidLoadNib(_ aController: NSWindowController) {
super.windowControllerDidLoadNib(aController)
// Add any code here that needs to be executed once the windowController has loaded the document's window.
}
- override class func autosavesInPlace() -> Bool {
+ override class var autosavesInPlace: Bool {
return true
}
override func makeWindowControllers() {
// Returns the Storyboard that contains your Document window.
- let storyboard = NSStoryboard(name: "Main", bundle: nil)
- windowController = storyboard.instantiateControllerWithIdentifier("Editor Window Controller") as! NSWindowController
+ let storyboard = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
+ windowController = storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "Editor Window Controller")) as! NSWindowController
if let v = windowController.contentViewController as? EditorViewController{
vc = v
vc.entities = entities
@@ -39,7 +39,7 @@ class Document: NSDocument {
}
- override func dataOfType(typeName: String) throws -> NSData {
+ override func data(ofType typeName: String) throws -> Data {
var outError: NSError! = NSError(domain: "Migrator", code: 0, userInfo: nil)
var arrayOfDictionaries = [NSDictionary]()
@@ -49,9 +49,9 @@ class Document: NSDocument {
arrayOfDictionaries.append(entity.toDictionary())
}
- let data: NSData?
+ let data: Data?
do {
- data = try NSJSONSerialization.dataWithJSONObject(arrayOfDictionaries, options: [])
+ data = try JSONSerialization.data(withJSONObject: arrayOfDictionaries, options: [])
} catch let error as NSError {
outError = error
data = nil
@@ -63,10 +63,10 @@ class Document: NSDocument {
throw outError
}
- override func readFromData(data: NSData, ofType typeName: String) throws {
+ override func read(from data: Data, ofType typeName: String) throws {
let outError: NSError! = NSError(domain: "Migrator", code: 0, userInfo: nil)
- if let arrayOfDictionaries = try! NSJSONSerialization.JSONObjectWithData(data, options: []) as? [NSDictionary]{
+ if let arrayOfDictionaries = try! JSONSerialization.jsonObject(with: data, options: []) as? [NSDictionary]{
for dictionary in arrayOfDictionaries{
entities.append(EntityDescriptor(dictionary: dictionary))
diff --git a/Realm Object Editor/EditorViewController.swift b/Realm Object Editor/EditorViewController.swift
old mode 100644
new mode 100755
index 75cad05..099414e
--- a/Realm Object Editor/EditorViewController.swift
+++ b/Realm Object Editor/EditorViewController.swift
@@ -88,12 +88,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
override func viewDidLoad() {
super.viewDidLoad()
- noSelectionContainer.hidden = false
+ noSelectionContainer.isHidden = false
entitiesTable.extendedDelegate = self
attributesTable.extendedDelegate = self
relationshipsTable.extendedDelegate = self
attributeTypesPopup.removeAllItems()
- attributeTypesPopup.addItemsWithTitles(supportedTypesAsStringsArray())
+ attributeTypesPopup.addItems(withTitles: supportedTypesAsStringsArray())
}
@@ -103,25 +103,25 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
func selectedEntityDidChange()
{
for view in optionContainers {
- view.hidden = true
+ view.isHidden = true
}
attributesTable.reloadData()
relationshipsTable.reloadData()
selectedAttribute = nil
if selectedEntity == nil{
- noSelectionContainer.hidden = false
+ noSelectionContainer.isHidden = false
return
}
entityNameField.stringValue = selectedEntity.name
entityParentClassField.stringValue = selectedEntity.superClassName
- entityOptionsContainer.hidden = false
+ entityOptionsContainer.isHidden = false
}
- @IBAction func entityParentClassNameDidChange(sender: AnyObject)
+ @IBAction func entityParentClassNameDidChange(_ sender: AnyObject)
{
if selectedEntity == nil{
return
@@ -129,13 +129,13 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
selectedEntity.superClassName = entityParentClassField.stringValue
}
- @IBAction func selectedEntityNameDidChange(sender: AnyObject)
+ @IBAction func selectedEntityNameDidChange(_ sender: AnyObject)
{
entityNameDidChange(selectedEntity, newName: entityNameField.stringValue)
}
- func entityNameAlreadyUsed(entityName : String) -> Bool
+ func entityNameAlreadyUsed(_ entityName : String) -> Bool
{
for entity in entities{
if entity.name == entityName{
@@ -150,12 +150,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
//MARK: - EntityNameCellDelegate
- func entityNameDidChange(entity: EntityDescriptor!, newName: String)
+ func entityNameDidChange(_ entity: EntityDescriptor!, newName: String)
{
if entity == nil{
return
}
- if newName.characters.count == 0{
+ if newName.count == 0{
entityNameField.stringValue = entity.name
showErrorMessage(NSLocalizedString("EMPTY_ENTITY_NAME", tableName: "ErrorMessages", value:"Entity name cannot be empty", comment: "Displayed when trying to remove entity name"))
@@ -180,8 +180,8 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
let row = entitiesTable.selectedRow
if row > -1{
- let indexSet = NSIndexSet(index: row)
- entitiesTable.reloadDataForRowIndexes(indexSet, columnIndexes: NSIndexSet(indexesInRange: NSMakeRange(0, 1)))
+ let indexSet = IndexSet(integer: row)
+ entitiesTable.reloadData(forRowIndexes: indexSet, columnIndexes: IndexSet(integersIn: 0...0))
entitiesTable.selectRowIndexes(indexSet, byExtendingSelection: false)
}
}
@@ -191,23 +191,23 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
{
if selectedRelationship != nil{
for view in optionContainers {
- view.hidden = true
+ view.isHidden = true
}
- relationshipOptionsContainer.hidden = false
+ relationshipOptionsContainer.isHidden = false
//Fill option with the selected relationship data
populateRelationshipUI()
}
}
- @IBAction func selectedRelationshipNameDidChange(sender: AnyObject)
+ @IBAction func selectedRelationshipNameDidChange(_ sender: AnyObject)
{
let newName = relationshipNameField.stringValue
relationshipNameDidChange(selectedRelationship, newName: newName)
}
- @IBAction func selectedRelationshipDestinationDidChange(sender: AnyObject)
+ @IBAction func selectedRelationshipDestinationDidChange(_ sender: AnyObject)
{
if selectedRelationship == nil{
return
@@ -219,12 +219,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func selectedRelationshipToManyStateDidChange(sender: AnyObject)
+ @IBAction func selectedRelationshipToManyStateDidChange(_ sender: AnyObject)
{
if selectedRelationship == nil{
return
}
- selectedRelationship.toMany = relationshipToManyCheckbox.state == NSOnState
+ selectedRelationship.toMany = relationshipToManyCheckbox.state == NSControl.StateValue.on
populateRelationshipUI()
}
@@ -235,31 +235,31 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
return
}
relationshipDestinationPopup.removeAllItems()
- relationshipDestinationPopup.addItemWithTitle("No Value")
- relationshipDestinationPopup.addItemsWithTitles(entities.map({ (e) -> String in
+ relationshipDestinationPopup.addItem(withTitle: "No Value")
+ relationshipDestinationPopup.addItems(withTitles: entities.map({ (e) -> String in
e.name
}))
if selectedRelationship == nil{
return
}
- relationshipToManyCheckbox.state = selectedRelationship.toMany ? NSOnState : NSOffState
+ relationshipToManyCheckbox.state = selectedRelationship.toMany ? NSControl.StateValue.on : NSControl.StateValue.off
relationshipNameField.stringValue = selectedRelationship.name
if selectedRelationship.destinationName != nil{
- relationshipDestinationPopup.selectItemWithTitle(selectedRelationship.destinationName)
+ relationshipDestinationPopup.selectItem(withTitle: selectedRelationship.destinationName)
}else{
- relationshipDestinationPopup.selectItemAtIndex(0)
+ relationshipDestinationPopup.selectItem(at: 0)
}
let row = relationshipsTable.selectedRow
if row > -1{
- let indexSet = NSIndexSet(index: row)
- relationshipsTable.reloadDataForRowIndexes(indexSet, columnIndexes: NSIndexSet(indexesInRange: NSMakeRange(0, 2)))
+ let indexSet = IndexSet(integer: row)
+ relationshipsTable.reloadData(forRowIndexes: indexSet, columnIndexes: IndexSet(integersIn: 0...1))
relationshipsTable.selectRowIndexes(indexSet, byExtendingSelection: false)
}
}
- func relationshipNameAlreadyUsed(name: String) -> Bool
+ func relationshipNameAlreadyUsed(_ name: String) -> Bool
{
if selectedEntity == nil{
return false
@@ -276,7 +276,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - RelationshipNameCellDelegate
- func relationshipNameDidChange(relationship: RelationshipDescriptor!, newName: String)
+ func relationshipNameDidChange(_ relationship: RelationshipDescriptor!, newName: String)
{
if relationship != nil{
@@ -299,11 +299,11 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
func selectedAttributeDidChange()
{
for view in optionContainers {
- view.hidden = true
+ view.isHidden = true
}
if selectedAttribute != nil{
- attributeOptionsContainer.hidden = false
+ attributeOptionsContainer.isHidden = false
//Fill option with the selected attribute data
populateAttributeUI()
@@ -316,22 +316,22 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
return
}
attributeNameField.stringValue = selectedAttribute.name
- attributeIgnoredCheckbox.state = selectedAttribute.ignored ? NSOnState : NSOffState
- attributePrimaryKeyCheckbox.state = selectedAttribute.isPrimaryKey ? NSOnState : NSOffState
- attributeIndexedCheckbox.state = selectedAttribute.indexed ? NSOnState : NSOffState
- attributeDefaultCheckbox.state = selectedAttribute.hasDefault ? NSOnState : NSOffState
+ attributeIgnoredCheckbox.state = selectedAttribute.ignored ? NSControl.StateValue.on : NSControl.StateValue.off
+ attributePrimaryKeyCheckbox.state = selectedAttribute.isPrimaryKey ? NSControl.StateValue.on : NSControl.StateValue.off
+ attributeIndexedCheckbox.state = selectedAttribute.indexed ? NSControl.StateValue.on : NSControl.StateValue.off
+ attributeDefaultCheckbox.state = selectedAttribute.hasDefault ? NSControl.StateValue.on : NSControl.StateValue.off
if "\(selectedAttribute.type.defaultValue)" == "\(NoDefaultValue)"{
- attributeDefaultValueField.enabled = false
+ attributeDefaultValueField.isEnabled = false
attributeDefaultValueField.stringValue = ""
- attributeDefaultCheckbox.state = NSOffState
- attributeDefaultCheckbox.enabled = false
+ attributeDefaultCheckbox.state = NSControl.StateValue.off
+ attributeDefaultCheckbox.isEnabled = false
}else{
attributeDefaultValueField.stringValue = selectedAttribute.hasDefault ? "\(selectedAttribute.defaultValue)" : ""
- attributeDefaultValueField.enabled = true
- attributeDefaultCheckbox.enabled = true
+ attributeDefaultValueField.isEnabled = true
+ attributeDefaultCheckbox.isEnabled = true
}
- attributeTypesPopup.selectItemWithTitle(selectedAttribute.type.typeName)
+ attributeTypesPopup.selectItem(withTitle: selectedAttribute.type.typeName)
}
@@ -339,17 +339,17 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
{
let row = attributesTable.selectedRow
if row > -1{
- let indexSet = NSIndexSet(index: row)
- attributesTable.reloadDataForRowIndexes(indexSet, columnIndexes: NSIndexSet(indexesInRange: NSMakeRange(0, 2)))
+ let indexSet = IndexSet(integer: row)
+ attributesTable.reloadData(forRowIndexes: indexSet, columnIndexes: IndexSet(integersIn: 0...1))
attributesTable.selectRowIndexes(indexSet, byExtendingSelection: false)
}
}
- @IBAction func attributeNameDidChange(sender: AnyObject)
+ @IBAction func attributeNameDidChange(_ sender: AnyObject)
{
attributeNameDidChange(selectedAttribute, newName: attributeNameField.stringValue)
}
- func attributeNameAlreadyUsed(attrName: String) -> Bool
+ func attributeNameAlreadyUsed(_ attrName: String) -> Bool
{
if selectedEntity == nil{
return false
@@ -364,28 +364,28 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func attributeIgnoredStateDidChange(sender: AnyObject)
+ @IBAction func attributeIgnoredStateDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
}
- if (selectedAttribute.isPrimaryKey || selectedAttribute.indexed) && attributeIgnoredCheckbox.state == NSOnState{
- attributeIgnoredCheckbox.state = NSOffState
+ if (selectedAttribute.isPrimaryKey || selectedAttribute.indexed) && attributeIgnoredCheckbox.state == NSControl.StateValue.on{
+ attributeIgnoredCheckbox.state = NSControl.StateValue.off
showErrorMessage(NSLocalizedString("PRIMARYKEY_AND_INDEX_CAN_NOT_BE_IGNORED", tableName: "ErrorMessages", value:"Primary key and indexed attributes can not be marked as ignored", comment: "Displayed when attempting to set a primary key or an indexed attribute as ignored"))
return
}
- selectedAttribute.ignored = attributeIgnoredCheckbox.state == NSOnState
+ selectedAttribute.ignored = attributeIgnoredCheckbox.state == NSControl.StateValue.on
}
- @IBAction func attributePrimaryKeyStateDidChange(sender: AnyObject)
+ @IBAction func attributePrimaryKeyStateDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
}
- if attributePrimaryKeyCheckbox.state == NSOffState{
+ if attributePrimaryKeyCheckbox.state == NSControl.StateValue.off{
selectedAttribute.isPrimaryKey = false
return
}
@@ -397,12 +397,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
showErrorMessage(errorMessage)
- attributePrimaryKeyCheckbox.state = NSOffState
+ attributePrimaryKeyCheckbox.state = NSControl.StateValue.off
}
//otherwise make sure we can only have one primary key
for attribute in selectedEntity.attributes{
if attribute.isPrimaryKey{
- attributePrimaryKeyCheckbox.state = NSOffState
+ attributePrimaryKeyCheckbox.state = NSControl.StateValue.off
let errorMessage = String(format:NSLocalizedString("TRYING_TO_SET_MULTI_PRIMARY_KEYS", tableName: "ErrorMessages", value:"You already set %@ as the primary key for this entity. You can have only one primary key per entity", comment:"Displayed when trying to set more than one primary key for the same entity."), attribute.name)
@@ -415,46 +415,46 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
selectedAttribute.isPrimaryKey = true
if selectedAttribute.ignored{
selectedAttribute.ignored = false
- attributeIgnoredCheckbox.state = NSOffState
+ attributeIgnoredCheckbox.state = NSControl.StateValue.off
}
}
- @IBAction func attributeIndexedStateDidChange(sender: AnyObject)
+ @IBAction func attributeIndexedStateDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
}
- if selectedAttribute.ignored && attributeIndexedCheckbox.state == NSOnState{
- attributeIndexedCheckbox.state = NSOffState
+ if selectedAttribute.ignored && attributeIndexedCheckbox.state == NSControl.StateValue.on{
+ attributeIndexedCheckbox.state = NSControl.StateValue.off
showErrorMessage(NSLocalizedString("IGNORE_INDEXED_ATTR", tableName: "ErrorMessages", value:"Ignored attributes can not be indexed.", comment:"Displayed when user attempt to set ignored attribute as an indexed attribute"))
return
}
- selectedAttribute.indexed = attributeIndexedCheckbox.state == NSOnState
+ selectedAttribute.indexed = attributeIndexedCheckbox.state == NSControl.StateValue.on
}
- @IBAction func attributeDefaultValueDidChange(sender: AnyObject)
+ @IBAction func attributeDefaultValueDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
}
selectedAttribute.hasDefault = true
- attributeDefaultCheckbox.state = NSOnState
+ attributeDefaultCheckbox.state = NSControl.StateValue.on
selectedAttribute.defaultValue = attributeDefaultValueField.stringValue
}
- @IBAction func attributeHasDefaultStateDidChange(sender: AnyObject)
+ @IBAction func attributeHasDefaultStateDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
}
- selectedAttribute.hasDefault = attributeDefaultCheckbox.state == NSOnState
+ selectedAttribute.hasDefault = attributeDefaultCheckbox.state == NSControl.StateValue.on
if !selectedAttribute.hasDefault{
attributeDefaultValueField.stringValue = ""
}else{
@@ -462,7 +462,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
}
- @IBAction func attributeTypeDidChange(sender: AnyObject)
+ @IBAction func attributeTypeDidChange(_ sender: AnyObject)
{
if selectedAttribute == nil{
return
@@ -472,13 +472,13 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - AttributeNameCellDelegate
- func attributeNameDidChange(attribute: AttributeDescriptor!, newName: String)
+ func attributeNameDidChange(_ attribute: AttributeDescriptor!, newName: String)
{
if attribute == nil{
return
}
- if newName.characters.count == 0{
+ if newName.count == 0{
showErrorMessage(NSLocalizedString("EMPTY_ATTR_NAME", tableName: "ErrorMessages", value:"Attribute name can not be empty", comment:"Displayed when user tries to remove an attribute name"))
return
@@ -501,7 +501,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - Actions
- @IBAction func addEntity(sender: AnyObject)
+ @IBAction func addEntity(_ sender: AnyObject)
{
var entityName = "Entity"
if entities.count > 0{
@@ -522,7 +522,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func removeSelectedEntity(sender: AnyObject)
+ @IBAction func removeSelectedEntity(_ sender: AnyObject)
{
let row = entitiesTable.selectedRow
if row < 0{
@@ -530,7 +530,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
return
}
selectedEntity = nil
- let removedEntityName = entities.removeAtIndex(row).name
+ let removedEntityName = entities.remove(at: row).name
entitiesTable.reloadData()
//remove any related relations
for entity in entities{
@@ -538,7 +538,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
for i in 0 ..< relationships.count{
let relationship = relationships[i]
if relationship.destinationName == removedEntityName{
- entity.relationships.removeAtIndex(i)
+ entity.relationships.remove(at: i)
}
}
}
@@ -546,7 +546,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func addAttribute(sender: AnyObject)
+ @IBAction func addAttribute(_ sender: AnyObject)
{
if selectedEntity == nil{
return
@@ -571,7 +571,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func removeSelectedAttribute(sender: AnyObject)
+ @IBAction func removeSelectedAttribute(_ sender: AnyObject)
{
if selectedEntity == nil{
return
@@ -581,12 +581,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
return
}
selectedAttribute = nil
- selectedEntity.attributes.removeAtIndex(row)
+ selectedEntity.attributes.remove(at: row)
attributesTable.reloadData()
}
- @IBAction func addRelationship(sender: AnyObject)
+ @IBAction func addRelationship(_ sender: AnyObject)
{
if selectedEntity == nil{
return
@@ -609,7 +609,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
- @IBAction func removeSelectedRelationship(sender: AnyObject)
+ @IBAction func removeSelectedRelationship(_ sender: AnyObject)
{
if selectedEntity == nil{
return
@@ -618,11 +618,11 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
if row < 0{
return
}
- selectedEntity.relationships.removeAtIndex(row)
+ selectedEntity.relationships.remove(at: row)
relationshipsTable.reloadData()
}
- @IBAction func toggleRelationsListContainer(sender: NSButton)
+ @IBAction func toggleRelationsListContainer(_ sender: NSButton)
{
let animator = relationsListHeightConstraint.animator()
if animator.constant == relationsListContainer.bottomSeperatorWidth{
@@ -638,7 +638,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
//MARK: - Show/hide contents
- @IBAction func toggleAttributesListContainer(sender: NSButton)
+ @IBAction func toggleAttributesListContainer(_ sender: NSButton)
{
let animator = attributesListHeightConstraint.animator()
@@ -654,32 +654,32 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - Entity cells handling
- func entityCellAtRow(row: Int) -> NSView
+ func entityCellAtRow(_ row: Int) -> NSView
{
- let cell = entitiesTable.makeViewWithIdentifier("entityCell", owner: self) as! EntityCell
+ let cell = entitiesTable.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "entityCell"), owner: self) as! EntityCell
cell.entity = entities[row]
cell.delegate = self
return cell
}
//MARK: - Attribute cells handling
- func cellForAttributeAtRow(row: Int, column: NSTableColumn?) -> NSView
+ func cellForAttributeAtRow(_ row: Int, column: NSTableColumn?) -> NSView
{
let attribute = selectedEntity.attributes[row]
- if column?.identifier == "name"{
- let cell = attributesTable.makeViewWithIdentifier("name", owner: self) as! AttributeNameCell
+ if (column?.identifier)!.rawValue == "name"{
+ let cell = attributesTable.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "name"), owner: self) as! AttributeNameCell
cell.attribute = attribute
cell.delegate = self
return cell
}else{
- let cell = attributesTable.makeViewWithIdentifier("type", owner: self) as! AttributeTypeCell
+ let cell = attributesTable.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "type"), owner: self) as! AttributeTypeCell
cell.attribute = attribute
cell.delegate = self
return cell
}
}
//MARK: - AttributeTypeCellDelegate
- func attributeTypeDidChange(attribute attribute: AttributeDescriptor)
+ func attributeTypeDidChange(attribute: AttributeDescriptor)
{
attributesTable.reloadData()
populateAttributeUI()
@@ -688,16 +688,16 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
//MARK: - Relationship cells handling
- func cellForRelationshipAtRow(row: Int, column: NSTableColumn?) -> NSView
+ func cellForRelationshipAtRow(_ row: Int, column: NSTableColumn?) -> NSView
{
let relationship = selectedEntity.relationships[row]
- if column?.identifier == "name"{
- let cell = relationshipsTable.makeViewWithIdentifier("name", owner: self) as! RelationshipNameCell
+ if (column?.identifier)!.rawValue == "name"{
+ let cell = relationshipsTable.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "name"), owner: self) as! RelationshipNameCell
cell.relationship = relationship
cell.delegate = self
return cell
}else{
- let cell = relationshipsTable.makeViewWithIdentifier("destination", owner: self) as! RelationshipDestinationCell
+ let cell = relationshipsTable.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "destination"), owner: self) as! RelationshipDestinationCell
cell.allEntities = entities
cell.relationship = relationship
cell.delegate = self
@@ -706,14 +706,14 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - RelationshipDestinationCellDelegate
- func relationshipDestinationDidChange(cell: RelationshipDestinationCell, relationship: RelationshipDescriptor)
+ func relationshipDestinationDidChange(_ cell: RelationshipDestinationCell, relationship: RelationshipDescriptor)
{
relationshipsTable.reloadData()
populateRelationshipUI()
}
//MARK: - NSTableViewDataSource
- func numberOfRowsInTableView(tableView: NSTableView) -> Int
+ func numberOfRows(in tableView: NSTableView) -> Int
{
if tableView == entitiesTable{
return entities.count
@@ -732,7 +732,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
//MARK: - NSTableViewDelegate
- func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView?
+ func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView?
{
if tableView == entitiesTable{
return entityCellAtRow(row)
@@ -748,14 +748,14 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
- func tableView(tableView: NSTableView, nextTypeSelectMatchFromRow startRow: Int, toRow endRow: Int, forString searchString: String) -> Int
+ func tableView(_ tableView: NSTableView, nextTypeSelectMatchFromRow startRow: Int, toRow endRow: Int, for searchString: String) -> Int
{
if tableView != entitiesTable{
return -1
}
for i in startRow ..< entities.count{
let entity = entities[i]
- if entity.name.lowercaseString.hasPrefix(searchString){
+ if entity.name.lowercased().hasPrefix(searchString){
selectedEntity = entity
return i
@@ -766,7 +766,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
return -1
}
- func tableView(tableView: NSTableView, shouldSelectRow row: Int) -> Bool {
+ func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool {
if tableView == entitiesTable{
selectedEntity = entities[row]
@@ -779,7 +779,7 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - ExtendedTableViewDelegate
- func tableView(tableView: ClickableTableView, didClickOnRow row: Int)
+ func tableView(_ tableView: ClickableTableView, didClickOnRow row: Int)
{
if tableView == entitiesTable{
selectedEntity = entities[row]
@@ -792,11 +792,11 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
//MARK: - Messages
- func showError(error: NSError)
+ func showError(_ error: NSError)
{
NSAlert(error: error).runModal()
}
- func showErrorMessage(message: String)
+ func showErrorMessage(_ message: String)
{
let alert = NSAlert()
@@ -838,17 +838,17 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
//MARK: - Export
- func exportToSwift(sender: AnyObject!)
+ @IBAction func exportToSwift(_ sender: AnyObject!)
{
tryToExportWithLangName("Swift")
}
- func exportToObjectiveC(sender: AnyObject!)
+ @IBAction func exportToObjectiveC(_ sender: AnyObject!)
{
tryToExportWithLangName("ObjC")
}
- func exportToAndroidJava(sender: AnyObject!)
+ @IBAction func exportToAndroidJava(_ sender: AnyObject!)
{
showDialogToInputPackage(withTitle: "What is your packege name?",
information: "example: com.youcompanyname.youappname.model",
@@ -861,12 +861,12 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
}
- func exportToAndroidKotlin(sender: AnyObject!)
+ @IBAction func exportToAndroidKotlin(_ sender: AnyObject!)
{
tryToExportWithLangName("Kotlin")
}
- func tryToExportWithLangName(langName: String)
+ func tryToExportWithLangName(_ langName: String)
{
if validEntities() {
let lang = langWithName(langName)
@@ -875,19 +875,19 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
}
}
- func langWithName(langName: String) -> LangModel
+ func langWithName(_ langName: String) -> LangModel
{
// let fileName = "\(langName).json"
- let filePathUrl = NSBundle.mainBundle().URLForResource(langName, withExtension: "json")!
- let data = NSData(contentsOfURL: filePathUrl)
- let jsonObject = (try! NSJSONSerialization.JSONObjectWithData(data!, options: [])) as! NSDictionary
+ let filePathUrl = Bundle.main.url(forResource: langName, withExtension: "json")!
+ let data = try? Data(contentsOf: filePathUrl)
+ let jsonObject = (try! JSONSerialization.jsonObject(with: data!, options: [])) as! NSDictionary
let lang = LangModel(fromDictionary: jsonObject)
return lang
}
//MARK: - Showing the open panel and save files
- func choosePathAndSaveFiles(files: [FileModel])
+ func choosePathAndSaveFiles(_ files: [FileModel])
{
let openPanel = NSOpenPanel()
openPanel.allowsOtherFileTypes = false
@@ -896,14 +896,11 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
openPanel.canChooseDirectories = true
openPanel.canCreateDirectories = true
openPanel.prompt = "Choose"
- openPanel.beginSheetModalForWindow(view.window!, completionHandler: { (button : Int) -> Void in
- if button == NSFileHandlingPanelOKButton{
-
- self.saveFiles(files, toPath:openPanel.URL!.path!)
-
-
+ openPanel.beginSheetModal(for: view.window!) { (response) in
+ if response == NSApplication.ModalResponse.OK {
+ self.saveFiles(files, toPath:openPanel.url!.path)
}
- })
+ }
}
@@ -912,16 +909,16 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
- parameter path: in which to save the files
*/
- func saveFiles(files:[FileModel], toPath path: String)
+ func saveFiles(_ files:[FileModel], toPath path: String)
{
var error : NSError?
for file in files{
- let filePath = "\(path)/\(file.fileName).\(file.fileExtension)"
+ let filePath = "\(path)/\(file.fileName!).\(file.fileExtension!)"
do {
- try file.fileContent.writeToFile(filePath, atomically: false, encoding: NSUTF8StringEncoding)
+ try file.fileContent.write(toFile: filePath, atomically: false, encoding: String.Encoding.utf8)
} catch let error1 as NSError {
error = error1
}
@@ -947,16 +944,16 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
let notification = NSUserNotification()
notification.title = "Success!"
notification.informativeText = "Your Realm files have been generated successfully."
- notification.deliveryDate = NSDate()
+ notification.deliveryDate = Date()
- let center = NSUserNotificationCenter.defaultUserNotificationCenter()
+ let center = NSUserNotificationCenter.default
center.delegate = self
- center.deliverNotification(notification)
+ center.deliver(notification)
}
//MARK: - NSUserNotificationCenterDelegate
- func userNotificationCenter(center: NSUserNotificationCenter,
- shouldPresentNotification notification: NSUserNotification) -> Bool
+ func userNotificationCenter(_ center: NSUserNotificationCenter,
+ shouldPresent notification: NSUserNotification) -> Bool
{
return true
}
@@ -968,8 +965,8 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
func showDialogToInputPackage(withTitle title: String, information: String, placeholder: String, completion: ((String?)->())? = nil) {
let alert = NSAlert()
- alert.addButtonWithTitle("OK") // 1st button
- alert.addButtonWithTitle("Cancel") // 2nd button
+ alert.addButton(withTitle: "OK") // 1st button
+ alert.addButton(withTitle: "Cancel") // 2nd button
alert.messageText = title
alert.informativeText = information
@@ -977,9 +974,9 @@ class EditorViewController: NSViewController, NSTableViewDelegate, NSTableViewDa
textfield.placeholderString = placeholder
alert.accessoryView = textfield
- let response: NSModalResponse = alert.runModal()
+ let response: NSApplication.ModalResponse = alert.runModal()
- if (response == NSAlertFirstButtonReturn) {
+ if (response == NSApplication.ModalResponse.alertFirstButtonReturn) {
completion?(textfield.stringValue)
}
}
diff --git a/Realm Object Editor/EntityCell.swift b/Realm Object Editor/EntityCell.swift
index 04c4e1c..05a9ef8 100644
--- a/Realm Object Editor/EntityCell.swift
+++ b/Realm Object Editor/EntityCell.swift
@@ -9,7 +9,7 @@
import Cocoa
protocol EntityNameCellDelegate : class{
- func entityNameDidChange(entity: EntityDescriptor!, newName: String)
+ func entityNameDidChange(_ entity: EntityDescriptor!, newName: String)
}
class EntityCell: ClickableCell{
@@ -27,7 +27,7 @@ class EntityCell: ClickableCell{
}
}
- override func nameDidChange(newName: String)
+ override func nameDidChange(_ newName: String)
{
super.nameDidChange(newName)
delegate?.entityNameDidChange(entity, newName: newName)
diff --git a/Realm Object Editor/EntityFilesGenerator.swift b/Realm Object Editor/EntityFilesGenerator.swift
index a86df53..8bf8e04 100644
--- a/Realm Object Editor/EntityFilesGenerator.swift
+++ b/Realm Object Editor/EntityFilesGenerator.swift
@@ -8,23 +8,11 @@
import Foundation
class EntityFilesGenerator {
- /**
- Lazely load and return the singleton instance of the EntityGenerator
- */
-
- class var instance : EntityFilesGenerator {
- struct Static {
- static var onceToken : dispatch_once_t = 0
- static var instance : EntityFilesGenerator? = nil
- }
- dispatch_once(&Static.onceToken) {
- Static.instance = EntityFilesGenerator()
- }
- return Static.instance!
- }
+
+ static let instance = EntityFilesGenerator()
- func entitiesToFiles(entities: [EntityDescriptor], lang: LangModel) -> [FileModel]
+ func entitiesToFiles(_ entities: [EntityDescriptor], lang: LangModel) -> [FileModel]
{
var files = [FileModel]()
for entity in entities{
@@ -46,17 +34,17 @@ class EntityFilesGenerator {
}
- func fileContentForEntity(entity: EntityDescriptor, lang: LangModel) -> String
+ func fileContentForEntity(_ entity: EntityDescriptor, lang: LangModel) -> String
{
return FileContentGenerator(entity: entity, lang: lang).getFileContent()
}
- func headerFileContentForEntity(entity: EntityDescriptor, lang: LangModel) -> String
+ func headerFileContentForEntity(_ entity: EntityDescriptor, lang: LangModel) -> String
{
return ""
}
-}
\ No newline at end of file
+}
diff --git a/Realm Object Editor/FileContentGenerator.swift b/Realm Object Editor/FileContentGenerator.swift
old mode 100644
new mode 100755
index 51ba7c0..eeed068
--- a/Realm Object Editor/FileContentGenerator.swift
+++ b/Realm Object Editor/FileContentGenerator.swift
@@ -31,7 +31,7 @@ class FileContentGenerator {
content += lang.modelDefinition
content += lang.modelStart
content.replace(EntityName, by: entity.name)
- if entity.superClassName.characters.count == 0{
+ if entity.superClassName.count == 0{
content.replace(ParentName, by: lang.defaultSuperClass)
}else{
content.replace(ParentName, by: entity.superClassName)
@@ -58,7 +58,7 @@ class FileContentGenerator {
}
//MARK: - Setter and Getters
- func appendGettersAndSetters(getter: String, setter: String)
+ func appendGettersAndSetters(_ getter: String, setter: String)
{
let types = lang.dataTypes.toDictionary()
for attr in entity.attributes{
@@ -69,16 +69,16 @@ class FileContentGenerator {
for relationship in entity.relationships{
var type = relationship.destinationName
if relationship.toMany && lang.toManyRelationType != nil{
- var relationshipType = lang.toManyRelationType
- relationshipType.replace(RelationshipType, by: type)
+ var relationshipType: String = lang.toManyRelationType
+ relationshipType.replace(RelationshipType, by: type!)
type = relationshipType
}
- appendDefination(getter, attrName: relationship.name, attrType: type)
- appendDefination(setter, attrName: relationship.name, attrType: type)
+ appendDefination(getter, attrName: relationship.name, attrType: type!)
+ appendDefination(setter, attrName: relationship.name, attrType: type!)
}
}
- func appendDefination(defination: String, attrName: String, attrType: String)
+ func appendDefination(_ defination: String, attrName: String, attrType: String)
{
var def = defination
def.replace(AttrName, by: attrName)
@@ -88,7 +88,7 @@ class FileContentGenerator {
}
//MARK: - Ignored properties
- func appendIgnoredProperties(ignoredPropertiesDef: String, forEachIgnoredProperty: String)
+ func appendIgnoredProperties(_ ignoredPropertiesDef: String, forEachIgnoredProperty: String)
{
let types = lang.dataTypes.toDictionary()
var ignoredAttrs = ""
@@ -101,7 +101,7 @@ class FileContentGenerator {
}
}
- if ignoredAttrs.characters.count > 0{
+ if ignoredAttrs.count > 0{
var ignoredAttrDef = ignoredPropertiesDef
ignoredAttrDef.replace(IgnoredAttributes, by: ignoredAttrs)
content += ignoredAttrDef
@@ -109,7 +109,7 @@ class FileContentGenerator {
}
//MARK: - Primary Key
- func appendPrimaryKey(primaryKeyDef: String)
+ func appendPrimaryKey(_ primaryKeyDef: String)
{
let types = lang.dataTypes.toDictionary()
for attr in entity.attributes{
@@ -125,7 +125,7 @@ class FileContentGenerator {
//MARK: - Index Attributes
- func appendIndexedAttributes(indexAttributesDefination: String, forEachIndexedAttribute: String)
+ func appendIndexedAttributes(_ indexAttributesDefination: String, forEachIndexedAttribute: String)
{
let types = lang.dataTypes.toDictionary()
var indexedAttrs = ""
@@ -138,7 +138,7 @@ class FileContentGenerator {
}
}
- if indexedAttrs.characters.count > 0{
+ if indexedAttrs.count > 0{
var indexedAttrDef = indexAttributesDefination
indexedAttrDef.replace(IndexedAttributes, by: indexedAttrs)
content += indexedAttrDef
@@ -148,7 +148,7 @@ class FileContentGenerator {
//MARK: - Relationships
func appendRelationships()
{
- for (index, relationship) in entity.relationships.enumerate(){
+ for (index, relationship) in entity.relationships.enumerated(){
var relationshipDef = ""
if relationship.toMany{
relationshipDef = lang.toManyRelationshipDefination
@@ -172,10 +172,10 @@ class FileContentGenerator {
func appendAttributes()
{
let types = lang.dataTypes.toDictionary()
- for (index, attr) in entity.attributes.enumerate(){
+ for (index, attr) in entity.attributes.enumerated(){
var attrDefination = ""
- if lang.attributeDefinationWithDefaultValue != nil && lang.attributeDefinationWithDefaultValue.characters.count > 0 && attr.hasDefault{
+ if lang.attributeDefinationWithDefaultValue != nil && lang.attributeDefinationWithDefaultValue.count > 0 && attr.hasDefault{
attrDefination = lang.attributeDefinationWithDefaultValue
let defValue = defaultValueForAttribute(attr, types: types)
@@ -220,13 +220,13 @@ class FileContentGenerator {
}
}
- func getSeperator(index: Int, total: Int) -> String
+ func getSeperator(_ index: Int, total: Int) -> String
{
return (index < total - 1) ? "," : ""
}
- func defaultValueForAttribute(attribute: AttributeDescriptor, types: [String : String]) -> String
+ func defaultValueForAttribute(_ attribute: AttributeDescriptor, types: [String : String]) -> String
{
var defValue = attribute.defaultValue
if defValue == NoDefaultValue{
@@ -258,7 +258,7 @@ class FileContentGenerator {
{
if lang.relationsipImports != nil{
for r in entity.relationships{
- var relationshipImport = lang.relationsipImports
+ var relationshipImport: String = lang.relationsipImports
relationshipImport.replace(RelationshipType, by: r.destinationName)
content += relationshipImport
}
@@ -266,14 +266,14 @@ class FileContentGenerator {
}
//MARK: - Copyrights
- func appendCopyrights(fileName: String, fileExtension: String)
+ func appendCopyrights(_ fileName: String, fileExtension: String)
{
content += "//\n//\t\(fileName).\(fileExtension)\n"
- if let me = ABAddressBook.sharedAddressBook()?.me(){
+ if let me = ABAddressBook.shared()?.me(){
- if let firstName = me.valueForProperty(kABFirstNameProperty as String) as? String{
+ if let firstName = me.value(forProperty: kABFirstNameProperty as String) as? String{
content += "//\n//\tCreate by \(firstName)"
- if let lastName = me.valueForProperty(kABLastNameProperty as String) as? String{
+ if let lastName = me.value(forProperty: kABLastNameProperty as String) as? String{
content += " \(lastName)"
}
}
@@ -281,7 +281,7 @@ class FileContentGenerator {
content += " on \(getTodayFormattedDay())\n//\tCopyright © \(getYear())"
- if let organization = me.valueForProperty(kABOrganizationProperty as String) as? String{
+ if let organization = me.value(forProperty: kABOrganizationProperty as String) as? String{
content += " \(organization)"
}
@@ -305,7 +305,7 @@ class FileContentGenerator {
*/
func getYear() -> String
{
- return "\(NSCalendar.currentCalendar().component(.Year, fromDate: NSDate()))"
+ return "\((Calendar.current as NSCalendar).component(.year, from: Date()))"
}
/**
@@ -313,7 +313,7 @@ class FileContentGenerator {
*/
func getTodayFormattedDay() -> String
{
- let components = NSCalendar.currentCalendar().components([.Day, .Month, .Year], fromDate: NSDate())
- return "\(components.day)/\(components.month)/\(components.year)"
+ let components = (Calendar.current as NSCalendar).components([.day, .month, .year], from: Date())
+ return "\(components.day!)/\(components.month!)/\(components.year!)"
}
-}
\ No newline at end of file
+}
diff --git a/Realm Object Editor/ImplementationFileContentGenerator.swift b/Realm Object Editor/ImplementationFileContentGenerator.swift
index 6267f46..da27844 100644
--- a/Realm Object Editor/ImplementationFileContentGenerator.swift
+++ b/Realm Object Editor/ImplementationFileContentGenerator.swift
@@ -40,18 +40,18 @@ class ImplementationFileContentGenerator: FileContentGenerator {
continue
}
let defValue = defaultValueForAttribute(attr, types: types)
- if attr.defaultValue.characters.count == 0{
+ if attr.defaultValue.count == 0{
continue
}
- var defValueDefination = lang.implementation.forEachPropertyWithDefaultValue
+ var defValueDefination: String = lang.implementation.forEachPropertyWithDefaultValue
defValueDefination.replace(AttrName, by: attr.name)
defValueDefination.replace(AttrDefaultValue, by: defValue)
defValues += defValueDefination
}
- if defValues.characters.count > 0{
- var defValuesDef = lang.implementation.defaultValuesDefination
+ if defValues.count > 0{
+ var defValuesDef: String = lang.implementation.defaultValuesDefination
defValuesDef.replace(DefaultValues, by: defValues)
content += defValuesDef
}
diff --git a/Realm Object Editor/Info.plist b/Realm Object Editor/Info.plist
index 36f7eec..7d477fe 100644
--- a/Realm Object Editor/Info.plist
+++ b/Realm Object Editor/Info.plist
@@ -34,7 +34,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.0.6
+ 0.0.7
CFBundleSignature
????
CFBundleVersion
diff --git a/Realm Object Editor/RelationshipDestinationCell.swift b/Realm Object Editor/RelationshipDestinationCell.swift
index bd55bce..0988508 100644
--- a/Realm Object Editor/RelationshipDestinationCell.swift
+++ b/Realm Object Editor/RelationshipDestinationCell.swift
@@ -8,7 +8,7 @@
import Cocoa
protocol RelationshipDestinationCellDelegate : class{
- func relationshipDestinationDidChange(cell: RelationshipDestinationCell, relationship: RelationshipDescriptor)
+ func relationshipDestinationDidChange(_ cell: RelationshipDestinationCell, relationship: RelationshipDescriptor)
}
class RelationshipDestinationCell: NSTableCellView {
@@ -19,8 +19,8 @@ class RelationshipDestinationCell: NSTableCellView {
var allEntities : [EntityDescriptor]!{
didSet{
destinationPopUpButton.removeAllItems()
- destinationPopUpButton.addItemWithTitle("No Value")
- destinationPopUpButton.addItemsWithTitles(allEntities.map{
+ destinationPopUpButton.addItem(withTitle: "No Value")
+ destinationPopUpButton.addItems(withTitles: allEntities.map{
(entity) -> String in
entity.name
})
@@ -29,9 +29,9 @@ class RelationshipDestinationCell: NSTableCellView {
var relationship: RelationshipDescriptor!{
didSet{
if relationship.destinationName != nil{
- destinationPopUpButton.selectItemWithTitle(relationship.destinationName)
+ destinationPopUpButton.selectItem(withTitle: relationship.destinationName)
}else{
- destinationPopUpButton.selectItemAtIndex(0)
+ destinationPopUpButton.selectItem(at: 0)
}
}
@@ -40,7 +40,7 @@ class RelationshipDestinationCell: NSTableCellView {
- @IBAction func changeRelationDestination(sender: AnyObject)
+ @IBAction func changeRelationDestination(_ sender: AnyObject)
{
relationship.destinationName = destinationPopUpButton.titleOfSelectedItem
delegate?.relationshipDestinationDidChange(self, relationship: relationship)
diff --git a/Realm Object Editor/RelationshipNameCell.swift b/Realm Object Editor/RelationshipNameCell.swift
index 2c47dcb..eae59e5 100644
--- a/Realm Object Editor/RelationshipNameCell.swift
+++ b/Realm Object Editor/RelationshipNameCell.swift
@@ -8,7 +8,7 @@
import Cocoa
protocol RelationshipNameCellDelegate : class{
- func relationshipNameDidChange(relationship: RelationshipDescriptor!, newName: String)
+ func relationshipNameDidChange(_ relationship: RelationshipDescriptor!, newName: String)
}
class RelationshipNameCell: ClickableCell {
@@ -27,7 +27,7 @@ class RelationshipNameCell: ClickableCell {
}
}
- override func nameDidChange(newName: String)
+ override func nameDidChange(_ newName: String)
{
super.nameDidChange(newName)
delegate?.relationshipNameDidChange(relationship, newName: newName)
diff --git a/Realm Object Editor/StringExtension.swift b/Realm Object Editor/StringExtension.swift
index 72b0ce7..f41a65c 100644
--- a/Realm Object Editor/StringExtension.swift
+++ b/Realm Object Editor/StringExtension.swift
@@ -40,20 +40,20 @@ extension String{
func toSingular() -> String
{
var singular = self
- let length = self.characters.count
+ let length = self.count
if length > 3{
- let range = endIndex.advancedBy(-3) ..< endIndex
- let lastThreeChars = self.substringWithRange(range)
+ let range = self.index(endIndex, offsetBy: -3) ..< endIndex
+ let lastThreeChars = self[range]
if lastThreeChars == "ies" {
- singular = self.stringByReplacingOccurrencesOfString(lastThreeChars, withString: "y", options: [], range: range)
+ singular = self.replacingOccurrences(of: lastThreeChars, with: "y", options: [], range: range)
}
}
if length > 2{
- let range = endIndex.advancedBy(-1) ..< endIndex
- let lastChar = self.substringWithRange(range)
+ let range = self.index(endIndex, offsetBy: -1) ..< endIndex
+ let lastChar = self[range]
if lastChar == "s" {
- singular = self.stringByReplacingOccurrencesOfString(lastChar, withString: "", options: [], range: range)
+ singular = self.replacingOccurrences(of: lastChar, with: "", options: [], range: range)
}
}
return singular
@@ -65,10 +65,9 @@ extension String{
- returns: the converted version
*/
func lowercaseFirstChar() -> String{
- let range = startIndex ..< startIndex.advancedBy(1)
- let firstLowerChar = self.substringWithRange(range).lowercaseString
-
- return self.stringByReplacingCharactersInRange(range, withString: firstLowerChar)
+ let range = startIndex ..< self.index(startIndex, offsetBy: 1)
+ let firstLowerChar = self[range].lowercased()
+ return self.replacingCharacters(in: range, with: firstLowerChar)
}
/**
@@ -77,28 +76,28 @@ extension String{
- returns: the converted version
*/
func uppercaseFirstChar() -> String{
- let range = startIndex ..< startIndex.advancedBy(1)
+ let range = startIndex ..< self.index(startIndex, offsetBy: 1)
- let firstUpperChar = self.substringWithRange(range).uppercaseString
+ let firstUpperChar = self[range].uppercased()
- return self.stringByReplacingCharactersInRange(range, withString: firstUpperChar)
+ return self.replacingCharacters(in: range, with: firstUpperChar)
}
func getUppercaseOfFirstChar() -> String
{
- return lastCharacter().uppercaseString
+ return lastCharacter().uppercased()
}
func lastCharacter() -> String
{
- let range = startIndex ..< startIndex.advancedBy(1)
- return self.substringWithRange(range)
+ let range = startIndex ..< self.index(startIndex, offsetBy: 1)
+ return String(self[range])
}
- mutating func replace(str: String, by replacement: String)
+ mutating func replace(_ str: String, by replacement: String)
{
- self = self.stringByReplacingOccurrencesOfString(str, withString: replacement)
+ self = self.replacingOccurrences(of: str, with: replacement)
}
-}
\ No newline at end of file
+}
diff --git a/Realm Object Editor/Swift.json b/Realm Object Editor/Swift.json
index a65a4d6..279bb44 100644
--- a/Realm Object Editor/Swift.json
+++ b/Realm Object Editor/Swift.json
@@ -9,24 +9,25 @@
"longType": "Double",
"stringType": "String",
"stringTypeQuotedValue" : "\"\"",
- "dateType": "NSDate",
- "dateTypeDefaultValue" : "NSDate()",
- "dataType": "NSData",
- "dataTypeDefaultValue" : "NSData()"
+ "dateType": "Date",
+ "dateTypeDefaultValue" : "Date()",
+ "dataType": "Data",
+ "dataTypeDefaultValue" : "Data()"
},
+ "staticImports" : "\nimport Foundation\nimport RealmSwift\n",
"modelDefinition": "\nclass : ",
"modelStart": "{\n",
"modelEnd": "\n}",
- "attributeDefination": "\tdynamic var : \n",
- "attributeDefinationWithDefaultValue": "\tdynamic var : = \n",
+ "attributeDefination": "\t@objc dynamic var : \n",
+ "attributeDefinationWithDefaultValue": "\t@objc dynamic var : = \n",
- "toOneRelationshipDefination": "\tdynamic var : ?\n",
- "toManyRelationshipDefination": "\tdynamic var = RLMArray(objectClassName: .className())\n",
+ "toOneRelationshipDefination": "\t@objc dynamic var : ?\n",
+ "toManyRelationshipDefination": "\tlet = List<>()\n",
"indexedAttributesDefination" : "\n\toverride class func attributesForProperty(propertyName: String) -> RLMPropertyAttributes\n {\n\t\tvar attrs = super.attributesForProperty(propertyName)\n\t\tvar indexedProperties = [String]()\n\n\t\tif find(indexedProperties, propertyName) != nil{\n\t\t\tattrs |= RLMPropertyAttributes.AttributeIndexed\n\t\t}\n\n\t\treturn attrs\n\t}\n",
"forEachIndexedAttribute" : "\t\tindexedProperties.append(\"\")\n",
"ignoredProperties" : "\n\toverride class func ignoredProperties() -> [AnyObject]\n\t{\n\t\treturn [\n\t\t\t]\n\t}\n",
"forEachIgnoredProperty" : "\t\t\t\"\",\n",
"primaryKeyDefination" : "\n\toverride class func primaryKey() -> String\n\t{\n\t\treturn \"\"\n\t}\n"
-}
\ No newline at end of file
+}