I have a Swift Package that builds both an AppKit and a UIKit library, and code completion works great for AppKit code, but does not work in any of the UIKit files - regardless of the target selected on the top of the IDE.This Swift Package in turn is consumed by an AppKit sample, and a UIKit sample, code completion works just fine on both of those projects. It is just the shared Swift Package that fails to work with iOS APIs.I have tried removing mac as a platform in `Package.swift`, and wiping out my DerivedData for the project, but it does not make a difference, completion still is completely busted for code living inside the Swift Package.The code is open source, under the MIT license, if anyone wants to look at the setup:https://github.com/migueldeicaza/SwiftTerm
Post
Replies
Boosts
Views
Activity
Hello,
I have developed an open source terminal emulator library which is exposed as a UIView. It works great, but I have struggled tremendously to make this UIView conform to UITextInput to support dictation.
The challenges are as follows. While there is a high-level overview of how UITextInput works, it never gets to the more complex scenarios necessary to properly support accessibility and dictation.
The "Guided Tour of a UITextInput Implementation" - https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/LowerLevelText-HandlingTechnologies/LowerLevelText-HandlingTechnologies.html documentation for the technology’ does a walkthrough a sample that has been flagged as retired. - https://developer.apple.com/library/archive/samplecode/SimpleTextInput/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010633
I nevertheless, downloaded the sample, and while it does shed some light on the problem, it has not kept up with changes in iOS, so the sample itself is buggy. Dictation produces incorrect behavior while using it.
I have tried scouring GitHub for samples, but can not find anyone that implement UITextInput and works with dictation or alternative input systems (I managed to get Chinese input working, a little brittle, but it looks like it works).
Could someone point me to an up to date documentation, sample or reference that could help me make my terminal emulator accessible?
My code is at https://github.com/migueldeicaza/SwiftTerm and the "uitextinput-support" contains my attempts to make it work.
Today, after Xcode 12.5 upgraded, when I try to work on my projects, Xcode keeps running "Resolve Swift Packages" every second or so, this means that it both keeps flashing the display the whole time - it never settles, and it also keeps the machine busy and eventually, Xcode becomes unusable.
This has a movie showing what my Xcode looks like tonight, the pauses in the video are caused by Xcode not responding to scrolling, since I left that thing idling while I had dinner:
tirania.org/tmp/xcode-hang.mov
This can be reproduced by downloading github.com/migueldeicaza/SwiftTerm and opening either the Swift solution or the Xcode projects.
I have submitted a bug report.
Hello,
With Beta3 I started getting this error in one of my Swift libraries:
'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.
It happens in code like this:
UIApplication.shared.open (nested)
The "Require Only App-Extension-Safe API" is set to NO.
Hello,
I am trying to use NWConnection's WebSocket support to get to SSH clients behind web servers, but I never get past the .preparing stage of NWConnection, and I get these errors in the console:
[] nw_ws_validate_server_response [C1.1:1] server response doesn't match expected value
[] nw_protocol_copy_ws_definition_block_invoke [C1.1:1] nw_ws_validate_server_response
Then my state handler goes to .failed, and I get the following detail:
POSIXErorCode(rawValue: 53): Software caused connection abort
This is the code that I use to setup my connection (I have replaced the real hostname with 'HOST' below):
let parameters = NWParameters.tcp
let options = NWProtocolWebSocket.Options()
options.autoReplyPing = true
parameters.defaultProtocolStack.applicationProtocols.insert(options, at: 0)
connection = NWConnection (to: .url (URL (string: "wss://usaws1.sshstores.vip:8880")!), using: parameters)
On Wireshark, I can see that the connection is established, and I get a reply:
Client sends:
GET / HTTP/1.1
Host: usaws1.sshstores.vip
Sec-WebSocket-Version: 13
Upgrade: WebSocket
Sec-WebSocket-Key: wEUS7BsMfPNEMg9fhk/fxg==
Connection: Upgrade
And the server replies:
HTTP/1.1 101 Switching Protocol
\Content-Length: 1048576000000
I have tried also with a different server, and I get that in this case:
Client sends:
GET / HTTP/1.1
Host: sshws-sg.gameserver.pw
Sec-WebSocket-Version: 13
Upgrade: WebSocket
Sec-WebSocket-Key: k+jtlUsrn2L9SaFXBZpp7g==
Connection: Upgrade
Server responds:
HTTP/1.1 101 Switching Protocol
Date: Sat, 16 Apr 2022 18:08:15 GMT
Connection: upgrade
\Content-Length: 1048576000000
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=bVwvSh2T19Z%2BWDGh%2BzQRMIJknR9ScAkx2bzkDg5NLTy26ga6sJpGmPax9iFUAO9fJ5c5ycMK0Hc7xILew2LiL8cZ0uWVRvsjTx%2FEjoHq84SEHEipl%2BpStQd1Nt8bDR%2BSWL7OC4xejM5m"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 6fcedd790d3c1962-EWR
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
In both cases the same error is reported back, and in both cases the message on the console is the same nw_ws_validate_server_response.
Is there some way for me to figure out what is tripping NWConnection, or what it is that it doesn't like?
Hello friends,
I saw that iOS 16 has support for NSFileProviderReplicatedExtension, and I was hoping I could use this as a backend for my SSH/SFTP client.
I have attempted to use it by adding a new "File Provider Extension" target to my application, but when I attempt to use it, the system throws an exception shortly after calling my extension constructor, reporting that my class does not respond to the beginRequestWithExtensionContext:
2022-07-11 17:38:08.775886-0400 SshFs[32841:7522410] -[SshFs.FileProviderExtension beginRequestWithExtensionContext:]: unrecognized selector sent to instance 0x600001f80220
2022-07-11 17:38:08.778225-0400 SshFs[32841:7522410] [xpc.exceptions] <NSXPCConnection: 0x600002c900a0> connection to service with pid 27736 created from an endpoint: Warning: Exception caught during invocation of selector beginRequestWithDomain:alternateContentsDictionary:domainServicer:providerDomain:domainVersion:completionHandler:, dropping incoming message and invalidating the connection.
Exception: -[SshFs.FileProviderExtension beginRequestWithExtensionContext:]: unrecognized selector sent to instance 0x600001f80220
-[SshFs.FileProviderExtension beginRequestWithExtensionContext:]: unrecognized selector sent to instance 0x600001f80220
(
0 CoreFoundation 0x000000018040d20c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018005008c objc_exception_throw + 56
2 CoreFoundation 0x000000018041bd28 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x0000000180411104 ___forwarding___ + 1308
4 CoreFoundation 0x00000001804133fc _CF_forwarding_prep_0 + 92
5 FileProvider 0x000000018feb7c5c -[FPXExtensionContext beginRequestWithDomain:alternateContentsDictionary:domainServicer:providerDomain:domainVersion:completionHandler:] + 1464
6 CoreFoundation 0x00000001804135b0 __invoking___ + 144
7 CoreFoundation 0x0000000180410924 -[NSInvocation invoke] + 276
8 Foundation 0x0000000180cbc798 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT__ + 12
9 Foundation 0x0000000180cbb37c -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:] + 1184
10 Foundation 0x0000000180cbd5e0 message_handler_message + 84
11 Foundation 0x0000000180cbcb6c message_handler + 148
12 libxpc.dylib 0x0000000180087420 _xpc_connection_call_event_handler + 68
13 libxpc.dylib 0x00000001800877e0 _xpc_connection_mach_event + 904
14 libdispatch.dylib 0x0000000180134864 _dispatch_client_callout4 + 16
15 libdispatch.dylib 0x0000000180152f08 _dispatch_mach_msg_invoke + 624
16 libdispatch.dylib 0x000000018013c690 _dispatch_lane_serial_drain + 348
17 libdispatch.dylib 0x0000000180153fd4 _dispatch_mach_invoke + 468
18 libdispatch.dylib 0x000000018013c690 _dispatch_lane_serial_drain + 348
19 libdispatch.dylib 0x000000018013d4bc _dispatch_lane_invoke + 448
20 libdispatch.dylib 0x000000018014960c _dispatch_workloop_worker_thread + 772
21 libsystem_pthread.dylib 0x00000001add9bb40 _pthread_wqthread + 284
22 libsystem_pthread.dylib 0x00000001add9a904 start_wqthread + 8
)
I tried with a fresh project, with no baggage, and I get the same error, I uploaded it to GitHub
I am wondering what I might be missing, or if there is some sample code that I could get my hands on, just like there was some for macOS a couple of years back (FruitBasket).
Hello folks,
While the API for FileProviderUI is listed as supporting VisionOS 1.0, Xcode Cloud complains at the first step of the build with:
"Unsupported Platform. The extension bundle LaTerminal.app/PlugIns/LaTerminalFileProviderUI.appex is not supported for this platform. Please refer to the App Extension Programming Guide at http://developer.apple.com."
I also noticed that while you can create a FileExtension from Xcode, there is no template for creating the FileExtensionUI on Xcode for VisionOS projects.
Could use some guidance as to what I could be doing wrong.
One practice that I use a lot is to drag and drop a SwiftPM package into my project when I want to make local edits - this replaces the remote dependency with a local dependency. Then I can edit and make changes to the dependency.
When I am done, I remove that directory and Xcode would revert back to the remote package.
In Xcode 16 this feature does not seem to work anymore, and instead it offers to copy the files into the project.