Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrelling committed Mar 4, 2024
1 parent d77de4e commit 20ea2c4
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Examples/BlendModes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct BlendMode_Previews: PreviewProvider {

static var previews: some View {
ScrollView {
LazyVGrid(columns: Self.columns, spacing: 40) {
LazyVGrid(columns: columns, spacing: 40) {
ForEach(BlendMode.allCases, id: \.self) { blendMode in
VStack {
Sphere(fill: .green)
Expand Down
4 changes: 2 additions & 2 deletions Sources/KippleFonts/Extensions/Font+Convenience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public extension UXFont {
static func printNamesAndVariations() {
familyNamesAndVariations.forEach { print($0) }
}

/// A wrapper around `familyName` that converts to a `String` on all platforms.
///
///
/// This is necessary because `NSFont.familyName` is optional, but `UIFont.familyName` is not.
/// On macOS, if a family name is not found, a value of `"Unknown"` is returned.
var safeFamilyName: String {
Expand Down
2 changes: 2 additions & 0 deletions Sources/KippleShaders/Extensions/Bundle+Convenience.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

import Foundation

extension Bundle {
Expand Down
16 changes: 9 additions & 7 deletions Sources/KippleShaders/Helpers/KippleShaderLibrary.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

import Metal
import MetalPerformanceShaders

final class KippleShaderLibrary {
// // MARK: Properties
//
//
// private var device: MTLDevice? {
// MTLCreateSystemDefaultDevice()
// }
//
//
// // Whether or not Metal Performance Shaders are supported.
// private var isMetalSupported: Bool {
// MPSSupportsMTLDevice(self.device)
// }
//
//
// // MARK: Methods
//
//
// func initialize() throws {
// // Ensure we can get a default device.
// guard let device else {
// assertionFailure("Unable to create system default Metal device")
// return
// }
//
//
// // Ensure the environment supports Metal Performance Shaders.
// guard self.isMetalSupported else {
// assertionFailure("Metal Performance Shaders are not supported")
// return
// }
//
//
// // Create the command queue.
// let _ = device.makeCommandQueue()
//
//
// // Create the default library.
// let _ = try device.makeDefaultLibrary(bundle: Bundle.kippleShaders)
// }
Expand Down
2 changes: 2 additions & 0 deletions Sources/KippleShaders/View+Checkerboard.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

import SwiftUI

private struct CheckerboardModifier: ViewModifier {
Expand Down
8 changes: 5 additions & 3 deletions Sources/KippleShaders/View+Pixellate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

import SwiftUI

//private struct PixellationModifier: ViewModifier {
// private struct PixellationModifier: ViewModifier {
// func body(content: Content) -> some View {
// content
// .foregroundStyle(.blue)
Expand All @@ -11,7 +13,7 @@ import SwiftUI
// maxSampleOffset: .zero
// )
// }
//}
// }

// MARK: - Extensions

Expand All @@ -22,7 +24,7 @@ public extension View {
name: "pixellate"
)
let shader = Shader(function: function, arguments: [
.float(10)
.float(10),
])
return self
.layerEffect(shader, maxSampleOffset: .zero, isEnabled: true)
Expand Down
2 changes: 1 addition & 1 deletion Sources/KippleShapes/Shapes/Hexagon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct Hexagon_Previews: PreviewProvider {
Hexagon(orientation: .horizontal)
.fill(.red)
.aspectRatio(contentMode: .fit)

Hexagon(orientation: .vertical)
.fill(.red)
.aspectRatio(contentMode: .fit)
Expand Down
1 change: 1 addition & 0 deletions Sources/KippleShapes/Shapes/PointedStar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public struct PointedStar: Shape {
}

// MARK: - Previews

struct Star_Previews: PreviewProvider {
static var previews: some View {
PointedStar()
Expand Down
2 changes: 1 addition & 1 deletion Sources/KippleShapes/Shapes/Quadrilateral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct Quadrilateral_Previews: PreviewProvider {
Quadrilateral()
.fill(.red)
.aspectRatio(contentMode: .fit)

Quadrilateral(points: [.topLeading, .top, .bottomTrailing, .bottomLeading])
.fill(.red)
.aspectRatio(contentMode: .fit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public extension View {

#if os(tvOS) || os(watchOS)

extension View {
public func navigationBarTitle(_ titleKey: LocalizedStringKey, displayMode: NavigationBarItem.TitleDisplayMode) -> some View {
public extension View {
func navigationBarTitle(_ titleKey: LocalizedStringKey, displayMode: NavigationBarItem.TitleDisplayMode) -> some View {
self.navigationTitle(titleKey)
}
}
Expand Down
20 changes: 11 additions & 9 deletions Sources/KippleUI/Kipple/ScaledBezier.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

//// Copyright © 2024 Brian Drelling. All rights reserved.
//
//import SwiftUI
// import SwiftUI
//
///// Draws a `UIBezierPath` within a SwiftUI `Shape` context.
/////
///// Source (with modifications): https://www.hackingwithswift.com/quick-start/swiftui/how-to-use-uibezierpath-and-cgpath-in-swiftui
//public struct ScaledBezier: Shape {
// public struct ScaledBezier: Shape {
// private let bezierPath: UIBezierPath
//
// public init(_ bezierPath: UIBezierPath) {
Expand All @@ -16,11 +18,11 @@
// let path = Path(bezierPath.cgPath)
// return path.scaled(to: rect)
// }
//}
// }
//
//// MARK: - Extensions
//
//public extension Path {
// public extension Path {
// func scaled(to rect: CGRect) -> Path {
// // Determine the scale of the current path
// let width = rect.width / boundingRect.width
Expand All @@ -35,20 +37,20 @@
// // Apply that scale and send back the result.
// return applying(transform)
// }
//}
// }
//
//// MARK: - Previews
//
//struct ScaledBezier_Previews: PreviewProvider {
// struct ScaledBezier_Previews: PreviewProvider {
// static var previews: some View {
// ScaledBezier(.cardiogram)
// .stroke(Color.white)
// .background(Color.blue)
// .frame(maxWidth: .infinity, maxHeight: .infinity)
// }
//}
// }
//
//private extension UIBezierPath {
// private extension UIBezierPath {
// static var cardiogram: UIBezierPath {
// let path = UIBezierPath()
// path.move(to: .init(x: 0, y: 0.5))
Expand All @@ -62,4 +64,4 @@
// path.addLine(to: .init(x: 1, y: 0.5))
// return path
// }
//}
// }
2 changes: 1 addition & 1 deletion Sources/KippleUI/Kipple/View+Copying.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ private struct CopyingModifier: ViewModifier {
@State private var isShowingPopover = false

private let text: String

#if os(iOS)
private let backgroundColor: Color = .init(uiColor: .secondarySystemBackground)
#elseif os(macOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public enum PreviewDeviceType: String {
case iPhone13ProMax = "iPhone 13 Pro Max"
// Temporarily disabled as it's not working in Xcode 13.4.1 by default.
case iPhoneSEGen3 = "iPhone SE (3rd generation)"

// iOS 16 (2022)
case iPhone14 = "iPhone 14"
case iPhone14Plus = "iPhone 14 Plus"
case iPhone14Pro = "iPhone 14 Pro"
case iPhone14ProMax = "iPhone 14 Pro Max"

// iOS 17 (2023)
case iPhone15 = "iPhone 15"
case iPhone15Plus = "iPhone 15 Plus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ struct PreviewBackground_Previews: PreviewProvider {
static var previews: some View {
GeometryReader { _ in
ZStack {
HStack(spacing: Self.spacing) {
VStack(spacing: Self.spacing) {
HStack(spacing: spacing) {
VStack(spacing: spacing) {
Text("Text")
.previewBackground()
Text("Text")
Expand All @@ -67,7 +67,7 @@ struct PreviewBackground_Previews: PreviewProvider {
.padding()
.previewBackground()

VStack(spacing: Self.spacing) {
VStack(spacing: spacing) {
Text("Text")
.previewBackground()
Text("Text")
Expand Down
10 changes: 6 additions & 4 deletions Tests/KippleShadersTests/MetalPerformanceShadersTests.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Copyright © 2024 Brian Drelling. All rights reserved.

@testable import KippleShaders
import Metal
import MetalPerformanceShaders
@testable import KippleShaders
import XCTest

/// Drop-in tests for ensuring Metal resources are found within the tested module.
final class MetalPerformanceShadersTests: XCTestCase {
// MARK: Properties

let bundle: Bundle = .kippleShaders

// MARK: Tests

/// Tests that the Bundle contains a `default.metallib` file, which is required to initialize the default library.
func testMetalResourcesExist() {
let path = self.bundle.path(forResource: "default", ofType: "metallib")
Expand Down
14 changes: 8 additions & 6 deletions Tests/KippleShadersTests/ShaderLibraryTests.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
//@testable import KippleShaders
//import XCTest
// Copyright © 2024 Brian Drelling. All rights reserved.

// @testable import KippleShaders
// import XCTest
//
//final class ShaderLibraryTests: XCTestCase {
// final class ShaderLibraryTests: XCTestCase {
// // MARK: Properties
//
//
// let bundle: Bundle = .kippleShaders
//
//
// // MARK: Tests
//
// func testInitialization() throws {
// try KippleShaderLibrary().initialize()
// }
//}
// }

0 comments on commit 20ea2c4

Please sign in to comment.