Fix File Not Found libarclite_iphonesimulator.a in Xcode 14.3
Posts for: #Xcode
How to fix Xcode: “Could Not Locate Device Support Files” error
There may be a time when you try to run your app in your device and you get the following error:
Could not locate device support files.
This iPhone (Model …) is running iOS 13.4 (11E608c), which may not be supported by this version of Xcode.
This issue usually happened when you are still developing your app using old version of Xcode but your device have already been upgraded to latest iOS version that is not supported by Xcode.
How to create multiple screen previews in SwiftUI
Today I learned that you can actually create multiple Xcode screen previews in SwiftUI.
Assuming you have a SwiftUI View named ContentView. In the PreviewProvider, create a Group and init multiple ContentView() children inside of it. For example:
struct ContentView_Previews: PreviewProvider { static var previews: some View { Group { ContentView() .previewDevice(PreviewDevice(rawValue: "iPhone 11")) .previewDisplayName("iPhone 11") // Optional ContentView() .previewDevice(PreviewDevice(rawValue: "iPhone 8")) .previewDisplayName("iPhone 8 Dark") .environment(\.colorScheme, .dark) .environment(\.sizeCategory, .accessibilityLarge) ContentView() .
How to use SwiftUI in a UIKit project
Did you know that SwiftUI can be use in UIKit project? To use SwiftUI in UIKit project, you have to make use of UIHostingViewController. It is a UIViewController that basically “host” a SwiftUI view.
Assuming you have a SwiftUI View named SwiftUIView like so:
let swiftUIView = SwiftUIView() Initializing it programmatically To initialize it programmatically, set the SwiftUI View as the rootView of the UIHostingController.
let vc = UIHostingController(rootView: swiftUIView) self.
How to use Xcode 11’s Swift Package Manager in your project
Similar like Cocoapods or Carthage, you can use Swift Package Manager to manage the dependencies in your Cocoa project.
With the latest Xcode 11, there is now a native support for Swift Package Manager for you to use it directly in your project.
Adding a new package To add a new package with Swift Package Manager is really easy. Go to the following Xcode’s menu:
File > Swift Packages > Add Package Dependency.