theoriginalbit / previewview Goto Github PK
View Code? Open in Web Editor NEWMake use of SwiftUI Previews for UIKit!
License: MIT License
Make use of SwiftUI Previews for UIKit!
License: MIT License
This may be more of an issue/lockdown of the Previews starting with Xcode 14.
When trying to use the same preview code that works with Xcode 13.4.1, the Preview gives a compile error:
Compiling failed: '__designTimeString(_:fallback:)' is only available in iOS 13.0 or newer
Here is my preview code:
// MARK: - Preview
#if canImport(SwiftUI) && DEBUG
import SwiftUI
@available(iOS 13, *)
struct ContentItemHeaderView_Previews: PreviewProvider {
static let headerView: ContentItemHeaderView = {
let view = ContentItemHeaderView()
view.imageView.image = UIImage(named: "first-launch-background4")
view.titleText = "Connect With Mother Nature When You Really Want To"
view.publisherText = "Apple.com"
view.authorNameText = "Jonny Appleseed"
return view
}()
static var previews: some View {
Group {
ViewPreview(headerView)
.previewLayout(.fixed(width: 390, height: 95))
ViewPreview(headerView)
.preferredColorScheme(.dark)
.previewLayout(.fixed(width: 390, height: 95))
}
}
}
#endif
Could not find module 'PreviewView' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator
SPM builds for arm64 despite the project explicitly specifying arm64 as an excluded architecture for the Simulator.
Due to this, a project that depends on older libraries that have no simulator[arm64] support fails to link with this library.
A CocoaPods support would have solved this issue due to Cocoapods being able to support architecture exclusion
SwiftUIPreview render exceed 30 seconds and throw error when preview a custom view inside a large app (take over 10 mins to compile)
PreviewView
as demonstrated in Examples doesnt seem to work with latest HEAD.
Examples on Readme should be Preview
struct YourViewController_Previews: PreviewProvider {
static var previews: some View {
Preview(for: YourViewController())
.edgesIgnoringSafeArea(.all)
.previewDevice(PreviewDevice(rawValue: "iPhone 11"))
}
}
Readme uses PreviewView
in examples
struct YourViewController_Previews: PreviewProvider {
static var previews: some View {
Preview(for: YourViewController())
.edgesIgnoringSafeArea(.all)
.previewDevice(PreviewDevice(rawValue: "iPhone 11"))
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.