mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-06-16 10:34:34 +00:00
Fixed dark mode support for SwiftFormat for Xcode
* Remove custom background colours from table view cells * Setup more discreet borders in the rule view * Don’t set row view background colors on cell views * Set row view background colors on the row views * Reuse table row views when possible
This commit is contained in:
committed by
Nick Lockwood
parent
2a0042fc21
commit
d8a4ae013a
@@ -417,21 +417,24 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="476" height="613"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="33" horizontalPageScroll="10" verticalLineScroll="33" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="vVz-rA-tRS">
|
||||
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="RZx-Ps-pFP">
|
||||
<rect key="frame" x="0.0" y="571" width="476" height="5"/>
|
||||
</box>
|
||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="33" horizontalPageScroll="10" verticalLineScroll="33" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="vVz-rA-tRS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="476" height="573"/>
|
||||
<clipView key="contentView" id="1nY-Z5-cvR">
|
||||
<rect key="frame" x="1" y="1" width="474" height="571"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="1nY-Z5-cvR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="476" height="573"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" selectionHighlightStyle="none" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="30" rowSizeStyle="automatic" usesAutomaticRowHeights="YES" viewBased="YES" id="JTc-wy-tJT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="474" height="571"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="476" height="573"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="3"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableViewGridLines key="gridStyleMask" horizontal="YES"/>
|
||||
<tableViewGridLines key="gridStyleMask" dashed="YES"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn editable="NO" width="471" minWidth="40" maxWidth="1000" id="jXL-aR-Mks">
|
||||
<tableColumn editable="NO" width="473" minWidth="40" maxWidth="1000" id="jXL-aR-Mks">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -444,12 +447,12 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="BinarySelectionTableCellView" id="CZN-za-xvO" customClass="BinarySelectionTableCellView" customModule="SwiftFormat_for_Xcode" customModuleProvider="target">
|
||||
<rect key="frame" x="1" y="1" width="471" height="26"/>
|
||||
<rect key="frame" x="1" y="1" width="473" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="Mfi-uR-j8t">
|
||||
<rect key="frame" x="2" y="4" width="467" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="aQA-fV-2dz">
|
||||
<rect key="frame" x="2" y="4" width="469" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="leading" state="on" inset="2" id="aQA-fV-2dz">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
@@ -469,7 +472,7 @@
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="FreeTextTableCellView" id="ISi-9v-fr9" customClass="FreeTextTableCellView" customModule="SwiftFormat_for_Xcode" customModuleProvider="target">
|
||||
<rect key="frame" x="1" y="30" width="471" height="30"/>
|
||||
<rect key="frame" x="1" y="30" width="473" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hfs-ko-uob">
|
||||
@@ -477,11 +480,11 @@
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Rule name" id="vqw-aY-rHp">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3FH-Sx-Hfs">
|
||||
<rect key="frame" x="106" y="4" width="357" height="22"/>
|
||||
<rect key="frame" x="106" y="4" width="359" height="22"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="Mkg-Qi-aiV">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -506,11 +509,11 @@
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="ListSelectionTableCellView" id="gu5-aI-ODU" customClass="ListSelectionTableCellView" customModule="SwiftFormat_for_Xcode" customModuleProvider="target">
|
||||
<rect key="frame" x="1" y="63" width="471" height="29"/>
|
||||
<rect key="frame" x="1" y="63" width="473" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<popUpButton horizontalHuggingPriority="500" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uIw-Th-pkZ">
|
||||
<rect key="frame" x="389" y="1" width="77" height="25"/>
|
||||
<rect key="frame" x="391" y="1" width="77" height="25"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="oEo-Ud-RHl" id="99Z-zT-syJ">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
@@ -527,11 +530,11 @@
|
||||
</connections>
|
||||
</popUpButton>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Sj-pm-88d">
|
||||
<rect key="frame" x="32" y="6" width="353" height="17"/>
|
||||
<rect key="frame" x="32" y="6" width="355" height="17"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Option name" id="72m-8i-Mg3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
@@ -557,6 +560,7 @@
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<nil key="backgroundColor"/>
|
||||
</clipView>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="xtf-EX-hPz">
|
||||
<rect key="frame" x="-100" y="-100" width="223" height="15"/>
|
||||
@@ -584,10 +588,13 @@
|
||||
<constraints>
|
||||
<constraint firstItem="pHb-Fu-MRN" firstAttribute="centerX" secondItem="iDF-FY-6tf" secondAttribute="centerX" id="KMc-9S-niI"/>
|
||||
<constraint firstItem="vVz-rA-tRS" firstAttribute="leading" secondItem="iDF-FY-6tf" secondAttribute="leading" id="b3G-xy-WS8"/>
|
||||
<constraint firstItem="RZx-Ps-pFP" firstAttribute="leading" secondItem="vVz-rA-tRS" secondAttribute="leading" id="bxG-eX-JCO"/>
|
||||
<constraint firstItem="vVz-rA-tRS" firstAttribute="top" secondItem="pHb-Fu-MRN" secondAttribute="bottom" id="dY0-w7-cRt"/>
|
||||
<constraint firstItem="RZx-Ps-pFP" firstAttribute="trailing" secondItem="vVz-rA-tRS" secondAttribute="trailing" id="eTh-8E-Cyf"/>
|
||||
<constraint firstAttribute="bottom" secondItem="vVz-rA-tRS" secondAttribute="bottom" id="k1r-sg-eQJ"/>
|
||||
<constraint firstItem="pHb-Fu-MRN" firstAttribute="top" secondItem="iDF-FY-6tf" secondAttribute="top" id="npV-YY-FNN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vVz-rA-tRS" secondAttribute="trailing" id="pOR-wA-uLW"/>
|
||||
<constraint firstItem="RZx-Ps-pFP" firstAttribute="bottom" secondItem="vVz-rA-tRS" secondAttribute="top" id="uev-MI-Uhh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
|
||||
@@ -189,25 +189,40 @@ extension RulesViewController: NSTableViewDelegate {
|
||||
func tableView(_ tableView: NSTableView, viewFor _: NSTableColumn?, row: Int) -> NSView? {
|
||||
let model = self.model(forRow: row)
|
||||
let id: NSUserInterfaceItemIdentifier
|
||||
let backgroundColor: NSColor
|
||||
switch model {
|
||||
case .binary:
|
||||
id = .binarySelectionTableCellView
|
||||
let gray: CGFloat = 0.97
|
||||
backgroundColor = NSColor(calibratedRed: gray, green: gray, blue: gray, alpha: gray)
|
||||
case .list:
|
||||
id = .listSelectionTableCellView
|
||||
backgroundColor = NSColor.white
|
||||
case .freeText:
|
||||
id = .freeTextTableCellView
|
||||
backgroundColor = NSColor.white
|
||||
}
|
||||
|
||||
let cell = tableView.makeView(withIdentifier: id, owner: self)
|
||||
cell?.wantsLayer = true
|
||||
return tableView.makeView(withIdentifier: id, owner: self)
|
||||
}
|
||||
|
||||
cell?.layer?.backgroundColor = backgroundColor.cgColor
|
||||
func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
|
||||
if let rowView = tableView.makeView(withIdentifier: .ruleRowView, owner: self) as? NSTableRowView {
|
||||
return rowView
|
||||
}
|
||||
|
||||
return cell
|
||||
let rowView = NSTableRowView(frame: .zero)
|
||||
rowView.identifier = .ruleRowView
|
||||
return rowView
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, didAdd rowView: NSTableRowView, forRow row: Int) {
|
||||
switch self.model(forRow: row) {
|
||||
case .binary:
|
||||
rowView.backgroundColor = NSColor.controlAlternatingRowBackgroundColors[1]
|
||||
case .list, .freeText:
|
||||
rowView.backgroundColor = NSColor.controlAlternatingRowBackgroundColors[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension NSUserInterfaceItemIdentifier {
|
||||
static let ruleRowView = NSUserInterfaceItemIdentifier(rawValue: "RuleRowView")
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18D109</string>
|
||||
<string>17G5019</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>18D109</string>
|
||||
<string>17G5019</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -6,27 +6,27 @@
|
||||
<dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
|
||||
<data>
|
||||
3q565H/pkgLf+QmdBd0b+r9SbLc=
|
||||
u4vEDh8epEK5Xs9pO0IHXjkLo+0=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
|
||||
<data>
|
||||
J6aTA410qqG4Z/zeAOpt92gA+hs=
|
||||
BLKpc5YKNxtfFAkk/yuEL+ef0VE=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
|
||||
<data>
|
||||
fX8oHEFMCpSdmghXy9qtK1OIXUc=
|
||||
V0q3O0kWQH5upcH14/N7oSEUiZQ=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
|
||||
<data>
|
||||
pamMPdzsWMcvczXyxMnQnMkU3Mw=
|
||||
+NmGgDatmhXJgXeak4nibJgU47c=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
|
||||
<data>
|
||||
abf/Tby6xfd5BwR29r6hUoSc63w=
|
||||
5OXFQrYDgQAwBX7o+xnPoUXvkmE=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
|
||||
<data>
|
||||
zPUrr8qYNVs17vhpXBPsNu6XFdk=
|
||||
qlqMKaVVOg12pBE9C5WYMIATkPU=
|
||||
</data>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
|
||||
<data>
|
||||
@@ -178,7 +178,7 @@
|
||||
<dict>
|
||||
<key>cdhash</key>
|
||||
<data>
|
||||
tGXckxeAS0PdMm9XJGcSJ+Z/ciM=
|
||||
hIBVQKitdwGl5MLs0esbnsxGNtE=
|
||||
</data>
|
||||
<key>requirement</key>
|
||||
<string>anchor apple generic and identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "8VQKF583ED")</string>
|
||||
@@ -187,66 +187,66 @@
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
3q565H/pkgLf+QmdBd0b+r9SbLc=
|
||||
u4vEDh8epEK5Xs9pO0IHXjkLo+0=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
TsrZ810bFAT7ZQwvswVAvvCduHaTXg+Ko6Y0EZ5n+VU=
|
||||
1iq3aVEzldlu58kNDzixl0wRFJvRUjFFI4NxKCfmCR4=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
J6aTA410qqG4Z/zeAOpt92gA+hs=
|
||||
BLKpc5YKNxtfFAkk/yuEL+ef0VE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
y7VWDod2aXdam6rgaruX+ugBaKa4m6lxqsBF+Op/F/s=
|
||||
nibw/0KY/znqe7c3sIodZM+9rJFTpTqDoW08l/ns+9g=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
fX8oHEFMCpSdmghXy9qtK1OIXUc=
|
||||
V0q3O0kWQH5upcH14/N7oSEUiZQ=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
FVBAJlQchx93JI4rmMAT/2UUUHtfJgwivGo0AZicyRw=
|
||||
Enjxn5KkmtVa6wZVjfVwXCxNMzefnNe0PHUyLDEsmRE=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
pamMPdzsWMcvczXyxMnQnMkU3Mw=
|
||||
+NmGgDatmhXJgXeak4nibJgU47c=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
YA4SALqi0RL3w1dBKl+TGSqBNnXJ4oUlrVqI0JK/VBE=
|
||||
tkNu5WxL/lxV8POOtM8b2N5Y/KHkPfAiBSzhrEvwxeo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
abf/Tby6xfd5BwR29r6hUoSc63w=
|
||||
5OXFQrYDgQAwBX7o+xnPoUXvkmE=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
T/SboJxUI72KMjzwIMppL2cOdvDIUNuUrvJLjXUi3XY=
|
||||
2qmjvLuG86WycFbTrjfVTOZCu69SsljzOBJ6aFxyghA=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
|
||||
<dict>
|
||||
<key>hash</key>
|
||||
<data>
|
||||
zPUrr8qYNVs17vhpXBPsNu6XFdk=
|
||||
qlqMKaVVOg12pBE9C5WYMIATkPU=
|
||||
</data>
|
||||
<key>hash2</key>
|
||||
<data>
|
||||
aLBWIkZ05hBjU8SPduXnGllbGaQBjk66/ohSMdgGtIE=
|
||||
Z+/9r6a0y9DN3CXyBtPYB7Dloz9fYqayE/VbHvmpxQs=
|
||||
</data>
|
||||
</dict>
|
||||
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
|
||||
|
||||
Reference in New Issue
Block a user