on bd01268 help sign in
Melk.xcodeproj/project.pbxproj+1−1
since splitsnapshots
unifiedsplit
@@ -133,7 +133,6 @@
133 children = (
133 children = (
134 09BF420F1F0833C100AFAD57 /* MainCoordinator.swift */,
134 09BF420F1F0833C100AFAD57 /* MainCoordinator.swift */,
135 09BF42551F08413000AFAD57 /* MainViewController.swift */,
135 09BF42551F08413000AFAD57 /* MainViewController.swift */,
136− 09939A551F097DA90014719D /* TableViewCells.swift */,
137 );
136 );
138 name = Main;
137 name = Main;
139 sourceTree = "<group>";
138 sourceTree = "<group>";
@@ -193,6 +192,7 @@
193 09BF42111F08341B00AFAD57 /* MyWeirdness.swift */,
192 09BF42111F08341B00AFAD57 /* MyWeirdness.swift */,
194 09BF42121F08341B00AFAD57 /* PublicCrap.swift */,
193 09BF42121F08341B00AFAD57 /* PublicCrap.swift */,
195 09F03F351F1674ED000CE916 /* VKServer.swift */,
194 09F03F351F1674ED000CE916 /* VKServer.swift */,
195+ 09939A551F097DA90014719D /* TableViewCells.swift */,
196 09BF420D1F0833A700AFAD57 /* LocalVKDataTypes.swift */,
196 09BF420D1F0833A700AFAD57 /* LocalVKDataTypes.swift */,
197 09BF42151F0834D400AFAD57 /* VKPublicCrap.swift */,
197 09BF42151F0834D400AFAD57 /* VKPublicCrap.swift */,
198 09BF42171F08352E00AFAD57 /* VKData.swift */,
198 09BF42171F08352E00AFAD57 /* VKData.swift */,
Melk.xcodeproj/xcuserdata/ilya.xcuserdatad/xcschemes/Melk.xcscheme+3−3
@@ -42,9 +42,9 @@
42 </AdditionalOptions>
42 </AdditionalOptions>
43 </TestAction>
43 </TestAction>
44 <LaunchAction
44 <LaunchAction
45− buildConfiguration = "Release"
45+ buildConfiguration = "Debug"
46− selectedDebuggerIdentifier = ""
46+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47− selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
47+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48 launchStyle = "0"
48 launchStyle = "0"
49 useCustomWorkingDirectory = "NO"
49 useCustomWorkingDirectory = "NO"
50 ignoresPersistentStateOnLaunch = "NO"
50 ignoresPersistentStateOnLaunch = "NO"
Melk/CardView.swift+10−45
@@ -18,12 +18,12 @@ class CardView: UIView {
18 }
18 }
19 var minWidth: CGFloat = 300 {
19 var minWidth: CGFloat = 300 {
20 didSet {
20 didSet {
21−// update()
21+ update()
22 }
22 }
23 }
23 }
24 var height: CGFloat = 400 {
24 var height: CGFloat = 400 {
25 didSet {
25 didSet {
26−// update()
26+ update()
27 }
27 }
28 }
28 }
29
29
@@ -31,32 +31,17 @@ class CardView: UIView {
31 super.init(frame: frame)
31 super.init(frame: frame)
32 layer.masksToBounds = true
32 layer.masksToBounds = true
33 layer.cornerRadius = 20
33 layer.cornerRadius = 20
34− gradient.colors = [#colorLiteral(red: 0.9841352105, green: 0.9841352105, blue: 0.9841352105, alpha: 1).cgColor, #colorLiteral(red: 0.9456828237, green: 0.9456828237, blue: 0.9456828237, alpha: 1).cgColor]
35− gradient.startPoint = CGPoint(x: 0.5, y: 0)
36− gradient.endPoint = CGPoint(x: 0.5, y: 1)
37− layer.addSublayer(gradient)
38−// backgroundColor = #colorLiteral(red: 0.9638966278, green: 0.9734401588, blue: 0.9734401588, alpha: 1)
34+ backgroundColor = #colorLiteral(red: 0.9638966278, green: 0.9734401588, blue: 0.9734401588, alpha: 1)
39 }
35 }
40
36
41 required init?(coder aDecoder: NSCoder) {
37 required init?(coder aDecoder: NSCoder) {
42 fatalError("init(coder:) has not been implemented")
38 fatalError("init(coder:) has not been implemented")
43 }
39 }
44−
45− private let gradient = CAGradientLayer()
46−
47
40
48 private let padding = CGPoint(x: 32, y: 32)
41 private let padding = CGPoint(x: 32, y: 32)
49 private let vPadding1: CGFloat = 16
42 private let vPadding1: CGFloat = 16
50 private let vPadding2: CGFloat = 16
43 private let vPadding2: CGFloat = 16
51− private var minTextHeight: CGFloat {
44+ private let minTextHeight: CGFloat = 50
52− return CGFloat(height * 0.2)
53− }
54− private let gradientRatio: CGFloat = 0.2
55− private let minGradientAmount: CGFloat = 70
56− private let hiddenByGradient: CGFloat = 10
57− private var maxAttachmentDim: CGFloat {
58− return minWidth / 2.3
59− }
60
45
61// private let avatar = UIImage()
46// private let avatar = UIImage()
62// private let name = UIImage()
47// private let name = UIImage()
@@ -69,9 +54,10 @@ class CardView: UIView {
69 addSubview(largeStack)
54 addSubview(largeStack)
70
55
71 let userView = StackView(axis: .horizontal, alignment: .center)
56 let userView = StackView(axis: .horizontal, alignment: .center)
57+// userView.backgroundColor = #colorLiteral(red: 0.5568627715, green: 0.3529411852, blue: 0.9686274529, alpha: 1)
72
58
73
59
74− let avatarDim: CGFloat = 64
60+ let avatarDim: CGFloat = 50
75 let avatar = UIImageView()
61 let avatar = UIImageView()
76 post?.owner?.avatar?.load(into: avatar)
62 post?.owner?.avatar?.load(into: avatar)
77 avatar.layer.cornerRadius = avatarDim/2
63 avatar.layer.cornerRadius = avatarDim/2
@@ -88,7 +74,6 @@ class CardView: UIView {
88 let lastName = post?.owner?.lastName ?? ""
74 let lastName = post?.owner?.lastName ?? ""
89 userName.text = "\(firstName) \(lastName)"
75 userName.text = "\(firstName) \(lastName)"
90 userName.font = UIFont.systemFont(ofSize: 28, weight: UIFontWeightHeavy)
76 userName.font = UIFont.systemFont(ofSize: 28, weight: UIFontWeightHeavy)
91− userName.textColor = UIColor.darkText
92 userName.sizeToFit()
77 userName.sizeToFit()
93 userView.addArrangedSubview(.view(userName))
78 userView.addArrangedSubview(.view(userName))
94
79
@@ -108,7 +93,7 @@ class CardView: UIView {
108 photoView.verticalPadding = 8
93 photoView.verticalPadding = 8
109 photoView.padding = CGPoint.zero
94 photoView.padding = CGPoint.zero
110 photoView.maxWidth = width
95 photoView.maxWidth = width
111− var maxPhotoDim: CGFloat = maxAttachmentDim
96+ var maxPhotoDim: CGFloat = 150
112 if let attachments = post?.attachments {
97 if let attachments = post?.attachments {
113 for attachment in attachments {
98 for attachment in attachments {
114 if let v = attachment.value {
99 if let v = attachment.value {
@@ -118,7 +103,6 @@ class CardView: UIView {
118 var pHeight = photo.height.value >>> {CGFloat($0)} {
103 var pHeight = photo.height.value >>> {CGFloat($0)} {
119 let photoV = UIImageView()
104 let photoV = UIImageView()
120 photoV.layer.minificationFilter = kCAFilterTrilinear
105 photoV.layer.minificationFilter = kCAFilterTrilinear
121− photoV.contentMode = .scaleAspectFill
122 photo.image?.load(into: photoV)
106 photo.image?.load(into: photoV)
123 var k: CGFloat!
107 var k: CGFloat!
124 if pWidth > pHeight {
108 if pWidth > pHeight {
@@ -141,10 +125,10 @@ class CardView: UIView {
141 photoView.layoutIfNeeded()
125 photoView.layoutIfNeeded()
142
126
143 var textHeight = height
127 var textHeight = height
144− textHeight -= padding.y * 2 + vPadding1 + userView.frame.height
128+ textHeight -= padding.y + vPadding1 + userView.frame.height
145 if let count = post?.attachments.count{
129 if let count = post?.attachments.count{
146 if count > 0 {
130 if count > 0 {
147− textHeight -= vPadding2 + photoView.frame.height
131+ textHeight -= vPadding2 + photoView.frame.height + padding.y
148 }
132 }
149 }
133 }
150 print(textHeight)
134 print(textHeight)
@@ -156,25 +140,9 @@ class CardView: UIView {
156 let bodyWidth: Double = Double(width)
140 let bodyWidth: Double = Double(width)
157 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
141 body.font = UIFont.systemFont(ofSize: 22, weight: UIFontWeightSemibold)
158 body.text = post?.body
142 body.text = post?.body
159− body.textColor = UIColor.darkText
160 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
143 let size = body.textRect(forBounds: CGRect(x: 0, y: 0, width: bodyWidth, height: Double.infinity), limitedToNumberOfLines: 0).size
144+ body.frame.size.height = min(size.height, textHeight)
161 body.frame.size.width = size.width
145 body.frame.size.width = size.width
162− if size.height > textHeight {
163− body.frame.size.height = textHeight
164− let maskView = UIView()
165− let maskLayer = CAGradientLayer()
166− maskLayer.colors = [UIColor.black.cgColor, UIColor.clear.cgColor]
167− maskLayer.endPoint = CGPoint(x: 0.5, y: 1 - (hiddenByGradient/textHeight))
168− let minPoint = minGradientAmount / textHeight
169− maskLayer.startPoint = CGPoint(x: 0.5, y: 1 - max(minPoint, gradientRatio))
170− print(maskLayer.startPoint)
171− maskLayer.frame = body.bounds
172− maskView.frame = body.bounds
173− maskView.layer.addSublayer(maskLayer)
174− body.mask = maskView
175− } else {
176− body.frame.size.height = size.height
177− }
178
146
179 largeStack.addArrangedSubview(.view(body))
147 largeStack.addArrangedSubview(.view(body))
180
148
@@ -189,8 +157,5 @@ class CardView: UIView {
189
157
190 frame.size = CGSize(width: width + padding.x * 2, height: min(height, largeStack.frame.height))
158 frame.size = CGSize(width: width + padding.x * 2, height: min(height, largeStack.frame.height))
191
159
192− gradient.frame = self.bounds
193− gradient.endPoint = CGPoint(x: 0.5, y: bounds.height / height)
194−
195 }
160 }
196}
161}
Melk/MainCoordinator.swift+2−8
@@ -27,14 +27,6 @@ class MainCoordinator {
27 deleteRealmIfMigrationNeeded: true)
27 deleteRealmIfMigrationNeeded: true)
28
28
29 navC = UINavigationController(rootViewController: mainVC)
29 navC = UINavigationController(rootViewController: mainVC)
30−
31− mainVC.present = { tags in
32− if tags.count > 0 {
33− self.secondaryCoord.present(tag: tags.first!)
34− self.stream.rules = tags
35− self.stream.connect()
36− }
37− }
38 updateScreens()
30 updateScreens()
39 stream.handleResult = { result in
31 stream.handleResult = { result in
40 self.secondaryCoord.add(result: result)
32 self.secondaryCoord.add(result: result)
@@ -52,6 +44,8 @@ class MainCoordinator {
52// }
44// }
53 print("didAuthorize")
45 print("didAuthorize")
54 window.rootViewController = navC
46 window.rootViewController = navC
47+ stream.rules = ["я", "а", "и"]
48+ stream.connect()
55 }
49 }
56
50
57 func updateScreens() {
51 func updateScreens() {
Melk/MainViewController.swift+2−22
@@ -29,9 +29,7 @@ class MainViewController: UIViewController {
29 }
29 }
30
30
31 @objc private func presentTags() {
31 @objc private func presentTags() {
32− present?(
32+
33− mainView.tags.flatMap({$0}).filter({$0 != ""})
34− )
35 }
33 }
36}
34}
37
35
@@ -47,8 +45,6 @@ class MainView: UIView {
47 tableView.rowHeight = UITableViewAutomaticDimension
45 tableView.rowHeight = UITableViewAutomaticDimension
48 tableView.register(TitleTableViewCell.self, forCellReuseIdentifier: TitleTableViewCell.identifier)
46 tableView.register(TitleTableViewCell.self, forCellReuseIdentifier: TitleTableViewCell.identifier)
49 tableView.register(TagTableViewCell.self, forCellReuseIdentifier: TagTableViewCell.identifier)
47 tableView.register(TagTableViewCell.self, forCellReuseIdentifier: TagTableViewCell.identifier)
50− tableView.separatorStyle = .none
51− tableView.allowsSelection = false
52 setNeedsLayout()
48 setNeedsLayout()
53 }
49 }
54
50
@@ -56,17 +52,6 @@ class MainView: UIView {
56 tableView.frame = bounds
52 tableView.frame = bounds
57 }
53 }
58
54
59− fileprivate var tags: [String?] = [nil] {
60− didSet {
61− if tags.last! != nil && tags.last! != "" {
62− if tags.count < 10 {
63− tags.append(nil)
64− tableView.insertRows(at: [IndexPath.init(row: tags.count - 1, section: 0)], with: .automatic)
65− }
66− }
67− }
68− }
69−
70 required init?(coder aDecoder: NSCoder) {
55 required init?(coder aDecoder: NSCoder) {
71 fatalError("init(coder:) has not been implemented")
56 fatalError("init(coder:) has not been implemented")
72 }
57 }
@@ -77,18 +62,13 @@ extension MainView: UITableViewDataSource {
77 if let cell = tableView.dequeueReusableCell(withIdentifier: TagTableViewCell.identifier) as? TagTableViewCell {
62 if let cell = tableView.dequeueReusableCell(withIdentifier: TagTableViewCell.identifier) as? TagTableViewCell {
78// cell.titleText = "Testing testing 1 2 3"
63// cell.titleText = "Testing testing 1 2 3"
79 cell.style = indexPath.item == 0 ? .large : .normal
64 cell.style = indexPath.item == 0 ? .large : .normal
80− let index = indexPath.row
81− cell.tagDidChange = { tag in
82− self.tags[index] = tag
83− }
84− cell.tagString = tags[index]
85 return cell
65 return cell
86 }
66 }
87 return UITableViewCell()
67 return UITableViewCell()
88 }
68 }
89
69
90 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
70 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
91− return tags.count
71+ return 3
92 }
72 }
93
73
94 func numberOfSections(in tableView: UITableView) -> Int {
74 func numberOfSections(in tableView: UITableView) -> Int {
Melk/SecondaryCoordinator.swift−12
@@ -12,21 +12,12 @@ class SecondaryCoordinator {
12
12
13 var windows: [UIWindow] = []
13 var windows: [UIWindow] = []
14
14
15− private var didStartPresenting = false
16− private var tag: String = ""
17−
18 func add(result: StreamingServiceResult) {
15 func add(result: StreamingServiceResult) {
19 for vc in VCs {
16 for vc in VCs {
20 vc.add(result: result)
17 vc.add(result: result)
21 }
18 }
22 }
19 }
23
20
24− func present(tag newTag: String) {
25− didStartPresenting = true
26− self.tag = newTag
27− VCs.map({ $0.present(tag: newTag) })
28− }
29−
30 init() {
21 init() {
31
22
32 }
23 }
@@ -45,9 +36,6 @@ class SecondaryCoordinator {
45 VCs.append(VC)
36 VCs.append(VC)
46 window.rootViewController = VC
37 window.rootViewController = VC
47 windows.append(window)
38 windows.append(window)
48− if didStartPresenting {
49− VC.present(tag: tag)
50− }
51 }
39 }
52 }
40 }
53}
41}
Melk/SecondaryViewController.swift+4−53
@@ -19,10 +19,6 @@ class SecondaryViewController: UIViewController {
19 sView.add(result: result)
19 sView.add(result: result)
20 }
20 }
21
21
22− func present(tag: String) {
23− sView.present(tag: tag)
24− }
25−
26 required init?(coder aDecoder: NSCoder) {
22 required init?(coder aDecoder: NSCoder) {
27 fatalError("init(coder:) has not been implemented")
23 fatalError("init(coder:) has not been implemented")
28 }
24 }
@@ -32,38 +28,13 @@ class SecondaryViewController: UIViewController {
32
28
33class SecondaryView: UIView {
29class SecondaryView: UIView {
34
30
35− var mainTag: String? {
36− get {
37− return tagLabel.text
38− }
39− set {
40− tagLabel.text = newValue
41−
42− }
43− }
44−
45
31
46 private let spacer: CGFloat = 32
32 private let spacer: CGFloat = 32
47− private let bottomSpacer: CGFloat = 64
48− private let tagSpacer: CGFloat = 32
49− private let tagLabel = UILabel()
50− private let melkLabel = UILabel()
51−
52− func present(tag: String) {
53− UIView.perform(.delete, on: [melkLabel], options: [], animations: nil) { (_) in
54− self.melkLabel.removeFromSuperview()
55− self.mainTag = tag
56− self.tagLabel.sizeToFit()
57− self.layoutIfNeeded(animated: true)
58− }
59− }
60
33
61 func add(result: StreamingServiceResult) {
34 func add(result: StreamingServiceResult) {
62 switch result {
35 switch result {
63 case .post(let post):
36 case .post(let post):
64 let card = CardContainer()
37 let card = CardContainer()
65− card.minWidth = min(bounds.width / 2.3, 550)
66− card.height = cardHeight
67 card.post = post
38 card.post = post
68 cards.addArrangedSubview(.spacer(spacer))
39 cards.addArrangedSubview(.spacer(spacer))
69 cards.addArrangedSubview(.view(card))
40 cards.addArrangedSubview(.view(card))
@@ -80,15 +51,6 @@ class SecondaryView: UIView {
80 super.init(frame: frame)
51 super.init(frame: frame)
81 backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
52 backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
82 addSubview(cards)
53 addSubview(cards)
83−
84− melkLabel.text = "Melk"
85− melkLabel.font = UIFont.systemFont(ofSize: 200, weight: UIFontWeightHeavy)
86− melkLabel.textColor = #colorLiteral(red: 0.9601849914, green: 0.9601849914, blue: 0.9601849914, alpha: 1)
87− addSubview(melkLabel)
88−
89− tagLabel.font = UIFont.systemFont(ofSize: 69, weight: UIFontWeightBold)
90− tagLabel.textColor = #colorLiteral(red: 0.3176470588, green: 0.3179988265, blue: 0.3179988265, alpha: 1)
91− addSubview(tagLabel)
92 }
54 }
93
55
94 func setNeedsLayout(animated: Bool) {
56 func setNeedsLayout(animated: Bool) {
@@ -102,7 +64,6 @@ class SecondaryView: UIView {
102 private var animate: Bool = false
64 private var animate: Bool = false
103
65
104 private func cleanCards() {
66 private func cleanCards() {
105− var offset = 0
106 outLoop: for (i, element) in cards.arrangedSubviews.enumerated() {
67 outLoop: for (i, element) in cards.arrangedSubviews.enumerated() {
107 switch element {
68 switch element {
108 case .view(let card):
69 case .view(let card):
@@ -110,9 +71,8 @@ class SecondaryView: UIView {
110 if cardFrame.intersects(bounds) {
71 if cardFrame.intersects(bounds) {
111 break outLoop
72 break outLoop
112 } else {
73 } else {
113− cards.arrangedSubviews.remove(at: i-1-offset)
74+ cards.arrangedSubviews.remove(at: i-1)
114− cards.arrangedSubviews.remove(at: i-1-offset)
75+ cards.arrangedSubviews.remove(at: i-1)
115− offset += 2
116 }
76 }
117 case .spacer(_):
77 case .spacer(_):
118 break
78 break
@@ -120,21 +80,13 @@ class SecondaryView: UIView {
120 }
80 }
121 }
81 }
122
82
123− private let padding = CGPoint(x: 32, y: 16)
83+ private let padding = CGPoint(x: 32, y: 32)
124− private var cardHeight: CGFloat = 400
125
84
126 override func layoutSubviews() {
85 override func layoutSubviews() {
127 super.layoutSubviews()
86 super.layoutSubviews()
128−
129− melkLabel.sizeToFit()
130− melkLabel.center = center
131−
132 let updates = {
87 let updates = {
133− self.tagLabel.sizeToFit()
134− self.tagLabel.center.x = self.center.x
135− self.tagLabel.frame.origin.y = self.tagSpacer
136− self.cards.frame.origin.y = self.tagLabel.frame.maxY + self.padding.y
137 self.cards.layoutIfNeeded()
88 self.cards.layoutIfNeeded()
89+ self.cards.frame.origin.y = self.padding.y
138 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
90 self.cards.frame.origin.x = self.frame.width - self.padding.x - self.cards.frame.width
139 }
91 }
140 if animate {
92 if animate {
@@ -146,7 +98,6 @@ class SecondaryView: UIView {
146 updates()
98 updates()
147 self.cleanCards()
99 self.cleanCards()
148 }
100 }
149− cardHeight = bounds.height - tagLabel.frame.height - padding.y - tagSpacer - bottomSpacer
150 animate = false
101 animate = false
151 }
102 }
152
103
Melk/TableViewCells.swift+3−12
@@ -57,12 +57,6 @@ class TagTableViewCell: UITableViewCell {
57 }
57 }
58 }
58 }
59
59
60− var tagDidChange: ((String?) -> ())?
61−
62− @objc private func textDidChange() {
63− tagDidChange?(tagString)
64− }
65−
66 var style: TagStyle = .normal {
60 var style: TagStyle = .normal {
67 didSet {
61 didSet {
68 updateStyle()
62 updateStyle()
@@ -76,9 +70,6 @@ class TagTableViewCell: UITableViewCell {
76
70
77 textField.borderStyle = .roundedRect
71 textField.borderStyle = .roundedRect
78 textField.adjustsFontSizeToFitWidth = false
72 textField.adjustsFontSizeToFitWidth = false
79− textField.autocapitalizationType = .none
80− textField.autocorrectionType = .no
81− textField.addTarget(self, action: #selector(self.textDidChange), for: .editingChanged)
82
73
83 contentView.addSubview(textField)
74 contentView.addSubview(textField)
84// textField.delegate = self
75// textField.delegate = self
@@ -101,7 +92,7 @@ class TagTableViewCell: UITableViewCell {
101 CGRect.infinite, limitedToNumberOfLines: 1)
92 CGRect.infinite, limitedToNumberOfLines: 1)
102 .height + 2*2
93 .height + 2*2
103
94
104− let frame = CGRect(x: 16, y: style == .large ? 32 : 4, width: bounds.width - 16*2, height: height)
95+ let frame = CGRect(x: 16, y: 8, width: bounds.width - 16*2, height: height)
105 textField.frame = frame
96 textField.frame = frame
106 print(textField.frame)
97 print(textField.frame)
107 }
98 }
@@ -112,8 +103,8 @@ class TagTableViewCell: UITableViewCell {
112
103
113
104
114 static let identifier = "io.Melk.tagTableViewCell"
105 static let identifier = "io.Melk.tagTableViewCell"
115− static let largeHeight: CGFloat = 37.5 + 16 + 32
106+ static let largeHeight: CGFloat = 37.5 + 8*2
116− static let normalHeight: CGFloat = 28.0 + 4*2
107+ static let normalHeight: CGFloat = 28.0 + 8*2
117}
108}
118
109
119//extension TagTableViewCell: UITextFieldDelegate {
110//extension TagTableViewCell: UITextFieldDelegate {
Melk/VKData.swift+7−7
@@ -289,13 +289,13 @@ class VKData {
289 photo.width.value = json["width"].int
289 photo.width.value = json["width"].int
290 photo.height.value = json["height"].int
290 photo.height.value = json["height"].int
291 var surl: String?
291 var surl: String?
292−// if let imageSurl = json["photo_2560"].string {
292+ if let imageSurl = json["photo_2560"].string {
293−// surl = imageSurl
293+ surl = imageSurl
294−// } else if let imageSurl = json["photo_1280"].string {
294+ } else if let imageSurl = json["photo_1280"].string {
295−// surl = imageSurl
295+ surl = imageSurl
296−// } else if let imageSurl = json["photo_807"].string {
296+ } else if let imageSurl = json["photo_807"].string {
297−// surl = imageSurl
297+ surl = imageSurl
298− /*} else*/ if let imageSurl = json["photo_604"].string {
298+ } else if let imageSurl = json["photo_604"].string {
299 surl = imageSurl
299 surl = imageSurl
300 } else if let imageSurl = json["photo_130"].string {
300 } else if let imageSurl = json["photo_130"].string {
301 surl = imageSurl
301 surl = imageSurl
Melk/VKServer.swift+1−1
@@ -118,6 +118,6 @@ class VKServer {
118}
118}
119
119
120fileprivate func url(`for` method: String) -> URL {
120fileprivate func url(`for` method: String) -> URL {
121− let surl = "https://api.vk.com/method/\(method)?access_token=\(accessKey)&v=\(vkAPIVersion)&lang=0"
121+ let surl = "https://api.vk.com/method/\(method)?access_token=\(accessKey)&v=\(vkAPIVersion)"
122 return URL.init(string: surl)!
122 return URL.init(string: surl)!
123}
123}
README.mddeleted−17
@@ -1,17 +0,0 @@
1−# Melk
2−
3−_Might not work properly with new streaming API. This project was developed while the API was in beta._
4−
5−[![Melk demo](http://img.youtube.com/vi/9SNc0bLDCL0/0.jpg)](http://www.youtube.com/watch?v=9SNc0bLDCL0)
6−
7−При проведении различных мероприятий организаторы довольно часто призывают людей, посещающих эти мероприятия, выложить у себя в соц сети что-нибудь об этом мероприятии, чаще всего под мероприятие даже выделяется отдельный хештег.
8−
9−Для привлечения внимания к хештегу и поощрения его использования можно выводить некоторые из выложенных с хештегом записей туда, где все смогут это увидеть.
10−
11−При проведении больших мероприятий желательно использовать большое количество независимых систем, чтобы если летит что-то одно, все остальное продолжало работать.
12−
13−Полноценный десктопный компьютер для данной цели не нужен, поэтому приложение работает просто на телефоне или планшете.
14−
15−Самый первый хештег или ключевое слово будет крупно показано вместе со всеми записями.
16−
17−После того, как будет нажата кнопка “Present”, записи с основным хештегом будут выводиться на любые подключенные к устройству экраны.