Skip to content

Commit

Permalink
Fix warnings and renamed icons
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Apr 11, 2023
1 parent 890176f commit 783bded
Show file tree
Hide file tree
Showing 586 changed files with 49 additions and 63 deletions.
12 changes: 6 additions & 6 deletions Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public extension Checkbox where Label == EmptyView {
struct Checkbox_LibraryContent: LibraryContentProvider {
var views: [LibraryItem] {
LibraryItem(
Checkbox(isOn: .constant(false)) {
Checkbox(isOn: .constant(false), label: {
Text("Text")
},
}),
title: "Checkbox", category: .control
)
}
Expand All @@ -129,17 +129,17 @@ struct Checkbox_LibraryContent: LibraryContentProvider {
struct Checkbox_preview: PreviewProvider {
static var previews: some View {
VStack(spacing: 24) {
Checkbox(isOn: .constant(true)) {
Checkbox(isOn: .constant(true), label: {
Text("Text")
}
})

Checkbox(isOn: .constant(false), alignment: .leading, label: {
Text("Text")
})

Checkbox(isOn: .constant(true), alignment: .trailing) {
Checkbox(isOn: .constant(true), alignment: .trailing, label: {
Text("Text")
}
})

Checkbox("Text", isOn: .constant(false), alignment: .leading)

Expand Down
6 changes: 2 additions & 4 deletions Sources/OversizeUI/Controls/Select/MultiSelect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ public struct MultiSelect<Element: Equatable, Content, Selection>: View
}
let selectionItems = selectedIndexes.compactMap { data[$0] }
selection = selectionItems
}), label: {
content(data[index], isSelected)
})

) {
content(data[index], isSelected)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,56 +88,29 @@ public struct Icon: View {
}
}

public extension Image {
func icon(_ color: Color = Color.onSurfaceHighEmphasis) -> some View {
renderingMode(.template)
.foregroundColor(color)
}
}

public extension Image {
func icon(_ color: Color = Color.onSurfaceHighEmphasis, size: IconSizes) -> some View {
renderingMode(.template)
.resizable()
.foregroundColor(color)
.frame(width: size.rawValue, height: size.rawValue)
}
}
@available(tvOS, unavailable)
struct IconAsset_Previews: PreviewProvider {
static var previews: some View {
let grid = [GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem(),
GridItem()]

// public extension View {
// func iconOnSurface(_ surfaceStyle: SurfaceStyle = .secondary, surfaceSolor: Color? = nil) -> some View {
// Surface {
// self
// }
// .surfaceStyle(surfaceStyle)
// .surfaceBackgroundColor(surfaceSolor)
// .surfaceContentInsets(.xxSmall)
// }
// }
Button(role: .cancel, action: {}, label: {
Text("Text")
})
.buttonStyle(.borderedProminent)
.controlSize(.large)

// @available(tvOS, unavailable)
// struct IconAsset_Previews: PreviewProvider {
// static var previews: some View {
// let grid = [GridItem(),
// GridItem(),
// GridItem(),
// GridItem(),
// GridItem(),
// GridItem()]
//
// Button(role: .cancel, action: {}, label: {
// Text("Text")
// })
// .buttonStyle(.borderedProminent)
// .controlSize(.large)
//
// LazyVGrid(columns: grid) {
// ForEach(IconsNames.allCases, id: \.self) { icon in
// Icon(icon)
// .padding(.vertical)
// }
// }
// .padding()
// .previewLayout(.sizeThatFits)
// }
// }
LazyVGrid(columns: grid) {
ForEach(IconsNames.allCases, id: \.self) { icon in
Icon(icon)
.padding(.vertical)
}
}
.padding()
.previewLayout(.sizeThatFits)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ extension Color: RawRepresentable {
self = .blue
return
}

do {
let color = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? UIColor ?? .blue
let color = try NSKeyedUnarchiver.unarchivedObject(ofClass: UIColor.self, from: data) ?? .blue
self = Color(color)
} catch {
self = .black
Expand Down
16 changes: 16 additions & 0 deletions Sources/OversizeUI/Extensions/Image/Image+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,19 @@ public extension Image {
.frame(width: width, height: height)
}
}

public extension Image {
func icon(_ color: Color = Color.onSurfaceHighEmphasis) -> some View {
renderingMode(.template)
.foregroundColor(color)
}
}

public extension Image {
func icon(_ color: Color = Color.onSurfaceHighEmphasis, size: IconSizes) -> some View {
renderingMode(.template)
.resizable()
.foregroundColor(color)
.frame(width: size.rawValue, height: size.rawValue)
}
}
Loading

0 comments on commit 783bded

Please sign in to comment.