Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ jobs:
with:
xcode-version: '16.4'
- uses: actions/checkout@v3
- name: Install SwiftLint
- name: Install SwiftLint and SwiftFormat
run: |
brew install swiftlint
brew install swiftlint swiftformat
- name: SwiftFormat Lint
run: |
swiftformat --lint NativeAppTemplate
# Commented out due to an error.
# - name: Unit Tests
# run: |
Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ swiftlint
swiftlint --strict
```

### Linting and Formatting
Always run `make lint` before pushing to verify SwiftLint and SwiftFormat checks pass (matches CI). Use `make format` to auto-fix SwiftFormat issues.

### Formatting
```bash
# Run SwiftFormat (must be installed via: brew install swiftformat)
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY: lint format

lint:
swiftlint lint --strict NativeAppTemplate
swiftformat --lint NativeAppTemplate

format:
swiftformat NativeAppTemplate
2 changes: 1 addition & 1 deletion NativeAppTemplate/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// NativeAppTemplate
//

import SwiftUI
import typealias Foundation.TimeInterval
import SwiftUI

extension Int {
static let minimumPasswordLength: Int = 8
Expand Down
8 changes: 4 additions & 4 deletions NativeAppTemplate/Logging/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ struct Failure {
func log() {
appLogger.error(
"""
\(self.action, privacy: .public) \
source=\(self.source, privacy: .public) \
reason=\(self.reason, privacy: .private)
\(action, privacy: .public) \
source=\(source, privacy: .public) \
reason=\(reason, privacy: .private)
"""
)
}
Expand Down Expand Up @@ -99,6 +99,6 @@ struct Event {
private let action: String

func log() {
appLogger.info("EVENT:: source: \(self.source, privacy: .public), action: \(self.action, privacy: .public)")
appLogger.info("EVENT:: source: \(source, privacy: .public), action: \(action, privacy: .public)")
}
}
2 changes: 1 addition & 1 deletion NativeAppTemplate/Models/ItemTag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import Foundation

struct ItemTag: Codable, Hashable, Identifiable, Sendable {
struct ItemTag: Codable, Hashable, Identifiable {
var id: String = ""
var shopId: String = ""
var queueNumber: String = ""
Expand Down
2 changes: 1 addition & 1 deletion NativeAppTemplate/Models/Shop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import Foundation

struct Shop: Codable, Identifiable, Sendable {
struct Shop: Codable, Identifiable {
var id: String
var name: String
var description: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
// CertificatePinningDelegate.swift
// NativeAppTemplate
//
// Created by Daisuke Adachi.
//

import CommonCrypto
import Foundation

final class CertificatePinningDelegate: NSObject, URLSessionDelegate {
// SPKI SHA-256 hashes (base64-encoded) for api.nativeapptemplate.com
// The server uses Google Trust Services certificates (Render hosting).
// Pin the leaf public key and Google Trust Services intermediate CAs as backup.
/// SPKI SHA-256 hashes (base64-encoded) for api.nativeapptemplate.com
/// The server uses Google Trust Services certificates (Render hosting).
/// Pin the leaf public key and Google Trust Services intermediate CAs as backup.
static let pinnedHashes: Set<String> = [
// Leaf certificate public key (api.nativeapptemplate.com)
"54Il7gpV4QvX8fAyEKV+6fp8VGjgHqIAAqF5bLCfYNQ=",
Expand All @@ -21,19 +19,19 @@ final class CertificatePinningDelegate: NSObject, URLSessionDelegate {

static let pinnedDomain = String.domain

// ASN.1 header for EC 256-bit public key (SPKI prefix)
/// ASN.1 header for EC 256-bit public key (SPKI prefix)
private static let ecDsaSecp256r1Asn1Header: [UInt8] = [
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86,
0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A,
0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03,
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a,
0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
0x42, 0x00
]

// ASN.1 header for RSA 2048-bit public key (SPKI prefix)
/// ASN.1 header for RSA 2048-bit public key (SPKI prefix)
private static let rsa2048Asn1Header: [UInt8] = [
0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09,
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01,
0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00
0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00
]

func urlSession(
Expand All @@ -52,7 +50,7 @@ final class CertificatePinningDelegate: NSObject, URLSessionDelegate {
let certificateCount = SecTrustGetCertificateCount(serverTrust)
var pinMatched = false

for index in 0..<certificateCount {
for index in 0 ..< certificateCount {
guard let certificate = SecTrustCopyCertificateChain(serverTrust)
.map({ unsafeBitCast(CFArrayGetValueAtIndex($0, index), to: SecCertificate.self) })
else { continue }
Expand Down
4 changes: 3 additions & 1 deletion NativeAppTemplate/Networking/Services/Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ protocol Service {
}

extension Service {
var session: URLSession { .pinned }
var session: URLSession {
.pinned
}
}

extension Service {
Expand Down
2 changes: 1 addition & 1 deletion NativeAppTemplate/UI/App Root/AppTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension AppTabView: View {
.onChange(of: sessionController.shouldPopToRootView) {
if sessionController.shouldPopToRootView {
navigationPathShops = NavigationPath()
sessionController.shouldPopToRootView = false
sessionController.shouldPopToRootView = false
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions NativeAppTemplate/UI/Shared/GlassButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// GlassButtonStyle.swift
// NativeAppTemplate
//
// Created by Daisuke Adachi.
//

import SwiftUI

Expand Down
2 changes: 0 additions & 2 deletions NativeAppTemplate/UI/Shared/GlassCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// GlassCard.swift
// NativeAppTemplate
//
// Created by Daisuke Adachi.
//

import SwiftUI

Expand Down
Loading