Modernize CapsuleView for Swift 5 / current Xcode#1
Open
umarF wants to merge 1 commit into
Open
Conversation
Tier 1 — compile on modern toolchains + repo hygiene: - Replace deprecated APIs: UIViewAutoresizing -> UIView.AutoresizingMask, UIApplicationLaunchOptionsKey -> UIApplication.LaunchOptionsKey, @UIApplicationMain -> @main, bringSubview(toFront:) -> bringSubviewToFront(_:) - Remove needless force-unwraps and guard the borderColor/shadowColor getters against a nil CGColor (previously could crash) - Bump SWIFT_VERSION to 5.0 and deployment target to iOS 13 - Add .gitignore, untrack committed xcuserdata, update README Tier 2 — internal refactors (public API unchanged): - Collapse duplicate FontType/FontType2 into a single FontSize enum - De-duplicate the custom init by delegating to setupViewDynamic - Table-drive setAllignment via the existing TextAllignment enum - Make IBInspectable didSet observers nil-safe during storyboard decode CI: - Add shared CapsuleView scheme and a GitHub Actions macOS workflow that builds the project for the iOS Simulator Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0144VuLgTxYEpwYmGWwaCSPV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the 2018-era
CapsuleViewcomponent (Swift 4.0 / iOS 11) so it compiles on a current Xcode toolchain, removes some latent crashes, and de-duplicates internal logic. The public API is unchanged — existing Storyboard/programmatic usage keeps working.Scope was agreed as Tier 1 + Tier 2; the source-breaking renames (misspelled property names, enum-typed parameters, SwiftPM) were intentionally left out for a possible future major version.
Tier 1 — Compile on modern toolchains + repo hygiene
UIViewAutoresizing→UIView.AutoresizingMaskUIApplicationLaunchOptionsKey→UIApplication.LaunchOptionsKey@UIApplicationMain→@mainbringSubview(toFront:)→bringSubviewToFront(_:)(demo + README)self.label.text! = …,bgColor!) and guard theborderColor/shadowColorgetters against a nilCGColor— previously these could crash.SWIFT_VERSIONto 5.0 and deployment target to iOS 13; update Xcode upgrade-check markers..gitignore, untrack committedxcuserdata/(two users' UI state, breakpoints, schemes), update README (Swift 3.0+→Swift 5).Tier 2 — Internal refactors (non-breaking)
FontType/FontType2enums into oneFontSizeenum.init(...)by delegating tosetupViewDynamic(...).setAllignment()through the existing (previously unused)TextAllignmentenum instead of two magic-numberswitches.@IBInspectabledidSetobservers nil-safe during Storyboard decode ordering.CI / verification
This project is a UIKit app and cannot be built on a Linux environment, so I added:
CapsuleViewscheme (the old scheme lived in the now-untrackedxcuserdata)..github/workflows/ci.yml) that builds the project for the iOS Simulator on every push/PR tomaster.CapsuleViewTests/is not wired as a build target in the project, so CI runsbuildonly, nottest.🤖 Generated with Claude Code
Generated by Claude Code