Questions tagged [swift-compiler]
22 questions
0
votes
0 answers
Swift @inlinable with multiple targets in a single SPM package
I'm working on a series of SPM packages that work together, each of which has multiple targets within. I'm trying to figure out how much of my code to mark with @inlinable in order to allow the compiler to do cross-module optimizations.
Doing…

bplattenburg
- 623
- 1
- 8
- 33
0
votes
0 answers
Where is swift compiler's symbol table?
I wanted to know how name resolution happens in swift compiler, but I am unable to find code that is responsible for name lookup.
A explanation of how name lookup happens (in swift compiler) will be a huge help.
I also suspect that name lookup is…

whh
- 33
- 1
- 5
0
votes
1 answer
What is better in this case: extension or function?
I have a ViewController where there's a logic for the "known" and "unknown" location.
At a high level it looks like this:
class MyViewController {
private var myVar: CLLocationCoordinate2D? // is updated somewhere
private var myFunc1() {
…

olha
- 2,132
- 1
- 18
- 39
0
votes
1 answer
Hot to compile a Swift script to a universal binary
We can easily compile a Swift script with:
$ swiftc /path/to/script.swift -o /path/to/binary
However, that only compiles for the current architecture.
$ lipo -archs /path/to/binary
arm64
I found some commands to build for multiple architectures,…

user137369
- 5,219
- 5
- 31
- 54
0
votes
1 answer
SwiftUI ForEach with index - "The compiler is unable to type-check this expression in reasonable time"
In a swiftUI view that I'm writing, I need to use a ForEach, accessing each element of a list and its index. Most of the information I could find about this said to use .enumerated() as in ForEach(Array(values.enumerated()), id: \.offset) { index,…

Cameron Delong
- 454
- 1
- 6
- 12
0
votes
0 answers
Too many default arguments do slow down build time?
Given the following initialiser:
init(a1: String? = nil, a2: String? = nil, .... a16: String? = nil) {
...
}
With some simple mathematics all the possible initialisers are 2^16 = 65536
Question:
Is it true that adding too many default arguments…

Kwnstantinos Nikoloutsos
- 1,832
- 4
- 18
- 34
0
votes
1 answer
Tell Swift compiler method as swift only
I have a swift class defined like this:
@objcMembers
public class MyURL: NSObject {
func concat(_ components: String...) -> MyURL {
concat(components)
}
/// Concat the specified components one by one.
func concat(_…

Itachi
- 5,777
- 2
- 37
- 69