blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
listlengths 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
listlengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7b0f91817b62821baa114da8c71ac4c1590d2dfb | 27a1830b1f6c15d1ccc56f22e3d6eacc28d58cdd | /Fibonacci.swift | 0fb7cbf3b000d8db7f7200a8f331a45f0f4bcee3 | [] | no_license | WillyCoding/EjerciciosDeProgramacionBasicos | a009c0342f05d92e5a51406e9a827e32070b8965 | 22871f9e5465e1161b3403c79953723dc833fa3f | refs/heads/master | 2021-05-02T07:28:53.216857 | 2018-02-10T18:57:12 | 2018-02-10T18:57:12 | 120,830,153 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,044 | swift | //
// main.swift
// FibonacciEnSwift
//
// Created by Guillermo on 9/2/18.
// Copyright © 2018 Guillermo. All rights reserved.
//
import Foundation
// Declaracion de las funciones
func fibonacci(_ numero:Int) -> Int {
if numero == 0 || numero == 1 {
return numero
} else {
return fibonacci(numero - 2) + fibonacci(numero - 1)
}
}
// Variables y constantes
var numeroUsuario:Int = 0
var numeroUsuarioString:String?
var numeroFibonacci:Int = 0
// Desarrollo del programa
print("Introduce un numero: ")
numeroUsuarioString = readLine()
guard let numeroRecogido = numeroUsuarioString else {
print ("Valor introducido Nil")
exit (-1)
}
if numeroRecogido.isEmpty {
print ("No se ha introducido nada")
exit (-1)
}
guard let numeroEntero = Int(numeroRecogido) else {
print ("ERROR: No se ha introducio un numero")
exit (-1)
}
numeroUsuario = numeroEntero
for sucessionFibonnaci in 0...numeroUsuario {
numeroFibonacci = fibonacci(sucessionFibonnaci)
print(NumeroFibonacci)
}
| [
-1
] |
06cbbf3d37eb92d0ef5e59df6dc19716b6050caf | cf2a9e90b4a754f0bde2a4af7625e49174677d57 | /smart-kiddy/AppDelegate.swift | 6126a8576a01fd2f2034cffd9d4878f73b16af05 | [] | no_license | internick20/smart-kiddy | 6a556816402b742c91c0098210743e7d9dbdfc07 | 422864f7f506eb79cda3c415d64ddab16e5b6ed4 | refs/heads/master | 2020-09-24T10:47:36.423893 | 2019-08-21T23:02:04 | 2019-08-21T23:02:04 | 225,742,921 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,168 | swift | //
// AppDelegate.swift
// smart-kiddy
//
// Created by Admin on 21/08/19.
// Copyright © 2019 galosoft. 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,
229388,
294924,
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,
204856,
229432,
286778,
286791,
237640,
278605,
286797,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
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,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
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,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
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,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
295685,
328453,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
304013,
279438,
213902,
295822,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
234648,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
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,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
148843,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
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,
222676,
288214,
280021,
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,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
304651,
370187,
304653,
230923,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
313073,
419570,
288499,
321266,
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,
337732,
304968,
280393,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
239612,
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,
215154,
313458,
280691,
149618,
313464,
329850,
321659,
288895,
321670,
215175,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
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,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
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,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
240535,
289687,
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,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
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,
192008,
323084,
257550,
282127,
290321,
282130,
282133,
290325,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
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,
307009,
413506,
241475,
307012,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
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,
241581,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
233979,
291323,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
234010,
242202,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
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,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
324490,
291716,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
234437,
226245,
234439,
234434,
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,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
300299,
177419,
242957,
283917,
300301,
177424,
275725,
349464,
283939,
259367,
283951,
292143,
300344,
243003,
283963,
226628,
283973,
300357,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
275834,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
374196,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
308790,
284215,
316983,
194103,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
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,
276166,
284358,
358089,
284362,
276170,
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,
325408,
300832,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
153417,
292681,
358224,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
358292,
284564,
317332,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292784,
358326,
161718,
276410,
276411,
358330,
276418,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
317468,
243740,
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,
194654,
178273,
309346,
194657,
309348,
350308,
309350,
227426,
309352,
350313,
309354,
301163,
350316,
194660,
227430,
276583,
276590,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
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,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
310080,
293696,
277317,
277322,
293706,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
293882,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
285835,
384148,
162964,
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,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
285958,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
326991,
294223,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
310659,
351619,
294276,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
245191,
310727,
64966,
163272,
292968,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
146977,
187939,
294435,
40484,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
122517,
278168,
179870,
327333,
229030,
278188,
302764,
278192,
319153,
278196,
319163,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40851,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
0ed543c05cb81e7f1bab525abe4243c2b45b1843 | 12d5d9706e5fce004e4edf47446405d2239cee89 | /projectManager_ShopOwner/Model/matchedMemberModel.swift | b169fe06b5f1a675cca25894f22a5c96c620050d | [] | no_license | jba52739088/projectManager_ShopOwner | 24ee73e4825af7200bfe4050a1cc443c9add8688 | 063b8be6426669459174ab393a9e9128c7143c72 | refs/heads/master | 2020-03-22T08:33:33.213346 | 2018-09-22T03:09:52 | 2018-09-22T03:09:52 | 139,773,930 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,146 | swift | //
// matchedMemberModel.swift
// projectManager
//
// Created by 黃恩祐 on 2018/7/4.
// Copyright © 2018年 ENYUHUANG. All rights reserved.
//
import Foundation
class MatchedMember: NSObject {
var R_ID: String = ""
var MyName: String = ""
var M_ACCOUNT: String = ""
var M_SN: String = ""
var M_NAME: String = ""
var M_MAIL: String = ""
var M_TEL_D: String = ""
var Status: Int = 0
var isHost: Bool = false
var LastLogin: String = ""
init(R_ID: String,
MyName: String,
M_ACCOUNT: String,
M_SN: String,
M_NAME: String,
Status: Int,
isHost: Bool) {
self.R_ID = R_ID
self.MyName = MyName
self.M_ACCOUNT = M_ACCOUNT
self.M_SN = M_SN
self.M_NAME = M_NAME
self.Status = Status
self.isHost = isHost
}
}
// R_ID 關聯ID
// MyName 本人名稱
// isHost 是否為發出人
// M_SN 對方ID
// M_ACCOUNT 對方帳號
// M_NAME 對方名稱
// Status 狀態審核狀態
// LastLogin 最後登入時間
| [
-1
] |
0a3c6ae4049a3291ccffd3df01d7ecd293671b73 | 1a8c32420e2cdf0a0cfdd3464b3b1ef1f5f4de89 | /dicoding-list-movies/AppDelegate.swift | 36356cab8c3dbae058b88b994764917e75244d20 | [] | no_license | wahyupermadie/ios-movie-list | 6f89f0255b44136068123c9a005863bd872c4754 | 17e1107bcf286ca3c653e2f8710f0dba5718d29b | refs/heads/master | 2022-12-08T00:35:39.462456 | 2020-08-21T08:01:49 | 2020-08-21T08:01:49 | 289,213,062 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,432 | swift | //
// AppDelegate.swift
// dicoding-list-movies
//
// Created by Wahyu Permadi on 21/08/20.
// Copyright © 2020 Wahyu Permadi. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
361288,
328522,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
328941,
386285,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
214610,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
249214,
175486,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
224993,
257761,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
372499,
167700,
225043,
225048,
257819,
225053,
184094,
225058,
339747,
339749,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
421960,
356439,
430180,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
431106,
209943,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
341113,
349308,
210044,
160895,
152703,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
333511,
210631,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
333774,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
383536,
358961,
334384,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
260924,
326467,
244551,
326473,
326477,
326485,
416597,
342874,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
262005,
147317,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
0de773fbb1e050df864ad5a2e80ced1ac424bdc6 | 74fc0d3cce951d89fb9181093239153a6bb6e8c7 | /iOS/Multi-Thread GCD/GooglyPuff/PhotoManager.swift | a7d503507ba77c815d78a23c5ebc42510b3f854c | [] | no_license | kavya-ios-ttn/ttn_assignments | fa168aa5c9bb890a89739c4628809bd0671aac81 | a6649894b7444419115f9d06c3074f0379d2cdde | refs/heads/master | 2023-04-11T01:23:56.673390 | 2021-04-19T21:46:17 | 2021-04-19T21:46:17 | 337,688,057 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,693 | swift | /// Copyright (c) 2018 Razeware LLC
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,
/// distribute, sublicense, create a derivative work, and/or sell copies of the
/// Software in any work that is designed, intended, or marketed for pedagogical or
/// instructional purposes related to programming, coding, application development,
/// or information technology. Permission for such use, copying, modification,
/// merger, publication, distribution, sublicensing, creation of derivative works,
/// or sale is expressly withheld.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
import UIKit
struct PhotoManagerNotification {
// Notification when new photo instances are added
static let contentAdded = Notification.Name("com.raywenderlich.GooglyPuff.PhotoManagerContentAdded")
// Notification when content updates (i.e. Download finishes)
static let contentUpdated = Notification.Name("com.raywenderlich.GooglyPuff.PhotoManagerContentUpdated")
}
struct PhotoURLString {
// Photo Credit: Devin Begley, http://www.devinbegley.com/
static let overlyAttachedGirlfriend = "https://i.imgur.com/zMRy3Ed.jpeg"
static let successKid = "https://i.imgur.com/Z87EoDW.jpg"
static let lotsOfFaces = "https://i.imgur.com/rGdGk6d.jpeg"
}
typealias PhotoProcessingProgressClosure = (_ completionPercentage: CGFloat) -> Void
typealias BatchPhotoDownloadingCompletionClosure = (_ error: NSError?) -> Void
final class PhotoManager {
private init() {}
static let shared = PhotoManager()
// ** MODIFICATION 3 **
private let concurrentPhotoQueue = DispatchQueue(label: "com.raywenderlich.GooglyPuff.photoQueue",attributes: .concurrent)
// modification 3 ends
private var unsafePhotos: [Photo] = []
var photos: [Photo] {
// ** MODIFICATION 5 **
//return unsafePhotos
var photosCopy: [Photo]!
// 1 . we are reading photos synchronously
concurrentPhotoQueue.sync {
// 2 . storing the photos in photoarray and returniing it
photosCopy = self.unsafePhotos
}
return photosCopy
// MODIFICATION 5 ENDS
}
func addPhoto(_ photo: Photo) {
// ** MODIFICATION 4 **
// unsafePhotos.append(photo)
// DispatchQueue.main.async { [weak self] in
// self?.postContentAddedNotification()
// }
// 1 . we use barrie in async ( to haev only one item in our queue we used it ).
concurrentPhotoQueue.async(flags: .barrier) { [weak self] in
guard let self = self else {
return
}
// 2 . we added photo ( object ) to the array
self.unsafePhotos.append(photo)
// 3 . we post the UI notification and we have to do it asynchrounously in the main queue
DispatchQueue.main.async { [weak self] in
self?.postContentAddedNotification()
}
}
// MODIFICATION 4 ENDS
}
func downloadPhotos(withCompletion completion: BatchPhotoDownloadingCompletionClosure?) {
var storedError: NSError?
for address in [PhotoURLString.overlyAttachedGirlfriend,
PhotoURLString.successKid,
PhotoURLString.lotsOfFaces] {
let url = URL(string: address)
let photo = DownloadPhoto(url: url!) { _, error in
if error != nil {
storedError = error
}
}
PhotoManager.shared.addPhoto(photo)
}
completion?(storedError)
}
private func postContentAddedNotification() {
NotificationCenter.default.post(name: PhotoManagerNotification.contentAdded, object: nil)
}
}
| [
-1
] |
d5823173ecc1204b1938db6812d887c6f158d72a | 578451f50395c856c1c18add2e6b024adf48ddee | /Example/Classes/EViewController.swift | ad76305b85f2761cf00026e621ec37520ac29014 | [
"MIT"
] | permissive | Boxzhi/HZNavigationBar | 25ce17be00ae69df11f48468f1194e3279a5bf7c | f309bd82ebdf54ce2e2d52fc153f4d62647c9498 | refs/heads/master | 2023-02-22T18:50:51.084468 | 2023-02-21T03:21:46 | 2023-02-21T03:21:46 | 174,451,787 | 69 | 6 | null | null | null | null | UTF-8 | Swift | false | false | 1,408 | swift | //
// EViewController.swift
// test
//
// Created by 何志志 on 2018/12/13.
// Copyright © 2018 何志志. All rights reserved.
//
import UIKit
import HZNavigationBar
class EViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
nav?.title = "EViewController"
nav?.hz.barItemClickHandler(.left, barItemClickHandler: { item in
print("拦截返回按钮")
})
let rightFirst = HZNavigationBarItem("delegateIcon") { item in
if self.nav?.hz.getBarItems(.right)?.count != 2 {
self.nav?.hz.removeBarItems(.right, indexs: [1])
}
print("删除按钮")
}
let rightSecond = HZNavigationBarItem("updateIcon") { item in
self.nav?.hz.insertBarItem(.right, atIndex: 1, item: HZNavigationBarItem("插入", normalColor: .red, clickHandler: { item in
}))
print("更新按钮")
}
let rightButtons = [rightFirst, rightSecond]
nav?.hz.setBarItems(.right, items: rightButtons)
nav?.hz.barItemShowColorBadge(.right, atIndex: 1)
UIButton.setJumpButton(self, action: #selector(jumpToNext(_:)))
}
@objc func jumpToNext(_ sender: UIButton) {
self.navigationController?.pushViewController(FViewController(), animated: true)
}
}
| [
-1
] |
26b216dbfb1b34dd57fe6543a8bff0af18d6aa9e | b998ffaa7130f2742f3c86ef6f2e37b665c310e1 | /Sources/StarWarsAPI/StarWarsAPI/Sources/Operations/Queries/HeroTypeDependentAliasedFieldQuery.graphql.swift | 4a6d4dbbb8f3bdd5ce70a270a6141647319a1022 | [
"MIT"
] | permissive | apollographql/apollo-ios | 6678f0cb8b5b690651a4fd5ace414b179e71032a | e10dc84167b7edd4511d94ae7bbfafb65dca074b | refs/heads/main | 2023-09-01T06:47:26.880635 | 2023-08-21T17:15:25 | 2023-08-21T17:15:25 | 64,176,717 | 3,705 | 830 | MIT | 2023-09-13T14:43:28 | 2016-07-26T00:24:04 | Swift | UTF-8 | Swift | false | false | 4,890 | swift | // @generated
// This file was automatically generated and should not be edited.
@_exported import ApolloAPI
public class HeroTypeDependentAliasedFieldQuery: GraphQLQuery {
public static let operationName: String = "HeroTypeDependentAliasedField"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
operationIdentifier: "5b1ed6a84e96a4e48a3cad675ebb46020bce176f47361d097d8a0a824b7b8452",
definition: .init(
#"query HeroTypeDependentAliasedField($episode: Episode) { hero(episode: $episode) { __typename ... on Human { __typename property: homePlanet } ... on Droid { __typename property: primaryFunction } } }"#
))
public var episode: GraphQLNullable<GraphQLEnum<Episode>>
public init(episode: GraphQLNullable<GraphQLEnum<Episode>>) {
self.episode = episode
}
public var __variables: Variables? { ["episode": episode] }
public struct Data: StarWarsAPI.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("hero", Hero?.self, arguments: ["episode": .variable("episode")]),
] }
public var hero: Hero? { __data["hero"] }
public init(
hero: Hero? = nil
) {
self.init(_dataDict: DataDict(
data: [
"__typename": StarWarsAPI.Objects.Query.typename,
"hero": hero._fieldData,
],
fulfilledFragments: [
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.self)
]
))
}
/// Hero
///
/// Parent Type: `Character`
public struct Hero: StarWarsAPI.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Interfaces.Character }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.inlineFragment(AsHuman.self),
.inlineFragment(AsDroid.self),
] }
public var asHuman: AsHuman? { _asInlineFragment() }
public var asDroid: AsDroid? { _asInlineFragment() }
public init(
__typename: String
) {
self.init(_dataDict: DataDict(
data: [
"__typename": __typename,
],
fulfilledFragments: [
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self)
]
))
}
/// Hero.AsHuman
///
/// Parent Type: `Human`
public struct AsHuman: StarWarsAPI.InlineFragment {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public typealias RootEntityType = HeroTypeDependentAliasedFieldQuery.Data.Hero
public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Human }
public static var __selections: [ApolloAPI.Selection] { [
.field("homePlanet", alias: "property", String?.self),
] }
/// The home planet of the human, or null if unknown
public var property: String? { __data["property"] }
public init(
property: String? = nil
) {
self.init(_dataDict: DataDict(
data: [
"__typename": StarWarsAPI.Objects.Human.typename,
"property": property,
],
fulfilledFragments: [
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self),
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.AsHuman.self)
]
))
}
}
/// Hero.AsDroid
///
/// Parent Type: `Droid`
public struct AsDroid: StarWarsAPI.InlineFragment {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }
public typealias RootEntityType = HeroTypeDependentAliasedFieldQuery.Data.Hero
public static var __parentType: ApolloAPI.ParentType { StarWarsAPI.Objects.Droid }
public static var __selections: [ApolloAPI.Selection] { [
.field("primaryFunction", alias: "property", String?.self),
] }
/// This droid's primary function
public var property: String? { __data["property"] }
public init(
property: String? = nil
) {
self.init(_dataDict: DataDict(
data: [
"__typename": StarWarsAPI.Objects.Droid.typename,
"property": property,
],
fulfilledFragments: [
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.self),
ObjectIdentifier(HeroTypeDependentAliasedFieldQuery.Data.Hero.AsDroid.self)
]
))
}
}
}
}
}
| [
-1
] |
175af4d2c143a9f462f89e2102a5e8a8196964d3 | 9bd3e9e56993512ad336708defcdea8bcc9096d9 | /ShelloooUITests/ShelloooUITests.swift | d01d04d5681b3212fc0c01d1c83727044c80992a | [] | no_license | Shellooo/Shellooo | 39a73086790428712f7297f3adc3c8910b85197e | 327872f4fdf3596902bdf4e5f83a7728f279ba74 | refs/heads/master | 2021-09-08T08:41:06.321569 | 2018-03-08T19:26:01 | 2018-03-08T19:26:01 | 113,082,868 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,256 | swift | //
// ShelloooUITests.swift
// ShelloooUITests
//
// Created by Elizabeth Brown on 11/21/17.
// Copyright © 2017 Elizabeth Brown. All rights reserved.
//
import XCTest
class ShelloooUITests: 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.
}
}
| [
333827,
243720,
282634,
313356,
237599,
241695,
292901,
223269,
354342,
229414,
102441,
315433,
354346,
278571,
325675,
102446,
282671,
315431,
229425,
241717,
180279,
229431,
215095,
288829,
325695,
286787,
288835,
237638,
313415,
233548,
311373,
315468,
278607,
333902,
311377,
196687,
354386,
329812,
315477,
200795,
315488,
315489,
45154,
321632,
280676,
313446,
215144,
233578,
194667,
307306,
278637,
288878,
278642,
284789,
284790,
131190,
288890,
215165,
131199,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
329884,
299166,
278690,
311459,
215204,
284840,
184489,
278698,
284843,
299176,
278703,
184498,
278707,
278713,
258233,
295099,
280761,
299197,
180409,
280767,
223418,
227517,
299202,
139459,
309443,
176325,
131270,
301255,
299208,
227525,
280779,
282832,
321744,
227536,
301270,
229591,
301271,
280792,
311520,
325857,
334049,
280803,
307431,
295147,
317676,
313595,
184574,
217352,
194832,
227601,
325904,
319764,
278805,
282908,
311582,
282912,
233761,
278817,
211239,
282920,
317738,
311596,
321839,
315698,
98611,
332084,
307514,
278843,
282938,
319812,
280903,
227655,
323914,
201037,
229716,
289109,
168280,
323934,
391521,
239973,
381286,
285031,
416103,
280938,
242027,
242028,
321901,
354671,
278895,
287089,
199030,
227702,
315768,
315769,
291194,
223611,
248188,
139641,
311679,
211327,
291200,
240003,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
190872,
291225,
293275,
285083,
317851,
242079,
227743,
289185,
293281,
283039,
285089,
301482,
289195,
311723,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
326083,
278988,
289229,
281038,
281039,
278992,
283088,
283089,
279000,
176602,
242138,
285152,
279009,
369121,
195044,
279014,
319976,
279017,
311787,
281071,
319986,
236020,
279030,
293368,
311800,
279033,
317949,
283138,
279042,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303634,
303635,
279061,
182802,
188954,
279066,
322077,
291359,
293420,
289328,
236080,
283185,
279092,
234037,
23093,
244279,
338491,
234044,
301635,
309831,
55880,
377419,
281165,
303693,
301647,
281170,
326229,
309847,
189016,
115287,
332379,
111197,
295518,
287327,
306634,
279143,
279150,
281200,
313970,
287348,
301688,
244345,
189054,
287359,
297600,
303743,
301702,
164487,
311944,
334473,
316044,
311948,
311950,
316048,
311953,
316050,
287379,
326288,
227991,
295575,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
295598,
248494,
285360,
279215,
299698,
293552,
287412,
166581,
318127,
154295,
164532,
342705,
303802,
314043,
66243,
291529,
225996,
287438,
242385,
279253,
158424,
230105,
299737,
295653,
342757,
289511,
230120,
330473,
285419,
330476,
289517,
312046,
170735,
279278,
125683,
230133,
199415,
279293,
289534,
205566,
322302,
299777,
291584,
228099,
285443,
291591,
295688,
322312,
264971,
312076,
326413,
322320,
285457,
295698,
166677,
283418,
285467,
326428,
281378,
234276,
283431,
262952,
262953,
279337,
293673,
289580,
262957,
318247,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
301883,
201534,
281407,
289599,
295745,
342846,
222017,
293702,
283466,
281426,
279379,
295769,
201562,
244569,
281434,
322396,
230238,
230239,
301919,
279393,
293729,
275294,
349025,
281444,
279398,
303973,
351078,
177002,
308075,
242540,
295797,
201590,
295799,
207735,
228214,
279418,
177018,
269179,
308093,
314240,
291713,
158594,
287623,
228232,
299912,
279434,
320394,
416649,
316299,
252812,
308111,
189327,
308113,
293780,
310166,
289691,
209820,
283551,
310177,
289699,
189349,
293801,
279465,
326571,
304050,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
19398,
213961,
279499,
56270,
191445,
183254,
304086,
234469,
314343,
304104,
324587,
183276,
289773,
203758,
320492,
234476,
287730,
240631,
312313,
312315,
312317,
328701,
328705,
293894,
320520,
230411,
320526,
330766,
238611,
293911,
140311,
316441,
197658,
238617,
113710,
281647,
189487,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
314437,
349254,
238663,
300109,
234578,
296023,
205911,
314458,
156763,
281698,
281699,
285795,
214116,
322664,
228457,
279659,
318571,
300145,
238706,
279666,
312435,
187508,
230514,
302202,
285819,
314493,
150656,
279686,
222344,
285833,
285834,
318602,
228492,
337037,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
300192,
339106,
306339,
234662,
300200,
249003,
238764,
208044,
322733,
3243,
300215,
294075,
228541,
283841,
148674,
283846,
312519,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
234741,
316661,
283894,
208123,
292092,
228608,
320769,
234756,
242955,
177420,
312588,
318732,
245018,
320795,
320802,
239610,
130342,
304422,
292145,
298290,
312628,
159033,
333114,
222523,
333115,
286012,
279872,
181568,
294210,
279874,
300355,
193858,
216387,
300354,
372039,
304457,
230730,
294220,
296269,
234830,
222542,
238928,
224591,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
294236,
314721,
292194,
281958,
314727,
306541,
327023,
234864,
296304,
312688,
316786,
230772,
314740,
327030,
310650,
224637,
306558,
290176,
243073,
179586,
294278,
314759,
296328,
296330,
298378,
368012,
314765,
292242,
112019,
306580,
234902,
224662,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
314790,
245160,
333224,
241067,
279979,
314797,
286128,
279988,
173492,
286133,
310714,
228796,
54719,
302530,
292291,
228804,
415170,
306630,
300488,
370122,
310731,
302539,
234957,
339403,
310735,
329168,
300490,
222674,
327122,
280020,
329170,
312785,
280025,
239069,
144862,
286176,
187877,
320997,
310758,
280042,
280043,
191980,
300526,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
288248,
191991,
286201,
300539,
288252,
312830,
290304,
245249,
228868,
323079,
218632,
302602,
230922,
323083,
294413,
304655,
329231,
323088,
282132,
230933,
282135,
316951,
374297,
302620,
222754,
245291,
312879,
230960,
288305,
290359,
239159,
323132,
235069,
288319,
280131,
349764,
310853,
282182,
194118,
292424,
288328,
286281,
292426,
333389,
224848,
224852,
290391,
128600,
196184,
235096,
306777,
212574,
204386,
300643,
300645,
282214,
204394,
312941,
206447,
310896,
294517,
314997,
288377,
290425,
325246,
333438,
235136,
282244,
239238,
282248,
286344,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
282279,
298664,
212649,
298666,
317102,
286387,
337590,
286392,
300729,
302778,
306875,
296636,
280253,
282302,
280252,
286400,
323262,
321217,
280259,
321220,
282309,
333508,
296649,
239305,
280266,
306891,
212684,
302798,
9935,
241360,
282321,
313042,
286419,
241366,
282330,
18139,
294621,
280285,
282336,
321250,
294629,
153318,
333543,
181992,
337638,
12009,
282347,
288492,
282349,
323315,
67316,
286457,
284410,
288508,
286463,
319232,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
300812,
284430,
161553,
284436,
278292,
116502,
118549,
278294,
282390,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
186149,
186148,
241447,
333609,
294699,
286507,
284460,
280367,
300849,
282418,
280373,
280377,
321338,
282428,
280381,
345918,
280386,
280391,
153416,
315209,
325449,
159563,
280396,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
296807,
282471,
292713,
282476,
292719,
313200,
325491,
313204,
333687,
317305,
317308,
339840,
315265,
280451,
188293,
243590,
282503,
67464,
305032,
315272,
315275,
325514,
184207,
311183,
294806,
214936,
294808,
337816,
239515,
214943,
298912,
319393,
333727,
294820,
284584,
294824,
298921,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
292835,
6116,
190437,
292838,
294887,
313322,
298987,
278507,
311277,
329707,
296942,
327666,
325620,
313338
] |
2f1c65112e15b3caada3774f14a8b942eb7a07b5 | 1d860cb67bce63ede21fe02bf0d194eb29953419 | /AppleMusicSample/ServiceManager.swift | 43f83be2a428ce8e4afed97cd56b0bbbc279a12c | [] | no_license | KarthikGowda022/AppleMuscisSample | d3c1d91acf869a7030261c94f6558903a62b19ea | 84656df18c1fb5a2b753f522a516b3d96d8c6a30 | refs/heads/master | 2021-02-09T15:49:00.590427 | 2021-01-24T07:00:12 | 2021-01-24T07:00:12 | 244,299,281 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,932 | swift | //
// ServiceManager.swift
// AppleMusicSample
//
// Created by Karthik Shyadanhalli Madeve Gowda on 2/28/20.
// Copyright © 2020 Karthik Shyadanhalli Madeve Gowda. All rights reserved.
//
import Foundation
import UIKit
class ServiceManager {
static let shared = ServiceManager()
func fetchTopTenAlbums(completion: @escaping (FeedResult) -> Void){
let urlStr = "https://rss.itunes.apple.com/api/v1/us/apple-music/top-albums/all/100/explicit.json"
guard let url = URL(string: urlStr) else { return }
load(url: url) { (responseData) in
if let response = responseData{
do{
let result = try JSONDecoder().decode(FeedResult.self, from: response)
//print(result)
completion(result)
}catch{
print("Error in parsing response -\(error)")
}
}
}
}
func load(url: URL, withCompletion completion: @escaping (Data?) -> Void) {
let session = URLSession.shared
let task = session.dataTask(with: url, completionHandler: { (data: Data?, response: URLResponse?, error: Error?) -> Void in
if error == nil {
completion(data)
}
else{
print("Error fetching data from service: \(String(describing: error?.localizedDescription))")
}
})
task.resume()
}
func loadImage(with url: URL?, completion: @escaping (UIImage?) -> Void) {
guard let imageUrl = url else {
return
}
load(url: imageUrl) { data in
if let data = data {
completion(UIImage(data: data))
} else {
completion(UIImage(named: "Default"))
}
}
}
}
| [
-1
] |
eb13c50d9a76b8126614867060018b9755fca1d9 | dcb64593cdc907780ef1f3c5ecbded6bcccadae5 | /Twitter/TwitterAPICaller.swift | 9830746a7115b1becb9a6a94030bde8137ea1306 | [] | no_license | Axgel/TwitterApp | 9743bf2b164d053122c61ac1df80bf099701d37a | 4b2ae80333de264ef67da06254c0f1cbc03a6cc1 | refs/heads/master | 2022-12-29T06:16:33.622151 | 2020-10-17T06:26:39 | 2020-10-17T06:26:39 | 302,482,749 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,844 | swift | //
// APIManager.swift
// Twitter
//
// Created by Dan on 1/3/19.
// Copyright © 2019 Dan. All rights reserved.
//
import UIKit
import BDBOAuth1Manager
class TwitterAPICaller: BDBOAuth1SessionManager {
static let client = TwitterAPICaller(baseURL: URL(string: "https://api.twitter.com"), consumerKey: "uFTmFW66AAMEUwx3rZlZDMSCf", consumerSecret: "LtlxIoQpBvHcqjpSMIA9Gs2E9wCJbr7xkx9EpSdBYoNedaZUgh")
var loginSuccess: (() -> ())?
var loginFailure: ((Error) -> ())?
func handleOpenUrl(url: URL){
let requestToken = BDBOAuth1Credential(queryString: url.query)
TwitterAPICaller.client?.fetchAccessToken(withPath: "oauth/access_token", method: "POST", requestToken: requestToken, success: { (accessToken: BDBOAuth1Credential!) in
self.loginSuccess?()
}, failure: { (error: Error!) in
self.loginFailure?(error)
})
}
func login(url: String, success: @escaping () -> (), failure: @escaping (Error) -> ()){
loginSuccess = success
loginFailure = failure
TwitterAPICaller.client?.deauthorize()
TwitterAPICaller.client?.fetchRequestToken(withPath: url, method: "GET", callbackURL: URL(string: "alamoTwitter://oauth"), scope: nil, success: { (requestToken: BDBOAuth1Credential!) -> Void in
let url = URL(string: "https://api.twitter.com/oauth/authorize?oauth_token=\(requestToken.token!)")!
UIApplication.shared.open(url)
}, failure: { (error: Error!) -> Void in
print("Error: \(error.localizedDescription)")
self.loginFailure?(error)
})
}
func logout (){
deauthorize()
}
func getDictionaryRequest(url: String, parameters: [String:Any], success: @escaping (NSDictionary) -> (), failure: @escaping (Error) -> ()){
TwitterAPICaller.client?.get(url, parameters: parameters, progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success(response as! NSDictionary)
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func getDictionariesRequest(url: String, parameters: [String:Any], success: @escaping ([NSDictionary]) -> (), failure: @escaping (Error) -> ()){
print(parameters)
TwitterAPICaller.client?.get(url, parameters: parameters, progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success(response as! [NSDictionary])
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func postRequest(url: String, parameters: [Any], success: @escaping () -> (), failure: @escaping (Error) -> ()){
TwitterAPICaller.client?.post(url, parameters: parameters, progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success()
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func postTweet(tweetString: String, success: @escaping () -> (), failure: @escaping(Error) -> ()){
let url = "https://api.twitter.com/1.1/statuses/update.json"
TwitterAPICaller.client?.post(url, parameters: ["status":tweetString ], progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success()
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func favoriteTweet(tweetId: Int, success: @escaping () -> (), failure: @escaping(Error) -> ()){
let url = "https://api.twitter.com/1.1/favorites/create.json"
TwitterAPICaller.client?.post(url, parameters: ["id":tweetId], progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success()
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func unfavoriteTweet(tweetId: Int, success: @escaping () -> (), failure: @escaping(Error) -> ()){
let url = "https://api.twitter.com/1.1/favorites/destroy.json"
TwitterAPICaller.client?.post(url, parameters: ["id":tweetId], progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success()
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
func retweet(tweetId:Int, success:@escaping () -> (), failure: @escaping (Error) -> ()){
let url = "https://api.twitter.com/1.1/statuses/retweet/\(tweetId).json"
TwitterAPICaller.client?.post(url, parameters: ["id":tweetId], progress: nil, success: { (task: URLSessionDataTask, response: Any?) in
success()
}, failure: { (task: URLSessionDataTask?, error: Error) in
failure(error)
})
}
}
| [
360321,
399196
] |
ea0083641d53f9b06e26b80602ff54a65d1adbc7 | 9a61dade558e7d21c287fa6ca0b1311da8398b63 | /SoundFontsFramework/SoundFontsFrameworkTests/Foundation+ExtensionsTests.swift | 98de6bbd94d7ed654ef5031769fa65425b63b998 | [
"MIT"
] | permissive | colin3dmax/SoundFonts | 0048aaa41583d6ae5612012ba17c12300294b65d | 6e07f10bc8ecabf03ea617be7927a01bd86152a2 | refs/heads/main | 2023-08-29T12:47:27.199355 | 2021-10-06T21:01:47 | 2021-10-06T21:01:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,769 | swift | // Copyright © 2020 Brad Howes. All rights reserved.
import SoundFontsFramework
import XCTest
class Foundation_ExtensionsTests: XCTestCase {
let userDefaults = UserDefaults(suiteName: "com.braysoftware.ignoreMe")!
func testSettingSerializable() {
String.set(key: "stringKey", value: "stringValue", userDefaults: userDefaults)
XCTAssertEqual("stringValue", String.get(key: "stringKey", userDefaults: userDefaults))
}
func testIntSerializable() {
Int.set(key: "intKey", value: 123, userDefaults: userDefaults)
XCTAssertEqual(123, Int.get(key: "intKey", userDefaults: userDefaults))
}
func testFloatSerializable() {
Float.set(key: "floatKey", value: 123.456, userDefaults: userDefaults)
XCTAssertEqual(123.456, Float.get(key: "floatKey", userDefaults: userDefaults))
}
func testDoubleSerializable() {
Double.set(key: "doubleKey", value: 123.456, userDefaults: userDefaults)
XCTAssertEqual(123.456, Double.get(key: "doubleKey", userDefaults: userDefaults))
}
func testBoolSerializable() {
Bool.set(key: "boolKey", value: true, userDefaults: userDefaults)
XCTAssertEqual(true, Bool.get(key: "boolKey", userDefaults: userDefaults))
}
func testDateSerializable() {
Date.set(
key: "dateKey", value: Date(timeIntervalSince1970: 123123),
userDefaults: userDefaults)
XCTAssertEqual(
Date(timeIntervalSince1970: 123123), Date.get(key: "dateKey", userDefaults: userDefaults))
}
func testDoubleTimes() {
XCTAssertEqual(1.day, 86400.seconds)
XCTAssertEqual(5.minutes, 300.seconds)
XCTAssertEqual(10.seconds, 10000.milliseconds)
XCTAssertEqual(11.seconds, 11000.ms)
}
// func testPerformanceExample() {
// self.measure {
// }
// }
}
| [
-1
] |
582857494cfe50c60f72dba672e0a398ac6b4b05 | acae4d933e0c3346da6be3ed35bb439667d5175b | /iExtraTests/UI/Extensions/UISlider/UISlider_Extensions_ValueAtPointTests.swift | e9c1797071c099315935334ca3df7d1569894fef | [
"MIT"
] | permissive | mohsinalimat/iExtra | 100296fe6635a0190d81a5988ee1ed43f3c8d269 | 59831a0e34ee1088f4a15f9803786dcda395efca | refs/heads/master | 2021-04-30T13:44:48.168956 | 2018-01-30T10:12:33 | 2018-01-30T10:12:33 | 121,202,119 | 1 | 0 | null | 2018-02-12T05:01:39 | 2018-02-12T05:01:38 | null | UTF-8 | Swift | false | false | 2,277 | swift | //
// UISlider_Extensions_ValueAtPointTests.swift
// iExtra
//
// Created by Daniel Saidi Daniel on 2016-12-12.
// Copyright © 2016 Daniel Saidi. All rights reserved.
//
import Quick
import Nimble
import iExtra
class UISlider_Extensions_ValueAtPointTests: QuickSpec {
override func spec() {
describe("slider value at point") {
var slider: UISlider!
beforeEach {
slider = UISlider()
slider.bounds = CGRect(x: 100, y: 200, width: 500, height: 20)
}
context("with normal slider values") {
beforeEach {
slider.minimumValue = 0
slider.maximumValue = 100
}
it("handles no progress") {
let point = CGPoint(x: 0, y: 20)
expect(slider.value(at: point)).to(equal(0))
}
it("handles progress") {
let point = CGPoint(x: 250, y: 20)
expect(slider.value(at: point)).to(equal(50))
}
it("handles full progress") {
let point = CGPoint(x: 500, y: 20)
expect(slider.value(at: point)).to(equal(100))
}
}
context("with offset slider values") {
beforeEach {
slider.minimumValue = 100
slider.maximumValue = 200
}
it("handles no progress") {
let point = CGPoint(x: 0, y: 20)
expect(slider.value(at: point)).to(equal(100))
}
it("handles progress") {
let point = CGPoint(x: 250, y: 20)
expect(slider.value(at: point)).to(equal(150))
}
it("handles full progress") {
let point = CGPoint(x: 500, y: 20)
expect(slider.value(at: point)).to(equal(200))
}
}
}
}
}
| [
-1
] |
90d13cf99cdc0b0b579d85728a1f9497a030d91b | aed2ff574c6a0871e48c25b49e7b62e549d44fe3 | /UICollection/StretchyHeader/StretchyHeader.swift | 4fb30e85ae79165642a2be7ed35a6d49eb1e47f8 | [] | no_license | piyatat/UICollection | 542c9a558c82db591e3c754a3a442ce04b52747c | 5143442975a9acc730a8f4a896e0b695b7d6bdb5 | refs/heads/main | 2023-02-11T16:37:02.370814 | 2021-01-10T06:04:23 | 2021-01-10T06:04:23 | 314,973,329 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,659 | swift | //
// StretchyHeader.swift
// UICollection
//
// Created by Tei on 22/11/20.
//
import SwiftUI
struct StretchyHeader: View {
@State private var showHeader = false
var body: some View {
GeometryReader { geometry in
ZStack(alignment: .top) {
ScrollView(showsIndicators: false) {
VStack(alignment: .leading, spacing: 8) {
// Stretchy Header
// Ref: https://blckbirds.com/post/stretchy-header-and-parallax-scrolling-in-swiftui/
GeometryReader { gHeader in
ZStack(alignment: Alignment(horizontal: .leading, vertical: .top)) {
// Image
Image("Test")
.resizable()
.scaledToFill()
.frame(width: geometry.size.width, height: (gHeader.frame(in: .global).minY > 0 ? gHeader.size.height + gHeader.frame(in: .global).minY : gHeader.size.height))
.offset(y: (gHeader.frame(in: .global).minY > 0 ? -gHeader.frame(in: .global).minY : 0))
}
.preference(key: ViewOffsetKey.self, value: CGPoint(x: gHeader.frame(in: .global).minX, y: gHeader.frame(in: .global).minY))
}
.frame(width: geometry.size.width, height: geometry.size.width)
.onPreferenceChange(ViewOffsetKey.self) { offset in
if offset.y < -geometry.size.width {
withAnimation() {
self.showHeader = true
}
} else {
withAnimation() {
self.showHeader = false
}
}
}
VStack(alignment: .center) {
Text("Hello World!!!")
Spacer()
}
.frame(minHeight: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom)
}
}
.frame(width: geometry.size.width, alignment: .top)
if self.showHeader {
// Header
HStack(alignment: .center) {
Spacer()
Text("Title")
.foregroundColor(.white)
.padding(.top, geometry.safeAreaInsets.top)
Spacer()
}
.background(Color.black)
.edgesIgnoringSafeArea(.top)
.frame(width: geometry.size.width, height: 40 + geometry.safeAreaInsets.top)
}
}
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing, height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom, alignment: .top)
.edgesIgnoringSafeArea(.all)
}
}
}
struct StretchyHeader_Previews: PreviewProvider {
static var previews: some View {
StretchyHeader()
}
}
struct ViewOffsetKey: PreferenceKey {
static var defaultValue = CGPoint.zero
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) {
value = nextValue()
}
}
| [
-1
] |
95c9a4f56354dd0b52649a0671e98e73011f3025 | 2dad1eec0732a2b8991ef766994eee2ae2d67f17 | /mobileapps/dolarya/iOS/dolarya/Common.swift | 77b6b9ad8729ab5b8aa20b5780c56cd539aa73af | [] | no_license | rodriavila89/mirepogit | fb9180ec02d570f526c5d980da7476f01fd92473 | 203ff037f27d171a374d994b7e55975bc866105d | refs/heads/master | 2021-01-09T20:04:18.567707 | 2018-07-12T13:05:08 | 2018-07-12T13:05:08 | 81,220,438 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 736 | swift | //
// Common.swift
// dolarya
//
// Created by Ramiro Rinaldi on 11/11/15.
// Copyright © 2015 El Cronista. All rights reserved.
//
import UIKit
class Common: NSObject {
static func GetToolBar(callBack: Selector, target: UIViewController) -> UIToolbar
{
let toolbar = UIToolbar(frame: CGRectMake(0, 0, 320, 50))
toolbar.barStyle = UIBarStyle.BlackTranslucent
let doneButton = UIBarButtonItem(title: "Listo", style: UIBarButtonItemStyle.Done, target: target, action: callBack)
doneButton.tintColor = UIColor.whiteColor()
toolbar.items = [UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil), doneButton]
return toolbar
}
}
| [
-1
] |
8a78fe2e0733d6dc3cd4fe152725f3438146d023 | 4151aea8ad1251a35de96474199123fedb890451 | /CameraMakeUp/CameraMakeUp/Constant/Constant.swift | f0c896fb7a4091c75e85bc5172cb06f5ea3ae3ab | [] | no_license | haiphan5289/cameramakeup | 2805283a118278c64dbe61dc03fad2fc025d36d6 | 418e73521e4b5bc7640e092a1a42f1d088c56818 | refs/heads/master | 2023-08-16T03:14:05.709932 | 2021-09-29T08:16:48 | 2021-09-29T08:16:48 | 408,844,025 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 393 | swift | //
// Constant.swift
// CameraMakeUp
//
// Created by haiphan on 22/09/2021.
//
import Foundation
import UIKit
final class Constant {
static var shared = Constant()
let bigRadiusTabbar: CGFloat = 30
private init() {}
func getHeightSafeArea(type: GetHeightSafeArea.SafeAreaType) -> CGFloat {
return GetHeightSafeArea.shared.getHeight(type: type)
}
}
| [
-1
] |
b60aca681748150830e60d4d9a7c1bfad669aeb3 | 5fc5803090a689784975cc372415f3108771848a | /Calculation/SceneDelegate.swift | 52030bd796814575983b4be96727734244ef71ac | [] | no_license | 7se7olod/CalculationBlue | 7c55e40f397bca347d87f639041d5304ace45572 | e129e41987a795995333e3fe4adbdb8177b88cf7 | refs/heads/main | 2023-04-01T23:41:50.508546 | 2021-03-31T16:57:13 | 2021-03-31T16:57:13 | 353,429,378 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,300 | swift | //
// SceneDelegate.swift
// Calculation
//
// Created by Всеволод on 31.03.2021.
//
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 necessarily 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,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
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,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
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,
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,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
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,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
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,
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,
257869,
257872,
225105,
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,
356521,
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,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
250239,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
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,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
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,
357411,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
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,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
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,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
211161,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
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,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
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,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
326858,
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,
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,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
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,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
8294b03b728f2ae216a5c539f2ea2e7dbe9510da | 3bd59ee58f985a2db0075fa82c189b4c78ed6f57 | /Gitea/Networking/Model/GiteaSpecificModel/CommitMeta.swift | 7658ee4ec0262f8f50eca1dec3d4d528b8dc46a9 | [
"MIT"
] | permissive | jneuhauser/gitea-client-ios | 1718e10482f0790ad4b9a5c96cd058e9d7dd6097 | bfc46547348a93122c9af1027206c49c61a91953 | refs/heads/master | 2020-06-09T03:32:37.901140 | 2019-07-08T05:15:23 | 2019-07-08T05:15:23 | 193,362,085 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 346 | swift | //
// Created by Johann Neuhauser on 16.05.19.
// Copyright © 2019 Johann Neuhauser. All rights reserved.
//
import Foundation
public struct CommitMeta: Codable, Equatable, Hashable {
public var sha: String?
public var url: String?
public init(sha: String?, url: String?) {
self.sha = sha
self.url = url
}
}
| [
-1
] |
f731ee0b4eb063c0d94814be5c5ee39394b0e624 | 157ca394d03c0558c5a71f64adface2c2d816c3a | /Project 1 Founders DirectoryTests/Project_1_Founders_DirectoryTests.swift | 695783a88f0778f036069659b954e93aa411a35c | [] | no_license | gillkyle/founders-directory | c7157258b20b5aee5fcf8f047654547bbf70a731 | 0e60822932e4339ded4af5215fec19099222a243 | refs/heads/master | 2020-03-29T10:08:52.108115 | 2018-10-04T22:23:43 | 2018-10-04T22:23:43 | 149,791,269 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 982 | swift | //
// Project_1_Founders_DirectoryTests.swift
// Project 1 Founders DirectoryTests
//
// Created by Kyle Gill on 9/21/18.
// Copyright © 2018 Kyle Gill. All rights reserved.
//
import XCTest
@testable import Project_1_Founders_Directory
class Project_1_Founders_DirectoryTests: 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.
}
}
}
| [
358410,
354316,
317467,
241692,
145435,
239650,
16419,
329765,
292902,
354343,
315432,
315434,
325674,
223274,
102445,
176175,
243759,
321583,
282672,
241716,
319542,
124984,
241720,
352315,
288828,
325694,
288833,
288834,
315465,
311372,
311374,
354385,
196691,
329814,
354393,
200794,
356447,
254048,
309345,
280675,
329829,
280677,
319591,
43110,
321637,
131178,
319598,
288879,
333940,
204916,
223350,
131191,
233590,
288889,
280694,
131198,
385153,
333955,
319629,
235662,
311438,
325776,
323729,
317587,
362659,
333996,
173,
239793,
405687,
180408,
227513,
295098,
379071,
258239,
280768,
301251,
417988,
227524,
309444,
417994,
346314,
321745,
280795,
194782,
356576,
327904,
346346,
321772,
385262,
125169,
344313,
356602,
327929,
149760,
194820,
321800,
180493,
278797,
125199,
254226,
338197,
334103,
325912,
315673,
237856,
125217,
227616,
278816,
305440,
211235,
151847,
282919,
338218,
325931,
321840,
332083,
332085,
332089,
282939,
287041,
139589,
182597,
280902,
323916,
319821,
348492,
282960,
325968,
366929,
155990,
289110,
215385,
272729,
168281,
332123,
334171,
106847,
323935,
332127,
354655,
321894,
242023,
242029,
160110,
242033,
313713,
139640,
246137,
106874,
291192,
315773,
211326,
313727,
291198,
362881,
248194,
225670,
332167,
242058,
395659,
311691,
227725,
108944,
252308,
291224,
39324,
285084,
317852,
242078,
141728,
121245,
315810,
315811,
381347,
289189,
108972,
311727,
377264,
299441,
283064,
311738,
336317,
293310,
291265,
342466,
278978,
291267,
127427,
254406,
127428,
283075,
311745,
324039,
317901,
6606,
278989,
281037,
281040,
334290,
278993,
289232,
242139,
369116,
256477,
285150,
279008,
160225,
195045,
279013,
127465,
279018,
311786,
330218,
319981,
109042,
319987,
279029,
254456,
233978,
301571,
342536,
348682,
279050,
279062,
254488,
289304,
279065,
322078,
291358,
207393,
375333,
377386,
293419,
244269,
197167,
234036,
315960,
338490,
348732,
352829,
115270,
55881,
377418,
354911,
436832,
242277,
244327,
295536,
287346,
313971,
344696,
301689,
244347,
279164,
356989,
291454,
311945,
369289,
344715,
330379,
311949,
334481,
316049,
330387,
346772,
316053,
352917,
330388,
111253,
295576,
111258,
363163,
344738,
279206,
295599,
342706,
299699,
299700,
164533,
289462,
109241,
248517,
363211,
154316,
242386,
279252,
318173,
289502,
299746,
295652,
338662,
299759,
418546,
312052,
199414,
344827,
221948,
279294,
363263,
299776,
295682,
191235,
264968,
291592,
322313,
322316,
117517,
326414,
322319,
312079,
295697,
291604,
207640,
291612,
326429,
293664,
281377,
326433,
279336,
318250,
295724,
152365,
312108,
285487,
301871,
318252,
353078,
230199,
355130,
293693,
342847,
295746,
355139,
252741,
318278,
355146,
201549,
355154,
281427,
353109,
244568,
230234,
322395,
244570,
355165,
109409,
242529,
351077,
342887,
326505,
355178,
177001,
201577,
242541,
207727,
400239,
330609,
174963,
109428,
207732,
310131,
209783,
246648,
361337,
269178,
359299,
113542,
109447,
416646,
228233,
316298,
349067,
236428,
240518,
426895,
349072,
355217,
56208,
308112,
209817,
289690,
127902,
185250,
189348,
310182,
256935,
240552,
353195,
140204,
236461,
293806,
252847,
316333,
316343,
289722,
230332,
353215,
330689,
279498,
330708,
248796,
248797,
64485,
52200,
123881,
203757,
383982,
289774,
287731,
277492,
316405,
240630,
349175,
312314,
314362,
328700,
328706,
357379,
320516,
293893,
134150,
330763,
320527,
324625,
238610,
308243,
330772,
418837,
316437,
197657,
281626,
201755,
175132,
326685,
252958,
300068,
345132,
322612,
359478,
324666,
324667,
238651,
302139,
361535,
21569,
314436,
214086,
359495,
361543,
250956,
341073,
296019,
339030,
353367,
361566,
281697,
314467,
230499,
250981,
253029,
228458,
207979,
281706,
318572,
316526,
15471,
351344,
312434,
353397,
300150,
300151,
363641,
337017,
285820,
300158,
150657,
302213,
349318,
228491,
228493,
169104,
177296,
326804,
119962,
283802,
339100,
285851,
296092,
300188,
343203,
373926,
300202,
253099,
253100,
306346,
318639,
228540,
230588,
228542,
343234,
259268,
353479,
62665,
353481,
353482,
283853,
333011,
189652,
189653,
148696,
357595,
333022,
359647,
304351,
304356,
290022,
222440,
328940,
234733,
279792,
353523,
298228,
216315,
208124,
292091,
261377,
320770,
228609,
242954,
328971,
292107,
353551,
251153,
177428,
349462,
245019,
320796,
126237,
115998,
333090,
369956,
109861,
208164,
130348,
279854,
298291,
171317,
326966,
318775,
116026,
312634,
312635,
286013,
333117,
216386,
193859,
300359,
312648,
294218,
296273,
331090,
120148,
314709,
314710,
357719,
318805,
134491,
316765,
222559,
163175,
333160,
306542,
296303,
243056,
312689,
327025,
314739,
249204,
314741,
249205,
327024,
181625,
111993,
290169,
314751,
224640,
306560,
294275,
298374,
388487,
368011,
304524,
296335,
112017,
112018,
9619,
370068,
234898,
224661,
318875,
314783,
310692,
241066,
316842,
314798,
286129,
279989,
353719,
228795,
292283,
280004,
300487,
306631,
284107,
302540,
310732,
312782,
64975,
310736,
327121,
366037,
210390,
210391,
210392,
210393,
286172,
144867,
103909,
316902,
245223,
361963,
54765,
191981,
282096,
321009,
251378,
329200,
191990,
280055,
300536,
359930,
290301,
286205,
300542,
230913,
292356,
329225,
253451,
253452,
359950,
323087,
323089,
398869,
413209,
282141,
349726,
187938,
355876,
245287,
245292,
347694,
230959,
288309,
290358,
194110,
425535,
288318,
349763,
56902,
282183,
288327,
292423,
243274,
333388,
224847,
228943,
333393,
118353,
280147,
224851,
290390,
128599,
235095,
196187,
44635,
333408,
157281,
286306,
374372,
323172,
312940,
204397,
224883,
333430,
370296,
247416,
323196,
325245,
175741,
337535,
294529,
224901,
312965,
282246,
229001,
290443,
188048,
282259,
302739,
345752,
229020,
255649,
257699,
40613,
40614,
40615,
298661,
61101,
321199,
364207,
224946,
337591,
321207,
280251,
224958,
333503,
323264,
327358,
282303,
321219,
333509,
319177,
212685,
9936,
241361,
9937,
302802,
241365,
181975,
229088,
298720,
325346,
321249,
153319,
345833,
12010,
280300,
294638,
360177,
325371,
194303,
194304,
319233,
323331,
216839,
284431,
243472,
321295,
323346,
161554,
321302,
116505,
255776,
313120,
241441,
315171,
341796,
247590,
333610,
284459,
294700,
200498,
321337,
259899,
319292,
325439,
315202,
307011,
325445,
282438,
339783,
153415,
280392,
159562,
337745,
325457,
413521,
304977,
317269,
18262,
241495,
362327,
284507,
300894,
245599,
237408,
302946,
276327,
325484,
296814,
282480,
292720,
325492,
317304,
241528,
194429,
124798,
55167,
325503,
315264,
188292,
253829,
327557,
241540,
67463,
243591,
315273,
317323,
325515,
315274,
243597,
329622,
294807,
118685,
311199,
253856,
292771,
354212,
300963,
313254,
294823,
292782,
317360,
200627,
294843,
188348,
362431,
214977,
280514,
174019,
321480,
214984,
284619,
344013,
212942,
231375,
212951,
360417,
294886,
337895,
354280,
247785,
313319,
317415,
296941,
362480,
278512,
311281,
223218,
311282,
325619,
333817,
292858
] |
1db9dc6381d45299ed997af122c3c564aeafb68a | 06913456410867a3c1ea3852e43dd17db806e21f | /Tests/AluminumTests/MTLBuffer+Value.swift | 197a0e03608db1853c3b9de57396900943e22a61 | [
"MIT"
] | permissive | MaximV88/Aluminum | 78e94bb0ccaf1756e6f794be40f4f2400309c82d | 4885988fae30e225668c4f7fe998dce4331762ce | refs/heads/master | 2022-11-25T22:27:55.830555 | 2020-07-26T15:20:42 | 2020-07-26T15:20:42 | 239,602,141 | 16 | 0 | null | 2020-04-15T07:15:11 | 2020-02-10T20:05:38 | Swift | UTF-8 | Swift | false | false | 309 | swift | //
// MTLBuffer+Value.swift
// AluminumTests
//
// Created by Maxim Vainshtein on 10/04/2020.
// Copyright © 2020 Maxim Vainshtein. All rights reserved.
//
import Metal
internal extension MTLBuffer {
func value<T>() -> T {
return contents().assumingMemoryBound(to: T.self).pointee
}
}
| [
-1
] |
252ccb12a988f680df9b499b944c2b325c4ad991 | cd3b57b9c890a7844ec2c65e67916aa28bf3147d | /Pod/Classes/ui/Features/Payments/Transfer Status/View/Data Source/TransferStatusDataSource.swift | 6a3580e3bca213a814ca97965bafd3ff823faf20 | [
"MIT"
] | permissive | nejcpintar/apto-ui-sdk-ios | 7a414e28327b54833e33c37c15512e2015cce396 | 4a164cd225e90b7887c83e83486a2bf23d2fd79c | refs/heads/master | 2023-04-10T00:17:59.679800 | 2021-04-13T08:19:48 | 2021-04-13T08:19:48 | 357,475,387 | 0 | 0 | MIT | 2021-04-13T08:29:24 | 2021-04-13T08:14:55 | Swift | UTF-8 | Swift | false | false | 1,295 | swift | import Foundation
import AptoSDK
final class TransferStatusDataSource: NSObject, UITableViewDataSource, UITableViewDelegate {
private var tableView: UITableView?
private var uiConfig: UIConfig?
var items: [TransferStatusItem] = [] {
didSet { tableView?.reloadData() }
}
init(uiConfig: UIConfig){
self.uiConfig = uiConfig
}
func configure(tableView: UITableView) {
tableView.backgroundColor = uiConfig?.uiBackgroundPrimaryColor
tableView.register(TransferStatusCell.self, forCellReuseIdentifier: TransferStatusCell.identifier)
tableView.estimatedRowHeight = 56
tableView.dataSource = self
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: TransferStatusCell.identifier, for: indexPath) as? TransferStatusCell else { fatalError() }
guard indexPath.row <= items.count else { fatalError() }
let item = items[indexPath.row]
cell.configure(with: item, uiConfig: uiConfig)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
56
}
}
| [
-1
] |
feca62ac1d69e2c548ca48b21d5a9d76b99e9578 | 7033e9b373ee22d812cc4e4d72aa3a69068e7fac | /QueueBarriersExample/Queues/DispatchBarrierQueue.swift | 8b8e96199c058e12c47dedbd6d61785bac57a875 | [
"WTFPL"
] | permissive | mackuba/QueueBarriersExample | 182d486a8a99989a6469c2389f42cd40ad17a92c | a3dcf1a81477f9356c279bed37855f1a8e6be5b7 | refs/heads/master | 2020-09-27T02:22:40.992073 | 2019-12-09T11:48:32 | 2019-12-09T11:48:32 | 226,402,717 | 6 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,098 | swift | //
// DispatchGroupQueue.swift
// QueueBarriersTest
//
// Created by Kuba Suder on 10.11.2019.
// Copyright © 2019 Kuba Suder. All rights reserved.
//
import Foundation
class DispatchBarrierQueue: TaskQueue {
let queue: DispatchQueue
var tasks: [Task] = []
weak var delegate: TaskQueueDelegate?
var specialTaskName: String {
return "Blocking Task"
}
required init() {
queue = DispatchQueue(label: "DispatchBarrierQueue", qos: .userInitiated, attributes: .concurrent)
}
func addTask(_ task: Task) {
task.register()
tasks.append(task)
delegate?.taskAdded(task)
if task.isBlocking {
queue.async(qos: .userInitiated, flags: .barrier) {
task.run()
self.tasks.removeAll(where: { $0 == task })
self.delegate?.taskFinished(task)
}
} else {
queue.async {
task.run()
self.tasks.removeAll(where: { $0 == task })
self.delegate?.taskFinished(task)
}
}
}
}
| [
-1
] |
d24fea926bc53214b1c5ab12cbe9f654bc43ac16 | 79309f64a8465cc0010c6b4150475b85dc0e1896 | /nara-ios-homework-18-12-2016/Data Model/UpdateModel.swift | 042a9996ab5fdad75a073aae4ff58c05c0a6f5f4 | [] | no_license | NaraTouch/nara-ios-homework-18-12-2016 | faadbe4d089ffeb607e7e28a9680c52d34d8e015 | 5898a35d6c232a9ab235445c765ccc28bf97a755 | refs/heads/master | 2021-01-12T06:47:03.640539 | 2016-12-19T03:28:19 | 2016-12-19T03:28:19 | 76,824,523 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,439 | swift | //
// UpdateModel.swift
// UploadImageSreyoun
//
// Created by sreyoun on 12/18/16.
// Copyright © 2016 KSHRD. All rights reserved.
//
import Foundation
import UIKit
import Alamofire
class UpdateModel{
// Create object from UpdatePresenterInterface
var updatePresenterInterface: UpdatePresenterInterface?
func uploadImage(image: UIImage){
Alamofire.upload(multipartFormData: { formData in
// Create image data
let imageData = UIImageJPEGRepresentation(image, 1)
// Append Image Data to formData
formData.append(imageData!, withName: "FILE", fileName: "image.jpg", mimeType: "image/jpg")
}, usingThreshold: 0, to: URL(string: UPLOAD_SINGLE_IMAGE)!, method: .post, headers: HEADERS, encodingCompletion: {
encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON(completionHandler: { response in
if let value = response.result.value as? [String:AnyObject]{
// Pass image url to presenter
let imageUrl = value["DATA"] as! String
// Call presenter delegate
self.updatePresenterInterface!.uploadImageComplete(imageUrl: imageUrl)
}
})
case .failure(let error):
print(error.localizedDescription)
}
})
}
func updateArticle(id:Int, title:String, description:String, imageUrl:String){
let params : Parameters = [
"TITLE": title,
"DESCRIPTION": description,
"AUTHOR": 0,
"CATEGORY_ID": 0,
"STATUS": "string",
"IMAGE": imageUrl
]
print(params)
Alamofire.request(URL(string: "\(GET_ALL_ARTICLE)/\(id)")!, method: .put, parameters: params, encoding: JSONEncoding.default, headers: HEADERS).responseJSON(completionHandler: { response in
if let value = response.result.value as? [String:AnyObject]{
// Tell presenter that the update is complete
self.updatePresenterInterface?.updateComplete(message: value["MESSAGE"] as! String)
}
})
}
}
| [
-1
] |
34d8a94ae80ac4a34349898d731ff6b7f5cae1b5 | d23c2a3c833b0ee02895a3e518cc3a64f0bce9de | /marioKartUITests/marioKartUITests.swift | dcb7a380c361197651f42511839e06bcb050639a | [] | no_license | yikeyike/marioKartRace | 257ae9f566b3a1d3fa7ac521a2c8d8b3e466ae03 | 240625aadf254fec83ca59600343fa0956205450 | refs/heads/main | 2023-06-16T07:36:58.841434 | 2021-07-18T18:12:10 | 2021-07-18T18:12:10 | 387,241,382 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,427 | swift | //
// marioKartUITests.swift
// marioKartUITests
//
// Created by Yike Li on 7/17/21.
//
import XCTest
class marioKartUITests: XCTestCase {
override func setUpWithError() throws {
// 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
// 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 tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
385078,
163894,
180279,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
393291,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
278637,
385135,
319599,
376945,
131190,
385147,
131199,
426124,
196758,
49308,
65698,
311459,
49317,
377008,
377010,
180409,
295099,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
147680,
311520,
205034,
254189,
286957,
254193,
344312,
336121,
262403,
147716,
368908,
180494,
262419,
368915,
254228,
319764,
278805,
254250,
311596,
131374,
418095,
336177,
180534,
155968,
287040,
311622,
270663,
368969,
254285,
180559,
377168,
344402,
229716,
368982,
270703,
139641,
385407,
385409,
270733,
106893,
385423,
213402,
385437,
254373,
156069,
385448,
385449,
115116,
385463,
319931,
278974,
336319,
336323,
188870,
278988,
278992,
262619,
377309,
377310,
369121,
369124,
279014,
270823,
279017,
311787,
213486,
360945,
139766,
393719,
279030,
377337,
279033,
254459,
410108,
410109,
262657,
377346,
279042,
279053,
410126,
262673,
385554,
393745,
303635,
279060,
279061,
254487,
410138,
279066,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
377419,
385612,
303693,
426575,
385620,
115287,
189016,
270938,
287327,
279143,
279150,
287345,
352885,
352886,
344697,
189054,
287359,
385669,
369285,
311944,
344714,
311950,
377487,
311953,
287379,
336531,
180886,
352921,
377499,
221853,
344737,
295591,
352938,
295598,
418479,
279215,
279218,
164532,
336565,
287418,
377531,
303802,
377534,
377536,
66243,
385737,
287434,
385745,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
418529,
295649,
385763,
295653,
369383,
230120,
361194,
312046,
418550,
344829,
279293,
205566,
197377,
434956,
312076,
295698,
418579,
426772,
197398,
221980,
344864,
197412,
336678,
262952,
189229,
262957,
164655,
197424,
328495,
197428,
336693,
230198,
197433,
426809,
222017,
295745,
377669,
369488,
279379,
385880,
295769,
197467,
435038,
230238,
279393,
303973,
279398,
197479,
385895,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
172936,
320394,
426894,
377754,
172971,
140203,
377778,
304050,
189365,
377789,
189373,
345030,
345034,
279499,
418774,
386007,
386009,
418781,
386016,
123880,
418793,
320495,
222193,
435185,
271351,
214009,
312313,
435195,
328701,
312317,
386049,
328705,
418819,
410629,
377863,
189448,
230411,
361487,
435216,
254997,
336928,
336930,
410665,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
410687,
336962,
377927,
238663,
361547,
205911,
156763,
361570,
214116,
230500,
214119,
402538,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
279686,
402568,
222344,
140426,
337037,
386191,
410772,
222364,
124073,
402618,
148674,
402632,
148687,
402641,
189651,
419028,
279766,
189656,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
369912,
386296,
369913,
419066,
386300,
279803,
386304,
369929,
419097,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
222523,
345418,
353611,
337226,
337228,
353612,
230730,
296269,
353617,
222542,
238928,
296274,
378201,
230757,
296304,
312688,
337280,
353672,
263561,
296328,
296330,
370066,
9618,
411028,
279955,
370072,
148899,
148900,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
361958,
271850,
280042,
280043,
271853,
329198,
411119,
337391,
116209,
296434,
386551,
288252,
271880,
198155,
329231,
304655,
370200,
222754,
157219,
157220,
394793,
312879,
288305,
288319,
288322,
280131,
288328,
353875,
312937,
271980,
206447,
403057,
42616,
337533,
280193,
370307,
419462,
149127,
149128,
419464,
288391,
411275,
214667,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
239305,
296649,
403149,
313042,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
395018,
395019,
116491,
395026,
116502,
435993,
345882,
411417,
255781,
362281,
378666,
403248,
378673,
182070,
182071,
345910,
436029,
345918,
337734,
280396,
272207,
272208,
337746,
395092,
362326,
345942,
370526,
345950,
362336,
255844,
296807,
214894,
362351,
214896,
313200,
313204,
280451,
67464,
305032,
337816,
329627,
239515,
436130,
354210,
10153,
313257,
362411,
370604,
362418,
411587,
280517,
362442,
346066,
231382,
354268,
403421,
436189,
329696,
354273,
403425,
354279,
436199,
174058,
337899,
354283,
247787,
329707,
296942,
436209,
239610,
182277,
346117,
354310,
43016,
354312,
354311,
436235,
313356,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
272432,
403507,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
395373,
288878,
346237,
215165,
436372,
329884,
362658,
436388,
215204,
133313,
395458,
338118,
346319,
379102,
387299,
18661,
379110,
338151,
149743,
379120,
436466,
411892,
436471,
395511,
313595,
436480,
272644,
338187,
338188,
395536,
338196,
272661,
379157,
157973,
338217,
321839,
362809,
379193,
395591,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
362864,
272755,
354678,
199030,
223611,
436609,
436613,
395653,
395660,
264591,
272784,
420241,
240020,
190870,
43416,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
166403,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
117350,
420461,
346739,
346741,
420473,
297600,
166533,
363155,
346771,
264855,
363161,
289435,
436897,
248494,
166581,
355006,
363212,
363228,
436957,
322269,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
166677,
207639,
363295,
355117,
191285,
273209,
355129,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
363353,
363354,
281434,
420702,
363361,
363362,
412516,
355173,
355174,
281444,
207724,
355182,
207728,
420722,
314240,
158594,
330627,
240517,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
240543,
256934,
273336,
289720,
289723,
273341,
330688,
379845,
363462,
19398,
420808,
273353,
191445,
207839,
347104,
314343,
134124,
412653,
248815,
257007,
347122,
183291,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
281647,
412725,
257093,
404550,
207954,
339031,
404582,
257126,
265318,
322664,
265323,
396395,
404589,
273523,
363643,
248960,
363658,
404622,
224400,
265366,
347286,
429209,
339101,
429216,
380069,
265381,
3243,
208044,
322733,
339131,
265410,
183492,
273616,
421081,
339167,
298209,
421102,
363769,
52473,
208123,
52476,
412926,
437504,
322826,
388369,
380178,
429332,
126229,
412963,
257323,
437550,
273713,
298290,
208179,
159033,
347451,
372039,
257353,
257354,
109899,
437585,
331091,
150868,
314708,
372064,
429410,
437602,
281958,
388458,
265579,
306541,
421240,
224637,
388488,
298378,
306580,
282008,
396697,
282013,
290206,
396709,
298406,
241067,
314797,
380335,
355761,
421302,
134586,
380348,
216510,
216511,
380350,
306630,
200136,
273865,
306634,
339403,
372172,
413138,
421338,
437726,
429540,
3557,
3559,
191980,
282097,
265720,
216575,
290304,
372226,
437766,
323083,
208397,
323088,
413202,
413206,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
413255,
273992,
265800,
421452,
265809,
290391,
265816,
396889,
306777,
388699,
396896,
388712,
388713,
314997,
290425,
339579,
396927,
282248,
224907,
396942,
405140,
274071,
323226,
208547,
208548,
405157,
388775,
282279,
364202,
421556,
224951,
224952,
306875,
282302,
323262,
241366,
224985,
282330,
159462,
372458,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
282379,
216844,
372497,
397076,
421657,
339746,
216868,
257831,
167720,
241447,
421680,
282418,
421686,
274234,
339782,
315209,
159563,
339799,
307038,
274276,
282471,
274288,
339840,
282517,
298912,
118693,
438186,
126896,
151492,
380874,
372699,
323554,
380910,
380922,
380923,
274432,
372736,
241695,
430120,
102441,
315433,
430127,
405552,
282671,
241717,
249912,
225347,
307269,
421958,
233548,
176209,
381013,
53334,
315477,
200795,
356446,
323678,
438374,
176231,
438378,
233578,
422000,
249976,
266361,
422020,
168069,
381061,
168070,
381071,
241809,
430231,
200856,
422044,
192670,
192671,
299166,
258213,
299176,
323761,
184498,
430263,
266427,
356550,
299208,
372943,
266447,
258263,
356575,
307431,
438512,
372979,
389364,
381173,
135416,
356603,
184574,
266504,
217352,
61720,
381210,
282908,
389406,
282912,
233761,
438575,
315698,
266547,
397620,
332084,
438583,
127292,
323914,
201037,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
242028,
160111,
250227,
315768,
291193,
438653,
291200,
266628,
340356,
242059,
225684,
373141,
373144,
291225,
389534,
397732,
176602,
242138,
184799,
291297,
201195,
324098,
233987,
340489,
397841,
283154,
258584,
397855,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
373377,
422529,
201348,
152196,
356998,
348807,
356999,
316044,
275102,
176805,
340645,
422567,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
398039,
234216,
373485,
373486,
21239,
275193,
348921,
234233,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
234290,
152372,
160569,
430909,
160576,
348999,
283466,
439118,
234330,
275294,
381791,
127840,
357219,
439145,
177002,
308075,
381811,
201590,
177018,
398205,
340865,
291713,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
373653,
430999,
209820,
381856,
398244,
185252,
422825,
381872,
177074,
398268,
349122,
398275,
127945,
373705,
340960,
398305,
340967,
398313,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
398405,
349254,
218187,
250955,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
234655,
234662,
373937,
373939,
324790,
300215,
218301,
283841,
283846,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
439563,
242955,
414989,
259346,
349458,
382243,
382246,
382257,
292145,
382264,
193853,
193858,
251212,
234830,
406862,
259408,
283990,
357720,
300378,
300379,
374110,
234864,
259449,
382329,
357758,
243073,
357763,
112019,
398740,
234902,
374189,
251314,
284086,
259513,
54719,
292291,
300490,
300526,
259569,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
415360,
325246,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
431861,
284410,
161539,
284425,
300812,
284430,
366358,
169751,
431901,
341791,
186148,
186149,
399148,
202541,
431918,
284460,
153392,
431935,
415555,
325444,
153416,
325449,
341837,
415566,
431955,
325460,
341846,
300893,
259937,
382820,
276326,
415592,
292713,
292719,
325491,
341878,
276343,
350072,
333687,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
284584,
292783,
300983,
128955,
219102,
292835,
6116,
317416,
432114,
325620,
415740,
415744,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
399433,
333902,
104534,
194667,
260206,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
104633,
260285,
227517,
268479,
374984,
301270,
301271,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
309504,
260355,
432387,
375052,
194832,
325904,
391448,
268570,
178459,
186660,
268581,
334121,
358698,
317738,
325930,
432435,
358710,
14654,
268609,
227655,
383309,
383327,
391521,
366948,
416101,
416103,
383338,
432503,
432511,
211327,
227721,
285074,
252309,
39323,
285083,
317851,
285089,
375211,
334259,
342454,
358844,
293309,
317889,
326083,
416201,
129484,
154061,
416206,
326093,
432608,
285152,
391654,
334315,
375281,
293368,
317949,
334345,
432650,
309770,
342537,
342549,
342560,
416288,
350758,
350759,
358951,
358952,
293420,
219694,
219695,
375345,
432694,
244279,
309831,
375369,
375373,
416334,
301647,
416340,
244311,
260705,
416353,
375396,
268901,
244345,
334473,
375438,
326288,
285348,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
432883,
203511,
342775,
383740,
416509,
432894,
359166,
375552,
162559,
228099,
285443,
285450,
383755,
326413,
285467,
326428,
318247,
342827,
391980,
318251,
375610,
301883,
342846,
416577,
416591,
244569,
375644,
252766,
293729,
351078,
342888,
392057,
211835,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
293801,
326571,
252848,
326580,
326586,
359365,
211913,
326602,
252878,
342990,
433104,
56270,
359380,
433112,
359391,
343020,
383980,
187372,
203758,
383994,
171009,
384004,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
318515,
203829,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
187508,
384120,
302202,
285819,
392317,
343166,
384127,
392320,
285823,
285833,
285834,
318602,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
367798,
64699,
294075,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
195809,
253168,
351475,
351489,
367897,
367898,
130342,
130344,
130347,
261426,
212282,
294210,
359747,
359748,
146760,
146763,
114022,
253288,
425327,
425331,
163190,
327030,
384379,
253316,
294278,
318860,
253339,
253340,
318876,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
253431,
359931,
187900,
343552,
245249,
228868,
409095,
359949,
294413,
253456,
302613,
253462,
146976,
245290,
343606,
163385,
425534,
138817,
147011,
147020,
179800,
196184,
343646,
212574,
204386,
155238,
204394,
138862,
310896,
188021,
294517,
286351,
188049,
425624,
229021,
245413,
286387,
384693,
376502,
286392,
302778,
409277,
286400,
409289,
425682,
286419,
294621,
245471,
155360,
294629,
212721,
163575,
286457,
286463,
319232,
360194,
155408,
417556,
294699,
204600,
319289,
384826,
409404,
360253,
409416,
376661,
237397,
368471,
425820,
368486,
409446,
425832,
368489,
40809,
384871,
417648,
417658,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
204702,
319393,
294820,
253868,
204722,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
327666,
385011
] |
28029ba22b6db23e59a4ef0c3a3768b2ddb96d5c | 170f185a65f40e0679693d4c366285261eb33a9a | /BasisTests/OperatorsSpec.swift | ff693a64fddfb103e58541bc05148232aea21128 | [
"MIT"
] | permissive | CodaFi/Basis | 18e8f59f84031a94a9aa7e975a458bdb543e32cb | 1f255a1da485fe4a5e4c12d61d4bb3528af0e94c | refs/heads/master | 2021-01-17T20:42:11.315734 | 2015-06-08T18:13:56 | 2015-06-08T18:13:56 | 29,100,556 | 2 | 0 | null | 2015-01-11T20:52:49 | 2015-01-11T18:05:06 | Swift | UTF-8 | Swift | false | false | 2,550 | swift | //
// OperatorsSpec.swift
// Basis
//
// Created by Robert Widmann on 9/7/14.
// Copyright (c) 2014 TypeLift. All rights reserved.
// Released under the MIT license.
//
import Basis
import XCTest
class OperatorsSpec : XCTestCase {
func testAfter() {
let s = ""
let f = { $0 + "World!" }
let g = { $0 + "Hello, " }
XCTAssertTrue((f • g)(s) == "Hello, World!", "")
}
func testPipeBackwards() {
let f = { $0 + 5 }
let g = { $0 + 10 }
let h = { $0 + 20 }
let x = 5
XCTAssertTrue((f <<| g <<| h(x)) == f(g(h(x))) , "")
}
func testPipeForwards() {
let f = { $0 + 5 }
let g = { $0 + 10 }
let h = { $0 + 20 }
let x = 5
XCTAssertTrue((h(x) |>> g |>> f) == f(g(h(x))) , "")
}
func testPairFormation() {
let x = "String"
let y = 20
XCTAssertTrue(fst(x ∏ y) == fst((x, y)), "")
XCTAssertTrue(snd(x ∏ y) == snd((x, y)), "")
}
func testOn() {
let y = 32.0
XCTAssertTrue(on(+)({ s in pow(s, 2.0) })(4.0)(4.0) == y, "")
}
func testRLCompose() {
let f = ^{ $0 + 5 }
let g = ^{ $0 + 10 }
let h = ^{ $0 + 20 }
let x = 5
XCTAssertTrue((f <<< g <<< h).apply(x) == f.apply(g.apply(h.apply(x))), "")
}
func testLRCompose() {
let f = ^{ $0 + 5 }
let g = ^{ $0 + 10 }
let h = ^{ $0 + 20 }
let x = 5
XCTAssertTrue((h >>> g >>> f).apply(x) == f.apply(g.apply(h.apply(x))), "")
}
func testChoose() {
let x : Maybe<Int> = Maybe.just(10)
let y : Maybe<Int> = Maybe.nothing()
XCTAssertTrue((x <|> y) == x, "")
}
func testBind() {
let x : Maybe<Int> = Maybe.just(10)
XCTAssertTrue(fromJust(x >>- { v in Maybe.just(v) }) == fromJust(x), "")
}
func testSplit() {
let f = ^{ $0 + 5 }
let g = ^{ $0 + " Zone!" }
XCTAssertTrue(fst((f *** g).apply(5, "Danger")) == 10, "")
XCTAssertTrue(snd((f *** g).apply(5, "Danger")) == "Danger Zone!", "")
}
func testFanout() {
let f = ^{ $0 + 5 }
let g = ^{ $0 + 10 }
XCTAssertTrue(fst((f &&& g).apply(5)) == 10, "")
XCTAssertTrue(snd((f &&& g).apply(5)) == 15, "")
}
func testSplat() {
let f = ^{ $0 + "!" }
let g = ^{ $0 + "Bro" }
let left = Either<String, String>.left("Ruh-Roh")
let right = Either<String, String>.right("UMad")
XCTAssertTrue(isLeft((f +++ g).apply(left)), "")
XCTAssertTrue(isRight((f +++ g).apply(right)), "")
}
func testFanin() {
let f = ^{ $0 + 5 }
let g = ^{ $0 + 10 }
let left = Either<Int, Int>.left(10)
let right = Either<Int, Int>.right(10)
XCTAssertTrue((f ||| g).apply(left) == 15, "")
XCTAssertTrue((f ||| g).apply(right) == 20, "")
}
}
| [
-1
] |
f8c99ff78dbeba8beaad1388b3bf92b5e585dc5a | 3f38db49c1fe7f836eb042603632adbcc65e4a53 | /WhatsThatWhistle/AddCommentsViewController.swift | 9cb5d16db78f59d07319686486754c3cbe2ca1e1 | [] | no_license | voxqhuy/iOS-SmallApps | 2b5e24b608817630832572a9c690b4c06b3a117b | 79898b72c2db283752100b7d7061466407e7f2db | refs/heads/master | 2021-10-09T15:32:52.861917 | 2018-12-30T18:57:56 | 2018-12-30T18:57:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,011 | swift | //
// AddCommentsViewController.swift
// WhatsThatWhistle
//
// Created by Vo Huy on 7/31/18.
// Copyright © 2018 Vo Huy. All rights reserved.
//
import UIKit
class AddCommentsViewController: UIViewController, UITextViewDelegate {
var genre: String!
var comments: UITextView!
let placeholder = "If you have any additional comments that might help identify your tune, enter them here."
override func loadView() {
super.loadView()
comments = UITextView()
comments.translatesAutoresizingMaskIntoConstraints = false
comments.delegate = self
comments.font = UIFont.preferredFont(forTextStyle: .body)
view.addSubview(comments)
comments.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
comments.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
comments.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
comments.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
}
override func viewDidLoad() {
super.viewDidLoad()
title = "Comments"
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Submit", style: .plain, target: self, action: #selector(submitTapped))
comments.text = placeholder
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@objc func submitTapped() {
let vc = SubmitViewController()
vc.genre = genre
if comments.text == placeholder {
vc.comments = ""
} else {
vc.comments = comments.text
}
navigationController?.pushViewController(vc, animated: true)
}
func textViewDidBeginEditing(_ textView: UITextView) {
if textView.text == placeholder {
textView.text = ""
}
}
}
| [
350336
] |
7b78ccd45ac9d2284295b0d4af813885d8fc5dd4 | 998023e094740fad3a2dbe99cf1d678d656d8936 | /WeatherApp/WeatherApp/ViewController/FavoritesViewController.swift | 367f11e85a355e4472f3b8400af12ac614c6a747 | [
"MIT"
] | permissive | Margiett/weatherAppProgrammaticJan31 | f570e280c90f9ed8215d49ceaa7e2f2d524a8ced | cd3202e8eac990644d4759121a80a138a935c9eb | refs/heads/master | 2020-12-26T13:46:45.452484 | 2020-02-12T16:10:43 | 2020-02-12T16:10:43 | 237,529,001 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,525 | swift | //
// FavoritesViewController.swift
// WeatherApp
//
// Created by Margiett Gil on 2/5/20.
// Copyright © 2020 David Rifkin. All rights reserved.
//
import UIKit
class FavoritesViewController: UIViewController {
public var favoritesView = FavoritesView()
public var persistenceHelper = PersistenceHelper(filename:"fave.plist")
weak var delegate: FavoritesDelegate?
public var faveDidSet = [ImageObject]() {
didSet {
DispatchQueue.main.async {
self.favoritesView.collectionView.reloadData()
}
}
}
override func loadView(){
view = favoritesView
}
override func viewDidLoad() {
super.viewDidLoad()
favoritesView.collectionView.delegate = self
favoritesView.collectionView.dataSource = self
loadFavorites()
favoritesView.collectionView.register(UINib(nibName: "FavoritesCell", bundle: nil), forCellWithReuseIdentifier: "favoritesCell")
}
override func viewDidAppear(_ animated: Bool) {
super.viewWillAppear(true)
loadFavorites()
}
private func loadFavorites() {
do {
faveDidSet = try persistenceHelper.loadPhotos()
} catch {
print("unable to load favorites")
}
}
}
extension FavoritesViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return faveDidSet.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = favoritesView.collectionView.dequeueReusableCell(withReuseIdentifier: "favoritesCell", for: indexPath) as? FavoritesCell else {
fatalError("could not cast to favorites cell")
}
let fave = faveDidSet[indexPath.row]
cell.configureCell(for: fave)
return cell
}
}
extension FavoritesViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let maxSize: CGSize = UIScreen.main.bounds.size
let itemWidth: CGFloat = maxSize.width * 0.95
return CGSize(width: itemWidth, height: itemWidth)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 1, left: 1, bottom: 1, right: 1)
}
}
extension FavoritesViewController: FavoritesDelegate {
func didLongPress(_ imageCell: FavoritesCell) {
guard let indexPath = favoritesView.collectionView.indexPath(for: imageCell) else {
return
}
// present an action sheet
// actions: delete, cancel
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let deleteAction = UIAlertAction(title: "Delete", style: .destructive) { [weak self] alertAction in
self?.deleteImageObject(indexPath: indexPath)
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
alertController.addAction(deleteAction)
alertController.addAction(cancelAction)
present(alertController, animated: true)
}
private func deleteImageObject(indexPath: IndexPath) {
persistenceHelper.sync(items: faveDidSet)
do {
faveDidSet = try persistenceHelper.loadPhotos()
} catch {
print("loading error: \(error)")
}
// delete imageObject from imageObjects
faveDidSet.remove(at: indexPath.row)
// delete cell from collection view
favoritesView.collectionView.deleteItems(at: [indexPath])
do {
// delete image object from documents directory
try persistenceHelper.delete(event: indexPath.row)
} catch {
print("error deleting item: \(error)")
}
}
func addedToFaves(pic: ImageObject?) {
faveDidSet.append(pic!)
}
// func addedToFaves(pic: ImageObject) {
// faveDidSet.append(pic)
// }
}
| [
-1
] |
570d7f79a495bb14573d60ebc99fd1836d6f7b85 | 424492d8d8cf56258acb444d70d70a175cd3c460 | /MovieList/Scenes/Splash/SplashBuilder.swift | 3e2f0b4e8b3adff301e79429867add33f16e1f23 | [] | no_license | cihankarabas/OMDPApi-Demo | 57f85d7fdce38fb9f9f903b4a79eaa746657ff04 | 31230d8117b97a5d47f6ecaa56d2bc6d056cdd7e | refs/heads/master | 2022-12-06T00:32:13.953420 | 2020-08-22T10:14:14 | 2020-08-22T10:14:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 529 | swift | //
// SplashBuilder.swift
// MovieList
//
// Created by Cihan Karabaş on 22.08.2020.
// Copyright © 2020 Cihan Karabaş. All rights reserved.
//
import UIKit
final class SplashBuilder{
static func make() -> SplashViewController{
let storyboard = UIStoryboard(name: "Splash", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "SplashViewController") as! SplashViewController
//viewController.service = app.service
return viewController
}
}
| [
-1
] |
15d06338595cf2e461977383ecb3beca1a7607f4 | 54caf3f04a6a103fa379fbfa41add171537f43c4 | /delivery/Model/deliveryType.swift | 8ab9ef61af2f8766e7e3bbd46135c7aa2fc28155 | [] | no_license | nedostatok/delivery | 650a6ca283e235f7bef21389f9e2d6e8f3be77fa | 9639c74b065357210f4b9a05a5e214e587dacb69 | refs/heads/master | 2023-02-27T03:26:22.600375 | 2021-01-25T11:42:56 | 2021-01-25T11:42:56 | 273,477,116 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 215 | swift | //
// deliveryType.swift
// delivery
//
// Created by User on 25.06.2020.
// Copyright © 2020 sad. All rights reserved.
//
import Foundation
struct DeliveryType {
let type: String
let price: String
}
| [
-1
] |
dcde8255f3ea9741dd8f7b5f4e271238071e5ad0 | 3d09e2f556bf1e6a364d6debd0f40ac6ed1d0d59 | /Application/SmartDiet/SmartDiet/Constants/Constants.swift | 6153f8d97c3aacc2952437bf331294ddee49e1b7 | [] | no_license | santhosh1993/SmartDiet | d807508c38682a286daf988d9212a262099d8194 | 42f2764dcce1a4c7b43306dec5362dd955ede83d | refs/heads/master | 2022-03-06T16:34:39.960474 | 2019-09-16T07:59:16 | 2019-09-16T07:59:16 | 208,739,904 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,984 | swift | //
// Constants.swift
// SmartDiet
//
// Created by Sunilkumar Gavara on 14/09/19.
// Copyright © 2019 Epam. All rights reserved.
//
import Foundation
let MAIN_URL = "http://10.71.164.4:8000/"
let EMPTY_STRING = ""
struct Constants {
static let protien = "PROTIEN"
static let fat = "FAT"
static let carbs = "CARBS"
static let fibre = "FIBRE"
}
struct ReuseIdentifiers {
static let selectFoodCell = "SelectFoodCell"
static let cellWithImage = "CellWithImage"
static let mealDetailCell = "MealDetailCell"
static let cellCharts = "CellCharts"
static let cellDescription = "CellDescription"
}
struct ControllerIds {
static let tabBarController = "TabBarController"
static let MealDetailController = "MealDetailController"
static let suggestMealController = "SuggestMealController"
static let loginController = "SDLogInController"
}
struct Colors {
static let themeColor = "#1A9CB0"
}
struct URLs {
static let GET_FOOD_LIST = MAIN_URL + "data/foodlist/"
}
struct Nibs {
static let selectFoodCell = "SelectFoodCell"
static let cellWithImage = "CellWithImage"
static let mealDetailCell = "MealDetailCell"
static let cellCharts = "CellCharts"
static let cellDescription = "CellDescription"
}
struct Images {
static let veg = "veg"
static let nonVeg = "nonVeg"
}
struct StoryBoardNames {
static let Food = "Food"
static let Main = "Main"
}
struct Keys {
static let price = "price"
static let isVeg = "is_veg"
static let name = "name"
static let imageUrl = "image_url"
static let desc = "description"
static let protein = "protein"
static let fat = "fat"
static let carbs = "carbs"
static let fiber = "fiber"
}
struct FontNames {
static let HiraginoSansW3 = "Hiragino Sans W3"
}
struct AlertConstants {
static let Alert = "Yummy Meal Is On The Way!"
static let FoodOnTheWay = ""
static let Ok = "OK"
}
| [
-1
] |
f11d5d6714648b96a271f9488afcb768026c8a6e | 63893b4bb739115609dc74daa81c470f53035b14 | /Posts ReaderTests/Posts_ReaderTests.swift | a4afd1af35c7fff53bd6b0c95ba5241800e5906a | [] | no_license | mrbodich/Posts-Reader-SwiftUI | 37fcbf2dd322b3ada9804d4045552a2abe501a27 | fdbad5c7f52e90b8919f0bcf5aa9a1733b962c23 | refs/heads/main | 2023-06-24T14:40:47.648239 | 2021-07-24T06:56:58 | 2021-07-24T06:56:58 | 386,989,755 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 924 | swift | //
// Posts_ReaderTests.swift
// Posts ReaderTests
//
// Created by Bogdan Chornobryvets on 15.07.2021.
//
import XCTest
@testable import Posts_Reader
class Posts_ReaderTests: 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 testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// 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,
352315,
376894,
352326,
311372,
196691,
278615,
385116,
237663,
254048,
319591,
221290,
278634,
319598,
352368,
204916,
131191,
237689,
278655,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
32941,
278704,
377009,
278708,
131256,
295098,
417988,
417994,
139479,
254170,
229597,
311519,
205035,
286958,
336120,
327929,
344313,
147717,
368905,
180493,
254226,
368916,
262421,
377114,
237856,
237857,
278816,
254251,
311597,
98610,
180535,
336183,
278842,
287041,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
139640,
246136,
106874,
246137,
311685,
106888,
385417,
385422,
213403,
385454,
311727,
377264,
311738,
33211,
278970,
336317,
319930,
336320,
311745,
278978,
254406,
188871,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
319981,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
393751,
254488,
279065,
377376,
377386,
197167,
385588,
352829,
115270,
385615,
426576,
369235,
139872,
66150,
344680,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
279206,
295590,
352937,
287404,
336558,
205487,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
369385,
312052,
172792,
344827,
221948,
344828,
205568,
295682,
197386,
434957,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
295724,
312108,
197422,
353070,
164656,
295729,
353069,
328499,
189228,
353078,
197431,
230199,
353079,
336702,
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,
304110,
320494,
271350,
295927,
304122,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
197657,
336929,
369701,
345132,
238639,
312373,
238651,
132158,
361535,
336960,
377926,
361543,
238664,
353367,
156764,
156765,
304222,
173166,
377972,
353397,
377983,
402565,
279685,
222343,
386189,
337039,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
353479,
353481,
402634,
353482,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
320796,
222494,
66862,
353584,
345396,
386359,
116026,
378172,
222524,
279875,
312648,
337225,
304456,
230729,
337227,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
279920,
312689,
296307,
116084,
337281,
148867,
378244,
296329,
296335,
9619,
370071,
279974,
173491,
304564,
353719,
361927,
370123,
148940,
280013,
312782,
222675,
353750,
271843,
280041,
361963,
296433,
321009,
280055,
288249,
329225,
230921,
296461,
304656,
329232,
370197,
402985,
394794,
230959,
288309,
312889,
288318,
124485,
288326,
288327,
239198,
99938,
312940,
222832,
370296,
247416,
337534,
337535,
263809,
288392,
239250,
419478,
345752,
255649,
337591,
321207,
296632,
280251,
321219,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
280278,
280280,
18138,
345821,
321247,
321249,
345833,
345834,
280300,
67315,
173814,
313081,
124669,
288512,
288516,
280329,
321302,
345879,
116505,
321310,
255776,
247590,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
345929,
255829,
18262,
362327,
370522,
345951,
362337,
345955,
296806,
288619,
214895,
313199,
362352,
313203,
124798,
182144,
305026,
67463,
329622,
337815,
124824,
214937,
436131,
354212,
436137,
362417,
124852,
288697,
362431,
214977,
214984,
362443,
247757,
280541,
354269,
329695,
436191,
354272,
354274,
337895,
313319,
354280,
174057,
247785,
436205,
247791,
362480,
313339,
43014,
354316,
313357,
182296,
354345,
223274,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
354385,
338003,
280661,
329814,
338007,
354393,
280675,
280677,
43110,
321637,
313447,
436329,
288879,
280694,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
379071,
149703,
338119,
346314,
321745,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
125193,
125198,
272658,
125203,
272660,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
182598,
289110,
215385,
272729,
379225,
321894,
280939,
354676,
354677,
436608,
362881,
240002,
436611,
248194,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
289232,
281040,
256477,
281072,
174593,
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,
354969,
289434,
363163,
346779,
338613,
314040,
158394,
363211,
363230,
289502,
264928,
338662,
346858,
330474,
289518,
199414,
363263,
35583,
117517,
322319,
166676,
207640,
289576,
355121,
191283,
273207,
355130,
289598,
355137,
355139,
420677,
355146,
355152,
281427,
281433,
355165,
355178,
330609,
207732,
158593,
240518,
224145,
355217,
256922,
289690,
420773,
256935,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
248796,
248797,
207838,
347103,
314342,
289774,
347123,
240630,
314362,
257024,
330754,
330763,
281626,
248872,
322612,
248901,
257094,
314448,
339030,
314467,
281700,
257125,
322663,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
347283,
363669,
339100,
380061,
429214,
199839,
339102,
265379,
249002,
306346,
44203,
3246,
421048,
339130,
265412,
290000,
134366,
298208,
298212,
298213,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
109861,
372009,
412971,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
380271,
314739,
208244,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
208293,
314791,
396711,
396712,
282024,
241066,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
191981,
290301,
282114,
372227,
323080,
323087,
175639,
388632,
396827,
134686,
282146,
306723,
355876,
347694,
290358,
265798,
265804,
396882,
290390,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
339585,
224901,
282245,
282246,
323217,
282259,
323236,
298661,
282280,
364207,
224946,
110268,
224958,
282303,
274115,
306890,
241361,
298712,
298720,
12010,
282348,
282358,
175873,
339715,
323331,
323332,
339720,
372496,
323346,
249626,
282400,
339745,
241441,
257830,
421672,
282417,
282427,
315202,
307011,
216918,
241495,
241528,
339841,
315273,
315274,
372626,
380821,
282518,
282519,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
102437,
315432,
102445,
233517,
176175,
241716,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
438377,
315498,
299121,
233589,
266357,
422019,
241808,
381073,
323729,
233636,
299174,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
356602,
184575,
381208,
315673,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
127284,
332085,
332089,
315706,
282939,
241986,
438596,
332101,
323913,
348492,
323916,
323920,
250192,
348500,
168281,
332123,
332127,
323935,
242023,
242029,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
315811,
381347,
61859,
340398,
61873,
61880,
283064,
127427,
127428,
283075,
324039,
373197,
176601,
242139,
160225,
242148,
291311,
233978,
291333,
340490,
348682,
258581,
291358,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
340558,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
356989,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
348920,
299776,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
242485,
160571,
430910,
160575,
160580,
348998,
299849,
283467,
381773,
201551,
242529,
349026,
357218,
127841,
275303,
308076,
242541,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
349067,
349072,
308112,
209817,
324506,
324507,
390045,
185250,
324517,
185254,
373687,
349121,
381897,
373706,
316364,
340955,
340961,
324586,
340974,
349171,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
316437,
201755,
300068,
357414,
357423,
300084,
324666,
308287,
21569,
218186,
250954,
250956,
300111,
341073,
439384,
250981,
300135,
316520,
300136,
357486,
316526,
144496,
349294,
300150,
291959,
300151,
160891,
341115,
300158,
349316,
349318,
373903,
169104,
177296,
308372,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
316627,
333011,
357595,
234733,
234742,
128251,
316669,
439562,
292107,
242954,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
193859,
177484,
251213,
259406,
234831,
406861,
120148,
283991,
374109,
292195,
333160,
243056,
316787,
382330,
357762,
112017,
234898,
259475,
275859,
112018,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
366037,
210390,
210391,
210393,
144867,
54765,
251378,
308723,
300536,
210433,
366083,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
423453,
349726,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
349781,
300630,
128599,
235095,
333408,
300644,
374372,
415338,
243307,
120427,
54893,
325231,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
259781,
333517,
333520,
333521,
333523,
325346,
333542,
153319,
325352,
284401,
325371,
194303,
284429,
243472,
366360,
284442,
169754,
325404,
325410,
341796,
399147,
431916,
366381,
300848,
317232,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
284514,
292712,
325484,
423789,
292720,
325492,
276341,
341879,
317304,
333688,
112509,
194429,
325503,
55167,
333701,
243591,
350093,
325518,
243597,
333722,
350109,
292771,
415655,
333735,
284587,
243637,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
129076,
243767,
358456,
309345,
194666,
260207,
432240,
284788,
333940,
292992,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
301251,
309444,
194782,
301279,
317664,
243962,
375039,
309503,
375051,
325905,
325912,
211235,
432421,
211238,
358703,
358709,
260418,
383311,
6481,
366930,
366929,
6489,
391520,
383332,
383336,
211326,
317831,
227725,
252308,
317852,
121245,
285090,
375207,
342450,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
342536,
342553,
416286,
375333,
358954,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
39530,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
318130,
383667,
293556,
342713,
285373,
39614,
318173,
375526,
285415,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
310036,
326429,
293664,
326433,
342820,
400166,
293672,
318250,
318252,
375609,
252741,
293711,
244568,
244570,
293730,
351077,
342887,
269178,
211836,
400252,
359298,
359299,
260996,
113542,
228233,
392074,
228234,
56208,
400283,
318364,
310176,
310178,
293800,
359338,
236461,
326581,
326587,
359364,
326601,
211914,
359381,
433115,
359387,
343005,
130016,
64485,
326635,
187374,
383983,
359406,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
252958,
252980,
359478,
203830,
302139,
359495,
392290,
253029,
228458,
351344,
187506,
285814,
392318,
187521,
384131,
302216,
228491,
228493,
285838,
162961,
326804,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
302274,
367810,
343234,
244940,
228563,
351446,
359647,
195808,
310497,
228588,
253167,
302325,
351478,
261377,
228609,
245019,
253216,
130338,
130343,
130348,
261425,
351537,
286013,
286018,
146762,
294218,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
253317,
384393,
368011,
318864,
318868,
310692,
245161,
286129,
286132,
343476,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
64975,
327121,
228827,
286172,
310757,
187878,
343542,
343543,
286202,
359930,
286205,
302590,
228867,
253451,
253452,
359950,
146964,
253463,
286244,
245287,
245292,
286254,
196164,
56902,
179801,
196187,
343647,
310889,
204397,
138863,
188016,
294529,
229001,
310923,
188048,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
384695,
319162,
327358,
286399,
212685,
384720,
245457,
302802,
278234,
294622,
278240,
212716,
212717,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
425825,
425833,
417654,
188292,
253829,
294807,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
212951,
360417,
294886,
253929,
327661,
311281,
311282
] |
a17c2c9c9115cae8ac8ae15f34674c297ebf34b0 | 2f75e143c1aba5c49a89f0789ee851380bc2c4c2 | /Mapper/Model/RoundedImageView.swift | 57d9a9aac255bbe37bbef0289a9ebf872d5f6ad0 | [] | no_license | MahmoudSaeed77/Mapper | 5aceb66f44d213fad7f94c89d29f8b1499b1aa9f | 48f74c3e1346c2c90691f49faae30d9b7ee85fd5 | refs/heads/master | 2020-06-28T22:54:02.967181 | 2019-08-03T10:42:12 | 2019-08-03T10:42:12 | 200,363,473 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 439 | swift | //
// RoundedImageView.swift
// Mapper
//
// Created by Mohamed Ibrahem on 8/1/19.
// Copyright © 2019 Mahmoud Saeed. All rights reserved.
//
import UIKit
class RoundedImageView: UIImageView {
override func awakeFromNib() {
super.awakeFromNib()
roundTheImage()
}
func roundTheImage(){
self.layer.cornerRadius = self.frame.height / 2
self.layer.masksToBounds = false
}
}
| [
-1
] |
cb26eb1384cfc29eaf0b812c9f65fe9b1456fe7a | 38bfbbd01d80ebcbad123e3e18920e2920b8724b | /WeatherAppTests/Mock/MockNetworking.swift | 184a6aad0b1babb11f2897b039189ea7b311830a | [] | no_license | samar-khaled/WeatherApp | 568c0907fa97f4c68ae41c66b3a945daa536b409 | deff38488cf87207355b788112f59c53b8c10843 | refs/heads/master | 2022-12-17T17:52:26.050773 | 2020-09-21T12:16:55 | 2020-09-21T12:16:55 | 292,551,313 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,605 | swift | //
// MockNetworking.swift
// WeatherAppTests
//
// Created by Samar Khaled on 21/9/2020.
// Copyright © 2020 Samar Khaled. All rights reserved.
//
import Foundation
import Mocker
@testable import WeatherApp
class MockNetworking: Networking {
var mockedStatusCode: Int
var mockedData: Data
init(mockedStatusCode: Int, mockedData: Data) {
self.mockedStatusCode = mockedStatusCode
self.mockedData = mockedData
}
func fetch(_ endpoint: Endpoint, completion: @escaping (Result<Data, NetworkError>) -> Void) {
let configuration = URLSessionConfiguration.default
configuration.protocolClasses = [MockingURLProtocol.self] + (configuration.protocolClasses ?? [])
let sessionManager = URLSession(configuration: configuration)
guard let apiEndpoint = endpoint.urlRequest.url else { return }
let mock = Mock(url: apiEndpoint, dataType: .json, statusCode: mockedStatusCode, data: [.get: mockedData])
mock.register()
sessionManager.dataTask(with: apiEndpoint) { (data, response, error) in
if error != nil {
completion(.failure(.backendError))
return
}
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode != 200 {
completion(.failure(.network(statusCode: httpResponse.statusCode)))
return
}
if let data = data {
completion(.success(data))
} else {
completion(.failure(.invalidData))
}
}.resume()
}
}
| [
-1
] |
378c7eabaac497e66620d29b61bb47566813ed13 | 289604e2a10cb3eb05d4ff8aa054395eb16cd007 | /Sources/Kitura/RouterResponse.swift | a4e655060dea85163a37206dc692c1aee7f60584 | [
"Apache-2.0"
] | permissive | TyrfingMjolnir/Kitura | 01f4fd952e06e06bdc112bed57f81aec5fe9ad12 | 7a7a177dd0889fc9077340b79c6834f4cd36cb16 | refs/heads/master | 2020-01-23T22:01:50.803707 | 2016-11-24T15:45:44 | 2016-11-24T15:45:44 | 74,710,834 | 1 | 0 | null | 2016-11-24T23:22:20 | 2016-11-24T23:22:20 | null | UTF-8 | Swift | false | false | 13,083 | swift | /*
* Copyright IBM Corporation 2016
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import KituraNet
import SwiftyJSON
import Foundation
import LoggerAPI
// MARK: RouterResponse
/// Router response that the server sends as a reply to `RouterRequest`.
public class RouterResponse {
struct State {
/// Whether the response has ended
var invokedEnd = false
/// Whether data has been added to buffer
var invokedSend = false
}
struct Lifecycle {
/// Lifecycle hook called on end()
var onEndInvoked: LifecycleHandler = {}
/// Current pre-write lifecycle handler
var writtenDataFilter: WrittenDataFilter = { body in
return body
}
}
/// The server response
let response: ServerResponse
/// The router
unowned let router: Router
/// The associated request
let request: RouterRequest
/// The buffer used for output
private let buffer = BufferList()
/// State of the request
var state = State()
private var lifecycle = Lifecycle()
/// Set of cookies to return with the response.
public var cookies = [String: HTTPCookie]()
/// Optional error value.
public var error: Swift.Error?
/// HTTP headers of the response.
public var headers: Headers
/// HTTP status code of the response.
public var statusCode: HTTPStatusCode {
get {
return response.statusCode ?? .unknown
}
set(newValue) {
response.statusCode = newValue
}
}
/// Initialize a `RouterResponse` instance
///
/// - Parameter response: The `ServerResponse` object to work with
/// - Parameter router: The `Router` instance that this `RouterResponse` is
/// working with.
/// - Parameter request: The `RouterRequest` object that is paired with this
/// `RouterResponse` object.
init(response: ServerResponse, router: Router, request: RouterRequest) {
self.response = response
self.router = router
self.request = request
headers = Headers(headers: response.headers)
statusCode = .unknown
}
/// End the response.
///
/// - Throws: Socket.Error if an error occurred while writing to a socket.
@discardableResult
public func end() throws {
lifecycle.onEndInvoked()
// Sets status code if unset
if statusCode == .unknown {
statusCode = .OK
}
let content = lifecycle.writtenDataFilter(buffer.data)
let contentLength = headers["Content-Length"]
if contentLength == nil {
headers["Content-Length"] = String(content.count)
}
addCookies()
if request.method != .head {
try response.write(from: content)
}
state.invokedEnd = true
try response.end()
}
/// Add Set-Cookie headers
private func addCookies() {
var cookieStrings = [String]()
for (_, cookie) in cookies {
var cookieString = cookie.name + "=" + cookie.value + "; path=" + cookie.path + "; domain=" + cookie.domain
if let expiresDate = cookie.expiresDate {
cookieString += "; expires=" + SPIUtils.httpDate(expiresDate)
}
if cookie.isSecure {
cookieString += "; secure; HTTPOnly"
}
cookieStrings.append(cookieString)
}
response.headers.append("Set-Cookie", value: cookieStrings)
}
/// Send a string.
///
/// - Parameter str: the string to send.
/// - Returns: this RouterResponse.
@discardableResult
public func send(_ str: String) -> RouterResponse {
let utf8Length = str.lengthOfBytes(using: .utf8)
let bufferLength = utf8Length + 1 // Add room for the NULL terminator
var utf8: [CChar] = Array<CChar>(repeating: 0, count: bufferLength)
if str.getCString(&utf8, maxLength: bufferLength, encoding: .utf8) {
let rawBytes = UnsafeRawPointer(UnsafePointer(utf8))
buffer.append(bytes: rawBytes.assumingMemoryBound(to: UInt8.self), length: utf8Length)
state.invokedSend = true
}
return self
}
/// Send data.
///
/// - Parameter data: the data to send.
/// - Returns: this RouterResponse.
@discardableResult
public func send(data: Data) -> RouterResponse {
buffer.append(data: data)
state.invokedSend = true
return self
}
/// Send a file.
///
/// - Parameter fileName: the name of the file to send.
/// - Throws: An error in the Cocoa domain, if the file cannot be read.
/// - Returns: this RouterResponse.
///
/// - Note: Sets the Content-Type header based on the "extension" of the file.
/// If the fileName is relative, it is relative to the current directory.
@discardableResult
public func send(fileName: String) throws -> RouterResponse {
let data = try Data(contentsOf: URL(fileURLWithPath: fileName))
let contentType = ContentType.sharedInstance.getContentType(forFileName: fileName)
if let contentType = contentType {
headers["Content-Type"] = contentType
}
send(data: data)
return self
}
/// Send JSON.
///
/// - Parameter json: the JSON object to send.
/// - Returns: this RouterResponse.
@discardableResult
public func send(json: JSON) -> RouterResponse {
do {
let jsonData = try json.rawData(options:.prettyPrinted)
headers.setType("json")
send(data: jsonData)
}
catch { } // Do nothing if the JSON to Data fails
return self
}
/// Send JSON with JSONP callback.
///
/// - Parameter json: the JSON object to send.
/// - Parameter callbackParameter: the name of the URL query
/// parameter whose value contains the JSONP callback function.
///
/// - Throws: `JSONPError.invalidCallbackName` if the the callback
/// query parameter of the request URL is missing or its value is
/// empty or contains invalid characters (the set of valid characters
/// is the alphanumeric characters and `[]$._`).
/// - Returns: this RouterResponse.
public func send(jsonp: JSON, callbackParameter: String = "callback") throws -> RouterResponse {
func sanitizeJSIdentifier(_ ident: String) -> String {
return ident.replacingOccurrences(of: "[^\\[\\]\\w$.]", with: "", options:
NSString.CompareOptions.regularExpression)
}
func validJsonpCallbackName(_ name: String?) -> String? {
if let name = name {
if name.characters.count > 0 && name == sanitizeJSIdentifier(name) {
return name
}
}
return nil
}
func jsonToJS(_ json: String) -> String {
// Translate JSON characters that are invalid in javascript
return json.replacingOccurrences(of: "\u{2028}", with: "\\u2028")
.replacingOccurrences(of: "\u{2029}", with: "\\u2029")
}
let jsonStr = jsonp.description
let taintedJSCallbackName = request.queryParameters[callbackParameter]
if let jsCallbackName = validJsonpCallbackName(taintedJSCallbackName) {
headers.setType("js")
// Set header "X-Content-Type-Options: nosniff" and prefix body with
// "/**/ " as security mitigation for Flash vulnerability
// CVE-2014-4671, CVE-2014-5333 "Abusing JSONP with Rosetta Flash"
headers["X-Content-Type-Options"] = "nosniff"
send("/**/ " + jsCallbackName + "(" + jsonToJS(jsonStr) + ")")
} else {
throw JSONPError.invalidCallbackName(name: taintedJSCallbackName)
}
return self
}
/// Set the status code.
///
/// - Parameter status: the HTTP status code object.
/// - Returns: this RouterResponse.
@discardableResult
public func status(_ status: HTTPStatusCode) -> RouterResponse {
response.statusCode = status
return self
}
/// Send the HTTP status code.
///
/// - Parameter status: the HTTP status code.
/// - Returns: this RouterResponse.
public func send(status: HTTPStatusCode) -> RouterResponse {
self.status(status)
send(HTTPURLResponse.localizedString(forStatusCode: status.rawValue))
return self
}
/// Redirect to path with status code.
///
/// - Parameter: the path for the redirect.
/// - Parameter: the status code for the redirect.
/// - Throws: Socket.Error if an error occurred while writing to a socket.
/// - Returns: this RouterResponse.
@discardableResult
public func redirect(_ path: String, status: HTTPStatusCode = .movedTemporarily) throws -> RouterResponse {
headers.setLocation(path)
try self.status(status).end()
return self
}
/// Render a resource using Router's template engine.
///
/// - Parameter resource: the resource name without extension.
/// - Parameter context: a dictionary of local variables of the resource.
/// - Throws: TemplatingError if no file extension was specified or there is no template engine defined for the extension.
/// - Returns: this RouterResponse.
///
// influenced by http://expressjs.com/en/4x/api.html#app.render
@discardableResult
public func render(_ resource: String, context: [String:Any]) throws -> RouterResponse {
let renderedResource = try router.render(template: resource, context: context)
return send(renderedResource)
}
/// Set headers and attach file for downloading.
///
/// - Parameter download: the file to download.
/// - Throws: An error in the Cocoa domain, if the file cannot be read.
public func send(download: String) throws {
try send(fileName: StaticFileServer.ResourcePathHandler.getAbsolutePath(for: download))
headers.addAttachment(for: download)
}
/// Set the pre-flush lifecycle handler and return the previous one.
///
/// - Parameter newOnEndInvoked: The new pre-flush lifecycle handler.
/// - Returns: The old pre-flush lifecycle handler.
public func setOnEndInvoked(_ newOnEndInvoked: @escaping LifecycleHandler) -> LifecycleHandler {
let oldOnEndInvoked = lifecycle.onEndInvoked
lifecycle.onEndInvoked = newOnEndInvoked
return oldOnEndInvoked
}
/// Set the written data filter and return the previous one.
///
/// - Parameter newWrittenDataFilter: The new written data filter.
/// - Returns: The old written data filter.
public func setWrittenDataFilter(_ newWrittenDataFilter: @escaping WrittenDataFilter) -> WrittenDataFilter {
let oldWrittenDataFilter = lifecycle.writtenDataFilter
lifecycle.writtenDataFilter = newWrittenDataFilter
return oldWrittenDataFilter
}
/// Perform content-negotiation on the Accept HTTP header on the request, when present.
///
/// Uses request.accepts() to select a handler for the request, based on the acceptable types ordered by their
/// quality values. If the header is not specified, the default callback is invoked. When no match is found,
/// the server invokes the default callback if exists, or responds with 406 “Not Acceptable”.
/// The Content-Type response header is set when a callback is selected.
///
/// - Parameter callbacks: a dictionary that maps content types to handlers.
/// - Throws: Socket.Error if an error occurred while writing to a socket.
public func format(callbacks: [String : ((RouterRequest, RouterResponse) -> Void)]) throws {
let callbackTypes = Array(callbacks.keys)
if let acceptType = request.accepts(types: callbackTypes) {
headers["Content-Type"] = acceptType
callbacks[acceptType]!(request, self)
} else if let defaultCallback = callbacks["default"] {
defaultCallback(request, self)
} else {
try status(.notAcceptable).end()
}
}
}
/// Type alias for "Before flush" (i.e. before headers and body are written) lifecycle handler.
public typealias LifecycleHandler = () -> Void
/// Type alias for written data filter, i.e. pre-write lifecycle handler.
public typealias WrittenDataFilter = (Data) -> Data
| [
-1
] |
8f1ada9325527a4e5e161daa8d37ca0b5edd6d68 | 407db077298f295276842d49192570f3dec40891 | /Breakout/AppDelegate.swift | f75e5a7b512376607de3fc6c3d437cf0d408a6ce | [] | no_license | AlexShubin/Breakout | 36298a78d114189b8eeaeece80ea4b1685d84de5 | 7475080cf0d1477350cfa42ff396f4ea4f5655e1 | refs/heads/master | 2021-01-04T02:43:06.466898 | 2019-11-29T07:57:39 | 2019-11-29T07:57:39 | 75,653,302 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,826 | swift | //
// AppDelegate.swift
// Breakout
//
// Created by ashubin on 28.11.19.
// Copyright © 2019 Alex Shubin. 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.
}
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.
}
}
| [
229383,
229385,
229388,
294924,
327695,
229391,
229394,
229397,
229399,
229402,
229405,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
229428,
286774,
229432,
204856,
286776,
319544,
286778,
352318,
286791,
237640,
286797,
237646,
311375,
163920,
196692,
319573,
319590,
311400,
303212,
131192,
237693,
327814,
131209,
303241,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
295110,
286922,
286924,
286926,
319694,
131281,
295133,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
237826,
319751,
286987,
319757,
286999,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
311601,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
229717,
196963,
139638,
213367,
106872,
319872,
311683,
311693,
65938,
319898,
311719,
139689,
311728,
311741,
319938,
319945,
188895,
287202,
172520,
319978,
172526,
311791,
172529,
319989,
180727,
287230,
303617,
287234,
172550,
320007,
303623,
172558,
303632,
303637,
172572,
172577,
295459,
172581,
295461,
172591,
172607,
172612,
172614,
172618,
303690,
33357,
254563,
172644,
311911,
172656,
295538,
172660,
287349,
287355,
295553,
172675,
295557,
311942,
352905,
311946,
287371,
311951,
287377,
287381,
311957,
287386,
221850,
230045,
172702,
287390,
172705,
287394,
172707,
303780,
287398,
287400,
172714,
295595,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
328381,
287423,
328384,
164546,
172748,
295633,
172755,
303827,
287450,
303835,
189149,
303838,
312035,
295654,
230128,
189169,
312048,
312050,
205564,
303871,
230146,
295685,
230154,
312077,
295695,
295701,
295707,
328476,
295710,
230175,
303914,
230202,
222018,
295755,
377676,
148302,
287569,
230237,
230241,
303976,
336744,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
304009,
304011,
189325,
304013,
295822,
189329,
304019,
58262,
304023,
213931,
189367,
230327,
304055,
287675,
230334,
304063,
304065,
213954,
156612,
312272,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
230413,
320528,
140312,
295961,
238620,
304170,
238641,
238652,
238655,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
148575,
230497,
296036,
296040,
312432,
189562,
337018,
66690,
296084,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
304311,
230592,
410820,
312518,
230600,
230607,
320727,
304348,
304354,
296163,
320740,
304360,
320748,
304370,
296189,
320771,
312585,
296205,
230674,
320786,
230677,
296213,
230679,
320792,
230681,
296215,
312622,
296243,
312630,
296253,
230718,
296255,
312639,
296259,
296262,
230727,
296264,
320840,
238919,
296267,
296271,
312663,
222556,
337244,
230752,
312676,
230760,
410987,
148843,
230763,
230768,
296305,
312692,
230773,
181626,
304506,
312711,
296331,
230800,
288144,
288154,
288162,
288164,
304555,
173488,
288176,
312755,
312759,
288185,
222652,
312766,
173507,
230860,
312783,
288208,
230865,
148946,
222676,
329177,
239070,
288229,
320998,
288232,
296435,
288250,
296446,
402942,
296450,
230916,
230919,
304651,
230923,
304653,
402969,
222752,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
288338,
288344,
239194,
403039,
239202,
370279,
312938,
116354,
288408,
419489,
321195,
296622,
321200,
337585,
296634,
370365,
296637,
419522,
419525,
206536,
206539,
206541,
206543,
263888,
321239,
313052,
288478,
313055,
419555,
313066,
288494,
321266,
288499,
288502,
288510,
198405,
288519,
198416,
296723,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
321336,
288576,
345921,
337732,
304968,
173907,
313176,
321381,
296809,
296812,
313201,
305028,
124817,
239510,
124827,
214940,
247709,
214944,
321458,
296883,
124853,
214966,
296890,
288700,
296894,
296900,
337862,
165831,
354265,
296921,
354270,
239586,
354281,
231404,
124913,
165876,
321528,
288764,
313340,
239617,
313347,
313358,
305176,
313371,
305191,
223273,
313386,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
288848,
215123,
288855,
288859,
280669,
280671,
149599,
149601,
321634,
149603,
280681,
280687,
215154,
313458,
313464,
321659,
288895,
321670,
215175,
141455,
280725,
313498,
100520,
280747,
288947,
321717,
321740,
313557,
338147,
280804,
125171,
182517,
280825,
125187,
125191,
125207,
321817,
125209,
125218,
321842,
223539,
125239,
280891,
289087,
239944,
305480,
239947,
305485,
305489,
248153,
215387,
354653,
313700,
190832,
223606,
313720,
215422,
199051,
289166,
240017,
297363,
297365,
297368,
297372,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
281024,
289218,
436684,
166378,
305647,
174580,
305662,
305664,
240129,
305666,
330244,
305668,
240132,
223749,
223752,
338440,
150025,
223757,
223763,
223765,
150066,
158266,
289342,
322115,
338532,
19053,
158317,
313973,
297594,
158347,
264845,
182926,
182929,
117398,
314007,
289436,
174754,
330404,
289448,
314029,
314033,
240309,
314047,
314051,
297671,
158409,
256716,
289493,
289513,
289532,
322303,
289537,
322310,
322314,
322318,
322341,
215850,
289593,
289601,
240468,
322393,
174955,
224110,
207733,
207737,
183172,
338823,
322440,
314249,
142226,
224151,
240535,
289687,
289694,
289696,
289700,
289712,
281529,
289724,
420829,
289762,
322534,
297961,
183277,
412659,
322550,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314456,
314461,
314474,
248995,
306341,
306347,
306354,
199877,
289991,
306377,
289997,
249045,
363742,
330988,
216303,
322801,
388350,
175360,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
224587,
224594,
216404,
306517,
150870,
314714,
314718,
314723,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
298372,
314756,
298377,
314763,
314768,
224657,
314773,
306581,
314779,
314785,
314793,
241068,
241070,
241072,
298424,
306618,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
191985,
241142,
191992,
290298,
151036,
290302,
290305,
192008,
290321,
290325,
241175,
290328,
290332,
241181,
290344,
290349,
290351,
290356,
224849,
306778,
323176,
224875,
241260,
315016,
290445,
282255,
175770,
298651,
323229,
298655,
192163,
323260,
323266,
241362,
306904,
52959,
241380,
323304,
306945,
241412,
323333,
323345,
323349,
315167,
315174,
323367,
241448,
306988,
306991,
323376,
315190,
159545,
307009,
307012,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
110438,
298860,
110445,
315249,
315253,
315255,
339838,
315267,
315269,
241544,
241546,
241548,
298896,
298898,
44948,
241556,
298901,
241560,
241563,
241565,
241567,
241569,
241574,
241581,
241583,
323504,
241586,
290739,
241588,
241590,
241592,
241598,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
315396,
241669,
315397,
241693,
102438,
217127,
290877,
315463,
315466,
192589,
307287,
315482,
315483,
217179,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
299126,
233591,
45181,
307329,
307338,
299164,
241821,
299167,
184486,
307370,
307374,
307376,
299185,
323763,
184503,
307385,
258235,
307388,
307390,
307394,
299204,
307396,
184518,
307399,
323784,
307409,
307411,
299225,
233701,
307432,
291104,
233766,
307508,
315701,
307510,
332086,
307512,
307515,
307518,
323917,
233808,
323921,
315733,
323926,
233815,
315739,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
291226,
242075,
291231,
61855,
291238,
127403,
127405,
127407,
291247,
299444,
127413,
291254,
127417,
291260,
127421,
127424,
299457,
315856,
315860,
127447,
299481,
176605,
242143,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
291314,
291317,
135672,
233979,
291323,
291330,
127497,
135689,
233994,
127500,
233998,
127506,
234003,
234006,
152087,
127511,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
152118,
234038,
234041,
315961,
70213,
111193,
242275,
299620,
242279,
184952,
135805,
135808,
299655,
135820,
316051,
316054,
299672,
135834,
373404,
135839,
135844,
299684,
242343,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
201444,
299750,
234219,
185074,
316151,
242431,
234242,
299778,
234246,
291593,
242443,
234252,
242445,
291601,
234258,
242450,
242452,
201496,
234264,
234266,
234272,
152355,
299814,
234287,
185138,
234296,
160572,
234302,
234307,
316233,
316235,
234319,
234324,
201557,
308063,
234336,
242530,
234344,
234347,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
291711,
234370,
291714,
291716,
234373,
308105,
234390,
324504,
209818,
308123,
234396,
324508,
291742,
234401,
291747,
291748,
234405,
324518,
291750,
324520,
234410,
324522,
291754,
291756,
324527,
291760,
234417,
201650,
324531,
234422,
324536,
291773,
234431,
324544,
242623,
234434,
324546,
324548,
234443,
193486,
234446,
193488,
234449,
234452,
234455,
234464,
168935,
324585,
316400,
234481,
316403,
234485,
234487,
234496,
316416,
234504,
234507,
300054,
234519,
234520,
316439,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234546,
234549,
300085,
300088,
234553,
234558,
316479,
234561,
234563,
308291,
316491,
234572,
300108,
234574,
300115,
242777,
234593,
234597,
300133,
300139,
234605,
160879,
234610,
300148,
144506,
234620,
242822,
177293,
234640,
308373,
324757,
234647,
234648,
234650,
308379,
234653,
300189,
119967,
324766,
324768,
300197,
177318,
234667,
316596,
234687,
300226,
234692,
283844,
300229,
308422,
308420,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
300263,
300265,
300267,
300270,
300272,
300278,
316663,
275703,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
234760,
349451,
177419,
300299,
300301,
242957,
177424,
275725,
349464,
415009,
292143,
300344,
243003,
300357,
177482,
316758,
357722,
316766,
316768,
292192,
292197,
316774,
136562,
333178,
316803,
316806,
316811,
316814,
300433,
234899,
357783,
316824,
316826,
300448,
144810,
144812,
144814,
144820,
292279,
144826,
144830,
144832,
144835,
144837,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
300527,
308720,
292338,
316917,
292343,
300537,
316933,
316947,
308757,
308762,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
284215,
316983,
194103,
284218,
284223,
284226,
243268,
284228,
292421,
284231,
284234,
284238,
284241,
194130,
300628,
284245,
284247,
317015,
235097,
243290,
284249,
300638,
292452,
292458,
284272,
284274,
284278,
292470,
292473,
284283,
284286,
292479,
284288,
284290,
325250,
284292,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
284308,
284312,
284314,
284316,
284320,
284322,
284327,
284329,
317098,
284331,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
284354,
358083,
284358,
358089,
284362,
284368,
284370,
358098,
317138,
358114,
358116,
358119,
325353,
358122,
358126,
358128,
358133,
358135,
358138,
300795,
358140,
358142,
358146,
317187,
317189,
317191,
300816,
300819,
317207,
300828,
300832,
325408,
300834,
317221,
358183,
243504,
325436,
366406,
300872,
153417,
292681,
358224,
350035,
317271,
292700,
292715,
300912,
292721,
300915,
292729,
317306,
292734,
325512,
399252,
358292,
317332,
358312,
317353,
358326,
358330,
301011,
301013,
292823,
301015,
358360,
301017,
292828,
178147,
292839,
350186,
292843,
292845,
350200,
325624,
317435,
350210,
178181,
350218,
350222,
317456,
317458,
243733,
243740,
317468,
325666,
243751,
292904,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
178238,
243779,
292934,
243785,
350293,
350295,
309337,
350302,
178273,
309346,
194660,
350308,
309348,
309350,
292968,
350313,
309354,
309352,
350316,
301163,
301167,
350321,
350325,
350328,
292985,
350332,
292989,
301185,
292993,
350339,
317570,
350342,
350345,
350349,
317584,
325777,
350357,
350359,
350362,
350366,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
350402,
301252,
350406,
301258,
309450,
309455,
309462,
301272,
309468,
309471,
301283,
317672,
317674,
325867,
243960,
325910,
309530,
342298,
211241,
325937,
325943,
211260,
235853,
235858,
391523,
293227,
293232,
186744,
285061,
366983,
317833,
317853,
342434,
317858,
235955,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
293346,
293352,
236013,
293364,
293370,
301562,
317951,
309764,
301575,
342541,
113167,
309779,
309781,
293417,
227882,
309804,
293421,
236082,
23094,
219714,
318020,
301636,
301639,
301643,
309844,
326244,
318055,
309871,
121458,
309885,
309888,
301706,
318092,
326285,
318094,
334476,
334488,
318108,
318110,
137889,
383658,
318128,
293555,
318132,
318144,
342745,
137946,
342747,
342749,
113378,
342760,
56043,
56045,
56059,
310015,
310029,
293659,
326430,
293666,
318248,
293677,
318253,
293685,
301880,
301884,
293696,
310080,
310100,
301921,
162671,
310134,
236408,
416639,
416640,
113538,
310147,
416648,
301972,
277411,
310179,
293798,
293802,
236460,
293811,
293820,
342994,
293849,
318442,
228332,
326638,
351217,
293876,
285686,
121850,
293882,
302075,
293908,
293917,
293939,
318516,
293956,
293960,
310344,
203857,
293971,
310359,
236632,
310374,
203879,
310376,
318573,
203886,
367737,
302205,
253057,
392326,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
351392,
302248,
64682,
294063,
302258,
294072,
318651,
318657,
244930,
130244,
302277,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
302315,
294132,
138485,
204026,
64768,
310531,
138505,
318742,
130345,
384302,
285999,
318773,
318776,
417086,
294211,
302403,
384328,
146765,
326991,
294223,
294246,
327015,
310632,
327017,
351607,
310651,
310657,
310659,
351619,
310665,
318858,
310672,
351633,
310689,
130468,
310703,
130486,
310710,
310712,
310715,
302526,
302534,
245191,
310727,
302541,
302543,
310737,
310749,
310755,
310764,
310772,
40440,
286203,
40443,
40448,
286214,
302603,
302614,
302617,
302621,
187936,
286240,
187939,
40484,
294435,
40486,
286246,
245288,
196133,
294439,
40491,
294440,
294443,
294445,
40488,
310831,
40499,
40502,
212538,
40507,
40511,
40521,
40525,
40527,
212560,
400976,
40533,
40537,
40541,
40544,
40550,
40552,
40554,
40557,
40560,
294521,
343679,
310925,
327333,
229030,
302764,
319153,
302781,
302789,
294599,
294601,
302793,
212690,
319187,
286420,
286425,
319194,
294625,
294634,
302838,
319226,
286460,
302852,
302854,
311048,
294664,
319243,
311053,
302862,
319251,
294682,
188199,
294701,
319280,
319290,
229192,
302925,
188247,
237409,
229233,
294776,
294785,
360322,
327554,
319390,
319394,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
393190,
311279,
237555,
311283,
237562
] |
e17dfeec7edd7b84123af153e95b49d71b5eed10 | a4688bf3922a5aef2444afc4000d672f35250bdc | /LikeAppStore/Views/Music/MusicLoadigFooter.swift | 4ac75b4e26d53d0942f791749ab208914df46bab | [] | no_license | mohsinalimat/LikeAppStore | 13250eb12d834a17823c89e17804597a3bcc6489 | 0e45b9a0e9665a891c9e58db72fe509404a2235f | refs/heads/master | 2021-01-04T09:42:16.854681 | 2019-06-20T13:13:06 | 2019-06-20T13:13:06 | 240,494,062 | 1 | 0 | null | 2020-02-14T11:32:24 | 2020-02-14T11:32:23 | null | UTF-8 | Swift | false | false | 962 | swift | //
// MusicLoadigFooter.swift
// LikeAppStore
//
// Created by ivica petrsoric on 15/06/2019.
// Copyright © 2019 ivica petrsoric. All rights reserved.
//
import UIKit
class MusicLoadigFooter: UICollectionReusableView {
override init(frame: CGRect) {
super.init(frame: frame)
let aiv = UIActivityIndicatorView(style: .whiteLarge)
aiv.color = .darkGray
aiv.startAnimating()
let label = UILabel(text: "Loading more...", font: .systemFont(ofSize: 14))
label.textAlignment = .center
let stackView = VerticalStackView(arrangedSubviews: [
aiv, label
], spacing: 8)
stackView.alignment = .center
addSubview(stackView)
stackView.centerInSuperview(size: .init(width: 200, height: 0))
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
bf169c2bbab1080e41fd444cf37cf626ab7a19a6 | 4444fdb87c60baf038b83c4ffd1d02f3071b8060 | /stdlib/public/core/FlatMap.swift | caa7805cabf103ae97457102ed7ae4ace963836d | [
"Apache-2.0",
"Swift-exception"
] | permissive | inevs/swift | 1762762de1d8fd388b1b810dff4f55a68157c1af | 7ae082578101454f29648a0e40d6b898a7dea5d7 | refs/heads/master | 2020-05-25T19:23:35.166682 | 2016-07-29T06:09:05 | 2016-07-29T06:09:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,221 | swift | //===--- FlatMap.swift ----------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
extension LazySequenceProtocol {
/// Returns the concatenated results of mapping `transform` over
/// `self`. Equivalent to
///
/// self.map(transform).joined()
///
/// - Complexity: O(1)
public func flatMap<SegmentOfResult : Sequence>(
_ transform: (Elements.Iterator.Element) -> SegmentOfResult
) -> LazySequence<
FlattenSequence<LazyMapSequence<Elements, SegmentOfResult>>> {
return self.map(transform).joined()
}
/// Returns a `LazyMapSequence` containing the concatenated non-nil
/// results of mapping transform over this `Sequence`.
///
/// Use this method to receive only nonoptional values when your
/// transformation produces an optional value.
///
/// - Parameter transform: A closure that accepts an element of this
/// sequence as its argument and returns an optional value.
public func flatMap<ElementOfResult>(
_ transform: (Elements.Iterator.Element) -> ElementOfResult?
) -> LazyMapSequence<
LazyFilterSequence<
LazyMapSequence<Elements, ElementOfResult?>>,
ElementOfResult
> {
return self.map(transform).filter { $0 != nil }.map { $0! }
}
}
extension LazyCollectionProtocol {
/// Returns the concatenated results of mapping `transform` over
/// `self`. Equivalent to
///
/// self.map(transform).joined()
///
/// - Complexity: O(1)
public func flatMap<SegmentOfResult : Collection>(
_ transform: (Elements.Iterator.Element) -> SegmentOfResult
) -> LazyCollection<
FlattenCollection<
LazyMapCollection<Elements, SegmentOfResult>>
> {
return self.map(transform).joined()
}
/// Returns a `LazyMapCollection` containing the concatenated non-nil
/// results of mapping transform over this collection.
///
/// Use this method to receive only nonoptional values when your
/// transformation produces an optional value.
///
/// - Parameter transform: A closure that accepts an element of this
/// collection as its argument and returns an optional value.
public func flatMap<ElementOfResult>(
_ transform: (Elements.Iterator.Element) -> ElementOfResult?
) -> LazyMapCollection<
LazyFilterCollection<
LazyMapCollection<Elements, ElementOfResult?>>,
ElementOfResult
> {
return self.map(transform).filter { $0 != nil }.map { $0! }
}
}
extension LazyCollectionProtocol
where
Self : BidirectionalCollection,
Elements : BidirectionalCollection
{
/// Returns the concatenated results of mapping `transform` over
/// `self`. Equivalent to
///
/// self.map(transform).joined()
///
/// - Complexity: O(1)
public func flatMap<SegmentOfResult : Collection>(
_ transform: (Elements.Iterator.Element) -> SegmentOfResult
) -> LazyCollection<
FlattenBidirectionalCollection<
LazyMapBidirectionalCollection<Elements, SegmentOfResult>>>
where SegmentOfResult : BidirectionalCollection {
return self.map(transform).joined()
}
/// Returns a `LazyMapBidirectionalCollection` containing the concatenated non-nil
/// results of mapping transform over this collection.
///
/// Use this method to receive only nonoptional values when your
/// transformation produces an optional value.
///
/// - Parameter transform: A closure that accepts an element of this
/// collection as its argument and returns an optional value.
public func flatMap<ElementOfResult>(
_ transform: (Elements.Iterator.Element) -> ElementOfResult?
) -> LazyMapBidirectionalCollection<
LazyFilterBidirectionalCollection<
LazyMapBidirectionalCollection<Elements, ElementOfResult?>>,
ElementOfResult
> {
return self.map(transform).filter { $0 != nil }.map { $0! }
}
}
| [
91515
] |
0cf6e4f546408afb858971fadee608808b7bf70e | 2531b3491effd55ee0c319f5a450935bd605c443 | /Grocery List/ViewController.swift | 4785c3831d215239e5682fc04e43b62e4517ceaf | [] | no_license | aashanashah/grocery-list | 4d6cfc5ff32a443e428791dbd1a37e9cbce8f132 | c93488f857ecd0d4e2ae24b0f0ab71a82bac1edd | refs/heads/master | 2021-07-01T16:49:09.629636 | 2019-03-11T23:03:54 | 2019-03-11T23:03:54 | 109,911,026 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 15,148 | swift | //
// ViewController.swift
// Grocery List
//
// Created by Aashana on 11/6/17.
// Copyright © 2017 Aashana. All rights reserved.
//
import UIKit
import CoreData
import UserNotifications
import UserNotificationsUI
import CoreLocation
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate {
@IBOutlet var addList : UIButton!
@IBOutlet var arrowNav : UIImageView!
@IBOutlet var listName : UITableView!
@IBOutlet var editButton : UIBarButtonItem!
@IBOutlet var cancelButton : UIBarButtonItem!
let cellReuseIdentifier = "ListNameTableViewCell"
var listNames : [String]!
var places : [String]!
var ids : [String]!
var locationManager : CLLocationManager = CLLocationManager()
var delete = 0
var deleteIndexes : [Int]!
override func viewDidLoad()
{
super.viewDidLoad()
addList.layer.cornerRadius = 10
addList.layer.borderWidth = 1
addList.layer.borderColor = UIColor.black.cgColor
self.title = "Lists"
// 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.
}
override func viewWillAppear(_ animated: Bool) {
listNames = [String]()
places = [String]()
ids = [String]()
editButton.title = "Edit"
editButton.tintColor = .black
listName.isEditing = false
cancelButton.tintColor = .black
cancelButton.isEnabled = false
listName.allowsMultipleSelectionDuringEditing = false
retrievedata()
}
@IBAction func addList(sender : UIButton!)
{
let listItemsViewController = self.storyboard?.instantiateViewController(withIdentifier: "ListItemsViewController") as! ListItemsViewController
listItemsViewController.flag = 0
UserDefaults.standard.set(nil, forKey: "Place")
UserDefaults.standard.set(nil, forKey: "Latitude")
UserDefaults.standard.set(nil, forKey: "Longitude")
self.navigationController?.pushViewController(listItemsViewController, animated: true)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return listNames.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell:ListNameTableViewCell = self.listName.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as! ListNameTableViewCell
cell.name.text = (" \(ids[indexPath.row]). \(listNames[indexPath.row])")
cell.address.text = places[indexPath.row]
cell.preservesSuperviewLayoutMargins = false
cell.separatorInset = UIEdgeInsets.zero
cell.layoutMargins = UIEdgeInsets.zero
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
if tableView.isEditing
{
deleteIndexes.append(indexPath.row)
print(deleteIndexes)
}
else
{
let listItemsViewController = self.storyboard?.instantiateViewController(withIdentifier: "ListItemsViewController") as! ListItemsViewController
listItemsViewController.name = listNames[indexPath.row]
listItemsViewController.itemId = Int(ids[indexPath.row])
listItemsViewController.flag = 1
self.navigationController?.pushViewController(listItemsViewController, animated: true)
}
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
if tableView.isEditing
{
if let index = deleteIndexes.index(of:indexPath.row) {
deleteIndexes.remove(at: index)
}
print(deleteIndexes)
}
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
{
return true
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath)
{
if (editingStyle == UITableViewCellEditingStyle.delete)
{
// handle delete (by removing the data from your array and updating the tableview)
listNames.remove(at: indexPath.row)
places.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
deleteData(id : indexPath.row+1)
}
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
{
let footerView = UIView(frame: CGRect(x:0, y:0, width:Int(tableView.frame.size.width), height:Int(tableView.frame.size.height)))
footerView.backgroundColor = .clear
return footerView
}
func retrievedata()
{
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let request:NSFetchRequest<List>
request = NSFetchRequest<List>(entityName: "List")
let requestItems:NSFetchRequest<Items>
requestItems = NSFetchRequest<Items>(entityName: "Items")
do
{
let entities = try appDelegate.managedObjectContext?.fetch(request)
for item in entities!
{
//for key in item.entity.attributesByName.keys
//{
//if key == "name"
//{
let nameValue: Any? = item.value(forKey: "name")
let IdValue: Any? = item.value(forKey: "id")
if nameValue == nil
{
listNames.append("a")
}
else
{
listNames.append("\(nameValue!)")
}
//}
//else
//{
if IdValue == nil
{
ids.append("no")
}
else
{
ids.append("\(IdValue!)")
}
//}
//}
}
self.listName.reloadData()
}catch{
print("Unable to retrieve data")
}
do
{
let entities = try appDelegate.managedObjectContext?.fetch(requestItems)
for item in entities!
{
//for key in item.entity.attributesByName.keys
// {
if ids.contains("\(item.value(forKey: "id")!)")
{
let place = "\(item.value(forKey: "place")!)"
if place == ""
{
places.append("No Store Selected")
}
else
{
places.append(place)
}
//}
}
}
self.listName.reloadData()
}catch{
print("Unable to retrieve data")
}
if listNames.count == 0
{
arrowNav.isHidden = false
listName.isHidden = true
editButton.isEnabled = false
}
else
{
arrowNav.isHidden = true
listName.isHidden = false
editButton.isEnabled = true
}
}
func deleteData(id : Int)
{
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let requestList:NSFetchRequest<List>
requestList = NSFetchRequest<List>(entityName: "List")
let requestItems:NSFetchRequest<Items>
requestItems = NSFetchRequest<Items>(entityName: "Items")
do
{
let entities = try appDelegate.managedObjectContext?.fetch(requestList)
let context = appDelegate.managedObjectContext
for item in entities!
{
for key in item.entity.attributesByName.keys
{
if key == "id" && item.value(forKey: key) as? Int! == id
{
context?.delete(item)
}
}
}
do {
try context?.save()
print("saved!")
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
}catch{
print("Unable to retrieve data")
}
do
{
let entities = try appDelegate.managedObjectContext?.fetch(requestItems)
let context = appDelegate.managedObjectContext
for item in entities!
{
for key in item.entity.attributesByName.keys
{
if key == "id" && item.value(forKey: key) as? Int! == id
{
if let loc = item.value(forKey: "geotification")
{
let location = "\(loc)"
let arr = location.split(separator: "+").map(String.init)
let lat = Double(arr[0])!
let long = Double(arr[1])!
let geo = CLLocationCoordinate2DMake(lat, long);
let region = CLCircularRegion(center: geo , radius: 200, identifier: arr[2])
locationManager.stopMonitoring(for: region)
}
context?.delete(item)
}
}
}
do {
try context?.save()
print("saved!")
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
self.listName.reloadData()
}catch{
print("Unable to retrieve data")
}
if listNames.count == 0
{
arrowNav.isHidden = false
listName.isHidden = true
editButton.isEnabled = false
}
else
{
arrowNav.isHidden = true
listName.isHidden = false
editButton.isEnabled = true
}
updateID()
}
func updateID()
{
var newID = 1
var geoid = 1
ids = [String]()
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let requestList:NSFetchRequest<List>
requestList = NSFetchRequest<List>(entityName: "List")
let requestItems:NSFetchRequest<Items>
requestItems = NSFetchRequest<Items>(entityName: "Items")
do
{
let entities = try appDelegate.managedObjectContext?.fetch(requestItems)
let context = appDelegate.managedObjectContext
for item in entities!
{
for key in item.entity.attributesByName.keys
{
if key == "id"
{
item.id = Int16(newID)
ids.append("\(item.id)")
print(newID)
newID += 1
}
if key == "geotification"
{
if let geotification = item.geotification
{
let arr = geotification.split(separator: "+").map(String.init)
let lat = Double(arr[0])!
let long = Double(arr[1])!
let geo = CLLocationCoordinate2DMake(lat, long);
let region = CLCircularRegion(center: geo , radius: 200, identifier: arr[2])
locationManager.stopMonitoring(for: region)
let geonew = arr[2].split(separator: "@")
let newregion = CLCircularRegion(center:geo , radius: 200, identifier: "\(geonew[0])@\(geoid)")
locationManager.startMonitoring(for: newregion)
item.setValue("\(lat)+\(long)+\(region.identifier)", forKey: "geotification")
}
print(geoid)
geoid += 1
}
}
}
do {
try context?.save()
print("saved!")
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
}catch{
print("Unable to retrieve data")
}
newID = 1
do
{
let entities = try appDelegate.managedObjectContext?.fetch(requestList)
let context = appDelegate.managedObjectContext
for item in entities!
{
for key in item.entity.attributesByName.keys
{
if key == "id"
{
item.id = Int16(newID)
newID += 1
}
}
}
do {
try context?.save()
print("saved!")
} catch let error as NSError {
print("Could not save \(error), \(error.userInfo)")
}
}catch{
print("Unable to retrieve data")
}
}
@IBAction func edit(sender : UIBarButtonItem)
{
if sender.title != "Edit"
{
deleteIndexes.sort(by: >)
for index in deleteIndexes
{
listNames.remove(at: index)
places.remove(at: index)
deleteData(id : index+1)
listName.reloadData()
}
sender.title = "Edit"
sender.tintColor = .black
cancelButton.isEnabled = false
listName.isEditing = false
listName.allowsMultipleSelectionDuringEditing = false
}
else
{
print(listNames)
print(places)
sender.title = "Delete"
sender.tintColor = .red
cancelButton.isEnabled = true
deleteIndexes = [Int]()
listName.isEditing = true
listName.allowsMultipleSelectionDuringEditing = true
}
self.listName.reloadData()
}
@IBAction func cancel(sender: UIBarButtonItem)
{
editButton.title = "Edit"
deleteIndexes = [Int]()
editButton.tintColor = .black
cancelButton.isEnabled = false
listName.isEditing = false
listName.allowsMultipleSelectionDuringEditing = false
}
}
| [
-1
] |
e91fc21b22ef69095b824834c2e184c8c84f20d6 | 946ac783f52c72b05919fadf5ad344ce141a3114 | /DouYuZB/DouYuZB/Classes/Home/View/CollectionViewCycleCell.swift | afe41db91e5cc62bce38e02762f605c4ff38d42e | [
"MIT"
] | permissive | lewnick/DYZB | 2676e4faf1009abe883bc340caab7054db8d6688 | 5a15a133047cc5b13412578d8561e1d047b1950d | refs/heads/master | 2020-03-27T00:59:26.994788 | 2019-03-21T13:19:57 | 2019-03-21T13:19:57 | 145,672,650 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 776 | swift | //
// CollectionViewCycleCell.swift
// DouYuZB
//
// Created by NicGe on 2019/3/7.
// Copyright © 2019 NicGe. All rights reserved.
//
import UIKit
import Kingfisher
class CollectionViewCycleCell: UICollectionViewCell {
//添加控件属性
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
//定义模型属性
var cyclemodel : CycleModel?{
didSet{
titleLabel.text = cyclemodel?.title
imageView.kf.setImage(with: URL(string: cyclemodel?.pic_url ?? "Img_default"))
// let imageurl : urlWebString2UIImage = urlWebString2UIImage()
// imageView.image = imageurl.loadWebImage(urlString: cyclemodel?.pic_url ?? "Img_default")
}
}
}
| [
-1
] |
d64e292acedaafe237290b45f1163f3eb1262d6c | 58b5c76d7b2dba9546fefae267b6786299c50bc7 | /AFSample/AppDelegate.swift | bea0c4faaece551e7598d716844bfbde5a3b66c4 | [] | no_license | jaymar85/AFSample | 59458ad43ea185658f0af73d9482f6275c767ee5 | 870f6f053aa775fffc72cec3e8a6e5b39efa6d2f | refs/heads/master | 2021-05-21T21:47:12.547558 | 2020-04-03T18:59:52 | 2020-04-03T18:59:52 | 252,816,017 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,414 | swift | //
// AppDelegate.swift
// AFSample
//
// Created by Jeremy Mark on 4/3/20.
// Copyright © 2020 Jeremy Mark. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
163891,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
336123,
418043,
336128,
385280,
262404,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
328206,
410128,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
352821,
188987,
418363,
369223,
385609,
385616,
352856,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
336512,
148105,
377484,
352918,
98968,
344744,
361129,
385713,
434867,
164534,
336567,
328378,
328386,
352968,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
222128,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328702,
328714,
361489,
386069,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
386285,
328941,
386291,
345376,
345379,
410917,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181649,
181654,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
361960,
329194,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
337592,
419512,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
141051,
337659,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
248111,
362822,
436555,
190796,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
264918,
183005,
256734,
338660,
338664,
264941,
363251,
207619,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
330748,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
248985,
339097,
44197,
380070,
339112,
249014,
330958,
330965,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
372015,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
249312,
339424,
339428,
339434,
69113,
372228,
339461,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
339588,
126596,
421508,
224904,
159374,
11918,
339601,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
257716,
257720,
257724,
257732,
339662,
257747,
224981,
224993,
257761,
224999,
339695,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
372499,
167700,
225043,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
397112,
225082,
397115,
225087,
225092,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
257896,
274280,
257901,
225137,
257908,
225141,
257912,
257916,
257920,
339844,
225165,
397200,
225170,
380822,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
421960,
356439,
430180,
421990,
266350,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
356740,
332172,
373145,
340379,
389550,
266687,
340451,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
324139,
356907,
324142,
356916,
324149,
324155,
348733,
324160,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
119674,
324475,
340858,
340861,
324478,
324481,
373634,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
5046,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
431106,
209943,
250914,
357410,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
341113,
210044,
349308,
152703,
160895,
349311,
210052,
210055,
349319,
210067,
210071,
210077,
210080,
210084,
251044,
185511,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
251128,
218360,
275706,
275712,
275715,
275721,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
333399,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
153227,
333498,
333511,
210631,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
399206,
358255,
399215,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
260289,
350410,
260298,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
268559,
350480,
432405,
350486,
350490,
325914,
325917,
350493,
350498,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
350822,
334465,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
391894,
154328,
416473,
64230,
342766,
375535,
203506,
342776,
391937,
326416,
375568,
375571,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
326502,
375656,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
351423,
384191,
384198,
326855,
244937,
384201,
253130,
343244,
384208,
146642,
384224,
359649,
343270,
351466,
384246,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
384283,
245020,
384288,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
245525,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
327654,
253926,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
4d3e06dfa2c64bb0a3659e15782342a195b544fd | 9da29a1f322582fcf7f153683cb6546b53fa388f | /level-1/Sum-of-two-integers/devny.swift | 598f728b1b142c68521c20a8af3cbd385cd03f4b | [] | no_license | boridevna/baobab-algorithm-study | 032b6372d313bdd3564896e51426a55d51d91b1f | a868e32acedf813f0861b103d091e19bcbdf3227 | refs/heads/master | 2020-04-17T04:22:24.766767 | 2019-03-22T07:39:24 | 2019-03-22T07:39:24 | 166,227,206 | 0 | 3 | null | 2019-03-22T07:33:12 | 2019-01-17T13:06:41 | Java | UTF-8 | Swift | false | false | 103 | swift | func solution(_ a:Int, _ b:Int) -> Int64 {
return Int64((a+b) * (max(a, b) - min(a, b) + 1) / 2)
}
| [
-1
] |
6cd0f60d10322714f2b7251539de5e05d67acc8c | 1de82f0ec3cc8ce59f236ca0435f79ebb04b6fc6 | /LockID Portal/Components/Bluetooth/BluetoothViewController.swift | 5ef75ae514454e8f5275a5bbbd973a1142dcc63c | [] | no_license | PaulDanielsons/LockID_iOS | 82d6812adc795d9f2a82dd95d0810d7cb5ac5e21 | a749f87b20f52b015e1df38d87739f6dd334e5fe | refs/heads/master | 2020-05-16T19:53:50.540925 | 2019-04-24T17:33:11 | 2019-04-24T17:33:11 | 183,273,411 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,443 | swift | //
// BluetoothViewController.swift
// LockID Portal
//
// Copyright © 2019 Paul Danielsons. All rights reserved.
// Partial code is sourced from Udemy.com
//
//
import UIKit
import CoreBluetooth
class BluetoothViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, CBCentralManagerDelegate {
var centralManager : CBCentralManager?
var strength = "Error"
var names : [String] = []
var RSSIs : [NSNumber] = []
var signalStregth : [String] = []
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
let backButton = UIImage(named: "backButton")
self.navigationController?.navigationBar.backIndicatorImage = backButton
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = backButton
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "Home", style: .plain, target: nil, action: nil)
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipe(sender:)))
view.addGestureRecognizer(rightSwipe)
centralManager = CBCentralManager(delegate: self, queue: nil)
}
@objc func handleSwipe(sender: UISwipeGestureRecognizer){
if sender.state == .ended{
switch sender.direction {
case .right:
performSegue(withIdentifier: "segueHome", sender: nil)
default: break
}
}
}
@IBAction func rescan(_ sender: Any) {
names = []
RSSIs = []
signalStregth = []
startScan()
tableView.reloadData()
}
func startScan() {
centralManager?.stopScan()
centralManager?.scanForPeripherals(withServices: nil, options: nil)
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
// Values are based of: https://www.metageek.com/training/resources/understanding-rssi.html
if (RSSI.intValue <= -90){
strength = "Unusable"
} else if (RSSI.intValue <= -80){
strength = "Not good"
} else if (RSSI.intValue <= -70){
strength = "Okay"
} else if (RSSI.intValue <= -67){
strength = "Very good"
} else if (RSSI.intValue <= -50){
strength = "Excellent"
} else if (RSSI.intValue <= -30){
strength = "Near perfect"
} else if (RSSI.intValue >= -30){
strength = "Perfect"
}
if let name = peripheral.name {
names.append(name)
} else{
names.append(peripheral.identifier.uuidString)
}
RSSIs.append(RSSI)
signalStregth.append(strength)
tableView.reloadData()
//
// if let name = peripheral.name {
// print("Device Name: \(name)")
// print("UUID: \(peripheral.identifier.uuidString)")
// print("RSSI: \(RSSI)")
// print("Signal Stregth: \(strength)")
// // print ("Ad Data: \(advertisementData)")
// print("\n")
// }
// else{
// print("Device Name: Unknown")
// print("UUID: \(peripheral.identifier.uuidString)")
// print("RSSI: \(RSSI)")
// print("Signal Stregth: \(strength)")
// // print ("Ad Data: \(advertisementData)")
// print("\n")
// }
}
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if central.state == .poweredOn {
// Working
startScan()
}
else if central.state == .poweredOff{
let alertVC = UIAlertController(title: "Bluetooth is Turned off", message: "Bluetooth is necessary for lock discovery. Please turn on bluetooh in Settings.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .default, handler: { (action) in
alertVC.dismiss(animated: true, completion: nil)
})
alertVC.addAction(okAction)
present(alertVC, animated: true, completion: nil)
}
else {
// Not Working
let alertVC = UIAlertController(title: "Something went wrong with your bluetooth", message: "Make sure your bluetooth turned on, so locks can be discovered.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "Ok", style: .default, handler: { (action) in
alertVC.dismiss(animated: true, completion: nil)
})
alertVC.addAction(okAction)
present(alertVC, animated: true, completion: nil)
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return names.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "bluetoothCell", for: indexPath) as? BluetoothTableView {
cell.nameLabel.text = names[indexPath.row]
cell.signalStregth.text = "Signal Stregth: \(signalStregth[indexPath.row])"
cell.rssiLabel.text = "RSSI: \(RSSIs[indexPath.row])"
return cell
}
return UITableViewCell()
}
}
| [
-1
] |
8ec271a1d6476e293963fbfd4f6561a279c7688a | 97657dbe102c53193c746297a7107f485525d6e8 | /KPCTabsControl/Theme.swift | f1bdb91804dcaf551974d1f4b3321d25eb025364 | [
"MIT"
] | permissive | FLORG1/KPCTabsControl | a4b8c0259411e9a628f9b1cd1234f88f3b9da957 | 72f351e1237a540462b5da89f5bd60900e2d2c93 | refs/heads/master | 2022-05-23T02:25:00.083247 | 2022-05-04T16:22:54 | 2022-05-04T16:22:54 | 224,449,675 | 0 | 1 | null | 2021-02-16T11:23:50 | 2019-11-27T14:31:40 | Swift | UTF-8 | Swift | false | false | 1,672 | swift | //
// Theme.swift
// KPCTabsControl
//
// Created by Cédric Foellmi on 13/08/16.
// Licensed under the MIT License (see LICENSE file)
//
import AppKit
/**
* The theme of a single Tab button
*/
public protocol TabButtonTheme {
var backgroundColor: NSColor { get }
var borderColor: NSColor { get }
var titleColor: NSColor { get }
var titleFont: NSFont { get }
}
/**
* The theme of the whole TabsControl bar
*/
public protocol TabsControlTheme {
var backgroundColor: NSColor { get }
var borderColor: NSColor { get }
}
/**
* The theme of a complete TabsControl
*/
public protocol Theme {
var tabButtonTheme: TabButtonTheme { get }
var selectedTabButtonTheme: TabButtonTheme { get }
var unselectableTabButtonTheme: TabButtonTheme { get }
var tabsControlTheme: TabsControlTheme { get }
}
extension Theme {
/**
Convenience function that select the theme corresponding to the right selection state.
- parameter selectionState: The tab selection state
- returns: The theme crresponding to the selection state.
*/
public func tabButtonTheme(fromSelectionState selectionState : TabSelectionState) -> TabButtonTheme {
switch selectionState {
case .normal: return self.tabButtonTheme
case .selected: return self.selectedTabButtonTheme
case .unselectable: return self.unselectableTabButtonTheme
}
}
}
public extension Theme {
var closeButtonColor: NSColor {
return NSColor.textColor
}
}
public protocol GradientTabButtonTheme {
var topBackgroundColor : NSColor { get }
var bottomBackgroundColor : NSColor { get }
}
| [
-1
] |
59b933409f999a6b7daad3a845e55c2bf891bab7 | 700f46387df24fd136f6656ebc7aa1ff94f1c231 | /Factorial/Factorial/Controllers/Main/Folder/File/FileListViewController.swift | 4ec7bc847563a13f5a9909489f06c0cf9aa4da05 | [] | no_license | FactorialTeam/IOSFactorial | 2b684b5431ef21d1eb92bf63b8bb8d72599fed85 | 0f1d6bfd2f3d380a2ff61934d9dceaffc307240f | refs/heads/master | 2020-03-30T23:38:31.239120 | 2018-10-08T07:06:26 | 2018-10-08T07:06:26 | 151,707,701 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,984 | swift | //
// FileListViewController.swift
// Factorial
//
// Created by Mnats on 10/6/18.
// Copyright © 2018 Mnats. All rights reserved.
//
import UIKit
class FileListViewController: UIViewController {
var folderId: Int?
private var files: [FileModel]?
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.loadFiles()
self.navigationItem.title = "Files"
}
private func loadFiles() {
guard let folderId = folderId else {return}
let task = GetFilesTasks(folderId: folderId)
task.execute(in: NetworkDispatcher.autDispatcher(), taskCompletion: { [weak self] (value) in
guard let files = value, let strongSelf = self else { return }
strongSelf.files = files
strongSelf.tableView.reloadData()
}) { (error, statusCode) in
}
}
}
extension FileListViewController : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return files?.count ?? 0
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "FolderTableViewCell", for: indexPath) as? FolderTableViewCell
else {
return UITableViewCell()
}
if let files = files {
let file = files[indexPath.row]
cell.configure(with: file.title)
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let files = files else {
return
}
let file = files[indexPath.row]
let vc = BaseModulFactoryImp().makeQuestionsViewController(file: file)
self.navigationController?.pushViewController(vc, animated: true)
}
}
| [
-1
] |
0680aeb1631c8018b80509606af1ca9fda56269c | 1bc49ca6de6889e5f7a7ba073caf15e63db21b81 | /MQQuartz2DDraw/MQQuartz2DDraw/MQDrawingBoardView.swift | bf4da6cc05834bf72eef5d5406d864da06ebf19e | [] | no_license | MengQuietly/MQQuartz2DDrawDemo | 5f0c12514ec9f5f88b1da2022e0a618528f475ba | 97434e97e283396114d33e3a4e7b79c7199e74f7 | refs/heads/master | 2020-12-04T15:09:35.744063 | 2016-08-24T02:04:50 | 2016-08-24T02:04:50 | 66,197,318 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,805 | swift | //
// MQDrawingBoardView.swift
// MQQuartz2DDraw
//
// Created by mengmeng on 16/8/15.
// Copyright © 2016年 mengQuietly. All rights reserved.
//
import UIKit
/** 画板View */
class MQDrawingBoardView: UIView {
var pathColor = UIColor()
var pathWidth = CGFloat()
var path:MQBezierPath!
var pathArr = [AnyObject]()
var drawImg:UIImage?{
didSet {
pathArr.append(drawImg!)
setNeedsDisplay()
}
}
override func awakeFromNib() {
let pan = UIPanGestureRecognizer(target: self, action: #selector(panClick))
self.addGestureRecognizer(pan)
pathColor = UIColor.blackColor()
pathWidth = 1
}
func panClick(pan:UIPanGestureRecognizer) {
let currentP = pan.locationInView(self)
if pan.state == UIGestureRecognizerState.Began {
path = MQBezierPath()
path.pathColor = pathColor
path.lineWidth = pathWidth
path.moveToPoint(currentP)
pathArr.append(path)
}
path.addLineToPoint(currentP)
setNeedsDisplay()
}
override func drawRect(rect: CGRect) {
if pathArr.count == 0 { return }
for pp in pathArr {
if pp.isKindOfClass(UIImage) {
let image = pp as! UIImage
image.drawInRect(rect)
}else{
pp.pathColor.set()
pp.stroke()
}
}
}
/// 清屏
func clear() {
if pathArr.count == 0 { return }
pathArr.removeAll()
setNeedsDisplay()
}
/// 撤销
func undo() {
if pathArr.count == 0 { return }
pathArr.removeLast()
setNeedsDisplay()
}
}
| [
-1
] |
38998f68b0642f65bf0ce5056b879304924baf97 | e8b349407c4d45efc346101373b3494aa9b374b7 | /FridgeEasyUITests/FridgeEasyUITests.swift | faaaea5cb63a75b98fcc9bf1199f878736db3791 | [] | no_license | FridgEasy/ios | a9dc8ea523f8ac9c2f33c789676104ea27125f55 | 98efd1d5c87e67a56d455cd373b3af8f63f99128 | refs/heads/master | 2021-01-10T17:22:55.686755 | 2016-03-07T00:39:28 | 2016-03-07T00:39:28 | 53,278,794 | 0 | 0 | null | 2016-03-07T00:39:28 | 2016-03-06T22:09:18 | null | UTF-8 | Swift | false | false | 1,253 | swift | //
// FridgeEasyUITests.swift
// FridgeEasyUITests
//
// Created by Michael J Kim on 3/6/16.
// Copyright © 2016 FridgeEasy. All rights reserved.
//
import XCTest
class FridgeEasyUITests: 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.
}
}
| [
282634,
313356,
305173,
237599,
241695,
292901,
223269,
354342,
229414,
315433,
354346,
278571,
325675,
102441,
102446,
282671,
313388,
229425,
321589,
180279,
229431,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
311373,
315468,
278607,
333902,
196687,
311377,
354386,
329812,
315477,
285362,
223317,
200795,
323678,
315488,
315489,
45154,
321632,
280676,
313446,
215144,
307306,
194667,
278637,
288878,
319599,
284789,
284790,
131190,
288890,
292987,
215165,
131199,
194692,
235661,
278669,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
278684,
329884,
278690,
311459,
215204,
233635,
284840,
299176,
278698,
284843,
184489,
278703,
323761,
184498,
278707,
278713,
258233,
280761,
295099,
299197,
180409,
280767,
223418,
227517,
139459,
309443,
227525,
131270,
301255,
176325,
280779,
282832,
321744,
227536,
301270,
229591,
301271,
280792,
311520,
325857,
334049,
280803,
182503,
319719,
295147,
317676,
286957,
313595,
184574,
309504,
194832,
227601,
325904,
319764,
278805,
315674,
282908,
311582,
299294,
282912,
278817,
233761,
211239,
282920,
317738,
311596,
321839,
315698,
98611,
332084,
307514,
278843,
282938,
168251,
287040,
319812,
280903,
227655,
319816,
323914,
282959,
229716,
289109,
168280,
379224,
323934,
391521,
239973,
381286,
285031,
416103,
313703,
280938,
242027,
242028,
321901,
354671,
278895,
287089,
199030,
227702,
315768,
315769,
291194,
223611,
248188,
139641,
311679,
211327,
291200,
158087,
313736,
227721,
242059,
311692,
285074,
227730,
240020,
190870,
190872,
291225,
293275,
242079,
283039,
289185,
285089,
293281,
227743,
305572,
156069,
300490,
301482,
311723,
289195,
377265,
338359,
299449,
311739,
319931,
293309,
278974,
311744,
317889,
291266,
278979,
326083,
278988,
289229,
281038,
281039,
278992,
283088,
283089,
279000,
176602,
242138,
285152,
279009,
369121,
160224,
195044,
291297,
279014,
319976,
279017,
311787,
281071,
319986,
236020,
279030,
311800,
279033,
317949,
283138,
279042,
233987,
287237,
377352,
322057,
309770,
342537,
279053,
283154,
303634,
303635,
279061,
279060,
182802,
188954,
279066,
291359,
227881,
293420,
236080,
283185,
279092,
234037,
23093,
244280,
338491,
234044,
301635,
309831,
55880,
377419,
281165,
303693,
281170,
309847,
189016,
115287,
287319,
332379,
111197,
295518,
287327,
242274,
279143,
279150,
281200,
287345,
287348,
301688,
244345,
189054,
287359,
297600,
303743,
301702,
164487,
311944,
279176,
316044,
311948,
311950,
184974,
316048,
311953,
316050,
287379,
326288,
227991,
295575,
289435,
303772,
205469,
221853,
285348,
314020,
279207,
295591,
248494,
279215,
285360,
293552,
299698,
295598,
287412,
166581,
318127,
154295,
164532,
342705,
303802,
314043,
66243,
291529,
225996,
363212,
287438,
242385,
303826,
279253,
158424,
230105,
299737,
322269,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
312046,
170735,
279278,
125683,
230133,
199415,
242428,
279293,
205566,
322302,
299777,
285443,
228099,
295688,
322312,
285450,
264971,
326413,
322320,
285457,
295698,
166677,
283418,
285467,
326428,
221980,
281378,
283431,
262952,
262953,
279337,
293673,
289580,
262957,
318247,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
285496,
301883,
201534,
281407,
289599,
295745,
342846,
293702,
283466,
281426,
279379,
244569,
201562,
281434,
322396,
295769,
230238,
230239,
301919,
279393,
293729,
275294,
349025,
281444,
279398,
303973,
351078,
177002,
308075,
310132,
295797,
201590,
207735,
228214,
279418,
177018,
269179,
308093,
314240,
291713,
158594,
240517,
287623,
228232,
299912,
279434,
320394,
416649,
316299,
252812,
308111,
189327,
308113,
293780,
310166,
289691,
209820,
283551,
310177,
289699,
189349,
289704,
279465,
293801,
326571,
304050,
177074,
326580,
289720,
326586,
289723,
189373,
213956,
281541,
19398,
345030,
213961,
279499,
56270,
191445,
183254,
304086,
314343,
304104,
324587,
183276,
289773,
320492,
203758,
320495,
287730,
240631,
320504,
214009,
312317,
328701,
328705,
293894,
230411,
320526,
330766,
238611,
140311,
293911,
316441,
197658,
238617,
113710,
281647,
189487,
322609,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
349254,
238663,
300109,
207954,
296023,
205911,
314458,
156763,
281698,
281699,
285795,
214116,
322664,
228457,
279659,
318571,
300145,
238706,
279666,
312435,
187508,
230514,
302202,
285819,
314493,
285823,
150656,
279686,
222344,
285833,
285834,
318602,
228492,
337037,
177297,
162962,
187539,
326803,
308375,
324761,
285850,
296091,
302239,
300192,
330912,
339106,
306339,
300200,
249003,
238764,
208044,
322733,
3243,
302251,
294069,
300215,
294075,
228541,
283841,
148674,
283846,
312519,
279752,
283849,
148687,
290001,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
310496,
279780,
228587,
279789,
290030,
302319,
251124,
316661,
283894,
234741,
208123,
292092,
279803,
228608,
320769,
234756,
322826,
242955,
177420,
312588,
318732,
126229,
245018,
320795,
318746,
239610,
320802,
130342,
304422,
130344,
292145,
298290,
312628,
159033,
333114,
222523,
333115,
286012,
279872,
181568,
279874,
300355,
193858,
216387,
300354,
372039,
230730,
296269,
222542,
234830,
238928,
224591,
296274,
314708,
318804,
283990,
314711,
357720,
300378,
300379,
294236,
314721,
292194,
230757,
281958,
134504,
306541,
284015,
296304,
327023,
234864,
316786,
314740,
230772,
327030,
310650,
290170,
224637,
306558,
290176,
243073,
179586,
306561,
294278,
314759,
296330,
298378,
368012,
318860,
112019,
306580,
224662,
234902,
282008,
314776,
318876,
282013,
290206,
148899,
314788,
298406,
282023,
314790,
245160,
333224,
241067,
279979,
314797,
279980,
286128,
279988,
173492,
284090,
310714,
228796,
54719,
302530,
292291,
228804,
415170,
306630,
280003,
300488,
370122,
310731,
302539,
339403,
306634,
310735,
329168,
280011,
222674,
327122,
280020,
329170,
312785,
280025,
310747,
239069,
144862,
286176,
187877,
320997,
310758,
280043,
191980,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
288248,
191991,
286201,
288252,
312830,
290304,
245249,
228868,
292359,
218632,
302602,
230922,
323083,
294413,
304655,
329231,
282132,
230933,
282135,
316951,
374297,
302620,
222754,
282147,
306730,
245291,
312879,
230960,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
282182,
194118,
288328,
286281,
292426,
333389,
224848,
224852,
290391,
128600,
196184,
235096,
306777,
239192,
212574,
345697,
300643,
300645,
282214,
204394,
224874,
243306,
312941,
206447,
310896,
294517,
288377,
290425,
325246,
235136,
280193,
282244,
239238,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
280217,
323226,
179868,
229021,
302751,
282272,
198304,
282279,
298664,
212649,
298666,
286387,
337590,
286392,
300729,
306875,
280252,
280253,
282302,
323262,
286400,
321217,
296636,
280259,
321220,
282309,
333508,
239305,
280266,
306891,
296649,
302798,
9935,
241360,
282321,
313042,
286419,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
321250,
294629,
153318,
333543,
181992,
337638,
288492,
282349,
323315,
67316,
286457,
284410,
288508,
200444,
282366,
286463,
288515,
280326,
282375,
323335,
284425,
300810,
116491,
282379,
280333,
216844,
300812,
284430,
161553,
284436,
278292,
116502,
118549,
278294,
282390,
325403,
321308,
321309,
282399,
241440,
282401,
325411,
315172,
186149,
186148,
241447,
333609,
286507,
294699,
280367,
300849,
282418,
282424,
280377,
321338,
282428,
280381,
345918,
413500,
241471,
280386,
153416,
315209,
325449,
159563,
280396,
307024,
317268,
237397,
307030,
18263,
241494,
188250,
284508,
300893,
307038,
237411,
284515,
276326,
282471,
292713,
282476,
292719,
296815,
325491,
313204,
333687,
317305,
317308,
339840,
315265,
280451,
188293,
243590,
282503,
67464,
305032,
315272,
315275,
243592,
184207,
311183,
279218,
282517,
294806,
214936,
294808,
337816,
239515,
214943,
298912,
319393,
333727,
294820,
284584,
294824,
298921,
313257,
292783,
126896,
200628,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
24531,
231382,
329696,
6116,
190437,
292838,
294887,
313322,
278507,
329707,
311277,
296942,
298987,
325620,
313338
] |
078b8fb2566cb49d1e50e832fa72fc2b4f02453f | 148573cbd7d8b6a1e90330ec444f6badac3e5d22 | /swift/Samples/TicTacToe/Sources/Game/RunGameWorkflow.swift | e333cb2c9ad152d612c6c6f9e54e244abf7ee7ba | [
"Apache-2.0"
] | permissive | wugeorgeq/workflow | ab2ba24a652638c3ad18b2951b71e0b8d4df1a00 | ae2ec55aa784e0f0c48e749748bbdceab9498dc1 | refs/heads/master | 2021-05-25T19:17:24.941614 | 2020-04-03T00:12:54 | 2020-04-03T00:12:54 | 253,887,853 | 0 | 0 | Apache-2.0 | 2020-04-07T19:07:44 | 2020-04-07T19:07:43 | null | UTF-8 | Swift | false | false | 3,804 | swift | /*
* Copyright 2019 Square Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Workflow
import WorkflowUI
import BackStackContainer
// MARK: Input and Output
struct RunGameWorkflow: Workflow {
typealias Output = Never
}
// MARK: State and Initialization
extension RunGameWorkflow {
struct State {
var playerX: String
var playerO: String
var step: Step
enum Step {
case newGame
case playing
}
}
func makeInitialState() -> RunGameWorkflow.State {
return State(playerX: "X", playerO: "O", step: .newGame)
}
func workflowDidChange(from previousWorkflow: RunGameWorkflow, state: inout State) {
}
}
// MARK: Actions
extension RunGameWorkflow {
enum Action: WorkflowAction {
typealias WorkflowType = RunGameWorkflow
case updatePlayerX(String)
case updatePlayerO(String)
case startGame
case back
func apply(toState state: inout RunGameWorkflow.State) -> RunGameWorkflow.Output? {
switch self {
case .updatePlayerX(let name):
state.playerX = name
case .updatePlayerO(let name):
state.playerO = name
case .startGame:
state.step = .playing
case .back:
state.step = .newGame
}
return nil
}
}
}
// MARK: Rendering
extension RunGameWorkflow {
typealias Rendering = BackStackScreen
func render(state: RunGameWorkflow.State, context: RenderContext<RunGameWorkflow>) -> Rendering {
let sink = context.makeSink(of: Action.self)
var backStackItems: [BackStackScreen.Item] = [BackStackScreen.Item(
screen: newGameScreen(
sink: sink,
playerX: state.playerX,
playerO: state.playerO),
barVisibility: .hidden)]
switch state.step {
case .newGame:
break
case .playing:
let takeTurnsScreen = TakeTurnsWorkflow(
playerX: state.playerX,
playerO: state.playerO)
.rendered(with: context)
backStackItems.append(BackStackScreen.Item(
screen: takeTurnsScreen,
barVisibility: .visible(BackStackScreen.BarContent(
leftItem: BackStackScreen.BarContent.BarButtonItem.button(BackStackScreen.BarContent.Button(
content: .text("Quit"),
handler: {
sink.send(.back)
}))))))
}
return BackStackScreen(items: backStackItems)
}
private func newGameScreen(sink: Sink<Action>, playerX: String, playerO: String) -> NewGameScreen {
return NewGameScreen(
playerX: playerX,
playerO: playerO,
eventHandler: { event in
switch event {
case .startGame:
sink.send(.startGame)
case .playerXChanged(let name):
sink.send(.updatePlayerX(name))
case .playerOChanged(let name):
sink.send(.updatePlayerO(name))
}
})
}
}
| [
-1
] |
aa3d7fab2143bb98488ba4352913a4c1d89262c9 | eedb7bf656a400a2698f22352c394c6bd3303cd1 | /mvp/toast-project/toast-project/Toasts/Profile Detail/FriendsList/FriendCell.swift | ed4caf941927dfd0b6fae18bccfde2f887aac28d | [] | no_license | ckn220/TOAST-previously-LastEats | 11fd3b166a2656d6b5e4e79f07ca3b9712c34e71 | 81485e0b7c976e9719b8e52215fe6232f764fd20 | refs/heads/master | 2021-05-30T11:55:20.056207 | 2015-11-14T12:11:34 | 2015-11-14T12:11:34 | 17,371,679 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,780 | swift | //
// FriendCell.swift
// toast-project
//
// Created by Diego Cruz on 5/7/15.
// Copyright (c) 2015 Diego Cruz. All rights reserved.
//
import UIKit
import Parse
import Haneke
class FriendCell: UITableViewCell {
@IBOutlet weak var highlightView: UIView!
@IBOutlet weak var topLinewView: UIView!
@IBOutlet weak var friendPicture: BackgroundImageView!
@IBOutlet weak var friendNameLabel: UILabel!
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
}
override func setHighlighted(highlighted: Bool, animated: Bool) {
super.setHighlighted(highlighted, animated: animated)
if highlighted{
self.highlightView.alpha = 0.3
}else{
self.highlightView.alpha = 0
}
}
func configure(friend:PFObject,isFirstRow:Bool){
configureTopLine(!isFirstRow)
configurePicture(friend)
configureName(friend)
}
private func configureTopLine(visible:Bool){
topLinewView.hidden = !visible
}
private func configurePicture(friend:PFObject){
initPicture()
friendPicture.setImage(user:friend as! PFUser)
}
private func initPicture(){
let pictureLayer = friendPicture.layer
pictureLayer.borderWidth = 1
pictureLayer.borderColor = UIColor.whiteColor().CGColor
pictureLayer.cornerRadius = CGRectGetWidth(pictureLayer.bounds)/2
}
private func configureName(friend:PFObject){
friendNameLabel.text = friend["name"] as? String
}
}
| [
-1
] |
de64ba59404f8c0ff04cc48e6327a3da8bde2a17 | ffc30cc1fc9bda5555ea379b9c91914646eda4ed | /DemoSwiftUICombine/DemoSwiftUICombine/Code/View/MainView.swift | e4cc160c21025d36842ea5d761f791f8a0b6d980 | [] | no_license | eytan55/DemoSwiftUi-Combine | 94fe48cb5106c779c87553a61b1dbce6657279c8 | be31fc57210b95db30b13bbb0ba17933f8f65588 | refs/heads/master | 2022-10-09T01:36:38.983809 | 2020-06-09T21:30:15 | 2020-06-09T21:30:15 | 271,109,638 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,264 | swift | //
// ContentView.swift
// DemoSwiftUICombine
//
// Created by eytan taieb on 28/05/2020.
// Copyright © 2020 eytan taieb. All rights reserved.
//
import SwiftUI
struct MainView: View {
@State var action:Int? = 0
var connexionManager = ConnexionManager()
@State var show = false
@State var disablePopup = true
var body: some View {
ZStack(){
NavigationView {
NavigationLink(destination: UserListPageView(), tag: 1, selection: $action) {
Text("UserListButton").onTapGesture {
self.connexionManager.get()
self.disablePopup.toggle()
self.action = 1
}
}
}
if disablePopup{
Button(action: {
withAnimation{
self.show.toggle()
}
}, label: {
Text("Popup")
})
if self.show{
PopupView(isPresented: self.$show)
}
}
}
}
}
struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView()
}
}
| [
-1
] |
0b0da4fd220cf41c5545ea66cf49886a67734644 | 811507f7f0ea38a0888e3282d0e25d059f69771f | /RxMemo/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift | 44207e69e221c1045bfcd48d2e8159629ba3a426 | [
"MIT"
] | permissive | applebuddy/RxMVVMStudy | a5c5848d28aff7f5d60fb5e7dbf264fbc6c9d310 | 343c264ef11a933e44dea256f4cf99e5afec2ecb | refs/heads/master | 2020-09-01T18:17:44.574598 | 2020-08-23T13:01:23 | 2020-08-23T13:01:23 | 219,024,764 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,355 | swift | //
// AsMaybe.swift
// RxSwift
//
// Created by Krunoslav Zaher on 3/12/17.
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//
private final class AsMaybeSink<Observer: ObserverType>: Sink<Observer>, ObserverType {
typealias Element = Observer.Element
private var _element: Event<Element>?
func on(_ event: Event<Element>) {
switch event {
case .next:
if _element != nil {
forwardOn(.error(RxError.moreThanOneElement))
dispose()
}
_element = event
case .error:
forwardOn(event)
dispose()
case .completed:
if let element = self._element {
forwardOn(element)
}
forwardOn(.completed)
dispose()
}
}
}
final class AsMaybe<Element>: Producer<Element> {
fileprivate let _source: Observable<Element>
init(source: Observable<Element>) {
_source = source
}
override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {
let sink = AsMaybeSink(observer: observer, cancel: cancel)
let subscription = _source.subscribe(sink)
return (sink: sink, subscription: subscription)
}
}
| [
124898,
124878,
15604,
124604,
15646
] |
59af57b6fe3169d934546412394bdbd95f555e60 | db888fe847365fb14c200a18c655396de7128e89 | /Dizzy/Classes/Map+Extensions.swift | cb1ce07c487f12ff9ad6fcffadd8b77c5c7d2430 | [
"MIT"
] | permissive | iStorry/Dizzy | 95ff7436da24b19976de5897274817324e3c9923 | 099438ff86e9fdf3599f0fbd6369d6d3fe8b218f | refs/heads/master | 2021-01-21T10:09:23.090190 | 2019-12-14T00:03:03 | 2019-12-14T00:03:03 | 83,391,013 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,823 | swift | //
// Map+Extensions.swift
// Dizzy
//
// Created by ジャティン on 2019/11/15.
// Copyright © 2019 Me. All rights reserved.
//
import UIKit
import MapKit
public extension UIImageView {
func showMapImage(with latitude: Double, with longitude: Double, bounds: CGRect) {
let snapshot = MKMapSnapshotter.Options()
let coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
let region = MKCoordinateRegion(center: coordinate, latitudinalMeters: 800, longitudinalMeters: 800)
/// Annotation
let annotation = MKPointAnnotation()
annotation.coordinate = coordinate
snapshot.region = region
snapshot.scale = UIScreen.main.scale
snapshot.size = CGSize(width: 380, height: 140)
snapshot.showsBuildings = true
let snapshotter = MKMapSnapshotter(options: snapshot)
snapshotter.start { snapshot, error in
if let error = error {
print(error.localizedDescription)
} else {
let image = UIGraphicsImageRenderer(size: bounds.size).image { _ in
snapshot?.image.draw(at: .zero)
let annotation = MKPinAnnotationView(annotation: nil, reuseIdentifier: nil)
let image = annotation.image
if var points = snapshot?.point(for: coordinate), bounds.contains(points) {
points.x -= annotation.bounds.width / 2
points.y -= annotation.bounds.height / 2
points.x += annotation.centerOffset.x
points.y += annotation.centerOffset.y
image?.draw(at: points)
}
}
self.image = image
}
}
}
}
| [
-1
] |
7e9cf8cc6315e9ad07dde29976f629d06e55dee6 | 4f8e9041c5f8929eca1927537fa87f59d5ecb31d | /parstagramUITests/parstagramUITests.swift | 0d579b12c24700c5e18c100bd40125b3a9396efe | [] | no_license | anguyen216/parstagram | 046ce8b69b5f5c5b8ba48c5c2fc5ce1cbf6fb10d | 4f5d97039eb4e1ce13d2622f67761ee80c8a81de | refs/heads/main | 2023-03-28T04:51:36.637730 | 2021-03-26T19:53:00 | 2021-03-26T19:53:00 | 349,258,995 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,420 | swift | //
// parstagramUITests.swift
// parstagramUITests
//
// Created by Anh Nguyen on 3/18/21.
//
import XCTest
class parstagramUITests: XCTestCase {
override func setUpWithError() throws {
// 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
// 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 tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
376853,
344106,
253996,
163894,
385078,
319543,
352314,
376892,
32829,
352324,
352327,
385095,
393291,
163916,
368717,
196687,
254039,
426074,
368732,
32871,
352359,
221292,
385135,
376945,
385147,
426124,
196758,
49308,
65698,
49317,
377008,
377010,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
385240,
254171,
147679,
147680,
205034,
254189,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
254228,
368915,
377116,
254250,
418095,
336177,
368949,
180534,
155968,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
368982,
270703,
139641,
385407,
385409,
106893,
270733,
385423,
385433,
213402,
385437,
254373,
385448,
385449,
311723,
115116,
385463,
336319,
336323,
188870,
262619,
377309,
377310,
369121,
369124,
270823,
213486,
360945,
139766,
393719,
377337,
254459,
410108,
410109,
262657,
377346,
410126,
393745,
385554,
254487,
410138,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
385612,
426575,
385620,
369236,
270938,
352885,
352886,
344697,
369285,
385669,
344714,
377487,
426646,
180886,
352921,
377499,
344737,
352938,
418479,
164532,
336565,
377531,
377534,
377536,
385737,
385745,
369365,
369366,
385751,
361178,
352989,
352990,
418529,
295649,
385763,
369383,
361194,
418550,
344829,
197377,
434956,
418579,
426772,
197398,
426777,
344864,
197412,
336678,
189229,
197424,
197428,
336693,
377656,
197433,
426809,
222017,
377669,
197451,
369488,
385878,
385880,
197467,
435038,
385895,
197479,
385901,
197489,
164730,
254851,
369541,
172936,
426894,
189327,
377754,
140203,
172971,
377778,
189362,
377789,
345034,
418774,
386007,
418781,
386016,
123880,
418793,
435185,
222193,
271351,
435195,
328701,
386049,
328705,
418819,
410629,
377863,
189448,
320526,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
386108,
410687,
377927,
361547,
205911,
361570,
214116,
214119,
402538,
173168,
377974,
66684,
377986,
402568,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
402632,
148687,
402641,
419028,
222441,
386288,
66802,
271607,
386296,
369913,
419066,
369912,
386300,
386304,
320769,
369929,
419097,
320795,
115997,
222496,
369964,
353581,
116014,
312628,
345397,
386363,
337226,
353611,
337228,
353612,
378186,
353617,
378201,
312688,
337280,
353672,
263561,
304523,
370066,
9618,
411028,
370072,
148900,
361928,
337359,
329168,
353751,
329181,
320997,
361958,
271850,
271853,
411119,
116209,
386551,
312830,
271880,
198155,
329231,
370200,
157219,
157220,
394793,
353875,
99937,
345697,
271980,
206447,
403057,
42616,
337533,
370307,
419462,
149127,
149128,
419464,
214667,
411275,
345753,
255651,
337590,
370359,
403149,
345813,
370390,
272087,
345817,
337638,
345832,
181992,
345835,
141037,
173828,
395018,
395019,
395026,
124691,
435993,
345882,
411417,
321308,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
337734,
272207,
272208,
337746,
395092,
362326,
345942,
345950,
370526,
362336,
255844,
214894,
362351,
214896,
124795,
182145,
337816,
124826,
329627,
436130,
354210,
436135,
10153,
362411,
370604,
362418,
411587,
362442,
346066,
354268,
436189,
403421,
329696,
354273,
403425,
190437,
354279,
436199,
174058,
354283,
337899,
247787,
247786,
313322,
124912,
436209,
346117,
182277,
403463,
354311,
43016,
354310,
354312,
436235,
419857,
436248,
346153,
124974,
272432,
403507,
378933,
378934,
436283,
403524,
436293,
436304,
411738,
272477,
395373,
346237,
436372,
362658,
436388,
125108,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
125166,
149743,
379120,
436466,
125170,
411892,
436471,
395511,
436480,
125184,
272644,
125192,
338187,
338188,
125197,
395536,
125200,
338196,
272661,
379157,
125204,
125215,
125216,
338217,
125225,
125236,
362809,
379193,
395591,
272730,
436570,
215395,
362864,
354672,
272755,
354678,
248188,
313726,
436609,
240003,
395653,
436613,
395660,
264591,
272784,
420241,
436644,
272815,
436659,
338359,
436677,
256476,
420326,
166403,
322057,
420374,
322077,
330291,
191065,
436831,
420461,
313970,
346739,
346741,
420473,
166533,
346771,
363155,
264855,
363161,
436897,
355006,
363228,
436957,
436960,
264929,
338658,
346859,
330476,
35584,
133889,
346889,
264971,
322320,
207639,
363295,
355117,
191285,
355129,
273209,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
387927,
363353,
363354,
322396,
420702,
363361,
363362,
412516,
355173,
355174,
207724,
355182,
207728,
420722,
330627,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
256934,
273336,
273341,
330688,
379845,
363462,
273353,
207839,
347104,
134124,
412653,
257007,
248815,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
330789,
248871,
412725,
257093,
404550,
314437,
339031,
257126,
404582,
265318,
396395,
265323,
404589,
273523,
363643,
248960,
150656,
363658,
404622,
224400,
347286,
265366,
429209,
339101,
429216,
339106,
265381,
380069,
421050,
265410,
183492,
273616,
339167,
421102,
363769,
52473,
265467,
52476,
412926,
437504,
380178,
429332,
126229,
412963,
257323,
273713,
208179,
159033,
347451,
216387,
257353,
257354,
109899,
437585,
331091,
150868,
372064,
429410,
437602,
388458,
265579,
314734,
314740,
314742,
421240,
314745,
388488,
314776,
396697,
396709,
380331,
380335,
355761,
421302,
134586,
380348,
380350,
216511,
216510,
200136,
273865,
339403,
372172,
413138,
437726,
429540,
3557,
3559,
191980,
191991,
265720,
216575,
372226,
437766,
208397,
323088,
413202,
388630,
413206,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
134715,
421437,
396865,
413255,
265800,
273992,
421452,
265809,
396885,
265816,
396889,
388699,
396896,
323171,
388712,
388713,
339579,
396927,
224907,
396942,
405140,
274071,
208547,
208548,
405157,
388775,
364202,
421556,
224951,
224952,
323262,
323265,
241360,
241366,
224985,
159462,
372458,
397040,
12017,
274170,
175874,
249606,
323335,
372497,
397076,
421657,
339746,
241447,
167720,
257831,
421680,
274234,
241471,
339782,
315209,
241494,
339799,
274288,
372592,
274296,
339840,
315265,
372625,
118693,
438186,
151492,
380874,
372699,
380910,
380922,
380923,
274432,
372736,
241695,
315431,
430120,
315433,
430127,
405552,
249912,
225347,
421958,
176209,
381013,
53334,
356446,
438374,
176231,
438378,
217194,
422000,
249976,
266361,
422020,
381061,
168070,
168069,
381071,
323730,
430231,
200856,
422044,
192670,
192671,
258213,
323761,
266427,
356550,
372943,
266447,
258263,
356575,
438512,
372979,
389364,
381173,
135416,
356603,
266504,
61720,
381210,
315674,
389406,
438575,
266547,
397620,
332084,
438583,
127292,
438592,
332100,
397650,
348499,
348501,
389465,
332128,
110955,
242027,
160111,
250227,
438653,
266628,
340356,
225684,
373141,
373144,
389534,
397732,
373196,
242138,
184799,
201195,
324098,
340489,
397841,
258584,
397855,
348709,
348710,
397872,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
422529,
373377,
152196,
201348,
356998,
348807,
356999,
316050,
275102,
340645,
176805,
422567,
176810,
160441,
422591,
135888,
242385,
373485,
373486,
21239,
275193,
348921,
430853,
430860,
62222,
430880,
152372,
160569,
430909,
160576,
348999,
275294,
381791,
127840,
357219,
439145,
242540,
242542,
381811,
201590,
398205,
340865,
349066,
316299,
349068,
381840,
390034,
373653,
430999,
209820,
381856,
185252,
398244,
422825,
381872,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
398313,
127990,
349176,
201721,
349179,
357380,
398370,
357413,
357420,
21567,
398405,
218187,
250955,
250965,
439391,
250982,
398444,
62574,
357487,
119925,
349304,
349315,
349317,
373902,
177297,
324761,
373937,
373939,
218301,
259275,
259285,
357594,
414956,
251124,
439550,
439563,
242955,
414989,
349458,
259346,
382243,
382246,
382257,
382264,
333115,
193853,
251212,
406862,
259408,
316764,
374110,
382329,
259449,
357758,
243073,
357763,
112019,
398740,
374189,
251314,
259513,
54719,
259569,
251379,
398844,
210429,
366081,
153115,
431646,
349727,
431662,
374327,
210489,
349764,
128589,
333394,
349780,
415334,
54895,
366198,
210558,
210559,
415360,
333438,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
317102,
415419,
259780,
333508,
267978,
333522,
325345,
431861,
161539,
366358,
169751,
431901,
341791,
325411,
333609,
399148,
202541,
431918,
153392,
431935,
415555,
325444,
325449,
341837,
415566,
431955,
325460,
317268,
341846,
259937,
382820,
415592,
325491,
341878,
276343,
350072,
333687,
317305,
112510,
325508,
333700,
243590,
350091,
350092,
350102,
350108,
333727,
219046,
128955,
219102,
6116,
432114,
415740,
268286,
415744,
333827,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
104534,
260206,
432241,
374913,
374914,
415883,
333968,
333990,
104633,
260285,
268479,
374984,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
432387,
260355,
375052,
325904,
194832,
391448,
334104,
268570,
178459,
186660,
268581,
358698,
325930,
260396,
358707,
432435,
178485,
358710,
14654,
268609,
383309,
383327,
391521,
366948,
416101,
383338,
432503,
432511,
39323,
317851,
375211,
129461,
342454,
358844,
317889,
326083,
416201,
129484,
154061,
416206,
432608,
195044,
391654,
432616,
334315,
375281,
334345,
432650,
342549,
416288,
342560,
350758,
350759,
358951,
358952,
219694,
219695,
375345,
432694,
375369,
375373,
416334,
416340,
244311,
416353,
260705,
375396,
268901,
244326,
244345,
375438,
326288,
383668,
342714,
39616,
383708,
269036,
432883,
203511,
342775,
383740,
416509,
359166,
162559,
375552,
432894,
383755,
326413,
318247,
342827,
391980,
318251,
375610,
342846,
416577,
416591,
244569,
375644,
252766,
351078,
342888,
392057,
211835,
269179,
392065,
260995,
400262,
392071,
424842,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
342990,
252878,
433104,
359380,
433112,
433116,
359391,
187372,
383980,
343020,
383994,
171009,
384004,
433166,
384015,
433173,
326684,
252959,
384031,
375848,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
384120,
392317,
343166,
384127,
392320,
359574,
351389,
253098,
367791,
367792,
367798,
343230,
367809,
253124,
113863,
351445,
253168,
351475,
351489,
367897,
367898,
245018,
130347,
261426,
212282,
359747,
359748,
146763,
114022,
253288,
425327,
425331,
163190,
384379,
253316,
384391,
253339,
253340,
343457,
245160,
359860,
359861,
343480,
425417,
327122,
425434,
310747,
253431,
359931,
187900,
343552,
409095,
359949,
253456,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
179800,
343646,
155238,
204394,
138862,
188021,
425624,
245413,
384693,
376502,
409277,
319176,
409289,
425682,
245471,
155360,
212721,
163575,
319232,
360194,
409355,
155408,
417556,
204600,
319289,
384826,
409404,
360253,
409416,
376661,
368471,
425820,
409446,
368486,
384871,
40809,
368489,
425832,
417648,
417658,
360315,
253828,
327556,
425875,
253851,
376733,
204702,
253868,
204722,
188349,
212947,
212953,
360416,
253930,
385011
] |
4a4463aff9443981e89ca569f32afe4b0ac60790 | b343c1d164e6c577e7d227c774af87a6e1038b7c | /Weather App/BackgroundView.swift | c7457a837e711233e48ce6acc9507d28d208466a | [
"MIT"
] | permissive | brandonlee503/Atmosphere | 4bd80918952423330c7cc4df3a5885ad6dab4936 | 069d7c84c7aeda741b7d4a8abab75753e307da90 | refs/heads/master | 2021-01-18T02:35:24.888024 | 2015-08-24T18:00:16 | 2015-08-24T18:00:16 | 38,283,697 | 0 | 0 | null | 2015-08-23T06:00:35 | 2015-06-30T02:43:09 | Swift | UTF-8 | Swift | false | false | 1,374 | swift | //
// BackgroundView.swift
// Weather App
//
// Created by Brandon Lee on 8/15/15.
// Copyright (c) 2015 Brandon Lee. All rights reserved.
//
import UIKit
class BackgroundView: UIView {
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Background View
//// Color Declarations
let lightPurple: UIColor = UIColor(red: 0.377, green: 0.075, blue: 0.778, alpha: 1.000)
let darkPurple: UIColor = UIColor(red: 0.060, green: 0.036, blue: 0.202, alpha: 1.000)
let context = UIGraphicsGetCurrentContext()
//// Gradient Declarations
let purpleGradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), [lightPurple.CGColor, darkPurple.CGColor], [0, 1])
//// Background Drawing
let backgroundPath = UIBezierPath(rect: CGRectMake(0, 0, self.frame.width, self.frame.height))
CGContextSaveGState(context)
backgroundPath.addClip()
CGContextDrawLinearGradient(context, purpleGradient,
CGPointMake(160, 0),
CGPointMake(160, 568),
UInt32(kCGGradientDrawsBeforeStartLocation) | UInt32(kCGGradientDrawsAfterEndLocation))
CGContextRestoreGState(context)
}
}
| [
-1
] |
1e2fac7b24faf57b65bd3d16a3ec2aeaff4c7d68 | ab9dd5eb676dfb413932b0c08d68eadc74ea1d87 | /Tests/ModelTests/LegalAgreementTypeTests.swift | 529b3957265804b3cdfc253705ee26737d7412cb | [
"MIT"
] | permissive | skelpo/PayPal | 24910dc6162f3ba0d1ea2a68006646fe3ed6b20d | c058dc6027d73d1743c30f4332b2e62b7c91ab7e | refs/heads/master | 2020-03-21T06:22:21.539414 | 2019-12-11T16:10:57 | 2019-12-11T16:10:57 | 138,215,275 | 15 | 2 | MIT | 2019-12-11T16:10:59 | 2018-06-21T19:51:35 | Swift | UTF-8 | Swift | false | false | 1,901 | swift | import XCTest
@testable import PayPal
typealias AgreementType = LegalAgreement.AgreementType
final class LegalAgreementTypeTests: XCTestCase {
struct Agreement: Codable {
let type: AgreementType
}
func testCaseRawValues() {
XCTAssertEqual(AgreementType.userAgreement.rawValue, "USER_AGREEMENT")
XCTAssertEqual(AgreementType.financialAuthority.rawValue, "FINANCIAL_BINDING_AUTHORITY")
}
func testAllCase() {
XCTAssertEqual(AgreementType.allCases.count, 2)
XCTAssertEqual(AgreementType.allCases, [.userAgreement, .financialAuthority])
}
func testEncoding()throws {
let encoder = JSONEncoder()
let userAgreement = try String(data: encoder.encode(Agreement(type: .userAgreement)), encoding: .utf8)
let financialAuthority = try String(data: encoder.encode(Agreement(type: .financialAuthority)), encoding: .utf8)
XCTAssertEqual(userAgreement, "{\"type\":\"USER_AGREEMENT\"}")
XCTAssertEqual(financialAuthority, "{\"type\":\"FINANCIAL_BINDING_AUTHORITY\"}")
}
func testDecoding()throws {
let decoder = JSONDecoder()
let userAgreement = """
{
"type": "USER_AGREEMENT"
}
""".data(using: .utf8)!
let financialAuthority = """
{
"type": "FINANCIAL_BINDING_AUTHORITY"
}
"""
try XCTAssertEqual(decoder.decode(Agreement.self, from: userAgreement).type, .userAgreement)
try XCTAssertEqual(decoder.decode(Agreement.self, from: financialAuthority).type, .financialAuthority)
}
static var allTests: [(String, (LegalAgreementTypeTests) -> ()throws -> ())] = [
("testCaseRawValues", testCaseRawValues),
("testAllCase", testAllCase),
("testEncoding", testEncoding),
("testDecoding", testDecoding)
]
}
| [
-1
] |
3f7b98889beedfaccd8e43c85b18018c4fe3441f | 331e2f22118c7e98936cdaf20e20ecde6bbda133 | /BezPaketov/Extension/UIAlertController+Ext.swift | 633dd067beaef470bf708f2868fe55166d783ddf | [] | no_license | granchenkooleg/BezPaketov | 143f4719f04ece111ca1a4588cd1f06ef04ca3a2 | d09689fb371ff8ace2d64a533283375bebe97186 | refs/heads/master | 2021-01-19T08:59:26.453410 | 2017-11-27T19:51:00 | 2017-11-27T19:51:00 | 87,706,289 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,023 | swift | //
// UIAlertController+.swift
// BinarySwipe
//
// Created by Oleg on 5/31/16.
// Copyright © 2016 Oleg. All rights reserved.
//
import Foundation
import UIKit
extension UIAlertController {
class func alert(_ message: String?) -> UIAlertController {
return UIAlertController(title: nil, message: message, preferredStyle: .alert)
}
class func alert(_ title: String?, message: String?) -> UIAlertController {
return UIAlertController(title: title, message: message, preferredStyle: .alert)
}
class func actionSheet(_ title: String?, message: String? = nil) -> UIAlertController {
return UIAlertController(title: title, message: message, preferredStyle: .actionSheet)
}
func action(_ title: String?, style: UIAlertActionStyle = .default, handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertController {
let action = UIAlertAction(title: title, style: style, handler: handler)
addAction(action)
return self
}
func show () {
show(nil)
}
func show(_ sender: UIView?) {
let navigation = UINavigationController.main
guard let presentingViewController = navigation.presentedViewController ?? navigation.topViewController else { return }
if actions.count == 0 {
action("ok".ls)
}
if let popoverController = self.popoverPresentationController , self.preferredStyle == .actionSheet {
if let sender = sender {
popoverController.sourceView = sender
popoverController.sourceRect = sender.bounds
} else {
popoverController.sourceView = presentingViewController.view
popoverController.sourceRect = CGRect(x: 0, y: navigation.view.frame.midY - 1, width: navigation.view.width, height: 1)
}
popoverController.permittedArrowDirections = .any
}
presentingViewController.present(self, animated: true, completion: nil)
}
}
| [
-1
] |
b67492818729eebf6bf733627a988143469573ae | 6ba4d9764fb60440157a619956014d44c938e7f5 | /StoryPrompt/controller/StoryPromptTableViewController.swift | 7f3f507cb9cc53ed6115283a1769028eb308a576 | [] | no_license | mausayao/StoryPrompt | 647065f8e5580183bf0adee519d5979990d9201a | 363df62e409993cf60ddb86112e229d51897b7e5 | refs/heads/main | 2023-03-23T07:20:10.113239 | 2021-03-19T13:12:16 | 2021-03-19T13:12:16 | 337,745,727 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,008 | swift | //
// StoryPromptTableViewController.swift
// StoryPrompt
//
// Created by Maurício de Freitas Sayão on 18/03/21.
//
import UIKit
class StoryPromptTableViewController: UITableViewController {
var storyPrompts = [StoryPromptEntry]()
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
storyPrompts.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "StoryPromptCell", for: indexPath)
cell.textLabel?.text = "Promp \(indexPath.row + 1)"
cell.imageView?.image = storyPrompts[indexPath.row].image
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let storyPromp = storyPrompts[indexPath.row]
performSegue(withIdentifier: "StoryPromptCellSegue", sender: storyPromp)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "StoryPromptCellSegue" {
guard let destination = segue.destination as? StoryPromptViewController, let storyPrompt = sender as? StoryPromptEntry else { return }
destination.storyPrompt = storyPrompt
}
}
@IBAction func saveStoryPrompt(unwindSegue: UIStoryboardSegue) {
guard let storyPromptViewController = unwindSegue.source as? StoryPromptViewController, let storyPrompt = storyPromptViewController.storyPrompt else { return }
storyPrompts.append(storyPrompt)
tableView.reloadData()
}
@IBAction func cancelStoryPrompt(unwindSegue: UIStoryboardSegue) {
}
}
| [
-1
] |
e16e02d64333e168ca973d8f08f6f81d1c94c07a | 652be040ccd036236105b1665105ec1c523bbf1e | /Reading List/Reading List/ViewControllers/ReadingListTableViewController.swift | 409ae6c0de825c1e385e567952e69611278d8ecc | [] | no_license | claywatkins/ios-reading-list | 634a35720c165986fde1acca1f85a92e9292b463 | b2ee67ce9b70e769e799202e03272775ec7b4afc | refs/heads/master | 2022-04-24T14:53:31.403569 | 2020-04-26T00:54:42 | 2020-04-26T00:54:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,641 | swift | //
// ReadingListTableViewController.swift
// Reading List
//
// Created by Clayton Watkins on 4/24/20.
// Copyright © 2020 Lambda School. All rights reserved.
//
import UIKit
class ReadingListTableViewController: UITableViewController, BookTableViewCellDelegate {
let bookController = BookController()
override func viewDidLoad() {
super.viewDidLoad()
bookController.loadFromPersistentStore()
tableView.reloadData()
}
override func viewDidAppear(_ animated: Bool) {
tableView.reloadData()
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
var rows = 0
if section == 0{
rows = bookController.readBooks.count
} else {
rows = bookController.unreadBooks.count
}
return rows
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "BookCell", for: indexPath) as? BookTableViewCell else { return UITableViewCell() }
cell.delegate = self
let book = bookFor(indexPath: indexPath)
cell.book = book
return cell
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
if section == 0{
guard bookController.readBooks.count > 0 else { return nil }
return "Read Books"
} else {
guard bookController.unreadBooks.count > 0 else { return nil }
return "Unread Books"
}
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let book = bookFor(indexPath: indexPath)
bookController.removeBook(book: book)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
func bookFor(indexPath: IndexPath) -> Book{
if indexPath.section == 0{
return bookController.readBooks[indexPath.row]
} else {
return bookController.unreadBooks[indexPath.row]
}
}
func toggleHasBeenRead(for cell: BookTableViewCell) {
guard let selectedBook = tableView.indexPath(for: cell) else { return }
let book = bookFor(indexPath: selectedBook)
bookController.updateHasBeenRead(for: book)
tableView.reloadData()
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "AddBookSegue" {
guard let addBookDestination = segue.destination as? BookDetailViewController else { return }
addBookDestination.bookController = bookController
} else if segue.identifier == "BookDetailSegue" {
guard let indexPath = tableView.indexPathForSelectedRow,
let detailBookDestination = segue.destination as? BookDetailViewController else { return }
let book = bookFor(indexPath: indexPath)
detailBookDestination.book = book
detailBookDestination.bookController = bookController
}
}
}
// MARK: - Properties (ex: var booL: Bool()?!
// MARK: - IBOutlets / Computer Props (programmatic code)
// MARK: - Life Cycle
// MARK: - IBActions / @objc funcs (programmatic code)
// MARK: - Helper Functions
// MARK: - Extensions
| [
-1
] |
f18cc66ce4957eec6bf888a63d37214eff354022 | 78ca7eae663382fff163e40b0a1c73c44d441de1 | /RxSwiftTest/RxSwiftTest/TestCell.swift | acab6c3a416da7b6f6c4443aa36952e57ce2edf7 | [] | no_license | songdealer/swiftTestFiles | 5346eaea44a3df1aae95f064596980c1b30c9349 | 6c9d8b61f2845c235a7e5bbeb780fa2ec15c0fa9 | refs/heads/master | 2022-09-23T16:29:21.575229 | 2020-06-05T04:55:47 | 2020-06-05T04:55:47 | 231,186,240 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 269 | swift | //
// TestCell.swift
// RxSwiftTest
//
// Created by MinG._. on 2020/05/29.
// Copyright © 2020 MinG._. All rights reserved.
//
import UIKit
class TestCell: UITableViewCell {
static let identifier = "TestCell"
//@IBOutlet weak var label: UILabel!
}
| [
-1
] |
7a9daafabae13b7ac4d546311478f8a75565bf05 | f332627f772d496c4c8bb004c6edc62259bd1694 | /练习 - 类.playground/Pages/2. 练习 - 创建子类.xcplaygroundpage/Contents.swift | b63fc399f0833679744d2fd2e2774385c48d0331 | [] | no_license | HYIUYOU/swift-test_1 | c7451127acd235c1bca9a19854ca0919ad508837 | 5d2549029984146a7e0b01659499eb0e7aa95530 | refs/heads/master | 2022-06-26T00:08:54.688305 | 2020-05-06T02:53:34 | 2020-05-06T02:53:34 | 261,636,462 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,723 | swift | /*:
## 练习 - 创建子类
- Note:(注):\
下面的练习基于一个太空飞船避开太空障碍物的游戏。飞船位于坐标系的底部,当障碍物从上向下“坠落”时,飞船只能向左或向右移动。在整个练习中,你将创建不同的类来代表可在游戏中使用的不同类型的太空飞船。下面是为你提供的基类 `Spaceship`。
*/
class Spaceship {
var name: String = ""
var health = 100
var position = 0
func moveLeft() {
position -= 1
}
func moveRight() {
position += 1
}
func wasHit() {
health -= 5
}
}
/*:
定义一个继承自 `Spaceship` 的新类 `Fighter`。添加一个默认值为空字符串的变量属性 `weapon`,以及一个默认值为 5 的变量属性 `remainingFirePower`。
*/
class Fighter: Spaceship {
var weapon = ""
var remainingFirePower = 5
func fire() {
if remainingFirePower > 0 {
remainingFirePower -= 1
} else {
print("You have no more fire power.")
}
}
}
/*:
创建一个名为 `destroyer` 的新 `Fighter` 实例。`Fighter` 将能够射击飞过来的物体,以避免与之发生碰撞。在初始化后,将 `weapon` 设置为“Laser”,将 `remainingFirePower` 设置为 10。请注意,`Fighter` 继承自 `Spaceship`,因此其也具有 `name`、`health` 和 `position` 属性,以及 `moveLeft()`、`moveRight()` 和 `wasHit()` 方法,即使你没有特意向 `Fighter` 声明中添加这些属性和方法,也是如此。将 `name` 设置为“Destroyer”,并输出 `position`,然后调用 `moveRight()`,再输出 `position`。
*/
let destroyer = Fighter()
destroyer.weapon = "Laser"
destroyer.remainingFirePower = 10
destroyer.name = "Destroyer"
print(destroyer.position)
destroyer.moveRight()
print(destroyer.position)
/*:
尝试输出 `falcon` 中的 `weapon`。为什么无法输出?通过注释或 print 语句提供你的答案,并将你所添加的无法编译的代码移除,如下所示。
*/
let falcon = Fighter()
print(falcon.weapon)
/*:
向 `fighter` 添加一个名为 `fire()` 的方法。此方法应检查 `remainingFirePower` 是否大于 0,如果是,则应以 1 递减 `remainingFirePower`。如果 `remainingFirePower` 不大于 0,则输出“You have no more fire power.”。对 `destroyer` 调用几次 `fire()`,并在每次调用该方法后输出 `remainingFirePower`。
*/
destroyer.fire()
print(destroyer.remainingFirePower)
destroyer.fire()
print(destroyer.remainingFirePower)
destroyer.fire()
print(destroyer.remainingFirePower)
//: [上一页](@previous) | 第 2 页,共 4 页 | [下一页:练习 - 覆盖方法和属性](@next)
| [
-1
] |
82c8934badf03e9d12e503bce4eff72d0cccaf7c | 837b91db18ca5bf6e95c5699d886d3aa005c1e25 | /Monies/app/controllers/Lock/LockViewController.swift | 59fa6df898f4ecfdf82947be29d350101c2e61dd | [
"MIT"
] | permissive | Dan2552/Monies | 084e61b53d8ba7fd81b3c9e86dab4998a061f039 | 67cf81b75a971e989e1b06a7c112e82a280fbe06 | refs/heads/master | 2021-01-23T19:11:16.260404 | 2017-11-11T22:49:32 | 2017-11-11T22:49:32 | 35,155,601 | 8 | 1 | null | 2017-05-25T22:01:30 | 2015-05-06T11:55:00 | Swift | UTF-8 | Swift | false | false | 1,285 | swift | import UIKit
import LocalAuthentication
import Async
import Placemat
class LockViewController: UIViewController {
override func viewDidLoad() {
view.backgroundColor = Style().primaryColor
}
override func viewDidAppear(_ animated: Bool) {
guard ensureHasAccounts() else { return }
touchId()
}
func touchId() {
let context = LAContext()
var error: NSError?
let myLocalizedReasonString = "Identify"
// Allow devices without TouchID
guard context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
allow()
return
}
context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, error in
if success {
Async.main(after: 0) { self.allow() }
} else {
Async.main(after: 5) { self.touchId() }
}
}
}
func allow() {
NavigationFlow().presentMainScreen(from: self)
}
func ensureHasAccounts() -> Bool {
if BankLogin.existing() { return true }
NavigationFlow().presentEditBankLogin(from: self)
return false
}
}
| [
-1
] |
9a9b11082585b7a7d402811fed94b363d66b3598 | 536a7f92b8b1c20e0bf7c5ab4e20b5e9680d83ac | /Trial-Expire-While-Running/MyNewApp/TrialProvider.swift | cd7519c8fda9fd47c8d25f599d61889e896cbc62 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | adamnemecek/mac-licensing-fastspring-cocoafob | 20b3a470b14f54493220093dbf2a9c8d414f2bcc | 734934697d4663973fac13e4cbb63c3f350864c5 | refs/heads/master | 2020-04-05T23:26:33.036773 | 2016-03-22T12:44:54 | 2016-03-22T12:45:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 925 | swift | // Copyright (c) 2015 Christian Tietze
//
// See the file LICENSE for copying permission.
import Foundation
public class TrialProvider {
public init() { }
lazy var userDefaults: NSUserDefaults = UserDefaults.standardUserDefaults()
public var currentTrialPeriod: TrialPeriod? {
if let startDate = userDefaults.objectForKey("\(TrialPeriod.UserDefaultsKeys.StartDate)") as? NSDate,
endDate = userDefaults.objectForKey("\(TrialPeriod.UserDefaultsKeys.EndDate)") as? NSDate {
return TrialPeriod(startDate: startDate, endDate: endDate)
}
return .None
}
public func currentTrialWithClock(clock: KnowsTimeAndDate) -> Trial? {
if let trialPeriod = currentTrialPeriod {
return Trial(trialPeriod: trialPeriod, clock: clock)
}
return .None
}
}
| [
-1
] |
ba81334349465e88014e413bb5956c64d673b080 | 12223049f9cbb22f083894140d092cac7307a445 | /sourceCode/iOS/NhacCuaTui/Resource/UIToast/UIToastCenter.swift | 2ffe98ae30d3743fa2e1e285429eefc03537b7e7 | [] | no_license | tiendnuit/555 | 89fafc19e6bd2a921eac6cd922602c6956365ef1 | 15e6d29631ee8971240f0823f7b42506a30d76ad | refs/heads/master | 2021-07-09T10:53:21.091994 | 2017-10-07T07:36:24 | 2017-10-07T07:36:24 | 106,079,504 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,167 | swift | //
// UIToastCenter.swift
// ecoinsystem
//
// Created by Delphinus on 6/1/15.
// Copyright (c) 2015 Delphinus. All rights reserved.
//
import UIKit
@objc open class UIToastCenter: NSObject {
fileprivate var _queue: OperationQueue!
fileprivate struct Singletone {
static let defaultCenter = UIToastCenter()
}
open class func defaultCenter() -> UIToastCenter {
return Singletone.defaultCenter
}
override init() {
super.init()
self._queue = OperationQueue()
self._queue.maxConcurrentOperationCount = 1
NotificationCenter.default.addObserver(
self,
selector: #selector(UIToastCenter.deviceOrientationDidChange(_:)),
name: NSNotification.Name.UIDeviceOrientationDidChange,
object: nil
)
}
open func addToast(_ toast: UIToast) {
self._queue.addOperation(toast)
}
func deviceOrientationDidChange(_ sender: AnyObject?) {
if self._queue.operations.count > 0 {
let lastToast: UIToast = _queue.operations[0] as! UIToast
lastToast.view.updateView()
}
}
}
| [
188225
] |
92b5c1230db174efe0ad831116631c895ff6478f | 431240081869ba10ecb09901b253aa128b5b6bac | /iOSEngineerCodeCheck/Repository/GitHubRepositoryRepository.swift | 38e9e0347d4ff88899d35b3fc8dcb17c1175428f | [
"Apache-2.0"
] | permissive | YIshihara11201/yumemi-ios-engineer-codecheck | 2becd3e63e3b38130bb5ae7cdbb1c965bdaa1173 | bb0280beddbcd4e4f3e3cda98386fbaa09e28ec0 | refs/heads/main | 2023-08-24T06:05:10.006748 | 2021-10-27T21:19:47 | 2021-10-27T21:19:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 846 | swift | //
// GitHubRepositoryRepository.swift
// iOSEngineerCodeCheck
//
// Created by kntk on 2021/10/24.
// Copyright © 2021 YUMEMI Inc. All rights reserved.
//
protocol GitHubRepositoryRepository {
/// 指定された検索語でGitHubのリポジトリを検索する
///
/// - parameters:
/// - word: 検索語
/// - sort: 検索結果のソート方法
/// - returns: 検索結果
func searchGitHubRepositories(by word: String, sort: GitHubRepositorySortKind) async throws -> [GitHubRepository]
}
final class GitHubRepositoryRepositoryImpl: GitHubRepositoryRepository {
func searchGitHubRepositories(by word: String, sort: GitHubRepositorySortKind) async throws -> [GitHubRepository] {
return try await API.shared.call(SearchGitHubRepositoryRequest(query: word, sort: sort)).items
}
}
| [
-1
] |
535dfa5b19cbe11cf974e6906d808f6afa8d3867 | 41aa9bc6f7fb7af22248cda5a3c5b2a49ab51563 | /NewAppStore/Models.swift | 5213e09cbd0aaef1494c6d3dee5977ca773daa67 | [] | no_license | alexbeattie/appStoredemo | 1483101552b3b5c755bb974dbcc7bb1e6ea1e6d1 | a0d9d4dcae1ed751e598e6323cc73d8525b7baac | refs/heads/master | 2021-06-29T05:10:03.074443 | 2017-09-24T18:15:19 | 2017-09-24T18:15:19 | 104,495,396 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,699 | swift | //
// Models.swift
// NewAppStore
//
// Created by Alex Beattie on 9/22/17.
// Copyright © 2017 Artisan Branding. All rights reserved.
//
import UIKit
struct FeaturedApps: Decodable {
var bannerCategory: AppCategory?
var categories: [AppCategory]?
}
struct AppCategory: Decodable {
let name: String?
let apps: [App]?
let type: String?
static func fetchFeaturedApps(_ completionHandler: @escaping (FeaturedApps) -> ()) {
let urlString = "https://api.letsbuildthatapp.com/appstore/featured"
URLSession.shared.dataTask(with: URL(string: urlString)!, completionHandler: { (data, response, error) -> Void in
guard let data = data else { return }
if let error = error {
print(error)
return
}
do {
let decoder = JSONDecoder()
let featuredApps = try decoder.decode(FeaturedApps.self, from: data)
print(featuredApps)
DispatchQueue.main.async(execute: { () -> Void in
completionHandler(featuredApps)
})
} catch let err {
print(err)
}
}) .resume()
}
}
struct App: Decodable {
let Id: Int?
var Name: String?
var Category: String?
var ImageName: String?
var Price: Float?
// var Screenshots: [String]?
// var description: String?
// var appInformation: [AppInformation]?
}
//struct AppInformation: Decodable {
// let Name: String
// let Value: String
//}
| [
-1
] |
3b1587176072395eda7e4825314a4e99bb2c7202 | 690604fa41bd34eb42464499b9c2d13eea221519 | /Week_08/merge-intervals.playground/Contents.swift | d954167a65dfe73a4134e1af627562c5535e02b5 | [] | no_license | taoyuxuan/algorithm009-class02 | 8d00ce53e83cf262ed026c8294d2837f81a8bcb0 | 292d9f1c22c544ea04518f9b543ddc55c170b79e | refs/heads/master | 2022-11-22T07:51:55.195497 | 2020-07-27T03:52:36 | 2020-07-27T03:52:36 | 264,992,029 | 0 | 0 | null | 2020-05-18T16:07:16 | 2020-05-18T16:07:15 | null | UTF-8 | Swift | false | false | 1,189 | swift | import UIKit
//56. 合并区间
//给出一个区间的集合,请合并所有重叠的区间。
//
//示例 1:
//
//输入: [[1,3],[2,6],[8,10],[15,18]]
//输出: [[1,6],[8,10],[15,18]]
//解释: 区间 [1,3] 和 [2,6] 重叠, 将它们合并为 [1,6].
//示例 2:
//
//输入: [[1,4],[4,5]]
//输出: [[1,5]]
//解释: 区间 [1,4] 和 [4,5] 可被视为重叠区间。
// *********************** 解法一 排序 ********************* //
class Solution {
func merge(_ intervals: [[Int]]) -> [[Int]] {
let cnt: Int = intervals.count
if cnt == 0 { return [] }
let sortedIntervals: [[Int]] = intervals.sorted { $0[0] < $1[0] }
var merged: [[Int]] = []
for i in 0..<cnt {
let L = sortedIntervals[i][0]
let R = sortedIntervals[i][1]
let curcnt: Int = merged.count
if curcnt == 0 || merged[curcnt-1][1] < L {
merged.append([L,R])
} else {
merged[curcnt-1][1] = max(merged[curcnt-1][1], R)
}
}
return merged
}
}
let solu = Solution()
let result = solu.merge([[1,3],[8,10],[2,6],[15,18]])
print(result)
| [
-1
] |
babf7f4768fc4e983d8b0ee9a46f11f33b5d8bc4 | 6544d97866fc55f60079de8b49d9d26754f2c45f | /proj/fitWomanProject/MealsViewController.swift | 51f1ce8c04395293dd3f35a30e20eaa9068446e4 | [] | no_license | marwaronron/FitnessForWomen-IOS-Swift | ec34d092da39b47ada07388a9c897e0d97cd8c83 | 7aa515d44e816771803aa66a04c716d26ab9a4da | refs/heads/master | 2022-11-28T17:55:27.581578 | 2020-08-01T13:44:15 | 2020-08-01T13:44:15 | 284,261,751 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 9,553 | swift | //
// MealsViewController.swift
// fitWomanProject
//
// Created by marwa on 05/12/2018.
// Copyright © 2018 marwa. All rights reserved.
//
import UIKit
import Alamofire
import SwiftyJSON
import AlamofireImage
class MealsViewController: BaseViewController ,UITableViewDataSource , UITableViewDelegate{
let URL_SAVE_USER = "http://\(MyIPAddress.IPAddress)/FitWomanServicesIOS/MdeleteMeal.php"
let defaults = UserDefaults.standard
var ActivitiesArray = [AnyObject]()
var UserEmail:String = ""
var MarwaBMI:String = ""
var a:Int = 0
var c:Int = 0
var e:Int = 0
var f:Int = 0
var g:Int = 0
var h:Int = 0
@IBOutlet weak var AddMealView: UIView!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var remaining: UILabel!
@IBOutlet weak var consumed: UILabel!
@IBOutlet weak var budget: UILabel!
@IBOutlet weak var today: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
addSlideMenuButton()
addSlideMenuButton()
UserEmail = defaults.object(forKey:"email") as! String
MarwaBMI = defaults.object(forKey:"bmi") as! String
self.tableView.reloadData()
FetchData()
let datex = Date()
let formatterx = DateFormatter()
formatterx.dateFormat = "yyyy-MM-dd"
let resultx = formatterx.string(from: datex)
self.today.text = "Today, \(resultx) "
if(MarwaBMI == "1"){
budget.text = "2500"
consumed.text = "0"
remaining.text = "2500"
}else if(MarwaBMI == "2"){
budget.text = "2000"
consumed.text = "0"
remaining.text = "2000"
} else if(MarwaBMI == "3"){
budget.text = "1500"
consumed.text = "0"
remaining.text = "1500"
}
c = Int(budget.text!)!
AddMealView.layer.shadowColor = UIColor.gray.cgColor
AddMealView.layer.shadowOpacity = 0.3
AddMealView.layer.shadowOffset = CGSize.zero
AddMealView.layer.shadowRadius = 6
}
func FetchData() {
////////////////////////////////////////////////////////////
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
let result = formatter.string(from: date)
///////////////////////////////////////////////////////////
let url = "http://\(MyIPAddress.IPAddress)/FitWomanServicesIOS/MgetMealByUserDay.php"
let _headers : HTTPHeaders = ["Content-Type":"application/x-www-form-urlencoded"]
let params : Parameters = ["emailUser": UserEmail ,
"day": result]
// let urlL = NSURL(string:url as String)
Alamofire.request(url, method: .post, parameters: params, encoding: URLEncoding.httpBody , headers: _headers).responseJSON { (responseData) -> Void in
if((responseData.result.value) != nil) {
let swiftyJsonVar = JSON(responseData.result.value!)
//
if let resData = swiftyJsonVar[].arrayObject {
self.ActivitiesArray = resData as [AnyObject]; ()
self.tableView.reloadData()
print(responseData)
}
if self.ActivitiesArray.count > 0 {
self.tableView.isHidden = false
// self.noActivity.isHidden = true
self.tableView.reloadData()
print(responseData)
} else {
self.tableView.isHidden = true
//self.noActivity.isHidden = false
}
}else{
print(responseData)
print(responseData.result.value as Any)
}
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return ActivitiesArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MealCell")
let contentView = cell?.viewWithTag(0)
let ActivityName = contentView?.viewWithTag(1) as! UILabel
let ActivityCalories = contentView?.viewWithTag(2) as! UILabel
let iew = contentView?.viewWithTag(50)
let Activityarray = ActivitiesArray[ indexPath.item] as! Dictionary<String,Any>
let type = Activityarray["type"] as! String
let name = Activityarray["name"] as! String
let totalCal = Activityarray["totalCalories"] as! String
ActivityName.text = "\(type) : \(name)"
ActivityCalories.text = "Total Calories: \(totalCal) cal"
iew?.layer.cornerRadius = 9
iew?.layer.shadowColor = UIColor.gray.cgColor
iew?.layer.shadowOpacity = 0.3
iew?.layer.shadowOffset = CGSize.zero
iew?.layer.shadowRadius = 6
if ActivitiesArray.count > e {
e = e + 1
//budget.text = String(e)
let b = Int(totalCal)
a = a + b!
consumed.text = String(a)
///////////////////////
c = c - b!
remaining.text = String(c)
///////////////////////////
}
return cell!
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if(editingStyle == .delete){
print("delet")
let ActivityarrayD = ActivitiesArray[ indexPath.row] as! Dictionary<String,Any>
let idActivity = ActivityarrayD["id"] as! String
let ActivityC = ActivityarrayD["totalCalories"] as! String
//////////////////////////////////////////
let requestURL = NSURL(string: URL_SAVE_USER)
let request = NSMutableURLRequest(url: requestURL! as URL)
request.httpMethod = "POST"
let postParameters = "id=" + idActivity
request.httpBody = postParameters.data(using: String.Encoding.utf8)
let task = URLSession.shared.dataTask(with: request as URLRequest){
data, response, error in
if error != nil{
print("error ")
return;
}
do {
let myJSON = try JSONSerialization.jsonObject(with: data!, options: JSONSerialization.ReadingOptions.allowFragments) as? [String:AnyObject]
if let parseJSON = myJSON {
var msg : String!
msg = parseJSON["message"] as! String?
print(msg)
}
} catch {
print(error)
}
}
task.resume()
//////////////////////////////////////////
ActivitiesArray.remove(at: indexPath.row)
tableView.reloadData()
if self.ActivitiesArray.count > 0 {
self.tableView.isHidden = false
// self.noActivity.isHidden = true
if ActivitiesArray.count > f {
f = e - 1
let b = Int(ActivityC)
g = a - b!
consumed.text = String(g)
///////////////////////
h = c + b!
remaining.text = String(h)
///////////////////////////
}
self.tableView.reloadData()
} else {
self.tableView.isHidden = true
// self.noActivity.isHidden = false
consumed.text = "0"
remaining.text = budget.text
}
}
///////////////////////////
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MealDetailViewController") as! MealDetailViewController
let workoutarray = ActivitiesArray[indexPath.item] as! Dictionary<String,Any>
popOverVC.BIngredients = workoutarray["ingredients"] as? String
self.addChild(popOverVC)
popOverVC.view.frame = self.view.frame
self.view.addSubview(popOverVC.view)
popOverVC.didMove(toParent: self)
}
/*
// 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.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
e8d6e6bfb7762ab0804c6f188fb054509f617159 | dc46175de2cbe6bbdadd78a311a7a59c728d13eb | /LearnMVC_API/AppDelegate.swift | 49aa6e49973e49efd9d3d06cf4f848047dc75cb5 | [] | no_license | sebkoo/LearnMVC_API | 061a0778348e0fded7c098e1955f0576aa468e33 | 98850f0a51256116a70d4a07c81a8bcc4b0612b4 | refs/heads/main | 2023-03-01T02:36:41.587784 | 2021-02-11T01:51:53 | 2021-02-11T01:51:53 | 338,102,418 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,352 | swift | //
// AppDelegate.swift
// LearnMVC_API
//
// Created by Sebastian Koo on 2/10/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
368727,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
327871,
377036,
377046,
418007,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
262404,
180490,
164106,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
246123,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
262566,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
337205,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181673,
181681,
337329,
181684,
361917,
181696,
337349,
337365,
271839,
329191,
361960,
116210,
337398,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
403070,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329867,
329885,
411805,
346272,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
346355,
436473,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
330642,
355218,
412599,
207808,
379848,
396245,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
347176,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
126144,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249227,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
224909,
11918,
159374,
224913,
126610,
339601,
224916,
224919,
126616,
224922,
208538,
224926,
224929,
224932,
224936,
257704,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
257896,
274280,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
225493,
266453,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
332117,
348502,
250199,
250202,
332125,
250210,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
381436,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
332493,
357069,
357073,
332511,
332520,
340718,
332533,
348924,
389892,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
381813,
324472,
398201,
340858,
324475,
430972,
340861,
324478,
119674,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
381946,
349180,
431106,
357410,
250914,
185380,
357418,
209979,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
349308,
349311,
160895,
152703,
210052,
349319,
210055,
218247,
210067,
251044,
185511,
210107,
332997,
210127,
333009,
210131,
333014,
210143,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
365911,
259421,
365921,
333154,
333162,
234866,
390516,
333175,
357755,
251271,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
333498,
210631,
333511,
358099,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
399159,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
211160,
350425,
268507,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
325891,
350467,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
325919,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
326058,
375216,
334262,
334275,
326084,
358856,
334304,
334311,
375277,
334321,
350723,
391690,
186897,
342545,
334358,
342550,
342554,
334363,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
383793,
326451,
326454,
326460,
260924,
375612,
244540,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
342874,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
326598,
359366,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
359451,
261147,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
384107,
367723,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
384191,
351423,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384269,
253200,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
425276,
384323,
212291,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
376714,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
59f5e88e3862db1f6695e709f59515a1ac6f03a8 | 49ad3cc5a7e28fff1769797613816bfbe4a5ccbc | /PhoneNumberKit/MetadataManager.swift | a34e1d815d8400b45604195903ed90e29fe7d5cb | [
"MIT"
] | permissive | marmelroy/PhoneNumberKit | 146eb34da094967666a1523b94ec2cc48880f51f | b6c141f4a97dde7cd3ea335a5d6d679faa7675f6 | refs/heads/master | 2023-08-18T11:57:29.243589 | 2023-08-03T13:06:46 | 2023-08-03T13:06:46 | 43,208,710 | 5,217 | 971 | MIT | 2023-09-13T12:20:38 | 2015-09-26T14:37:36 | Swift | UTF-8 | Swift | false | false | 3,815 | swift | //
// Metadata.swift
// PhoneNumberKit
//
// Created by Roy Marmelstein on 03/10/2015.
// Copyright © 2021 Roy Marmelstein. All rights reserved.
//
import Foundation
final class MetadataManager {
private(set) var territories = [MetadataTerritory]()
private var territoriesByCode = [UInt64: [MetadataTerritory]]()
private var mainTerritoryByCode = [UInt64: MetadataTerritory]()
private var territoriesByCountry = [String: MetadataTerritory]()
// MARK: Lifecycle
/// Private init populates metadata territories and the two hashed dictionaries for faster lookup.
///
/// - Parameter metadataCallback: a closure that returns metadata as JSON Data.
public init(metadataCallback: MetadataCallback) {
self.territories = self.populateTerritories(metadataCallback: metadataCallback)
for item in self.territories {
var currentTerritories: [MetadataTerritory] = self.territoriesByCode[item.countryCode] ?? [MetadataTerritory]()
// In the case of multiple countries sharing a calling code, such as the NANPA countries,
// the one indicated with "isMainCountryForCode" in the metadata should be first.
if item.mainCountryForCode {
currentTerritories.insert(item, at: 0)
} else {
currentTerritories.append(item)
}
self.territoriesByCode[item.countryCode] = currentTerritories
if self.mainTerritoryByCode[item.countryCode] == nil || item.mainCountryForCode == true {
self.mainTerritoryByCode[item.countryCode] = item
}
self.territoriesByCountry[item.codeID] = item
}
}
deinit {
territories.removeAll()
territoriesByCode.removeAll()
territoriesByCountry.removeAll()
}
/// Populates the metadata from a metadataCallback.
///
/// - Parameter metadataCallback: a closure that returns metadata as JSON Data.
/// - Returns: array of MetadataTerritory objects
private func populateTerritories(metadataCallback: MetadataCallback) -> [MetadataTerritory] {
var territoryArray = [MetadataTerritory]()
do {
let jsonData: Data? = try metadataCallback()
let jsonDecoder = JSONDecoder()
if let jsonData = jsonData, let metadata: PhoneNumberMetadata = try? jsonDecoder.decode(PhoneNumberMetadata.self, from: jsonData) {
territoryArray = metadata.territories
}
} catch {
debugPrint("ERROR: Unable to load PhoneNumberMetadata.json resource: \(error.localizedDescription)")
}
return territoryArray
}
// MARK: Filters
/// Get an array of MetadataTerritory objects corresponding to a given country code.
///
/// - parameter code: international country code (e.g 44 for the UK).
///
/// - returns: optional array of MetadataTerritory objects.
internal func filterTerritories(byCode code: UInt64) -> [MetadataTerritory]? {
return self.territoriesByCode[code]
}
/// Get the MetadataTerritory objects for an ISO 3166 compliant region code.
///
/// - parameter country: ISO 3166 compliant region code (e.g "GB" for the UK).
///
/// - returns: A MetadataTerritory object.
internal func filterTerritories(byCountry country: String) -> MetadataTerritory? {
return self.territoriesByCountry[country.uppercased()]
}
/// Get the main MetadataTerritory objects for a given country code.
///
/// - parameter code: An international country code (e.g 1 for the US).
///
/// - returns: A MetadataTerritory object.
internal func mainTerritory(forCode code: UInt64) -> MetadataTerritory? {
return self.mainTerritoryByCode[code]
}
}
| [
-1
] |
fc42416623e9578cd694ad96c29ea7cc19c609fb | ca5b330491ccdb07eaf3d455c62c14b6914ba4d2 | /studentklubben/ViewController.swift | 87eeb1c8bd3c1984405880e68e6aab70c572eef8 | [] | no_license | Sonberg/Studentklubben | 5375590da7e66458af5954ed78091ddc5b7b45be | 73b3d4d7e04db18c9401144636f2980f9b5d0a0b | refs/heads/master | 2020-05-27T12:39:24.971981 | 2017-02-23T18:39:45 | 2017-02-23T18:39:45 | 82,549,860 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,687 | swift | //
// ViewController.swift
// maprun
//
// Created by Per Sonberg on 2017-01-26.
// Copyright © 2017 Per Sonberg. All rights reserved.
//
import UIKit
import Firebase
import FontAwesome_swift
import BTNavigationDropdownMenu
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate {
// MARK : - Outlets
@IBOutlet weak var tableView: UITableView!
// MARK : - Actions
func didTouchUser(_ sender : Any) {
self.performSegue(withIdentifier: "userSegue", sender: self)
}
// MARK : - Varables
let transtition = SwiftyExpandingTransition()
var selectedCellFrame : CGRect = .zero
var events : [Event] = []
let screen = UIScreen.main.bounds
var user : User = User() {
didSet {
print(user)
}
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController!.interactivePopGestureRecognizer?.delegate = self
self.navigationController?.setNavigationBarHidden(true, animated: false)
self.firebase()
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor.white
tableView.contentInset = UIEdgeInsets(top: 64, left: 10, bottom: 0, right: -10)
view.backgroundColor = UIColor.white
// MARK : - User profile
let userButton = UIButton(frame: CGRect(x: Int(self.screen.size.width) - 32 - 16, y: 28, width: 32, height: 32))
userButton.setImage(UIImage.init(icon: FontType.linearIcons(LinearIconType.user), size: CGSize(width: 24, height: 24), textColor: .darkGray, backgroundColor: .clear), for: .normal)
userButton.addTarget(self, action: #selector(didTouchUser(_:)), for: .touchUpInside)
self.view.addSubview(userButton)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
navigationItem.title = "Studentklubben"
navigationController?.setNavigationBarHidden(true, animated: false)
tableView.reloadData()
// MARK : - Logout
let firebaseAuth = FIRAuth.auth()
do {
try firebaseAuth?.signOut()
} catch let signOutError as NSError {
print ("Error signing out: %@", signOutError)
}
}
// MARK : - Table View
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return events.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CardTableViewCell
cell.event = self.events[indexPath.row]
// MARK : - Going State
if self.events[indexPath.row].going.contains("me") {
let check = UIImage.fontAwesomeIcon(name: FontAwesome.check, textColor: .white, size: CGSize(width: 22, height: 22))
//cell.accessoryView = UIImageView(image: check)
} else {
cell.accessoryView = nil
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! CardTableViewCell
self.selectedCellFrame = tableView.convert(cell.frame, to: tableView.superview)
self.performSegue(withIdentifier: "eventSegue", sender: self)
}
// MARK : - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
self.navigationItem.title = ""
if segue.destination is EventViewController {
//self.navigationController?.delegate = self
if let indexPath = self.tableView.indexPathForSelectedRow {
let vc = segue.destination as! EventViewController
vc.event = self.events[indexPath.row]
self.tableView.deselectRow(at: indexPath, animated: true)
}
}
}
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if operation == UINavigationControllerOperation.push {
transtition.operation = UINavigationControllerOperation.push
transtition.duration = 0.40
transtition.selectedCellFrame = self.selectedCellFrame
return transtition
}
if operation == UINavigationControllerOperation.pop {
transtition.operation = UINavigationControllerOperation.pop
transtition.duration = 0.20
return transtition
}
return nil
}
func townMenu() {
let items = ["Most Popular", "Latest", "Trending", "Nearest", "Top Picks"]
let menuView = BTNavigationDropdownMenu(navigationController: self.navigationController, containerView: self.navigationController!.view, title: "Dropdown Menu", items: items as [AnyObject])
menuView.cellBackgroundColor = .flatWhite
self.navigationItem.setRightBarButton(UIBarButtonItem(customView: menuView), animated: true)
menuView.didSelectItemAtIndexHandler = {[weak self] (indexPath: Int) -> () in
print("Did select item at index: \(indexPath)")
}
}
}
// MARK : - Firebase
extension ViewController {
func firebase() {
let ref = FIRDatabase.database().reference().child("events")
ref.observe(FIRDataEventType.childAdded) { (snap : FIRDataSnapshot) in
self.events.append(Event(snap: snap))
self.tableView.reloadData()
}
ref.observe(FIRDataEventType.childChanged) { (snap : FIRDataSnapshot) in
let event = Event(snap: snap)
for index in 0...self.events.count - 1 {
if self.events[index].id == event.id {
self.events[index] = event
self.tableView.reloadData()
}
}
}
ref.observe(FIRDataEventType.childRemoved) { (snap : FIRDataSnapshot) in
for index in 0...self.events.count - 1 {
if self.events[index].id == snap.key {
self.events.remove(at: index)
self.tableView.reloadData()
}
}
}
}
}
| [
-1
] |
f81943d7747bbdaf81a9ef2d20892c01e0fce844 | 64f4ac10870a0f5fd030803ac9306eb0d27b333e | /Proyecto final/Organizador/Organizador/TimerViewController.swift | 46926c495fbe4c534849df12dc1d0d2819775160 | [] | no_license | ferfarron06/Computo-movil | 90d116d53701236f1168dd514f38c3499eef77d4 | de5ec6ea0000ba4b5735c3afe5eb09317f893d2b | refs/heads/master | 2020-03-26T17:46:21.141778 | 2018-12-05T18:56:24 | 2018-12-05T18:56:24 | 144,937,478 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 823 | swift | //
// TimerViewController.swift
// Organizador
//
// Created by Fer on 12/5/18.
// Copyright © 2018 Fer. All rights reserved.
//
import UIKit
class TimerViewController: UIViewController {
@IBOutlet weak var sliderOutlet: UISlider!
@IBOutlet weak var label: UILabel!
@IBAction func slider(_ sender: UISlider) {
}
@IBOutlet weak var startOutlet: UIButton!
@IBAction func start(_ sender: Any) {
}
@IBOutlet weak var stopOutlet: UIButton!
@IBAction func stop(_ sender: Any) {
}
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.
}
}
| [
-1
] |
4e1ad8306e46a0c989ba648ad5ba6474ff9c0de0 | f533478ecacbb358e7d0e6b41e4fb6309bcbc203 | /MBU-AgTasarimProje/Controller/FLSM/FLSMResultViewController.swift | 051198cc79b51b15285e5b9f7f06505a713d5596 | [] | no_license | yusufalicezik/MBU-VLSMSubnetting | b116c98634906657bac4812f315099f7d96a12db | e5108ea29df1c008b04e6ed7852a6fa4f4a5f6b8 | refs/heads/master | 2020-08-27T15:05:04.016172 | 2020-01-06T19:43:03 | 2020-01-06T19:43:03 | 217,416,111 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 16,737 | swift | //
// FLSMResultViewController.swift
// MBU-AgTasarimProje
//
// Created by Yusuf ali cezik on 26.11.2019.
// Copyright © 2019 Yusuf Ali Cezik. All rights reserved.
//
import UIKit
class FLSMResultViewController: UIViewController {
@IBOutlet weak var kullanilanIPAdresi: UILabel!
@IBOutlet weak var kullanilanIPBinary: UILabel!
@IBOutlet weak var subnetBinary: UILabel!
@IBOutlet weak var tableView: UITableView!
public var dataList:[Ag] = []
public var ipAdress:String?
private var increase_count = 0
private var allDatas = [String]()
private var dataListResult:[AgResult] = []
private var allCells = [AgInfoCell]()
private var subnetCount = 0
private var exp1_count = 0
private var new_subnet_mask:String = ""
fileprivate var firstTime = true
private var subnetBinaryString = ""
private var indexNo = 0
private var kullanilanIPString = ""
private var kullanilanSubnetString = ""
private var kullanilanIPBinaryString = ""
private var ayirilanIPCount = 0
override func viewDidLoad() {
super.viewDidLoad()
setup()
calculateFLSM()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
UIApplication.shared.statusBarView?.backgroundColor = #colorLiteral(red: 0.2862745098, green: 0.5764705882, blue: 0.6588235294, alpha: 1)
self.setNeedsStatusBarAppearanceUpdate()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
private func setup(){
tableView.delegate = self
tableView.dataSource = self
self.tableView.tableFooterView = UIView()
}
@IBAction func backButtonClicked(_ sender: Any) {
self.navigationController?.popViewController(animated: true)
}
@IBAction func tableButtonClicked(_ sender: Any) {
let vc = storyboard?.instantiateViewController(withIdentifier: "allVC") as? AllResultsViewController
vc?.dataList = self.dataListResult
self.navigationController?.pushViewController(vc!, animated: true)
}
}
extension FLSMResultViewController:UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataListResult.count-1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = Bundle.main.loadNibNamed("AgInfoCell", owner: self, options: nil)?.first as? AgInfoCell else {return UITableViewCell()}
cell.agAdiLabel.text = self.dataListResult[indexPath.row].agName
cell.hostSayisiLabel.text = self.dataListResult[indexPath.row].agAgAdresi
cell.detailicon.isHidden = false
print(self.dataListResult[indexPath.row].agBitisIp)
print(self.dataListResult[indexPath.row].agYayinAdresi)
allCells.append(cell)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.tableView.deselectRow(at: indexPath, animated: true)
let detailsVC = storyboard?.instantiateViewController(withIdentifier: "DetailVC") as? DetailResultViewController
let secilenAg = self.dataListResult[indexPath.row]
detailsVC?.propertyList = [secilenAg.agName,secilenAg.agHostSayisi, secilenAg.ayrilanIPSayisi,secilenAg.kullanılanIPAdres, secilenAg.bostaKalanIPAdress,secilenAg.agAgAdresi,secilenAg.agBaslangicIp, secilenAg.agBitisIp, secilenAg.agYayinAdresi, secilenAg.agAltAgMaskesi]
self.navigationController?.pushViewController(detailsVC!, animated: true)
}
}
extension FLSMResultViewController{
private func calculateFLSM(){
self.subnetCount = self.dataList.count
var currentExp = 0
var last_i = 0
for i in 0..<100{
currentExp = 2.getExp(exp: i)
if (currentExp) >= subnetCount-1{
last_i = i
break
}
}
self.exp1_count = last_i // 6 alt ağ ise 3 olmalı
var seperatedNetwork = ipAdress!.split(separator: "/")
let subnetMask = Int(seperatedNetwork[1])! // /16
self.new_subnet_mask = String(subnetMask+self.exp1_count) // 16 + 3
print(new_subnet_mask)
let ipAdressList = getIpAdressInt(String(seperatedNetwork[0]))//"192.168.1.10" luk kısımı ayrıp int dizisi olarak döndürür
let subnedMaskListInt:[Int64] = getSubnetMaskString(Int64(subnetMask)) //16 tane 1 olan dizi döner.
let starting_ip_address = AndTwoValue(ipAdressList,subnedMaskListInt)
print(starting_ip_address) //tüm ağın baslangic ip adresi (andlenmiş vs.)
let decimal_starting_ip_address = getDecimalIPAdress(starting_ip_address) //decimal
//andlenmiş ip adres üzerinden;
let decimal_and_ip_address_list = decimal_starting_ip_address.split(separator: ".")
for i in 0..<decimal_and_ip_address_list.count{ //0 olan kısımı buluruz. 192.168.0.0 ise 2. index
if Int(decimal_and_ip_address_list[i]) == 0{
indexNo = i
break
}
}
print(indexNo)
let mList = decimal_and_ip_address_list //andlenmiş decimal ip adress
getIncreaseCount() //self.increase_count güncellenecek.
var currentCounter = 0
if indexNo == 1{
for i in 0..<self.dataList.count{
let addedString = "\(mList[0]).\(currentCounter).\(mList[2]).\(mList[3])"
self.allDatas.append(addedString)
currentCounter = self.increase_count*(i+1) //0, 32, 64 şeklinde sabit artış.
}
}else if indexNo == 2{
for i in 0..<self.dataList.count{
self.allDatas.append("\(mList[0]).\(mList[1]).\(currentCounter).\(mList[3])")
currentCounter = self.increase_count*(i+1)
}
}else if indexNo == 3{
for i in 0..<self.dataList.count{
self.allDatas.append("\(mList[0]).\(mList[1]).\(mList[2]).\(currentCounter)")
currentCounter = self.increase_count*(i+1)
}
}
saveData()
setupUI()
}
private func setupUI(){
self.kullanilanIPAdresi.text = self.ipAdress!
self.kullanilanIPBinary.text = self.kullanilanIPBinaryString
self.subnetBinary.text = self.kullanilanSubnetString
}
private func saveData(){
for i in 0..<self.allDatas.count{
let ag = AgResult()
ag.agName = self.dataList[i].agAdi
ag.agHostSayisi = String(self.dataList[i].hostSayisi)
ag.agAltAgMaskesi = "/\(self.new_subnet_mask)"
ag.agAgAdresi = self.allDatas[i]
ag.agBaslangicIp = getBitisIP(indexNo: indexNo, baslangicIP: self.allDatas[i], forBaslangic: true)
ag.agBitisIp = getBitisIP(indexNo:indexNo, baslangicIP:self.allDatas[i])
ag.agYayinAdresi = getYayinIP(indexNo:indexNo, baslangicIP:self.allDatas[i])
ag.ayrilanIPSayisi = "\(self.ayirilanIPCount-2)" //128 ise 126 (baslangic ve yayin haric)
ag.kullanılanIPAdres = String(self.dataList[i].hostSayisi)
ag.bostaKalanIPAdress = "\((self.ayirilanIPCount-2)-self.dataList[i].hostSayisi)"
self.dataListResult.append(ag)
}
}
private func getBitisIP(indexNo:Int, baslangicIP:String, forBaslangic:Bool = false)->String{
var returnedString = ""
if indexNo == 2{
self.ayirilanIPCount = 255*increase_count // örn: 32.255
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
if forBaslangic{
splittedInt[indexNo+1] = splittedInt[indexNo+1]!+1
}else{
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-1
if indexNo != 3{
splittedInt[indexNo+1] = 254
}
}
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}else if indexNo == 1{
self.ayirilanIPCount = 255*255*increase_count
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
if forBaslangic{
splittedInt[indexNo+2] = splittedInt[indexNo+2]!+1
}else{
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-1
if indexNo != 2{
splittedInt[indexNo+1] = 255
splittedInt[indexNo+2] = 254
}
}
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}else if indexNo == 3{
self.ayirilanIPCount = increase_count
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
if forBaslangic{
splittedInt[indexNo] = splittedInt[indexNo]! + 1
}else{
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-2
}
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}
return returnedString
}
private func getYayinIP(indexNo:Int, baslangicIP:String)->String{
var returnedString = ""
if indexNo == 2{
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-1
if indexNo != 3{
splittedInt[indexNo+1] = 255
}
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}else if indexNo == 1{
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-1
if indexNo != 2{
splittedInt[indexNo+1] = 255
splittedInt[indexNo+2] = 255
}
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}else if indexNo == 3{
let splittedIP = baslangicIP.split(separator: ".")
var splittedInt = splittedIP.map{Int($0)}
splittedInt[indexNo] = splittedInt[indexNo]! + self.increase_count-1
for i in 0..<splittedInt.count{
if i != splittedInt.count-1{
returnedString += "\(splittedInt[i]!)."
}else{
returnedString += "\(splittedInt[i]!)"
}
}
}
return returnedString
}
private func getIncreaseCount(){
var currentCount = 256
for i in 0...exp1_count{
if i != 1{
currentCount/=2
}
}
print("artis: \(currentCount)")
self.increase_count = currentCount
}
private func getIpAdressInt(_ ipAdress:String)->[Int]{
let resultIPListString = ipAdress.split(separator: ".")
let resultIPList = resultIPListString.map({
Int($0)
})
return resultIPList as! [Int]
}
func getSubnetMaskString(_ subnetMask:Int64)->[Int64]{
var returnedMask:String = ""
var returnedMaskList = [Int64]()
for i in 1...32{
if i<=subnetMask{
returnedMask+="1"
}else{
returnedMask+="0"
}
if i%8 == 0{
returnedMaskList.append(Int64(returnedMask)!)
returnedMask = ""
}
}
return returnedMaskList
}
func AndTwoValue(_ ipAdressList:[Int], _ subnedMaskListInt:[Int64])->String{
var lastIpAdresWithSubnet = ""
let ipAddressByteList = getIpAdressListForByteList(ipAdressList) //string olarak aldık 111111, 000000
let subnetMaskByteList = getSubnetMaskForByteList(subnedMaskListInt)
subnetMaskByteList.forEach{self.kullanilanSubnetString+="\($0)."}
self.kullanilanSubnetString.removeLast()
ipAddressByteList.forEach{self.kullanilanIPBinaryString+="\($0)."}
self.kullanilanIPBinaryString.removeLast()
print(kullanilanIPBinaryString)
for i in 0..<ipAddressByteList.count{
let ipOktet = ipAddressByteList[i]
let subnetOktet = subnetMaskByteList[i]
for j in 0..<8{
if ipOktet[j] == "1" && subnetOktet[j] == "1"{
lastIpAdresWithSubnet+="1"
}else{
lastIpAdresWithSubnet+="0"
}
}
if i != ipAddressByteList.count-1{
lastIpAdresWithSubnet+="."
}
}
return lastIpAdresWithSubnet
}
func getIpAdressListForByteList(_ ipAdressList:[Int])->[String]{
var returnetByteList = [String]()
for i in 0..<ipAdressList.count{
var byteInt = ""
var ipOktetItem = ipAdressList[i]
if ipOktetItem == 0{
byteInt = "00000000"
}else{
while(ipOktetItem>0){
let kalan = ipOktetItem%2
byteInt=String(kalan)+byteInt
ipOktetItem = ipOktetItem/2
}
var newByteInt = ""
if byteInt.count < 8{
let fark = 8-byteInt.count
for _ in 0..<fark{
newByteInt += "0"
}
byteInt = newByteInt+byteInt
}
}
returnetByteList.append(byteInt)
}
return returnetByteList
}
func getSubnetMaskForByteList(_ subnetList:[Int64])->[String]{
var returnetByteList = [String]()
for i in subnetList{
var stringItem = String(i)
if stringItem.count<8{
let fark = 8-stringItem.count
var newByteInt = ""
for _ in 0..<fark{
newByteInt+="0"
}
stringItem = newByteInt+stringItem
}
returnetByteList.append(stringItem)
}
//for CIDR
if firstTime{
for i in 0...returnetByteList.count-1{
self.subnetBinaryString+=returnetByteList[i]
if i != returnetByteList.count-1{
self.subnetBinaryString+="."
}
}
self.firstTime = false
}
return returnetByteList
}
func getDecimalIPAdress(_ withSubnetIpAdress:String)->String{
var decimalString = ""
let binaryList = withSubnetIpAdress.split(separator: ".")
for oktet in binaryList{
var oktetSumResult = 0
for j in 0...7{
if String(oktet)[j] == "1"{
let val = 2.getExp(exp: (7-j))
oktetSumResult+=val
}
}
decimalString+=String(oktetSumResult)
//if oktet != binaryList[binaryList.count-1]{
decimalString+="."
//}
}
return decimalString
}
}
| [
-1
] |
d531fdc12c0cfa9a3340f7e2865ccc369d7fe6f9 | 5fedb25db73bd2a13a13fe929630af8bda4b70c1 | /Sources/Extensions/UIKit/UIView/UIView+XibNameProtocol.swift | cf3888fd1d234a11179f05bc2075a9ed282b9863 | [
"Apache-2.0"
] | permissive | Loupehope/LeadKit | 1b850010f143146e1f2dc83c494a9257d9d45b8a | a4fef9cb206db3bc14cbc8e674855f9465abf420 | refs/heads/master | 2020-12-21T02:53:05.729972 | 2020-10-23T15:07:09 | 2020-10-23T15:07:09 | 236,284,948 | 0 | 0 | Apache-2.0 | 2020-08-17T17:55:50 | 2020-01-26T08:18:47 | Swift | UTF-8 | Swift | false | false | 1,265 | swift | //
// Copyright (c) 2017 Touch Instinct
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import UIKit
extension UIView: XibNameProtocol {
open class var xibName: String {
return typeName(of: self)
}
}
| [
194560,
395267,
196612,
395271,
395274,
108279,
395278,
395280,
395281,
395282,
395283,
407569,
334604,
395286,
395287,
228513,
395289,
395290,
23614,
196636,
407580,
196638,
395295,
395296,
196641,
98341,
61478,
98344,
98345,
98346,
98347,
223075,
98349,
23618,
23619,
329778,
59445,
174135,
354359,
124987,
174139,
174141,
354364,
229438,
229440,
229441,
395328,
354369,
174148,
327749,
229444,
395332,
174152,
327751,
395333,
395334,
229443,
378951,
229449,
174159,
229456,
112721,
112723,
106580,
142079,
106582,
106584,
106585,
112730,
106586,
106587,
174171,
174170,
354400,
284773,
208027,
124988,
208029,
213321,
125048,
229504,
125057,
125062,
125064,
125065,
235658,
208033,
125066,
285781,
229524,
303255,
303256,
229532,
125086,
125087,
215205,
215206,
215208,
215211,
215212,
215215,
241846,
241852,
191,
241856,
241859,
241860,
241862,
317638,
241864,
317640,
241866,
241868,
97327,
241870,
241871,
262353,
262354,
241873,
108281,
262357,
241877,
262359,
97329,
106713,
241878,
106715,
262361,
241879,
106714,
106719,
35040,
106720,
262366,
106725,
241894,
227183,
241897,
241901,
241903,
241904,
106737,
176369,
176370,
241907,
106741,
260342,
241908,
241910,
176373,
106746,
106747,
241916,
141565,
141566,
106750,
176378,
141569,
241923,
241926,
141576,
241928,
141578,
141577,
241930,
241955,
241934,
241931,
241936,
241937,
141586,
141583,
141588,
12565,
227604,
227607,
141591,
141592,
227608,
227610,
227612,
141595,
227614,
141596,
141597,
141598,
141600,
141601,
141603,
141599,
241952,
241957,
141606,
141607,
141608,
289062,
289068,
241962,
289067,
289071,
141612,
12592,
289074,
241963,
97347,
289078,
141627,
141628,
141629,
141632,
141634,
241989,
227609,
213319,
213320,
241993,
141639,
141640,
141641,
141642,
241994,
241999,
141643,
141649,
241996,
241998,
242002,
141651,
242006,
282967,
141654,
141655,
215384,
227613,
141660,
168285,
282969,
141663,
141664,
141665,
215396,
141670,
172391,
141674,
141676,
141677,
141679,
375153,
287090,
375155,
334196,
141681,
375154,
190840,
190841,
430456,
375163,
375164,
190843,
375166,
190844,
430458,
375168,
287106,
375171,
141700,
141701,
375173,
141702,
375172,
430471,
430475,
141707,
375181,
430476,
141711,
430483,
217492,
217494,
197016,
197018,
197019,
197021,
295330,
295331,
197029,
430502,
168359,
213421,
303550,
160205,
160208,
381398,
106742,
319962,
305637,
305638,
408040,
272872,
223741,
125456,
61971,
191006,
191007,
272931,
57893,
272934,
328232,
57896,
420394,
57899,
57900,
57901,
295467,
57903,
57904,
57905,
57906,
158257,
336445,
336446,
336450,
336451,
336453,
336454,
336455,
336457,
336459,
336460,
55886,
336464,
336465,
55890,
336467,
336466,
336469,
336470,
336471,
336472,
336473,
336474,
296688,
55901,
336478,
336479,
336480,
336481,
336482,
336483,
54666,
111202,
272994,
336487,
336488,
336489,
273003,
437302,
273021,
273023,
297615,
27810,
297620,
437310,
297625,
297634,
297636,
437314,
135854,
135860,
135861,
242361,
299713,
244419,
244421,
66247,
244427,
248524,
127693,
244430,
127695,
66257,
66261,
127702,
127703,
248541,
62174,
127714,
334563,
334564,
334562,
127716,
62183,
127727,
172784,
127729,
244469,
244470,
318199,
318200,
142073,
164601,
316155,
111356,
142076,
66302,
142078,
244480,
142081,
241944,
142083,
334590,
142085,
228512,
142087,
318207,
142089,
334601,
334596,
318220,
318221,
334600,
318223,
318218,
142097,
334603,
334602,
334606,
334607,
142093,
318231,
142095,
318233,
318234,
318235,
318236,
318237,
318238,
318239,
318240,
318241,
187173,
318246,
187175,
187176,
187174,
187177,
187179,
187180,
187178,
241954,
314165,
314167,
316216,
396088,
314170,
396089,
396091,
396092,
396094,
396095,
148287,
316224,
396098,
314179,
279366,
279367,
396104,
396110,
396112,
299858,
396115,
396114,
396118,
396119,
396120,
187223,
396122,
396123,
241961,
396125,
396126,
396127,
396128,
396129,
396134,
299880,
396137,
299884,
162668,
187248,
396147,
396151,
248696,
396153,
187258,
187259,
322430,
297858,
60304,
201617,
60312,
60317,
60318,
60319,
60321,
60322,
60323,
60324,
185258,
60331,
185259,
23469,
185262,
23470,
23472,
60337,
23473,
60338,
23474,
23475,
23476,
185267,
23479,
23481,
287674,
185275,
23483,
23487,
185280,
242796,
281538,
281539,
23492,
23493,
23494,
185286,
23499,
23501,
23502,
228306,
23508,
312407,
23515,
259036,
23517,
23519,
40089,
23523,
203755,
23531,
433131,
23533,
152560,
241992,
312413,
23552,
171008,
23554,
23555,
437252,
23557,
40096,
23559,
23560,
23561,
23562,
437258,
437256,
437261,
437266,
437267,
23572,
23573,
23574,
23575,
23576,
437273,
23578,
437269,
23580,
437277,
23582,
23581,
23584,
437281,
23585,
23590,
23591,
23592,
312423,
23594,
23595,
23596,
23597,
23598,
3119,
189488,
23599,
187442,
189490,
187444,
187445,
189492,
187447,
144440,
189493,
437305,
144443,
189491,
23607,
341054,
341055,
144441,
97339,
341058,
341059,
341060,
23612,
341062,
341063,
23616,
341057,
341066,
222278,
341068,
23620,
23621,
437326,
185428,
23636,
437333,
203862,
285783,
23640,
285784,
437338,
285787,
312412,
437340,
285782,
285785,
115805,
312417,
115806,
115807,
293982,
115809,
115810,
185446,
437349,
437353,
115817,
312427,
185451,
437356,
185454,
242794,
115819,
115820,
185452,
115823,
437364,
185455,
115825,
115827,
242803,
437369,
115829,
142459,
437371,
242807,
189508,
142463,
294016,
294015,
294012,
205959,
437384,
213935,
437390,
248975,
437392,
437396,
40088,
312473,
189594,
208026,
40092,
312476,
312478,
312479,
312480,
312481,
40098,
189598,
40095,
40101,
437412,
208039,
437415,
312489,
437416,
312482,
312492,
189607,
40110,
437423,
437424,
189609,
437426,
312499,
189612,
312501,
312502,
437431,
312504,
437433,
437430,
189619,
189621,
189623,
189626,
322751,
437440,
38081,
437436,
437443,
437445,
185453,
292041,
292042,
437451,
38092,
437453,
128874,
181455,
292049,
437458,
152789,
203990,
276230,
203991,
203993,
152795,
204000,
276232,
204003,
281832,
339176,
437428,
339177,
152821,
208117,
152825,
294138,
294137,
321829,
279818,
206094,
279823,
206097,
206098,
294162,
206102,
206103,
206104,
206107,
206108,
206109,
181533,
425247,
294181,
27943,
27944,
27945,
181544,
294183,
27948,
181545,
40105,
181553,
181559,
173368,
206137,
206138,
290105,
375165,
290113,
151285,
173379,
23471,
152906,
152907,
152908,
152909,
290126,
152910,
290123,
290125,
290127,
290130,
290131,
312483,
173394,
290135,
290136,
245081,
290137,
290139,
378206,
378207,
378208,
64865,
222562,
171363,
222563,
222566,
380266,
228717,
245102,
222573,
228721,
222577,
222579,
222581,
222582,
222587,
222590,
222591,
54655,
222594,
222596,
222597,
312493,
177543,
363913,
222599,
222601,
222603,
222604,
54669,
222605,
222606,
222607,
279954,
54673,
40109,
54678,
54680,
173465,
312497,
312498,
329120,
279969,
54692,
152998,
54698,
54701,
54703,
153009,
298431,
189495,
212420,
370118,
153037,
153049,
153051,
189496,
157151,
222689,
222692,
157157,
222693,
112111,
112115,
112117,
112120,
65016,
40450,
112131,
40451,
40453,
280068,
40455,
206344,
40457,
40458,
40459,
40460,
40463,
112144,
112145,
40466,
355859,
40469,
40471,
40475,
40477,
40479,
40482,
189593,
362020,
362022,
116267,
282156,
173614,
173615,
173617,
173618,
173621,
173622,
34359,
173623,
34362,
34365,
318228,
173631,
316993,
173634,
173635,
316995,
173637,
316997,
316996,
173640,
173641,
317001,
263755,
173639,
106082,
106085,
319081,
319085,
319088,
319089,
189502,
314168,
300660,
300661,
300662,
319094,
52855,
189610,
300663,
319098,
319101,
319103,
262475,
175760,
175763,
52884,
394899,
52886,
52887,
394905,
189617,
394908,
394910,
52896,
144435,
394912,
52899,
52900,
339622,
147113,
286378,
144437,
147115,
147116,
147118,
190842,
144438,
394930,
151218,
394935,
321210,
292544,
144442,
141593,
108230,
108234,
141594,
296682,
144444,
341052,
108240,
144445,
296684,
108245,
212694,
34516,
296660,
34522,
34531,
296687,
192229,
192230,
296679,
192231,
34537,
192232,
296681,
34538,
34540,
34541,
216812,
216814,
155377,
216815,
296691,
296692,
216816,
296694,
216818,
296696,
216819,
296698,
296699,
296700,
216822,
296702,
296703,
216826,
216828,
296706,
216829,
216832,
296709,
296710,
12569,
216833,
296713,
216834,
216836,
276236,
216837,
216838,
311055,
296712,
313101,
313104,
313099,
313108,
313102,
313111,
313112,
313113,
149274,
149275,
141609,
159518,
149280,
159523,
296701,
227116,
296704,
321342,
210755,
210756,
210757,
210758,
296707,
321353,
296708,
218959,
218960,
120655,
120656,
120657,
218963,
218964,
218962,
223064,
223065,
180058,
180059,
229209,
223069,
229213,
169824,
229217,
169826,
292705,
292708,
292709,
237413,
169830,
223076,
223081,
128873,
128875,
227179,
223085,
227180,
169835,
128876,
169837,
128878,
223086,
128884,
223087,
128881,
128882,
116600,
128883,
227188,
141181,
327550,
108419,
169860,
108421,
141189,
108425,
141198,
108431,
108432,
180070,
141202,
108436,
141208,
169881,
219033,
108446,
108448,
219040,
141219,
219043,
219044,
141220,
141223,
141228,
141229,
108460,
108462,
229294,
229295,
141235,
319426,
141253,
228510,
319432,
290767,
141264,
141646,
23600,
334591,
59349,
23601,
141272,
141273,
23602,
23603,
40931,
141284,
40932,
23604,
23608,
141650,
141290,
40940,
40941,
141293,
141295,
174063,
231406,
174066,
174067,
141652,
237559,
174074,
395259,
194558,
194559
] |
7d6df2ef6ff0dcad0c2dd2b27b1666351c947e7f | d607282fff1b4399778b4294da644c710d100eb8 | /UIStackViews/UIStackViews/ViewController.swift | 238db7c05a29599474be872fe9770e22240486bf | [] | no_license | owenhenley/iOS-Swift-Projects | c759e1d93231d829d97816241f9868507905c51a | 5866f89789e4ae2f8fa5c276530a5eb7e1fbc85b | refs/heads/master | 2021-07-01T01:57:19.068906 | 2018-12-14T00:57:52 | 2018-12-14T00:57:52 | 131,935,415 | 1 | 0 | null | 2018-08-20T03:40:01 | 2018-05-03T03:12:46 | Swift | UTF-8 | Swift | false | false | 357 | swift | //
// ViewController.swift
// UIStackViews
//
// Created by Owen Henley on 6/17/18.
// Copyright © 2018 Owen Henley. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
}
| [
190120
] |
d419560abdb168a52999697f3b8db46d2097cb31 | 4a6a8886825411741d0aae935c71efdcea686990 | /jianlei/base/Controller/DDRootTabBarVC.swift | 7a1535f62b19b38215dab44ef7ce76946d22313f | [] | no_license | hhcszgd/appFrame | 01cc8139a3ac1d33f61621767f488c1c7c5ca1a6 | 57018fff024b659da70840c7f2db11e829d036bc | refs/heads/master | 2020-07-27T21:50:16.249834 | 2019-09-18T05:39:26 | 2019-09-18T05:39:26 | 209,225,162 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,884 | swift | //
// DDRootTabBarVC.swift
// ZDLao
//
// Created by WY on 2019/9/13.
// Copyright © 2019年 jianlei. All rights reserved.
//
import UIKit
class DDRootTabBarVC: UITabBarController {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.setViewControllers(self.childVCToBeAdd() , animated: false)
self.tabBar.isTranslucent = false
self.tabBar.tintColor = UIColor.colorWithHexStringSwift("0357ba")//选中是,文字的颜色
self.tabBar.barTintColor = UIColor.white//bar的背景色
//去黑线
// self.tabBar.shadowImage = UIImage()
// self.tabBar.backgroundImage = UIImage()
}
func childVCToBeAdd() -> [UIViewController] {
var controllers = [UIViewController]()
controllers.append(DDItem1NavVC())
controllers.append(DDItem2NavVC())
controllers.append(DDItem3NaviVC())
return controllers
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func reset() {
// self.setViewControllers(self.childVCToBeAdd(), animated: true)
}
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
] |
20cf05404e36eb1a1c472bc90ed23032c4a8dc56 | e03360b03b9bc7e24392b5b8c73255718484347a | /XListing/Modules/Account/LogIn/LogInViewModel.swift | 5029cb4f7bdd5016785d59306c1316cf687594fc | [] | no_license | taonos/Z | 2a973716efa01729171a95c02f00434fd74014c7 | fa4363bb5a7408e29005808f043d0d86f37e1115 | refs/heads/master | 2021-06-05T07:33:05.904467 | 2016-03-14T22:29:53 | 2016-03-14T22:29:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,907 | swift | //
// LogInViewModel.swift
// XListing
//
// Created by Lance Zhu on 2015-06-09.
// Copyright (c) 2015 ZenChat. All rights reserved.
//
import Foundation
import ReactiveCocoa
import AVOSCloud
public final class LogInViewModel {
// MARK: - Input
// MARK: - Output
// MARK: - Properties
// MARK: - View Models
public let usernameAndPasswordViewModel = UsernameAndPasswordViewModel()
// MARK: - Services
private let meService: IMeService
private weak var accountNavigator: IAccountNavigator!
// MARK: - Initializers
public init(accountNavigator: IAccountNavigator, meService: IMeService) {
self.accountNavigator = accountNavigator
self.meService = meService
}
deinit {
// Dispose signals before deinit.
AccountLogVerbose("Log In View Model deinitializes.")
}
// MARK: - Setups
// MARK: - Others
public var logIn: SignalProducer<Bool, NSError> {
return usernameAndPasswordViewModel.allInputsValid.producer
// only allow TRUE value
.filter { $0 }
// combine the username and password into one signal
.flatMap(.Concat) { _ in
zip(self.usernameAndPasswordViewModel.username.producer.ignoreNil(), self.usernameAndPasswordViewModel.password.producer.ignoreNil())
}
// promote to NSError
.promoteErrors(NSError)
// log in user
.flatMap(FlattenStrategy.Merge) { username, password in
return self.meService.logIn(username, password: password)
}
.map { _ in
return true
}
}
public func finishModule(callback: (CompletionHandler? -> ())? = nil) {
accountNavigator.finishModule { handler in
callback?(handler)
}
}
}
| [
-1
] |
1f93bfab3f611d3a9c49d743cab6ffcc97cd667c | 3147267b91b20a07efa381f4dfd83732e778230a | /BooBooBoo/ViewController.swift | 1a452107be7fb048a9055ffafa6ce7c472bfa802 | [] | no_license | Minho-Choi/BooBooBoo | 32cf5884c9ccd2892b5c8a9a3cd93613ade606ac | 690f08e8054999aa31c0af08bd8aa0d06e195442 | refs/heads/main | 2022-12-28T14:52:25.646430 | 2020-10-16T14:28:15 | 2020-10-16T14:28:15 | 304,650,707 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 958 | swift | //
// ViewController.swift
// BooBooBoo
//
// Created by Minho Choi on 2020/10/16.
//
import UIKit
import AVFoundation
var soundEffect: AVAudioPlayer?
class ViewController: UIViewController {
@IBAction func airhornButton(_ sender: UIButton) {
playSound()
}
@IBOutlet weak var airhornButtonLook: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
private func playSound() {
let url = Bundle.main.url(forResource: "Airhorn", withExtension: "mp3")
if let url = url {
do {
soundEffect = try AVAudioPlayer(contentsOf: url)
guard let sound = soundEffect else { return }
sound.prepareToPlay()
sound.play()
} catch let error {
print(error.localizedDescription)
}
}
}
}
| [
-1
] |
09187a6db0267a91078ac8d64c221bc1c5e42009 | 7b044bc2bb3d90cc2c920b40dc7bc0193501329b | /GnomesBrowser/DataRetriever.swift | 33d3f81ac9c77e82a9358f114e889926ea548166 | [] | no_license | simarc86/GnomresBrowser | a93f556b66c2fde67c89415ef522d1cbc277bc26 | 3bbee50fcff30f6f327d3739790b264ada7a1555 | refs/heads/master | 2020-04-02T14:44:25.790204 | 2018-10-24T16:46:45 | 2018-10-24T16:46:45 | 154,536,785 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 973 | swift | //
// URLSession.swift
// GnomesBrowser
//
// Created by Marc Tamarit Romero on 21/9/18.
// Copyright © 2018 Marc Tamarit. All rights reserved.
//
import Foundation
protocol DataRetrieverDelegate: class {
func dataRetrievedSuccess(gnomes:[Gnome])
}
class DataRetriever: NSObject {
weak var delegate: DataRetrieverDelegate?
func retriveDataFrom(urlString:String){
guard let url = URL(string: urlString) else { return }
URLSession.shared.dataTask(with:url, completionHandler: {(data, response, error) in
guard let data = data, error == nil else { return }
do {
//Fill automatically the brastlewark object with json
let brastlewark = try JSONDecoder().decode(Towns.self, from: data)
self.delegate?.dataRetrievedSuccess(gnomes:brastlewark.Brastlewark)
} catch let error as NSError {
print(error)
}
}).resume()
}
}
| [
-1
] |
1110b09f576cacda23ba38485ada315800e6eee9 | 99b2d51e13f97915cca26626876478f8afe134f3 | /Part 13/Part 13/Resources/AppDelegate.swift | 100e47edee4945115e2cdccd2b7e7220f1b4e5c9 | [] | no_license | un0dvendig/MetalKit-iOS | b1040acecb3355ab010cce10e31736efe4ae3abc | 6ae22631d6c6a6141e1ccdd5aec0c7546c278d87 | refs/heads/master | 2022-04-10T17:08:30.655290 | 2020-03-27T12:26:26 | 2020-03-27T12:26:26 | 247,030,783 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 436 | swift | //
// AppDelegate.swift
// Part 13
//
// Created by Eugene Ilyin on 13.03.2020.
// Copyright © 2020 Eugene Ilyin. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
}
| [
230796,
310285,
204302,
243599,
223761,
241553,
330259,
233620,
326801,
201621,
190873,
358175,
133791,
224035,
382375,
382249,
241578,
286252,
311725,
323767,
241214,
321728,
315207,
241352,
345803,
332363,
329165,
205902,
239568,
233554,
321746,
65749,
258261,
304981,
346838,
334300,
40928,
230114,
317677,
177008,
313456,
299122,
159731,
286196,
302448,
321783
] |
ea18c85c2f556e86790640d4f13083f2f4c02c51 | 76b597969cdf8ec675de10ebe117a7f79bca30cc | /Vendors/TableMapViewController/MapViewController.swift | 76f10a3431c3c89a55e8ee28b7335e1bb9ba734d | [
"MIT"
] | permissive | caoool/Whistle | 8dda92d945f9213bf662f92f4f4e16d29638c0c4 | 587bd48effa9dacf51e140c49a1eb61f83237027 | refs/heads/master | 2021-01-24T20:03:07.843629 | 2015-06-23T16:55:47 | 2015-06-23T16:55:47 | 37,931,057 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,567 | swift | //
// MapViewController.swift
// Map-swift
//
// Created by Gazolla on 25/07/14.
// Copyright (c) 2014 Gazolla. All rights reserved.
//
import UIKit
import MapKit
class MapViewController: UIViewController, MKMapViewDelegate{
var venuePoints:[Int: MapPointAnnotation] = [Int:MapPointAnnotation]()
var map:MKMapView?
var venues: [Venue]?
var rightButton: UIButton?
var selectedVenue:Venue?
convenience init(frame:CGRect){
self.init(nibName: nil, bundle: nil)
self.view.frame = frame
NSNotificationCenter.defaultCenter().addObserver(self, selector:"selectAnnotation:", name: "selectAnnotation", object: nil)
self.map = MKMapView(frame: frame)
self.map!.delegate = self
self.view.addSubview(self.map!)
adjustRegion(37.3175,aLongitude: -122.0419)
}
func adjustRegion(aLatitude:CLLocationDegrees, aLongitude: CLLocationDegrees){
var latitude:CLLocationDegrees = aLatitude
var longitude:CLLocationDegrees = aLongitude
var latDelta:CLLocationDegrees = 1.0
var longDelta:CLLocationDegrees = 1.0
var aSpan:MKCoordinateSpan = MKCoordinateSpan(latitudeDelta: latDelta,longitudeDelta: longDelta)
var Center :CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
var region:MKCoordinateRegion = MKCoordinateRegionMake(Center, aSpan)
self.map!.setRegion(region, animated: true)
}
func loadPointsWithArray(someVenues:[Venue]){
map!.removeAnnotations(map!.annotations)
for (var i=0; i<someVenues.count; i++) {
var point:MapPointAnnotation = MapPointAnnotation()
var v = someVenues[i] as Venue
point.venue = v
let latitude = (v.lat as NSString).doubleValue
let longitude = (v.lng as NSString).doubleValue
point.coordinate = CLLocationCoordinate2DMake(latitude,longitude);
point.title = v.name
point.subtitle = v.categoryName
venuePoints[v.ident] = point
map!.addAnnotation(point)
}
}
// select venue from tableview
func selectAnnotation(notification :NSNotification) {
self.selectedVenue = notification.object as? Venue
var point:MKPointAnnotation = venuePoints[self.selectedVenue!.ident]!
map!.selectAnnotation(point, animated: true)
}
//select venue from mapview
func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!) {
let p = view.annotation as! MapPointAnnotation
self.selectedVenue = p.venue
println("\(p.venue)")
}
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
if annotation is MKUserLocation {
//return nil so map view draws "blue dot" for standard user location
return nil
}
let reuseId = "pin"
var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? MKPinAnnotationView
if pinView == nil {
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView!.canShowCallout = true
pinView!.animatesDrop = true
pinView!.pinColor = .Purple
if self.rightButton == nil {
self.rightButton = UIButton.buttonWithType(UIButtonType.DetailDisclosure) as? UIButton
}
// let point:MapPointAnnotation = pinView!.annotation as! MapPointAnnotation
// println("point.venue.name = \(point.venue?.name)")
// self.rightButton!.venue = point.venue
self.rightButton!.titleForState(UIControlState.Normal)
self.rightButton!.addTarget(self, action: "rightButtonTapped:", forControlEvents: UIControlEvents.TouchUpInside)
pinView!.rightCalloutAccessoryView = self.rightButton! as UIView
}
else {
pinView!.annotation = annotation
}
return pinView
}
func rightButtonTapped(sender: UIButton!){
if let venue:Venue = selectedVenue{
println("venue name:\(venue.name)")
NSNotificationCenter.defaultCenter().postNotificationName("navigateToDetail", object: venue)
} else {
println("no venue")
}
}
}
| [
-1
] |
0188b7703e2c0f851823c8816a8a3328611f023d | d5c630bfc6bf8405c2bf438c0f9cf62e58833dfd | /ZJXT_Project/ZJXT_Swift/ZJXT_Swift/Modules/Learn/Controller/ZJLearnHomeController.swift | 627c51bee70281133a5db30a742bedaf968638a8 | [
"Apache-2.0"
] | permissive | Grandaunt/IOS_intern | cc76ad59cf0e481609c7f2b243a55cd73806edb4 | 2cc5a72a107e729adae4ba9790efbec47f872e4c | refs/heads/master | 2021-08-20T05:25:30.705945 | 2017-11-28T07:47:37 | 2017-11-28T07:47:37 | 112,302,733 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,567 | swift | //
// ZJLearnHomeController.swift
// ZJXT_Swift
//
// Created by User on 2017/9/6.
// Copyright © 2017年 runer. All rights reserved.
//
import UIKit
import MJRefresh
class SearchButton:UIButton
{
override var intrinsicContentSize: CGSize{
get{
return CGSize(width: kScreenViewWidth - 30, height: 30)
}
}
}
class ZJLearnHomeController: BaseViewController
{
fileprivate var hotArray = [ZJLearnHomeCourseModel]() //热门
fileprivate var layout:UICollectionViewFlowLayout = {
let layout = UICollectionViewFlowLayout()
return layout
}()
fileprivate lazy var collection:UICollectionView = {[weak self] in
let collection = UICollectionView(frame: kTableViewFrame, collectionViewLayout: (self?.layout)!)
collection.backgroundColor = UIColor.white
collection.delegate = self?.collectionViewProtocol
collection.dataSource = self?.collectionViewProtocol
collection.mj_header = MJRefreshNormalHeader(refreshingBlock: {
self?.requestData()
})
collection.register(UINib(nibName: "ZJLearnHomeClassCell", bundle: nil), forCellWithReuseIdentifier: "ZJLearnHomeClassCell")
collection.register(UINib(nibName: "ZJLearnHomeVideoCell", bundle: nil), forCellWithReuseIdentifier: "ZJLearnHomeVideoCell")
collection.register(UINib(nibName: "ZJLearnHomeHeaderView", bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "ZJLearnHomeHeaderView")
collection.register(UICollectionReusableView.classForCoder(), forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "footer")
return collection
}()
fileprivate lazy var collectionViewProtocol:ZJLearnHomeProtocol = {[weak self] in
let cProtocol = ZJLearnHomeProtocol()
cProtocol.controller = self
return cProtocol
}()
fileprivate var viewModel = ZJLearnHomeViewModel()
override func viewDidLoad()
{
super.viewDidLoad()
self.initNav()
self.view.addSubview(self.collection)
self.collection.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
self.requestData()
}
fileprivate func requestData()
{
self.requestCategory()
self.requestHot()
self.requestRecommend()
self.collection.mj_header.endRefreshing()
}
fileprivate func requestCategory()
{
self.viewModel.requestCategoryList {[weak self] (dataArray) in
self?.collectionViewProtocol.categoryDataArray = dataArray
self?.collection.reloadSections(NSIndexSet(indexesIn: NSRange(location: 0, length: 1)) as IndexSet)
}
}
fileprivate func requestHot()
{
self.viewModel.requestHotList {[weak self] (array) in
self?.hotArray = array
self?.collectionViewProtocol.hotArray = array
self?.collection.reloadSections(NSIndexSet(indexesIn: NSRange(location: 1, length: 1)) as IndexSet)
}
}
fileprivate func requestRecommend()
{
self.viewModel.requestRecommendList {[weak self] (array) in
self?.collectionViewProtocol.recommendArray = array
self?.collection.reloadSections(NSIndexSet(indexesIn: NSRange(location: 2, length: 1)) as IndexSet)
}
}
fileprivate func initNav()
{
self.transitioningDelegate = self
let searchBtn = SearchButton(type: .custom)
searchBtn.frame = CGRect(x: 15, y: 7, width: kScreenViewWidth - 30, height: 30)
searchBtn.layer.masksToBounds = true
searchBtn.layer.cornerRadius = 17
searchBtn.backgroundColor = kBackgroundColor
searchBtn.addTarget(self, action: #selector(searchBtnClicked), for: .touchUpInside)
let imgView = UIImageView(image: IconFontUtils.imageSquare(code: "\u{e7e0}", size: 18, color: UIColor.color(hex: "#CACACA")))
searchBtn.addSubview(imgView)
imgView.snp.makeConstraints { (make) in
make.left.equalToSuperview().offset(kHomeEdgeSpace*1.5)
make.centerY.equalToSuperview()
}
let label = UILabel()
label.textColor = UIColor.color(hex: "#CACACA")
label.font = UIFont.systemFont(ofSize: 15)
label.text = "调酒师(热门职位搜索)"
searchBtn.addSubview(label)
label.snp.makeConstraints { (make) in
make.left.equalTo(imgView.snp.right).offset(kHomeEdgeSpace)
make.centerY.equalToSuperview()
}
self.navigationItem.titleView = searchBtn
}
@objc fileprivate func searchBtnClicked()
{
let toVC = ZJLearnSearchController()
toVC.hotArray = self.hotArray
let nav = ZJNavigationController(rootViewController: toVC)
nav.transitioningDelegate = self
self.present(nav, animated: true, completion: nil)
}
}
extension ZJLearnHomeController:UIViewControllerTransitioningDelegate
{
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?
{
return FadeInTransition()
}
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning?
{
return FadeInTransition()
}
}
| [
-1
] |
d1bc76f60c71bd7f02577fc00da6672eee5b4905 | 238bdee9c631ef4397238d1cff3c925d831223cb | /Instagram/Controller/Core Tabs/ExploreViewController.swift | 362b8ce02604501607ed930dc94ffacf3567b490 | [] | no_license | yangirova01/Instagram | 7b94adbb018e3264edb7e099ad52df65e6a351dd | 71c742732b204d87b437cac6bb0ad3ca08f901a0 | refs/heads/master | 2023-08-17T07:13:44.887319 | 2021-09-30T02:10:30 | 2021-09-30T02:10:30 | 411,822,704 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,669 | swift | //
// ExploreViewController.swift
// Instagram
//
// Created by Эвелина on 07.09.2021.
//
import UIKit
class ExploreViewController: UIViewController {
private let searchBar: UISearchBar = {
let searchBar = UISearchBar()
searchBar.placeholder = "Search"
searchBar.backgroundColor = .secondarySystemBackground
return searchBar
}()
private var collectionView: UICollectionView?
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
navigationController?.navigationBar.topItem?.titleView = searchBar
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView?.register(PhotoCollectionViewCell.self,
forCellWithReuseIdentifier: PhotoCollectionViewCell.identifier)
collectionView?.delegate = self
collectionView?.dataSource = self
guard let collectionView = collectionView else {
return
}
view.addSubview(collectionView)
searchBar.delegate = self
}
}
extension ExploreViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
didCancelSearch()
guard let text = searchBar.text, !text.isEmpty else {
return
}
query(text)
}
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Cancel",
style: .plain,
target: self,
action: #selector(didCancelSearch))
}
@objc private func didCancelSearch() {
searchBar.resignFirstResponder()
navigationItem.rightBarButtonItem = nil
}
private func query(_ text: String) {
// Perform in search in the back ends
}
}
extension ExploreViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return UICollectionViewCell()
}
}
| [
-1
] |
f0de5f3a3ee706dbaab14d69a740dc711fa51ce5 | 35ef3098347e5e7ea2ed5c1c34f7362a75cc2342 | /Googlenow/ViewController.swift | 1af0cdff7b75be59f6d33fed874e6715583af163 | [] | no_license | vsirimalle/Googlenow | ff4f1baf6ed4f4d9682f1b9746a751fbddaf07bb | 73b130526281940fe90caf68fec730216ccb7e54 | refs/heads/master | 2016-09-05T22:20:21.585433 | 2015-01-23T00:21:17 | 2015-01-23T00:21:17 | 29,707,743 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 502 | swift | //
// ViewController.swift
// Googlenow
//
// Created by Vinod Sirimalle on 1/20/15.
// Copyright (c) 2015 vs. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
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.
}
}
| [
293888,
279041,
215562,
275466,
279064,
284197,
286249,
237616,
360501,
300086,
40505,
238653,
226878,
226896,
284240,
284242,
292435,
276054,
307288,
277602,
276580,
281701,
284261,
306791,
281703,
286314,
277612,
276597,
276087,
284289,
284298,
303242,
311437,
226447,
282262,
299165,
285855,
228000,
225955,
282275,
280231,
284328,
209577,
287399,
284336,
277171,
286390,
282301,
283839,
277696,
285377,
280770,
228548,
280772,
302788,
276167,
277192,
280775,
284361,
284373,
280790,
226009,
280797,
284391,
280808,
358127,
312049,
120054,
226038,
204027,
286462,
280832,
278786,
230147,
358147,
226055,
329499,
228127,
276256,
278304,
312107,
278845,
289600,
300358,
238920,
296272,
276309,
307029,
188253,
323933,
303977,
306540,
278897,
310649,
292730,
207738,
275842,
324491,
306578,
284586,
277935,
324528,
230323,
337336,
276412,
306633,
286158,
301012,
163289,
276959,
286175,
279011,
276965,
294889,
286189,
277487,
310773,
286204,
287231
] |
2974c759f0e7669d3b46a2fc4ace9154fdcf58ac | bd1190948114fdb5f59ba495598841945fcef634 | /FoodTracker(CoreData)/MealTableViewCell.swift | daa6af073bb6f30584d19f09a385f953bd09dee4 | [] | no_license | leanhhao95/FoodTracker-coreData- | 408e79e64e4621fc93572588b730c64b8d358b95 | 6145d2b1a6fa5c01df966c74ff1069b1b2061bac | refs/heads/master | 2021-07-05T20:18:14.709491 | 2017-09-28T13:19:32 | 2017-09-28T13:19:32 | 105,150,415 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 684 | swift | //
// MealTableViewCell.swift
// FoodTracker(CoreData)
//
// Created by Hao on 9/28/17.
// Copyright © 2017 Hao. All rights reserved.
//
import UIKit
class MealTableViewCell: UITableViewCell {
//MARK: Properties
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var ratingControl: RatingControl!
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
}
}
| [
159072,
301925,
293670,
217192,
302921,
300392,
237644,
306996,
280215,
314425,
280156,
298718
] |
00dca9bbace980c1f3f162b350cf3809ad2cc433 | ca69c3d532241e02d30da2a4a175d06f87d9f7ab | /GoogleMapsProject/WebViewVC.swift | c563283a14ae3bee3f0f0293c60503bf07923c1c | [] | no_license | gecorrea/GoogleMapsProject | c79f99ae2e967630e837b8c419a861d3250cf2a5 | 7381dbe53bd07e1fd46c35c0b3c012b45a5d3ee3 | refs/heads/master | 2020-12-30T12:35:06.223227 | 2017-06-02T21:17:15 | 2017-06-02T21:17:15 | 91,391,044 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,309 | swift | import UIKit
import WebKit
class WebViewVC: UIViewController, WKNavigationDelegate {
var theWeb : WKWebView!
@IBOutlet weak var mapButton: UIButton!
var urlString = String()
override func viewDidLoad() {
let configuration = WKWebViewConfiguration()
theWeb = WKWebView(frame: UIScreen.main.bounds, configuration: configuration)
view.insertSubview(theWeb, at: 0)
theWeb.navigationDelegate = self
self.goToWeb(urlString: urlString)
theWeb.allowsBackForwardNavigationGestures = true
}
func goToWeb(urlString: String) {
if let url = URL(string: urlString) {
DispatchQueue.main.async {
let urlRequest = URLRequest(url: url)
self.theWeb.load(urlRequest)
}
}
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
mapButton.isHidden = false
}
@IBAction func backToMap(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
| [
-1
] |
05bf6e3b1c26a39709087238a2dac7fccc0b790f | 6a3549db660ceaf184b6c0ad3ce2c6b673a74843 | /123Bay/123Bay/Views/ListFlights/ArrangeOption/ArrangeOptionsAlertViewController.swift | bbe67a7189aab06b0fac19cfab32f48ced1e6b8f | [] | no_license | congthai08/123Bay | 43e2b750ac07fd62e45fcf24a3835c80f862f99e | a3ecd79abaa18a487e94db901d745dc507e46876 | refs/heads/master | 2020-04-05T14:33:22.613376 | 2017-07-02T16:42:52 | 2017-07-02T16:42:52 | 94,673,816 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,234 | swift | //
// ArrangeOptionsAlertViewController.swift
// 123bay
//
// Created by Huỳnh Công Thái on 6/6/17.
// Copyright © 2017 123bay. All rights reserved.
//
import UIKit
import SnapKit
/*
This class is a alert show some options arrange
for display flight list.
User can choose options arrange
*/
class ArrangeOptionsAlertViewController: BaseAlertViewController {
// MARK: Define Variable
private let timeInterval: TimeInterval = 0.5
// MARK: Define controls
private let contentView: ArrangeOtionsView = ArrangeOtionsView()
// MARK: Setup layout
private func setupContentView() {
self.view.addSubview(self.contentView)
self.contentView.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.height.equalToSuperview().dividedBy(2)
}
self.contentView.addTargetForButton(
self,
selector: #selector(ArrangeOptionsAlertViewController.dismissAlert)
)
}
private func setupAnimation() {
self.contentView.layer.transform = CATransform3DMakeTranslation(
0,
-Dimension.shared.heightScreen / 3,
0
)
}
private func showContentViewAnimation() {
UIView.animate(withDuration: timeInterval, delay: 0, usingSpringWithDamping: 50, initialSpringVelocity: 100, options: [.curveLinear], animations: {
self.contentView.layer.transform = CATransform3DIdentity
}, completion: nil)
}
private func hideContentViewAnimation() {
UIView.animate(withDuration: timeInterval) {
self.contentView.layer.transform = CATransform3DMakeTranslation(
0,
Dimension.shared.heightScreen / 3,
0
)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
showContentViewAnimation()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
hideContentViewAnimation()
}
override func setUp() {
self.setupContentView()
self.setupAnimation()
}
}
| [
-1
] |
64f03ef5c422e2c06d0ed80293bb37e06b7418e7 | 7aade25be312e4dfbc22aade2a0d4752f6262403 | /Pokeapi/Main/AppDelegate.swift | 643024ad712a7a2bfbbe687bb0c9462aff39c59b | [] | no_license | arifinfrds/iOS-Swift-Pokeapi | b5e897d0d292d02f4a92c2e81998d92140456329 | 3cd067965cec623e5c36981a876c6e72588b0aeb | refs/heads/main | 2023-08-17T21:15:54.078730 | 2021-10-20T13:46:17 | 2021-10-20T13:46:17 | 397,489,230 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,349 | swift | //
// AppDelegate.swift
// Pokeapi
//
// Created by Arifin Firdaus on 18/08/21.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
262404,
164106,
180490,
368911,
262416,
262422,
377117,
262436,
336180,
262454,
393538,
262472,
344403,
213332,
65880,
262496,
418144,
262499,
213352,
262507,
262510,
213372,
385419,
393612,
262550,
262552,
385440,
385443,
385451,
262573,
393647,
385458,
262586,
344511,
262592,
360916,
369118,
328177,
328179,
328182,
328189,
328192,
164361,
410128,
393747,
254490,
188958,
385570,
33316,
377383,
197159,
352821,
197177,
418363,
188987,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
98968,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
164538,
328378,
328386,
344776,
352968,
352971,
418507,
352973,
385742,
385748,
361179,
369381,
361195,
418553,
344831,
344835,
336643,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
369542,
361360,
222128,
345035,
386003,
345043,
386011,
386018,
386022,
435187,
328714,
361489,
386069,
386073,
336921,
336925,
345118,
377887,
345133,
345138,
386101,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
361593,
410745,
361598,
214149,
345222,
386186,
337047,
345246,
214175,
337071,
337075,
345267,
386258,
328924,
66782,
222437,
386285,
328941,
386291,
345376,
353570,
345379,
410917,
345382,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
181654,
230809,
181670,
181673,
181678,
181681,
337329,
181684,
181690,
361917,
181696,
337349,
181703,
271839,
329191,
361960,
329194,
116210,
337415,
329226,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
353919,
403075,
345736,
198280,
403091,
345749,
419483,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337833,
362413,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
354313,
346139,
436289,
378954,
395339,
338004,
100453,
329832,
329855,
329885,
411805,
346272,
362660,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411864,
411868,
411873,
379107,
411876,
387301,
338152,
387306,
387312,
346355,
436473,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
395566,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
338381,
330189,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
363251,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
355175,
387944,
355179,
330610,
355218,
330642,
412599,
207808,
379848,
396245,
330710,
248792,
248798,
347105,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
339097,
248985,
44197,
380070,
339112,
249014,
330958,
330965,
265432,
265436,
388319,
388347,
175375,
159005,
175396,
208166,
273708,
347437,
372015,
347441,
372018,
199988,
44342,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
175463,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
339420,
249308,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
372353,
224897,
216707,
421508,
126596,
224904,
224909,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
257704,
224936,
224942,
257712,
224947,
257716,
257720,
224953,
257724,
224959,
257732,
224965,
224969,
339662,
224975,
257747,
224981,
224986,
257761,
224993,
257764,
224999,
339695,
225012,
257787,
225020,
257790,
339710,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
225043,
372499,
167700,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
257845,
225079,
397112,
225082,
397115,
225087,
225092,
225096,
323402,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
266297,
421960,
356439,
421990,
266350,
356466,
266362,
381068,
225423,
250002,
250004,
225429,
356506,
225437,
135327,
225441,
438433,
225444,
438436,
225447,
438440,
225450,
258222,
225455,
430256,
225458,
225461,
225466,
389307,
225470,
381120,
372929,
430274,
225475,
389320,
225484,
225487,
225490,
266453,
225493,
225496,
225499,
225502,
225505,
356578,
225510,
217318,
225514,
225518,
372976,
381176,
397571,
389380,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332117,
348502,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
389502,
250238,
332161,
356740,
332172,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324099,
324102,
324111,
340500,
324117,
324131,
332324,
381481,
356907,
324139,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324170,
324173,
324176,
389723,
332380,
373343,
381545,
340627,
373398,
184982,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
348978,
152370,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
430965,
324472,
398201,
119674,
324475,
430972,
340861,
324478,
340858,
324481,
373634,
398211,
324484,
324487,
381833,
324492,
324495,
430995,
324501,
324510,
422816,
324513,
398245,
201637,
324524,
340909,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
209943,
357410,
250914,
185380,
357418,
209965,
209971,
209975,
209979,
209987,
209990,
209995,
341071,
349267,
250967,
210010,
341091,
210025,
210030,
210036,
210039,
349308,
210044,
349311,
160895,
152703,
210052,
210055,
349319,
218247,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
251189,
415033,
357708,
210260,
365911,
259421,
365921,
333154,
251235,
374117,
333162,
234866,
390516,
333175,
357755,
251271,
136590,
374160,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
366038,
415191,
415193,
415196,
415199,
423392,
333284,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
210487,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
153227,
333498,
210631,
333511,
259788,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
210739,
366387,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
399215,
358255,
268143,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
350202,
333818,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
342133,
374902,
432271,
333997,
334011,
260289,
260298,
350410,
350416,
350422,
350425,
334045,
350445,
375026,
358644,
350458,
350461,
350464,
350467,
325891,
350475,
375053,
268559,
350480,
432405,
350486,
325914,
350490,
325917,
350493,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
268701,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
383536,
358961,
334384,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
375574,
162591,
326441,
326451,
326454,
260924,
375612,
244540,
326460,
326467,
244551,
326473,
326477,
416597,
326485,
342874,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
392060,
359295,
351104,
342915,
400259,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
211884,
400306,
351168,
359361,
359366,
326598,
359382,
359388,
383967,
343015,
359407,
261108,
244726,
261111,
383997,
261129,
261147,
359451,
211998,
261153,
261159,
359470,
359476,
343131,
384098,
384101,
367723,
384107,
187502,
343154,
384114,
212094,
351364,
384135,
384139,
384143,
351381,
384160,
384168,
367794,
384181,
367800,
351423,
384191,
384198,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
384249,
343306,
261389,
359694,
253200,
261393,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
384314,
425276,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
179802,
155239,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
147317,
262005,
425845,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
384977,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
9ed6d2f444bfdfaeb3c4c55146012d465f3b1c2e | cfe7d044e6059644861960eb0ef02d68366eb611 | /CollectionViewDemoTests/CollectionViewDemoTests.swift | a1820b1c94f0f121b732755e29c6a421eaff6e1b | [] | no_license | ThangDinhTrong/Search-Media-App | 61ba4543866149ebe51b9ac026408704581f801e | 10546fa38c8e23c9089167b42215bce75436cc92 | refs/heads/master | 2021-06-04T06:06:05.784169 | 2016-08-15T15:13:10 | 2016-08-15T15:13:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,027 | swift | //
// CollectionViewDemoTests.swift
// CollectionViewDemoTests
//
// Created by dinh trong thang on 8/1/16.
// Copyright © 2016 dinh trong thang. All rights reserved.
//
import XCTest
@testable import CollectionViewDemo
class CollectionViewDemoTests: XCTestCase {
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() {
// 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.measureBlock {
// Put the code you want to measure the time of here.
}
}
}
| [
333828,
282633,
313357,
305179,
317467,
241692,
229413,
354343,
204840,
354345,
227370,
278570,
233517,
155694,
309295,
229424,
282672,
124975,
243759,
237620,
229430,
288828,
288833,
288834,
286788,
254027,
311372,
223316,
280661,
315476,
180311,
180312,
307289,
354393,
237663,
315487,
309345,
45153,
280675,
227428,
280677,
307299,
313447,
329829,
278634,
194666,
319598,
288879,
284788,
233589,
223350,
233590,
280694,
131191,
288889,
215164,
215166,
131198,
292992,
194691,
227460,
280712,
215178,
235662,
311438,
317587,
278677,
284825,
284826,
311458,
278691,
233636,
184484,
233642,
284842,
278704,
239793,
323762,
299187,
125109,
131256,
227513,
278714,
223419,
280762,
299198,
280768,
227524,
309444,
280778,
282831,
280795,
227548,
229597,
301279,
311519,
317664,
280802,
356576,
176362,
321772,
286958,
227578,
184575,
309503,
125188,
278797,
125198,
125199,
125203,
319763,
125208,
309529,
282909,
299293,
278816,
237857,
227616,
211235,
217380,
233762,
211238,
282919,
98610,
125235,
280887,
125240,
278842,
315706,
282939,
307517,
260418,
287043,
139589,
280902,
319813,
311621,
227654,
6481,
278869,
289110,
6489,
379225,
323935,
106847,
391520,
321894,
416104,
280939,
285040,
313713,
242033,
199029,
311681,
227725,
178582,
291224,
293274,
285084,
61857,
285090,
61859,
246178,
289189,
289194,
108972,
377264,
299441,
293303,
283064,
278970,
319930,
293310,
278978,
127427,
127428,
283075,
291267,
324039,
278989,
317901,
373197,
281040,
278993,
326100,
278999,
328152,
176601,
369116,
188894,
287198,
279008,
160225,
358882,
279013,
279018,
291311,
281072,
309744,
279029,
279032,
279039,
301571,
291333,
287241,
279050,
303631,
283153,
279057,
279062,
279065,
291358,
180771,
244269,
283182,
283184,
236081,
234036,
23092,
279094,
338490,
70209,
309830,
293448,
55881,
281166,
281171,
287318,
309846,
295519,
242277,
66150,
111208,
279146,
313966,
281199,
295536,
287346,
287352,
301689,
279164,
291454,
189057,
279177,
152203,
287374,
330387,
330388,
117397,
295576,
314009,
303771,
221852,
205471,
279210,
287404,
205487,
295599,
285361,
303793,
299699,
342706,
293556,
166582,
299700,
314040,
287417,
158394,
303803,
285373,
287422,
287433,
225995,
154316,
287439,
242386,
279252,
96984,
287452,
289502,
299746,
295652,
285415,
234217,
342762,
330474,
293612,
230125,
289518,
312047,
279280,
125684,
199414,
154359,
230134,
299770,
234234,
221948,
205568,
242433,
295682,
299776,
285444,
291585,
322313,
295697,
285458,
291604,
293664,
326433,
281377,
234277,
283430,
279336,
289576,
262954,
293672,
295724,
312108,
301871,
164656,
303920,
262962,
285487,
230199,
285497,
289598,
160575,
281408,
295744,
295746,
279362,
318278,
201551,
281427,
281433,
301918,
295776,
279392,
293730,
349026,
303972,
242529,
279397,
230248,
177001,
201577,
308076,
400239,
246641,
174963,
207732,
310131,
209783,
246648,
209785,
279417,
269178,
308092,
177019,
291712,
158593,
113542,
287622,
228233,
228234,
308107,
56208,
308112,
234386,
293781,
324506,
324507,
310176,
310178,
289698,
189348,
283558,
289703,
279464,
293800,
310182,
236461,
293806,
304051,
189374,
353216,
330689,
213960,
279498,
316364,
183248,
304087,
50143,
340961,
314342,
234472,
234473,
52200,
324586,
203757,
289774,
183279,
320493,
287731,
316405,
240630,
304122,
293886,
234500,
322570,
330763,
324625,
234514,
238610,
316437,
140310,
320536,
197657,
281626,
175132,
189474,
238639,
300084,
312373,
238651,
308287,
238664,
234577,
296019,
353367,
234587,
277597,
304222,
113760,
281697,
302177,
230499,
281700,
285798,
300135,
300136,
228458,
207979,
279660,
15471,
144496,
234609,
312434,
285814,
300151,
279672,
291959,
160891,
300158,
150657,
187521,
234625,
285828,
279685,
302213,
222343,
302216,
285830,
330888,
228491,
234638,
162961,
308372,
185493,
296086,
238743,
119962,
283802,
296092,
285851,
300187,
339102,
300188,
306338,
234663,
249002,
238765,
279728,
238769,
208058,
64700,
228540,
228542,
322749,
283840,
302274,
279747,
283847,
353479,
353482,
283852,
279760,
290000,
228563,
189652,
279765,
316627,
279774,
304351,
298212,
304356,
298213,
290022,
279785,
228588,
234733,
279792,
298228,
302325,
234742,
292085,
228600,
216315,
292091,
208124,
228609,
234755,
322824,
292107,
312587,
328971,
173334,
339234,
298291,
222524,
286013,
333117,
286018,
279875,
193859,
300359,
294218,
234827,
224586,
222541,
296270,
234831,
238927,
372043,
120148,
318805,
283991,
357719,
222559,
234850,
292195,
294243,
230756,
281957,
163175,
134506,
230765,
284014,
296303,
279920,
243056,
327024,
296307,
306542,
314741,
181625,
111993,
290173,
306559,
224640,
179587,
298374,
314758,
142729,
296329,
368011,
296335,
112017,
306579,
9619,
224661,
282007,
357786,
318875,
290207,
333220,
310692,
282022,
282024,
316842,
173491,
304564,
279989,
286132,
284089,
228795,
292283,
300487,
306631,
296392,
280010,
284107,
310732,
302540,
280013,
64975,
312782,
306639,
310736,
329173,
228827,
286172,
239068,
280032,
144867,
187878,
316902,
280041,
306673,
308723,
333300,
306677,
191990,
300535,
280055,
288249,
286202,
333303,
290300,
286205,
302590,
300542,
294400,
296448,
282114,
306692,
306693,
292356,
329225,
230921,
296461,
282129,
308756,
282136,
282141,
302623,
333343,
230943,
286244,
230959,
288309,
290358,
288318,
194110,
280130,
349763,
196164,
124485,
56902,
282183,
218696,
288327,
292425,
243274,
333388,
228943,
286288,
280147,
290390,
300630,
306776,
239198,
333408,
157281,
286306,
300644,
282213,
317032,
222832,
314998,
288378,
325245,
235135,
294529,
239237,
282245,
286343,
282246,
229001,
288392,
290443,
310923,
323217,
282259,
229020,
298654,
282271,
333470,
282273,
302754,
282276,
40613,
40614,
40615,
282280,
290471,
229029,
298667,
300714,
323236,
286388,
286391,
296632,
282303,
286399,
280257,
218819,
282312,
306890,
280267,
302797,
333517,
282318,
241361,
302802,
245457,
333521,
241365,
280278,
282327,
298712,
278233,
278234,
286423,
67292,
18138,
280280,
294622,
278240,
282339,
12010,
288491,
282348,
239341,
284401,
282355,
282358,
313081,
229113,
300794,
124669,
194304,
288512,
278272,
311042,
288516,
323331,
323332,
280327,
216839,
280329,
282378,
300811,
284431,
278291,
278293,
294678,
282391,
284442,
286494,
282400,
313120,
315171,
282409,
333610,
284459,
294700,
280366,
282417,
200498,
296755,
280372,
321337,
282427,
280380,
325439,
282434,
307011,
280390,
282438,
280392,
360264,
323406,
304977,
307025,
413521,
18262,
216918,
307031,
241495,
280410,
284507,
188251,
237408,
284512,
284514,
276327,
292712,
282474,
288619,
288620,
280430,
296814,
282480,
313203,
300918,
317304,
194429,
305026,
241540,
67463,
282504,
325515,
243597,
110480,
184208,
282518,
282519,
294807,
214937,
214938,
294809,
239514,
294814,
300963,
292771,
294823,
298920,
284587,
292782,
282549,
288697,
290746,
98239,
280514,
294850,
280519,
214984,
284619,
301008,
194515,
24532,
280541,
329695,
298980,
292837,
294886,
247785,
296941,
124911,
329712,
311281,
311282,
292858
] |
7ece142465f898418f661d9ff304cdcba0dd9516 | 50adbef0ce136e54204c2c27e77cebaf11b60458 | /jyanken/AppDelegate.swift | 49b9aa61fdb4db7c3aa7478f83c83de9deb8e120 | [] | no_license | takafumiwao/jyanken | 2ac2851c328570a869704e6527e2ffa552d429fc | f033e1855b5c481e384c5d8ae08119e50f596676 | refs/heads/master | 2020-04-09T16:34:11.685714 | 2018-12-05T04:38:04 | 2018-12-05T04:38:04 | 160,456,545 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,115 | swift | //
// AppDelegate.swift
// jyanken
//
// Created by 岩男高史 on 2018/12/05.
// Copyright © 2018 岩男高史. 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,
229432,
204856,
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,
287238,
320007,
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,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
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,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
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,
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,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
288217,
329177,
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,
206336,
296450,
148990,
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,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
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,
239586,
313320,
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,
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,
354653,
313700,
280937,
313705,
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,
133776,
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,
240519,
322440,
314249,
338823,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
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,
290174,
298365,
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,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
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,
44948,
298901,
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,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
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,
315860,
176597,
127447,
283095,
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,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
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,
292433,
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,
201603,
226182,
234375,
308105,
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,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
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,
226500,
283844,
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,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
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,
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,
227440,
316917,
308727,
292343,
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,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
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,
276160,
358080,
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,
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,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
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,
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,
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,
342707,
154292,
318132,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
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,
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,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
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,
285792,
277601,
203872,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
285835,
302218,
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,
64966,
245191,
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,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
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,
286313,
40554,
286312,
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,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
b7a059a3e0506ef6526c9cd43c58b053e9e7b1f5 | 6d3bb2aa444b2fb3bf147ab7b1cb0917680f5604 | /E2EE/Security/Session/SessionState.swift | 5133b387a9d6cfff88ae5728f1166670537cd73f | [] | no_license | 89gnahT/E2EE | dfb872c6c119f85f747f0db83c53be0f73241797 | 3ccb5c3c5c223ddcb3dc7cc0861c5031f73f19e0 | refs/heads/master | 2020-08-20T02:40:11.605284 | 2019-11-11T10:10:44 | 2019-11-13T02:14:29 | 215,976,492 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,770 | swift | //
// SessionState.swift
// E2EE
//
// Created by CPU11899 on 10/28/19.
// Copyright © 2019 ThangNVH. All rights reserved.
//
import Foundation
public typealias RatchetIdentityKeyPair = KeyPair
struct SymmetricParameters {
var ourIdentityKey: RatchetIdentityKeyPair
var ourBaseKey: KeyPair
var ourRatchetKey: KeyPair
var theirBaseKey: PublicKey
var theirRatchetKey: PublicKey
var theirIdentityKey: PublicKey
var isAlice: Bool {
return ourBaseKey.publicKey < theirBaseKey //WARNING
}
}
final class SessionState: ProtocolBufferEquivalent {
private static let maxRecieverChains = 5
private static let keyInfo = "WhisperSecureText".data(using: .utf8)!
var previousCounter: UInt32 = 0
var localIdentity: PublicKey?
var remoteIdentity: PublicKey?
var rootKey: RatchetRootKey?
var senderChain: SenderChain?
var receiverChains: [ReceiverChain]
var pendingPreKey: PendingPreKey?
var aliceBaseKey: PublicKey?
init() {
self.receiverChains = [ReceiverChain]()
}
func receiverChain(for senderEmphemeralKey: PublicKey) -> ReceiverChain? {
for chain in receiverChains {
if chain.ratchetKey == senderEmphemeralKey {
return chain
}
}
return nil
}
func add(receiverChain: ReceiverChain) {
receiverChains.insert(receiverChain, at: 0)
if receiverChains.count > SessionState.maxRecieverChains {
receiverChains.removeLast(receiverChains.count - SessionState.maxRecieverChains)
}
}
func set(chainKey: RatchetChainKey, for senderEmphemeralKey: PublicKey) throws {
for index in 0..<receiverChains.count {
if receiverChains[index].ratchetKey == senderEmphemeralKey {
receiverChains[index].chainKey = chainKey
return
}
}
throw SignalError(.unknown, "Couldn't find receiver chain to set chain key on")
}
func set(messageKeys: RatchetMessageKeys, for senderEphemeral: PublicKey) {
if let chain = receiverChain(for: senderEphemeral) {
chain.add(messageKey: messageKeys)
}
}
func removeMessageKeys(for senderEmphemeral: PublicKey, and counter: UInt32) -> RatchetMessageKeys? {
guard let chain = receiverChain(for: senderEmphemeral) else { return nil }
return chain.removeMessageKey(for: counter)
}
func receiverChainKey(for senderEmphemeral: PublicKey) -> RatchetChainKey? {
return receiverChain(for: senderEmphemeral)?.chainKey
}
func set(receiverChainKey: RatchetChainKey, for senderEphemeral: PublicKey) throws {
guard let node = receiverChain(for: senderEphemeral) else {
throw SignalError(.unknown, "Couldn't find receiver chain to set chain key on");
}
node.chainKey = receiverChainKey
}
func aliceInitialize(ourIdentityKey: RatchetIdentityKeyPair, ourBaseKey: KeyPair, theirIdentityKey: PublicKey, theirSignedPreKey: PublicKey, theirOneTimePreKey: PublicKey?, theirRatchetKey: PublicKey) throws {
let sendingRatchetKey = try KeyPair()
let secret1 = Data(repeating: 0xFF, count: 32)
let secret2 = try theirSignedPreKey.calculateAgreement(privateKey: ourIdentityKey.privateKey)
let secret3 = try theirIdentityKey.calculateAgreement(privateKey: ourBaseKey.privateKey)
let secret4 = try theirSignedPreKey.calculateAgreement(privateKey: ourBaseKey.privateKey)
let secret5 = try theirOneTimePreKey?.calculateAgreement(privateKey: ourBaseKey.privateKey) ?? Data()
let secret = secret1 + secret2 + secret3 + secret4 + secret5
let (derivedRoot, derivedChain) = try calculateDerivedKeys(secret: secret)
let (sendingChainRoot, sendingChainKey) = try derivedRoot.createChain(theirRatchetKey: theirRatchetKey, ourRatchetKey: sendingRatchetKey.privateKey)
add(receiverChain: ReceiverChain(ratchetKey: theirRatchetKey, chainKey: derivedChain))
self.remoteIdentity = theirIdentityKey
self.localIdentity = ourIdentityKey.publicKey
self.senderChain = SenderChain(ratchetKey: sendingRatchetKey, chainKey: sendingChainKey)
self.rootKey = sendingChainRoot
}
func bobInitialize(ourIdentityKey: RatchetIdentityKeyPair, ourSignedPreKey: KeyPair, ourOneTimePreKey: KeyPair?, ourRatchetKey: KeyPair, theirIdentityKey: PublicKey, theirBaseKey: PublicKey) throws {
let secret1 = Data(repeating: 0xFF, count: 32)
let secret2 = try theirIdentityKey.calculateAgreement(privateKey: ourSignedPreKey.privateKey)
let secret3 = try theirBaseKey.calculateAgreement(privateKey: ourIdentityKey.privateKey)
let secret4 = try theirBaseKey.calculateAgreement(privateKey: ourSignedPreKey.privateKey)
let secret5 = try ourOneTimePreKey?.privateKey.calculateAgreement(publicKey: theirBaseKey) ?? Data()
let secret = secret1 + secret2 + secret3 + secret4 + secret5
let (derivedRoot, derivedChain) = try calculateDerivedKeys(secret: secret)
self.remoteIdentity = theirIdentityKey
self.localIdentity = ourIdentityKey.publicKey
self.senderChain = SenderChain(ratchetKey: ourRatchetKey, chainKey: derivedChain)
self.rootKey = derivedRoot
}
func symmetricInitialize(parameters params: SymmetricParameters) throws {
if params.isAlice {
try aliceInitialize(ourIdentityKey: params.ourIdentityKey, ourBaseKey: params.ourBaseKey, theirIdentityKey: params.theirIdentityKey, theirSignedPreKey: params.theirBaseKey, theirOneTimePreKey: nil, theirRatchetKey: params.theirRatchetKey)
} else {
try bobInitialize(ourIdentityKey: params.ourIdentityKey, ourSignedPreKey: params.ourBaseKey, ourOneTimePreKey: nil, ourRatchetKey: params.ourRatchetKey, theirIdentityKey: params.theirIdentityKey, theirBaseKey: params.theirBaseKey)
}
}
private func calculateDerivedKeys(secret: Data) throws -> (rootKey: RatchetRootKey, chainKey: RatchetChainKey) {
let salt = Data(count: RatchetChainKey.hashOutputSize)
return try HKDF.chainAndRootKey(material: secret, salt: salt, info: SessionState.keyInfo)
}
var protoObject: Signal_Session {
return Signal_Session.with {
if let item = self.localIdentity {
$0.localIdentityPublic = item.data
}
if let item = self.remoteIdentity {
$0.remoteIdentityPublic = item.data
}
if let item = self.rootKey {
$0.rootKey = item.protoData()
}
$0.previousCounter = self.previousCounter
if let item = self.senderChain {
$0.senderChain = item.protoObject
}
$0.receiverChains = receiverChains.map {$0.protoObject}
if let item = self.pendingPreKey {
$0.pendingPreKey = item.protoObject
}
if let item = self.aliceBaseKey {
$0.aliceBaseKey = item.data
}
}
}
init(from protoObject: Signal_Session) throws {
if protoObject.hasLocalIdentityPublic {
self.localIdentity = try PublicKey(from: protoObject.localIdentityPublic)
}
if protoObject.hasRemoteIdentityPublic {
self.remoteIdentity = try PublicKey(from: protoObject.remoteIdentityPublic)
}
if protoObject.hasRootKey {
self.rootKey = RatchetRootKey(from: protoObject.rootKey)
}
self.previousCounter = protoObject.previousCounter
if protoObject.hasSenderChain {
self.senderChain = try SenderChain(from: protoObject.senderChain)
}
self.receiverChains = try protoObject.receiverChains.map {
try ReceiverChain(from: $0)
}
if protoObject.hasPendingPreKey {
self.pendingPreKey = try PendingPreKey(from: protoObject.pendingPreKey)
}
if protoObject.hasAliceBaseKey {
self.aliceBaseKey = try PublicKey(from: protoObject.aliceBaseKey)
}
}
}
extension SessionState: Equatable {
static func ==(a: SessionState, b: SessionState) -> Bool {
guard a.previousCounter == b.previousCounter else {
return false
}
guard a.localIdentity == b.localIdentity, a.remoteIdentity == b.remoteIdentity, a.rootKey == b.rootKey, a.senderChain == b.senderChain else {
return false
}
guard a.receiverChains == b.receiverChains, a.pendingPreKey == b.pendingPreKey, a.aliceBaseKey == b.aliceBaseKey else {
return false
}
return true
}
}
| [
-1
] |
fae19f193b8bbc83157685f68e3c1a6a2cca4e90 | 1cb721e5690cb98b76049e4dbd034c89e4563414 | /Game3/shooterscene.swift | 6c2bc93d11358b820e00b3980c514f1ce173ae4d | [] | no_license | TopMarshall/derpity | 386f4304ab49f343dce0235b40a2a901025c036e | e3d005eba06f33bbd5af78a724634009c00fb718 | refs/heads/master | 2021-01-25T08:28:49.062636 | 2015-07-10T19:23:57 | 2015-07-10T19:23:57 | 38,898,187 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,954 | swift | //
// shooterscene.swift
// GameTutorial2
//
// Created by John Marshall on 6/30/15.
// Copyright © 2015 John Marshall. All rights reserved.
//
import UIKit
import SpriteKit
class shooterscene: SKScene {
var score = 0
var enemyCount = 10
var shooterAnimation = [SKTexture]()
override func didMoveToView(view: SKView) {
self.physicsWorld.gravity = CGVectorMake(0, -1.2)
self.initShooterScene()
}
func initShooterScene(){
let shooterAtlas = SKTextureAtlas(named: "shooter")
for index in 1...shooterAtlas.textureNames.count {
let imgName = String(format: "shooter%01d", index)
shooterAnimation += [shooterAtlas.textureNamed(imgName)]
}
let dropBalls = SKAction.sequence([SKAction.runBlock({
self.createBallNode()
}),
SKAction.waitForDuration(2.0)
])
self.runAction(SKAction.repeatAction(dropBalls, count: enemyCount))
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
let shooterNode = self.childNodeWithName("shooterNode")
if(shooterNode != nil) {
let animation = SKAction.animateWithTextures(shooterAnimation, timePerFrame: 0.05)
let shootBullet = SKAction.runBlock({
let bulletNode = self.createBulletNode()
self.addChild(bulletNode)
bulletNode.physicsBody?.applyImpulse(CGVectorMake(10, 0))
})
let sequence = SKAction.sequence([animation, shootBullet])
shooterNode?.runAction(sequence)
shooterNode?.runAction(animation)
}
}
func createBulletNode() ->SKSpriteNode {
let shooterNode = self.childNodeWithName("shooterNode")
let shooterPosition = shooterNode?.position
let shooterWidth = shooterNode?.frame.size.width
let bullet = SKSpriteNode(imageNamed: "bullet.png")
bullet.position = CGPointMake(shooterPosition!.x + shooterWidth!/2, shooterPosition!.y + 15)
bullet.name = "bulletNode"
bullet.physicsBody = SKPhysicsBody(rectangleOfSize: bullet.frame.size)
bullet.physicsBody?.usesPreciseCollisionDetection = true
return bullet
}
func createBallNode(){
let ball = SKSpriteNode(imageNamed: "Starball.png")
ball.position = CGPointMake(randomNumber(self.size.width), self.size.height)
ball.name = "ballNode"
ball.physicsBody = SKPhysicsBody(circleOfRadius: ball.size.width/2)
ball.physicsBody?.usesPreciseCollisionDetection = true
self.addChild(ball)
}
func randomNumber(maximum: CGFloat) -> CGFloat{
let maxInt = UInt32(maximum)
let result = arc4random_uniform(maxInt)
return CGFloat(result)
}
}
| [
-1
] |
cdff765ad1f948343d9dfc0f46a5735c5917990a | ceb8ce94c19d7013184cd9a6e43ea7a53db367bd | /SignalR-Swift/Transports/LongPollingTransport.swift | 2b33e0f5908e4542cd56b80180d269771557f830 | [
"MIT"
] | permissive | swift2geek/SignalR-Swift | 4f57bcd403761d961400e68c1252c0f3ed5035d0 | 8395f1f7191b54e320a7500d4ccbbc16a2646ac0 | refs/heads/master | 2020-03-26T08:08:20.896138 | 2018-08-20T17:32:35 | 2018-08-20T17:32:35 | 144,687,518 | 1 | 0 | MIT | 2018-08-20T17:32:36 | 2018-08-14T07:55:00 | Swift | UTF-8 | Swift | false | false | 6,408 | swift | //
// LongPollingTransport.swift
// SignalR-Swift
//
//
// Copyright © 2017 Jordan Camara. All rights reserved.
//
import Foundation
import Alamofire
open class LongPollingTransport: HttpTransport {
var reconnectDelay = 5.0
var errorDelay = 2.0
var pollingQueue = DispatchQueue(label: "com.autosoftdms.SignalR-Swift.serial")
// MARK: - Client Transport Protocol
override public var name: String? {
return "longPolling"
}
override public var supportsKeepAlive: Bool {
return false
}
override public func negotiate(connection: ConnectionProtocol, connectionData: String?, completionHandler: ((NegotiationResponse?, Error?) -> ())?) {
super.negotiate(connection: connection, connectionData: connectionData, completionHandler: completionHandler)
}
override public func start(connection: ConnectionProtocol, connectionData: String?, completionHandler: ((Any?, Error?) -> ())?) {
self.poll(connection: connection, connectionData: connectionData, completionHandler: completionHandler)
}
override public func send(connection: ConnectionProtocol, data: Any, connectionData: String?, completionHandler: ((Any?, Error?) -> ())?) {
super.send(connection: connection, data: data, connectionData: connectionData, completionHandler: completionHandler)
}
override public func abort(connection: ConnectionProtocol, timeout: Double, connectionData: String?) {
super.abort(connection: connection, timeout: timeout, connectionData: connectionData)
}
override public func lostConnection(connection: ConnectionProtocol) {
}
// MARK: - Long Polling
func poll(connection: ConnectionProtocol, connectionData: String?, completionHandler: ((_ response: String?, _ error: Error?) -> ())?) {
var canReconnect = true
var url = connection.url
if connection.messageId == nil {
url = url.appending("connect")
} else if self.isConnectionReconnecting(connection: connection) {
url = url.appending("reconnect")
} else {
url = url.appending("poll")
}
self.delayConnectionReconnect(connection: connection, canReconnect: &canReconnect)
var parameters: [String: Any] = [
"transport": self.name!,
"connectionToken": connection.connectionToken ?? "",
"connectionData": connectionData ?? "",
"groupsToken": connection.groupsToken ?? "",
"messageId": connection.messageId ?? ""
]
if let queryString = connection.queryString {
for (key, value) in queryString {
parameters[key] = value
}
}
let encodedRequest = connection.getRequest(url: url, httpMethod: .get, encoding: URLEncoding.default, parameters: parameters, timeout: 240)
_ = self.pollingQueue.sync {
encodedRequest.validate().responseData(completionHandler: { [weak self, weak connection] response in
guard let strongSelf = self, let strongConnection = connection else { return }
switch response.result {
case .success(let result):
var shouldReconnect = false
var disconnectedReceived = false
strongConnection.processResponse(response: result, shouldReconnect: &shouldReconnect, disconnected: &disconnectedReceived)
if let handler = completionHandler {
handler(nil, nil)
}
if strongSelf.isConnectionReconnecting(connection: strongConnection) {
strongSelf.connectionReconnect(connection: strongConnection, canReconnect: canReconnect)
}
if shouldReconnect {
_ = Connection.ensureReconnecting(connection: strongConnection)
}
if disconnectedReceived {
strongConnection.disconnect()
}
if !strongSelf.tryCompleteAbort() {
canReconnect = true
strongSelf.poll(connection: strongConnection, connectionData: connectionData, completionHandler: nil)
}
case .failure(let error):
canReconnect = false
_ = Connection.ensureReconnecting(connection: strongConnection)
if !strongSelf.tryCompleteAbort() && !ExceptionHelper.isRequestAborted(error: (error as NSError)) {
strongConnection.didReceiveError(error: error)
canReconnect = true
_ = BlockOperation(block: {
strongSelf.poll(connection: strongConnection, connectionData: connectionData, completionHandler: nil)
}).perform(#selector(BlockOperation.start), with: nil, afterDelay: strongSelf.errorDelay)
} else {
strongSelf.completeAbort()
if let handler = completionHandler {
handler(nil, error)
}
}
}
})
}
}
func delayConnectionReconnect(connection: ConnectionProtocol, canReconnect: inout Bool) {
if self.isConnectionReconnecting(connection: connection) {
let canReconnectCopy = canReconnect
if canReconnect {
canReconnect = false
_ = BlockOperation(block: { [weak self, weak connection] in
guard let strongSelf = self, let strongConnection = connection else { return }
strongSelf.connectionReconnect(connection: strongConnection, canReconnect: canReconnectCopy)
}).perform(#selector(BlockOperation.start), with: nil, afterDelay: self.reconnectDelay)
}
}
}
func connectionReconnect(connection: ConnectionProtocol, canReconnect: Bool) {
if canReconnect {
if connection.changeState(oldState: .reconnecting, toState: .connected) {
connection.didReconnect()
}
}
}
func isConnectionReconnecting(connection: ConnectionProtocol) -> Bool {
return connection.state == .reconnecting
}
}
| [
-1
] |
6b9ef9d7f985bfaa181d2a1fcc552d438ff6e0f3 | 34ea200920abb6092ee69ec60cc72212351c4751 | /TDLib/Models/VoiceNote.swift | 3a9b467e34f76722827fca203026f1c46ae0d68e | [] | no_license | vox-humana/telegram-contest-2021-watch | 67d633ac62cee74797f8e95b9b4da93ae097ff60 | 33c3c922ee014cce438092ad71dd8e116ac56272 | refs/heads/main | 2023-05-30T19:04:36.053945 | 2021-06-07T07:46:23 | 2021-06-07T07:46:23 | 374,579,339 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 914 | swift | //
// VoiceNote.swift
// tl2swift
//
// Created by Code Generator
//
import Foundation
/// Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel
internal struct VoiceNote: Codable {
/// Duration of the voice note, in seconds; as defined by the sender
internal let duration: Int
/// MIME type of the file; as defined by the sender
internal let mimeType: String
/// File containing the voice note
internal let voice: File
/// A waveform representation of the voice note in 5-bit format
internal let waveform: Data
internal init(
duration: Int,
mimeType: String,
voice: File,
waveform: Data
) {
self.duration = duration
self.mimeType = mimeType
self.voice = voice
self.waveform = waveform
}
}
| [
-1
] |
56a844d8b0e9b32177c77a8ffd0df1d07c87823a | 9b9235213f6d6b8c6f6a1d2fafd1cf998ab7cb8d | /CodeScan/Controllers/UIViewControllers/ListViewVC.swift | e977beaac132c0e67a927f1d0bc4f49f81e3dd1a | [] | no_license | anil1997-accurascan/iOS-KYC | f101994d2dcd39830ccad28f811920a9adead1ac | 932ce68604f9ce3cd5675452ad3b7b2d947ebf5d | refs/heads/master | 2023-07-11T14:31:48.841556 | 2021-08-18T11:42:24 | 2021-08-18T11:42:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,503 | swift |
import UIKit
import AccuraOCR
struct CardType {
let id : Int?
let card_type : String?
init( id:Int, card_type:String) {
self.id = id
self.card_type = card_type
}
}
class ListViewVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
//MARK:- Outlet
@IBOutlet var tblList: UITableView!
@IBOutlet weak var lblTitle: UILabel!
@IBOutlet weak var viewNavigationBar: UIView!
@IBOutlet weak var viewStatusBar: UIView!
@IBOutlet weak var btnBack: UIButton!
@IBOutlet weak var buttonOrientation: UIButton!
//MARK:- Variable
var screenList = NSMutableArray()
var arrResponse : [[String:AnyObject]] = [[String:AnyObject]]()
var countryId : Int? = 0
var cardtype: Int? = 0
//MARK:- ViewController
override func viewDidLoad() {
super.viewDidLoad()
viewStatusBar.backgroundColor = UIColor(red: 231.0 / 255.0, green: 52.0 / 255.0, blue: 74.0 / 255.0, alpha: 1.0)
viewNavigationBar.backgroundColor = UIColor(red: 231.0 / 255.0, green: 52.0 / 255.0, blue: 74.0 / 255.0, alpha: 1.0)
self.tblList.register(UINib.init(nibName: "ListTableCell", bundle: nil), forCellReuseIdentifier: "ListTableCell")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
let orientation = UIApplication.shared.statusBarOrientation
if(orientation == UIInterfaceOrientation.portrait) {
buttonOrientation.isSelected = false
} else {
buttonOrientation.isSelected = true
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
// print("Success")
}
//MARK:- Button Action
@IBAction func btnBackAction(_ sender: UIButton) {
self.navigationController?.popViewController(animated: true)
}
@IBAction func buttoOrientationAction(_ sender: UIButton) {
if(sender.isSelected == true) {
sender.isSelected = false
AppDelegate.AppUtility.lockOrientation(.portrait, andRotateTo: .portrait)
} else {
sender.isSelected = true
AppDelegate.AppUtility.lockOrientation(.landscapeRight, andRotateTo: .landscapeRight)
}
}
//MARK: UITableView Delegate and Datasource method
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return screenList.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ListTableCell") as! ListTableCell
cell.selectionStyle = .none
let cellDict = screenList.object(at: indexPath.row) as! NSDictionary
cell.lbl_list_title.text = "\(String(describing: (cellDict.value(forKey: "card_name"))!))"
cell.vw.backgroundColor = #colorLiteral(red: 0.8352941176, green: 0.1960784314, blue: 0.2470588235, alpha: 1)
cell.vw.layer.masksToBounds = true
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cellDict = screenList.object(at: indexPath.row) as! NSDictionary
if(cellDict.value(forKey: "card_type") as! Int == 1)
{
let loginVC = UIStoryboard(name: "CodeScanVC", bundle: nil).instantiateViewController(withIdentifier: "CodeScanVC") as! CodeScanVC
loginVC.cardid = cellDict.value(forKey: "card_id") as? Int
loginVC.countryid = countryId
loginVC.isBarcodeEnabled = false
self.navigationController?.pushViewController(loginVC, animated: true)
}
else{
let vc: ViewController = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
vc.cardid = cellDict.value(forKey: "card_id") as? Int
vc.docName = (cellDict.value(forKey: "card_name") as? String)!
vc.countryid = countryId
vc.isCheckScanOCR = true
vc.cardType = cellDict.value(forKey: "card_type") as? Int//cardtype
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
| [
-1
] |
09c86c5526cbc75bdb3fb381e98e5c366f1a5412 | cfb508df0628f522ebdec9835bd68f562388c311 | /SwiftProject/Code/Home/Controllers/USearchViewController.swift | 692d85975d13ea17780f1956f34587fca1f26824 | [
"Apache-2.0"
] | permissive | ChenNW/swiftProject | c7808a805a8ecffffd9cf7a89e22609cb2739b7f | c5a70fd606b986b78b11f98142492e24890c8718 | refs/heads/main | 2023-01-07T02:10:08.759946 | 2020-11-10T10:12:14 | 2020-11-10T10:12:14 | 308,264,506 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,691 | swift | //
// USearchViewController.swift
// SwiftProject
//
// Created by Cnw on 2020/11/9.
//
import UIKit
import KakaJSON
class USearchViewController: UBaseViewController {
private var currentRequest:Cancellable?
private var hotItems: [SearchItemModel]?
private var relative: [SearchItemModel1]?
private var comics:[ComicModel]?
private lazy var searchHistory: [String]! = {
return UserDefaults.standard.value(forKey: String.searchHistoryKey) as? [String] ?? [String]()
}()
private lazy var searchBar: UITextField = {
let textField = UITextField()
textField.backgroundColor = .white
textField.tintColor = .gray
textField.font = .systemFont(ofSize: 15)
textField.placeholder = "输入漫画名称/作者"
textField.layer.cornerRadius = 15
textField.clipsToBounds = true
textField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 15, height: 15))
textField.leftViewMode = .always
textField.clearButtonMode = .whileEditing
textField.clearsOnBeginEditing = true
textField.returnKeyType = .search
textField.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(textFieldTextChange(noti:)), name: UITextField.textDidChangeNotification, object: nil)
return textField
}()
private lazy var historyTableView: UITableView = {
let tw = UITableView(frame: .zero, style: .grouped)
tw.delegate = self
tw.dataSource = self
tw.register(headerFooterViewType: USearchTHead.self)
tw.register(cellType: UBaseTableViewCell.self)
tw.register(headerFooterViewType: USearchTFoot.self)
return tw
}()
private lazy var searchTableView: UITableView = {
let tb = UITableView(frame: .zero, style: .grouped)
tb.delegate = self
tb.dataSource = self
tb.register(headerFooterViewType: USearchTHead.self)
tb.register(cellType: UBaseTableViewCell.self)
return tb
}()
private lazy var resultTableView: UITableView = {
let tb = UITableView(frame: .zero, style: .grouped)
tb.delegate = self
tb.dataSource = self
tb.register(cellType: UComicTCell.self)
return tb
}()
override func configNavigationBar() {
super.configNavigationBar()
navigationItem.titleView = searchBar
searchBar.frame = CGRect(x: 0, y: 0, width: screenWidth - 50, height: 30)
navigationItem.leftBarButtonItem = UIBarButtonItem(title: nil, style: .plain, target: nil, action: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "取消",
target: self,
action: #selector(leftButtonClick))
}
override func leftButtonClick() {
super.leftButtonClick()
searchBar.resignFirstResponder()
}
override func viewDidLoad() {
super.viewDidLoad()
loadHistory()
}
override func configUI() {
view.addSubview(historyTableView)
view.addSubview(searchTableView)
view.addSubview(resultTableView)
historyTableView.snp.makeConstraints {$0.edges.equalTo(self.view.usnp.edges)}
searchTableView.snp.makeConstraints {$0.edges.equalTo(self.view.usnp.edges)}
resultTableView.snp.makeConstraints {$0.edges.equalTo(self.view.usnp.edges)}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
//MARK:Method
///历史数据
private func loadHistory (){
historyTableView.isHidden = false
searchTableView.isHidden = true
resultTableView.isHidden = true
ApiProvider.request(UApi.searchHot, model: HotItemsModel.self) { [weak self] (result) in
self?.hotItems = result?.hotItems
self?.historyTableView.reloadData()
}
}
///模糊搜索
private func searchRelative(_ text: String) {
if text.count > 0 {
historyTableView.isHidden = true
searchTableView.isHidden = false
resultTableView.isHidden = true
currentRequest?.cancel()
currentRequest = ApiLoadingProvider.request(UApi.searchRelative(inputText: text), completion: { (result) in
let data = result.value?.data
let string = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
let model = string?.kj.model(type: ResponseData1.self) as! ResponseData1
self.relative = model.data?.returnData
self.searchTableView.reloadData()
})
}else{
historyTableView.isHidden = false
searchTableView.isHidden = true
resultTableView.isHidden = true
}
}
///精确搜索
private func searchResult(_ text: String) {
if text.count > 0 {
historyTableView.isHidden = true
searchTableView.isHidden = true
resultTableView.isHidden = false
searchBar.text = text
ApiLoadingProvider.request(UApi.searchResult(argCon: 0, q: text), model: SearchResultModel.self) { (result) in
self.comics = result?.comics
self.resultTableView.reloadData()
}
let defaults = UserDefaults.standard
var history = defaults.value(forKey: String.searchHistoryKey) as? [String] ?? [String]()
history.removeAll([text])
history.insertFirst(text)
searchHistory = history
historyTableView.reloadData()
defaults.setValue(history, forKey: String.searchHistoryKey)
defaults.synchronize()
}else{
historyTableView.isHidden = false
searchTableView.isHidden = true
resultTableView.isHidden = true
}
}
}
extension USearchViewController: UITextFieldDelegate {
@objc func textFieldTextChange(noti:Notification){
guard let textField = noti.object as? UITextField ,let text = textField.text else {
return
}
searchRelative(text)
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
return textField.resignFirstResponder()
}
}
extension USearchViewController: UITableViewDelegate,UITableViewDataSource{
func numberOfSections(in tableView: UITableView) -> Int {
if tableView == historyTableView {
return 2
}
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView == historyTableView {
return section == 0 ? (searchHistory?.prefix(5).count ?? 0):0
}else if tableView == searchTableView {
return relative?.count ?? 0
}else {
return comics?.count ?? 0
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if tableView == historyTableView {
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: UBaseTableViewCell.self)
cell.textLabel?.text = searchHistory?[indexPath.row]
cell.textLabel?.textColor = UIColor.darkGray
cell.textLabel?.font = UIFont.systemFont(ofSize: 13)
cell.separatorInset = .zero
return cell
}else if tableView == searchTableView{
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: UBaseTableViewCell.self)
cell.textLabel?.text = relative?[indexPath.row].name
cell.textLabel?.textColor = .darkGray
cell.textLabel?.font = .systemFont(ofSize: 13)
cell.separatorInset = UIEdgeInsets.zero
return cell
}else if tableView == resultTableView{
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: UComicTCell.self)
cell.model = comics?[indexPath.row]
return cell
}
else{
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: UBaseTableViewCell.self)
return cell
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if tableView == historyTableView {
searchRelative(searchHistory[indexPath.row])
}else if tableView == searchTableView {
searchResult(relative?[indexPath.row].name ?? "")
}else{
guard let model = comics?[indexPath.row] else {
return
}
let vc = UComicViewController(detailId: model.comicId)
navigationController?.pushViewController(vc, animated: true)
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if tableView == resultTableView {
return 180
}
return 44
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if tableView == historyTableView {
return 44
}else if tableView == searchTableView {
return comics?.count ?? 0 > 0 ? 44 : CGFloat.leastNormalMagnitude
}else{
return CGFloat.leastNormalMagnitude
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if tableView == historyTableView {
let head = tableView.dequeueReusableHeaderFooterView(USearchTHead.self)
head?.titleLabel.text = section == 0 ? "看看你都搜过什么" : "大家都在搜"
head?.moreButton.setImage(UIImage(named: section == 0 ? "search_history_delete" : "search_keyword_refresh"), for: .normal)
head?.moreButtonAction = { [weak self] (button) in
if section == 0 {
self?.searchHistory.removeAll()
self?.historyTableView.reloadData()
UserDefaults.standard.removeObject(forKey: String.searchHistoryKey)
UserDefaults.standard.synchronize()
}else{
self?.loadHistory()
}
}
return head
}else if tableView == searchTableView {
let head = tableView.dequeueReusableHeaderFooterView(USearchTHead.self)
head?.titleLabel.text = "找到相关的漫画\(comics?.count ?? 0)本"
head?.moreButton.isHidden = true
return head
}
return nil
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if tableView == historyTableView {
return section == 0 ? 10 : tableView.frame.height - 44
}
return CGFloat.leastNormalMagnitude
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if tableView == historyTableView && section == 1 {
let footer = tableView.dequeueReusableHeaderFooterView(USearchTFoot.self)
footer?.data = hotItems ?? []
footer?.didSelectIndexClosure({[weak self] (index, model) in
let vc = UComicViewController(detailId: model.comic_id)
self?.navigationController?.pushViewController(vc, animated: true)
})
return footer
}
return nil
}
}
| [
-1
] |
595841c837bb9bea8d037439c46552320cee797e | da02379a86233dd0099e4f05454069259a596289 | /JSSAlertView.swift | 8f4711f26ff72bf8a12401ae8827ee33d9538ae3 | [
"MIT"
] | permissive | sman591/JSSAlertView | 6b97bd502edfcb84fb9635fd1dc048e0f422e0a8 | 6c3e08c3f8b59a47bda5298f2c1b75733050f80b | refs/heads/master | 2021-01-09T20:43:17.331547 | 2015-03-09T03:16:17 | 2015-03-09T03:16:17 | 31,873,600 | 0 | 0 | null | 2015-03-09T01:33:09 | 2015-03-09T01:33:08 | null | UTF-8 | Swift | false | false | 17,650 | swift | //
// JSSAlertView
// JSSAlertView
//
// Created by Jay Stakelon on 9/16/14.
// Copyright (c) 2014 Jay Stakelon / https://github.com/stakes - all rights reserved.
//
// Inspired by and modeled after https://github.com/vikmeup/SCLAlertView-Swift
// by Victor Radchenko: https://github.com/vikmeup
//
import Foundation
import UIKit
class JSSAlertView: UIViewController {
var containerView:UIView!
var alertBackgroundView:UIView!
var dismissButton:UIButton!
var cancelButton:UIButton!
var buttonLabel:UILabel!
var cancelButtonLabel:UILabel!
var titleLabel:UILabel!
var textView:UITextView!
var rootViewController:UIViewController!
var iconImage:UIImage!
var iconImageView:UIImageView!
var closeAction:(()->Void)!
var cancelAction:(()->Void)!
var isAlertOpen:Bool = false
enum FontType {
case Title, Text, Button
}
var titleFont = "HelveticaNeue-Light"
var textFont = "HelveticaNeue"
var buttonFont = "HelveticaNeue-Bold"
var defaultColor = UIColorFromHex(0xF2F4F4, alpha: 1)
enum TextColorTheme {
case Dark, Light
}
var darkTextColor = UIColorFromHex(0x000000, alpha: 0.75)
var lightTextColor = UIColorFromHex(0xffffff, alpha: 0.9)
let baseHeight:CGFloat = 160.0
var alertWidth:CGFloat = 290.0
let buttonHeight:CGFloat = 70.0
let padding:CGFloat = 20.0
var viewWidth:CGFloat?
var viewHeight:CGFloat?
// Allow alerts to be closed/renamed in a chainable manner
class JSSAlertViewResponder {
let alertview: JSSAlertView
init(alertview: JSSAlertView) {
self.alertview = alertview
}
func addAction(action: ()->Void) {
self.alertview.addAction(action)
}
func addCancelAction(action: ()->Void) {
self.alertview.addCancelAction(action)
}
func setTitleFont(fontStr: String) {
self.alertview.setFont(fontStr, type: .Title)
}
func setTextFont(fontStr: String) {
self.alertview.setFont(fontStr, type: .Text)
}
func setButtonFont(fontStr: String) {
self.alertview.setFont(fontStr, type: .Button)
}
func setTextTheme(theme: TextColorTheme) {
self.alertview.setTextTheme(theme)
}
func close() {
self.alertview.closeView(false)
}
}
func setFont(fontStr: String, type: FontType) {
switch type {
case .Title:
self.titleFont = fontStr
if let font = UIFont(name: self.titleFont, size: 24) {
self.titleLabel.font = font
} else {
self.titleLabel.font = UIFont.systemFontOfSize(24)
}
case .Text:
if self.textView != nil {
self.textFont = fontStr
if let font = UIFont(name: self.textFont, size: 16) {
self.textView.font = font
} else {
self.textView.font = UIFont.systemFontOfSize(16)
}
}
case .Button:
self.buttonFont = fontStr
if let font = UIFont(name: self.buttonFont, size: 24) {
self.buttonLabel.font = font
} else {
self.buttonLabel.font = UIFont.systemFontOfSize(24)
}
}
// relayout to account for size changes
self.viewDidLayoutSubviews()
}
func setTextTheme(theme: TextColorTheme) {
switch theme {
case .Light:
recolorText(lightTextColor)
case .Dark:
recolorText(darkTextColor)
}
}
func recolorText(color: UIColor) {
titleLabel.textColor = color
if textView != nil {
textView.textColor = color
}
buttonLabel.textColor = color
if cancelButtonLabel != nil {
cancelButtonLabel.textColor = color
}
}
required init(coder aDecoder: NSCoder) {
fatalError("NSCoding not supported")
}
required override init() {
super.init()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName:nibNameOrNil, bundle:nibBundleOrNil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewDidLayoutSubviews() {
super.viewWillLayoutSubviews()
let size = UIScreen.mainScreen().bounds.size
self.viewWidth = size.width
self.viewHeight = size.height
var yPos:CGFloat = 0.0
var contentWidth:CGFloat = self.alertWidth - (self.padding*2)
// position the icon image view, if there is one
if self.iconImageView != nil {
yPos += iconImageView.frame.height
var centerX = (self.alertWidth-self.iconImageView.frame.width)/2
self.iconImageView.frame.origin = CGPoint(x: centerX, y: self.padding)
yPos += padding
}
// position the title
let titleString = titleLabel.text! as NSString
let titleAttr = [NSFontAttributeName:titleLabel.font]
let titleSize = CGSize(width: contentWidth, height: 90)
let titleRect = titleString.boundingRectWithSize(titleSize, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: titleAttr, context: nil)
yPos += padding
self.titleLabel.frame = CGRect(x: self.padding, y: yPos, width: self.alertWidth - (self.padding*2), height: ceil(titleRect.size.height))
yPos += ceil(titleRect.size.height)
// position text
if self.textView != nil {
let textString = textView.text! as NSString
let textAttr = [NSFontAttributeName:textView.font]
let textSize = CGSize(width: contentWidth, height: 90)
let textRect = textString.boundingRectWithSize(textSize, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: textAttr, context: nil)
self.textView.frame = CGRect(x: self.padding, y: yPos, width: self.alertWidth - (self.padding*2), height: ceil(textRect.size.height)*2)
yPos += ceil(textRect.size.height) + padding/2
}
// position the buttons
yPos += self.padding
var buttonWidth = self.alertWidth
if self.cancelButton != nil {
buttonWidth = self.alertWidth/2
self.cancelButton.frame = CGRect(x: 0, y: yPos, width: buttonWidth-0.5, height: self.buttonHeight)
if self.cancelButtonLabel != nil {
self.cancelButtonLabel.frame = CGRect(x: self.padding, y: (self.buttonHeight/2) - 15, width: buttonWidth - (self.padding*2), height: 30)
}
}
var buttonX = buttonWidth == self.alertWidth ? 0 : buttonWidth
self.dismissButton.frame = CGRect(x: buttonX, y: yPos, width: buttonWidth, height: self.buttonHeight)
if self.buttonLabel != nil {
self.buttonLabel.frame = CGRect(x: self.padding, y: (self.buttonHeight/2) - 15, width: buttonWidth - (self.padding*2), height: 30)
}
// set button fonts
if self.buttonLabel != nil {
buttonLabel.font = UIFont(name: self.buttonFont, size: 20)
}
if self.cancelButtonLabel != nil {
cancelButtonLabel.font = UIFont(name: self.buttonFont, size: 20)
}
yPos += self.buttonHeight
// size the background view
self.alertBackgroundView.frame = CGRect(x: 0, y: 0, width: self.alertWidth, height: yPos)
// size the container that holds everything together
self.containerView.frame = CGRect(x: (self.viewWidth!-self.alertWidth)/2, y: (self.viewHeight! - yPos)/2, width: self.alertWidth, height: yPos)
}
func info(viewController: UIViewController, title: String, text: String?=nil, buttonText: String?=nil, cancelButtonText: String?=nil) -> JSSAlertViewResponder {
var alertview = self.show(viewController, title: title, text: text, buttonText: buttonText, cancelButtonText: cancelButtonText, color: UIColorFromHex(0x3498db, alpha: 1))
alertview.setTextTheme(.Light)
return alertview
}
func success(viewController: UIViewController, title: String, text: String?=nil, buttonText: String?=nil, cancelButtonText: String?=nil) -> JSSAlertViewResponder {
return self.show(viewController, title: title, text: text, buttonText: buttonText, cancelButtonText: cancelButtonText, color: UIColorFromHex(0x2ecc71, alpha: 1))
}
func warning(viewController: UIViewController, title: String, text: String?=nil, buttonText: String?=nil, cancelButtonText: String?=nil) -> JSSAlertViewResponder {
return self.show(viewController, title: title, text: text, buttonText: buttonText, cancelButtonText: cancelButtonText, color: UIColorFromHex(0xf1c40f, alpha: 1))
}
func danger(viewController: UIViewController, title: String, text: String?=nil, buttonText: String?=nil, cancelButtonText: String?=nil) -> JSSAlertViewResponder {
var alertview = self.show(viewController, title: title, text: text, buttonText: buttonText, cancelButtonText: cancelButtonText, color: UIColorFromHex(0xe74c3c, alpha: 1))
alertview.setTextTheme(.Light)
return alertview
}
func show(viewController: UIViewController, title: String, text: String?=nil, buttonText: String?=nil, cancelButtonText: String?=nil, color: UIColor?=nil, iconImage: UIImage?=nil) -> JSSAlertViewResponder {
self.rootViewController = viewController.view.window!.rootViewController
self.rootViewController.addChildViewController(self)
self.rootViewController.view.addSubview(view)
self.view.backgroundColor = UIColorFromHex(0x000000, alpha: 0.7)
var baseColor:UIColor?
if let customColor = color {
baseColor = customColor
} else {
baseColor = self.defaultColor
}
var textColor = self.darkTextColor
let sz = UIScreen.mainScreen().bounds.size
self.viewWidth = sz.width
self.viewHeight = sz.height
// Container for the entire alert modal contents
self.containerView = UIView()
self.view.addSubview(self.containerView!)
// Background view/main color
self.alertBackgroundView = UIView()
alertBackgroundView.backgroundColor = baseColor
alertBackgroundView.layer.cornerRadius = 4
alertBackgroundView.layer.masksToBounds = true
self.containerView.addSubview(alertBackgroundView!)
// Icon
self.iconImage = iconImage
if self.iconImage != nil {
self.iconImageView = UIImageView(image: self.iconImage)
self.containerView.addSubview(iconImageView)
}
// Title
self.titleLabel = UILabel()
titleLabel.textColor = textColor
titleLabel.numberOfLines = 0
titleLabel.textAlignment = .Center
titleLabel.font = UIFont(name: self.titleFont, size: 24)
titleLabel.text = title
self.containerView.addSubview(titleLabel)
// View text
if let text = text? {
self.textView = UITextView()
self.textView.userInteractionEnabled = false
textView.editable = false
textView.textColor = textColor
textView.textAlignment = .Center
textView.font = UIFont(name: self.textFont, size: 16)
textView.backgroundColor = UIColor.clearColor()
textView.text = text
self.containerView.addSubview(textView)
}
// Button
self.dismissButton = UIButton()
let buttonColor = UIImage.withColor(adjustBrightness(baseColor!, 0.8))
let buttonHighlightColor = UIImage.withColor(adjustBrightness(baseColor!, 0.9))
dismissButton.setBackgroundImage(buttonColor, forState: .Normal)
dismissButton.setBackgroundImage(buttonHighlightColor, forState: .Highlighted)
dismissButton.addTarget(self, action: "buttonTap", forControlEvents: .TouchUpInside)
alertBackgroundView!.addSubview(dismissButton)
// Button text
self.buttonLabel = UILabel()
buttonLabel.textColor = textColor
buttonLabel.numberOfLines = 1
buttonLabel.textAlignment = .Center
if let text = buttonText {
buttonLabel.text = text
} else {
buttonLabel.text = "OK"
}
dismissButton.addSubview(buttonLabel)
// Second cancel button
if let btnText = cancelButtonText {
self.cancelButton = UIButton()
let buttonColor = UIImage.withColor(adjustBrightness(baseColor!, 0.8))
let buttonHighlightColor = UIImage.withColor(adjustBrightness(baseColor!, 0.9))
cancelButton.setBackgroundImage(buttonColor, forState: .Normal)
cancelButton.setBackgroundImage(buttonHighlightColor, forState: .Highlighted)
cancelButton.addTarget(self, action: "cancelButtonTap", forControlEvents: .TouchUpInside)
alertBackgroundView!.addSubview(cancelButton)
// Button text
self.cancelButtonLabel = UILabel()
cancelButtonLabel.alpha = 0.7
cancelButtonLabel.textColor = textColor
cancelButtonLabel.numberOfLines = 1
cancelButtonLabel.textAlignment = .Center
if let text = cancelButtonText {
cancelButtonLabel.text = text
}
cancelButton.addSubview(cancelButtonLabel)
}
// Animate it in
self.view.alpha = 0
UIView.animateWithDuration(0.2, animations: {
self.view.alpha = 1
})
self.containerView.frame.origin.x = self.rootViewController.view.center.x
self.containerView.center.y = -500
UIView.animateWithDuration(0.5, delay: 0.05, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.5, options: nil, animations: {
self.containerView.center = self.rootViewController.view.center
}, completion: { finished in
})
isAlertOpen = true
return JSSAlertViewResponder(alertview: self)
}
func addAction(action: ()->Void) {
self.closeAction = action
}
func buttonTap() {
closeView(true);
}
func addCancelAction(action: ()->Void) {
self.cancelAction = action
}
func cancelButtonTap() {
closeView(false);
}
func closeView(withCallback:Bool) {
UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.5, options: nil, animations: {
self.containerView.center.y = self.rootViewController.view.center.y + self.viewHeight!
}, completion: { finished in
UIView.animateWithDuration(0.1, animations: {
self.view.alpha = 0
}, completion: { finished in
if withCallback == true {
if let action = self.closeAction? {
action()
}
}
self.removeView()
})
})
}
func removeView() {
isAlertOpen = false
self.view.removeFromSuperview()
if let action = self.cancelAction? {
action()
}
}
}
// Utility methods + extensions
// Extend UIImage with a method to create
// a UIImage from a solid color
//
// See: http://stackoverflow.com/questions/20300766/how-to-change-the-highlighted-color-of-a-uibutton
extension UIImage {
class func withColor(color: UIColor) -> UIImage {
let rect = CGRectMake(0, 0, 1, 1)
UIGraphicsBeginImageContext(rect.size)
let context = UIGraphicsGetCurrentContext()
CGContextSetFillColorWithColor(context, color.CGColor)
CGContextFillRect(context, rect)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
// For any hex code 0xXXXXXX and alpha value,
// return a matching UIColor
func UIColorFromHex(rgbValue:UInt32, alpha:Double=1.0)->UIColor {
let red = CGFloat((rgbValue & 0xFF0000) >> 16)/256.0
let green = CGFloat((rgbValue & 0xFF00) >> 8)/256.0
let blue = CGFloat(rgbValue & 0xFF)/256.0
return UIColor(red:red, green:green, blue:blue, alpha:CGFloat(alpha))
}
// For any UIColor and brightness value where darker <1
// and lighter (>1) return an altered UIColor.
//
// See: http://a2apps.com.au/lighten-or-darken-a-uicolor/
func adjustBrightness(color:UIColor, amount:CGFloat) -> UIColor {
var hue:CGFloat = 0
var saturation:CGFloat = 0
var brightness:CGFloat = 0
var alpha:CGFloat = 0
if color.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) {
brightness += (amount-1.0)
brightness = max(min(brightness, 1.0), 0.0)
return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: alpha)
}
return color
}
| [
-1
] |
2868715382df9bf9a0038ed808c8b88a9bca302d | 3411e534c894b77056c4fb068fa944a11bde3ee5 | /iOS-PicPay-Teste/iOS-PicPay-Teste/Utils/Services/Brunofire.swift | 9281a3d23ad57ef4f3e43bdb85dee184908a7bb1 | [] | no_license | brunoks/Projetos-meus | f7d1a46ee5567c370a27a8c1a1f3aa71c8cc1817 | 5827914bf4f9908f8244f42a7bd16e7f58e6b15a | refs/heads/master | 2022-12-10T18:55:02.072803 | 2019-06-21T17:33:01 | 2019-06-21T17:33:01 | 129,985,924 | 0 | 0 | null | 2022-12-07T04:15:19 | 2018-04-18T01:31:26 | Swift | UTF-8 | Swift | false | false | 1,374 | swift | //
// Brunofire.swift
// iOS-PicPay-Teste
//
// Created by Mac Novo on 19/12/18.
// Copyright © 2018 Bruno iOS Dev. All rights reserved.
//
import Foundation
struct BrunoFire {
enum HTTPmethod: String {
case post
case get
}
func request(_ urlstring: String, method: HTTPmethod = .get, parameters: [String:Any] = [:], headers: [String:String] = [:], completed: @escaping (_ success:Data) ->()) {
let url = URL(string: urlstring.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!)
var request = URLRequest(url: url!)
request.httpMethod = method.rawValue
if headers.count > 0 {
request.allHTTPHeaderFields = headers
}
if parameters.count > 0 {
do {
request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted)
} catch let error {
print(error.localizedDescription)
}
}
let task = URLSession.shared.dataTask(with: request) { data, _, error in
guard error == nil else {
print(error!)
return
}
guard let data = data else {
return
}
completed(data)
}
task.resume()
}
}
| [
-1
] |
3d6564c2c078d4d743e2ab00e38b198a6a6d46bd | 4d377a7f5552b8c39aed26ad5ed4dde89a727001 | /Artsy/View_Controllers/Live_Auctions/ViewModels/LiveAuctionLotViewModel.swift | f12c3a42bafdf77b914b88c459d68af1fabb8f73 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | cn-chengjiangang/eigen | b7219752f414a82e1b4a88ad56c89c4da0cd3166 | 0184284ea148e5fce8998745909dba1ca6aee95f | refs/heads/master | 2021-01-23T05:14:09.082657 | 2017-03-25T08:46:19 | 2017-03-25T08:46:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 12,051 | swift | import Foundation
import Interstellar
// Represents a single lot view
enum LotState {
case upcomingLot(isHighestBidder: Bool)
case liveLot
case closedLot(wasPassed: Bool)
}
func == (lhs: LotState, rhs: LotState) -> Bool {
switch (lhs, rhs) {
case (.upcomingLot, .upcomingLot): return true
case (.liveLot, .liveLot): return true
case let (.closedLot(lhsClosed), .closedLot(rhsClosed)) where lhsClosed == rhsClosed: return true
default: return false
}
}
typealias CurrentBid = (bid: String, reserve: String?)
protocol LiveAuctionLotViewModelType: class {
var numberOfDerivedEvents: Int { get }
func derivedEventAtPresentationIndex(_ index: Int) -> LiveAuctionEventViewModel
var lotArtist: String { get }
var lotArtistBlurb: String? { get }
var lotArtworkDescription: String? { get }
var lotArtworkMedium: String? { get }
var lotArtworkDimensions: String? { get }
var estimateString: String? { get }
var highEstimateCents: UInt64? { get }
var lotName: String { get }
var lotID: String { get }
var lotIndex: String { get }
var lotNumber: String { get }
var lotArtworkCreationDate: String? { get }
var urlForThumbnail: URL { get }
var urlForProfile: URL { get }
var askingPrice: UInt64 { get }
var winningBidPrice: UInt64? { get }
var currencySymbol: String { get }
var numberOfBids: Int { get }
var imageAspectRatio: CGFloat { get }
var liveAuctionLotID: String { get }
var reserveStatusString: String { get }
var dateLotOpened: Date? { get }
var userIsBeingSoldTo: Bool { get }
var isBeingSold: Bool { get }
var userIsWinning: Bool { get }
var reserveStatusSignal: Observable<ARReserveStatus> { get }
var lotStateSignal: Observable<LotState> { get }
var askingPriceSignal: Observable<UInt64> { get }
var currentBidSignal: Observable<CurrentBid> { get }
var newEventsSignal: Observable<[LiveAuctionEventViewModel]> { get }
}
extension LiveAuctionLotViewModelType {
var formattedLotIndexDisplayString: String {
return "Lot \(lotIndex)"
}
var currentBidSignal: Observable<CurrentBid> {
let currencySymbol = self.currencySymbol
return askingPriceSignal.merge(reserveStatusSignal).map { (askingPrice, reserveStatus) -> CurrentBid in
let reserveString: String?
switch reserveStatus {
case .unknown: fallthrough
case .noReserve: reserveString = nil
case .reserveMet: reserveString = "(Reserve met)"
case .reserveNotMet: reserveString = "(Reserve not met)"
}
return (
bid: "Current Bid: \(askingPrice.convertToDollarString(currencySymbol))",
reserve: reserveString
)
}
}
}
class LiveAuctionLotViewModel: NSObject, LiveAuctionLotViewModelType {
fileprivate let model: LiveAuctionLot
fileprivate let bidderCredentials: BiddingCredentials
// This is the full event stream
fileprivate var fullEventList = [LiveAuctionEventViewModel]()
// This is the event stream once undos, and composite bids have
// done their work on the events
fileprivate var derivedEvents = [LiveAuctionEventViewModel]()
fileprivate typealias BiddingStatus = (status: ARLiveBiddingStatus, wasPassed: Bool, isHighestBidder: Bool)
fileprivate let biddingStatusSignal = Observable<BiddingStatus>()
fileprivate var soldStatus: String?
let reserveStatusSignal = Observable<ARReserveStatus>()
let lotStateSignal: Observable<LotState>
let askingPriceSignal = Observable<UInt64>()
let newEventsSignal = Observable<[LiveAuctionEventViewModel]>()
var sellingToBidderID: String? = nil
var winningBidEventID: String? = nil
init(lot: LiveAuctionLot, bidderCredentials: BiddingCredentials) {
self.model = lot
self.bidderCredentials = bidderCredentials
reserveStatusSignal.update(lot.reserveStatus)
askingPriceSignal.update(lot.askingPriceCents)
lotStateSignal = biddingStatusSignal.map { (biddingStatus, passed, isHighestBidder) -> LotState in
switch biddingStatus {
case .upcoming: fallthrough // Case that sale is not yet open
case .open: // Case that lot is open to leave max bids
return .upcomingLot(isHighestBidder: isHighestBidder)
case .onBlock: // Currently on the block
return .liveLot
case .complete: // Closed
return .closedLot(wasPassed: passed)
}
}
}
var lotArtworkDescription: String? {
return model.artwork.blurb
}
var lotArtworkMedium: String? {
return model.artwork.medium
}
var lotArtworkDimensions: String? {
return model.artwork.dimensionsCM
}
var lotIndex: String {
// TODO: a lot's position is not the same as it's lot number. See: https://github.com/artsy/eigen/issues/1791
return String(model.position)
}
var lotNumber: String {
return String(model.lotNumber)
}
var winningBidPrice: UInt64? {
return self.winningBidEvent?.bidAmountCents
}
var askingPrice: UInt64 {
return model.askingPriceCents
}
var numberOfBids: Int {
return fullEventList.filter { $0.isBid }.count
}
var urlForThumbnail: URL {
return model.urlForThumbnail()
}
var urlForProfile: URL {
return model.urlForProfile()
}
var imageAspectRatio: CGFloat {
return model.imageAspectRatio()
}
var lotName: String {
return model.artworkTitle
}
var lotID: String {
return model.liveAuctionLotID
}
var lotArtworkCreationDate: String? {
return model.artworkDate
}
var lotArtist: String {
return model.artistName
}
var lotArtistBlurb: String? {
return model.artistBlurb
}
var liveAuctionLotID: String {
return model.liveAuctionLotID
}
var winningBidEvent: LiveAuctionEventViewModel? {
return fullEventList.filter({ $0.eventID == winningBidEventID }).last
}
var isBeingSold: Bool {
return sellingToBidderID != nil
}
var userIsBeingSoldTo: Bool {
guard let
bidderID = bidderCredentials.bidderID,
let sellingToBidderID = sellingToBidderID else { return false }
return bidderID == sellingToBidderID
}
var userIsWinning: Bool {
guard let
bidderID = bidderCredentials.bidderID,
let winningBidEvent = winningBidEvent else { return false }
return winningBidEvent.hasBidderID(bidderID)
}
func findBidWithValue(_ amountCents: UInt64) -> LiveAuctionEventViewModel? {
return fullEventList.filter({ $0.isBid && $0.hasAmountCents(amountCents) }).first
}
// Want to avoid array searching + string->date processing every in timer loops
// so pre-cache createdAt when found.
fileprivate var _dateLotOpened: Date?
var dateLotOpened: Date? {
guard _dateLotOpened == nil else { return _dateLotOpened }
guard let opening = fullEventList.filter({ $0.isLotOpening }).first else { return nil }
_dateLotOpened = opening.dateEventCreated as Date
return _dateLotOpened
}
var currencySymbol: String {
return model.currencySymbol
}
var estimateString: String? {
return model.estimate
}
var highEstimateCents: UInt64? {
return model.highEstimateCents?.uint64Value
}
var eventIDs: [String] {
return model.eventIDs
}
func eventWithID(_ string: String) -> LiveAuctionEventViewModel? {
return fullEventList.filter { $0.event.eventID == string }.first
}
var numberOfDerivedEvents: Int {
return derivedEvents.count
}
func derivedEventAtPresentationIndex(_ index: Int) -> LiveAuctionEventViewModel {
// Events are ordered FIFO, need to inverse for presentation
return derivedEvents[numberOfDerivedEvents - index - 1]
}
var reserveStatusString: String {
guard let status = reserveStatusSignal.peek() else {
return "unknown reserve"
}
switch status {
case .unknown: fallthrough
case .noReserve:
return "no reserve"
case .reserveMet:
return "reserve met"
case .reserveNotMet:
return "reserve not yet met"
}
}
func updateReserveStatus(_ reserveStatusString: String) {
let updated = model.updateReserveStatus(with: reserveStatusString)
if updated {
reserveStatusSignal.update(model.reserveStatus)
}
}
func updateOnlineAskingPrice(_ askingPrice: UInt64) {
let updated = model.updateOnlineAskingPrice(askingPrice)
if updated {
askingPriceSignal.update(askingPrice)
}
}
func updateBiddingStatus(_ biddingStatus: String, wasPassed: Bool) {
let updated = model.updateBiddingStatus(with: biddingStatus)
if updated {
biddingStatusSignal.update((status: model.biddingStatus, wasPassed: wasPassed, isHighestBidder: self.userIsWinning))
}
}
func updateSellingToBidder(_ sellingToBidderID: String?) {
self.sellingToBidderID = sellingToBidderID
}
func updateWinningBidEventID(_ winningBidEventId: String?) {
self.winningBidEventID = winningBidEventId
}
func addEvents(_ newEvents: [LiveEvent]) {
model.addEvents(newEvents.map { $0.eventID })
let newEventViewModels = newEvents.map { LiveAuctionEventViewModel(event: $0, currencySymbol: model.currencySymbol) }
fullEventList += newEventViewModels
updateExistingEventsWithLotState()
var allUserFacingEvents = fullEventList.filter { $0.isUserFacing }
if let winningBidEvent = allUserFacingEvents.remove(matching: { event in
guard let winningBidEventID = self.winningBidEventID else { return false }
return event.eventID == winningBidEventID
}) {
derivedEvents = allUserFacingEvents + [winningBidEvent]
} else {
derivedEvents = allUserFacingEvents
}
let newDerivedEvents = newEventViewModels.filter { $0.isUserFacing }
newEventsSignal.update(newDerivedEvents)
}
/// This isn't really very efficient, lots of loops to do lookups, maybe n^n?
fileprivate func updateExistingEventsWithLotState() {
// Undoes need applying
for undoEvent in fullEventList.filter({ $0.isUndo }) {
guard let
referenceEventID = undoEvent.undoLiveEventID,
let eventToUndo = eventWithID(referenceEventID) else { continue }
eventToUndo.cancel()
}
/// Setup Pending
for bidEvent in fullEventList.filter({ $0.isBidConfirmation }) {
guard let
amount = bidEvent.bidConfirmationAmount,
let eventToConfirm = findBidWithValue(amount) else { continue }
eventToConfirm.confirm()
}
/// Setup bidStatus, so an EventVM knows if it's top/owner by the user etc
for bidEvent in fullEventList.filter({ $0.isBid }) {
let isTopBid = (bidEvent.eventID == winningBidEvent?.eventID)
let isUser: Bool
if let bidderID = bidderCredentials.bidderID, bidderCredentials.canBid {
isUser = bidEvent.hasBidderID(bidderID)
} else {
isUser = false
}
let status: BidEventBidStatus
if bidEvent.isFloorBidder {
status = .bid(isMine: isUser, isTop: isTopBid)
} else { // if bidEvent.isArtsyBidder {
status = .bid(isMine: isUser, isTop: isTopBid)
}
bidEvent.bidStatus = status
}
}
}
| [
-1
] |
f10a1eda5f61d730a2c78630ac865798df44cbc5 | 764e8145519cd0fc1c8ef4a1f6c8cc578e074e74 | /nns.st/App/Views/Class/DateInfoCell.swift | 49f023df4a4cd4243a7025d09f90df86c589c71c | [] | no_license | shohe/nns_st_stylist_ios | 517acc3f1231f67165bcfe79537d7623ef368e28 | 4abed55318721335f4b8e98dcbc1d7f77781a93b | refs/heads/master | 2020-03-29T11:24:24.617427 | 2018-09-22T06:14:17 | 2018-09-22T06:14:17 | 149,850,878 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,806 | swift | //
// DateInfoCell.swift
// nns.st
//
// Created by SHOHE on 2018/08/20.
// Copyright © 2018 OhtaniShohe. All rights reserved.
//
import UIKit
class DateInfoCell: UITableViewCell {
@IBOutlet weak var dateLabel: UILabel!
static var identifier:String {
get{
return "DateInfoCell"
}
}
static var nib:UINib {
get{
return UINib(nibName: "DateInfoCell", bundle: nil)
}
}
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
}
}
extension DateInfoCell {
func setItem(item: OfferGetDetailItem?) {
if let i = item {
dateLabel.text = self.fixFormat(isoDate: i.dateTime)
}
}
func setItem(item: OfferHistoryDetailGetItem?) {
if let i = item {
dateLabel.text = self.fixFormat(isoDate: i.dateTime)
}
}
func setEachValue(item: OfferItem?) {
if let item = item {
setDateTime(date: item.datetime)
}
}
private func fixFormat(isoDate: String) -> String {
let dateArray = isoDate.components(separatedBy: " ")
let timeArray = dateArray[1].components(separatedBy: ":")
let fixed = "\(dateArray[0]) \(timeArray[0]) : \(timeArray[1]) ~"
return fixed
}
private func setDateTime(date: Date?) {
if let date = date {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH : mm ~"
dateLabel.text = dateFormatter.string(from: date)
}
}
}
| [
-1
] |
a4dd65c15c94bac8dd4c81da82b39f7f5beff76d | 735731b78c519520764f588c172e7dbf2e8f5420 | /Collaborator/DetailViewController.swift | b2fb924b52d478feba37cb80b976f05612d6d1a7 | [] | no_license | woodylouis/collaborator | 5ab4e065494615c7157714c4feb31e09f1167737 | dba19b02f1671d5381817da42fef5b0b6e9b84d5 | refs/heads/master | 2020-03-14T21:40:23.555728 | 2018-06-02T12:13:55 | 2018-06-02T12:13:55 | 131,802,046 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,008 | swift | //
// DetailViewController.swift
// Collaborator
//
// Created by Wenjin Li on 26/4/18.
// Copyright © 2018 Wenjin Li. All rights reserved.
//
import UIKit
protocol DetailViewControllerDelegate: class {
func detailViewControllerDidUpdate(_ detailViewController: DetailViewController)
}
let subsectionHeaders = ["TASK", "COLLABORATORS", "LOG"]
enum subSections: Int {
case taskSection = 0
case collaboratorSection = 1
case logSection = 2
}
class DetailViewController: UITableViewController, UITextFieldDelegate, TextFiledTableViewCellDelegate, LogTextFiledTableViewCellDelegate {
var objects = subsectionHeaders.map { (_: String) -> [Task] in return [Task]() } //.map
var delegate: DetailViewControllerDelegate?
var testFiledTableViewCell: TextFiledTableViewCell? = nil
var logTableViewCell: LogTableViewCell? = nil
var indexPath: IndexPath?
var textRowCell = Int()
var textSectionCell = Int()
var peerName = [AnyObject]()
var theHostOwner = ""
// to get row and section for the text filed
func LocateTextFiled(_ textFiledTableViewCell: TextFiledTableViewCell) {
textRowCell = textFiledTableViewCell.taskRow
textSectionCell = textFiledTableViewCell.taskSection
}
// to get row and section for the log's
func LocateLogField(_ logTextFiledTableViewCell: LogTableViewCell) {
textRowCell = logTextFiledTableViewCell.logRow
textSectionCell = logTextFiledTableViewCell.logSection
}
public func textFieldShouldReturn(_ textField: UITextField) -> Bool{
textField.resignFirstResponder()
let taskIndexPath = IndexPath(row: textRowCell, section: textSectionCell)
// return detail for in log Section
if textSectionCell == 0 {
StoreHistory(taskIndexPath: taskIndexPath)
} else if textSectionCell == 2 {
StoreAHistory(taskIndexPath: taskIndexPath)
}
delegate?.detailViewControllerDidUpdate(self)
tableView.reloadData()
return true
}
// For store history's date
func StoreHistory(taskIndexPath: IndexPath){
let theDate = Date()
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-YYYY HH:mm:ss" //Australian Date format
//formatter.dateStyle = .short
let currentDate = formatter.string(from: theDate)
let defaultChange = "\(currentDate) Wenjin Li changed topic to"
let taskCell = tableView.cellForRow(at: taskIndexPath) as! TextFiledTableViewCell
detailItem?.taskName = taskCell.taskDetailCell.text ?? ""
detailItem?.logDetail.append("\(defaultChange) \"\(taskCell.taskDetailCell.text!)\"")
}
// the function use for store log data
func StoreAHistory(taskIndexPath: IndexPath){
let logCell = tableView.cellForRow(at: taskIndexPath) as! LogTableViewCell
detailItem?.logDetail[taskIndexPath.row] = logCell.logDetailCell.text ?? ""
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillDisappear(_ animated: Bool) {
delegate?.detailViewControllerDidUpdate(self)
}
var detailItem: Task? {
didSet {
// Update the view.
//configureView()
}
}
func configureView() {
// Update the user interface for the detail item.
let taskCell = tableView.dequeueReusableCell(withIdentifier: "task") as! TextFiledTableViewCell
if let detail = detailItem {
if let field = taskCell.taskDetailCell {
field.text = detail.taskName
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
configureView()
}
// MARK: Segue
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.destination is ChatMessageViewController{
let controller = segue.destination as? ChatMessageViewController
controller?.detailItem = detailItem
}
}
// MARK: - table View
override func numberOfSections(in tableView: UITableView) -> Int {
return subsectionHeaders.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 1 {
return peerName.count
} else if section == 2 {
return detailItem?.logDetail.count ?? 1
} else {
return 1
}
}
// Switch section by identifier
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let identifier: String
guard let subSection = subSections(rawValue: indexPath.section) else {
fatalError("Unexpectedly got \(indexPath.section)")
}
switch subSection {
case .taskSection:
identifier = "task"
case .collaboratorSection:
identifier = "collaborator"
case .logSection:
identifier = "log"
// default:
// fatalError("Unexpectedly got \(indexPath.section)")
}
// guard let taggedView = cell.viewWithTag(1), let textField = taggedView as? UITextField else {
// return cell
// }
// let the program identify the cell and edit its text cell
if identifier == "task" {
let cell = tableView.dequeueReusableCell(withIdentifier: "task", for: indexPath) as! TextFiledTableViewCell
let textFiled: UITextField = cell.taskDetailCell
textFiled.text = detailItem?.description
cell.taskRow = indexPath.row
cell.taskSection = indexPath.section
cell.delegate = self
return cell
} else if identifier == "collaborator" {
let cell = tableView.dequeueReusableCell(withIdentifier: "collaborator", for: indexPath) as! CollaboratorTableViewCell
cell.textLabel?.text = String(describing: peerName[indexPath.row].displayName ?? "")
cell.detailTextLabel?.text = theHostOwner
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "log", for: indexPath) as! LogTableViewCell
let logTextField: UITextField = cell.logDetailCell
logTextField.text = detailItem?.logDetail[indexPath.row]
cell.delegate = self
cell.logRow = indexPath.row
cell.logSection = indexPath.section
return cell
}
}
// MARK: - to show sub header i.e. TASK, COLLABORATORS, LOG
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return subsectionHeaders[section]
}
}
| [
-1
] |
a5927a5edbe68a60aea29289782086588024922c | 3fdfc434396cd7fb63a07b83e63921d7daa915ce | /Automation/Source/AppDelegate.swift | 433f5f1df386e6fbde1dc859f9fc7fa6e21d9a39 | [
"LicenseRef-scancode-public-domain",
"MIT"
] | permissive | kristipati/VeraAutomationSwift | 26175ab3bc91a97773ad9942b6f17f61c6ba08f2 | 787026419847a5cd7419e15ea25bfd9343a31e87 | refs/heads/master | 2021-06-27T14:36:24.435221 | 2017-09-17T20:25:02 | 2017-09-17T20:25:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 25,670 | swift | //
// AppDelegate.swift
// Automation
//
// Created by Scott Gruby on 10/4/14.
// Copyright (c) 2014 Gruby Solutions. All rights reserved.
//
import UIKit
import XCGLogger
import KeychainSwift
import OnePasswordExtension
let kTabOrderDefault = "Tab Order"
let kSelectedTabDefault = "Selected Tab"
let kShowAudioTabDefault = "Show Audio Tab"
let kUsername = "username"
let kPassword = "password"
let kExcludedDevices = "Excluded Devices"
let kExcludedScenes = "Excluded Scenes"
let sTimeForCheck: TimeInterval = 4.0
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate, UITabBarControllerDelegate {
let log = XCGLogger.default
var veraAPI = VeraAPI()
var periodicTimer: Timer?
var lastUnitCheck: Date?
var handlingLogin = false
var queryingVera = false
var notifyView: SFSwiftNotification?
class func appDelegate() -> AppDelegate {
// swiftlint:disable force_cast
return UIApplication.shared.delegate as! AppDelegate
// swiftlint:enable force_cast
}
var window: UIWindow?
var initialTabViewControllers = [UIViewController]()
func logout() {
KeychainSwift(keyPrefix: "").clear()
veraAPI.resetAPI()
presentLogin()
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
veraAPI.excludedDevices = UserDefaults.standard.array(forKey: kExcludedDevices) as? [Int]
veraAPI.excludedScenes = UserDefaults.standard.array(forKey: kExcludedScenes) as? [Int]
// swiftlint:disable force_cast
window?.rootViewController = UITabBarController()
let tabbarController = window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
tabbarController.delegate = self
log.setup(level: .verbose, showThreadName: true, showLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil, fileLevel: .debug)
var viewControllers = [UIViewController]()
let switchesSplitViewController = UISplitViewController()
let navController = UINavigationController(rootViewController: RoomsTableViewController())
let detailNavController = UINavigationController(rootViewController: DevicesViewController())
switchesSplitViewController.viewControllers = [navController, detailNavController]
switchesSplitViewController.tabBarItem.image = UIImage(named: "lightbulb")
switchesSplitViewController.tabBarItem.title = NSLocalizedString("SWITCHES_TITLE", comment:"")
switchesSplitViewController.delegate = self
switchesSplitViewController.preferredDisplayMode = .allVisible
switchesSplitViewController.getBaseViewController().title = switchesSplitViewController.tabBarItem.title
viewControllers.append(switchesSplitViewController)
let audioSplitViewController = UISplitViewController()
let audioViewController = RoomsTableViewController()
audioViewController.roomType = .audio
let detailAudioNavController = UINavigationController(rootViewController: DevicesViewController())
let audioNavController = UINavigationController(rootViewController: audioViewController)
audioSplitViewController.viewControllers = [audioNavController, detailAudioNavController]
audioSplitViewController.tabBarItem.image = UIImage(named: "radio")
audioSplitViewController.tabBarItem.title = NSLocalizedString("AUDIO_TITLE", comment:"")
audioSplitViewController.delegate = self
audioSplitViewController.preferredDisplayMode = .allVisible
audioSplitViewController.getBaseViewController().title = audioSplitViewController.tabBarItem.title
viewControllers.append(audioSplitViewController)
let scenesSplitViewController = UISplitViewController()
let sceneViewController = RoomsTableViewController()
sceneViewController.roomType = .scenes
let detailSceneNavController = UINavigationController(rootViewController: DevicesViewController())
let sceneNavController = UINavigationController(rootViewController: sceneViewController)
scenesSplitViewController.viewControllers = [sceneNavController, detailSceneNavController]
scenesSplitViewController.tabBarItem.image = UIImage(named: "scene")
scenesSplitViewController.tabBarItem.title = NSLocalizedString("SCENES_TITLE", comment:"")
scenesSplitViewController.delegate = self
scenesSplitViewController.preferredDisplayMode = .allVisible
scenesSplitViewController.getBaseViewController().title = scenesSplitViewController.tabBarItem.title
viewControllers.append(scenesSplitViewController)
let onViewController = DevicesViewController()
onViewController.roomType = .on
onViewController.tabBarItem.image = UIImage(named: "power")
onViewController.tabBarItem.title = NSLocalizedString("ON_TITLE", comment:"")
onViewController.getBaseViewController().title = onViewController.tabBarItem.title
let onNavController = UINavigationController(rootViewController: onViewController)
viewControllers.append(onNavController)
let locksViewController = DevicesViewController()
locksViewController.roomType = .locks
locksViewController.tabBarItem.image = UIImage(named: "lock")
locksViewController.tabBarItem.title = NSLocalizedString("LOCK_TITLE", comment:"")
locksViewController.getBaseViewController().title = locksViewController.tabBarItem.title
let locksNavController = UINavigationController(rootViewController: locksViewController)
viewControllers.append(locksNavController)
let climateViewController = DevicesViewController()
climateViewController.roomType = .climate
climateViewController.tabBarItem.image = UIImage(named: "climate")
climateViewController.tabBarItem.title = NSLocalizedString("CLIMATE_TITLE", comment:"")
climateViewController.getBaseViewController().title = climateViewController.tabBarItem.title
let climateNavController = UINavigationController(rootViewController: climateViewController)
viewControllers.append(climateNavController)
let settingsViewController = SettingsViewController()
settingsViewController.tabBarItem.image = UIImage(named: "gear")
settingsViewController.tabBarItem.title = NSLocalizedString("SETTINGS_TITLE", comment:"")
settingsViewController.title = settingsViewController.tabBarItem.title
let settingsNavController = UINavigationController(rootViewController: settingsViewController)
viewControllers.append(settingsNavController)
if let orderedArray = UserDefaults.standard.array(forKey: kTabOrderDefault) {
var currentIndex = 0
for orderedVCClass in orderedArray {
if let className = orderedVCClass as? String {
for index in 0..<viewControllers.count {
let vcClass = (viewControllers[index] as UIViewController).getBaseViewControllerName()
if vcClass == className && currentIndex != index {
viewControllers.swapAt(currentIndex, index)
}
}
}
currentIndex += 1
}
}
tabbarController.viewControllers = viewControllers
initialTabViewControllers = viewControllers // Store a reference for later
showHideAudioTab()
periodicTimer = Timer.scheduledTimer(timeInterval: sTimeForCheck, target: self, selector: #selector(AppDelegate.updateVeraInfo), userInfo: nil, repeats: true)
NotificationCenter.default.addObserver(self,
selector: #selector(AppDelegate.orientationChanged(notification:)),
name: NSNotification.Name.UIApplicationWillChangeStatusBarOrientation,
object: nil)
let delay = 1.0 * Double(NSEC_PER_SEC)
let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in
self?.handleLogin()
}
return true
}
func applicationWillResignActive(_ application: UIApplication) {
periodicTimer?.invalidate()
periodicTimer = nil
}
func applicationDidBecomeActive(_ application: UIApplication) {
periodicTimer = Timer.scheduledTimer(timeInterval: sTimeForCheck, target: self, selector: #selector(AppDelegate.updateVeraInfo), userInfo: nil, repeats: true)
lastUnitCheck = nil
updateVeraInfo()
let delay = 1.0 * Double(NSEC_PER_SEC)
let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in
self?.handleLogin()
}
}
// swiftlint:disable identifier_name
func splitViewController(_ splitViewController: UISplitViewController, showDetail vc: UIViewController, sender: Any?) -> Bool {
// swiftlint:enable identifier_name
if splitViewController.viewControllers.count == 2 {
if let navController = splitViewController.viewControllers.last as? UINavigationController {
navController.viewControllers = [vc]
}
} else if let navController = splitViewController.viewControllers.first as? UINavigationController {
navController.pushViewController(vc, animated: true)
}
return true
}
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
if let secondaryAsNavController = secondaryViewController as? UINavigationController {
if let topAsDetailController = secondaryAsNavController.topViewController as? DevicesViewController {
if topAsDetailController.room == nil {
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
return true
}
}
}
return false
}
func tabBarController(_ tabBarController: UITabBarController, didEndCustomizing viewControllers: [UIViewController], changed: Bool) {
if changed == true {
saveTabOrderWith(viewControllers: viewControllers)
checkViewControllers()
}
}
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
if viewController.isKind(of: UINavigationController.self) {
if let navController = viewController as? UINavigationController {
navController.popToRootViewController(animated: true)
}
} else if let splitViewController = viewController as? UISplitViewController, let navController = splitViewController.viewControllers.first as? UINavigationController {
navController.popToRootViewController(animated: true)
}
}
func saveTabOrderWith (viewControllers: [UIViewController]) {
var orderViewControllerArray = [String]()
for viewController in viewControllers {
orderViewControllerArray.append(viewController.getBaseViewControllerName())
}
UserDefaults.standard.set(orderViewControllerArray, forKey: kTabOrderDefault)
UserDefaults.standard.synchronize()
}
// Make sure that none of the split view controllers roll over to the more part of the tab bar controller
func checkViewControllers () {
if UIDevice.current.userInterfaceIdiom == .phone {
// swiftlint:disable force_cast
let tabbarController = window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
var splitViewControllerArray = [UIViewController]()
var otherViewControllerArray = [UIViewController]()
var rearrangeViewControllers = false
for index in 0..<tabbarController.viewControllers!.count {
let viewController = tabbarController.viewControllers![index]
if viewController as? UISplitViewController != nil {
if index > 3 {
rearrangeViewControllers = true
}
splitViewControllerArray.append(viewController)
} else {
otherViewControllerArray.append(viewController)
}
}
if rearrangeViewControllers {
var newViewControllerArray = [UIViewController]()
newViewControllerArray += splitViewControllerArray
newViewControllerArray += otherViewControllerArray
saveTabOrderWith(viewControllers: newViewControllerArray as [UIViewController])
tabbarController.viewControllers = newViewControllerArray
}
}
}
// MARK: Vera API
func handleLogin () {
if handlingLogin == true {
return
}
handlingLogin = true
var password = KeychainSwift().get(kPassword)
var username = KeychainSwift().get(kUsername)
if password != nil && password!.characters.count > 0 && username != nil && username!.characters.count > 0 {
veraAPI.username = username
veraAPI.password = password
veraAPI.getUnitsInformationForUser { [weak self] (success) -> Void in
if let strongSelf = self {
if success == true {
strongSelf.handlingLogin = false
strongSelf.updateVeraInfo()
} else {
strongSelf.presentLogin()
}
}
}
} else {
presentLogin()
}
}
func presentLogin() {
let alertController = UIAlertController(title: nil, message: NSLocalizedString("LOGIN_ALERT_TITLE", comment: ""), preferredStyle: .alert)
var textFieldObserver: NSObjectProtocol?
let loginAction = UIAlertAction(title: NSLocalizedString("LOGIN_TITLE", comment: ""), style: .default) {[weak self] (_) in
NotificationCenter.default.removeObserver(textFieldObserver as Any)
self?.handlingLogin = false
let loginTextField = alertController.textFields![0]
let passwordTextField = alertController.textFields![1]
let password = passwordTextField.text
let username = loginTextField.text
if password != nil && username != nil && password!.isEmpty == false && username!.isEmpty == false {
KeychainSwift(keyPrefix: "").clear()
KeychainSwift(keyPrefix: "").set(username!, forKey: kUsername)
KeychainSwift(keyPrefix: "").set(password!, forKey: kPassword)
self?.handleLogin()
} else {
let delay = 1.0 * Double(NSEC_PER_SEC)
let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time) {
self?.presentLogin()
}
}
}
loginAction.isEnabled = false
let cancelAction = UIAlertAction(title: NSLocalizedString("CANCEL_TITLE", comment: ""), style: .cancel) {[weak self] (_) in
NotificationCenter.default.removeObserver(textFieldObserver as Any)
self?.handlingLogin = false
}
let domainForOnePassword = "getvera.com"
let onePasswordAction = UIAlertAction(title: NSLocalizedString("ONE_PASSWORD_ACTION", comment: ""), style: .destructive) {[weak self] (_) in
NotificationCenter.default.removeObserver(textFieldObserver as Any)
guard let strongSelf = self else {return}
// swiftlint:disable force_cast
let tabbarController = strongSelf.window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
OnePasswordExtension.shared().findLogin(forURLString: domainForOnePassword, for: strongSelf.window!.rootViewController!,
sender: tabbarController.tabBar) { (credentials, _) -> Void in
strongSelf.handlingLogin = false
if let creds = credentials as? [String:String] {
let username = creds[AppExtensionUsernameKey] as String?
let password = creds[AppExtensionPasswordKey] as String?
KeychainSwift(keyPrefix: "").clear()
KeychainSwift(keyPrefix: "").set(username!, forKey: kUsername)
KeychainSwift(keyPrefix: "").set(password!, forKey: kPassword)
strongSelf.handleLogin()
} else {
let delay = 1.0 * Double(NSEC_PER_SEC)
let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
DispatchQueue.main.asyncAfter(deadline: time) {
strongSelf.presentLogin()
}
}
}
}
alertController.addTextField { (textField) in
textField.placeholder = NSLocalizedString("USERNAME_PLACEHOLDER", comment: "")
textField.text = KeychainSwift(keyPrefix: "").get(kUsername)
textFieldObserver = NotificationCenter.default.addObserver(forName: NSNotification.Name.UITextFieldTextDidChange, object: textField, queue: OperationQueue.main) { (_) in
loginAction.isEnabled = textField.text != ""
}
}
alertController.addTextField { (textField) in
textField.placeholder = NSLocalizedString("PASSWORD_PLACEHOLDER", comment: "")
textField.text = KeychainSwift(keyPrefix: "").get(kPassword)
textField.isSecureTextEntry = true
}
alertController.addAction(loginAction)
alertController.addAction(cancelAction)
if OnePasswordExtension.shared().isAppExtensionAvailable() {
alertController.addAction(onePasswordAction)
}
if KeychainSwift(keyPrefix: "").get(kUsername) != nil && KeychainSwift(keyPrefix: "").get(kPassword) != nil {
loginAction.isEnabled = true
}
// swiftlint:disable force_cast
let tabbarController = window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
tabbarController.present(alertController, animated: true, completion: nil)
}
@objc func updateVeraInfo() {
// We must have a username and password
if queryingVera == true || veraAPI.username == nil || veraAPI.password == nil || (lastUnitCheck != nil && Date().timeIntervalSince(lastUnitCheck!) < sTimeForCheck) {
if veraAPI.username == nil && veraAPI.password == nil {
handleLogin()
}
return
}
queryingVera = true
veraAPI.getUnitInformation { [weak self] (success, fullload) in
guard let strongSelf = self else {return}
strongSelf.queryingVera = false
strongSelf.lastUnitCheck = Date()
if success == true {
// swiftlint:disable force_cast
let tabbarController = strongSelf.window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
if let presentedController = tabbarController.presentedViewController {
presentedController.dismiss(animated: true) {}
}
NotificationCenter.default.post(name: Notification.Name(rawValue: VeraUnitInfoUpdated), object: nil, userInfo: [VeraUnitInfoFullLoad: fullload])
} else {
strongSelf.log.info("Did not get unit info")
if strongSelf.handlingLogin == false {
strongSelf.handleLogin()
}
}
}
}
func showHideAudioTab() {
let show = UserDefaults.standard.bool(forKey: kShowAudioTabDefault)
// swiftlint:disable force_cast
let tabbarController = window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
var newViewControllerArray = tabbarController.viewControllers
if newViewControllerArray != nil {
var indexToRemove: Int?
for index in 0..<newViewControllerArray!.count {
let viewController = newViewControllerArray![index]
let baseViewController = viewController.getBaseViewController()
if let devicesController = baseViewController as? RoomsTableViewController, devicesController.roomType == .audio {
indexToRemove = index
break
}
}
if indexToRemove != nil && show == false {
newViewControllerArray?.remove(at: indexToRemove!)
tabbarController.viewControllers = newViewControllerArray
} else if indexToRemove == nil && show == true {
for viewController in initialTabViewControllers {
let baseViewController = viewController.getBaseViewController()
if let devicesController = baseViewController as? RoomsTableViewController, devicesController.roomType == .audio {
newViewControllerArray?.append(viewController)
tabbarController.viewControllers = newViewControllerArray
tabbarController.moreNavigationController.view.setNeedsDisplay()
break
}
}
}
}
checkViewControllers()
}
func setExcludedDeviceArray(array: [Int]) {
if array.isEmpty {
UserDefaults.standard.removeObject(forKey: kExcludedDevices)
} else {
UserDefaults.standard.set(array, forKey: kExcludedDevices)
}
UserDefaults.standard.synchronize()
if veraAPI.excludedDevices == nil || (veraAPI.excludedDevices != nil && array != veraAPI.excludedDevices!) {
veraAPI.excludedDevices = array
let fullload = veraAPI.getVeraUnit() != nil
NotificationCenter.default.post(name: Notification.Name(rawValue: VeraUnitInfoUpdated), object: nil, userInfo: [VeraUnitInfoFullLoad: fullload])
}
}
func setExcludedSceneArray(array: [Int]) {
if array.isEmpty {
UserDefaults.standard.removeObject(forKey: kExcludedScenes)
} else {
UserDefaults.standard.set(array, forKey: kExcludedScenes)
}
UserDefaults.standard.synchronize()
if veraAPI.excludedScenes == nil || (veraAPI.excludedScenes != nil && array != veraAPI.excludedScenes!) {
veraAPI.excludedScenes = array
let fullload = veraAPI.getVeraUnit() != nil
NotificationCenter.default.post(name: Notification.Name(rawValue: VeraUnitInfoUpdated), object: nil, userInfo: [VeraUnitInfoFullLoad: fullload])
}
}
@objc func orientationChanged(notification: Notification) {
if notifyView != nil {
notifyView!.hide()
}
}
func showMessageWithTitle(title: String) {
// swiftlint:disable force_cast
let tabbarController = window!.rootViewController as! UITabBarController
// swiftlint:enable force_cast
_ = CGRect(x: 0, y: 0, width: tabbarController.view.frame.maxX, height: 64)
if notifyView != nil {
notifyView!.hide()
}
notifyView = SFSwiftNotification(viewController: tabbarController,
title: nil,
animationType: AnimationType.animationTypeCollision,
direction: Direction.topToBottom,
delegate: nil)
notifyView!.backgroundColor = UIColor(red: 10.0/255.0, green: 243.0/255.0, blue: 237.0/255.0, alpha: 1.0)
notifyView!.label.textColor = UIColor.black
notifyView!.label.text = title as String
notifyView!.animate(0)
}
}
extension UIViewController {
func getBaseViewController() -> UIViewController {
var viewController = self
if let navController = viewController as? UINavigationController, navController.topViewController != nil {
viewController = navController.topViewController!
}
if let splitViewController = viewController as? UISplitViewController {
viewController = splitViewController.viewControllers.first!
}
if let navController = viewController as? UINavigationController, navController.topViewController != nil {
viewController = navController.topViewController!
}
return viewController
}
func getBaseViewControllerName() -> String {
let baseViewController = getBaseViewController()
if let rooms = baseViewController as? RoomsTableViewController {
return rooms.roomType.rawValue
} else if let devices = baseViewController as? DevicesViewController {
return devices.roomType.rawValue
}
return String(describing: type(of: baseViewController))
}
}
| [
-1
] |
51362f1bbd89bc7ca3c47a1dd397bb2f9be60d0a | 4618b1f423747e7d6b317de7d1bef196548b3c07 | /MyChengyu/GameRecords/GameRecordsVC.swift | 22f1587821c34ec32a1d9741fb67ceebe88d0a41 | [] | no_license | BouberMouth/MyChengyu | 9d52ed9b33078f0d5ede877f315cc75dc0b88448 | 9ed8c8eb07e04f57766ddcefff01c9d53e03f7e3 | refs/heads/master | 2023-01-16T04:10:32.060762 | 2020-11-13T22:14:58 | 2020-11-13T22:14:58 | 276,401,920 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,609 | swift | //
// GameRecordsVC.swift
// I Learn Chengyus
//
// Created by Antoine on 02/04/2020.
// Copyright © 2020 BOUBERBOUCHE Antoine. All rights reserved.
//
import UIKit
import RealmSwift
final class GameRecordsVC: UITableViewController {
let realm = try! Realm()
lazy var records: Results<GameRecord> = {
realm.objects(GameRecord.self)
}()
var hideNavbar = false
var newRecordID: Int = -1
override func viewDidLoad() {
super.viewDidLoad()
tableView.backgroundColor = UIColor(named: "ChengyuBackground")
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cellID")
tableView.separatorColor = UIColor.chengyuWhite.withAlphaComponent(0.25)
title = String.localize(forKey: "GAME_RECORDS.TITLE")
navigationController?.navigationBar.isHidden = hideNavbar
navigationItem.leftBarButtonItem = UIBarButtonItem()
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "OK", style: .done, target: self, action: #selector(backToMenu))
}
@objc private func backToMenu() {
navigationController?.popToRootViewController(animated: true)
ReviewService.shared.increaseCompletedProcesses()
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return records.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = String.localize(forKey: "GAME_RECORDS.LIST_DATE_FORMAT")
let date = dateFormatter.string(from: records[indexPath.row].date)
let score = records[indexPath.row].score
cell.textLabel?.text = "\(date) (\(score)%)"
cell.backgroundColor = newRecordID == records[indexPath.row].id ? UIColor(named: "ChengyuBackgroundNegative")?.withAlphaComponent(0.5) : UIColor(named: "ChengyuBackground")
cell.textLabel?.textColor = .chengyuWhite
cell.textLabel?.font = UIFont.roundedFont(ofSize: 20.0, weight: .regular)
cell.selectionStyle = .none
return cell
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .destructive, title: nil) { (_, _, complete) in
try! self.realm.write {
let itemToDelete = self.records[indexPath.row]
self.realm.delete(itemToDelete)
}
tableView.reloadData()
}
deleteAction.backgroundColor = .red
if let binImage = UIImage(systemName: "trash") {
deleteAction.image = binImage
} else {
deleteAction.title = String.localize(forKey: "DEFAULT.DELETE")
}
let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
configuration.performsFirstActionWithFullSwipe = true
return configuration
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let record = records[indexPath.row]
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = String.localize(forKey: "GAME_RECORDS.DETAILS_DATE_FORMAT")
let date = dateFormatter.string(from: record.date)
let body = """
\(String.localize(forKey: "GAME_RECORDS.DETAILS_PLACEHOLDER.DATE")) : \(date)
\(String.localize(forKey: "GAME_RECORDS.DETAILS_PLACEHOLDER.DECK_NAME")) : \(record.deckName)
\(String.localize(forKey: "GAME_RECORDS.DETAILS_PLACEHOLDER.RIGHT_ANSWERS")) : \(record.goodAnswers)
\(String.localize(forKey: "GAME_RECORDS.DETAILS_PLACEHOLDER.WRONG_ANSWERS")) : \(record.wrongAnswers)
\(String.localize(forKey: "GAME_RECORDS.DETAILS_PLACEHOLDER.SCORE")) : \(record.score)%
"""
let ac = UIAlertController(title: String.localize(forKey: "GAME_RECORDS.DETAILS_ALERT_TITLE"), message: body, preferredStyle: .alert)
ac.addAction(UIAlertAction(title: String.localize(forKey: "DEFAULT.OK"), style: .cancel, handler: nil))
ac.setTheme()
present(ac, animated: true)
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.