Post

Replies

Boosts

Views

Activity

SafariBookmarksSyncAgent quits unexpectedly
Since recently (maybe after updating to Sonoma 14.7.1 - 23H222, but not sure, I get a crash report stating that SafariBookmarksSyncAgent quitted unexpectedly Once acquitted the report, it will reappear 2 minutes later as long as Xcode is open. Configuration: Sonoma 14.7.1 Safari Technology Preview Release 208 (Safari 18.2, WebKit 19621.1.5.1) Xcode 15.3 (15E204a) That seems to be a known problem. Question: Is it due to MacOS version ? To Xcode version ? To Safari version ? To webKit version ? Or to simulator, as I gat an AegirPoster crash (as described here: https://stackoverflow.com/questions/77083912/macbook-pro-crashes-when-using-simulator-aegirposter-process) I read that I would need to restart some devices (eg, iPhone). That seems to temporarily solve the problem Here is a part of the report: Incident Identifier: 0D2456DF-5801-41D6-8294-2BF442224913 CrashReporter Key: 4DE33529-174E-32C5-D8A8-26FE128BE16B Hardware Model: Mac14,12 Process: SafariBookmarksSyncAgent [38972] Path: /Volumes/VOLUME/*/SafariSupport.bundle/SafariBookmarksSyncAgent Identifier: com.apple.SafariBookmarksSyncAgent Version: 8614 (8614.1.25.0.17) Code Type: ARM-64 (Native) Role: Unspecified Parent Process: launchd_sim [28070] Coalition: com.apple.CoreSimulator.SimDevice.0058D576-D9FF-4169-8437-D0A24C923500 [9832] Responsible Process: SimulatorTrampoline [1116] Date/Time: 2024-11-27 15:19:42.4908 +0100 Launch Time: 2024-11-27 15:19:42.4610 +0100 OS Version: macOS 14.7.1 (23H222) Release Type: User Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000204476580 Exception Codes: 0x0000000000000001, 0x0000000204476580 VM Region Info: 0x204476580 is not in any region. Bytes after previous region: 894002561 Bytes before following region: 58984012416 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL VM_ALLOCATE 1cefdc000-1cefe0000 [ 16K] r--/rwx SM=PRV ---> GAP OF 0xdf1020000 BYTES commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=COW reserved VM address space (unallocated) Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [38972] Triggered by Thread: 0 Thread 0 Crashed: 0 dyld_sim 0x104f9dc7c dyld4::SyscallDelegate::forEachInDirectory(char const*, bool, void (char const*, char const*) block_pointer) const + 172 1 dyld_sim 0x104f88b6c invocation function for block in dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 104 2 dyld_sim 0x104f88aa0 dyld4::ProcessConfig::PathOverrides::forEachInColonList(char const*, char const*, bool&, void (char const*, bool&) block_pointer) + 224 3 dyld_sim 0x104f886b8 dyld4::ProcessConfig::PathOverrides::processVersionedPaths(dyld4::ProcessConfig::Process const&, dyld4::SyscallDelegate&, dyld4::ProcessConfig::DyldCache const&, dyld3::Platform, dyld3::GradedArchs const&, lsl::Allocator&) + 144 4 dyld_sim 0x104f882a8 dyld4::ProcessConfig::PathOverrides::PathOverrides(dyld4::ProcessConfig::Process const&, dyld4::ProcessConfig::Security const&, dyld4::ProcessConfig::Logging const&, dyld4::ProcessConfig::DyldCache const&, dyld4::SyscallDelegate&, lsl::Allocator&) + 344 5 dyld_sim 0x104f868b8 dyld4::ProcessConfig::ProcessConfig(dyld4::KernelArgs const*, dyld4::SyscallDelegate&, lsl::Allocator&) + 152 6 dyld_sim 0x104f85e30 _dyld_sim_prepare + 352 7 dyld 0x10492fa8c dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1276 8 dyld 0x10492e4f0 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 308 9 dyld 0x10492def4 start + 1868 I filed a bug report: Nov 27, 2024 at 3:41 PM – FB15976427
1
0
694
Dec ’24
Could someone test if Settings in iOS 18.2 are broken ?
Apparently, settings do not show anymore the apps settings in iOS 18.2. I tested on simulators (Xcode 16.2) both on iOS 18.1 and iOS 18.2 and got very different results: In iOS 18.1 simulator, I see the settings of a lot of apps. In iOS 18.2 simulator, not a single app setting. That is a really serious issue in simulator for development (I filed a bug report FB16175635), but would be really critical on device as it would make it impossible to adjust setting of many apps. Unless I missed something (meta setting ?) in iOS 18.2 ? I have not upgraded to 18.2 notably for this reason. So I would appreciate if someone who has upgraded could make the test and report ? select Settings on Home page scroll to Apps category tap here to access the list Does the list show anything ? Thanks for your help.
1
1
1.1k
Jan ’25
labels appear as dimmed in UIView
In this setup, label do not show properly because of the textColor. Labels are defined in IB, in the following hierarchy: ViewController View Label 1 scrollView View Button Label 2 Buttons show properly, but labels, even though defined with default label color appear as if their alpha was 0.2. It is even worse in dark mode: I have checked the settings for the label and did not find anything anormal: I have tried to change label color to system.gray 2, to no avail. If I change to red, does not show in red in IB. Problem appears for both Label 1 (at the top level in the view) and Label 2
1
0
369
Feb ’25
Set UILabel color in alertController
I have an alertController that is presented as popover on iPad let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: alertStyle) if let ppc = alertController.popoverPresentationController { // … } Is it possible to change the message font color (which is really very light on iPad) ? It is OK on iPhone with the same alert (not popover): text is much more readable:
1
0
351
Feb ’25
Picked photo in the gallery does not recognise image orientation
When picking a photo in the gallery, whatever the orientation of the original image, size is always as landscape if let image = info[convertFromUIImagePickerControllerInfoKey(UIImagePickerController.InfoKey.editedImage)] as? UIImage { print("picked original", image.size) For a portrait photo: picked original (1122.0, 932.0) For a landscape: picked original (1124.0, 844.0) What am I missing ?
1
0
365
Feb ’25
tableView.dequeueReusableHeaderFooterView(withIdentifier: ) crashes on iPad only
I have created a custom class: class TarifsHeaderFooterView: UITableViewHeaderFooterView { …} With its init: override init(reuseIdentifier: String?) { super.init(reuseIdentifier: reuseIdentifier) configureContents() } I register the custom header view in viewDidLoad of the class using the tableView. Table delegate and data source are defined in storyboard. tarifsTableView.register(TarifsHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: headerTarifsIdentifier) And call it: func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let view = tableView.dequeueReusableHeaderFooterView(withIdentifier: headerTarifsIdentifier) as! TarifsHeaderFooterView That works on iPhone (simulators and devices). But it crashes on any iPad simulator, as tableView.dequeueReusableHeaderFooterView(withIdentifier: headerTarifsIdentifier) is found nil. What difference between iPhone and iPad do I miss that explains this crash ? PS: sorry for the messy message. It looks like the new "feature" of the forum to put a Copy code button on the code parts, causes the code sections to be put at the very end of the post, not at the place they should be.
1
0
98
Mar ’25
In Xcode 26 ß (iOS 26 simulator) UIBarButtonItem content disappear when tapped
Just testing an existing app with Xcode 26. I notice that content of UIBarButtonItem (either text or image) disappears when tapped (and reappear on release). Those are custom, bordered buttons. Attribute inspector: Buttons in Xcode: When selected in Xcode, we see a rectangle inside the rounder rect of iOS 26 In simulator: When tapped in simulator: I have edited code from backButton.setTitleTextAttributes([ .font : boldFont, .foregroundColor : UIColor.systemBlue, ], for: .normal) to backButton.setTitleTextAttributes([ .font : boldFont, .foregroundColor : UIColor.systemBlue, ], for: [.normal, .focused, .selected, .highlighted]) to no avail. What am I missing ?
1
0
319
Aug ’25
No more simulators showing in Xcode
I sometimes use Xcode 14.2. Recently, I have an issue with simulators: on some SwiftUI project, the simulator list is empty. I created a new project. I see the complete list of simulators, but when running for a simulator, it fails with following diag; Same error with UIKit project. Details Unable to boot the Simulator. Domain: NSPOSIXErrorDomain Code: 60 Failure Reason: launchd failed to respond. User Info: { DVTErrorCreationDateKey = "2025-06-29 06:16:35 +0000"; IDERunOperationFailingWorker = "_IDEInstalliPhoneSimulatorWorker"; Session = "com.apple.CoreSimulator.SimDevice.134EC197-BA6B-45DF-B5B2-61A1D4F14863"; } -- Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding Domain: com.apple.SimLaunchHostService.RequestError Code: 4 -- Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : { "device_model" = "iPhone15,2"; "device_osBuild" = "16.2 (20C52)"; "device_platform" = "com.apple.platform.iphonesimulator"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = "x86_64"; "operation_duration_ms" = 8341; "operation_errorCode" = 60; "operation_errorDomain" = NSPOSIXErrorDomain; "operation_errorWorker" = "_IDEInstalliPhoneSimulatorWorker"; "operation_name" = IDERunOperationWorkerGroup; "param_consoleMode" = 0; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphonesimulator"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 1; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_runnable_type" = 2; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphonesimulator16.2"; "sdk_osVersion" = "16.2"; "sdk_variant" = iphonesimulator; } -- System Information macOS Version 12.7.1 (Build 21G920) Xcode 14.2 (21534) (Build 14C18) Timestamp: 2025-06-29T08:16:35+02:00 I filed a bug report: FB18475006
1
0
191
Jun ’25
Can some of those simulator files be safely deleted ?
When looking ay space used by system, I found that AssetsV2 (in System/Library) account for 270 GB. In this folder, 3 account for 260 GB and are apparently related to Xcode simulators: Content is a bit cryptic. Does it relate to some specific apps I compiled and ran on simulator ? Or is it related to older versions of Xcode I keep on the Mac ? How to know what each forlder relates to ? Is it safe to remove ?
1
0
133
Jun ’25
Localization and tap gesture
In this app I have a view with 3 textFields or labels on which I have gesture recogniqzers.They work OK.I have localized the app for 2 more languages, and now, when I switxh language (inside the app), I get the following error:2018-02-16 00:19:34.951810+0100 Autonomie[1635:1007703] [Warning] WARNING: A Gesture recognizer (<UITapGestureRecognizer: 0x1757fd90; state = Possible; view = <UITextView 0x17b86600>; target= <(action=autonomieVersionViewTapped:, target=<Autonomie.StartViewController 0x1757f890>)>>) was setup in a storyboard/xib to be added to more than one view (-><UITextView: 0x17ba8000; frame = (60.5 50; 198 25); text = 'version 0.5 © AlphaNums 2...'; clipsToBounds = YES; hidden = YES; opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x175e25d0>; layer = <CALayer: 0x175da320>; contentOffset: {0, 0}; contentSize: {198, 31}>) at a time, this was never allowed, and is now enforced. Beginning with iOS 9.0 it will be put in the first view it is loaded into.<UIButtonLabel: 0x176d3da0; frame = (160 18; 0 0); text = 'Calcular el rango …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x176d01c0>><UIButtonLabel: 0x1765cc40; frame = (160 18; 0 0); text = 'Calculer autonomie …'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1765cda0>>And gestures do not work.If I switch back to the original language, everything OK.
2
0
3.5k
Feb ’21
NSLayoutConstraint should not be declared weak in Xcode 10ß2 - Swift 4.2
When compiling this OSX App in XCode 10 beta 2 (Swift 4.2), I get a warning that did not show in XCode 9.4 each time I create an NSConstraint programmaticallyInstance will be immediately deallocated because property 'myConstraint' is 'weak'fileprivate weak var myConstraint : NSLayoutConstraint! myConstraint = NSLayoutConstraint(item: aButton, attribute: .top, relatedBy: .equal, toItem: aView, attribute: .bottom, multiplier: 1.0, constant: 30)However, there is no such warning for IBOutlet@IBOutlet fileprivate weak var anotherConstraint : NSLayoutConstraint!Is it a just a new warning for an error that existed before ? Or did something change in NSConstraint ?Should I treat IBOutlet and programmatically created differently with respect to weak ?
2
0
5.4k
Feb ’21
Passing data from an App VC to its widget
Learning Widgets, I try a simple pattern: get a textField in the app; have the Widget updated when textField is changed. App is UIKit. Widget has No "included Configuration Intent". It compiles and works. Widget is updated every 5 minutes as asked line 23 (final snippet). But the message is never updated (line 48 of final snippet) with globalToPass (as expected from line 24): it always shows "Hello". What I tried: Create a singleton to hold the data to pass: class Util { &#9;&#9; &#9;&#9;class var shared : Util { &#9;&#9;&#9;&#9;struct Singleton { &#9;&#9;&#9;&#9;&#9;&#9;static let instance = Util() &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;return Singleton.instance; &#9;&#9;} &#9;&#9; &#9;&#9;var globalToPass = "Hello" } shared the file between the 2 targets App and WidgetExtension In VC, update the singleton when textField is changed and ask for widget to reload timeline &#9;&#9;@IBAction func updateMessage(_ sender: UITextField) { &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;Util.shared.globalToPass = valueToPassLabel.text ?? "--" &#9;&#9;&#9;&#9;WidgetCenter.shared.reloadTimelines(ofKind: "WidgetForTest") &#9;&#9;&#9;&#9;WidgetCenter.shared.reloadAllTimelines() &#9;&#9;} Problem : Widget never updated its message field Probably I need to have the message in @State var, but I could not get it work. Here is the full widget code at this time: import WidgetKit import SwiftUI struct LoadStatusProvider: TimelineProvider { &#9;&#9; &#9;&#9;func placeholder(in context: Context) -> SimpleEntry { &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;SimpleEntry(date: Date(), loadEntry: 0, message: Util.shared.globalToPass) &#9;&#9;} &#9;&#9;func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) { &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;let entry = SimpleEntry(date: Date(), loadEntry: 0, message: Util.shared.globalToPass) &#9;&#9;&#9;&#9;completion(entry) &#9;&#9;} &#9;&#9;func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { &#9;&#9;&#9;&#9;var entries: [SimpleEntry] = [] &#9;&#9;&#9;&#9;// Generate a timeline consisting of five entries an hour apart, starting from the current date. &#9;&#9;&#9;&#9;let currentDate = Date() &#9;&#9;&#9;&#9;for minuteOffset in 0 ..< 2 { &#9;&#9;&#9;&#9;&#9;&#9;let entryDate = Calendar.current.date(byAdding: .minute, value: 5*minuteOffset, to: currentDate)! &#9;&#9;&#9;&#9;&#9;&#9;let entry = SimpleEntry(date: entryDate, loadEntry: minuteOffset, message: Util.shared.globalToPass) &#9;&#9;&#9;&#9;&#9;&#9;entries.append(entry) &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;let timeline = Timeline(entries: entries, policy: .atEnd) &#9;&#9;&#9;&#9;completion(timeline) &#9;&#9;} } struct SimpleEntry: TimelineEntry { &#9;&#9;let date: Date &#9;&#9;let loadEntry: Int &#9;&#9;let message: String } struct WidgetForTestNoIntentEntryView : View { &#9;&#9;var entry: LoadStatusProvider.Entry &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;let formatter = DateFormatter() &#9;&#9;&#9;&#9;formatter.timeStyle = .medium &#9;&#9;&#9;&#9;let dateString = formatter.string(from: entry.date) &#9;&#9;&#9;&#9;return &#9;&#9;&#9;&#9;&#9;&#9;VStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text(String(entry.message)) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;HStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text("Started") &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text(entry.date, style: .time) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;HStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text("Now") &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text(dateString) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;HStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text("Loaded") &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text(String(entry.loadEntry)) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;} } @main struct WidgetForTestNoIntent: Widget { &#9;&#9;let kind: String = "WidgetForTestNoIntent" &#9;&#9;var body: some WidgetConfiguration { &#9;&#9;&#9;&#9;StaticConfiguration(kind: kind, provider: LoadStatusProvider()) { entry in &#9;&#9;&#9;&#9;&#9;&#9;WidgetForTestNoIntentEntryView(entry: entry) &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;.configurationDisplayName("My Widget") &#9;&#9;&#9;&#9;.description("This is an example widget.") &#9;&#9;} } struct WidgetForTestNoIntent_Previews: PreviewProvider { &#9;&#9;static var previews: some View { &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;WidgetForTestNoIntentEntryView(entry: SimpleEntry(date: Date(), loadEntry: 0, message: "-")) &#9;&#9;&#9;&#9;&#9;&#9;.previewContext(WidgetPreviewContext(family: .systemSmall)) &#9;&#9;} } I have not defined extension for IntentHandler
2
0
2.3k
Mar ’21
List with 2 cells side by side
From the Landmarks sample project, I tried a variation, to get two cells side by side in the List. This is the original with on cell per row as in the tutorial: struct LandmarkList: View { &#9;&#9; &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;List(landmarks) { landmark in &#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmark) &#9;&#9;&#9;&#9;} &#9;&#9;} } Surprisingly, the following variation works well to display 2 cells side by side: struct LandmarkList: View { &#9;&#9; &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;List (0 ..< (landmarks.count+1)/2) { item in &#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmarks[2*item]) &#9;&#9;&#9;&#9;&#9;&#9;if 2*item + 1 < landmarks.count { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmarks[(2*item)+1]) &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;} &#9;&#9;} } I thus tried to go on and add navigationLinks… It works when adding a navigation link to the first cell only struct LandmarkList: View { &#9;&#9; &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;NavigationView { &#9;&#9;&#9;&#9;&#9;&#9;List (0 ..< (landmarks.count+1)/2) { item in &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;NavigationLink(destination: LandmarkDetail()) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmarks[2*item]) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;if 2*item + 1 < landmarks.count { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmarks[(2*item)+1]) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;.navigationTitle("Landmarks")&#9; &#9;&#9;&#9;&#9;} &#9;&#9;} } But adding NavigationLink to the second makes it fail: struct LandmarkList: View { &#9;&#9; &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;NavigationView { &#9;&#9;&#9;&#9;&#9;&#9;List (0 ..< (landmarks.count+1)/2) { item in &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;NavigationLink(destination: LandmarkDetail()) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;LandmarkRow(landmark: landmarks[2*item]) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;if 2*item + 1 < landmarks.count { NavigationLink(destination: LandmarkDetail()) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; LandmarkRow(landmark: landmarks[(2*item)+1]) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; } &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;.navigationTitle("Landmarks")&#9; &#9;&#9;&#9;&#9;} &#9;&#9;} } The error is on line 3: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions Is it a normal List behaviour ? Or did I miss something ? Which expression could I break ?
2
0
730
Dec ’20
Assignment operator in Swift - What is the rationale behind language design ?
I suspect this point has been discussed in length, but I would like to find some reference to the design logic behind some Swift key aspect : the assignment operator, by value or reference. We know well how = works, depending it deals with reference or value (knowing the consequence of misuse) and the difference between the 2 : class AClass { var val: Int = 0 } struct AStruct { var val : Int = 0 } let aClass = AClass() let bClass = aClass bClass.val += 10 print("aClass.val", aClass.val, "bClass.val", bClass.val) let aStruct = AStruct() var bStruct = aStruct bStruct.val += 10 print("aStruct.val", aStruct.val, "bStruct.val", bStruct.val) Hence my question. Was it ever considered to have 2 operators, one used to assign reference and the other to assign value? Imagine we have : = operator when dealing with references := operator when dealing with content. Then let bClass = aClass would remain unchanged. But var bStruct = aStruct would not be valid anymore, with a compiler warning to replace by var bStruct := aStruct On the other end, we could now write let bClass := aClass to create a new instance and assign another instance content, equivalent to convenience initialiser class AClass { var val: Int = 0 init(with aVar: AClass) { self.val = aVar.val } init() { } } called as let cClass = AClass(with: aClass) But the 2 operators would have made it clear that when using = we copy the reference. When using := we copy content. I do think there is a strong rationale behind the present design choice (side effects I do not see ?), but I would appreciate to better understand which.
2
0
750
Jun ’21