Post

Replies

Boosts

Views

Activity

Command SwiftCompile failed with a nonzero exit code (syntax is correct)
Hello, I'm new to Swift and I started making my pet project. I was building a UIKit user interface programmatically, and everything worked fine. Since some moment (I do not understand what really happened) Xcode started telling me that "Command SwiftCompile failed with a nonzero exit code" while it doesn't tell me that syntax is not correct. I found that this extension causes the problem: import Foundation import UIKit enum Constraints<T> { case setTop(to: T, constant: CGFloat = 0) case setBottom(to: T, constant: CGFloat = 0) case setLeading(to: T, constant: CGFloat = 0) case setTrailing(to: T, constant: CGFloat = 0) case toBottom(of: T, constant: CGFloat = 0) case toTop(of: T, constant: CGFloat = 0) case toLeading(of: T, constant: CGFloat = 0) case toTrailing(of: T, constant: CGFloat = 0) case toHeight(of: T, multiplier: CGFloat = 1) case toWigth(of: T, multiplier: CGFloat = 1) } extension UIView { func applyConstraints(_ constraints: Constraints<UIView>...) { self.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate(constraints.map { switch $0 { case setTop(to: let to, constant: let constant): return self.topAnchor.constraint(equalTo: to.topAnchor, constant: constant) case setBottom(to: let to, constant: let constant): return self.bottomAnchor.constraint(equalTo: to.bottomAnchor, constant: constant) case setLeading(to: let to, constant: let constant): return self.leadingAnchor.constraint(equalTo: to.leadingAnchor, constant: constant) case setTrailing(to: let to, constant: let constant): return self.trailingAnchor.constraint(equalTo: to.trailingAnchor, constant: constant) case toBottom(of: let of, constant: let constant): return self.topAnchor.constraint(equalTo: of.bottomAnchor, constant: constant) case toTop(of: let of, constant: let constant): return self.bottomAnchor.constraint(equalTo: of.topAnchor, constant: constant) case toLeading(of: let of, constant: let constant): return self.trailingAnchor.constraint(equalTo: of.leadingAnchor, constant: constant) case toTrailing(of: let of, constant: let constant): return self.leadingAnchor.constraint(equalTo: of.trailingAnchor, constant: constant) case toHeight(of: let of, multiplier: let multiplier): return self.heightAnchor.constraint(equalTo: of.heightAnchor, multiplier: multiplier) case toWigth(of: let of, multiplier: let multiplier): return self.widthAnchor.constraint(equalTo: of.widthAnchor, multiplier: multiplier) } }) } } I'm using it to reduce layout code: class MainVC: UIViewController { let searchAreaContainer = UIView() let tabBarContainer = UIView() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemBackground view.addSubview(searchAreaContainer) searchAreaContainer.applyConstraints( .setTop(to: view), .setLeading(to: view), .setTrailing(to: view), .toHeight(of: view, multiplier: 0.06) ) view.addSubview(tabBarContainer) tabBarContainer.applyConstraints( .setBottom(to: view), .setLeading(to: view), .setTrailing(to: view), .toBottom(of: searchAreaContainer) ) } } It's strange because there are no syntax errors. And some time before it worked fine. Can please anyone help what's causing this? I tried to clean Build folder, restarting Xcode and rebooting... Nothing Helped. I'm using MacBook Pro 2023 having M2 Max CPU with 32 Gb of RAM and Xcode Version 14.3 (14E222b) running on MacOs Ventura 13.3.1 (a) (22E772610a) I can send an url to GitHub if this problem is not caused by the code. Thank you.
1
0
1.9k
May ’23
Lots of "Failed to get renderer info [0x5 (os/kern) failure]" errors coming to console when I start debugging views in Xcode
I'm working on a pet project and there's one strange issue. When I open Debug View Hierarchy, a lot of similar errors appear in console. It looks like: 2023-06-14 15:47:07.356740+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.356807+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.359829+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.359904+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.359964+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.363650+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] 2023-06-14 15:47:07.363726+0300 BFB[19678:4582894] [API] Failed to get renderer info (client=0x42b6b2ed) [0x5 (os/kern) failure] (And so many of them) What are they caused by and how can I remove this? My pet project is just simple, only standard UIKit items like UIViews / UITableViews are used. I'm using Apple M2 Max CPU with 32 Gb RAM and Mac OS Ventura 13.4 Swift version is 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100) I created another Xcode from scratch, placed simple label and tried to debug its views - errors didn't appear. So may be it somehow related to project... but it doesn't really contain any special. Thank you.
1
0
1.7k
Jun ’23