Documentation Center

Luz iOS App

Document Infos


Change Logs

Quick Start


What is Luz ?
Luz is a powerful iOS template to load images, videos and articles from your website. It can be linked to a WordPress website. Features includes comments, social sharing, categories, user account, tour and about page.

Installing Xcode
Xcode is the mac app that you will need to open the .xcodeproj file. Follow the tutorial to install it and then open Luz.xcodeproj

Build the project
Once Xcode is open you can easily build the app at any time on the simulator or a device. All you have to do is to press cmd+R or click on run.

Quick Test
To quickly test the configuration settings while setting up apis, we have create an apis test endpoint. The endpoint url is http://leafcoding.com/luz/apis/. Please go to the Luz Xcode project and modify the API_Root_URL key inside Configuration.h (screenshot provided below).

Table of content


Introduction

Open the Xcode project (Luz.xcodeproj) and select the Luz project on the left menu. Select Targets and go to the Info tab. This section is for you to change : - The name displayed under your app icon in the iOS dashboard (Bundle display name) - The Icon glow effect (Icon already includes gloss effects) - The version number (Bundle version) This file is a plist and is easy to update.

To change the icon of the app go to Luz -> General -> App Icon Sources and replace the AppIcons (drag and drop).

Configuration File

Open the Configuration.h to modify the values and connect the APIs

Key Description

Please find below a description for each key inside the Configuration.h file


AdMode

Enable or Disable iAd inside the app. Accepted values are 0 (Disable) or 1 (Enable)

AdMobadUnitID (since v1.1)

Your AdMob advertisement unit ID. To learn more go to Google Support

AdMobTestMode (since v1.1)

Enable or Disable the use for the simulator to load Ad Mob Banners. Remember to disable it before sending to the AppStore. Accepted values are 0 (Disable) or 1 (Enable)

DebugMode

Enable or Disable Debugging Mode inside the app. Debugging mode gives you informations during your development or configuration phase. You should Disable it before going live on the AppStore. Accepted values are 0 (Disable) or 1 (Enable)

API_Root_URL

Set up the main apis end point URL for your custom JSON apis. Find more details under the JSON Custom Apis section

AllowComments

Enable or Disable Comments inside the app. Accepted values are 0 (Disable) or 1 (Enable)

AllowLikes

Enable or Disable Likes inside the app. Accepted values are 0 (Disable) or 1 (Enable)

RequireAuth

Enable or Disable Forced Authentication inside the app. Accepted values are 0 (Disable) or 1 (Enable)

ShowCellTitle

Enable or Disable Item Cell Title inside the app. Accepted values are 0 (Disable) or 1 (Enable)

ShowCellSubtitle

Enable or Disable Item Cell SubTitle inside the app. Accepted values are 0 (Disable) or 1 (Enable)

ShowCellDuration

Enable or Disable Item Cell Duration (videos only) inside the app. Accepted values are 0 (Disable) or 1 (Enable)

HasToBeLoggedInToLike

Enable or Disable Forced Auth before like action inside the app. Accepted values are 0 (Disable) or 1 (Enable)

TermsAndConditionsURL

Set up the url for terms and conditions in the sign up user interface. Accepted values are any correct url

ShowMenuHeader

Enable or Disable Menu Header (User photo and name) inside the app. Accepted values are 0 (Disable) or 1 (Enable)

WPApisDomain

Set up the main apis end point URL for your Wordpress apis. Find more details under the WordPress Apis section

EnableTour

Enable or Disable the App Tour. Accepted values are 0 (Disable) or 1 (Enable)

ShowTourOnlyOnce

Enable or Disable Showing App Tour only once inside the app. Accepted values are 0 (Disable) or 1 (Enable)

TourImagesiPhone

A list of images separated by commas for the app tour (iPhone devices only). Please remember to include your images inside the resources folder and the project it self (drag & drop).

TourImagesiPad

A list of images separated by commas for the app tour (iPad devices only). Please remember to include your images inside the resources folder and the project it self (drag & drop).

SocialAboutText

Set up the text for About us / Social section. Any text is accepted.

SocialList

