Segmentation fault: 11 - Xcode/Swift 5 compile issue - ios

I'm always getting a Segmentation fault: 11 error when compiling.
I have massively stripped back my code to identify the nuances of what is causing the issue and have produced the demo code below that exhibits the exact same problem.
Can anyone suggest any way to resolve this issue (thats different to what I have already highlight in the code comments)?
PS: this Swift 5 code and occurs with both Xcode 11.7 and Xcode 12
// If we make this a class instead, it compiles! (but I want it to be a struct)
struct SomeStruct {
// If we remove either of these properties or change them to an Int, it compiles! (but I obviously need 2 strings)
let propertyA: String
let propertyB: String
}
protocol Protocol { }
enum Enumeration {
// If we remove this case, it compiles! (but I need this case, and the protocol also)
case possibilityA(protocol: Protocol)
// If we add additional associated values to this case, it compiles! (but I need this case)
case possibilityB(completion: (Result<SomeStruct, Error>) -> ())
}
class SomeClass {
func method() {
// If we remove the use of `possibilityB`, it compiles! (but I need this)
_ = Enumeration.possibilityB(completion: { _ in
})
}
}
Here's the stack dump...
Stack dump:
0. Program arguments: /Applications/Xcode_12.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/x/Demo/Sources/Demo/Demo.swift -emit-module-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftmodule -emit-module-doc-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftdoc -emit-module-source-info-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftsourceinfo -serialize-diagnostics-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.dia -emit-dependencies-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.d -emit-reference-dependencies-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.swiftdeps -target arm64-apple-ios9.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -I /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos -I /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib -F /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos -F /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/x/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/x/Demo -enable-anonymous-context-mangled-names -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/swift-overrides.hmap -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos/include -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources-normal/arm64 -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources/arm64 -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -target-sdk-version 14.0 -parse-as-library -module-name Demo -o /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.o -embed-bitcode-marker -index-store-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Index/DataStore -index-system-modules
1. Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
2. While evaluating request IRGenSourceFileRequest(IR Generation for file "/Users/x/Demo/Sources/Demo/Demo.swift")
3. While emitting IR SIL function "#$s8Demo9SomeClassC6methodyyF".
for 'method()' (at /Users/x/Demo/Sources/Demo/Demo.swift:21:5)
4. While converting type '(#callee_guaranteed (#in_guaranteed Result<SomeStruct, Error>) -> ())'
0 swift 0x0000000107a19865 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift 0x0000000107a18865 llvm::sys::RunSignalHandlers() + 85
2 swift 0x0000000107a19e1f SignalHandler(int) + 111
3 libsystem_platform.dylib 0x00007fff68acc5fd _sigtramp + 29
4 libsystem_platform.dylib 0x0000000000000004 _sigtramp + 18446603338760010276
5 swift 0x00000001039794d8 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 21400
6 swift 0x000000010396fc26 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8982
7 swift 0x0000000103809dc7 swift::irgen::IRGenerator::emitGlobalTopLevel(llvm::StringSet<llvm::MallocAllocator>*) + 1607
8 swift 0x00000001039449d7 performIRGeneration(swift::IRGenOptions const&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, swift::SourceFile*, llvm::GlobalVariable**, llvm::StringSet<llvm::MallocAllocator>*) + 1687
9 swift 0x000000010396d681 swift::SimpleRequest<swift::IRGenSourceFileRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenSourceFileRequest const&, swift::Evaluator&) + 97
10 swift 0x0000000103948dec llvm::Expected<swift::IRGenSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenSourceFileRequest>(swift::IRGenSourceFileRequest const&) + 940
11 swift 0x000000010394503d swift::performIRGeneration(swift::IRGenOptions const&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**, llvm::StringSet<llvm::MallocAllocator>*) + 269
12 swift 0x0000000103590d3a performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 3002
13 swift 0x0000000103580928 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 20712
14 swift 0x0000000103501c07 main + 1255
15 libdyld.dylib 0x00007fff688d3cc9 start + 1
16 libdyld.dylib 0x000000000000004f start + 18446603338762077063
error: Segmentation fault: 11 (in target 'Demo' from project 'Demo')

