-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataFile.swift
More file actions
86 lines (77 loc) · 2.46 KB
/
DataFile.swift
File metadata and controls
86 lines (77 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// DataFile.swift
// AddrManager
//
// Created by Martini Wang on 14/10/18.
// Copyright (c) 2014年 Martini Wang. All rights reserved.
//
import UIKit
import CoreData
var today:Date = Date()
//登录状态
var userLogin:Bool = true
//allProfiles[index].addContactInGroup(allProfiles[indexPath.section].removeContactAtIndex(indexPath.row)!)
/*
var myProfile:Profile = Profile(name: "测试员", address: myAddress)
var anyProfile:Profile = Profile(name: "测试员1", address: Address(fullAddress: "山东省青岛市崂山区松岭路238号中国海洋大学崂山校区"))
var myAddress:Address = Address(fullAddress: "山东省青岛市崂山区松岭路238号中国海洋大学崂山校区")
var myAddressAuthorizationList:[AddrAuthorization] = [AddrAuthorization(user: myProfile, limitPeriod: authorizationPeriod.forrver), AddrAuthorization(user: anyProfile, limitPeriod: authorizationPeriod.oneMonth)]
*/
// 0: Marked, 1: Default
//var allProfiles:[ContactsGroup] = [ContactsGroup(contacts: [myProfile,anyProfile], groupName: "Marked"),ContactsGroup(contacts: [Profile](), groupName: "Default")]
/*
func countNotEmptyContactsGroups (groups:[ContactsGroup]?) -> Int {
return (groupsIsNotEmpty(groups) ?? [ContactsGroup]())!.count
}
func groupsIsNotEmpty(groups:[ContactsGroup]?) -> [ContactsGroup]? {
var tmpGroup:Array = [ContactsGroup]()
if groups == nil {
return nil
}else{
for g in groups! {
if !g.isEmpty() {
tmpGroup.append(g)
}
}
}
return tmpGroup.count == 0 ? nil : tmpGroup
}
*/
/*
// 生成更新联系人时索引数组
func buildContactUpdateIndexArray(indexPaths:[NSIndexPath]?) -> [[Int]] {
var contactsToUpdate = [[Int]]()
if indexPaths == nil {
for i in 0 ..< loadContactsGroups().count {
for j in 0 ..< loadContactsGroups()[i].count() {
contactsToUpdate.append([i,j])
}
}
}else{
for indexPath in indexPaths! {
contactsToUpdate.append([indexPath.section,indexPath.row])
}
}
return contactsToUpdate
}
*/
/*
func buildUpdateProfileArray(updateIndex:[[Int]]) -> [Profile] {
var tmpArray = [Profile]()
for key in updateIndex {
tmpArray.append(contactsGroups[key[0]].contactsArray()[key[1]])
}
return tmpArray
}
*/
//import CoreData
/*
// 测试代码
func test (textField:UITextField, str1:String, str2:String?) {
if (str2 != nil) {
textField.text = str1 + "\(allProfiles.count * 10)" + str2!
}else{
textField.text = str1 + "\(allProfiles.count)"
}
}
*/