-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into clean-up-system-property-enableSBS-from-beta.33
- Loading branch information
Showing
6 changed files
with
129 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Sources/MapboxSearchUI/PreviewCategoriesFavoritesSegmentControl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright © 2024 Mapbox. All rights reserved. | ||
|
||
import Foundation | ||
|
||
#if canImport(SwiftUI) && DEBUG | ||
import SwiftUI | ||
|
||
@available(iOS 13.0, *) | ||
struct TabsSegmentControlRepresentable: UIViewRepresentable { | ||
func makeUIView(context: Context) -> UIView { | ||
let segmentControl: CategoriesFavoritesSegmentControl = UINib( | ||
nibName: "CategoriesFavoritesSegmentControl", | ||
bundle: .mapboxSearchUI | ||
) | ||
.instantiate(withOwner: nil, options: nil)[0] as! CategoriesFavoritesSegmentControl | ||
// swiftlint:disable:previous force_cast | ||
|
||
segmentControl.configuration = Configuration() | ||
|
||
return segmentControl | ||
} | ||
|
||
func updateUIView(_ view: UIView, context: Context) {} | ||
} | ||
|
||
@available(iOS 13.0, *) | ||
struct CategoriesFavoritesSegmentControlPreview: PreviewProvider { | ||
static var previews: some View { | ||
Group { | ||
TabsSegmentControlRepresentable() | ||
.previewDisplayName("Light Mode") | ||
.previewLayout(PreviewLayout.fixed(width: 202, height: 28)) | ||
TabsSegmentControlRepresentable() | ||
.previewDisplayName("Dark Mode") | ||
.preferredColorScheme(.dark) | ||
.previewLayout(PreviewLayout.fixed(width: 202, height: 28)) | ||
.previewLayout(.sizeThatFits) | ||
TabsSegmentControlRepresentable() | ||
.previewDisplayName("Right to Left") | ||
.previewLayout(PreviewLayout.fixed(width: 202, height: 28)) | ||
.environment(\.layoutDirection, .rightToLeft) | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters