Search results for

column

2,061 results found

Post

Replies

Boosts

Views

Activity

Reply to Dynamic e random matrix
Claude31, Exactly. In the application, the user will answer some questions and according to their answer, a certain column X row will be filled with information. Like this: The cell (col X row) to be filled depends on the user's response The content will be text, a string. You can restart the app at any time, when previously used cells must be cleaned.
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’24
Reply to SwiftUI indentation in multiline string
Hi there! Decided to post a reply, as I found a working solution. You can define custom grid items width and use it with LazyVGrid: struct MyView: View { let bulletListGridItems = [ GridItem(.fixed(10)), GridItem() ] var body: some View { LazyVGrid(columns: bulletListGridItems, alignment: .leading, content: { GridRow { VStack(alignment: .leading, content: { Text(•) Spacer() }) Text(Play the course as you find it and play the ball as it lies.) } } } This would return: Note, I'm using a Stack with Spacer() to push the bullet to the top of the grid row
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’24
NSTableView.reloadData(forRowIndexes:columnIndexes:) causes wrong subview layout when usesAutomaticRowHeights = true
I have a table view where each row has two labels, one left-aligned and one right-aligned. I would like to reload a single row, but doing so causes the right-aligned label to hug the left-aligned label. Before the reload: After the reload: Reloading the whole table view instead, or disabling automatic row height, solves the issue. Can a single row be reloaded without resorting to these two workaround? class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate { override func loadView() { let tableView = NSTableView() tableView.translatesAutoresizingMaskIntoConstraints = false tableView.dataSource = self tableView.delegate = self tableView.usesAutomaticRowHeights = true let column = NSTableColumn() column.width = 400 tableView.addTableColumn(column) let scrollView = NSScrollView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) scrollView.translatesAutoresizingMaskIntoConstraints = false scrollView.documentView = tableView view = scrollView Timer.scheduledTimer(withT
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
499
Jan ’24
iPhone won't sync after iOS 17.2.1 upgrade
I have an iPhone 11 (MWJE2LL/A) for personal and development use. When I upgraded it to iOS 17.2.1 it stopped sync'ing to my computers. I can't sync or restore the iPhone. Both Finder and Music show the iPhone in the left column, but time out after 60 secs of Loading..., finally stating: The selected device could not be found. Xcode also does not see the connected iPhone, and does not list it in the available iOS build destinations. I have tried sync'ing using numerous Apple USB cables and computers (Mac Pro, 16 MacBook Pro, Mac Studio) all running macOS Sonoma 14.1. Is this a known bug in iOS 17.2? Is there a workaround so I can restore the iPhone and continue development work?
1
0
760
Jan ’24
The link cannot be activated.
Hi all, I am new to Swift and I have found an issue which I can't fix. I use a TabView and if I change the views a few times, and go back to this view I get this error and I can't tab on any of the views any longer in the Navigation Stack. The way to fix it, is to force close the app and reopen it. Error message: A NavigationLink is presenting a value of type “NavigationItem” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. Note: Links search for destinations in any surrounding NavigationStack, then within the same column of a NavigationSplitView. Code: struct ToolsMainView: View { @State private var navigationPath = NavigationPath() var body: some View { NavigationStack(path: $navigationPath) { VStack { ScrollView(showsIndicators: false) { VStack { ForEach(navigationItems) { item in NavigationLink(value: item) { HStack(alignment: .center, spacing: 12) { Image(systemName: item.icon) Text(item.title) Spacer() Image(systemNa
1
0
1.1k
Jan ’24
Reply to Understanding the swift language and its documentation
Hi. I'm glad you asked this because I'm constantly tripping over SwiftUI syntax myself. There are a bunch of ways to express the contents of your NavigationSplitView. Note that SwiftUI is not Swift. It looks like Swift, it is written in Swift, but it is a domain specific language for creating descriptions of user interfaces. It extends the Swift language. If you look at the documentation for NavigationSplitView in Xcode's Documentation viewer, you'll find struct NavigationSplitView where Sidebar : View, Content : View, Detail: View and if you click on View, you'll find that it is a protocol. The initializer you are using is the one which creates a two-column view, with no control over the visibility of the columns public init(@ViewBuilder sidebar: () -> Sidebar, @ViewBuilder detail: () -> Detail) where Content == EmptyView The parameters (labelled sidebar and detail here) are closures - functions returning structs conforming to the View protocol. my SidebarView and DetailView are Views
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’23
How to select item or "date" in VGrid
HStack { ForEach(days, id:.self) { day in Text(day) .font(.system(size: 12, weight: .medium)) .frame(maxWidth: .infinity) } } LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 7), spacing: 20) { ForEach(fetchDates()) { value in ZStack { if value.day != -1 { let hasAppts = manager.days.contains(value.date.monthDayYearFormat()) NavigationLink(value: AppRouter.day(date: value.date)) { Text((value.day)) .foregroundColor(hasAppts ? .blue : .black) .fontWeight(hasAppts ? .bold : .none) .background { ZStack(alignment: .bottom) { Circle() .frame(width: 48, height: 48) .foregroundColor(hasAppts ? .blue.opacity(0.1) : .clear) if value.date.monthDayYearFormat() == Date().monthDayYearFormat() { Circle() .frame(width: 8, height: 8) .foregroundColor(hasAppts ? .blue : .gray) } } } } .disabled(!hasAppts) } else { Text() } } .frame(width: 32, height: 32) } } } .padding() }
0
0
321
Dec ’23
Scrollview not scrolling...
I embedded a vertical scrollview to a calendar that was originally horizontally navigation with buttons. But its isn't scrolling changing months. What am I missing? let days = [SUN, MON, TUE, WED, THU, FRI, SAT] @State private var selectedMonth = 0 @State private var selectedDate = Date() @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { ScrollView { VStack { Rectangle() .frame(height: 1) .foregroundColor(.gray) VStack(spacing: 20) { // Month Selection HStack { Spacer() Button { withAnimation { selectedMonth -= 1 } } label: { Image(systemName: lessthan.circle.fill) .resizable() .scaledToFit() .frame(width: 32, height: 32) .foregroundColor(.gray) } Spacer() Text(selectedDate.monthYearFormat()) .font(.title2) Spacer() Button { withAnimation { selectedMonth += 1 } } label: { Image(systemName: greaterthan.circle.fill) .resizable() .scaledToFit() .frame(width: 32, height: 32) .foregroundColor(.gray) } Spacer() } HStack { ForEach(days, id:.self) { day in Text(day) .font
0
0
319
Dec ’23
Reply to DataFrame's Column doesn't support array of dictionary
I've finally initialized the DataFrame like this var trainingData: DataFrame = [keywords : data.trainingKeywords, target: data.trainingTargets] but now i'm getting this error when creating my data model like this: let model = try MLLinearRegressor(trainingData: trainingData, targetColumn: target) CreateML Type Error: Column keywords has element of unsupported type Any. Any idea from there on?
Topic: Machine Learning & AI SubTopic: Core ML Tags:
Dec ’23
NavigationSplitView: Make button clickable in detail-section safe area
Hi, I've tried to find a solution for this problem for weeks now but it seems no one knows how to solve it and Apple doesn't seem to care. I have a NavigationSplitView with two columns. In the detail column I have a button - or any other clickable control - which is placed in the very top where usually the safe area resides. The button is NOT clickable when he is in the safe area and I have NO idea why. I know I can place buttons in safe areas of other views and they are clickable. Please have a look at the code: `struct NavTestView: View { var body: some View { GeometryReader { p in VStack(spacing: 0) { NavigationSplitView { List(names) { Text($0.name).frame(width: p.size.width) .background(Color.green) }.listRowSpacing(p.size.height * 0.15 / 100 ) .toolbar(.hidden, for: .navigationBar) } detail: { TestView().ignoresSafeArea() }.frame(width: p.size.width, height: p.size.height, alignment: .topLeading) .background(Color.yellow) } } } } struct TestView: View { var body: some View { GeometryRe
1
0
673
Dec ’23
tabView in Vstack in Scrollview
I'm creating a view which is scrollable and has Vstack which include tabView what I'm facing that when I added the TabView in Vstack , it's vanished unless I specify the height for the TabView and when I specify the height of the tabview any lazy view inside it , it loose it's laziness because I already specify the height which means it render all it's content in advance . BTW I have to use tabview because I need the paging effect : here's the full code ScrollView{ LazyVStack{ Text(hello) TabView(selection: $selectedIndex){ LazyVGrid(columns: columns2) { ForEach(myItems.indices, id: .self) { item in Color.green .frame(height: 150) .overlay { Text((item.description)) .foregroundStyle(Color.black) .font(.largeTitle) } } .tag(0) } }.frame(minHeight: 100) // if I removed this line the tabview will disappear // and if I specify a big number the lazyVgrid is no longer lazy } }
1
0
1.1k
Dec ’23
DataFrame's Column doesn't support array of dictionary
I'm following Apple WWDC video (https://developer.apple.com/videos/play/wwdc2021/10037/) about how to create a recommendation model. But I'm getting this error when I run the project on that like of code from their tutorial. Column keywords has element of unsupported type Dictionary. Here is the block of code took from the transcript of WWDC video that cause me issue: func featuresFromMealAndKeywords(meal: String, keywords: [String]) -> [String: Double] { // Capture interactions between content (the dish keywords) and context (meal) by // adding a copy of each keyword modified to include the meal. let featureNames = keywords + keywords.map { meal + : + $0 } // For each keyword, create an entry in a dictionary of features with a value of 1.0. return featureNames.reduce(into: [:]) { features, name in features[name] = 1.0 } } var trainingKeywords: [[String: Double]] = [] var trainingTargets: [Double] = [] for item in userPurchasedItems { // Add in the positive example. trainingKeywords.append( featur
4
0
1.1k
Dec ’23