FAQ is an iOS library that makes building an FAQs section into your app super simple.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'FAQ', :git => 'TODO'
Just initialize the controller and present it!
let FAQViewController = FAQController(URL: NSURL(string: "https://red.to/test.json")!)
self.presentViewController(FAQViewController, animated: true)
The JSON file should look like:
{
"title": "Cooking FAQ's",
"actionType": "navigation",
"data": [
{
"title": "How to cook jelly",
"actionType": "web",
"data": "https://red.to"
},
{
"title": "How to cook pasta",
"actionType": "web",
"data": "https://red.to"
},
{
"title": "Pasta FAQ's",
"actionType": "navigation",
"data": [
{
"title": "Row 1",
"actionType": "web",
"data": "https://red.to"
},
{
"title": "Row 2",
"actionType": "web",
"data": "https://red.to"
},
{
"title": "Row 3",
"actionType": "web",
"data": "https://red.to"
}
]
},
{
"title": "How to buy pans",
"actionType": "web",
"data": "https://red.to"
}
]
}
Each section is made up of 3 values; title
, actionType
and data
.
title
is pretty straight forward, it’s the title.
The actionType
defines what type of controller should be shown. navigation
will show a table view and web
will show a web view.
navigation
action types expect the data
value to be an array of sections.
web
action types expect the data
value to be a URL.