fwcd / fwcd/swift-graphics

Simplify module and type naming scheme for library consumers

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
31
Forks
8
PR merge metrics
No merged PRs in 30d

Description

For the next major version, we may consider a new naming scheme that is simpler for downstream consumers, e.g.

- Modules
- `Graphics` -> `GraphicsBase`
- `PlatformGraphics` -> `Graphics` (re-exporting everything needed, including `Utils`)
- Types
- `Image` (+ `BufferedImage`) -> `ImageProtocol`
- `PlatformImage` -> `Image`

Ideally, we would want parity between the different backends and polyfill as needed, so that they can be used interchangeably. It should not matter whether a `CoreGraphicsImage` or a `CairoImage` is used and portable code should not have to deal with this distinction, i.e. `Image` should always refer to the "one true" image type.

Perhaps introducing a wrapper layer (e.g. have `Image` and `GraphicsContext` be shared types that internally uses a platform-specific backends) would be worth looking into, to avoid accidentally leaking platform-specific implementation details if the platform-specific types implement something not declared in the protocol. This might require renaming the protocol for clarity (e.g. `BackingImage`, `ImageBackend` or similar).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inventorying the existing Graphics, PlatformGraphics, Image, BufferedImage, PlatformImage, and backend types mentioned in the issue. Research whether a shared wrapper or renamed protocol can provide backend parity without leaking platform details; done requires an agreed naming scheme and portable Image and graphics types across CoreGraphics and Cairo backends.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
computer-graphics
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.