Skip to content

Commit

Permalink
Make library buildable on visionOS (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
marekpridal authored Dec 9, 2023
1 parent a2f15cb commit 3ce16bd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/BarChartKit/UIKit/Controls/BarParentControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Created by Marek Přidal on 30/08/2020.
//
#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

final class BarParentControl: UIControl {
Expand Down
6 changes: 3 additions & 3 deletions Sources/BarChartKit/UIKit/Labels/ChartLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created by Marek Přidal on 01/01/2020.
// Copyright © 2020 Marek Pridal. All rights reserved.
//
#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

final class ChartLabel: UILabel {
Expand All @@ -16,12 +16,12 @@ final class ChartLabel: UILabel {
super.init(frame: frame)
commonInit()
}

#if os(iOS)
override func awakeFromNib() {
super.awakeFromNib()
commonInit()
}

#endif
private func commonInit() {
font = UIFont.systemFont(ofSize: 12, weight: .medium)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/BarChartKit/UIKit/Labels/LimitLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Marek Přidal on 18/10/2020.
//

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

final class LimitLabel: UILabel {
Expand All @@ -17,12 +17,12 @@ final class LimitLabel: UILabel {
super.init(frame: frame)
commonInit()
}

#if os(iOS)
override func awakeFromNib() {
super.awakeFromNib()
commonInit()
}

#endif
private func commonInit() {
font = UIFont.systemFont(ofSize: 10, weight: .medium)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/BarChartKit/UIKit/Preview/UIViewPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Created by Marek Přidal on 29/01/2020.
// Copyright © 2020 Marek Pridal. All rights reserved.
//
#if os(iOS)
#if os(iOS) || os(visionOS)
import SwiftUI

struct UIViewPreview<View: UIView>: UIViewRepresentable {
Expand Down
5 changes: 3 additions & 2 deletions Sources/BarChartKit/UIKit/Views/BarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Copyright © 2019 Marek Pridal. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

public protocol BarChartViewDelegate: AnyObject {
Expand Down Expand Up @@ -105,11 +105,12 @@ public final class BarChartView: UIView {
}

// MARK: - Override
#if os(iOS)
public override func awakeFromNib() {
super.awakeFromNib()
commonInit()
}

#endif
public override func layoutSubviews() {
guard let dataSet = dataSet else { return }
constructGraph(dataSet: dataSet)
Expand Down
2 changes: 1 addition & 1 deletion Sources/BarChartKit/UIKit/Views/DashedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Marek Přidal on 18/10/2020.
//

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

final class DashedView: UIView {
Expand Down
5 changes: 3 additions & 2 deletions Sources/BarChartKit/UIKit/Views/LimitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Marek Přidal on 18/10/2020.
//

#if os(iOS)
#if os(iOS) || os(visionOS)
import UIKit

final class LimitView: UIView {
Expand Down Expand Up @@ -38,11 +38,12 @@ final class LimitView: UIView {
}

// MARK: - Override
#if os(iOS)
public override func awakeFromNib() {
super.awakeFromNib()
commonInit()
}

#endif
private func commonInit() {
addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
Expand Down

0 comments on commit 3ce16bd

Please sign in to comment.