Skip to content

Commit cb8e135

Browse files
authored
Update for 0.6.0 release (#4)
* Updated documentation * Added .relative to RectAnchor, deprecated edgeAnchors and vertexAchnors and added vertices CGRect point and points methods were all deprecated and replaced with subscripts that take RectAnchor. Added CGRect subscript that takes a RectAnchor and CornerStyle and returns a Corner. Added CGRect subscript that takes an array of (x: CGFloat, y: CGFloat) tuples containing relative locations and returns points. All references ro rect.point or rect.points were replaced with subscripts. Associated parameter label radius was removed from CornerStyle values to reduce verbose noise. Deprecated versions that continue to use the named radius parameter were added and deprecated to ease transition. All reference to CornerStyle radius associated parameter have had it removed to reduce verbose noise. Bugfix: the .corner method was changed so if nil is provided and the type is already a corner it will not replace the corner style. Added .interior and .exterior types to AnchorType Updated documentation on Vector2 to mention CGVector RelativeCornerShape file with unused concept was removed * Removed CGRect subscripts that included cornerstyles Added repositioned(to:) moved(:) and moved(dx:dy:) to CGRect Added rect(origin:) and rect(x:y:) to CGSize Added corner parameter to Vector2Representable that would keep existing corner or turn into a point style corner. Added corners parameter to arrays of Vector2Representable that would do the same to an array. Added rect(size:anchor:) and rect(width:height:anchor:) to CGPoint to easily create new rectangles * Changed EnumeratedCornerShape styles dictionary value type from CornerStyle? to CornerStyle Added bounds to Collection of Vector2Representable instead of just Array Deprecated anchorPoint function on Array of Vector2Representable as bounds[anchor] can be used instead Added relative(to:) to Vector2Representable to return a RectAnchor. Added relative(to:) to Array of Vector2Representable to return an Array of RectAnchor. Added rect(size:anchor:) and rect(width:height:anchor:) to Vector2Representable to return a CGRect. Removed rect(size:anchor:) and rect(width:height:) from CGPoint as it's now in Vector2Transformable. Added scaledPosition(:anchor:) to Vector2Transformable so that objects can be scaled based on a specific point. Deprecated scaledPosition(scale:) on Vector2Transformable as scaledPosition(:) can be used instead. Deprecated scaledPosition(width:height:) on Vector2Transformable as scaledPosition(x:y:) can be used instead. Added scaledPositions(:anchor:) to Array of Vector2Transformable so that objects can be scaled based on a specific point or anchor point relative to the bounds. Deprecated scaledPositions(scale:) on Array of Vector2Transformable as scaledPositions(:) can be used instead. Deprecated scaledPositions(width:height:) on Array of Vector2Transformable as scaledPositions(x:y:) can be used instead. Added moved(:to:) to Array of Vector2Transformable so points could be moved based on a RectAnchor from their bounds Added moved(:to:) to CGRect to move it based on a RectAnchor point. Added scaled(:anchor:) and scaled(x:y:anchor:) to CGRect to scale it using a RectAnchor as the anchor. Added rect(at:anchor:) to CGSize to create a rectangle with a specific anchor point located at a specific point. Added scaled(:) and scaled(_:_:) to CGSize to easily scale the size. Made corner style animatable on CornerRectangle, CornerPentagon and CornerTriangle. Added corner radius adjustment to Corner Example with animation. Removed internal update functions for Corner and CornerStyle animatable extensions. * Added VectorArray and AnimatableArray to make it easier to make an array of VectorArithmetic or Animatable types conform to VectorArithmetic or Animatable. Added VectorDictionary and AnimatableDictionary to make it easier to make a dictionary of VectorArithmetic or Animatable types conform to VectorArithmetic or Animatable. Made CornerTriangle, CornerRectangle, and CornerPentagon styles property animatable (nested corner styles are still not animatable) * Added .symmetrical corner style that allows for custom symmetrical corner styles using RelativeCorner Added RelativeCorner. A corner with position based on RectAnchor and a CornerStyle Added a setter to the radius property of CornerStyle and Corner Added relative(to:) to CGPoint to create a RectAnchor relative to Corner.Dimensions Added relative(to:) to Corner to create a RelativeCorner relative to Corner.Dimensions Removed relative(to:) from Vector2Representable Added relativeToRhombus(origin:uVector:vVector:) to CGPoint to create a RectAnchor relative to a rhombus. Added relativeToRhombus(origin:uVector:vVector:) to Corner to create a RelativeCorner relative to a rhombus. Added startVector, endVector and position(of:RectAnchor) to Corner.Dimensions Added Stylish protocol but not yet implemented Added Codable conformance to RectAnchor Renamed point(in:) to callAsFunction(in:) for RectAnchor Added crossProduct(with:) to Vector2Algebraic Moved rect(size:anchor:) and rect(width:height:anchor:) from Vector2Representable to CGPoint * Changed .symmetrical style to .custom to allow for non-symmetrical custom corner shapes Added CornerStylish protocol to keep a bunch of methods that apply to both Corner and RelativeCorner Added CGFrame as a way to describe any rhombus shaped frame with an origin and vectors for the x and y axes. Added a frame property to Corner.Dimensions Removed position(of:) method from Corner.Dimensions Replaced all relativeToRhombus(origin:uVector:vVector:) methods with relative(to:) that work with CGFrame Removed all relative(to:) functions that work with Corner.Dimensions Changed CornerStyle cornerStyles property so it can be set as well. Changed callAsFunction(in:) functions so that they are explicitly called point, points, corner and corners * Added RectangleExample3 Renamed CornerStylish to CornerStyled * Glass shape example * Gated code that's only compatible with Xcode 26 Refactored VectorArray, VectorDictionary, AnimatableArray and AnimatableDictionary Added extensions to Array or Dictionary of Animatable or VectorArithmetic types with an animatableData property Made 1 level of CornerStyle animatable. Added NestedAnimatable for creating reduced animatable properties for one nested level down. Added radiusOffset and relativeCorner properties to CornerStyle Made RelativeCorner animatable Made RectAnchor conform to VectorArithmetic Updated CornerRectangle, CornerTriangle, and CornerPentagon so their style properties are back to plain dictionaries. * Fixed corner example for iOS 18 and older Removed AnimatableArray and enamed VectorArray to AnimatableArray Removed AnimatableDictionary and enamed VectorDictionary to AnimatableDictionary Deleted commented-out code for conforming CornerStyle and RelativeCorner to VectorArithmetic * Updated CornerExample to toggle between regular and glass shapes * Moved NestedAnimatable to its own file. Updated documentation on RelativeCorner. * Rebuilt NotchStyle changing it from an enum to a struct that holds an array of RelativeCorner Existing triangle, rectangle and custom NotchStyle cases converted to static methods. Custom NotchStyle is deprecated and may not work correctly given the only way to create notches now is using RelativeCorner. Added Animatable conformance to NotchStyle and Notch Changed Notch properties from let to var Created a new init for Notch that takes an array of RelativeCorner Added relativeCorner methods to RectAnchor and arrays of rectAnchor Changed regular/glass toggle in CornerExample to use a button instead of a picker for easier multiplatform support Moved cornerStyles property from Array of Corner to Array of CornerStyled Added retroactive to Animatable conformance of Optional ConerStyle Fixed cornerStyles set method on CornerStyle so that it properly sets styles for relativeCorners Added corners(in:) methods to array of RelativeCorner * Added documentation and examples to AnimatableArray, AnimatableDictionary, AnimatablePack, and NestedAnimatable Added documentation to CGFrame, CGPoint and CGRect * Updated the readme with CGFrame and fixed a few typos Added documentation to a few methods and fixed a few typos Changed the properties on CGFrame to be public var instead of let * Updated the readme reorganizing thing to better explain ShapeUp Added subscripts to CGFrame for transforming between RectAnchor, ralative points and CGPoint Added subscripts to CGRect to get RectAnchor from CGPoint Reorganized CGFrame and CGRect subscripts for clarity Moved deprecated CGRect extensions to the bottom Added scaledPositions that use RectAnchor for Vector2TransformableArray Adjusted CGSize scaled method so it uses x and y like other similar methods. * Renamed AnimatablePack folder to Animatable * Fixed concave corner insetting so it works correctly for reflex angles Updated ShapeUpLogoView to work with new CGSize scaled method * Re-arranged the properties in RelativeCorner so the style goes at the end. Added inits for Corner where the style property is at the end and changed the existing ones to disfavoured overload so it won't be suggested. Added .custom option for Notch and NotchStyle for easy init and switching from existing Notch.custom * Removed the disfavoredOverloads and changed to soft deprecation so the old methods won't be suggested. * Changed most deprecations to soft deprecations. Updated Notch custom message to better describe how the function may not work as intended. * Added extra warnings for old custom notch styles * Fixed a bug where custom corners with empty arrays would not draw at all. Now they draw with a single point as the default. Updated CornerExample to move the inset slider to the bottom. * Changed NotchStyle back to an enum * Added handy static methods to RelativeCorner so it works almost like RectAnchor with style Added a .custom init for NotchStyle that uses relative corners without needing the array * Added easy RectAnchor style static methods to RelativeCorner so you can create an unstyled .topLeft. Added methods to quickly apply styles to CornerStyled types like .rounded(20). Added applyingStyle to EnumeratedCornerShape and Rectangle for applying a style to a single ShapeCorner Renamed RelativeShape to RelativeCornerShape and made it public. Changed x and y properties in the CGRect subscript so that they are labelled again. Removed anchorPoints init from .custom corner style as it can be handled with relative corners. Added corners methods to CGRect to quickly create arrays of Corner from arrays of RelativeCorner Fixed documentation on custom corner style so that it doesn't say it will mirror the points. Added clear glass to CornerExample * Added the radius parameter name back to all the corner styles. * Moved CornerStyled corner style method chaining to its own file. Added Notch method chaining for notch style. Removed the Notch init that takes relativeCorners made the style property in the default init optional defaulting to the rectangular notch. Soft deprecated all the NotchStyle static inits from Notch. * Updated a couple examples with the new Notch method chaining. * Removed corners methods from CGRect. Refactored AddOpenCornerShapeExample so it works with method chaining on rect subscripts instead of a single corners method. Updated some of the ShapeUpLogoView to remove some parentheses. * Added subscripts for generating Corner from CGRect. This removes the .corner after each rect[.topLeft] or similar. * Moved relative(to:) methods from individual types to the RelativeRepresentable protocol. Both CGPoint and Corner conform to this. Removed previously added Corner inits as they are no longer needed with method chaining. Moved corner methods from Vector2Representable and added them to their own protocol CornerRepresentable that CGPoint conforms to * Deleted CornerRepresentable and moved all point and corner parameters and methods back to Vector2Representable Updated Vector2Transformable scaledPositions methods so they return an array of Self instead of CGPoint. Added RectAnchorRepresentable and RectAnchorTransformable to allow RectAnchor types to be easily transformed with more appropriate methods than the Vector2 versions (but using Vector2 logic under the hood) Added RectAnchorTransformable conformance to RectAnchor and RelativeCorner Fixed init(closed:_:) on RelativeCornerShape so it better matches the other init. * Removed RectAnchorRepresentable. Added array extensions to RectAnchorTransformable. Added localBounds to RectAnchorTransformable arrays. Fixed flippedVertically method on Vector2Transformable arrays so that it works correctly. * Renamed "anchorPoint" to "anchor" for any RectAnchor type. It only remains when referring to a CGPoint based on an anchor. Added relativeToBounds to RelativeRepresentable * Updated documentation on RectAnchorTransformable. * CGRect extensions changed so subscript is only used for single points, corners or anchors. subscripts that returns arrays were changed to methods called points and corners for clarity. Added closed(_:) and applyingStyle(_:) methods to RelativeCornerShape to make it easier to adjust. BasicCompareExample updated to chevron Readme updated * Renamed points(_:) back to points(relativeLocations:) for clarity CornerStyle properties radiusOffset and relativeCorners changed to internal(set) as it should only be used for animatableData. Changed animatableData so it only stores an array of relativeCorners and not cornerStyles as well. Removed set option for cornerStyles as it is no longer needed. NotchStyle relativeCorners property changed to internal(set) as it should only be used for animatableData. Updated readme * Quick fix for concave radius inset problem. Result isn't perfect but it is a lot closer. There's still a problem with some angles greater than 90 degrees * Updated documentation. * Deprecated AngleType due to problems with equating float values. Added isApproximatelyStraight(tolerance:) to Corner.Dimensions to help with checks for straight angles. Fixed calculation errors when dealing with 180 degree (or close enough) corners. Fixed most issues with concave corners so they only draw incorrectly with reflex concave corners. * Bugfix: The last point in an array of inset points would not inset correctly. This especially caused a lot of issues with concave corner insetting. * Bugfix: relative corners and rect anchors would accidentally be translated to the rotation anchor when using rotated(). There still remains a bug with rotating arrays of RectAnchorTransformable * Bugfix: Concave corners now inset correctly! Changed the concave corner style so that it stores a concaveInset (same as the value used to inset it) instead of radiusOffset (the distance between the corner point and the concave radius center). This change means concave corners should look consistent even when their angles change. Lots of changes to the Corner.Dimensions static methods for concave corners. Added scalarProjection, parallelComponent and perpendicularComponent to Vector2Algebraic Updates to rotated and flipped methods on Vector2Transformable to account for values very close to zero Bugfix: Fixed an error that prevented the example app building on Xcode 16 Updated readme with change from radiusOffset to concaveInset * Added additional test cases and deleted tests for AngleType * Fixed issue with reflex concave corners not insetting correctly. * Fixed a bug where Vector2Algebraic perpendicularComponent was reversed. Added and updated documentation. * Added CornerArrayBuilder and RelativeCornerArrayBuilder so that CornerCustom, CornerShape and RelativeCornerShape can use trailing closures with ViewBuilder style syntax to list corners (no commas needed as the arrays are generated. * Renamed RelativeCornerShape to RelativeCornerCustom Adjusted code to use RelativeCorners.corners(in:) instead of rect.points(relativeLocations:) Updated CornerCustomExample to use new RelativeCornerCustom shape Added transformCorners, applyingStyle and applyingStyles methods to CornerCustom and transformRelativeCorners to RelativeCornerCustom * Updated documentation * Changed RelativeCorner so that it can now include an offset value. Updated RelativeCorner Animatable functionality to include this offset Removed RectAnchorTransformable from RelativeCorner and wrote specific transformationg functions that would take into account the offset Removed insetAnchor and any transform methods based on local anchors as I think they are overly complicated and not that usefull Added a default value for the rotation anchor of rotated(_:anchor:) and removed rotated(_:) from Vector2Transformable and RectAnchor Removed subscripts with arrays of points and anchors from CGFrame as it was already removed from CGRect Added build expressions to CornerArrayBuilder that error with RelativeCorner Added build expressions to RelativeCornerArrayBuilder that error with Corner Changed Corner.addingNotch so the cornerIndex default is zero. This allows for an easy way to add corners between two shapes. * Added path(closed:) method to arrays of CGPoint Changed Vector2Representable extensions so they only work on Array as they need to work on elements in the same order and Collection doesn't require that. Updated readme * Added CornerStylable for types that can have corner styles applied and left CornerStyled only for types that have a single corner style. Removed applyingStyle() from Corner and RelativeCorner as it is now in CornerStyled Removed use of .corner from AddOpenCornerShapeExample * Easy chainging of corner styles moved from CornerStylable to CornerStyled as it might be confusing when used on arrays without a more specific function name. Added CornerStylable to RelativeCornerShape and EnumeratedCornerShape Deprecated applyingStyle methods on Rectangle as it's a bit weird to use Rectangle in place of CornerRectangle. * Removed RectAnchorTransformable and moved extensions directly onto RectAnchor. * Replaced deprecated Rectangle exmaples with CornerRectangle * Changed moved method on RelativeCorner so that it takes RelatableValue. Removed the offset method. Added components to RelatableValue to easily get the absolute and relative components Added an custom method to Notch that takes a closure with RelativeCornerArrayBuilder Added an custom static method to NotchStyle that takes a closure with RelativeCornerArrayBuilder Added an init to Notch that has a trailing closure with RelativeCornerArrayBuilder Removed some extra methods on NotchStyle for creating triangle and rectangle notches. Updated Readme * Updated Readme * Fixed documentation on Vector2Transformable. Added documentation to RelativeCorner transformation methods. * Added extensions to Path for addOpenCornerShape and addClosedCornerShape that use a trailing CornerArrayBuilder closure. Updated Readme to better match previous adjustments Improved various example views in the example app to include code. * Updated readme * Added CGFrameRepresentable and moved shared code between CGFrame and CGRect inside RelativeCorner init matches Corner init starting with the style property Added RectAnchorArrayBuilder Fixed availability messages on Notch deprecations Removed Rectangle method that was added after the latest version and then deprecated (no need to keep it around) * RelativeCorner corner(in:CGRect) method updated to use CGFrameRepresentable CGFrame init fixed to remove unused anchor property RectAnchor hashable method adjusted so named enum location and relative locations that are the same hash as the same thing CGRect moved method fixed to account for initial origin position * Updated Readme to remove RectAnchor point subscript Updated Vector2Transformable repositioned(from:to:) to use CGFrameRepresentable Fixed bugs in AngleRepresentableTests * Change RelativeRepresentable to remove the repositioned method * Renamed applyingStyle to cornerStyle and applyingStyles to cornerStyles Conformed NotchStyle and Notch to CornerStylable Renamed applyingStyle on Notch to notchShape Removed Notch chaining methods for triangle, rectangle and custom Changed all deprecated messages so they deprecate immediately and not by version number. Adjusted the messaging to show the new notch methods * Documentation updates Collection of Relative corner now has a corners(in:) method that takes some CGFrameRepresentation instead of one for CGRect and one for CGFrame * Fixed Corners and RelativeCorners changing them back to struct from enum so it has an init Fixed NotchedPentagonExample * Changed Array<Animatable> extension from animatableData to elementAnimatableData to avoid potential conflicts with animatableData extension on Array<VectorArithmetic> Made animatableData and elementAnimatableData extensions public Fixed an error on a deprecation rename Fixed CGPoint.relative(to:) function so it works even if axes are colinear or if one has a zero length Added tests for CGPoint.relative(to:) * Fixed tvOS compilation by commenting out incompatible previews. Fixed visionOS example app compilation error due to missing Glass effect. * Documentation updates * Renamed animatableData to valueAnimatableData for Dictionaries with values that conform to Animatable. * Created an xcworkspace to easily run the tests and example app from the same place. Fixed some compiler errors and warnings on the package * Updated documentation * Added CHANGELOG Removed CaseIterable from RectAnchor Renamed notchShape to notchStyle Changed Corners to a typealias of [Corner] and RelativeCorners to a typealias of [RelativeCorner] Added cornerStyles to CornerCustom and deprecated the last applyingStyles method Added a static method to CornerStyle with custom corners with a trailing closure that builds relative corners. Added a custom corner example to the readme * Removed AnchorType completely. Updated changelog * Updated tests after AnchorType was removed. * RelativeRepresentable and the relative(to: some CGFrameRepresentable) method changed to internal. Array of CGPoint path(closed:) method removed as it was unused. Updated headers to match filenames. Updated readme. * Removed RelativeRepresentable but kept relative(to:) as an internal method on CGPoint and Corner Removed CGPoint.rect and CGSize.rect methods Removed CGRect.repositioned(to:) Moved CornerStylable to its own file Updated documentation Updated CHANGELOG * Updated README and CHANGELOG * Improved corner path drawing for all styles so it calculates correctly when inset with an angle of zero or 180 degrees. CornerInsetContinuityExample added to test this functionality. halfAngleSine, isApproximatelyZero and isApproximatelyStraight added to AngleRepresentable isApproximatelyStraight removed from Corner.Dimensions Corner.Dimensions deprecated Added tests for new AngleRepresentable methods, corner dimension path drawing and corner inset contiuity. * Documentation update * Updated subscript deprecation warnings so they nolonger use "renamed" as the fix doesn't work correctly with subscripts. * Notch may now be used inside CornerArrayBuilder * Added an automatic corner style that defaults to point and a defaultCornerStyle method that only replaces automatic styles. Changed CornerStylable protocol so it only requires one transformCornerStyles method and synthesizes cornerStyles, changingRadius, and defaultCornerStyle. * CornerStylable and CornerStyled APIs narrowed and mutating array helpers deprecated cornerStyle and changingRadius moved from CornerStylable to CornerStyled Mutating cornerstyle and notch helpers deprecated cornerStyles property on arrays of CornerStyled changed to read only Deprecated applyingStyles methods moved from protocols to their original types so they aren't being applied to extra types that they weren't previously Deprecation messaging clarified so that defaultCornerStyle is the preferred method for styling CornerStylable values unline applyingStyles that would replace all styles by default. Updated examples, documentation, changelog, and tests. * Updated deprecations, tests, and the changelog * Update to latest settings * Changing minimum swift tools version to 6.0 Changing OS compatibility to iOS 15+, macOS 12+, watchOS 8+, tvOS 15+, and visionOS 1+ * Renamed AnimatableProperties to AnimatableByProperty and removed all references to "fields". Cleaned up all places where types conforming to both VectorArithmetic and Animatable would have a conflicting property name. Updated all shapes that conform to Animatable so they now conform to AnimatableByProperty Updated readme, changelog and tests * AnimatableByProperty updated so it no longer has recursive properties. CornerStyle and RelativeCorner updated so they manually select a couple levels of recursion in their animatable properties. Build expressions for AnimatableByProperty removed as it can use the expressions for Animatable as it conforms to that and provides the same animatableData property. CGFrame public init added. * Array update changed so it updates elements in place. * Renamed AnimatableByProperty to AnimatableProperties Renamed AnimatableProperties to PropertyDescriptor Renamed AnimatablePropertiesBuilder to AnimatablePropertyBuilder * Bugfix for scalar projections onto vectors with zero length. * Public inits on various AnimatableProperty types changed to internal * Updated some example shapes so they use AnimatableProperties Updated Readme and documentation so AnimatableProperties is more clearly defined as the default tool for Animatable conformance. Updated AnimatableDictionary so it only updates existing properties. It no longer adds keys. Updated SketchyLine so more properties are animatable * Fixed a bug with Shape scaleToFit and added tests Updated documentation and changelog * Whitespace fixes * Add Swift compatibility CI Add GitHub Actions coverage that tests the package with Xcode 16.0, builds every supported Apple platform with Swift 6.0, and runs the macOS test suite on the current Xcode runner. The workflow runs for dev and main changes and cancels superseded runs. * Updated transformCorners function so it compiles in Swift 6.0 * Fixed traililng comma that crashes in Swift 6.0 * Updated CI to run OS tests on the current version and swift 6.0 compatibility only on macOS * Deprecated more methods to do with Corner dimensions Moved notchStyle method from Notch+chaining and deleted that file. Deleted unused CutoutLocation Changed RelativeCorner repositioned method to internal Changed concaveInset property to internal Updated deprecation messages on Notch static inits Deprecated more notch static inits * Made RectAnchor.relative(CGPoint) intarnal Added a documentation note to CGFrame subscript * Removed the subscript requirement from CGFrameRepresentable and added it to the extension Removed point(in: CGRect) and point(in: CGFrame) from RectAnchor and added point(in: some CGFrameRepresentable) Updated RelatableValue+Arithmatic extensions so it doesn't duplicate extensions provided by AdditiveArithmatic. Updated SketchyLines so all line properties are animated. Changed the drawAmount property to an optional so that lines can use their own draw amounts. Deprecated SketchyLine.path(in:drawAmount:) as it's no longer needed. Updated Shape.scaleToFit tests Deprecated Shape.scaleToFit(_:aspectRadio:) * Fixed documentation on Shape scaleToFit Added tests for SketchyLines * Added AnimatablePropertyGroup and AnimatablePropertyArray Adjusted how CornerStyle and RelativeCorner reference each other's properties. CornerStyle now references RelativeCorner directly while RelativeCorner accesses CornerStyle properties indirectly to avoid infinite recursion. They both use the new AnimatablePropertyGroup to isolate animatable values to specific styles. SketchyLine no longer animates other properties when the edge or draw direction change. * Added continuous corner rounding style to CornerStyle.rounded. The style works perfectly at 90 degrees and appears to work at other angles though the radius is not quite right. * Adjusted continuous corner rendering removing the exact match with SwiftUI continuous path elements (as they were just an approximation and did not match the rendered curve). Added a RoundedRectangleRendering test to the example app for demonstrating how a RoundedRectangle path is different from the elements of that path. Updated tests for continuous corner rendering. * Changed all groups to folders in the example app Deleted to empty Frameworks group from the example app * Updated minimum watchOS version to 9 * Updated continuous corner calculations with a new approach from Claude * Corner.Dimensions made internal instead of just deprecated. * Add Path.addContinuousCurve Updated the continuous curve logic Renamed halvedRadiusAngle to halvedTurnAngle throughout Added Angle.doubled Moved Corner.Dimensions..turnAngle out from the continuous corner specific code Removed two unused methods in Corner.Dimensions: absoluteRadius(radius:maxRadius:) and cutLength(absoluteRadius:halvedNonReflexAngle:) * Updated Corner and Continuous Corner examples in the app. It turns out the ShapeUp Continuous corner only matches the path elements of a SwiftUI continuous corner, not the final rendered output. * Moved the xcworkspace file inside the example app so Swift Package Index and xcodebuild-based CI build the package directly instead of resolving the wrong scheme. * Added corner curve measurement to the example app Added a continuous curve path obtained by a private api CGPathCreateWithContinuousRoundedRect * Refit the continuous corner profile to SwiftUI's rendered shape - Added ContinuousCornerRasterProbe, which measures a rendered shape from its raster alone. Accurate to 0.07 of a pixel, pinned by a test against an exact circle. - Refitted halfCurvatureSamples to that measurement - Restored the rendered rectangle comparison test. All six cases pass; two were failing because of the profile, not the test. - Remeasured the 90-degree boundary reference samples and updated related tests. - Added a test regenerating the Gauss-Legendre nodes and weights, so the recipe stays runnable if a different sample count is ever wanted. - Documented why the curvature is fitted rather than read off the path elements. - Documented Path.addContinuousCurve in the README and updated the continuous corner examples. - Updated documentation. * Added disfavoredOverload to RelatableValue * and / functions so they aren't ambiguous as RelatableValue is expressible by Int and CGFloat Updated latest xcode project settings Updated some documentation and formatting in the example app * Removed flattened and isFlat from Corner, Corner arrays and Dimensions as it is no longer used in any other calculations concave curve was fixed so the bezier version used the correct end control point. Previously it was using one on the previous line instead of using the previous point. Path.addContinuousCurve fixed so zero and 180 degrees collapse to straight lines. Fixed RelatableValue equatable and hashable so they use components meaning .absolut(x) == .mixed(absolute: x, relative: 0) and so on Fixed documentation issues Updated tests * Updated Changelog * Fixed some ambiguous cos and sin methods that tripped up Swift 6. Updated github actions so they can be triggered on demand (once the swift compatibility file is on the main thread) * Changed swift compatibility workflow so it only runs swift build on swift 6.0 instead of swift test Updated some tests for better type checking and clarity. * Added new NotchedCornerShapeExample Updated readme and docs * Updated changelog
1 parent 9a7b129 commit cb8e135

158 files changed

Lines changed: 10976 additions & 2181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Swift Compatibility
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- dev
8+
- main
9+
push:
10+
branches:
11+
- dev
12+
- main
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: swift-compatibility-${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
swift-6-0:
23+
name: Swift 6.0 compatibility
24+
runs-on: macos-15
25+
timeout-minutes: 15
26+
env:
27+
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
28+
29+
steps:
30+
- name: Check out repository
31+
uses: actions/checkout@v4
32+
33+
- name: Report toolchain
34+
run: |
35+
xcodebuild -version
36+
swift --version
37+
38+
# Only the library is built here. This job guards the minimum Swift
39+
# version the package claims to support, which is a promise about the
40+
# code consumers compile. The test target is exercised by the
41+
# current-swift job instead.
42+
- name: Build the library on macOS
43+
run: swift build
44+
45+
current-swift:
46+
name: Current Swift tests and platform builds
47+
runs-on: macos-26
48+
timeout-minutes: 45
49+
50+
steps:
51+
- name: Check out repository
52+
uses: actions/checkout@v4
53+
54+
- name: Report toolchain
55+
run: |
56+
xcodebuild -version
57+
swift --version
58+
59+
- name: Test on macOS
60+
run: swift test
61+
62+
- name: Build for iOS
63+
run: >-
64+
xcodebuild build
65+
-scheme ShapeUp
66+
-destination 'generic/platform=iOS'
67+
CODE_SIGNING_ALLOWED=NO
68+
69+
- name: Build for tvOS
70+
run: >-
71+
xcodebuild build
72+
-scheme ShapeUp
73+
-destination 'generic/platform=tvOS'
74+
CODE_SIGNING_ALLOWED=NO
75+
76+
- name: Build for watchOS
77+
run: >-
78+
xcodebuild build
79+
-scheme ShapeUp
80+
-destination 'generic/platform=watchOS'
81+
CODE_SIGNING_ALLOWED=NO
82+
83+
- name: Build for visionOS
84+
run: >-
85+
xcodebuild build
86+
-scheme ShapeUp
87+
-destination 'generic/platform=visionOS'
88+
CODE_SIGNING_ALLOWED=NO

‎.spi.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [ShapeUp]

‎.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎CHANGELOG.md‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Changelog
2+
3+
## 0.6.0 - 2026-08-19
4+
5+
Changes since the previous versioned release, `0.5.3`.
6+
7+
This release includes several source-breaking changes and a large number of deprecations. All deprecated APIs are scheduled for removal in `1.0.0`. Upgrade to `0.6.0` and resolve all deprecation warnings before moving to `1.0.0`.
8+
9+
This release introduces a new way to construct corner arrays and shapes using result builders, new relative anchors and corners that allow for custom corner styles, better custom notches, and animation support for almost every corner shape. It also fixes several insetting issues that mostly affected concave corners.
10+
11+
### Breaking Changes
12+
13+
- `CornerStyle.rounded` now includes a `style` associated value. Existing construction continues to default to `.circular`, but pattern matching this case must account for the new value.
14+
- Updated the package to Swift tools version 6.0 and raised the minimum supported versions to iOS 15, macOS 12, watchOS 9, and tvOS 15. The visionOS minimum remains version 1.
15+
- Changed `CornerStyle.concave(radius:radiusOffset:)` to `CornerStyle.concave(radius:concaveInset:)` to correct drawing errors and allow animation.
16+
- `CornerRectangle`, `CornerTriangle`, and `CornerPentagon` now use non-optional styles for each corner to support animation.
17+
- `NotchStyle.cornerStyles` now returns resolved, non-optional styles; stored nil values are represented by `.automatic`.
18+
- Replaced the closure-based `NotchStyle.custom(corners:)` enum case with `NotchStyle.custom(relativeCorners:)`. A deprecated factory converts closure-based custom notches when possible.
19+
- Changed the concrete `AnimatableData` associated types of existing animatable types, including `Corner`, `CornerStyle`, `CornerCustom`, `CornerRectangle`, `CornerTriangle`, `CornerPentagon`, `SketchyLine`, and `SketchyLines`, as their animated properties expanded.
20+
- `Corner.Dimensions` is now internal. This cached geometry type was an implementation detail of drawing and insetting, and keeping it public constrained how corners could be calculated. Use `[Corner].path(closed:)`, `[Corner].inset(by:previousPoint:nextPoint:)`, `Path.addOpenCornerShape`, or `Path.addClosedCornerShape` instead. The `Corner.dimensions(previousPoint:nextPoint:)` and `[Corner].dimensions` accessors are internal for the same reason.
21+
- Added cases to two public enums: `CornerStyle.automatic` and `CornerStyle.custom`, and `RectAnchor.relative`. Exhaustive switches over either type need to handle the new cases.
22+
- `SketchyLines.drawAmount` and its initializer parameter changed from `CGFloat` to `CGFloat?` so each `SketchyLine` keeps its own draw amount unless an override is supplied.
23+
- `RectAnchor` no longer conforms to `CaseIterable`.
24+
- `AnchorType` removed.
25+
26+
### New Features
27+
28+
- Added `CornerStyle.RoundingStyle` with `.circular` and `.continuous` options. `CornerStyle.rounded(radius:style:)` defaults to `.circular`. Continuous corners preserve the requested nominal radius with zero-curvature edge joins at any supplied angle and use a profile fitted to SwiftUI's continuous rounded corner at 90 degrees.
29+
- Added `Path.addContinuousCurve(tangent1End:tangent2End:radius:)`, a continuous-curve counterpart to SwiftUI's `Path.addArc(tangent1End:tangent2End:radius:)`. It draws the same curve continuous corners use, so a continuous corner can be added to any path without going through `Corner`.
30+
- Added a new case `RectAnchor.relative(x:y:)` for storing relative positions.
31+
- Added `RelativeCorner`, a type similar to `Corner` but with a `RectAnchor` position and an absolute offset along frame axes. It has convenience initializers similar to `RectAnchor` such as `.topLeft`, `.top`, `.right`, `.bottom`, `.center`, and `.relative(x:y:)`. Also, similar to `Corner` there are methods for moving, rotating, flipping, scaling, and changing corner styles for either single instances or arrays.
32+
- Added `RelativeCornerCustom`, a version of `CornerCustom` that uses relative corners and can take animated State variables within its closure creating an animatable shape.
33+
- Added `CornerStyle.automatic` which is the new default for all unstyled corners and will draw as a point by default. The new `defaultCornerStyle(_:)` method will update only corners with this automatic style.
34+
- Added `CornerStyle.custom(radius:relativeCorners:)` for custom corner styles based on array of relative corners.
35+
- Added a new `Notch` init with a trailing closure that builds a custom notch with relative corners.
36+
- Added `CornerArrayBuilder`, `RelativeCornerArrayBuilder`, and `RectAnchorArrayBuilder` for building `Corner`, `RelativeCorner`, and `RectAnchor` arrays using result builders. `CornerArrayBuilder` also accepts `Notch` values and expands them between their nearest surrounding corners.
37+
- Added `Corners` and `RelativeCorners` as typealiases for `[Corner]` and `[RelativeCorner]` with result builder inits to easily create arrays without comma-separated array literals.
38+
- Added `Path.addClosedCornerShape` that takes an array of corners or a `CornerArrayBuilder` closure and draws it as a closed shape.
39+
- Added a `Path.addOpenCornerShape` overload with a `CornerArrayBuilder` closure.
40+
- Added the `CornerStylable` protocol so default corner styles can be applied consistently to corners, relative corners, arrays of corners or relative corners, notches, enumerated shapes, and custom shapes. Conforming types implement `transformCornerStyles(_:)`, which provides `defaultCornerStyle(_:)` automatically.
41+
- Added the `CornerStyled` protocol to centralize the style property, `cornerStyle(_:)`, and `changingRadius(to:)` across `Corner` and `RelativeCorner`.
42+
- Added animatable support for `CornerStyle`, `Corner`, `RelativeCorner`, `RectAnchor`, `NotchStyle`, `Notch`, `CornerRectangle`, `CornerTriangle`, `CornerPentagon`, and `RelativeCornerCustom`.
43+
- Added `AnimatableProperties` that synthesizes `animatableData` from supplied writable key paths. It supports types that conform to `VectorArithmetic` or `Animatable` (including other `AnimatableProperties` types) and any `Optional` wrappers or `Array`/`Dictionary` collections of those types.
44+
- Added public `AnimatablePropertyGroup` for grouping properties that should animate only while a `Hashable` identifier remains unchanged. When the identifier changes, the grouped properties keep their current values instead of receiving interpolated data.
45+
- Added `AnimatableArray` and `AnimatableDictionary` helpers for animating arrays and dictionaries. Arrays expose public `animatableArray` and `animatableValueArray` properties, while dictionaries expose `animatableDictionary` and `animatableValueDictionary`.
46+
- Added `CGFrame` for describing coordinate frames with an origin, an x-axis vector, and a y-axis vector. This is used internally to draw custom corners at any angle, not just 90 degrees.
47+
- Added `Corner.relative(to:)` for converting a `Corner` into a `RelativeCorner` positioned in a `CGRect` or `CGFrame`.
48+
- Added `CGSize.scaled(_:)` and `CGSize.scaled(x:y:)` helpers.
49+
- Added `CGRect` move and scale helpers that use `RectAnchor` values as anchors.
50+
- Added `Vector2Algebraic.crossProduct(with:)`, `dotProduct(with:)`, `scalarProjection`, `parallelComponent`, and `perpendicularComponent`.
51+
- Added `AngleRepresentable.halfAngleSine`, `isApproximatelyZero(tolerance:)`, and `isApproximatelyStraight(tolerance:)` for half-angle geometry and angle checks that avoid floating-point equality.
52+
53+
### Changes
54+
55+
- Changed `NotchStyle.custom` from a stored closure into an array of relative corners so notches can participate in animation.
56+
- Changed `Notch` properties from constants to variables to allow animation and gave `Notch.init` a default `.rectangle` style.
57+
- Changed `CornerStyle.radius`, `concaveInset`, and related nested corner data to support animation updates.
58+
- `RectAnchor` now conforms to `Equatable`, `Hashable`, and `Codable`.
59+
- `RectAnchor` added `vertices` to replace deprecated `vertexAnchors`.
60+
- Changed `CGRect` point method `rect.point(.topLeft)` to a subscript `rect[.topLeft]`.
61+
- Changed `CGRect.point(relativeLocation:)` to a subscript `rect[x, y]`.
62+
- Replaced the `CGRect.points(relativeLocations:)` overloads with `points { }`, which uses `RectAnchorArrayBuilder` and accepts anchors such as `.topLeft`, `.relative(x:y:)`, or `(x, y)` tuples.
63+
- Changed the `CornerShape.corners(in:)` method to use `CornerArrayBuilder`.
64+
- Changed `CornerCustom` init to use `CornerArrayBuilder` and added a helper for `closed(_:)`.
65+
- Changed enumerated corner shape `styles` dictionaries to store non-optional `CornerStyle` values.
66+
- Updated `SketchyLines` to animate its lines. The shared draw amount now defaults to `nil`, preserving each `SketchyLine` draw amount unless an override is supplied.
67+
- Added a shared `ShapeUp.xcworkspace` and shared `ShapeUp Development` scheme for working with the package tests and example app from one workspace.
68+
- Updated the example app with new interactive shape examples that also show the code.
69+
- `RelatableValue` now compares by its absolute and relative components rather than by case, so `.absolute(5)` and `.mixed(absolute: 5, relative: 0)` are equal and hash equally. Adding values of different cases produces a `.mixed` result, so without this `value + .zero` did not equal `value`, breaking the `AdditiveArithmetic` and `VectorArithmetic` laws it relies on for animation.
70+
71+
### Deprecations
72+
73+
- Deprecated `CGRect` methods `point(_:)`, `point(relativeLocation:)`, and `points(relativeLocations:)`. Use subscript and builder-based APIs, such as `rect[anchor]`, `rect[x, y]`, and `rect.points { ... }`.
74+
- Deprecated `NotchStyle.custom(corners:)`. Use relative-corner-based `NotchStyle.custom { ... }` instead.
75+
- Deprecated notch factory methods like `Notch.rectangle(...)`, `Notch.triangle(...)`, and `Notch.custom(...)`. Instead use `Notch(...)`, `Notch(.triangle, ...)`, and `Notch(...) { }`.
76+
- Deprecated `applyingStyle` and `applyingStyles` in favor of `cornerStyle`, `defaultCornerStyle`, `transformCornerStyles`, and `cornerStyles` as appropriate. Array-wide style replacement remains available through deprecated compatibility methods but has no new `cornerStyle(_:)` equivalent.
77+
- Deprecated the mutating `[Corner].addNotch` and `addNotches` methods in favor of assigning the result of `addingNotch` and `addingNotches` back to the array.
78+
- `RectAnchor.edgeAnchors` and `RectAnchor.vertexAnchors` are deprecated in favor of `RectAnchor.vertices` and explicit anchor builders.
79+
- Deprecated the `Array<Vector2Representable>` method `anchorPoint(_:)` and property `center`. Use `bounds[anchor]` and `bounds[.center]` instead.
80+
- `Array<Vector2>` methods `scaledPositions(scale:)` and `scaledPositions(width:height:)` were renamed to `scaledPositions(_:)` and `scaledPositions(x:y:)`.
81+
- `AngleType` and `AngleRepresentable.type` are deprecated because equating angle classifications through floating-point values was error-prone. `AngleRepresentable.interior` is deprecated in favour of `nonReflexCoterminal.positive`.
82+
- The single-value `scaledPosition(scale:)` and `scaledPosition(width:height:)` were renamed to `scaledPosition(_:)` and `scaledPosition(x:y:)`, matching the array versions above.
83+
- `Rectangle.applyingStyle` convenience methods are deprecated in favor of using `CornerRectangle` instead.
84+
- Deprecated `SketchyLine.path(in:drawAmount:)`; set `drawAmount` on the line and call `path(in:)` instead.
85+
- Deprecated `Shape.scaleToFit(_:aspectRatio:)`. This was a very old method I haven't used in a long time. If you need this functionality use SwiftUI Shape's scale modifier and check the code for this method. This will be removed in the next major version.
86+
87+
### Bug Fixes
88+
89+
- Fixed concave corner insetting, including reflex-angle cases and inset radius behavior.
90+
- Fixed corner path drawing and insetting at zero and 180 degree angles for all corner styles.
91+
- Fixed an issue where the last point in an inset point array could be inset incorrectly.
92+
- Fixed `Shape.scaleToFit(_:aspectRatio:)` producing an incorrect horizontal scale when fitting a narrower aspect ratio into a wider frame.
93+
- Fixed visionOS example compilation where the glass effect API was unavailable.
94+
- Fixed transitions between different `CornerStyle` cases interpolating unrelated animation data, which could make custom subcorners slide in from the corner's start point. Different styles now switch immediately, while properties within the same style continue to animate.
95+
- Moved the xcworkspace file inside the example app so Swift Package Index and xcodebuild-based CI build the package directly instead of resolving the wrong scheme.
96+
97+
### Tests
98+
99+
- Expanded test coverage for corner construction, styling, paths, and insetting; relative coordinates and anchors; animation helpers; vector and angle math; and shape scaling.
100+
- Added coverage for `RelatableValue` equality, arithmetic, and animation conformances, and for the degenerate angles handled by `Path.addContinuousCurve`.

‎Example/ShapeUp.xcworkspace/contents.xcworkspacedata‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "2700"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "NO"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "CF2FE2EC26C7061A0040A985"
18+
BuildableName = "ShapeUpExample.app"
19+
BlueprintName = "ShapeUpExample"
20+
ReferencedContainer = "container:ShapeUpExample.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "ShapeUpTests"
36+
BuildableName = "ShapeUpTests"
37+
BlueprintName = "ShapeUpTests"
38+
ReferencedContainer = "container:..">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
</TestAction>
43+
<LaunchAction
44+
buildConfiguration = "Debug"
45+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
launchStyle = "0"
48+
useCustomWorkingDirectory = "NO"
49+
ignoresPersistentStateOnLaunch = "NO"
50+
debugDocumentVersioning = "YES"
51+
debugServiceExtension = "internal"
52+
allowLocationSimulation = "YES">
53+
<BuildableProductRunnable
54+
runnableDebuggingMode = "0">
55+
<BuildableReference
56+
BuildableIdentifier = "primary"
57+
BlueprintIdentifier = "CF2FE2EC26C7061A0040A985"
58+
BuildableName = "ShapeUpExample.app"
59+
BlueprintName = "ShapeUpExample"
60+
ReferencedContainer = "container:ShapeUpExample.xcodeproj">
61+
</BuildableReference>
62+
</BuildableProductRunnable>
63+
</LaunchAction>
64+
<ProfileAction
65+
buildConfiguration = "Release"
66+
shouldUseLaunchSchemeArgsEnv = "YES"
67+
savedToolIdentifier = ""
68+
useCustomWorkingDirectory = "NO"
69+
debugDocumentVersioning = "YES">
70+
<BuildableProductRunnable
71+
runnableDebuggingMode = "0">
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "CF2FE2EC26C7061A0040A985"
75+
BuildableName = "ShapeUpExample.app"
76+
BlueprintName = "ShapeUpExample"
77+
ReferencedContainer = "container:ShapeUpExample.xcodeproj">
78+
</BuildableReference>
79+
</BuildableProductRunnable>
80+
</ProfileAction>
81+
<AnalyzeAction
82+
buildConfiguration = "Debug">
83+
</AnalyzeAction>
84+
<ArchiveAction
85+
buildConfiguration = "Release"
86+
revealArchiveInOrganizer = "YES">
87+
</ArchiveAction>
88+
</Scheme>

0 commit comments

Comments
 (0)