Skip to content

Commit ff2d1cc

Browse files
dadachiclaude
andcommitted
Add SwiftFormat, restructure SwiftLint, and fix Sendable warnings
Replace Xcode build phase SwiftLint with CLI-based enforcement via GitHub Actions CI. Add SwiftFormat for consistent code formatting with .swiftformat config. Move .swiftlint.yml from NativeAppTemplate/ subdirectory to repository root with simplified rules. Add CHANGELOG.md following Keep a Changelog format. Fix Swift 6 Sendable capture warnings in NFCManager and ItemTagDetailViewModel using @preconcurrency import and nonisolated(unsafe). Fix ambiguous #require macro calls in test assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1f42723 commit ff2d1cc

204 files changed

Lines changed: 15221 additions & 15563 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.

.github/workflows/swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
paths:
66
- '.github/workflows/swiftlint.yml'
7-
- 'NativeAppTemplate/.swiftlint.yml'
7+
- '.swiftlint.yml'
88
- 'NativeAppTemplate/**/*.swift'
99

1010
jobs:

.swiftformat

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SwiftFormat Configuration for NativeAppTemplate
2+
3+
# Swift version
4+
--swiftversion 6.0
5+
6+
# Indentation
7+
--indent 4
8+
--indentcase false
9+
--trimwhitespace always
10+
11+
# Operators
12+
--nospaceoperators ...,..
13+
--ranges spaced
14+
15+
# File header
16+
--header "//\n// {file}\n// NativeAppTemplate\n//"
17+
18+
# Excluded paths
19+
--exclude Pods,Carthage,DerivedData,.build
20+
21+
# Formatting rules
22+
--allman false
23+
--maxwidth 120
24+
--wraparguments before-first
25+
--wrapparameters before-first
26+
--wrapcollections before-first
27+
--closingparen balanced
28+
--commas always
29+
--decimalgrouping 3,4
30+
--exponentcase lowercase
31+
--fractiongrouping disabled
32+
--hexliteralcase lowercase
33+
--ifdef no-indent
34+
--linebreaks lf
35+
--octalgrouping 4,8
36+
--operatorfunc spaced
37+
--patternlet hoist
38+
--self remove
39+
--semicolons never
40+
--stripunusedargs closure-only
41+
--trailingclosures
42+
--commas inline
43+
--xcodeindentation disabled
44+
45+
# Disabled rules to avoid conflicts with SwiftLint
46+
--disable wrapMultilineStatementBraces

