Post

Replies

Boosts

Views

Activity

Reply to CIImage generate CGImage is unavailable
It renders as expected. However your texture background's is black just like your text colour. Because CGContext is premultiplying alpha. If you change the context's background to red for example, you will see it. CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast|kCGImageByteOrder32Big); CGContextSetFillColorWithColor(context, [[UIColor redColor] CGColor]); CGContextFillRect(context,  CGRectMake(0, 0, width, height)); To bypass CGContext all together, try rendering directly to an MTLTexture using CIContext's render(_: to: commandBuffer: bounds: colorSpace:), you can find more info here: Apple Developer Doc
Nov ’22
Reply to SWIFTUI DatePicker with Calendar identifier
To make SwiftUI's DatePicker display different calendars, you need to set the calendar environment value. .environment(\.calendar, Calendar(identifier: .hebrew) Using your example, to display a Hebrew calendar add the modifier above Struct DateView: View { @State var selectedDate = Date() let dateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateStyle = .medium return formatter }() var body: some View { DatePicker("Please enter a date", selection: $selectedDate, displayedComponents: .date) .datePickerStyle(WheelDatePickerStyle()) .environment(\.calendar, Calendar(identifier: .hebrew)) Divider() Text ("You selected \(selectedDate,formatter: dateFormatter)") Spacer() } }
Nov ’22