I am using public struct ShareLink<Data, PreviewImage, PreviewIcon, Label> : View where Data : RandomAccessCollection, PreviewImage : Transferable, PreviewIcon : Transferable, Label : View, Data.Element : Transferable {}
And it is generating entitlement errors and not working reliably ( will transfer 1-3 items, but not 4+ ; will not work a second time)
Error is: Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.primitiveattribute AND originator doesn't have entitlement com.apple.runningboard.assertions.frontboard AND target is not running or doesn't have entitlement com.apple.runningboard.trustedtarget AND Target not hosted by originator)}> Received port for identifier response: <> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port Received port for identifier response: <> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false} elapsedCPUTimeForFrontBoard couldn't generate a task port Received port for identifier response: <> with error:Error Domain=RBSServiceErrorDomain Code=1 "Client not entitled" UserInfo={RBSEntitlement=com.apple.runningboard.process-state, NSLocalizedFailureReason=Client not entitled, RBSPermanent=false}
Code is
import SwiftUI
var images = Array<Image?>(repeating: nil , count: 200);
struct ShareTestGContentView: View { let columns = [GridItem(.fixed(165)), GridItem(.fixed(165))] private let twoColumnGrid = [ GridItem(.flexible(minimum: 40), spacing: 2), GridItem(.flexible(minimum: 40), spacing: 2) ] @State var selected = Set<Int>()
var body: some View {
topSection()
ScrollView {
LazyVGrid(columns: twoColumnGrid, spacing: 2) { // columns: [GridItem(.flexible())]) {
ForEach(1...100, id: \.self) { idx in
var cr = ( selected.contains(idx) ? 16.0 : 0 )
var lw = ( selected.contains(idx) ? 8.0 : 0 )
VStack{
Button(action: {
if selected.contains(idx) {
selected.remove(idx); cr = 0.0; lw = 0.0
} else {
selected.insert(idx); cr = 16.0; lw = 8.0
}
} , label: {
AsyncImage(url :URL(string: "https://picsum.photos/800/800?\(idx)")) { image in
let _ = ( images[idx] = image.image )
image.image
}.frame(width: boxHalf,height:boxHalf).drawingGroup()
})
}.overlay(
RoundedRectangle(cornerRadius: cr).stroke(Color.yellow, lineWidth: lw)
).drawingGroup()
}
}
}
}
func topSection() -> some View {
let imgarray = selected.compactMap { images[$0] }
return HStack {
ShareLink("",items: imgarray) { img in
SharePreview("images", image: Image(systemName: "captions.bubble.fill"))
}
}
}
}
#Preview { ShareTestGContentView() }