Post

Replies

Boosts

Views

Activity

Getting inconsistent padding on widgets between devices and simulators
I'm trying to design a homescreen widget but I am unable to properly control the padding and sizing of various components. In the four attached screenshots you can see the huge variation in padding around the outside, the change in text colour and the spacing between the text. I've boiled it down as simple as possible and attached the view as a sample file. What I'd like to achieve is a consistent look between iPads and iPhones and ideally in the simulator too. Is there a simple way to set the padding so that all places use the same, and then scale the text so that I know that if the text fits in the simulator the same text will fit on all devices? Device iPad 8 - 17.7 iPhone 13 Pro Max - 17.7 Xcode Canvas - iPad 13" Simulator - iPad Pro sampleview.txt 13"
0
0
152
Sep ’24
interpolating AreaMarks beyond the edge of the chart
I'm making an app that shows tides. It's approximately a sine wave going smoothly in and out. If I use only the low and high tides times, the line should curve slowly between them. If the first value on the chart is a low tide and the next is a high tide I want the line to start from horizontal, get steeper and then flatten out as the tide peaks. This happens for all the values within the chart except for the first and last because there's no data outside of the chart's range to tell the interpolation code where the line needs to curve to. If I add extra data beyond what I am displaying, the chart adapts and shows that data too, then I have nothing beyond that. Some pictures might help Here the first and last points look like the tide is still going down/up rather fast, where as the other points all slow down as they reach the high/low value I tried using .chartXScale(domain: start...end) to set the bounds of the x-axis, but the chart gets drawn beyond those bounds I believe I can fake it by adding my own interpolated points just seconds before the first and after the last point with the same value as the true data. This would force the interpolation to flatten out, but I'd rather use the real data and control the chart sounds properly
0
0
872
Jan ’23
No playgrounds work "Could not build Objective-C module 'SwiftUI'"
I am unable to run even the simplest of Swift Playgrounds. It's as if the fundamental libraries are missing, but in Xcode I am able to build and run SwiftUI applications. From the main screen under More Playgrounds I click on the App template and before I make any changes it tries to build and fails as per screenshot, with errors such as "Could not build Objective-C module 'SwiftUI'" "Could not build module 'Application Services'" Mac OS 12.6.2 Xcode 14.2 Playgrounds 4.1
3
1
2.1k
Jan ’23
JSONDecoder unable to decode my API
I'm trying to get JSONDecoder to decode data from an API. I know the content of the data is valid JSON has I've downloaded it independently and verified it. let decoder = JSONDecoder() let dataStr = String(bytes: data, encoding: String.Encoding.utf8) print(dataStr) do {      let combinedForecast = try decoder.decode(NWCombinedForecast.self, from: data)      print("getting data")      completion?(combinedForecast) } catch {      let msg = error.localizedDescription      print(msg) } I can use the inspector to see that dataStr is set and valid. I can also see data is defined as Foundation.Data, but the try line always throws and error and before 'getting data' is printed, it drops down to the catch block. Below is the inspector showing that dataStr is set, hopefully showing that data is there, but decoder is not doing anything useful with it. Incase it helps, this is the NWCombinedForecast struct that I am trying to decode the data into public struct NWCombinedForecast: Codable {     let forecast: [NWForecast]     let summary: [NWSummary]     let location: NWLocation }
3
0
1.3k
Aug ’22
Is it ok to share our Distribution Certificate and private key?
My company has contracted an external company to write an app for us without providing the source code. The developer is now insisting on our distribution certificate and matching private key so they can sign and upload the app. I had been expecting to re-sign the app but they tell me that Apple doesn't allow this any more. I don't believe sharing the private key is a good idea, and Apple's docs say: "Do not share Apple Certificates outside of your organization" - https://developer.apple.com/support/certificates/. Is there a way to upload an app to the store for public consumption with only the .xcarchive and .ipa? What am I risking by giving another company a .p12?
4
0
4.5k
Aug ’20
Widget preview failed to load in 15 seconds
I'm trying to use the code provided with Widgets Code-along part 1 but despite following the steps to the letter, Xcode is not showing me the widget preview. The error message is 'The app "Emoji Rangers.app" did not launch on "iPhone SE (1st generation)" in 15 seconds'. Since I need Xcode working solidly on my current development machine I have only got this mid-2012 machine to install the Xcode 12.0 beta on. Is it simply too slow to be able to run Swift previews or is there a way around it? macOS 10.15.4 Xcode 12.0 beta (12A6159) MacBook Pro (mid 2012) 2.6Ghz i7
0
0
646
Jul ’20