Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
5703ecc1
Commit
5703ecc1
authored
May 04, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure login and signup view controllers.
parent
e972256c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
9 deletions
+74
-9
Main.storyboard
...Customers/Sample App Customers/Base.lproj/Main.storyboard
+0
-0
LoginViewController.swift
... Customers/Sample App Customers/LoginViewController.swift
+31
-5
SignupViewController.swift
...Customers/Sample App Customers/SignupViewController.swift
+43
-4
No files found.
Mobile Buy SDK Sample Apps/Sample App Customers/Sample App Customers/Base.lproj/Main.storyboard
View file @
5703ecc1
This diff is collapsed.
Click to expand it.
Mobile Buy SDK Sample Apps/Sample App Customers/Sample App Customers/LoginViewController.swift
View file @
5703ecc1
...
...
@@ -25,16 +25,42 @@
//
import
UIKit
import
Buy
class
LoginViewController
:
UITableViewController
{
@IBOutlet
weak
var
emailField
:
UITextField
!
@IBOutlet
weak
var
passwordField
:
UITextField
!
var
email
:
String
{
return
self
.
emailField
.
text
??
""
}
var
password
:
String
{
return
self
.
passwordField
.
text
??
""
}
// ----------------------------------
// MARK: -
View Loading
-
// MARK: -
Actions
-
//
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
private
func
loginUser
()
{
let
credentials
=
BUYAccountCredentials
(
items
:
[
BUYAccountCredentialItem
(
emailWithValue
:
self
.
email
),
BUYAccountCredentialItem
(
passwordWithValue
:
self
.
password
),
])
BUYClient
.
sharedClient
.
loginCustomerWithCredentials
(
credentials
)
{
(
customer
,
token
,
error
)
in
print
(
"Customer:
\(
customer
)
, Token:
\(
token
)
, Error:
\(
error
)
"
)
}
}
// ----------------------------------
// MARK: - UITableViewDelegate -
//
override
func
tableView
(
tableView
:
UITableView
,
didSelectRowAtIndexPath
indexPath
:
NSIndexPath
)
{
if
indexPath
.
section
==
1
{
if
!
self
.
email
.
isEmpty
&&
!
self
.
password
.
isEmpty
{
self
.
loginUser
()
}
}
tableView
.
deselectRowAtIndexPath
(
indexPath
,
animated
:
true
)
}
}
Mobile Buy SDK Sample Apps/Sample App Customers/Sample App Customers/SignupViewController.swift
View file @
5703ecc1
...
...
@@ -29,12 +29,50 @@ import Buy
class
SignupViewController
:
UITableViewController
{
@IBOutlet
weak
var
firstNameField
:
UITextField
!
@IBOutlet
weak
var
lastNameField
:
UITextField
!
@IBOutlet
weak
var
emailField
:
UITextField
!
@IBOutlet
weak
var
passwordField
:
UITextField
!
@IBOutlet
weak
var
passwordConfirmField
:
UITextField
!
var
firstName
:
String
{
return
self
.
firstNameField
.
text
??
""
}
var
lastName
:
String
{
return
self
.
lastNameField
.
text
??
""
}
var
email
:
String
{
return
self
.
emailField
.
text
??
""
}
var
password
:
String
{
return
self
.
passwordField
.
text
??
""
}
var
passwordConfirm
:
String
{
return
self
.
passwordField
.
text
??
""
}
// ----------------------------------
// MARK: -
View Loading
-
// MARK: -
Actions
-
//
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
private
func
createUser
()
{
let
credentials
=
BUYAccountCredentials
(
items
:
[
BUYAccountCredentialItem
(
firstNameWithValue
:
self
.
firstName
),
BUYAccountCredentialItem
(
firstNameWithValue
:
self
.
lastName
),
BUYAccountCredentialItem
(
emailWithValue
:
self
.
email
),
BUYAccountCredentialItem
(
passwordWithValue
:
self
.
password
),
BUYAccountCredentialItem
(
passwordConfirmationWithValue
:
self
.
passwordConfirm
),
])
BUYClient
.
sharedClient
.
createCustomerWithCredentials
(
credentials
)
{
(
customer
,
token
,
error
)
in
print
(
"Customer:
\(
customer
)
, Token:
\(
token
)
, Error:
\(
error
)
"
)
}
}
// ----------------------------------
// MARK: - UITableViewDelegate -
//
override
func
tableView
(
tableView
:
UITableView
,
didSelectRowAtIndexPath
indexPath
:
NSIndexPath
)
{
if
indexPath
.
section
==
1
{
if
!
self
.
email
.
isEmpty
&&
!
self
.
password
.
isEmpty
&&
!
self
.
firstName
.
isEmpty
&&
!
self
.
lastName
.
isEmpty
&&
!
self
.
passwordConfirm
.
isEmpty
{
self
.
createUser
()
}
}
tableView
.
deselectRowAtIndexPath
(
indexPath
,
animated
:
true
)
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment