Post

Replies

Boosts

Views

Activity

Add hosting view controller to UIKit View
Hi All, I am trying to add an UIHostingViewController to my UIViewController, to cover the screen. Unfortunately, I keep getting this error (Thread 1: "NSLayoutConstraint for <_TtGC7SwiftUI19UIHostingControllerV5Pickt10ViewRouter_: 0x7fa32a37c3f0>: Constraint items must each be a view or layout guide.") from my code: let controller = UIHostingController(rootView: ViewRouter(join: join, create: create, showPicker: showPicker, setMock: setMock))         controller.view.translatesAutoresizingMaskIntoConstraints = false         view.addSubview(controller.view)         view.addConstraints([             NSLayoutConstraint(item: controller,                                attribute: .top,                               relatedBy: .equal,                               toItem: view.safeAreaLayoutGuide,                               attribute: .top,                               multiplier: 1,                               constant: 0),             NSLayoutConstraint(item: controller,                                attribute: .leading,                                relatedBy: .equal,                                toItem: view.safeAreaLayoutGuide,                                attribute: .leading,                                multiplier: 1,                                constant: 0),             NSLayoutConstraint(item: controller,                                attribute: .trailing,                               relatedBy: .equal,                               toItem: view.safeAreaLayoutGuide,                               attribute: .trailing,                               multiplier: 1,                               constant: 0),             NSLayoutConstraint(item: controller,                                attribute: .bottom,                               relatedBy: .equal,                               toItem: view.safeAreaLayoutGuide,                               attribute: .bottom,                               multiplier: 1,                               constant: 0)           ])
1
0
965
May ’22
MKLocalSearch produces SearchAttribution Error and Error Domain=GEOErrorDomain Code=-8
Hi, I am trying to use mapkit auto completion in my SwiftUI project and whenever I run the view, I get a bunch of errors such as: 2022-02-12 19:45:59.095462-0800 Pickt[64199:2417526] [SearchAttribution] No matching attribution source found for com.timeout 2022-02-12 19:45:59.095595-0800 Pickt[64199:2417526] [SearchAttribution] No matching attribution source found for com.theculturetrip 2022-02-12 19:45:59.095822-0800 Pickt[64199:2417526] [SearchAttribution] No matching attribution source found for com.redtri 2022-02-12 19:45:59.095909-0800 Pickt[64199:2417526] [SearchAttribution] No matching attribution source found for com.fotospot 2022-02-12 19:45:59.096549-0800 Pickt[64199:2417526] [SearchAttribution] Error loading attribution info for identifier com.timeout from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for com.timeout" UserInfo={NSDebugDescription=No matching attribution source found for com.timeout} 2022-02-12 19:45:59.096679-0800 Pickt[64199:2417526] [SearchAttribution] Error loading attribution info for identifier com.theculturetrip from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for com.theculturetrip" UserInfo={NSDebugDescription=No matching attribution source found for com.theculturetrip} 2022-02-12 19:45:59.096761-0800 Pickt[64199:2417526] [SearchAttribution] Error loading attribution info for identifier com.redtri from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for com.redtri" UserInfo={NSDebugDescription=No matching attribution source found for com.redtri} 2022-02-12 19:45:59.096837-0800 Pickt[64199:2417526] [SearchAttribution] Error loading attribution info for identifier com.fotospot from geod: Error Domain=GEOErrorDomain Code=-8 "No matching attribution source found for com.fotospot" UserInfo={NSDebugDescription=No matching attribution source found for com.fotospot} and then the auto complete breaks until I dismiss and reload the view. Full Code I am in desperate need of help, thx in advance!
1
0
995
Feb ’22
Convert Key Pairs Array To Struct
I have a key pairs array: ["Id": XmGjU9gxS5s0CzP4S6-bHw, "Name": Pizzeria La Rocca, "Url": https://www.yelp.com/biz/pizzeria-la-rocca-seattle?adjust_creative=sxCnBn1t8D3B-4MLGRB_2g&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=sxCnBn1t8D3B-4MLGRB_2g, "Rating": 5, "Img": https://s3-media1.fl.yelpcdn.com/bphoto/kE6hbIfi4WdlIW52SF5KUw/o.jpg] How do I convert this to my struct? struct RestaurantListViewModel: Identifiable {     let name: String     let imageUrl: URL     let id: String     let rating: Double     let url: String //    let category: Array<String> } Thank you in advanced!
1
0
894
Sep ’21
Alignment Issues
I have this one view that seems to be much lower than it is supposed to be. Can someone please tell me what I am doing wrong? Code Here is a link to the image(I was having trouble uploading directly) https://drive.google.com/file/d/16HIhPCrXtybbh9JD7QRbc5ccBVj9Dhiq/view?usp=sharing
0
0
595
Sep ’21
Deeplinking
I have looked around and am confused about deep linking to a view that is not the default view, or passing information to that view which then impacts what is shown. Please help. Note: I am using the UIKit lifecycle
2
0
623
Sep ’21
List Sections
I have this struct: struct Final_Restaurant_View: View {     var data: [RestaurantListViewModel]     @State private var isHome = false     var body: some View {         NavigationView{             VStack {                 List(data) {                     data in                         layout(data: data)                 }                 .listStyle(GroupedListStyle())                 Button(action: {                     isHome = true                 }, label: {                     Text("Go Home")                 })                 .padding()             }             .fullScreenCover(isPresented: $isHome, content: {                 ContentView()             })             .navigationBarTitle("Results")         }     } } Which is supposed to get data and display it in a list. The problem is that I can't find anything about sections on a table structured like this and therefore, it goes wack with the section title. Any Ideas???
5
0
1.3k
Sep ’21