Search results for

Swift 6

49,206 results found

Post

Replies

Boosts

Views

Activity

Reply to QNE2TransparentProxyMac sample code
[quote='847299022, Peter_Si, /thread/789165?answerId=847299022#847299022, /profile/Peter_Si'] Can you help me understand the difference between a NetworkExtension.NWEndpoint and Network.NWEndpoint and where I would need to use one versus the other? [/quote] Sure. And that is, indeed, a gnarly edge case. NetworkExtension.NWEndpoint is an Objective-C class. It was introduced prior to the introduction of Network framework proper. Network framework is a Swift API [1] and, in Swift, it makes sense to represent endpoints as an enum, so Network.NWEndpoint is an enum. Quoting TN3151 Choosing the right networking API: Network Extension in-provider networking includes NWUDPSession. While there are some very limited circumstances where this is still useful, in most cases it’s better to use Network framework. For more details, see In-Provider Networking. So, what are those circumstances? In short: If your product supports system prior to the introduction of Network framework, that is, macOS 10.14. That’
Jul ’25
error: the replacement path doesn't exist:
I'm using SwiftData with an @Model and am also using an @ModelActor. I've fixed all concurrency issues and have migrated to Swift 6. I am getting a console error that I do not understand how to clear. I get this error in Swift 6 and Swift 5. I do not experience any issue with the app. It seems to be working well. But I want to try to get all issues taken care of. I am using the latest Xcode beta. error: the replacement path doesn't exist: /var/folders/1q/6jw9d6mn0gx1znh1n19z2v9r0000gp/T/swift-generated-sources/@_swiftmacro_17MyAppName14MyModelC4type18_PersistedPr> opertyfMa.swift
27
0
11k
Aug ’24
xcode 8.3.1: Abort trap: 6 when compiling swift
Hi,My project compiles fine in xcode 8.2.1 but when updating to xcode 8.3.1 several classes can't be compiled.Error is Abort trap: 6 with stacktrace below, anybody experiencing the same?, This must be a compiler-bug, has anybody filed a bugreport?CompileSwift normal x86_64 /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/EditTimeSheetViewController.swift cd /Users/toni/Documents/WS/trunk/SnapTime /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/TimeSheetCell.swift /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/PeriodReportsViewController.swift -primary-file /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/EditTimeSheetViewController.swift /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/DayReportViewController.swift /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/MonthReportsViewController.swift /Users/toni/Documents/WS/trunk/SnapTime/SnapTime/EditAccountViewController.swift /Users/to
8
0
3.6k
Apr ’17
Reply to ViewBridge to RemoteViewService Terminated (...)
I created a minimal SwiftUI macOS app that consistently reproduces the same ViewBridge warning. The issue occurs only when using a SecureField view in a Settings scene, not in a standard WindowGroup scene. Reproduction Steps Launch the application Open the Settings window (⌘,) Close the Settings window Open the Settings window again (⌘,) The Warning Upon reopening the Settings window, the following warning appears in the console: ViewBridge to RemoteViewService Terminated: Error Domain=com.apple.ViewBridge Code=18 (null) UserInfo={com.apple.ViewBridge.error.hint=this process disconnected remote view controller -- benign unless unexpected, com.apple.ViewBridge.error.description=NSViewBridgeErrorCanceled} Key Observations The warning only occurs when a SecureField view is present in a Settings scene The same SecureField view in a WindowGroup scene does not trigger the warning when repeatedly opening and closing the main window (⌘N) Environment OS: macOS 15.3.2 SDK: macOS 15.4 IDE: Xcode 16.3 Compiler: Swift 6
Topic: UI Frameworks SubTopic: AppKit
Apr ’25
Xcode 8 beta 6 fails to recognize Swift 3 types.
I'm working on a project that I started with Xcode 8 beta 2 using Swift 3 and everything has been working flawlessly. Today I updated to Xcode 8 beta 6 on my iMac and right away my code failed to compile. I've now got over 70 errors similar to the following:Use of undeclared type 'SortDescriptor'Use of undeclared type 'Date'Method does not override any method from its superclassIf I change the code to Swift 2.2 syntax the code compiles, obviously the new Xcode is failing to recognize Swift 3 for some reason. I tried using the syntax converter and it fails.I recalled that my macbook had Xcode 8 beta 2 on it so I tried opening the project on there and I still had the errors. I believe that opening my project files on my iMac in Xcode 8 beta 6 has changed a setting in my project file and I'm not sure if there is a way to correct this.Has anyone experienced anything similar?
2
0
405
Aug ’16
Reply to Framework Project Fails to Run Across Different Xcode Versions
ABI stability isn't the issue here — enabling module stability through the library evolution build flags is. When you build an XCFramework, you need to enable the BUILD_LIBRARY_FOR_DISTRIBUTION build setting, which enables library evolution for the module defined by the Xcode target to which you're applying that build setting. That causes a swiftinterface file to be output as part of the build, which is the textual representation of your module's interface that is stable for newer complier versions to consume. When you import SomePackage into your module, module stability is not conveyed for that imported module, it too would need to enable module stability. Further, the public interface with all of the types of that imported module becomes part of the public interface in your final XCFramework. So if I look at the arm64-apple-ios.swiftinterface in your test project's XCFramework, I see this: // swift-interface-format-version: 1.0 // swift-compiler-version: Apple Swift version 5.10
Apr ’25
Reply to Xcode warning for call to DispatchQueue.main.sync: Call to method 'asd' in closure requires explicit use of 'self' to make capture semantics explicit
I boiled your question down to this: 1 class Test { 2 3 func asd() { 4 } 5 6 func test() { 7 DispatchQueue.global().async { [self] in 8 DispatchQueue.main.async { 9 self.asd() 10 } 11 DispatchQueue.main.async { [self] in 12 asd() 13 } 14 DispatchQueue.main.sync { 15 self.asd() 16 } 17 DispatchQueue.main.sync { [self] in 18 asd() ^ Call to method 'asd' in closure requires explicit use of 'self' to make capture semantics explicit; this is an error in Swift 6 19 } 20 } 21 } 22 } This is an interesting glitch in the matrix. It’s definitely triggered by the context set up by line 7. Without that, you don’t see the warning. The immediate fix here is to use an explicit self, as shown by lines 14 through 16. As to why capturing self on line 17 still triggers the warning, I’m not sure. It’s probably worth filing a bug about that. Please post your bug number, just for the record. Taking a step back, this overall approach is kinda worrying. First, I recommend against using Dispatch global concurrent qu
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’23
Xcode 16 beta 6 - unexpected concurrency build issues
The following behavior seems like a bug in the swift compiler that ships with Xcode 16 beta 6. Add the following code snippet to a new iOS app project using Xcode 16 beta 6 and observe the error an warning called out in the comments within the itemProvider() method: import WebKit extension WKWebView { func allowInspectionForDebugBuilds() { // commenting out the following line makes it so that the completion closure argument of the trailing closure // passed to NSItemProvider.registerDataRepresentation(forTypeIdentifier:visibility:loadHandler:) is no longer // isolated to the main actor, thus resolving the build issues. It is unexpected that the presence or absence of // the following line would have this kind of impact. isInspectable = true } } class Foo { func itemProvider() -> NSItemProvider? { let itemProvider = NSItemProvider() itemProvider.registerDataRepresentation(forTypeIdentifier: , visibility: .all) { completion in Task.detached { guard let url = URL(string: ) else { co
8
0
1.1k
Aug ’24
Swift 3, beta 6, can't implement UIActivityItemSource
In the Xcode 8 beta 6 compiler, I get a compile error when trying to implement the UIActivityItemSource protocol.Specifically this optional function...optional public func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> StringThe compiler error is:Method cannot be an implementation of an @objc requirement because the type of the parameter 2 cannot be represented in Objective-C.I've double checked the definition and don't see what I could be doing wrong.Any ideas?
8
0
1.9k
Aug ’16
Xcode 7, Swift 2.0, odd "trap 6" with odd solution
TL;DRI got trap 6 error when I tried to build my App. I tried to fix it for a whole day. I fixed it by simply cloning the repo to somewhere else and build it. It might be caused by some cached build file somewhere in the project folder, which is not tracked by version control.Why I am certain it is caused by some cached file in that project folderI tried Clean action in Product menu. I also tried deleting Derrived Data folder in Project window. None of these helped.I also tried to checkout my master branch, which I know it should build. But I got the same error which makes no sense.I created some demo project to mimic the minimal setup of my App. All of them can be built without any error.I cloned my repo somewhere else and checked out the exact commit which is giving me trap 6 error. Build, succeeded!I copied the original trap 6 folder to somewhere else, I still got the same error.PS.Another thing is that, I got this error when I was using Xcode 7 beta. I updated to beta 2 because
6
0
943
Jun ’15
XCode 7 beta 6 (Swift 2) initializing error
I am currently having problems declaring a String. I wa previously able to use this in XCode 6 but now I can't.The command is:let HTMLString = NSString(contentsOfURL: myURL, encoding: NSUTF8StringEncoding, error: &error)But I am getting the error:Cannot invoke initializer for type 'NSString' with an argument list of type '(contentsOfURL: NSURL, encoding: UInt, error: inout NSError?)'Any ideas?Thanks
1
0
609
Sep ’15
Reply to Struggling with async/await: Fetching an image off the main thread
Folks, This conversation will go more smoothly if you reply as a reply, rather than in the comments. See Quinn’s Top Ten DevForums Tips for this and other tips. eoonline wrote: for the sake of future readers, that alone is insufficient. Agreed. As that’s a critical point of my previous post, I’ve edited that post to clarify it. Thanks for pointing this out. Praveenraj4256 wrote: Using Task.detached is better approach? No. In general, you should try to avoid creating new tasks wherever possible. [quote='817895022, Praveenraj4256, /thread/770655?answerId=817895022#817895022, /profile/Praveenraj4256'] I want to achieve the same functionality using structured concurrency [/quote] I think it’s a mistake to look for ‘drop in’ replacements for old techniques. The key thing to remember about Swift concurrency is that the isolation context of your code is determined statically [1]. That’s a benefit for you — you can look at the code and understand its isolation context — but it’s of critical importance to the
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24