Naming the enum associated values is a shadow zone. While it is apparently accepted under certain conditions, it is not used or even mentioned in the official Swift Language Guide chapter on Enumerations. So in this case, your code compiles fine if you remove the naming.
enum Enumeration {
case possibilityA(Protocol)
case possibilityB((Result<SomeStruct, Error>) -> ())
}
...
func method() {
let _ = Enumeration.possibilityB({ _ in
})
In any case, a crashing compiler is never nice, no matter how bad code you feed it, and furthermore you got a pretty cool minimal test, so filling a report should be your duty and honor :)

Related

Swift static library compile fails with "Stack dump without symbol names" when build with release configuration

Situation
As I described in title, Swift static library below fails when it's built with release build configuration. It's okay when built with debug configuration.
Codes
It's part of my project codes where the error occurs. If you try compiling it in a static library project, you can also get the error I got.
public struct LocalStorageManager<Instance, Storage> where Instance: Codable, Storage: StorageType {
private let localStorage: Storage
private let coderSet: CoderSet
public func save(_ instance: Instance, name: String) -> URL? {
guard let data = try? coderSet.encoder.encode(instance) else {
return nil
}
return localStorage.save(data: data, name: name)
}
public func load(path: URL) -> Instance? {
guard let data = localStorage.download(with: path) else {
return nil
}
guard let instance = try? coderSet.decoder.decode(Instance.self, from: data) else {
return nil
}
return instance
}
public init(_ localStorage: Storage = LocalStorageService()) {
self.localStorage = localStorage
self.coderSet = CoderSet()
}
}
fileprivate struct CoderSet {
let encoder = JSONEncoder()
let decoder = JSONDecoder()
}
struct LocalStorageService: StorageType {
private let storage: FileManager
init(_ storage: FileManager = FileManager.default) {
self.storage = storage
}
func save(data: Data, name: String?) -> URL? {
guard let name else { return nil }
do {
let filePath = fileURL(with: name)
try data.write(to: filePath ?? URL(string: "www.google.com")!)
return filePath
} catch {
return nil
}
}
func download(with url: URL) -> Data? {
do {
guard storage.fileExists(atPath: url.relativeString) else {
return nil
}
let data = try Data(contentsOf: url)
return data
} catch {
return nil
}
}
}
extension LocalStorageService {
var documentDirectory: URL? {
return try? self.storage.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: false)
}
func fileURL(with name: String?) -> URL? {
guard let documentDirectory = documentDirectory else {
return nil
}
let parsedName = name ?? UUID().uuidString
return documentDirectory.appendingPathComponent(parsedName)
}
}
public protocol StorageType {
func save(data: Data, name: String?) -> URL?
func download(with url: URL) -> Data?
}
Error logs
The codes show error logs like:
SwiftCompile normal arm64 Compiling\ CompileFailureTestFramework.swift /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift (in target 'CompileFailureTestFramework' from project 'CompileFailureTestFramework')
cd /Users/youngbinlee/Documents/Github/CompileFailureTestFramework
builtin-swiftTaskExecution -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift -emit-module-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftmodule -emit-module-doc-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftdoc -emit-module-source-info-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftsourceinfo -emit-dependencies-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.d -serialize-diagnostics-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.dia -emit-objc-header-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-Swift.h -emit-abi-descriptor-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.abi.json -target arm64-apple-ios16.2-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -I /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/PackageFrameworks -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -no-color-diagnostics -g -module-cache-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity\=checked -O -serialize-debugging-options -enable-bare-slash-regex -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/youngbinlee/Documents/Github/CompileFailureTestFramework -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-generated-files.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-own-target-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-project-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/include -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources-normal/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources -module-name CompileFailureTestFramework -frontend-parseable-output -disable-clang-spi -target-sdk-version 16.2 -parse-as-library -num-threads 10 -o /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o -index-unit-output-path /CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o
caller: $s27CompileFailureTestFramework19LocalStorageManagerVyACyxq_Gq_cfcfA_
callee: $s27CompileFailureTestFramework19LocalStorageServiceVyACSo13NSFileManagerCcfcfA_
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift -emit-module-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftmodule -emit-module-doc-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftdoc -emit-module-source-info-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftsourceinfo -emit-dependencies-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.d -serialize-diagnostics-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.dia -emit-objc-header-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-Swift.h -emit-abi-descriptor-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.abi.json -target arm64-apple-ios16.2-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -I /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/PackageFrameworks -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -no-color-diagnostics -g -module-cache-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -O -serialize-debugging-options -enable-bare-slash-regex -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/youngbinlee/Documents/Github/CompileFailureTestFramework -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-generated-files.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-own-target-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-project-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/include -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources-normal/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources -module-name CompileFailureTestFramework -frontend-parseable-output -disable-clang-spi -target-sdk-version 16.2 -parse-as-library -num-threads 10 -o /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o -index-unit-output-path /CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o
1. Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for CompileFailureTestFramework)
4. While running pass #1046 SILFunctionTransform "EarlyInliner" on SILFunction "#$s27CompileFailureTestFramework19LocalStorageManagerVyACyxq_Gq_cfcfA_".
for expression at [/Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift:37:43 - line:37:63] RangeText="LocalStorageService("
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000107a075b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000107a065b4 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000107a07c34 SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001ae8a02a4 _sigtramp + 56
4 swift-frontend 0x0000000103ac17e4 swift::getEligibleFunction(swift::FullApplySite, swift::InlineSelection) + 1576
5 swift-frontend 0x00000001039b35a0 (anonymous namespace)::SILPerformanceInlinerPass::run() + 2068
6 swift-frontend 0x0000000103908470 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 4020
7 swift-frontend 0x00000001039050c4 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 148
8 swift-frontend 0x0000000103920670 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
9 swift-frontend 0x000000010390d858 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 504
10 swift-frontend 0x000000010390f9a0 swift::runSILOptimizationPasses(swift::SILModule&) + 368
11 swift-frontend 0x00000001030c1694 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 524
12 swift-frontend 0x00000001030525cc performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1064
13 swift-frontend 0x0000000103054ce8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7284
14 swift-frontend 0x0000000102ff5294 swift::mainEntry(int, char const**) + 3940
15 dyld 0x00000001ae547e50 start + 2544
Insight
The part I noticed is [/Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift:37:43 - line:37:63] RangeText="LocalStorageService(" and Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
Thanks to those logs, I could solve the error by changing init of LocalStorageManager:
// Changed
public init(_ localStorage: Storage? = nil) {
if let localStorage {
self.localStorage = localStorage
} else {
self.localStorage = LocalStorageService() as! Storage
}
self.coderSet = CoderSet()
}
It works but I don't know why..
Question
So my question is:
Is there any reason why it doesn't fail in debug, but only in release?
And why is the original init failing to compile?
If you have any idea, please let me know. Thanks!

Segmentation fault 11 when passing a capture block to a DispatchQueue

I am getting a Segmentation fault on both Swift 4 and Swift 4.2 on a capture block for a DispatchQueue.
I am trying to provide a capture block to the escaping parameter of a DispatchQueue to guarantee that the object passed to the called closure is alive when it will be called.
The code looks something like this:
import Foundation
struct Response {
let outcome: String?
}
enum NotEvenError: Error {
case notEven
}
struct IsEvenService {
typealias SuccessCallback = (Response) -> Void
typealias FailureCallback = (Error?) -> Void
func perform(success: #escaping SuccessCallback, failure: #escaping FailureCallback) {
let number = Int.random(in: 0 ... 10)
if number%2 == 0 {
let outcome = Response(outcome: "it is")
success(outcome)
} else {
failure(NotEvenError.notEven)
}
}
}
func runTest(success: #escaping (Response) -> Void, failure: #escaping (Error?) -> Void) {
let service = IsEvenService()
service.perform(success: { (response) in
if response.outcome != nil {
DispatchQueue.main.async { [resp = response] in
success(resp)
}
}
},
failure: { (error) in
DispatchQueue.main.async { [err = error] in
failure(err)
}
})
}
The problematic part is the following:
DispatchQueue.main.async { [err = error] in
failure(err)
}
This is a sample file that can be easily verified with a swiftc call in the command line.
Here is the outcome:
Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
Target: x86_64-apple-darwin17.7.0
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -target x86_64-apple-darwin17.7.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name test -o /var/folders/fn/wh62twgj54180b7x1dx9j6080000gp/T/test-d0f7f4.o
0 swift 0x000000010720964a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000107208dfe SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff7ac3ff5a _sigtramp + 26
3 libsystem_platform.dylib 0x00007ffeec7e0000 _sigtramp + 1908015296
4 swift 0x0000000103eef293 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 6531
5 swift 0x0000000103ea826e swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 462
6 swift 0x0000000103e0be14 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 516
7 swift 0x0000000103e0b142 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 1042
8 swift 0x0000000103e1501b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 939
9 swift 0x0000000103e16bd5 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 1333
10 swift 0x00000001034983fe performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 28990
11 swift 0x000000010348ddc5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
12 swift 0x0000000103433a35 main + 1349
13 libdyld.dylib 0x00007fff7a931015 start + 1
14 libdyld.dylib 0x000000000000000f start + 2238509051
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -target x86_64-apple-darwin17.7.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name test -o /var/folders/fn/wh62twgj54180b7x1dx9j6080000gp/T/test-d0f7f4.o
1. While emitting SIL for 'runTest(success:failure:)' at test.swift:26:1
2. While silgen emitFunction SIL function "#$S4test7runTest7success7failureyyAA8ResponseVc_ys5Error_pSgctF".
for 'runTest(success:failure:)' at test.swift:26:1
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)
Is it safe to assume that if I do not pass a capture block that the object will be retained when the closure is executed?
If I do the following, it compiles:
let uselessTempError = error
DispatchQueue.main.async { [err = uselessTempError] in
failure(err)
}
You don't need the [err = error] part. The following block will keep a strong reference to error:
DispatchQueue.main.async {
failure(error)
}

fatal error encountered while deserializing SIL global "UIEdgeInsetsZero"

Using Swift 4.2 with Xcode 10 beta, if I write:
import UIKit
let foo: UIEdgeInsets = .zero
Then I get a fatal error at compile time:
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
result is ambiguous
0 swift 0x000000010784fc5a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010784f066 SignalHandler(int) + 966
2 libsystem_platform.dylib 0x00007fff62a5ef5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000010 _sigtramp + 2639925456
4 libsystem_c.dylib 0x00007fff627fc1ae abort + 127
5 swift 0x0000000104cf599b swift::ModuleFile::fatal(llvm::Error) + 1915
6 swift 0x0000000104d2d4d2 swift::SILDeserializer::readGlobalVar(llvm::StringRef) + 1890
7 swift 0x0000000104dd7f9a swift::SerializedSILLoader::getAllForModule(swift::Identifier, swift::FileUnit*) + 234
8 swift 0x0000000103b2adbe performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 34750
9 swift 0x0000000103b1f10f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7839
10 swift 0x0000000103ac8c48 main + 13144
11 libdyld.dylib 0x00007fff62750015 start + 1
12 libdyld.dylib 0x0000000000000041 start + 2643132461
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -merge-modules -emit-module /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/ViewController~partial.swiftmodule /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy~partial.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-ios12.0-simulator -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk -I /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator -F /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/coeur/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/coeur/Development/Edgy -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-generated-files.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-own-target-headers.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-all-target-headers.hmap -Xcc -iquote -Xcc /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-project-headers.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/DerivedSources/x86_64 -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy.swiftdoc -emit-objc-header-path /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy-Swift.h -module-name Edgy -o /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy.swiftmodule
1. While deserializing SIL global "UIEdgeInsetsZero"
error: Abort trap: 6
Here is workaround I found for Xcode 10 beta and Xcode 10 beta 2. Just temporary include this somewhere in your project until you update Xcode:
#if swift(>=4.2)
import UIKit.UIGeometry
extension UIEdgeInsets {
public static let zero = UIEdgeInsets()
}
#endif
Issue resolved in Xcode 10 beta 3 and newer.
(the resolution happened thanks to this pull request: https://github.com/apple/swift/pull/17122)
It is the bug of Swift compiler, see https://bugs.swift.org/browse/SR-7879 for current state and get more information.
You can try to use this workaround:
Replace all occurrence .zero like
tableView.separatorInset = .zero
to
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
Helpful is search .zero in the whole workspace, checking type, and when the type is UIEdgeInsets, just replace .zero.
It has been fixed today in Xcode 10 beta 3.
https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf
"The zero property on UIEdgeInsets can now successfully be used. (40735990)"
Xcode 10
goto Build settings select All
and Search for Optimization Level
Change in Swift Compiler - Code Generation Optimization Level
Debug : No Optimization[-Onone ] to Optimise for Speed [-O]
It worked for me.

Segmentation fault 11 fix?

I'm trying to make an app where you push a button as many times as possible in a certain amount of time for points. I've been building it and running it on my iPhone daily for the past week or so, but now all of the sudden Xcode is giving me and error "segmentation fault 11". I have removed code that I added, removed things from the storyboard, and even reinstalled Xcode, but nothing has fixed the problem. There's articles and videos on how to fix it, but none of them seem to work for me.
Here's my code:
import UIKit
import Foundation
import AudioToolbox
// PlaySounds
class PlaySounds {
private var soundID: SystemSoundID = 0
public init(named name: String) {
if let soundURL = soundURL(forName: name) {
let status = AudioServicesCreateSystemSoundID(soundURL as CFURL, &soundID)
if status != noErr {
print("Unable to create sound at URL: '\(name)'")
soundID = 0
}
}
}
public func play() {
if soundID != 0 {
AudioServicesPlaySystemSound(soundID)
}
}
private func soundURL(forName name: String) -> URL? {
let fileExtensions = ["m4a", "wav", "mp3", "aac", "adts", "aif", "aiff", "aifc", "caf", "mp4"]
for fileExtention in fileExtensions {
if let soundURL = Bundle.main.url(forResource: name, withExtension: fileExtention) {
return soundURL
}
}
print("Unable to find sound file with name '\(name)'")
return nil
}
deinit {
if soundID != 0 {
AudioServicesDisposeSystemSoundID(soundID)
}
}
}
// ViewController
class ViewController: UIViewController {
let startTimer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(UIMenuController.update), userInfo: nil, repeats: true)
let XDSound = PlaySounds(named: "XDDDDDDD")
#IBAction func playButtonPressed(_ sender: AnyObject) {
XDSound.play()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
And the error code:
CompileSwift normal arm64 /Users/aaa/Desktop/XD/XD/XD/ViewController.swift
cd /Users/aaa/Desktop/XD/XD
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/aaa/Desktop/XD/XD/XD/ViewController.swift /Users/aaa/Desktop/XD/XD/XD/AppDelegate.swift -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -F /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -enable-testing -g -module-cache-path /Users/aaa/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-generated-files.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-own-target-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-all-target-headers.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-project-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos/include -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources/arm64 -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/aaa/Desktop/XD/XD -emit-module-doc-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name XD -emit-module-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.d -emit-reference-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.swiftdeps -o /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.o
0 swift 0x000000010bf6bb6d PrintStackTraceSignalHandler(void*) + 45
1 swift 0x000000010bf6b5b6 SignalHandler(int) + 470
2 libsystem_platform.dylib 0x00007fffa9fdebba _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff568ee500 _sigtramp + 2895182176
4 swift 0x000000010944b00f llvm::Value* llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&, llvm::Constant*)>::callback_fn<getTypeMetadataAccessFunction(swift::irgen::IRGenModule&, swift::CanType, swift::ForDefinition_t)::$_3>(long, swift::irgen::IRGenFunction&, llvm::Constant*) + 255
5 swift 0x000000010944974a swift::irgen::emitLazyCacheAccessFunction(swift::irgen::IRGenModule&, llvm::Function*, llvm::GlobalVariable*, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&)> const&) + 1194
6 swift 0x000000010944b2cc getTypeMetadataAccessFunction(swift::irgen::IRGenModule&, swift::CanType, swift::ForDefinition_t, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&, llvm::Constant*)>&&) + 300
7 swift 0x000000010944ae45 emitCallToTypeMetadataAccessFunction(swift::irgen::IRGenFunction&, swift::CanType, swift::ForDefinition_t) + 117
8 swift 0x00000001094498dc swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 108
9 swift 0x000000010948707d void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<(anonymous namespace)::EmitPolymorphicArguments::emit(swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&)::$_14>(long, swift::irgen::GenericRequirement) + 861
10 swift 0x000000010947c9e1 (anonymous namespace)::PolymorphicConvention::enumerateRequirements(llvm::function_ref<void (swift::irgen::GenericRequirement)> const&) + 129
11 swift 0x0000000109486bdb swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 459
12 swift 0x00000001094e34f5 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2997
13 swift 0x00000001094ce268 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9080
14 swift 0x00000001093f2601 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1329
15 swift 0x00000001094b3fcb performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1259
16 swift 0x00000001093821c7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 23687
17 swift 0x000000010937a265 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17029
18 swift 0x000000010933782d main + 8685
19 libdyld.dylib 0x00007fffa9dd2255 start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/aaa/Desktop/XD/XD/XD/ViewController.swift /Users/aaa/Desktop/XD/XD/XD/AppDelegate.swift -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -F /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -enable-testing -g -module-cache-path /Users/aaa/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-generated-files.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-own-target-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-all-target-headers.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-project-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos/include -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources/arm64 -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/aaa/Desktop/XD/XD -emit-module-doc-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name XD -emit-module-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.d -emit-reference-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.swiftdeps -o /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.o
1. While emitting IR SIL function #_TFC2XD14ViewControllercfT7nibNameGSqSS_6bundleGSqCSo6Bundle__S0_ for 'init' at /Users/aaa/Desktop/XD/XD/XD/ViewController.swift:56:40
It says on the bottom of the error "swift:56:40" which I think means the 40th character of the 56th line, but all that's there is the opening bracket for the ViewController. Help?
The line to initialize the timer causes the error.
You can't call target/action methods on the top level of a class.
Either declare the variable as implicit unwrapped optional
var startTimer : Timer!
and initialize it in viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
startTimer = Timer.scheduledTimer(timeInterval: 0.4,
target: self,
selector: #selector(UIMenuController.update),
userInfo: nil,
repeats: true)
}
or declare the variable as lazy with a closure
lazy var startTimer : Timer = {
return Timer.scheduledTimer(timeInterval: 4.0, target: self, selector: #selector(update), userInfo: nil, repeats: false)
}()
and call it to start the timer
let _ = startTimer

Command failed due to signal: Segmentation fault: 11 occurred with Eureka 1.5.0

I have an error "Command failed due to signal: Segmentation fault: 11" when I compile my Swift code with a library Eureka. I am using Xcode Version 7.3 (7D175). My situation is similar to this question.
In the question above, some people were getting the same error with Eureka but it doesn't help me. I have just created a new project and done "pod install". Then I added "AgeRow.swift". So, this project is minimum and clean.
Here is a small sample that causes the segmentation fault error.
Please make sure this sample depends on Eureka 1.5.0.
I am writing my custom row named AgeInlineRow. When I comment out the AgeInlineRow class, the sample can be compiled. That is, other code seems not to be the cause of the error.
public final class AgeInlineRow: _AgeInlineRow, RowType, InlineRowType {
required public init(tag: String?) {
super.init(tag: tag)
onExpandInlineRow { cell, row, _ in
let color = cell.detailTextLabel?.textColor
row.onCollapseInlineRow { cell, _, _ in
cell.detailTextLabel?.textColor = color
}
cell.detailTextLabel?.textColor = cell.tintColor
}
}
public override func customDidSelect() {
super.customDidSelect()
if !isDisabled {
toggleInlineRow()
}
}
public func setupInlineRow(inlineRow: InlineRow) {
inlineRow.year_options = self.year_options
inlineRow.month_options = self.month_options
inlineRow.displayValueFor = self.displayValueFor
}
}
When I remove InlineRowType protocol and modify code to compile, this project can be compiled. So, I guess the cause is InlineRowType protocol and this is the limits of my debug abilities. I have no idea how can I bypass the issue. I have copied Eureka's PickerInlineRow code and modified. Of course PickerInlineRow doesn't cause segmentation fault.
I would be grateful if you could specify the reasons.
Here is the error message below.
0 swift 0x0000000108f344eb llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1 swift 0x0000000108f337d6 llvm::sys::RunSignalHandlers() + 70
2 swift 0x0000000108f34b4f SignalHandler(int) + 287
3 libsystem_platform.dylib 0x00007fff919e252a _sigtramp + 26
4 swift 0x0000000108d5f78b llvm::FoldingSet<llvm::AttributeSetNode>::NodeEquals(llvm::FoldingSetImpl::Node*, llvm::FoldingSetNodeID const&, unsigned int, llvm::FoldingSetNodeID&) const + 59
5 swift 0x000000010835e15f llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) + 367
6 swift 0x000000010835e2f0 llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateCall(llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) + 64
7 swift 0x0000000106d869c5 swift::irgen::IRGenModule::emitSILWitnessTable(swift::SILWitnessTable*) + 1829
8 swift 0x0000000106d1a0dd swift::irgen::IRGenModuleDispatcher::emitGlobalTopLevel() + 861
9 swift 0x0000000106da5a5e performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1278
10 swift 0x0000000106da5f06 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 70
11 swift 0x0000000106c89a1c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 15004
12 swift 0x0000000106c8541d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781
13 swift 0x0000000106c80e3c main + 1932
14 libdyld.dylib 0x00007fff91af25ad start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/ViewController.swift /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/AppDelegate.swift -primary-file /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/AgeRow.swift -target x86_64-apple-ios9.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -I /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator -F /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator -F /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator/Eureka -enable-testing -g -module-cache-path /Users/keta/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -serialize-debugging-options -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-generated-files.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-own-target-headers.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-project-headers.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/DerivedSources/x86_64 -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/keta/Documents/Swift/AgeInlineRowSample -emit-module-doc-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow~partial.swiftdoc -Onone -module-name AgeInlineRowSample -emit-module-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow~partial.swiftmodule -serialize-diagnostics-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.dia -emit-dependencies-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.d -emit-reference-dependencies-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.swiftdeps -o /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.o
P.S. I would like to make a custom inline row that has UIPickerView with two components.
I ran into this when i was implementing DateInlineRow. It seems swift compiler can not infer some types.
I ended up making DateInlineRow generic, even though i don't need the generic type for DateInlineRow.
Check out DateInlineRow implementation
/// A row with an NSDate as value where the user can select a date from an inline picker view.
public final class DateInlineRow_<T>: _DateInlineRow, RowType, InlineRowType {
required public init(tag: String?) {
super.init(tag: tag)
onExpandInlineRow { cell, row, _ in
let color = cell.detailTextLabel?.textColor
row.onCollapseInlineRow { cell, _, _ in
cell.detailTextLabel?.textColor = color
}
cell.detailTextLabel?.textColor = cell.tintColor
}
}
public override func customDidSelect() {
super.customDidSelect()
if !isDisabled {
toggleInlineRow()
}
}
}
public typealias DateInlineRow = DateInlineRow_<NSDate>
According to this your implementation should be.....
public final class AgeInlineRow_<T>: _AgeInlineRow, RowType, InlineRowType {
.....
}
public typealias AgeInlineRow = AgeInlineRow_<String>
Hope it helps

Resources