How do you check documentation as you learn swift?

How do you check documentation as you learn swift?
Is there some way to access documentation/code as in python notebooks (method?, method??) in swift notebooks?

My temporary method right now is using xcode which allows you to search the documentation very quickly.

1 Like

I don’t use MacOS :confused:

What do you usually search for? Are they concepts of Swift in general like optionals, get/ set … or more related to s4tf?

Just started with swift. For now, I’m googling the more general things and for s4tf I’m checking the docs and the source code. Feels pretty slow :sweat_smile:.

Maybe try clion, which has a swift extension?

3 Likes

If the APIs are from swift foundation, I will read from apple’s Swift docs.
Feel better than the docs from xcode.

Jeremy, I am trying to make some optimizations experiments (like genetic algorithms) with swift to test its speed. For this kind of tasks where I won’t be using differentiation will it be better to use TensorFlow operations or your BaseMath/SwiftyMKL libraries?

Definitely the latter. :slight_smile:

1 Like

I’m trying to use SwiftyMKL, I pulled and intalled the repo. make run and make test works as expected but I can’t import the library on swift shell :s

I also tried this from jupyter:

%install-location $cwd/swift-install
%install '.package(path: "$cwd/SwiftyMKL")' SwiftyMKL

but I get:

Installing packages:
	.package(path: "/home/renato/tmp/SwiftyMKL")
		SwiftyMKL
With SwiftPM flags: []
Working in: /tmp/tmpv5t7qq7y/swift-install
/home/renato/swift/usr/bin/swift-build: /home/renato/anaconda3/lib/libuuid.so.1: no version information available (required by /home/renato/swift/usr/lib/swift/linux/libFoundation.so)
/home/renato/swift/usr/bin/swift-build: /home/renato/anaconda3/lib/libcurl.so.4: no version information available (required by /home/renato/swift/usr/lib/swift/linux/libFoundation.so)
Fetching https://github.com/jph00/BaseMath.git
Completed resolution in 2.30s
Cloning https://github.com/jph00/BaseMath.git
Resolving https://github.com/jph00/BaseMath.git at 1.0.1
'jupyterInstalledPackages' /home/renato/tmp/swift-install/package: error: product dependency 'SwiftyMKL' not found
warning: dependency 'SwiftyMKL' is not used by any target

Install Error: swift-build returned nonzero exit code 1.

Am I missing any step?

Btw, my os is ubuntu 18.04.

swift-jupyter compiles the library using the Swift Package Manager. The fact that make works does not guarantee that SPM will work too. I would try it out by issuing the command swift build in the place where you downloaded the repo. By looking at the code it looks like SwiftyMKL depends on Intel’s Math Kernel Library, so you might need to have that installed in your system first - make downloads a copy, but it places it inside the project folder. That’s a non-standard place, so it might not be found by the package manager.

As a Python and ex-Java person, I find this Swift in Depth book (December 2018, Swift 4.2) an excellent guide when the official docs don’t given an answer to anything weird:


1 Like