Questions tagged [swift-compiler]
22 questions
9
votes
0 answers
Swift Version Conflict: this SDK is not supported by the compiler - using BUILD_LIBRARY_FOR_DISTRIBUTION setting. What could be the issue?
I'm building a Swift static library with:
Xcode 13.2 (Swift compiler 5.5.2)
iOS Deployment target 12.0
Build library for distribution YES
Skip install NO
Swift language version 5 and tried with 4.2
Dependency managed with CocoaPods:
Japx…

Sebastiano Bertolin
- 91
- 1
- 2
5
votes
0 answers
Why can't swift 5.7 in toolchain find Regex?
I believe I'm running Swift 5.7 from the command line, and that Swift 5.7 should have the new Regex class and /.../ syntax. But It doesn't seem to.
I have the following Swift source "parse.swift". But Swift didn't seem to understand the Swift 5.7…

clearlight
- 12,255
- 11
- 57
- 75
4
votes
0 answers
How to send correctly keypress to BG app with no difference between swift script and compiled swiftc binary
Have a small swift script called skey.swift which sending a keypress into processes even when they're not active, (e.g. they're in the background) by their PID (process ID).
import Foundation
if CommandLine.argc < 2 {
print("Error",…

clt60
- 62,119
- 17
- 107
- 194
4
votes
2 answers
Why does a simple Swift arithmetic operation compile so slow?
In an attempt to optimize the build time of my app I've added the following to my OTHER_SWIFT_FLAGS:
OTHER_SWIFT_FLAGS =
-Xfrontend -warn-long-expression-type-checking=75
-Xfrontend -warn-long-function-bodies=75
I got a warnings for this specific…

Groot
- 13,943
- 6
- 61
- 72
3
votes
1 answer
What does "-c" option do for Swift compiler (swiftc)?
I noticed there is "-c" option in swiftc, what does this option do?
swiftc ... -c ....
Is there an official document about this? I couldn't find it from man, --help or online :(

Roovent
- 311
- 3
- 11
2
votes
1 answer
How to avoid import function from Module
I have two Packages: FirstModule and AnotherModule, and each of them defines
extension CGPoint {
public static func + (lhs: CGPoint, rhs: CGPoint) -> CGPoint {
CGPoint(x: lhs.x + rhs.x, y: lhs.y+rhs.y)
}
}
Also in main app I…

Łukasz
- 773
- 5
- 23
2
votes
4 answers
Kingfisher Swift Compiler error when Archiving
I'm using xCode 13 beta 4 and want to archive my project containing Kingfisher.
The app runs fine under iOS 15, however I get the following errors when I look to archive it. Anyone with an idea what I should do? Thanks!

mcmgr
- 21
- 1
- 2
1
vote
0 answers
How does the Swift compiler choose between two Int initializers with a String parameter?
I recently found an Int initializer:
init?(_ text: S, radix: Int = 10) where S: StringProtocol
As you can see, the second parameter radix has a default value with 10, so I can call this function without providing it.
Meanwhile, String does…

Evan
- 430
- 6
- 16
1
vote
0 answers
Swiftc arguments in Swift Package
I hava a Swift Package with an executable target, the project structure looks like this:
MySwiftPackage
├── Package.swift
├── Sources
│ └── MySwiftPackage
│ ├── SwiftBridgeCore.swift
│ ├── main.swift
│ └── my_rust_lib.swift
├──…

Jomy
- 514
- 6
- 22
1
vote
2 answers
Swift compiler speed with array concatenation
I'd like to understand what could be the least painful way for programmer and compiler to get the following code to compile in a reasonable time
extension Array {
func unflat() -> [[Element]] {
return self.map{[$0]}
}
}
let…

Anton Duzenko
- 2,366
- 1
- 21
- 26
1
vote
1 answer
swiftc compile time is more slow when using -O than not using
I have studied swift compiler ( swiftc )
I just make one swift file written about sorting algorithms. ( radix, merge, quick, heap .. )
and then I compiled with or without optimization flags ( -O , -wmo ) and checked time by using flag…

HyunSu
- 155
- 7
1
vote
0 answers
Unexpected Behavior with Swift's Compiler -- Probably
I was doing a WatchKit app, and I faced a very strange behavior which I think probably hasn't to do with WatchKit, but some weird way the compiler is behaving, although not sure if the compiler is the culprit but that's what I suspect.
The scenario…

Sean Goudarzi
- 1,244
- 1
- 10
- 23
1
vote
0 answers
Swift: How ARC deals with anonymous objects?
ARC came many years ago to replace painful MRC, but since ARC is only a compiler technique its magic happens during the compile time. So, basically what it does - automatically inserts retain and release calls where appropriate. So, now comes my…

Andre Liberty
- 707
- 1
- 9
- 17
1
vote
1 answer
why do i receive this warning to implement 'hash(into:)' on a type that conforms to a protocol with at default implementation
The code below shows the warning:
❯ swiftc demo.swift …

byaruhaf
- 4,128
- 2
- 32
- 50
1
vote
1 answer
Command CompileSwiftSources failed with a nonzero exit code. Command PrecompileSwiftBridgingHeader failed with a nonzero exit code
I'm getting this my countly target and other notification related target. I tried compilation mode to Whole module but it didn't help.

Ganesh Shetty
- 302
- 1
- 4
- 12