diff --git a/Sources/geometrize/GeometrizeModelBase.swift b/Sources/geometrize/GeometrizeModelBase.swift
index 0180c7d..8f9b3f3 100644
--- a/Sources/geometrize/GeometrizeModelBase.swift
+++ b/Sources/geometrize/GeometrizeModelBase.swift
@@ -44,7 +44,7 @@ class GeometrizeModelBase {
/// - shape: The shape to draw.
/// - color: The color (including alpha) of the shape.
/// - Returns: Data about the shape drawn on the model.
- func draw(shape: any Shape, color: Rgba) -> ShapeResult {
+ func draw(shape: Shape, color: Rgba) -> ShapeResult {
let lines: [Scanline] = shape.rasterize(x: 0...width - 1, y: 0...height - 1)
let before: Bitmap = currentBitmap
currentBitmap.draw(lines: lines, color: color)
diff --git a/Sources/geometrize/SVGExporter.swift b/Sources/geometrize/SVGExporter.swift
index 1c16ba3..50f00dc 100644
--- a/Sources/geometrize/SVGExporter.swift
+++ b/Sources/geometrize/SVGExporter.swift
@@ -13,7 +13,7 @@ public struct SVGExporter {
/// - color: The color of the shape
/// - shape: The shape to convert to SVG data
/// - Returns: The SVG shape data for the given shape
- func singleShapeData(color: Rgba, shape: any Shape) -> String {
+ func singleShapeData(color: Rgba, shape: Shape) -> String {
var shapeData: String = shapeData(shape: shape)
var styles: String = ""
@@ -45,7 +45,7 @@ public struct SVGExporter {
/// - Returns: A string representing the SVG image.
func exportSingleShape( // swiftlint:disable:this function_parameter_count
color: Rgba,
- shape: any Shape,
+ shape: Shape,
width: Int,
height: Int,
originWidth: Int,
@@ -142,7 +142,7 @@ public struct SVGExporter {
""
}
- private func shapeData(shape: any Shape) -> String {
+ private func shapeData(shape: Shape) -> String {
switch shape {
case let rectangle as Rectangle:
return shapeData(rectangle: rectangle)
diff --git a/Sources/geometrize/ShapeAcceptancePrecondition.swift b/Sources/geometrize/ShapeAcceptancePrecondition.swift
index 7ee5604..8a92209 100644
--- a/Sources/geometrize/ShapeAcceptancePrecondition.swift
+++ b/Sources/geometrize/ShapeAcceptancePrecondition.swift
@@ -14,7 +14,7 @@ import Foundation
public typealias ShapeAcceptancePreconditionFunction = @Sendable (
_ lastScore: Double,
_ newScore: Double,
- _ shape: any Shape,
+ _ shape: Shape,
_ lines: [Scanline],
_ color: Rgba,
_ before: Bitmap,
@@ -25,7 +25,7 @@ public typealias ShapeAcceptancePreconditionFunction = @Sendable (
@Sendable public func defaultAddShapePrecondition( // swiftlint:disable:this function_parameter_count
lastScore: Double,
newScore: Double,
- shape: any Shape,
+ shape: Shape,
lines: [Scanline],
color: Rgba,
_: Bitmap,
diff --git a/Sources/geometrize/ShapeCreator.swift b/Sources/geometrize/ShapeCreator.swift
index fc7de4e..368f819 100644
--- a/Sources/geometrize/ShapeCreator.swift
+++ b/Sources/geometrize/ShapeCreator.swift
@@ -1,6 +1,6 @@
import Foundation
-public typealias ShapeCreator = @Sendable (inout SplitMix64) -> any Shape
+public typealias ShapeCreator = @Sendable (inout SplitMix64) -> Shape
/// Creates a function for creating instances of Shape. Returned instances should be set up!
/// - Parameters:
diff --git a/Sources/geometrize/ShapeResult.swift b/Sources/geometrize/ShapeResult.swift
index a5da152..11c6ff6 100644
--- a/Sources/geometrize/ShapeResult.swift
+++ b/Sources/geometrize/ShapeResult.swift
@@ -4,9 +4,9 @@ import Foundation
public struct ShapeResult {
public let score: Double
public let color: Rgba
- public let shape: any Shape
+ public let shape: Shape
- public init(score: Double, color: Rgba, shape: any Shape) {
+ public init(score: Double, color: Rgba, shape: Shape) {
self.score = score
self.color = color
self.shape = shape
diff --git a/Sources/geometrize/State.swift b/Sources/geometrize/State.swift
index 060bd71..8851ecd 100644
--- a/Sources/geometrize/State.swift
+++ b/Sources/geometrize/State.swift
@@ -2,7 +2,7 @@ import Foundation
struct State: Sendable {
- init(score: Double, alpha: UInt8, shape: some Shape) {
+ init(score: Double, alpha: UInt8, shape: Shape) {
self.score = score
self.alpha = alpha
self.shape = shape
@@ -15,7 +15,7 @@ struct State: Sendable {
let alpha: UInt8
/// The geometric primitive owned by the state.
- let shape: any Shape
+ let shape: Shape
/// Modifies the current state in a random fashion.
/// - Returns: new mutated state.
@@ -23,7 +23,7 @@ struct State: Sendable {
x xRange: ClosedRange, // TODO: rename
y yRange: ClosedRange, // TODO: rename
using generator: inout SplitMix64,
- score: ((any Shape) -> Double)
+ score: ((Shape) -> Double)
) -> State {
let mutatedShape = shape.mutate(x: xRange, y: yRange, using: &generator)
return State(score: score(mutatedShape), alpha: alpha, shape: mutatedShape)
diff --git a/Tests/geometrizeTests/hillClimbTests.swift b/Tests/geometrizeTests/hillClimbTests.swift
index e2518c8..8e19459 100644
--- a/Tests/geometrizeTests/hillClimbTests.swift
+++ b/Tests/geometrizeTests/hillClimbTests.swift
@@ -79,7 +79,7 @@ final class HillClimbTests: XCTestCase {
}
-func == (lhs: any Shape, rhs: any Shape) -> Bool {
+func == (lhs: Shape, rhs: Shape) -> Bool {
switch (lhs, rhs) {
case (let lhs as Circle, let rhs as Circle): return lhs == rhs
case (let lhs as Ellipse, let rhs as Ellipse): return lhs == rhs