Swift package to get the current user
whoami.swift
Retrieve the current user and environment through simple functions.
This package can:
- Get the user’s full name
- Get the user’s username
- Get the user’s preferred language(s)
- Get the devices’s hostname
- Some unimplemented TODO
Example
Add this package to current project and import.
import Whoami
func main() {
let host = Whoami().hostName()
print("Current host: \(host)")
}
The GitHub Link: