Skip to content

Fix Xcode 27 warnings in SwiftUI App template - #68

Merged
jmarek41 merged 3 commits into
mainfrom
fix/template-xcode27-warnings
Sep 7, 2026
Merged

jmarek41 merged 3 commits into
mainfrom
fix/template-xcode27-warnings

Conversation

@jmarek41

@jmarek41 jmarek41 commented Sep 4, 2026 •

Copy link
Copy Markdown
Member
  • Assign the weak capture explicitly ([weak instance = instance]) to silence the Swift 6.4 #ImplicitStrongCapture warning in ExampleFlowCoordinator.
  • Enable INFOPLIST_KEY_UILaunchScreen_Generation, as Apple's SwiftUI App template does, and drop the #warning asking to add UILaunchScreen manually.
  • Format all template sources with the iOS-project-template .swiftformat / .swiftlint.yml and switch to Apple's //___FILEHEADER___ form, so the first build of a generated project no longer rewrites 20 files. Verified by generating a project, linking FuturedKit locally and building with Xcode 27: build succeeds, the only compiler warning is the intended build-phase reorder #warning.

jmarek41 and others added 2 commits September 4, 2026 09:12
Swift 6.4 warns when a nested closure captures a value weakly while the
enclosing @ViewBuilder closure captures it strongly by implication
(#ImplicitStrongCapture). Assign the capture explicitly to silence it.

Enable INFOPLIST_KEY_UILaunchScreen_Generation, as Apple's own SwiftUI
App template does, so generated projects run full screen without a
manual Info.plist edit, and drop the #warning that asked for it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A project created from the template had 18 files rewritten by the
SwiftFormat phase and 2 more by swiftlint --fix on the first build.
Apply the same formatting to the template sources so the first build
changes nothing.

- Use Apple's //___FILEHEADER___ form; the two-space variant expanded
  to a first header line with trailing whitespace in every file.
- Remove redundant self, unused argument names, empty-body line breaks,
  indent #if DEBUG blocks, implicit returns, sorted imports.
- MARK comments without dash, trailing closures, StateInfoConfig init
  with defaulted parameters last (project SwiftLint rules).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jmarek41
jmarek41 requested review from ssestak and a lite review from Copilot September 4, 2026 08:09
@jmarek41
jmarek41 enabled auto-merge September 4, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are template-focused, compile-safe formatting/warning fixes with no functional logic regressions identified in the updated template sources.

Pull request overview

Updates the SwiftUI App (and related) Xcode templates to match Apple’s current template defaults and the repo’s formatting/linting rules, reducing first-build churn and silencing new Xcode/Swift warnings in generated projects.

Changes:

  • Silence Swift 6.4 implicit strong capture warning in the template ExampleFlowCoordinator by explicitly binding a weak capture ([weak instance = instance]).
  • Enable automatic launch screen generation via INFOPLIST_KEY_UILaunchScreen_Generation and remove the template warning instructing manual UILaunchScreen setup.
  • Apply consistent SwiftFormat/SwiftLint-driven formatting across template sources (including switching to //___FILEHEADER___).
File summaries
File Description
Templates/Tab Coordinator.xctemplate/___VARIABLE_tabCoordinatorIdentifier___TabCoordinator.swift Aligns header + removes unnecessary @ViewBuilder attribute on rootView.
Templates/SwiftUI App.xctemplate/TemplateInfo.plist Enables INFOPLIST_KEY_UILaunchScreen_Generation=YES in template shared settings.
Templates/SwiftUI App.xctemplate/StateInfoView.swift Reorders config init usage and reformats previews/action initializers.
Templates/SwiftUI App.xctemplate/StateInfoConfig.swift Reorders initializer parameters to place title first and formats header.
Templates/SwiftUI App.xctemplate/Mockable.swift Normalizes file header formatting.
Templates/SwiftUI App.xctemplate/ItemStateView.swift Formatting-only tweaks (property assignment style, headers).
Templates/SwiftUI App.xctemplate/ItemState.swift Normalizes file header formatting.
Templates/SwiftUI App.xctemplate/ExampleFlowCoordinator.swift Fixes implicit strong capture warning by explicitly binding a weak capture.
Templates/SwiftUI App.xctemplate/ExampleComponentModel.swift Formatting cleanup (blank line removal, preview mock indentation).
Templates/SwiftUI App.xctemplate/ExampleComponent.swift Preview formatting and header normalization.
Templates/SwiftUI App.xctemplate/ExampleCacheProjection.swift Header normalization.
Templates/SwiftUI App.xctemplate/DataCacheModel.swift Converts section comment to doc comment and normalizes header.
Templates/SwiftUI App.xctemplate/Container.swift Formatting-only (self. removal) and header normalization.
Templates/SwiftUI App.xctemplate/ComponentStateView.swift MARK formatting + minor initializer callsite formatting (incl. trailing closure).
Templates/SwiftUI App.xctemplate/ComponentState.swift Formatting-only (expanded if case, shorthand returns) and header normalization.
Templates/SwiftUI App.xctemplate/CacheProjection.swift Avoids unused-parameter warnings by using _ names in default impl.
Templates/SwiftUI App.xctemplate/AppDelegate.swift Avoids unused parameter warning (_: UIApplication) and formatting.
Templates/SwiftUI App.xctemplate/AppCoordinator.swift Avoids unused parameter warning (with _:) and formatting.
Templates/SwiftUI App.xctemplate/App.swift Removes obsolete UILaunchScreen warning, keeps build-phase reorder warning, formatting cleanup.
Templates/Service.xctemplate/VARIABLE_serviceIdentifier.swift Compacts empty protocol/class bodies and normalizes header.
Templates/SceneFlowProvider.xctemplate/___VARIABLE_sceneFlowProviderIdentifier___SceneFlowProvider.swift Comment indentation/formatting and header normalization.
Templates/Scene.xctemplate/Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___ComponentModel.swift Formatting cleanup (blank line removal, preview mock indentation).
Templates/Scene.xctemplate/Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___Component.swift Preview formatting and header normalization.
Templates/Scene.xctemplate/Resource Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___Resource.swift Compacts empty protocol/struct bodies and normalizes header.
Templates/Scene.xctemplate/Resource Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___ComponentModel.swift Formatting cleanup (blank line removal, preview mock indentation).
Templates/Scene.xctemplate/Resource Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___Component.swift Preview formatting and header normalization.
Templates/Scene.xctemplate/Projection Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___ComponentModel.swift Formatting cleanup (blank line removal, preview mock indentation).
Templates/Scene.xctemplate/Projection Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___Component.swift Preview formatting and header normalization.
Templates/Scene.xctemplate/Projection Scene/VARIABLE_sceneIdentifier/___VARIABLE_sceneIdentifier___CacheProjection.swift Avoids unused-parameter warnings (from _) and normalizes header.
Templates/Flow Coordinator.xctemplate/___VARIABLE_flowCoordinatorIdentifier___FlowCoordinator.swift Header normalization.
Review details
  • Files reviewed: 21/30 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jmarek41
jmarek41 merged commit 48ea777 into main Sep 7, 2026
1 check passed
@jmarek41
jmarek41 deleted the fix/template-xcode27-warnings branch September 7, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants