Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
contact-list-app
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Luis Zarza
contact-list-app
Commits
73d919d6
Commit
73d919d6
authored
Mar 16, 2020
by
Luis Zarza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parent
e842e5e9
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
516 additions
and
16 deletions
+516
-16
contact-list-app.xcodeproj/project.pbxproj
+4
-0
contact-list-app.xcodeproj/xcuserdata/roshka.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+6
-0
contact-list-app/Assets.xcassets/roshka.imageset/3RAw8Hjd_400x400.png
+0
-0
contact-list-app/Assets.xcassets/roshka.imageset/Contents.json
+22
-0
contact-list-app/Base.lproj/Main.storyboard
+194
-8
contact-list-app/ContactProfileVC.swift
+118
-0
contact-list-app/Info.plist
+4
-0
contact-list-app/ViewController.swift
+168
-8
No files found.
contact-list-app.xcodeproj/project.pbxproj
View file @
73d919d6
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
BBE208A7241A541600A7D661
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208A5241A541600A7D661
/* LaunchScreen.storyboard */
;
};
BBE208A7241A541600A7D661
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208A5241A541600A7D661
/* LaunchScreen.storyboard */
;
};
BBE208B2241A541700A7D661
/* contact_list_appTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208B1241A541700A7D661
/* contact_list_appTests.swift */
;
};
BBE208B2241A541700A7D661
/* contact_list_appTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208B1241A541700A7D661
/* contact_list_appTests.swift */
;
};
BBE208BD241A541700A7D661
/* contact_list_appUITests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208BC241A541700A7D661
/* contact_list_appUITests.swift */
;
};
BBE208BD241A541700A7D661
/* contact_list_appUITests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208BC241A541700A7D661
/* contact_list_appUITests.swift */
;
};
BBE208CB241ADD6C00A7D661
/* ContactProfileVC.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BBE208CA241ADD6C00A7D661
/* ContactProfileVC.swift */
;
};
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
/* Begin PBXContainerItemProxy section */
...
@@ -49,6 +50,7 @@
...
@@ -49,6 +50,7 @@
BBE208B8241A541700A7D661
/* contact-list-appUITests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
"contact-list-appUITests.xctest"
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
BBE208B8241A541700A7D661
/* contact-list-appUITests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
"contact-list-appUITests.xctest"
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
BBE208BC241A541700A7D661
/* contact_list_appUITests.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
contact_list_appUITests.swift
;
sourceTree
=
"<group>"
;
};
BBE208BC241A541700A7D661
/* contact_list_appUITests.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
contact_list_appUITests.swift
;
sourceTree
=
"<group>"
;
};
BBE208BE241A541700A7D661
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
BBE208BE241A541700A7D661
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
BBE208CA241ADD6C00A7D661
/* ContactProfileVC.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ContactProfileVC.swift
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
/* Begin PBXFrameworksBuildPhase section */
...
@@ -106,6 +108,7 @@
...
@@ -106,6 +108,7 @@
BBE208A3241A541600A7D661
/* Assets.xcassets */
,
BBE208A3241A541600A7D661
/* Assets.xcassets */
,
BBE208A5241A541600A7D661
/* LaunchScreen.storyboard */
,
BBE208A5241A541600A7D661
/* LaunchScreen.storyboard */
,
BBE208A8241A541600A7D661
/* Info.plist */
,
BBE208A8241A541600A7D661
/* Info.plist */
,
BBE208CA241ADD6C00A7D661
/* ContactProfileVC.swift */
,
);
);
path
=
"contact-list-app"
;
path
=
"contact-list-app"
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -262,6 +265,7 @@
...
@@ -262,6 +265,7 @@
BBE2089F241A540F00A7D661
/* ViewController.swift in Sources */
,
BBE2089F241A540F00A7D661
/* ViewController.swift in Sources */
,
BBE2089B241A540F00A7D661
/* AppDelegate.swift in Sources */
,
BBE2089B241A540F00A7D661
/* AppDelegate.swift in Sources */
,
BBE2089D241A540F00A7D661
/* SceneDelegate.swift in Sources */
,
BBE2089D241A540F00A7D661
/* SceneDelegate.swift in Sources */
,
BBE208CB241ADD6C00A7D661
/* ContactProfileVC.swift in Sources */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
...
contact-list-app.xcodeproj/xcuserdata/roshka.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
0 → 100644
View file @
73d919d6
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid =
"E62FFFE2-E3E7-4856-BC3B-99F22A3963AA"
type =
"1"
version =
"2.0"
>
</Bucket>
contact-list-app/Assets.xcassets/roshka.imageset/3RAw8Hjd_400x400.png
0 → 100644
View file @
73d919d6
63.4 KB
contact-list-app/Assets.xcassets/roshka.imageset/Contents.json
0 → 100644
View file @
73d919d6
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"3RAw8Hjd_400x400.png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
contact-list-app/Base.lproj/Main.storyboard
View file @
73d919d6
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13122.16"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
initialViewController=
"BYZ-38-t0r"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"15400"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
colorMatched=
"YES"
initialViewController=
"oce-u7-YwH"
>
<device
id=
"retina6_1"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"13104.12"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"15404"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
</dependencies>
<scenes>
<scenes>
<!--
View Controller
-->
<!--
Contacts
-->
<scene
sceneID=
"tne-QT-ifu"
>
<scene
sceneID=
"tne-QT-ifu"
>
<objects>
<objects>
<viewController
id=
"BYZ-38-t0r"
customClass=
"ViewController"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<viewController
id=
"BYZ-38-t0r"
customClass=
"ViewController"
customModule=
"contact_list_app"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<layoutGuides>
<viewControllerLayoutGuide
type=
"top"
id=
"rpR-nG-dWc"
/>
<viewControllerLayoutGuide
type=
"bottom"
id=
"5Uy-TO-mT9"
/>
</layoutGuides>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
375"
height=
"667
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
414"
height=
"896
"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<color
key=
"backgroundColor"
xcode11CocoaTouchSystemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<subviews>
<viewLayoutGuide
key=
"safeArea"
id=
"6Tk-OE-BBY"
/>
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"default"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"28"
sectionFooterHeight=
"28"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"yEq-E4-J6w"
>
<rect
key=
"frame"
x=
"0.0"
y=
"188"
width=
"414"
height=
"674"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<prototypes>
<tableViewCell
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
preservesSuperviewLayoutMargins=
"YES"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"contactCell"
rowHeight=
"62"
id=
"lPk-Fk-Vjq"
customClass=
"ContactCell"
customModule=
"contact_list_app"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"28"
width=
"414"
height=
"62"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
preservesSuperviewLayoutMargins=
"YES"
insetsLayoutMarginsFromSafeArea=
"NO"
tableViewCell=
"lPk-Fk-Vjq"
id=
"ckC-7R-599"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"62"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Xf3-p0-ISG"
>
<rect
key=
"frame"
x=
"20"
y=
"13.5"
width=
"36"
height=
"35"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"tintColor"
white=
"0.66666666669999997"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"fuy-oJ-DGB"
>
<rect
key=
"frame"
x=
"64"
y=
"21"
width=
"195"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<outlet
property=
"nameLbl"
destination=
"fuy-oJ-DGB"
id=
"uls-i0-de2"
/>
<outlet
property=
"profilePic"
destination=
"Xf3-p0-ISG"
id=
"Rg9-yB-R93"
/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
image=
"3RAw8Hjd_400x400"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"uXr-7H-u4l"
>
<rect
key=
"frame"
x=
"157"
y=
"96"
width=
"100"
height=
"90"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
</subviews>
<color
key=
"backgroundColor"
red=
"0.92132973669999996"
green=
"0.93007987739999998"
blue=
"0.952917397"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<constraints>
<constraint
firstItem=
"5Uy-TO-mT9"
firstAttribute=
"top"
secondItem=
"yEq-E4-J6w"
secondAttribute=
"bottom"
id=
"8Sq-6G-bMc"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"yEq-E4-J6w"
secondAttribute=
"trailing"
id=
"FLX-Xx-Rhf"
/>
<constraint
firstItem=
"yEq-E4-J6w"
firstAttribute=
"leading"
secondItem=
"8bC-Xf-vdC"
secondAttribute=
"leading"
id=
"eJv-oN-nLL"
/>
<constraint
firstItem=
"yEq-E4-J6w"
firstAttribute=
"top"
secondItem=
"rpR-nG-dWc"
secondAttribute=
"bottom"
constant=
"100"
id=
"nAJ-O1-aip"
/>
</constraints>
</view>
</view>
<navigationItem
key=
"navigationItem"
title=
"Contacts"
id=
"bfK-iM-1Sh"
/>
<connections>
<outlet
property=
"contacsTable"
destination=
"yEq-E4-J6w"
id=
"zMq-Ro-NJS"
/>
</connections>
</viewController>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"dkx-z0-nzr"
sceneMemberID=
"firstResponder"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"dkx-z0-nzr"
sceneMemberID=
"firstResponder"
/>
</objects>
</objects>
<point
key=
"canvasLocation"
x=
"1042.0289855072465"
y=
"69.642857142857139"
/>
</scene>
<!--Contact ProfileVC-->
<scene
sceneID=
"f7s-LV-l4v"
>
<objects>
<viewController
storyboardIdentifier=
"contactProfileID"
id=
"LL8-U7-O8l"
customClass=
"ContactProfileVC"
customModule=
"contact_list_app"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<layoutGuides>
<viewControllerLayoutGuide
type=
"top"
id=
"5oe-vr-uDI"
/>
<viewControllerLayoutGuide
type=
"bottom"
id=
"o1o-O3-4or"
/>
</layoutGuides>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"plT-rv-AIL"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Label"
textAlignment=
"center"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"lsN-f2-7Q7"
>
<rect
key=
"frame"
x=
"57"
y=
"265"
width=
"300"
height=
"30"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"25"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"person.circle.fill"
catalog=
"system"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"aqc-6p-dNh"
>
<rect
key=
"frame"
x=
"132"
y=
"93.5"
width=
"150"
height=
"149"
/>
<color
key=
"tintColor"
white=
"0.66666666669999997"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"150"
id=
"OLe-7d-Xfc"
/>
<constraint
firstAttribute=
"height"
constant=
"150"
id=
"Vcm-cY-zsp"
/>
</constraints>
</imageView>
<tableView
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"default"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"28"
sectionFooterHeight=
"28"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"aic-Uk-fNB"
>
<rect
key=
"frame"
x=
"0.0"
y=
"356"
width=
"414"
height=
"506"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<prototypes>
<tableViewCell
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
preservesSuperviewLayoutMargins=
"YES"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"contactPhoneNumberCell"
id=
"Fx5-n5-I8P"
customClass=
"PhoneNumberCell"
customModule=
"contact_list_app"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"28"
width=
"414"
height=
"43.5"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
preservesSuperviewLayoutMargins=
"YES"
insetsLayoutMarginsFromSafeArea=
"NO"
tableViewCell=
"Fx5-n5-I8P"
id=
"o45-nf-QV0"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"43.5"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
image=
"phone.fill"
catalog=
"system"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"AoQ-Z6-Rj0"
>
<rect
key=
"frame"
x=
"20"
y=
"2"
width=
"32"
height=
"39"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"35D-gi-Vib"
>
<rect
key=
"frame"
x=
"64"
y=
"11"
width=
"179"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<outlet
property=
"phoneIconImg"
destination=
"AoQ-Z6-Rj0"
id=
"eMW-Vm-sQ6"
/>
<outlet
property=
"phoneNumberLbl"
destination=
"35D-gi-Vib"
id=
"G6s-E7-6Z0"
/>
</connections>
</tableViewCell>
<tableViewCell
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
preservesSuperviewLayoutMargins=
"YES"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"emailAddressCellID"
id=
"qb1-bN-vea"
customClass=
"EmailAddressCell"
customModule=
"contact_list_app"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"71.5"
width=
"414"
height=
"43.5"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
preservesSuperviewLayoutMargins=
"YES"
insetsLayoutMarginsFromSafeArea=
"NO"
tableViewCell=
"qb1-bN-vea"
id=
"wzD-FC-e5G"
customClass=
"EmailAddressCell"
customModule=
"contact_list_app"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"43.5"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"G9v-30-3L2"
>
<rect
key=
"frame"
x=
"63"
y=
"11"
width=
"286"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
image=
"envelope"
catalog=
"system"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"26i-CX-gzd"
>
<rect
key=
"frame"
x=
"18"
y=
"5"
width=
"35"
height=
"33"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet
property=
"emailAddressLbl"
destination=
"G9v-30-3L2"
id=
"I4s-55-KCu"
/>
</connections>
</tableViewCell>
</prototypes>
</tableView>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<constraints>
<constraint
firstItem=
"aic-Uk-fNB"
firstAttribute=
"leading"
secondItem=
"plT-rv-AIL"
secondAttribute=
"leading"
id=
"67i-g4-NdJ"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"lsN-f2-7Q7"
secondAttribute=
"trailing"
constant=
"57"
id=
"98w-IL-fuh"
/>
<constraint
firstItem=
"lsN-f2-7Q7"
firstAttribute=
"leading"
secondItem=
"plT-rv-AIL"
secondAttribute=
"leading"
constant=
"57"
id=
"AqT-Px-hnS"
/>
<constraint
firstItem=
"aqc-6p-dNh"
firstAttribute=
"centerX"
secondItem=
"plT-rv-AIL"
secondAttribute=
"centerX"
id=
"D3y-t6-qOA"
/>
<constraint
firstItem=
"aic-Uk-fNB"
firstAttribute=
"top"
secondItem=
"lsN-f2-7Q7"
secondAttribute=
"bottom"
constant=
"61"
id=
"ONE-qv-FDH"
/>
<constraint
firstItem=
"aqc-6p-dNh"
firstAttribute=
"top"
secondItem=
"5oe-vr-uDI"
secondAttribute=
"bottom"
constant=
"49"
id=
"esw-oM-raU"
/>
<constraint
firstItem=
"lsN-f2-7Q7"
firstAttribute=
"top"
secondItem=
"aqc-6p-dNh"
secondAttribute=
"bottom"
constant=
"22"
id=
"j6G-MY-N7i"
/>
<constraint
firstItem=
"o1o-O3-4or"
firstAttribute=
"top"
secondItem=
"aic-Uk-fNB"
secondAttribute=
"bottom"
id=
"ut5-en-TNj"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"aic-Uk-fNB"
secondAttribute=
"trailing"
id=
"vTT-Ez-SKT"
/>
</constraints>
</view>
<connections>
<outlet
property=
"contactPhoneNumbersTable"
destination=
"aic-Uk-fNB"
id=
"bR1-NU-cgB"
/>
<outlet
property=
"nameLbl"
destination=
"lsN-f2-7Q7"
id=
"l4n-WS-ZIm"
/>
<outlet
property=
"profilePic"
destination=
"aqc-6p-dNh"
id=
"ZuQ-fr-ch3"
/>
</connections>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"Wp9-Fb-PXH"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"1908.6956521739132"
y=
"69.642857142857139"
/>
</scene>
<!--Navigation Controller-->
<scene
sceneID=
"1LF-8i-MOu"
>
<objects>
<navigationController
automaticallyAdjustsScrollViewInsets=
"NO"
id=
"oce-u7-YwH"
sceneMemberID=
"viewController"
>
<toolbarItems/>
<navigationBar
key=
"navigationBar"
contentMode=
"scaleToFill"
insetsLayoutMarginsFromSafeArea=
"NO"
id=
"U8M-aI-L3B"
>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"44"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<color
key=
"tintColor"
red=
"0.22852048280000001"
green=
"0.54993033410000003"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
key=
"barTintColor"
red=
"0.0"
green=
"0.47843137250000001"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<textAttributes
key=
"titleTextAttributes"
>
<color
key=
"textColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
</textAttributes>
</navigationBar>
<nil
name=
"viewControllers"
/>
<connections>
<segue
destination=
"BYZ-38-t0r"
kind=
"relationship"
relationship=
"rootViewController"
id=
"T7m-Zc-QdJ"
/>
</connections>
</navigationController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"0Er-KU-fi5"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
</objects>
<point
key=
"canvasLocation"
x=
"131.8840579710145"
y=
"69.642857142857139"
/>
</scene>
</scene>
</scenes>
</scenes>
<resources>
<image
name=
"3RAw8Hjd_400x400"
width=
"400"
height=
"400"
/>
<image
name=
"envelope"
catalog=
"system"
width=
"64"
height=
"46"
/>
<image
name=
"person.circle.fill"
catalog=
"system"
width=
"64"
height=
"60"
/>
<image
name=
"phone.fill"
catalog=
"system"
width=
"64"
height=
"56"
/>
</resources>
</document>
</document>
contact-list-app/ContactProfileVC.swift
0 → 100644
View file @
73d919d6
import
UIKit
import
Contacts
struct
ContactProfile
{
var
phonNumbersList
:[
String
]
var
emailAdressList
:
[
String
]
}
class
PhoneNumberCell
:
UITableViewCell
{
@IBOutlet
weak
var
phoneIconImg
:
UIImageView
!
@IBOutlet
weak
var
phoneNumberLbl
:
UILabel
!
}
class
EmailAddressCell
:
UITableViewCell
{
@IBOutlet
weak
var
emailAddressLbl
:
UILabel
!
}
class
ContactProfileVC
:
UIViewController
{
var
contact
:
CNContact
?
var
contactProfileData
:
ContactProfile
?
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
profilePic
:
UIImageView
!
@IBOutlet
weak
var
contactPhoneNumbersTable
:
UITableView
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
//call the main function
main
()
}
func
main
(){
//set profile pic
setProfilePic
()
//set contact name
nameLbl
.
text
=
"
\(
contact
!.
givenName
)
\(
contact
!.
familyName
)
"
//get contact's incoming data
setContactProfileAttributes
()
//set tableView handlers to this instance
contactPhoneNumbersTable
.
dataSource
=
self
contactPhoneNumbersTable
.
delegate
=
self
}
func
setContactProfileAttributes
(){
var
phoneNumbers
:[
String
]
=
[]
var
emailAddressList
:[
String
]
=
[]
//get phone numbers
contact
!.
phoneNumbers
.
forEach
(
{
phoneNumber
in
phoneNumbers
.
append
(
phoneNumber
.
value
.
stringValue
)
})
//get emails
contact
!.
emailAddresses
.
forEach
({
emailAddress
in
emailAddressList
.
append
(
emailAddress
.
value
as
String
)
})
//append to contact's attributes
contactProfileData
=
ContactProfile
(
phonNumbersList
:
phoneNumbers
,
emailAdressList
:
emailAddressList
)
}
func
setProfilePic
(){
if
contact
!.
imageDataAvailable
{
print
(
"imagen disponible"
)
if
let
image
=
UIImage
.
init
(
data
:
contact
!.
imageData
!
)
{
profilePic
.
image
=
image
profilePic
.
layer
.
cornerRadius
=
profilePic
.
frame
.
width
/
2
}
}
else
{
print
(
"no image data available"
)
}
}
}
extension
ContactProfileVC
:
UITableViewDelegate
,
UITableViewDataSource
{
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
indexPath
.
section
==
0
{
//phones
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"contactPhoneNumberCell"
)
as!
PhoneNumberCell
cell
.
phoneNumberLbl
.
text
=
contactProfileData
!.
phonNumbersList
[
indexPath
.
row
]
return
cell
}
else
{
//emails
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"emailAddressCellID"
)
as!
EmailAddressCell
cell
.
emailAddressLbl
.
text
=
contactProfileData
!.
emailAdressList
[
indexPath
.
row
]
return
cell
}
}
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
2
}
func
tableView
(
_
tableView
:
UITableView
,
titleForHeaderInSection
section
:
Int
)
->
String
?
{
if
section
==
0
{
return
"Phones"
}
else
{
return
"Emails"
}
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
section
==
0
{
return
contactProfileData
!.
phonNumbersList
.
count
}
else
{
return
contactProfileData
!.
emailAdressList
.
count
}
}
}
contact-list-app/Info.plist
View file @
73d919d6
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
d
i
c
t
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)
photo
use
<
/string
>
<
k
e
y
>
NSContactsUsageDescription
<
/k
e
y
>
<
string
>
$
(
PRODUCT_NAME
)
contact
use
<
/string
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
$
(
DEVELOPMENT_LANGUAGE
)<
/string
>
<
string
>
$
(
DEVELOPMENT_LANGUAGE
)<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
...
...
contact-list-app/ViewController.swift
View file @
73d919d6
//
// ViewController.swift
// contact-list-app
//
// Created by Mobile Roshka on 3/12/20.
// Copyright © 2020 Mobile Roshka. All rights reserved.
//
import
UIKit
import
UIKit
import
Contacts
struct
ContactList
{
var
firstLetter
:
String
var
contactList
:[
CNContact
]
var
backUpContacts
:[
CNContact
]
=
[]
var
isHidden
=
false
}
class
ContactCell
:
UITableViewCell
{
@IBOutlet
weak
var
nameLbl
:
UILabel
!
@IBOutlet
weak
var
profilePic
:
UIImageView
!
}
class
ViewController
:
UIViewController
{
class
ViewController
:
UIViewController
{
let
contactStore
=
CNContactStore
()
var
contacts
=
[
CNContact
]()
var
dataSource
:[
ContactList
]?
=
[]
var
backUpContacts
:[
CNContact
]
=
[]
var
isHidden
=
false
@IBOutlet
weak
var
contacsTable
:
UITableView
!
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
// Do any additional setup after loading the view.
//call the main functions
main
()
}
}
func
main
(){
//get contacts from device
getAllContacts
()
//sort in alphabetical order
sortContacts
()
//set tableView handlers to this instance
contacsTable
.
dataSource
=
self
contacsTable
.
delegate
=
self
}
func
sortContacts
(){
var
pivot
=
contacts
[
0
]
.
givenName
.
prefix
(
1
)
//first letter from first contact
var
temp
:
[
CNContact
]
=
[]
//temp array to storage contacts
for
i
in
(
0
...
contacts
.
count
-
2
){
if
pivot
==
contacts
[
i
+
1
]
.
givenName
.
prefix
(
1
){
temp
.
append
(
contacts
[
i
])
}
else
{
temp
.
append
(
contacts
[
i
])
dataSource
!.
append
(
ContactList
(
firstLetter
:
String
(
pivot
),
contactList
:
temp
))
pivot
=
contacts
[
i
+
1
]
.
givenName
.
prefix
(
1
)
temp
=
[]
}
}
//ask for the last contact
if
contacts
[
contacts
.
count
-
1
]
.
givenName
.
prefix
(
1
)
==
dataSource
!
[
dataSource
!.
count
-
1
]
.
firstLetter
{
//last group
dataSource
!
[
dataSource
!.
count
-
1
]
.
contactList
.
append
(
contacts
[
contacts
.
count
-
1
])
}
else
{
//new group
dataSource
!.
append
(
ContactList
(
firstLetter
:
String
(
pivot
),
contactList
:
[
contacts
[
contacts
.
count
-
1
]]))
}
}
func
getAllContacts
(){
//keys
let
keys
=
[
CNContactGivenNameKey
,
CNContactFamilyNameKey
,
CNContactImageDataKey
,
CNContactImageDataAvailableKey
,
CNContactPhoneNumbersKey
,
CNContactEmailAddressesKey
]
as
[
CNKeyDescriptor
]
//request
let
request
=
CNContactFetchRequest
(
keysToFetch
:
keys
)
request
.
sortOrder
=
.
givenName
do
{
try
self
.
contactStore
.
enumerateContacts
(
with
:
request
)
{
(
contact
,
stop
)
in
// Array containing all unified contacts from everywhere
self
.
contacts
.
append
(
contact
)
print
(
"success"
)
}
}
catch
{
print
(
"unable to fetch contacts"
)
}
}
@objc
func
foldContacts
(
_
sender
:
UIButton
)
->
Void
{
if
let
section
=
sender
.
tag
as?
Int
{
if
dataSource
!
[
section
]
.
isHidden
{
//show contacts
dataSource
!
[
section
]
.
contactList
=
dataSource
!
[
section
]
.
backUpContacts
dataSource
!
[
section
]
.
isHidden
=
false
}
else
{
//hide contacts
dataSource
!
[
section
]
.
backUpContacts
=
dataSource
!
[
section
]
.
contactList
dataSource
!
[
section
]
.
contactList
=
[]
dataSource
!
[
section
]
.
isHidden
=
true
}
}
//reload table view
contacsTable
.
reloadData
()
}
}
}
extension
ViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
dataSource
!.
count
}
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
return
dataSource
!
[
section
]
.
contactList
.
count
}
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"contactCell"
,
for
:
indexPath
)
as!
ContactCell
cell
.
nameLbl
.
text
=
"
\(
dataSource
!
[
indexPath
.
section
]
.
contactList
[
indexPath
.
row
]
.
givenName
)
\(
dataSource
!
[
indexPath
.
section
]
.
contactList
[
indexPath
.
row
]
.
familyName
)
"
if
dataSource
!
[
indexPath
.
section
]
.
contactList
[
indexPath
.
row
]
.
imageDataAvailable
{
if
let
image
=
UIImage
.
init
(
data
:
dataSource
!
[
indexPath
.
section
]
.
contactList
[
indexPath
.
row
]
.
imageData
!
)
{
cell
.
profilePic
.
image
=
image
cell
.
profilePic
.
layer
.
cornerRadius
=
cell
.
profilePic
.
frame
.
width
/
2
}
}
else
{
//poner icono por defecto
cell
.
profilePic
.
image
=
UIImage
(
systemName
:
"person.fill"
)
}
return
cell
}
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
let
headerView
=
UIView
.
init
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
tableView
.
frame
.
width
,
height
:
200
))
headerView
.
backgroundColor
=
UIColor
.
link
//label
let
label
=
UILabel
()
label
.
frame
=
CGRect
.
init
(
x
:
30
,
y
:
10
,
width
:
headerView
.
frame
.
width
-
10
,
height
:
25
)
label
.
textColor
=
UIColor
.
white
label
.
text
=
dataSource
!
[
section
]
.
firstLetter
label
.
font
=
UIFont
.
boldSystemFont
(
ofSize
:
16.0
)
//button
let
foldButton
=
UIButton
()
foldButton
.
frame
=
CGRect
(
x
:
headerView
.
frame
.
width
-
80
,
y
:
10
,
width
:
30
,
height
:
30
)
foldButton
.
backgroundColor
=
UIColor
.
white
foldButton
.
setTitle
(
"+"
,
for
:
.
normal
)
foldButton
.
layer
.
cornerRadius
=
foldButton
.
frame
.
width
/
2
foldButton
.
tag
=
section
foldButton
.
addTarget
(
self
,
action
:
#selector(
foldContacts(_ :)
)
,
for
:
.
touchUpInside
)
//add subview to container
headerView
.
addSubview
(
label
)
headerView
.
addSubview
(
foldButton
)
return
headerView
}
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
return
50
}
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
return
60
}
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
let
contacProfileVC
=
self
.
storyboard
?
.
instantiateViewController
(
withIdentifier
:
"contactProfileID"
)
as!
ContactProfileVC
contacProfileVC
.
contact
=
dataSource
!
[
indexPath
.
section
]
.
contactList
[
indexPath
.
row
]
show
(
contacProfileVC
,
sender
:
nil
)
}
}
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