SCHEME := Amphlify
DESTINATION ?= platform=iOS Simulator,name=iPhone 18 Pro
XCODEBUILD := xcodebuild -project Amphlify.xcodeproj -scheme $(SCHEME) -derivedDataPath build -quiet
KIT := Packages/AmphlifyKit

.PHONY: fmt check test run

fmt:
	swiftformat .

check:
	swiftformat --lint .
	swiftlint --strict --quiet
	$(XCODEBUILD) -destination 'generic/platform=iOS Simulator' build

test:
	swift test --package-path $(KIT) --quiet

run:
	$(XCODEBUILD) -destination '$(DESTINATION)' build
	xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/Amphlify.app
	xcrun simctl launch booted com.soundoz.amphlify
