Convert to Swift 4.2
This commit is contained in:
parent
c2633b5174
commit
9f5b7c7cb5
4 changed files with 28 additions and 20 deletions
|
|
@ -113,9 +113,9 @@ public class PreferencesViewController: NSViewController {
|
|||
view.addSubview(colorStackView)
|
||||
|
||||
let centerX = colorStackView.centerXAnchor.constraint(equalTo: view.centerXAnchor)
|
||||
centerX.priority = 999
|
||||
centerX.priority = NSLayoutConstraint.Priority(rawValue: 999)
|
||||
let centerY = colorStackView.centerYAnchor.constraint(equalTo: view.centerYAnchor)
|
||||
centerY.priority = 999
|
||||
centerY.priority = NSLayoutConstraint.Priority(rawValue: 999)
|
||||
NSLayoutConstraint.activate([
|
||||
centerX, centerY,
|
||||
colorStackView.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor, constant: 8),
|
||||
|
|
@ -153,7 +153,7 @@ public class PreferencesViewController: NSViewController {
|
|||
|
||||
override public func viewWillDisappear() {
|
||||
super.viewWillDisappear()
|
||||
NSColorPanel.shared().close()
|
||||
NSColorPanel.shared.close()
|
||||
}
|
||||
|
||||
private func prepareColorViews() {
|
||||
|
|
@ -166,7 +166,7 @@ public class PreferencesViewController: NSViewController {
|
|||
}
|
||||
|
||||
private func prepareColorPanel() {
|
||||
let colorPanel = NSColorPanel.shared()
|
||||
let colorPanel = NSColorPanel.shared
|
||||
colorPanel.isContinuous = true
|
||||
colorPanel.setTarget(self)
|
||||
colorPanel.setAction(#selector(PreferencesViewController.colorPanelDidUpdateValue))
|
||||
|
|
@ -182,20 +182,20 @@ public class PreferencesViewController: NSViewController {
|
|||
|
||||
// MARK: - Actions
|
||||
|
||||
func colorPanelDidUpdateValue(_ colorPanel: NSColorPanel) {
|
||||
@objc func colorPanelDidUpdateValue(_ colorPanel: NSColorPanel) {
|
||||
postColorNotification()
|
||||
}
|
||||
|
||||
func styleDidUpdate(sender: NSMenuItem) {
|
||||
@objc func styleDidUpdate(sender: NSMenuItem) {
|
||||
updateColorViewVisibility()
|
||||
postColorNotification()
|
||||
}
|
||||
|
||||
func sliderDidUpdate(sender: NSSlider) {
|
||||
@objc func sliderDidUpdate(sender: NSSlider) {
|
||||
postColorNotification()
|
||||
}
|
||||
|
||||
func closeWindow() {
|
||||
@objc func closeWindow() {
|
||||
self.view.window?.close()
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ class ParameterView: NSView {
|
|||
stackView.addArrangedSubview(label)
|
||||
|
||||
control.translatesAutoresizingMaskIntoConstraints = false
|
||||
control.setContentHuggingPriority(251, for: .horizontal)
|
||||
control.setContentHuggingPriority(NSLayoutConstraint.Priority(rawValue: 251), for: .horizontal)
|
||||
stackView.addArrangedSubview(control)
|
||||
|
||||
addSubview(stackView)
|
||||
|
|
|
|||
|
|
@ -117,9 +117,9 @@ public class Renderer: NSObject, MTKViewDelegate {
|
|||
encoder.label = "Render Pass"
|
||||
encoder.setViewport(MTLViewport(originX: 0.0, originY: 0.0, width: Double(view.drawableSize.width), height: Double(view.drawableSize.height), znear: -1.0, zfar: 1.0))
|
||||
encoder.setRenderPipelineState(renderPipelineState)
|
||||
encoder.setVertexBytes(points, length: points.count * MemoryLayout<Vertex>.stride, at: 0)
|
||||
encoder.setFragmentBuffer(field.parametersBuffer, offset: 0, at: 0)
|
||||
encoder.setFragmentBuffer(field.ballBuffer, offset: 0, at: 1)
|
||||
encoder.setVertexBytes(points, length: points.count * MemoryLayout<Vertex>.stride, index: 0)
|
||||
encoder.setFragmentBuffer(field.parametersBuffer, offset: 0, index: 0)
|
||||
encoder.setFragmentBuffer(field.ballBuffer, offset: 0, index: 1)
|
||||
encoder.drawPrimitives(type: .triangle, vertexStart: 0, vertexCount: 6)
|
||||
encoder.endEncoding()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue