Post

Replies

Boosts

Views

Activity

Reply to Xcode 12 (17219) : Unable to install apps on devices
Found the solution. Apparently this is a known (SR-13343) in Xcode 12. It has to do with "SwiftPM binaryTarget dependency and code signing", where Xcode fails to sign the frameworks that are provided by SwiftPM. See this link: https://forums.swift.org/t/swiftpm-binarytarget-dependency-and-code-signing/38953 If you read thru you will find a link to the work around, by adding a script to the build phase of the target: Work Around Link: pspdfkit.com/guides/ios/current/knowledge-base/library-not-found-swiftpm/ I just added the script to my app, everything is now good!
Oct ’20
Reply to Snapshot of a SwiftUI View
//	Convert any SwiftUI View to UIImage import SwiftUI struct ContentView: View { 		let imageSize: CGSize = CGSize(width: 1000, height: 1000) 		var body: some View { 				testView 						.frame(width: 300, height: 300) 						.onTapGesture { 								// Capture high res image of swiftUI view 								let highresImage = testView.asImage(size: imageSize) 								// Now you can do what ever with the highresImage 						} 		} 		var testView: some View { 				ZStack { 						Color.blue 						Circle() 								.fill(Color.red) 				} 		} } extension UIView { 		func asImage() -> UIImage { 				let format = UIGraphicsImageRendererFormat() 				format.scale = 1 				return UIGraphicsImageRenderer(size: self.layer.frame.size, format: format).image { context in 						self.drawHierarchy(in: self.layer.bounds, afterScreenUpdates: true) 				} 		} } extension View { 		func asImage(size: CGSize) -> UIImage { 				let controller = UIHostingController(rootView: self) 				controller.view.bounds = CGRect(origin: .zero, size: size) 				let image = controller.view.asImage() 				return image 		} }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’20