I use NSPersistentCloudKitContainer. It seems that it the data synced in iCloud after a few seconds. However, I get the following warnings in the console. I do not understand what is it for.
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(813): <NSCloudKitMirroringDelegate: 0x280b051e0>: Successfully set up CloudKit integration for store: <NSSQLCore: 0x280024a00> (URL: file:///private/var/mobile/Containers/Shared/AppGroup/89D9D17C-03DF-48E4-83C3-DB23A8FE0D6F/TestData.sqlite)
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndScheduleImportIfNecessary:]_block_invoke(2033): <NSCloudKitMirroringDelegate: 0x280b051e0>: Scheduling automated import with activity: <CKSchedulerActivity: 0x281f51590; additionalXPCActivityCriteria={
Priority = Utility;
}, containerID=<CKContainerID: 0x283c612e0; containerIdentifier=iCloud.io.test.testData, containerEnvironment="Sandbox">, identifier=com.apple.coredata.cloudkit.activity.import, priority=2>
Could you please explain what is this warning for and what should I do to fix it?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
My App has been rejected due to not having a functional link to Terms Of Use.
I have chosen Apple’s Standard License Agreement. Do I still need to have a Terms Of Use Policy ?
Thanks In advance.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Review
App Store
App Store Connect
I have asked this question on stack overflow. You may read it there, because I have included 2 GIFs that illustrates the problem.
I am building a custom segmented control. This is the code that I have written.
struct SegmentedControl: View {
		private var items: [String] = ["One", "Two", "Three"]
		
@Namespace var animation:Namespace.ID
@State var selected: String = "One"
var body: some View {
ScrollView(.horizontal) {
HStack {
ForEach(items, id: \.self) { item in
Button(action: {
withAnimation(.spring()){
self.selected = item
}
}) {
Text(item)
.font(Font.subheadline.weight(.medium))
.foregroundColor(selected == item ? .white : .accentColor)
.padding(.horizontal, 25)
.padding(.vertical, 10)
.background(zStack(item: item))
}
}
} .padding()
}
}
private func zStack(item: String) -> some View {
ZStack{
if selected == item {
Color.accentColor
.clipShape(Capsule())
.matchedGeometryEffect(id: "Tab", in: animation)
} else {
Color(.gray)
.clipShape(Capsule())
}}
}
}
A control is Blue when it is selected.
However, sometimes if you navigate back and forth very fast, the Color.accentColor disappears
Info, It is easier to test it on a physical device rather than a simulator.
I have a NavigationView that contains a UItableView at the bottom. At the top, there are some more views. I am using UItableView because I need both of its trailing and leading swipe actions.
Since the table view is a subview of NavigationView, is there any way to access it in UITableView, in its didSelectRowAt method?		func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
				let destination = Text("Destination")
				let host = UIHostingController(rootView: destination)
/*TODO: - Navigate to Destination
*navigationController.pushViewController(host, animated: true)/
}
UITableView
struct TableView: UIViewRepresentable {
		@State var rows = ["London", "Paris", "Oslo"]
		
func makeUIView(context: Context) -> UITableView {
let table = UITableView()
table.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
table.dataSource = context.coordinator
table.delegate = context.coordinator
return table
}
func updateUIView( uiView: UITableView, context: Context) {
}
func makeCoordinator() -> Coordinator {
return Coordinator(rows: $rows)
}
class Coordinator: NSObject, UITableViewDataSource, UITableViewDelegate {
@Binding var rows: [String]
init(rows: Binding<[String]>) {
self.rows = rows
}
func tableView( tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.rows.count
}
func tableView( tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")
cell?.textLabel?.text = self.rows[indexPath.row]
return cell!
}
func tableView( tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let destination = Text("Destination")
let host = UIHostingController(rootView: destination)
}
func tableView( tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let add = UIContextualAction(style: .normal,title: "Add") { (action, view, success) in
success(true)
}
add.backgroundColor = .gray
return UISwipeActionsConfiguration(actions: [add])
}
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let remove = UIContextualAction(style: .normal,title: "Remove") { (action, view, success) in
success(true)
}
remove.backgroundColor = .red
let edit = UIContextualAction(style: .normal,title: "Edit") { (action, view, success) in
success(true)
}
edit.backgroundColor = .gray
let color = UIContextualAction(style: .normal, title: "Color") { (action, view, success) in
success(true)
}
return UISwipeActionsConfiguration(actions: [remove, edit, color])
}
}
}
View that contains the tableView
struct ContentView: View {
		var body: some View {
				NavigationView {
						VStack {
								HStack {
										Text("Some other Views")
								}
								TableView()
						}
				}
		}
}
I have a simple SwiftUI list that I want to scroll to a row when a user click on a button. This is my code that it suppose to work, but it does not do.
struct ContentView: View {
		var body: some View {
				ScrollViewReader { proxy in
						VStack {
								Button("Jump to #50") {
proxy.scrollTo(5, anchor: .top)
}
List(0..<100) { i in
Text("Example \(i)")
.id(i)
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
I tested it on iOS 14.2 both on simulator and a physical device.
I read srollTo's documentation - https://developer.apple.com/documentation/swiftui/scrollviewproxy/scrollto(_:anchor:) but there is not much info.
So how to scroll to a row, for example, row 50?