mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-11 17:06:46 +01:00
39 lines
972 B
Swift
39 lines
972 B
Swift
//
|
|
// DetailContainerView.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Brent Simmons on 2/12/19.
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import AppKit
|
|
|
|
final class DetailContainerView: NSView {
|
|
|
|
@IBOutlet var detailStatusBarView: DetailStatusBarView!
|
|
|
|
var contentViewConstraints: [NSLayoutConstraint]?
|
|
|
|
var contentView: NSView? {
|
|
didSet {
|
|
if contentView == oldValue {
|
|
return
|
|
}
|
|
|
|
if let currentConstraints = contentViewConstraints {
|
|
NSLayoutConstraint.deactivate(currentConstraints)
|
|
}
|
|
contentViewConstraints = nil
|
|
oldValue?.removeFromSuperviewWithoutNeedingDisplay()
|
|
|
|
if let contentView = contentView {
|
|
contentView.translatesAutoresizingMaskIntoConstraints = false
|
|
addSubview(contentView, positioned: .below, relativeTo: detailStatusBarView)
|
|
let constraints = constraintsToMakeSubViewFullSize(contentView)
|
|
NSLayoutConstraint.activate(constraints)
|
|
contentViewConstraints = constraints
|
|
}
|
|
}
|
|
}
|
|
}
|