Skip to content

Commit

Permalink
modification date
Browse files Browse the repository at this point in the history
  • Loading branch information
glushchenko committed Aug 8, 2017
1 parent 86b4794 commit 967a587
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions FSNotes/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="left" title="Name" usesSingleLineMode="YES" id="y7T-Rc-etT">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlDarkShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<binding destination="8qL-z4-nzh" name="value" keyPath="objectValue.name" id="isc-2k-ZuS"/>
Expand All @@ -973,7 +973,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="2/23/11" id="9w3-fa-di3">
<font key="font" metaFont="system"/>
<color key="textColor" name="keyboardFocusIndicatorColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" red="0.65995385362694303" green="0.1371187799261683" blue="0.15795969262071341" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" name="controlHighlightColor" catalog="System" colorSpace="catalog"/>
<connections>
<binding destination="8qL-z4-nzh" name="value" keyPath="objectValue.getDateForLabel" id="VH2-T1-K75"/>
Expand Down
7 changes: 6 additions & 1 deletion FSNotes/NoteCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ class NoteCellView: NSTableCellView {
}

preview.translatesAutoresizingMaskIntoConstraints = false
date.translatesAutoresizingMaskIntoConstraints = false

let previewTop = preview.topAnchor.constraint(equalTo: self.topAnchor, constant: 2)
let previewLeft = preview.leftAnchor.constraint(equalTo: name.rightAnchor, constant: 0)
NSLayoutConstraint.activate([previewTop, previewLeft])
let dateRight = date.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -5)
let dateTop = date.topAnchor.constraint(equalTo: self.topAnchor, constant: 3)
let previewRight = preview.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -65)
NSLayoutConstraint.activate([previewTop, previewLeft, dateRight, dateTop, previewRight])
}
}
2 changes: 1 addition & 1 deletion FSNotes/NoteRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NoteRowView: NSTableRowView {
if self.selectionHighlightStyle != .none {
let selectionRect = NSInsetRect(self.bounds, 0, 0)
NSColor(calibratedWhite: 0.55, alpha: 1).setStroke()
NSColor(calibratedRed: 0.3, green: 0.6, blue: 0.9, alpha: 0.9).setFill()
NSColor(calibratedRed: 0.3, green: 0.6, blue: 0.9, alpha: 0.8).setFill()
let selectionPath = NSBezierPath.init(roundedRect: selectionRect, xRadius: 2, yRadius: 2)
selectionPath.fill()
selectionPath.stroke()
Expand Down
3 changes: 2 additions & 1 deletion FSNotes/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class ViewController: NSViewController,
if (notesTableView.notesList.indices.contains(selected)) {
let note = notesTableView.notesList.remove(at: selected)
note.content = content
note.date = Date.init()

notesTableView.notesList.insert(note, at: 0)
notesTableView.moveRow(at: selected, to: 0)
Expand Down Expand Up @@ -150,7 +151,7 @@ class ViewController: NSViewController,
do {
let fileAttribute: [FileAttributeKey : Any] = try FileManager.default.attributesOfItem(atPath: url.path)

modificationDate = fileAttribute[FileAttributeKey.modificationDate] as! Date
modificationDate = fileAttribute[FileAttributeKey.modificationDate] as? Date
} catch {
print(error.localizedDescription)
}
Expand Down

0 comments on commit 967a587

Please sign in to comment.