FutureJones
Published © MIT

Swift 3.0 on Raspberry Pi! Hello Swifty World! - Part 2

In part 2 of "Hello, swifty world" we will learn about Swift Modules and the Swift-Lite build system.

BeginnerProtip30 minutes4,443
Swift 3.0 on Raspberry Pi! Hello Swifty World! - Part 2

Things used in this project

Hardware components

Raspberry Pi Zero
Raspberry Pi Zero
Compatible with all Raspberry Pi models including Raspberry Pi 3 and Raspberry Pi Zero
×1

Software apps and online services

Raspberry Pi Raspbian Jessie
Swift-Lite

Story

Read more

Code

helloworld.swift

Swift
Project file for "Hello, swifty world" tutorial.
// A Swift-Lite Project File
// type:project
// name:helloworld
// include:date.swift

print("Hello, swifty world!")

// function from date.swift module
printToday()

date.swift

Swift
Module file for "Hello, swifty world" tutorial.
// A Swift-Lite Module File
// type:module
// name:date

import Foundation

    func printToday(){
        let date = Date()
        let dateFormatter = DateFormatter()
        
        dateFormatter.dateStyle = .full
        dateFormatter.timeStyle = .full
        
        let dateString = dateFormatter.string(from: date as Date)
        
        print("FullStyle Date Format = \(dateString)") 
        
        }

Credits

FutureJones

FutureJones

4 projects • 34 followers
Development Engineer at Swift-Arm - Bringing Swift to the Raspberry Pi and other Arm SBC's. Designer and creator of Swift-Lite.

Comments