Search results for

column

2,071 results found

Post

Replies

Boosts

Views

Activity

Reply to Make method less repetative
I'm sorry, maybe I'm being totally dense, but what Wallace wrote would be no different than if I had just done this and not returned a new function:func theMethodToCallOverAndOver(column: Int, row: Int) -> (column: Int, row: Int) { let newCol = -2 * column switch column { case 0: return (newCol, row / 2) case 1 where numberOfPlayers == 8: return (newCol, row ^ 1) case 1 where numberOfPlayers == 16: return (newCol, 3 - row) case 1 where numberOfPlayers == 32: return (newCol, (row + 4) % 8) case 2 where numberOfPlayers == 16: return (newCol, row ^ 1) case 2 where numberOfPlayers == 32: return (newCol, row) case 3: return (newCol, row ^ 1) default: return (newCol, 0) } }That means every time I call the method, I'm checking the value of numberOfPlayers.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Generate Provisioning Profile that includes MusicKit Entitlements
MusicKit isn’t gated by an entitlement. That’s why, when you enable it on an App ID, you enable it in the App Services column rather than the Capabilities column. Enabling it there grants that App ID access to that service without needing your app to be signed with any entitlement. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
May ’25
how do I remove the columns showing in the below pic if no data is available.
this below is the view which doesn't remove the columns after I click the delete button and it shows the data even after it is removed from the firestore unless relaunched the app. import SwiftUI import Firebase struct user:Identifiable{ @State var id:String= @State var productnm:String= @State var quan:String= } class mainviewmodel:ObservableObject{ @Published var use = [user]() init(){ fetchCurrentUser() } func fetchCurrentUser(){ guard let uid = Firebase.Auth.auth().currentUser?.uid else { return } FirebaseManager.shared.firestore.collection(users).document(uid).collection(product).getDocuments{snapshot,error in if error==nil{ //no errors if let snapshot = snapshot{ //update the user property in the main thread DispatchQueue.main.async { // //get all the documents and create user self.use=snapshot.documents.map{ d in //map will iterate over array and perform code on each item //create an new user for each document returned return user(id: d.documentID,productnm: d[product name] as? String ?? , qua
1
0
735
Mar ’22
Reply to ARKit - Get User's Position
Hi to get the uers location you use the frame.camera.transform this is basically a world matrix representing the camera. It will either be the last column or last row in the matrix (I cant remember the matrix order used by these systems). It will give you values like x,y,z,1 when you take the last column (or row). Just ignore the 1.Anyway, that should give you enough to work it out.
Topic: Spatial Computing SubTopic: ARKit Tags:
Jun ’17
Reply to Undefined symbols error when trying to use NSToolbarPrimarySidebarTrackingSeparatorItemIdentifier & NSToolbarSupplementarySidebarTrackingSeparatorItemIdentifier
Yep, beta 4 seems to fix these. Now getting some weirdness when using the toggleSidebar item in that the window title appears in the primary column rather than the supplementary column, and the toggleSidebar item moves to the far right within the overflow item. This must be a bug, toggling the toolbar into icon + label mode and back to icon only mode seems to fix it temporarily.
Topic: App & System Services SubTopic: General Tags:
Aug ’20
How to display Data in 2 columns in Table dynamically
Hi I want to display below Data in table Dynamically. No of records can vary.Title DescTitle DescTitle Desc{ error = 0; message = Ok; result = ( { id = 81; desc = <p>Traveler can select any date of travel before 60 days . He can pay remaining payment as per the payment plan mentioned above. </p> n; title = Payment Policy; }, { id = 76; desc = <p> </p> n n<p>6000</p> n; title = Advance; }, { id = 68; desc = <p>25% of Tour Cost (including booking amount)</p> n; title = On confirmation of Price quote; }, { id = 79; desc = <p>70% of Tour Cost</p> n; title = “30 Days Before Departure; }, { id = 77; desc = <p>Total Cost</p> n; title = 10 Days before Departure; } ); }Thanks
3
0
2.6k
Jul ’17
WeatherKit REST API new columns for CurrentWeather
My pipeline broke today as new fields were added for the current weather dataset: cloudCoverLowAltPct cloudCoverMidAltPct cloudCoverHighAltPct I presumed new fields would only be released in a new version of the API? Is there any way to use a specific version of the API that will not be subject to change? The current weather REST API docs are here, which don't include these fields: https://developer.apple.com/documentation/weatherkitrestapi/currentweather/currentweatherdata
6
0
1.4k
Jan ’23
Swift - access attribute in array of core data entities in a table column via a variable
The below code works. I pass in an array of core data entities and display attributes in a table. In the second table column I use a switch case statement to handle the 3 possible attributes I want to display. I could eliminate the switch case if I could figure out how to access a given core data attribute via a variable that contains the specific attribute name but have been unable to determine how to do so. Two attempts are commented out in the code. struct DataTable: View { private var closingValues: Array var heading: String var attribute: String init(closingValues: [TradingDayPrices], heading: String, attribute: String) { self.closingValues = closingValues self.heading = heading self.attribute = attribute } var body: some View { Text(heading) .foregroundColor(.black) .font(Font.custom(Arial, size: 18)) .bold() .padding(.top, 10) Table(self.closingValues) { TableColumn(Date) { value in HStack { Spacer() Text(dateToStringFormatter.string(from: value.timeStamp!)) Spacer() } } .width(100) TableColum
1
0
896
Apr ’23
Reply to Question About Swift
Here's what I ended up with, it works now...import Cocoa protocol TabularDataSource { var numberOfRows: Int { get } var numberOfColumns: Int { get } func label(forColumn column: Int) -> String func itemFor(row: Int, column: Int) -> String } func computeWidths(for dataSource: TabularDataSource) -> [Int] { var columnWidths = [Int]() for j in 0 ..< dataSource.numberOfColumns { let columnLabel = dataSource.label(forColumn: j) columnWidths.append(columnLabel.count) for i in 0 ..< dataSource.numberOfRows { let item = dataSource.itemFor(row: i, column: j) if columnWidths[j] < item.count { columnWidths[j] = item.count } } } return columnWidths } func printTable(_ dataSource: TabularDataSource & CustomStringConvertible) { print(Table: (dataSource.description)) var firstRow = | var columnWidths = computeWidths(for: dataSource) for i in 0 ..< dataSource.numberOfColumns { let columnLabel = dataSource.label(forColumn: i) let paddingNeeded = columnWidths[i] - columnLabel.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’18
Reply to SwiftUI Collection View
I agree these are not technically collection views or table views.What I meant and would like to achieve is a grid layout (like in Music's album library, Apple Books' library, etc.) or cascading layout (e.g. Pinterest) natively in SwiftUI.According to SwiftUI's documentation, a List is a container that presents rows of data arranged in a single column. What I'm looking for is a container that present data arranged in several columns and rows.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19