Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve support for multiple platforms #33

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sources/Base/View/BaseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS)
import UIKit

/// A wrapper for the frame nature of `UIView`
Expand Down Expand Up @@ -39,3 +40,4 @@ open class BaseView: UIView {
@objc
open dynamic func addInitialLayout() { }
}
#endif
2 changes: 2 additions & 0 deletions Sources/Core/Utilities/OptionalSize+CG.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ public typealias OptionalCGSize = OptionalSize<CGFloat>

// MARK: - Logic

#if !os(watchOS)
extension OptionalSize where T == CGFloat {
public static var noIntrinsicMetric: Self {
.init(UIView.noIntrinsicMetric)
}
}
#endif

extension OptionalSize where T == Float {
public var cgFloatWidth: CGFloat? {
Expand Down
2 changes: 2 additions & 0 deletions Sources/Epoxy/CollectionView/CollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCollectionView
Expand Down Expand Up @@ -50,3 +51,4 @@ extension CollectionView {
contextMenuDelegate?.collectionView(self, willPerformPreviewActionForMenuWith: configuration, animator: animator)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCollectionView
Expand All @@ -28,3 +29,4 @@ extension AnyItemModel: RAKInternalItemModeling {
return config
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCollectionView
Expand Down Expand Up @@ -33,3 +34,4 @@ extension CollectionViewContextMenuDelegate {
animator _: UIContextMenuInteractionCommitAnimating
) { }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand Down Expand Up @@ -36,3 +37,4 @@ extension CallbackContextEpoxyModeled where Self: ContextMenuProviding {
copy(updating: willShowContextMenuProperty, to: value)
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCollectionView
Expand Down Expand Up @@ -49,3 +50,4 @@ extension ItemModel {
return view
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCollectionView
Expand All @@ -14,3 +15,4 @@ import EpoxyCollectionView
protocol RAKInternalItemModeling: InternalItemModeling {
func handleWillShowContextMenu(_ cell: ItemWrapperView, with metadata: ItemCellMetadata) -> UIContextMenuConfiguration?
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/CollectionView/Tools/EpoxyModeled+Padding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand All @@ -16,3 +17,4 @@ extension EpoxyModeled where Self: PaddingProviding {
padding(value.edgeInsets)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/BaseStyledEpoxyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand All @@ -26,3 +27,4 @@ open class BaseStyledEpoxyView<Style: Hashable>: RAKBase.BaseView, StyledView {
fatalError("init(coder:) has not been implemented")
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ButtonRow/AnyButtonImageContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS)
import UIKit

import RAKCore
Expand Down Expand Up @@ -57,3 +58,4 @@ extension AnyButtonImageContent: FastImageContentProviding {
.init(UIImage(systemName: name, withConfiguration: configuration))
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ButtonRow/ButtonImageContentProviding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS)
import UIKit

// MARK: - ButtonImageContentProviding
Expand Down Expand Up @@ -42,3 +43,4 @@ extension String: ButtonImageContentProviding {
}
}
}
#endif
4 changes: 3 additions & 1 deletion Sources/Epoxy/Row/ButtonRow/ButtonRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(tvOS) && !os(watchOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand Down Expand Up @@ -126,7 +127,7 @@ extension ButtonRow: StyledView {
addTarget(self, action: #selector(buttonDidTouchDown(_:)), for: .touchDown)
addTarget(self, action: #selector(buttonDidClick(_:)), for: .touchUpInside)

if #available(iOS 14.0, *) {
if #available(iOS 14.0, tvOS 14.0, *) {
addTarget(self, action: #selector(buttonDidTriggerMenuAction(_:)), for: .menuActionTriggered)
}
}
Expand Down Expand Up @@ -291,3 +292,4 @@ extension ButtonRow: BehaviorsConfigurableView {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ButtonRow/ButtonRowStateContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import RAKCore
Expand All @@ -22,3 +23,4 @@ protocol ButtonRowStateContent {
titleColor: ConvertibleToColor
)
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ImageRow/AnyImageContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS)
import UIKit

import RAKCore
Expand Down Expand Up @@ -57,3 +58,4 @@ extension AnyImageContent: FastImageContentProviding {
.init(UIImage(systemName: name, withConfiguration: configuration))
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ImageRow/ImageContentProviding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS)
import UIKit

// MARK: - ImageContentProviding
Expand Down Expand Up @@ -42,3 +43,4 @@ extension String: ImageContentProviding {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/ImageRow/ImageRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand Down Expand Up @@ -117,3 +118,4 @@ extension ImageRow: ContentConfigurableView {
// MARK: BehaviorsConfigurableView

extension ImageRow: BehaviorsConfigurableView { }
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/SwitchRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import Combine
Expand Down Expand Up @@ -128,3 +129,4 @@ extension SwitchRow: BehaviorsConfigurableView {
.store(in: &cancellable)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/TextFieldRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import Combine
Expand Down Expand Up @@ -198,3 +199,4 @@ extension TextFieldRow: UITextFieldDelegate {
textField.resignFirstResponder()
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Epoxy/Row/TextRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 RakuyoKit. All rights reserved.
//

#if !os(watchOS) && !os(tvOS) && !os(visionOS)
import UIKit

import EpoxyCore
Expand Down Expand Up @@ -103,3 +104,4 @@ extension TextRow: ContentConfigurableView {
// MARK: BehaviorsConfigurableView

extension TextRow: BehaviorsConfigurableView { }
#endif