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

fix: 🐛 [JIRA: HCPSDKFIORIUIKIT-2822] warning clean-up #919

Merged
merged 2 commits into from
Dec 2, 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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct MasonryTestView: View {
}
}

extension VerticalAlignment: Hashable {
extension VerticalAlignment: @retroactive Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ let threeRowTwoColumnWithAcc = TableModel(headerData: nil, rowData: [row1WithAcc

let row1WithAlignment = TableRowItem(data: [DataTextItem("Leading", Font.fiori(forTextStyle: .title1)), DataTextItem("C"), DataImageItem(Image("wheel"))])
let row2WithAlignment = TableRowItem(data: [DataTextItem("Leading", Font.title), DataImageItem(Image("wheel")), DataTextItem("Trailing Trailing")])
let row3WithAlignment = TableRowItem(data: [DataImageItem(Image("wheel")), DataTextItem("Center Center"), DataTextItem("Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing end", Font.fioriCondensed(forTextStyle: .title1))])
let row3WithAlignment = TableRowItem(data: [DataImageItem(Image("wheel")), DataTextItem("Center Center"), DataTextItem("Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing Trailing end", Font.fiori(forTextStyle: .title1))])

let row1WithDate = TableRowItem(data: [DataTextItem("Hello", Font.headline, Color.orange), DataImageItem(Image("wheel")), DataDateItem(Date(timeIntervalSince1970: 1), Font.largeTitle, Color.preferredColor(.chart2)), DataTimeItem(Date(timeIntervalSince1970: 1), Font.headline, Color.purple), DataDurationItem(3000, Font.footnote, Color.preferredColor(.secondaryLabel)), DataListItem("San Jose")])
let row2WithDate = TableRowItem(data: [DataImageItem(Image("wheel")), DataTextItem("World"), DataDateItem(Date(timeIntervalSinceReferenceDate: 1), Font.title2), DataTimeItem(Date(timeIntervalSinceReferenceDate: 1000)), DataDurationItem(23000), DataListItem("New York", Font.headline)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import FioriCharts
import FioriSwiftUICore
import SwiftUI

struct MyCustomTagStyle: TagStyle {
func makeBody(_ configuration: TagConfiguration) -> some View {
Tag(configuration)
.foregroundStyle(Color.cyan)
.background {
ZStack {
RoundedRectangle(cornerRadius: 4).fill(Color.yellow)
RoundedRectangle(cornerRadius: 4).stroke(Color.red, lineWidth: 0.5)
}
}
}
}

struct ObjectHeaderTestApp: View {
var body: some View {
let header = ObjectHeader(title: {
Expand All @@ -10,9 +23,7 @@ struct ObjectHeaderTestApp: View {
Text("Job 819701")
}, tags: {
Tag("I am selected")
.tagStyle(CustomTagStyle(textColor: Color(UIColor.cyan),
fillColor: Color(UIColor.yellow),
borderColor: Color.red))
.tagStyle(MyCustomTagStyle())
Tag("Tag1")
Tag("Tag2")
}, bodyText: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ class ImageSaver: NSObject {
let hostingController = UIHostingController(rootView: self)

hostingController.view.frame = CGRect(x: 0, y: CGFloat(Int.max), width: 1, height: 1)
UIApplication.shared.windows.first!.rootViewController?.view.addSubview(hostingController.view)
let window = UIApplication
.shared
.connectedScenes
.compactMap { ($0 as? UIWindowScene)?.keyWindow }
.last
if let rootView = window?.rootViewController?.view {
rootView.addSubview(hostingController.view)
}
let size = hostingController.sizeThatFits(in: UIScreen.main.bounds.size)
hostingController.view.bounds = CGRect(origin: .zero, size: size)
hostingController.view.sizeToFit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ struct ToolbarView: View {

#Preview {
NavigationStack {
let a = "Extra Extra Extra Long Long Long Long Long Helper Text"
ToolbarView(numberOfButtons: .constant(2), useFioriToolbar: .constant(true), helperText: .constant("6768"), customHelperText: .constant(true), moreActionOverflowIcon: .constant(false), primaryButtonText: .constant(""), secondaryButtonText: .constant(""), thirdButtonText: .constant(""), buttonType: .constant(.fiori))
}
}
4 changes: 2 additions & 2 deletions Apps/Examples/Examples/FioriThemeManager/72-Fonts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ extension FioriFonts {
}
}

extension Font.FioriWeight: CaseIterable {
extension Font.FioriWeight: @retroactive CaseIterable {
public static var allCases: [Font.FioriWeight] {
[.black, .heavy, .bold, .semibold, .semiboldDuplex, .medium, .regular, .light, .thin, .ultraLight]
}
}

extension Font.Weight: CustomStringConvertible {
extension Font.Weight: @retroactive CustomStringConvertible {
public var description: String {
let name: String

Expand Down
2 changes: 1 addition & 1 deletion Apps/Examples/Examples/FioriThemeManager/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct CustomColors: View {
switch self.testData {
case .customPalette:
Text("Here a custom palette provides random colors for all ColorStyles")
case .programmatic(_), .styleSheet:
case .programmatic(_, _), .styleSheet:
Text("ℹ️ primaryLabel color was overridden (other colors come from .latest palette)")
}
ForEach(self.colorStyles,
Expand Down
9 changes: 4 additions & 5 deletions Sources/FioriSwiftUICore/Views/MHStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct MHStack<T: TagViewList>: View {
EmptyView()
} else {
GeometryReader { geometry in
self.makeBody(in: geometry)
self.makeBody(in: geometry.size.width)
}
.frame(height: self.mainViewSize.height < 0 ? nil : self.mainViewSize.height)
}
Expand All @@ -63,12 +63,11 @@ public struct MHStack<T: TagViewList>: View {

return min(limit, self.tags.count)
}

func makeBody(in g: GeometryProxy) -> some View {
func makeBody(in containerWidth: CGFloat) -> some View {
var width = CGFloat.zero
var height = CGFloat.zero
var tmpMainViewSize: CGSize = .zero

return ZStack(alignment: .topLeading) {
ForEach(0 ..< self.tagCount, id: \.self) { index in
self.tags.view(at: index)
Expand All @@ -78,7 +77,7 @@ public struct MHStack<T: TagViewList>: View {
tmpMainViewSize = .zero
}

if abs(width - d.width) > g.size.width {
if abs(width - d.width) > containerWidth {
width = 0
height = -(tmpMainViewSize.height + self.lineSpacing)
}
Expand Down
10 changes: 0 additions & 10 deletions Sources/FioriSwiftUICore/Views/_SideBar+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ public struct ExpandableList<Data, Row, Destination>: View where Data: RandomAcc
rowContent: rowContent(item),
selectionBinding: selection)
.environment(\.sideBarListItemConfigMode, SideBarListItemConfig(isSelected: true, isHeaderContent: false))
.overlay(NavigationLink(destination: destination(item),
tag: item,
selection: selection,
label: { EmptyView() })
.buttonStyle(PlainButtonStyle()))
} else {
RowContentContainer<Data, Row>(item: item,
rowContent: rowContent(item),
Expand Down Expand Up @@ -200,11 +195,6 @@ public extension ExpandableList where Row == _SideBarListItem<_ConditionalConten
_SideBarListItem(model: rowModel(item))
.modifier(ListItemBackgroundSelectionStyle())
.environment(\.sideBarListItemConfigMode, SideBarListItemConfig(isSelected: true, isHeaderContent: false))
.overlay(NavigationLink(destination: destination(item),
tag: item,
selection: selection,
label: { EmptyView() })
.buttonStyle(PlainButtonStyle()))
.contentShape(Rectangle())
.onTapGesture {
selection.wrappedValue = item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public struct TagBaseStyle: TagStyle {
@ViewBuilder
public func makeBody(_ configuration: TagConfiguration) -> some View {
configuration.tag
.padding(EdgeInsets(top: 2, leading: 3, bottom: 2, trailing: 3))
}
}

Expand All @@ -24,7 +25,6 @@ public struct TagFioriStyle: TagStyle {
.font(.fiori(forTextStyle: .footnote))
.foregroundStyle(isLight ? Color.preferredColor(.secondaryLabel) : Color.preferredColor(.primaryLabel, background: .darkConstant))
.lineLimit(self.tagLimit)
.padding(EdgeInsets(top: 2, leading: 3, bottom: 2, trailing: 3))
.background(background)
}
}
Expand Down Expand Up @@ -56,7 +56,6 @@ public struct LightTagStyle: TagStyle {
.font(.fiori(forTextStyle: .footnote))
.foregroundColor(.preferredColor(.secondaryLabel))
.lineLimit(1)
.padding(EdgeInsets(top: 2, leading: 3, bottom: 2, trailing: 3))
.background(RoundedRectangle(cornerRadius: 8).stroke(Color.preferredColor(.quaternaryLabel), lineWidth: 0.5))
}
}
Expand All @@ -72,7 +71,6 @@ public struct DarkTagStyle: TagStyle {
.font(.fiori(forTextStyle: .footnote))
.foregroundColor(.preferredColor(.primaryLabel, background: .darkConstant))
.lineLimit(1)
.padding(EdgeInsets(top: 2, leading: 3, bottom: 2, trailing: 3))
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.tertiaryLabel)))
}
}
Expand Down
Loading