Set up the list for the About us / Social List Labels. Separate the titles by a comma.

SocialListURLs

Set up the list for the About us / Social List URLs. Separate the URLs by a comma.

FontName

Set up the font name for the App labels. Please remember to include your font file inside the resources folder and the project it self (drag & drop).

FontNameBold

Set up the bold font name for the App labels. Please remember to include your font file inside the resources folder and the project it self (drag & drop).

SecondFont

Set up the font name for the App Menu Labels. Please remember to include your font file inside the resources folder and the project it self (drag & drop).

CellTitleFontSize

Set up the font size in pixels for the item titles. Accepted values are any correct integer number.

CellDurationFontSize

Set up the font size in pixels for the item duration labels. Accepted values are any correct integer number.

CellSubTitleFontSize

Set up the font size in pixels for the item subtitles. Accepted values are any correct integer number.

DescriptionFontSize

Set up the font size in pixels for the item description. Accepted values are any correct integer number.

CommentFontSize

Set up the font size in pixels for the comments. Accepted values are any correct integer number.

CommentNameFontSize

Set up the font size in pixels for the user name in the comments section. Accepted values are any correct integer number.

iPhoneRowHeight

Set up the row height for the iPhones items inside the lists. Accepted values are any correct integer number.

iPadMediumRowHeight

Set up the row height for the iPad medium sized items inside the lists. Accepted values are any correct integer number.

iPadBigRowHeight

Set up the row height for the iPad big sized items inside the lists. Accepted values are any correct integer number.

iPadCellPadding

Set up the padding value for the items inside the lists (iPad Version). Accepted values are any correct integer number.

iPhoneCellPadding

Set up the padding value for the items inside the lists (iPhone Version). Accepted values are any correct integer number.

BackGroundColor

Set up the color for the backgrounds in the app . Accepted values are any correct hexadecimal color code.

BackGroundColorDetail

Set up the color for the background inside any item detail window in the app . Accepted values are any correct hexadecimal color code.

NavigationBarColor

Set up the color for the navigation bar in the app. This value is also used to apply color to a certain number of other elements. Accepted values are any correct hexadecimal color code.

FontColor

Set up the main font color for the labels in the app . Accepted values are any correct hexadecimal color code.

CellBackGroundColor

Set up the color for the background inside the items list in the app . Accepted values are any correct hexadecimal color code.

CellCommentBackGroundColor

Set up the color for the background inside the comment items list in the app . Accepted values are any correct hexadecimal color code.

FontDetailsColor

Set up the details font color for the labels in the app . Accepted values are any correct hexadecimal color code.

BackGroundColorDetailDescription

Set up the color for the background description item in the app . Accepted values are any correct hexadecimal color code.

CellCommentFontColor

Set up the font color for the comment items in the app . Accepted values are any correct hexadecimal color code.



User Interface Modification

User Interface Files (.xib)

The User Interface Files (.xib) are located under the Luz Xcode Project (see screenshot below). All the files are compatible with auto-layout, so any change will apply to all devices. In case you don't know how to use interface builder inside Xcode, please have a look to the Apple documentation first.

Images Files

All images files are located under the Luz Xcode Project (see screenshot below). You can also find these files in the Finder under the Resource folder. Feel free to apply any modification to those files. We remind you to not forget to save for the appropriate sizes (@1x, @2x and @3x) if needed.

WordPress APIs

Install Jetpack

Luz can use your Wordpress website/blog data. To connect it you need to install Jetpack plugin inside your WordPress website. Make sure to enable the JSON apis (see screenshot below). To test if the plugin has been configured correctly try this URL : https://public-api.wordpress.com/rest/v1.1/sites/yourWPwebsite.com/posts/ .If the output is JSON results of the latest posts, you are all set.

Update the configuration file

In order to link the app to your Wordpress data, go to the Configuration.h file and update the WPApisDomain key to your domain (do not use http:// or www. in front of your domain)

Custom JSON APIs

Please find below the list of apis calls made from the app along with queries parameters and results. We also wanted to help you so we create some PHP examples to help you set up your custom private JSON APIs.

Load Main Feed PHP Example :
					$page = $_POST['page'];
					$userID = $_POST['userID'];
					$array = array();
	
	//Row 1
	$array[0]['title'] = 'Fish Surfing';
	$array[0]['date'] = '2015-09-14 18:00:00 +0000';
	$array[0]['type'] = 'image';
	$array[0]['thumb'] = 'http://leafcoding.com/luz/thumbs/fish_surf_thumb.jpg';
	$array[0]['embed'] = 'http://leafcoding.com/luz/thumbs/fish_surf.jpg';
	$array[0]['duration'] = '';
	$array[0]['description']='Wooden fish surfboard';
	$array[0]['postID']='1';
	$array[0]['postCategoryID']='1';
	$array[0]['postCategory']='Surf';
	$array[0]['link']='https://vimeo.com/45369433';
	$array[0]['liked_by_user']='true';
	
	echo json_encode($array);
	
Result Example (JSON):
[
{"title":"Fish Surfing",
"date":"2015-09-14 18:00:00 +0000",
"type":"image",
"thumb":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"embed":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"duration":"",
"description":"Wooden fish surfboard",
"postID":"1",
"postCategoryID":"1",
"postCategory":"Surf",
"link":"https:\/\/vimeo.com\/45369433"
} ]
Results items (Array of the following items) :
Load Main Feed For a Category PHP Example :
					$page = $_POST['page'];
					$userID = $_POST['userID'];
					$categoryID = $_POST['categoryID'];
					$array = array();
	
	//Row 1
	$array[0]['title'] = 'Fish Surfing';
	$array[0]['date'] = '2015-09-14 18:00:00 +0000';
	$array[0]['type'] = 'image';
	$array[0]['thumb'] = 'http://leafcoding.com/luz/thumbs/fish_surf_thumb.jpg';
	$array[0]['embed'] = 'http://leafcoding.com/luz/thumbs/fish_surf.jpg';
	$array[0]['duration'] = '';
	$array[0]['description']='Wooden fish surfboard';
	$array[0]['postID']='1';
	$array[0]['postCategoryID']='1';
	$array[0]['postCategory']='Surf';
	$array[0]['link']='https://vimeo.com/45369433';
	$array[0]['liked_by_user']='true';
	
	echo json_encode($array);
	
Result Example (JSON):
[
{"title":"Fish Surfing",
"date":"2015-09-14 18:00:00 +0000",
"type":"image",
"thumb":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"embed":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"duration":"",
"description":"Wooden fish surfboard",
"postID":"1",
"postCategoryID":"1",
"postCategory":"Surf",
"link":"https:\/\/vimeo.com\/45369433"
} ]
Results items (Array of the following items) :
Load Categories PHP Example :
					
					$array = array();
	$array[0]['name'] = "Surf";$array[0]['id'] = "1";
	$array[1]['name'] = "Skate";$array[1]['id'] = "2";
	$array[2]['name'] = "Travel";$array[2]['id'] = "3";

	

	echo json_encode($array);

	
Result Example (JSON):
[
{"name":"Surf","id":"1"},
{"name":"Skate","id":"2"},
{"name":"Travel","id":"3"},
]
Results items (Array of the following items) :
Like a Post PHP Example :
					$postID=$_POST['postID'];
					$userID=$_POST['userID'];
					$array = array();
	$array[0]['result'] = 'Success';
	echo json_encode($array);
The app is not expecting any specific JSON response
Load Comments for a Post PHP Example :
					$postID=$_POST['postID'];
					$page=$_POST['page'];
					$result=array();
					$result[0]['name']="John Doe";
		$result[0]['date']="2015-09-15 13:10:00 +0000";
		$result[0]['avatar']="http://leafcoding.com/luz/thumbs/avatar/m2.jpg";
		$result[0]['content']="Content";
		echo json_encode($array);
		
Result Example (JSON):
[
{"name":"John Doe",
"date":"2015-09-15 13:10:00 +0000",
"avatar":"http:\/\/leafcoding.com\/luz\/thumbs\/avatar\/m2.jpg",
"content":"Sharing it now. \ud83d\ude1c"}
]
Results items (Array of the following items) :
Send Comment for a Post PHP Example :
					$postID=$_POST['postID'];
					$userID=$_POST['userID'];
					$comment=$_POST['comment'];
					$array = array();
	$array[0]['result'] = 'Success';
	echo json_encode($array);
The app is not expecting any specific JSON response
Register User PHP Example :
					$email = $_POST['email'];
					$photo = $_POST['data'];
					$pwd_md5_hash = $_POST['pwd'];
						$array = array();
	$array[0]['user']['email'] = $_POST['email'];
	$array[0]['user']['userID'] = "1";
	$array[0]['user']['photoURL'] = "http://leafcoding.com/luz/thumbs/avatar/m1.jpg";
	echo json_encode($array);
Result Example (JSON):
[
{"user":
{"email":'test@leafcoding.com',
"userID":"1",
"photoURL":"http:\/\/leafcoding.com\/luz\/thumbs\/avatar\/m1.jpg", "first_name":"John",
"last_name":"Doe"

}
}]
Results items (Array of the following items) :
Log User PHP Example :
					$email = $_POST['email'];
					$pwd_md5_hash = $_POST['pwd'];
						$array = array();
	$array[0]['user']['email'] = $_POST['email'];
	$array[0]['user']['userID'] = "1";
	$array[0]['user']['photoURL'] = "http://leafcoding.com/luz/thumbs/avatar/m1.jpg";
	echo json_encode($array);
Result Example (JSON):
[
{"user":
{"email":'test@leafcoding.com',
"userID":"1",
"photoURL":"http:\/\/leafcoding.com\/luz\/thumbs\/avatar\/m1.jpg", "first_name":"John",
"last_name":"Doe"

}
}]
Results items (Array of the following items) :
Update User PHP Example :
					$email = $_POST['email'];
					$photo = $_POST['data'];
					$pwd_md5_hash = $_POST['pwd'];
					$first_name = $_POST['first'];
					$last_name = $_POST['last'];
						$array = array();
	$array[0]['user']['email'] = $_POST['email'];
	$array[0]['user']['userID'] = "1";
	$array[0]['user']['first_name'] = "John";
	$array[0]['user']['last_name'] = "Doe";
	$array[0]['user']['photoURL'] = "http://leafcoding.com/luz/thumbs/avatar/m1.jpg";
	echo json_encode($array);
Result Example (JSON):
[
{"user":
{"email":'test@leafcoding.com',
"userID":"1",
"photoURL":"http:\/\/leafcoding.com\/luz\/thumbs\/avatar\/m1.jpg", "first_name":"John",
"last_name":"Doe"

}
}]
Results items (Array of the following items) :
Load Search Results PHP Example :
					$userID = $_POST['userID'];
					$search_content = $_POST['s'];
					$array = array();
	
	//Row 1
	$array[0]['title'] = 'Fish Surfing';
	$array[0]['date'] = '2015-09-14 18:00:00 +0000';
	$array[0]['type'] = 'image';
	$array[0]['thumb'] = 'http://leafcoding.com/luz/thumbs/fish_surf_thumb.jpg';
	$array[0]['embed'] = 'http://leafcoding.com/luz/thumbs/fish_surf.jpg';
	$array[0]['duration'] = '';
	$array[0]['description']='Wooden fish surfboard';
	$array[0]['postID']='1';
	$array[0]['postCategoryID']='1';
	$array[0]['postCategory']='Surf';
	$array[0]['link']='https://vimeo.com/45369433';
	$array[0]['liked_by_user']='true';
	
	echo json_encode($array);
	
Result Example (JSON):
[
{"title":"Fish Surfing",
"date":"2015-09-14 18:00:00 +0000",
"type":"image",
"thumb":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"embed":"http:\/\/leafcoding.com\/luz\/thumbs\/fish_surf.jpg",
"duration":"",
"description":"Wooden fish surfboard",
"postID":"1",
"postCategoryID":"1",
"postCategory":"Surf",
"link":"https:\/\/vimeo.com\/45369433"
} ]
Results items (Array of the following items) :
© Leaf Coding 2015. All rights reserved.