Skip to content

Commit

Permalink
adad
Browse files Browse the repository at this point in the history
  • Loading branch information
vanthanhtran245 committed Sep 7, 2018
1 parent c276eed commit f6e9947
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 32 deletions.
32 changes: 16 additions & 16 deletions SmartContact/SmartContact.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
6A29BB36213EBC02006CAC91 /* FavoriteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A29BB35213EBC02006CAC91 /* FavoriteViewController.swift */; };
6A29BB38213EC3ED006CAC91 /* FavoriteHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A29BB37213EC3ED006CAC91 /* FavoriteHelper.swift */; };
6A8EC11921398FF000C08E23 /* ContactEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A8EC11821398FF000C08E23 /* ContactEntry.swift */; };
6AB0C1ED21416E1500FC6D81 /* GroupHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AB0C1EB21416E1500FC6D81 /* GroupHeaderView.swift */; };
6AB0C1EE21416E1500FC6D81 /* GroupHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6AB0C1EC21416E1500FC6D81 /* GroupHeaderView.xib */; };
6AB0C1F121416EF600FC6D81 /* NoContactCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AB0C1EF21416EF600FC6D81 /* NoContactCell.swift */; };
6AB0C1F221416EF600FC6D81 /* NoContactCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6AB0C1F021416EF600FC6D81 /* NoContactCell.xib */; };
A50163B0214207A0007C9AC7 /* NoContactCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50163AC21420794007C9AC7 /* NoContactCell.swift */; };
A50163B1214207A0007C9AC7 /* GroupHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50163AD2142079F007C9AC7 /* GroupHeaderView.swift */; };
A50163B2214207A0007C9AC7 /* GroupHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A50163AE2142079F007C9AC7 /* GroupHeaderView.xib */; };
A50163B3214207A0007C9AC7 /* NoContactCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A50163AF214207A0007C9AC7 /* NoContactCell.xib */; };
A507A5782140B055001D0D59 /* ContactsPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A507A5712140B055001D0D59 /* ContactsPickerViewController.swift */; };
A507A5792140B055001D0D59 /* Contacts.swift in Sources */ = {isa = PBXBuildFile; fileRef = A507A5732140B055001D0D59 /* Contacts.swift */; };
A507A57E2140B147001D0D59 /* Common+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A507A57C2140B147001D0D59 /* Common+Extensions.swift */; };
Expand Down Expand Up @@ -92,10 +92,10 @@
6A29BB35213EBC02006CAC91 /* FavoriteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteViewController.swift; sourceTree = "<group>"; };
6A29BB37213EC3ED006CAC91 /* FavoriteHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteHelper.swift; sourceTree = "<group>"; };
6A8EC11821398FF000C08E23 /* ContactEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactEntry.swift; sourceTree = "<group>"; };
6AB0C1EB21416E1500FC6D81 /* GroupHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupHeaderView.swift; sourceTree = "<group>"; };
6AB0C1EC21416E1500FC6D81 /* GroupHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GroupHeaderView.xib; sourceTree = "<group>"; };
6AB0C1EF21416EF600FC6D81 /* NoContactCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoContactCell.swift; sourceTree = "<group>"; };
6AB0C1F021416EF600FC6D81 /* NoContactCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoContactCell.xib; sourceTree = "<group>"; };
A50163AC21420794007C9AC7 /* NoContactCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NoContactCell.swift; sourceTree = "<group>"; };
A50163AD2142079F007C9AC7 /* GroupHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupHeaderView.swift; sourceTree = "<group>"; };
A50163AE2142079F007C9AC7 /* GroupHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GroupHeaderView.xib; sourceTree = "<group>"; };
A50163AF214207A0007C9AC7 /* NoContactCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NoContactCell.xib; sourceTree = "<group>"; };
A507A5712140B055001D0D59 /* ContactsPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsPickerViewController.swift; sourceTree = "<group>"; };
A507A5732140B055001D0D59 /* Contacts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Contacts.swift; sourceTree = "<group>"; };
A507A57C2140B147001D0D59 /* Common+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Common+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -190,11 +190,11 @@
6A8EC11421398E3C00C08E23 /* View */ = {
isa = PBXGroup;
children = (
A50163AD2142079F007C9AC7 /* GroupHeaderView.swift */,
A50163AE2142079F007C9AC7 /* GroupHeaderView.xib */,
A50163AC21420794007C9AC7 /* NoContactCell.swift */,
A50163AF214207A0007C9AC7 /* NoContactCell.xib */,
A5F45E30213E5A5F000FEDC0 /* JFContactCell.xib */,
6AB0C1EB21416E1500FC6D81 /* GroupHeaderView.swift */,
6AB0C1EC21416E1500FC6D81 /* GroupHeaderView.xib */,
6AB0C1EF21416EF600FC6D81 /* NoContactCell.swift */,
6AB0C1F021416EF600FC6D81 /* NoContactCell.xib */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -476,9 +476,9 @@
6A1D7ED421391BC000C76FDD /* Cartfile in Resources */,
A5F45E5D213FC33F000FEDC0 /* SampleView.xib in Resources */,
6A1D7ED521391BC000C76FDD /* Cartfile.resolved in Resources */,
6AB0C1EE21416E1500FC6D81 /* GroupHeaderView.xib in Resources */,
A50163B2214207A0007C9AC7 /* GroupHeaderView.xib in Resources */,
A53B51772137ECF100DE670E /* Main.storyboard in Resources */,
6AB0C1F221416EF600FC6D81 /* NoContactCell.xib in Resources */,
A50163B3214207A0007C9AC7 /* NoContactCell.xib in Resources */,
A5F45E31213E5A5F000FEDC0 /* JFContactCell.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -534,7 +534,9 @@
A5F45E2B213E5A3E000FEDC0 /* MainContact.swift in Sources */,
A507A5852140B20D001D0D59 /* UIViewController.swift in Sources */,
A53B51742137ECF100DE670E /* SecondViewController.swift in Sources */,
A50163B1214207A0007C9AC7 /* GroupHeaderView.swift in Sources */,
A507A57E2140B147001D0D59 /* Common+Extensions.swift in Sources */,
A50163B0214207A0007C9AC7 /* NoContactCell.swift in Sources */,
6A8EC11921398FF000C08E23 /* ContactEntry.swift in Sources */,
A5F45E2E213E5A3E000FEDC0 /* Contact.swift in Sources */,
A5F45E2F213E5A3E000FEDC0 /* Extensions.swift in Sources */,
Expand All @@ -544,15 +546,13 @@
A5F45E36213E8E46000FEDC0 /* SwipeHelper.swift in Sources */,
6A29BB38213EC3ED006CAC91 /* FavoriteHelper.swift in Sources */,
A53B51702137ECF100DE670E /* AppDelegate.swift in Sources */,
6AB0C1F121416EF600FC6D81 /* NoContactCell.swift in Sources */,
A5F45E65213FC7F9000FEDC0 /* UINavigationController.swift in Sources */,
A5F45E5C213FC33F000FEDC0 /* SampleView.swift in Sources */,
6A29BB30213EB34A006CAC91 /* GroupContactViewController.swift in Sources */,
A507A5832140B1C5001D0D59 /* UIAlertController+Extensions.swift in Sources */,
A5F45E42213FBAFF000FEDC0 /* SettingsViewController.swift in Sources */,
A507A5892140B427001D0D59 /* ContactPickerCell.swift in Sources */,
A507A5782140B055001D0D59 /* ContactsPickerViewController.swift in Sources */,
6AB0C1ED21416E1500FC6D81 /* GroupHeaderView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
<attribute name="firstName" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="lastName" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<entity name="Group" representedClassName="Group" syncable="YES" codeGenerationType="class">
<attribute name="cnContact" optional="YES" attributeType="Transformable" syncable="YES"/>
<attribute name="groupName" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<elements>
<element name="Favorite" positionX="-63" positionY="-18" width="128" height="150"/>
<element name="Group" positionX="-63" positionY="36" width="128" height="75"/>
</elements>
</model>
14 changes: 3 additions & 11 deletions SmartContact/SmartContact/View/GroupHeaderView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(Title) (Title) (Title) (Title)" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x4s-JC-SVc">
<rect key="frame" x="16" y="0.0" width="273" height="50"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" red="0.1333333333" green="0.1333333333" blue="0.1333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<accessibility key="accessibilityConfiguration" identifier="highlights_header"/>

<constraints>
<constraint firstItem="wwi-dw-Scp" firstAttribute="centerY" secondItem="nUt-jB-2bG" secondAttribute="centerY" id="0wc-oz-x0r"/>
<constraint firstItem="wwi-dw-Scp" firstAttribute="centerY" secondItem="x4s-JC-SVc" secondAttribute="centerY" id="1Uo-Zy-3fv"/>
<constraint firstItem="x4s-JC-SVc" firstAttribute="centerY" secondItem="nUt-jB-2bG" secondAttribute="centerY" id="Be5-Ww-ZK9"/>
<constraint firstAttribute="bottom" secondItem="x4s-JC-SVc" secondAttribute="bottom" id="M9w-hr-29w"/>
<constraint firstItem="x4s-JC-SVc" firstAttribute="leading" secondItem="nUt-jB-2bG" secondAttribute="leading" constant="16" id="RQY-6l-ESC"/>
<constraint firstItem="x4s-JC-SVc" firstAttribute="top" secondItem="nUt-jB-2bG" secondAttribute="top" id="Y5j-Wv-uDO"/>
Expand All @@ -50,12 +48,6 @@
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="thx-wQ-HkE"/>
<variation key="default">
<mask key="constraints">
<exclude reference="Be5-Ww-ZK9"/>
<exclude reference="0wc-oz-x0r"/>
</mask>
</variation>
<connections>
<outlet property="actionButton" destination="wwi-dw-Scp" id="QD1-ay-MMj"/>
<outlet property="titleLabel" destination="x4s-JC-SVc" id="uX6-sh-Nod"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class GroupContactViewController: BaseViewController {
print("Error \(error)")
}
}


}

func groupsSuccess(groups: [CNGroup]) {
Expand All @@ -51,9 +49,9 @@ class GroupContactViewController: BaseViewController {
}
self.contacts.updateValue(temps, forKey: group.name)
}
self.disPlayEmptyView(isShow: self.contacts.keys.count == 0)
self.tableView.reloadData()
}
disPlayEmptyView(isShow: contacts.keys.count == 0)
tableView.reloadData()
}
}

Expand Down Expand Up @@ -118,8 +116,9 @@ extension GroupContactViewController: UITableViewDelegate, UITableViewDataSource
let allContacts = receivedContacts.compactMap({
return Contact(contact: $0)
})
let allValues = contactInSections + allContacts
self.addContactToGroups(group: self.groups[section], contacts: allContacts, {
self.contacts.updateValue(allContacts, forKey: name)
self.contacts.updateValue(allValues, forKey: name)
let indexSet = IndexSet.init(integer: section)
self.tableView.reloadSections(indexSet, with: .fade)
self.disPlayEmptyView(isShow: self.contacts.keys.count == 0)
Expand Down

0 comments on commit f6e9947

Please sign in to comment.