Swift on Mac terminal - swift

Formerly I used FreeBSD and NetBSD. Mostly I code C on Command Line Interface (CLI) with vim editor.
Now I am using macOS. As I get used to CLI, so when I code swift on macOS, I opt console.
I've learned that I can also code swift on Mac Terminal without installing Xcode. I can compile or interpret and run simple Swift code on Terminal.
So my questions, does swift on Mac Terminal have full features as Xcode or not? Are all Swift libraries included in Mac Terminal?

You will have to install Xcode even if you don't plan to use it, because it installs the Swift toolchain.
On Linux you can install standalone Swift (and of course you can only access Linux libraries, not macOS or iOS ones) but in macOS you have to install via Xcode (but you don't have to use Xcode itself to write code).
See https://swift.org/getting-started/ and https://swift.org/download/#releases

Install xcode command line tools. Then in terminal, follow steps:
Step 1: Open Terminal
Step 2: Type "swift"
Now you can write swift code here. But better to use playground.

Related

Cross-compile Swift code for Raspberry Pi on macOS

What is the easiest / best way to use a macOS Xcode setup to build code for a Raspberry Pi (3b+)?
Some of the builds can be pretty heavy, thus building them on the Raspberry would take too long. Thus it would be preferred to build on macOS. How should I go about doing this?
Note: I'm aware that there is quite some information out there.
However, some of it is a few years old, and Swift is changing quickly.
To answer my own question, the current best solution (very recent) is:
https://github.com/CSCIX65G/swift-mac2arm-x-compile-toolchain
That provides the needed toolchains, etc. for building on macOS for the R Pi.
Best instructions for remote debugging (using lldb) can be found here:
https://lldb.llvm.org/use/remote.html
Note that on macOS you need to use the version of lldb provided by the toolchain, e.g.:
[path_to_toolchains]/Toolchains/arm64-swift.xctoolchain/usr/bin/lldb -o "platform select remote-linux" -o "platform connect connect://ipaddress:port" -o "file ./remoteProgram"
Still looking to connect the lldb debugger to Xcode run on the Mac. If that can be done, the development cycle is complete.

Swift programming without using mac

I am new to mobile application development and I have decided to use Swift for iOS development but I don't want to buy a Mac , can I install macOS on another computer and start developing?
Thanks
If you want to get started with Swift programming this is also possible on Windows. There is an open source Swift Compiler for Windows. This is basically useful for learning Swift and possibly for writing desktop applications, e.g. using wxSwift, a binding from the portable GUI library wxWidgets to Swift. If you want to program mobile applications with Swift you'll end up with MacOS, but it can possibly be setup as a virtual machine or installed on a regular PC hardware. See also: https://learnappmaking.com/develop-ios-apps-on-windows-pc/
Of course, it is also possible to program Swift on Ubuntu Linux as officially supported by the Swift project. However, Xcode is not available for Linux, so it is basically useful to learn the language

Ionic Capacitor iOS on linux

Considering this answer, it is not possible to run Xcode on Arch Linux.
Capacitor iOS documentation says that I need it to run iOS emulation.
Is there a way to emulate iOS device on Manjaro using Ionic Capacitor?
you can run xcode on linux NATIVELY using darling
Darling is a translation layer that lets you run macOS software on Linux
once installed you can install xcode
via command-line developer tool following this link
No, it's not possible, iOS requires Xcode and macOS

Is it possible to port Apple .frameworks files to Linux?

I am trying to build a swift project on Linux which depends on CoreBluetooth.framework. It builds fine on OSX, but on Linux it gives me the following error
~/ReWork/.../DeviceManager.swift:10:8: error no such module 'CoreBluetooth'
import CoreBluetooth
^
I used Xcode to hunt around, and found the actual .framework file on my mac, which looks to contain a bunch of headers. Is it at all possible to put this on my linux box and point swift to it?
No. CoreBluetooth is a component of macOS, and is not available on Linux.

New Xcode8 extension development process

Recently I'm running the Xcode plugin migration to Xcode8 built in version.
But I can't find enough documentation since it's new and the resource is very rare.
Does anybody know how to publish / install / update /remove process of the new extensions?
I've try many solution but many of the users say it doesn't work.
Here is my project call Swimat - to format your swift code.
https://github.com/Jintin/Swimat/tree/extension
Thanks for any kind of information.
Are you asking how your users can install/update/remove your extension?
If so, they just need to launch your container app. Once they do, they'll see the extension in System Preferences (where they can also disable it if necessary), and it'll show up when they launch Xcode.
Distribution of your source editor extension works just like other types of App Extensions. See: App Extension Programming Guide
If your users are having trouble running any source editor extensions, it's possible they'll need to follow a workaround from the Xcode 8 release notes:
To use the Editor's Comment/Uncomment Selection and Add Documentation
commands—as well as other installed Xcode Extensions—on OS X version 10.11,
launch Xcode and install additional system components, then restart your
Mac. (26106213)"