blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0ef332d363f3cb014e24a19367074a9eebc4e5e6 | d2d3814e243dfb63d836f440ea269375575aa5a8 | /Application-Checklist/Checklist/models/Liste+defaults.swift | e36ad89c89610ab062fac39f50b95207a1cce0d4 | [] | no_license | AnthonyHervy/iOS-XCode-Swift | c85e31480fb6adf6321ddbeed544a269b4fefda6 | 08e5f82ceff979d6cb20c9d961e376a021484f7a | refs/heads/master | 2020-03-23T18:25:13.522477 | 2018-07-22T15:30:47 | 2018-07-22T15:30:47 | 141,907,546 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,829 | swift | //
// Liste+defaults.swift
// Checklist
//
// Created by Anthony on 11/05/2018.
// Copyright © 2018 Anthony. All rights reserved.
//
import Foundation
extension Liste {
func creerItem(item:String, defaults:UserDefaults) {
var itemsSauvegardes:[Dictionary<String,Any>] = []
let nouvoItem = ["texte": item, "status": 0] as [String : Any]
//on vérifie les items existants dans defaults
if let items = defaults.object(forKey:"items") as? [Dictionary<String,Any>] {
itemsSauvegardes = items
}
//le nouvel item ajouté
itemsSauvegardes.append(nouvoItem)
defaults.set(itemsSauvegardes, forKey: "items")
}
func sauvegarderItems(items:[Item], defaults:UserDefaults) {
var itemsSauvegardes:[Dictionary<String,Any>] = []
for item in items {
let i = ["texte": item.texte, "status": setStatus(item: item)] as [String : Any]
itemsSauvegardes.append(i)
}
defaults.set(itemsSauvegardes, forKey: "items")
}
func telechargerItems(defaults:UserDefaults) -> [Item] {
var items:[Item] = []
if let itemsArray = defaults.object(forKey: "items") as? [Dictionary<String, Any>] {
for item in itemsArray {
let i = Item(texte: item["texte"] as! String)
i.statutFait = getStatus(itemValue: item["status"] as! Int)
items.append(i)
}
}
return items
}
func setStatus(item:Item) -> Int {
let statutValue = item.statutFait ? 1 : 0
return statutValue
}
func getStatus(itemValue:Int) -> Bool {
let status = itemValue == 1 ? true : false
return status
}
}
| [
-1
] |
8a2f709cf6010abf7172caac994f2cbe4ae6a886 | f7fb77423cd990d578e5621fbab87fb75368d25c | /Mobile/iOS/Hunter/Hunter/Utils/UI/Hunter/HunterLoading.swift | f4ffd467084e4df958269a18f2e4a35c4ed3face | [
"MIT"
] | permissive | UTN-FRBA-Mobile/Hunter | c1b07a83503f3a9ab6b06063ceca9a0229c99fa8 | 9531a0a1d263fc0af1c168e55e3d4b2a2f32d1d1 | refs/heads/master | 2023-01-21T08:49:52.492916 | 2020-11-30T22:11:30 | 2020-11-30T22:11:30 | 294,838,780 | 0 | 0 | MIT | 2020-11-30T21:55:19 | 2020-09-12T00:27:20 | Swift | UTF-8 | Swift | false | false | 3,975 | swift | import Foundation
import UIKit
protocol Loading {
func startLoading() -> Self
func stopLoading(shouldBeRemove value: Bool, _ onComplete: @escaping (() -> Void))
func removeLoading()
}
class HunterLoading: UIView {
private (set) weak var spinner: UIActivityIndicatorView!
private (set) weak var descriptionLabel: PaddingLabel!
private let defaultText: String = "Cargando..."
init() {
let spinner = UIActivityIndicatorView(style: .large)
spinner.translatesAutoresizingMaskIntoConstraints = false
spinner.tintColor = Color.Hunter.green
spinner.color = Color.Hunter.green
let label = PaddingLabel()
label.contentInsets = .init(top: 4, left: 8, bottom: 4, right: 8)
label.isHidden = true
label.translatesAutoresizingMaskIntoConstraints = false
let container: UIView = UIView.loadFromCode { $0.backgroundColor = .clear }
self.spinner = spinner
self.descriptionLabel = label
container.addSubview(spinner)
container.addSubview(label)
super.init(frame: .zero)
self.translatesAutoresizingMaskIntoConstraints = false
label.text = defaultText
label.font = .systemFont(ofSize: 24, weight: .semibold)
label.clipsToBounds = true
addInside(centerFlexible: container, axis: [.horizontal, .vertical])
container.flexible(for: .vertical, with: spinner)
container.centerX(to: spinner).activate()
[
container.topAnchor.constraint(equalTo: spinner.topAnchor),
label.topAnchor.constraint(equalTo: spinner.bottomAnchor, constant: 40),
container.leadingAnchor.constraint(equalTo: label.leadingAnchor),
container.trailingAnchor.constraint(equalTo: label.trailingAnchor),
container.bottomAnchor.constraint(equalTo: label.bottomAnchor)
].activate()
}
required init?(coder: NSCoder) { super.init(coder: coder) }
// MARK: - Public Functions
@discardableResult
func fullScreen(of superview: UIView, colored: UIColor = .black, withText text: String? = nil) -> Self {
asSubview(of: superview).toEdges(of: superview)
descriptionLabel.text = text ?? defaultText
startLoading()
return self
}
@discardableResult
func centered(in superview: UIView, withText text: String? = nil) -> Self {
addInside(centerFlexible: superview, axis: [.vertical, .horizontal])
descriptionLabel.text = text ?? defaultText
startLoading()
return self
}
override func layoutSubviews() {
super.layoutSubviews()
descriptionLabel.layer.cornerRadius = descriptionLabel.frame.height / 4
}
}
extension HunterLoading: Loading {
@discardableResult
func startLoading() -> Self {
descriptionLabel.isHidden = false
UIView.animate(withDuration: 0.3) {
self.spinner.transform = .init(scaleX: 2, y: 2)
self.descriptionLabel.backgroundColor = .white
self.descriptionLabel.textColor = .black
}
spinner.startAnimating()
return self
}
func stopLoading(shouldBeRemove value: Bool = true, _ onComplete: @escaping (() -> Void) = {}) {
descriptionLabel.isHidden = true
UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.3,
initialSpringVelocity: 0.3,
options: .curveEaseIn) { [weak self] in
self?.spinner.transform = .identity
} completion: { [weak self] finished in
guard finished else { return }
onComplete()
self?.spinner.stopAnimating()
value ? self?.removeLoading() : nil
}
}
func removeLoading() {
removeFromSuperview()
}
}
| [
-1
] |
e567ad6b824f699a55d18e1ce220acaa434d77a6 | b9767eb1f24cd5828d82a119b5aa4fd9c5c47f13 | /FoodTracker/FoodTrackerUITests/FoodTrackerUITests.swift | 502deb8a87fc5d6280af3c666768bd5fba6f4883 | [
"MIT"
] | permissive | Alexoner/learn-iOS | 8076dd700d153470c759bcd5b1fc16a0d3c7b86d | e20aab6e536bceb4f33b26866ddf042f92411bce | refs/heads/master | 2021-01-13T00:49:39.013881 | 2016-02-23T03:14:45 | 2016-02-23T03:14:45 | 50,019,321 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,246 | swift | //
// FoodTrackerUITests.swift
// FoodTrackerUITests
//
// Created by duhao.dh on 1/18/16.
// Copyright © 2016 alex. All rights reserved.
//
import XCTest
class FoodTrackerUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
| [
155665,
237599,
229414,
278571,
229425,
180279,
229431,
319543,
213051,
286787,
237638,
311373,
196687,
278607,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
147679,
311520,
147680,
319719,
295147,
286957,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
278843,
287040,
319812,
311622,
319816,
229716,
278895,
287089,
139641,
311679,
311692,
106893,
156069,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
278979,
336323,
278988,
278992,
279000,
369121,
279009,
188899,
279014,
319976,
279017,
311787,
319986,
279030,
311800,
279033,
279042,
287237,
377352,
279053,
303634,
303635,
279060,
279061,
188954,
279066,
279092,
377419,
303693,
115287,
189016,
287319,
295518,
287327,
279143,
279150,
287345,
287348,
189054,
287359,
303743,
164487,
279176,
311944,
344714,
311948,
311950,
311953,
336531,
287379,
295575,
303772,
221853,
205469,
279207,
295591,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
279249,
303826,
279253,
369365,
369366,
230105,
295653,
230120,
312046,
279278,
230133,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
230198,
222017,
295745,
279379,
295769,
230238,
230239,
279393,
303973,
279398,
295797,
295799,
279418,
336765,
287623,
279434,
320394,
189327,
189349,
279465,
304050,
189373,
213956,
345030,
213961,
279499,
304086,
304104,
123880,
320492,
320495,
287730,
320504,
312313,
214009,
312315,
312317,
328701,
328705,
418819,
320520,
230411,
320526,
238611,
140311,
238617,
197658,
336930,
189487,
312372,
238646,
238650,
320571,
336962,
238663,
205911,
296023,
156763,
230500,
214116,
279659,
238706,
279666,
312435,
230514,
279686,
222344,
337037,
296091,
238764,
148674,
312519,
279752,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
312628,
345398,
222523,
181568,
279872,
279874,
304457,
345418,
230730,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
279979,
279980,
173492,
279988,
280003,
370122,
280011,
337359,
329168,
312785,
222674,
329170,
280020,
280025,
239069,
320997,
280042,
280043,
329198,
337391,
296434,
288248,
288252,
312830,
230922,
329231,
304655,
230933,
222754,
312879,
230960,
288305,
239159,
157246,
288319,
288322,
280131,
124486,
288328,
230999,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
239238,
288391,
239251,
280217,
198304,
337590,
280252,
280253,
296636,
321217,
280259,
321220,
296649,
239305,
280266,
9935,
313042,
280279,
18139,
280285,
321250,
337638,
181992,
288492,
34547,
67316,
313082,
288508,
288515,
280326,
116491,
280333,
124691,
116502,
321308,
321309,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
337746,
18263,
370526,
296807,
296815,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
124816,
214936,
337816,
124826,
329627,
239515,
214943,
313257,
288698,
214978,
280517,
280518,
214983,
231382,
329696,
190437,
313322,
329707,
174058,
296942,
124912,
313338,
239610,
182277,
313356,
305173,
223269,
354342,
354346,
313388,
124974,
321589,
288829,
288835,
313415,
239689,
354386,
280660,
223317,
329812,
321632,
280674,
280676,
313446,
215144,
288878,
288890,
215165,
280708,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
280779,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125200,
125204,
338196,
125215,
125225,
338217,
321839,
125236,
280903,
289109,
379224,
239973,
313703,
280938,
321901,
354671,
354672,
199030,
223611,
248188,
313726,
240003,
158087,
313736,
240020,
190870,
190872,
289185,
305572,
289195,
338359,
289229,
281038,
281039,
281071,
322057,
182802,
322077,
289328,
338491,
322119,
281165,
281170,
281200,
297600,
289435,
314020,
248494,
166581,
314043,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
125683,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
281378,
289580,
281407,
289599,
281426,
281434,
322396,
281444,
207735,
314240,
158594,
330627,
240517,
289691,
240543,
289699,
289704,
289720,
289723,
281541,
19398,
191445,
183254,
207839,
142309,
314343,
183276,
289773,
248815,
240631,
330759,
322571,
330766,
330789,
248871,
281647,
322609,
314437,
207954,
339031,
314458,
281698,
281699,
322664,
314493,
150656,
347286,
330912,
339106,
306339,
249003,
208044,
322733,
3243,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
298290,
208179,
159033,
216387,
372039,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314759,
298378,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
314790,
282023,
298406,
241067,
314797,
306630,
306634,
339403,
191980,
282097,
306678,
191991,
290304,
323083,
323088,
282132,
282135,
175640,
306730,
290359,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
323226,
282272,
282279,
298664,
298666,
306875,
282302,
323262,
323265,
282309,
306891,
241360,
282321,
241366,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
315209,
159563,
307024,
307030,
241494,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
298921,
126896,
200628,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
102441,
315433,
102446,
282671,
241717,
307269,
233548,
315468,
315477,
200795,
323678,
315488,
315489,
45154,
217194,
233578,
307306,
249976,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
184574,
217352,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
332084,
307514,
282938,
127292,
168251,
323914,
201037,
282959,
250196,
168280,
323934,
381286,
242027,
242028,
250227,
315768,
315769,
291194,
291193,
291200,
242059,
315798,
291225,
242079,
283039,
299449,
291266,
373196,
283088,
283089,
242138,
176602,
160224,
291297,
242150,
283138,
233987,
324098,
340489,
283154,
291359,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
291455,
316044,
184974,
316048,
316050,
340645,
176810,
299698,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291605,
283418,
234276,
283431,
242481,
234290,
201534,
283466,
201562,
234330,
275294,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
234513,
316441,
300087,
21567,
308288,
160834,
349254,
300109,
234578,
250965,
234588,
250982,
234606,
300145,
300147,
234626,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
324790,
300215,
283841,
283846,
283849,
316628,
251124,
316661,
283894,
234741,
292092,
234756,
242955,
177420,
292145,
300342,
333114,
333115,
193858,
300355,
300354,
234830,
283990,
357720,
300378,
300379,
316764,
292194,
284015,
234864,
316786,
243073,
292242,
112019,
234902,
333224,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
308722,
300539,
210429,
292359,
218632,
316951,
374297,
235069,
349764,
194118,
292424,
292426,
333389,
349780,
128600,
235096,
300643,
300645,
243306,
325246,
235136,
317102,
300725,
300729,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300810,
300812,
284430,
161553,
284436,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
317268,
325460,
341846,
284508,
300893,
284515,
276326,
292713,
292719,
325491,
333687,
317305,
317308,
325508,
333700,
243590,
243592,
325514,
350091,
350092,
350102,
333727,
219046,
333734,
284584,
292783,
300983,
153553,
292835,
6116,
292838,
317416,
325620,
333827,
243720,
292901,
325675,
243763,
325695,
333902,
227432,
194667,
284789,
284790,
292987,
227459,
194692,
235661,
333968,
153752,
284827,
333990,
284840,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
334049,
317676,
309504,
194832,
227601,
325904,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
285031,
416103,
227702,
211327,
227721,
285074,
227730,
285083,
293275,
317851,
227743,
285089,
293281,
301482,
375211,
334259,
293309,
317889,
326083,
129484,
326093,
285152,
195044,
334315,
236020,
293368,
317949,
342537,
309770,
334345,
342560,
227881,
293420,
236080,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
309847,
244311,
244326,
277095,
301688,
244345,
301702,
334473,
326288,
227991,
285348,
318127,
293552,
285360,
285362,
342705,
154295,
342757,
285419,
170735,
342775,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
326428,
318247,
293673,
318251,
301872,
285493,
285496,
301883,
342846,
293702,
318279,
244569,
301919,
293729,
351078,
310132,
228214,
269179,
228232,
416649,
236427,
252812,
293780,
310166,
310177,
293801,
326571,
326580,
326586,
359365,
211913,
326602,
56270,
203758,
293894,
293911,
326684,
113710,
318515,
203829,
285795,
228457,
318571,
187508,
302202,
285819,
285823,
285833,
318602,
285834,
228492,
162962,
187539,
326803,
285850,
302239,
302251,
294069,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
228608,
318732,
245018,
318746,
130342,
130344,
130347,
286012,
294210,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
368012,
318860,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
310731,
302539,
310735,
327122,
310747,
286176,
187877,
310758,
40439,
286201,
359931,
245249,
228868,
302602,
294413,
359949,
302613,
302620,
245291,
130622,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
179853,
286351,
188049,
229011,
179868,
229021,
302751,
245413,
212649,
286387,
286392,
302778,
286400,
212684,
302798,
286419,
278232,
278237,
294621,
278241,
294629,
286457,
286463,
319232,
278292,
278294,
294699,
286507,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
319393,
294820,
294824,
343993,
98240,
294849,
24531,
294887,
278507,
311277,
327666,
278515
] |
ba7cc49a326c799d1036beec84ac7fb72b47c37c | 76d65c769025b72ea9a5db5adfb64aa4d657cdc0 | /TecnonutriFeed/Presentation/Feed/FeedViewController.swift | c88a18ec946a2cd7ca688a2098f3e63a10f8e1c3 | [] | no_license | zacmks/TenonutriFeed | 8a02c0e6c6606585ac9f5ef1a546d9a7e1f73309 | 8c1ca42b27f34f687d267eb1e25aab5cbc015650 | refs/heads/master | 2021-01-15T12:50:07.866884 | 2017-08-13T19:34:02 | 2017-08-13T19:34:02 | 99,661,059 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,312 | swift | //
// FeedViewController.swift
// TecnonutriFeed
//
// Created by Isaac Mitsuaki Saito on 09/08/2017.
// Copyright © 2017 Isaac Mitsuaki Saito. All rights reserved.
//
import UIKit
import MoPub
import Firebase
class FeedViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, MPAdViewDelegate, FeedView {
@IBOutlet weak var tableView: UITableView!
var presenter: FeedPresenter!
override func viewDidLoad() {
super.viewDidLoad()
// let viewContext = CoreDataStackImplementation.sharedInstance.persistentContainer.viewContext
let feedItemManager = FeedItemManagerImpl(feedItemManagerAPI: FeedItemManagerAPI(), feedItemManagerDB: FeedItemManagerDB())
let feedDisplayAction = FeedDisplayActionImpl(feedItemManager: feedItemManager)
let feedLoadPageAction = FeedLoadPageActionImpl(feedItemManager: feedItemManager)
let feedItemLikeDislikeAction = FeedItemLikeDislikeActionImpl(feedItemManager: feedItemManager)
let feedViewSwitcher = FeedViewSwitcherImpl(feedViewController: self)
presenter = FeedPresenterImpl(view: self,
feedDisplayAction: feedDisplayAction,
feedLoadPageAction: feedLoadPageAction,
feedItemLikeDislikeAction: feedItemLikeDislikeAction,
feedViewSwitcher: feedViewSwitcher)
// iOS related
self.tableView.tableHeaderView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: self.tableView.bounds.size.width, height: 0.01));
tableView.register(UINib(nibName: "FeedTableViewCell", bundle: nil), forCellReuseIdentifier: "FeedTableViewCell")
tableView.delegate = self
tableView.dataSource = self
// Refresh control
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, action: #selector(loadData), for: UIControlEvents.valueChanged)
self.tableView.refreshControl = refreshControl
presenter.viewDidLoad()
// TODO fetchConfig() and loadAds() to better packages?
fetchConfig()
}
// TODO fetchConfig() and loadAds() to better packages?
func fetchConfig() {
#if DEBUG
RemoteConfig.remoteConfig().configSettings = RemoteConfigSettings(developerModeEnabled: true)!
#endif
RemoteConfig.remoteConfig().setDefaults(Config.defaultValues)
RemoteConfig.remoteConfig().fetch(withExpirationDuration: 0) { (status, error) in
guard error == nil else {
print("Error fetching remote config: \(error)")
self.loadAds()
return
}
let remoteConfig = RemoteConfig.remoteConfig()
remoteConfig.activateFetched()
let showAds = remoteConfig["show_ads"].boolValue ?? true
if (showAds) {
self.loadAds()
}
}
}
// TODO fetchConfig() and loadAds() to better packages?
func loadAds() {
let adSize: CGSize = UI_USER_INTERFACE_IDIOM() == .pad ? MOPUB_LEADERBOARD_SIZE : MOPUB_BANNER_SIZE
let bannerAdView = MPAdView.init(adUnitId: "bd5ab3e9fa8c43b88e663b6e17e4c1e5", size: adSize)
bannerAdView?.delegate = self
var adFrame: CGRect = CGRect.zero
adFrame.size.width = adSize.width
adFrame.size.height = adSize.height
adFrame.origin.x = (UIScreen.main.bounds.width - adSize.width) / 2.0
adFrame.origin.y = UIScreen.main.bounds.height / 2.0
adFrame.origin.y = view.bounds.height - adSize.height
bannerAdView!.frame = adFrame
self.view?.addSubview(bannerAdView!)
bannerAdView?.loadAd()
}
func loadData() {
presenter.loadData()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tableView.reloadData()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
presenter.switcher.prepare(for: segue, sender: sender)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return presenter.numberOfFeedItems
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "FeedTableViewCell", for: indexPath) as! FeedTableViewCell
presenter.configure(cell: cell, forRow: indexPath.row)
return cell
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.row >= presenter.numberOfFeedItems - 1 {
presenter.loadNextPage()
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 68.0 + 52 + UIScreen.main.bounds.width / 1.25 + 4.0 + 4.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
presenter.didSelect(section: indexPath.row)
}
func refreshFeedView() {
tableView.reloadData()
tableView.refreshControl!.endRefreshing()
}
func displayError(title: String, message: String) {
presentAlert(withTitle: title, message: message)
}
func viewControllerForPresentingModalView() -> UIViewController! {
return self
}
}
| [
-1
] |
7fb0b4fd8b9c8fb2fdb256f997398f8ac7dc686a | 701f4abbf7bc71a74f608451d1f0c32dcf3d89e9 | /Controllers/SearchUsersViewController.swift | f0ab0bf3132008b434181643f8850be158b50bac | [] | no_license | alandoonan/Odd_Jobs_Realm_Location_Tasks | 4b1e2710315ca7e4f3cc4cd3901095eba30bec40 | 98ed88c4d71bb4e5f9f824cd5fbff184fd201cdc | refs/heads/master | 2020-07-18T02:28:44.081577 | 2019-09-03T19:17:00 | 2019-09-03T19:17:00 | 206,154,668 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,220 | swift | //
// SearchUsersViewController
// Odd_Jobs_Realm
//
// Created by Alan Doonan on 07/07/2019.
// Copyright © 2019 Alan Doonan. All rights reserved.
//
import UIKit
import RealmSwift
import RealmSearchViewController
import RSSelectionMenu
class SearchUsersViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate
{
var realm: Realm
var items: Results<UserItem>
var scoreVC = ScoreViewController()
var notificationToken: NotificationToken?
var delegate: HomeControllerDelegate?
var searchBar = UISearchBar()
let tableView = UITableView()
var scoreCategory = ["User"]
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
let config = SyncUser.current?.configuration(realmURL: Constants.ODDJOBS_REALM_URL, fullSynchronization: true)
self.realm = try! Realm(configuration: config!)
self.items = realm.objects(UserItem.self).filter("Category contains[c] %@", "User")
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
deinit {
notificationToken?.invalidate()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
applyThemeView(view)
}
fileprivate func addNotificationToken() {
notificationToken = items.observe { [weak self] (changes) in
guard let tableView = self?.tableView else { return }
switch changes {
case .initial:
tableView.reloadData()
case .update(_, let deletions, let insertions, let modifications):
tableView.beginUpdates()
tableView.insertRows(at: insertions.map({ IndexPath(row: $0, section: 0) }),
with: .automatic)
tableView.deleteRows(at: deletions.map({ IndexPath(row: $0, section: 0)}),
with: .automatic)
tableView.reloadRows(at: modifications.map({ IndexPath(row: $0, section: 0) }),
with: .automatic)
tableView.endUpdates()
case .error(let error):
fatalError("\(error)")
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
let logout = UIBarButtonItem(title: "Logout", style: .plain, target: self, action: #selector(logOutButtonPress))
let sideBar = UIBarButtonItem(image: #imageLiteral(resourceName: "ic_menu_white_3x").withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(handleDismiss))
addSearchBar(scoreCategory: scoreCategory, searchBar: searchBar)
addNavBar([sideBar], [logout], scoreCategory: scoreCategory)
tableView.addTableView(tableView, view)
tableView.dataSource = self
tableView.delegate = self
addNotificationToken()
addNotificationToken()
setUpSearchBar(searchBar: searchBar)
applyThemeView(view)
tableView.reloadData()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return Themes.current.preferredStatusBarStyle
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
fileprivate func addTableCell(_ tableView: UITableView, _ indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") ?? UITableViewCell(style: .subtitle, reuseIdentifier: "Cell")
let item = items[indexPath.row]
cell.selectionStyle = .none
cell.textLabel?.text = item.Name
cell.tintColor = .white
cell.textLabel?.textColor = .white
cell.detailTextLabel?.textColor = .white
cell.backgroundColor = UIColor.orangeTheme
cell.detailTextLabel?.text = ("Name: " + item.Name)
cell.detailTextLabel?.text = ("User ID: " + item.UserID)
cell.textLabel!.font = UIFont(name: Themes.mainFontName,size: 18)
return cell
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return addTableCell(tableView, indexPath)
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
print("typing in search bar: term = \(searchText)")
if searchText != "" {
let predicate = NSPredicate(format:"(Name CONTAINS[c] %@) AND Category in %@", searchText, scoreCategory)
self.items = realm.objects(UserItem.self).filter(predicate)
tableView.reloadData()
} else {
self.items = realm.objects(UserItem.self).filter("Category in %@", scoreCategory)
tableView.reloadData()
}
tableView.reloadData()
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
guard editingStyle == .delete else { return }
let item = items[indexPath.row]
try! realm.write {
realm.delete(item)
}
}
}
| [
-1
] |
6d30cd0f44682f1a281ba8e8e8092b89cdc0a33d | 7c1f88ea695145bb242db343bffec3332d6924be | /Flicks/AppDelegate.swift | 5360e50105debc2117dec26ab08f810b3d236195 | [
"Apache-2.0"
] | permissive | eveliotc/flicks | ca573e2ed2bbce8ae376a249006cb73d280abd4b | 6923fc3f1772730d1fbcaf907ab7211d32ad6cd0 | refs/heads/master | 2021-01-11T03:16:57.014989 | 2016-10-15T23:16:53 | 2016-10-17T02:39:22 | 71,093,579 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,085 | swift | //
// AppDelegate.swift
// Flicks
//
// Created by Evelio Tarazona on 10/15/16.
// Copyright © 2016 Evelio Tarazona. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let viewControllerStoryboardId = "NavigationMoviesViewController"
let storyboardName = "Main"
let storyboard = UIStoryboard(name: storyboardName, bundle: Bundle.main)
// Most Recent
let vc1 = storyboard.instantiateViewController(withIdentifier: viewControllerStoryboardId)
let movieVC1 = vc1.childViewControllers[0] as! MoviesViewController
movieVC1.movieSource = .nowPlaying
vc1.tabBarItem = UITabBarItem(tabBarSystemItem: .mostRecent, tag: 0)
// Top Rated
let vc2 = storyboard.instantiateViewController(withIdentifier: viewControllerStoryboardId)
let movieVC2 = vc2.childViewControllers[0] as! MoviesViewController
movieVC2.movieSource = .topRated
vc2.tabBarItem = UITabBarItem(tabBarSystemItem: .topRated, tag: 1)
// Tab Bar
let tabBarController = UITabBarController()
tabBarController.viewControllers = [vc1, vc2]
window?.rootViewController = tabBarController
window?.makeKeyAndVisible()
let blurEffect = UIBlurEffect(style: .dark)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = tabBarController.tabBar.bounds
tabBarController.tabBar.insertSubview(blurView, at: 0)
let tabBar = UITabBar.appearance()
tabBar.barStyle = .blackOpaque
tabBar.tintColor = Colors.main
tabBar.barTintColor = Colors.main
tabBar.backgroundImage = UIImage()
tabBar.shadowImage = UIImage()
return true
}
}
| [
-1
] |
88501037a20c422db48065620c38b259f3919afb | 71ff618e3bc4224088ff3adceae4ef018b21c282 | /ios/keychaineditor/gui/keychainEditrUI/keychainEditrUITests/keychainTests.swift | 078544db3d440ad284e27e292f87d05509983c8d | [] | no_license | meshubhama01/mobileptrepo | b80e447fd44edc5d6e0b397b1a5177724629a55d | c1a28fe53bf599bf7f7042ae04725156abb824a2 | refs/heads/master | 2022-03-10T19:34:38.325694 | 2019-11-04T03:29:33 | 2019-11-04T03:29:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 897 | swift | //
// keychainTests.swift
// keychainEditrUI
//
// Created by Nitin Jami on 2/17/16.
// Copyright © 2016 Ghutle. All rights reserved.
//
import XCTest
import Security
import keychainEditrUI
class keychainTests: XCTestCase {
var keychainObj: Keychain!
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
keychainObj = Keychain()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testAddItem() {
// given
let retVal = keychainObj.addItem()
//when
let checkVal: OSStatus! = errSecSuccess
XCTAssertEqual(retVal.status, checkVal)
}
}
| [
-1
] |
f355f3750b2605f6f4f0588fcf96e7c13d5e80bd | 79a8b0439ec9a9027eaaf1b117c086aaff2c838b | /Demirciy/Classes/DCollection.swift | 2e9bf8a7f60e4664bfc42c605336f260590434ae | [
"MIT"
] | permissive | ferhanakkan/Demirciy | 5c9a5d99ad1da64f0a58ce12247158301271faac | 48189d41705846858ee1468d62631de3cb2fcabf | refs/heads/master | 2022-11-18T01:53:34.138662 | 2020-07-12T07:20:12 | 2020-07-12T07:20:12 | 281,931,934 | 2 | 0 | MIT | 2020-07-23T11:22:53 | 2020-07-23T11:22:53 | null | UTF-8 | Swift | false | false | 1,121 | swift | //
// DCollection.swift
// DemirciyFramework
//
// Created by Yusuf Demirci on 10.12.2019.
// Copyright © 2019 Yusuf Demirci. All rights reserved.
//
import UIKit
open class DCollection: UICollectionView {
public init(layout: DCollectionLayout = DCollectionLayout(scrollDirection: UICollectionView.ScrollDirection.vertical)) {
super.init(frame: CGRect.zero, collectionViewLayout: layout)
commonInit()
}
public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
super.init(frame: frame, collectionViewLayout: UICollectionViewLayout())
commonInit()
}
public required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
open override func initUI() {
super.initUI()
backgroundColor = UIColor.clear
}
}
// MARK: - Private Functions
private extension DCollection {
func commonInit() {
initUI()
initLocale()
initTheme()
addSubviews()
addConstraints()
observe()
}
}
| [
-1
] |
abee0a7629431b6c01d21993094e256359263d5c | cda28179428f3e17dcd81262bde9f4c977a754ab | /Detailed/Detailed/AppDelegate.swift | 9b663a6e4e9e47ea1b30cd214f8fbd5f9ec21ece | [] | no_license | iyinraphael/Detailed | 575a9d4a7c65f757e1558d4c6aafdfb86f56cee5 | eeabeb0032c3302761412b54338c4eecf60a1e75 | refs/heads/master | 2020-04-06T15:59:52.970371 | 2018-11-27T22:58:20 | 2018-11-27T22:58:20 | 157,601,265 | 0 | 0 | null | 2018-11-14T19:38:53 | 2018-11-14T19:38:52 | null | UTF-8 | Swift | false | false | 2,176 | swift | //
// AppDelegate.swift
// Detailed
//
// Created by Iyin Raphael on 11/27/18.
// Copyright © 2018 Iyin Raphael. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
289111,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
234657,
283805,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
4d8fcdd70b2e1e6ef43948a227e3421abcd91b7e | 10ff678e58d8c7fe0810cb8eb52070de15be23ff | /Sources/SlackAPI.swift | 78312c9b1321d2fcbd877afec838829a00866c7e | [] | no_license | qmihara/ShuhoMaker | bb7b337c34e3feea15c2bb6cc2a0d77243f6f62d | 8763fb9100b9b7c661523bf1e3c2d20166a420b1 | refs/heads/master | 2021-08-28T13:45:51.801155 | 2017-12-12T10:36:52 | 2017-12-12T10:36:52 | 113,975,133 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,480 | swift | //
// SlackAPI.swift
// ShuhoMakerPackageDescription
//
// Created by Kyusaku Mihara on 2017/12/01.
//
import Foundation
import Result
struct SlackAPI {
static func fetchMessages(withQuery query: String, completion: @escaping ((Result<Message, ShuhoMakerError>) -> Void)) {
var urlComponents = URLComponents(string: "https://slack.com/api/search.messages")
urlComponents?.queryItems = [
URLQueryItem(name: "token", value: Settings.slackAPIToken),
URLQueryItem(name: "query", value: query),
URLQueryItem(name: "sort_dir", value: "asc"),
]
guard let url = urlComponents?.url else {
print("Could not create url. components:\(String(describing: urlComponents))")
completion(.failure(.unknown))
return
}
let task = URLSession.shared.dataTask(with: url) { data, response, error in
if let error = error {
print("An error occured. \(error.localizedDescription)")
completion(.failure(.httpError))
return
}
guard let data = data else {
print("JSON deserialize failed.")
completion(.failure(.jsonError))
return
}
guard let responseValue = try? JSONDecoder().decode(Response.self, from: data) else {
print("JSON decode failed.")
completion(.failure(.jsonError))
return
}
completion(.success(responseValue.messages))
}
task.resume()
}
static func postMessage(text: String, atChannelID channelID: String, completion: @escaping (() -> Void)) {
var urlComponents = URLComponents(string: "https://slack.com/api/chat.postMessage")
urlComponents?.queryItems = [
URLQueryItem(name: "token", value: Settings.slackAPIToken),
URLQueryItem(name: "channel", value: channelID),
URLQueryItem(name: "text", value: text),
URLQueryItem(name: "as_user", value: "false"),
]
guard let url = urlComponents?.url else {
completion()
return
}
let task = URLSession.shared.dataTask(with: url) { data, response, error in
if let error = error {
print("Post a message failed. \(error.localizedDescription)")
}
completion()
}
task.resume()
}
}
| [
-1
] |
1209614a889df29db74fc2ee336f7f7d5d041f7f | d63f88a3f11789a3a9dca1e0ec4cbefaf20d0b36 | /SwiftFun/scenes/HomeScene.swift | ee2f99b150a0a7437ef3a732ae1c8fbb7a1cbdb5 | [] | no_license | TheTwoNotes/SwiftFun | 7a19ca346cd56cb6675cc6f1a24b11674a39fe84 | c158de4a8961a63886be1ab208f912d46a378a78 | refs/heads/main | 2022-11-21T22:34:26.177777 | 2020-07-23T15:21:27 | 2020-07-23T15:21:27 | 276,488,298 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,476 | swift | //
// HomeScene.swift
// SwiftFun
//
// Created by Gil Estes on 7/1/20.
// Copyright © 2020 Cal30. All rights reserved.
//
import SpriteKit
import GameplayKit
class HomeScene: SKScene {
let actionKeys: [String] = [
"Images",
"Shapes",
"Sparkles",
"Bouncy Balls",
"Credits"
]
let targetScenes: [String: SceneIdentifier] = [
"Images": .images,
"Shapes": .boxDrop,
"Sparkles": .emitters,
"Bouncy Balls": .rollerBall,
"Credits": .credits
]
private var spinnyNode : SKShapeNode?
var label: SKLabelNode?
override func didMove(to view: SKView) {
self.alpha = 0.0
view.ignoresSiblingOrder = true
scaleMode = .aspectFill
let _ = initTitleLabel(sceneHeading: "Home")
// add action labels
var linkPosition: CGFloat = 0
for targetKey in actionKeys {
createActionLink(action: targetKey, position: linkPosition)
linkPosition+=1
}
backgroundColor = .white
revealScene()
}
func createActionLink(action: String, position: CGFloat) {
print("createActionLink(action: \(action), position: \(position))")
let spacing: CGFloat = 80
let max: CGFloat = 160
let actionLink = SKLabelNode()
actionLink.name = action
actionLink.text = action
actionLink.fontName = styles.fontName
actionLink.fontSize = CGFloat(styles.fontSizeLarge)
actionLink.fontColor = SKColor(hex: styles.actionColorHex)
actionLink.position = CGPoint(x: 0, y: max - (spacing * position))
actionLink.zPosition = 1
addChild(actionLink)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in touches {
let location = touch.location(in: self)
let touchedNode = atPoint(location)
if let key = touchedNode.name {
if let sceneIdentifier: SceneIdentifier = targetScenes[key] {
print("key=[\(key)]")
print("sceneName=[\(sceneIdentifier.rawValue)]")
loadScene(withIdentifier: sceneIdentifier)
}
}
}
}
override func update(_ currentTime: TimeInterval) {
// Called before each frame is rendered
}
}
| [
-1
] |
42bc61cf6f6495674f54c142b15bf5ce7ba2cb7a | b4678b900dd604c6e3a429e0b197fb1f686a36f4 | /my virtual tourist/Virtual Tourist/Model/Network/flickerConstants.swift | 4fb35a38803b3fc12e9a83a7a036d98a39b40564 | [] | no_license | adhwaaa/Virtual-tourist | b03a28624c393c916aaa7fcc979c91961b512bf3 | 0838f0fa20c5e6600e2f23cd2b6f649a0879850b | refs/heads/master | 2020-04-21T22:48:33.850963 | 2019-02-11T07:02:54 | 2019-02-11T07:02:54 | 169,925,181 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,016 | swift |
import Foundation
import UIKit
// flicker constants
struct Constants {
static let APIScheme = "https"
static let APIHost = "api.flickr.com"
static let APIPath = "/services/rest"
static let APIKey = "e15b9170bc438715ac2f7b9549917022"
static let SearchBBoxHalfWidth = 1.0
static let SearchBBoxHalfHeight = 1.0
}
struct ParameterKeys {
static let APIKey = "api_key"
static let Method = "method"
static let Extras = "extras"
static let Format = "format"
static let NoJSONCallback = "nojsoncallback"
static let BoundingBox = "bbox"
static let PerPage = "per_page"
static let Page = "page"
static let Lat = "lat"
static let Lon = "lon"
}
struct ParameterValues {
static let ResponseFormat = "json"
static let DisableJSONCallback = "1"
static let MediumURL = "url_m"
}
struct Methods {
static let SearchMethod = "flickr.photos.search"
}
struct ResponseKeys {
static let Photos = "photos"
static let Photo = "photo"
}
| [
-1
] |
cd8a2b6480d473e39ef55b3c34af284e2cde2a32 | 7bae6cf4907d980cbcf0360547f98a3fe3e6f178 | /MHTTools/ElementView/TemplateTextLable.swift | e7ea72591722d3833ce4003d5990c9862b6e7fdb | [] | no_license | zysyyz/MHTLabelPrinter | e8114b922ec4b0ead231fce0f8f4c5cbf1dff436 | 936f494613c7b33a5591ac086f9d4e5aef684a2c | refs/heads/master | 2020-06-14T18:46:57.860015 | 2018-03-07T08:06:46 | 2018-03-07T08:06:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,178 | swift | //
// TemplateTextLable.swift
// MHTLabelPrinter
//
// Created by Admin on 25/01/2018.
// Copyright © 2018 MHT. All rights reserved.
//
import UIKit
class TemplateTextLable: UILabel {
var wordSpace = CGFloat(0)
var lineSpace = CGFloat(0)
// 文字区域
// override func drawText(in rect: CGRect) {
// super.drawText(in: rect)
// super.drawText(in: UIEdgeInsetsInsetRect(rect, UIEdgeInsets.init(top: 0, left: padding, bottom: 0, right: padding)))
// }
// UILabel的内容区域
// override func textRect(forBounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect {
// let insets = UIEdgeInsets.init(top: 0, left: padding, bottom: 0, right: padding)
// var rect = super.textRect(forBounds: UIEdgeInsetsInsetRect(bounds, insets), limitedToNumberOfLines: numberOfLines)
// rect.origin.x -= insets.left
// rect.origin.y -= insets.top
// rect.size.width += (insets.left + insets.right)
// rect.size.height += (insets.top + insets.bottom)
// var rect = super.textRect(forBounds: forBounds, limitedToNumberOfLines: numberOfLines)
// return rect
// }
}
| [
-1
] |
513084db4d97494fc1ee38a7a4c266932fd9c80d | 8b9e2f195121a1a55d9c1d35bbeea15b19249234 | /meal_start/AppDelegate.swift | 4e9b8444aad3e090b1d7395e03496952accb7ee7 | [] | no_license | ZeranLatte/meal_start | a6cb795c1406d6f7dd8d4b8ea1902379537440db | 153c7d8d2211771a399b42c5ff9d9ed863159630 | refs/heads/master | 2021-01-20T20:08:53.245224 | 2016-08-01T06:48:47 | 2016-08-01T06:48:47 | 64,556,183 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,252 | swift | //
// AppDelegate.swift
// meal_start
//
// Created by ZZZZeran on 10/17/15.
// Copyright © 2015 Z Latte. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Enable IQKeyboard Manager
// IQKeyboardManager.sharedManager().enable = true
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
278542,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
278564,
229415,
229417,
327722,
237613,
229426,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
131209,
303241,
417930,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
286922,
286924,
286926,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
229622,
327930,
278781,
278783,
278785,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
155966,
278849,
319809,
319810,
319814,
319818,
311628,
287054,
319822,
278865,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
279010,
287202,
279015,
172520,
279020,
279023,
311791,
172529,
279027,
319989,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
172552,
303623,
320007,
279051,
172558,
279055,
279058,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
279124,
172634,
262752,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
295538,
189044,
172660,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
287381,
311957,
221850,
287386,
164509,
287390,
295583,
303773,
230045,
287394,
303780,
287398,
287400,
279208,
172714,
279212,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
279231,
287423,
328384,
287427,
107208,
279241,
107212,
172748,
287436,
287440,
295633,
172755,
303827,
279255,
279258,
303835,
213724,
189149,
303838,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
279383,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295808,
304005,
213895,
320391,
304007,
304009,
304011,
304013,
213902,
279438,
295822,
295825,
304019,
279445,
58262,
279452,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
304063,
238528,
304065,
189378,
213954,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
304164,
189479,
238641,
238652,
238655,
230465,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
402518,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
279750,
230600,
230607,
148690,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
214294,
320792,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
312639,
296255,
296259,
378181,
230727,
238919,
320840,
222545,
230739,
337244,
222556,
230752,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
279929,
181626,
304506,
181631,
312711,
312712,
296331,
288140,
230800,
288144,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
288236,
288238,
288240,
291754,
288242,
296435,
288244,
296439,
288250,
402942,
206336,
296450,
230916,
230919,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
280264,
206536,
206539,
206541,
206543,
280276,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
419570,
321266,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280458,
280464,
124817,
280468,
239510,
280473,
124827,
247709,
214944,
280487,
313258,
296883,
124853,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
223303,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
223327,
149599,
321634,
149603,
280681,
313451,
223341,
280687,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
354653,
313700,
280937,
313705,
280940,
190832,
280946,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338532,
281190,
199273,
281196,
158317,
313973,
281210,
158347,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
314029,
314033,
240309,
314047,
314051,
199364,
297671,
199367,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
322310,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
289593,
281401,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207737,
183172,
240519,
322440,
338823,
314249,
183184,
289687,
240535,
297883,
289694,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322610,
314421,
281654,
314427,
207937,
314433,
207949,
322642,
281691,
314461,
281702,
281704,
281708,
281711,
289912,
248995,
306341,
306347,
306354,
142531,
199877,
289991,
306377,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
363802,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
314714,
224603,
159068,
314718,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
298377,
314763,
224657,
306581,
314779,
314785,
282025,
314793,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
175621,
192008,
323084,
282127,
290321,
282130,
282133,
290325,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
224875,
241260,
257658,
315016,
282249,
290445,
324757,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
315184,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
307012,
315211,
307027,
315221,
282454,
315223,
241496,
241498,
307035,
307040,
282465,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
44948,
298901,
241556,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
282547,
241588,
241590,
241592,
241598,
290751,
241600,
241605,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
217179,
315483,
192605,
200801,
299105,
217188,
299109,
307303,
315495,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
307370,
307372,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
307394,
307396,
184518,
323784,
307409,
307411,
176343,
233701,
307432,
282881,
282893,
291089,
282906,
291104,
233766,
307508,
315701,
307510,
332086,
151864,
307512,
307515,
282942,
307518,
151874,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127431,
283080,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
291323,
233979,
291330,
283142,
127497,
233994,
135689,
234003,
234006,
152087,
127511,
283161,
242202,
234010,
135707,
242206,
242208,
291361,
291378,
234038,
152118,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
299720,
299723,
225998,
299726,
226002,
226005,
119509,
226008,
201444,
283368,
234219,
283372,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
234356,
234358,
234362,
234368,
234370,
201603,
234373,
226182,
234375,
226185,
234379,
234384,
234388,
234390,
226200,
324504,
234393,
209818,
308123,
324508,
234398,
234396,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
226230,
234422,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
234439,
234434,
234443,
193486,
234446,
193488,
275406,
234449,
316370,
234452,
234455,
234459,
234461,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
316483,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
308379,
283805,
234653,
324766,
119967,
234657,
300189,
324768,
242852,
283813,
234661,
300197,
234664,
275626,
234667,
316596,
308414,
234687,
316610,
300226,
226500,
234692,
300229,
308420,
308418,
283844,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
283904,
300289,
292097,
300292,
300294,
275719,
177419,
300299,
283917,
300301,
242957,
177424,
275725,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
284010,
136562,
324978,
275834,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
259567,
300527,
308720,
226802,
316917,
308727,
300537,
316947,
308757,
284191,
284194,
284196,
235045,
284199,
235047,
284204,
284206,
284209,
284211,
284213,
194103,
284215,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
300628,
284253,
235097,
284255,
300638,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
276098,
292479,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358140,
284413,
358142,
284418,
358146,
317187,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
317221,
227109,
358183,
276268,
300845,
194351,
243504,
284469,
276280,
325436,
276291,
366406,
276295,
153417,
276308,
284502,
317271,
276315,
292700,
284511,
227175,
300912,
284529,
292721,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
276496,
317456,
317458,
243733,
243740,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
235579,
276539,
235581,
178238,
325692,
276544,
284739,
292934,
243785,
276553,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
178273,
227426,
194657,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
227440,
350316,
284786,
350321,
276595,
301167,
350325,
350328,
292985,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
227463,
350345,
350349,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
227522,
350402,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
309462,
301272,
309468,
194780,
309471,
301283,
317672,
276713,
325867,
227571,
309491,
276725,
309494,
243960,
227583,
276735,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
276789,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
317910,
293336,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
301562,
317951,
309764,
301575,
121352,
236043,
342541,
113167,
317971,
277011,
309781,
309779,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
277054,
129603,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
285453,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
301884,
310080,
293696,
277314,
277317,
277322,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
310134,
277368,
15224,
236408,
416639,
416640,
113538,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293820,
203715,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293917,
293939,
277561,
277564,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
236632,
277594,
138332,
277598,
285792,
277601,
310374,
203879,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
392326,
285831,
253064,
302218,
285835,
162964,
384148,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
113964,
285997,
285999,
113969,
277811,
318773,
318776,
277816,
286010,
277822,
417086,
286016,
294211,
302403,
277832,
384328,
277836,
326991,
277839,
277850,
179547,
277853,
146784,
277857,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
277888,
310657,
351619,
294276,
277892,
310659,
327046,
253320,
310665,
318858,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
277923,
130468,
228776,
277932,
310703,
277937,
310710,
130486,
310712,
310715,
302526,
228799,
277953,
64966,
245191,
163272,
277959,
302534,
310727,
302541,
277966,
302543,
310737,
277975,
286169,
228825,
163290,
310749,
277981,
310755,
277989,
187880,
310764,
286188,
278003,
310772,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
65038,
302614,
286233,
302617,
146977,
187939,
294435,
286246,
294439,
286248,
278057,
294440,
294443,
294445,
310831,
212538,
40507,
228933,
286283,
40525,
212560,
228944,
400976,
147032,
40537,
40539,
278109,
40550,
286312,
286313,
40554,
310892,
40557,
294521,
343679,
310925,
286354,
278163,
122517,
278168,
327333,
229030,
278188,
278192,
319153,
278196,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
311053,
302862,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
294785,
327554,
40851,
294811,
319390,
294817,
319394,
40865,
311209,
180142,
294831,
188340,
294844,
294847,
393177,
294876,
294879,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
bd14e3b8a5d5b38db6e6a305b3b23984a102ae11 | cdfe487562f8d6e16fd15462b90c721555fdf9e1 | /WormholeX/Carthage/Checkouts/NEKit/src/Socket/AdapterSocket/AdapterSocket.swift | bf9a5f878cf3fb6006e1ac61ab89b160fb196df8 | [
"BSD-3-Clause"
] | permissive | y1024/NetworkExtension | 270d22bc68d9e62830ba44c7c2d2392e9c8d172f | 373c42196549babd2ff7fd4170cd07d0ebff1c1d | refs/heads/master | 2021-08-14T11:35:41.095425 | 2017-11-15T14:43:04 | 2017-11-15T14:43:04 | 110,513,830 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,118 | swift | import Foundation
open class AdapterSocket: NSObject, SocketProtocol, RawTCPSocketDelegate {
open var session: ConnectSession!
open var observer: Observer<AdapterSocketEvent>?
open override var description: String {
return "<\(typeName) host:\(session.host) port:\(session.port))>"
}
internal var _cancelled = false
public var isCancelled: Bool {
return _cancelled
}
/**
Connect to remote according to the `ConnectSession`.
- parameter session: The connect session.
*/
open func openSocketWith(session: ConnectSession) {
guard !isCancelled else {
return
}
self.session = session
observer?.signal(.socketOpened(self, withSession: session))
socket?.delegate = self
_status = .connecting
}
// MARK: SocketProtocol Implementation
/// The underlying TCP socket transmitting data.
open var socket: RawTCPSocketProtocol!
/// The delegate instance.
weak open var delegate: SocketDelegate?
var _status: SocketStatus = .invalid
/// The current connection status of the socket.
public var status: SocketStatus {
return _status
}
open var statusDescription: String {
return "\(status)"
}
public init(observe: Bool = true) {
super.init()
if observe {
observer = ObserverFactory.currentFactory?.getObserverForAdapterSocket(self)
}
}
/**
Read data from the socket.
- warning: This should only be called after the last read is finished, i.e., `delegate?.didReadData()` is called.
*/
open func readData() {
guard !isCancelled else {
return
}
socket?.readData()
}
/**
Send data to remote.
- parameter data: Data to send.
- warning: This should only be called after the last write is finished, i.e., `delegate?.didWriteData()` is called.
*/
open func write(data: Data) {
guard !isCancelled else {
return
}
socket?.write(data: data)
}
/**
Disconnect the socket elegantly.
*/
open func disconnect(becauseOf error: Error? = nil) {
_status = .disconnecting
_cancelled = true
session.disconnected(becauseOf: error, by: .adapter)
observer?.signal(.disconnectCalled(self))
socket?.disconnect()
}
/**
Disconnect the socket immediately.
*/
open func forceDisconnect(becauseOf error: Error? = nil) {
_status = .disconnecting
_cancelled = true
session.disconnected(becauseOf: error, by: .adapter)
observer?.signal(.forceDisconnectCalled(self))
socket?.forceDisconnect()
}
// MARK: RawTCPSocketDelegate Protocol Implementation
/**
The socket did disconnect.
- parameter socket: The socket which did disconnect.
*/
open func didDisconnectWith(socket: RawTCPSocketProtocol) {
_status = .closed
observer?.signal(.disconnected(self))
delegate?.didDisconnectWith(socket: self)
}
/**
The socket did read some data.
- parameter data: The data read from the socket.
- parameter from: The socket where the data is read from.
*/
open func didRead(data: Data, from: RawTCPSocketProtocol) {
observer?.signal(.readData(data, on: self))
}
/**
The socket did send some data.
- parameter data: The data which have been sent to remote (acknowledged). Note this may not be available since the data may be released to save memory.
- parameter by: The socket where the data is sent out.
*/
open func didWrite(data: Data?, by: RawTCPSocketProtocol) {
observer?.signal(.wroteData(data, on: self))
}
/**
The socket did connect to remote.
- parameter socket: The connected socket.
*/
open func didConnectWith(socket: RawTCPSocketProtocol) {
_status = .established
observer?.signal(.connected(self))
delegate?.didConnectWith(adapterSocket: self)
}
}
| [
108118,
108111
] |
d57189600d2dbad751d6d453b2571467c86756bd | 08fad67c454db27cb202ef666c32d3d426a17837 | /WeedAI/Extensions/UIStoryboard+Extensions.swift | dd83bba802401298e6c2ce162716f024b3203c55 | [] | no_license | dazen-lxt/ncsu_iOS | 98fe2b0c97fa07a135360f4e0c5de0fa9fd7d41d | 667cfea728a2be358635648a8c6a6ceab59cc3c0 | refs/heads/master | 2023-01-30T23:20:17.622363 | 2020-12-16T17:35:59 | 2020-12-16T17:35:59 | 313,758,219 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 838 | swift | //
// UIStoryboard+Extensions.swift
// WeedAI
//
// Created by Carlos Muñoz on 10/19/20.
// Copyright © 2020 Carlos Muñoz. All rights reserved.
//
import UIKit
extension UIStoryboard {
func instantiateViewController<T: UIViewController>() -> T {
guard let viewController = self.instantiateViewController(withIdentifier: T.storyboardIdentifier) as? T else {
fatalError("Couldn't instantiate view controller with identifier \(T.storyboardIdentifier) ")
}
return viewController
}
}
protocol StoryboardIdentifiable {
static var storyboardIdentifier: String { get }
}
extension StoryboardIdentifiable where Self: UIViewController {
static var storyboardIdentifier: String {
return String(describing: self)
}
}
extension UIViewController: StoryboardIdentifiable { }
| [
-1
] |
af9d27214515932453ab4798362757445aa85f92 | b87c72d869c115afd9c418cf917d5ac41b0d2a8f | /Swift/ToolsTests/DateExtensionTests.swift | 1e69f3af0a9b4e3f1c2560329c6f4e10019bd4ab | [
"MIT"
] | permissive | ALCoding/JLTools | 7de376e0228c3cb23aa67ff9cce32794a1637abd | c0a3f736e824569af93818b2c930c260a4033443 | refs/heads/master | 2021-04-15T04:13:58.729392 | 2018-03-23T03:54:49 | 2018-03-23T03:54:49 | 126,424,136 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,316 | swift | //
// DateExtensionTests.swift
// Tools
//
// Created by Jalen.He on 2017/7/3.
// Copyright © 2017年 杨方明. All rights reserved.
//
import XCTest
@testable import Tools
class DateExtensionTests: ToolsTests {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
let nowDate = Date.getNowLocalDate()
XCTAssertNotNil(nowDate, "\(nowDate) 获取本地Date失败")
let nowDateString = nowDate.toString(style: .defaultStyle)
XCTAssert(!nowDateString.isEmpty, "\(nowDateString) Date转字符串失败")
let timeInterval = nowDate.timeIntervalSince1970
let past60sec = timeInterval - 50
let pastMin = timeInterval - 50 * 60
let today = timeInterval - (60 * 60 + 10)
let yesterday = timeInterval - (24 * 60 * 60 - 10)
let moreThanYest = timeInterval - 24 * 60 * 60 * 3.0
let thisYear = timeInterval - 24 * 60 * 60 * 90.0
let nextYear = timeInterval - 24 * 60 * 60 * 367.0
var result = Date.distanceTime(with: past60sec)
XCTAssert(result == "刚刚", "\(result) 时间间隔计算失败")
result = Date.distanceTime(with: pastMin)
XCTAssert(result.contains("分钟前"), "\(result) 时间间隔计算失败")
result = Date.distanceTime(with: today)
XCTAssert(result.contains("今天"), "\(result) 时间间隔计算失败")
result = Date.distanceTime(with: yesterday)
XCTAssert(result.contains("昨天"), "\(result) 时间间隔计算失败")
result = Date.distanceTime(with: moreThanYest)
XCTAssert(result.contains("-"), "\(result) 时间间隔计算失败")//
result = Date.distanceTime(with: thisYear)
XCTAssert(result.contains("-"), "\(result) 时间间隔计算失败")
result = Date.distanceTime(with: nextYear)
// XCTAssert(result.contains("--"), "时间间隔计算失败")
}
}
| [
-1
] |
d13dda4a4f0167e710b35377c3576da0df43d803 | c975d96896fa5727c2edc22eb83c1e7ce4734b65 | /ClaweeUI/Common/Utils/ClaweeTimer.swift | 94ef7fd343730193b7751661b7378bb20941c482 | [] | no_license | redmilk/Reusable-UI-Nibs | 852c3d4ac0d10cb6328e662f32416aab8d09b317 | f7d3af155e035a528105aacaa9386d1c0251c54a | refs/heads/main | 2023-03-25T11:57:43.033501 | 2021-03-14T16:03:47 | 2021-03-14T16:03:47 | 346,660,489 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,099 | swift | //
// ClaweeTimer.swift
// Clawee
//
// Created by Roma Bozhenko on 06.10.2020.
// Copyright © 2020 Noisy Miner. All rights reserved.
//
import Foundation
struct Constants {
static let currentSagaVersion = 1
static let timerExpiredLong = "00m:00s"
static let timerExpiredShort = "00:00"
}
final class ClaweeTimer {
private var completion: ((String, Bool?) -> Void)? //(timerLabelText, isExpired?)
private var isShortFormat = false // "0m:10s" OR "0:10"
private(set) var expireTime = Date()
private var loopPeriod: Double = 0 // seconds to add to expireTime
private var currentTime: Date { Date() }
private var timer: Timer?
private var timeDiff: Double {
let diff = expireTime.timeIntervalSince1970 - Date().timeIntervalSince1970
return Double(diff).rounded()
}
private var timerText: String {
.timeStringForExpirationTime(using: timeDiff, isShortFormat: isShortFormat)
}
//MARK: - Public API
func run(tillExpirationDateInMillisecondsSince1970 date: TimeInterval,
timeInterval: Double = 1,
shortTimerFormat: Bool = false,
onTimeChange completion: @escaping ((String, Bool?) -> Void)) {
expireTime = Date(timeIntervalSince1970: date / 1000)
isShortFormat = shortTimerFormat
self.completion = completion
checkExpirationTime()
timer?.invalidate()
timer = nil
timer = Timer.scheduledTimer(timeInterval: timeInterval,
target: self,
selector: #selector(checkExpirationTime),
userInfo: nil,
repeats: true)
}
func countDown(seconds: Double,
timeInterval: Double = 1,
completion: @escaping ((String, Bool?) -> Void)) {
expireTime = Date().addingTimeInterval(seconds)
self.completion = completion
checkCountdownTime()
timer?.invalidate()
timer = nil
timer = Timer.scheduledTimer(timeInterval: timeInterval,
target: self,
selector: #selector(checkCountdownTime),
userInfo: nil,
repeats: true)
}
func loop(expirationTime date: TimeInterval,
loopPeriod: Double,
timeInterval: Double = 1,
shortTimerFormat: Bool = false,
onTimeChange completion: @escaping ((String, Bool?) -> Void)) {
expireTime = Date(timeIntervalSince1970: date / 1000)
isShortFormat = shortTimerFormat
self.completion = completion
self.loopPeriod = loopPeriod
loopTimer()
timer = Timer.scheduledTimer(timeInterval: timeInterval,
target: self,
selector: #selector(loopTimer),
userInfo: nil,
repeats: true)
}
func stopTimer() {
timer?.invalidate()
completion = nil
timer = nil
}
//MARK: - Private API
@objc private func loopTimer() {
guard expireTime >= currentTime else {
expireTime = expireTime.addingTimeInterval(loopPeriod)
completion?(timerText, true)
return
}
completion?(timerText, nil)
}
@objc private func checkExpirationTime() {
guard expireTime > currentTime else {
completion?(isShortFormat ? Constants.timerExpiredShort : Constants.timerExpiredLong, true)
stopTimer()
return
}
completion?(timerText, nil)
}
@objc private func checkCountdownTime() {
guard expireTime >= currentTime else {
completion?("0", true)
stopTimer()
return
}
completion?(timerText, nil)
}
}
| [
-1
] |
f08bfe4939fee40946730b2041e9ada5f18d5ed9 | 31b297ac9ed919df35c4fafe51129232776ef0b1 | /bavarder/Model/UserInformationModel.swift | aa2fa458d1a18df76169b1d96bf60116ac948116 | [] | no_license | aWildRiceHasAppeared/bavader | 21687b2d11bb96cb4d3a6cd53dc50f2103655575 | 7b5f6e8b54c950226c412105bdd8d9b072b02d5c | refs/heads/master | 2020-03-24T01:15:47.009147 | 2018-07-25T16:51:23 | 2018-07-25T16:51:23 | 142,328,581 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 165 | swift | //
// UserInformationModel.swift
// bavarder
//
// Created by Irving Hsu on 5/27/18.
// Copyright © 2018 Irving Hsu. All rights reserved.
//
import Foundation
| [
-1
] |
585d493aab8db6603ba257bfa3c987d9615dbfb7 | 6887fd1d895d0e07a46d30cd587cfe7ffc832d47 | /Wikipedia App/Extensions/UIImageView-Extension.swift | 1cd520f0430ee1d53304e540ebef994d97432351 | [
"MIT"
] | permissive | anil-appface/WikipediaApp | caac4f17406466c8371a543cc8a0fe0e5389f092 | 4c6c637801d61b6067f8564ed2fce65bfa4bac5b | refs/heads/master | 2020-03-24T13:59:06.814896 | 2018-07-29T12:17:30 | 2018-07-29T12:17:30 | 142,756,472 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,228 | swift | //
// UIImageView-Extension.swift
// Wikipedia App
//
// Created by Anil Kumar on 28/07/18.
// Copyright © 2018 Anil Kumar. All rights reserved.
//
import UIKit
import Alamofire
let imageCache = NSCache<NSString, AnyObject>()
extension UIImageView {
func loadImageUsingCache(withUrl urlString : String) {
guard let url = URL(string: urlString) else {
self.image = #imageLiteral(resourceName: "WikiPlaceholderIcon")
return
}
// check cached image
if let cachedImage = imageCache.object(forKey: urlString as NSString) as? UIImage {
self.image = cachedImage
return
}
// if not, download image from url
URLSession.shared.dataTask(with: url, completionHandler: { (data, response, error) in
if error != nil {
print(error!)
return
}
DispatchQueue.main.async {
if let image = UIImage(data: data!) {
imageCache.setObject(image, forKey: urlString as NSString)
self.image = image
}
}
}).resume()
}
}
| [
-1
] |
66b0f41b25b95b4a00e99b78b629b0133697b006 | dd9707d7b563f09e0d018eef9124de8c1cf70270 | /3M Asset Tracking/3M Asset Tracking/Tealium/core/TealiumModulesManager.swift | ce87df8ef2a552475d00c0dc3f0f10821bdb7553 | [] | no_license | arafath348/Tracking | 7201a3e7544de35934bbdb34285430d1a6dd2150 | 09574d04b1a426d996c3415cd075c31e76667db4 | refs/heads/master | 2021-01-25T11:40:42.938462 | 2018-03-01T12:16:51 | 2018-03-01T12:16:51 | 123,420,874 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,143 | swift | //
// TealiumModulesManager.swift
// tealium-swift
//
// Created by Jason Koo on 10/5/16.
// Copyright © 2016 tealium. All rights reserved.
//
// Build 4
import Foundation
/**
Coordinates optional modules with primary Tealium class.
*/
class TealiumModulesManager : NSObject {
weak var queue : DispatchQueue?
var modules = [TealiumModule]()
var isEnabled = true
var modulesRequestingReport = [Weak<TealiumModule>]()
let timeoutMillisecondIncrement = 500
var timeoutMillisecondCurrent = 0
var timeoutMillisecondMax = 10000 // TODO: Make this alterable via config
func setupModulesFrom(config: TealiumConfig) {
let modulesList = config.getModulesList()
let newModules = TealiumModules.allModulesFor(modulesList,
assigningDelegate: self)
self.modules = newModules.prioritized()
}
// MARK:
// MARK: PUBLIC
func update(config:TealiumConfig){
self.modules.removeAll()
enable(config: config)
}
func enable(config: TealiumConfig) {
self.setupModulesFrom(config: config)
self.queue = config.dispatchQueue()
let request = TealiumEnableRequest(config: config)
self.modules.first?.handle(request)
}
func disable() {
isEnabled = false
let request = TealiumDisableRequest()
self.modules.first?.handle(request)
}
func getModule(forName: String) -> TealiumModule? {
return modules.first(where: { type(of:$0).moduleConfig().name == forName})
}
func allModulesReady() -> Bool {
for module in modules {
if module.isEnabled == false {
return false
}
}
return true
}
func modulesNotReady(_ modules: [TealiumModule]) -> [TealiumModule] {
var result = [TealiumModule]()
for module in modules {
if module.isEnabled == false {
result.append(module)
}
}
return result
}
func track(_ track: TealiumTrackRequest) {
guard let firstModule = modules.first else {
track.completion?(false, nil, TealiumModulesManagerError.noModules)
return
}
if isEnabled == false {
track.completion?(false, nil, TealiumModulesManagerError.isDisabled)
return
}
let notReady = modulesNotReady(modules)
if notReady.isEmpty == false {
timeoutMillisecondCurrent += timeoutMillisecondIncrement
// TODO: queue events instead of dropping
if timeoutMillisecondCurrent >= timeoutMillisecondMax {
print("*** Track call dropped: Tealium library module(s) not ready in time: \(notReady). Try making call at a later time.")
return
}
let delay = DispatchTime.now() + .milliseconds(timeoutMillisecondCurrent)
queue?.asyncAfter(deadline: delay, execute: {
// Put call into end of queue until all modules ready.
self.track(track)
})
return
}
self.timeoutMillisecondCurrent = 0 // reset
firstModule.handle(track)
}
// MARK:
// MARK: INTERNAL
internal func reportToModules(_ modules: [Weak<TealiumModule>],
request: TealiumRequest) {
for moduleRef in modules {
guard let module = moduleRef.value else {
// Module has been dereferenced
continue
}
module.handleReport(request)
}
}
}
// MARK:
// MARK: TEALIUM MODULE DELEGATE
extension TealiumModulesManager : TealiumModuleDelegate {
func tealiumModuleFinished(module: TealiumModule,
process: TealiumRequest) {
guard let nextModule = modules.next(after: module) else {
// If enable call set isEnable
if let _ = process as? TealiumEnableRequest {
self.isEnabled = true
}
// Last module has finished processing
reportToModules(modulesRequestingReport,
request: process)
return
}
nextModule.handle(process)
}
func tealiumModuleRequests(module: TealiumModule,
process: TealiumRequest) {
// Module wants to be notified when last module has finished processing
// any requests.
if let _ = process as? TealiumReportNotificationsRequest {
let existingRequestModule = modulesRequestingReport.filter{ $0.value == module }
if existingRequestModule.count == 0 {
modulesRequestingReport.append(Weak(value:module))
}
return
}
// Module wants to notify any listening modules of status.
if let process = process as? TealiumReportRequest {
reportToModules(modulesRequestingReport,
request: process)
return
}
if let track = process as? TealiumTrackRequest {
self.track(track)
return
}
if let enable = process as? TealiumEnableRequest {
self.enable(config: enable.config)
return
}
if let _ = process as? TealiumDisableRequest {
self.disable()
return
}
if isEnabled == false {
return
}
// Pass request to other modules - Regular behavior
modules.first?.handle(process)
}
}
// MARK:
// MARK: MODULEMANAGER EXTENSIONS
extension Array where Element : TealiumModule {
/**
Convenience for sorting Arrays of TealiumModules by priority number: Lower numbers going first.
*/
func prioritized() -> [TealiumModule] {
return self.sorted{
type(of:$0).moduleConfig().priority < type(of:$1).moduleConfig().priority
}
}
/// Get all existing module names, in current order
///
/// - Returns: Array of module names.
func moduleNames() -> [String] {
return self.map { type(of:$0).moduleConfig().name }
}
}
extension Array where Element: Equatable {
/**
Convenience for getting the next object in a given array.
*/
func next(after:Element) -> Element? {
for i in 0..<self.count {
let object = self[i]
if object == after {
if i + 1 < self.count {
return self[i+1]
}
}
}
return nil
}
}
| [
-1
] |
45d6fa0ef7d949e593da2381f3d82d18c384f061 | b74fe09acba2029cc94cdf70bba829cda42d81df | /UIKit Fundamentals/RoShamBo/RoShamBo/ResultsViewController.swift | 5cea83de8439cba69d26a2ff8dae9039cd218c47 | [] | no_license | ajczerwinski/Udacity-iOS | 839c67a59b6bcb63442db1d45e2e8c83157bdcc9 | d223edbe9feab56a19ad7c5f28204ee9ea442313 | refs/heads/master | 2020-04-15T15:23:11.344581 | 2016-05-26T04:11:40 | 2016-05-26T04:11:40 | 52,648,929 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,250 | swift | //
// ResultsViewController.swift
// RoShamBo
//
// Created by Allen Czerwinski on 3/3/16.
// Copyright © 2016 Allen Czerwinski. All rights reserved.
//
import Foundation
import UIKit
class ResultsViewController: UIViewController {
var playerRoShamBoChoice: String!
var opponentRoShamBoChoice: String!
@IBOutlet weak var gameResultImage: UIImageView!
@IBOutlet weak var gameResultText: UILabel!
override func viewWillAppear(animated: Bool) {
if opponentRoShamBoChoice == "Rock" {
if playerRoShamBoChoice == "Rock" {
self.gameResultImage.image = UIImage(named: "itsATie")
self.gameResultText.text = "It's a tie!"
} else if self.playerRoShamBoChoice == "Paper" {
self.gameResultImage.image = UIImage(named: "PaperCoversRock")
self.gameResultText.text = "Paper covers Rock, you win!"
} else {
self.gameResultImage.image = UIImage(named: "RockCrushesScissors")
self.gameResultText.text = "Rock crushes Scissors, you lose!"
}
}
switch(playerRoShamBoChoice) {
case "Rock":
if opponentRoShamBoChoice == "Rock" {
self.gameResultImage.image = UIImage(named: "itsATie")
self.gameResultText.text = "It's a tie!"
} else if opponentRoShamBoChoice == "Paper" {
self.gameResultImage.image = UIImage(named: "PaperCoversRock")
self.gameResultText.text = "Paper covers Rock, you lose!"
} else {
self.gameResultImage.image = UIImage(named: "RockCrushesScissors")
self.gameResultText.text = "Rock crushes Scissors, you win!"
}
case "Paper":
if opponentRoShamBoChoice == "Rock" {
self.gameResultImage.image = UIImage(named: "PaperCoversRock")
self.gameResultText.text = "Paper covers Rock, you win!"
} else if opponentRoShamBoChoice == "Paper" {
self.gameResultImage.image = UIImage(named: "itsATie")
self.gameResultText.text = "It's a tie!"
} else {
self.gameResultImage.image = UIImage(named: "ScissorsCutPaper")
self.gameResultText.text = "Scissors cut Paper, you lose!"
}
case "Scissors":
if opponentRoShamBoChoice == "Rock" {
self.gameResultImage.image = UIImage(named: "RockCrushesScissors")
self.gameResultText.text = "Rock crushes Scissors, you lose!"
} else if opponentRoShamBoChoice == "Paper" {
self.gameResultImage.image = UIImage(named: "ScissorsCutPaper")
self.gameResultText.text = "Scissors cut Paper, you win!"
} else {
self.gameResultImage.image = UIImage(named: "itsATie")
self.gameResultText.text = "It's a tie!"
}
default:
print("Looks like nobody wins because yours truly messed something up")
}
}
@IBAction func playAgain() {
self.dismissViewControllerAnimated(true, completion: nil)
}
} | [
-1
] |
22002c19eaa957a0f0a3551ba5337d983391c4dd | 93fd8ce1d80cd012e99277c0440b01dbfff698f6 | /TechBaseVN/Utilities/CustomImageView.swift | b254618275bdbf8065f53614d55d843acdeeb172 | [] | no_license | onggiahuy97/Fetching-Images | 814244ef0b62bb0eb913e28331a6e345c2ca99b3 | 1637ef96fe4177cb4be085555aeb1aa1ba082c1c | refs/heads/main | 2023-04-18T16:48:46.796348 | 2021-05-06T20:37:19 | 2021-05-06T20:37:19 | 365,031,384 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,212 | swift | //
// CustomImageView.swift
// TechBaseVN
//
// Created by Huy Ong on 4/29/21.
//
import UIKit
var imageCache = [String: UIImage]()
class CustomeImageView: UIImageView {
var lastURLUsedToLoadImage: String?
func loadImage(urlString: String) {
lastURLUsedToLoadImage = urlString
self.image = nil
if let cachedImage = imageCache[urlString] {
self.image = cachedImage
return
}
guard let url = URL(string: urlString) else { return }
URLSession.shared.dataTask(with: url) { data, res, error in
if let error = error {
fatalError("Failed to fetch image: \(error)")
}
if url.absoluteString != self.lastURLUsedToLoadImage {
return
}
guard let imageData = data else { return }
let photoImage = UIImage(data: imageData)
imageCache[url.absoluteString] = photoImage
DispatchQueue.main.async {
self.image = photoImage
}
}
.resume()
}
}
| [
-1
] |
9a41b56ccd4a9b08cd9d81c204d8bb66bd2b9d4b | 0a72cace2bdb4a2128d53bc7e88f8224f8a27e6e | /socialapp/CreateVC.swift | fd3c9c49079aefd596536bbfeb8765fd25f27fc1 | [] | no_license | cowpro/socialapp | 20e07cf626ff2f02d1237a128735fa53133cacb9 | 48e4c911b92425875801777de153cf1fa6be1b56 | refs/heads/master | 2020-06-01T06:58:44.679641 | 2019-09-22T03:03:47 | 2019-09-22T03:03:47 | 190,689,122 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,193 | swift | //
// CreateVC.swift
// socialapp
//
// Created by Kian Chakamian on 6/7/19.
// Copyright © 2019 Kian Chakamian. All rights reserved.
//
import UIKit
import Firebase
class CreateVC: UIViewController, UITextViewDelegate {
@IBOutlet weak var userImgView: UIImageView!
@IBOutlet weak var captext: UITextView!
var imagePicker: UIImagePickerController!
var selectedImage: UIImage!
override func viewDidLoad() {
super.viewDidLoad()
self.hideKeyboardWhenTappedAround()
imagePicker = UIImagePickerController()
imagePicker.allowsEditing = true
imagePicker.delegate = self as UIImagePickerControllerDelegate & UINavigationControllerDelegate
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(false)
userImgView.image = selectedImage
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
self.view.endEditing(true)
return false
}
@IBAction func getPhoto(_ sender: AnyObject) {
present(imagePicker, animated: true, completion: nil)
}
@IBAction func createPost(_ sender: Any) {
uploadToFirebase()
performSegue(withIdentifier: "backToFeed", sender: self)
}
func uploadToFirebase() {
let userUid = Auth.auth().currentUser!.uid
let ref = Database.database().reference(withPath: "/users/\(userUid)/")
ref.observeSingleEvent(of: .value, with: { (snapshot) in
let value = snapshot.value as! NSDictionary
let postID = value["currentPostNumber"] as! Int
if let data = self.userImgView.image!.jpegData(compressionQuality: 0.2) {
let storageRef = Storage.storage().reference(withPath: "/posts/\(String(describing: userUid))/\(postID).jpeg")
let uploadMetadata = StorageMetadata()
uploadMetadata.contentType = "imgage/jpeg"
storageRef.putData(data, metadata: uploadMetadata) { (metadata, error) in
let userData = [
"caption": self.captext.text as String,
"userImg": "/posts/\(String(describing: userUid))/\(postID).jpeg" as String,
"likes": 0,
"ID": "\(userUid)",
"likedBy": [""]
] as [String : AnyObject]
Database.database().reference().child("posts").child("\(String(describing: userUid))").child("\(postID)").setValue(userData)
}
}
ref.updateChildValues([
"currentPostNumber": postID + 1
])
})
}
}
extension CreateVC: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
internal func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[.originalImage] as? UIImage {
userImgView.image = image
selectedImage = image
} else {
print("Image wasn't selected!")
}
imagePicker.dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
63d68b364ddeb6ac00d1c567474dd2a28d877c5d | 5f501ef81415cbfdc1ad6bad923d07ae63c84b56 | /Sources/LoxInterpreter/Evaluator.swift | daa976bdac43e504c2ce15e6c9b114bab1d9b228 | [] | no_license | dheale/SwiftLox | f6b90c34ca89de81dba24cf0a152f851585092e6 | a335faa110ae53beab97b5bd533b7cb08d0679da | refs/heads/master | 2020-04-22T07:12:20.679095 | 2019-03-05T21:25:25 | 2019-03-05T21:25:25 | 170,212,569 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,356 | swift | //
// Evaluator.swift
// LoxFramework
//
// Created by Dominic Heale on 26/09/2018.
// Copyright © 2018 Dominic Heale. All rights reserved.
//
import Foundation
extension ResolvedExpression {
func evaluated(_ environment: Environment) throws -> Literal {
switch self {
case .literal(let l):
return l
case .unary(let op, let expr):
let right = try expr.evaluated(environment)
switch op.type {
case .bang:
return .bool(!right.isTruthy)
case .minus:
guard case let .number(rightNumber) = right
else { throw RuntimeError(token: op, message: "Operand must be a number.") }
return .number(-rightNumber)
default: throw RuntimeError(token: op, message: "Unexpected unary operation.")
}
case .binary(let left, let op, let right):
let lhs = try left.evaluated(environment)
let rhs = try right.evaluated(environment)
/// Deal with two numbers
if case let .number(leftNumber) = lhs,
case let .number(rightNumber) = rhs {
switch op.type {
case .plus:
return .number(leftNumber + rightNumber)
case .minus:
return .number(leftNumber - rightNumber)
case .slash:
return .number(leftNumber / rightNumber)
case .star:
return .number(leftNumber * rightNumber)
case .greater:
return .bool(leftNumber > rightNumber)
case .greaterEqual:
return .bool(leftNumber >= rightNumber)
case .less:
return .bool(leftNumber < rightNumber)
case .lessEqual:
return .bool(leftNumber <= rightNumber)
default: break
}
}
/// Deal with two strings, only concatenation is supported
if case let .string(leftString) = lhs,
case let .string(rightString) = rhs,
case .plus = op.type {
return .string(leftString + rightString)
}
switch op.type {
case .bangEqual: return .bool(lhs != rhs)
case .equalEqual: return .bool(lhs == rhs)
// By the time we got here, all correct binary operators with correct value
// types are handled. Next handle correct operators with incorrect types.
case .plus:
throw RuntimeError(token: op, message: "Operands must be two numbers or two strings.")
case .minus, .slash, .star, .greater, .greaterEqual, .less, .lessEqual:
throw RuntimeError(token: op, message: "Operands must be numbers.")
default: break
}
fatalError()
case .grouping(let expression):
return try expression.evaluated(environment)
case let .variable(name, depth):
return try environment.get(name: name, depth: depth)
case let .assign(name, expression, depth):
let value = try expression.evaluated(environment)
try environment.assign(name: name, value: value, depth: depth)
return value
case .logical(let leftExpression, let `operator`, let rightExpression):
let leftValue = try leftExpression.evaluated(environment)
if `operator`.isType(.or) {
if leftValue.isTruthy { return leftValue }
} else {
if !leftValue.isTruthy { return leftValue }
}
return try rightExpression.evaluated(environment)
case .call(let callee, let paren, let arguments):
let calleeValue = try callee.evaluated(environment)
let argumentValues: [Literal] = try arguments.map {
try $0.evaluated(environment)
}
guard let callable = calleeValue.callable(environment) else {
throw RuntimeError(token: paren,
message: "Can only call functions and classes.")
}
guard callable.arity == argumentValues.count else {
throw RuntimeError(token: nil,
message: "Expected \(callable.arity) arguments but got \(argumentValues.count).") // at [line \(paren.lineNumber)]
}
do {
return try callable.call(argumentValues)
}
catch let `return` as ReturnValue {
return `return`.value
}
case let .lambda(definition):
return .function(UserFunction(definition: definition,
env: environment,
isInitializer: false,
description: "Unnamed function"))
case let .get(object, name):
let object = try object.evaluated(environment)
guard case let .instance(instance) = object else {
throw RuntimeError(token: name,
message: "Only instances have properties.")
}
return try instance.get(name)
case let .set(object: object, name: name, value: value):
let object = try object.evaluated(environment)
guard case let .instance(instance) = object else {
throw RuntimeError(token: name,
message: "Only instances have fields.")
}
let v = try value.evaluated(environment)
instance.set(name, v)
return v
case .this(let name, let depth):
return try environment.get(name: name, depth: depth)
case let .super(_, method, depth):
guard case let .class(superclass) = try environment.get(name: "super",
depth: depth)
else { fatalError("Got a non-class for 'super'.") }
guard case let .instance(object) = try environment.get(name: "this",
depth: depth - 1)
else { fatalError("Got a non-object for 'this'.") }
guard let mtd = superclass.find(instance: object, method: method.lexeme) else {
throw RuntimeError(token: nil,
message: "Undefined property '\(method.lexeme)'.")
}
return .function(mtd)
}
}
}
extension Literal {
func callable(_ env: Environment) -> Callable? {
switch self {
case let .function(f):
return f as Callable
case let .class(c):
return c as Callable
default:
return nil
}
}
}
| [
-1
] |
ce87b51b089943e126d509f951d7d142d4644eb7 | 6f3fdee30db43af36fac59e235008af427724495 | /DemoApp/ApiHelper/ApiHelper.swift | 1b1abbb3932df2b32d0b353698387a1b00d0fce9 | [] | no_license | anilkumar1392/DemoApp-Using-Dynamic-Coding-Keys- | 87a8624f8df9f15c62cbcd679c37b4d9f11c4285 | 66d972b420fea83443afc5d293dec8ace4ee11e8 | refs/heads/main | 2023-07-18T06:05:52.630285 | 2021-09-03T13:51:20 | 2021-09-03T13:51:20 | 402,749,218 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,386 | swift | //
// ApiHelper.swift
// DemoApp
//
// Created by mac on 04/07/21.
//
import Foundation
class UserList : UsersService{
var serviceHelper = ServiceHelper()
func getUsers(onComplition : @escaping ([User]?) -> Void){
serviceHelper.request(param: [:], methodType: .get, apiName: kUsersApi, complition: { (result) in
switch result{
case .success(let data):
do {
let result = try JSONDecoder().decode([User].self, from: data as! Data)
onComplition(result)
} catch {
onComplition(nil)
}
case .failure(let error):
print("Something went wrong \(error)")
}
})
}
func getKeeprs(onComplition : @escaping ([KeeperArray]?) -> Void){
serviceHelper.request(param: [:], methodType: .get, apiName: kKeeperApi, complition: { (result) in
switch result{
case .success(let data):
do {
let result = try JSONDecoder().decode(KeeperModel.self, from: data as! Data)
onComplition(result.keeperArr)
} catch {
onComplition(nil)
}
case .failure(let error):
print("Something went wrong \(error)")
}
})
}
}
| [
-1
] |
3af26500c1fef1a63f4ee6c8350c3a79425e8421 | c7d4b45e926e4fec57b8ae957aefc4cb6efc15cc | /iOS Playground/AppDelegate.swift | c87a2fec280a537d63be480c725b14ff8bdbf3fa | [] | no_license | Catboy96/iOS-Playground | e9dfc992daaec61bdf16a806b35a60b5dcbd0518 | 0b7f56e6a1427b5a4e2eb1bba8e0aef0226a9483 | refs/heads/master | 2020-04-04T15:59:10.036857 | 2018-11-05T02:55:49 | 2018-11-05T02:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,176 | swift | //
// AppDelegate.swift
// iOS Playground
//
// Created by 任子晨 on 2018/11/4.
// Copyright © 2018 Ralf Ren. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
325624,
350200,
276472,
317435,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
277804,
384302,
285999,
285997,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
bc7b3e15a10a466805db701b602284955bc56f0e | 94cbf3e2569f31e236ebaae56cc92f16d0dc60cb | /SocketDemo/SocketDemoTests/SocketDemoTests.swift | 74b4f31212c1586d3b63f5709369b5558740c918 | [
"Apache-2.0"
] | permissive | madaoCN/WebsocketDemo | f60b9a453d0a30d48460522aa98d1ce828ea0099 | 61b26bf8a4a0ccd713792a40fa5352553a0f76c9 | refs/heads/master | 2020-07-24T07:07:34.136519 | 2020-03-31T07:44:40 | 2020-03-31T07:46:39 | 207,839,675 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 908 | swift | //
// SocketDemoTests.swift
// SocketDemoTests
//
// Created by 梁宪松 on 2019/9/12.
// Copyright © 2019 madao. All rights reserved.
//
import XCTest
@testable import SocketDemo
class SocketDemoTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
229413,
204840,
344107,
155694,
319542,
229430,
163896,
180280,
376894,
352326,
196691,
385116,
237663,
254048,
319591,
221290,
319598,
204916,
131191,
196760,
426138,
173,
377009,
180408,
295098,
417988,
417994,
139479,
229597,
311519,
205035,
327929,
344313,
147717,
368905,
180493,
254226,
368916,
262421,
377114,
237856,
237857,
311597,
98610,
180535,
336183,
344401,
377169,
368981,
155990,
368984,
98657,
270701,
270706,
139640,
246137,
311685,
106888,
385417,
311691,
385422,
213403,
385454,
311727,
377264,
311738,
33211,
336320,
311745,
254406,
188871,
328152,
369116,
287198,
319981,
254456,
377338,
377343,
254465,
139792,
303636,
393751,
377376,
377386,
197167,
385588,
115270,
385615,
426576,
369235,
139872,
139892,
344696,
287352,
311941,
336518,
311945,
369289,
344715,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
205487,
303793,
336564,
287417,
287422,
377539,
164560,
385747,
361176,
418520,
287452,
246503,
369385,
312052,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
426774,
197399,
426775,
197411,
295724,
353069,
197422,
353070,
164656,
295729,
353078,
197431,
336702,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
246641,
246643,
295798,
361337,
254850,
369538,
295824,
353195,
140204,
377772,
304051,
230332,
377790,
353215,
353216,
213957,
345033,
386006,
418776,
50143,
123881,
271350,
295927,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
320527,
238610,
418837,
140310,
320536,
369701,
345132,
238639,
312373,
238651,
361535,
214086,
377926,
353367,
156765,
361566,
304222,
173166,
377972,
377983,
402565,
386189,
238743,
238765,
238769,
402613,
353479,
353480,
353481,
353482,
402634,
189653,
419029,
148696,
296153,
304351,
222440,
328940,
353523,
353524,
386294,
386301,
320770,
386306,
328971,
353551,
320796,
222494,
353584,
345396,
386359,
378172,
345415,
312648,
337225,
304456,
230729,
238927,
353616,
378209,
386412,
296307,
116084,
337281,
148867,
296329,
304524,
296335,
9619,
370071,
173491,
304564,
353719,
361927,
271843,
296433,
321009,
329225,
296461,
304656,
329232,
370197,
402985,
394794,
288309,
312889,
124485,
288327,
239198,
99938,
345700,
312940,
222832,
247416,
370296,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
337591,
403148,
9936,
9937,
370388,
272085,
345814,
345821,
321247,
321249,
345833,
345834,
67315,
173814,
124669,
288512,
288516,
321302,
345879,
321310,
255776,
247590,
362283,
378668,
296755,
345919,
436031,
403267,
345929,
337745,
18262,
362327,
345951,
362337,
345955,
296806,
313199,
214895,
362352,
182144,
305026,
329622,
337815,
124824,
436131,
313254,
436137,
362417,
124852,
362431,
174019,
214984,
321480,
362443,
329695,
436191,
313319,
354280,
247785,
436205,
362480,
43014,
354316,
313357,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
313416,
436301,
338001,
338003,
280661,
329814,
280675,
321637,
329829,
43110,
280677,
436329,
215164,
215166,
280712,
346271,
436383,
362659,
239793,
125109,
182456,
379071,
149703,
346314,
321745,
387296,
280802,
379106,
346346,
321772,
436470,
125183,
149760,
411906,
125188,
313608,
321800,
125193,
125199,
272658,
125203,
125208,
125217,
338218,
321840,
379186,
125235,
125240,
321860,
182598,
289110,
215385,
354676,
313727,
436608,
362881,
240002,
436611,
395659,
108944,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
289232,
256477,
109042,
174593,
240131,
420369,
207393,
289332,
174648,
338489,
338490,
297560,
436832,
436834,
420463,
346737,
313971,
346740,
420471,
330379,
117396,
346772,
264856,
289434,
346779,
314040,
109241,
363211,
363230,
264928,
330474,
289518,
322291,
363263,
322316,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
289598,
109409,
207727,
330609,
207732,
158593,
240518,
109447,
224145,
355217,
256922,
289690,
240544,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
248796,
347103,
347123,
240630,
257024,
330754,
330763,
248872,
314436,
314448,
339030,
257125,
273515,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
339102,
199839,
429214,
265379,
249002,
306346,
3246,
421048,
339130,
322749,
265412,
290000,
298208,
298212,
298213,
330984,
298221,
298228,
437505,
322824,
257305,
339234,
208164,
372009,
412971,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
314726,
380271,
208244,
314741,
249204,
249205,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
290207,
314783,
314789,
314791,
396711,
396712,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
191981,
372227,
323080,
175639,
388632,
396827,
134686,
355876,
347694,
265798,
265804,
396882,
44635,
396895,
323172,
224883,
314998,
323196,
339584,
298661,
61101,
224946,
110268,
224958,
323264,
274115,
306890,
241361,
241365,
298720,
323331,
339715,
339720,
372496,
323346,
241441,
241442,
339745,
257830,
421672,
216918,
241495,
241528,
339841,
315273,
315274,
372626,
380821,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
315432,
315434,
102445,
233517,
176175,
241716,
241720,
225351,
315465,
307289,
200794,
315487,
356447,
438377,
233589,
266357,
422019,
241808,
323729,
381073,
299174,
241843,
405687,
258239,
389313,
299203,
299209,
372941,
266449,
307435,
438511,
381172,
184575,
381208,
315673,
151839,
233762,
217380,
151847,
332083,
332085,
332089,
241986,
438596,
332101,
323913,
323916,
348492,
323920,
348500,
168281,
332123,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
332167,
242058,
373134,
242078,
315810,
315811,
381347,
340398,
127427,
324039,
373197,
242139,
160225,
242148,
242149,
291311,
291333,
340490,
258581,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
242277,
111208,
184940,
373358,
389745,
209530,
356989,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
381773,
201551,
242529,
349026,
357218,
201577,
308076,
242541,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
349072,
390045,
127902,
185250,
185254,
373687,
373706,
316364,
316405,
349175,
201720,
127992,
357379,
308243,
357414,
300084,
308287,
21569,
218186,
341073,
439384,
300135,
316520,
357486,
316526,
144496,
300150,
291959,
300151,
160891,
300158,
349316,
349318,
373903,
177296,
169104,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
62665,
283852,
283853,
259280,
316627,
333011,
234742,
128251,
316669,
242954,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
193859,
177484,
406861,
259406,
234831,
120148,
374109,
333160,
316787,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
316842,
374191,
300489,
366037,
210390,
210391,
210393,
144867,
54765,
251378,
308723,
300536,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
128587,
333388,
128599,
333408,
374372,
300644,
415338,
243307,
54893,
325231,
333430,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
259781,
333517,
333520,
333523,
325346,
333542,
153319,
325352,
325371,
243472,
366360,
325404,
325410,
399147,
431916,
317232,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
292712,
325484,
423789,
325492,
276341,
341879,
317304,
333688,
112509,
325503,
55167,
333701,
243591,
325515,
317323,
325518,
333722,
350109,
292771,
333735,
415655,
243637,
301008,
153554,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
325674,
243759,
129076,
243767,
358456,
194666,
260207,
432240,
333955,
415881,
104587,
235662,
284826,
333991,
333996,
194782,
301279,
317664,
243962,
375039,
194820,
325905,
334103,
325912,
211235,
432421,
211238,
325931,
358703,
358709,
325968,
366930,
391520,
383332,
383336,
317820,
211326,
317831,
252308,
39324,
121245,
342450,
293303,
293310,
416197,
129483,
342476,
317901,
334290,
342498,
358882,
334309,
391655,
432618,
375276,
416286,
375333,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
416351,
268899,
244327,
39530,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
318130,
383667,
293556,
39614,
318173,
375526,
342762,
342763,
293612,
154359,
432893,
162561,
383754,
310036,
326429,
293664,
326433,
400166,
293672,
318252,
375609,
342847,
252741,
293711,
244568,
244570,
342887,
326505,
269178,
400252,
359298,
359299,
260996,
113542,
392074,
236428,
318364,
310176,
310178,
293800,
236461,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
433174,
252958,
359478,
203830,
359495,
392290,
253029,
318572,
351344,
285814,
392318,
384131,
302216,
326804,
351390,
253099,
253100,
318639,
367799,
113850,
294074,
302274,
367810,
244940,
195808,
310497,
302325,
261377,
318733,
253216,
261425,
351537,
286013,
146762,
294218,
294219,
318805,
425304,
163175,
327024,
318848,
253317,
384393,
368011,
318864,
318868,
212375,
212382,
310692,
245161,
286129,
286132,
228795,
425405,
302531,
425418,
286172,
245223,
343542,
359930,
286202,
302590,
253451,
359950,
146964,
253463,
286244,
245287,
245292,
196164,
179801,
196187,
343647,
310889,
204397,
138863,
188016,
294529,
229001,
188048,
425626,
302754,
40614,
384695,
327358,
319177,
212685,
384720,
302802,
212716,
212717,
360177,
319233,
360195,
286494,
409394,
319288,
319292,
360252,
360264,
376669,
245599,
425825,
425833,
417654,
188292,
327557,
253829,
294807,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
344013,
212942,
24532,
327661,
311281,
311282
] |
037310b4ee67c709915ef6ce4653d0a8f789545e | a64b016955c63333ee20ff34c0dedcce75c84a90 | /MonthlyBudget/Helper.swift | 2aea275a2a2132c528973d521e8b45791c724637 | [] | no_license | andersshv/MoneyBudget | ba913ec5c240d6cbd14e1edb9ed96f4b012d56e4 | 6c6d229c95232b4f48aa57283cf2542e327b485c | refs/heads/master | 2020-12-11T14:44:12.978014 | 2020-03-03T21:31:01 | 2020-03-03T21:31:01 | 233,875,994 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,131 | swift | //
// Helper.swift
// MonthlyBudget
//
// Created by Anders Strand-Holm Vinther on 15/01/2020.
// Copyright © 2020 ashvpps. All rights reserved.
//
import Foundation
func getDaysLeftInMonth() -> Int {
let date = Date()
let year = getYear(date)
let month = getMonth(date)
let daysInMonth = getDaysInMonth(year, month);
let day = getDay(date)
return daysInMonth - Int(day)! + 1
}
func getYear(_ date: Date) -> String {
return String(getDateSplit(date)[0])
}
func getMonth(_ date: Date) -> String {
return String(getDateSplit(date)[1])
}
func getDay(_ date: Date) -> String {
let daysPart = getDateSplit(date)[2]
return String(daysPart.prefix(2));
}
func getDateSplit(_ date: Date) -> [String.SubSequence] {
let dateString = date.description
let dateStringSplit = dateString.split(separator: "-")
return dateStringSplit
}
func getDaysInMonth(_ year: String, _ month: String) -> Int {
let dateComponents = DateComponents(year: Int(year), month: Int(month))
let calendar = Calendar.current
let date = calendar.date(from: dateComponents)!
let range = calendar.range(of: .day, in: .month, for: date)!
let numDays = range.count
return numDays;
}
/******** STORAGE *********/
let amountPerMonth = "amountPerMonth"
func getAmountPerMonth() -> Int {
if let val = getSavedIntValue(amountPerMonth) {
return val
}
return 0
}
func saveAmountPerMonth(amount: Int) {
UserDefaults.standard.set(amount, forKey: amountPerMonth)
}
func getCurrentMonthKey() -> String {
let date = Date()
let year = getYear(date)
let month = getMonth(date)
return year + month
}
func getAmountUsedSoFar() -> Int {
let key = getCurrentMonthKey()
if let postingsJson = getSavedStringValue(key) {
let jsonData = postingsJson.data(using: .utf8)!
let decoder = JSONDecoder()
let postings = try! decoder.decode([Posting].self, from: jsonData)
var amount = 0
for posting in postings {
amount += posting.amount
}
return amount
}
return 0;
}
func saveNewPosting(_ description: String, _ amount: Int) {
let key = getCurrentMonthKey()
var postings = [Posting]()
if let postingsJson = getSavedStringValue(key) {
let jsonData = postingsJson.data(using: .utf8)!
let decoder = JSONDecoder()
postings = try! decoder.decode([Posting].self, from: jsonData)
}
postings.append(Posting(description: description, amount: amount))
let encoder = JSONEncoder()
encoder.outputFormatting = .prettyPrinted
let data = try! encoder.encode(postings)
let jsonString = String(data: data, encoding: .utf8)!
UserDefaults.standard.set(jsonString, forKey: key)
}
func clearMonth() {
let key = getCurrentMonthKey()
UserDefaults.standard.set(nil, forKey: key)
}
func getSavedIntValue(_ key: String) -> Int? {
return UserDefaults.standard.integer(forKey: key)
}
func getSavedStringValue(_ key: String) -> String? {
let val = UserDefaults.standard.string(forKey: key)
return val == "" ? nil : val
}
| [
-1
] |
4f35e1b1282c10d0248389f2025a4c73f020bc7d | 7f3388c7c96a7def7287392fe9344dc89bc997e0 | /posts-library/Data/UserRepository/UserRepository.swift | fe453841398a1fa4c842aea96c6ec70d0f9c1444 | [] | no_license | viniciusromani/posts-library | bf4996722dd639882800a2fa4031915d99a38419 | baaa2ec36f8d494f242e0fd3e05e94e5b727042d | refs/heads/main | 2023-08-16T11:42:24.556937 | 2021-09-22T09:59:09 | 2021-09-22T09:59:09 | 400,038,713 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,610 | swift | import Foundation
import RxSwift
struct UserRepository {
private let cacheRepository: CacheRepository
init(cacheRepository: CacheRepository) {
self.cacheRepository = cacheRepository
}
}
extension UserRepository: UserDataSource {
func retrieveUsersPosts() -> Single<(source: SourceOfDataEntity, response: UsersPostsResponse)> {
let request: UsersPostsRequest = .init()
let chain = RequestManager<UsersPostsResponse>()
.request(request)
.asObservable()
.flatMap { response in
self.cacheRepository.storeUsers(response: response)
.andThen(Observable.just((source: SourceOfDataEntity.api, response: response)))
}
.catch { exception in
guard let _ = exception.asAFError else {
let unknown = UnknownException()
return Observable.error(unknown)
}
return self.cacheRepository.retrieveUsers()
.asObservable()
.map { response -> (source: SourceOfDataEntity, response: UsersPostsResponse) in
let source: SourceOfDataEntity = .cache
let posts = response ?? UsersPostsResponse(data: [])
let tuple = (source: source, response: posts)
return tuple
}
}
.catchAndReturn((source: SourceOfDataEntity.none, response: UsersPostsResponse(data: [])))
.asSingle()
return chain
}
}
| [
-1
] |
a7a820ce890ddaad8e6e9665849a0a08a7a5d37e | fd05ec35a5cf45ba101b072ac7f4eaf6c3de19cc | /TechMaster/SwiftDay16/Tetris/Tetris/AppDelegate.swift | 80f33cbf22e8c5504dba53d18a9d8bc8d07f3764 | [] | no_license | tienhaobv/Learn-IOS-Techmaster | 83be2d609eabc8217981e561229121ad9493ff15 | c04b87d9f95cc56598e9c0e5b2e8f14f953afa01 | refs/heads/master | 2020-05-23T01:20:58.503193 | 2019-09-25T10:18:59 | 2019-09-25T10:18:59 | 186,585,791 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 689 | swift | //
// AppDelegate.swift
// Tetris
//
// Created by apple on 6/13/19.
// Copyright © 2019 Hào. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame: UIScreen.main.bounds)
guard let window = self.window else { fatalError("No Window") }
window.rootViewController = MainScreen()
// Make it visible
window.makeKeyAndVisible()
return true
}
}
| [
351585,
148698,
216333,
142193,
374392,
205848,
105466,
327323
] |
8211e2840f7a652e06beeeeba89aceafb7c81adc | 0022c5ec52f1b5ec63d7be6720b3601e4d56f160 | /EmojiDictionary/Emoji.swift | 710f31506cb8e07c5b36b12ddcc4b8b90dcedf91 | [] | no_license | bleighton/EmojiDictionary | 59c31486e0297335bb957ddf7a2681d228c36d4d | 6107d6360ab9913f810503a9c3d4e3be05772573 | refs/heads/master | 2020-05-31T10:21:47.116632 | 2019-06-06T13:04:48 | 2019-06-06T13:04:48 | 190,239,067 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 364 | swift | import Foundation
//creating Emoji class
class Emoji {
var symbol: String
var name: String
var description: String
var usage: String
init(symbol: String, name: String, description: String,
usage: String) {
self.symbol = symbol
self.name = name
self.description = description
self.usage = usage
}
}
| [
-1
] |
d2462613ea6aefec6d8ce040da02d2b73acfe385 | db64b074fb24a85aeaa4aa2fffb011878b44e4f4 | /toDoList/toDoList/AppDelegate.swift | 8dbf47e9c627a5810c82a26492612180e11afdc0 | [] | no_license | tbatten/CodeAcademy-2018 | 7db31a22b2b15fd9be86689cd65fd3230e64ee7c | fdc191a795f1e0085b341ea3e8f45fe0daf118fa | refs/heads/master | 2020-03-07T04:51:21.041383 | 2018-03-28T14:25:31 | 2018-03-28T14:25:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,245 | swift | //
// AppDelegate.swift
// toDoList
//
// Created by Pravara Kant on 27/01/2018.
// Copyright © 2018 Pravara Kant. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UserDefaults.standard.set("1234", forKey: "Serial nummber")
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
294924,
229388,
229391,
327695,
229394,
229397,
229399,
229402,
278556,
229405,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
280021,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
320998,
288234,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
127447,
299481,
176605,
242143,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
324490,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
235047,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
236056,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
237562
] |
59daf4dc09df3bd2b6b70cf106a1e2b1d2e9e3fa | 8e256eabc3eed47dbdc9b8ca276a18049e7cb4d4 | /Snacktacular/Review.swift | 39098942cbf295ca86e7fa2e0338856bb62e072c | [] | no_license | gallaugher/Snacktacular | 77e3634b47508666793228fb707c5e24fe3921a0 | 3809d1dddb8ddea00872a17ffcd31e2f4c52f6cb | refs/heads/master | 2021-07-10T09:05:38.735183 | 2018-08-13T13:33:49 | 2018-08-13T13:33:49 | 136,680,401 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,752 | swift | //
// Review.swift
// Snacktacular
//
// Created by John Gallaugher on 3/31/18.
// Copyright © 2018 John Gallaugher. All rights reserved.
//
import Foundation
import Firebase
class Review {
var title: String
var text: String
var rating: Int
var reviewerUserID: String
var date: Date
var documentID: String
var dictionary: [String: Any] {
return ["title": title, "text": text, "rating": rating, "reviewerUserID": reviewerUserID, "date": date]
}
init(title: String, text: String, rating: Int, reviewerUserID: String, date: Date, documentID: String) {
self.title = title
self.text = text
self.rating = rating
self.reviewerUserID = reviewerUserID
self.date = date
self.documentID = documentID
}
convenience init(dictionary: [String: Any]) {
let title = dictionary["title"] as! String? ?? ""
let text = dictionary["text"] as! String? ?? ""
let rating = dictionary["rating"] as! Int? ?? 0
let reviewerUserID = dictionary["reviewerUserID"] as! String
let date = dictionary["date"] as! Date? ?? Date()
self.init(title: title, text: text, rating: rating, reviewerUserID: reviewerUserID, date: date, documentID: "")
}
convenience init() {
let currentUserID = Auth.auth().currentUser?.email ?? "Unknown User"
self.init(title: "", text: "", rating: 0, reviewerUserID: currentUserID, date: Date(), documentID: "")
}
func saveData(spot: Spot, completed: @escaping (Bool) -> ()) {
let db = Firestore.firestore()
// Create the dictionary representing the data we want to save
let dataToSave = self.dictionary
// if we HAVE saved a record, we'll have a documentID
if self.documentID != "" {
let ref = db.collection("spots").document(spot.documentID).collection("reviews").document(self.documentID)
ref.setData(dataToSave) { (error) in
if let error = error {
print("*** ERROR: updating document \(self.documentID) in spot \(spot.documentID) \(error.localizedDescription)")
completed(false)
} else {
print("^^^ Document updated with ref ID \(ref.documentID)")
spot.updateAverageRating {
completed(true)
}
}
}
} else {
var ref: DocumentReference? = nil // Let firestore create the new documentID
ref = db.collection("spots").document(spot.documentID).collection("reviews").addDocument(data: dataToSave) { error in
if let error = error {
print("*** ERROR: creating new document in spot \(spot.documentID) for new review documentID \(error.localizedDescription)")
completed(false)
} else {
print("^^^ new document created with ref ID \(ref?.documentID ?? "unknown")")
spot.updateAverageRating {
completed(true)
}
}
}
}
}
func deleteData(spot: Spot, completed: @escaping (Bool) -> ()) {
let db = Firestore.firestore()
db.collection("spots").document(spot.documentID).collection("reviews").document(documentID).delete() { error in
if let error = error {
print("😡 ERROR: deleting review documentID \(self.documentID) \(error.localizedDescription)")
completed(false)
} else {
spot.updateAverageRating {
completed(true)
}
}
}
}
}
| [
-1
] |
62dd14c1e64bed9ac52ef8f0b7402db33c9ec811 | 065e40d8f5b1494b655a7cf8f5ecb20ba06d0b4e | /GameOfThrones/GameOfThrones/GOTEpisdoe.swift | e4ff807c82747da0d0a5b8da2651035979de4680 | [
"MIT"
] | permissive | LubaKaper/Pursuit-Core-iOS-Unit2-Assignment2 | bdf5cfaeebed0d7dd00625e3fc744555d9f26240 | d05ad78e12cb71c3d7c3cd1ff034f022cba75622 | refs/heads/master | 2020-09-13T12:25:42.666392 | 2019-11-23T19:30:17 | 2019-11-23T19:30:17 | 222,778,690 | 0 | 0 | MIT | 2019-11-19T19:59:41 | 2019-11-19T19:59:40 | null | UTF-8 | Swift | false | false | 25,897 | swift | //
// GOTEpisdoe.swift
// GOT-StudentVersion
//
// Created by C4Q on 11/2/17.
// Copyright © 2017 C4Q . All rights reserved.
//
import Foundation
class GOTEpisode {
var airdate: String
var id: Int
var name: String
var number: Int
var season: Int
var runtime: Int
var summary: String
var mediumImageID: String
var originalImageID: String
init(airdate: String, id: Int, name: String, number: Int, season: Int, runtime: Int, summary: String, mediumImageID: String, originalImageID: String) {
self.airdate = airdate
self.id = id
self.name = name
self.number = number
self.season = season
self.runtime = runtime
self.summary = summary
self.mediumImageID = mediumImageID
self.originalImageID = originalImageID
}
static let allEpisodes = [
GOTEpisode(airdate: "2011-04-17", id: 4952, name: "Winter is Coming", number: 1, season: 1, runtime: 60, summary: "Lord Eddard Stark, ruler of the North, is summoned to court by his old friend, King Robert Baratheon, to serve as the King's Hand. Eddard reluctantly agrees after learning of a possible threat to the King's life. Eddard's bastard son Jon Snow must make a painful decision about his own future, while in the distant east Viserys Targaryen plots to reclaim his father's throne, usurped by Robert, by selling his sister in marriage.", mediumImageID: "2668", originalImageID: "2668"),
GOTEpisode(airdate: "2011-04-24", id: 4953, name: "The Kingsroad", number: 2, season: 1, runtime: 60, summary: "An incident on the Kingsroad threatens Eddard and Robert's friendship. Jon and Tyrion travel to the Wall, where they discover that the reality of the Night's Watch may not match the heroic image of it.", mediumImageID: "2669", originalImageID: "2669"),
GOTEpisode(airdate: "2011-05-01", id: 4954, name: "Lord Snow", number: 3, season: 1, runtime: 60, summary: "Jon Snow attempts to find his place amongst the Night's Watch. Eddard and his daughters arrive at King's Landing.", mediumImageID: "2671", originalImageID: "2671"),
GOTEpisode(airdate: "2011-05-08", id: 4955, name: "Cripples, Bastards, and Broken Things", number: 4, season: 1, runtime: 60, summary: "Tyrion stops at Winterfell on his way home and gets a frosty reception from Robb Stark. Eddard's investigation into the death of his predecessor gets underway.", mediumImageID: "2673", originalImageID: "2673"),
GOTEpisode(airdate: "2011-05-15", id: 4956, name: "The Wolf and the Lion", number: 5, season: 1, runtime: 60, summary: "Catelyn's actions on the road have repercussions for Eddard. Tyrion enjoys the dubious hospitality of the Eyrie.", mediumImageID: "2674", originalImageID: "2674"),
GOTEpisode(airdate: "2011-05-22", id: 4957, name: "A Golden Crown", number: 6, season: 1, runtime: 60, summary: "Viserys is increasingly frustrated by the lack of progress towards gaining his crown.", mediumImageID: "2676", originalImageID: "2676"),
GOTEpisode(airdate: "2011-05-29", id: 4958, name: "You Win or You Die", number: 7, season: 1, runtime: 60, summary: "Eddard's investigations in King's Landing reach a climax and a dark secret is revealed.", mediumImageID: "2677", originalImageID: "2677"),
GOTEpisode(airdate: "2011-06-05", id: 4959, name: "The Pointy End", number: 8, season: 1, runtime: 60, summary: "Tyrion joins his father's army with unexpected allies. Events in King's Landing take a turn for the worse as Arya's lessons are put to the test.", mediumImageID: "2678", originalImageID: "2678"),
GOTEpisode(airdate: "2011-06-12", id: 4960, name: "Baelor", number: 9, season: 1, runtime: 60, summary: "Catelyn must negotiate with the irascible Lord Walder Frey.", mediumImageID: "2679", originalImageID: "2679"),
GOTEpisode(airdate: "2011-06-19", id: 4961, name: "Fire and Blood", number: 10, season: 1, runtime: 60, summary: "Daenerys must realize her destiny. Jaime finds himself in an unfamiliar predicament.", mediumImageID: "2681", originalImageID: "2681"),
GOTEpisode(airdate: "2012-04-01", id: 4962, name: "The North Remembers", number: 1, season: 2, runtime: 60, summary: "War grips the continent of Westeros. As Tyrion Lannister tries to take his strong-willed nephew in hand in King's Landing, Stannis Baratheon launches his own campaign to take the Iron Throne with the help of a mysterious priestess. In the east, Daenerys must lead her retinue through a desolate wasteland whilst beyond the Wall the Night's Watch seeks the aid of a wildling.", mediumImageID: "3174", originalImageID: "3174"),
GOTEpisode(airdate: "2012-04-08", id: 4963, name: "The Night Lands", number: 2, season: 2, runtime: 60, summary: "Stannis uses Ser Davos to seek out new allies for his war with the Lannisters. On the road north, Arya confides in Gendry. Robb Stark sends Theon Greyjoy to win an alliance with his father and the fierce warriors of the Iron Islands. Cersei and Tyrion clash on how to rule in King's Landing.", mediumImageID: "3175", originalImageID: "3175"),
GOTEpisode(airdate: "2012-04-15", id: 4964, name: "What is Dead May Never Die", number: 3, season: 2, runtime: 60, summary: "Catelyn Stark treats with King Renly in the hope of winning an alliance. Tyrion undertakes a complex plan in King's Landing to expose an enemy. At Winterfell, Bran's dreams continue to trouble him.", mediumImageID: "3176", originalImageID: "3176"),
GOTEpisode(airdate: "2012-04-22", id: 4965, name: "Garden of Bones", number: 4, season: 2, runtime: 60, summary: "Tyrion attempts to restrain Joffrey's cruelty. Catelyn attempts to broker a peace between Stannis and Renly. Daenerys and her followers arrive at the great city of Qarth and hope to find refuge there. Arya and Gendry arrive at Harrenhal, a great castle now under Lannister occupation.", mediumImageID: "3177", originalImageID: "3177"),
GOTEpisode(airdate: "2012-04-29", id: 4966, name: "The Ghost of Harrenhal", number: 5, season: 2, runtime: 60, summary: "Confusion rages in the Stormlands in the wake of a devastating reversal. Catelyn must flee with a new ally, whilst Littlefinger sees an opportunity in the chaos. Theon seeks to prove himself to his father in battle. Arya receives a promise from the enigmatic Jaqen H'ghar. The Night's Watch arrives at the Fist of the First Men. Daenerys Targaryen receives a marriage proposal.", mediumImageID: "3178", originalImageID: "3178"),
GOTEpisode(airdate: "2012-05-06", id: 4967, name: "The Old Gods and the New", number: 6, season: 2, runtime: 60, summary: "Arya has a surprise visitor; Dany vows to take what is hers; Joffrey meets his subjects; Qhorin gives Jon a chance to prove himself.", mediumImageID: "3180", originalImageID: "3180"),
GOTEpisode(airdate: "2012-05-13", id: 4968, name: "A Man Without Honor", number: 7, season: 2, runtime: 60, summary: "Jaime meets a relative; Theon hunts; Dany receives an invitation.", mediumImageID: "3192", originalImageID: "3192"),
GOTEpisode(airdate: "2012-05-20", id: 4969, name: "The Prince of Winterfell", number: 8, season: 2, runtime: 60, summary: "Theon holds the fort; Arya calls in her debt with Jaqen; Robb is betrayed; Stannis and Davos approach their destination.", mediumImageID: "3194", originalImageID: "3194"),
GOTEpisode(airdate: "2012-05-27", id: 4970, name: "Blackwater", number: 9, season: 2, runtime: 60, summary: "A massive battle rages for control of King's Landing and the Iron Throne.", mediumImageID: "3196", originalImageID: "3196"),
GOTEpisode(airdate: "2012-06-03", id: 4971, name: "Valar Morghulis", number: 10, season: 2, runtime: 60, summary: "Tyrion awakens to a changed situation. King Joffrey doles out rewards to his subjects. As Theon stirs his men to action, Luwin offers some final advice. Brienne silences Jaime; Arya receives a gift from Jaqen; Dany goes to a strange place; Jon proves himself to Qhorin.", mediumImageID: "3197", originalImageID: "3197"),
GOTEpisode(airdate: "2013-03-31", id: 4972, name: "Valar Dohaeris", number: 1, season: 3, runtime: 60, summary: "Jon is brought before Mance Rayder, the King Beyond the Wall, while the Night's Watch survivors retreat south. In King's Landing, Tyrion asks for his reward. Littlefinger offers Sansa a way out. Cersei hosts a dinner for the royal family. Daenerys sails into Slaver's Bay.", mediumImageID: "2628", originalImageID: "2628"),
GOTEpisode(airdate: "2013-04-07", id: 4973, name: "Dark Wings, Dark Words", number: 2, season: 3, runtime: 60, summary: "Sansa (Sophie Turner) says too much. Shae (Sibel Kekilli) asks Tyrion (Peter Dinklage) for a favor. Jaime (Nikolaj Coster-Waldau) finds a way to pass the time. Arya (Maisie Williams) runs into the Brotherhood Without Banners.", mediumImageID: "2618", originalImageID: "2618"),
GOTEpisode(airdate: "2013-04-14", id: 4974, name: "Walk of Punishment", number: 3, season: 3, runtime: 60, summary: "Tyrion shoulders new responsibilities. Jon (Kit Harington) is taken to the Fist of the First Men. Daenerys (Emilia Clarke) meets with the slavers. Jaime strikes a deal with his captors.", mediumImageID: "2616", originalImageID: "2616"),
GOTEpisode(airdate: "2013-04-21", id: 4975, name: "And Now His Watch is Ended", number: 4, season: 3, runtime: 60, summary: "The Night's Watch takes stock. Varys (Conleth Hill) meets his better. Arya is taken to the commander of the Brotherhood. Daenerys exchanges a chain for a Whip.", mediumImageID: "2615", originalImageID: "2615"),
GOTEpisode(airdate: "2013-04-28", id: 4976, name: "Kissed by Fire", number: 5, season: 3, runtime: 60, summary: "The Hound (Rory McCann) is judged by the gods; Jaime is judged by men. Jon proves himself; Robb (Richard Madden) is betrayed. Tyrion learns the cost of weddings.", mediumImageID: "2614", originalImageID: "2614"),
GOTEpisode(airdate: "2013-05-05", id: 4977, name: "The Climb", number: 6, season: 3, runtime: 60, summary: "Tywin (Charles Dance) plans strategic unions for the Lannisters. Melisandre (Carice van Houten) visits the Riverlands. Robb (Richard Madden) weighs a compromise to repair his alliance with House Frey. Roose Bolton (Michael McElhatton) decides what to do with Jaime Lannister (Nikolaj Coster-Waldau). Jon (Kit Harington), Ygritte (Rose Leslie) and the Wildlings face a daunting climb.", mediumImageID: "2612", originalImageID: "2612"),
GOTEpisode(airdate: "2013-05-12", id: 4978, name: "The Bear and the Maiden Fair", number: 7, season: 3, runtime: 60, summary: "Daenerys (Emilia Clarke) exchanges gifts with a slave lord outside Yunkai. As Sansa (Sophie Turner) frets about her prospects, Shae (Sibel Kekilli) chafes at Tyrion's (Peter Dinklage) new situation. Tywin counsels the king, and Melisandre reveals a secret to Gendry (Joe Dempsie). Brienne (Gwendoline Christie) faces a formidable foe in Harrenhal.", mediumImageID: "2611", originalImageID: "2611"),
GOTEpisode(airdate: "2013-05-19", id: 4979, name: "Second Sons", number: 8, season: 3, runtime: 60, summary: "King's Landing hosts a wedding, and Tyrion and Sansa spend the night together. Daenerys meets the Titan's Bastard. Davos (Liam Cunningham) demands proof from Melisandre. Sam (John Bradley) and Gilly (Hannah Murray) meet an older Gentleman.", mediumImageID: "2599", originalImageID: "2599"),
GOTEpisode(airdate: "2013-06-02", id: 4980, name: "The Rains of Castamere", number: 9, season: 3, runtime: 60, summary: "Robb (Richard Madden) presents himself to Walder Frey (David Bradley), and Edmure (Tobias Menzies) meets his bride. Jon (Kit Harington) faces his harshest test yet. Bran (Isaac Hempstead Wright) discovers a new gift. Daario (Ed Skrein) and Jorah (Iain Glen) debate how to take Yunkai. House Frey joins with House Tully.", mediumImageID: "2598", originalImageID: "2598"),
GOTEpisode(airdate: "2013-06-09", id: 4981, name: "Mhysa", number: 10, season: 3, runtime: 60, summary: "Joffrey (Jack Gleeson) challenges Tywin (Charles Dance). Bran tells a ghost story. In Dragonstone, mercy comes from strange quarters. Daenerys (Emilia Clarke) waits to see if she is a conqueror or a liberator.", mediumImageID: "2597", originalImageID: "2597"),
GOTEpisode(airdate: "2014-04-06", id: 4982, name: "Two Swords", number: 1, season: 4, runtime: 60, summary: "Tyrion (Peter Dinklage) welcomes a guest to King's Landing. At Castle Black, Jon Snow (Kit Harington) finds himself unwelcome. Dany (Emilia Clarke) is pointed to Meereen, the mother of all slave cities. Arya (Maisie Williams) runs into an old friend.", mediumImageID: "2583", originalImageID: "2583"),
GOTEpisode(airdate: "2014-04-13", id: 4983, name: "The Lion and the Rose", number: 2, season: 4, runtime: 60, summary: "Tyrion lends Jaime (Nikolaj Coster-Waldau) a hand. Joffrey (Jack Gleeson) and Margaery (Natalie Dormer) host a breakfast. At Dragonstone, Stannis (Stephen Dillane) loses patience with Davos (Liam Cunningham). Ramsay (Iwan Rheon) finds a purpose for his pet. North of the Wall, Bran (Isaac Hempstead Wright) sees where they must go.", mediumImageID: "2584", originalImageID: "2584"),
GOTEpisode(airdate: "2014-04-20", id: 4984, name: "Breaker of Chains", number: 3, season: 4, runtime: 60, summary: "Tyrion ponders his options. Tywin (Charles Dance) extends an olive branch. Sam (John Bradley) realizes Castle Black isn't safe, and Jon proposes a bold plan. The Hound (Rory McCann) teaches Arya the way things are. Dany chooses her Champion.", mediumImageID: "2585", originalImageID: "2585"),
GOTEpisode(airdate: "2014-04-27", id: 4985, name: "Oathkeeper", number: 4, season: 4, runtime: 60, summary: "Dany balances justice and mercy. Jaime tasks Brienne (Gwendoline Christie) with his honor. Jon secures volunteers while Bran, Jojen (Thomas Brodie-Sangster), Meera (Ellie Kendrick) and Hodor (Kristian Nairn) stumble on shelter.", mediumImageID: "2586", originalImageID: "2586"),
GOTEpisode(airdate: "2014-05-04", id: 4986, name: "First of His Name", number: 5, season: 4, runtime: 60, summary: "Cersei (Lena Headey) and Tywin (Charles Dance) plot the Crown's next move. Dany (Emilia Clarke) discusses future plans. Jon (Kit Harington) embarks on a new mission.", mediumImageID: "2587", originalImageID: "2587"),
GOTEpisode(airdate: "2014-05-11", id: 4987, name: "The Laws of Gods and Men", number: 6, season: 4, runtime: 60, summary: "Stannis (Stephen Dillane) and Davos (Liam Cunningham) set sail with a new strategy. Dany meets with supplicants. Tyrion (Peter Dinklage) faces down his father in the throne room.", mediumImageID: "2588", originalImageID: "2588"),
GOTEpisode(airdate: "2014-05-18", id: 4988, name: "Mockingbird", number: 7, season: 4, runtime: 60, summary: "Tyrion enlists an unlikely ally. Daario (Michiel Huisman) entreats Dany to allow him to do what he does best. Jon's warnings about the Wall's vulnerability fall on deaf ears. Brienne (Gwendoline Christie) follows a new lead on the road with Pod (Daniel Portman).", mediumImageID: "2589", originalImageID: "2589"),
GOTEpisode(airdate: "2014-06-01", id: 4989, name: "The Mountain and the Viper", number: 8, season: 4, runtime: 60, summary: "Mole's Town receives unexpected visitors. Littlefinger's (Aidan Gillen) motives are questioned. Ramsay (Iwan Rhoen) attempts to prove himself to his father. Tyrion's (Peter Dinklage) fate is decided.", mediumImageID: "2591", originalImageID: "2591"),
GOTEpisode(airdate: "2014-06-08", id: 4990, name: "The Watchers on the Wall", number: 9, season: 4, runtime: 60, summary: "Jon Snow (Kit Harington) and the rest of the Night's Watch face the biggest challenge to the Wall yet.", mediumImageID: "2593", originalImageID: "2593"),
GOTEpisode(airdate: "2014-06-15", id: 4991, name: "The Children", number: 10, season: 4, runtime: 60, summary: "An unexpected arrival north of the Wall changes circumstances. Dany (Emilia Clarke) is forced to face harsh realities. Bran (Isaac Hempstead Wright) learns more of his destiny. Tyrion sees the truth of his Situation.", mediumImageID: "2594", originalImageID: "2594"),
GOTEpisode(airdate: "2015-04-12", id: 116522, name: "The Wars to Come", number: 1, season: 5, runtime: 60, summary: "In the Season 5 premiere, Varys discusses a conspiracy with Tyrion; Daenerys' rule faces a new threat; Jon finds himself between two kings; and Cersei and Jaime try to move on from Tywin's demise.", mediumImageID: "25988", originalImageID: "25988"),
GOTEpisode(airdate: "2015-04-19", id: 144328, name: "The House of Black and White", number: 2, season: 5, runtime: 60, summary: "Arya arrives in Braavos; Brienne and Podrick find danger while traveling; Cersei worries about Myrcella in Dorne when Ellaria Sand seeks revenge for Oberyn's death; Jon is tempted by Stannis.", mediumImageID: "25989", originalImageID: "25989"),
GOTEpisode(airdate: "2015-04-26", id: 144329, name: "High Sparrow", number: 3, season: 5, runtime: 60, summary: "Cersei meets the High Sparrow after learning of a clergyman's embarrassing tale. Meanwhile, Davos talks to Jon about the future of Winterfell, where Ramsay Snow has just learned the identity of his future bride; Arya grows impatient doing menial tasks in the House of Black and White; and Tyrion searches for more comfortable surroundings on a long trip with Varys.", mediumImageID: "25990", originalImageID: "25990"),
GOTEpisode(airdate: "2015-05-03", id: 144330, name: "Sons of the Harpy", number: 4, season: 5, runtime: 60, summary: "Margaery seeks prudent counsel. Jaime Struggles in foreign lands. Dany answers the Harpy's call.", mediumImageID: "26444", originalImageID: "26444"),
GOTEpisode(airdate: "2015-05-10", id: 151777, name: "Kill the Boy", number: 5, season: 5, runtime: 60, summary: "Dany makes a difficult decision in Meereen. Jon recruits the help of an unexpected ally. Brienne searches for Sansa. Theon remains under Ramsay's control.", mediumImageID: "26819", originalImageID: "26819"),
GOTEpisode(airdate: "2015-05-17", id: 152766, name: "Unbowed, Unbent, Unbroken", number: 6, season: 5, runtime: 60, summary: "Arya trains. Jorah and Tyrion run into slavers. Trystane and Myrcella make plans. Jaime and Bronn reach their destination. The Sand Snakes attack.", mediumImageID: "27259", originalImageID: "27259"),
GOTEpisode(airdate: "2015-05-24", id: 153327, name: "The Gift", number: 7, season: 5, runtime: 60, summary: "Jon prepares for conflict. Sansa tries to talk to Theon. Brienne waits for a sign. Stannis remains stubborn. Jaime attempts to reconnect with family.<br><br>", mediumImageID: "27535", originalImageID: "27535"),
GOTEpisode(airdate: "2015-05-31", id: 155299, name: "Hardhome", number: 8, season: 5, runtime: 60, summary: "Arya makes progress in her training. Sansa confronts an old friend. Cersei struggles. Jon travels.<br><br>", mediumImageID: "28151", originalImageID: "28151"),
GOTEpisode(airdate: "2015-06-07", id: 160040, name: "The Dance of Dragons", number: 9, season: 5, runtime: 60, summary: "Stannis confronts a troubling decision. Jon returns to The Wall. Mace visits the Iron Bank. Arya encounters someone from her past. Dany reluctantly oversees a traditional celebration of athleticism.", mediumImageID: "29160", originalImageID: "29160"),
GOTEpisode(airdate: "2015-06-14", id: 162186, name: "Mother's Mercy", number: 10, season: 5, runtime: 60, summary: "Cersei seeks forgiveness; Jon faces a new challenge; Arya plots to cross a name off her list; Tyrion sees a familiar face; and Daenerys finds herself surrounded by strangers.", mediumImageID: "30012", originalImageID: "30012"),
GOTEpisode(airdate: "2016-04-24", id: 560813, name: "The Red Woman", number: 1, season: 6, runtime: 60, summary: "Jon Snow is dead. Daenerys meets a strong man. Cersei sees her daughter again.", mediumImageID: "142371", originalImageID: "142371"),
GOTEpisode(airdate: "2016-05-01", id: 664672, name: "Home", number: 2, season: 6, runtime: 60, summary: "Bran trains with the Three-Eyed Raven. In King's Landing, Jaime advises Tommen. Tyrion demands good news, but has to make his own. At Castle Black, the Night's Watch stands behind Thorne. Ramsay Bolton proposes a plan, and Balon Greyjoy entertains other proposals.", mediumImageID: "142372", originalImageID: "142372"),
GOTEpisode(airdate: "2016-05-08", id: 664673, name: "Oathbreaker", number: 3, season: 6, runtime: 60, summary: "Daenerys meets her future. Bran meets the past. Tommen confronts the High Sparrow. Arya trains to be No One. Varys finds an answer. Ramsay gets a gift.", mediumImageID: "142370", originalImageID: "142370"),
GOTEpisode(airdate: "2016-05-15", id: 664674, name: "Book of the Stranger", number: 4, season: 6, runtime: 60, summary: "Tyrion strikes a deal. Jorah and Daario undertake a difficult task. Jaime and Cersei try to improve their situation.", mediumImageID: "142273", originalImageID: "142273"),
GOTEpisode(airdate: "2016-05-22", id: 664675, name: "The Door", number: 5, season: 6, runtime: 60, summary: "Tyrion seeks a strange ally. Bran learns a great deal. Brienne goes on a mission. Arya is given a chance to prove herself.", mediumImageID: "150273", originalImageID: "150273"),
GOTEpisode(airdate: "2016-05-29", id: 664676, name: "Blood of My Blood", number: 6, season: 6, runtime: 60, summary: "An old foe comes back into the picture. Gilly meets Sam's family. Arya faces a difficult choice. Jaime faces off against the High Sparrow.", mediumImageID: "150274", originalImageID: "150274"),
GOTEpisode(airdate: "2016-06-05", id: 717449, name: "The Broken Man", number: 7, season: 6, runtime: 60, summary: "The High Sparrow eyes another target. Jaime confronts a hero. Arya makes a plan. The North is reminded.", mediumImageID: "150275", originalImageID: "150275"),
GOTEpisode(airdate: "2016-06-12", id: 729573, name: "No One", number: 8, season: 6, runtime: 60, summary: "Jaime encounters a hero; the High Sparrow fixates on another prey; Arya hatches a new plan; Yara and Theon plot their next move; Olenna and Cersei discuss their families' futures.While Jaime weighs his options, Cersei answers a request. Tyrion's plans bear fruit. Arya faces a new test.", mediumImageID: "153044", originalImageID: "153044"),
GOTEpisode(airdate: "2016-06-19", id: 729574, name: "Battle of the Bastards", number: 9, season: 6, runtime: 60, summary: "Ramsay surprises his audience. Jon retaliates. Dany is true to her word.", mediumImageID: "155042", originalImageID: "155042"),
GOTEpisode(airdate: "2016-06-26", id: 729575, name: "The Winds of Winter", number: 10, season: 6, runtime: 69, summary: "Alliances are made, the High Sparrow is holding trials at King's Landing, Daenerys is sailing for the Seven Kingdoms and a new King of the North is crowned.", mediumImageID: "157920", originalImageID: "157920"),
GOTEpisode(airdate: "2017-07-16", id: 937256, name: "Dragonstone", number: 1, season: 7, runtime: 60, summary: "Jon organizes the defense of the North. Cersei tries to even the odds. Daenerys comes home.", mediumImageID: "302038", originalImageID: "302038"),
GOTEpisode(airdate: "2017-07-23", id: 1221410, name: "Stormborn", number: 2, season: 7, runtime: 60, summary: "Daenerys receives an unexpected visitor. Jon faces a revolt. Tyrion plans the conquest of Westeros.", mediumImageID: "302047", originalImageID: "302047"),
GOTEpisode(airdate: "2017-07-30", id: 1221411, name: "The Queen's Justice", number: 3, season: 7, runtime: 60, summary: "Daenerys holds court. Cersei returns a gift. Jaime learns from his mistakes.", mediumImageID: "306938", originalImageID: "306938"),
GOTEpisode(airdate: "2017-08-06", id: 1221412, name: "The Spoils of War", number: 4, season: 7, runtime: 60, summary: "Arya gets to the final destination. Daenerys takes it upon herself to strike back.", mediumImageID: "307677", originalImageID: "307677"),
GOTEpisode(airdate: "2017-08-13", id: 1221413, name: "Eastwatch", number: 5, season: 7, runtime: 60, summary: "Daenerys demands loyalty from the surviving Lannister soldiers; Jon heeds Bran's warning about White Walkers on the move; Cersei vows to vanquish anyone or anything that stands in her way.", mediumImageID: "310839", originalImageID: "310839"),
GOTEpisode(airdate: "2017-08-20", id: 1221414, name: "Beyond the Wall", number: 6, season: 7, runtime: 60, summary: "Jon's mission continues north of the wall, but the odds against his ragged band of misfits may be greater than he imagined.", mediumImageID: "312651", originalImageID: "312651"),
GOTEpisode(airdate: "2017-08-27", id: 1221415, name: "The Dragon and the Wolf", number: 7, season: 7, runtime: 60, summary: "Cersei sits on the Iron Throne; Daenerys sails across the Narrow Sea; Jon Snow is King in the North, and winter is finally here.", mediumImageID: "314502", originalImageID: "314502")
]
static func getSeasonSections() -> [[GOTEpisode]] {
let sortedEpisodes = allEpisodes.sorted { $0.season < $1.season }
let uniqueSeasons = Set(sortedEpisodes.map { $0.season})
var sections = Array(repeating: [GOTEpisode](), count: uniqueSeasons.count)
var currentIndex = 0
var currentSeason = sortedEpisodes.first?.season
for episode in sortedEpisodes {
if episode.season == currentSeason {
sections[currentIndex].append(episode)
} else {
currentIndex += 1
currentSeason = episode.season
sections[currentIndex].append(episode)
}
}
return sections
}
}
| [
-1
] |
2f9814b9efbe053f5304e3839660fc4400ce42ad | 6f147637eec75579df93c3d81d83a4b79b819f9a | /swifty_protein/View/ProteinTableViewCell.swift | e43237f7c296599a03c51dd84dc88db9603e7b42 | [] | no_license | Vaynn/swifty_protein | 510e051dd6415b031f585fb153094f339d48950e | d8d51f162b118d28258e9bb605fd5d80ba83ea0b | refs/heads/main | 2023-06-23T04:19:58.183023 | 2021-07-09T09:22:52 | 2021-07-09T09:22:52 | 384,360,781 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 686 | swift | //
// ProteinTableViewCell.swift
// swifty_protein
//
// Created by Yvann Martorana on 25/06/2021.
//
import UIKit
class ProteinTableViewCell: UITableViewCell {
@IBOutlet weak var ligandName: UILabel!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configure(name:String){
ligandName.text = name
activityIndicator.stopAnimating()
}
}
| [
-1
] |
e2fafe571e8b16fd9edaa195380730c44457730d | 4fddd72988355c3ffe16e2a3301da979ed17d785 | /Stepic/Sources/Modules/EditStep/EditStepProvider.swift | da34988b56dd9b072db1842d28850bb59e7f12c4 | [] | no_license | StepicOrg/stepik-ios | 83e68965c09645f8786da389ee0c994e0310dabe | 8a3797864d282560ce2369a9c1e9737a52c49ae5 | refs/heads/master | 2023-06-07T20:53:05.024612 | 2022-04-06T10:43:23 | 2022-04-06T10:43:23 | 42,045,080 | 136 | 41 | null | 2023-09-14T12:31:14 | 2015-09-07T09:51:32 | Swift | UTF-8 | Swift | false | false | 1,996 | swift | import Foundation
import PromiseKit
protocol EditStepProviderProtocol {
func fetchStepSource(stepID: Step.IdType) -> Promise<StepSource?>
func updateStepSource(_ stepSource: StepSource) -> Promise<StepSource>
func fetchCachedStep(stepID: Step.IdType) -> Promise<Step?>
}
// MARK: - EditStepProvider: EditStepProviderProtocol -
final class EditStepProvider: EditStepProviderProtocol {
private let stepSourcesNetworkService: StepSourcesNetworkService
private let stepsPersistenceService: StepsPersistenceServiceProtocol
init(
stepSourcesNetworkService: StepSourcesNetworkService,
stepsPersistenceService: StepsPersistenceServiceProtocol
) {
self.stepSourcesNetworkService = stepSourcesNetworkService
self.stepsPersistenceService = stepsPersistenceService
}
func fetchStepSource(stepID: Step.IdType) -> Promise<StepSource?> {
Promise { seal in
self.stepSourcesNetworkService.fetch(ids: [stepID]).done { stepSources, _ in
seal.fulfill(stepSources.first)
}.catch { _ in
seal.reject(Error.networkFetchFailed)
}
}
}
func updateStepSource(_ stepSource: StepSource) -> Promise<StepSource> {
Promise { seal in
self.stepSourcesNetworkService.update(stepSource: stepSource).done { stepSource in
seal.fulfill(stepSource)
}.catch { _ in
seal.reject(Error.networkUpdateFailed)
}
}
}
func fetchCachedStep(stepID: Step.IdType) -> Promise<Step?> {
Promise { seal in
self.stepsPersistenceService.fetch(ids: [stepID]).done { steps in
seal.fulfill(steps.first)
}.catch { _ in
seal.reject(Error.stepFetchFailed)
}
}
}
// MARK: Types
enum Error: Swift.Error {
case networkFetchFailed
case networkUpdateFailed
case stepFetchFailed
}
}
| [
-1
] |
f986efcf1bfd85da61e7b3f332bf50d53d940892 | 652486e6ca74333e4883d230e464702808fb6491 | /2015/swift/day22_1/day22_1/day22_1.swift | c4497a9bc4bb4cb24cd058f39161e04d83f519a8 | [
"MIT"
] | permissive | sgravrock/adventofcode | 3e3138abe29e1e1ed34357791c2bce25e71c6b69 | d44655f1e2ade3cecbc6b16fbda8e3bf62e5156f | refs/heads/master | 2023-07-20T04:04:57.704026 | 2023-07-12T03:43:47 | 2023-07-12T03:43:47 | 47,810,570 | 0 | 0 | MIT | 2022-12-23T21:41:51 | 2015-12-11T06:56:52 | Rust | UTF-8 | Swift | false | false | 5,185 | swift | func minManaToWin(player: Player, boss: Boss, spells: [Spell]) -> Int? {
var pendingSteps : [Step] = []
for spell in spells.filter({ player.canCast(spell: $0) }) {
pendingSteps.append(Step(player: player.clone(), boss: boss.clone(), nextSpell: spell, costSoFar: 0))
}
var minMana = Int.max
while pendingSteps.count > 0 {
let step = pendingSteps.removeFirst()
playerTurn(player: step.player, boss: step.boss, spell: step.nextSpell)
bossTurn(player: step.player, boss: step.boss)
let cost = step.costSoFar + step.nextSpell.cost
if cost > minMana {
break;
}
switch currentGameState(player: step.player, boss: step.boss) {
case .PlayerWon:
minMana = cost
print("New minimum: \(minMana)")
case .BossWon:
break;
case .Running:
for spell in spells.filter({ step.player.canCast(spell: $0) }) {
pendingSteps.append(step.nextStep(spell: spell))
}
}
}
if minMana == Int.max {
return nil
}
return minMana
}
struct Step {
let player: Player
let boss: Boss
let nextSpell: Spell
let costSoFar: Int
func nextStep(spell: Spell) -> Step {
return Step(player: player.clone(), boss: boss.clone(), nextSpell: spell, costSoFar: costSoFar + nextSpell.cost)
}
}
func minManaToWin(player: Player, boss: Boss, spells: [Spell], nextSpell: Spell) -> Int? {
playerTurn(player: player, boss: boss, spell: nextSpell)
bossTurn(player: player, boss: boss)
switch currentGameState(player: player, boss: boss) {
case .BossWon:
return nil
case .PlayerWon:
return nextSpell.cost
case .Running:
if let subresult = minManaToWin(player: player.clone(), boss: boss.clone(), spells: spells) {
return subresult + nextSpell.cost
} else {
return nil
}
}
}
struct Spell {
let cost: Int
let damage: Int
let healing: Int
let effect: Effect?
}
struct Effect : Equatable {
let duration: Int
let armor: Int
let damage: Int
let mana: Int
static func ==(lhs: Effect, rhs: Effect) -> Bool {
return lhs.duration == rhs.duration &&
lhs.armor == rhs.armor &&
lhs.damage == rhs.damage &&
lhs.mana == rhs.mana
}
}
let magicMissile = Spell(cost: 53, damage: 4, healing: 0, effect: nil)
let drain = Spell(cost: 73, damage: 2, healing: 2, effect: nil)
let shield = Spell(cost: 113, damage: 0, healing: 0, effect: Effect(duration: 6, armor: 7, damage: 0, mana: 0))
let poison = Spell(cost: 173, damage: 0, healing: 0, effect: Effect(duration: 6, armor: 0, damage: 3, mana: 0))
let recharge = Spell(cost: 229, damage: 0, healing: 0, effect: Effect(duration: 5, armor: 0, damage: 0, mana: 101))
let allSpells = [
magicMissile,
drain,
shield,
poison,
recharge,
]
class Player {
var activeEffects: [Effect]
var pendingEffect: Effect?
var hitPoints: Int
var mana: Int
var armorPoints: Int {
return activeEffects.map { $0.armor }.reduce(0, +)
}
init(hitPoints: Int, mana: Int) {
self.hitPoints = hitPoints
self.mana = mana
self.activeEffects = []
}
func clone() -> Player {
let other = Player(hitPoints: hitPoints, mana: mana)
other.activeEffects = activeEffects
other.pendingEffect = pendingEffect
return other
}
func canCast(spell: Spell) -> Bool {
if spell.cost > mana {
return false
}
if spell.effect == nil {
return true
}
let match = activeEffects.first(where: { (e: Effect) -> Bool in
return e.duration > 1 && effectsOverlap(a: e, b: spell.effect!)
})
return match == nil
}
func cast(spell: Spell, target: Boss) {
assert(canCast(spell: spell))
if let effect = spell.effect {
assert(pendingEffect == nil)
pendingEffect = effect
}
mana -= spell.cost
hitPoints += spell.healing
target.hitPoints -= spell.damage
}
func applyEffects(target: Boss) {
for e in activeEffects {
target.hitPoints -= e.damage
mana += e.mana
}
ageEffects()
if let e = pendingEffect {
activeEffects.append(e)
pendingEffect = nil
}
}
func ageEffects() {
activeEffects = activeEffects
.filter { $0.duration > 1 }
.map { Effect(duration: $0.duration - 1, armor: $0.armor, damage: $0.damage, mana: $0.mana) }
}
}
func effectsOverlap(a: Effect, b: Effect) -> Bool {
return (a.armor != 0 && b.armor != 0) ||
(a.damage != 0 && b.damage != 0) ||
(a.mana != 0 && b.mana != 0)
}
class Boss {
let damagePoints: Int
var hitPoints: Int
init(hitPoints: Int, damagePoints: Int) {
self.damagePoints = damagePoints
self.hitPoints = hitPoints
}
func clone() -> Boss {
return Boss(hitPoints: hitPoints, damagePoints: damagePoints)
}
func attack(player: Player) {
let damageDone = max(1, damagePoints - player.armorPoints)
player.hitPoints -= damageDone
}
}
enum GameState {
case Running
case PlayerWon
case BossWon
}
func currentGameState(player: Player, boss: Boss) -> GameState {
if player.hitPoints <= 0 {
return .BossWon
} else if boss.hitPoints <= 0 {
return .PlayerWon
} else {
return .Running
}
}
func playerTurn(player: Player, boss: Boss, spell: Spell) {
player.cast(spell: spell, target: boss)
player.applyEffects(target: boss)
}
func bossTurn(player: Player, boss: Boss) {
player.applyEffects(target: boss)
if boss.hitPoints > 0 {
boss.attack(player: player)
}
}
| [
-1
] |
ad4ea914dfa148d2bca8b020b25a6c65b8b62a20 | 35619a0101ea94c59e4d60fdfc52de25af347e7c | /Memory/Card.swift | 6bee5f461808e2e95e4087cc5ea3fb7c0dfe9f8f | [] | no_license | PauBlanes/IOS_MatchTwo | 6d069b37223e93987a3eeab6cf69c9a683f9c10a | 617d94ad46384e69b031d69940168da45ae3e7f9 | refs/heads/master | 2020-05-02T20:48:58.973515 | 2019-06-05T15:38:10 | 2019-06-05T15:38:10 | 178,202,436 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 310 | swift | //
// Card.swift
// Memory
//
// Created by Pau Blanes on 21/3/19.
// Copyright © 2019 Pau Blanes. All rights reserved.
//
import Foundation
enum CardState {
case covered,uncovered,matched
}
class Card {
var id:Int = -1
var pairId:Int = -1
var state:CardState = CardState.covered
}
| [
-1
] |
9e29b6cefba7ca8ec9681bde474ae1c33cfd0b17 | 5fa1cb682fbade8075aa1598d6ef42c5630106ff | /NEWJContacts/CoreData/LocalStorageHandler.swift | eb4bbb9991ae3f3c9380276f83db97c1bab89c76 | [] | no_license | sagar-patil-52/NEWJContacts | bc9f11b2f0717652f01a2415da676ce658493084 | 4ef7917da0cea83b096c7875c0065b338a1689f3 | refs/heads/main | 2023-07-01T13:15:29.781395 | 2021-08-01T11:32:19 | 2021-08-01T11:32:19 | 391,598,358 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,430 | swift | //
// LocalStorageHandler.swift
// NEWJContacts
//
// Created by mmt on 30/07/21.
//
import Foundation
import CoreData
class LocalStorageHandler {
func storeData<T>( entity : T) {
let entityName = Constants.Strings.user
NSEntityDescription.insertNewObject(forEntityName: entityName,
into: PersistenceService.context)
}
func fetchData() -> [User]? {
var users = [User]()
let request = NSFetchRequest<NSFetchRequestResult>(entityName: Constants.Strings.user)
request.returnsObjectsAsFaults = false
do {
let result = try PersistenceService.context.fetch(request)
for data in result as! [NSManagedObject] {
if let user = data as? User {
users.append(user)
}
}
} catch {
print(Constants.Error.dataFetchError)
}
return users
}
func fetchUser(id : Int) -> User? {
let predicate = NSPredicate(format: "id = %d" , id)
let request = NSFetchRequest<NSFetchRequestResult>(entityName: Constants.Strings.user)
request.predicate = predicate
request.returnsObjectsAsFaults = false
do {
let result = try PersistenceService.context.fetch(request)
for data in result as! [NSManagedObject] {
if let user = data as? User {
return user
}
}
} catch {
print(Constants.Error.dataFetchError)
}
return nil
}
func markUserFavourite(id : Int) {
let datePredicate = NSPredicate(format: "id = %d" , id)
let request = NSFetchRequest<NSFetchRequestResult>(entityName: Constants.Strings.user)
request.predicate = datePredicate
request.returnsObjectsAsFaults = false
do {
let result = try PersistenceService.context.fetch(request)
for data in result as! [NSManagedObject] {
if let user = data as? User {
user.isFavourite = !user.isFavourite
}
}
PersistenceService.saveContext()
} catch {
print(Constants.Error.dataFetchError)
}
}
func saveData() {
PersistenceService.saveContext()
}
}
| [
-1
] |
8d33f99caee572d28336705858af1994435bf8d2 | 2a97163d0e4ea10c2890ff910e132faca943058d | /MoodPocket/Model/Diary.swift | 4ddb1134fc87859672d67a076af639b111403175 | [] | no_license | zengbingjie/MoodPocket | 5e88856c15c7d489f4bfa73be1d9dcbeac4d3322 | a77adc269f208140c04d59f13f1a242758acaff3 | refs/heads/master | 2021-09-02T07:25:01.171845 | 2017-12-31T12:19:24 | 2017-12-31T12:19:24 | 115,735,715 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,034 | swift | //
// Diary.swift
// MoodPocket
//
// Created by 曾冰洁 on 2017/12/6.
// Copyright © 2017年 曾冰洁. All rights reserved.
//
import UIKit
import os.log
class Diary: NSObject, NSCoding {
//MARK: Properties
var content: String?
var photo: UIImage
var mood: Int
var date: Date
var tag: String?
var isFavourite: Bool
//MARK: Archiving Paths
static let DocumentsDirectory = FileManager().urls(for: .documentDirectory, in: .userDomainMask).first!
static let ArchiveURL = DocumentsDirectory.appendingPathComponent("diaries")
//MARK: Types
struct PropertyKey {
static let content = "content"
static let photo = "photo"
static let mood = "mood"
static let date = "date"
static let tag = "tag"
static let isFavourite = "isFavourite"
}
//MARK: Initialization
init(content: String?, photo: UIImage, mood: Int, date: Date, tag: String?, isFavourite: Bool) {
// Initialize stored properties.
self.content = content
self.photo = photo
self.mood = mood
self.date = date
self.tag = tag
self.isFavourite = isFavourite
}
// MARK: Static methods
static func loadSampleDiaries() {
let diary1 = Diary(content: "ios太难了", photo: #imageLiteral(resourceName: "defaultimage"), mood: 10, date: Date.stringToDate(string: "2017-12-06"), tag: "Study", isFavourite: false)
let diary2 = Diary(content: "calendar和linechart可以拖动啦!!!!!前前后后改了n遍!!!!", photo: #imageLiteral(resourceName: "defaultimage"), mood: 100, date: Date.stringToDate(string: "2017-12-17"), tag: "Study", isFavourite: false)
let diary3 = Diary(content: "可以进入app就输入密码啦但是有bug🤯写心情和写信界面退出后重新打开不能显示密码界面🤯", photo: #imageLiteral(resourceName: "defaultimage"), mood: 45, date: Date.stringToDate(string: "2017-12-21"), tag: "Study", isFavourite: false)
let diary4 = Diary(content: "收藏/添加tag/选择photo功能上线啦", photo: #imageLiteral(resourceName: "defaultimage"), mood: 80, date: Date.stringToDate(string: "2017-12-23"), tag: "Study", isFavourite: false)
let diary5 = Diary(content: "输入密码bug fixed 感谢仓鼠同学 一定是我之前的google姿势不对", photo: #imageLiteral(resourceName: "defaultimage"), mood: 90, date: Date.stringToDate(string: "2017-12-25"), tag: "Study", isFavourite: false)
let diary6 = Diary(content: "Happy Christmas!\n听说英国女王不用merry这个词是因为瞧不上它lol", photo: #imageLiteral(resourceName: "defaultimage"), mood: 60, date: Date.stringToDate(string: "2017-12-25"), tag: "Life", isFavourite: false)
let diary7 = Diary(content: "元旦快乐.", photo: #imageLiteral(resourceName: "defaultimage"), mood: 60, date: Date.stringToDate(string: "2017-12-31"), tag: "Life", isFavourite: false)
diaries += [diary1, diary2, diary3, diary4, diary5, diary6, diary7]
}
static func loadDiaries() -> [Diary]? {
return NSKeyedUnarchiver.unarchiveObject(withFile: Diary.ArchiveURL.path) as? [Diary]
}
static func saveDiaries() {
let isSuccessfulSave = NSKeyedArchiver.archiveRootObject(diaries, toFile: Diary.ArchiveURL.path)
if isSuccessfulSave {
os_log("diaries successfully saved.", log: OSLog.default, type: .debug)
} else {
os_log("Failed to save diaries...", log: OSLog.default, type: .error)
}
}
//MARK: NSCoding
func encode(with aCoder: NSCoder) {
aCoder.encode(content, forKey: PropertyKey.content)
aCoder.encode(photo, forKey: PropertyKey.photo)
aCoder.encode(mood, forKey: PropertyKey.mood)
aCoder.encode(date, forKey: PropertyKey.date)
aCoder.encode(tag, forKey: PropertyKey.tag)
aCoder.encode(isFavourite, forKey: PropertyKey.isFavourite)
}
required convenience init?(coder aDecoder: NSCoder) {
guard let content = aDecoder.decodeObject(forKey: PropertyKey.content) as? String else {
os_log("Unable to decode the content for a Diary object.", log: OSLog.default, type: .debug)
return nil
}
let photo = aDecoder.decodeObject(forKey: PropertyKey.photo) as! UIImage
let mood = aDecoder.decodeInteger(forKey: PropertyKey.mood)
guard let date = aDecoder.decodeObject(forKey: PropertyKey.date) as? Date else {
os_log("Unable to decode the date for a Diary object.", log: OSLog.default, type: .debug)
return nil
}
let tag = aDecoder.decodeObject(forKey: PropertyKey.tag) as? String
let isFavourite = aDecoder.decodeBool(forKey: PropertyKey.isFavourite)
self.init(content: content, photo: photo, mood: mood, date: date, tag: tag, isFavourite: isFavourite)
}
// MARK: Methods
}
| [
-1
] |
6c8af67bb84375603e5eb45c033d566ee2342d85 | 9f80a26d2250f1fd1c966ab307f0eccd6a5fd12d | /Sources/Shallows/Storage.swift | 31ed69829c505e44838048b302772f56d7fa7546 | [
"MIT"
] | permissive | dreymonde/Shallows | 0d942003ba46e0d10e2071f67d2f771880038c06 | 3a9d673a7c01d6fd4fbaa5cd592648dbae42d4a7 | refs/heads/master | 2022-05-14T02:25:56.895460 | 2022-05-01T13:01:56 | 2022-05-01T13:01:56 | 89,173,939 | 633 | 26 | MIT | 2020-04-28T14:22:47 | 2017-04-23T21:34:15 | Swift | UTF-8 | Swift | false | false | 7,420 | swift | public protocol StorageDesign {
var storageName: String { get }
}
extension StorageDesign {
public var storageName: String {
return String(describing: Self.self)
}
}
public protocol StorageProtocol : ReadableStorageProtocol, WritableStorageProtocol { }
public struct Storage<Key, Value> : StorageProtocol {
public let storageName: String
private let _retrieve: ReadOnlyStorage<Key, Value>
private let _set: WriteOnlyStorage<Key, Value>
public init(storageName: String,
read: ReadOnlyStorage<Key, Value>,
write: WriteOnlyStorage<Key, Value>) {
self.storageName = storageName
self._retrieve = read.renaming(to: storageName)
self._set = write.renaming(to: storageName)
}
public init(storageName: String,
retrieve: @escaping (Key, @escaping (ShallowsResult<Value>) -> ()) -> (),
set: @escaping (Value, Key, @escaping (ShallowsResult<Void>) -> ()) -> ()) {
self.storageName = storageName
self._retrieve = ReadOnlyStorage(storageName: storageName, retrieve: retrieve)
self._set = WriteOnlyStorage(storageName: storageName, set: set)
}
public init<StorageType : StorageProtocol>(_ storage: StorageType) where StorageType.Key == Key, StorageType.Value == Value {
self.storageName = storage.storageName
self._retrieve = storage.asReadOnlyStorage()
self._set = storage.asWriteOnlyStorage()
}
public init(read: ReadOnlyStorage<Key, Value>,
write: WriteOnlyStorage<Key, Value>) {
self.init(storageName: read.storageName,
read: read,
write: write)
}
public func retrieve(forKey key: Key, completion: @escaping (ShallowsResult<Value>) -> ()) {
_retrieve.retrieve(forKey: key, completion: completion)
}
public func set(_ value: Value, forKey key: Key, completion: @escaping (ShallowsResult<Void>) -> ()) {
_set.set(value, forKey: key, completion: completion)
}
@available(swift, deprecated: 5.5, message: "use async version or provide completion handler explicitly")
public func set(_ value: Value, forKey key: Key) {
_set.set(value, forKey: key, completion: { _ in })
}
public func asReadOnlyStorage() -> ReadOnlyStorage<Key, Value> {
return _retrieve
}
public func asWriteOnlyStorage() -> WriteOnlyStorage<Key, Value> {
return _set
}
}
internal func storageName(left: String, right: String, pullingFromBack: Bool, pushingToBack: Bool) -> String {
switch (pullingFromBack, pushingToBack) {
case (true, true):
return left + "<->" + right
case (true, false):
return left + "<-" + right
case (false, true):
return left + "->" + right
case (false, false):
return left + "-" + right
}
}
extension StorageProtocol {
public func asStorage() -> Storage<Key, Value> {
if let alreadyNormalized = self as? Storage<Key, Value> {
return alreadyNormalized
}
return Storage(self)
}
@available(swift, deprecated: 5.5, message: "`update` is deprecated because it was creating potentially wrong assumptions regarding the serial nature of this function. `update` cannot guarantee that no concurrent calls to `retrieve` or `set` from other places will be made during the update")
public func update(forKey key: Key,
_ modify: @escaping (inout Value) -> (),
completion: @escaping (ShallowsResult<Value>) -> () = { _ in }) {
retrieve(forKey: key) { (result) in
switch result {
case .success(var value):
modify(&value)
self.set(value, forKey: key, completion: { (setResult) in
switch setResult {
case .success:
completion(.success(value))
case .failure(let error):
completion(.failure(error))
}
})
case .failure(let error):
completion(.failure(error))
}
}
}
}
extension StorageProtocol {
public func mapKeys<OtherKey>(to type: OtherKey.Type = OtherKey.self,
_ transform: @escaping (OtherKey) throws -> Key) -> Storage<OtherKey, Value> {
return Storage(read: asReadOnlyStorage().mapKeys(transform),
write: asWriteOnlyStorage().mapKeys(transform))
}
public func mapValues<OtherValue>(to type: OtherValue.Type = OtherValue.self,
transformIn: @escaping (Value) throws -> OtherValue,
transformOut: @escaping (OtherValue) throws -> Value) -> Storage<Key, OtherValue> {
return Storage(read: asReadOnlyStorage().mapValues(transformIn),
write: asWriteOnlyStorage().mapValues(transformOut))
}
}
extension StorageProtocol {
public func mapValues<OtherValue : RawRepresentable>(toRawRepresentableType type: OtherValue.Type) -> Storage<Key, OtherValue> where OtherValue.RawValue == Value {
return mapValues(transformIn: throwing(OtherValue.init(rawValue:)),
transformOut: { $0.rawValue })
}
public func mapKeys<OtherKey : RawRepresentable>(toRawRepresentableType type: OtherKey.Type) -> Storage<OtherKey, Value> where OtherKey.RawValue == Key {
return mapKeys({ $0.rawValue })
}
}
extension StorageProtocol {
public func fallback(with produceValue: @escaping (Error) throws -> Value) -> Storage<Key, Value> {
let readOnly = asReadOnlyStorage().fallback(with: produceValue)
return Storage(read: readOnly, write: asWriteOnlyStorage())
}
public func defaulting(to defaultValue: @autoclosure @escaping () -> Value) -> Storage<Key, Value> {
return fallback(with: { _ in defaultValue() })
}
}
extension StorageProtocol {
public func singleKey(_ key: Key) -> Storage<Void, Value> {
return mapKeys({ key })
}
}
extension ReadableStorageProtocol where Key == Void {
public func retrieve(completion: @escaping (ShallowsResult<Value>) -> ()) {
retrieve(forKey: (), completion: completion)
}
}
extension WritableStorageProtocol where Key == Void {
public func set(_ value: Value, completion: @escaping (ShallowsResult<Void>) -> ()) {
set(value, forKey: (), completion: completion)
}
@available(swift, deprecated: 5.5, message: "use async version or provide completion handler explicitly")
public func set(_ value: Value) {
set(value, completion: { _ in })
}
}
extension StorageProtocol where Key == Void {
@available(swift, deprecated: 5.5, message: "`update` is deprecated because it was creating potentially wrong assumptions regarding the serial nature of this function. `update` cannot guarantee that no concurrent calls to `retrieve` or `set` from other places will be made during the update")
public func update(_ modify: @escaping (inout Value) -> (), completion: @escaping (ShallowsResult<Value>) -> () = {_ in }) {
self.update(forKey: (), modify, completion: completion)
}
}
| [
-1
] |
2009a4efa9778ecfe6f72a74567c41c399863a1f | a9654aae990d554d0f82e5854a98fcb4b0b46fd2 | /Tests/CBOREncoderTests.swift | d7391858a01421dc920cc8adf5cd10579da87e3a | [
"MIT"
] | permissive | outfoxx/PotentCodables | 67323649f366579f241749ccf0ca80cec6ef7c72 | 0c423eb5fdbbefffd36926430bf99f9f998c0cad | refs/heads/main | 2023-07-13T07:27:41.117442 | 2023-06-26T17:08:05 | 2023-06-26T17:08:05 | 194,583,595 | 51 | 14 | MIT | 2023-06-26T17:08:07 | 2019-07-01T02:04:38 | Roff | UTF-8 | Swift | false | false | 11,092 | swift | //
// CBOREncoderTests.swift
// PotentCodables
//
// Copyright © 2021 Outfox, inc.
//
//
// Distributed under the MIT License, See LICENSE for details.
//
import BigInt
@testable import PotentCBOR
@testable import PotentCodables
import XCTest
class CBOREncoderTests: XCTestCase {
func encode<T: Encodable>(_ value: T, dates: CBOREncoder.DateEncodingStrategy = .iso8601) throws -> [UInt8] {
return Array(try CBOREncoder().encode(value))
}
func testEncodeNull() {
XCTAssertEqual(try encode(String?(nil)), [0xF6])
}
func testEncodeBools() {
XCTAssertEqual(try encode(false), [0xF4])
XCTAssertEqual(try encode(true), [0xF5])
}
func testEncodeInts() {
// Less than 24
XCTAssertEqual(try encode(0), [0x00])
XCTAssertEqual(try encode(8), [0x08])
XCTAssertEqual(try encode(10), [0x0A])
XCTAssertEqual(try encode(23), [0x17])
// Just bigger than 23
XCTAssertEqual(try encode(24), [0x18, 0x18])
XCTAssertEqual(try encode(25), [0x18, 0x19])
// Bigger
XCTAssertEqual(try encode(100), [0x18, 0x64])
XCTAssertEqual(try encode(1000), [0x19, 0x03, 0xE8])
XCTAssertEqual(try encode(1_000_000), [0x1A, 0x00, 0x0F, 0x42, 0x40])
XCTAssertEqual(try encode(Int64(1_000_000_000_000)), [0x1B, 0x00, 0x00, 0x00, 0xE8, 0xD4, 0xA5, 0x10, 0x00])
// Biggest
XCTAssertEqual(
try encode(UInt64(18_446_744_073_709_551_615)),
[0x1B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
)
// Specific Types
XCTAssertEqual(try encode(Int8.max), [0x18, 0x7f])
XCTAssertEqual(try encode(Int16.max), [0x19, 0x7f, 0xff])
XCTAssertEqual(try encode(Int32.max), [0x1A, 0x7f, 0xff, 0xff, 0xff])
XCTAssertEqual(try encode(Int64.max), [0x1B, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
XCTAssertEqual(
try encode(Int.max),
MemoryLayout<Int>.size == 4
? [0x1A, 0x7f, 0xff, 0xff, 0xff]
: [0x1B, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
XCTAssertEqual(try encode(UInt8.max), [0x18, 0xff])
XCTAssertEqual(try encode(UInt16.max), [0x19, 0xff, 0xff])
XCTAssertEqual(try encode(UInt32.max), [0x1A, 0xff, 0xff, 0xff, 0xff])
XCTAssertEqual(try encode(UInt64.max), [0x1B, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
XCTAssertEqual(
try encode(UInt.max),
MemoryLayout<Int>.size == 4
? [0x1A, 0xff, 0xff, 0xff, 0xff]
: [0x1B, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
}
func testEncodeNegativeInts() {
// Less than 24
XCTAssertEqual(try encode(-1), [0x20])
XCTAssertEqual(try encode(-10), [0x29])
// Bigger
XCTAssertEqual(try encode(-100), [0x38, 0x63])
XCTAssertEqual(try encode(-1000), [0x39, 0x03, 0xE7])
// Biggest
XCTAssertEqual(
try encode(Int64(-9_223_372_036_854_775_808)),
[0x3B, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
)
XCTAssertEqual(try encode(Int8.min), [0x38, 0x7f])
XCTAssertEqual(try encode(Int16.min), [0x39, 0x7f, 0xff])
XCTAssertEqual(try encode(Int32.min), [0x3A, 0x7f, 0xff, 0xff, 0xff])
XCTAssertEqual(try encode(Int64.min), [0x3B, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
XCTAssertEqual(
try encode(Int.min),
MemoryLayout<Int>.size == 4
? [0x3A, 0x7f, 0xff, 0xff, 0xff]
: [0x3B, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
}
func testEncodeHalfs() {
XCTAssertEqual(try encode(CBOR.Half(1.5)), [0xf9, 0x3e, 0x00])
XCTAssertEqual(try encode(CBOR.Half(-1.5)), [0xf9, 0xbe, 0x00])
}
func testEncodeFloats() {
XCTAssertEqual(try encode(Float(1.9874999523162842)), [0xfa, 0x3f, 0xfe, 0x66, 0x66])
XCTAssertEqual(try encode(Float(-1.9874999523162842)), [0xfa, 0xbf, 0xfe, 0x66, 0x66])
}
func testEncodeDoubles() {
XCTAssertEqual(try encode(Double(1.234)), [0xfb, 0x3f, 0xf3, 0xbe, 0x76, 0xc8, 0xb4, 0x39, 0x58])
XCTAssertEqual(try encode(Double(-1.234)), [0xfb, 0xbf, 0xf3, 0xbe, 0x76, 0xc8, 0xb4, 0x39, 0x58])
}
func testEncodeStrings() {
XCTAssertEqual(try encode(""), [0x60])
XCTAssertEqual(try encode("a"), [0x61, 0x61])
XCTAssertEqual(try encode("IETF"), [0x64, 0x49, 0x45, 0x54, 0x46])
XCTAssertEqual(try encode("\"\\"), [0x62, 0x22, 0x5C])
XCTAssertEqual(try encode("\u{00FC}"), [0x62, 0xC3, 0xBC])
}
func testEncodeByteStrings() {
XCTAssertEqual(try encode(Data([0x01, 0x02, 0x03, 0x04])), [0x44, 0x01, 0x02, 0x03, 0x04])
}
func testEncodeArrays() {
XCTAssertEqual(
try encode([String]()),
[0x80]
)
XCTAssertEqual(
try encode([1, 2, 3]),
[0x83, 0x01, 0x02, 0x03]
)
XCTAssertEqual(
try encode([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]),
[0x98, 0x19, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x18, 0x18, 0x19]
)
XCTAssertEqual(
try encode([[1], [2, 3], [4, 5]]),
[0x83, 0x81, 0x01, 0x82, 0x02, 0x03, 0x82, 0x04, 0x05]
)
}
func testEncodeMaps() throws {
XCTAssertEqual(try encode([String: String]()), [0xA0])
let stringToString = try encode(["a": "A", "b": "B", "c": "C", "d": "D", "e": "E"])
XCTAssertEqual(stringToString.first!, 0xA5)
let dataMinusFirstByte = stringToString[1...].map { $0 }.chunked(into: 4)
.sorted(by: { $0.lexicographicallyPrecedes($1) })
let dataForKeyValuePairs: [[UInt8]] = [
[0x61, 0x61, 0x61, 0x41],
[0x61, 0x62, 0x61, 0x42],
[0x61, 0x63, 0x61, 0x43],
[0x61, 0x64, 0x61, 0x44],
[0x61, 0x65, 0x61, 0x45],
]
XCTAssertEqual(dataMinusFirstByte, dataForKeyValuePairs)
let oneTwoThreeFour = try encode([1: 2, 3: 4])
XCTAssert(
oneTwoThreeFour == [0xA2, 0x61, 0x31, 0x02, 0x61, 0x33, 0x04] || oneTwoThreeFour ==
[0xA2, 0x61, 0x33, 0x04, 0x61, 0x31, 0x02]
)
}
func testEncodeDeterministicMaps() throws {
struct Test: Codable {
struct Sub: Codable {
var value: Int
}
var test: String
var sub: Sub
}
print(try CBOR.Encoder.deterministic.encode(Test(test: "a", sub: .init(value: 5))).hexEncodedString())
XCTAssertEqual(
try CBOR.Encoder.deterministic.encode(Test(test: "a", sub: .init(value: 5))),
Data([0xA2, 0x63, 0x73, 0x75, 0x62, 0xA1, 0x65, 0x76, 0x61, 0x6C,
0x75, 0x65, 0x05, 0x64, 0x74, 0x65, 0x73, 0x74, 0x61, 0x61])
)
}
func testEncodingDoesntTranslateMapKeys() throws {
let encoder = CBOREncoder()
encoder.keyEncodingStrategy = .convertToSnakeCase
let tree = try encoder.encodeTree(["thisIsAnExampleKey": 0])
XCTAssertEqual(tree.mapValue?.keys.first, "thisIsAnExampleKey")
}
func testEncodeDates() throws {
let dateOne = Date(timeIntervalSince1970: 1_363_896_240)
let dateTwo = Date(timeIntervalSince1970: 1_363_896_240.5)
// numeric dates
let encoder = CBOREncoder()
encoder.dateEncodingStrategy = .millisecondsSince1970
XCTAssertEqual(try Array(encoder.encode(dateOne)), [0x1B, 0x00, 0x00, 0x01, 0x3D, 0x8E, 0x8D, 0x07, 0x80])
XCTAssertEqual(try Array(encoder.encode(dateTwo)), [0x1B, 0x00, 0x00, 0x01, 0x3D, 0x8E, 0x8D, 0x09, 0x74])
// numeric fractional dates
encoder.dateEncodingStrategy = .secondsSince1970
XCTAssertEqual(try Array(encoder.encode(dateOne)), [0xC1, 0xFB, 0x41, 0xD4, 0x52, 0xD9, 0xEC, 0x00, 0x00, 0x00])
XCTAssertEqual(try Array(encoder.encode(dateTwo)), [0xC1, 0xFB, 0x41, 0xD4, 0x52, 0xD9, 0xEC, 0x20, 0x00, 0x00])
// string dates (no fractional seconds)
encoder.dateEncodingStrategy = .iso8601
XCTAssertEqual(
try Array(encoder.encode(dateOne)),
[0xC0, 0x78, 0x18, 0x32, 0x30, 0x31, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x31, 0x54, 0x32, 0x30,
0x3A, 0x30, 0x34, 0x3A, 0x30, 0x30, 0x2E, 0x30, 0x30, 0x30, 0x5A]
)
XCTAssertEqual(
try Array(encoder.encode(dateTwo)),
[0xC0, 0x78, 0x18, 0x32, 0x30, 0x31, 0x33, 0x2D, 0x30, 0x33, 0x2D, 0x32, 0x31, 0x54, 0x32, 0x30,
0x3A, 0x30, 0x34, 0x3A, 0x30, 0x30, 0x2E, 0x35, 0x30, 0x30, 0x5A]
)
}
func testEncodeSimpleStructs() throws {
struct MyStruct: Codable {
let age: Int
let name: String
}
let encoded = try encode(MyStruct(age: 27, name: "Ham"))
XCTAssert(
encoded == [0xA2, 0x63, 0x61, 0x67, 0x65, 0x18, 0x1B, 0x64, 0x6E, 0x61, 0x6D, 0x65, 0x63, 0x48, 0x61, 0x6D]
|| encoded == [0xA2, 0x64, 0x6E, 0x61, 0x6D, 0x65, 0x63, 0x48, 0x61, 0x6D, 0x63, 0x61, 0x67, 0x65, 0x18, 0x1B]
)
}
func testEncodeData() {
XCTAssertEqual(try encode(Data([1, 2, 3, 4, 5])), [0x45, 0x1, 0x2, 0x3, 0x4, 0x5])
}
func testEncodeURL() {
XCTAssertEqual(try encode(URL(string: "https://example.com/some/thing")),
[0xD8, 0x20, 0x78, 0x1E, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F,
0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x2F,
0x73, 0x6F, 0x6D, 0x65, 0x2F, 0x74, 0x68, 0x69, 0x6E, 0x67])
}
func testEncodeUUID() {
XCTAssertEqual(try encode(UUID(uuidString: "975AEBED-8060-4E4D-8A11-28C5E8DDD24C")),
[0xD8, 0x25, 0x50, 0x97, 0x5A, 0xEB, 0xED, 0x80, 0x60, 0x4E,
0x4D, 0x8A, 0x11, 0x28, 0xC5, 0xE8, 0xDD, 0xD2, 0x4C])
}
func testEncodePositiveDecimalNegativeExponent() {
XCTAssertEqual(try encode(Decimal(sign: .plus, exponent: -3, significand: 1234567)),
[0xC4, 0x82, 0x22, 0xC2, 0x43, 0x12, 0xD6, 0x87])
}
func testEncodePositiveDecimalPositiveExponent() {
XCTAssertEqual(try encode(Decimal(sign: .plus, exponent: 1, significand: 1234567)),
[0xC4, 0x82, 0x01, 0xC2, 0x43, 0x12, 0xD6, 0x87])
}
func testEncodeNegativeDecimalNegativeExponent() throws {
XCTAssertEqual(try encode(Decimal(sign: .minus, exponent: -3, significand: 1234567)),
[0xC4, 0x82, 0x22, 0xC3, 0x43, 0x12, 0xD6, 0x86])
}
func testEncodeNegativeDecimalPositiveExponent() {
XCTAssertEqual(try encode(Decimal(sign: .minus, exponent: 1, significand: 1234567)),
[0xC4, 0x82, 0x01, 0xC3, 0x43, 0x12, 0xD6, 0x86])
}
func testEncodePositiveBigInt() {
XCTAssertEqual(try encode(BigInt(1234567)),
[0xC2, 0x43, 0x12, 0xD6, 0x87])
}
func testEncodeNegativeBigInt() {
XCTAssertEqual(try encode(BigInt(-1234567)),
[0xC3, 0x43, 0x12, 0xD6, 0x86])
}
func testEncodePositiveBigUInt() {
XCTAssertEqual(try encode(BigUInt(1234567)),
[0xC2, 0x43, 0x12, 0xD6, 0x87])
}
func testEncodeAnyDictionary() throws {
let dict: AnyValue.AnyDictionary = ["b": 1, "z": 2, "n": 3, "f": 4]
XCTAssertEqual(try encode(dict),
[0xA4, 0x61, 0x62, 0x01, 0x61, 0x7A, 0x02, 0x61, 0x6E, 0x03, 0x61, 0x66, 0x04])
}
}
extension Array {
func chunked(into size: Int) -> [[Element]] {
return stride(from: 0, to: count, by: size).map {
Array(self[$0 ..< Swift.min($0 + size, count)])
}
}
}
| [
-1
] |
8b7e4a2db637f587b9d6f4bf00ddb89a73df8ac0 | 5fbf7159fd474fff1d38b2154ee15cf03f8b42c4 | /Extensions/Sources/UI/UIColor+Colors.swift | 7890a9f9b86d14810664341836a8f448b24cd10e | [
"MIT"
] | permissive | wavesplatform/WavesWallet-iOS | 578eb98561318fff782b80417fdbcb80bb52b11e | 6826c342feda13a010b5d3c5a9ebc1fadfbc3fa7 | refs/heads/develop | 2022-10-25T09:55:33.838485 | 2019-11-18T09:52:01 | 2019-11-18T09:52:01 | 139,603,017 | 52 | 34 | MIT | 2022-10-06T03:06:09 | 2018-07-03T15:24:58 | Swift | UTF-8 | Swift | false | false | 7,546 | swift | //
// UIColor+Additions.swift
// Waves app / iOS
//
// Generated on Zeplin. (4/26/2018).
// Copyright (c) 2018 __MyCompanyName__. All rights reserved.
//
import UIKit
public extension UIColor {
@nonobjc class var overlayDark: UIColor {
return UIColor(red: 0.0, green: 26.0 / 255.0, blue: 57.0 / 255.0, alpha: 0.2)
}
// @nonobjc class var white: UIColor {
// return UIColor(white: 1.0, alpha: 1.0)
// }
// @nonobjc class var black: UIColor {
// return UIColor(white: 0.0, alpha: 1.0)
// }
@nonobjc class var disabled666: UIColor {
return UIColor(red: 0.0 / 255.0, green: 26.0 / 255.0, blue: 57 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled500: UIColor {
return UIColor(white: 153.0 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled700: UIColor {
return UIColor(white: 119.0 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled900: UIColor {
return UIColor(white: 45.0 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled50: UIColor {
return UIColor(white: 250.0 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled100: UIColor {
return UIColor(white: 240.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic50: UIColor {
return UIColor(red: 248.0 / 255.0, green: 249.0 / 255.0, blue: 251.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic100: UIColor {
return UIColor(red: 237.0 / 255.0, green: 240.0 / 255.0, blue: 244.0 / 255.0, alpha: 1.0)
}
@nonobjc class var disabled400: UIColor {
return UIColor(white: 188.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic200: UIColor {
return UIColor(red: 218.0 / 255.0, green: 225.0 / 255.0, blue: 233.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic500: UIColor {
return UIColor(red: 155.0 / 255.0, green: 166.0 / 255.0, blue: 178.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic300: UIColor {
return UIColor(red: 197.0 / 255.0, green: 208.0 / 255.0, blue: 222.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic900: UIColor {
return UIColor(red: 38.0 / 255.0, green: 50.0 / 255.0, blue: 65.0 / 255.0, alpha: 1.0)
}
@nonobjc class var basic700: UIColor {
return UIColor(red: 78.0 / 255.0, green: 92.0 / 255.0, blue: 110.0 / 255.0, alpha: 1.0)
}
@nonobjc class var accent50: UIColor {
return UIColor(red: 233.0 / 255.0, green: 233.0 / 255.0, blue: 235.0 / 255.0, alpha: 1.0)
}
@nonobjc class var accent100: UIColor {
return UIColor(red: 206.0 / 255.0, green: 208.0 / 255.0, blue: 218.0 / 255.0, alpha: 1.0)
}
@nonobjc class var info50: UIColor {
return UIColor(red: 223.0 / 255.0, green: 234.0 / 255.0, blue: 248.0 / 255.0, alpha: 1.0)
}
@nonobjc class var info200: UIColor {
return UIColor(red: 197.0 / 255.0, green: 217.0 / 255.0, blue: 232.0 / 255.0, alpha: 1.0)
}
@nonobjc class var info300: UIColor {
return UIColor(red: 168.0 / 255.0, green: 198.0 / 255.0, blue: 223.0 / 255.0, alpha: 1.0)
}
@nonobjc class var info400: UIColor {
return UIColor(red: 141.0 / 255.0, green: 171.0 / 255.0, blue: 196.0 / 255.0, alpha: 1.0)
}
@nonobjc class var info500: UIColor {
return UIColor(red: 121.0 / 255.0, green: 149.0 / 255.0, blue: 185.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit50: UIColor {
return UIColor(red: 238.0 / 255.0, green: 245.0 / 255.0, blue: 254.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit100: UIColor {
return UIColor(red: 196.0 / 255.0, green: 208.0 / 255.0, blue: 239.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit200: UIColor {
return UIColor(red: 186.0 / 255.0, green: 202.0 / 255.0, blue: 244.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit300: UIColor {
return UIColor(red: 90.0 / 255.0, green: 129.0 / 255.0, blue: 234.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit400: UIColor {
return UIColor(red: 31.0 / 255.0, green: 90.0 / 255.0, blue: 246.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit500: UIColor {
return UIColor(red: 23.0 / 255.0, green: 81.0 / 255.0, blue: 236.0 / 255.0, alpha: 1.0)
}
@nonobjc class var submit700: UIColor {
return UIColor(red: 26.0 / 255.0, green: 74.0 / 255.0, blue: 200.0 / 255.0, alpha: 1.0)
}
@nonobjc class var success100: UIColor {
return UIColor(red: 164.0 / 255.0, green: 236.0 / 255.0, blue: 155.0 / 255.0, alpha: 1.0)
}
@nonobjc class var success50: UIColor {
return UIColor(red: 219.0 / 255.0, green: 245.0 / 255.0, blue: 211.0 / 255.0, alpha: 1.0)
}
@nonobjc class var success400: UIColor {
return UIColor(red: 74.0 / 255.0, green: 173.0 / 255.0, blue: 2.0 / 255.0, alpha: 1.0)
}
@nonobjc class var success300: UIColor {
return UIColor(red: 78.0 / 255.0, green: 206.0 / 255.0, blue: 61.0 / 255.0, alpha: 1.0)
}
@nonobjc class var successLime: UIColor {
return UIColor(red: 129.0 / 255.0, green: 201.0 / 255.0, blue: 38.0 / 255.0, alpha: 1.0)
}
@nonobjc class var warning100: UIColor {
return UIColor(red: 1.0, green: 235.0 / 255.0, blue: 192.0 / 255.0, alpha: 1.0)
}
@nonobjc class var warning400: UIColor {
return UIColor(red: 248.0 / 255.0, green: 183.0 / 255.0, blue: 0.0, alpha: 1.0)
}
@nonobjc class var warning600: UIColor {
return UIColor(red: 248.0 / 255.0, green: 147.0 / 255.0, blue: 0.0, alpha: 1.0)
}
@nonobjc class var warning50: UIColor {
return UIColor(red: 1.0, green: 245.0 / 255.0, blue: 223.0 / 255.0, alpha: 1.0)
}
@nonobjc class var error100: UIColor {
return UIColor(red: 1.0, green: 228.0 / 255.0, blue: 228.0 / 255.0, alpha: 1.0)
}
@nonobjc class var error200: UIColor {
return UIColor(red: 244.0 / 255.0, green: 177.0 / 255.0, blue: 165.0 / 255.0, alpha: 1.0)
}
@nonobjc class var error400: UIColor {
return UIColor(red: 229.0 / 255.0, green: 73.0 / 255.0, blue: 77.0 / 255.0, alpha: 1.0)
}
@nonobjc class var error500: UIColor {
return UIColor(red: 239.0 / 255.0, green: 72.0 / 255.0, blue: 41.0 / 255.0, alpha: 1.0)
}
@nonobjc class var error700: UIColor {
return UIColor(red: 183.0 / 255.0, green: 33.0 / 255.0, blue: 37.0 / 255.0, alpha: 1.0)
}
@nonobjc class var mixElton: UIColor {
return UIColor(red: 0.0, green: 174.0 / 255.0, blue: 249.0 / 255.0, alpha: 1.0)
}
@nonobjc class var mixOcean: UIColor {
return UIColor(red: 38.0 / 255.0, green: 193.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0)
}
@nonobjc class var mixUnicorn: UIColor {
return UIColor(red: 171.0 / 255.0, green: 125.0 / 255.0, blue: 246.0 / 255.0, alpha: 1.0)
}
@nonobjc class var success500: UIColor {
return UIColor(red: 57.0 / 255.0, green: 161.0 / 255.0, blue: 44.0 / 255.0, alpha: 1.0)
}
@nonobjc class var blueGrey: UIColor {
return UIColor(red: 155.0 / 255.0, green: 166.0 / 255.0, blue: 178.0 / 255.0, alpha: 1.0)
}
@nonobjc class var clearBlue: UIColor {
return UIColor(red: 51.0 / 255.0, green: 129.0 / 255.0, blue: 237.0 / 255.0, alpha: 1.0)
}
}
| [
-1
] |
7531dccd1fbdf9bd4db68ab1a610be3cbcc35603 | da49b40506d328bfb748ccdb93e16c4f03ab7f31 | /FamChat/RegisterViewController.swift | ca0ddebe670715cd50fa03bac203ef91b5574603 | [
"MIT"
] | permissive | mechdon/FamilyApp | d04fe14230355ccdf4ccc52ad56842c659ba27d1 | 16fe5690ebb8272cd4bdf706ddd4d34187caaf02 | refs/heads/master | 2021-01-10T08:08:16.935426 | 2015-10-13T06:39:46 | 2015-10-13T06:39:46 | 44,155,678 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,410 | swift | //
// RegisterViewController.swift
// FamChat
//
// Created by Gerard Heng on 13/8/15.
// Copyright (c) 2015 gLabs. All rights reserved.
//
import UIKit
import Parse
class RegisterViewController: UIViewController, UITextFieldDelegate {
// Textfield outlets
@IBOutlet weak var name: UITextField!
@IBOutlet weak var email: UITextField!
@IBOutlet weak var password: UITextField!
// Declare variables
var error = ""
var userId: String = ""
override func viewDidAppear(animated: Bool) {
// Set delegates for textfields
self.name.delegate = self
self.email.delegate = self
self.password.delegate = self
}
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> Int {
return UIInterfaceOrientation.Portrait.rawValue
}
// Textfield resigns first responder when return key is pressed
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
// Register button pressed
@IBAction func register(sender: AnyObject) {
var nameString: String = name.text
var userNameString: String = email.text
var emailString: String = email.text
var passwordString: String = password.text
// Prompt user to enter name if username field is empty
if nameString.isEmpty {
showAlertMsg("SignUp Error", errorMsg: "Please enter your name")
}
// Prompt user to enter email if email field is empty
else if emailString.isEmpty {
showAlertMsg("SignUp Error", errorMsg: "Please enter your email")
}
// Prompt user to enter password if password field is empty
else if passwordString.isEmpty {
showAlertMsg("SignUp Error", errorMsg: "Please enter your password")
}
else {
// SignUp user
var user = PFUser()
user.setObject(name.text, forKey: "Name")
user.username = email.text
user.password = password.text
user.email = email.text
IndicatorView.shared.showActivityIndicator(view)
user.signUpInBackgroundWithBlock {
(succeeded: Bool, signupError: NSError?) -> Void in
IndicatorView.shared.hideActivityIndicator()
if signupError == nil {
var image = UIImage(named: "profile.png")
var memberPhoto = PFFile(name: "photo.png", data: UIImagePNGRepresentation(image))
var member = PFObject(className: "Members")
member.setObject(user.objectId!, forKey: "userId")
member.setObject(self.name.text, forKey: "Name")
member.setObject(self.email.text, forKey: "email")
member.setObject(memberPhoto, forKey: "photo")
member.saveInBackground()
self.performSegueWithIdentifier("toTabBarController", sender: self)
} else {
if let errorString = signupError?.userInfo?["error"] as? NSString {
self.error = errorString as! String
} else {
self.error = "Please try again later"
}
self.showAlertMsg("SignUp Error", errorMsg: self.error)
}
}
}
}
// Show Alert Method
func showAlertMsg(errorTitle: String, errorMsg: String) {
var title = errorTitle
var errormsg = errorMsg
NSOperationQueue.mainQueue().addOperationWithBlock{ var alert = UIAlertController(title: title, message: errormsg, preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { action in
// No further action apart from dismissing this alert
}))
self.presentViewController(alert, animated: true, completion: nil)
}
}
}
| [
-1
] |
7b0f742653d0d1450ccfa309a5845b770b479ba2 | 1aef0914e5946872dcdbd16b96da6dd0e0f6320b | /Alome/ViewControllerSettings.swift | 7eb0cb1f28d9924fa2d4cb493bfc13f834792b16 | [] | no_license | BigAl2444/Alome-App | 42a69b6d0bd922f9a6f921e7ca1fe9d93a4c91bf | 1cc03e208e634260773bd55d8f64e514aabcdae0 | refs/heads/master | 2020-03-18T23:47:15.366163 | 2018-06-07T06:38:33 | 2018-06-07T06:38:33 | 135,428,131 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 860 | swift | //
// ViewControllerSettings.swift
// Alome
//
// Created by student on 1/6/18.
// Copyright © 2018 student. All rights reserved.
//
import UIKit
class ViewControllerSettings: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
277006,
282128,
286234,
317473,
295460,
284197,
286257,
300086,
279096,
288827,
226878,
159812,
228932,
288331,
288332,
284240,
280146,
200802,
292451,
276580,
307311,
53876,
284277,
284279,
284289,
227984,
282262,
117399,
307378,
276150,
277696,
227523,
228551,
280777,
279754,
284361,
298189,
229585,
239315,
226009,
298202,
298204,
280797,
298207,
363743,
282338,
294636,
234223,
289524,
280821,
288501,
280824,
358137,
358139,
280832,
230147,
226055,
287007,
277797,
282917,
283433,
282411,
289596,
300358,
234829,
279380,
279386,
289120,
308064,
291709,
290175,
275842,
183173,
226705,
310673,
226196,
283031,
283032,
283034,
283035,
283036,
227740,
294812,
277406,
289187,
284586,
230323,
278968,
127418,
281530,
278973,
291774,
295874,
289224,
281042,
316371,
163289,
279011,
286189,
277487,
356337,
293874,
227315,
277502
] |
2f3dfd678eeca008f7c075aabc4239296a2e8cc4 | 2dd8502d4619e1f67e84acec6952f483c69a6ce2 | /CalculatorDemoTests/CalculatorSubtractTests.swift | 9d65ecd584307377d3346d1a04ee20c46aff01c0 | [] | no_license | markopedu/CalculatorDemo | fcfd249a2cd122cb60e4f6e560585451fdc51051 | 0706412159f72fa0c553023c6182136b95749104 | refs/heads/main | 2023-02-15T12:52:57.163158 | 2021-01-08T09:03:02 | 2021-01-08T09:03:02 | 327,842,212 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 746 | swift | //
// CalculatorSubtractTests.swift
// CalculatorDemoTests
//
// Created by Marko Poikkimäki on 2021-01-08.
//
import XCTest
@testable import CalculatorDemo
class CalculatorSubtractTests: XCTestCase {
var calculator: Calculator!
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
calculator = Calculator()
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
calculator = nil
}
func testSubtract() {
let result = calculator.subtract(4, 2)
XCTAssertEqual(result, 2)
}
}
| [
176461
] |
d7016586695f00f10c33175c63da778b89dee15f | d9a7665db224344801c4be3f973ddaa3d97c3671 | /Checkers/Checkers/New Group/GameEngine.swift | 449bffb7742f9f1b27e73ab35a14ea334c96720b | [
"Apache-2.0"
] | permissive | pschuette22/Checkers-iOS | ed837c9153d579d8d6e44d4271db5bbe1e9796f4 | e263356d7a8be813044f50b1b074dfaa280ae05d | refs/heads/master | 2021-03-27T16:19:23.039738 | 2018-04-18T02:41:14 | 2018-04-18T02:41:14 | 123,521,844 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,244 | swift | //
// GameEngine.swift
// Checkers
//
// Created by Schuette, Peter on 3/3/18.
// Copyright © 2018 Zeppa. All rights reserved.
//
import Foundation
/// Checkers game engine
/// This drives the logic of the game
class GameEngine {
private weak var delegate: GameEngineDelegate?
private var activePlayer: Player
private var otherPlayer: Player {
get {
let isDown = activePlayer.pawnDirection == .down
let direction: Direction = isDown ? .up : .down
return delegate!.player(going: direction)
}
}
// Turn state logic variables
private var selectedTileIndex: TileIndex? {
didSet {
if selectedTileIndex == nil {
// After removing the selected tile index, remove valid moves
validMoves = nil
}
}
}
private var validMoves: [Move]?
private var isJumpChain = false
init(delegate: GameEngineDelegate, activePlayer: Player) {
self.delegate = delegate
self.activePlayer = activePlayer
}
}
// MARK: - Turn State Logic
extension GameEngine {
func didSelect(_ tileIndex: TileIndex) -> Bool {
// Indicates that a tile was tapped
guard let tile = delegate?.board.tile(at: tileIndex) else {
delegate?.selectIgnored("Unable to retrieve tile")
return false
}
if tile.piece == .outOfPlay {
delegate?.selectIgnored("Tile out of play")
} else if selectedTileIndex == nil {
// There isn't a currently selected tile,
return didStartTurn(for: activePlayer, on: tile, at: tileIndex)
} else if selectedTileIndex == tileIndex && !isJumpChain {
return didUnselectTile(at: tileIndex)
} else if tile.owner == activePlayer && !isJumpChain {
_ = didUnselectTile(at: selectedTileIndex!)
return didStartTurn(for: activePlayer, on: tile, at: tileIndex)
} else if let move = validMoves?.first(where: {$0.destination == tileIndex}) {
let otherMoves = validMoves?.filter({$0 != move}) ?? []
return didMove(move, ignoring: otherMoves)
}
// If we get here, this is an invalid tap
return false
}
private func didUnselectTile(at tileIndex: TileIndex) -> Bool {
delegate?.didUnselectTile(at: tileIndex, with: validMoves ?? [])
selectedTileIndex = nil
return true
}
private func didStartTurn(for player: Player, on tile: Tile, at index: TileIndex) -> Bool {
if tile.owner != activePlayer {
delegate?.selectIgnored("Tried to select tile active player doesn't own")
return false
}
// This owner has a tile at this location
// Calculate the moves from here
selectedTileIndex = index
validMoves = calculateMoves(for: player, on: tile, at: index, jumpsOnly: false)
delegate?.didStartTurn(at: index, with: validMoves!)
return true
}
private func calculateMoves(for player: Player, on tile: Tile, at index: TileIndex, jumpsOnly: Bool) -> [Move] {
if tile.owner != player {
fatalError("Cannot calculate moves for a tile the player does not own")
}
var moves = [Move]()
var verticals = [Direction]()
if tile.piece == .king {
verticals.append(contentsOf: [.up, .down])
} else if tile.piece == .pawn {
verticals.append(player.pawnDirection)
}
for moveIndex in index.validMoveIndexes(verticleMovements: verticals) {
// Iterate over the valid move indexes
// determine if movement to this tile is valid
guard let tile = delegate?.board.tile(at: moveIndex) else {
continue
}
if tile.piece == .empty && !jumpsOnly {
// add a change position move
moves.append(Move(target: index, destination: moveIndex, jumps: nil))
} else if tile.owner != nil && tile.owner != activePlayer {
// This tile is owned by the opponent
guard let jumpToIndex = moveIndex.jumpIndex,
let jumpedTile = delegate?.board.tile(at: jumpToIndex) else {
continue
}
if jumpedTile.piece == .empty {
// Add a jump move
moves.append(Move(target: index, destination: jumpToIndex, jumps: [moveIndex]))
}
}
}
return moves
}
private func didMove(_ move: Move, ignoring otherMoves: [Move]) -> Bool {
// Execute the move logic
guard let target = delegate?.board.tile(at: move.target), let destination = delegate?.board.tile(at: move.destination) else { return false }
let type = move.type
if type != .stay {
// King the piece as needed
if target.piece == .pawn && delegate?.board.isKingingTile(at: move.destination, for: activePlayer) ?? false {
target.piece = .king
}
delegate?.board.place(target.piece, withOwner: activePlayer, at: move.destination)
delegate?.board.setEmpty(at: move.target)
if type == .jump, let jumps = move.jumps {
delegate?.board.setEmpty(at: jumps.first!)
}
}
delegate?.didMove(move, ignoring: otherMoves)
if type == .jump && didSetupJumpChain(fromPrevious: move, on: destination) {
return true
}
return didFinishTurn(move)
}
/// Setup a double jump move
///
/// - Parameters:
/// - move: previous move leading into double jump
/// - tile: tile that piece landed on from previous move
/// - Returns: true if a chain jump is available
private func didSetupJumpChain(fromPrevious move: Move, on tile: Tile) -> Bool {
// Is there an opportunity for another jump ?
// Calculate jump moves for this tile
let activeTileIndex = move.destination!
var doubleJumpMoves = calculateMoves(for: activePlayer, on: tile, at: activeTileIndex, jumpsOnly: true)
if doubleJumpMoves.isEmpty {
return false
}
// Add stay move
let move = Move(target: activeTileIndex, destination: move.destination, jumps: nil)
doubleJumpMoves.append(move)
self.validMoves = doubleJumpMoves
selectedTileIndex = move.destination
delegate?.didStartTurn(at: activeTileIndex, with: doubleJumpMoves)
isJumpChain = true
return true
}
// Called when a move is completed
private func didFinishTurn(_ move: Move) -> Bool {
if delegate?.board.tileCount(for: otherPlayer) == 0 {
didFinishGame(winner: activePlayer)
}
// Switch the active player
activePlayer = otherPlayer
// Clear out the selected tile
selectedTileIndex = nil
isJumpChain = false
// indicates the player has finished their turn
return true
}
private func didFinishGame(winner:Player) {
delegate?.didFinishGame(winner)
}
}
| [
-1
] |
34ddedaa0b9b4dc28c781c94a34dd3ae4100fd44 | 0dadfba02dd0446de419c269031583339f562223 | /Covid Tracker/Controller/CountriesViewController.swift | b690881281560aabfbe8f28534326581c9604c64 | [] | no_license | umarchohan/Covid-19 | 97f0f729609e4f52be2e61669e7c0e87a384fe89 | 83fe4e3f6935c010d2f44953d686d9cc852d9969 | refs/heads/master | 2022-04-25T19:24:09.812554 | 2020-04-26T04:03:43 | 2020-04-26T04:03:43 | 258,934,043 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,964 | swift | //
// CountriesViewController.swift
// Covid Tracker
//
// Created by Umar Afzal on 4/19/20.
// Copyright © 2020 Umar Afzal. All rights reserved.
//
import UIKit
import LoadingShimmer
import SwiftyJSON
class CountriesViewController: UIViewController,UITableViewDelegate,UITableViewDataSource
{
//MARK:-IBOutlets
@IBOutlet weak var countriesTable: UITableView!
//MARK:-Properties
var dataLoaded:Bool = false
var countries:Array<CovidModel> = Array<CovidModel>()
//MARK:-Lifecycle
override func viewDidLoad()
{
super.viewDidLoad()
self.countriesTable.delegate = self
self.countriesTable.dataSource = self
LoadingShimmer.startCovering(self.countriesTable, with: [""])
getCountriesData()
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(false, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
//MARK:-Private
func getCountriesData()
{
CovidAPI.getAllCountriesData { (response, error, reach) in
if let json = response?.arrayValue
{
for country in json
{
let c = CovidModel.init(info: country)
if c.country != ""
{
self.countries.append(c)
}
}
self.dataLoaded = true
self.countriesTable.reloadData()
LoadingShimmer.stopCovering(self.countriesTable)
}
}
}
//MARK:-UITableViewDelegate/Datasource
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return dataLoaded ? self.countries.count: 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell:CountryCell = tableView.dequeueReusableCell(withIdentifier: "CountryCell", for: indexPath) as! CountryCell
cell.selectionStyle = .none
if dataLoaded
{
cell.setupCountry(country: countries[indexPath.row])
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
let view:CountryDetailsViewController = self.storyboard?.instantiateViewController(withIdentifier: "CountryDetailsViewController") as! CountryDetailsViewController
view.covidInfo = countries[indexPath.row]
self.navigationController?.pushViewController(view, animated: true)
}
//MARK:-IBActions
}
| [
-1
] |
176484068b06d0737eb3e2263350c5640b6836ff | 9ec7201e0ab13b9be72819a9785d8aad55652aac | /iOS/Deck/Deck/CardStack.swift | 7ab600589d1f835afc9b66b56a7be590d0ba2ecb | [] | no_license | jonathanreyes/Deck | 2c4522468c4ad7eb6c1895b26db38bd3e93c4029 | bf2018aa26531f14719e27f46f833b4195ba3255 | refs/heads/master | 2021-01-10T10:00:11.098006 | 2015-10-11T02:43:51 | 2015-10-11T02:43:51 | 43,183,451 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,069 | swift | //
// CardStack.swift
// Deck
//
// Created by Justin Shiiba on 10/10/15.
// Copyright © 2015 ChasslessApps. All rights reserved.
//
struct CardStack<T>: Stackable {
typealias CardType = T
internal var cards: [T]
init(cards: [T]) {
self.cards = cards
}
mutating func shuffle() {
cards.shuffleInPlace()
}
func count() -> Int {
return cards.count
}
mutating func cardAt(index: Int) -> T {
return cards.removeAtIndex(index) as T
}
mutating func invert() {
cards = cards.reverse()
}
mutating func pop() -> T? {
return cards.popLast()
}
mutating func removeAt(index: Int) -> T {
return cards.removeAtIndex(index) as T
}
mutating func push(card: T) {
cards.append(card)
}
mutating func push(cards stack: CardStack) {
self.cards.appendContentsOf(stack.cards)
}
mutating func insert(card: T, atIndex index: Int) {
cards.insert(card, atIndex: index)
}
}
| [
-1
] |
a8c8759b1f9614f14d58f05f468342fd34573d8d | ccd4ec6a13acb621db525717152f407043feceee | /TacoPOP/HeaderView.swift | bc00ef09c03adfba00b3f50d3bc99919f03e72ff | [] | no_license | ertus0409/TacoPOP | e8df7b5729fef478c156941eae29e3040c919fb4 | 8f464a4620a48147a662ec86474433218c3d19db | refs/heads/master | 2021-06-26T10:46:00.111742 | 2017-09-11T19:24:30 | 2017-09-11T19:24:30 | 103,178,221 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 209 | swift | //
// HeaderView.swift
// TacoPOP
//
// Created by Guner Babursah on 29/07/2017.
// Copyright © 2017 Guner Babursah. All rights reserved.
//
import UIKit
class HeaderView: UIView, DropShadow {
}
| [
-1
] |
5c1a2973736dd216655432394d471480c31c5ae4 | d8dd9cad60ed9554cf1c77ab714d6393ad250895 | /MiniRetoSem5/MiniS5.playground/Contents.swift | 7baa51abbd7753ef7385c81c6c48ebb4514afdde | [] | no_license | ezegongut/Hambur | 8a5da621f4ed6015f4be593c9d6ff3e8576e3e6b | a19043ab6155ce40664acd26047c69a24b8e0181 | refs/heads/master | 2020-12-24T20:42:51.110697 | 2016-04-22T12:50:32 | 2016-04-22T12:50:32 | 56,823,570 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 198 | swift | //: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
let color = UIColor(red: 30/255.0, green: 180/255.0, blue: 20/255.0, alpha: 1)
arc4random() % 100
| [
-1
] |
d1b0ef0966d2c46b80ecf2f7d9427619a633cf23 | 8e5aa8b6ce88cb8c2ee7e135ddf8eec45980eb14 | /property_management_app/View Controllers/PMPropertyInfoViewController.swift | b89ca7e0367d8b7443dc7e060b73d1ba6eacb92e | [] | no_license | forsythetony/cs4320-frontend | e813d03b44252297076e148bc0740ec8f02414f9 | 02d6fe6ee5f5d2d80b6306b472d0d7e03ec388aa | refs/heads/master | 2021-08-08T08:01:58.484182 | 2017-11-07T22:38:19 | 2017-11-07T22:38:19 | 109,359,030 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,439 | swift | //
// PMPropertyInfoViewController.swift
// property_management_app
//
// Created by Tony Forsythe on 11/3/17.
// Copyright © 2017 Tony Forsythe. All rights reserved.
//
import UIKit
import SnapKit
import AlamofireImage
class PMPropertyInfoViewController: UIViewController {
var propertyInfo : PMProperty?
private var infoScrollView : UIScrollView!
private var propImageView : UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
private func setup() {
}
private func setupScrollView() {
let sv = UIScrollView(frame: self.view.bounds)
}
private func setupImageView() -> UIImageView {
let img = UIImageView()
img.contentMode = .scaleAspectFit
return img
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
b47956f2e5bb43a96d4e7cb74fdee770f3c1ba2d | 33e482885bdb6ef3915be0493e6c4267b39b3234 | /iMottoApp/iMottoApp/MyGiftViewController.swift | d0f4cc208b5d52e8b8e7d622593e9b24edd3dc63 | [] | no_license | imotto/ios-app | 512f41b78d2456707f3e47fee6dcb1b5ba6e4f0a | 03c776885389ef5e3fd772bdc6cad3d255212f65 | refs/heads/master | 2020-05-26T17:08:28.876232 | 2017-03-15T02:08:10 | 2017-03-15T02:08:10 | 85,014,974 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,788 | swift | //
// MyGiftViewController.swift
// iMottoApp
//
// Created by zhangkai on 25/12/2016.
// Copyright © 2016 imotto. All rights reserved.
//
import UIKit
class MyGiftViewController: UIViewController, UITableViewDataSource {
var mid:Int64!
var page = 1
var gifts = [GiftExchangeModel]()
lazy var tableView: UITableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let backBtn = UIBarButtonItem(image: ImgGoBack, style: .plain, target: self, action: #selector(navBackTapped))
backBtn.tintColor = COLOR_NAV_TINT
self.navigationItem.leftBarButtonItem = backBtn
let giftImg = FAKIonIcons.iosCartOutlineIcon(withSize: 30).image(with: CGSize(width: 30, height: 30))
let giftBtn = UIBarButtonItem(image: giftImg, style: .plain, target: self, action: #selector(giftBtnTapped))
giftBtn.tintColor = COLOR_NAV_TINT
self.navigationItem.rightBarButtonItem = giftBtn
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: NAV_BG_IMG) , for: .default)
self.navigationItem.title = "我的礼品"
self.view.backgroundColor = UIColor.white
tableView.dataSource = self;
let nib = UINib(nibName: "MyGiftCell", bundle: nil)
tableView.register(nib, forCellReuseIdentifier: "MyGiftCell")
tableView.estimatedRowHeight = 60
tableView.rowHeight = UITableViewAutomaticDimension
tableView.separatorStyle = .none
self.view.addSubview(tableView)
tableView.snp.makeConstraints { (make) in
make.edges.equalTo(self.view)
}
let header = ESRefreshHeaderAnimator.init(frame: CGRect.zero)
let footer = ESRefreshFooterAnimator.init(frame: CGRect.zero)
let _ = self.tableView.es_addPullToRefresh(animator: header) { [weak self] in
self?.refresh()
}
let _ = self.tableView.es_addInfiniteScrolling(animator: footer) { [weak self] in
self?.loadMore()
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tableView.es_startPullToRefresh()
}
// MARK: - Private
private func refresh() {
self.page = 1
self.gifts.removeAll()
IMApi.instance.readUserExchanges(self.page, psize: 10) { (resp) in
if resp.isSuccess {
let marray = resp.Data!
self.gifts.append(contentsOf: marray)
self.tableView.reloadData()
self.tableView.es_stopPullToRefresh(completion: true)
if marray.count < DEFAULT_PAGE_SIZE {
self.tableView.es_noticeNoMoreData()
}
} else {
debugPrint("support Motto failure: \(resp.msg)")
self.tableView.es_stopPullToRefresh(completion: true)
}
}
}
private func loadMore() {
self.page += 1
IMApi.instance.readUserExchanges(self.page, psize: 10) { (resp) in
if resp.isSuccess {
let marray = resp.Data!
self.gifts.append(contentsOf: marray)
self.tableView.reloadData()
self.tableView.es_stopPullToRefresh(completion: true)
if marray.count < DEFAULT_PAGE_SIZE {
self.tableView.es_noticeNoMoreData()
} else {
self.tableView.es_stopLoadingMore()
}
} else {
debugPrint("support Motto failure: \(resp.msg)")
self.tableView.es_stopLoadingMore()
}
}
}
func giftBtnTapped(_ sender: AnyObject){
let storyboard = UIStoryboard(name: "Account", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "GiftsController")
self.navigationController?.pushViewController(controller, animated: true)
}
func buttonReceiveClicked(_ sender:UIButton) {
let controller = UIAlertController(title: "礼品签收", message: "确认已经收到礼品了?", preferredStyle: .alert)
controller.addAction(UIAlertAction(title: "是的", style: .cancel, handler: { (action) in
ToastManager.shared.makeToastActivity(self.view)
let gift = self.gifts[sender.tag]
IMApi.instance.doSignature("\(gift.id)", completion: { (resp) in
ToastManager.shared.hideToastActivity()
if resp.isSuccess{
self.tableView.es_startPullToRefresh()
} else {
self.view.window?.makeToast("发送失败,请重试。")
}
})
}))
controller.addAction(UIAlertAction(title: "还没有", style: .default, handler: { (action) in
}))
self.present(controller, animated: true, completion: nil)
}
func buttonReviewClicked(_ sender:UIButton) {
let gift = self.gifts[sender.tag]
let controller = AddReviewViewController()
controller.exchangeId = "\(gift.id)"
self.navigationController?.pushViewController(controller, animated: true)
}
// MARK: - UITableViewDataSource
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.gifts.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyGiftCell") as! MyGiftCell
let model = self.gifts[indexPath.row]
cell.imageViewLogo.image = ImgGiftPlaceholder
cell.labelName.text = model.giftName
cell.buttonAction.isHidden = true
cell.constraintButtonActionHeight.constant = 0
var status = ""
var statusHint = ""
switch model.deliverState {
case 0:
status = "待发放"
statusHint = "请耐心等待礼品发放"
break
case 1:
status = "运送中"
statusHint = "请耐心等待礼品投递"
cell.buttonAction.isHidden = false
cell.constraintButtonActionHeight.constant = 30
cell.buttonAction.setTitle("礼品签收", for: .normal)
cell.buttonAction.tag = indexPath.row
cell.buttonAction.addTarget(self, action: #selector(buttonReceiveClicked), for: .touchUpInside)
break
case 2:
status = "已签收"
statusHint = "已经确认签收"
cell.buttonAction.isHidden = false
cell.constraintButtonActionHeight.constant = 30
cell.buttonAction.setTitle("填写评价", for: .normal)
cell.buttonAction.tag = indexPath.row
cell.buttonAction.addTarget(self, action: #selector(buttonReviewClicked), for: .touchUpInside)
break
case 3:
status = "已退货"
statusHint = "已经进行退货处理"
break
case 9:
status = "已评价"
statusHint = "交易已完成"
break
default:
status = ""
statusHint = "已无法跟踪状态"
}
cell.labelStatus.text = status
let info = "您在\(friendlyTime(model.exchangeTime))使用\(model.total)枚金币兑换\(model.amount)件此礼品,\(statusHint)"
cell.labelDesc.text = info
return cell
}
// MARK: -
}
| [
-1
] |
c7ea62820e5a4f49355c7c80169957f0f48403a1 | 0d2504198d24be0e8eb2362b8dc9e55414b26db9 | /WeatherBot/PaddedLabel.swift | eb15ed22fbd41856f7d11243a93b740894de44f4 | [] | no_license | freak-lather/WeatherBot | 32304a8e72c38bc3d2d956f7633ea67a3851a2fd | 55a4f0f766c3fded4f16b7002963fff112a333f8 | refs/heads/master | 2022-11-02T21:45:21.072668 | 2020-06-20T20:17:03 | 2020-06-20T20:17:03 | 273,777,329 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 161 | swift | //
// PaddedLabel.swift
// WeatherBot
//
// Created by ajay lather on 06/06/20.
// Copyright © 2020 Ajay Lather. All rights reserved.
//
import Foundation
| [
-1
] |
b64de9e0d297d033a06cdb3928d2e1c59d8704dd | 2c6fe7a44397e71935f76e053622440ebe964669 | /VALÚTests/VALU_Tests.swift | 5424a790be92eaad632d3f7b40198d6ca5d04d49 | [] | no_license | serjomac/VALU | a56ab654d937bda0c0be3dd488c88015e8512b79 | cb811c30747c688455433e7569224d8e3494929d | refs/heads/master | 2020-05-22T22:32:48.080789 | 2019-05-14T04:59:17 | 2019-05-14T04:59:17 | 186,547,501 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 881 | swift | //
// VALU_Tests.swift
// VALÚTests
//
// Created by iMac on 5/10/19.
// Copyright © 2019 vale. All rights reserved.
//
import XCTest
@testable import VALU_
class VALU_Tests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
229430,
319542,
163896,
180280,
376894,
352326,
254027,
311372,
163917,
311374,
196691,
278615,
385116,
237663,
254048,
319591,
221290,
278634,
131178,
319598,
352368,
204916,
131191,
237689,
131198,
278655,
319629,
311438,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
32941,
278704,
377009,
278708,
180408,
131256,
295098,
139479,
254170,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
180493,
278797,
254226,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
336183,
180535,
278842,
287041,
139589,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
246136,
246137,
139640,
311685,
106888,
385417,
311691,
385422,
213403,
246178,
385454,
311727,
377264,
319930,
311738,
33211,
336317,
278970,
336320,
311745,
278978,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
311786,
319981,
319987,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
279062,
393751,
279065,
377376,
377386,
197167,
385588,
352829,
115270,
377418,
385615,
426576,
369235,
139872,
66150,
344680,
295536,
287346,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
295576,
205471,
344738,
139939,
279206,
295590,
287404,
205487,
295599,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
246503,
369385,
312052,
312053,
172792,
344827,
221948,
279294,
205568,
295682,
336648,
197386,
434957,
312079,
295697,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
295724,
353069,
197422,
353070,
164656,
295729,
312108,
328499,
353078,
197431,
230199,
353079,
336702,
295746,
353094,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
246641,
246643,
295798,
246648,
361337,
279417,
254850,
369538,
287622,
295824,
189348,
353195,
140204,
377772,
353197,
304051,
230332,
377790,
353215,
353216,
213957,
213960,
345033,
279498,
386006,
418776,
50143,
123881,
320494,
304110,
287731,
271350,
295927,
304122,
320507,
328700,
312314,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
320536,
197657,
336929,
369701,
345132,
238639,
312373,
238651,
336960,
377926,
214086,
238664,
296019,
353367,
156764,
156765,
304222,
230499,
173166,
312434,
377972,
353397,
337017,
377983,
402565,
279685,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
230588,
353479,
353481,
353482,
402634,
189652,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
320796,
222494,
115998,
279854,
353584,
345396,
386359,
345402,
312634,
378172,
116026,
222524,
279875,
345415,
312648,
337225,
304456,
230729,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
296303,
279920,
312689,
296307,
116084,
181625,
337281,
148867,
378244,
296329,
304524,
296335,
9619,
370071,
279974,
173491,
304564,
279989,
353719,
280004,
361927,
370123,
148940,
280013,
312782,
222675,
329173,
353750,
271843,
280041,
361963,
329200,
321009,
296433,
280055,
288249,
230913,
329225,
230921,
296461,
304656,
329232,
370197,
402985,
394794,
230959,
312880,
288309,
312889,
288318,
124485,
288326,
288327,
280147,
239198,
157281,
99938,
345700,
312940,
222832,
247416,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
345752,
255649,
321199,
337591,
321207,
296632,
280251,
321219,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
181975,
280278,
280280,
18138,
345821,
321247,
321249,
345833,
345834,
280300,
67315,
173814,
313081,
124669,
288512,
288516,
280329,
321295,
321302,
345879,
116505,
321310,
255776,
313120,
247590,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
280392,
345929,
337747,
18262,
362327,
370522,
345951,
362337,
345955,
296806,
288619,
296814,
214895,
313199,
362352,
313203,
124798,
182144,
305026,
247686,
67463,
329622,
337815,
124824,
214937,
436131,
354212,
313254,
436137,
362417,
124852,
288697,
362431,
214977,
280514,
174019,
214984,
321480,
362443,
247757,
231375,
280541,
329695,
436191,
313319,
337895,
174057,
247785,
436205,
296941,
124911,
329712,
362480,
223218,
313339,
43014,
354316,
313357,
182296,
239650,
223268,
329765,
354343,
354345,
223274,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
354385,
338003,
280661,
329814,
338007,
354393,
280675,
329829,
321637,
280677,
43110,
436329,
313447,
288879,
280694,
223350,
288889,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
379071,
280768,
338119,
149703,
346314,
321745,
280795,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
125193,
321800,
125198,
125199,
272658,
125203,
338197,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
182597,
182598,
280902,
289110,
215385,
272729,
379225,
354655,
321894,
280939,
313713,
354676,
436608,
362881,
248194,
240002,
436611,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
281037,
289232,
281040,
256477,
330218,
281072,
109042,
174593,
240131,
420369,
289304,
207393,
182817,
289332,
174648,
338489,
338490,
322120,
281166,
297560,
354911,
436832,
436834,
191082,
313966,
420463,
281199,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
330388,
264856,
289434,
346779,
338613,
289462,
314040,
109241,
158394,
248517,
363211,
363230,
289502,
264928,
338662,
330474,
346858,
289518,
322291,
199414,
35583,
363263,
191235,
322313,
322316,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
289598,
420677,
281427,
281433,
322395,
109409,
330609,
174963,
207732,
109428,
158593,
240518,
109447,
224145,
355217,
256922,
289690,
240544,
420773,
289703,
240552,
363438,
347055,
289722,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
248796,
248797,
207838,
347103,
314342,
52200,
412651,
289774,
347123,
240630,
314362,
257024,
330754,
134150,
330763,
330772,
322582,
281626,
175132,
248872,
322612,
314448,
339030,
281697,
314467,
281700,
257125,
322663,
281706,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
339102,
265379,
249002,
306346,
3246,
421048,
339130,
322749,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
208164,
372009,
412971,
298291,
306494,
216386,
224586,
372043,
331090,
314709,
314710,
372054,
159066,
134491,
314720,
314726,
306542,
380271,
314739,
249204,
249205,
208244,
290169,
290173,
306559,
314751,
224640,
306560,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
314791,
396711,
396712,
241066,
282024,
314798,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
191981,
282096,
191990,
290301,
282114,
372227,
323080,
323087,
323089,
175639,
388632,
396827,
282141,
134686,
282146,
306723,
347694,
290358,
265798,
282183,
265804,
224847,
118353,
396882,
290390,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
224901,
282245,
323207,
282246,
290443,
323217,
282259,
257699,
323236,
298661,
282280,
61101,
224946,
110268,
224958,
323263,
323264,
282303,
274115,
306890,
241361,
241365,
298712,
298720,
12010,
282348,
282358,
175873,
339715,
323331,
323332,
216839,
339720,
372496,
323346,
249626,
282400,
241441,
339745,
241442,
315171,
257830,
421672,
282417,
200498,
282427,
315202,
307011,
282438,
159562,
413521,
216918,
241495,
282480,
241528,
315264,
339841,
241540,
315273,
315274,
372626,
380821,
282518,
282519,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
102437,
315432,
315434,
102445,
233517,
176175,
282672,
241716,
241720,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
315497,
315498,
438377,
299121,
233589,
266357,
233590,
422019,
241808,
381073,
323729,
233636,
299174,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
12542,
184575,
381208,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
127284,
332085,
332089,
315706,
282939,
241986,
438596,
332101,
323913,
348492,
323916,
323920,
250192,
282960,
348500,
168281,
332123,
332127,
323935,
242023,
242029,
160110,
242033,
250226,
291192,
315770,
315773,
291198,
340357,
225670,
332167,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
315811,
381347,
61859,
340398,
61873,
299441,
61880,
283064,
291265,
127427,
127428,
283075,
291267,
324039,
373197,
176601,
242139,
160225,
242148,
127465,
291311,
233978,
324097,
291333,
340490,
258581,
291358,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
340558,
381517,
332378,
201308,
242273,
242277,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
332446,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
299746,
234217,
299759,
299776,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
291612,
152365,
422703,
422709,
152374,
242485,
160571,
430910,
160575,
160580,
299849,
283467,
381773,
201549,
201551,
242529,
349026,
357218,
275303,
177001,
201577,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
349072,
308112,
209817,
324506,
324507,
390045,
127902,
185250,
324517,
185254,
316333,
373687,
316343,
349121,
373706,
316364,
340955,
340961,
324586,
340974,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
218186,
250956,
300111,
341073,
439384,
250981,
300135,
316520,
300136,
316526,
357486,
144496,
300150,
291959,
300151,
160891,
341115,
300158,
349316,
349318,
373903,
169104,
177296,
308372,
324760,
119962,
300187,
300188,
283802,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
333011,
316627,
357595,
333022,
234733,
234742,
128251,
292091,
316669,
439562,
292107,
242954,
414990,
251153,
177428,
349462,
333090,
382258,
300343,
382269,
333117,
193859,
300359,
177484,
406861,
259406,
234831,
251213,
120148,
283991,
357719,
316765,
374109,
292195,
333160,
243056,
316787,
111993,
357762,
112017,
112018,
234898,
259475,
275859,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
284107,
366037,
210390,
210391,
210392,
210393,
144867,
103909,
316902,
54765,
251378,
308723,
333300,
333303,
300536,
300542,
210433,
366083,
292356,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
349726,
333343,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
292423,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
415338,
243307,
120427,
54893,
325231,
333430,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
333509,
259781,
333517,
333520,
333521,
333523,
325346,
333542,
153319,
325352,
284401,
325371,
194303,
194304,
284429,
284431,
243472,
161554,
366360,
284442,
325404,
325410,
341796,
399147,
431916,
284459,
317232,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
128862,
300894,
284514,
276327,
292712,
325484,
423789,
292720,
325492,
276341,
341879,
317304,
333688,
112509,
194429,
325503,
55167,
333701,
243591,
317323,
325515,
243597,
325518,
333722,
350109,
292771,
300963,
333735,
415655,
284587,
292782,
317360,
243637,
284619,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
243759,
129076,
243767,
358456,
325694,
309345,
194666,
260207,
432240,
284788,
333940,
292992,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
333996,
227513,
301251,
309444,
227524,
334042,
194782,
301279,
317664,
243962,
375039,
309503,
194820,
375051,
325905,
325912,
186650,
227616,
211235,
432421,
211238,
325931,
358703,
358709,
260418,
325968,
6481,
366930,
366929,
6489,
334171,
391520,
383332,
383336,
317820,
211326,
317831,
227725,
252308,
317852,
121245,
285084,
285090,
375207,
342450,
334260,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
301571,
342536,
342553,
416286,
375333,
293419,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
244327,
39530,
301689,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
318130,
383667,
293556,
342706,
342713,
285373,
39614,
154316,
334547,
318173,
375526,
285415,
342762,
342763,
293612,
129773,
154359,
432893,
162561,
285444,
383754,
326414,
310036,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
285487,
301871,
375609,
293693,
342847,
252741,
318278,
293711,
244568,
244570,
293730,
351077,
342887,
400239,
310131,
269178,
400252,
359298,
359299,
260996,
113542,
416646,
228233,
392074,
228234,
236428,
56208,
326553,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
326581,
326587,
326601,
359381,
433115,
343005,
130016,
64485,
326635,
203757,
187374,
383983,
277492,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
326685,
252958,
252980,
203830,
359478,
302139,
359495,
392290,
253029,
228458,
318572,
15471,
351344,
187506,
285814,
285820,
392318,
187521,
384131,
302213,
302216,
228491,
228493,
285838,
162961,
326804,
285851,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
228540,
228542,
302274,
367810,
343234,
244940,
228563,
195808,
310497,
228588,
253167,
302325,
261377,
228609,
245019,
253216,
130338,
130343,
130348,
261425,
351537,
171317,
326966,
318775,
286013,
286018,
146762,
294218,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
294275,
253317,
384393,
368011,
318864,
318868,
212375,
318875,
212382,
310692,
245161,
286129,
286132,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
302540,
64975,
310736,
327121,
228827,
310748,
286172,
310757,
187878,
245223,
343542,
343543,
286202,
359930,
286205,
302590,
228867,
253451,
253452,
359950,
146964,
253463,
187938,
286244,
245287,
245292,
286254,
196164,
56902,
228943,
179801,
196187,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
229001,
310923,
188048,
302739,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
384695,
319162,
327358,
286399,
212685,
384720,
245457,
302802,
278234,
294622,
278240,
229088,
212716,
212717,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
294700,
409394,
319288,
319292,
360252,
360264,
188251,
376669,
245599,
237408,
425825,
302946,
425833,
417654,
188292,
253829,
327557,
294807,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
294886,
253929,
327661,
278512,
311281,
311282
] |
97808beb11f6f5725dc9deeabf4943cf31032935 | 22717b61a504d623214a7a809a9f37b935753d41 | /Sources/EtsyRequestKit/Request.swift | 793ecd4b5be6ebca9df21ea8e314ed3ee20020ba | [
"MIT"
] | permissive | nicholasspencer/EtsyKit | b28ada106471bb7f480ed934e42c7e2e5bdc8da4 | 487c3ab14f446cc9fd4be19f8c1943d9637991ab | refs/heads/master | 2020-05-30T02:34:26.256614 | 2019-06-10T22:30:57 | 2019-06-10T22:30:57 | 189,500,392 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 49 | swift | import Foundation
typealias Request = URLRequest | [
-1
] |
66261513b4da4d32fd5156e08f3096621b559ad1 | 462940a076f22ccd494da37d89f314a0a41de06b | /06-12-2017/ProjectWSRest/ProjectWSRest/Service/AuthInterceptor.swift | 4508a7e697d71a7cd1075db02c5dbf478f78af48 | [] | no_license | julianoeloilima/StudyIOS | a47280cbff203f6ee4ed7153ef878ae012583060 | 4adff8c20b8a63d6c13272df5f8880aebd18aeba | refs/heads/master | 2021-08-29T09:59:26.416809 | 2017-12-13T16:06:33 | 2017-12-13T16:06:33 | 111,857,016 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 639 | swift | //
// CurlInterceptor.swift
// ProjectWSRest
//
// Created by Aloc SP08608 on 07/12/2017.
// Copyright © 2017 Aloc SP08608. All rights reserved.
//
import Foundation
import Genome
import Alamofire
import EasyRest
open class AuthInterceptor: Interceptor {
required public init() {}
open func requestInterceptor<T: NodeInitializable>(_ api: API<T>) {
if let token = LoginService.getLoggedUser()?.accessToken {
api.headers["Authorization"] = "Bearer \(token)"
}
}
open func responseInterceptor<T: NodeInitializable>(_ api: API<T>, response: DataResponse<Any>) {
}
}
| [
-1
] |
be2212e7a0ccb18cb4c35357bfe67d2a818ec808 | 20b24a5322b0694124412541d08c148137e6339b | /Bundle/HomeTableViewController.swift | 066a85852806d955005d636871834432294ff438 | [] | no_license | SeanMurphy15/bundle-public | b87d548b04b535fbbf1cc801795c30a7ede0e39d | c0affd63999ef912c9c3e319bb2448f83bd3eb23 | refs/heads/master | 2020-04-18T21:53:48.846071 | 2016-09-07T21:24:08 | 2016-09-07T21:24:08 | 67,644,755 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,850 | swift | //
// HomeVC.swift
// Bundle
//
// Created by Sean Murphy on 4/11/16.
// Copyright © 2016 Bundle. All rights reserved.
//
import UIKit
@IBDesignable
class HomeTableViewController: UITableViewController {
@IBOutlet weak var notificationsButton: UIBarButtonItem!
@IBOutlet weak var menuButton: UIBarButtonItem!
var bundleArray = [Bundle]()
override func viewDidLoad() {
super.viewDidLoad()
tableView.registerNib(UINib(nibName: "BundleCell", bundle: nil), forCellReuseIdentifier: "bundleCell")
tableView.registerNib(UINib(nibName: "HeaderCell", bundle: nil), forCellReuseIdentifier: "headerCell")
self.placeLogoInNavigationBar()
menuButton.target = self.revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
let attributes = [NSFontAttributeName: UIFont.fontAwesomeOfSize(20)] as Dictionary!
menuButton.setTitleTextAttributes(attributes, forState: .Normal)
menuButton.title = String.fontAwesomeIconWithName(.Navicon)
notificationsButton.setTitleTextAttributes(attributes, forState: .Normal)
notificationsButton.title = String.fontAwesomeIconWithName(.Bell)
tableView.sectionHeaderHeight = UITableViewAutomaticDimension
tableView.estimatedSectionHeaderHeight = 129.0
tableView.estimatedRowHeight = 172.0
tableView.separatorStyle = .None
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
BundleController.fetchUserBundles { (success, bundles) in
if success {
if let bundles = bundles {
self.bundleArray = bundles
self.tableView.reloadData()
}
}
}
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerCell = tableView.dequeueReusableCellWithIdentifier("headerCell") as! HeaderCell
headerCell.isProfileHeader()
let header = headerCell.contentView
return header
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return bundleArray.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("bundleCell") as! BundleCell
let bundle = bundleArray[indexPath.row]
if let price = ConversionController.convertIntToString(bundle.price!){
if let priceType = bundle.bundleEventPriceStructureType {
cell.bundlePrice.text = "$\(price) \(priceType)"
}
}
cell.bundleEventNameLabel.text = bundle.bundleEventName
cell.bundleDescriptionTextView.text = bundle.description
cell.selectionStyle = .None
cell.updateUI()
return cell
}
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.alpha = 0
UIView.animateWithDuration(0.5) {
cell.alpha = 1
}
}
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.alpha = 1
UIView.animateWithDuration(0.5) {
cell.alpha = 0
}
}
@IBAction func notificationsButtonPressed(sender: AnyObject) {
let notificationsVC = UIStoryboard(name: "Notifications", bundle: nil).instantiateViewControllerWithIdentifier("notificationsTableViewController") as! UINavigationController
self.presentViewController(notificationsVC, animated: true, completion: nil)
}
}
| [
-1
] |
b4d2e64fe78bb1f026a9e876a30a7ec972f0eaad | b4ab4669bcc5499029d5457722616e909fa1eb47 | /assignment1/assignment1/Wonders.swift | bbdcfd96bcc40c6050abae9926cb0c44579f089f | [] | no_license | A00430396/IOS_Assignment3 | b7375dc5490aae1ba81db4720ad8e56eca2c7b98 | 5edd523ff2a0c615ca73840e5cd4d2bff7ab5c3a | refs/heads/master | 2020-07-05T22:30:06.292916 | 2019-08-16T21:37:23 | 2019-08-16T21:37:23 | 202,801,897 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,503 | swift | //
// wonders.swift
// assignment1
//
// Created by Talwinder saini on 2019-07-20.
// Copyright © 2019 nishant_talwinder. All rights reserved.
//
import Foundation
class Wonders: NSObject, NSCoding {
var name: String
var wonderDescription: String?
var userRating: Double
var imageURL: String
var coordinates: [Double]
struct PropertyKey {
static let name = "name"
static let description = "description"
static let userRating = "userRating"
static let imageURL = "imageURL"
static let coordinates = "coordinates"
}
init?(wonder: [String: Any]) {
guard let properties = wonder["properties"] as? [String: Any], let geometry = wonder["geometry"] as? [String: Any] else { return nil }
self.name = properties["name"] as? String ?? ""
self.wonderDescription = properties["description"] as? String
self.userRating = properties["userRating"] as? Double ?? 0.0
self.imageURL = properties["imageURL"] as? String ?? ""
self.coordinates = geometry["coordinates"] as? [Double] ?? []
}
init(name: String, wonderDescription: String?, userRating: Double, imageURL: String, coordinates: [Double]) {
self.name = name
self.wonderDescription = wonderDescription
self.userRating = userRating
self.imageURL = imageURL
self.coordinates = coordinates
}
func encode(with aCoder: NSCoder) {
aCoder.encode(name, forKey: PropertyKey.name)
aCoder.encode(wonderDescription, forKey: PropertyKey.description)
aCoder.encode(userRating, forKey: PropertyKey.userRating)
aCoder.encode(imageURL, forKey: PropertyKey.imageURL)
aCoder.encode(coordinates, forKey: PropertyKey.coordinates)
}
required convenience init?(coder aDecoder: NSCoder) {
let name = aDecoder.decodeObject(forKey: PropertyKey.name) as? String ?? ""
let wonderDescription = aDecoder.decodeObject(forKey: PropertyKey.description) as? String
let userRating = aDecoder.decodeObject(forKey: PropertyKey.userRating) as? Double ?? 0.0
let imageURL = aDecoder.decodeObject(forKey: PropertyKey.imageURL) as? String ?? ""
let coordinates = aDecoder.decodeObject(forKey: PropertyKey.coordinates) as? [Double] ?? [0.0, 0.0]
self.init(name: name, wonderDescription: wonderDescription, userRating: userRating, imageURL: imageURL, coordinates: coordinates)
}
}
| [
-1
] |
fedf70b7f5cc1b4c60afa2c9813694e337e8c0e1 | 1a60149535e050bcbd9a4f65cebbe6e7790285cd | /Sources/Shelly/ShellyError.swift | 0fa5c53ec18ae8a1124336532b5e4652487d3c42 | [
"MIT"
] | permissive | drekka/Shelly | d5bad44d1e94a9fdc7001574d03871fe335ef3a8 | 1afc98c43257fc3e46e71c90e50e1060c6053d40 | refs/heads/master | 2020-03-31T20:07:47.072705 | 2018-10-22T03:43:29 | 2018-10-22T03:43:29 | 152,526,563 | 0 | 0 | null | 2018-10-18T05:01:04 | 2018-10-11T03:37:23 | Swift | UTF-8 | Swift | false | false | 1,370 | swift |
// Created by Derek Clarkson on 18/9/18.
import Basic
public enum ShellyError: Error, CustomStringConvertible {
case invalidCurrentDirectory
case missingArgument(String)
case illegalArgument(String, String)
case argumentNotFound
case noSubcommandPassed
case incorrectFile(String)
case folderNotFound(AbsolutePath)
case notAFolder(AbsolutePath)
public var description: String {
switch self {
case let .missingArgument(argument):
return "Missing argument. '\(argument)' is required."
case .invalidCurrentDirectory:
return "Unable to obtain the current working directory."
case .argumentNotFound:
return "Argument handler not found."
case .noSubcommandPassed:
return "No sub-command found. Please use '--help' to see a list of all valid subcommands."
case let .incorrectFile(message):
return "Incorrect file passed: \(message)"
case let .notAFolder(filePath):
return "Specified path: \(filePath.prettyPath()) - is not a valid folder."
case let .folderNotFound(filePath):
return "Folder not found: \(filePath.prettyPath())"
case let .illegalArgument(arg, unless):
return "Illegal argument: \(arg) is not allowed unless \(unless)"
}
}
}
| [
-1
] |
74daa25aabb5aace768478fe86031a6804710e08 | 19211731faa473d1d3dd587b106b8e231818a780 | /MyTravelHelper/Modules/SearchTrains/Entity/Stations.swift | cdd437a347920496635ce92383d2c5e505da8cea | [] | no_license | biswarulz/TechTest | 6c7ed76fbac38785ef063c1c24eb63f151608be7 | df6469ccd32b49e474a01b1ba6a40d71e39ecb64 | refs/heads/main | 2023-05-14T14:43:14.463535 | 2021-05-31T15:04:48 | 2021-05-31T15:04:48 | 372,504,374 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,815 | swift | //
// Stations.swift
// MyTravelHelper
//
// Created by Satish on 11/03/19.
// Copyright © 2019 Sample. All rights reserved.
//
import Foundation
struct Stations: Codable {
var stationsList: [Station]
enum CodingKeys: String, CodingKey {
case stationsList = "objStation"
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(stationsList, forKey: .stationsList)
}
}
struct Station: Codable {
var stationDesc: String
var stationLatitude: Double
var stationLongitude: Double
var stationCode: String
var stationId: Int
enum CodingKeys: String, CodingKey {
case stationDesc = "StationDesc"
case stationLatitude = "StationLatitude"
case stationLongitude = "StationLongitude"
case stationCode = "StationCode"
case stationId = "StationId"
}
init(desc: String, latitude: Double, longitude: Double, code: String, stationId: Int) {
self.stationDesc = desc
self.stationLatitude = latitude
self.stationLongitude = longitude
self.stationCode = code
self.stationId = stationId
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
let desc = try values.decode(String.self, forKey: .stationDesc)
let lat = try values.decode(Double.self, forKey: .stationLatitude)
let long = try values.decode(Double.self, forKey: .stationLongitude)
let code = try values.decode(String.self, forKey: .stationCode)
let stationId = try values.decode(Int.self, forKey: .stationId)
self.init(desc: desc, latitude: lat, longitude: long, code: code, stationId: stationId)
}
}
| [
-1
] |
65c9661945e5c3d1892045dec8ee33bbd9998ee2 | 48a792448fdbfdd9e238dc95858352c00e2a1867 | /Tests/LinuxMain.swift | 810b6cbefd6f7bf4f565f3bc9f0ca14d9cda3f34 | [
"MIT"
] | permissive | joelypoley/SwiftFFTW | 2ef48ce960c6d72a5952f6e53dbe736d70954ed9 | a7d78a68627200f93d3da1606cd14c8844e4137e | refs/heads/master | 2020-12-20T08:10:03.625573 | 2020-01-24T15:00:38 | 2020-01-24T15:00:38 | 236,010,355 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 120 | swift | import XCTest
import SwiftFFTWTests
var tests = [XCTestCaseEntry]()
tests += SwiftFFTWTests.allTests()
XCTMain(tests)
| [
248320,
45058,
254467,
222725,
145938,
35347,
238613,
323613,
217120,
241184,
342562,
333349,
224296,
35372,
199216,
168501,
321591,
54336,
253504,
175173,
187467,
352334,
341076,
184406,
327256,
345191,
139367,
312943,
253046,
346746,
347259,
323711,
160899,
245389,
258709,
315548,
343205,
314022,
352942,
315575,
229049,
325305,
222401,
323781,
357063,
339668,
223960,
254173,
352992,
323818,
329453,
211187,
315124,
337651,
65272,
194809,
315135,
319236,
374023,
208138,
136462,
315151,
353048,
353560,
347418,
321820,
336672,
342307,
334116,
341808,
347444,
321846,
30010,
368445,
325452,
323408,
253782,
253786,
253790,
351071,
38753,
253794,
244581,
211814,
246117,
253802,
351083,
106860,
316780,
253810,
240501,
179063,
337272,
359288,
421793,
57767,
219048,
354215,
222124,
5043,
344504,
343486,
326592,
329152,
373199,
340946,
363479,
319458,
241123,
319462,
351207,
340969,
247798
] |
5f711b2dc98e9a4f759430e836841fe80618b6fd | 74926e2e6615f48b19f39395fd34999960c06558 | /rff/ViewController/Sales/sales order approval/main view/SalesOrderApprovalViewController.swift | 68e4dc48856108cf78f8d14eadcceb24dddab3e6 | [] | no_license | Riyadhfoods/rff.app | 33525a3c744167f1645ac645b754dcdd6f645193 | b3065711287b56a0db61e23fec6723e654e778ed | refs/heads/master | 2020-03-21T17:58:53.170175 | 2018-11-01T06:20:34 | 2018-11-01T06:20:34 | 138,865,486 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,248 | swift | //
// SalesOrderApprovalViewController.swift
// rff
//
// Created by Riyadh Foods Industrial Co. on 26/08/1439 AH.
// Copyright © 1439 Riyadh Foods Industrial Co. All rights reserved.
//
import UIKit
class SalesOrderApprovalViewController: UIViewController, ApprovalOrderConfomationDelegate {
// -- MARK: IBOutlets
@IBOutlet weak var menuBtn: UIBarButtonItem!
@IBOutlet weak var salesOrdertableview: UITableView!
@IBOutlet weak var aiContainer: UIView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
// -- MAKR: Variables
let cellId = "cell_salesOrderApproval"
let screenSize = AppDelegate.shared.screenSize
let webService = SalesOrderApproveService.instance
var salesOrderDetails: [SalesOrderApproveModul] = [SalesOrderApproveModul]()
var rowIndexSelected = 0
var isApproved = false
var isRejected = false
func orderRequestStatus(isApproved: Bool) {
self.isApproved = isApproved
}
func orderRequestStatus(isRejected: Bool) {
self.isRejected = isRejected
}
// -- MARK: viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
setCustomNavAndBackButton(navItem: navigationItem, title: "Sales Order Approval".localize(), backTitle: "Return".localize())
start()
setViewAlignment()
setSlideMenu(controller: self, menuButton: menuBtn)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
CommonFunction.shared.getCurrentViewContoller(Target: self)
if salesOrderDetails.isEmpty || isApproved || isRejected{
getSalesOrderDetails()
}
stop()
}
func start(){startLoader(superView: aiContainer, activityIndicator: activityIndicator)}
func stop(){stopLoader(superView: aiContainer, activityIndicator: activityIndicator)}
func getSalesOrderDetails(){
if let userIdInt = Int(AuthServices.currentUserId){
salesOrderDetails = webService.SalesOrderApprove(empno: userIdInt)
salesOrdertableview.reloadData()
}
}
}
extension SalesOrderApprovalViewController: UITableViewDelegate, UITableViewDataSource{
// -- MARK: Table view data source
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
emptyMessage(viewController: self, tableView: salesOrdertableview, isEmpty: salesOrderDetails.count == 0)
return salesOrderDetails.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as? SalesOrderApprovalCell{
let salesOrder = salesOrderDetails[indexPath.row]
cell.orderId.text = salesOrder.OrderID
cell.empCreated.text = salesOrder.EmpCreated
cell.customerName.text = salesOrder.CustomerName
cell.items.text = salesOrder.Items
cell.date.text = salesOrder.DeliveryDate
cell.status.text = salesOrder.Status
cell.comment.text = salesOrder.Comment == "" ? AppDelegate.noComment : salesOrder.Comment
cell.selectButton.addTarget(self, action: #selector(selectButtonTapped), for: .touchUpInside)
cell.selectButton.tag = indexPath.row
print(salesOrder.OrderID + salesOrder.EmpCreated)
return cell
}
return UITableViewCell()
}
// -- MARK: objc functions
@objc func selectButtonTapped(sender: UIButton){
rowIndexSelected = sender.tag
performSegue(withIdentifier: "showSalesOrderApproval", sender: nil)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let vc = segue.destination as? DetailsSalesOrderApprovalViewController{
vc.orderId = salesOrderDetails[rowIndexSelected].OrderID
vc.reqDate = salesOrderDetails[rowIndexSelected].ReqDate
vc.deliveryDate = salesOrderDetails[rowIndexSelected].DeliveryDate
vc.delegate = self
}
}
}
| [
-1
] |
139f438f0399021e4524a9f92aaf39e1eb4d4178 | d9a8c7f83efad57c48aff3cea634f37af14fbb41 | /remember me/ViewController2.swift | b4e85a3de8c6df0150ffadfed8b908252fdc8f4b | [] | no_license | AditiSrivastava20/checkboxSelection | 92e040eb28b375b77656e7495f2b121e1ec80784 | 684ce6bbb5f28fb041f5f5507cbb5b141f86c3f5 | refs/heads/master | 2021-05-06T04:11:32.783244 | 2017-10-18T09:03:13 | 2017-10-18T09:03:13 | 114,919,572 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,354 | swift | //
// ViewController2.swift
// remember me
//
// Created by Sierra 4 on 04/04/17.
// Copyright © 2017 codebrew. All rights reserved.
//
import UIKit
class ViewController2: UIViewController {
var data : [String] = []
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func btnBack(_ sender: UIButton)
{
_ = navigationController?.popViewController(animated: true)
}
}
extension ViewController2 : UITableViewDelegate,UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
guard let cell: TableViewCellsecond = tableView.dequeueReusableCell(withIdentifier: "tablecell2", for: indexPath) as? TableViewCellsecond else{ return TableViewCellsecond()}
cell.lblsegueinfo.text = data[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
}
}
| [
-1
] |
191a99b420937e3364f8a5b9b526cf876af50d6b | 2933ac5bf3e0cfeb0d004bda6692a8ecbe5a5fb3 | /DPKitchenSink/DPKitchenSink/Protocols/PopoverDisplayable.swift | 9c9ea3a03daf3cbd7f776083eebb139e3bf5b8ec | [
"MIT"
] | permissive | drewpitchford/DPKitchenSink | f78c99dd082dbd57da2bd676bf1c9aaca4e61a62 | 4565dfd89a373f78662cd51a65cdd7840bea6403 | refs/heads/master | 2020-03-21T20:55:35.650589 | 2019-04-01T14:36:37 | 2019-04-01T14:36:37 | 139,036,925 | 0 | 0 | MIT | 2019-04-01T14:28:49 | 2018-06-28T15:28:51 | Swift | UTF-8 | Swift | false | false | 1,476 | swift | //Copyright © mSIGNIA, Incorporated, 2007. All rights reserved.
//
//Software is protected by one or more of U.S. Patent No. 9,559,852, 9294448, 8,817,984,
//international patents and others pending. For more information see www.mSIGNIA.com. User agrees
//that they will not them self, or through any affiliate, agent or other third-party, entity or
//other business structure remove, alter, cover or obfuscate any copyright notices or other
//proprietary rights notices of mSIGNIA or its licensors. User agrees that they will not them
//self, or through any affiliate, agent or other third party, entity or other business structure
//(a) reproduce, sell, lease, license or sublicense this software or any part thereof, (b)
//decompile, disassemble, re-program, reverse engineer or otherwise attempt to derive or modify
//this software in whole or in part, (c) write or develop any derivative software or any other
//software program based upon this software, (d) provide, copy, transmit, disclose, divulge, or
//make available to, or permit use of this software by any third party or entity or machine without
//software owner's prior written consent, (e) circumvent or disable any security or other
//technological features or measures used by this software.
//
// PopoverDisplayable.swift
// 3ds-v2-ios-merchant-demo
//
// Created by Drew Pitchford on 4/5/17.
//
//
import Foundation
public protocol PopoverDisplayable {
var displayText: String { get }
}
| [
-1
] |
f2f85e450dc0eef32c7ce155bb15229acde1cf2d | d78b41477037c265647d4244e52daba76dd47978 | /Sources/App/Services/AzureSignatureService.swift | 4f199bf299eba3d2382e92b73588565a7cb63445 | [
"MIT"
] | permissive | Mikroservices/FilesAzureStorage | 04034dc5b0a7e4269eca8e709ffb1c2379c6fdd1 | 769ab8782c8c4208b39e91b2cc0fa47aed3e533d | refs/heads/master | 2020-04-25T00:25:11.016410 | 2019-04-10T15:29:50 | 2019-04-10T15:29:50 | 172,377,666 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,245 | swift | import Foundation
import Vapor
import Crypto
/// Class to sign request to Azure.
/// Documentation: https://docs.microsoft.com/pl-pl/rest/api/storageservices/authorize-with-shared-key
final class AzureSignatureService: ServiceType {
static func makeService(for container: Container) throws -> AzureSignatureService {
return AzureSignatureService()
}
/// Signature which should be send with request to Azure.
///
/// - Parameter accountName: Azure storage account name.
/// - Parameter method: Request's method.
/// - Parameter uri: Request's URI.
/// - Parameter headers: Request's headers.
/// - Returns: String to sign.
func signature(accountName: String, method: HTTPMethod, uri: String, headers: HTTPHeaders) throws -> String {
let message = try signableString(accountName: accountName, method: method, uri: uri, headers: headers)
let secret = "/KU4W86aVIzseUTP4Uw3yDdX5vtRfkB7Q3bt15dpH0FjNmL+eG2nhJ/FODtavAI3zgfsITQR3u0wA1OS0yf2YQ=="
let secretBase64 = Data(base64Encoded: secret, options: .ignoreUnknownCharacters)
if let decodedSecretKey = secretBase64 {
let signature = try HMAC.SHA256.authenticate([UInt8](message.utf8), key: [UInt8](decodedSecretKey))
return signature.base64EncodedString(options: .lineLength64Characters)
}
return ""
}
/// Method creates string which should be signed.
///
/// - Parameter accountName: Azure storage account name.
/// - Parameter method: Request's method.
/// - Parameter uri: Request's URI.
/// - Parameter headers: Request's headers.
/// - Returns: String to sign.
private func signableString(accountName: String, method: HTTPMethod, uri: String, headers: HTTPHeaders) throws -> String {
let canonicalizedHeaders = self.canonicalizedHeaders(headers: headers)
let canonicalizedResource = try self.canonicalizedResource(accountName: accountName, uri: uri)
let version = headers.valueFor(name: .xMsVersion, defaultValue: "2014-02-14")
let defaultContentLenght = version.compare("2014-02-13") == .orderedDescending ? "" : "0"
let array: [String] = [
method.string.uppercased(),
headers.valueFor(name: .contentEncoding, defaultValue: ""),
headers.valueFor(name: .contentLanguage, defaultValue: ""),
headers.valueFor(name: .contentLength, defaultValue: defaultContentLenght),
headers.valueFor(name: .contentMD5, defaultValue: ""),
headers.valueFor(name: .contentType, defaultValue: ""),
headers.valueFor(name: .date, defaultValue: ""),
headers.valueFor(name: .ifModifiedSince, defaultValue: ""),
headers.valueFor(name: .ifMatch, defaultValue: ""),
headers.valueFor(name: .ifNoneMatch, defaultValue: ""),
headers.valueFor(name: .ifUnmodifiedSince, defaultValue: ""),
headers.valueFor(name: .range, defaultValue: ""),
canonicalizedHeaders,
canonicalizedResource
]
return array.joined(separator: "\n")
}
/// Method produces canonicalized headers.
///
/// Example header:
/// x-ms-date:Sat, 21 Feb 2015 00:48:38 GMT\nx-ms-version:2014-02-14
///
/// - Parameter headers: Headers from request.
/// - Returns: Canonicalized headers.
private func canonicalizedHeaders(headers: HTTPHeaders) -> String {
var microsoftHeaders = [String: String]()
headers.enumerated().forEach { header in
if header.element.name.starts(with: "x-ms-") {
microsoftHeaders[header.element.name] = header.element.value
}
}
let sorted = microsoftHeaders.sorted { (left, right) -> Bool in
left.key < right.key
}.map { header -> String in
return "\(header.key.lowercased()):\(header.value)"
}.map { header -> String in
return header.replacingOccurrences(of: "\\s+", with: " ")
}
return sorted.joined(separator: "\n")
}
/// Method produces canonicalized resource.
///
/// Example header:
/// /myaccount/mycontainer
/// comp:metadata
/// restype:container
///
/// - Parameter accountName: Azure storage account name.
/// - Parameter uri: URI from path request.
/// - Returns: Canonicalized resources.
private func canonicalizedResource(accountName: String, uri: String) throws -> String {
let url = URL(string: uri)
var resource = "/" + accountName
guard let unwrappedUrl = url else {
throw AzureStorageError.invalidUri
}
resource += "/" + unwrappedUrl.path
var array = unwrappedUrl.queryParameters.map { (key, value) in
return (key.lowercased(), value)
}.sorted { (left, right) -> Bool in
left.0 < right.0
}.map { (key, value) -> String in
let str = value.replacingOccurrences(of: "(^\\s+|\\s+$)", with: "").replacingOccurrences(of: "%3D", with: "=")
return "\(key):\(str)"
}
array.insert(resource, at: 0)
return array.joined(separator: "\n")
}
}
| [
-1
] |
4ebfb6d3aba36ec893e4b2b6ec0d9075cbb6bf05 | 944d6d56544403a73ac8558e2d58955d9b62947b | /Shared/Screens/MenuScreen/MenuScreen.swift | 0b2649980d7173c2199b5800b8a13ebc53bf9237 | [] | no_license | Jack-Wong-dev/King-s-Cup | e0dafd7120fbceea61445e8c665f7e08e41accb0 | 624feaf5e56dd676c9a9c282c198c6658755a32e | refs/heads/main | 2023-04-20T16:34:15.515015 | 2021-05-08T03:46:42 | 2021-05-08T03:46:42 | 345,009,077 | 1 | 0 | null | 2021-03-11T23:19:18 | 2021-03-06T04:57:44 | Swift | UTF-8 | Swift | false | false | 2,848 | swift | //
// MenuScreen.swift
// King's Cup (iOS)
//
// Created by Jack Wong on 3/8/21.
//
import SwiftUI
enum HelpAction: Int, Identifiable {
var id: Int { self.rawValue }
case showUsedCards
case showGuide
}
struct MenuScreen: View {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
@Environment(\.verticalSizeClass) var verticalSizeClass
@EnvironmentObject var appStateContainer: AppStateContainer
@EnvironmentObject var brain: GameViewModel
@State private var helpAction: HelpAction?
var proxy: GeometryProxy
var scale: CGFloat {
switch (horizontalSizeClass, verticalSizeClass) {
case (.regular, .regular):
return 0.3
default:
return 0.5
}
}
var body: some View {
VStack {
Button(action: resume) {
Text("Resume")
.fontWeight(.semibold)
.frame(maxWidth: proxy.size.width * scale)
}
Button(action: restart) {
Text("Restart")
.fontWeight(.semibold)
.frame(maxWidth: proxy.size.width * scale)
}
Button(action: showUsedCards) {
Text("Cards Used")
.fontWeight(.semibold)
.frame(maxWidth: proxy.size.width * scale)
}
Button(action: showTutorial) {
Text("How to play")
.fontWeight(.semibold)
.frame(maxWidth: proxy.size.width * scale)
}
Button(action: exit) {
Text("Exit Game")
.fontWeight(.semibold)
.frame(maxWidth: proxy.size.width * scale)
}
}
.font(.system(Font.TextStyle.body, design: .rounded))
.padding()
.sheet(item: $helpAction) { help in
switch help {
case .showUsedCards:
UsedCardsView()
case .showGuide:
HowToPlayScreen()
}
}
}
private func resume() {
brain.gameState = .resume
}
private func restart() {
withAnimation {
brain.gameState = .start
}
}
private func showUsedCards() {
withAnimation {
helpAction = .showUsedCards
}
}
private func showTutorial() {
withAnimation {
helpAction = .showGuide
}
}
private func exit() {
// withAnimation {
appStateContainer.destinationState.destination = .welcome
// }
}
}
//struct MenuScreen_Previews: PreviewProvider {
// static var previews: some View {
// MenuScreen()
// }
//}
| [
-1
] |
3adc388ea38182aa5dac52665ecb0c5b271f345e | d0b57e34eeca580ac0a4b013e3509afb2f927184 | /test/test/AppDelegate.swift | cb9a17dfd537620e2c2014e3157f7c10e5ad0158 | [] | no_license | liutiesong/testTravis | 2e090663468a48a0cfd983d93cf106f29a268031 | 7ca6ae298831adfa35096176a83e5ac0913c55db | refs/heads/master | 2020-07-05T16:36:29.546664 | 2019-08-17T05:22:39 | 2019-08-17T05:22:39 | 202,700,995 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// test
//
// Created by 刘铁崧 on 2019/8/16.
// Copyright © 2019 刘铁崧. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
148946,
222676,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
291742,
234396,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
18f528dbec9b6fb486a223139ef15fb3795f6ca6 | e02e039ae4fbede72cbd158f8c36cf8023375ba6 | /RevCheckIn/loginViewController.swift | 72a336481837410e406804d858b1a087e8521120 | [
"MIT"
] | permissive | asowers1/RevCheckIn | 37b6cda2a06c7abdadc23fa229ffdc50ebf5c819 | 1095bbeb851f168aaf471b55c3b99a761bffc547 | refs/heads/master | 2020-06-07T02:10:35.221935 | 2014-10-15T15:17:35 | 2014-10-15T15:17:35 | 22,819,099 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,386 | swift | //
// loginViewController.swift
// RevCheckIn
//
// Created by Andrew Sowers on 7/27/14.
// Copyright (c) 2014 Andrew Sowers. All rights reserved.
//
import UIKit
import CoreData
import Foundation
import QuartzCore
class loginViewController: UIViewController, UITextFieldDelegate {
@IBOutlet var username: UITextField!
@IBOutlet var password: UITextField!
@IBOutlet weak var newAccountButton: UIButton!
@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var leadingConstraint: NSLayoutConstraint!
@IBOutlet weak var trailingConstraint: NSLayoutConstraint!
@IBOutlet var imgView: UIImageView!
var usernameString:String=""
var passwordString:String=""
var existingItem: NSManagedObject!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.hidden = true
let titleDict: NSDictionary = [NSForegroundColorAttributeName: UIColor.whiteColor(),NSFontAttributeName :UIFont(name: "AppleSDGothicNeo-Thin", size: 28.0)]
self.navigationController?.navigationBar.titleTextAttributes = titleDict
self.title = "Rev Check-in"
username.delegate = self
password.delegate = self
self.newAccountButton.layer.borderWidth = 2.0
self.loginButton.layer.borderWidth = 2.0
self.newAccountButton.layer.borderColor = UIColor.whiteColor().CGColor
self.loginButton.layer.borderColor = UIColor.whiteColor().CGColor
username.layer.borderWidth = 2.0
password.layer.borderWidth = 2.0
username.layer.borderColor = UIColor.whiteColor().CGColor
password.layer.borderColor = UIColor.whiteColor().CGColor
}
override func viewDidAppear(animated: Bool) {
var myList: Array<AnyObject> = []
var appDel2: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
var context2: NSManagedObjectContext = appDel2.managedObjectContext!
let freq = NSFetchRequest(entityName: "Active_user")
myList = context2.executeFetchRequest(freq, error: nil)!
if (myList.count > 0){
var selectedItem: NSManagedObject = myList[0] as NSManagedObject
var user: String = selectedItem.valueForKeyPath("username") as String
if user != "-1" {
println("login successful: \(user)")
self.performSegueWithIdentifier("login", sender: self)
}
else{
println("login unsuccessful")
}
}
}
override func prefersStatusBarHidden() -> Bool {
return false
}
func textFieldShouldReturn(textField: UITextField!) -> Bool {
if(textField == username){
password.becomeFirstResponder()
}else if(textField == password){
password.resignFirstResponder()
}
return true
}
@IBAction func startEditingLogin(sender: AnyObject) {
println("Started Editing username")
}
func loginLogic() {
var helper: HTTPHelper = HTTPHelper()
helper.login(username.text, password: password.text)
var myList: Array<AnyObject> = []
var appDel2: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
var context2: NSManagedObjectContext = appDel2.managedObjectContext!
let freq = NSFetchRequest(entityName: "Active_user")
println("login logic")
while myList.isEmpty {myList = context2.executeFetchRequest(freq, error: nil)!}
println("got context")
var selectedItem: NSManagedObject = myList[0] as NSManagedObject
if let user: String = selectedItem.valueForKeyPath("username") as? String {
if user != "-1" {
println("login successful")
//record user device
//var helper: HTTPHelper = HTTPHelper()
//let device = helper.getDeviceContext()
//var coreDataHelper: CoreDataHelper = CoreDataHelper()
//let network: HTTPBackground = HTTPBackground()
//network.linkUserToDevice(user, device)
//println("user:\(user): device:\(device): LINKED")
self.performSegueWithIdentifier("login", sender: self)
}
else{
println("login unsuccessful")
let networkIssue = UIAlertController(title: "Login unsuccessful", message: "Your username or password is incorrect", preferredStyle: UIAlertControllerStyle.Alert)
networkIssue.addAction(UIAlertAction(title: "Try Again", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(networkIssue, animated: true, completion: nil)
}
}else{
println("login unsuccessful!")
let networkIssue = UIAlertController(title: "Network Issue", message: "Could not log in", preferredStyle: UIAlertControllerStyle.Alert)
networkIssue.addAction(UIAlertAction(title: "Try Later", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(networkIssue, animated: true, completion: nil)
var helper:HTTPHelper = HTTPHelper()
helper.setUserContext("-1")
}
}
@IBAction func cancelLogin(sender: AnyObject) {
self.leadingConstraint.constant = 0
self.trailingConstraint.constant = 0
UIView.animateWithDuration(0.25, animations: {
self.view.layoutIfNeeded()
})
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
var myList: Array<AnyObject> = []
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func login(sender: AnyObject) {
if (self.username.text != "" && self.password.text != ""){
self.loginLogic()
} else {
var field = "username"
if (self.password.text == "" && self.username.text != ""){
field = "password"
}
let incomplete: UIAlertController = UIAlertController(title: "incomplete login", message: "\(field) field cannot be blank", preferredStyle: UIAlertControllerStyle.Alert)
incomplete.addAction(UIAlertAction(title: "ok", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(incomplete, animated: true, completion: nil)
}
}
@IBAction func showLogin(sender: AnyObject) {
println(self.leadingConstraint.constant)
self.leadingConstraint.constant = self.view.frame.origin.x - (self.newAccountButton.frame.size.width + 20)
self.trailingConstraint.constant = -1 * (self.newAccountButton.frame.size.width + 20)
println(self.leadingConstraint.constant)
UIView.animateWithDuration(0.25, animations: {
self.view.layoutIfNeeded()
})
}
@IBAction func register(sender: AnyObject) {
Crashlytics.setObjectValue("register", forKey: "loginAction")
self.performSegueWithIdentifier("register", sender: self)
}
@IBAction func sendToWeb(sender: AnyObject) {
let viewWeb : UIAlertController = UIAlertController(title: "learn more", message:"visit Push on the web", preferredStyle: UIAlertControllerStyle.ActionSheet)
viewWeb.addAction(UIAlertAction(title:"cancel", style: UIAlertActionStyle.Cancel, handler: nil))
viewWeb.addAction(UIAlertAction(title: "view", style: UIAlertActionStyle.Default, handler: {(alert: UIAlertAction!) in println("Foo")
UIApplication.sharedApplication().openURL(NSURL.URLWithString("http://www.experiencepush.com"))
}))
self.presentViewController(viewWeb, animated: true, completion: nil)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "register" {
println("segue")
}
}
}
| [
-1
] |
5337a7b3690a84d42d721c864c4ebd7d89572c94 | 795fe2a181150ad7b77c643d1d137da11eaeec7b | /Sources/Identifiable/SwiftStdLib.swift | 70b1190c0db3d8ee75858d8063925c4286e705c6 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mgray88/Allegory | 9c9285efbc43ab7a09bcb0e62f2855710cccd1ef | 0a59454530a53ff9b8a25b12f5c1222bdf969a02 | refs/heads/main | 2023-08-16T04:53:25.811770 | 2021-09-27T12:24:16 | 2021-09-27T12:24:16 | 392,075,726 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 512 | swift | //
// SwiftStdLib.swift
// SwiftStdLib
//
// Created by Mike on 8/2/21.
//
extension String: Identifiable {}
extension UInt: Identifiable {}
extension UInt8: Identifiable {}
extension UInt16: Identifiable {}
extension UInt32: Identifiable {}
extension UInt64: Identifiable {}
extension Int: Identifiable {}
extension Int8: Identifiable {}
extension Int16: Identifiable {}
extension Int32: Identifiable {}
extension Int64: Identifiable {}
extension Double: Identifiable {}
extension Float: Identifiable {}
| [
-1
] |
e23f870c5deac022408bfdd25fa969b2c88e273a | 45dbb2346c2707e8d614bfe0b13d6172c9e88945 | /redis/redistack/example/Sources/example/main.swift | 8a5888341c35f0652b95fb0e8ac2d8276a3e033d | [] | no_license | bjtj/tjsamples | 8085fbfb59510228688f01f9fa448bff5fdfe42c | 7be8c143ad2005d3b707e3053020da0f328d7411 | refs/heads/master | 2023-08-31T14:11:31.174752 | 2023-08-31T08:54:02 | 2023-08-31T08:54:02 | 46,951,932 | 19 | 19 | null | 2023-09-06T20:42:46 | 2015-11-27T00:27:42 | JavaScript | UTF-8 | Swift | false | false | 434 | swift | import NIO
import RediStack
let hostname = "127.0.0.1"
let eventLoop: EventLoop = MultiThreadedEventLoopGroup(numberOfThreads: 1).next()
let connection = try RedisConnection.make(
configuration: try .init(hostname: hostname),
boundEventLoop: eventLoop
).wait()
let result = try connection.set("my_key", to: "some value")
.flatMap { return connection.get("my_key") }
.wait()
print(result) // Optional("some value")
| [
-1
] |
d440c539baffbfd0127995c31fca30e2ede2ac94 | c8b2cc70f06f978c7716c7961f0c5e14b16eb739 | /Beautifulvino/FeedViewController.swift | 7e65b564de90d47f3790eba6e82a6a07a861ba4e | [] | no_license | antonio-laudazi/BeautifulVinoIOs | 25378567e9e3c33ea11f96c67b88a1206053265a | aa1d17bed906ec28e7263ebb73e00385df6648ce | refs/heads/master | 2022-11-07T21:12:09.872403 | 2020-06-22T13:04:18 | 2020-06-22T13:04:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,691 | swift | //
// FirstViewController.swift
// Beautifulvino
//
// Created by Antonio Laudazi on 26/10/17.
// Copyright © 2017 Maria Tourbanova. All rights reserved.
//
import UIKit
import Firebase
class FeedViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, ConnectionManagerDelegate {
@IBOutlet weak var tableViewFeed: UITableView!
var caricamentoView=CaricamentoView.instanceFromNib()
private let cManager = ConnectionManager()//AppDelegate.connectionManager
private let refreshControl = UIRefreshControl()
private let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
var feedArray:[Feed]!
private var footerView:UIView!
var numTotFeed = 0
private var idProvincia = -1
private var requestType:RequestTypeList!
// private var ultimoFeedRicevutoJson:Feed!
private var feedSelezionato:Feed!
private var headerClicked:Bool!
private var loadedError:Bool=false
private var loaded:Bool=false
override func viewDidLoad() {
super.viewDidLoad()
refreshControl.addTarget(self, action: #selector(refreshFeed(_:)), for: .valueChanged)
refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
tableViewFeed.register(UINib(nibName: "FeedAziendaTableViewCell", bundle: nil), forCellReuseIdentifier: "CellIdentifierFeedAzienda")
if #available(iOS 10.0, *) {
tableViewFeed.refreshControl = refreshControl
} else {
tableViewFeed.addSubview(refreshControl)
}
cManager.delegate=self
if feedArray==nil {
feedArray=[Feed]()
tableViewFeed.reloadData()
showLoading()
requestType=RequestTypeList.refresh
cManager.getFeed(ultimoFeed:nil)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func viewWillAppear(_ animated: Bool) {
UIApplication.shared.statusBarStyle = .default
setNeedsStatusBarAppearanceUpdate()
cManager.delegate=self
tableViewFeed.tableFooterView?.isHidden = true
spinner.stopAnimating()
}
override func viewDidAppear(_ animated: Bool) {
Analytics.setScreenName("I_ListaFeed", screenClass: "FeedViewController")
}
/* override func viewWillDisappear(_ animated: Bool) {
requestIsFinished()
cManager.cancelRequest(typeRequest: cManager.request_get_feed)
}*/
// MARK: - tableView
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return feedArray.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
let f=feedArray[indexPath.row]
if f.tipoFeed == Feed.TipoFeed.pubblicita.rawValue{
return CGFloat(Height.feedPubblicitaTableViewCell)
}else if f.tipoFeed == Feed.TipoFeed.azienda.rawValue{
return CGFloat(Height.feedAziendaTableViewCell)
}else if f.tipoFeed == Feed.TipoFeed.evento.rawValue || f.tipoFeed == Feed.TipoFeed.vino.rawValue{
return CGFloat(Height.feedAzioneTableViewCell)
}else {
return CGFloat(Height.feedPostTableViewCell)
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let f=feedArray[indexPath.row]
if f.tipoFeed == Feed.TipoFeed.pubblicita.rawValue{
let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifierFeedPubblicita", for: indexPath) as! FeedPubblicitaTableViewCell
cell.setData(feed: f)
return cell
}else if f.tipoFeed == Feed.TipoFeed.azienda.rawValue{
let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifierFeedAzienda", for: indexPath) as! FeedAziendaTableViewCell
cell.setData(feed: f, tag: indexPath.row)
let tapGes = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
cell.headerView.addGestureRecognizer(tapGes)
tapGes.view?.tag=indexPath.row
return cell
}else if f.tipoFeed == Feed.TipoFeed.evento.rawValue || f.tipoFeed == Feed.TipoFeed.vino.rawValue{
let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifierFeedAzione", for: indexPath) as! FeedAzioneTableViewCell
cell.setData(feed:f, tag: indexPath.row)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
cell.headerView.addGestureRecognizer(tap)
tap.view?.tag=indexPath.row
return cell
}else {
let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifierFeedPost", for: indexPath) as! FeedPostTableViewCell
cell.setData(feed: f, tag: indexPath.row)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
cell.headerView.addGestureRecognizer(tap)
tap.view?.tag=indexPath.row
return cell
}
}
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if (feedArray.count < numTotFeed && indexPath.row==feedArray.count-1 && !loadedError && !loaded) {
loaded=true
spinner.startAnimating()
spinner.frame = CGRect(x: CGFloat(0), y: CGFloat(0), width: tableView.bounds.width, height: CGFloat(44))
tableViewFeed.tableFooterView = spinner
tableViewFeed.tableFooterView?.isHidden = false
requestType=RequestTypeList.more
cManager.getFeed(ultimoFeed: self.feedArray[feedArray.count-1])
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
headerClicked=false
feedSelezionato=feedArray[indexPath.row]
tableViewFeed.deselectRow(at: indexPath, animated: false)
if feedSelezionato.tipoFeed == Feed.TipoFeed.pubblicita.rawValue || feedSelezionato.tipoFeed == Feed.TipoFeed.vino.rawValue {
performSegue(withIdentifier: "GoToDettaglioVinoFromFeed", sender: nil)
}else if feedSelezionato.tipoFeed == Feed.TipoFeed.azienda.rawValue || feedSelezionato.tipoFeed == Feed.TipoFeed.post.rawValue {
performSegue(withIdentifier: "GoToDettaglioPostFromFeed", sender: nil)
}else if feedSelezionato.tipoFeed == Feed.TipoFeed.evento.rawValue {
performSegue(withIdentifier: "GoToDettaglioEventoFromFeed", sender: nil)
}
}
@objc func handleTap(_ sender:AnyObject) {
headerClicked=true
feedSelezionato=feedArray[sender.view.tag]
if feedSelezionato.tipoEntitaHeaderFeed == Feed.TipoEntitaHeaderFeed.azienda.rawValue {
performSegue(withIdentifier: "GoToDettaglioAziendaFromFeed", sender: nil)
}else if feedSelezionato.tipoEntitaHeaderFeed == Feed.TipoEntitaHeaderFeed.evento.rawValue{
performSegue(withIdentifier: "GoToDettaglioEventoFromFeed", sender: nil)
}else if feedSelezionato.tipoEntitaHeaderFeed == Feed.TipoEntitaHeaderFeed.profilo.rawValue {
performSegue(withIdentifier: "GoToDettaglioProfiloFromFeed", sender: nil)
}else if feedSelezionato.tipoEntitaHeaderFeed == Feed.TipoEntitaHeaderFeed.vino.rawValue {
performSegue(withIdentifier: "GoToDettaglioVinoFromFeed", sender: nil)
}
}
private func showLoading(){
caricamentoView.frame=CGRect(x:0,y:0,width:self.view.frame.size.width, height:self.view.frame.size.height)
self.view.addSubview(caricamentoView)
caricamentoView.activityIndicator?.startAnimating()
UIApplication.shared.isNetworkActivityIndicatorVisible = true
}
private func hideLoading(){
UIApplication.shared.isNetworkActivityIndicatorVisible = false
caricamentoView.removeFromSuperview()
}
private func showAlert(titolo:String, msg:String){
let alert = UIAlertController(title: titolo, message: msg, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
private func requestIsFinished(){
self.tableViewFeed.tableFooterView?.isHidden=true
self.hideLoading()
self.refreshControl.endRefreshing()
}
@objc private func refreshFeed(_ sender: Any) {
requestType=RequestTypeList.refresh
showLoading()
cManager.getFeed(ultimoFeed:nil)
}
// MARK: - ConnectionManagerDelegate
func feedArrayDidReceive(feedA:[Feed]?, numTotFeed:Int, errore:String){
if errore=="" {
if(requestType==RequestTypeList.refresh){
self.feedArray=feedA
self.numTotFeed=numTotFeed
DispatchQueue.main.async() {
self.tableViewFeed.reloadData()
}
}else{
// self.feedArray.append(contentsOf: feedArray!)
// self.numTotFeed=numTotFeed
let c:Int=feedArray.count
self.feedArray.append(contentsOf: feedA!)
let a:Int=feedArray.count-1
self.numTotFeed=numTotFeed
var r: Array<IndexPath>=Array()
for i in c...a {
let indexPath=IndexPath(row: i, section: 0)
r.append(indexPath)
}
DispatchQueue.main.async() {
self.tableViewFeed.insertRows(at: r, with: .none)
}
}
loadedError=false
}else{
loadedError=true
DispatchQueue.main.async() {
self.showAlert(titolo: "Errore", msg: errore)
}
}
DispatchQueue.main.async() {
self.requestIsFinished()
}
loaded=false
}
func feedArrayDidReceiveWithError(error:Error){
loadedError=true
loaded=false
DispatchQueue.main.async () {
self.requestIsFinished()
self.tableViewFeed.reloadData()
self.showAlert(titolo: "Errore", msg: error.localizedDescription)
}
}
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if headerClicked==false {
if segue.identifier == "GoToDettaglioVinoFromFeed"{
let vdvc = segue.destination as! VinoDettaglioViewController
vdvc.vino=feedSelezionato.vinoFeedInt
}else if segue.identifier == "GoToDettaglioEventoFromFeed"{
let edvc = segue.destination as! EventoDettaglioViewController
let evento=feedSelezionato.eventoFeedInt
edvc.evento=evento
}else if segue.identifier == "GoToDettaglioPostFromFeed"{
let pdvc = segue.destination as! PostDettaglioViewController
pdvc.feed=feedSelezionato
}
}else{
if segue.identifier == "GoToDettaglioAziendaFromFeed"{
let advc = segue.destination as! AziendaDettaglioViewController
let az=Azienda()
az.nomeAzienda=""
az.idAzienda=feedSelezionato.idEntitaHeaderFeed
advc.azienda=az
}else if segue.identifier == "GoToDettaglioEventoFromFeed"{
let edvc = segue.destination as! EventoDettaglioViewController
let evento=Evento()
evento.idEvento=feedSelezionato.idEntitaHeaderFeed
evento.dataEvento=feedSelezionato.dataEntitaHeaderFeed
evento.titoloEvento=""
edvc.evento=evento
}else if segue.identifier == "GoToDettaglioProfiloFromFeed"{
let pdvc = segue.destination as! ProfiloViewController
let pr = Utente()
pr.idUtente=feedSelezionato.idEntitaHeaderFeed
pdvc.utente=pr
pdvc.fromTabBar=false
}else if segue.identifier == "GoToDettaglioVinoFromFeed"{
let vdvc = segue.destination as! VinoDettaglioViewController
let vino=Vino()
vino.idVino=feedSelezionato.idEntitaFeed
vino.nomeVino=""
vdvc.vino=vino
}
}
}
}
| [
-1
] |
53e2e0581552786243094e053d6997896ace34f7 | 567a9e574f7a07fc28d89e5c988f387314ba84ff | /TMDb-Test/APICaller.swift | 9c998ab01a764ff3eef35cd43154f3fd7b602f81 | [] | no_license | vitya87ua/TMDb-Test | 1890c6832146439bc5e23368160818a0f087d63a | 595ecf95c2604dd6cb5cf5163226969679cdefe1 | refs/heads/main | 2023-04-30T13:29:27.917841 | 2021-05-25T15:36:24 | 2021-05-25T15:36:24 | 370,010,547 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,726 | swift | //
// APICaller.swift
// TMDb-Test
//
// Created by Віктор Бережницький on 23.05.2021.
//
import Foundation
import UIKit
struct ServerResponce: Codable {
let success: Bool?
let expires_at: String?
let request_token: String?
}
struct SingInRequest: Codable {
let username: String
let password: String
let request_token: String
}
class ApiCaller {
static let share = ApiCaller()
private let baseUrlAuth = "https://api.themoviedb.org/3/authentication/token/new?api_key="
private let singInUrl = "https://api.themoviedb.org/3/authentication/token/validate_with_login?api_key="
private let popularMoviesUrl = "https://api.themoviedb.org/3/movie/popular?api_key=56af4d7d6e0da24d3fe208f8a04b854b&language=en-US&page=1"
private let baseImageUrl = "https://image.tmdb.org/t/p/w500"
private let movieDetailUrl = "https://api.themoviedb.org/3/movie/"
private let apiKey = "56af4d7d6e0da24d3fe208f8a04b854b"
//Create Request Token
func getToken(completion: @escaping (ServerResponce) -> Void) {
var request = URLRequest(url: URL(string: baseUrlAuth + apiKey)!)
URLSession.shared.dataTask(with: request) { data, responce, error in
// print("data: \(data), error \(error)")
let json = try! JSONDecoder().decode(ServerResponce.self, from: data!)
completion(json)
}.resume()
}
// Create Session With Login
func signIn(requestSignIn: SingInRequest, completion: @escaping (Bool) -> Void) {
let body = try! JSONEncoder().encode(requestSignIn)
var request = URLRequest(url: URL(string: singInUrl + apiKey)!)
request.httpMethod = "POST"
request.httpBody = body
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
URLSession.shared.dataTask(with: request) { data, responce, error in
print("data: \(data), error \(error)")
let json = try! JSONDecoder().decode(ServerResponce.self, from: data!)
completion(json.success!)
}.resume()
}
//Create Request Token
func getPopularMovies(completion: @escaping (PopularMoviesResponceModel) -> Void) {
var request = URLRequest(url: URL(string: popularMoviesUrl)!)
URLSession.shared.dataTask(with: request) { data, responce, error in
// print("data: \(data), error \(error)")
let json = try! JSONDecoder().decode(PopularMoviesResponceModel.self, from: data!)
DispatchQueue.main.async {
completion(json)
}
}.resume()
}
func getMoviesFor(id: Int, completion: @escaping (MovieDetailModel) -> Void) {
let url = URL(string: movieDetailUrl + "\(id)" + "?api_key=" + apiKey + "&language=en-US")!
URLSession.shared.dataTask(with: url) { data, responce, error in
// print("data: \(data), error \(error)")
let json = try! JSONDecoder().decode(MovieDetailModel.self, from: data!)
DispatchQueue.main.async {
completion(json)
}
}.resume()
}
func getImage(imageUrl: String) -> UIImage {
let url = URL(string: "https://image.tmdb.org/t/p/w500" + imageUrl)!
let data = try! Data(contentsOf: url)
return UIImage(data: data)!
}
}
| [
-1
] |
22613490b037e5b4430811739b536dca4041c0d8 | 05dc8d213912936b59f9890f1161ca3425453876 | /ContactTests/Edit Contact Detail Specs/EditContactDetailInteractorSpec.swift | 12562446cfe2f77eebb844d6437bdcb457393f92 | [] | no_license | fadhrigabestari/contact | e8daa009be27ca9740451d87b7d75221d622d7cf | 9d53e906735b4f9a78d5ecb719f51d801b9d840f | refs/heads/master | 2020-06-15T00:53:08.030792 | 2019-07-24T10:16:01 | 2019-07-24T10:16:01 | 195,168,398 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 738 | swift | //
// EditContactDetailInteractorSpec.swift
// ContactTests
//
// Created by PT. GOJEK INDONESIA on 24/07/19.
// Copyright © 2019 PT. GOJEK INDONESIA. All rights reserved.
//
import Foundation
import Quick
import Nimble
@testable import Contact
class EditContactDetailInteractorSpec: QuickSpec {
var presenter: MockEditContactDetailPresenter!
var interactor: EditContactDetailInteractor!
override func spec() {
describe("EditContactDetailInteractor") {
self.presenter = MockEditContactDetailPresenter()
self.interactor = EditContactDetailInteractor()
self.interactor.presenter = self.presenter
context("") {
}
}
}
}
| [
-1
] |
6a265a6a36c3b0f08277815892e0d1aadef9f9c5 | e92c7fcdb4f492334569785cd1d9a3f02c967a51 | /RxswiftApiDemo/FirebaseDemoWithDrawer/View/iExpense/UserView1.swift | 25cad61ad9796b1db4b89ef912558aced3f71201 | [] | no_license | Ashwini1Sapre/RxswiftApiDemo | 0b4cbec05785bb5317806fc8b1caa962d66f54b2 | 9ac9ad0b4d9de09c9267e18d6b8b3aadc56d3f91 | refs/heads/main | 2023-04-19T22:51:25.988192 | 2021-05-08T08:35:30 | 2021-05-08T08:35:30 | 359,824,688 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,298 | swift | //
// UserView.swift
// RxswiftApiDemo
//
// Created by Knoxpo MacBook Pro on 30/04/21.
//
import SwiftUI
import UIKit
class User12: ObservableObject {
@Published var firstName = "abc"
@Published var lastName = "xyz"
}
struct UserView1: View {
@ObservedObject var user12 = User12()
@State private var hideSatusBar = false
var body: some View {
Button("toggle status bar") {
withAnimation {
hideSatusBar.toggle()
}
}
.statusBar(hidden: hideSatusBar)
}
}
//discloser Group
struct SecondView: View {
@State private var revealDetail = false
var body: some View {
DisclosureGroup("show terms", isExpanded: $revealDetail) {
Text("Long term and condition here long term and condition")
}
.frame(width: 300)
// Text("secod view")
}
}
// Add toolbar
struct toolbarView: View {
var body: some View {
NavigationView {
Text("Hello, world!").padding()
.navigationTitle("SwiftUITool")
.toolbar {
ToolbarItemGroup(placement: .bottomBar){
Button("First") {
// Text("Pressed First")
print("Pressed")
}
Spacer()
Button("Second") {
// Text("Pressed First")
print("Pressed")
}
}
}
}
}
}
struct UserView1_Previews: PreviewProvider {
static var previews: some View {
toolbarView()
}
}
| [
-1
] |
f3a26baea8cabbc397d1d07d3e3e37d4743713aa | 1540f648150259bcd43bb4ec12441c013d792036 | /Synapse/XButton.swift | 3c0d39a704de517948e661be50c952e6268781b0 | [] | no_license | willhamilton24/SynapseWallet | 596bd47e9e717d7ee88e83aa394113339a6bdeb2 | df252981c695fa47b95fb2a030c89cbf709be716 | refs/heads/master | 2022-03-24T17:37:37.712904 | 2020-01-01T20:42:58 | 2020-01-01T20:42:58 | 212,067,908 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 623 | swift | //
// XButton.swift
// Synapse
//
// Created by Will Hamilton on 10/25/19.
// Copyright © 2019 Comitatus Capital. All rights reserved.
//
import SwiftUI
struct XButton: View {
@EnvironmentObject var viewRouter: ViewRouter
var body: some View {
Button(action: {self.viewRouter.currentPage = "main"}) {
Image("x")
.resizable()
.frame(width: 55, height: 55)
.foregroundColor(CustomColors().light)
}
}
}
struct XButton_Previews: PreviewProvider {
static var previews: some View {
XButton().environmentObject(ViewRouter())
}
}
| [
-1
] |
85a62711f6b83ce7c1e2a30db57d86e46c1a0d34 | f462ad4bd2a4a8414bce4d297c419e9917f52076 | /PitchPerfectTests/Mocks/PlayViewControllerMock.swift | ea0ba7a3af601c1645c02a993e3d96cbae808b1d | [] | no_license | guhungry/udacity-ios-pitchperfect | 2fa7608601af8d6cf0b773541d537d2c534f5d89 | 9031c727aa89af514567f0c67a4ee144ac68d149 | refs/heads/master | 2020-03-19T06:22:48.710488 | 2018-06-08T14:24:31 | 2018-06-08T14:24:31 | 136,014,118 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 399 | swift | //
// PlayViewControllerMock.swift
// PitchPerfectTests
//
// Created by Woraphot Chokratanasombat on 7/6/18.
// Copyright © 2018 Woraphot Chokratanasombat. All rights reserved.
//
import Foundation
@testable import PitchPerfect
class PlayViewControllerMock : PlayViewControllerProtocol {
var updateViewCallCount = 0
func updateView() {
updateViewCallCount += 1
}
}
| [
-1
] |
59a0f1b20b660234bef4be4f69a3f7ab5d3ed56a | 591969c17722895bdb4d4c57bbe2dc3864ec94df | /direct/platforms/ios/WeexDemo/UDP/RecordEvent.swift | 9c165b3657224aa9b7347028d2e59630e68fc0ec | [] | no_license | jb32/zhilianzidonghua | 76805f57fbc536de7ec122a5fae2c463d279db90 | 9425b7c4e07fb0152a0d455c805b2df297c5a0dd | refs/heads/master | 2020-05-20T03:35:56.322198 | 2019-05-07T09:27:59 | 2019-05-07T09:27:59 | 185,361,952 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,147 | swift | //
// RecordEvent.swift
// WeexDemo
//
// Created by zzzl on 2019/1/25.
// Copyright © 2019 zzzl. All rights reserved.
//
import Foundation
struct RecordEvent: OptionSet {
var rawValue: UInt8
static let sensor = RecordEvent(rawValue: 0x1 << 6)
static let phase = RecordEvent(rawValue: 0x1 << 5)
static let over = RecordEvent(rawValue: 0x1 << 4)
static let powerOutage = RecordEvent(rawValue: 0x1 << 3)
static let dryOver = RecordEvent(rawValue: 0x1 << 2)
static let wetOver = RecordEvent(rawValue: 0x1 << 1)
}
extension RecordEvent {
func des() -> [String] {
var arr = [String]()
if contains(.sensor) {
arr.append("传感器故障")
}
if contains(.phase) {
arr.append("缺相")
}
if contains(.over) {
arr.append("过载")
}
if contains(.powerOutage) {
arr.append("停电")
}
if contains(.dryOver) {
arr.append("温度超限")
}
if contains(.wetOver) {
arr.append("湿度超限")
}
return arr
}
}
| [
-1
] |
9a4c9abc1c6e5e211e2caac08f49076cbd2c8f42 | 2c40f1f65d7058df48752614bd680d2f990db27b | /GangPiaoWang/Module/Mine/Controller/UserMessage/GPWUserMessageController.swift | 5265a3e94de0bb030833fe975868c08b8f8da451 | [] | no_license | gangpiaoC/gangpiao | af5494ae1bc640cf7cfea9d56733c68b1f9dc9f2 | 7706901b09550d7f17f01050d4a742caca6e1dfe | refs/heads/master | 2021-09-11T15:15:45.292146 | 2018-04-03T01:54:07 | 2018-04-03T01:54:07 | 106,377,852 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,899 | swift | //
// GPWUserMessageController.swift
// GangPiaoWang
// 消息中心
// Created by gangpiaowang on 2016/12/22.
// Copyright © 2016年 GC. All rights reserved.
//
import UIKit
import SwiftyJSON
class GPWUserMessageController: GPWSecBaseViewController,UITableViewDelegate,UITableViewDataSource {
var showTableView:UITableView!
var dataArr = [JSON]()
var page = 1
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidLoad() {
super.viewDidLoad()
self.title = "消息中心"
//消息已读
let btn = UIButton(type: .custom)
btn.frame = CGRect(x: SCREEN_WIDTH - 90 - 16, y: 33, width: 90, height: 21)
btn.setTitle("全部标为已读", for: .normal)
btn.setTitleColor(UIColor.hex("666666"), for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
btn.addTarget(self, action: #selector(self.btnClick), for: .touchUpInside)
self.navigationBar.addSubview(btn)
showTableView = UITableView(frame: self.bgView.bounds, style: .plain)
showTableView.backgroundColor = bgColor
showTableView.separatorStyle = .none
showTableView.setUpHeaderRefresh {
[weak self] in
guard let self1 = self else {return}
self1.page = 1
self1.getNetData()
}
showTableView.setUpFooterRefresh {
[weak self] in
guard let self1 = self else {return}
self1.getNetData()
}
showTableView?.delegate = self
showTableView?.dataSource = self
self.bgView.addSubview(showTableView)
self.getNetData()
}
func btnClick() {
//消息全读
GPWNetwork.requetWithPost(url: Update_messages, parameters: ["auto_id":"all"], responseJSON: {
[weak self] (json, msg) in
printLog(message: json)
guard let strongSelf = self else { return }
strongSelf.page = 1
strongSelf.getNetData()
}, failure: { error in
})
}
override func getNetData() {
GPWNetwork.requetWithPost(url: User_message, parameters: ["page":self.page,"type":"message"], responseJSON: {
[weak self] (json, msg) in
printLog(message: json)
guard let strongSelf = self else { return }
strongSelf.showTableView.endFooterRefreshing()
strongSelf.showTableView.endHeaderRefreshing()
if strongSelf.page == 1 {
strongSelf.dataArr = json.array!
if strongSelf.dataArr.count == 0 {
strongSelf.showTableView.setFooterNoMoreData()
} else {
strongSelf.page += 1
strongSelf.showTableView.footerRefresh.isHidden = false
}
}else{
if (json.arrayObject?.count)! > 0 {
strongSelf.page += 1
strongSelf.dataArr += json.array!
}else{
strongSelf.showTableView.endFooterRefreshingWithNoMoreData()
}
}
strongSelf.showTableView.reloadData()
}, failure: { [weak self] error in
guard let strongSelf = self else { return }
strongSelf.showTableView.endFooterRefreshing()
strongSelf.showTableView.endHeaderRefreshing()
})
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataArr.count
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.0001
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.0001
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 67
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCell(withIdentifier: "GPWUserMessageCell") as? GPWUserMessageCell
if cell == nil {
cell = GPWUserMessageCell(style: .default, reuseIdentifier: "GPWUserMessageCell")
}
cell?.setInfo(dic: self.dataArr[indexPath.row],superC:self,type:"message")
return cell!
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
var dic = self.dataArr[indexPath.row]
dic["is_read"] = "1"
self.dataArr[indexPath.row] = dic
self.showTableView.reloadData()
self.navigationController?.pushViewController(GPWUserMDetailViewController(dic:self.dataArr[indexPath.row]), animated: true)
}
}
| [
-1
] |
9f111aeacbc9d3cf65dcd3bb62f5d1f41dc80fca | 12e13d4d398806b4a2e5d87cdc39c6870adcf37c | /WeatherGif/Data/Model/Gif.swift | aac6a31b3074df69503f142d3708d763de4cf7af | [] | no_license | joebenton/WeatherGif | 4229cb07d4f5271fcd036f7e46797e94e27c0e35 | c4b590190e960f13416f9dac377d2164901fbe6d | refs/heads/master | 2021-01-11T16:12:50.120460 | 2017-01-29T15:38:48 | 2017-01-29T15:38:48 | 80,036,922 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 472 | swift | //
// Gif.swift
// WeatherGif
//
// Created by Joe on 25/01/2017.
// Copyright © 2017 Joe Benton. All rights reserved.
//
import Foundation
struct Gif {
var imageUrl: String?
init(jsonDictionary: Dictionary<String, Any>) {
if let dataDict = jsonDictionary["data"] as? Dictionary<String,Any> {
if let imageUrl = dataDict["image_url"] as? String {
self.imageUrl = imageUrl
}
}
}
}
| [
-1
] |
9beb6673e321e5f8fdc88ece33ec89cc4e2b1d0f | da832b9ce6f7a1195580bb47616fe59869ad648f | /iOS Application/Scenes/ShowArticle/ShowArticleAction.swift | 342b34c6762ec5a5a01ba23cc1df6b86baacf630 | [
"MIT"
] | permissive | basememara/SwiftUI-NewsReader | d4fc6bef1c9b52c0f786c65ed4917f8644058912 | 8fef843cdad4fecd6c1a4a80bf759df7333bc6b9 | refs/heads/develop | 2020-09-15T18:52:01.445600 | 2020-02-28T22:43:03 | 2020-02-28T22:43:03 | 223,531,889 | 67 | 6 | MIT | 2019-12-27T17:41:11 | 2019-11-23T04:42:13 | Swift | UTF-8 | Swift | false | false | 759 | swift | //
// ShowArticleAction.swift
// NewsReader iOS
//
// Created by Basem Emara on 2019-11-24.
//
import NewsCore
enum ShowArticleAction: ActionType {
case toggleFavorite(String)
}
// MARK: - Logic
struct ShowArticleActionCreator: ActionCreatorType {
private let favoriteProvider: FavoriteProviderType
private let dispatch: (ShowArticleAction) -> Void
init(
favoriteProvider: FavoriteProviderType,
dispatch: @escaping (ShowArticleAction) -> Void
) {
self.favoriteProvider = favoriteProvider
self.dispatch = dispatch
}
}
extension ShowArticleActionCreator {
func toggleFavorite(id: String) {
favoriteProvider.toggleArticle(id: id)
dispatch(.toggleFavorite(id))
}
}
| [
-1
] |
4c3d21a51f30d5e2fedfbbd4cf0ba0af50e962b3 | dbc824021f0c2b94a301bbb81137449c1f521307 | /Just Radio/Libraries/FRadioPlayer/FRadioAPI.swift | 66aaccd39743e7d9252c3c52980c4bf2b82c2ee9 | [] | no_license | apeatling/Just-Radio | 31b780d0f1323204d5185a22a2052666c599a22c | b6981faa7ca37934b6cce781f537804a9cf8b480 | refs/heads/master | 2020-04-05T04:47:29.608503 | 2020-01-14T03:20:47 | 2020-01-14T03:20:47 | 156,566,941 | 5 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,299 | swift | //
// FRadioAPI.swift
// FRadioPlayer
//
// Created by Fethi El Hassasna on 2017-11-25.
// Copyright © 2017 Fethi El Hassasna (@fethica). All rights reserved.
//
import Foundation
// MARK: - iTunes API
internal struct FRadioAPI {
// MARK: - Util methods
static func getArtwork(for metadata: String, size: Int, completionHandler: @escaping (_ artworkURL: URL?) -> ()) {
let cleanMetadata = cleanRawMetadataIfNeeded(metadata)
guard !cleanMetadata.isEmpty, cleanMetadata != " - ", let url = getURL(with: cleanMetadata) else {
completionHandler(nil)
return
}
URLSession.shared.dataTask(with: url, completionHandler: { (data, response, error) in
guard error == nil, let data = data else {
completionHandler(nil)
return
}
let json = try? JSONSerialization.jsonObject(with: data, options: .allowFragments)
guard let parsedResult = json as? [String: Any],
let results = parsedResult[Keys.results] as? Array<[String: Any]>,
let result = results.first,
var artwork = result[Keys.artwork] as? String else {
completionHandler(nil)
return
}
if size != 100, size > 0 {
artwork = artwork.replacingOccurrences(of: "100x100", with: "\(size)x\(size)")
}
let artworkURL = URL(string: artwork)
completionHandler(artworkURL)
}).resume()
}
private static func getURL(with term: String) -> URL? {
var components = URLComponents()
components.scheme = Domain.scheme
components.host = Domain.host
components.path = Domain.path
components.queryItems = [URLQueryItem]()
components.queryItems?.append(URLQueryItem(name: Keys.term, value: term))
components.queryItems?.append(URLQueryItem(name: Keys.entity, value: Values.entity))
return components.url
}
private static func cleanRawMetadataIfNeeded(_ rawValue: String) -> String {
// Strip off trailing '[???]' characters left there by ShoutCast and Centova Streams
// It will leave the string alone if the pattern is not there
let pattern = "(\\[.*?\\]\\w*$)"
guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else { return rawValue }
let rawCleaned = NSMutableString(string: rawValue)
regex.replaceMatches(in: rawCleaned , options: .reportProgress, range: NSRange(location: 0, length: rawCleaned.length), withTemplate: "")
return rawCleaned as String
}
// MARK: - Constants
private struct Domain {
static let scheme = "https"
static let host = "itunes.apple.com"
static let path = "/search"
}
private struct Keys {
// Request
static let term = "term"
static let entity = "entity"
// Response
static let results = "results"
static let artwork = "artworkUrl100"
}
private struct Values {
static let entity = "song"
}
}
| [
338428,
329702
] |
686092ecdb757bfd7c84db2a6c71fcd3da7fdfb8 | f8f43b167d7bf883fd57d2625dcd6f192d77c222 | /Example/Soundrecognizer/SoundRecognizerTests/SoundRecognizerTests.swift | f23d788faee8cec3b769d22d3ca0562bb46fca95 | [
"MIT"
] | permissive | Moonko/RosaKit | d24d76de978549909497cf0e52ca6fb45bdb1b33 | b581bc45d3205e24c70f5f4d2b287bd46ad0a5ad | refs/heads/master | 2023-09-05T16:55:57.946185 | 2021-11-09T23:33:22 | 2021-11-09T23:33:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,611 | swift | //
// SoundRecognizerTests.swift
// SoundRecognizerTests
//
// Created by Hrebeniuk Dmytro on 30.06.2020.
// Copyright © 2020 Hrebeniuk Dmytro. All rights reserved.
//
import XCTest
import RosaKit
import SoundRecognizer
class SoundRecognizerTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testRecognizer() throws {
let url = Bundle(for: Self.self).url(forResource: "1-48298-A-46", withExtension: "wav")
let soundFile = url.flatMap { try? WavFileManager().readWavFile(at: $0) }
let int16Array = soundFile?.data.int16Array.map { Double($0)/32768.0 }
let xshape = int16Array?.count ?? 0
let size = 2048*20
let offset = size/8
let count = xshape/offset - 30/2
let validCategory = 46
let soundRecognizerEngine = SoundRecognizerEngine(sampleRate: 44100, windowLength: size)
var isCorrect = true
for index in 0..<count {
let samples = Array(int16Array?[offset*index..<offset*index + size] ?? [])
let result = soundRecognizerEngine.predict(samples: samples)
isCorrect = (result?.percentage ?? 0.0) > 0.95 && ((result?.category ?? -1) % 100) == validCategory
}
XCTAssertTrue(isCorrect)
}
}
| [
-1
] |
cf8cf17416bb0263c70cfc1a2e1fdd33e69547bc | f4b2e94d1dd0afcd6c98747bd583aa28670f7d83 | /Mattermost/Model/Channel.swift | 7475eabb7c6d8e014e9a4a870ee3fb6b3740e234 | [] | no_license | Kilograpp/Mattermost-iOS-Swift | 5a1665b03663a8992bf8b5ed660a9d177f9d92fe | 87767cf6cec17b428f6145981485ef5e7f68448d | refs/heads/development | 2021-07-16T12:15:19.084128 | 2017-08-12T08:34:16 | 2017-08-12T08:34:16 | 63,963,630 | 39 | 8 | null | 2019-03-09T20:00:34 | 2016-07-22T15:25:05 | Swift | UTF-8 | Swift | false | false | 6,484 | swift | //
// Channel.swift
// Mattermost
//
// Created by Maxim Gubin on 21/07/16.
// Copyright © 2016 Kilograpp. All rights reserved.
//
import Foundation
import RealmSwift
enum ChannelAttributes: String {
case identifier = "identifier"
case createdAt = "createdAt"
case updateAt = "updateAt"
case deleteAt = "deleteAt"
case privateTeamId = "privateTeamId"
case privateType = "privateType"
case displayName = "displayName"
case name = "name"
case header = "header"
case purpose = "purpose"
case lastPostDate = "lastPostDate"
case messagesCount = "messagesCount"
case extraUpdateDate = "extraUpdateDate"
case creatorId = "creatorId"
case mentionsCount = "mentionsCount"
case lastViewDate = "lastViewDate"
}
enum ChannelRelationships: String {
case team = "team"
case members = "members"
}
private enum PrivateType {
case direct
case publicChannel
case privateChannel
}
private protocol Computatations: class {
func computeDisplayNameWidth()
}
final class Channel: RealmObject {
class func privateTypeDisplayName(_ privateTypeString: String) -> String {
switch privateTypeString {
case Constants.ChannelType.PublicTypeChannel:
return "Public channels"
case Constants.ChannelType.PrivateTypeChannel:
return "Private groups"
case Constants.ChannelType.DirectTypeChannel:
return "Direct message"
case "out":
return "Outside this team"
default:
return "UNKNOWN"
}
}
//MARK: Properties
dynamic var identifier: String?
dynamic var createdAt: Date?
dynamic var updateAt: Date?
dynamic var deleteAt: Date?
dynamic var privateTeamId: String? {
didSet { computeTeam() }
}
dynamic var privateType: String?
dynamic var displayName: String? {
didSet { computeDisplayNameWidth() }
}
dynamic var name: String?
dynamic var header: String?
dynamic var purpose: String?
dynamic var lastPostDate: Date?
dynamic var messagesCount: String?
dynamic var extraUpdateDate: Date?
dynamic var creatorId: String?
dynamic var mentionsCount: Int = 0
dynamic var lastViewDate: Date?
dynamic var team: Team?
dynamic var displayNameWidth: Float = 0.0
dynamic var currentUserInChannel: Bool = false
dynamic var isInterlocuterOnTeam: Bool = false
dynamic var isDirectPrefered: Bool = false {
didSet {
}
}
dynamic var unsentPost: String = ""
//0..6 int
dynamic var gradientType: Int = 0
var isSelected: Bool {
return self == ChannelObserver.sharedObserver.selectedChannel
}
var members = List<User>()
//MARK: LifeCycle
override class func primaryKey() -> String {
return ChannelAttributes.identifier.rawValue
}
override class func indexedProperties() -> [String] {
return [ChannelAttributes.identifier.rawValue]
}
static func townSquare() -> Channel? {
let channels = RealmUtils.realmForCurrentThread().objects(Channel.self).filter("name == %@", "town-square")
return (channels.count > 0) ? channels.first : nil
}
static func isUserInChannelWith(channelId: String) -> Bool {
let realm = RealmUtils.realmForCurrentThread()
let channel = realm.object(ofType: Channel.self, forPrimaryKey: channelId)
guard channel != nil else { return false }
return (channel?.members.contains(DataManager.sharedInstance.currentUser!))!
}
func interlocuterFromPrivateChannel() -> User {
let ids = self.name?.components(separatedBy: "__")
let interlocuterId = ids?.first == Preferences.sharedInstance.currentUserId ? ids?.last : ids?.first
if interlocuterId == nil {
return safeRealm.objects(User.self).filter(NSPredicate(format: "identifier = %@", "cnxnpk8o7jf95b9zmb6ydc3bqy")).first!
}
return safeRealm.objects(User.self).filter(NSPredicate(format: "identifier = %@", interlocuterId!)).first!
}
func lastPost() -> Post? {
let predicate = NSPredicate(format: "channelId = %@", identifier ?? "")
let results = RealmUtils.realmForCurrentThread().objects(Post.self).filter(predicate).sorted(byKeyPath: "createdAt", ascending: false)
return results.first
}
}
private protocol Support: class {
static func teamIdentifierPath() -> String
func hasNewMessages() -> Bool
}
private protocol URLBuilder: class {
func buildURL() -> String
}
// MARK: - Support
extension Channel: Support {
static func teamIdentifierPath() -> String {
return ChannelRelationships.team.rawValue + "." + ChannelAttributes.identifier.rawValue
}
static func currentUserIdentifier() -> String {
if let identifier = Preferences.sharedInstance.currentUserId {
return identifier
} else {
return ""
}
}
func computeTeam() {
//s3 refactor
if (self.privateTeamId!.isEmpty) {
self.team = safeRealm.object(ofType:Team.self, forPrimaryKey: DataManager.sharedInstance.currentTeam!.identifier!)
} else {
self.team = safeRealm.object(ofType:Team.self, forPrimaryKey: self.privateTeamId!)
}
}
func computeDispayNameIfNeeded() {
if self.privateType == "D" {
if !(self.name?.isEmpty)! {
let user = self.interlocuterFromPrivateChannel()
self.displayName = user.displayName
}
}
}
func hasNewMessages() -> Bool {
guard lastViewDate != nil else { return false }
return ((self.lastViewDate as NSDate?)?.isEarlierThan(self.lastPostDate))!
}
}
//MARK: Computatations
extension Channel: Computatations {
func computeDisplayNameWidth() {
self.displayNameWidth = StringUtils.widthOfString(self.displayName! as NSString!, font: FontBucket.postAuthorNameFont)
}
}
//MARK: URLBuilder
extension Channel: URLBuilder {
func buildURL() -> String {
let baseUrlArr: [String] = Api.sharedInstance.baseURL().relativeString.components(separatedBy: "/")
return baseUrlArr[0]+"//"+baseUrlArr[2]+"/"+self.team!.name!+"/channels/"+self.name!
}
}
| [
-1
] |
c33433343ef1f8f75fecbec280752ffeddcd9649 | 19e2f822a8d102b7b21c3b7a87575079908f9c35 | /Wildfire1.1/ViewControllers/DriverLicenceFrontUploadViewController.swift | 2b38eb3b9603e9ba84d80ff54cc05c1416e99371 | [] | no_license | tomdpitts/wildfire | 72359bc3f79d59eaeadc577c1bd4e3696a0faa0c | 50ea482a62bdfe617f93134dcf0251028914b95f | refs/heads/master | 2022-11-11T22:23:28.464859 | 2020-07-01T03:58:01 | 2020-07-01T03:58:01 | 177,329,366 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,704 | swift | //
// DriverLicenceFrontUploadViewController.swift
// Wildfire1.1
//
// Created by Thomas Pitts on 02/03/2020.
// Copyright © 2020 Wildfire. All rights reserved.
//
import UIKit
import AlamofireImage
class DriverLicenceFrontUploadViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
var frontImage: UIImage?
@IBOutlet weak var pictureView: UIImageView!
@IBOutlet weak var editImageButton: UIButton!
@IBOutlet weak var nextButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
nextButton.isHidden = true
Utilities.styleHollowButton(editImageButton)
Utilities.styleHollowButton(nextButton)
pictureView.clipsToBounds = true
pictureView.layer.cornerRadius = pictureView.frame.width/40
pictureView.layer.borderWidth = 5.0 //Or some other value
pictureView.layer.borderColor = UIColor(hexString: "#39C3C6").cgColor
}
@IBAction func editImageButton(_ sender: Any) {
ImagePickerManager().pickImage(self){ image in
// and scale a version to display (possibly not strictly necessary)
let size = CGSize(width: self.pictureView.frame.width, height: self.pictureView.frame.height)
let aspectScaleImage = image.af.imageAspectScaled(toFit: size)
self.pictureView.image = aspectScaleImage
// contentMode needs to be updated from "center" (which ensures the icons8 'rescan'icon doesn't look stretched or blurry) to scaleAspectFill to best render the image
self.pictureView.contentMode = .scaleAspectFill
let impactFeedbackgenerator = UIImpactFeedbackGenerator(style: .heavy)
impactFeedbackgenerator.prepare()
impactFeedbackgenerator.impactOccurred()
self.frontImage = aspectScaleImage
self.editImageButton.setTitle("Change Image", for: .normal)
self.nextButton.isHidden = false
}
}
func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: NSDictionary!){
self.dismiss(animated: true, completion: { () -> Void in
})
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.destination is DriverLicenceBackUploadViewController {
let vc = segue.destination as! DriverLicenceBackUploadViewController
if let front = self.frontImage {
vc.frontImage = front
}
}
}
}
| [
-1
] |
32f25807272ed1c228461e48b1f6a63b73babc1c | fab8a576f13c97933f63caad8ddbb85c67371fbb | /datamovie-ios/DataMovie/Common/Model/Entities/VideoModel.swift | 96a1ec3900ada7d7f30e3609fa11cf6b2b3fc73f | [] | no_license | andrehsouza/ios-recruiting-brazil | f95e24f06318b01d743703ac83130205954807a9 | ee14deb2d128e7a051473147d8719ee927e4c945 | refs/heads/master | 2020-03-31T23:02:02.948005 | 2018-10-11T18:54:22 | 2018-10-11T18:54:22 | 152,640,235 | 0 | 0 | null | 2018-10-11T18:50:57 | 2018-10-11T18:50:57 | null | UTF-8 | Swift | false | false | 1,145 | swift | //
// VideoModel.swift
// DataMovie
//
// Created by Andre on 02/09/2018.
// Copyright © 2018 Andre. All rights reserved.
//
import Foundation
enum VideoType: String {
case youtube = "YouTube"
}
struct VideoModel: Decodable {
var videoID: String?
var key: String? //O que vai na url
var type: String? //Trailer
var name: String?
var site: String? //YouTube
enum CodingKeys: String, CodingKey {
case videoID = "id"
case key = "key"
case type = "type"
case name = "name"
case site = "site"
case results = "results"
}
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
videoID = try container.decodeIfPresent(String.self, forKey: .videoID)
key = try container.decodeIfPresent(String.self, forKey: .key)
type = try container.decodeIfPresent(String.self, forKey: .type)
name = try container.decodeIfPresent(String.self, forKey: .name)
site = try container.decodeIfPresent(String.self, forKey: .site)
}
}
| [
-1
] |
244448c51ade04b0b3bccdf17be76e20eb8d93bc | 3b9ec0dd4a5ae63799beefc445d18caea7a0a459 | /Student Help/Student Help/Homework1.swift | c1fb042f5023b160ad19ec2813b28e96ec81f6e6 | [
"Apache-2.0"
] | permissive | AnhDuyHa/swiftApp1 | d81a98e2cbc9614f45d4efd5c3e2913e4662f128 | df242f6ccc10068914479db54c4678efc5c74002 | refs/heads/master | 2020-03-22T21:43:24.802972 | 2018-07-12T12:33:18 | 2018-07-12T12:33:18 | 140,710,038 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,690 | swift | //
// Homework1.swift
// Student Help
//
// Created by AnhDuy Ha on 13/5/18.
// Copyright © 2018 AnhDuy Ha. All rights reserved.
//
import UIKit
//global array, to let its acessable for all and Homework1 ViewController
var list:Array = [String]()
var myIndex = 0
class Homework1: UIViewController, UITableViewDelegate, UITableViewDataSource{
@IBOutlet weak var myTableView: UITableView!
//tell how many rows we want in our tableView
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return (list.count) //number of rows is equal to the number of items that is in the h/w list
}
//puting text in the tableView
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
cell.textLabel?.text = list[indexPath.row]
return(cell)
}
//This function let the user delete an item by swiping left
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath)
{
if editingStyle == UITableViewCellEditingStyle.delete
{
list.remove(at: indexPath.row)
myTableView.reloadData()
}
}
//The row that you tap on it will transfer the user you to another view controller
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
myIndex = indexPath.row //the number of myIndex will be equal to the number of row that you are pressing on
performSegue(withIdentifier: "segue", sender: self)
}
//each time the tableView appear its gonna reload the data
override func viewDidAppear(_ animated: Bool) {
myTableView.reloadData()
}
//Goes back to the tableView
@IBAction func unwindSegue(_ sender: UIStoryboardSegue) {
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
c87173e170e85b7e095c097732fac238f888174f | c08155dc82bbfc2fe228699da2c888b2d6c50ee5 | /RoomPlanner/Renderable.swift | 80b54a41142a7938d80046a42ba68769eeb03c1c | [] | no_license | scheckmedia/RoomPlanner | a936f9623f9021244fdeb2a2ee3da89e5f27ebdd | c749a03ba943545ebfb3c1b9fb2e344e65003517 | refs/heads/master | 2020-03-16T10:15:51.664390 | 2017-02-07T15:22:02 | 2017-02-07T15:22:02 | 132,632,816 | 4 | 0 | null | 2018-05-08T16:00:09 | 2018-05-08T16:00:09 | null | UTF-8 | Swift | false | false | 482 | swift | //
// RenderableObject.swift
// RoomPlanner
//
// Created by Tobias Scheck on 06.11.16.
// Copyright © 2016 AR. All rights reserved.
//
import GLMatrix
import GLKit
protocol Renderable {
var modelPosition:Mat4 { get set }
var texture:GLuint? { get set }
func render(projection: Mat4, view:Mat4)
}
struct Vertex {
var position : (x: GLfloat, y: GLfloat, z: GLfloat)
var uv : (x: GLfloat, y: GLfloat)
var normal: (x: GLfloat, y: GLfloat, z: GLfloat)
}
| [
-1
] |
c8a6ca6bb740330dc0e7397488be2f7fb4da638b | f40fac17bee3a00adadc02ada107cfdad4b0f332 | /Instagram/CommentViewController.swift | f4e1201ced45d749f493e9065f5309f423c111b5 | [] | no_license | naka-sa/instagram | 0ee3182a10de8a93bb0869dfee517ef104e01758 | 725d0d026f58068160197c15779aad551839a602 | refs/heads/master | 2021-01-19T09:24:56.136431 | 2017-04-10T07:27:13 | 2017-04-10T07:27:13 | 87,756,098 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,936 | swift | //
// CommentViewController.swift
// Instagram
//
// Created by satoshi_nakajima on 2017/03/28.
// Copyright © 2017年 satoshi_nakajima. All rights reserved.
//
import UIKit
import Firebase
import FirebaseAuth
import FirebaseDatabase
import SVProgressHUD
class CommentViewController: UIViewController {
@IBOutlet weak var commentField: UITextField!
//target
var postData:PostData!
@IBAction func commentPostButton(_ sender: Any) {
// postDataに必要な情報を取得しておく
let name = FIRAuth.auth()?.currentUser?.displayName
// 辞書を作成してFirebaseに保存する
let postRef = FIRDatabase.database().reference().child(Const.PostPath).child(self.postData.id!)
let postData = ["caption": "\(self.postData.caption!) : \n : \(name!) : \(commentField.text!)"]
postRef.updateChildValues(postData)
//コメント投稿を完了する
SVProgressHUD.showSuccess(withStatus: "コメントを投稿しました")
self.dismiss(animated: true, completion: nil)
}
@IBAction func commentCancelButton(_ sender: Any) {
//コメント投稿をキャンセルする
self.dismiss(animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
0ec2e8a9fbeaebfcb26ebbabad357b95c47b6af7 | b9ade621e8e5e0f57c1877d69a773978a51546c8 | /SegundaMano/Coche.swift | 014e04936a5ec0790a41a6aa1615531502577545 | [] | no_license | virkinia/cursoIOS | 93c11a44c34ce4a1a6bcb26e5fdfec0241cb4d25 | 83bf4ae49a66f7138329a75f5e20685a29437365 | refs/heads/master | 2020-05-07T19:46:42.021530 | 2019-04-11T15:58:09 | 2019-04-11T15:58:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,063 | swift | //
// Coche.swift
// SegundaMano
//
// Created by Dev2 on 09/04/2019.
// Copyright © 2019 CFTIC. All rights reserved.
//
import Foundation
class Coche {
var maker: String
var model: String
var platter: String
var year: String
var price: Double?
convenience init (_ maker: String, _ model: String, _ platter: String) {
self.init(maker,model,platter, "YYYY", 2000);
}
init ( _ maker: String, _ model: String,_ platter: String, _ year: String, _ price:Double? ) {
self.maker = maker
self.model = model
self.platter = platter
self.year = year
self.price = price
}
func toString() -> String {
return "Soy un \(self.maker)"
}
func toJson() -> Data? {
let json: [String: Any] = [
"maker":self.maker,
"model": self.model,
"platter":self.platter,
"year":self.year,
"price":self.price ?? 0
]
return try? JSONSerialization.data(withJSONObject: json)
}
}
| [
-1
] |
0e718874607e21356821278c9ccb6f8b2ad31793 | 1e1fbf7b73cadd6a9d67822dc4970a0f16dd10a6 | /ios/AppCMS/AppCMS/Parser/Module/SFPageControlParser.swift | cf761806f2b222555376ed5083afd7e7d092e2dd | [] | no_license | piyushaggarwal-mob-incedo/fastlanetest | d1843b0d1a2a746940906f6f8d2850b0b1d313f2 | 7bf03d082edfcfefb35e8a749f8d136a0206a75b | refs/heads/master | 2021-04-06T08:44:03.687425 | 2018-03-16T10:00:52 | 2018-03-16T10:00:52 | 124,931,474 | 0 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 1,092 | swift | //
// SFPageControlParser.swift
// AppCMS
//
// Created by Gaurav Vig on 25/05/17.
// Copyright © 2017 Viewlift. All rights reserved.
//
import UIKit
class SFPageControlParser: NSObject {
func parsePageControlJson(pageControlDictionary: Dictionary<String, AnyObject>) -> SFPageControlObject
{
let pageControlObject = SFPageControlObject()
pageControlObject.type = pageControlDictionary["type"] as? String
pageControlObject.selectorColor = pageControlDictionary["selectedColor"] as? String
pageControlObject.unSelectedColor = pageControlDictionary["unSelectedColor"] as? String
let layoutDict = pageControlDictionary["layout"] as? Dictionary<String, Any>
if layoutDict != nil {
let layoutObjectParser = LayoutObjectParser()
let layoutObjectDict:Dictionary <String, LayoutObject> = layoutObjectParser.parseLayoutJson(layoutDictionary: layoutDict!)
pageControlObject.layoutObjectDict = layoutObjectDict
}
return pageControlObject
}
}
| [
-1
] |
2e29d8db9b0b79c975562779bb9a917b32fb9ce6 | 1acbde41cbef9e020f2900a0473292f57d61ff28 | /Reddit/Extensions/UINavigationController+NavigationBar.swift | e16721a2054a18160908b392d40256c1848daa5c | [] | no_license | suneethchakravarthy/Reddit | c88f88970d88dd5681691f33aac05c3e49e28be1 | 573db077cf42414f507b5a0dc5ab16ea01ec82e6 | refs/heads/master | 2022-12-14T17:51:08.046470 | 2020-09-20T07:20:00 | 2020-09-20T07:20:00 | 297,021,115 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 544 | swift | //
// UINavigationController+NavigationBar.swift
// Reddit
//
// Created by Suneeth on 9/19/20.
// Copyright © 2020 Suneeth. All rights reserved.
//
import UIKit
extension UINavigationController {
func setNavigationBar(){
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.navigationBarbuttonTextColor]
navigationBar.tintColor = UIColor.navigationBarbuttonTextColor
navigationBar.barTintColor = UIColor.navigationBarColor
navigationBar.titleTextAttributes = textAttributes
}
}
| [
-1
] |
fc5f92cded8a653b885687849a5560befa68e212 | 3c754f0a8cb380113f1064fe3ba826da7b42b0a3 | /Source/ImageProgre.swift | b0157a2f6a0df17effbe4e073be2e39368fdaee1 | [
"Apache-2.0"
] | permissive | tangjianfengVS/WisdomHUD | 063ae11d15069e13d3810f7a0ccc829c0fdb3b9a | 55b573c7fb153f871191216ae5425893bd8d9f65 | refs/heads/master | 2023-08-17T10:28:36.293592 | 2023-08-15T09:24:47 | 2023-08-15T09:24:47 | 160,308,853 | 24 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 12,667 | swift | //
// ImageProgre.swift
// WisdomHUDDemo
//
// Created by 汤建锋 on 2022/12/6.
// Copyright © 2022 All over the sky star. All rights reserved.
//
import UIKit
public class WisdomHUDImageProgreView: WisdomHUDImageBaseView {
fileprivate var progreWidth: CGFloat=3.0
let progreLabel: UILabel = {
let label = UILabel()
label.text = "0%"
label.font = UIFont.systemFont(ofSize: 13, weight: .regular)
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
public override init(size: CGFloat) {
super.init(size: size)
addSubview(progreLabel)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension WisdomHUDImageProgreView {
@objc func setProgreValue(value: UInt){
}
@objc func setProgreColor(color: UIColor){
}
@objc func setProgreTextColor(color: UIColor){
}
@objc func setProgreShadowColor(color: UIColor){
}
}
@objc public class WisdomHUDImageCircleView: WisdomHUDImageProgreView {
@objc public private(set) var circleColor = UIColor.white
private lazy var circleLayer: CAShapeLayer = {
let path = UIBezierPath(arcCenter: CGPoint(x: size/2, y: size/2),
radius: (size-progreWidth)/2.0,
startAngle: Double.pi,
endAngle: Double.pi*3,
clockwise: true)
let circle = CAShapeLayer()
circle.fillColor = UIColor.clear.cgColor
circle.strokeColor = UIColor(white: 0.5, alpha: 0.3).cgColor
circle.lineCap = CAShapeLayerLineCap.round
circle.lineWidth = progreWidth
circle.strokeEnd = 1.0
circle.path = path.cgPath
return circle
}()
private lazy var task_circleLayer: CAShapeLayer = {
let path = UIBezierPath(arcCenter: CGPoint(x: size/2, y: size/2),
radius: (size-progreWidth)/2.0,
startAngle: Double.pi*1.5,
endAngle: Double.pi*3.5,
clockwise: true)
let circle = CAShapeLayer()
circle.fillColor = UIColor.clear.cgColor
circle.strokeColor = circleColor.cgColor
circle.lineCap = CAShapeLayerLineCap.round
circle.lineWidth = progreWidth
circle.strokeEnd = 0
circle.path = path.cgPath
return circle
}()
@objc public init(size: CGFloat, barStyle: WisdomSceneBarStyle) {
super.init(size: size)
progreWidth = size/15.0
switch barStyle {
case .dark: circleColor = UIColor.white
case .light: circleColor = UIColor.black
case .hide: circleColor = UIColor.white
}
wisdom_addConstraint(toCenterX: progreLabel, toCenterY: progreLabel)
progreLabel.font = UIFont.systemFont(ofSize: size/3.8, weight: .regular)
progreLabel.textColor = circleColor
layer.addSublayer(circleLayer)
layer.addSublayer(task_circleLayer)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc override public func setProgreValue(value: UInt){
if value>=100 {
task_circleLayer.strokeEnd = 1
progreLabel.text = "100%"
}else {
task_circleLayer.strokeEnd = CGFloat(value)/100.0
progreLabel.text = "\(value)%"
}
}
@objc override public func setProgreColor(color: UIColor){
task_circleLayer.strokeColor = color.cgColor
}
@objc override public func setProgreTextColor(color: UIColor){
progreLabel.textColor = color
}
@objc override public func setProgreShadowColor(color: UIColor){
circleLayer.strokeColor = color.cgColor
}
}
@objc public class WisdomHUDImageLinearView: WisdomHUDImageProgreView {
@objc public private(set) var lineColor = UIColor.white
private lazy var progreHeight: CGFloat = { return size/8.4 }()
private lazy var borderView: UIView = {
let view = UIView()
view.layer.borderColor = UIColor(white: 0.5, alpha: 0.3).cgColor
view.layer.borderWidth = 1.0
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.masksToBounds = true
view.layer.cornerRadius = progreHeight/2
return view
}()
private lazy var task_circleLayer: CAShapeLayer = {
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: progreHeight/2))
path.addLine(to: CGPoint(x: progreWidth, y: progreHeight/2))
let circle = CAShapeLayer()
circle.fillColor = UIColor.clear.cgColor
circle.strokeColor = lineColor.cgColor
circle.lineCap = CAShapeLayerLineCap.round
circle.lineWidth = progreHeight
circle.strokeEnd = 0
circle.path = path.cgPath
return circle
}()
@objc public init(size: CGFloat, barStyle: WisdomSceneBarStyle) {
super.init(size: size)
progreWidth = size*1.2
switch barStyle {
case .dark: lineColor = UIColor.white
case .light: lineColor = UIColor.black
case .hide: lineColor = UIColor.white
}
progreLabel.textColor = lineColor
progreLabel.font = UIFont.systemFont(ofSize: size/3.4, weight: .regular)
addSubview(borderView)
borderView.wisdom_addConstraint(width: progreWidth, height: progreHeight)
wisdom_addConstraint(toCenterX: borderView, toCenterY: nil)
addConstraint(NSLayoutConstraint(item: borderView,
attribute: .bottom,
relatedBy: .equal,
toItem: self,
attribute: .bottom,
multiplier: 1.0,
constant: -progreHeight*1.3))
wisdom_addConstraint(toCenterX: progreLabel, toCenterY: nil)
addConstraint(NSLayoutConstraint(item: progreLabel,
attribute: .bottom,
relatedBy: .equal,
toItem: borderView,
attribute:.top,
multiplier: 1.0,
constant: -progreHeight*1.5))
borderView.layer.addSublayer(task_circleLayer)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc override public func setProgreValue(value: UInt){
if value>=100 {
task_circleLayer.strokeEnd = 1
progreLabel.text = "100%"
}else {
task_circleLayer.strokeEnd = CGFloat(value)/100.0
progreLabel.text = "\(value)%"
}
}
@objc override public func setProgreColor(color: UIColor){
task_circleLayer.strokeColor = color.cgColor
}
@objc override public func setProgreTextColor(color: UIColor){
progreLabel.textColor = color
}
@objc override public func setProgreShadowColor(color: UIColor){
borderView.layer.borderColor = color.cgColor
}
}
@objc public class WisdomHUDImageWaterView: WisdomHUDImageProgreView {
@objc public private(set) var waterColor = UIColor.white
private lazy var water_deep: CGFloat = { return size/3.2 }()
private lazy var water_margin: CGFloat = { return size/16 }()
private lazy var left_bottom_x: CGFloat = (water_margin+size)/4
private lazy var right_top_x: CGFloat = (water_margin+size)/4*3
private var water_leftTopAnim = false
private var progre: CGFloat = 0
private lazy var waterView: UIView = {
let view = UIView()
view.backgroundColor = UIColor(white: 0.5, alpha: 0.3)
view.translatesAutoresizingMaskIntoConstraints = false
view.layer.masksToBounds = true
view.layer.cornerRadius = size/2
return view
}()
private lazy var waterLayer: CAShapeLayer = {
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: size))
path.addCurve(to: CGPoint(x: water_margin*2+size, y: size),
controlPoint1: CGPoint(x: left_bottom_x, y: size+water_deep),
controlPoint2: CGPoint(x: right_top_x, y: size-water_deep))
path.addLine(to: CGPoint(x: water_margin*2+size, y: size+water_deep/3))
path.addLine(to: CGPoint(x: 0, y: size+water_deep/3))
path.addLine(to: CGPoint(x: 0, y: size+water_deep/3))
let water = CAShapeLayer()
water.fillColor = waterColor.cgColor
water.strokeColor = waterColor.cgColor
water.lineCap = CAShapeLayerLineCap.round
water.lineWidth = 0.5
water.path = path.cgPath
water.frame = CGRect(x: -water_margin, y: 0, width: size+water_margin*2, height: size)
return water
}()
@objc public init(size: CGFloat, barStyle: WisdomSceneBarStyle) {
super.init(size: size)
switch barStyle {
case .dark: waterColor = UIColor.white
case .light: waterColor = UIColor.black
case .hide: waterColor = UIColor.white
}
wisdom_addConstraint(toCenterX: progreLabel, toCenterY: progreLabel)
progreLabel.font = UIFont.systemFont(ofSize: size/3.8, weight: .regular)
progreLabel.textColor = waterColor
insertSubview(waterView, belowSubview: progreLabel)
waterView.wisdom_addConstraint(width: size, height: size)
wisdom_addConstraint(toCenterX: waterView, toCenterY: waterView)
waterView.layer.addSublayer(waterLayer)
setRotationAnim()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc override public func setProgreValue(value: UInt){
if value>=100 {
progre = 1
progreLabel.text = "100%"
}else {
progre = CGFloat(value)/100.0
progreLabel.text = "\(value)%"
}
}
@objc override public func setProgreColor(color: UIColor){
waterLayer.fillColor = color.cgColor
waterLayer.strokeColor = color.cgColor
}
@objc override public func setProgreTextColor(color: UIColor){
progreLabel.textColor = color
}
@objc override public func setProgreShadowColor(color: UIColor){
waterView.backgroundColor = color
}
private func setRotationAnim() {
let path = UIBezierPath()
path.move(to: CGPoint(x: 0, y: size*(1-progre)))
if progre == 1 {
path.addLine(to: CGPoint(x: water_margin*2+size, y: 0))
}else if water_leftTopAnim {
path.addCurve(to: CGPoint(x: water_margin*2+size, y: size*(1-progre)),
controlPoint1: CGPoint(x: left_bottom_x, y: (progre <= 0.1) ? size*(1-progre)-water_deep*0.7:size*(1-progre)-water_deep),
controlPoint2: CGPoint(x: right_top_x, y: (progre <= 0.1) ? size*(1-progre)+water_deep*0.7:size*(1-progre)+water_deep))
}else {
path.addCurve(to: CGPoint(x: water_margin*2+size, y: size*(1-progre)),
controlPoint1: CGPoint(x: left_bottom_x, y: (progre <= 0.1) ? size*(1-progre)+water_deep*0.7:size*(1-progre)+water_deep),
controlPoint2: CGPoint(x: right_top_x, y: (progre <= 0.1) ? size*(1-progre)-water_deep*0.7:size*(1-progre)-water_deep))
}
path.addLine(to: CGPoint(x: water_margin*2+size, y: size+water_deep/3))
path.addLine(to: CGPoint(x: 0, y: size+water_deep/3))
path.addLine(to: CGPoint(x: 0, y: size*(1-progre)+water_deep/3))
let basicAnim = CABasicAnimation(keyPath: "path")
basicAnim.duration = 0.6
basicAnim.fromValue = waterLayer.path
basicAnim.toValue = path
basicAnim.delegate = self
waterLayer.path = path.cgPath
waterLayer.add(basicAnim, forKey: nil)
water_leftTopAnim = !water_leftTopAnim
}
}
extension WisdomHUDImageWaterView: CAAnimationDelegate{
@objc public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
setRotationAnim()
}
}
| [
-1
] |
b61174ba341ea4e2d8693b2223328c472b60d4e6 | 7be8f22bfa0dee0e35c4612109d711cb66a79ee4 | /PensamentosCore/ValueObjects/Quote.swift | d4d6498d6e6f0cafad42eef900f30f1a5bd44021 | [] | no_license | AlessandroLima/Pensamentos | 09d445269d4056cd4defd988e33761dc8046594f | e02fe39a5c6c1decb329995d66d3851be8f4f78b | refs/heads/master | 2020-07-15T14:52:05.334471 | 2019-08-31T19:37:21 | 2019-08-31T19:37:21 | 205,587,984 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 186 | swift | //
// Quots.swift
// Pensamentos
//
// Created by Alessandro on 24/08/19.
// Copyright © 2019 Alessandro. All rights reserved.
//
import Foundation
public protocol Quotes{
}
| [
-1
] |
bbe5519442664341374c599235ff37cab7970448 | 8a1f36cef0a2ba08009171905a889720882c0062 | /multi/scott1sm1ms.swift | 94f798606f8c42fe0297fdc9e1c3c2f87a3e4105 | [] | no_license | skrieder/swift | 503ba1efd37a447a7f08b32827e081fa186121cd | efb13fbaa3903c988e064d83ce03cb8313c5c67c | refs/heads/master | 2021-03-12T21:57:14.638554 | 2012-06-12T16:28:21 | 2012-06-12T16:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,033 | swift |
type messagefile;
type countfile;
app (countfile t) countwords (messagefile f) {
a1sm1ms stdout=@filename(t);
}
string inputNames = "scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh scott3a.sh";
messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
foreach f,i in inputfiles {
countfile c <single_file_mapper; file=@strcat(i, ".result")>;
c = countwords(f);
}
| [
-1
] |
63ba32fce20f6d43a63c2ed642c7f0abb8c5724e | 3dc11c340e22d3c1659137680464da59ca9e28c5 | /Hospitals/HospitalRow.swift | 6251a846a74006a8c022897e5e5a41d771ad9120 | [] | no_license | viwo3022/Hospital-App | e129de983daec0fc3b357516437a3ffb7f896db1 | 6a032a3a1dd0319073a344d181c4e76d70720976 | refs/heads/main | 2023-07-03T09:00:09.777495 | 2021-08-05T16:31:23 | 2021-08-05T16:31:23 | 392,176,193 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 665 | swift | //
// HospitalRow.swift
// Hospitals
//
// Created by Vienna Wong on 7/28/21.
//
import Foundation
import SwiftUI
struct HospitalRow: View {
var hospitalName: String
var body: some View {
HStack {
Spacer().frame(width: 16)
Text(hospitalName)
.font(.subheadline)
.fontWeight(.semibold)
.foregroundColor(Color("gray"))
Spacer().frame(width: 24)
}
.padding(.vertical, 16)
}
}
struct HospitalRow_Previews: PreviewProvider {
static var previews: some View {
HospitalRow(hospitalName: "hospital name")
}
}
| [
-1
] |
10ba8e33690f62903f87fdf6679834b60b0fe433 | fd9c1089da716a9236b51bc4b0064f3d687ca332 | /Celsiusheit/SceneDelegate.swift | bb94e9d13923f997ad7663a8e09e25c3ee0094bc | [] | no_license | CarlosHG1995/Celsiusheit | ed0a4e694bde28866673dcc458b9d39891aa2cc1 | a0c04c808de9aab93dd0a8d68d669a6aa266ca0e | refs/heads/master | 2023-02-22T00:10:53.085249 | 2021-01-20T00:28:37 | 2021-01-20T00:28:37 | 330,988,369 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,336 | swift | //
// SceneDelegate.swift
// Celsiusheit
//
// Created by cmu on 10/10/2019.
// Copyright © 2019 UPV. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
180314,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
337048,
345247,
361645,
345268,
337076,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
115973,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
362274,
378664,
354107,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
395340,
378956,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
272787,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
338661,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
330750,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
339401,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
356631,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
332162,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
348926,
389927,
348979,
152371,
340792,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
267929,
333472,
333512,
259789,
358100,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
333767,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
334047,
350449,
375027,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
325915,
350494,
325918,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
326764,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
384192,
351424,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
245358,
138865,
155255,
155274,
368289,
245410,
425639,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
c9e403a5168e7c9d9b8d927b5dc2a59e5ee74272 | 32a0a528eba73beab92121549f310dafcff8b72e | /Car/Tools/Tool/Categories/UIImageView+FKKingfisher.swift | cbcc31de3cef5eb1c1774fc86dfbd4565f52cec0 | [] | no_license | maxmoo/Car | 30aed39cc045887a231aabf7173b438051bdeda1 | 4c54f5d9b6644ef3a300b93b5c832dd37200fb47 | refs/heads/master | 2021-04-26T01:46:09.031415 | 2017-10-19T06:11:05 | 2017-10-19T06:11:05 | 107,377,278 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 456 | swift | //
// UIImageView+FKKingfisher.swift
// FlycoSmart
//
// Created by hss on 2017/9/6.
// Copyright © 2017年 FlycoIT. All rights reserved.
//
import UIKit
import Kingfisher
extension UIImageView {
func fk_setImage(imageUrl: String, placeholder: String) {
let url = URL(string:imageUrl)
self.kf.setImage(with: url, placeholder:UIImage(named:placeholder) , options: nil, progressBlock: nil, completionHandler: nil)
}
}
| [
-1
] |
3a47b21db93ea153fe56d591280327535ae44dea | 00df94566b786d62e2aad0e849217c4cd5389d8f | /ios/Calculator/Calculator/ViewController.swift | d9aab68a2be74e2513fa6586d5c06ed3b112a657 | [] | no_license | mrthawee/training | f491a1704bcf294e3764df7f1efbf2fbd4e15be1 | d444189c7e83e043faba90a8afcf28f717bb4f11 | refs/heads/master | 2021-01-10T06:12:01.160886 | 2020-07-24T07:23:54 | 2020-07-24T07:23:54 | 50,881,742 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,610 | swift | //
// ViewController.swift
// Calculator
//
// Created by Thawee Techathamnukool on 1/28/16.
// Copyright © 2016 Thawee Techathamnukool. All rights reserved.
//
import UIKit
enum modes {
case NOT_SET
case ADDITION
case SUBTRACTION
}
class ViewController: UIViewController {
var labelString:String = "0"
var currentMode:modes = modes.NOT_SET
var savedNum:Int = 0
var lastButtonWasMode:Bool = false
@IBOutlet weak var label: UILabel!
@IBAction func tapped0(sender: AnyObject) { tappedNumber(0) }
@IBAction func tapped1(sender: AnyObject) { tappedNumber(1) }
@IBAction func tapped2(sender: AnyObject) { tappedNumber(2) }
@IBAction func tapped3(sender: AnyObject) { tappedNumber(3) }
@IBAction func tapped4(sender: AnyObject) { tappedNumber(4) }
@IBAction func tapped5(sender: AnyObject) { tappedNumber(5) }
@IBAction func tapped6(sender: AnyObject) { tappedNumber(6) }
@IBAction func tapped7(sender: AnyObject) { tappedNumber(7) }
@IBAction func tapped8(sender: AnyObject) { tappedNumber(8) }
@IBAction func tapped9(sender: AnyObject) { tappedNumber(9) }
@IBAction func tappedPlus(sender: AnyObject) {
changeMode(modes.ADDITION)
}
@IBAction func tappedMinus(sender: AnyObject) {
changeMode(modes.SUBTRACTION)
}
@IBAction func tappedEqual(sender: AnyObject) {
guard let num:Int = Int(labelString) else {
return
}
if (currentMode == modes.NOT_SET || lastButtonWasMode == true) {
return
}
if (currentMode == modes.ADDITION) {
savedNum += num
}
else if (currentMode == modes.SUBTRACTION) {
savedNum -= num
}
currentMode = modes.NOT_SET
labelString = "\(savedNum)"
updateText()
lastButtonWasMode = true
}
@IBAction func tappedClear(sender: AnyObject) {
savedNum = 0
labelString = "0"
label.text = "0"
currentMode = modes.NOT_SET
lastButtonWasMode = false
}
func tappedNumber(num:Int) {
//if (labelString == "0") {
// labelString = ""
//}
if (lastButtonWasMode == true) {
lastButtonWasMode = false
labelString = "0"
}
labelString = labelString.stringByAppendingString("\(num)")
updateText()
}
func updateText() {
// label.text = labelString
guard let labelInt:Int = Int(labelString) else {
label.text = "Int conversion failed"
return // exit from this function
}
if (currentMode == modes.NOT_SET) {
savedNum = labelInt
}
// use formatter to display comma(s)
let formatter:NSNumberFormatter = NSNumberFormatter()
formatter.numberStyle = NSNumberFormatterStyle.DecimalStyle
let num:NSNumber = NSNumber(integer: labelInt)
//label.text = "\(labelInt)"
label.text = formatter.stringFromNumber(num)
}
func changeMode(newMode:modes) {
if (savedNum == 0) {
return
}
currentMode = newMode
lastButtonWasMode = true
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
284393
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.