-
Notifications
You must be signed in to change notification settings - Fork 0
Add/#84 Config 추가 및 BASEURL 설정 #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // | ||
| // BaseURL.swift | ||
| // Cherrish-iOS | ||
| // | ||
| // Created by 송성용 on 1/18/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| enum Environment { | ||
| static let baseURL: String = Bundle.main.infoDictionary?["BASE_URL"] as! String | ||
| } | ||
|
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Force cast 사용으로 인한 런타임 크래시 위험
🔧 안전한 구현 제안 enum Environment {
- static let baseURL: String = Bundle.main.infoDictionary?["BASE_URL"] as! String
+ static let baseURL: String = {
+ guard let url = Bundle.main.infoDictionary?["BASE_URL"] as? String else {
+ fatalError("BASE_URL이 Info.plist에 정의되지 않았습니다. Config.xcconfig 설정을 확인하세요.")
+ }
+ return url
+ }()
}이 방식은 크래시 시 명확한 에러 메시지를 제공하여 디버깅을 용이하게 합니다. 🧰 Tools🪛 SwiftLint (0.57.0)[Error] 11-11: Force casts should be avoided (force_cast) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>BASE_URL</key> | ||
| <string>$(BASE_URL)</string> | ||
|
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for Config.xcconfig file in the repository
echo "=== Searching for Config.xcconfig ==="
fd -t f "Config\.xcconfig" --exec sh -c 'echo "Found: {}" && cat "{}"' \;
# Also search for any .xcconfig files to get a broader view
echo ""
echo "=== All .xcconfig files in repository ==="
fd -t f "\.xcconfig$"Repository: TEAM-Cherrish/Cherrish-iOS Length of output: 150 🏁 Script executed: #!/bin/bash
# Check if .xcconfig files are gitignored
echo "=== Checking .gitignore for .xcconfig patterns ==="
if [ -f ".gitignore" ]; then
cat .gitignore | grep -i "xcconfig" || echo "No .xcconfig patterns found in .gitignore"
else
echo ".gitignore not found"
fi
echo ""
echo "=== Searching for BASE_URL definition in all files ==="
rg "BASE_URL" --type-list | head -5
rg "BASE_URL" -t swift -t plist -t xml 2>/dev/null | head -20
echo ""
echo "=== Checking for README or setup documentation ==="
fd -t f "(README|SETUP|CONFIG)" --exec sh -c 'echo "File: {}" && head -10 "{}"' \; 2>/dev/null | head -50Repository: TEAM-Cherrish/Cherrish-iOS Length of output: 1142 🏁 Script executed: #!/bin/bash
# Check for template or example .xcconfig files
echo "=== Searching for .xcconfig templates or examples ==="
fd -i "xcconfig|config" -t f | grep -E "(example|template|sample)" || echo "No template files found"
echo ""
echo "=== Searching all files for BASE_URL reference ==="
rg "BASE_URL" 2>/dev/null | head -20
echo ""
echo "=== Checking Info.plist files ==="
fd "Info\.plist" -t f --exec sh -c 'echo "File: {}" && cat "{}"' \;
echo ""
echo "=== Checking Xcode project structure ==="
fd "\.pbxproj" -t f | head -5Repository: TEAM-Cherrish/Cherrish-iOS Length of output: 1125 🏁 Script executed: #!/bin/bash
# Check pbxproj for BASE_URL or build configuration
echo "=== Checking pbxproj for BASE_URL or build settings ==="
rg "BASE_URL|xcconfig" "Cherrish-iOS/Cherrish-iOS.xcodeproj/project.pbxproj" 2>/dev/null | head -20
echo ""
echo "=== Checking for build scripts or setup documentation ==="
fd -t f "(Makefile|\.sh|\.yml|\.yaml)" --exec sh -c 'basename "{}" && head -5 "{}"' \; 2>/dev/null | head -50
echo ""
echo "=== Checking for any .swift files that reference xcconfig ==="
rg "xcconfig|CONFIG" --type swift 2>/dev/null | head -10
echo ""
echo "=== Full README.md to check for setup instructions ==="
cat README.md | head -100Repository: TEAM-Cherrish/Cherrish-iOS Length of output: 3130 Config.xcconfig 파일 생성 필수 Info.plist에서 참조하는 각 개발자가 로컬에서 직접 🤖 Prompt for AI Agents |
||
| <key>UIAppFonts</key> | ||
| <array> | ||
| <string>Pretendard-Bold.otf</string> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Debug와 Release에 동일한 Config 파일 사용 검토
현재 Debug와 Release 모두 동일한
Core/Config.xcconfig를 참조합니다. 개발 환경과 프로덕션 환경에서 다른 BASE_URL이 필요한 경우, 환경별로 분리된 설정 파일 사용을 권장합니다.예시:
Config-Debug.xcconfig→ 개발 서버 URLConfig-Release.xcconfig→ 프로덕션 서버 URLAlso applies to: 217-218
🤖 Prompt for AI Agents