Search results for

column

2,046 results found

Post

Replies

Boosts

Views

Activity

How can I fix Context in environment is not connected to a persistent store coordinator
I am working on an app that will allow users to share or save the view via a share sheet. To capture the view I am using the ImageRenderer. When I go to click on the share button, it does not work and says, Unable to render flattened version of PlatformViewControllerRepresentableAdaptor, Never, _UnaryViewAdaptor>>. When I go to the issues it will say, Context in environment is not connected to a persistent store coordinator: . How can I fix this. This is the code. struct DividendView: View { @Environment(.managedObjectContext) var moc @FetchRequest(sortDescriptors: [ SortDescriptor(.stock_name) ]) var dividends: FetchedResults @State private var showingAddScreen = false @State private var showingShare = false // @EnvironmentObject var vm = ViewModel() @State private var renderedImage: Image? @State private var selectedName: String? @State private var expanded: Bool = false let dividend: Dividend // @State private var items: [Any] = [] // @State private var sheet: Bool = false // let columns = [
2
0
1.2k
Apr ’23
Reply to Tabular classification using Create ML Components
A tabular classifier will return both the classification probabilities and the most likely labels. If your target column name is target the predicted labels column is also going to be target while the probability distributions is going to be in targetProbabilities. You can always print the whole data frame with print(result) and see what the columns are. Hope this helps.
Apr ’23
Tabular classification using Create ML Components
I am working on a project that involves tabular classification using Create ML Components and I'm having trouble getting my model to work correctly. I've been following the official documentation here: https://developer.apple.com/documentation/createmlcomponents/ and also i have followed the wwdc talks. This one seems to be the most relevant one: https://developer.apple.com/wwdc22/10019 In that talk the construction of a tabular regressor is explained(20:23 Tabular regressor) . I tried using BoostedTreeClassifier similar to that. I am having trouble getting it to work though. While training with 5 featureColumns and one annotation columns appears to have worked. i am unsure how to get the label (the categorical value that the model is supposed to return) after calling .predict . This is the last bit of the example from apple (tabular regression) static func predict( type: String, region: String, volume: Double ) async throws -> Double { let model = try task.read(from: parametersURL) let dataFrame:
1
0
1.2k
Apr ’23
SwiftUI LazyVGrid Positioning
Hello, I want to create a dashboard with LazyVGrid. I made a lineup like 2-2-1. It's okay as the images in the first 2 rows are the same, but I can't fit last image exactly because the bottom image is bigger than the others. I am attaching a screenshot for your better understanding. How can I center currency converter image overflowing from the screen? struct ContentView: View { let columns = [ GridItem(.fixed(150), spacing: 30), GridItem(.fixed(150), spacing: 30),] var body: some View { NavigationView{ LazyVGrid(columns: columns) { // WEIGHT * MASS NavigationLink(destination: UnitView()) { Image(systemName: scalemass) .font(.system(size: 60)) .padding() .frame(width: 150, height: 150, alignment: .center) .background(Rectangle().fill(Color.purple.opacity(0.5)) .shadow(radius: 3)).cornerRadius(20) .foregroundColor(.black) .overlay(Text(Weight) .foregroundColor(.black) .padding() .font(.system(size: 22)), alignment: .bottom )} //DISTANCE * NavigationLink(destination: DistanceView()) {
2
0
4.3k
Apr ’23
Reply to SwiftUI LazyVGrid Positioning
Hi, I saw your question a few hours ago and I don't know if you are still looking for an answer at this time. Anyways, here is the solution with an explanation for anyone who might be interested in it. You have a LazyVGrid with two columns which is what you are seeing in the screenshot you've provided. UnitView(), TemperatureView() and CurrencyView() form the first column, whereas DistanceView() and TimeView() form the second column. Since you did not specify the alignment property, it assumed its default value, which is HorizontalAlignment.center in the case of LazyVGrid. If you specify alignment as HorizontalAlignment.leading, then the view would look somewhat like how you want it to look. But, it doesn't look good because the cards are not in the middle of the screen. To solve this, you would have to embed LazyVGrid into a LazyVStack, take the CurrencyView() out of the LazyVGrid, and place it outside LazyVGrid but within LazyVStack. struct ContentView: View { let columns
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’23
NavigationLink selected state area is larger than the underlying view
I'm using a NavigationSplitView with two columns for a macOS app. The sidebar column shows a list of items and the right pane shows the details for the selected item. I'm using NavigationLink to create clickable sidebar items and pass my own View-type struct that displays the row information. When I decided to add a slight background color to the rows & slight hover state, I noticed that the row view container is smaller than the NavigationLink when selected (I made the colors brighter to emphasize the issue - rows have a gray background & brighter gray hover state and blue is the built-in styling provided by NavigationLink). My code for the NavigationSplitView which lives in the body of the main ContentView: NavigationSplitView(columnVisibility: $columnVisibility) { VStack{ if userSettings.cases.isEmpty { Text(Press + to add your first case) .font(.title2) .foregroundColor(.gray) .multilineTextAlignment(.center) } else { List(userSettings.cases, selection: self.$selectedCase) { case
1
0
1.1k
Apr ’23
Reply to Best way to make a grid with both top and left headers
You can definitely use Grid for this! You can do something like this: Grid{ GridRow { ForEach(0..<3) { _ in Text(header) .padding() } } ForEach(0..<3){ num in GridRow { Text((num)) .padding() ForEach(0..<2) { _ in Text(X) .padding() } } } } The first GridRow would iterate through your data for your headers. Here, I have 3 headers as I will only be using 3 columns for my data. Then, I have a ForEach that gives me 3 more GridRows. Each of these contain the label for the vertical axis label and then another ForEach that contains the data for that row. This gives you both vertical and horizontal axis labels and the data is laid out by row.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’23
NavigationSplitView and .navigationDestination
I've run into two issues using NavigationSplitView with .navigationDestination modifiers. First, programmatic navigation using .navigationDestination(isPresented: destination) does not seem to work when used in the content column of a NavigationSplitView It does, however, work from the sidebar / first column. Second, it appears that we need to add redundant .navigationDestination modifiers on iPhone and iPad to handle how NavigationSplitView is adapted when used on iPhone. Specially, when it is collapsed into a NavigationStack. Also, when an iPad UI is collapsed to a NavigationStack via Stage Manager, then expanded again, .navigationDestination modifiers in the content column seem to get lost, preventing the content list from working going forward. This somewhat explains why dynamically adding .navigationDestinations via the first column push isn't sufficient. However it results in a broken UI. Is there one location we can place .navigationDestination modifiers to work both
1
0
696
Apr ’23
Why wont my decoder parse .json files
launchdata.json: [ { name: Smartcard, imageName: Smartcard, description: A all new way to buy and sell stuff featuring RFID and NFC for touchless transactions and with local server you can pay with your phone., department: Ticki Finance, productid: 1737484, id: 1, creator: The Ticki Team }, { name: Ink pad, imageName: Inkpad, description: A quick and easy way to take fingerprints and stamp stamps:), And with a quick water activation taking only 15 seconds you can setup in no time. Also, refilling the ink chamber is super easy, all you have to do is put ink in the middle hole., department: Ticki Design, productid: 7338388, id: 2, creator: The Ticki Team }, { name: Wallet, imageName: Wallet, description: Ever had issues with your credit cards falling out of your pocket/wallet? Well this fixes any issues. Introducing Ticki Wallet. , department: Ticki Finance, productid: 2444495, id: 3, creator: The Ticki Team }, { name: Pencil Case, imageName: PencilCase, description: I always lose my my pencils. How about you?
4
0
671
Apr ’23
Reply to NavigationLink and .navigationDestination Hang and Infinite Loop
You're pushing multiple stacks that share the same path. So one stack is trying to push another stack which is trying to push the other stack.... It's a happy coincidence that ObservableObject doesn't infinite loop, I'm surprised it does not. 2 general rules will help when using the navigation system: move navigationDestination modifiers as high up in the view hierarchy. This is more efficient for the Navigation system to read up front than with potentially every view update. Don't push stacks onto stacks, and try to avoid entire NavigationStacks coming and going from the columns of a NavigationSplitView. NSV will adopt the stack and integrate its state with the state of the whole split view. I ran this example on macOS and it looked as expected import SwiftUI import OSLog final class NavigationModel: ObservableObject { @Published var path = NavigationPath() { didSet { print(navigationModel.path.count: (path.count)) } } } struct Report: Hashable { var title: String = Report Title } private let logger
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’23
Reply to Overlaid items hide behind neighbouring views
Finally I went with something similar to what you suggested : var body: some View { GeometryReader {geometry in let size = min(geometry.size.width, geometry.size.height) let tileSize = size / 8 VStack( spacing: 0.0) { ForEach((0..<8).reversed(), id: .self) { rowIndex in HStack(spacing: 0) { ForEach((0..<8), id: .self) { columnIndex in TileView(x: rowIndex, y: columnIndex) } } } }.overlay(alignment: .bottomLeading){ ForEach(Array(model.initialState.keys), id:.self) { let (row, column) = $0.tuple() let piece = model.initialState[$0]! let offset = model.offset(piece: piece, val: tileSize) PieceView(type: piece.figure, side: piece.side) .frame(width: tileSize, height: tileSize) .offset(x: CGFloat(row) * tileSize, y: -CGFloat(column) * tileSize) .offset(offset) } } } } I thought Z Indexes are global ... then what they refer to ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’23
Reply to Creating Floor Plan with RoomPlan
actually what you need to do is remove the y component and not the z component, if you want to convert from 3D->2D, from CapturedRoom you get dimensions.x (wall length) and (transform) .columns.3.x, transform .columns.3.z) is the coordinate of the center of the wall and the direction(transform.columns.0.z, transform.columns.0.z), is the direction of the wall, now you there is a starting and ending point of a wall, similar to other things
Topic: Spatial Computing SubTopic: ARKit Tags:
Mar ’23