As an iOS developer, mastering the Terminal can significantly boost your productivity and help you solve common development challenges. Here’s a comprehensive guide to the most useful Terminal commands for Swift and iOS development.
1. Build and Test Management
XcodeBuild Testing
xcodebuild test -project YourProject.xcodeproj -scheme YourScheme -destination "platform=iOS Simulator,name=iPhone 14"
This command runs your unit tests from the command line, which is essential for continuous integration setups. You can specify different simulators and schemes as needed.
2. Dependency Management
CocoaPods Commands
pod install # Install pods specified in Podfile
pod update # Update pods to latest versions
pod repo update # Update local specs repo
Swift Package Manager
swift package update # Update package dependencies
swift package init # Create new Swift package
swift package generate-xcodeproj # Generate Xcode project