Sometimes You should use a VPN for getting the firebase package,
after that you should close the xcode, and delete
"/Users/[your-user-name]/Library/Caches/org.swift.swiftpm" this file(SPM cache),
after that you should go to the project folder(project path) in terminal and run this command "xcodebuild -workspace [yourworkspace.xcworkspace] -scheme your [your-scheme-name] build"