Remove dead code from the example app - #1906
Merged
Merged
Conversation
Nothing referenced any of this: - `AdvancedExampleViewController.makeButton(named:)` was private and had no caller. It also captured `self` strongly in its tap handler, so it was a retain cycle waiting for someone to call it. - `CameraInputBarAccessoryView.makeButton(named _:)` ignored the name it was given and hardcoded an SF Symbol. Its tap handler was replaced by `configure()` straight after, so the handler never ran either. It is now `makeCameraButton()` with no parameter. - `Sources/Resources/sound1.m4a` is byte-identical to `Sources/Sounds/sound1.m4a` and is in no build phase. - 13 image sets nothing loads. `mklogo` stays; the launch storyboard uses it. - `let topStackView = topStackView` shadowed the property with itself. - Three commented-out statements. `LaunchViewController` set a title on each section but never implemented `titleForHeaderInSection`, so "Examples" and "Support" never appeared. They do now. Its `didSelectRowAt` repeated the same three lines for each row; a `showDetail` helper replaces them, which removes the need for the `swiftlint:disable cyclomatic_complexity` pragma. That pragma did nothing regardless: `.swiftlint.yml` excludes `Example`, and `cyclomatic_complexity` is not in `only_rules`. Rows also deselect now. `ChatExampleTests` held an empty `testExample` plus empty `setUp` and `tearDown`. It now covers the `randomMessageType()` fallback. Also `MockSocket.shared` is a `let`, the availability check for iOS 14 in `SwiftUIExampleView` is gone (the target is 15.0), `messageList` is no longer pointlessly `lazy`, and a "patter" typo is fixed.
Kaspik
approved these changes
Aug 20, 2026
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.
Stacked on #1905. Review that one first; this PR targets its branch so the diff stays clean.
Removes code and resources that nothing references. No behaviour changes except the two noted at the end.
Dead code
AdvancedExampleViewController.makeButton(named:)private, no caller. Also capturedselfstrongly in its tap handler.CameraInputBarAccessoryView.makeButton(named _:)UIImage(systemName: "camera.fill").configure()then replaced itsonTouchUpInside, so the handler never ran. NowmakeCameraButton(), no parameter.Sources/Resources/sound1.m4aSources/Sounds/sound1.m4a(same MD5) and in no build phase.Dan-Leonard,Steve-Jobs,Tim-Cook,pin,ic_appstore,ic_camera,ic_info,ic_keyboard,ic_library,ic_like,ic_mic,ic_send,ic_typing.let topStackView = topStackViewmklogolooked unused from Swift but the launch storyboard references it, so it stays.Two small behaviour fixes
Section headers now appear.
LaunchViewController.Sectioncarried atitle— "Examples" and "Support" — but the controller never implementedtitleForHeaderInSection, so neither was ever drawn. Rows also deselect after a tap now.didSelectRowAtno longer repeats itself. Six of the eleven cases spelled out the same "wrap in a nav controller, thenshowDetailViewController" three-liner. AshowDetail(_:wrapInNavigationController:)helper replaces them.That repetition is what made the switch long enough to carry
// swiftlint:disable cyclomatic_complexity, which is now gone. It was doing nothing anyway —.swiftlint.ymlexcludesExample, andcyclomatic_complexityis not among itsonly_rules.Test
ChatExampleTestswas an emptytestExampleplus emptysetUp/tearDownoverrides. It now tests therandomMessageType()fallback that #1905 adds.Also
MockSocket.sharedbecomes alet; nothing reassigned it.SwiftUIExampleViewdropped itsif #available(iOS 14.0, *)branch and theIgnoresSafeAreawrapper around it. The deployment target is 15.0, so theelsewas unreachable.ChatViewController.messageListwaslazy var ... = [], which buys nothing on an empty array literal.Verification
Built for an iPhone 17 simulator (iOS 27). Both the new unit test and the UI test from #1905 pass, so all 8 examples still open and render.
🤖 Generated with Claude Code