.swiftlint.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SwiftLint Configuration for NativeAppTemplate
2+
3+
# Disabled rules
4+
disabled_rules:
5+
- trailing_whitespace
6+
- todo
7+
8+
# Opt-in rules for better code quality
9+
opt_in_rules:
10+
- empty_count
11+
- empty_string
12+
- explicit_init
13+
- first_where
14+
- closure_spacing
15+
- redundant_nil_coalescing
16+
- vertical_whitespace_closing_braces
17+
- vertical_whitespace_opening_braces
18+
19+
# Included paths
20+
included:
21+
- NativeAppTemplate
22+
23+
# Excluded paths
24+
excluded:
25+
- Pods
26+
- Carthage
27+
- DerivedData
28+
- .build
29+
30+
# Configured rules
31+
line_length:
32+
warning: 120
33+
error: 150
34+
35+
function_body_length:
36+
warning: 100
37+
error: 300
38+
39+
type_body_length:
40+
warning: 450
41+
error: 500
42+
43+
file_length:
44+
warning: 650
45+
error: 1000
46+
47+
type_name:
48+
max_length:
49+
warning: 50
50+
51+
cyclomatic_complexity:
52+
warning: 15
53+
error: 25
54+
55+
large_tuple:
56+
warning: 3
57+
error: 4
58+
59+
identifier_name:
60+
min_length:
61+
warning: 2
62+
max_length:
63+
warning: 50
64+
excluded:
65+
- by
66+
- id
67+
- db

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Changelog
2+
3+
All notable changes to NativeAppTemplate will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- SwiftFormat for code formatting (with `--maxwidth 120`)
12+
- `@preconcurrency import CoreNFC` and `nonisolated(unsafe)` for Sendable fixes
13+
14+
### Changed
15+
- Moved `.swiftlint.yml` to repository root with updated rules
16+
- Applied SwiftFormat across all source files
17+
- Fixed all SwiftLint violations (line length, cyclomatic complexity, etc.)
18+
19+
## [1.1.0] - 2025-07-26
20+
21+
### Changed
22+
- Updated for iOS 18 support
23+
- Bug fixes
24+
25+
## [1.0.0] - 2024-10-30
26+
27+
### Added
28+
- Initial release of NativeAppTemplate
29+
- 100% Swift, 99% SwiftUI (UIKit only for email screen via MessageUI)
30+
- `@Observable` macro (iOS 17+) for state management
31+
- MVVM architecture with repository pattern
32+
- Onboarding flow
33+
- Sign Up / Sign In / Sign Out
34+
- Email Confirmation
35+
- Forgot Password
36+
- Input Validation
37+
- CRUD operations for Shops
38+
- URL path-based multitenancy
39+
- User invitation to organizations
40+
- Role-based permissions and access control
41+
- NFC tag reading and writing
42+
- SwiftLint integration
43+
- Swift Testing framework for unit tests
44+
- GitHub Actions CI for automated testing
45+
46+
### Technical
47+
- Protocol-oriented repository pattern for testability
48+
- DataManager as central dependency injection container
49+
- Token-based authentication with automatic refresh
50+
- NavigationStack with path-based routing
51+
- JSON:API adapter layer

CLAUDE.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ xcodebuild -project NativeAppTemplate.xcodeproj \
3636
### Linting
3737
```bash
3838
# Run SwiftLint (must be installed via: brew install swiftlint)
39-
cd NativeAppTemplate && swiftlint
39+
swiftlint
4040

4141
# Run SwiftLint with strict mode (as in CI)
42-
cd NativeAppTemplate && swiftlint --strict
42+
swiftlint --strict
43+
```
44+
45+
### Formatting
46+
```bash
47+
# Run SwiftFormat (must be installed via: brew install swiftformat)
48+
swiftformat .
4349
```
4450

4551
## Architecture Overview

NativeAppTemplate.xcodeproj/project.pbxproj

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,6 @@
862862
011F6DE9259EF16400BED22E /* Sources */,
863863
011F6DEA259EF16400BED22E /* Frameworks */,
864864
011F6DEB259EF16400BED22E /* Resources */,
865-
01A77D352632D1D900352EBC /* SwiftLint Run Script */,
866865
);
867866
buildRules = (
868867
);
@@ -962,37 +961,6 @@
962961
/* End PBXResourcesBuildPhase section */
963962

964963
/* Begin PBXShellScriptBuildPhase section */
965-
01A77D352632D1D900352EBC /* SwiftLint Run Script */ = {
966-
isa = PBXShellScriptBuildPhase;
967-
alwaysOutOfDate = 1;
968-
name = "SwiftLint Run Script";
969-
shellPath = /bin/sh;
970-
shellScript = (
971-
"if [[ \"$(uname -m)\" == arm64 ]]; then",
972-
" export PATH=\"/opt/homebrew/bin:$PATH\"",
973-
"fi",
974-
"",
975-
"if which swiftlint > /dev/null; then",
976-
" swiftlint",
977-
"else",
978-
" echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"",
979-
"fi",
980-
"",
981-
"",
982-
"",
983-
"",
984-
"",
985-
"",
986-
"",
987-
"",
988-
"",
989-
"",
990-
"",
991-
"",
992-
"",
993-
"",
994-
);
995-
};
996964
/* End PBXShellScriptBuildPhase section */
997965

998966
/* Begin PBXSourcesBuildPhase section */

NativeAppTemplate/.swiftlint.yml

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

0 commit comments

Comments
 (0)