Swift Documentation Generation
Table of Content:
- Terminal Setup
- Install Ruby
Swift code documentation generator
Swift code documentation generator :Every programmer is obsessed with programming Documentation. To reduce this problem we can use jazzy Documentation. Swift requires documentation of code
Swift Doc Format
To install the Jazzy Documentation WE need to open terminal in mac
1) enter sudo code
$sudo gem install jazzy
2) enter your password of the user
3) Make sure Ruby is install in your system install or upgrade Ruby and then re-execute sudo gem install jazzy
4) if ruby is not installed execute the below code
A.) $ curl -L get.rvm.io | bash -s stable
B.) $ source ~/.bashrc
C.) $ source ~/.bash_profile
5) view the version of Ruby
$ rvm -v
6) To update the version of ruby execute the code example to update the code to Ruby 2.3.9
$ rvm install 2.3.9
7) After updating the ruby re-execute the sudo gem install jazzy
8) after successfully installation of Ruby and jazzy , go to the Project root Directory
$ cd path_to_project_folder
then excute
$ jazzy –min-acl internal -x -workspace,Workspace.xcworkspace,-scheme,Scheme
example:
$ jazzy –min-acl internal -x -workspace,projectname.xcworkspace,-scheme, projectname
9) if facing issue then execute these following command:-
A.) xcodebuild build -workspace Workspace.xcworkspace -scheme Scheme
B.) jazzy –min-acl internal -x -workspace,Workspace.xcworkspace,-scheme,Scheme
10)Then you will see the output in terminal
11)
Goto Project Folder -> docs – open Index.html.
Example of Documenting Code inside any Class :-
/**
– Parameters:
– VC : View Controller over which the function is called. You can use self, or provide a view controller name.
– message: Pass your alert message in String.
– okClickHandler: This will give you call back inside block when OK button is clicked
*/
Note:-