Swift – Full Name of Current Logon User
To get full name of current logon user in Swift, call NSFullUserName()
function.
The following code snippet returns the String representing the full name of the current logon user.
</>
Copy
NSFullUserName()
Example
In the following example Swift program, we will get the full name of current logon user, using the code snippet mentioned above.
main.swift
</>
Copy
import Foundation
let username = NSFullUserName()
print(username)
Output
TUTORIALKART
Conclusion
In this Swift Tutorial, we learned how to get the full name of current logon user in Swift.