blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f090f57ef6b378a3e201dad36cb55bfb4999b028 | 6eb09113b496189af73a843fedbcd168fb364839 | /proyectos/jsonFarmacia/jsonFarmacia/AppDelegate.swift | 8d3d23d54d5df4bbe40e5a65f13f377583a26b36 | [] | no_license | JavierAlrich/DesarrolloAplicacionesMovilesIOS_MTWDM | 5c6898028dd29790429c72cfe0ad923a188c9e70 | c6a9f7a75b9b748d356715f2de765208a59e9e27 | refs/heads/master | 2023-04-21T12:38:22.125851 | 2021-05-08T15:57:41 | 2021-05-08T15:57:41 | 364,121,360 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,353 | swift | //
// AppDelegate.swift
// jsonFarmacia
//
// Created by Javier Omedes on 06/05/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,
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,
328519,
361288,
336711,
328522,
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,
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,
116210,
337415,
419339,
419343,
419349,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
394853,
345701,
222830,
370297,
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,
141051,
337659,
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,
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,
354727,
338352,
338381,
330189,
338386,
338403,
338409,
248308,
199164,
330252,
199186,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
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,
330826,
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,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
339814,
225127,
274280,
257896,
257901,
225137,
339826,
257908,
225141,
257912,
225148,
257916,
257920,
225155,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
372738,
405533,
430129,
266294,
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,
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,
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,
415207,
366056,
366061,
415216,
210420,
415224,
423423,
415257,
415263,
366117,
415270,
144939,
415278,
415281,
415285,
415290,
415293,
349761,
415300,
333386,
366172,
333413,
423528,
423532,
210544,
415353,
333439,
415361,
267909,
210631,
333511,
358099,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
210739,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
399215,
358255,
268143,
358259,
341876,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358371,
350189,
350193,
333818,
350202,
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,
342430,
375208,
326058,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
186897,
342545,
334358,
342550,
342554,
334363,
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,
326855,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
253200,
384275,
245020,
245029,
171302,
351534,
376110,
245040,
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,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
360261,
155461,
376663,
155482,
261981,
425822,
376671,
155487,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
147317,
262005,
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
] |
852aeb0e0c1a8882d5504cc2b0e8f2e07e0e7efd | bac6d2a3e6b119214b3fe724e01d580fd939fed7 | /MoyaCache/Classes/CacheProvider.swift | 85befc757abd3fa5ea64677ef3f84a60e72b6ddb | [
"MIT"
] | permissive | Pircate/MoyaCache | 449639f4ac5f29a62f9a180765f89f2852dfeac9 | ea00296083b21ac915941ebd5fee9c1fe5ce6f75 | refs/heads/master | 2020-05-16T08:36:30.472440 | 2019-07-06T05:56:52 | 2019-07-06T05:56:52 | 182,917,699 | 7 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,424 | swift | //
// CacheProvider.swift
// MoyaCache
//
// Created by Pircate([email protected]) on 2019/4/22
// Copyright © 2019年 Pircate. All rights reserved.
//
import Moya
import Storable
public extension MoyaProvider where Target: Cacheable, Target.ResponseType == Moya.Response {
var cache: CacheProvider<MoyaProvider> {
return CacheProvider(self)
}
}
public struct CacheProvider<Provider: MoyaProviderType> where Provider.Target: Cacheable, Provider.Target.ResponseType == Moya.Response {
private let provider: Provider
init(_ provider: Provider) {
self.provider = provider
}
}
public extension CacheProvider {
@discardableResult
func request(
_ target: Provider.Target,
callbackQueue: DispatchQueue? = nil,
progress: Moya.ProgressBlock? = nil,
completion: @escaping Moya.Completion
) -> Cancellable
{
return provider.request(
target,
callbackQueue: callbackQueue,
progress: progress) { result in
switch result {
case .success(let response):
completion(.success(response))
if target.allowsStorage(response) {
try? target.storeCachedResponse(response)
}
case .failure(let error):
completion(.failure(error))
}
}
}
}
| [
-1
] |
5f794c6a463a9a267f40f98a068cce92a707f295 | cd76ce1f532672cfd603fcfb79fae1e9f4142483 | /TrumpTests/TrumpTests.swift | 2fa5805fe9b0bf88ddf1c59be8e617c2b6800008 | [] | no_license | Cryptoc1/trump | 4aee21514e5248f33e51ad04f15fbdce9dd96687 | 781cc7f08e3ea6db94a66a31546c3fd7ccee408b | refs/heads/master | 2021-01-10T18:19:30.365863 | 2015-12-16T23:57:27 | 2015-12-16T23:57:27 | 48,132,346 | 3 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 961 | swift | //
// TrumpTests.swift
// TrumpTests
//
// Created by Cryptoc1 on 12/16/15.
// Copyright © 2015 Cryptoc1. All rights reserved.
//
import XCTest
@testable import Trump
class TrumpTests: 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.
}
}
}
| [
313357,
145435,
317467,
241692,
239650,
229413,
329765,
354343,
204840,
354345,
227370,
223274,
292902,
233517,
155694,
309295,
229424,
315434,
325674,
282672,
241716,
229430,
288828,
288833,
288834,
286788,
313416,
315465,
311372,
311374,
354385,
196691,
223316,
280661,
315476,
329814,
307289,
354393,
200794,
237663,
315487,
309345,
280675,
227428,
280677,
43110,
313447,
321637,
315497,
278634,
194666,
315498,
329829,
131178,
288879,
319598,
284788,
333940,
223350,
233590,
280694,
288889,
204916,
131191,
292988,
313469,
215166,
131198,
292992,
215164,
194691,
227460,
280712,
215178,
319629,
235662,
311438,
325776,
323729,
278677,
278691,
233636,
233642,
284842,
239793,
278708,
180408,
227513,
278714,
223419,
280762,
295098,
299198,
258239,
280768,
301251,
227524,
309444,
280778,
282831,
321745,
280795,
227548,
229597,
194782,
301279,
356576,
280802,
346346,
286958,
125169,
327929,
184575,
194820,
313608,
321800,
278797,
325905,
319763,
338197,
325912,
309529,
278816,
282913,
227616,
305440,
217380,
211235,
282919,
151847,
98610,
332083,
332085,
280887,
332089,
278842,
315706,
282939,
307517,
287041,
321860,
139589,
280902,
319813,
182597,
325968,
6481,
282960,
366929,
289110,
6489,
168281,
332123,
334171,
323935,
106847,
354655,
332127,
321894,
285040,
313713,
242033,
246136,
291192,
317820,
315773,
211326,
291198,
311681,
248194,
332167,
242058,
311691,
227725,
227726,
240016,
108944,
190871,
291224,
293274,
285084,
317852,
242078,
141728,
61857,
285090,
61859,
246178,
289189,
315810,
315811,
381347,
108972,
311727,
299441,
283064,
278970,
319930,
311738,
293310,
291265,
278978,
127427,
127428,
291267,
283075,
311745,
278989,
281037,
317901,
281040,
278993,
289232,
326100,
278999,
176601,
369116,
188894,
287198,
279008,
160225,
358882,
285150,
279013,
127465,
279018,
311786,
330218,
319981,
291311,
281072,
109042,
319987,
279029,
233978,
279039,
301571,
291333,
342536,
287241,
279050,
283153,
279062,
289304,
279065,
291358,
180771,
293419,
244269,
283182,
236081,
234036,
279094,
315960,
338490,
70209,
115270,
70215,
55881,
377418,
281171,
309846,
332378,
295519,
66150,
244327,
111208,
279146,
281199,
295536,
287346,
287352,
301689,
244347,
279164,
291454,
152203,
330379,
311949,
287374,
316049,
330387,
330388,
111253,
316053,
295576,
289434,
303771,
111259,
111258,
205471,
279206,
295599,
285361,
303793,
299699,
342706,
318130,
166582,
299700,
314040,
230072,
158394,
164533,
289462,
285373,
287422,
109241,
248517,
363211,
154316,
287439,
242386,
334547,
279252,
96984,
289502,
299746,
295652,
279269,
246503,
342762,
129773,
289518,
299759,
279280,
312052,
199414,
154359,
230134,
228088,
299770,
221948,
279294,
205568,
242433,
295682,
299776,
191235,
291592,
322313,
322316,
326414,
312079,
322319,
295697,
291604,
207640,
285466,
283419,
291612,
326429,
293664,
281377,
326433,
234277,
283430,
279336,
289576,
262954,
318250,
295724,
318252,
152365,
301871,
164656,
303920,
262962,
312108,
285487,
230199,
293693,
281408,
279362,
295746,
318278,
201549,
201551,
281427,
353109,
230234,
322395,
301918,
295776,
109409,
293730,
230248,
177001,
201577,
308076,
242541,
400239,
246641,
330609,
174963,
207732,
109428,
310131,
209783,
228215,
209785,
279417,
246648,
177019,
113542,
287622,
109447,
228233,
228234,
416646,
316298,
58253,
236428,
56208,
308112,
234386,
293781,
209817,
289690,
324507,
318364,
127902,
310176,
310178,
289698,
283558,
289703,
279464,
293800,
310182,
240552,
353195,
236461,
293806,
316333,
304051,
316343,
289722,
230332,
189374,
353215,
19399,
213960,
279498,
316364,
50143,
52200,
324586,
203757,
289774,
183279,
287731,
277492,
316405,
240630,
304122,
312314,
314362,
318461,
328700,
328706,
234500,
293893,
134150,
322570,
330763,
320527,
234514,
238610,
308243,
316437,
140310,
322582,
197657,
281626,
175132,
326685,
300068,
300084,
322612,
238651,
302139,
308287,
21569,
214086,
238664,
234577,
296019,
339030,
353367,
234587,
277597,
304222,
113760,
281697,
230499,
281700,
314467,
285798,
300135,
300136,
228458,
207979,
279660,
281706,
318572,
15471,
316526,
312434,
353397,
285814,
300151,
300150,
337017,
285820,
300158,
150657,
279685,
302213,
222343,
302216,
228491,
228493,
177296,
326804,
185493,
296086,
238743,
187544,
119962,
283802,
296092,
300188,
339102,
285851,
306338,
300202,
306346,
279728,
238769,
208058,
230588,
228540,
228542,
283840,
279747,
353479,
353481,
244940,
283853,
279760,
290000,
189652,
279765,
189653,
148696,
279774,
304351,
298208,
310497,
333022,
298212,
304356,
290022,
279785,
228588,
234733,
279792,
353523,
298228,
302325,
234742,
228600,
216315,
292091,
388349,
208124,
228609,
320770,
292107,
312587,
251153,
177428,
173334,
245019,
126237,
115998,
339234,
130338,
333090,
279854,
298291,
171317,
318775,
286013,
306494,
333117,
216386,
279875,
300359,
312648,
294218,
234827,
296270,
234831,
238927,
296273,
331090,
120148,
314709,
314710,
283991,
357719,
134491,
316765,
222559,
292195,
294243,
163175,
333160,
284014,
306542,
296303,
327025,
296307,
116084,
249204,
249205,
181625,
111993,
290169,
290173,
306559,
224640,
306560,
179587,
294275,
298374,
314758,
314760,
368011,
304524,
296335,
112017,
112018,
306579,
234898,
224661,
282007,
357786,
318875,
310692,
282022,
314791,
282024,
241066,
316842,
314798,
286129,
279989,
228795,
292283,
302531,
292292,
280004,
339398,
300487,
306631,
296392,
280010,
284107,
310732,
280013,
302540,
64975,
312782,
310736,
327121,
228827,
286172,
239068,
280032,
144867,
103909,
187878,
316902,
245223,
280041,
329197,
191981,
329200,
306673,
282096,
321009,
306677,
191990,
300535,
280055,
288249,
286202,
300536,
290300,
286205,
302590,
290301,
294400,
300542,
282114,
230913,
306692,
306693,
292356,
230921,
296461,
323087,
304656,
282129,
316946,
323089,
308756,
282136,
282141,
187938,
286244,
245292,
230959,
312880,
288309,
290358,
288318,
194110,
280130,
349763,
56902,
282183,
218696,
288327,
292423,
243274,
333388,
228943,
286288,
224847,
118353,
280147,
290390,
300630,
128599,
235095,
196187,
44635,
239198,
333408,
157281,
286306,
282213,
317032,
310889,
323178,
312940,
204397,
222832,
224883,
314998,
333430,
288378,
175741,
235135,
337535,
294529,
239237,
282245,
286343,
312965,
229001,
282246,
290443,
188048,
323217,
282259,
302739,
229020,
282271,
282273,
257699,
282276,
40613,
40614,
40615,
282280,
290471,
229029,
298667,
298661,
206504,
61101,
321199,
286388,
286391,
337591,
280251,
327358,
282303,
286399,
280257,
323263,
323264,
321219,
333509,
280267,
9936,
313041,
302802,
9937,
278233,
278234,
18138,
67292,
321247,
278240,
298720,
229088,
321249,
153319,
12010,
280300,
239341,
284401,
313081,
229113,
325371,
194303,
194304,
288512,
278272,
323331,
323332,
280327,
216839,
280329,
300811,
284431,
243472,
321295,
161554,
323346,
116505,
284442,
286494,
313120,
241441,
315171,
284459,
294700,
300848,
200498,
321337,
319292,
315202,
307011,
325445,
282438,
153415,
280392,
304977,
307025,
413521,
325457,
317269,
18262,
216918,
307031,
280410,
284507,
300894,
245599,
237408,
284512,
284514,
302946,
276327,
288620,
325484,
280430,
296814,
282480,
292720,
313203,
325492,
300918,
241528,
194429,
325503,
315264,
339841,
188292,
241540,
327557,
243591,
282504,
67463,
315273,
315274,
243597,
110480,
184208,
329622,
282519,
294807,
214937,
214938,
294809,
337815,
298909,
294814,
311199,
300963,
292771,
313254,
294823,
298920,
284587,
292782,
317360,
200627,
294843,
98239,
214977,
280514,
294850,
280519,
214984,
151497,
284619,
344013,
231375,
301008,
194515,
298980,
292837,
294886,
317415,
296941,
329712,
278512,
311282,
325619,
282612,
311281,
223218,
333817,
292858
] |
d3ca703aedcf2c78d94a97d6ec9142256a5bfa9a | 75051e487f0422ffe7144e66e77da91e1a7db6ba | /iOSCleanArchitecture/Login/Entity/LoginEntity.swift | f82f3011f6544ef96850c31021bc916eabeb8d4b | [] | no_license | kosuge0820/iOSCleanArchitecture | 5ef8bbf066871f18857084534c3450989668090d | 54ba6a74347cf015ceb7ee6bc2d23576549a9a2e | refs/heads/master | 2021-01-19T14:53:11.993318 | 2017-04-16T14:45:23 | 2017-04-16T14:45:23 | 88,192,694 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 204 | swift | //
// LoginEntity.swift
// Kuri
//
// Created by k-satoshi on 2017/4/14.
// Copyright © 2016年 k-satoshi. All rights reserved.
//
import Foundation
protocol LoginEntity {
var id: Int { get }
} | [
-1
] |
8600c8c4b45968e833629f827f1abfc47d9e89f0 | 83d71f108336371def68eee82ee1169134321c06 | /Reader/Utils/MSTTools_Swift/Tools/MSTTools_Device.swift | fb76cfa4861f02c0e5dab54526cadab4de93e27c | [] | no_license | immustard/Reader | 746cbd91f9d72004e739a092a046ac0b917ffa31 | 096f06cedde4295e4442410455e39368ffeb6b30 | refs/heads/master | 2020-06-20T23:23:30.854400 | 2019-07-24T09:04:25 | 2019-07-24T09:04:25 | 197,285,429 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 709 | swift | //
// MSTTools_Device.swift
// Reader
//
// Created by 张宇豪 on 2019/7/19.
// Copyright © 2019 Mustard. All rights reserved.
//
import UIKit
public extension MSTTools {
var deviceName: String {
return UIDevice.current.name
}
var systemVersion: String {
return UIDevice.current.systemVersion
}
// MARK: - Class Methods
class func isIphoneX() -> Bool {
return MSTTools.shared.p_isIphoneX()
}
// MARK - Private Methods
private func p_isIphoneX() -> Bool {
if #available(iOS 11.0, *) {
return self.ad?.window??.safeAreaInsets != UIEdgeInsets.zero
} else {
return false
}
}
}
| [
-1
] |
a10029ce34412adb851e71f3439931f7d2deada8 | 940a62ace72e5e17a2ed3edc5ca2ff19d5ee979d | /CotEditor/Sources/NSTextView+BracePair.swift | 23d868b2512738b3b027c135685ce7b393c8b1cd | [
"CC-BY-NC-ND-4.0",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | lincjsun/CotEditor | a4f2191c2740fe0c6151e0892ff5911173bad974 | df072b7a604e968dc119cef532f1cb0123c2c643 | refs/heads/master | 2022-12-23T04:41:03.088720 | 2020-09-20T06:16:40 | 2020-09-20T06:16:40 | 297,205,062 | 1 | 0 | Apache-2.0 | 2020-09-21T02:12:12 | 2020-09-21T02:12:11 | null | UTF-8 | Swift | false | false | 2,143 | swift | //
// NSTextView+BracePair.swift
//
// CotEditor
// https://coteditor.com
//
// Created by 1024jp on 2018-03-29.
//
// ---------------------------------------------------------------------------
//
// © 2018-2020 1024jp
//
// 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
//
// https://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 Cocoa
extension NSTextView {
/// find the matching braces for the character before the cursors and highlight them
func highligtMatchingBrace(candidates: [BracePair], ignoring pairToIgnore: BracePair? = nil) {
guard
!self.string.isEmpty,
let selectedRanges = self.rangesForUserTextChange as? [NSRange]
else { return }
let cursorIndexes = selectedRanges
.filter { $0.isEmpty }
.filter { $0.location > 0 }
.map { String.Index(utf16Offset: $0.lowerBound, in: self.string) }
guard
!cursorIndexes.isEmpty,
let visibleRange = self.visibleRange,
let range = Range(visibleRange, in: self.string)
else { return }
cursorIndexes
.map { self.string.index(before: $0) }
.compactMap { self.string.indexOfBracePair(at: $0, candidates: candidates, in: range, ignoring: pairToIgnore) }
.compactMap { pairIndex in
switch pairIndex {
case .begin(let index), .end(let index): return index
case .odd: return nil
}
}
.map { NSRange($0...$0, in: self.string) }
.forEach { self.showFindIndicator(for: $0) }
}
}
| [
-1
] |
739ba5f70bcd49f595bbae442caccae46aab693d | 4d15c8681e6d640099ae87ddc425f2f295509d19 | /Example/Tests/Mocks/MockComposedRoutingPresenter.swift | 1f0634b774c0487579b57ef761dfcdf3d92f280c | [
"MIT"
] | permissive | barteljan/VISPER-Wireframe | 2ee1876007543bbb35b7de6a7ec9f669ce0b01ab | 3170b865d9bd439a53f6823b531f6ce03e9fab56 | refs/heads/master | 2021-08-24T10:39:48.750920 | 2017-12-09T08:12:54 | 2017-12-09T08:12:54 | 111,205,489 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,261 | swift | //
// MockComposedRoutingPresenter.swift
// VISPER-Wireframe_Tests
//
// Created by bartel on 02.12.17.
// Copyright © 2017 CocoaPods. All rights reserved.
//
import Foundation
import VISPER_Wireframe
import VISPER_Wireframe_Core
class MockComposedRoutingPresenter: NSObject, ComposedRoutingPresenter {
var invokedAdd = false
var invokedAddCount = 0
var invokedAddParameters: (routingPresenter: RoutingPresenter, priority: Int)?
var invokedAddParametersList = [(routingPresenter: RoutingPresenter, priority: Int)]()
func add(routingPresenter: RoutingPresenter, priority: Int) {
invokedAdd = true
invokedAddCount += 1
invokedAddParameters = (routingPresenter, priority)
invokedAddParametersList.append((routingPresenter, priority))
}
var invokedIsResponsible = false
var invokedIsResponsibleCount = 0
var invokedIsResponsibleParameters: (routeResult: RouteResult, Void)?
var invokedIsResponsibleParametersList = [(routeResult: RouteResult, Void)]()
var stubbedIsResponsibleResult: Bool! = false
func isResponsible(routeResult: RouteResult) -> Bool {
invokedIsResponsible = true
invokedIsResponsibleCount += 1
invokedIsResponsibleParameters = (routeResult, ())
invokedIsResponsibleParametersList.append((routeResult, ()))
return stubbedIsResponsibleResult
}
var invokedPresent = false
var invokedPresentCount = 0
var invokedPresentParameters: (controller: UIViewController, routeResult: RouteResult, wireframe: Wireframe, delegate: RoutingDelegate)?
var invokedPresentParametersList = [(controller: UIViewController, routeResult: RouteResult, wireframe: Wireframe, delegate: RoutingDelegate)]()
var invokedPresentParametersCompletion : (() -> Void)?
func present(controller: UIViewController, routeResult: RouteResult, wireframe: Wireframe, delegate: RoutingDelegate, completion: @escaping () -> ()) {
invokedPresent = true
invokedPresentCount += 1
invokedPresentParameters = (controller, routeResult, wireframe, delegate)
invokedPresentParametersList.append((controller, routeResult, wireframe, delegate))
invokedPresentParametersCompletion = completion
}
}
| [
-1
] |
7963e0a45948d1e7cbaeaae286d8d04b148bafb1 | 23b154624e3f197de3e6d6e29ff83e7733e30be0 | /Simplesgram/UserTableViewCell.swift | 27898dfe4441d7c8f5e46e106adc63da26865b5a | [] | no_license | JasonShi0706/Mobile_Project | c545448851627f5b800a190a638d97efd2eb04fb | aa16b574628afc4c12e3d2372f507e6741078c25 | refs/heads/master | 2021-01-12T02:12:26.618669 | 2017-01-10T01:48:28 | 2017-01-10T01:48:28 | 78,486,912 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,136 | swift | //
// UserTableViewCell.swift
// Simplesgram
//
// Created by yan ShengMing on 15/10/6.
// Copyright © 2015年 mobile_course_team_1. All rights reserved.
//
import UIKit
import Parse
import Bolts
class UserTableViewCell: UITableViewCell {
@IBOutlet weak var followButton: UIButton!
@IBOutlet weak var usernameLabel: 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
}
@IBAction func addToFollow(sender: AnyObject) {
let newFollowship=PFObject(className: "Followship")
newFollowship["follower"]=PFUser.currentUser()!.username
newFollowship["followee"]=usernameLabel.text!
newFollowship["followBy"]=PFUser.currentUser()
try! newFollowship.save()
GlobalVariable.followee.append(usernameLabel.text!)
followButton.setTitle("followed", forState: UIControlState.Normal)
followButton.enabled=false
}
}
| [
-1
] |
826a2a654fd05a9a35d018379749a60cd52d160d | d4cd1367a326dacc96951b151d260e5044458520 | /demo/Presenter/FakeLessonFactory.swift | 7832d5e1a8cf6a9836ebef98b6602ec30aec05f1 | [] | no_license | Santa-Garrick/vocaberry-demo-test | 52d63e4aff6a2cd42d7e7c6c7872b3e5bcccece3 | 00e8fe4f8ca3b8e14bb1b04d40cc625324e89ef1 | refs/heads/main | 2023-01-08T23:40:45.560033 | 2020-11-02T01:33:06 | 2020-11-02T01:33:06 | 309,227,661 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,914 | swift | //
// FakeLessonFactory.swift
// demo
//
// Created by Николай Красиков on 02.11.2020.
//
import UIKit
class FakeLessonFactory {
static func generateFakeResult() -> Exercise.Result {
let randomNotes = Double.random(in: 0.4...1)
let randomTempo = Double.random(in: 0.4...1)
return Exercise.Result(notes: randomNotes, tempo: randomTempo)
}
static var defaults: Lesson {
return Lesson(title: "Love Me Tender",
artist: "Elvis Presley",
difficulty: 1,
image: UIImage(named: "elvis-presley")!,
exercises: exercises)
}
private static var exercises: [Exercise] {
let exercises = [
Exercise(title: "Куплет", description: "Припев песни в медленном темпе, следует пропевать также как куплет."),
Exercise(title: "Основные ноты мелодии", description: "Спойте ноты, на которых строится мелодия песни."),
Exercise(title: "Терция",
description: "Самый частый и простой для голоса ход — интервал, который называется терцией.",
hasVideo: true),
Exercise(title: "Шаг в тон", description: "Будьте внимательны — интервал уменьшится и ваш голос будет восприниматься сложнее."),
Exercise(title: "Куплет", description: "Припев песни в медленном темпе, следует пропевать также как куплет."),
Exercise(title: "Основные ноты мелодии", description: "Спойте ноты, на которых строится мелодия песни."),
Exercise(title: "Терция", description: "Самый частый и простой для голоса ход — интервал, который называется терцией."),
Exercise(title: "Шаг в тон", description: "Будьте внимательны — интервал уменьшится и ваш голос будет восприниматься сложнее."),
Exercise(title: "Куплет", description: "Припев песни в медленном темпе, следует пропевать также как куплет."),
Exercise(title: "Основные ноты мелодии", description: "Спойте ноты, на которых строится мелодия песни."),
Exercise(title: "Терция", description: "Самый частый и простой для голоса ход — интервал, который называется терцией. Самый частый и простой для голоса ход — интервал, который называется терцией. Самый частый и простой для голоса ход — интервал, который называется терцией. Самый частый и простой для голоса ход — интервал, который называется терцией. Самый частый и простой для голоса ход — интервал, который называется терцией."),
Exercise(title: "Шаг в тон", description: "Будьте внимательны — интервал уменьшится и ваш голос будет восприниматься сложнее."),
].map{ $0.randomize() }
return exercises
}
}
fileprivate extension Exercise {
func randomize() -> Exercise {
var ex = self
ex.duration = Int.random(in: 25...150)
return ex
}
}
| [
-1
] |
84827f71fff910eda0b494e3aded2b123243bc8e | 1dccb69d457046aa3d731f6514dfdd3e5aa043c5 | /MoviesApp/ViewItems/RemoteImage.swift | 2cebb4a016ef6cea5890649ebc8a1d03451ed157 | [] | no_license | egoloven/MoviesApp | 58f4877c9cc5cb9b3c4c1deabfd5db392ede501f | 5ba3dbc7a5d0e7bc9cbbc004313b263a64eb9745 | refs/heads/main | 2023-04-24T10:31:58.949599 | 2021-05-10T12:10:26 | 2021-05-10T12:10:26 | 365,866,402 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,930 | swift | //
// RemoteImage.swift
// MoviesApp
//
// Created by Evgenii Goloven on 5/8/21.
//
import Foundation
import SwiftUI
enum LoadingStatus {
case error
case loading
case loaded
}
class RemoteImageLoader {
public static let cache = RemoteImageLoader()
private let cachedImages = NSCache<NSURL, UIImage>()
private var loadingResponses = [NSURL: [(UIImage?, LoadingStatus) -> Swift.Void]]()
final func offload() {
loadingResponses = [NSURL: [(UIImage?, LoadingStatus) -> Swift.Void]]()
}
final func image(url: NSURL) -> UIImage? {
return cachedImages.object(forKey: url)
}
final func load(from urlString: String, _ completion: @escaping (_ data: UIImage?, _ status: LoadingStatus) -> Void) {
guard let url = URL(string: urlString) else {
completion(nil, .error)
return
}
if let cachedImage = image(url: url as NSURL) {
completion(cachedImage, .loaded)
}
if loadingResponses[url as NSURL] != nil {
loadingResponses[url as NSURL]?.append(completion)
return
} else {
loadingResponses[url as NSURL] = [completion]
}
let dataTask = URLSession.shared.dataTask(with: url) {
data, response, error in
guard let responseData = data, let image = UIImage(data: responseData),
let blocks = self.loadingResponses[url as NSURL], error == nil else {
DispatchQueue.main.async {
completion(nil, .error)
}
return
}
// Cache the image.
self.cachedImages.setObject(image, forKey: url as NSURL, cost: responseData.count)
// Iterate over each requestor for the image and pass it back.
for block in blocks {
DispatchQueue.main.async {
block(image, .loaded)
}
return
}
}
dataTask.resume()
}
}
class RemoteImageController: ObservableObject {
@Published var loadingStatus: LoadingStatus = .loading
var image: UIImage?
init(from url: String) {
RemoteImageLoader.cache.load(from: url) {
image, status in
self.image = image
self.loadingStatus = status
}
}
}
struct RemoteImage: View {
@ObservedObject var controller: RemoteImageController
init(from url: String) {
self.controller = RemoteImageController(from: url)
}
var body: some View {
switch controller.loadingStatus {
case .loading:
Rectangle()
.fill(Color.gray)
.opacity(0.3)
case .error:
Text(Constants.noPoster)
.font(.title)
default:
Image(uiImage: controller.image!)
.resizable()
}
}
}
| [
-1
] |
4d04e577e373cc65ab878ddc7c8574eafc849910 | 4d4c9d94e4d4eafb3f15c72db838c1b0472040df | /ReactiveTest/Source/RecordedEvent.swift | f97f95ea9547c117fd8d1a9f750c10c147357781 | [
"MIT"
] | permissive | beeth0ven/Reactive | 07bdee1f74dfc1e1768b1c52f5a3297930c44858 | da567190c8567de2a4d19af1d1ab28e20f7750a5 | refs/heads/master | 2021-08-30T15:39:11.393228 | 2017-12-12T14:15:03 | 2017-12-12T14:15:03 | 103,025,814 | 3 | 0 | MIT | 2017-12-12T14:15:04 | 2017-09-10T11:59:21 | Swift | UTF-8 | Swift | false | false | 1,051 | swift | //
// Record.swift
// ReactiveTest
//
// Created by luojie on 2017/11/24.
// Copyright © 2017年 LuoJie. All rights reserved.
//
import Reactive
public struct RecordedEvent<E: Equatable> {
public let time: VirtualTimeScheduler.VirtualTime
public let event: Event<E>
}
extension RecordedEvent: Equatable {
public static func ==(lhs: RecordedEvent<E>, rhs: RecordedEvent<E>) -> Bool {
return lhs.time == rhs.time
&& lhs.event == rhs.event
}
}
extension RecordedEvent {
public static func next(_ time: VirtualTimeScheduler.VirtualTime, _ element: E) -> RecordedEvent<E> {
return RecordedEvent(time: time, event: .next(element))
}
public static func error(_ time: VirtualTimeScheduler.VirtualTime, _ error: Error) -> RecordedEvent<E> {
return RecordedEvent(time: time, event: .error(error))
}
public static func completed(_ time: VirtualTimeScheduler.VirtualTime) -> RecordedEvent<E> {
return RecordedEvent(time: time, event: .completed)
}
}
| [
-1
] |
39995c9969bd34c4339789cae046b00d84eedf5e | c96f0c685f7559943fdfadca8ba1334515d2eae6 | /NYTimesArticle/Web Service/WebResponseVerifier.swift | de14ce472fc920d6d1d57541e50472195ba7be81 | [] | no_license | NSubramanya/NYTimesArticleDemo | 7ac15bf32692b54aaf70759e45f2735dcaac293f | 130a58fcfe850a29a82c0a8cf2ce4aec37aafe20 | refs/heads/master | 2021-08-26T08:35:36.527190 | 2017-11-22T15:02:25 | 2017-11-22T15:02:25 | 111,697,837 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,074 | swift | //
// WebResponseVerifier.swift
// NYTimesArticle
//
// Created by subramanya on 20/11/17.
// Copyright © 2017 Chanel. All rights reserved.
//
import Foundation
public enum WebResponseError: Error {
case unknownError
case invalidRequest
case notFound
case invalidResponse
case noInternet
static func check(response: HTTPURLResponse?, request: URLRequest?, error: NSError?) -> WebResponseError? {
if let error = error {
return mapError(error)
}
if let response = response {
if response.statusCode != 200 {
self.logError("Invalid response status code", request: request, response: response)
let dataStoreError = WebResponseError.checkErrorCode(response.statusCode)
return dataStoreError
}
} else {
return .invalidResponse
}
return nil
}
static func checkErrorCode(_ errorCode: Int) -> WebResponseError {
switch errorCode {
case 403:
return .invalidRequest
case 404:
return .notFound
case NSURLErrorNotConnectedToInternet:
return .noInternet
default:
return .unknownError
}
}
static fileprivate func mapError(_ error: NSError) -> WebResponseError {
return self.checkErrorCode(error.code)
}
static func description(for error: WebResponseError) -> String {
switch error {
case .invalidRequest:
return "Invalid request was made"
case .notFound:
return "Not Found"
case .unknownError:
return "Encountered an unknown error"
case .invalidResponse:
return "Server returned an invalid response"
case .noInternet:
return "No Internet Connection. Please connect your device to internet to proceed"
}
}
static func logError(_ errorMessage: String, request: URLRequest?, response: HTTPURLResponse?) {
print(errorMessage)
}
}
| [
-1
] |
c55d48bbb2cf6f352ec3664ec0664a39dc1816c4 | 63e9bc7dcc5b9f2b7c2d512c6f7d12340163384e | /MobileCapture2SDKTest/FinishController.swift | 625b0492217d2ad1d1b86c660a20d3a52316d145 | [] | no_license | takaosakimoto/cumuluspro | f6a9019890805b291de47a16e13b6948ef26ea62 | 28ff538d6e77d32cd64077336a1d62c93eb748e6 | refs/heads/master | 2021-01-12T04:14:30.298006 | 2016-12-28T19:43:23 | 2016-12-28T19:43:23 | 77,556,828 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,594 | swift | //
// FinishController.swift
// MobileCapture2SDKTest
//
// Created by Carsten Houweling on 20-04-16.
// Copyright © 2016 CumulusPro. All rights reserved.
//
import UIKit
class FinishController: UIViewController {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
@IBOutlet weak var newButton: UIButton!
override func viewDidLoad() {
let backButton = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: navigationController, action: nil)
navigationItem.leftBarButtonItem = backButton
newButton.layer.masksToBounds = true
newButton.layer.cornerRadius = 40
}
@IBAction func newDocument(sender: AnyObject) {
let cc = appDelegate.clientConnector
// remove document page files
cc.removeDocumentState(cc.currentDocumentStateUniqueId)
cc.createDocumentState(true)
// select frontside document type
for i in 0 ..< cc.currentDocumentTypesCount {
if cc.currentDocumentTypeName(i) == appDelegate.FIRST_DOCUMENT_NAME {
cc.selectDocumentTypeIndex(i, finished: { (error) in
dispatch_async(dispatch_get_main_queue(), {
// self.navigationController?.popToRootViewControllerAnimated(true)
self.navigationController?.popToViewController((self.navigationController?.viewControllers[1])!, animated: true)
})
})
break
}
}
}
}
| [
-1
] |
08da803f0110e4a65d6663ab98814d31268ba291 | 7e935f8af18715787abc583966470599b95bb5bc | /FitBot_Activity_Tracker/FitBot_Activity_Tracker/Dependencies/SVNForm/SVNFormCheckMarkView.swift | dfee42883e5b4d2ce03e55b0308e734ed678bf31 | [] | no_license | bikisDesign-zz/fitBot_iOS_challenge | 47fc96cb3afeb03d4c00b2662682a476e7a7d5f8 | 6909e1f718cad51d574690bfe0d84abd2afcb222 | refs/heads/master | 2022-01-24T05:08:40.744695 | 2018-04-24T14:53:48 | 2018-04-24T14:53:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,017 | swift | //
// SVNFormCheckMarkView.swift
// Locked
//
// Created by Aaron bikis on 1/5/18.
// Copyright © 2018 Bikis Design. All rights reserved.
//
import UIKit
import SVNShapesManager
class SVNFormCheckMarkView: UIView, SVNFormField {
class var StandardHeight: CGFloat {
get {
if DeviceSize.current == .isiPad || DeviceSize.current == .isProSize {
return 100.0
}
if DeviceSize.current == .isPlus {
return 95.0
}
return 55.0
}
}
var validationText: String {
get {
return isChecked ? "tapped" : ""
}
}
var isChecked: Bool = false {
didSet {
selectCheckMark()
}
}
var type: SVNFormFieldType!
var hasErrorMessage: String {
didSet {
animateError(isError: hasErrorMessage != "")
}
}
var checkMarkColor: UIColor! {
didSet {
checkmarkMeta.stroke = checkMarkColor.cgColor
}
}
private lazy var checkmarkMeta: SVNShapeMetaData = self.checkmarkMetaFactory()
private func checkmarkMetaFactory() -> SVNShapeMetaData {
return SVNShapeMetaData(shapes: nil,
location: .fullRect,
padding: CGPoint(x: 2.5, y: 5),
size: CGSize(width: 0, height: 0),
fill: UIColor.clear.cgColor,
stroke: UIColor.red.cgColor,
strokeWidth: 5.0)
}
private var theme: SVNFormTheme
init(theme: SVNFormTheme){
self.theme = theme
hasErrorMessage = ""
super.init(frame: CGRect.zero)
setupContainer()
}
required init?(coder aDecoder: NSCoder) { fatalError() }
override func layoutSubviews() {
if isChecked {
createCheckMark()
}
}
func setView(asType type: SVNFormFieldType, isChecked: Bool){
self.type = type
self.isChecked = isChecked
}
private func setupContainer() {
backgroundColor = .clear
layer.borderColor = theme.checkMarkViewBorderColor.cgColor
layer.borderWidth = 0.5
let tgr = UITapGestureRecognizer(target: self, action: #selector(didTapContainer))
addGestureRecognizer(tgr)
checkMarkColor = theme.selectedButtonColor
}
func animateError(isError: Bool){
let fromWidth = layer.borderWidth
let toWidth: CGFloat = isError ? 5.0 : 0.5
let toColor: CGColor = isError ? theme.errorColor.cgColor : theme.checkMarkViewBorderColor.cgColor
CATransaction.begin()
let colorAnim = CABasicAnimation(keyPath: "borderColor")
colorAnim.duration = 0.25
colorAnim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
colorAnim.fromValue = layer.borderColor
colorAnim.toValue = toColor
let widthAnim = CABasicAnimation(keyPath: "borderWidth")
widthAnim.fromValue = fromWidth
widthAnim.toValue = toWidth
widthAnim.timingFunction = colorAnim.timingFunction
widthAnim.duration = 0.5
layer.add(widthAnim, forKey: "widthAnim")
layer.add(colorAnim, forKey: "colorAnim")
CATransaction.setCompletionBlock {
self.layer.borderWidth = toWidth
self.layer.borderColor = toColor
}
CATransaction.commit()
}
@objc private func didTapContainer(){
isChecked = !isChecked
selectCheckMark()
}
private func selectCheckMark(){
if isChecked {
hasErrorMessage = ""
createCheckMark()
return
}
checkmarkMeta.shapes?.forEach({
$0.removeFromSuperlayer()
})
checkmarkMeta.shapes = nil
}
private func createCheckMark(){
checkmarkMeta.shapes?.forEach({ $0.removeFromSuperlayer() }) // remove them if they exist before adding them again as this is called when laying out subviews
checkmarkMeta.shapes = nil
let manager = SVNShapesManager(container: frame)
checkmarkMeta.shapes = [manager.createCheckMark(with: checkmarkMeta)]
checkmarkMeta.shapes?.forEach({
self.layer.addSublayer($0)
})
}
}
| [
-1
] |
aefaa2c9075ccdd24b3a4e6693445ac16adb09f7 | f778723bdd8ba0733ab825d330d0750f91c141d7 | /Package.swift | c45454d342429995ddc246ba96ef3e5d68343d86 | [] | no_license | ArifADS/FormDataEncoder | 222b43569ff539728060d4817db9bf0124d41bc2 | 6887262a9388f54b01d14aba16bf8f74be57f719 | refs/heads/master | 2021-07-04T08:55:51.383071 | 2019-12-13T23:31:09 | 2019-12-13T23:31:09 | 159,843,145 | 0 | 0 | null | 2019-12-13T23:28:43 | 2018-11-30T15:34:17 | Swift | UTF-8 | Swift | false | false | 477 | swift | // swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "FormDataEncoder",
products: [
.library(name: "FormDataEncoder", targets: ["FormDataEncoder"]),
],
targets: [
.target(name: "FormDataEncoder", path: "Sources"),
.testTarget(name: "FormDataEncoderTests", dependencies: ["FormDataEncoder"], path: "Tests"),
]
)
| [
374529,
374535,
213001,
145931,
374670,
423572,
374551,
399392,
347813,
374570,
374452,
374581,
119352,
175172,
187590,
187593,
374475,
199757,
374479,
436433,
374495,
387431,
153325,
248319
] |
dc4da66f992fcd5f2593f1edcfc526c2cd7af685 | 69908d1d4df093408a3ef2a948ef3a4a37726d69 | /Clima/Clima/Model/WeatherProvider.swift | 019af00574004bd5b88e1e5111401673295f523d | [] | no_license | lynx56/Complete-iOS-App-Development | 257f08a7488674b337834c2d85fb1663084f33b3 | fc1924f2f4d4ecbae4638477c0ad3f5d9a9db5ff | refs/heads/master | 2021-07-05T12:00:09.072237 | 2020-07-23T08:11:54 | 2020-07-23T08:11:54 | 129,887,656 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 521 | swift | //
// OpenWeatherMapWeatherProvider.swift
// Clima
//
// Created by lynx on 25/04/2018.
// Copyright © 2018 Gulnaz. All rights reserved.
//
import Foundation
protocol WeatherProvider{
func getWeatherByCity(name: String, handler: @escaping ((Weather?, ProviderErrors?)->Void))
func getWeatherByLocation(longitude: Double, latitude: Double, handler: @escaping ((Weather?, ProviderErrors?)->Void))
}
enum ProviderErrors: LocalizedError{
case connectionProblem
case responseIsWrong
case unknown
}
| [
-1
] |
264096868821bbac6f2c4792d3a70b2840ffb962 | 187af66e45a73dd43242898660502e06530ebefb | /SwiftUI-Animations/SceneDelegate.swift | 0f5fae1a20b7932abe6e884ef825cf50864ba094 | [] | no_license | Ramenwaggie04/SwiftUI-Animations | dd07047ac74de7032015e6ce04b4fa4997693aee | 5ad2b4e202b56c2f99cbb64e948a4bd4d254f7ba | refs/heads/master | 2022-12-31T12:42:14.055798 | 2020-10-24T19:10:10 | 2020-10-24T19:10:10 | 294,431,915 | 0 | 0 | null | 2020-09-10T14:21:52 | 2020-09-10T14:21:50 | null | UTF-8 | Swift | false | false | 2,774 | swift | //
// SceneDelegate.swift
// SwiftUI-Animations
//
// Created by Shubham Singh on 05/08/20.
// Copyright © 2020 Shubham Singh. All rights reserved.
//
import UIKit
import SwiftUI
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).
// Create the SwiftUI view that provides the window contents.
let contentView = CircleLoader()
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
253445,
338951,
339464,
164362,
249355,
199182,
330769,
186388,
334359,
209944,
345626,
245275,
334364,
209948,
250915,
357411,
158759,
209966,
339504,
334386,
163892,
209973,
209976,
16444,
206397,
188990,
209988,
217158,
209991,
347208,
333387,
197708,
345172,
244309,
156762,
343132,
368736,
342113,
343650,
322660,
340580,
333415,
174696,
326764,
191085,
245358,
222831,
326767,
138865,
286833,
346736,
327276,
333423,
339572,
210042,
210045,
336517,
351366,
330886,
119432,
339593,
213642,
330384,
339602,
326291,
337048,
210078,
333472,
286880,
210081,
345763,
251045,
333989,
210085,
286889,
337072,
210096,
337076,
210100,
249015,
336568,
367801,
343232,
337601,
210116,
244934,
210632,
333512,
326858,
350411,
333003,
322763,
343246,
180432,
339664,
350417,
333010,
146644,
350423,
350426,
210139,
212700,
139998,
153311,
66783,
334047,
183006,
181982,
356580,
338661,
332521,
338665,
337643,
330479,
339696,
342769,
350449,
245495,
350459,
336124,
337661,
350462,
321787,
141052,
336129,
350465,
333566,
207620,
350469,
115973,
325895,
191240,
336644,
343307,
350477,
194829,
43279,
326417,
350481,
249617,
350487,
333079,
251161,
350491,
325915,
245021,
350494,
199455,
325918,
182559,
116512,
350500,
194854,
208167,
245032,
350505,
350510,
328498,
152371,
307507,
326452,
251190,
326455,
348983,
340792,
372533,
245042,
340276,
399166,
326463,
247618,
332098,
326468,
372035,
343366,
127815,
337224,
201030,
326474,
341835,
323404,
190797,
354124,
326479,
355151,
331089,
251211,
334162,
354132,
337743,
331094,
326486,
339795,
263509,
341852,
326494,
332126,
258399,
413539,
208228,
343399,
326503,
345449,
339818,
99692,
333164,
326508,
201583,
326511,
201580,
234867,
330612,
339827,
341877,
201589,
182136,
358260,
249210,
175484,
250239,
243584,
351105,
333699,
336712,
245128,
333709,
136591,
245137,
330643,
337814,
329625,
245146,
340380,
343453,
245149,
245152,
245155,
252838,
40358,
245158,
245163,
252846,
373169,
184245,
210357,
342453,
146878,
210028,
361922,
54724,
350153,
339401,
346059,
311244,
327116,
327118,
340940,
126279,
212945,
208338,
338387,
343509,
181717,
334306,
419810,
338411,
247790,
162289,
328178,
359411,
380919,
343545,
199165,
330750
] |
780f4d1bd93e58c8bd9252a9be5f33326b5f2b21 | 1c76056a3e9399bb6995e85c7f3625b94e319807 | /TapGesture/TapGesture/AppDelegate.swift | 3c9a97f229f3c09a935033973ab8ac2ac95cef75 | [] | no_license | frozenxnow/iOSproject | 7e1244514a986ca17a985e3021aa98b79a81cb49 | f2cb9771ec8c54965057b578e91129e829183330 | refs/heads/master | 2023-07-10T05:19:16.260016 | 2021-08-14T03:31:25 | 2021-08-14T03:31:25 | 374,143,582 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,346 | swift | //
// AppDelegate.swift
// TapGesture
//
// Created by 지원 on 2021/06/12.
//
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,
254030,
368727,
180313,
368735,
180320,
376931,
368752,
417924,
262283,
377012,
164028,
327871,
180416,
377036,
377046,
418010,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
385280,
336128,
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,
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,
352968,
344776,
352971,
418507,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
336711,
328522,
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,
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,
181681,
337329,
181684,
361917,
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,
353919,
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,
370415,
337659,
337668,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
354150,
354156,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
362413,
337844,
346057,
247759,
346063,
329697,
354277,
190439,
247789,
354313,
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,
436473,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
248308,
199164,
330252,
420376,
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,
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,
158761,
347176,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
412764,
339036,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
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,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
421508,
224904,
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,
257868,
225103,
257871,
397139,
225108,
225112,
257883,
257886,
225119,
257890,
225127,
257896,
274280,
257901,
225137,
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,
61722,
356637,
356640,
356643,
356646,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
348488,
332106,
348502,
250199,
250202,
332125,
250210,
332152,
389502,
250238,
356740,
373145,
340379,
389550,
324030,
266687,
160234,
127471,
340472,
324094,
266754,
324111,
340500,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
348743,
381512,
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,
324524,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
381946,
349180,
439294,
431106,
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,
349319,
210055,
218247,
210067,
210077,
210080,
251044,
210084,
185511,
210095,
210098,
210107,
210115,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275712,
275715,
275721,
349459,
333078,
251160,
349484,
349491,
415033,
357708,
210260,
365911,
259421,
365921,
333154,
333162,
234866,
390516,
333175,
357755,
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,
153302,
333534,
366307,
366311,
431851,
366318,
210672,
366321,
366325,
210695,
268041,
210698,
366348,
210706,
399128,
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,
333689,
243579,
325504,
333698,
333708,
382890,
350146,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350244,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
342111,
374902,
432271,
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,
350498,
194852,
350504,
358700,
391468,
350509,
358704,
358713,
358716,
383306,
383321,
383330,
383333,
391530,
383341,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
268701,
375208,
375216,
334262,
334275,
326084,
358856,
195039,
334304,
334311,
375277,
334321,
350723,
391690,
186897,
334358,
342550,
342554,
334363,
358941,
350761,
252461,
334384,
383536,
358961,
334394,
252482,
219718,
334407,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
260801,
350917,
391894,
154328,
416473,
64230,
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,
392091,
400285,
252836,
359334,
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,
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,
253303,
154999,
343417,
327034,
245127,
384397,
245136,
343450,
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,
425638,
425649,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
155371,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
417595,
155461,
360261,
376663,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
425845,
147317,
262005,
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,
204784,
393203,
360438,
253943,
393206,
393212,
155646
] |
90ba97e8aa82c4b2f388f2db68916d9753126767 | 1cca5e38b2a513f5e20f91b8fbefd2e16a0f7032 | /Sources/GraphQL/Language/AST.swift | 81fbced00f330ad997a25b7f00168b293581598f | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | alexsteinerde/GraphQL | c24384727f0472afdf945362f823e347df90b31c | a3011344bef0374fb72f4ad57a85460564eb8f0e | refs/heads/main | 2023-03-15T15:56:30.966647 | 2022-12-21T22:55:53 | 2022-12-21T22:55:53 | 233,377,673 | 1 | 2 | MIT | 2020-02-29T15:15:54 | 2020-01-12T10:55:29 | Swift | UTF-8 | Swift | false | false | 42,010 | swift | /**
* Contains a range of UTF-8 character offsets and token references that
* identify the region of the source from which the AST derived.
*/
public struct Location {
/**
* The character offset at which this Node begins.
*/
public let start: Int
/**
* The character offset at which this Node ends.
*/
public let end: Int
/**
* The Token at which this Node begins.
*/
public let startToken: Token
/**
* The Token at which this Node ends.
*/
public let endToken: Token
/**
* The Source document the AST represents.
*/
public let source: Source
}
/**
* Represents a range of characters represented by a lexical token
* within a Source.
*/
public final class Token {
public enum Kind: String, CustomStringConvertible {
case sof = "<SOF>"
case eof = "<EOF>"
case bang = "!"
case dollar = "$"
case openingParenthesis = "("
case closingParenthesis = ")"
case spread = "..."
case colon = ":"
case equals = "="
case at = "@"
case openingBracket = "["
case closingBracket = "]"
case openingBrace = "{"
case pipe = "|"
case closingBrace = "}"
case name = "Name"
case int = "Int"
case float = "Float"
case string = "String"
case blockstring = "BlockString"
case comment = "Comment"
public var description: String {
return rawValue
}
}
/**
* The kind of Token.
*/
public let kind: Kind
/**
* The character offset at which this Node begins.
*/
public let start: Int
/**
* The character offset at which this Node ends.
*/
public let end: Int
/**
* The 1-indexed line number on which this Token appears.
*/
public let line: Int
/**
* The 1-indexed column number at which this Token begins.
*/
public let column: Int
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
public let value: String?
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
public internal(set) weak var prev: Token?
public internal(set) var next: Token?
init(
kind: Kind,
start: Int,
end: Int,
line: Int,
column: Int,
value: String? = nil,
prev: Token? = nil,
next: Token? = nil
) {
self.kind = kind
self.start = start
self.end = end
self.line = line
self.column = column
self.value = value
self.prev = prev
self.next = next
}
}
extension Token: Equatable {
public static func == (lhs: Token, rhs: Token) -> Bool {
return lhs.kind == rhs.kind &&
lhs.start == rhs.start &&
lhs.end == rhs.end &&
lhs.line == rhs.line &&
lhs.column == rhs.column &&
lhs.value == rhs.value
}
}
extension Token: CustomStringConvertible {
public var description: String {
var description = "Token(kind: \(kind)"
if let value = value {
description += ", value: \(value)"
}
description += ", line: \(line), column: \(column))"
return description
}
}
public enum NodeResult {
case node(Node)
case array([Node])
public var isNode: Bool {
if case .node = self {
return true
}
return false
}
public var isArray: Bool {
if case .array = self {
return true
}
return false
}
}
/**
* The list of all possible AST node types.
*/
public protocol Node {
var kind: Kind { get }
var loc: Location? { get }
func get(key: String) -> NodeResult?
func set(value: Node?, key: String)
}
public extension Node {
func get(key _: String) -> NodeResult? {
return nil
}
func set(value _: Node?, key _: String) {}
}
extension Name: Node {}
extension Document: Node {}
extension OperationDefinition: Node {}
extension VariableDefinition: Node {}
extension Variable: Node {}
extension SelectionSet: Node {}
extension Field: Node {}
extension Argument: Node {}
extension FragmentSpread: Node {}
extension InlineFragment: Node {}
extension FragmentDefinition: Node {}
extension IntValue: Node {}
extension FloatValue: Node {}
extension StringValue: Node {}
extension BooleanValue: Node {}
extension EnumValue: Node {}
extension ListValue: Node {}
extension ObjectValue: Node {}
extension ObjectField: Node {}
extension Directive: Node {}
extension NamedType: Node {}
extension ListType: Node {}
extension NonNullType: Node {}
extension SchemaDefinition: Node {}
extension OperationTypeDefinition: Node {}
extension ScalarTypeDefinition: Node {}
extension ObjectTypeDefinition: Node {}
extension FieldDefinition: Node {}
extension InputValueDefinition: Node {}
extension InterfaceTypeDefinition: Node {}
extension UnionTypeDefinition: Node {}
extension EnumTypeDefinition: Node {}
extension EnumValueDefinition: Node {}
extension InputObjectTypeDefinition: Node {}
extension TypeExtensionDefinition: Node {}
extension SchemaExtensionDefinition: Node {}
extension DirectiveDefinition: Node {}
public final class Name {
public let kind: Kind = .name
public let loc: Location?
public let value: String
init(loc: Location? = nil, value: String) {
self.loc = loc
self.value = value
}
}
extension Name: Equatable {
public static func == (lhs: Name, rhs: Name) -> Bool {
return lhs.value == rhs.value
}
}
public final class Document {
public let kind: Kind = .document
public let loc: Location?
public let definitions: [Definition]
init(loc: Location? = nil, definitions: [Definition]) {
self.loc = loc
self.definitions = definitions
}
public func get(key: String) -> NodeResult? {
switch key {
case "definitions":
guard !definitions.isEmpty else {
return nil
}
return .array(definitions)
default:
return nil
}
}
}
extension Document: Equatable {
public static func == (lhs: Document, rhs: Document) -> Bool {
guard lhs.definitions.count == rhs.definitions.count else {
return false
}
for (l, r) in zip(lhs.definitions, rhs.definitions) {
guard l == r else {
return false
}
}
return true
}
}
public protocol Definition: Node {}
extension OperationDefinition: Definition {}
extension FragmentDefinition: Definition {}
public func == (lhs: Definition, rhs: Definition) -> Bool {
switch lhs {
case let l as OperationDefinition:
if let r = rhs as? OperationDefinition {
return l == r
}
case let l as FragmentDefinition:
if let r = rhs as? FragmentDefinition {
return l == r
}
case let l as TypeSystemDefinition:
if let r = rhs as? TypeSystemDefinition {
return l == r
}
default:
return false
}
return false
}
public enum OperationType: String {
case query
case mutation
// Note: subscription is an experimental non-spec addition.
case subscription
}
public final class OperationDefinition {
public let kind: Kind = .operationDefinition
public let loc: Location?
public let operation: OperationType
public let name: Name?
public let variableDefinitions: [VariableDefinition]
public let directives: [Directive]
public let selectionSet: SelectionSet
init(
loc: Location? = nil,
operation: OperationType,
name: Name? = nil,
variableDefinitions: [VariableDefinition] = [],
directives: [Directive] = [],
selectionSet: SelectionSet
) {
self.loc = loc
self.operation = operation
self.name = name
self.variableDefinitions = variableDefinitions
self.directives = directives
self.selectionSet = selectionSet
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return name.map { .node($0) }
case "variableDefinitions":
guard !variableDefinitions.isEmpty else {
return nil
}
return .array(variableDefinitions)
case "directives":
guard !variableDefinitions.isEmpty else {
return nil
}
return .array(directives)
case "selectionSet":
return .node(selectionSet)
default:
return nil
}
}
}
extension OperationDefinition: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(self))
}
public static func == (lhs: OperationDefinition, rhs: OperationDefinition) -> Bool {
return lhs.operation == rhs.operation &&
lhs.name == rhs.name &&
lhs.variableDefinitions == rhs.variableDefinitions &&
lhs.directives == rhs.directives &&
lhs.selectionSet == rhs.selectionSet
}
}
public final class VariableDefinition {
public let kind: Kind = .variableDefinition
public let loc: Location?
public let variable: Variable
public let type: Type
public let defaultValue: Value?
init(loc: Location? = nil, variable: Variable, type: Type, defaultValue: Value? = nil) {
self.loc = loc
self.variable = variable
self.type = type
self.defaultValue = defaultValue
}
public func get(key: String) -> NodeResult? {
switch key {
case "variable":
return .node(variable)
case "type":
return .node(type)
case "defaultValue":
return defaultValue.map { .node($0) }
default:
return nil
}
}
}
extension VariableDefinition: Equatable {
public static func == (lhs: VariableDefinition, rhs: VariableDefinition) -> Bool {
guard lhs.variable == rhs.variable else {
return false
}
guard lhs.type == rhs.type else {
return false
}
if lhs.defaultValue == nil, rhs.defaultValue == nil {
return true
}
guard let l = lhs.defaultValue, let r = rhs.defaultValue else {
return false
}
return l == r
}
}
public final class Variable {
public let kind: Kind = .variable
public let loc: Location?
public let name: Name
init(loc: Location? = nil, name: Name) {
self.loc = loc
self.name = name
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return .node(name)
default:
return nil
}
}
}
extension Variable: Equatable {
public static func == (lhs: Variable, rhs: Variable) -> Bool {
return lhs.name == rhs.name
}
}
public final class SelectionSet {
public let kind: Kind = .selectionSet
public let loc: Location?
public let selections: [Selection]
init(loc: Location? = nil, selections: [Selection]) {
self.loc = loc
self.selections = selections
}
public func get(key: String) -> NodeResult? {
switch key {
case "selections":
guard !selections.isEmpty else {
return nil
}
return .array(selections)
default:
return nil
}
}
}
extension SelectionSet: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(self))
}
public static func == (lhs: SelectionSet, rhs: SelectionSet) -> Bool {
guard lhs.selections.count == rhs.selections.count else {
return false
}
for (l, r) in zip(lhs.selections, rhs.selections) {
guard l == r else {
return false
}
}
return true
}
}
public protocol Selection: Node {}
extension Field: Selection {}
extension FragmentSpread: Selection {}
extension InlineFragment: Selection {}
public func == (lhs: Selection, rhs: Selection) -> Bool {
switch lhs {
case let l as Field:
if let r = rhs as? Field {
return l == r
}
case let l as FragmentSpread:
if let r = rhs as? FragmentSpread {
return l == r
}
case let l as InlineFragment:
if let r = rhs as? InlineFragment {
return l == r
}
default:
return false
}
return false
}
public final class Field {
public let kind: Kind = .field
public let loc: Location?
public let alias: Name?
public let name: Name
public let arguments: [Argument]
public let directives: [Directive]
public let selectionSet: SelectionSet?
init(
loc: Location? = nil,
alias: Name? = nil,
name: Name,
arguments: [Argument] = [],
directives: [Directive] = [],
selectionSet: SelectionSet? = nil
) {
self.loc = loc
self.alias = alias
self.name = name
self.arguments = arguments
self.directives = directives
self.selectionSet = selectionSet
}
public func get(key: String) -> NodeResult? {
switch key {
case "alias":
return alias.map { .node($0) }
case "name":
return .node(name)
case "arguments":
guard !arguments.isEmpty else {
return nil
}
return .array(arguments)
case "directives":
guard !directives.isEmpty else {
return nil
}
return .array(directives)
case "selectionSet":
return selectionSet.map { .node($0) }
default:
return nil
}
}
}
extension Field: Equatable {
public static func == (lhs: Field, rhs: Field) -> Bool {
return lhs.alias == rhs.alias &&
lhs.name == rhs.name &&
lhs.arguments == rhs.arguments &&
lhs.directives == rhs.directives &&
lhs.selectionSet == rhs.selectionSet
}
}
public final class Argument {
public let kind: Kind = .argument
public let loc: Location?
public let name: Name
public let value: Value
init(loc: Location? = nil, name: Name, value: Value) {
self.loc = loc
self.name = name
self.value = value
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return .node(name)
case "value":
return .node(value)
default:
return nil
}
}
}
extension Argument: Equatable {
public static func == (lhs: Argument, rhs: Argument) -> Bool {
return lhs.name == rhs.name &&
lhs.value == rhs.value
}
}
public protocol Fragment: Selection {}
extension FragmentSpread: Fragment {}
extension InlineFragment: Fragment {}
public final class FragmentSpread {
public let kind: Kind = .fragmentSpread
public let loc: Location?
public let name: Name
public let directives: [Directive]
init(loc: Location? = nil, name: Name, directives: [Directive] = []) {
self.loc = loc
self.name = name
self.directives = directives
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return .node(name)
case "directives":
guard !directives.isEmpty else {
return nil
}
return .array(directives)
default:
return nil
}
}
}
extension FragmentSpread: Equatable {
public static func == (lhs: FragmentSpread, rhs: FragmentSpread) -> Bool {
return lhs.name == rhs.name &&
lhs.directives == rhs.directives
}
}
public protocol HasTypeCondition {
func getTypeCondition() -> NamedType?
}
extension InlineFragment: HasTypeCondition {
public func getTypeCondition() -> NamedType? {
return typeCondition
}
}
extension FragmentDefinition: HasTypeCondition {
public func getTypeCondition() -> NamedType? {
return typeCondition
}
}
public final class InlineFragment {
public let kind: Kind = .inlineFragment
public let loc: Location?
public let typeCondition: NamedType?
public let directives: [Directive]
public let selectionSet: SelectionSet
init(
loc: Location? = nil,
typeCondition: NamedType? = nil,
directives: [Directive] = [],
selectionSet: SelectionSet
) {
self.loc = loc
self.typeCondition = typeCondition
self.directives = directives
self.selectionSet = selectionSet
}
}
public extension InlineFragment {
func get(key: String) -> NodeResult? {
switch key {
case "typeCondition":
return typeCondition.map { .node($0) }
case "directives":
guard !directives.isEmpty else {
return nil
}
return .array(directives)
case "selectionSet":
return .node(selectionSet)
default:
return nil
}
}
}
extension InlineFragment: Equatable {
public static func == (lhs: InlineFragment, rhs: InlineFragment) -> Bool {
return lhs.typeCondition == rhs.typeCondition &&
lhs.directives == rhs.directives &&
lhs.selectionSet == rhs.selectionSet
}
}
public final class FragmentDefinition {
public let kind: Kind = .fragmentDefinition
public let loc: Location?
public let name: Name
public let typeCondition: NamedType
public let directives: [Directive]
public let selectionSet: SelectionSet
init(
loc: Location? = nil,
name: Name,
typeCondition: NamedType,
directives: [Directive] = [],
selectionSet: SelectionSet
) {
self.loc = loc
self.name = name
self.typeCondition = typeCondition
self.directives = directives
self.selectionSet = selectionSet
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return .node(name)
case "typeCondition":
return .node(typeCondition)
case "directives":
guard !directives.isEmpty else {
return nil
}
return .array(directives)
case "selectionSet":
return .node(selectionSet)
default:
return nil
}
}
}
extension FragmentDefinition: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(self))
}
public static func == (lhs: FragmentDefinition, rhs: FragmentDefinition) -> Bool {
return lhs.name == rhs.name &&
lhs.typeCondition == rhs.typeCondition &&
lhs.directives == rhs.directives &&
lhs.selectionSet == rhs.selectionSet
}
}
public protocol Value: Node {}
extension Variable: Value {}
extension IntValue: Value {}
extension FloatValue: Value {}
extension StringValue: Value {}
extension BooleanValue: Value {}
extension NullValue: Value {}
extension EnumValue: Value {}
extension ListValue: Value {}
extension ObjectValue: Value {}
public func == (lhs: Value, rhs: Value) -> Bool {
switch lhs {
case let l as Variable:
if let r = rhs as? Variable {
return l == r
}
case let l as IntValue:
if let r = rhs as? IntValue {
return l == r
}
case let l as FloatValue:
if let r = rhs as? FloatValue {
return l == r
}
case let l as StringValue:
if let r = rhs as? StringValue {
return l == r
}
case let l as BooleanValue:
if let r = rhs as? BooleanValue {
return l == r
}
case let l as NullValue:
if let r = rhs as? NullValue {
return l == r
}
case let l as EnumValue:
if let r = rhs as? EnumValue {
return l == r
}
case let l as ListValue:
if let r = rhs as? ListValue {
return l == r
}
case let l as ObjectValue:
if let r = rhs as? ObjectValue {
return l == r
}
default:
return false
}
return false
}
public final class IntValue {
public let kind: Kind = .intValue
public let loc: Location?
public let value: String
init(loc: Location? = nil, value: String) {
self.loc = loc
self.value = value
}
}
extension IntValue: Equatable {
public static func == (lhs: IntValue, rhs: IntValue) -> Bool {
return lhs.value == rhs.value
}
}
public final class FloatValue {
public let kind: Kind = .floatValue
public let loc: Location?
public let value: String
init(loc: Location? = nil, value: String) {
self.loc = loc
self.value = value
}
}
extension FloatValue: Equatable {
public static func == (lhs: FloatValue, rhs: FloatValue) -> Bool {
return lhs.value == rhs.value
}
}
public final class StringValue {
public let kind: Kind = .stringValue
public let loc: Location?
public let value: String
public let block: Bool?
init(loc: Location? = nil, value: String, block: Bool? = nil) {
self.loc = loc
self.value = value
self.block = block
}
}
extension StringValue: Equatable {
public static func == (lhs: StringValue, rhs: StringValue) -> Bool {
return lhs.value == rhs.value && lhs.block == rhs.block
}
}
public final class BooleanValue {
public let kind: Kind = .booleanValue
public let loc: Location?
public let value: Bool
init(loc: Location? = nil, value: Bool) {
self.loc = loc
self.value = value
}
}
extension BooleanValue: Equatable {
public static func == (lhs: BooleanValue, rhs: BooleanValue) -> Bool {
return lhs.value == rhs.value
}
}
public final class NullValue {
public let kind: Kind = .nullValue
public let loc: Location?
init(loc: Location? = nil) {
self.loc = loc
}
}
extension NullValue: Equatable {
public static func == (_: NullValue, _: NullValue) -> Bool {
return true
}
}
public final class EnumValue {
public let kind: Kind = .enumValue
public let loc: Location?
public let value: String
init(loc: Location? = nil, value: String) {
self.loc = loc
self.value = value
}
}
extension EnumValue: Equatable {
public static func == (lhs: EnumValue, rhs: EnumValue) -> Bool {
return lhs.value == rhs.value
}
}
public final class ListValue {
public let kind: Kind = .listValue
public let loc: Location?
public let values: [Value]
init(loc: Location? = nil, values: [Value]) {
self.loc = loc
self.values = values
}
}
extension ListValue: Equatable {
public static func == (lhs: ListValue, rhs: ListValue) -> Bool {
guard lhs.values.count == rhs.values.count else {
return false
}
for (l, r) in zip(lhs.values, rhs.values) {
guard l == r else {
return false
}
}
return true
}
}
public final class ObjectValue {
public let kind: Kind = .objectValue
public let loc: Location?
public let fields: [ObjectField]
init(loc: Location? = nil, fields: [ObjectField]) {
self.loc = loc
self.fields = fields
}
}
extension ObjectValue: Equatable {
public static func == (lhs: ObjectValue, rhs: ObjectValue) -> Bool {
return lhs.fields == rhs.fields
}
}
public final class ObjectField {
public let kind: Kind = .objectField
public let loc: Location?
public let name: Name
public let value: Value
init(loc: Location? = nil, name: Name, value: Value) {
self.loc = loc
self.name = name
self.value = value
}
}
extension ObjectField: Equatable {
public static func == (lhs: ObjectField, rhs: ObjectField) -> Bool {
return lhs.name == rhs.name &&
lhs.value == rhs.value
}
}
public final class Directive {
public let kind: Kind = .directive
public let loc: Location?
public let name: Name
public let arguments: [Argument]
init(loc: Location? = nil, name: Name, arguments: [Argument] = []) {
self.loc = loc
self.name = name
self.arguments = arguments
}
}
extension Directive: Equatable {
public static func == (lhs: Directive, rhs: Directive) -> Bool {
return lhs.name == rhs.name &&
lhs.arguments == rhs.arguments
}
}
public protocol Type: Node {}
extension NamedType: Type {}
extension ListType: Type {}
extension NonNullType: Type {}
public func == (lhs: Type, rhs: Type) -> Bool {
switch lhs {
case let l as NamedType:
if let r = rhs as? NamedType {
return l == r
}
case let l as ListType:
if let r = rhs as? ListType {
return l == r
}
case let l as NonNullType:
if let r = rhs as? NonNullType {
return l == r
}
default:
return false
}
return false
}
public final class NamedType {
public let kind: Kind = .namedType
public let loc: Location?
public let name: Name
init(loc: Location? = nil, name: Name) {
self.loc = loc
self.name = name
}
public func get(key: String) -> NodeResult? {
switch key {
case "name":
return .node(name)
default:
return nil
}
}
}
extension NamedType: Equatable {
public static func == (lhs: NamedType, rhs: NamedType) -> Bool {
return lhs.name == rhs.name
}
}
public final class ListType {
public let kind: Kind = .listType
public let loc: Location?
public let type: Type
init(loc: Location? = nil, type: Type) {
self.loc = loc
self.type = type
}
}
extension ListType: Equatable {
public static func == (lhs: ListType, rhs: ListType) -> Bool {
return lhs.type == rhs.type
}
}
public protocol NonNullableType: Type {}
extension ListType: NonNullableType {}
extension NamedType: NonNullableType {}
public final class NonNullType {
public let kind: Kind = .nonNullType
public let loc: Location?
public let type: NonNullableType
init(loc: Location? = nil, type: NonNullableType) {
self.loc = loc
self.type = type
}
public func get(key: String) -> NodeResult? {
switch key {
case "type":
return .node(type)
default:
return nil
}
}
}
extension NonNullType: Equatable {
public static func == (lhs: NonNullType, rhs: NonNullType) -> Bool {
return lhs.type == rhs.type
}
}
// Type System Definition
// experimental non-spec addition.
public protocol TypeSystemDefinition: Definition {}
extension SchemaDefinition: TypeSystemDefinition {}
extension TypeExtensionDefinition: TypeSystemDefinition {}
extension SchemaExtensionDefinition: TypeSystemDefinition {}
extension DirectiveDefinition: TypeSystemDefinition {}
public func == (lhs: TypeSystemDefinition, rhs: TypeSystemDefinition) -> Bool {
switch lhs {
case let l as SchemaDefinition:
if let r = rhs as? SchemaDefinition {
return l == r
}
case let l as TypeExtensionDefinition:
if let r = rhs as? TypeExtensionDefinition {
return l == r
}
case let l as DirectiveDefinition:
if let r = rhs as? DirectiveDefinition {
return l == r
}
case let l as TypeDefinition:
if let r = rhs as? TypeDefinition {
return l == r
}
case let l as SchemaExtensionDefinition:
if let r = rhs as? SchemaExtensionDefinition {
return l == r
}
default:
return false
}
return false
}
public final class SchemaDefinition {
public let kind: Kind = .schemaDefinition
public let loc: Location?
public let description: StringValue?
public let directives: [Directive]
public let operationTypes: [OperationTypeDefinition]
init(
loc: Location? = nil,
description: StringValue? = nil,
directives: [Directive],
operationTypes: [OperationTypeDefinition]
) {
self.loc = loc
self.description = description
self.directives = directives
self.operationTypes = operationTypes
}
}
extension SchemaDefinition: Equatable {
public static func == (lhs: SchemaDefinition, rhs: SchemaDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.directives == rhs.directives &&
lhs.operationTypes == rhs.operationTypes
}
}
public final class OperationTypeDefinition {
public let kind: Kind = .operationDefinition
public let loc: Location?
public let operation: OperationType
public let type: NamedType
init(loc: Location? = nil, operation: OperationType, type: NamedType) {
self.loc = loc
self.operation = operation
self.type = type
}
}
extension OperationTypeDefinition: Equatable {
public static func == (lhs: OperationTypeDefinition, rhs: OperationTypeDefinition) -> Bool {
return lhs.operation == rhs.operation &&
lhs.type == rhs.type
}
}
public protocol TypeDefinition: TypeSystemDefinition {}
extension ScalarTypeDefinition: TypeDefinition {}
extension ObjectTypeDefinition: TypeDefinition {}
extension InterfaceTypeDefinition: TypeDefinition {}
extension UnionTypeDefinition: TypeDefinition {}
extension EnumTypeDefinition: TypeDefinition {}
extension InputObjectTypeDefinition: TypeDefinition {}
public func == (lhs: TypeDefinition, rhs: TypeDefinition) -> Bool {
switch lhs {
case let l as ScalarTypeDefinition:
if let r = rhs as? ScalarTypeDefinition {
return l == r
}
case let l as ObjectTypeDefinition:
if let r = rhs as? ObjectTypeDefinition {
return l == r
}
case let l as InterfaceTypeDefinition:
if let r = rhs as? InterfaceTypeDefinition {
return l == r
}
case let l as UnionTypeDefinition:
if let r = rhs as? UnionTypeDefinition {
return l == r
}
case let l as EnumTypeDefinition:
if let r = rhs as? EnumTypeDefinition {
return l == r
}
case let l as InputObjectTypeDefinition:
if let r = rhs as? InputObjectTypeDefinition {
return l == r
}
default:
return false
}
return false
}
public final class ScalarTypeDefinition {
public let kind: Kind = .scalarTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let directives: [Directive]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
directives: [Directive] = []
) {
self.loc = loc
self.description = description
self.name = name
self.directives = directives
}
}
extension ScalarTypeDefinition: Equatable {
public static func == (lhs: ScalarTypeDefinition, rhs: ScalarTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives
}
}
public final class ObjectTypeDefinition {
public let kind: Kind = .objectTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let interfaces: [NamedType]
public let directives: [Directive]
public let fields: [FieldDefinition]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
interfaces: [NamedType] = [],
directives: [Directive] = [],
fields: [FieldDefinition] = []
) {
self.loc = loc
self.description = description
self.name = name
self.interfaces = interfaces
self.directives = directives
self.fields = fields
}
}
extension ObjectTypeDefinition: Equatable {
public static func == (lhs: ObjectTypeDefinition, rhs: ObjectTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.interfaces == rhs.interfaces &&
lhs.directives == rhs.directives &&
lhs.fields == rhs.fields
}
}
public final class FieldDefinition {
public let kind: Kind = .fieldDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let arguments: [InputValueDefinition]
public let type: Type
public let directives: [Directive]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
arguments: [InputValueDefinition] = [],
type: Type,
directives: [Directive] = []
) {
self.loc = loc
self.description = description
self.name = name
self.arguments = arguments
self.type = type
self.directives = directives
}
}
extension FieldDefinition: Equatable {
public static func == (lhs: FieldDefinition, rhs: FieldDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.arguments == rhs.arguments &&
lhs.type == rhs.type &&
lhs.directives == rhs.directives
}
}
public final class InputValueDefinition {
public let kind: Kind = .inputValueDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let type: Type
public let defaultValue: Value?
public let directives: [Directive]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
type: Type,
defaultValue: Value? = nil,
directives: [Directive] = []
) {
self.loc = loc
self.description = description
self.name = name
self.type = type
self.defaultValue = defaultValue
self.directives = directives
}
}
extension InputValueDefinition: Equatable {
public static func == (lhs: InputValueDefinition, rhs: InputValueDefinition) -> Bool {
guard lhs.name == rhs.name else {
return false
}
guard lhs.type == rhs.type else {
return false
}
guard lhs.directives == rhs.directives else {
return false
}
if lhs.defaultValue == nil, rhs.defaultValue == nil {
return true
}
guard let l = lhs.defaultValue, let r = rhs.defaultValue else {
return false
}
return l == r
}
}
public final class InterfaceTypeDefinition {
public let kind: Kind = .interfaceTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let interfaces: [NamedType]
public let directives: [Directive]
public let fields: [FieldDefinition]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
interfaces: [NamedType] = [],
directives: [Directive] = [],
fields: [FieldDefinition]
) {
self.loc = loc
self.description = description
self.name = name
self.interfaces = interfaces
self.directives = directives
self.fields = fields
}
}
extension InterfaceTypeDefinition: Equatable {
public static func == (lhs: InterfaceTypeDefinition, rhs: InterfaceTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives &&
lhs.fields == rhs.fields
}
}
public final class UnionTypeDefinition {
public let kind: Kind = .unionTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let directives: [Directive]
public let types: [NamedType]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
directives: [Directive] = [],
types: [NamedType]
) {
self.loc = loc
self.description = description
self.name = name
self.directives = directives
self.types = types
}
}
extension UnionTypeDefinition: Equatable {
public static func == (lhs: UnionTypeDefinition, rhs: UnionTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives &&
lhs.types == rhs.types
}
}
public final class EnumTypeDefinition {
public let kind: Kind = .enumTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let directives: [Directive]
public let values: [EnumValueDefinition]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
directives: [Directive] = [],
values: [EnumValueDefinition]
) {
self.loc = loc
self.description = description
self.name = name
self.directives = directives
self.values = values
}
}
extension EnumTypeDefinition: Equatable {
public static func == (lhs: EnumTypeDefinition, rhs: EnumTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives &&
lhs.values == rhs.values
}
}
public final class EnumValueDefinition {
public let kind: Kind = .enumValueDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let directives: [Directive]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
directives: [Directive] = []
) {
self.loc = loc
self.description = description
self.name = name
self.directives = directives
}
}
extension EnumValueDefinition: Equatable {
public static func == (lhs: EnumValueDefinition, rhs: EnumValueDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives
}
}
public final class InputObjectTypeDefinition {
public let kind: Kind = .inputObjectTypeDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let directives: [Directive]
public let fields: [InputValueDefinition]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
directives: [Directive] = [],
fields: [InputValueDefinition]
) {
self.loc = loc
self.description = description
self.name = name
self.directives = directives
self.fields = fields
}
}
extension InputObjectTypeDefinition: Equatable {
public static func == (lhs: InputObjectTypeDefinition, rhs: InputObjectTypeDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.directives == rhs.directives &&
lhs.fields == rhs.fields
}
}
public final class TypeExtensionDefinition {
public let kind: Kind = .typeExtensionDefinition
public let loc: Location?
public let definition: ObjectTypeDefinition
init(loc: Location? = nil, definition: ObjectTypeDefinition) {
self.loc = loc
self.definition = definition
}
}
extension TypeExtensionDefinition: Equatable {
public static func == (lhs: TypeExtensionDefinition, rhs: TypeExtensionDefinition) -> Bool {
return lhs.definition == rhs.definition
}
}
public final class SchemaExtensionDefinition {
public let kind: Kind = .schemaExtensionDefinition
public let loc: Location?
public let definition: SchemaDefinition
init(loc: Location? = nil, definition: SchemaDefinition) {
self.loc = loc
self.definition = definition
}
}
extension SchemaExtensionDefinition: Equatable {
public static func == (lhs: SchemaExtensionDefinition, rhs: SchemaExtensionDefinition) -> Bool {
return lhs.definition == rhs.definition
}
}
public final class DirectiveDefinition {
public let kind: Kind = .directiveDefinition
public let loc: Location?
public let description: StringValue?
public let name: Name
public let arguments: [InputValueDefinition]
public let locations: [Name]
init(
loc: Location? = nil,
description: StringValue? = nil,
name: Name,
arguments: [InputValueDefinition] = [],
locations: [Name]
) {
self.loc = loc
self.name = name
self.description = description
self.arguments = arguments
self.locations = locations
}
}
extension DirectiveDefinition: Equatable {
public static func == (lhs: DirectiveDefinition, rhs: DirectiveDefinition) -> Bool {
return lhs.description == rhs.description &&
lhs.name == rhs.name &&
lhs.arguments == rhs.arguments &&
lhs.locations == rhs.locations
}
}
| [
-1
] |
2ee7c2e316002cded3abd1cf24ac7b50c0125833 | 0d32e9dd9b539b9112f6162c53512e5c2e5b0832 | /Sources/Wave.swift | 4515b7824f84583e12728f7551b4d096e5a76431 | [
"MIT"
] | permissive | onmyway133/Wave | aecdd29b7976abf59a1b2966d414425d801b93cc | 3b650cbd86845ef44eb74c716f64c35a0f3d677a | refs/heads/master | 2021-01-20T20:48:57.881587 | 2020-05-12T21:31:52 | 2020-05-12T21:31:52 | 60,433,879 | 138 | 10 | null | null | null | null | UTF-8 | Swift | false | false | 152 | swift | import UIKit
public extension UIView {
func run(_ action: Action, completion: @escaping Closure = {}) {
action.animation(self, completion)
}
}
| [
-1
] |
43af340db677b0cc58d6c8927b74a5ce7a33b9b2 | 3c6994b4fcc2fa29574250707406fbe93302e43b | /Example/BeaconEmitter/AppDelegate.swift | 49f194cd804f492e314ca581a5ac0f6a9a6dcad6 | [
"MIT"
] | permissive | carabina/BeaconEmitter-1 | 3ebe1f8680c8f8dcbb1c4a2d511fbf04ed8c279a | 044fdec00b9f2f5a85dd17d960e8ae5945abae00 | refs/heads/master | 2021-01-21T03:33:46.234377 | 2016-07-26T18:23:12 | 2016-07-26T18:23:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,100 | swift | //
// AppDelegate.swift
// BeaconEmitter
//
// Created by Matteo on 07/26/2016.
// Copyright (c) 2016 Matteo. All rights reserved.
//
import BeaconEmitter
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var beacon: BeaconEmitter?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
guard let uuid = NSUUID(UUIDString: "E2AD5810-554E-11E4-9E35-164230D1DF67") else { return true }
let beaconData = Beacon(uuid: uuid, minor: 1000, major: 56, power: -59)
beacon = BeaconEmitter(beacon: beaconData)
beacon?.start()
return true
}
func applicationWillResignActive(application: UIApplication) {}
func applicationDidEnterBackground(application: UIApplication) {}
func applicationWillEnterForeground(application: UIApplication) {}
func applicationDidBecomeActive(application: UIApplication) {}
func applicationWillTerminate(application: UIApplication) {}
}
| [
-1
] |
4bb1f29af0794daf55e87f107e877a3249d9df52 | 691a1b0c7cfe8f48606a23372260f6789dd60433 | /station/Classes/Presentation/Modules/TagSettings/View/TagSettingsViewModel.swift | 8865e6abe7758e2fb17a7b776bee83f742d69b9e | [
"BSD-3-Clause"
] | permissive | ruuvi/com.ruuvi.station.ios | 79cc9703b2cad4261e3dac5d8c74d9dfee6eb184 | 69a9f2e91b816330ddae5acf4de16af65093d7d9 | refs/heads/master | 2023-09-01T05:02:40.876214 | 2023-08-26T17:41:30 | 2023-08-26T17:41:30 | 135,691,786 | 31 | 24 | BSD-3-Clause | 2023-09-08T15:50:46 | 2018-06-01T08:41:58 | Swift | UTF-8 | Swift | false | false | 7,825 | swift | import UIKit
import RuuviOntology
struct TagSettingsViewModel {
let background: Observable<UIImage?> = Observable<UIImage?>()
let name: Observable<String?> = Observable<String?>()
let uuid: Observable<String?> = Observable<String?>()
let mac: Observable<String?> = Observable<String?>()
let rssi: Observable<Int?> = Observable<Int?>()
let humidity: Observable<Humidity?> = Observable<Humidity?>()
let temperature: Observable<Temperature?> = Observable<Temperature?>()
let humidityOffset: Observable<Double?> = Observable<Double?>()
let voltage: Observable<Double?> = Observable<Double?>()
let batteryNeedsReplacement: Observable<Bool?> = Observable<Bool?>()
let accelerationX: Observable<Double?> = Observable<Double?>()
let accelerationY: Observable<Double?> = Observable<Double?>()
let accelerationZ: Observable<Double?> = Observable<Double?>()
let version: Observable<Int?> = Observable<Int?>()
let firmwareVersion: Observable<String?> = Observable<String?>()
let movementCounter: Observable<Int?> = Observable<Int?>()
let measurementSequenceNumber: Observable<Int?> = Observable<Int?>()
let txPower: Observable<Int?> = Observable<Int?>()
let isConnectable: Observable<Bool?> = Observable<Bool?>()
let isConnected: Observable<Bool?> = Observable<Bool?>()
let isNetworkConnected: Observable<Bool?> = Observable<Bool?>()
let keepConnection: Observable<Bool?> = Observable<Bool?>()
let isPushNotificationsEnabled: Observable<Bool?> = Observable<Bool?>()
let temperatureUnit: Observable<TemperatureUnit?> = Observable<TemperatureUnit?>()
let humidityUnit: Observable<HumidityUnit?> = Observable<HumidityUnit?>()
let pressureUnit: Observable<UnitPressure?> = Observable<UnitPressure?>()
let isTemperatureAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let temperatureAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let temperatureLowerBound: Observable<Temperature?> = Observable<Temperature?>(Temperature(-40, unit: .celsius))
let temperatureUpperBound: Observable<Temperature?> = Observable<Temperature?>(Temperature(85, unit: .celsius))
let temperatureAlertDescription: Observable<String?> = Observable<String?>()
let temperatureAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isRelativeHumidityAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let relativeHumidityAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let relativeHumidityLowerBound: Observable<Double?> = Observable<Double?>(0)
let relativeHumidityUpperBound: Observable<Double?> = Observable<Double?>(100.0)
let relativeHumidityAlertDescription: Observable<String?> = Observable<String?>()
let relativeHumidityAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isPressureAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let pressureAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let pressureLowerBound: Observable<Pressure?> = Observable<Pressure?>(Pressure(500, unit: .hectopascals))
let pressureUpperBound: Observable<Pressure?> = Observable<Pressure?>(Pressure(1155, unit: .hectopascals))
let pressureAlertDescription: Observable<String?> = Observable<String?>()
let pressureAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isSignalAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let signalAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let signalLowerBound: Observable<Double?> = Observable<Double?>(-105)
let signalUpperBound: Observable<Double?> = Observable<Double?>(0)
let signalAlertDescription: Observable<String?> = Observable<String?>()
let signalAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isConnectionAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let connectionAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let connectionAlertDescription: Observable<String?> = Observable<String?>()
let connectionAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isMovementAlertOn: Observable<Bool?> = Observable<Bool?>(false)
let movementAlertMutedTill: Observable<Date?> = Observable<Date?>(nil)
let movementAlertDescription: Observable<String?> = Observable<String?>()
let movementAlertState: Observable<AlertState?> = Observable<AlertState?>()
let isAuthorized: Observable<Bool?> = Observable<Bool?>(true)
let canClaimTag: Observable<Bool?> = Observable<Bool?>(false)
let canShareTag: Observable<Bool?> = Observable<Bool?>(false)
var sharedTo: Observable<[String]?> = Observable<[String]?>()
let isClaimedTag: Observable<Bool?> = Observable<Bool?>(false)
let owner: Observable<String?> = Observable<String?>()
let isOwner: Observable<Bool?> = Observable<Bool?>(false)
let ownersPlan: Observable<String?> = Observable<String?>()
let temperatureOffsetCorrection: Observable<Double?> = Observable<Double?>()
let humidityOffsetCorrection: Observable<Double?> = Observable<Double?>()
let pressureOffsetCorrection: Observable<Double?> = Observable<Double?>()
let humidityOffsetCorrectionVisible: Observable<Bool?> = Observable<Bool?>()
let pressureOffsetCorrectionVisible: Observable<Bool?> = Observable<Bool?>()
let isAlertsEnabled: Observable<Bool?> = Observable<Bool?>(false)
let isPNAlertsAvailiable: Observable<Bool?> = Observable<Bool?>(false)
let isCloudAlertsAvailable: Observable<Bool?> = Observable<Bool?>(false)
var source: Observable<RuuviTagSensorRecordSource?> = Observable<RuuviTagSensorRecordSource?>()
var latestMeasurement: Observable<RuuviTagSensorRecord?> = Observable<RuuviTagSensorRecord?>()
func updateRecord(_ record: RuuviTagSensorRecord) {
humidity.value = record.humidity
temperature.value = record.temperature
voltage.value = record.voltage?.value
accelerationX.value = record.acceleration?.x.value
accelerationY.value = record.acceleration?.y.value
accelerationZ.value = record.acceleration?.z.value
movementCounter.value = record.movementCounter
measurementSequenceNumber.value = record.measurementSequenceNumber
txPower.value = record.txPower
source.value = record.source
let batteryStatusProvider = RuuviTagBatteryStatusProvider()
batteryNeedsReplacement.value = batteryStatusProvider.batteryNeedsReplacement(temperature: record.temperature,
voltage: record.voltage)
latestMeasurement.value = record
}
func reset() {
// TODO:- @Priyonto: This whole block needs to be refactored in good level later
isTemperatureAlertOn.value = false
temperatureLowerBound.value = Temperature(-40, unit: .celsius)
temperatureUpperBound.value = Temperature(85, unit: .celsius)
temperatureAlertDescription.value = nil
isRelativeHumidityAlertOn.value = false
relativeHumidityLowerBound.value = 0
relativeHumidityUpperBound.value = 100
relativeHumidityAlertDescription.value = nil
isPressureAlertOn.value = false
pressureLowerBound.value = Pressure(500, unit: .hectopascals)
pressureUpperBound.value = Pressure(1155, unit: .hectopascals)
pressureAlertDescription.value = nil
isSignalAlertOn.value = false
signalLowerBound.value = -105
signalUpperBound.value = 0
signalAlertDescription.value = nil
isConnectionAlertOn.value = false
connectionAlertDescription.value = nil
isMovementAlertOn.value = false
movementAlertDescription.value = nil
latestMeasurement.value = nil
}
}
| [
-1
] |
92c4af8aa15add5052b299f9e0b0cd85f3a72e0c | b17e7854ca86b862a58c7b7ac20a486a175c86ed | /Sources/RealHTTP/Stub/DataTypes/Stub Request/HTTPStubRequest+Matchers.swift | 125aaa5c25dec7b63358e1467b960ea0a5939425 | [
"MIT"
] | permissive | cgyan009/RealHTTP | df5617bfdf9cafa6a1094a23c964f0c6b593b8d3 | cdc60b3c577bc26a968df45847c5e9d5d8caf2d3 | refs/heads/main | 2023-08-14T04:48:45.850494 | 2021-10-08T07:52:27 | 2021-10-08T07:52:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,265 | swift | //
// IndomioHTTP
//
// Created by the Mobile Team @ ImmobiliareLabs
// Email: [email protected]
// Web: http://labs.immobiliare.it
//
// Copyright ©2021 Immobiliare.it SpA. All rights reserved.
// Licensed under MIT License.
//
import Foundation
extension HTTPStubRequest {
/// Add specified matcher to the list of matchers for request.
///
/// - Parameter matcher: matcher to add.
/// - Returns: Self
public func match(_ matcher: HTTPStubMatcherProtocol) -> Self {
matchers.append(matcher)
return self
}
/// Add a specified matcher with matching function directly.
///
/// - Parameter matcherFunction: matcher function.
/// - Returns: Self
public func match(_ matcherFunction: @escaping HTTPStubCustomMatcher.Handler) -> Self {
let matcher = HTTPStubCustomMatcher(matcherFunction)
return match(matcher)
}
/// Configure the stub request to use a regular expression matcher to intercept URLs.
///
/// - Parameters:
/// - pattern: pattern for validation.
/// - options: options for regular expression.
/// - Returns: Self
public func match(urlRegex pattern: String, options: NSRegularExpression.Options = []) -> Self {
guard let matcher = HTTPStubRegExMatcher(regex: pattern, options: options, in: .url) else {
return self
}
return match(matcher)
}
/// Configure the stub request to match the request's body with a configured `Codable` object.
///
/// - Parameter object: object to match.
/// - Returns: Self
public func match<Object: Codable & Hashable>(object: Object) -> Self {
match(HTTPStubJSONMatcher(matchObject: object))
}
/// Match body content.
///
/// - Parameter body: body content to match.
/// - Returns: Sefl
public func match(body: HTTPStubDataConvertible) -> Self {
match(HTTPStubBodyMatcher(content: body))
}
/// Configure the stub request to match URI template conform to the RFC6570 <https://tools.ietf.org/html/rfc6570>.
///
/// For example you can pass: `/kylef/Mockingjay` to match requests with the following URLs:
/// - https://github.com/kylef/WebLinking.swift
/// - https://github.com/kylef/{repository}
/// - /kylef/{repository}
/// - /kylef/URITemplate.swift
///
/// as described in <https://github.com/kylef/URITemplate.swift>
///
/// - Parameter uriTemplate: uri template to match, conform to RFC6570
/// - Returns: Self
public func match(URI uriTemplate: String) -> Self {
match(HTTPStubURITemplateMatcher(URI: uriTemplate))
}
/// Configure the stub request to match a specific URL optionally ignoring query parameters.
/// If URL is not valid no rule will be added.
///
/// - Parameters:
/// - URL: URL target.
/// - options: comparison options for URL matcher.
/// - Returns: Self
public func match(URL: URLConvertible, options: HTTPStubURLMatcher.Options = .default) -> Self {
guard let matcher = HTTPStubURLMatcher(URL: URL, options: options) else {
return self
}
return match(matcher)
}
}
| [
-1
] |
4676f3942d592b1d9022f19eef758655ac6c0326 | b73c9abe0f61cff7b7ade4214f2d5e00baf7d772 | /SoundCloudApp/Playlist.swift | 960b56d240c4c3abec12c948ccf13a6833b73482 | [] | no_license | prottoy/BuddyBuildTest | 071c7302015fe7e053eb6be7ccaced30981d4172 | e5fc1d54ef045170aa0154ce1426d42c9f60cc98 | refs/heads/master | 2022-04-14T20:14:51.292018 | 2020-04-17T20:18:19 | 2020-04-17T20:21:06 | 256,600,832 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 273 | swift | //
// PlayList.swift
//
import Foundation
struct Playlist: Codable {
let title: String
var tracks: [Track]
}
struct Track: Codable {
let id: Int
let title: String
let user: User
}
struct User: Codable {
let id: Int
let username: String
}
| [
-1
] |
f6dada06ea8bb86bd5933d81dd5a474755a7302c | 0e6a42f4c1d222c869acaa7065d2cc01c39b8c07 | /test/PhotosCell.swift | f26e1d2b7333f267f33a612e97a20b3bf225f892 | [] | no_license | geniusrocky/sahaj_coding | 31868dc3d6cd311d79d3d9f858b72e85bd735771 | 6768762b6123c47036303fddeb014347876525a4 | refs/heads/master | 2021-01-10T11:15:28.487404 | 2016-03-20T16:44:02 | 2016-03-20T16:44:02 | 54,116,176 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,605 | swift | //
// PhotosCell.swift
// test
//
// Created by sarav on 16/03/16.
// Copyright © 2016. All rights reserved.
//
import UIKit
class PhotosCell: UICollectionViewCell {
var frontView: SPImageView?
var backView: UIView?
var isFrontVisible: Bool = true
var photoObj: FlickrPhoto?
required internal init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
commonInit()
}
override internal init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
private func commonInit()
{
frontView = SPImageView(frame: self.bounds)
frontView?.contentMode = UIViewContentMode.ScaleAspectFit
frontView?.clipsToBounds = true
self.addSubview(frontView!)
self.backgroundColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
let singleTap = UITapGestureRecognizer(target: self, action: "tapped")
self.addGestureRecognizer(singleTap)
}
func updateData()
{
updateDataForFront()
}
private func updateDataForFront()
{
frontView?.setImageFromUrl(photoObj!.getImageURL(), cachingKey: photoObj!.photoID!)
}
private func updateDataForBack()
{
(backView?.viewWithTag(500) as? UILabel)?.text = photoObj!.title
}
func tapped()
{
if(isFrontVisible)
{
isFrontVisible = false
flipToBack()
}
else
{
isFrontVisible = true
flipToFront()
}
}
private func addBackView()
{
backView = UIView(frame: self.bounds)
backView?.backgroundColor = UIColor.whiteColor()
let label = UILabel(frame: backView!.bounds)
label.tag = 500
label.textAlignment = NSTextAlignment.Center
label.numberOfLines = 0
label.font = Fonts.IMAGE_BACK_TITLE
backView?.addSubview(label)
self.addSubview(backView!)
}
private func flipToBack()
{
if(backView == nil)
{
addBackView()
updateDataForBack()
}
UIView.transitionFromView(frontView!, toView: backView!, duration: 1.0, options: UIViewAnimationOptions.TransitionFlipFromLeft) { (flag) -> Void in
}
}
private func flipToFront()
{
UIView.transitionFromView(backView!, toView: frontView!, duration: 1.0, options: UIViewAnimationOptions.TransitionFlipFromRight) { (flag) -> Void in
}
}
}
| [
-1
] |
ebc0f8645a316614ad33c044427670bcd73a78d4 | a1dcaf0b7b56b63ef68b4f3d3e8fcd0804862d52 | /EdalCustomer/MVC/Search/Controller/New Group/FilteringVC.swift | cce0b57236d0739eee68133699b461477e73a4b3 | [] | no_license | knight6700/edalCustomer | 8593f604a036d2d5406267696861a30922ef1ba3 | b470816c7c3f2a9d19af41c21a46f60bc5a05f76 | refs/heads/master | 2023-01-07T11:01:41.014596 | 2020-11-07T12:13:23 | 2020-11-07T12:13:23 | 301,764,859 | 0 | 0 | null | 2020-11-07T12:13:24 | 2020-10-06T15:03:29 | Swift | UTF-8 | Swift | false | false | 9,771 | swift | //
// FilteringVC.swift
// edal-IosCustomerApp
//
// Created by Mohamed Kelany on 10/2/18.
// Copyright © 2018 hesham ghalaab. All rights reserved.
//
import UIKit
import GoogleMaps
//import RangeSeekSlider
struct FilterModel {
var categoryId: Int?
var maxRange: Int?
var minRange: Int?
var ratingFrom: Int?
var ratingTo: Int?
var location: Int?
}
protocol FilteringVCDelegate {
func onTappedSaveFilterData(categoryId: Int?, maxRange: Int?, minRange: Int?, ratingFrom: Int?, ratingTo: Int?, farLocation: Int?)
}
class FilteringVC: UIViewController {
@IBOutlet weak var indicatorCategoriesImageView: UIImageView!
@IBOutlet weak var indicatorRatingImageView: UIImageView!
var categories: Categories?
var paginationCategoriesData = [PaginatedCategories]()
var categoriesTotalpages: Int = 1
var categoriesCurrentPage: Int = 1
var categoryId: Int?
var maxRange: Int?
var minRange: Int?
var ratingFrom: Int?
var ratingTo: Int?
var delegate: FilteringVCDelegate?
@IBOutlet weak var ratingButon: UIButton!
@IBOutlet weak var categoriesButton: UIButton!
@IBOutlet weak var googleMapView: UIView!
@IBOutlet weak var mapView: GMSMapView!
@IBOutlet weak var kmLabel: UILabel!
@IBOutlet weak var locationKMSlider: UISlider!
@IBOutlet weak var rangeSeekSlider: RangeSeekSlider!
@IBOutlet weak var radiusLabel: UILabel!
// var categories: Categories?
var circle: GMSCircle!
var centerMapCoordinate:CLLocationCoordinate2D!
var SelectedCategory: CategoriesData?{
didSet{
print("categories id", SelectedCategory?.id)
categoriesButton.setTitle(SelectedCategory?.name, for: .normal)
categoryId = SelectedCategory?.id
}
}
var location = SelectedLocation()
let radiusSliderStep: Float = 1
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
print("total",categoriesTotalpages)
rangeSeekSlider.delegate = self
loadMoreCategories()
// Do any additional setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
addMarkerForPostion()
addCircle(radius: 10000)
}
func addMarkerForPostion() {
let providerTitle = "Kelany"
let providerMarker = GMSMarker()
providerMarker.icon = UIImage(named: "pinblue")
location.latitude = Defaults.Latitude
location.longitude = Defaults.Longitude
// Google Map View Setup
providerMarker.position = CLLocationCoordinate2D(latitude: location.latitude , longitude: location.longitude)
providerMarker.title = providerTitle
providerMarker.snippet = "Hey, this is \(providerTitle)"
providerMarker.map = mapView
// Center camera to marker position
mapView.camera = GMSCameraPosition.camera(withTarget: providerMarker.position, zoom: 8)
}
func addCircle(radius: Double) {
let circleCenter = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
circle = GMSCircle(position: circleCenter, radius: radius)
circle.fillColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2)
circle.strokeColor = .gray
circle.strokeWidth = 0.5
circle.map = mapView
}
func setupUI(){
rangeSeekSlider.selectedMinValue = 150
rangeSeekSlider.selectedMaxValue = 500
categoriesButton.roundView(withCorner: 4.0, borderColor: UIColor.init(red: 233/255, green: 233/255, blue: 233/255, alpha: 1.0), borderWidth: 1.0)
ratingButon.roundView(withCorner: 4.0, borderColor: UIColor.init(red: 233/255, green: 233/255, blue: 233/255, alpha: 1.0), borderWidth: 1.0)
getIndicatorTintColor(image: indicatorRatingImageView)
getIndicatorTintColor(image: indicatorCategoriesImageView)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
@IBAction func radiusSliderDidChangeValue(_ sender: UISlider) {
if circle.radius != nil {
// circle.
}
circle.radius = CLLocationDistance(locationKMSlider.value*1000)
let value = Int(locationKMSlider.value)
let string = "Within \(value) km of you"
kmLabel.text = string
}
//MARK: fetchMoreCategories
func loadMoreCategories(){
if categoriesCurrentPage == self.categoriesTotalpages {
getAllCategories(for: categoriesCurrentPage)
self.hideLoading()
return
}
if categoriesCurrentPage > self.categoriesTotalpages {
self.hideLoading()
return
}
while categoriesCurrentPage < categoriesTotalpages {
if paginationCategoriesData.count > 0 {
print("go to get more categories")
getAllCategories(for: categoriesCurrentPage)
categoriesCurrentPage += 1
print("page:\(categoriesCurrentPage)")
}
}
}
func getAllCategories(for page: Int) {
self.showLoading()
let services = CategoriesServices()
services.getAllCategories(for: page, completion: { (error, data) in
self.hideLoading()
if let error = error{
self.alertUser(title: "", message: error)
return
}
guard let _data = data else{return}
self.categories = _data.categories
})
}
@IBAction func onTappedCategories(_ sender: Any) {
let presenter = AuthPresenter(vc: self)
if categories != nil
{
presenter.present(.searchLookUpPopUp(type: .selectCategory, searchlookUpPopup: categories!))
}
else
{
self.alertUser(title: "Error", message: "No records found")
}
}
@IBAction func onTappedRatingButton(_ sender: UIButton) {
// let ratingArray = ["1-5", "2-5", "3-5", ]
let alert = UIAlertController(title: "", message: "Rating Star", preferredStyle: .actionSheet)
let cancelButton = UIAlertAction(title: "Cancel", style: .cancel) { (action) in
print("action")
alert.dismiss(animated: true, completion: nil)
}
let firstButton = UIAlertAction(title: "1 - 5", style: .default) { (action) in
self.ratingFrom = 1
self.ratingTo = 5
self.ratingButon.setTitle("1 - 5", for: .normal)
print("ok action")
}
let secondButton = UIAlertAction(title: "2 - 5", style: .default) { (action) in
self.ratingFrom = 2
self.ratingTo = 5
self.ratingButon.setTitle("2 - 5", for: .normal)
print("ok action")
}
let thirdButton = UIAlertAction(title: "3 - 5", style: .default) { (action) in
self.ratingFrom = 3
self.ratingTo = 5
self.ratingButon.setTitle("3 - 5", for: .normal)
print("ok action")
}
let fourthButton = UIAlertAction(title: "4 - 5", style: .default) { (action) in
self.ratingFrom = 4
self.ratingTo = 5
self.ratingButon.setTitle("4 - 5", for: .normal)
print("ok action")
}
alert.addAction(cancelButton)
alert.addAction(firstButton)
alert.addAction(secondButton)
alert.addAction(thirdButton)
alert.addAction(fourthButton)
present(alert, animated: true, completion: nil)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
func getIndicatorTintColor(image: UIImageView?){
guard let imageView = image else {
return
}
imageView.image = imageView.image!.withRenderingMode(.alwaysTemplate)
imageView.tintColor = UIColor.init(red: 155/255, green: 155/255, blue: 155/255, alpha: 1.0)
}
@IBAction func onTappedSave(_ sender: UIBarButtonItem) {
// guard let categoryID = categoryId else {return}
let min = rangeSeekSlider.selectedMinValue
let max = rangeSeekSlider.selectedMaxValue
delegate?.onTappedSaveFilterData(categoryId: categoryId, maxRange: Int(max), minRange: Int(min), ratingFrom: ratingFrom, ratingTo: ratingTo, farLocation: Int(locationKMSlider!.value/1000))
self.dismiss(animated: true, completion: nil)
}
@IBAction func onTappedReset(_ sender: UIBarButtonItem) {
self.rangeSeekSlider.selectedMinValue = 150.0
self.rangeSeekSlider.selectedMaxValue = 500.0
categoriesButton.setTitle(categories?.data?[0].name, for: .normal)
ratingButon.setTitle("1 - 5", for: .normal)
}
}
extension FilteringVC: SearchLookUpDataSource{
func categorySelectedWith(category: CategoriesData) {
print("Customer with selected categories \(category)")
self.SelectedCategory = category
}
}
// MARK: - RangeSeekSliderDelegate
extension FilteringVC: RangeSeekSliderDelegate {
func rangeSeekSlider(_ slider: RangeSeekSlider, didChange minValue: CGFloat, maxValue: CGFloat) {
print("Standard slider updated. Min Value: \(minValue) Max Value: \(maxValue)")
}
func didStartTouches(in slider: RangeSeekSlider) {
print("did start touches")
}
func didEndTouches(in slider: RangeSeekSlider) {
print("did end touches")
}
}
| [
-1
] |
ea8081f46fd814896a6ea28c93458b57caf9e41e | 488f474b9ded7e33356497e682b71f217379ec0c | /chatUITests/chattUITests.swift | 740a2e3510473d6d238c1c76ec9a882cbd4bb825 | [] | no_license | mokoranyAli/Chaty-Messanger | efa00e0dd7a9b3774a6558f5c20aa00f1dfc2de8 | e5e2dcc560b684f9bd978a11bcf0fb23c5f22529 | refs/heads/master | 2020-06-20T23:14:40.511751 | 2019-08-16T21:40:24 | 2019-08-16T21:40:24 | 197,283,460 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,240 | swift | //
// chattUITests.swift
// chattUITests
//
// Created by Mohamed Korany Ali on 7/14/19.
// Copyright © 2019 ashraf. All rights reserved.
//
import XCTest
class chattUITests: 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,
182277,
243720,
282634,
313356,
155665,
305173,
237599,
241695,
292901,
223269,
229414,
354342,
102441,
315433,
278571,
325675,
313388,
124974,
282671,
102446,
229425,
354346,
243763,
241717,
180279,
229431,
215095,
213051,
288829,
325695,
286787,
288835,
307269,
237638,
313415,
239689,
233548,
311373,
278607,
196687,
311377,
354386,
285362,
315477,
223317,
354394,
368732,
180317,
323678,
315488,
321632,
315489,
45154,
280676,
313446,
227432,
307306,
194667,
233578,
278637,
217194,
319599,
288878,
278642,
284789,
131190,
288890,
292987,
215165,
131199,
227459,
235661,
278669,
333968,
241809,
323730,
278676,
311447,
153752,
327834,
284827,
329884,
299166,
278690,
311459,
233635,
215204,
333990,
299176,
278698,
284843,
278703,
323761,
184498,
278707,
125108,
278713,
180409,
295099,
258233,
299197,
280761,
280767,
227517,
223418,
299202,
139459,
176325,
131270,
301255,
299208,
338118,
227525,
282832,
227536,
301270,
229591,
301271,
147679,
311520,
325857,
147680,
356575,
182503,
319719,
307431,
338151,
317676,
286957,
125166,
125170,
395511,
313595,
125180,
184574,
125184,
309504,
217352,
125197,
194832,
227601,
125204,
319764,
278805,
338196,
315674,
282908,
311582,
299294,
125215,
282912,
233761,
278817,
211239,
282920,
125225,
317738,
334121,
325930,
311596,
338217,
321839,
336177,
315698,
98611,
125236,
282938,
307514,
278843,
127292,
287040,
319812,
311622,
280903,
227655,
319816,
323914,
201037,
383309,
282959,
229716,
250196,
289109,
168280,
323934,
391521,
239973,
313703,
285031,
416103,
280938,
242027,
242028,
321901,
354671,
287089,
250227,
199030,
227702,
315768,
139641,
291194,
291193,
248188,
223611,
313726,
311679,
211327,
291200,
158087,
313736,
227721,
242059,
106893,
285074,
227730,
240020,
190870,
190872,
291225,
317851,
293275,
285083,
242079,
289185,
285089,
305572,
156069,
301482,
289195,
375211,
377265,
334259,
338359,
311739,
319931,
293309,
278974,
336319,
311744,
317889,
291266,
278979,
336323,
278988,
289229,
281038,
326093,
278992,
283088,
129484,
281039,
279000,
176602,
242138,
285152,
279009,
291297,
188899,
195044,
369121,
279014,
242150,
160224,
279017,
311787,
334315,
281071,
319986,
236020,
279030,
293368,
279033,
317949,
283138,
279042,
233987,
287237,
324098,
322057,
309770,
334345,
340489,
279053,
342537,
182802,
283154,
303634,
279061,
303635,
279060,
188954,
279066,
322077,
291359,
342560,
293420,
236080,
283185,
289328,
279092,
234037,
23093,
244279,
244280,
338491,
234044,
340539,
309831,
322119,
377419,
303693,
281165,
301647,
281170,
326229,
309847,
189016,
115287,
244311,
332379,
111197,
287327,
242274,
244326,
279143,
279150,
281200,
287345,
313970,
287348,
301688,
189054,
287359,
297600,
303743,
291455,
301702,
164487,
311944,
334473,
344714,
316044,
184974,
311950,
316048,
326288,
316050,
287379,
311953,
336531,
289435,
221853,
205469,
285348,
314020,
340645,
295591,
176810,
295598,
279215,
285360,
318127,
299698,
248494,
164532,
287412,
166581,
154295,
293552,
279218,
303802,
314043,
287418,
66243,
291529,
287434,
225996,
363212,
287438,
135888,
242385,
303826,
164561,
279249,
279253,
369365,
369366,
158424,
230105,
299737,
322269,
338658,
342757,
295653,
289511,
230120,
330473,
234216,
285419,
330476,
289517,
279278,
312046,
215790,
125683,
230133,
199415,
342775,
234233,
242428,
279293,
289534,
205566,
322302,
299777,
35584,
228099,
285443,
375552,
291584,
291591,
295688,
322312,
285450,
346889,
312076,
326413,
285457,
295698,
166677,
207639,
285467,
221980,
234276,
336678,
283431,
262952,
262953,
279337,
293673,
289580,
262957,
318247,
164655,
301872,
242481,
234290,
303921,
318251,
285493,
230198,
328495,
301883,
201534,
281407,
342846,
295745,
222017,
289599,
293702,
318279,
283466,
281426,
279379,
295769,
201562,
244569,
234330,
281434,
275294,
230239,
301919,
279393,
293729,
230238,
357219,
281444,
279398,
303973,
351078,
349025,
177002,
308075,
242540,
242542,
310132,
295797,
201590,
207735,
295799,
279418,
269179,
177018,
336765,
314240,
291713,
158594,
330627,
340865,
240517,
287623,
228232,
416649,
279434,
320394,
316299,
252812,
234382,
308111,
299912,
308113,
293780,
310166,
289691,
209820,
277404,
240543,
283551,
310177,
189349,
289704,
279465,
293801,
326571,
304050,
177074,
326580,
289720,
326586,
289723,
189373,
213956,
359365,
19398,
345030,
281541,
213961,
127945,
279499,
211913,
56270,
191445,
183254,
304086,
183258,
207839,
340960,
314343,
304104,
123880,
340967,
320492,
183276,
289773,
320495,
203758,
234476,
287730,
248815,
277493,
240631,
320504,
214009,
201721,
312313,
312315,
312317,
328705,
234499,
418819,
293894,
330759,
230411,
330766,
238611,
140311,
293911,
316441,
197658,
326684,
336930,
315272,
113710,
189487,
281647,
322609,
318515,
312372,
203829,
238646,
300087,
238650,
320571,
21567,
308288,
336962,
160834,
349254,
238663,
300109,
207954,
234578,
250965,
296023,
205911,
339031,
156763,
277600,
281699,
285795,
230500,
250982,
322664,
228457,
279659,
318571,
234606,
300145,
238706,
279666,
312435,
187508,
300147,
230514,
302202,
285819,
314493,
285823,
150656,
234626,
279686,
222344,
285833,
285834,
318602,
228492,
337037,
234635,
162962,
187539,
347286,
308375,
324761,
285850,
296091,
119965,
302239,
234655,
339106,
306339,
234662,
300200,
249003,
238764,
322733,
3243,
208044,
302251,
279729,
294069,
324790,
300215,
294075,
64699,
228541,
339131,
343230,
283841,
148674,
283846,
312519,
283849,
148687,
189651,
316628,
279766,
189656,
279775,
304352,
298209,
304353,
339167,
279780,
310496,
228587,
279789,
290030,
302319,
234741,
283894,
316661,
208123,
292092,
279803,
228608,
320769,
234756,
322826,
242955,
312588,
126229,
318746,
320795,
320802,
130342,
304422,
130344,
130347,
292145,
298290,
208179,
312628,
345398,
159033,
222523,
286012,
279872,
181568,
279874,
300355,
294210,
216387,
286019,
193858,
372039,
304457,
230730,
345418,
337228,
296269,
222542,
234830,
238928,
224591,
296274,
331091,
314708,
318804,
150868,
283990,
357720,
300378,
300379,
294236,
292194,
230757,
281958,
134504,
306541,
314734,
327023,
296304,
234864,
312688,
284015,
230772,
314740,
314742,
327030,
310650,
290170,
224637,
306558,
290176,
243073,
179586,
306561,
337280,
294278,
314759,
296328,
296330,
304523,
368012,
298378,
318860,
314765,
9618,
279955,
306580,
314771,
224662,
234902,
282008,
314776,
112019,
292242,
318876,
282013,
290206,
343457,
148899,
298406,
282023,
245160,
241067,
279979,
314797,
279980,
286128,
279988,
286133,
284086,
173492,
259513,
310714,
302523,
284090,
228796,
54719,
302530,
280003,
228804,
310725,
306630,
292291,
300488,
370122,
310731,
306634,
280011,
302539,
310735,
300490,
339403,
222674,
337359,
280020,
329168,
312785,
329170,
280025,
310747,
239069,
144862,
286176,
187877,
310758,
320997,
280042,
280043,
191980,
300526,
329198,
337391,
282097,
308722,
296434,
306678,
40439,
288248,
286201,
300539,
288252,
210429,
312830,
359931,
290304,
286208,
245249,
228868,
292359,
218632,
302602,
230922,
323083,
294413,
359949,
304655,
323088,
329231,
282132,
230933,
302613,
282135,
316951,
374297,
175640,
302620,
313338,
282147,
222754,
306730,
312879,
288305,
239159,
290359,
323132,
235069,
157246,
288319,
288322,
280131,
349764,
310853,
282182,
124486,
288328,
194118,
292424,
292426,
286281,
333389,
349780,
290391,
128600,
306777,
196184,
235096,
239192,
212574,
99937,
204386,
300643,
323171,
300645,
294220,
312937,
224874,
243306,
204394,
138862,
206447,
310896,
294517,
314997,
288377,
290425,
339579,
337533,
325246,
235136,
280193,
288391,
282248,
286344,
323208,
179853,
286351,
188049,
229011,
239251,
323226,
179868,
229021,
302751,
282272,
198304,
245413,
282279,
298664,
298666,
286387,
300725,
286392,
300729,
302778,
306875,
280252,
280253,
282302,
296636,
286400,
323265,
323262,
280259,
321220,
282309,
321217,
239305,
280266,
306891,
296649,
302798,
9935,
241360,
282321,
313042,
286419,
333522,
241366,
280279,
282330,
18139,
280285,
294621,
282336,
325345,
294629,
153318,
337638,
333543,
12009,
181992,
282347,
288492,
282349,
323315,
67316,
286457,
284410,
313082,
288508,
200444,
282366,
286463,
319232,
278273,
288515,
280326,
282375,
323335,
284425,
249606,
116491,
282379,
280333,
216844,
284430,
300812,
161553,
124691,
284436,
278292,
116502,
118549,
282390,
325403,
321308,
282399,
241440,
282401,
341791,
339746,
315172,
186148,
186149,
216868,
241447,
286507,
294699,
284460,
280367,
300849,
282418,
280377,
319289,
282428,
280381,
345918,
413500,
280386,
325444,
280391,
153416,
315209,
325449,
342705,
280396,
159563,
307024,
325460,
237397,
307030,
18263,
341846,
188250,
284508,
300893,
307038,
370526,
237411,
284515,
276326,
282471,
296807,
292713,
292719,
296815,
313200,
325491,
313204,
124795,
339840,
280451,
327556,
188293,
325508,
282503,
243592,
305032,
325514,
333700,
67464,
350091,
350092,
184207,
311183,
124816,
315275,
282517,
294806,
350102,
214936,
294808,
337816,
239515,
333727,
298912,
319393,
214943,
294820,
118693,
333734,
219046,
284584,
294824,
298921,
313257,
292783,
126896,
300983,
343993,
288698,
98240,
294849,
214978,
280517,
280518,
214983,
282572,
282573,
153553,
231382,
323554,
292835,
190437,
292838,
294887,
317416,
313322,
278507,
298987,
311277,
296942,
174058,
124912,
327666,
278515,
325620,
239610
] |
6cc2e204dc8c0806146f87b11d3b1b08ce39ad56 | 3b479c821db773db634e9c68e2fbbe5c27d27cc0 | /MSDKUI/Classes/ExtensionDate.swift | d657bdfc0d402c592b268799152c7f27a4f9835a | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | heremaps/msdkui-ios | 4cad74a63190010da061d35beed8f771a8efda49 | 2f7070193519285d972c306d27c143f1dd16b8e9 | refs/heads/master | 2023-04-07T14:42:39.072033 | 2022-04-08T09:26:02 | 2022-04-08T09:26:02 | 141,680,593 | 40 | 15 | Apache-2.0 | 2023-03-17T05:29:48 | 2018-07-20T07:44:39 | Swift | UTF-8 | Swift | false | false | 2,104 | swift | //
// Copyright (C) 2017-2021 HERE Europe B.V.
//
// 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 Foundation
extension Date {
/// Converts the given data to a String.
///
/// - Parameter formatter: The date formatter to be used. If not provided, applies
/// the "dMMM 'at' HH:mm" format.
/// - Returns: The stringized distance.
func formatted(_ formatter: DateFormatter = .dMMMHHmmFormatter) -> String {
let calendar = Calendar.current
let parameterYear = calendar.component(.year, from: self)
let parameterMonth = calendar.component(.month, from: self)
let parameterDay = calendar.component(.day, from: self)
let currentDate = Date()
let currentYear = calendar.component(.year, from: currentDate)
let currentMonth = calendar.component(.month, from: currentDate)
let currentDay = calendar.component(.day, from: currentDate)
// If the year is different, make sure to show the year, month, day and time.
// Else if the month or day is different, make sure to show the month, day and time.
// Otherwise, i.e. at the current day, show only the time.
if parameterYear != currentYear {
return DateFormatter.localizedString(from: self, dateStyle: .medium, timeStyle: .short)
} else if parameterMonth != currentMonth || parameterDay != currentDay {
return formatter.string(from: self)
} else {
return DateFormatter.localizedString(from: self, dateStyle: .none, timeStyle: .short)
}
}
}
| [
-1
] |
ecfc929e533974c23b00d87cb346e087a6664355 | a9caea633514410c44a6b607fee1ec098317281b | /examAlert/examAlert/AppDelegate.swift | 3be76cad800c5318dfeb187a2ec15c1fe8fad6d6 | [] | no_license | pain0928dev/study_swift | b27b3fe471b3055c46f0d15d82a187f6dcbb6dbe | 1738cc7e7d5e2a9735a983740d90b7df17a01755 | refs/heads/master | 2020-04-07T04:03:01.031668 | 2018-12-16T03:06:20 | 2018-12-16T03:06:20 | 158,038,139 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,167 | swift | //
// AppDelegate.swift
// examAlert
//
// Created by 402-24 on 24/11/2018.
// Copyright © 2018 402-24. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
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,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
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,
323330,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
0940b447c03901df4e894f4b9634ce4b6a496d0f | 842c6871fca72b8056607944f66ef4d62a3b182d | /first/SceneDelegate.swift | ce86623b389c8b599360211cc4e4e04ccaf08a9f | [] | no_license | harkiramadhan/firstSwift | 3585821359d5d046d86751e6073b45a4ae12acdb | 464043c2523480993f9b1888a9210408954cc396 | refs/heads/main | 2023-08-13T03:32:03.965636 | 2021-10-10T10:41:20 | 2021-10-10T10:41:20 | 415,510,297 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,320 | swift | //
// SceneDelegate.swift
// first
//
// Created by Ahmad Harki Ramadhan on 09/10/21.
//
import UIKit
@available(iOS 13.0, *)
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,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
254020,
376906,
327757,
254032,
368728,
254045,
180322,
376932,
286845,
286851,
417925,
262284,
360598,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
262405,
180491,
164107,
336140,
368913,
262417,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
418145,
262497,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328180,
328183,
328190,
254463,
328193,
328204,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
197160,
377384,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
385610,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
385714,
434868,
164535,
164539,
328379,
328387,
352969,
344777,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
369439,
418591,
262943,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
254813,
361310,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
418822,
328710,
328715,
377867,
361490,
386070,
336922,
345119,
377888,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
402636,
328925,
165086,
66783,
165092,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
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,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
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,
345965,
354157,
345968,
345971,
345975,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
256214,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
379135,
411905,
411917,
379154,
395539,
387350,
338201,
387353,
338212,
395567,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
330225,
248309,
248332,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
264919,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
199681,
338951,
330761,
330769,
330775,
248863,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
248905,
330827,
330830,
248915,
183384,
412765,
339037,
257121,
265321,
248952,
420985,
330890,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
437588,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
175478,
249215,
175487,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
372229,
208399,
175637,
405017,
134689,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
224923,
208539,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
257717,
224949,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
257791,
225027,
257796,
257802,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
257881,
225113,
257884,
257887,
225120,
257891,
225128,
257897,
225138,
257909,
372598,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
217319,
225511,
225515,
225519,
381177,
397572,
381212,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
340276,
356662,
397623,
332091,
225599,
348489,
332107,
151884,
332118,
348503,
430422,
340328,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
332162,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
324032,
266688,
201158,
127473,
217590,
340473,
324095,
324100,
266757,
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,
340628,
184983,
373399,
258723,
332460,
332464,
332473,
381626,
332484,
332487,
373450,
332494,
357070,
357074,
332512,
340724,
332534,
348926,
389927,
348979,
348983,
398141,
357202,
389971,
357208,
389979,
357212,
430940,
357215,
439138,
349041,
340850,
381815,
430967,
324473,
398202,
340859,
324476,
430973,
119675,
340863,
324479,
324482,
373635,
324485,
324488,
381834,
185226,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
398246,
373672,
324525,
111539,
324534,
324539,
324542,
398280,
349129,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
209904,
201712,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
160896,
349313,
152704,
210053,
210056,
349320,
373905,
259217,
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,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
390518,
357756,
374161,
112021,
349591,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
210422,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
349748,
415286,
210488,
415291,
415295,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
358192,
366384,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341839,
415574,
358235,
350046,
399200,
399208,
268144,
358256,
358260,
325494,
399222,
186233,
333690,
325505,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
153572,
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,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
211161,
358645,
268553,
268560,
432406,
325920,
194854,
358701,
391469,
358705,
358714,
358717,
383307,
358738,
383331,
383334,
391531,
383342,
334204,
194942,
391564,
366991,
334224,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
342555,
416294,
350762,
252463,
358962,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
375613,
244542,
375616,
342857,
416599,
342875,
244572,
433001,
400238,
211826,
211832,
392061,
351102,
252801,
260993,
351105,
400260,
211846,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
170950,
326599,
359367,
187335,
359383,
359389,
383968,
343018,
261109,
261112,
244728,
383999,
261130,
326669,
359452,
261148,
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,
384182,
367801,
384189,
351424,
384192,
343232,
367817,
244938,
384202,
253132,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
171304,
245032,
384299,
351535,
245042,
326970,
384324,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
245152,
245155,
155045,
245158,
114093,
327090,
343478,
359867,
384444,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155255,
155274,
368289,
245410,
425652,
425663,
155328,
245463,
155352,
155356,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
327542,
425846,
147319,
262006,
262009,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
253854,
155550,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
3d7cf2f2f1167dea857df8d58741a5b3c499b93d | a8e6aed2f9c6065d7e8f4e16fb62a031e86ac28b | /Project Butler/Controller/Personal/WorkLog/WorkLogViewController 2.swift | de4ac289ddc65564a2b38aba4400847dcbe6f33a | [] | no_license | neal811220/Project-Butler | 6e6ee3bec921fa1553a137b0cee645106d5a0f62 | 8eeba4bffad204a9d4c89e256b46fab8868c8469 | refs/heads/master | 2020-12-18T19:03:14.214844 | 2020-03-27T10:04:12 | 2020-03-27T10:04:12 | 235,370,573 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 18,422 | swift | //
// WorkLogViewController.swift
// Project Butler
//
// Created by Neal on 2020/2/15.
// Copyright © 2020 neal812220. All rights reserved.
//
import UIKit
class WorkLogViewController: UIViewController {
let projectlabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.B1
label.textAlignment = .center
label.font = UIFont(name: "AmericanTypewriter-Bold", size: 25)
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
let addLogButton: UIButton = {
let button = UIButton()
let image = UIImage.asset(.Icons_32px_AddWorkLog)
button.setImage(image, for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
let reportButton: UIButton = {
let button = UIButton()
let image = UIImage.asset(.Icons_32px_Report)
button.setImage(image, for: .normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
lazy var tableView: UITableView = {
let tableView = UITableView()
let nib = UINib(nibName: "WorkLogTableViewCell", bundle: nil)
tableView.register(nib, forCellReuseIdentifier: "WorkLogCell")
tableView.separatorStyle = .none
tableView.dataSource = self
tableView.rowHeight = UITableView.automaticDimension
tableView.translatesAutoresizingMaskIntoConstraints = false
return tableView
}()
lazy var collectionView: UICollectionView = {
let nib = UINib(nibName: "WorkLogCollectionViewCell", bundle: nil)
let numberNib = UINib(nibName: "NumberCollectionViewCell", bundle: nil)
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.register(nib, forCellWithReuseIdentifier: "WorkLogCell")
collectionView.register(numberNib, forCellWithReuseIdentifier: "NumberCell")
collectionView.backgroundColor = UIColor.clear
collectionView.delegate = self
collectionView.dataSource = self
collectionView.translatesAutoresizingMaskIntoConstraints = false
return collectionView
}()
let placeholderStackView: UIStackView = {
let stackView = UIStackView()
stackView.axis = NSLayoutConstraint.Axis.vertical
stackView.translatesAutoresizingMaskIntoConstraints = false
return stackView
}()
let placeholderImage: UIImageView = {
let image = UIImage.asset(.Icons_32px_LogDefaultImage)
let imageView = UIImageView()
imageView.image = image
imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView
}()
let placeholderLabel: UILabel = {
let label = UILabel()
label.textColor = UIColor.Gray3
label.font = UIFont(name: "AmericanTypewriter-Bold", size: 20)
label.text = "Please click the Add button to add a work log."
label.numberOfLines = 0
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
var completeProjectButton: UIButton = {
let button = UIButton(type: .custom)
button.setTitle("Complete", for: .normal)
button.setTitleColor(UIColor.B2, for: .normal)
button.titleLabel?.font = UIFont(name: "AmericanTypewriter-Bold", size: 17)
return button
}()
var members: [AuthInfo] = []
var projectDetail: ProjectDetail?
var personalWorkLogContent: [WorkLogContent] = [] {
didSet {
placeholderImage.isHidden = true
placeholderLabel.isHidden = true
}
}
var projectWorkLogContent: [WorkLogContent] = []
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = LargeTitle.workLog.rawValue
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: self, action: nil)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: completeProjectButton)
completeProjectButton.addTarget(self, action: #selector(didTapCompletedProjectButton), for: .touchUpInside)
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.B2!, NSAttributedString.Key.font: UIFont(name: "AmericanTypewriter-Bold", size: 17)!]
setupProjectTitle()
setupCollectionView()
setupTableView()
setupPlaceholdeImage()
setuptoolButton()
projectlabel.text = projectDetail?.projectName
fetchPersonalWorkLog(porjectID: projectDetail?.projectID ?? "")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
navigationItem.largeTitleDisplayMode = .never
if projectDetail?.isCompleted == true {
completeProjectButton.isHidden = true
}
}
func setupProjectTitle() {
view.addSubview(projectlabel)
NSLayoutConstraint.activate([
projectlabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20),
projectlabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
projectlabel.leftAnchor.constraint(equalTo: view.leftAnchor),
projectlabel.rightAnchor.constraint(equalTo: view.rightAnchor)
])
}
func setuptoolButton() {
view.addSubview(reportButton)
view.addSubview(addLogButton)
addLogButton.addTarget(self, action: #selector(didTapAddButton), for: .touchUpInside)
reportButton.addTarget(self, action: #selector(didTapReportButton), for: .touchUpInside)
NSLayoutConstraint.activate([
reportButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 60),
reportButton.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -10),
reportButton.heightAnchor.constraint(equalToConstant: 30),
reportButton.widthAnchor.constraint(equalToConstant: 30)
])
NSLayoutConstraint.activate([
addLogButton.topAnchor.constraint(equalTo: reportButton.topAnchor),
addLogButton.rightAnchor.constraint(equalTo: reportButton.leftAnchor, constant: -10),
addLogButton.heightAnchor.constraint(equalToConstant: 30),
addLogButton.widthAnchor.constraint(equalToConstant: 30)
])
}
func setupCollectionView() {
view.addSubview(collectionView)
NSLayoutConstraint.activate([
collectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 60),
collectionView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 10),
collectionView.widthAnchor.constraint(equalToConstant: view.frame.width / 4 + 20),
collectionView.heightAnchor.constraint(equalToConstant: 30)
])
}
func setupTableView() {
view.addSubview(tableView)
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: collectionView.bottomAnchor, constant: 3),
tableView.rightAnchor.constraint(equalTo: view.rightAnchor),
tableView.leftAnchor.constraint(equalTo: view.leftAnchor),
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
func setupPlaceholdeImage() {
view.addSubview(placeholderImage)
view.addSubview(placeholderLabel)
NSLayoutConstraint.activate([
placeholderImage.centerXAnchor.constraint(equalTo: view.centerXAnchor),
placeholderImage.centerYAnchor.constraint(equalTo: view.centerYAnchor),
placeholderImage.widthAnchor.constraint(equalToConstant: view.frame.width / 4),
placeholderImage.heightAnchor.constraint(equalToConstant: view.frame.width / 4)
])
NSLayoutConstraint.activate([
placeholderLabel.topAnchor.constraint(equalTo: placeholderImage.bottomAnchor, constant: 5),
placeholderLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
placeholderLabel.widthAnchor.constraint(equalToConstant: view.frame.width / 3 * 2),
placeholderLabel.heightAnchor.constraint(equalToConstant: view.frame.width / 3)
])
}
func fetchPersonalWorkLog(porjectID: String) {
ProjectManager.shared.fetchPersonalProjectWorkLog(projectID: porjectID) { (result) in
switch result {
case .success(let data):
self.personalWorkLogContent = data
self.personalWorkLogContent = self.personalWorkLogContent.sorted(by: {
$0.date < $1.date
})
self.tableView.reloadData()
case .failure(let error):
print(error)
}
}
}
func fetchProjectWorkLog(projectID: String, completion: @escaping (Result<Void, Error>) -> Void ) {
ProjectManager.shared.fetchProjectWorkLog(projectID: projectID) { [weak self] (result) in
guard let strongSelf = self else {
return
}
switch result {
case .success(let data):
strongSelf.projectWorkLogContent = data
completion(.success(()))
case .failure(let error):
print(error)
completion(.failure(error))
}
}
}
func completeProject() {
guard let projectDetail = projectDetail else {
return
}
PBProgressHUD.pbActivityView(text: "", viewController: tabBarController!)
ProjectManager.shared.completeProject(startDate: projectDetail.startDate, projectID: projectDetail.projectID) { [weak self] (result) in
guard let strongSelf = self else {
return
}
switch result {
case .success:
print("Success")
PBProgressHUD.showSuccess(text: "Complete project", viewController: strongSelf)
NotificationCenter.default.post(name: NSNotification.Name("RefreshProjectData"), object: nil)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
strongSelf.navigationController?.popViewController(animated: true)
}
case .failure(let error):
print(error)
}
}
}
@objc func didTapCompletedProjectButton() {
let completeProjectAlert = UIAlertController(title: "Complete Project", message: "Are you sure you want to change the project status to completed?", preferredStyle: .alert)
let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let submit = UIAlertAction(title: "Submit", style: .default) { [weak self] _ in
self?.completeProject()
}
completeProjectAlert.addAction(cancel)
completeProjectAlert.addAction(submit)
present(completeProjectAlert, animated: true, completion: nil)
}
@objc func didTapAddButton() {
guard let workLogContentVC = UIStoryboard.personal.instantiateViewController(withIdentifier: "WorkLogContentVC") as? WorkLogContentViewController else {
return
}
guard let projectDetail = projectDetail else {
return
}
workLogContentVC.documentID = projectDetail.projectID
workLogContentVC.workItemArray = projectDetail.workItems
workLogContentVC.startDate = projectDetail.startDate
workLogContentVC.endDate = projectDetail.endDate
workLogContentVC.passContentData = {
self.personalWorkLogContent.append($0)
self.tableView.reloadData()
self.collectionView.reloadData()
}
present(workLogContentVC, animated: true, completion: nil)
}
@objc func didTapReportButton() {
guard let reportVC = UIStoryboard.report.instantiateViewController(withIdentifier: "ReportVC") as? ReportViewController else {
return
}
guard let projectDetail = projectDetail else {
return
}
fetchProjectWorkLog(projectID: projectDetail.projectID) { [weak self] (result) in
guard let strongSelf = self else {
return
}
switch result {
case .success:
reportVC.workLogContent = strongSelf.projectWorkLogContent
reportVC.projectDetail = projectDetail
reportVC.projectMembers = strongSelf.members
strongSelf.show(reportVC, sender: nil)
case .failure(let error):
print(error)
}
}
}
}
extension WorkLogViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if members.count >= 3 {
return 3
} else {
return members.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if indexPath.row == 2 {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "NumberCell", for: indexPath) as? NumberCollectionViewCell else {
return UICollectionViewCell()
}
cell.numberLabel.text = "+\(members.count - 2)"
return cell
} else {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WorkLogCell", for: indexPath) as? WorkLogCollectionViewCell else {
return UICollectionViewCell()
}
cell.memberImage.loadImage(members[indexPath.row].userImageUrl)
return cell
}
}
}
extension WorkLogViewController: UICollectionViewDelegate {
}
extension WorkLogViewController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 30, height: 30)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 10
}
}
extension WorkLogViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return personalWorkLogContent.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "WorkLogCell", for: indexPath) as? WorkLogTableViewCell else {
return UITableViewCell()
}
cell.selectionStyle = .none
cell.dateLabel.textColor = UIColor(patternImage: UIImage(named: projectDetail!.color)!)
cell.timeLabel.textColor = UIColor(patternImage: UIImage(named: projectDetail!.color)!)
cell.dateLabel.text = personalWorkLogContent[indexPath.row].date
cell.timeLabel.text = "\(personalWorkLogContent[indexPath.row].startTime) - \(personalWorkLogContent[indexPath.row].endTime)"
if personalWorkLogContent[indexPath.row].hour == 0 {
cell.timeSpentLabel.text = "\(personalWorkLogContent[indexPath.row].minute) Minute"
} else {
cell.timeSpentLabel.text = "\(personalWorkLogContent[indexPath.row].hour) Hour, \(personalWorkLogContent[indexPath.row].minute) Minute"
}
cell.workItemLabel.text = personalWorkLogContent[indexPath.row].workItem
cell.workContentLabel.text = personalWorkLogContent[indexPath.row].workContent
cell.problemLabel.text = personalWorkLogContent[indexPath.row].problem
cell.leftView.backgroundColor = UIColor(patternImage: UIImage(named: projectDetail!.color)!)
return cell
}
}
| [
-1
] |
c857f2fc28c9b01cb3a6e3b283d7fb73f0842c4e | ecd1b1178b7f84c809b4e8fc9819ed97c49c3b8c | /AspirinKit/Sources/SceneKit/SceneKit_macOS.swift | 88ae5274aee2e9cfb7be2808dd834368bb1f3de2 | [
"MIT"
] | permissive | webelectric/AspirinKit | 7ca4340c15a76b4713085f271c4d4368fa9d14a3 | be268badd5317c689de58372c8ffbe4fe443ed67 | refs/heads/master | 2021-01-11T16:42:25.731528 | 2017-08-19T17:52:19 | 2017-08-19T17:52:19 | 80,141,925 | 2 | 0 | null | 2017-01-26T20:38:19 | 2017-01-26T18:23:51 | Swift | UTF-8 | Swift | false | false | 555 | swift | //
// SceneKit_macOS.swift
// AspirinKit
//
// Copyright © 2015-2017 The Web Electric Corp. All rights reserved.
//
//
import Foundation
import SceneKit
public extension SCNVector3 {
public init(x: Double, y: Double, z: Double) {
self.init(x: CGFloat(x), y: CGFloat(y), z: CGFloat(z))
}
public init(x: Float, y: Float, z: Float) {
self.init(x: CGFloat(x), y: CGFloat(y), z: CGFloat(z))
}
public init(x: Int, y: Int, z: Int) {
self.init(x: CGFloat(x), y: CGFloat(y), z: CGFloat(z))
}
}
| [
-1
] |
280cb1af04e64b1eebffdc2d8b683289799ef035 | 6e38b8cb7c1bb4a7eb8146310c7e1ece4bf82b12 | /PScrollView/PScrollViewUITests/PScrollViewUITests.swift | 330acb87af6f3410f1e4a272a3466a686e1b51a2 | [] | no_license | peicode/Swift-Demo | 6ec9858471ddd84aba31c5998fd213964034e988 | 5055648f869fc17e6ceffacfc7da56966c0ca1b1 | refs/heads/master | 2020-07-18T10:04:35.590018 | 2019-09-04T03:55:31 | 2019-09-04T04:03:06 | 206,226,716 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,171 | swift | //
// PScrollViewUITests.swift
// PScrollViewUITests
//
// Created by 廖佩志 on 2019/1/24.
// Copyright © 2019 廖佩志. All rights reserved.
//
import XCTest
class PScrollViewUITests: XCTestCase {
override func 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.
}
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,
354312,
282634,
313356,
241695,
223269,
229414,
315431,
292901,
315433,
178215,
325675,
344106,
346153,
124974,
102446,
282671,
229425,
243763,
321589,
241717,
215095,
319543,
229431,
180279,
249912,
352314,
376892,
32829,
325695,
286787,
237638,
313415,
239689,
233548,
315468,
311373,
196687,
278607,
311377,
354386,
176209,
315477,
223317,
53334,
354394,
368732,
323678,
356446,
315488,
315489,
45154,
321632,
215144,
227432,
217194,
194667,
233578,
278637,
307306,
319599,
278642,
284789,
131190,
249976,
288890,
292987,
215165,
227459,
381071,
241809,
323730,
278676,
311447,
327834,
284827,
329884,
299166,
233635,
284840,
278698,
323761,
278707,
125108,
180409,
280761,
278713,
295099,
227517,
299197,
280767,
299202,
139459,
176325,
131270,
301255,
233678,
346319,
282832,
321744,
227536,
301271,
385240,
337899,
356575,
311520,
325857,
182503,
338151,
319719,
362326,
317676,
286957,
125166,
125170,
313595,
125180,
356603,
125184,
262403,
125192,
125197,
180494,
125200,
194832,
227601,
325904,
125204,
319764,
272661,
334104,
61720,
315674,
282908,
311582,
125215,
299294,
282912,
233761,
278817,
125216,
211239,
282920,
125225,
317738,
325930,
311596,
338217,
321839,
315698,
98611,
125236,
368949,
362809,
307514,
287040,
319812,
332100,
311622,
227655,
280903,
319816,
323914,
254285,
383309,
282959,
344402,
348499,
229716,
289109,
348501,
272730,
323934,
332128,
391521,
215395,
366948,
239973,
285031,
313703,
280938,
242027,
242028,
321901,
354671,
354672,
287089,
160111,
227702,
315769,
139641,
291194,
248188,
313726,
211327,
291200,
240003,
340356,
158087,
313736,
242059,
311692,
106893,
285074,
240020,
190870,
315798,
291225,
285083,
293275,
317851,
39323,
242079,
285089,
305572,
156069,
436644,
254373,
301482,
311723,
377265,
342454,
338359,
319931,
311739,
278974,
336319,
311744,
317889,
291266,
278979,
278988,
289229,
281038,
326093,
278992,
283089,
373196,
279000,
242138,
256476,
285152,
369121,
291297,
195044,
242150,
319976,
311787,
281071,
360945,
319986,
236020,
279030,
311800,
317949,
279042,
283138,
324098,
287237,
377352,
322057,
342537,
334345,
279053,
182802,
303635,
283154,
279061,
279060,
254487,
322077,
291359,
342560,
348709,
348710,
227881,
289328,
283185,
330291,
279092,
23093,
244280,
352831,
322119,
55880,
309831,
303693,
369236,
326229,
309847,
189016,
111197,
295518,
436831,
242274,
375396,
244326,
279143,
279150,
176751,
287345,
313970,
287348,
244345,
344697,
356990,
287359,
291455,
297600,
303743,
152196,
301702,
164487,
279176,
311944,
334473,
316044,
311948,
311950,
184974,
316048,
311953,
316050,
336531,
287379,
326288,
346771,
363155,
180886,
352921,
289435,
221853,
285348,
279207,
295591,
176810,
248494,
318127,
293552,
295598,
285362,
279215,
287412,
166581,
164532,
154295,
287418,
314043,
303802,
342714,
355006,
363212,
225996,
287438,
242385,
303826,
354283,
158424,
230105,
299737,
361178,
322269,
338658,
289511,
230120,
330473,
369383,
285419,
330476,
361194,
215790,
170735,
279278,
312046,
125683,
199415,
205566,
322302,
359166,
299777,
291591,
295688,
346889,
285450,
264971,
312076,
326413,
322320,
285457,
295698,
166677,
207639,
285467,
221980,
283431,
262952,
262953,
279337,
318247,
318251,
262957,
289580,
164655,
328495,
301872,
242481,
303921,
336693,
230198,
285496,
355129,
201534,
281407,
342846,
222017,
295745,
355136,
355138,
293702,
348999,
283466,
355147,
355148,
355153,
279379,
295769,
201562,
244569,
322396,
230238,
275294,
301919,
293729,
252766,
127840,
435038,
355173,
351078,
355174,
342888,
308075,
242540,
242542,
310132,
295797,
201590,
207735,
228214,
177018,
269179,
211835,
314240,
291713,
158594,
330627,
340865,
240517,
287623,
416649,
279434,
236427,
316299,
349066,
189327,
355216,
308113,
293780,
310166,
256920,
400282,
209820,
277404,
240543,
283551,
359332,
189349,
359333,
256934,
140203,
252848,
177074,
289720,
326586,
289723,
189373,
330688,
213956,
281541,
345030,
19398,
127945,
326602,
56270,
252878,
359380,
191445,
183254,
304086,
183258,
340960,
340967,
304104,
123880,
324587,
183276,
289773,
203758,
320495,
343020,
248815,
287730,
347122,
277493,
240631,
320504,
201721,
328701,
418819,
357380,
293894,
330759,
320520,
230411,
320526,
330766,
347150,
361487,
384015,
140311,
293911,
238617,
316441,
326684,
384031,
330789,
248871,
113710,
189487,
281647,
322609,
345137,
361522,
312372,
203829,
238646,
238650,
320571,
21567,
160834,
336962,
314437,
257093,
238663,
250955,
361547,
300109,
207954,
205911,
296023,
277600,
281698,
281699,
230500,
285795,
361570,
214116,
322664,
228457,
253028,
318571,
257126,
214119,
300145,
238706,
312435,
187508,
302202,
285819,
363643,
285823,
150656,
248960,
349317,
279686,
318602,
285834,
140426,
337037,
177297,
162962,
187539,
347286,
308375,
359574,
324761,
339101,
351389,
302239,
330912,
339106,
300200,
253098,
249003,
208044,
238764,
322733,
279729,
373937,
294069,
367798,
300215,
294075,
339131,
343230,
148674,
283846,
279752,
283849,
259275,
148687,
290001,
189651,
316628,
259285,
189656,
357594,
279775,
304352,
298209,
304353,
339167,
228587,
302319,
351475,
251124,
316661,
283894,
279803,
320769,
234756,
322826,
242955,
318732,
126229,
245018,
320795,
318746,
320802,
304422,
130347,
257323,
353581,
116014,
292145,
208179,
312628,
345397,
345398,
159033,
333115,
181568,
279874,
216387,
193858,
294210,
286019,
359747,
359748,
304457,
345418,
230730,
337226,
296269,
234830,
224591,
238928,
109899,
296274,
259408,
314708,
318804,
283990,
314711,
331091,
150868,
300378,
300379,
316764,
314721,
292194,
230757,
281958,
314727,
134504,
306541,
314734,
284015,
234864,
312688,
316786,
327023,
314740,
314742,
327030,
314745,
290170,
290176,
243073,
179586,
306561,
314752,
294278,
314759,
296328,
388488,
296330,
304523,
318860,
298378,
9618,
279955,
112019,
224662,
234902,
282008,
314776,
282013,
290206,
148899,
314788,
148900,
314790,
282023,
333224,
298406,
241067,
279980,
314797,
279979,
374189,
173492,
284086,
284090,
302523,
134586,
380350,
54719,
415170,
292291,
302530,
280003,
228804,
310725,
300488,
306630,
306634,
339403,
280011,
302539,
200136,
337359,
329168,
312785,
327122,
222674,
353751,
280025,
310747,
329181,
144862,
320997,
310758,
3559,
280043,
191980,
300526,
337391,
282097,
308722,
259569,
251379,
306678,
40439,
191991,
253431,
300539,
288252,
210429,
312830,
290304,
286208,
366081,
228868,
323079,
292359,
230922,
323083,
294413,
208397,
329231,
323088,
304655,
359949,
253456,
282132,
230933,
302613,
316951,
374297,
349727,
146976,
313338,
222754,
282147,
372261,
306730,
312879,
230960,
239159,
290359,
374327,
210489,
134715,
323132,
157246,
425534,
280131,
349764,
310853,
124486,
288328,
286281,
292426,
128589,
224848,
333394,
224852,
290391,
196184,
239192,
306777,
212574,
99937,
204386,
323171,
345697,
300645,
282214,
415334,
312937,
204394,
224874,
243306,
312941,
138862,
206447,
310896,
54895,
294517,
288377,
337533,
325246,
333438,
235136,
280193,
323208,
286344,
224907,
286351,
188049,
253930,
239251,
345753,
229021,
302751,
282272,
255651,
245413,
282279,
298664,
212649,
317102,
286387,
337590,
224951,
286392,
224952,
302778,
306875,
280252,
296636,
282302,
323262,
286400,
323265,
321217,
280259,
333508,
321220,
259780,
319176,
296649,
239305,
306891,
212684,
302798,
9935,
241360,
282321,
333522,
313042,
286419,
345813,
241366,
280279,
224985,
18139,
280285,
294621,
282336,
325345,
321250,
294629,
153318,
333543,
337638,
12009,
181992,
282347,
345832,
282349,
141037,
286457,
282366,
286463,
319232,
278273,
175874,
288515,
360194,
280326,
282375,
323335,
300810,
282379,
280333,
161553,
124691,
278292,
118549,
278294,
282390,
116502,
169751,
325403,
321308,
321309,
282399,
241440,
282401,
341791,
325411,
186148,
186149,
315172,
241447,
255781,
333609,
294699,
286507,
280367,
300849,
282418,
280373,
282424,
319289,
321338,
280377,
280381,
345918,
241471,
280386,
325444,
339782,
280391,
153416,
325449,
315209,
159563,
280396,
307024,
337746,
317268,
325460,
307030,
241494,
237397,
345942,
188250,
339799,
284508,
300893,
307038,
341846,
345950,
370526,
362336,
259937,
282471,
296807,
292719,
313200,
296815,
362351,
313204,
333687,
350072,
317305,
124795,
317308,
339840,
182145,
315265,
280451,
325508,
333700,
243590,
282503,
67464,
188293,
327556,
325514,
184207,
124816,
282517,
294806,
350102,
214936,
337816,
124826,
329627,
294808,
239515,
253851,
214943,
298912,
319393,
354210,
118693,
219046,
333734,
294824,
298921,
313257,
284584,
253868,
292783,
126896,
200628,
300983,
343993,
188349,
98240,
214978,
280517,
214983,
362442,
282572,
282573,
153553,
346066,
212953,
354268,
329696,
360416,
323554,
190437,
292838,
294887,
317416,
313322,
278507,
329707,
298987,
296942,
311277,
124912,
247786,
327666,
278515,
325620,
239610
] |
e32d2ba431b6381d31ae18878740238596ad22e8 | 3687696ec8b99d7af21ddb55e77694266b2f659a | /AlertView/AppDelegate.swift | 84fafd31a919233ce84406f03728cc2e9e926743 | [
"MIT"
] | permissive | shadiabusamra/UIAlertController | 16f77f3dce4b84a20b01dd902124b565ae8030be | 069ae79c8950a2aa51d03c713e2d5f41252bd3d8 | refs/heads/master | 2020-03-07T05:14:04.731613 | 2018-03-29T13:06:38 | 2018-03-29T13:06:38 | 127,287,934 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,164 | swift | //
// AppDelegate.swift
// AlertView
//
// Created by Shadi on 29/03/2018.
// Copyright © 2018 Shadi. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
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,
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,
189325,
189329,
295825,
304019,
213902,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
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,
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,
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,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
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,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
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,
224151,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
323330,
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,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
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,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
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,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
226200,
234398,
291742,
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,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
324757,
308379,
300189,
324766,
119967,
234653,
234648,
283805,
234657,
324768,
300197,
234661,
283813,
234664,
242852,
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,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
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,
226787,
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,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
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,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
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,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
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,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
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,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
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,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
a54666b1eadb5cfcac879885b9ba986847fdc3f9 | 3f62c18fbabd14a01a8ea520bc73d8dbd13a13d3 | /SeeFood/AppDelegate.swift | ddbf3a4b594b92446a8b6989fe26d995c9ee6cbb | [] | no_license | Zityuen/SeeFood | e7b54edc0e672ce618fa14eec97086c2e27149a5 | 7e81ec07fa84f659e3badbd27f6e844b5a53b3c0 | refs/heads/master | 2021-09-01T01:09:02.966910 | 2017-12-24T02:30:37 | 2017-12-24T02:30:37 | 115,234,769 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,171 | swift | //
// AppDelegate.swift
// SeeFood
//
// Created by chityuen on 2017/11/15.
// Copyright © 2017年 chityuen. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
189039,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
304009,
213895,
304011,
230284,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
189331,
279438,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
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,
230679,
320792,
230681,
296215,
214294,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
181854,
370272,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
321336,
296767,
288576,
345921,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
275606,
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,
280819,
157940,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
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,
36779,
241581,
282542,
241583,
323504,
241586,
290739,
241588,
282547,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
299191,
307385,
307386,
258235,
307388,
176311,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127434,
315856,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
201496,
234264,
234266,
234269,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
226182,
234375,
308105,
226185,
234379,
201603,
324490,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324508,
291742,
324504,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226239,
226245,
234439,
234443,
291788,
234446,
193486,
193488,
234449,
316370,
275406,
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,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
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,
324757,
234647,
226453,
234648,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
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,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
284249,
276052,
276053,
300638,
284251,
284253,
243293,
284258,
284255,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
325624,
350200,
276472,
317435,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
293346,
227810,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
285265,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
277804,
285997,
384302,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
691aa30118cbd87fa3d1a4cbb5b03e69d91a077b | 3ca69736804534ae9e2a3352708ffac62f555b03 | /hw2.2/VC/ColorChangerViewController.swift | 7193e021a497e768087f71eef87fdae0f4e6d749 | [] | no_license | xxihyou/hw2.2 | da5e12b3cce2cc823de96da4f84a7d0d1b1d026b | 7a79faa7ed3b350e6e14ff86df92a5e88a6b58ea | refs/heads/main | 2023-06-25T10:49:11.053272 | 2021-07-25T19:57:41 | 2021-07-25T19:57:41 | 384,906,964 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,911 | swift | //
// ViewController.swift
// hw2.2
//
// Created by Maria Berger on 09.07.2021.
//
import UIKit
class ColorChangerViewController: UIViewController {
// MARK: - Outlets
@IBOutlet weak var colorDisplay: UIView!
@IBOutlet weak var redColorIndex: UILabel!
@IBOutlet weak var greenColorIndex: UILabel!
@IBOutlet weak var blueColorIndex: UILabel!
@IBOutlet weak var redSlider: UISlider!
@IBOutlet weak var greenSlider: UISlider!
@IBOutlet weak var blueSlider: UISlider!
@IBOutlet weak var redTextField: UITextField!
@IBOutlet weak var greenTextField: UITextField!
@IBOutlet weak var blueTextField: UITextField!
@IBOutlet weak var doneButton: UIButton!
// MARK: - Methods
var delegate: ColorChangerViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
colorDisplay.layer.cornerRadius = 15
redSliderChanged(redSlider)
greenSliderChanged(greenSlider)
blueSliderChanged(blueSlider)
}
@IBAction func redSliderChanged(_ sender: UISlider) {
let redValue = CGFloat(redSlider.value)
let greenValue = CGFloat(greenSlider.value)
let blueValue = CGFloat(blueSlider.value)
colorDisplay.backgroundColor = UIColor(displayP3Red: redValue, green: greenValue, blue: blueValue, alpha: 1.0)
redColorIndex.text = String(format: "%.2f", redSlider.value)
redTextField.text = String(format: "%.2f", redSlider.value)
}
@IBAction func greenSliderChanged(_ sender: UISlider) {
let redValue = CGFloat(redSlider.value)
let greenValue = CGFloat(greenSlider.value)
let blueValue = CGFloat(blueSlider.value)
colorDisplay.backgroundColor = UIColor(displayP3Red: redValue, green: greenValue, blue: blueValue, alpha: 1.0)
greenColorIndex.text = String(format: "%.2f", greenSlider.value)
greenTextField.text = String(format: "%.2f", greenSlider.value)
}
@IBAction func blueSliderChanged(_ sender: UISlider) {
let redValue = CGFloat(redSlider.value)
let greenValue = CGFloat(greenSlider.value)
let blueValue = CGFloat(blueSlider.value)
colorDisplay.backgroundColor = UIColor(displayP3Red: redValue, green: greenValue, blue: blueValue, alpha: 1.0)
blueColorIndex.text = String(format: "%.2f", blueSlider.value)
blueTextField.text = String(format: "%.2f", blueSlider.value)
}
@IBAction func doneButtonPressed() {
redTextField.endEditing(true)
greenTextField.endEditing(true)
blueTextField.endEditing(true)
delegate?.setNewColor(red: redSlider.value , green: greenSlider.value, blue: blueSlider.value)
dismiss(animated: true)
}
// MARK: - Keyboard
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
view.endEditing(true)
}
}
// MARK: - Extension
extension ColorChangerViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldDidEndEditing(_ textField: UITextField) {
guard let newValue = textField.text else { return }
if let currentValue = Float(newValue) {
switch textField.tag {
case 0: redSlider.value = currentValue
case 1: greenSlider.value = currentValue
case 2: blueSlider.value = currentValue
default: break
}
redSliderChanged(redSlider)
greenSliderChanged(greenSlider)
blueSliderChanged(blueSlider)
}
}
}
| [
-1
] |
f32cded33e8c9a0a711cdad3f7495b710c19099d | d7eb72e1d66215e133a8bf5250c99439f6a9d1ed | /VendingMachine.swift | b316a219ed7b6b079db25e71da52a72b1751ed84 | [] | no_license | cdconner/VendingMachine | 9f09e326b795c21f93502c8df2112f34fe6f8d6d | 0b28b10e8b1b1d9c39997032e0b67325ad9b683b | refs/heads/master | 2021-01-02T22:43:12.772338 | 2017-08-13T20:06:08 | 2017-08-13T20:06:08 | 99,379,782 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,891 | swift | //
// VendingMachine.swift
// VendingMachine
//
// Created by Chris Conner on 7/31/17.
// Copyright © 2017 Treehouse Island, Inc. All rights reserved.
//
import Foundation
enum VendingSelection: String {
case soda
case dietSoda
case chips
case cookie
case sandwich
case wrap
case candybar
case popTart
case water
case fruitJuice
case sportsDrink
case gum
}
protocol VendingItem {
var price: Double { get }
var quantity: Int { get set }
}
protocol VendingMachine {
var selection: [VendingSelection] { get }
var inventory: [VendingSelection: VendingItem] { get set }
var amountDeposited: Double { get set }
init(inventory: [VendingSelection: VendingItem])
func vend(_ quantity: Int, _ selection: VendingSelection) throws
func deposit(_ amount: Double)
}
struct Item: VendingItem {
let price: Double
var quantity: Int
}
enum InventoryError: Error {
case invalidResource
case conversionFailure
case invalidSelection
}
class PlistConverter {
static func dictionary(fromFile name: String, ofType type: String) throws -> [String: AnyObject] {
guard let path = Bundle.main.path(forResource: name, ofType: type) else {
throw InventoryError.invalidResource
}
guard let dictionary = NSDictionary(contentsOfFile: path) as? [String: AnyObject] else {
throw InventoryError.conversionFailure
}
return dictionary
}
}
class InventoryUnarchiver {
static func vendingInventory(fromDictionary dictionary: [String: Any]) throws -> [VendingSelection: VendingItem] {
var inventory: [VendingSelection: VendingItem] = [:]
for (key, value) in dictionary {
if let itemDictionary = value as? [String: Any], let price = itemDictionary["price"] as? Double, let quantity = itemDictionary["quantity"] as? Int {
let item = Item(price: price, quantity: quantity)
guard let selection = VendingSelection(rawValue: key) else {
throw InventoryError.invalidSelection
}
inventory.updateValue(item, forKey: selection)
}
}
return inventory
}
}
class FoodVendingMachine: VendingMachine {
let selection: [VendingSelection] = [.soda, .dietSoda, .chips, .cookie, .wrap, .sandwich, .candybar, .popTart, .water, .fruitJuice, .sportsDrink, .gum]
var inventory: [VendingSelection : VendingItem]
var amountDeposited: Double = 10.0
required init(inventory: [VendingSelection : VendingItem]) {
self.inventory = inventory
}
func vend(_ quantity: Int, _ selection: VendingSelection) throws {
}
func deposit(_ amount: Double) {
}
}
| [
-1
] |
0bbdbc140a1c170677128d7291eb38bbe0c3ea10 | 5b3b58e6e26d39fefb2686a8cf7e81f95ef76f2b | /TipC/TipCTests/TipCTests.swift | 3fdbd4b728a248440c3c225c06a68c69440e6fe5 | [
"Apache-2.0"
] | permissive | poojashah89/Swift | 368b8b946e097c838e8a42cee36639a8954af8aa | 6730d738674ffe763abe009ea42d9f411a9fbc7c | refs/heads/master | 2020-03-09T08:18:19.046700 | 2018-06-04T22:52:40 | 2018-06-04T22:52:40 | 128,686,015 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 954 | swift | //
// TipCTests.swift
// TipCTests
//
// Created by Pooja Shah on 1/5/18.
// Copyright © 2018 Pooja Shah. All rights reserved.
//
import XCTest
@testable import TipC
class TipCTests: 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.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
278558,
16419,
229413,
204840,
344107,
155694,
229424,
237620,
229430,
180280,
163896,
352315,
213052,
376894,
286788,
352326,
311372,
311374,
196691,
385116,
237663,
254048,
319591,
131178,
221290,
278638,
319598,
204916,
131191,
237689,
131198,
319629,
311438,
278677,
196760,
426138,
278685,
311458,
278691,
278699,
377009,
278708,
180408,
131256,
295098,
139479,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
278797,
254226,
319763,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
180535,
336183,
278842,
287041,
287043,
319813,
311621,
139589,
344401,
377169,
368981,
155990,
278869,
368984,
106847,
98657,
270701,
270706,
246136,
139640,
106874,
311681,
311685,
106888,
385417,
311691,
385422,
213403,
246178,
385454,
311727,
377264,
319930,
278970,
311738,
33211,
336320,
311745,
278978,
254406,
188871,
278989,
278993,
278999,
328152,
369116,
188894,
287198,
279008,
279013,
279018,
311786,
319981,
319987,
279029,
254456,
377338,
279039,
377343,
254465,
279050,
139792,
303636,
279062,
393751,
254488,
279065,
377376,
180771,
377386,
197167,
385588,
115270,
377418,
385615,
426576,
369235,
295519,
139872,
66150,
279146,
295536,
287346,
139892,
344696,
287352,
279164,
189057,
311941,
336518,
369289,
311945,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
221852,
377500,
295576,
205471,
344738,
139939,
279206,
287404,
295599,
205487,
303793,
336564,
164533,
230072,
287417,
303803,
287422,
66242,
377539,
287433,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
279269,
246503,
369385,
230125,
312047,
279280,
312052,
230134,
172792,
344827,
221948,
279294,
205568,
295682,
197386,
434957,
312079,
295697,
426774,
197399,
426775,
197411,
262951,
279336,
295724,
353069,
312108,
197422,
164656,
353070,
262962,
295729,
353079,
230199,
197431,
336702,
295744,
279362,
295746,
353109,
377686,
230234,
189275,
435039,
279392,
295776,
303972,
385893,
279397,
246641,
246643,
295798,
246648,
361337,
279417,
254850,
369538,
287622,
58253,
295824,
189348,
353195,
140204,
353197,
377772,
304051,
230332,
377790,
353215,
213957,
213960,
345033,
279498,
386006,
304087,
418776,
50143,
123881,
320493,
320494,
304110,
287731,
271350,
295927,
312314,
328700,
328706,
410627,
320516,
295942,
386056,
230410,
353290,
377869,
320527,
238610,
418837,
140310,
197657,
238623,
189474,
369701,
238639,
312373,
238651,
377926,
214086,
238664,
296019,
353367,
156765,
304222,
230499,
279660,
173166,
312434,
377972,
353397,
279672,
337017,
377983,
279685,
402565,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
230588,
279747,
353479,
353481,
353482,
402634,
189652,
189653,
419029,
279765,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
386294,
386301,
320770,
386306,
312587,
328971,
353551,
320796,
222494,
115998,
304421,
279854,
353584,
345396,
386359,
378172,
279875,
312648,
230729,
337225,
304456,
222541,
296270,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
296303,
296307,
116084,
181625,
337281,
148867,
296329,
304524,
296335,
9619,
370071,
279974,
279984,
173491,
304564,
279989,
353719,
280004,
361927,
296392,
280010,
280013,
312782,
222675,
239068,
280032,
271843,
280041,
329197,
329200,
296433,
321009,
280055,
288249,
296448,
230913,
230921,
329225,
296461,
304656,
329232,
370197,
402985,
394794,
230959,
312880,
288309,
312889,
288318,
280130,
288326,
288327,
280147,
239198,
157281,
99938,
312940,
222832,
288378,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
345752,
206504,
321199,
337591,
280251,
280257,
321219,
280267,
403148,
9936,
9937,
313041,
370388,
272085,
345814,
280278,
280280,
18138,
67292,
345821,
321247,
321249,
345833,
345834,
288491,
280300,
239341,
67315,
173814,
313081,
288512,
288516,
280327,
321295,
321302,
345879,
116505,
321310,
255776,
313120,
362283,
378668,
280366,
296755,
280372,
321337,
280380,
345919,
436031,
403267,
280390,
280392,
345929,
304977,
255829,
18262,
362327,
280410,
345951,
362337,
345955,
296806,
288619,
288620,
280430,
214895,
313199,
362352,
296814,
313203,
182144,
305026,
67463,
329622,
337815,
239514,
436131,
313254,
436137,
362417,
362431,
214977,
280514,
214984,
362443,
231375,
346067,
329695,
436191,
313319,
296941,
436205,
329712,
223218,
43014,
354316,
313357,
305179,
239650,
223268,
329765,
354343,
354345,
223274,
346162,
288828,
436285,
288833,
288834,
436292,
403525,
313416,
436301,
354385,
338001,
338003,
223316,
280661,
329814,
354393,
280675,
280677,
43110,
321637,
329829,
436329,
288879,
223350,
280694,
288889,
215164,
313469,
215166,
280712,
346271,
436383,
362659,
239793,
182456,
280762,
223419,
379071,
280768,
149703,
346314,
321745,
280795,
387296,
280802,
379106,
346346,
321772,
125169,
436470,
149760,
411906,
313608,
321800,
272658,
338197,
305440,
338218,
321840,
379186,
280887,
321860,
182597,
182598,
280902,
289110,
305495,
215385,
354655,
321894,
280939,
313713,
354676,
199029,
436608,
362881,
248194,
240002,
436611,
240016,
108944,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
281037,
289232,
281040,
256477,
330218,
281072,
109042,
174593,
420369,
289304,
207393,
289332,
174648,
338489,
338490,
322120,
281166,
297560,
436832,
436834,
313966,
420463,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
117397,
346772,
330388,
264856,
314009,
289434,
346779,
166582,
289462,
314040,
109241,
158394,
248517,
363211,
363230,
289502,
264928,
330474,
289518,
125684,
199414,
191235,
322313,
322316,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
289598,
355146,
355152,
355154,
281427,
281433,
322395,
355165,
109409,
355178,
330609,
174963,
207732,
109428,
158593,
109447,
224145,
355217,
256922,
289690,
289698,
420773,
289703,
240552,
363438,
347055,
289722,
289727,
273344,
330689,
363458,
379844,
19399,
330708,
248796,
347103,
52200,
289774,
183279,
347123,
314355,
240630,
314362,
257024,
330754,
134150,
330763,
322582,
281626,
175132,
248872,
322612,
314448,
339030,
281697,
314467,
281700,
257125,
322663,
281706,
207979,
273515,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
339102,
199839,
429214,
330913,
306338,
265379,
249002,
306346,
3246,
421048,
339130,
208058,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
388349,
437505,
322824,
257305,
126237,
339234,
208164,
109861,
372009,
412971,
298291,
306494,
216386,
224586,
331090,
314709,
314710,
372054,
159066,
134491,
314720,
281957,
314728,
306542,
380271,
208244,
314741,
249204,
249205,
290169,
290173,
306559,
306560,
224640,
314751,
314758,
298374,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
282022,
314791,
396711,
396712,
282024,
241066,
314798,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
191981,
282096,
306673,
191990,
290300,
290301,
372227,
306692,
323080,
323087,
282129,
323089,
175639,
388632,
282136,
396827,
282141,
134686,
347694,
290358,
265798,
282183,
265804,
224847,
118353,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
282245,
282246,
290443,
323217,
282259,
298654,
282271,
257699,
282276,
298661,
290471,
282280,
298667,
61101,
224946,
306874,
110268,
224958,
323263,
282303,
323264,
274115,
282312,
306890,
282318,
241361,
282327,
298712,
298720,
12010,
282348,
282355,
323316,
282358,
339715,
323331,
323332,
216839,
339720,
282378,
372496,
323346,
282391,
339745,
241441,
315171,
257830,
421672,
282409,
282417,
200498,
315202,
282434,
307011,
282438,
307025,
413521,
216918,
241495,
282474,
282480,
241528,
315264,
339841,
241540,
282504,
315273,
315274,
110480,
372626,
380821,
282518,
282519,
298909,
118685,
298920,
323507,
200627,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
282612,
290811,
241692,
102437,
315432,
315434,
102445,
233517,
176175,
282672,
241716,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
45153,
307299,
307301,
315497,
315498,
438377,
233589,
266357,
233590,
422019,
241808,
323729,
381073,
184484,
299174,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
184575,
381208,
282909,
299293,
151839,
282913,
233762,
217380,
151847,
282919,
332083,
332085,
332089,
315706,
282939,
438596,
332101,
323913,
348492,
323920,
282960,
348500,
168281,
332123,
323935,
332127,
242023,
160110,
242033,
291192,
315773,
291198,
340357,
225670,
332167,
242058,
373134,
291224,
242078,
61857,
315810,
315811,
61859,
381347,
340398,
299441,
283064,
291265,
291267,
127427,
127428,
283075,
324039,
373197,
160225,
127465,
291311,
233978,
291333,
340490,
283153,
258581,
291358,
283182,
283184,
234036,
234040,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
340558,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
152203,
316049,
316053,
111253,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
299746,
234217,
299759,
234234,
299776,
242433,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
283419,
291612,
283430,
152365,
422703,
422709,
152374,
234294,
160571,
430910,
160575,
160580,
381773,
201549,
201551,
242529,
349026,
357218,
275303,
201577,
177001,
308076,
242541,
209783,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
308112,
349072,
209817,
324506,
390045,
127902,
185250,
283558,
185254,
316333,
316343,
373687,
373706,
316364,
324586,
316405,
349175,
201720,
127992,
357379,
234514,
308243,
316437,
300068,
357414,
300084,
308287,
21569,
218186,
341073,
439384,
234587,
300135,
300136,
316520,
316526,
357486,
144496,
300146,
300150,
291959,
300151,
160891,
300158,
349316,
349318,
234638,
373903,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
283802,
234663,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
316627,
333011,
333022,
234733,
292085,
234742,
128251,
292091,
316669,
234755,
439562,
292107,
414990,
251153,
177428,
349462,
333090,
382258,
300343,
382269,
333117,
300359,
177484,
406861,
259406,
234831,
120148,
283991,
357719,
374109,
316765,
292195,
333160,
284014,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
112018,
357786,
251298,
333220,
316842,
374191,
284089,
292283,
415171,
292292,
300487,
300489,
284107,
366037,
210390,
210391,
210392,
210393,
144867,
103909,
316902,
251378,
308723,
300536,
300542,
292356,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
431649,
169518,
431663,
194110,
349763,
292423,
218696,
292425,
243274,
128587,
333388,
349781,
300630,
128599,
235095,
333408,
374372,
300644,
317032,
415338,
243307,
54893,
325231,
333430,
325245,
235135,
194180,
415375,
333470,
153251,
300714,
210603,
300728,
415420,
333503,
259781,
333509,
333517,
333520,
325346,
153319,
325352,
284401,
300794,
325371,
194303,
194304,
284431,
243472,
161554,
366360,
325404,
399147,
431916,
284459,
317232,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
300894,
128862,
284512,
276327,
292712,
325484,
423789,
292720,
325492,
276341,
300918,
341879,
317304,
333688,
194429,
112509,
55167,
325503,
333701,
243591,
350093,
325518,
243597,
333722,
350109,
300963,
292771,
333735,
415655,
284587,
292782,
317360,
243637,
284619,
301008,
153554,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
227370,
309295,
129076,
243767,
358456,
309345,
227428,
194666,
260207,
432240,
333940,
292988,
292992,
194691,
227460,
415881,
104587,
235662,
325776,
284826,
333991,
153776,
227513,
301251,
227524,
309444,
194782,
301279,
317664,
227578,
243962,
375039,
309503,
194820,
325905,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
227654,
325968,
6481,
366930,
366929,
6489,
334171,
383332,
416104,
383336,
317820,
211326,
317831,
227725,
227726,
252308,
293274,
39324,
121245,
285084,
317852,
285090,
342450,
334260,
293303,
293306,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
358882,
342498,
334309,
391655,
432618,
375276,
309744,
301571,
342536,
416286,
375333,
293419,
244269,
375343,
236081,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
309846,
416351,
268899,
244327,
39530,
301689,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
318130,
383667,
293556,
342706,
342713,
285371,
285372,
285373,
285374,
39614,
154316,
334547,
375526,
342762,
342763,
293612,
129773,
154359,
228088,
432893,
162561,
285444,
383754,
326414,
285458,
310036,
285466,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
285487,
301871,
375609,
285497,
293693,
252741,
318278,
293711,
244568,
244570,
293730,
342887,
400239,
310131,
211829,
228215,
211836,
400252,
359298,
359299,
260996,
113542,
416646,
228233,
392074,
236428,
56208,
400283,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
252847,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
203757,
187374,
383983,
277492,
318461,
293886,
277509,
293893,
433165,
384016,
277524,
293910,
433174,
326685,
252958,
252980,
203830,
359478,
302139,
277597,
113760,
392290,
253029,
285798,
228458,
318572,
15471,
351344,
285814,
285820,
392318,
187521,
384131,
285828,
302213,
285830,
302216,
228491,
228493,
326804,
187544,
285851,
351390,
302240,
253099,
253100,
318639,
294068,
367799,
294074,
113850,
64700,
228540,
228542,
302274,
367810,
244940,
195808,
310497,
228588,
302325,
228600,
228609,
261377,
245019,
253216,
130338,
130343,
261425,
351537,
171317,
318775,
286013,
286018,
113987,
146762,
294218,
294219,
318805,
425304,
163175,
327024,
327025,
318848,
179587,
294275,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
310701,
286129,
286132,
228795,
425405,
302529,
302531,
425418,
302540,
310732,
64975,
310736,
327121,
228827,
286172,
187878,
245223,
286202,
359930,
228861,
302590,
286205,
294400,
253451,
253452,
359950,
146964,
253463,
187938,
286244,
245287,
245292,
425535,
196164,
56902,
228943,
286288,
179801,
196187,
343647,
286306,
310889,
204397,
138863,
188016,
294529,
229001,
310923,
188048,
302739,
425626,
229020,
302754,
229029,
40614,
40613,
40615,
286391,
384695,
327358,
286399,
212685,
212688,
384720,
302802,
286423,
278233,
278234,
294622,
278240,
229088,
212716,
212717,
360177,
229113,
286459,
278272,
319233,
311042,
360195,
278291,
294678,
286494,
294700,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
237408,
425825,
302946,
425833,
417654,
188292,
327557,
294807,
294809,
376732,
294814,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
344013,
212942,
212946,
24532,
294886,
278512,
311281,
311282
] |
410397f3c634dd10420a5dffd3aa8660b7f8070d | cbf83e3d62a0991fdb22e46080080b52bb21e329 | /Sources/ASN1Kit/ObjectIdentifier.swift | 999c491a640f4604728a4a5197a17b9a54b73c2b | [
"Apache-2.0"
] | permissive | gematik/ASN1Kit | 5b5bfec8837f78d373a4c6ecb2f62fd744dc5e27 | 605113f951fd31c083e66e3197309f42b968d800 | refs/heads/main | 2023-08-04T04:39:19.412974 | 2023-06-28T14:06:29 | 2023-06-28T14:06:29 | 214,166,950 | 23 | 9 | Apache-2.0 | 2023-06-28T14:06:30 | 2019-10-10T11:38:45 | Swift | UTF-8 | Swift | false | false | 6,529 | swift | //
// Copyright (c) 2023 gematik GmbH
//
// 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 Foundation
public struct ObjectIdentifier: Equatable, Hashable, RawRepresentable {
public let rawValue: String
private init(withValidated value: String) {
rawValue = value
}
private init(withUnvalidated value: String) throws {
// check ASN.1 syntax
let regex = try! NSRegularExpression( // swiftlint:disable:this force_try
pattern: "^((urn:oid:)|\\{)?(([0-2]((\\.|\\s)([1-9]([0-9]*)|0))+)|(\\w+\\W?\\w*\\(\\d+\\)\\s*)+)(\\})?$"
)
guard !regex.matches(in: value, options: [], range: value.fullRange).isEmpty else {
throw ASN1Error.malformedEncoding("Invalid OID [\(value)]")
}
// Transform OID to internal (simple) representation
let allowedCharacters = ".0123456789 ".characterSet
let transformedOID = String(value.filter(allowedCharacters.contains)).replacingOccurrences(of: " ", with: ".")
guard transformedOID.isOID else {
throw ASN1Error.malformedEncoding("Invalid (transformed) OID [\(transformedOID)]")
}
self.init(withValidated: transformedOID)
}
public init?(rawValue: String) {
do {
try self.init(withUnvalidated: rawValue)
} catch {
return nil
}
}
/// Parse ASN.1 OID from String
///
/// Supports OID formats: ASN.1 notation (http://oid-info.com/faq.htm#17)
/// and dot notation (http://oid-info.com/faq.htm#14)
///
/// - Note: does not support OID-IRI notation (http://oid-info.com/faq.htm#iri)
///
/// - Parameters:
/// - string: OID encoded string e.g. "1.3.6.1.4.1 ", "{1 3 6 1 4 1}", "urn:oid:1.3.6.1.4.1"
/// or even "{iso(1) identified-organisation(3) dod(6) internet(1) private(4) enterprise(1)}"
/// - Throws: ASN1Error when string is malformed
/// - Returns: The parsed ObjectIdentifier as OID
public static func from(string value: String) throws -> ObjectIdentifier {
try ObjectIdentifier(withUnvalidated: value)
}
}
extension ObjectIdentifier: ASN1CodableType {
/// ASN.1 Encode the OID
///
/// - Parameter tag: ignored and set to `.universal(.objectIdentifier)`
/// - Throws: ASN1Error when SIDs are not Int Parsable
/// - Returns: The ASN1Primitive from ASN1 serializing
public func asn1encode(tag _: ASN1DecodedTag? = nil) throws -> ASN1Object {
var sids = rawValue.split(separator: ".").map(String.init).map(UInt.init)
guard sids.count > 1 else {
throw ASN1Error.internalInconsistency("Invalid SID encountered [Empty]")
}
// Encode first (2) SIDs
guard let firstSID = sids[0], let secondSID = sids[1] else {
throw ASN1Error.internalInconsistency("Invalid SID encountered [Too Short]")
}
let firstValue = firstSID * UInt(40) + secondSID
sids.removeFirst()
sids[0] = firstValue
// Encode consecutive SID
let data = try sids.reduce(Data()) { acc, sid in
var local = Data()
guard var sidValue = sid else {
throw ASN1Error.internalInconsistency("Invalid SID encountered [Nil]")
}
repeat {
let current = UInt8(sidValue % 128) | (local.isEmpty ? 0x0 : 0x80)
local.append(current)
sidValue /= 128
} while sidValue > 0
return acc + local.reversed()
}
return ASN1Primitive(data: .primitive(data), tag: .universal(.objectIdentifier))
}
/// Initialize an OID from Decoded ASN1 encoding
/// - Parameter asn1: The (de-serialized) ASN1 Tag
public init(from asn1: ASN1Object) throws {
guard asn1.tag == .universal(.objectIdentifier), let oidData = asn1.data.primitive, !oidData.isEmpty else {
throw ASN1Error.malformedEncoding("OID is not encoded primitive")
}
var value = ""
let scanner = DataScanner(data: oidData)
while !scanner.isComplete {
var subId = UInt(0)
var lastByte: UInt8
repeat {
guard let byte = scanner.scan(distance: 1)?[0] else {
throw ASN1Error.malformedEncoding("OID is not properly encoded")
}
subId *= 128
subId += UInt(byte) & 0x7F
lastByte = byte
} while (lastByte & 0x80) == UInt8(0x80)
// Treat first two (2) SIDs differently
if value.isEmpty {
switch subId {
case 0 ... 39:
value = "0.\(subId)"
case 40 ... 79:
value = "1.\(subId - 40)"
default:
value = "2.\(subId - 80)"
}
} else {
value += ".\(subId)"
}
}
self.init(withValidated: value)
}
}
extension ObjectIdentifier: CustomStringConvertible {
public var description: String {
rawValue
}
}
extension String {
// swiftlint:disable force_try line_length
static let oidRegex =
try! NSRegularExpression(
pattern: "^(((0|1)\\.([1-3][0-9]|[0-9])(\\.([1-9]([0-9])*|0))?)|(2\\.([1-9]([0-9]*)|[0-9])))(\\.([1-9]([0-9])*|0))*$"
)
// swiftlint:enable force_try line_length
/// Check if `self` could be a valid ASN.1 OID
/// - Returns: `true` when matching the oidRegex
var isOID: Bool {
!String.oidRegex.matches(in: self, options: [], range: fullRange).isEmpty
}
/// Create a Character set of self
public var characterSet: Set<Character> {
Set(self)
}
}
extension ObjectIdentifier: Codable {
public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let value = try container.decode(String.self)
try self.init(withUnvalidated: value)
}
}
| [
-1
] |
63e55d36dc14c36b4f230cf747ceff43e2853c22 | 5aa457832d7c7ed760c1e6283f2e79f8ed8db1ba | /ios/AppleWatchApp/modules/IWatchConnectModule.swift | 39113e5da1e9ea39e4b22286da6d7d050c5a5e8f | [] | no_license | lyicelee/react-native-apple-watch-app | 37dd2b2be88146af36afb501ee5c49cd15d7d21d | f1612f0a9ee841ff82ca0123733be89fc60c1e56 | refs/heads/master | 2020-06-25T17:46:43.955559 | 2017-07-18T07:59:39 | 2017-07-18T07:59:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 390 | swift | //
// IWatchConnectModule.swift
// AppleWatchApp
//
// Created by mac_vm on 2017/07/18.
// Copyright © 2017年 Facebook. All rights reserved.
//
import Foundation
@objc(IWatchConnectModule)
class IWatchConnectModule: NSObject {
@objc func callbackMethod(_ callback: RCTResponseSenderBlock) -> Void {
let result = [
"success": "sss"
];
callback([result])
}
}
| [
-1
] |
e6f508d51e0ed7143b3dabde19b30459fb544f4b | 203b350eadcc0c6e1b50c9a03972cf5c278a9778 | /BluetoothLowEnergyTests/BluetoothLowEnergyTests.swift | f3a6005f6c28249a0a1a7a12101084d427d44a1d | [] | no_license | ReemDAlsh/Bluetooth_Low_Energy- | 12ba67dd7fe77154a0cee21b9a5d654e8e4cd913 | c9da462d66514a042e6ea56d4d6e1e85e2b80976 | refs/heads/master | 2020-03-22T12:00:25.959392 | 2018-07-06T17:17:10 | 2018-07-06T17:17:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,017 | swift | //
// BluetoothLowEnergyTests.swift
// BluetoothLowEnergyTests
//
// Created by Reem alsharif on 4/26/18.
// Copyright © 2018 Reem alsharif. All rights reserved.
//
import XCTest
@testable import BluetoothLowEnergy
class BluetoothLowEnergyTests: 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.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
313357,
305179,
98333,
102437,
292902,
354345,
282672,
180280,
288834,
286788,
311372,
223316,
315476,
307289,
45153,
227428,
307301,
131178,
278638,
223350,
131191,
237689,
131198,
292992,
284826,
299174,
153776,
184505,
227513,
295098,
301279,
311519,
286958,
184570,
227578,
184575,
282909,
282913,
233762,
280887,
315706,
287041,
287043,
311621,
139589,
227654,
305495,
168281,
323935,
321894,
416104,
280939,
199029,
291192,
227725,
240016,
190871,
61857,
285090,
61859,
289189,
278970,
293306,
291267,
278989,
281037,
188894,
287198,
279008,
160225,
285150,
279013,
291311,
309744,
279029,
233978,
291333,
279050,
283153,
303636,
291358,
180771,
293419,
244269,
283184,
23092,
234036,
289332,
115270,
293448,
377418,
281166,
295536,
287346,
287352,
279164,
189057,
152203,
117397,
230040,
289434,
221852,
279206,
295599,
303793,
299699,
166582,
289462,
285371,
285372,
285373,
285374,
287422,
303803,
66242,
287433,
289502,
234217,
342762,
230125,
289518,
230134,
228088,
279294,
205568,
242433,
299776,
285444,
322313,
166676,
283419,
262951,
312108,
285487,
164656,
262962,
230199,
293693,
295746,
281433,
230234,
279392,
303972,
295798,
228215,
177019,
291712,
113542,
308107,
56208,
308112,
283558,
310182,
236461,
289727,
279498,
326635,
203757,
304110,
287731,
295927,
312314,
277509,
230410,
308243,
277524,
293910,
281626,
238623,
300068,
238639,
312373,
238651,
277597,
230499,
285798,
300135,
322663,
207979,
312434,
285820,
285828,
279685,
285830,
222343,
302213,
228491,
296086,
238743,
187544,
119962,
296092,
302240,
330913,
249002,
300202,
279728,
238769,
294074,
228542,
302274,
279747,
283847,
283852,
189652,
310497,
298212,
290022,
234733,
298221,
279792,
298228,
228600,
292107,
130338,
130343,
298291,
286018,
113987,
230729,
177484,
222541,
296270,
314709,
357719,
230756,
281957,
230765,
306542,
296303,
306559,
148867,
294275,
298374,
142729,
296335,
112017,
306579,
318875,
310692,
279974,
282022,
310701,
292292,
306631,
296392,
300489,
310732,
312782,
222675,
228827,
280032,
280041,
296433,
280055,
300536,
290300,
290301,
296448,
230913,
306692,
296461,
282141,
288309,
290358,
280130,
288326,
288327,
282183,
300630,
290390,
128599,
235095,
306776,
300644,
222832,
314998,
294529,
288392,
290443,
310923,
323217,
229020,
282271,
302754,
282276,
229029,
282280,
286391,
300728,
306874,
280251,
282303,
286399,
9936,
9937,
212688,
282327,
286423,
278233,
18138,
278234,
67292,
294622,
278240,
288491,
280300,
239341,
284401,
323316,
229113,
313081,
286459,
288516,
216839,
282378,
321295,
282417,
200498,
296755,
345919,
282438,
18262,
280410,
188251,
300894,
296806,
282474,
288619,
288620,
280430,
313203,
300918,
194429,
67463,
110480,
282518,
282519,
298909,
311199,
294823,
298920,
284587,
292782,
294843,
237504,
280514,
344013,
301008,
294886,
296941,
311282,
292858
] |
b2e2bafbc02fa93a258852a590621b0b807e2200 | fdec5e9fdebee64cdf31cdbcf5af443728754b6e | /UsingCoreData/UsingCoreData/ InfoPageVC.swift | c3bb345c300efe02a4434dc1bd3b1bbf2b746261 | [
"MIT"
] | permissive | shaniyanisha/UsingCoreDataRepository | 90e966b1946c81a0dd3d3019047547cdf3443966 | 91e3ee0a1acd14955fd21e54ce2f63c729d6650f | refs/heads/master | 2021-01-21T07:03:42.784395 | 2017-02-27T12:34:00 | 2017-02-27T12:34:00 | 83,308,232 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,439 | swift | //
// InfoPageVCViewController.swift
// HitList
//
// Created by Appinventiv on 24/02/17.
// Copyright © 2017 Razeware. All rights reserved.
//
import UIKit
import CoreData
class InfoPageVC: UIViewController {
//mark : IBOutlets
@IBOutlet weak var infoTableview: UITableView!
//Mark:Variables
var tableIndexPath = [IndexPath]()
var people = [Person]()
var arrayOfIndexpath = [IndexPath]()
// var selectedPerson = Person()
var infoList = ["Name","Gender","Address"]
@IBOutlet weak var doneButton: UIButton!
//Mark: View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
// datasource and delegate
infoTableview.dataSource = self
infoTableview.delegate = self
//Rgesiter tableview cell
let cellnib = UINib(nibName: "TableViewCell", bundle: nil)
infoTableview.register(cellnib, forCellReuseIdentifier: "TableViewCellID")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//IBAction of done button
@IBAction func done(_ sender: UIButton) {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext = appDelegate.persistentContainer.viewContext
let entity = NSEntityDescription.entity(forEntityName: "Person",
in: managedContext)!
let person = Person(entity: entity, insertInto: managedContext)
//for loop that goes when the indexpath of people goes to selectedPerson array
for indices in tableIndexPath.indices{
let cell = infoTableview.cellForRow(at: tableIndexPath[indices]) as! TableViewCell
switch indices{
case 0 :
person.name = cell.requirmentAnswer.text
case 1 :
person.gender = cell.requirmentAnswer.text
case 2 :
person.address = cell.requirmentAnswer.text
default: break
}
}
do {
try managedContext.save()
people.append(person)
}
catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
}
}
//Mark : extension od InfoPageVc
extension InfoPageVC : UITableViewDataSource,UITableViewDelegate{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return infoList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCell(withIdentifier: "TableViewCellID", for: indexPath) as! TableViewCell
cell.requirement.text = infoList[indexPath.row]
cell.layer.borderColor = UIColor.gray.cgColor
cell.layer.borderWidth = 1
cell.requirmentAnswer.placeholder = infoList[indexPath.row]
tableIndexPath.append(indexPath)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat{
return 90
}
}
| [
-1
] |
2a240f0910d434ca2c15abaea4736dcb905c7ec0 | 54e401879e76c2b381521d32828217462de7bb16 | /SwiftUI-Sample-App-master/Demo/Home/ProductListCollVCell.swift | f87a8f19c212b444eabc0198bbe2081113d651a2 | [
"MIT"
] | permissive | traning-ios/LearningSwiftUI | 1bb022afa4230037c53c40debdbbdd317175581d | 8bb3032a9db94955249ae1b464444c17439240ac | refs/heads/master | 2020-11-25T18:51:42.658526 | 2020-04-02T02:05:37 | 2020-04-02T02:05:37 | 228,800,209 | 11 | 4 | null | null | null | null | UTF-8 | Swift | false | false | 1,899 | swift | //
// ProductListCollVCell.swift
// SwiftUIWorkingDemo
//
// Created by mac-00015 on 19/10/19.
// Copyright © 2019 mac-00015. All rights reserved.
//
import SwiftUI
struct ProductListCollVCell: View {
var product: Product
var body: some View {
NavigationLink(destination: ProductListRedirection(product: product)) {
VStack {
Image(product.imageName)
.resizable()
.frame(width: (UIScreen.main.bounds.width * 190) / 414, height: (UIScreen.main.bounds.width * 134) / 414)
.aspectRatio(contentMode: .fill)
Text("Color Birds")
.lineLimit(2)
.padding([.leading, .trailing], 5)
.foregroundColor(Color("TextColor"))
Spacer()
}
// .background(Color.white)
.border(Color.gray)
.cornerRadius(10)
.shadow(radius: 2)
}
.buttonStyle(PlainButtonStyle())
}
}
struct ProductListCollVCell_Previews: PreviewProvider {
static var previews: some View {
ProductListCollVCell(product: Product(name: "First Product", imageName: "bird"))
.previewLayout(.fixed(width: (UIScreen.main.bounds.width * 200) / 414, height: (UIScreen.main.bounds.width * 200) / 414))
}
}
struct ProductListRedirection: View {
var product: Product
var body: some View {
switch product.name {
case "First Product":
return AnyView(CurrentOrderVC())
case "Second Product":
return AnyView(NotificationVC())
case "Third Product":
return AnyView(FavouritesVC())
default:
return AnyView(Text(product.name))
}
}
}
| [
-1
] |
9bf9ff14143837fd4c349eada65099ad40df138c | 325b4b67908d6b9641794068fdbb7974d5ec85a0 | /Example/SWEmailComposer/AppDelegate.swift | f7386b8cbbd8feac25e2246d8bfcfa35254d1881 | [
"MIT"
] | permissive | carabina/SWEmailComposer | 65d4d476cbcc47419fd72adbae69e5b05f78e097 | 2f55f4d7ccbffeb79a9e41bda72ad99b55afba70 | refs/heads/master | 2020-03-11T21:52:29.772544 | 2018-04-19T18:52:13 | 2018-04-19T18:52:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,185 | swift | //
// AppDelegate.swift
// SWEmailComposer
//
// Created by Spencer Whyte on 04/18/2018.
// Copyright (c) 2018 Spencer Whyte. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
352284,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
131209,
303241,
417930,
311436,
303244,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
278849,
319809,
319810,
319814,
311623,
319818,
311628,
229709,
287054,
319822,
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,
279010,
287202,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
172529,
279027,
319989,
164343,
180727,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
287238,
172550,
172552,
303623,
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,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
295538,
189044,
172660,
287349,
352880,
287355,
287360,
295553,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
287390,
295583,
303773,
172702,
287394,
172705,
303780,
172707,
287398,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
369433,
230169,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
213895,
320391,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
304063,
238528,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
279750,
312518,
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,
222525,
296253,
312639,
296255,
230718,
296259,
378181,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
312711,
312712,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
288226,
370146,
280036,
288229,
280038,
288230,
288232,
280034,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
402942,
148990,
296446,
206336,
296450,
321022,
230916,
230919,
214535,
370187,
304651,
304653,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
280152,
288344,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
280264,
206536,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
321266,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
321560,
305176,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
280671,
149599,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
230045,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
305668,
240132,
223749,
281095,
338440,
150025,
223752,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
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,
207661,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
314249,
338823,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
308418,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
290174,
298365,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
224657,
306581,
314779,
314785,
282025,
314793,
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,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
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,
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,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
282481,
110450,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
44948,
298901,
241556,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
241640,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
323763,
176311,
299191,
307385,
307386,
258235,
176316,
307388,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
307510,
332086,
151864,
307512,
168245,
307515,
282942,
307518,
151874,
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,
283033,
291226,
242075,
315801,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
127466,
176620,
127474,
291314,
291317,
135672,
233979,
291323,
127485,
291330,
283142,
127497,
233994,
135689,
291341,
233998,
234003,
234006,
152087,
127511,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
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,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
316151,
234231,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
291608,
234264,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
292433,
234313,
316233,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
234370,
201603,
291714,
234373,
226182,
234375,
291716,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
324504,
234393,
209818,
308123,
324508,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
234439,
234434,
234443,
291788,
193486,
234446,
193488,
275406,
234449,
316370,
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,
316483,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
300628,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
324757,
234648,
283805,
234653,
324766,
119967,
308379,
300189,
234657,
324768,
283813,
234661,
177318,
234664,
300197,
275626,
234667,
242852,
316596,
308414,
234687,
316610,
300226,
226500,
234692,
300229,
308420,
283844,
308422,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
300292,
300294,
275719,
300299,
177419,
283917,
300301,
242957,
177424,
275725,
349464,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
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,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
259567,
300527,
308720,
226802,
316917,
308727,
292343,
300537,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
194103,
284218,
226877,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
284234,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292479,
276098,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
358083,
276166,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
358146,
317187,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
186139,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
194351,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
292843,
276460,
276464,
178161,
276466,
227314,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
276496,
317456,
317458,
243733,
317468,
243740,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
276539,
178238,
276544,
284739,
292934,
243785,
276553,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
178273,
227426,
194657,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
227440,
350316,
284786,
350321,
276595,
350325,
301167,
350328,
292985,
301178,
292989,
292993,
301185,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
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,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
317971,
309779,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
318132,
285368,
277177,
277181,
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,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
15224,
236408,
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,
228330,
318442,
228332,
277486,
326638,
318450,
293876,
293877,
285686,
302073,
285690,
244731,
121850,
302075,
293882,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
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,
204023,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
228617,
138505,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
294211,
302403,
384328,
277832,
277836,
294221,
326991,
294223,
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,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
286169,
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,
294435,
40484,
286246,
40486,
286248,
278057,
294439,
294440,
294443,
294445,
40488,
310831,
40491,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
40533,
147032,
40537,
40539,
278109,
40541,
40544,
40548,
40550,
286312,
286313,
40554,
40552,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
122517,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
301163,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
302872,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
237409,
294776,
360317,
294785,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
52977d7f90c9474760d10b9918aed43c3c6eb5cf | bdc8f99c210afcfa5f8a34f6b5887caa30c3cd71 | /Sources/TTBaseUIKit/CustomView/BaseUIView/DatePicker/BaseMonthYearPicker.swift | 0507f9c099b1b6ca6af233cfbcc72cb3ea910dee | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | tqtuan1201/TTBaseUIKit | d9ad8216cde5cd4ebd76f2261aa02f9a1828311d | 17cf3de0c623e0300fb1f22486c483693e1a5ca2 | refs/heads/master | 2023-06-24T09:45:35.205283 | 2023-05-29T07:57:57 | 2023-05-29T07:57:57 | 179,668,912 | 3 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 12,534 | swift | //
// BaseDatePicker.swift
// TTBaseUIKit
//
// Created by Truong Quang Tuan on 5/21/19.
// Copyright © 2019 Truong Quang Tuan. All rights reserved.
//
import Foundation
import UIKit
open class TTBaseMonthYearPicker: TTBasePopupViewController {
open var previousYear:Int { get { return 40 } }
fileprivate var months:[String] = (1...12).map{ i in String(i) }
fileprivate var years:[String] = []
public enum TYPE {
case MONTH(month:String?) // "DD"
case YEAR(year:String?) // "2019"
case MONTH_YEAR(String?,String?) //(01,2019)
}
fileprivate var locate:Locale = Locale(identifier: "vi_VN")
fileprivate var type:TYPE = .MONTH_YEAR(nil,nil)
fileprivate var selectedMonthYear:(String?, String?) = (nil, nil)
public lazy var panel:TTBaseUIView = TTBaseUIView(withCornerRadius: TTBaseUIKitConfig.getSizeConfig().CORNER_RADIUS)
public lazy var panelButtonView:TTBaseUIStackView = TTBaseUIStackView(axis: .horizontal, spacing: TTSize.P_CONS_DEF, alignment: .fill, distributionValue: .fillEqually)
public lazy var cancelButton:TTBaseUIButton = TTBaseUIButton(textString: "Cancel", type: .DEFAULT, isSetSize: false)
public lazy var okButton:TTBaseUIButton = TTBaseUIButton(textString: "Select", type: .WARRING, isSetSize: false)
public lazy var font:UIFont = UIFont.systemFont(ofSize: 12)
public lazy var textColor:UIColor = TTView.textDefColor
public lazy var textSelectedColor:UIColor = TTView.textWarringColor
public lazy var timePicker: UIPickerView = UIPickerView()
public lazy var bgColor:UIColor = .white
public lazy var HEIGHT_BUTTON:CGFloat = TTSize.H_BUTTON
public var didDatePickerValueChanged:((_ date:Date) -> Void)?
public var didTouchCancelButton:(() -> Void)?
public var didTouchOKButton:((_ monthYear:(String?, String?)?) -> Void)?
open override var navType: TTBaseUIViewController<DarkBaseUIView>.NAV_STYLE { get { return .NO_VIEW}}
public init() {
super.init(isAllowTouchPanel: false)
self.setupViewCodable(with: [])
}
public init(with type:TYPE, locate:Locale, isAllowTouchPanel:Bool, textColor:UIColor = UIColor.darkText) {
super.init(isAllowTouchPanel: isAllowTouchPanel)
self.locate = locate
self.type = type
self.textColor = textColor
self.setupViewCodable(with: [])
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
open override func viewDidLoad() {
super.viewDidLoad()
}
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
DispatchQueue.main.async { [weak self] in self?.autoScrollToSelectedValue() }
}
fileprivate func autoScrollToSelectedValue() {
let indexs = self.getIndexSelectedValue()
switch self.type {
case .MONTH(let month):
self.selectedMonthYear.0 = month
if let indexMonth = indexs.0 { DispatchQueue.main.async { self.timePicker.selectRow(indexMonth, inComponent: 0, animated: true)}}
case .YEAR(let year):
self.selectedMonthYear.1 = year
if let indexYear = indexs.1 { DispatchQueue.main.async { self.timePicker.selectRow(indexYear, inComponent: 0, animated: true)}}
case .MONTH_YEAR(let month,let year):
self.selectedMonthYear.0 = month
self.selectedMonthYear.1 = year
if let indexMonth = indexs.0 { DispatchQueue.main.async { self.timePicker.selectRow(indexMonth, inComponent: 0, animated: true)}}
if let indexYear = indexs.1 { DispatchQueue.main.async { self.timePicker.selectRow(indexYear, inComponent: 1, animated: true)}}
}
}
fileprivate func getIndexSelectedValue() -> (Int?,Int?) {
switch self.type {
case .MONTH(let month):
return (self.getIndexForMonth(withMonth: month), nil)
case .YEAR(let year):
return (self.getIndexForMonth(withMonth: year), nil)
case .MONTH_YEAR(let month,let year):
return (self.getIndexForMonth(withMonth: month), self.getIndexForYear(withMonth: year))
}
}
fileprivate func getIndexForMonth(withMonth monthString:String?) -> Int? {
for (index, month) in self.months.enumerated() { if month == monthString { return index} }
return nil
}
fileprivate func getIndexForYear(withMonth yearString:String?) -> Int? {
for (index, year) in self.years.enumerated() { if year == yearString { return index} }
return nil
}
}
//MARK:// For base funcs
extension TTBaseMonthYearPicker {
public func setText(forLeftButton left:String, right:String) {
self.cancelButton.setText(text: left).done()
self.okButton.setText(text: right).done()
}
public func setHiddenButton() {
self.cancelButton.isHidden = true
self.okButton.isHidden = true
self.panelButtonView.setHeightAnchor(constant: 1).done()
}
public func setHiddenCancelButton() {
self.cancelButton.isHidden = true
}
public func setColor(withPanel panel:UIColor, text:UIColor, leftButton:UIColor,rightButton:UIColor) {
self.bgColor = panel
self.textColor = text
self.cancelButton.setBgColor(color: leftButton).done()
self.okButton.setBgColor(color: rightButton).done()
}
fileprivate func getDisplayMonth(with month:String) -> String {
return ("04-\(month)-1991 00:00:00".toDate(withFormat: .DD_MM_YYYY_HH_MM_SS)?.monthName(with: self.locate) ?? month)
}
}
extension TTBaseMonthYearPicker: TTViewCodable {
public func setupData() {
var years: [String] = []
if years.count == 0 {
var year = NSCalendar(identifier: NSCalendar.Identifier.gregorian)!.component(.year, from: Date())
for _ in 1...previousYear {
years.append(String(year))
year -= 1
}
}
self.years = years
}
public func setupCustomView() {
self.panelButtonView.addArrangedSubview(self.cancelButton)
self.panelButtonView.addArrangedSubview(self.okButton)
self.panel.addSubview(self.timePicker)
self.panel.addSubview(self.panelButtonView)
self.view.addSubview(self.panel)
}
public func setupStyles() {
self.panel.backgroundColor = self.bgColor
self.timePicker.backgroundColor = UIColor.clear
self.timePicker.delegate = self
self.timePicker.dataSource = self
self.timePicker.setValue(self.textColor, forKey: "textColor")
}
public func bindComponents() {
self.cancelButton.onTouchHandler = { [weak self] button in guard let strongSelf = self else { return }
strongSelf.didTouchCancelButton?()
strongSelf.dismiss(animated: true, completion: nil)
}
self.okButton.onTouchHandler = { [weak self] button in guard let strongSelf = self else { return }
TTBaseFunc.shared.printLog(object: "Month: \(strongSelf.selectedMonthYear.0 ?? "")")
TTBaseFunc.shared.printLog(object: "Year: \(strongSelf.selectedMonthYear.1 ?? "")")
strongSelf.didTouchOKButton?(strongSelf.selectedMonthYear)
strongSelf.dismiss(animated: true, completion: nil)
}
}
public func setupConstraints() {
self.timePicker.translatesAutoresizingMaskIntoConstraints = false
if Device.isPad() {
self.panel.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.6).isActive = true
} else {
self.panel.widthAnchor.constraint(equalTo: self.view.widthAnchor, multiplier: 0.85).isActive = true
}
self.panel.centerXAnchor.constraint(equalTo: self.view.centerXAnchor, constant: 1).isActive = true
self.panel.centerYAnchor.constraint(equalTo: self.view.centerYAnchor, constant: 1).isActive = true
self.timePicker.setLeadingAnchor(constant: P_CONS_DEF).setTopAnchor(constant: 0).setTrailingAnchor(constant: P_CONS_DEF).done()
self.timePicker.heightAnchor.constraint(equalTo: self.timePicker.widthAnchor, multiplier: 1).isActive = true
self.panelButtonView.setTopAnchorWithAboveView(nextToView: self.timePicker, constant: 0).setBottomAnchor(constant: P_CONS_DEF).done()
self.panelButtonView.setLeadingAnchor(constant: P_CONS_DEF).setTrailingAnchor(constant: P_CONS_DEF).done()
self.panelButtonView.setHeightAnchor(constant: HEIGHT_BUTTON).done()
}
}
extension TTBaseMonthYearPicker : UIPickerViewDelegate, UIPickerViewDataSource {
public func numberOfComponents(in pickerView: UIPickerView) -> Int {
switch self.type {
case .MONTH, .YEAR:
return 1
case .MONTH_YEAR:
return 2
}
}
public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
switch self.type {
case .MONTH:
return self.months.count
case .YEAR:
return self.years.count
case .MONTH_YEAR:
if component == 0 {
return self.months.count
} else {
return self.years.count
}
}
}
public func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {
switch self.type {
case .MONTH (let month):
if component == 0 {
if self.months.indices.contains(row) {
let monthString = self.months[row]
let monthDisplayString = self.getDisplayMonth(with: monthString)
let color = (monthString == month) ? self.textSelectedColor : self.textColor
return NSAttributedString(string: monthDisplayString, attributes: [NSAttributedString.Key.font:self.font,NSAttributedString.Key.foregroundColor:color])
}
}
return nil
case .YEAR(let year):
if component == 0 {
if self.years.indices.contains(row) {
let yearString = self.years[row]
let color = (yearString == year) ? self.textSelectedColor : self.textColor
return NSAttributedString(string: yearString, attributes: [NSAttributedString.Key.font:self.font,NSAttributedString.Key.foregroundColor:color])
}
}
return nil
case .MONTH_YEAR(let month,let year):
if component == 0 {
if self.months.indices.contains(row) {
let monthString = self.months[row]
let monthDisplayString = self.getDisplayMonth(with: monthString)
let color = (monthString == month) ? self.textSelectedColor : self.textColor
return NSAttributedString(string: monthDisplayString, attributes: [NSAttributedString.Key.font:self.font,NSAttributedString.Key.foregroundColor:color])
}
} else if component == 1 {
if self.years.indices.contains(row) {
let yearString = self.years[row]
let color = (yearString == year) ? self.textSelectedColor : self.textColor
return NSAttributedString(string: yearString, attributes: [NSAttributedString.Key.font:self.font,NSAttributedString.Key.foregroundColor:color])
}
}
return nil
}
}
public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
switch self.type {
case .MONTH:
if self.months.indices.contains(row) { self.selectedMonthYear.0 = self.months[row]}
break
case .YEAR:
if self.years.indices.contains(row) { self.selectedMonthYear.1 = self.years[row]}
break
case .MONTH_YEAR:
if component == 0 {
if self.months.indices.contains(row) { self.selectedMonthYear.0 = self.months[row]}
} else {
if self.years.indices.contains(row) { self.selectedMonthYear.1 = self.years[row]}
}
break
}
}
}
| [
-1
] |
91112458edef2c2435164c6827b7f72095eb8102 | 097884085d3afe25146845b165b6d2dbc3f177ac | /PayMayaSDK/PayMayaSDKTests/Validators/CVCValidatorTests.swift | 4a36aeacebfac83aca9c41906e98cd8193d8a17a | [
"MIT"
] | permissive | rjarce/PayMaya-iOS-SDK-v2 | 055a96cb8b136aa542a65486862ffb7b617c533c | 07c9d03e8bf692ffcea87660493fd7ff1399580f | refs/heads/master | 2023-04-18T03:26:16.750491 | 2021-04-26T06:39:51 | 2021-04-26T06:39:51 | 275,106,538 | 0 | 0 | MIT | 2020-06-26T08:15:52 | 2020-06-26T08:15:51 | null | UTF-8 | Swift | false | false | 2,591 | swift | //
// Copyright (c) 2020 PayMaya Philippines, Inc.
//
// 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 Foundation
import XCTest
@testable import PayMayaSDK
class CVCValidatorTests: XCTestCase {
let validator = CVCValidator()
func test_givenCVCnumber_whenWrongLength_shouldFail() {
XCTAssertInvalid(validator.validate(string: "12"))
XCTAssertInvalid(validator.validate(string: "1"))
XCTAssertInvalid(validator.validate(string: ""))
XCTAssertInvalid(validator.validate(string: "12345"))
XCTAssertInvalid(validator.validate(string: "123456"))
}
func test_givenCVCnumber_whenWrongChars_shouldFail() {
XCTAssertInvalid(validator.validate(string: "test"))
XCTAssertInvalid(validator.validate(string: "11a"))
XCTAssertInvalid(validator.validate(string: "test"))
XCTAssertInvalid(validator.validate(string: "12/"))
XCTAssertInvalid(validator.validate(string: "*&^"))
XCTAssertInvalid(validator.validate(string: "🍎👍🤖👎"))
}
func test_givenCVCnumber_whenCorrectChars_shouldPass() {
XCTAssertValid(validator.validate(string: "123"))
XCTAssertValid(validator.validate(string: "0000"))
}
func test_givenInputChar_whenWrong_shouldFail() {
XCTAssertFalse(validator.isCharAcceptable(char: "a"))
XCTAssertFalse(validator.isCharAcceptable(char: "!"))
XCTAssertFalse(validator.isCharAcceptable(char: "*"))
XCTAssertFalse(validator.isCharAcceptable(char: "😀"))
}
}
| [
194560,
395267,
196612,
395271,
395274,
395278,
395280,
395281,
395282,
395283,
395286,
395287,
395289,
395290,
196638,
395295,
395296,
196641,
98341,
61478,
98344,
98345,
98349,
124987,
174139,
354364,
229438,
229440,
229441,
395328,
174148,
229444,
395332,
327751,
174152,
395333,
395334,
174159,
229456,
112721,
106580,
106582,
106585,
106586,
106587,
112730,
174171,
235658,
229524,
303255,
303256,
125087,
215205,
215211,
215212,
241846,
241852,
241859,
241862,
241864,
317640,
241866,
241870,
241877,
241894,
241897,
241901,
241903,
241904,
241907,
241908,
241910,
260342,
241916,
141565,
141569,
241923,
241928,
141577,
141578,
241930,
241934,
241936,
241937,
141586,
141588,
12565,
227604,
241944,
227608,
12569,
141593,
141594,
141595,
141596,
141597,
141598,
141599,
141600,
227610,
141603,
241952,
241957,
141606,
141607,
141608,
289062,
241962,
289067,
141612,
289068,
12592,
289074,
289078,
141627,
141629,
141632,
241989,
213319,
141640,
141641,
141642,
141643,
213320,
241992,
241996,
241998,
241999,
242002,
141651,
242006,
141655,
215384,
282967,
141660,
168285,
141663,
141664,
141670,
141677,
141681,
190840,
190841,
430456,
190843,
190844,
430458,
375168,
141700,
141702,
141707,
430476,
141711,
430483,
217492,
217494,
197018,
197019,
197021,
295330,
295331,
197029,
430502,
168359,
303550,
160205,
381398,
272865,
305638,
223741,
61971,
191006,
191007,
57893,
272934,
57896,
328232,
57899,
57900,
295467,
57905,
57906,
336445,
336446,
336450,
336451,
336454,
336455,
336457,
336460,
336465,
336469,
336471,
336472,
336473,
336474,
336478,
336479,
336480,
336482,
336483,
336489,
273021,
297620,
297636,
135861,
242361,
244419,
66247,
244427,
248524,
127693,
244430,
66261,
127702,
127703,
334562,
127716,
334564,
62183,
127727,
127729,
318199,
318200,
142073,
164601,
142078,
334590,
318207,
244480,
334591,
334596,
334600,
318218,
334603,
318220,
334602,
334606,
318223,
334607,
318231,
318233,
318234,
318236,
318237,
318241,
187174,
187175,
318246,
187177,
187179,
187180,
314167,
316216,
396088,
396089,
396091,
396092,
396094,
148287,
316224,
396098,
314179,
279367,
396104,
396110,
396112,
396114,
396115,
396118,
396119,
396120,
396122,
396123,
396125,
396126,
396127,
396128,
396129,
299880,
396137,
162668,
299884,
187248,
396147,
396151,
248696,
396153,
187258,
187259,
322430,
185258,
185259,
23469,
185262,
23470,
23472,
23473,
23474,
23475,
23476,
185267,
23479,
287674,
23483,
23487,
281539,
23492,
23494,
228306,
23508,
23515,
23517,
23523,
23531,
23533,
152560,
23552,
171008,
23559,
23561,
23572,
23574,
23575,
23580,
23581,
23585,
23590,
23591,
23594,
23596,
23599,
189488,
97327,
187442,
189490,
187444,
189492,
189493,
187447,
189491,
23601,
97329,
144435,
23607,
144437,
144438,
144441,
97339,
23612,
144442,
144443,
144444,
23616,
144445,
341057,
341060,
222278,
341062,
341063,
341066,
341068,
203862,
285782,
285785,
312411,
115805,
115806,
115807,
293982,
115809,
115810,
185446,
115817,
242794,
115819,
115820,
185452,
185454,
115823,
185455,
115825,
115827,
242803,
115829,
242807,
294016,
205959,
40088,
312473,
189594,
208026,
40092,
208027,
189598,
40095,
208029,
208033,
27810,
228512,
228513,
312476,
312478,
189607,
312479,
189609,
189610,
312482,
189612,
312489,
312493,
189617,
312497,
189619,
312498,
189621,
312501,
189623,
189626,
322751,
292041,
292042,
181455,
292049,
152789,
152821,
152825,
294137,
294138,
206094,
206097,
206098,
294162,
206102,
206104,
206108,
206109,
181533,
294181,
27943,
181544,
294183,
27948,
181553,
173368,
206138,
173379,
312480,
152906,
152907,
152908,
152909,
152910,
290123,
290125,
290126,
290127,
290130,
312483,
290135,
290136,
245081,
290137,
290139,
378208,
222562,
222563,
222566,
228717,
228721,
222587,
222590,
222591,
222596,
177543,
222599,
222601,
222603,
222604,
54669,
222605,
222606,
222607,
54673,
54692,
152998,
54698,
54701,
54703,
298431,
370118,
157151,
222689,
222692,
222693,
112111,
112115,
112120,
362020,
362022,
116267,
282156,
34362,
173634,
173635,
316995,
316997,
106085,
319081,
319085,
319088,
300660,
300661,
300662,
300663,
394905,
394908,
394910,
394912,
339622,
147115,
292544,
108230,
341052,
108240,
108245,
212694,
34531,
192230,
192231,
192232,
296681,
34538,
34540,
34541,
216812,
216814,
216815,
216816,
216818,
216819,
296684,
296687,
216822,
296688,
296691,
296692,
216826,
296698,
216828,
216829,
296699,
296700,
216832,
216833,
216834,
296703,
216836,
216837,
216838,
296707,
296708,
296710,
296712,
296713,
313101,
313104,
313108,
313111,
313112,
149274,
149275,
149280,
159523,
321342,
210755,
210756,
210757,
210758,
321353,
218959,
120656,
218963,
218964,
223065,
180058,
229209,
223069,
229213,
169824,
229217,
169826,
237413,
169830,
292709,
128873,
169835,
128876,
169837,
128878,
223086,
223087,
128881,
128882,
128883,
128884,
141181,
327550,
108419,
141198,
108431,
108432,
219033,
108448,
219040,
141219,
219043,
219044,
141223,
141228,
141229,
108460,
108462,
229294,
229295,
141235,
141264,
40931,
40932,
141284,
141290,
40940,
40941,
141293,
141295,
174063,
231406,
174066,
174067,
237559,
174074,
194558
] |
a00c8dcdd736ea3b9252312dd5aa843a4e46405d | 51db974e7d85d428fa07320ddcebc570539af6ef | /marveloso/api/marvel/Models/TextObject.swift | c70990e362e0a7922c2bc47d16b97200fe2072b7 | [] | no_license | javimolla/marveloso | b174cb27d9503c2686c957f2c8c3ca2aabb8c59c | 76deae4e37059a47e26ddad9b11801703973e612 | refs/heads/main | 2023-03-21T04:51:23.548372 | 2021-03-04T16:51:20 | 2021-03-04T16:51:20 | 342,795,952 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 637 | swift | //
// TextObject.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
public struct TextObject: Codable {
/** The canonical type of the text object (e.g. solicit text, preview text, etc.). */
public var type: String?
/** The IETF language tag denoting the language the text object is written in. */
public var language: String?
/** The text. */
public var text: String?
public init(type: String? = nil, language: String? = nil, text: String? = nil) {
self.type = type
self.language = language
self.text = text
}
}
| [
-1
] |
72530302c7859ae2a55c3078ff70b221d0c898f5 | 34cb2fc9265e7ca87f6044eacac53f22efa81e7a | /Package.swift | 2eedda1631372804e291161a67a3dfc2ba2f756d | [] | no_license | saddamakhtar88/MenuBarView | 099c5e385407f3275fcc94988785ab3719fca1d2 | d17cfcbb6966eb625fda13f30f656fd6274dedeb | refs/heads/master | 2023-02-16T05:15:17.145004 | 2021-01-12T16:24:48 | 2021-01-12T16:24:48 | 268,348,531 | 3 | 0 | null | 2020-08-13T06:20:46 | 2020-05-31T19:24:21 | Swift | UTF-8 | Swift | false | false | 1,079 | swift | // swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MenuBarView",
platforms: [
.iOS(.v9)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MenuBarView",
targets: ["MenuBarView"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "MenuBarView",
dependencies: []),
.testTarget(
name: "MenuBarViewTests",
dependencies: ["MenuBarView"]),
]
)
| [
324608,
415748,
340484,
304657,
35346,
237593,
154138,
369691,
192028,
160385,
217118,
159263,
425505,
201762,
201764,
163440,
224295,
140330,
201771,
372779,
201773,
402986,
102447,
201775,
201777,
321584,
321590,
33336,
321598,
242239,
173122,
389700,
159303,
339016,
389705,
332367,
254035,
341075,
248917,
327255,
296024,
385112,
388858,
384092,
395359,
160864,
261220,
374373,
139366,
258151,
205930,
66668,
362606,
373359,
333424,
2161,
192626,
431731,
298612,
2165,
253045,
273525,
339573,
346745,
201853,
2173,
245376,
339072,
160898,
2179,
204420,
339075,
339078,
2177,
357000,
204425,
201866,
339081,
141453,
339087,
330389,
162966,
339093,
176794,
380058,
2205,
44192,
393379,
2212,
334503,
248488,
315563,
222381,
258733,
336559,
176817,
108215,
173752,
325304,
225979,
256188,
222400,
225985,
357568,
153283,
389316,
315584,
211655,
66762,
66765,
159439,
256720,
253649,
339667,
366292,
385237,
164053,
266456,
340697,
317666,
411879,
177384,
211186,
337650,
194808,
353017,
205050,
379128,
388856,
393979,
395512,
425724,
425728,
388865,
356604,
388867,
162564,
388868,
388870,
374022,
208137,
343308,
136461,
249101,
338189,
153870,
347417,
150811,
259360,
311584,
342306,
334115,
201507,
52520,
248106,
273707,
325932,
341807,
201858,
328500,
388918,
255800,
388921,
388922,
377150,
250175,
388930,
384848,
134482,
339800,
253789,
341853,
253793,
246116,
211813,
357222,
431973,
251240,
253801,
385896,
253805,
21871,
151919,
1905,
260978,
1907,
243570,
337271,
249211,
189309,
299394,
420230,
43400,
373131,
349583,
215442,
355224,
1946,
1947,
355228,
321435,
1950,
393626,
1952,
355233,
1955,
1957,
178087,
1960,
1963,
222123,
258475,
355243,
305585,
235957,
1976,
201144,
398776,
326591,
329151,
344514,
432587,
1996,
1998,
373198,
184787,
338388,
380372,
2006,
363478,
2008,
45015,
2010,
2011,
262620,
319457,
208354,
241122,
416228,
380902,
164333,
347124,
247797,
411133
] |
84d7a56b4a748262f54f3f21193fa932018ad864 | 36d2e6d16c36349ff136b2ed37054e7f34431326 | /Kurrency/Modules/Main/Business Logic/MainInteractorInput.swift | 3d79cfb69be9a488fc81e564bf2d00f8b4068dc2 | [] | no_license | unniverzal/Kurrency | d10bf5a15c32475b3ceec4fbd6fdeacc218151f9 | 850813a62778fa2d76895863f3805b86af009d25 | refs/heads/master | 2021-01-01T05:56:00.216657 | 2017-08-21T20:06:37 | 2017-08-21T20:06:37 | 97,311,025 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 195 | swift | //
// MainMainInteractorInput.swift
// Kurrency
//
// Created by Ard Stavileci on 15/07/2017.
// Copyright © 2017 Ard Stavileci. All rights reserved.
//
protocol MainInteractorInput {
}
| [
-1
] |
8c23f7e8f0e7562eae0e501ed9a5b68f0096172f | d8a890408a77c1ee923d6d9813233cea5b03fded | /Test.playground/Pages/FPR.xcplaygroundpage/Contents.swift | e701349df49ba86327e8030156ba0fa64948a825 | [] | no_license | reloni/SwiftTestPlayground | d763137f1177dd0e996f8579f9bf461ad4701de5 | 07b58c3c6978d7b5c3eafdcff2bc86c39520af66 | refs/heads/master | 2020-03-23T15:26:06.102867 | 2019-11-22T16:56:48 | 2019-11-22T16:56:48 | 141,747,917 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 409 | swift | //: [Previous](@previous)
import Foundation
func square<T: Numeric>(_ value: T) -> T {
return value * value
}
func increment<T: Numeric>(_ value: T) -> T {
return value + 1
}
2 |> square |> increment
2 |> increment |> square
(increment >>> square)(2)
2 |> square >>> increment >>> String.init
[1, 2, 3, 4, 5].map(square >>> increment >>> String.init)
//2 |> increment |> square
55 |> square
| [
-1
] |
1ea83206b6dc507f09224dd4c221697b71f1c7fc | f1498fc3c1321d64b42d321b74e5fe3c94cf3b9f | /HuPOS/Assets.xcassets/ItemsTV.swift | 096faf82f4bade461f1226399e7e70437480d90b | [] | no_license | HuSoftSolutions/HuPOS-Repo | b463a862de0534be58f3fd9f69c3d215e1e713ea | 243be6c93db757755a264ae12593132ea6f9942d | refs/heads/master | 2021-08-07T04:48:09.683327 | 2018-07-23T22:43:55 | 2018-07-23T22:43:55 | 119,433,048 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,097 | swift | //
// ItemsTV.swift
// HuPOS
//
// Created by Cody Husek on 2/25/18.
// Copyright © 2018 HuSoft Solutions. All rights reserved.
//
import UIKit
class ItemsTV: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 0
}
/*
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
// Configure the cell...
return cell
}
*/
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// 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.
}
*/
}
| [
294401,
253315,
278662,
374286,
312591,
374289,
336148,
290330,
248990,
332323,
282918,
292141,
281139,
316725,
303542,
125110,
292155,
290167,
176710,
283465,
302924,
180690,
253309,
167390,
312673,
295784,
292333,
290158,
290159,
292337,
290162,
290163,
290164,
290165,
125175,
294525,
124670
] |
5f30178decbf886517af6c842f6099025bdcd860 | 54d608da8bea9c5e96fc229bbf97274ad2debc16 | /Modules/Settings/SettingsView.swift | bf34e1655abce7b15d2ca19b2fc8255f1747761a | [
"MIT"
] | permissive | danhenshaw/SettingsMock | a13f73caf4df2903bb993ca0c90ac5cc06534f15 | 490211fd7fb1f9f9866adf13649b6813ce4a0302 | refs/heads/master | 2020-05-20T22:54:29.158301 | 2019-05-09T12:24:02 | 2019-05-09T12:24:02 | 185,788,759 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,503 | swift | //
// SettingsView.swift
// Settings
//
// Created by Daniel Henshaw on 2/5/19.
// Copyright © 2019 Dan Henshaw. All rights reserved.
//
import UIKit
class SettingsView: UIView {
// MARK: - Properties
lazy var tableView : UITableView = {
let view = UITableView(frame: .zero, style: .grouped)
view.separatorStyle = .singleLine
view.separatorColor = .darkGray
view.estimatedRowHeight = UITableView.automaticDimension
view.rowHeight = UITableView.automaticDimension
view.separatorStyle = .singleLine
return view
}()
// MARK: - Initialiser
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
setupConstraints()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - View configuration
func setupView() {
addSubview(tableView)
}
func setupConstraints() {
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.topAnchor.constraint(equalTo: self.topAnchor, constant: 0).isActive = true
tableView.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: 0).isActive = true
tableView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 0).isActive = true
tableView.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: 0).isActive = true
}
}
| [
-1
] |
7accb6be0dd4c649379f89cea4bee6b6889f77ef | 80d7ea69a14073bfc9d874bf4256b32c23a878b5 | /Demo-Todoey(Swift)/Todoey/Data Model/Item.swift | bcc6825b89b7efbdefc862b8a1e62f5ff749fc76 | [] | no_license | GiorgiShukakidze/MyDemoProjects | 32a676a457ba29713ba8dd9fb8e97c8c24bf589b | 16118ca93fcfaea291ca808f2c55b6378fef4c54 | refs/heads/master | 2022-11-18T23:43:44.803723 | 2020-07-17T14:32:20 | 2020-07-17T14:32:20 | 256,189,635 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 412 | swift | //
// Item.swift
// Todoey
//
// Created by Giorgi Shukakidze on 2/26/20.
// Copyright © 2020 Giorgi Shukakidze. All rights reserved.
//
import Foundation
import RealmSwift
class Item: Object {
@objc dynamic var title: String = ""
@objc dynamic var isDone: Bool = false
@objc dynamic var dateCreated: Date?
var parentCategory = LinkingObjects(fromType: Category.self, property: "items")
}
| [
-1
] |
5ea804d46ad1104e562cc2806408222d1b1b2783 | 393777187467808aa4a7e6ed83348a91bd05e29b | /Caprice/ForwardApplication.swift | 14d250df3de790c806b6b8af0514ca80341b2e66 | [
"MIT"
] | permissive | jrBordet/Caprice | 30f4190099116ca253d7709c2f4448cc954e47c3 | bd8cd27b58e26322b1b679ff0c5d12fd45bd328e | refs/heads/master | 2023-02-18T19:08:52.821954 | 2021-01-17T10:24:04 | 2021-01-17T10:24:04 | 271,975,070 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 224 | swift | //
// ForwardApplication.swift
// Caprice
//
// Created by Jean Raphael Bordet on 13/06/2020.
//
import Foundation
infix operator |>: ForwardApplication
public func |> <A, B> (x: A, f: (A) -> B) -> B {
return f(x)
}
| [
-1
] |
fd02eda82da00da96e1567f3af670d470ae60fba | 6ec3f59f9ed1488ea9f7fa95ff5a82f4e1f86805 | /DataLayer/Stubs/StubBookingService.swift | 716b9c3ff85aeb56ba2476fb8f9cbe990492370f | [] | no_license | armanarutiunov/BikeSharing | b21e25354bac79416cdf91d8a7bd6065bf275e50 | 1542c87765b50b5b09acf87a1945b2210dd3c5b6 | refs/heads/master | 2021-09-10T20:07:46.861346 | 2018-04-01T10:42:07 | 2018-04-01T10:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,472 | swift | //
// StubBookingService.swift
// DataLayer
//
// Created by Arman Arutyunov on 22/03/2018.
// Copyright © 2018 Arman Arutyunov. All rights reserved.
//
import RxSwift
import ModelLayer
import Gloss
public class StubBookingService: BookingService {
let bookedBikeKey = "bookedBike"
let ridingBikeKey = "ridingBike"
public init() {}
public func bookBike(_ bike: Bike) -> Observable<Void> {
return Observable.just(0).map { [weak self] _ in
guard let `self` = self else { return }
var bike = bike
bike.bookingExpiration = Date().timeIntervalSince1970 + 600
self.saveBike(bike, key: self.bookedBikeKey)
}
}
public func getBookedBike() -> Observable<Bike?> {
return Observable.just(0).map { [weak self] _ -> Bike? in
guard let `self` = self else { return nil }
return self.getSavedBike(with: self.bookedBikeKey)
}
}
public func cancelBooking() -> Observable<Void> {
return Observable.just(0).map { _ in
UserDefaults.standard.removeObject(forKey: self.bookedBikeKey)
}
}
public func startRide(_ bike: Bike) -> Observable<Void> {
return Observable.just(0).map { [weak self] _ in
guard let `self` = self else { return }
UserDefaults.standard.removeObject(forKey: self.bookedBikeKey)
self.saveBike(bike, key: self.ridingBikeKey)
}
}
public func getRidingBike() -> Observable<Bike?> {
return Observable.just(0).map { [weak self] _ -> Bike? in
guard let `self` = self else { return nil }
return self.getSavedBike(with: self.ridingBikeKey)
}
}
public func endRide() -> Observable<Void> {
return Observable.just(0).map{ [weak self] _ in
guard let `self` = self else { return }
UserDefaults.standard.removeObject(forKey: self.ridingBikeKey)
}
}
// MARK: - Helper methods
private func saveBike(_ bike: Bike, key: String) {
let bikeJSON = bike.toJSON() ?? [:]
UserDefaults.standard.setValue(bikeJSON, forKey: key)
}
private func getSavedBike(with key: String) -> Bike? {
guard let bikeJSON = UserDefaults.standard.value(forKey: key) as? JSON else { return nil }
return Bike(json: bikeJSON)
}
}
extension Bike: Gloss.JSONEncodable {
public func toJSON() -> JSON? {
return jsonify([
"id" ~~> id,
"stationId" ~~> stationId,
"name" ~~> name,
"frameColor" ~~> frameColor,
"pin" ~~> pin,
"bookingExpiration" ~~> bookingExpiration,
])
}
}
extension Bike: Gloss.JSONDecodable {
public init?(json: JSON) {
guard
let id: Int = "id" <~~ json,
let stationId: Int = "stationId" <~~ json,
let name: String = "name" <~~ json,
let frameColor: String = "frameColor" <~~ json,
let pin: Int = "pin" <~~ json
else { return nil }
self.bookingExpiration = nil
if let bookingExpiration: TimeInterval? = "bookingExpiration" <~~ json {
self.bookingExpiration = bookingExpiration
}
self.id = id
self.stationId = stationId
self.name = name
self.frameColor = FrameColor(rawValue: frameColor)!
self.pin = pin
}
}
| [
-1
] |
11b8ea8084f910b877052c2632f9c93b85c768f6 | d5f2bb4470379bc1eadacb0a932f0673d3304788 | /Weather/Scene/Forecast/ForecastView/ForecastView.swift | e9bdacf1bf24314d62adc0ea319b4eb63c95ac98 | [] | no_license | real0x0000/Weather | e422996519a45cb1568c4c46c9bfb9f4cb289e25 | cc4e88c5b435615ebf428639f5edeb698b10d0c2 | refs/heads/master | 2022-06-27T03:24:57.364225 | 2020-04-21T17:33:39 | 2020-04-21T17:33:39 | 256,711,824 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,551 | swift | //
// ForecastView.swift
// Weather
//
// Created by Anuwat Sittichak on 20/4/2563 BE.
//
import UIKit
public class ForecastView: UIView {
private var contentView: UIView?
@IBOutlet var frameView: UIView!
@IBOutlet var dateLabel: UILabel!
@IBOutlet var timeLabel: UILabel!
@IBOutlet var imageView: UIImageView!
@IBOutlet var highLabel: UILabel!
@IBOutlet var lowLabel: UILabel!
override public init(frame: CGRect) {
super.init(frame: frame)
xibSetup()
}
required public init?(coder aCoder: NSCoder) {
super.init(coder: aCoder)
xibSetup()
}
private func xibSetup() {
let view = loadViewFromNib()
view.frame = bounds
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(view)
contentView = view
setupUI()
}
private func loadViewFromNib() -> UIView {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
guard let view = nib.instantiate(withOwner: self, options: nil).first as? UIView else {
return UIView()
}
return view
}
private func setupUI() {
}
func updateUI(date: String, time: String, iconUrl: URL?, high: Double, low: Double) {
dateLabel.text = date
timeLabel.text = time
imageView.setImage(with: iconUrl)
highLabel.text = "\(high)"
lowLabel.text = "\(low)"
}
}
| [
-1
] |
97a17b97998b8692278a8dd2185160184ec6f916 | 592ce2cca30a1b323d395bf1b4305cfe1d0111b3 | /Bluebird Heli/Model/Media.swift | 3db93fcf04094c75f98729ba634bd3d1eb12ccfd | [] | no_license | calkinssean/bluebirdHeli | b96633a7eba48d8325c8392d709597d290c9e2c3 | c9855ec840addd8aabe329e0bab84a1b4aaa69e0 | refs/heads/master | 2021-09-16T11:03:53.252918 | 2018-06-20T00:41:58 | 2018-06-20T00:41:58 | 111,600,869 | 0 | 1 | null | 2018-02-20T19:19:09 | 2017-11-21T21:00:07 | Swift | UTF-8 | Swift | false | false | 592 | swift | //
// Media.swift
// Bluebird Heli
//
// Created by Sean Calkins on 1/18/18.
// Copyright © 2018 Sean Calkins. All rights reserved.
//
import Foundation
struct Media {
init(url: String, dateString: String, date: Double, type: MediaType, data: Data) {
self.url = url
self.dateString = dateString
self.date = date
self.mediaType = type
self.data = data
}
var url: String
var dateString: String
var date: Double
var mediaType: MediaType
var data: Data?
}
enum MediaType {
case Video
case Image
}
| [
-1
] |
0f0b7668a36f23cff37045e7a9d1d77d5fe6108b | fa61d3483aa76d445ffbeaf139db93a75910623c | /HistoriasDelLaberinto/HistoriasDelLaberinto/domain/models/characters/StatusAilment.swift | a70206685f4e7e1b1d07dd116a77d7515f0cbae3 | [] | no_license | khsora34/historiasDelLaberinto | a04aabd4a579bad828b119fcb2735979de7d4019 | b44773cee2f26666519b7eb86d429e9bd9c58c0b | refs/heads/master | 2022-04-11T10:48:59.887138 | 2020-02-03T14:22:43 | 2020-02-03T14:22:43 | 112,364,753 | 0 | 0 | null | 2017-11-28T17:21:13 | 2017-11-28T17:09:03 | Swift | UTF-8 | Swift | false | false | 682 | swift | enum StatusAilment: String {
case poison
case paralysis
case blindness
var ailmentKey: String {
switch self {
case .poison:
return "statusAilmentPoison"
case .paralysis:
return "statusAilmentParalysis"
case .blindness:
return "statusAilmentBlindness"
}
}
}
extension StatusAilment: Decodable {}
struct InduceAilment: Decodable, Hashable {
let ailment: StatusAilment
let induceRate: Int
}
extension InduceAilment {
static func == (lhs: InduceAilment, rhs: InduceAilment) -> Bool {
return lhs.ailment == rhs.ailment && lhs.induceRate == rhs.induceRate
}
}
| [
-1
] |
e45a1ea2c6039b9fb52d4d81a9b63f0175a8226c | 3a827d10bae45931fa9aa76ac2d76716201db0bc | /Sources/xcode-find/Tools/CatchFailureTool.swift | 9a0742b5adb36f9404f91b31cea43346e21db735 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | yutailang0119/XCFindKit | 1b1332d9d992ae6703dbd74bf31dd08bec7fffb2 | dda2110a0df993fdb2a861e63988066772c93288 | refs/heads/master | 2021-08-08T09:19:31.420653 | 2021-07-09T13:33:31 | 2021-07-09T13:33:31 | 220,802,136 | 2 | 0 | null | 2021-03-21T13:38:43 | 2019-11-10T14:32:59 | Swift | UTF-8 | Swift | false | false | 302 | swift | import Foundation
struct CatchFailureTool: Tool {
private let reason: String
init(reason: String) {
self.reason = reason
}
func run() {
let description = """
xcode-find: error: \(reason)
"""
print(description)
HelpTool().run()
exit(1)
}
}
| [
-1
] |
6397f030d2bdb4b058064946d2908be11ffabaec | ec6ab98e1af0dc4919f299620bfc9df3ec1be1eb | /FlexibleNetworkLayer/Models/UsersList.swift | e899a0ae659f0e4e654e711cdce96e485cba34b4 | [] | no_license | IsaAliev/FlexibleNetworkLayer | b9d953516eeae15a414e8d16294179b2a193f288 | 201f054ca8facf4f97934364b2bcc510472b8568 | refs/heads/master | 2021-03-24T10:05:16.378269 | 2019-01-15T08:52:31 | 2019-01-15T08:52:31 | 122,159,364 | 11 | 2 | null | null | null | null | UTF-8 | Swift | false | false | 297 | swift | //
// UsersList.swift
// FlexibleNetworkLayer
//
// Created by Isa Aliev on 20.02.18.
// Copyright © 2018 IA. All rights reserved.
//
import Foundation
struct UsersList: Decodable {
var users: [User]
enum CodingKeys: String, CodingKey {
case users = "response"
}
}
| [
-1
] |
cb173145171fe7c1c6c014fe42c115bbf3736a20 | cce269a40fbd2e4bec9182bc606a4fd901d88efd | /SimularImagesSearch/Operation.swift | db381bd6de5638bdfd8e2735ce97010bb002801d | [] | no_license | sammy-SC/image-comparison | e7bad1f66a03f2a8499404a8ae2804579f9abdc2 | 8c6510b27c1e9eb5e4a04a42ae0b28a20d927742 | refs/heads/master | 2021-01-10T03:57:31.798401 | 2015-12-17T08:07:56 | 2015-12-17T08:07:56 | 47,881,882 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 787 | swift | //
// Operation.swift
// SimularImagesSearch
//
// Created by samuel susla on 12/12/15.
// Copyright © 2015 samuel susla. All rights reserved.
//
import Foundation
class Operation: NSOperation {
var result: Double?
// keep track of executing and finished states
private var _executing = false
private var _finished = false
override var executing: Bool {
return _executing
}
override var finished: Bool {
return _finished
}
func startExecuting() {
willChangeValueForKey("isExecuting")
_executing = true
didChangeValueForKey("isExecuting")
}
func finish() {
willChangeValueForKey("isExecuting")
willChangeValueForKey("isFinished")
_executing = false
_finished = true
didChangeValueForKey("isExecuting")
didChangeValueForKey("isFinished")
}
}
| [
-1
] |
cfe07d232a0238f4bf1a391494e2514f9cb69d78 | dbb6c521aaf79a38e3b65a82edd20dfc979849e6 | /FaceIt/BlinkingFaceViewController.swift | 1688aa049c0736a5cf1d1933c672fed056c7742b | [] | no_license | tarunbhutani/FaceIt | 2b83478f00da158be4ccdfe375ac43877602bc02 | a5d556733b89242f1544c91de232892e51c07c5c | refs/heads/master | 2020-03-26T04:44:15.519577 | 2018-08-29T08:46:11 | 2018-08-29T08:46:11 | 144,520,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,222 | swift | //
// BlinkingFaceViewController.swift
// FaceIt
//
// Created by InSynchro M SDN BHD on 27/08/2018.
// Copyright © 2018 Tarun Bhutani. All rights reserved.
//
import UIKit
class BlinkingFaceViewController: FaceViewController {
private struct BlinkRate {
static let closedDuration = 0.4
static let openDuration = 2.5
}
var blinking:Bool = false {
didSet{
startBlink()
}
}
@objc func startBlink(){
if blinking{
faceView.eyesOpen = false
Timer.scheduledTimer(timeInterval: BlinkRate.closedDuration, target: self, selector: #selector(BlinkingFaceViewController.endBlink), userInfo: nil, repeats: false)
}
}
@objc func endBlink() {
faceView.eyesOpen = true
Timer.scheduledTimer(timeInterval: BlinkRate.openDuration, target: self, selector: #selector(BlinkingFaceViewController.startBlink), userInfo: nil, repeats: false)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
blinking = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
blinking = false
}
}
| [
-1
] |
d75e1abfec25f0dd94056027283e44cd83ee6fe9 | 9bb118d9d56314bd474568899c7df7a58aa3ba03 | /HideAndSeek/Controllers/ViewControllers/CatchHiderViewController.swift | c4e3476de392c898e87d8a4c14afa275504b0071 | [] | no_license | jonathanary/HideSeekGame | f8b4e8e7ee9e03b015c9b650e1a3bd6de2fc643b | 1b75683b5b8091677ff705dc93213bdff7b88dc6 | refs/heads/master | 2020-08-23T01:37:49.530759 | 2019-10-21T10:09:21 | 2019-10-21T10:09:21 | 216,516,634 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,194 | swift | //
// CatchHiderViewController.swift
// HideAndSeek
//
// Created by Jonathan on 2019. 02. 26..
// Copyright © 2019. Jonathan. All rights reserved.
//
import UIKit
import CoreLocation
class CatchHiderViewController: UIViewController, Storyboarded, CLLocationManagerDelegate {
weak var coordinator: MainCoordinator?
let backgroundColor = BackgoundColorProvider()
var hider = ""
var locationManager: CLLocationManager?
@IBOutlet var hidersColorOutlet: UIImageView!
@IBOutlet var messageLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
assert(coordinator != nil, "You must set a coordinator before presenting this view controller.")
setup()
}
func setup() {
locationManager = CLLocationManager.init()
locationManager?.delegate = self
locationManager?.requestWhenInUseAuthorization()
startScanningForBeaconRegion(beaconRegion: getBeaconRegion())
hidersColorOutlet.backgroundColor = backgroundColor.randomColor()
hidersColorOutlet.alpha = 0
}
override func viewWillDisappear(_ animated: Bool) {
super.viewDidDisappear(true)
self.hider = ""
}
func getBeaconRegion() -> CLBeaconRegion? {
guard let proximityUUID = Player.proximityUUID else { return nil }
let beaconRegion = CLBeaconRegion.init(
proximityUUID: proximityUUID,
major: CodeTrimmers.setMajor(with: hider),
identifier: self.hider)
return beaconRegion
}
func startScanningForBeaconRegion(beaconRegion: CLBeaconRegion?) {
guard let region = beaconRegion else { return }
locationManager?.startMonitoring(for: region)
locationManager?.startRangingBeacons(in: region)
}
// Delegate Methods for tracking beacons and changing the view
fileprivate func changeViewByProximity(_ beacon: CLBeacon) {
switch beacon.proximity {
case .unknown:
self.hidersColorOutlet.alpha = 0
self.messageLabel.textColor = .darkGray
self.messageLabel.text = "\(hider) is too far, or closed the app"
case .immediate:
self.hidersColorOutlet.alpha = 1
self.messageLabel.textColor = .white
self.messageLabel.text = "\(hider) is here."
case .near:
self.hidersColorOutlet.alpha = 0.6
self.messageLabel.textColor = .white
self.messageLabel.text = "\(hider) is very close."
case .far:
self.hidersColorOutlet.alpha = 0.3
self.messageLabel.textColor = .gray
self.messageLabel.text = "\(hider) is in range."
@unknown default:
fatalError()
}
}
}
extension CatchHiderViewController {
func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
if beacons.count > 0 {
print("beacons found")
for beacon in beacons {
print(String(describing: beacon.accuracy))
changeViewByProximity(beacon)
}
} else {
print("no hiders in range")
}
print("Ranging")
}
}
| [
-1
] |
5898ce7402e092e1c9580d0fbe482f191eb85e13 | fab8b5ecfe889985bb85f21c90e08eb921929b7f | /ios/Classes/SwiftNativeContactDialogPlugin.swift | ae577805e9c090c161dba3cbd0df7f1dd0d5cd6e | [
"MIT"
] | permissive | miok/flutter_native_contact_dialog | f2fed96d9efa9978eff7733f4a56b3d6e48a2f92 | 6001799a9ebb824cf7e8f70da6d62a4c9f359493 | refs/heads/master | 2020-09-15T21:12:51.139100 | 2019-10-11T12:15:10 | 2019-10-11T12:15:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,549 | swift | import Flutter
import UIKit
import Contacts
@available(iOS 9, *)
public class SwiftNativeContactDialogPlugin: NSObject, FlutterPlugin {
private let flutterVC: UIViewController;
private var addContactSession: ContactViewDelegate?;
init(withViewController viewController: UIViewController) {
self.flutterVC = viewController;
}
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "github.com.afulton11.plugins/native_contact_dialog", binaryMessenger: registrar.messenger())
let viewController: UIViewController = UIApplication.shared.delegate!.window!!.rootViewController!;
let instance = SwiftNativeContactDialogPlugin(withViewController: viewController)
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch (call.method) {
case "addContact":
let contact = dictionaryToContact(dictionary: call.arguments as! [String : Any]);
launchContactVC(withResult: result, forNewContact: contact);
break;
default:
result(FlutterMethodNotImplemented)
}
}
func launchContactVC(withResult result: FlutterResult, forNewContact contact: CNContact)
{
self.addContactSession = ContactViewDelegate(withResult: result, withNewContact: contact);
self.addContactSession!.didFinish = { [weak self] in
self?.addContactSession = nil;
}
let controller = UINavigationController(rootViewController: self.addContactSession!.contactViewController);
self.flutterVC.present(controller, animated: true, completion: nil)
}
func dictionaryToContact(dictionary : [String:Any]) -> CNMutableContact{
let contact = CNMutableContact()
//Simple fields
contact.givenName = dictionary["givenName"] as? String ?? ""
contact.familyName = dictionary["familyName"] as? String ?? ""
contact.middleName = dictionary["middleName"] as? String ?? ""
contact.namePrefix = dictionary["prefix"] as? String ?? ""
contact.nameSuffix = dictionary["suffix"] as? String ?? ""
contact.organizationName = dictionary["company"] as? String ?? ""
contact.jobTitle = dictionary["jobTitle"] as? String ?? ""
if let avatarData = (dictionary["avatar"] as? FlutterStandardTypedData)?.data {
contact.imageData = avatarData
}
//Phone numbers
if let phoneNumbers = dictionary["phones"] as? [[String:String]]{
for phone in phoneNumbers where phone["value"] != nil {
contact.phoneNumbers.append(
CNLabeledValue(
label: getPhoneLabel(
label: phone["label"]),
value: CNPhoneNumber(stringValue: phone["value"]!)))
}
}
//Emails
if let emails = dictionary["emails"] as? [[String:String]]{
for email in emails where nil != email["value"] {
let emailLabel = email["label"] ?? ""
contact.emailAddresses.append(CNLabeledValue(label:emailLabel, value:email["value"]! as NSString))
}
}
//Postal addresses
if let postalAddresses = dictionary["postalAddresses"] as? [[String:String]]{
for postalAddress in postalAddresses {
let newAddress = CNMutablePostalAddress()
newAddress.street = postalAddress["street"] ?? ""
newAddress.city = postalAddress["city"] ?? ""
newAddress.postalCode = postalAddress["postcode"] ?? ""
newAddress.country = postalAddress["country"] ?? ""
newAddress.state = postalAddress["region"] ?? ""
let label = postalAddress["label"] ?? ""
contact.postalAddresses.append(CNLabeledValue(label:label, value:newAddress))
}
}
return contact
}
func contactToDictionary(contact: CNContact) -> [String:Any]{
var result = [String:Any]()
//Simple fields
result["identifier"] = contact.identifier
result["displayName"] = CNContactFormatter.string(from: contact, style: CNContactFormatterStyle.fullName)
result["givenName"] = contact.givenName
result["familyName"] = contact.familyName
result["middleName"] = contact.middleName
result["prefix"] = contact.namePrefix
result["suffix"] = contact.nameSuffix
result["company"] = contact.organizationName
result["jobTitle"] = contact.jobTitle
if contact.isKeyAvailable(CNContactThumbnailImageDataKey) {
if let avatarData = contact.thumbnailImageData {
result["avatar"] = FlutterStandardTypedData(bytes: avatarData)
}
}
//Phone numbers
var phoneNumbers = [[String:String]]()
for phone in contact.phoneNumbers{
var phoneDictionary = [String:String]()
phoneDictionary["value"] = phone.value.stringValue
phoneDictionary["label"] = "other"
if let label = phone.label{
phoneDictionary["label"] = CNLabeledValue<NSString>.localizedString(forLabel: label)
}
phoneNumbers.append(phoneDictionary)
}
result["phones"] = phoneNumbers
//Emails
var emailAddresses = [[String:String]]()
for email in contact.emailAddresses{
var emailDictionary = [String:String]()
emailDictionary["value"] = String(email.value)
emailDictionary["label"] = "other"
if let label = email.label{
emailDictionary["label"] = CNLabeledValue<NSString>.localizedString(forLabel: label)
}
emailAddresses.append(emailDictionary)
}
result["emails"] = emailAddresses
//Postal addresses
var postalAddresses = [[String:String]]()
for address in contact.postalAddresses{
var addressDictionary = [String:String]()
addressDictionary["label"] = ""
if let label = address.label{
addressDictionary["label"] = CNLabeledValue<NSString>.localizedString(forLabel: label)
}
addressDictionary["street"] = address.value.street
addressDictionary["city"] = address.value.city
addressDictionary["postcode"] = address.value.postalCode
addressDictionary["region"] = address.value.state
addressDictionary["country"] = address.value.country
postalAddresses.append(addressDictionary)
}
result["postalAddresses"] = postalAddresses
return result
}
func getPhoneLabel(label: String?) -> String{
let labelValue = label ?? ""
switch(labelValue){
case "main": return CNLabelPhoneNumberMain
case "mobile": return CNLabelPhoneNumberMobile
case "iPhone": return CNLabelPhoneNumberiPhone
default: return labelValue
}
}
}
| [
-1
] |
040c675f79f09b49484b0c94af99e5972cf84f98 | 9f519356c874e13f75206fc3880873364184652c | /Concentration/ConcentrationTests/ConcentrationTests.swift | 012c472526dd894e43742ef7fbf7ad1543cede91 | [] | no_license | Idonotwantwin/StanFord-lecture-1 | b63c1b267f9ae281aabaa73c09f54991e068fba6 | de77e39de48047821e2c6e11b31989cb6ef67156 | refs/heads/master | 2021-08-17T14:47:34.562336 | 2017-11-21T08:12:48 | 2017-11-21T08:12:48 | 111,518,346 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 994 | swift | //
// ConcentrationTests.swift
// ConcentrationTests
//
// Created by LI RUNFENG on 21/11/2017.
// Copyright © 2017 LI RUNFENG. All rights reserved.
//
import XCTest
@testable import Concentration
class ConcentrationTests: 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.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
333828,
282633,
313357,
182296,
317467,
241692,
98333,
239650,
16419,
102437,
229413,
292902,
204840,
354345,
223274,
278570,
344107,
233517,
354343,
253999,
124975,
229424,
346162,
227370,
229430,
319542,
124984,
358456,
213052,
288828,
288833,
288834,
286788,
352326,
254027,
311372,
311374,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
180311,
180312,
315487,
237663,
45153,
309345,
280675,
227428,
280677,
307301,
313447,
307299,
329829,
131178,
194666,
278634,
315498,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
131191,
237689,
288889,
292988,
215164,
313469,
215166,
278655,
292992,
333955,
194691,
227460,
280712,
215178,
235662,
241808,
323729,
325776,
317587,
306542,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
184484,
333991,
333992,
233642,
284842,
32941,
278704,
239793,
323762,
299187,
278708,
125109,
131256,
182456,
295098,
278714,
184505,
280762,
299198,
379071,
227513,
223419,
280768,
299203,
301251,
309444,
227524,
338119,
299209,
282831,
321745,
286202,
254170,
301279,
356576,
317664,
280802,
338150,
176362,
321772,
286958,
125169,
338164,
327929,
184570,
227578,
243962,
125183,
309503,
184575,
125188,
184584,
313608,
125193,
375051,
180493,
125198,
278797,
325905,
254226,
125203,
319763,
125208,
325912,
309529,
299293,
278816,
125217,
233762,
211235,
217380,
305440,
227616,
151847,
282919,
211238,
98610,
125235,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
287043,
332101,
182598,
227654,
323916,
319821,
254286,
348492,
250192,
6481,
323920,
344401,
348500,
366929,
155990,
366930,
289110,
6489,
272729,
379225,
278869,
106847,
323935,
391520,
321894,
280939,
242029,
246127,
242033,
354676,
199029,
139640,
246136,
246137,
291192,
362881,
248194,
225670,
395659,
227725,
395661,
240016,
178582,
190871,
291224,
293274,
317852,
283038,
61857,
285090,
381347,
61859,
289189,
246178,
375207,
289194,
108972,
340398,
377264,
299441,
61873,
61880,
283064,
278970,
319930,
336317,
293310,
299456,
291265,
278978,
127427,
127428,
283075,
291267,
188871,
324039,
317901,
373197,
278989,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
227809,
342498,
242148,
195045,
279013,
279018,
281072,
279029,
293367,
279032,
233978,
279039,
301571,
291333,
342536,
287241,
279050,
340490,
283153,
230499,
303636,
279062,
289304,
279065,
342553,
291358,
182817,
375333,
377386,
293419,
244269,
283182,
283184,
23092,
234036,
315960,
338490,
352829,
301638,
348742,
293448,
322120,
55881,
348749,
281166,
281171,
244310,
354911,
436832,
295519,
66150,
111208,
344680,
191082,
279146,
313966,
281199,
295536,
287346,
287352,
301689,
279164,
291454,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
311949,
330387,
330388,
352917,
227990,
117397,
230040,
271000,
289434,
342682,
295576,
221852,
279206,
295590,
287404,
205487,
295599,
303793,
299699,
299700,
164533,
338613,
293556,
314040,
287417,
158394,
342713,
285373,
287422,
66242,
287433,
363211,
154316,
287439,
242386,
279252,
287452,
318173,
289502,
363230,
299746,
295652,
338662,
285415,
234217,
346858,
330474,
230125,
289518,
299759,
312047,
125684,
199414,
154359,
230134,
221948,
35583,
205568,
291585,
295682,
162561,
299776,
363263,
285444,
242433,
291592,
322319,
295697,
285458,
291604,
166676,
207640,
326429,
336671,
326433,
344865,
281377,
283430,
279336,
289576,
318250,
295724,
152365,
312108,
285487,
318252,
295729,
353069,
328499,
164656,
242485,
353078,
230199,
353079,
285497,
293693,
336702,
160575,
295744,
295746,
420677,
353094,
353095,
299849,
283467,
293711,
201551,
281427,
353109,
281433,
230234,
301918,
242529,
293730,
303972,
351077,
279397,
275303,
342887,
230248,
201577,
242541,
246641,
330609,
310131,
207732,
209783,
246648,
209785,
269178,
177019,
279417,
361337,
314239,
291712,
254850,
359298,
113542,
240518,
287622,
228233,
228234,
308107,
295824,
308112,
56208,
293781,
209817,
324506,
324507,
318364,
289698,
310178,
189348,
324517,
283558,
289703,
310182,
293800,
353195,
140204,
353197,
189374,
289727,
353216,
349121,
363458,
213960,
279498,
316364,
338899,
304087,
340955,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
52200,
123881,
324586,
203757,
289774,
183279,
304110,
320494,
340974,
287731,
320493,
316405,
240630,
295927,
201720,
304122,
314362,
320507,
328700,
293886,
328706,
320516,
230410,
330763,
320527,
146448,
324625,
316437,
140310,
418837,
320536,
197657,
281626,
201755,
336929,
189474,
300068,
357414,
248872,
345132,
238639,
252980,
300084,
322612,
359478,
324666,
238651,
302139,
21569,
359495,
238664,
300111,
314448,
341073,
296019,
353367,
156764,
156765,
304222,
113760,
302177,
314467,
281700,
250981,
285798,
322663,
300136,
316520,
228458,
207979,
281706,
300135,
316526,
357486,
144496,
187506,
353397,
291959,
300151,
160891,
341115,
363644,
282318,
300158,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
330888,
228491,
228493,
285838,
169104,
162961,
177296,
347283,
308372,
185493,
296086,
326804,
283802,
119962,
300187,
296092,
300188,
339102,
302240,
306338,
343203,
300201,
300202,
253099,
282327,
238765,
279728,
367799,
294074,
339130,
230588,
64700,
208058,
322749,
228542,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
283852,
244940,
283853,
290000,
228563,
189652,
279765,
316627,
296153,
357595,
279774,
298208,
310497,
298212,
298213,
304356,
290022,
330984,
228588,
298221,
234733,
253167,
279792,
353523,
298228,
292085,
234742,
292091,
216315,
208124,
316669,
363771,
388349,
228609,
234755,
279814,
322824,
242954,
292107,
312587,
328971,
251153,
245019,
320796,
126237,
130338,
130343,
286423,
351537,
298291,
345396,
300343,
116026,
222524,
333117,
286018,
193859,
279875,
304456,
230729,
294218,
224586,
372043,
177484,
251213,
234831,
238927,
296273,
120148,
318805,
283991,
357719,
222559,
314720,
234850,
292195,
230756,
294243,
333160,
134506,
230765,
284014,
296303,
279920,
243056,
312689,
296307,
314739,
116084,
327025,
327031,
327024,
111993,
306559,
148867,
179587,
378244,
298374,
314758,
314760,
388487,
142729,
368011,
296329,
314766,
296335,
112017,
234898,
112018,
306579,
9619,
224661,
282007,
357786,
318875,
290207,
314783,
333220,
314789,
279974,
310692,
282024,
241066,
316842,
310701,
286129,
173491,
286132,
210358,
284089,
292283,
228795,
302529,
302531,
163268,
380357,
415171,
300487,
296392,
361927,
300489,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
284107,
222675,
306639,
366037,
210390,
210391,
353750,
210393,
329173,
228827,
286172,
280032,
144867,
310757,
187878,
316902,
280041,
361963,
54765,
191981,
321009,
251378,
333300,
191990,
300535,
300536,
343542,
280055,
288249,
290300,
343543,
286205,
290301,
333303,
230913,
282114,
210433,
228867,
366083,
296448,
300542,
323080,
230921,
329225,
253452,
296461,
323087,
304656,
329232,
316946,
146964,
398869,
308756,
282136,
308764,
349726,
230943,
333343,
282146,
306723,
286244,
245287,
245292,
349741,
169518,
230959,
286254,
288309,
290358,
194110,
235070,
288318,
280130,
349763,
196164,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
228943,
333393,
280147,
290390,
235095,
300630,
306776,
196187,
239198,
343647,
333408,
157281,
286306,
300644,
282213,
374372,
317032,
323178,
54893,
138863,
222832,
314998,
247416,
366203,
175741,
325245,
235135,
337535,
294529,
224901,
282245,
282246,
288392,
229001,
286343,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
298654,
333470,
282271,
255649,
282273,
245412,
229029,
298661,
212646,
40613,
40614,
40615,
282280,
323236,
282276,
290471,
321207,
296632,
286391,
319162,
280251,
282303,
286399,
280257,
218819,
321219,
282312,
306890,
280267,
302797,
212685,
333517,
9936,
212688,
302802,
333520,
241361,
245457,
333521,
333523,
280280,
278233,
18138,
280278,
298712,
278234,
294622,
321247,
298720,
278240,
282339,
153319,
12010,
288491,
212716,
212717,
280300,
282348,
284401,
282355,
282358,
313081,
229113,
286459,
325371,
124669,
194303,
278272,
282369,
175873,
319233,
323331,
323332,
288512,
311042,
280327,
280329,
282378,
284429,
284431,
278291,
278293,
294678,
282391,
321302,
366360,
169754,
116505,
249626,
284442,
325404,
321310,
282400,
241441,
325410,
339745,
341796,
247590,
257830,
282409,
333610,
294700,
317232,
282417,
200498,
296755,
280372,
321337,
282427,
280380,
360252,
345919,
325439,
315202,
307011,
282434,
282438,
280392,
345929,
341836,
323406,
325457,
304977,
18262,
216918,
370522,
188251,
280410,
345951,
237408,
362337,
284514,
345955,
284512,
296806,
276327,
292712,
282474,
288619,
325484,
288620,
280430,
296814,
292720,
362352,
282480,
313203,
325492,
300918,
241528,
317304,
194429,
124798,
325503,
182144,
305026,
241540,
253829,
333701,
67463,
282504,
243591,
325515,
243597,
325518,
110480,
282518,
282519,
124824,
214937,
214938,
329622,
294807,
298909,
118685,
294809,
319392,
241365,
294814,
300963,
292771,
354212,
294823,
333735,
284587,
124852,
243637,
282549,
288697,
290746,
294843,
214977,
294850,
163781,
214984,
151497,
284619,
344013,
247757,
301008,
153554,
212946,
24532,
219101,
280541,
329695,
298980,
292837,
292836,
317415,
294886,
337895,
247785,
253929,
296941,
327661,
278512,
362480,
311281,
325619,
282612,
333817,
313339
] |
48a24728fc9c91bfcf89ceafcfff50db1d1910fc | 8595eeaa5207220714947047f1a12d011fa670e4 | /prototypes/scrollable-collection-view/scrollable-collection-viewTests/scrollable_collection_viewTests.swift | b438311193fb467b6fbea779e9aca9cbdca2d764 | [] | no_license | Sharrp/monnaie | a7230b03e79de070915d91fcbb15d5a182e50e2c | f6ba9ad55b54ca23b00c180e43d0a67f2804a610 | refs/heads/master | 2020-03-15T20:22:09.880863 | 2018-12-13T14:12:56 | 2018-12-13T14:12:56 | 132,331,034 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 987 | swift | //
// scrollable_collection_viewTests.swift
// scrollable-collection-viewTests
//
// Created by Anton Vronskii on 2018/11/23.
// Copyright © 2018 Anton Vronskii. All rights reserved.
//
import XCTest
@testable import scrollable_collection_view
class scrollable_collection_viewTests: 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.
}
}
}
| [
282633,
313357,
182296,
241692,
98333,
16419,
102437,
229413,
292902,
204840,
354345,
223274,
278570,
344107,
233517,
124975,
253999,
346162,
229430,
319542,
124984,
358456,
288833,
352326,
311372,
354385,
196691,
315476,
280661,
329814,
278615,
338007,
307289,
200794,
354393,
309345,
280675,
280677,
313447,
278634,
315498,
319598,
288879,
352368,
299121,
284788,
233589,
280694,
333940,
237689,
215164,
313469,
215166,
278655,
292992,
333955,
280712,
215178,
241808,
323729,
325776,
317587,
278677,
284826,
278685,
346271,
311458,
278691,
49316,
233636,
333991,
333992,
284842,
32941,
278704,
239793,
278708,
125109,
131256,
182456,
184505,
299198,
379071,
299203,
301251,
309444,
338119,
282831,
321745,
254170,
356576,
338150,
176362,
286958,
125169,
338164,
327929,
184570,
243962,
125183,
309503,
125188,
313608,
125193,
375051,
180493,
125198,
325905,
254226,
125203,
125208,
325912,
299293,
278816,
125217,
233762,
211235,
217380,
305440,
151847,
282919,
125235,
332085,
280887,
125240,
332089,
278842,
282939,
315706,
287041,
241986,
260418,
332101,
182598,
323916,
319821,
254286,
348492,
250192,
6481,
323920,
344401,
348500,
366929,
155990,
366930,
6489,
272729,
379225,
106847,
323935,
391520,
321894,
280939,
242029,
246127,
354676,
139640,
246136,
246137,
291192,
362881,
248194,
225670,
395659,
227725,
395661,
240016,
291224,
317852,
283038,
61857,
285090,
61859,
289189,
375207,
340398,
377264,
61873,
61880,
283064,
278970,
319930,
336317,
293310,
278978,
127427,
127428,
283075,
188871,
324039,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
285150,
287198,
279008,
342498,
242148,
195045,
279013,
279018,
281072,
279029,
279032,
233978,
279039,
342536,
287241,
279050,
340490,
289304,
279065,
342553,
291358,
182817,
375333,
377386,
283184,
23092,
315960,
352829,
301638,
348742,
322120,
55881,
348749,
281166,
244310,
354911,
436832,
66150,
111208,
344680,
191082,
313966,
281199,
279164,
189057,
311941,
348806,
279177,
369289,
330379,
344715,
184973,
311949,
330387,
330388,
352917,
227990,
230040,
271000,
342682,
279206,
295590,
287404,
303793,
299699,
299700,
164533,
338613,
314040,
287417,
158394,
342713,
285373,
66242,
363211,
279252,
318173,
289502,
363230,
295652,
338662,
285415,
346858,
289518,
199414,
154359,
35583,
205568,
162561,
299776,
363263,
285444,
322319,
166676,
207640,
326429,
336671,
326433,
344865,
279336,
318250,
295724,
152365,
312108,
318252,
353069,
328499,
242485,
353078,
230199,
353079,
336702,
420677,
353094,
353095,
299849,
283467,
293711,
281427,
353109,
281433,
230234,
293730,
303972,
351077,
275303,
342887,
242541,
246641,
330609,
246648,
209785,
269178,
177019,
279417,
361337,
254850,
359298,
240518,
287622,
228233,
228234,
308107,
56208,
295824,
308112,
209817,
324506,
324507,
318364,
189348,
324517,
289703,
353195,
140204,
353197,
353216,
349121,
363458,
213960,
279498,
316364,
338899,
340955,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
123881,
324586,
289774,
304110,
320494,
340974,
316405,
240630,
295927,
201720,
304122,
314362,
320507,
328700,
328706,
320516,
230410,
320527,
146448,
324625,
316437,
418837,
197657,
281626,
201755,
336929,
300068,
357414,
248872,
345132,
238639,
252980,
300084,
322612,
359478,
324666,
238651,
302139,
21569,
359495,
238664,
300111,
314448,
341073,
353367,
156764,
156765,
314467,
281700,
250981,
322663,
300136,
316520,
228458,
207979,
316526,
357486,
187506,
353397,
160891,
341115,
363644,
150657,
187521,
248961,
349316,
279685,
349318,
222343,
228491,
228493,
285838,
169104,
162961,
177296,
308372,
326804,
296086,
119962,
300187,
296092,
300188,
339102,
302240,
343203,
300201,
300202,
253099,
238765,
279728,
367799,
339130,
64700,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
244940,
283852,
283853,
290000,
228563,
296153,
357595,
279774,
298212,
304356,
330984,
228588,
234733,
253167,
279792,
353523,
298228,
216315,
208124,
316669,
363771,
388349,
228609,
279814,
322824,
242954,
292107,
312587,
328971,
251153,
245019,
320796,
126237,
130338,
130343,
351537,
345396,
300343,
116026,
222524,
286018,
193859,
279875,
230729,
224586,
372043,
177484,
251213,
238927,
296273,
120148,
318805,
283991,
222559,
314720,
292195,
230756,
294243,
333160,
230765,
243056,
279920,
312689,
314739,
116084,
327025,
327031,
306559,
378244,
298374,
314758,
314760,
388487,
368011,
314766,
296335,
112017,
112018,
234898,
306579,
282007,
357786,
290207,
314783,
333220,
314789,
279974,
282024,
241066,
316842,
286129,
173491,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
361927,
300489,
370123,
148940,
280013,
310732,
64975,
312782,
327121,
222675,
366037,
210390,
210391,
353750,
210393,
228827,
286172,
310757,
187878,
280041,
361963,
54765,
191981,
321009,
251378,
343542,
280055,
300536,
288249,
343543,
286205,
290301,
210433,
282114,
228867,
366083,
323080,
230921,
253452,
323087,
304656,
329232,
316946,
146964,
398869,
308764,
349726,
282146,
306723,
245287,
245292,
349741,
169518,
230959,
286254,
288309,
290358,
235070,
288318,
349763,
124485,
56902,
288326,
288327,
292425,
243274,
128587,
333388,
333393,
290390,
235095,
300630,
196187,
343647,
374372,
282213,
323178,
54893,
138863,
222832,
314998,
247416,
366203,
175741,
337535,
294529,
224901,
282245,
282246,
288392,
229001,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
255649,
245412,
40613,
40614,
40615,
229029,
282280,
298661,
323236,
321207,
296632,
319162,
280251,
282303,
286399,
218819,
321219,
306890,
280267,
212685,
333517,
333520,
241361,
245457,
302802,
333521,
333523,
280278,
280280,
298712,
18138,
278234,
294622,
321247,
278240,
12010,
212716,
212717,
280300,
282348,
284401,
282358,
313081,
286459,
325371,
124669,
194303,
278272,
175873,
319233,
323331,
323332,
280329,
284429,
278291,
294678,
321302,
366360,
116505,
249626,
284442,
325404,
321310,
282400,
241441,
325410,
339745,
341796,
247590,
257830,
317232,
282417,
321337,
282427,
360252,
325439,
315202,
307011,
345929,
341836,
325457,
18262,
370522,
188251,
345951,
362337,
284514,
345955,
296806,
292712,
288619,
325484,
292720,
362352,
313203,
325492,
241528,
194429,
124798,
325503,
182144,
305026,
253829,
333701,
67463,
243591,
243597,
325518,
282518,
282519,
124824,
214937,
329622,
118685,
298909,
319392,
292771,
354212,
294823,
333735,
284587,
124852,
243637,
288697,
214977,
163781,
247757,
344013,
212946,
219101,
280541,
292836,
298980,
294886,
337895,
247785,
253929,
327661,
362480,
325619,
333817,
313339
] |
3965c1280acda44ca6d4188f986a1757477b6a02 | 626d707466d4e67ccd4fe5c0c291a90ce7a9dd77 | /ReactiveCocoaTests/Swift/SignalSpec.swift | c84b38e02ef61b0410abaf28ceb9bdf688620660 | [
"MIT"
] | permissive | beni55/ReactiveCocoa | 0b4ca36c38cb97870d800890849305e923dfc69a | 43d7d545f87ff5f503587a35f987cc92d02a5d96 | refs/heads/master | 2017-05-03T02:33:05.615307 | 2015-09-14T13:21:55 | 2015-09-14T13:21:55 | 42,449,760 | 0 | 0 | null | 2015-09-14T13:21:55 | 2015-09-14T13:19:51 | Objective-C | UTF-8 | Swift | false | false | 41,455 | swift | //
// SignalSpec.swift
// ReactiveCocoa
//
// Created by Justin Spahr-Summers on 2015-01-23.
// Copyright (c) 2015 GitHub. All rights reserved.
//
import Result
import Nimble
import Quick
import ReactiveCocoa
class SignalSpec: QuickSpec {
override func spec() {
describe("init") {
var testScheduler: TestScheduler!
beforeEach {
testScheduler = TestScheduler()
}
it("should run the generator immediately") {
var didRunGenerator = false
Signal<AnyObject, NoError> { observer in
didRunGenerator = true
return nil
}
expect(didRunGenerator).to(beTruthy())
}
it("should not keep signal alive indefinitely") {
weak var signal: Signal<AnyObject, NoError>? = Signal.never
expect(signal).to(beNil())
}
it("should deallocate after erroring") {
weak var signal: Signal<AnyObject, TestError>? = Signal { observer in
testScheduler.schedule {
sendError(observer, TestError.Default)
}
return nil
}
var errored = false
signal?.observe(error: { _ in errored = true })
expect(errored).to(beFalsy())
expect(signal).toNot(beNil())
testScheduler.run()
expect(errored).to(beTruthy())
expect(signal).to(beNil())
}
it("should deallocate after completing") {
weak var signal: Signal<AnyObject, NoError>? = Signal { observer in
testScheduler.schedule {
sendCompleted(observer)
}
return nil
}
var completed = false
signal?.observe(completed: { completed = true })
expect(completed).to(beFalsy())
expect(signal).toNot(beNil())
testScheduler.run()
expect(completed).to(beTruthy())
expect(signal).to(beNil())
}
it("should deallocate after interrupting") {
weak var signal: Signal<AnyObject, NoError>? = Signal { observer in
testScheduler.schedule {
sendInterrupted(observer)
}
return nil
}
var interrupted = false
signal?.observe(interrupted: { interrupted = true })
expect(interrupted).to(beFalsy())
expect(signal).toNot(beNil())
testScheduler.run()
expect(interrupted).to(beTruthy())
expect(signal).to(beNil())
}
it("should forward events to observers") {
let numbers = [ 1, 2, 5 ]
let signal: Signal<Int, NoError> = Signal { observer in
testScheduler.schedule {
for number in numbers {
sendNext(observer, number)
}
sendCompleted(observer)
}
return nil
}
var fromSignal: [Int] = []
var completed = false
signal.observe(next: { number in
fromSignal.append(number)
}, completed: {
completed = true
})
expect(completed).to(beFalsy())
expect(fromSignal).to(beEmpty())
testScheduler.run()
expect(completed).to(beTruthy())
expect(fromSignal).to(equal(numbers))
}
it("should dispose of returned disposable upon error") {
let disposable = SimpleDisposable()
let signal: Signal<AnyObject, TestError> = Signal { observer in
testScheduler.schedule {
sendError(observer, TestError.Default)
}
return disposable
}
var errored = false
signal.observe(error: { _ in errored = true })
expect(errored).to(beFalsy())
expect(disposable.disposed).to(beFalsy())
testScheduler.run()
expect(errored).to(beTruthy())
expect(disposable.disposed).to(beTruthy())
}
it("should dispose of returned disposable upon completion") {
let disposable = SimpleDisposable()
let signal: Signal<AnyObject, NoError> = Signal { observer in
testScheduler.schedule {
sendCompleted(observer)
}
return disposable
}
var completed = false
signal.observe(completed: { completed = true })
expect(completed).to(beFalsy())
expect(disposable.disposed).to(beFalsy())
testScheduler.run()
expect(completed).to(beTruthy())
expect(disposable.disposed).to(beTruthy())
}
it("should dispose of returned disposable upon interrupted") {
let disposable = SimpleDisposable()
let signal: Signal<AnyObject, NoError> = Signal { observer in
testScheduler.schedule {
sendInterrupted(observer)
}
return disposable
}
var interrupted = false
signal.observe(interrupted: { interrupted = true })
expect(interrupted).to(beFalsy())
expect(disposable.disposed).to(beFalsy())
testScheduler.run()
expect(interrupted).to(beTruthy())
expect(disposable.disposed).to(beTruthy())
}
}
describe("Signal.pipe") {
it("should not keep signal alive indefinitely") {
weak var signal = Signal<(), NoError>.pipe().0
expect(signal).to(beNil())
}
it("should deallocate after erroring") {
let testScheduler = TestScheduler()
weak var weakSignal: Signal<(), TestError>?
// Use an inner closure to help ARC deallocate things as we
// expect.
let test: () -> () = {
let (signal, observer) = Signal<(), TestError>.pipe()
weakSignal = signal
testScheduler.schedule {
sendError(observer, TestError.Default)
}
}
test()
expect(weakSignal).toNot(beNil())
testScheduler.run()
expect(weakSignal).to(beNil())
}
it("should deallocate after completing") {
let testScheduler = TestScheduler()
weak var weakSignal: Signal<(), TestError>?
// Use an inner closure to help ARC deallocate things as we
// expect.
let test: () -> () = {
let (signal, observer) = Signal<(), TestError>.pipe()
weakSignal = signal
testScheduler.schedule {
sendCompleted(observer)
}
}
test()
expect(weakSignal).toNot(beNil())
testScheduler.run()
expect(weakSignal).to(beNil())
}
it("should deallocate after interrupting") {
let testScheduler = TestScheduler()
weak var weakSignal: Signal<(), NoError>?
let test: () -> () = {
let (signal, observer) = Signal<(), NoError>.pipe()
weakSignal = signal
testScheduler.schedule {
sendInterrupted(observer)
}
}
test()
expect(weakSignal).toNot(beNil())
testScheduler.run()
expect(weakSignal).to(beNil())
}
it("should forward events to observers") {
let (signal, observer) = Signal<Int, NoError>.pipe()
var fromSignal: [Int] = []
var completed = false
signal.observe(next: { number in
fromSignal.append(number)
}, completed: {
completed = true
})
expect(fromSignal).to(beEmpty())
expect(completed).to(beFalsy())
sendNext(observer, 1)
expect(fromSignal).to(equal([ 1 ]))
sendNext(observer, 2)
expect(fromSignal).to(equal([ 1, 2 ]))
expect(completed).to(beFalsy())
sendCompleted(observer)
expect(completed).to(beTruthy())
}
}
describe("observe") {
var testScheduler: TestScheduler!
beforeEach {
testScheduler = TestScheduler()
}
it("should stop forwarding events when disposed") {
let disposable = SimpleDisposable()
let signal: Signal<Int, NoError> = Signal { observer in
testScheduler.schedule {
for number in [ 1, 2 ] {
sendNext(observer, number)
}
sendCompleted(observer)
sendNext(observer, 4)
}
return disposable
}
var fromSignal: [Int] = []
signal.observe(next: { number in
fromSignal.append(number)
})
expect(disposable.disposed).to(beFalsy())
expect(fromSignal).to(beEmpty())
testScheduler.run()
expect(disposable.disposed).to(beTruthy())
expect(fromSignal).to(equal([ 1, 2 ]))
}
it("should not trigger side effects") {
var runCount = 0
let signal: Signal<(), NoError> = Signal { observer in
runCount += 1
return nil
}
expect(runCount).to(equal(1))
signal.observe()
expect(runCount).to(equal(1))
}
it("should release observer after termination") {
weak var testStr: NSMutableString?
let (signal, sink) = Signal<Int, NoError>.pipe()
let test: () -> () = {
let innerStr: NSMutableString = NSMutableString()
signal.observe(next: { value in
innerStr.appendString("\(value)")
})
testStr = innerStr
}
test()
sendNext(sink, 1)
expect(testStr).to(equal("1"))
sendNext(sink, 2)
expect(testStr).to(equal("12"))
sendCompleted(sink)
expect(testStr).to(beNil())
}
it("should release observer after interruption") {
weak var testStr: NSMutableString?
let (signal, sink) = Signal<Int, NoError>.pipe()
let test: () -> () = {
let innerStr: NSMutableString = NSMutableString()
signal.observe(next: { value in
innerStr.appendString("\(value)")
})
testStr = innerStr
}
test()
sendNext(sink, 1)
expect(testStr).to(equal("1"))
sendNext(sink, 2)
expect(testStr).to(equal("12"))
sendInterrupted(sink)
expect(testStr).to(beNil())
}
}
describe("trailing closure") {
it("receives next values") {
var values = [Int]()
let (signal, sink) = Signal<Int, NoError>.pipe()
signal.observe { next in
values.append(next)
}
sendNext(sink, 1)
expect(values).to(equal([1]))
}
}
describe("map") {
it("should transform the values of the signal") {
let (signal, sink) = Signal<Int, NoError>.pipe()
let mappedSignal = signal.map { String($0 + 1) }
var lastValue: String?
mappedSignal.observe(next: {
lastValue = $0
return
})
expect(lastValue).to(beNil())
sendNext(sink, 0)
expect(lastValue).to(equal("1"))
sendNext(sink, 1)
expect(lastValue).to(equal("2"))
}
}
describe("mapError") {
it("should transform the errors of the signal") {
let (signal, sink) = Signal<Int, TestError>.pipe()
let producerError = NSError(domain: "com.reactivecocoa.errordomain", code: 100, userInfo: nil)
var error: NSError?
signal
.mapError { _ in producerError }
.observe(next: { _ in return }, error: { error = $0 })
expect(error).to(beNil())
sendError(sink, TestError.Default)
expect(error).to(equal(producerError))
}
}
describe("filter") {
it("should omit values from the signal") {
let (signal, sink) = Signal<Int, NoError>.pipe()
let mappedSignal = signal.filter { $0 % 2 == 0 }
var lastValue: Int?
mappedSignal.observe(next: { lastValue = $0 })
expect(lastValue).to(beNil())
sendNext(sink, 0)
expect(lastValue).to(equal(0))
sendNext(sink, 1)
expect(lastValue).to(equal(0))
sendNext(sink, 2)
expect(lastValue).to(equal(2))
}
}
describe("ignoreNil") {
it("should forward only non-nil values") {
let (signal, sink) = Signal<Int?, NoError>.pipe()
let mappedSignal = signal.ignoreNil()
var lastValue: Int?
mappedSignal.observe(next: { lastValue = $0 })
expect(lastValue).to(beNil())
sendNext(sink, nil)
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(equal(1))
sendNext(sink, nil)
expect(lastValue).to(equal(1))
sendNext(sink, 2)
expect(lastValue).to(equal(2))
}
}
describe("scan") {
it("should incrementally accumulate a value") {
let (baseSignal, sink) = Signal<String, NoError>.pipe()
let signal = baseSignal.scan("", +)
var lastValue: String?
signal.observe(next: { lastValue = $0 })
expect(lastValue).to(beNil())
sendNext(sink, "a")
expect(lastValue).to(equal("a"))
sendNext(sink, "bb")
expect(lastValue).to(equal("abb"))
}
}
describe("reduce") {
it("should accumulate one value") {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
let signal = baseSignal.reduce(1, +)
var lastValue: Int?
var completed = false
signal.observe(next: {
lastValue = $0
}, completed: {
completed = true
})
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(beNil())
sendNext(sink, 2)
expect(lastValue).to(beNil())
expect(completed).to(beFalse())
sendCompleted(sink)
expect(completed).to(beTrue())
expect(lastValue).to(equal(4))
}
it("should send the initial value if none are received") {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
let signal = baseSignal.reduce(1, +)
var lastValue: Int?
var completed = false
signal.observe(next: {
lastValue = $0
}, completed: {
completed = true
})
expect(lastValue).to(beNil())
expect(completed).to(beFalse())
sendCompleted(sink)
expect(lastValue).to(equal(1))
expect(completed).to(beTrue())
}
}
describe("skip") {
it("should skip initial values") {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
let signal = baseSignal.skip(1)
var lastValue: Int?
signal.observe(next: { lastValue = $0 })
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(beNil())
sendNext(sink, 2)
expect(lastValue).to(equal(2))
}
it("should not skip any values when 0") {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
let signal = baseSignal.skip(0)
var lastValue: Int?
signal.observe(next: { lastValue = $0 })
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(equal(1))
sendNext(sink, 2)
expect(lastValue).to(equal(2))
}
}
describe("skipRepeats") {
it("should skip duplicate Equatable values") {
let (baseSignal, sink) = Signal<Bool, NoError>.pipe()
let signal = baseSignal.skipRepeats()
var values: [Bool] = []
signal.observe(next: { values.append($0) })
expect(values).to(equal([]))
sendNext(sink, true)
expect(values).to(equal([ true ]))
sendNext(sink, true)
expect(values).to(equal([ true ]))
sendNext(sink, false)
expect(values).to(equal([ true, false ]))
sendNext(sink, true)
expect(values).to(equal([ true, false, true ]))
}
it("should skip values according to a predicate") {
let (baseSignal, sink) = Signal<String, NoError>.pipe()
let signal = baseSignal.skipRepeats { $0.characters.count == $1.characters.count }
var values: [String] = []
signal.observe(next: { values.append($0) })
expect(values).to(equal([]))
sendNext(sink, "a")
expect(values).to(equal([ "a" ]))
sendNext(sink, "b")
expect(values).to(equal([ "a" ]))
sendNext(sink, "cc")
expect(values).to(equal([ "a", "cc" ]))
sendNext(sink, "d")
expect(values).to(equal([ "a", "cc", "d" ]))
}
}
describe("skipWhile") {
var signal: Signal<Int, NoError>!
var sink: Signal<Int, NoError>.Observer!
var lastValue: Int?
beforeEach {
let (baseSignal, observer) = Signal<Int, NoError>.pipe()
signal = baseSignal.skipWhile { $0 < 2 }
sink = observer
lastValue = nil
signal.observe(next: { lastValue = $0 })
}
it("should skip while the predicate is true") {
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(beNil())
sendNext(sink, 2)
expect(lastValue).to(equal(2))
sendNext(sink, 0)
expect(lastValue).to(equal(0))
}
it("should not skip any values when the predicate starts false") {
expect(lastValue).to(beNil())
sendNext(sink, 3)
expect(lastValue).to(equal(3))
sendNext(sink, 1)
expect(lastValue).to(equal(1))
}
}
describe("take") {
it("should take initial values") {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
let signal = baseSignal.take(2)
var lastValue: Int?
var completed = false
signal.observe(next: {
lastValue = $0
}, completed: {
completed = true
})
expect(lastValue).to(beNil())
expect(completed).to(beFalse())
sendNext(sink, 1)
expect(lastValue).to(equal(1))
expect(completed).to(beFalse())
sendNext(sink, 2)
expect(lastValue).to(equal(2))
expect(completed).to(beTrue())
}
it("should complete immediately after taking given number of values") {
let numbers = [ 1, 2, 4, 4, 5 ]
let testScheduler = TestScheduler()
var signal: Signal<Int, NoError> = Signal { observer in
testScheduler.schedule {
for number in numbers {
sendNext(observer, number)
}
}
return nil
}
var completed = false
signal = signal.take(numbers.count)
signal.observe(completed: { completed = true })
expect(completed).to(beFalsy())
testScheduler.run()
expect(completed).to(beTruthy())
}
it("should interrupt when 0") {
let numbers = [ 1, 2, 4, 4, 5 ]
let testScheduler = TestScheduler()
let signal: Signal<Int, NoError> = Signal { observer in
testScheduler.schedule {
for number in numbers {
sendNext(observer, number)
}
}
return nil
}
var result: [Int] = []
var interrupted = false
signal
.take(0)
.observe(next: { number in
result.append(number)
}, interrupted: {
interrupted = true
})
expect(interrupted).to(beTruthy())
testScheduler.run()
expect(result).to(beEmpty())
}
}
describe("collect") {
it("should collect all values") {
let (original, sink) = Signal<Int, NoError>.pipe()
let signal = original.collect()
let expectedResult = [ 1, 2, 3 ]
var result: [Int]?
signal.observe(next: { value in
expect(result).to(beNil())
result = value
})
for number in expectedResult {
sendNext(sink, number)
}
expect(result).to(beNil())
sendCompleted(sink)
expect(result).to(equal(expectedResult))
}
it("should complete with an empty array if there are no values") {
let (original, sink) = Signal<Int, NoError>.pipe()
let signal = original.collect()
var result: [Int]?
signal.observe(next: { result = $0 })
expect(result).to(beNil())
sendCompleted(sink)
expect(result).to(equal([]))
}
it("should forward errors") {
let (original, sink) = Signal<Int, TestError>.pipe()
let signal = original.collect()
var error: TestError?
signal.observe(error: { error = $0 })
expect(error).to(beNil())
sendError(sink, .Default)
expect(error).to(equal(TestError.Default))
}
}
describe("takeUntil") {
var signal: Signal<Int, NoError>!
var sink: Signal<Int, NoError>.Observer!
var triggerSink: Signal<(), NoError>.Observer!
var lastValue: Int? = nil
var completed: Bool = false
beforeEach {
let (baseSignal, observer) = Signal<Int, NoError>.pipe()
let (triggerSignal, triggerObserver) = Signal<(), NoError>.pipe()
signal = baseSignal.takeUntil(triggerSignal)
sink = observer
triggerSink = triggerObserver
lastValue = nil
completed = false
signal.observe(
next: { lastValue = $0 },
completed: { completed = true }
)
}
it("should take values until the trigger fires") {
expect(lastValue).to(beNil())
sendNext(sink, 1)
expect(lastValue).to(equal(1))
sendNext(sink, 2)
expect(lastValue).to(equal(2))
expect(completed).to(beFalse())
sendNext(triggerSink, ())
expect(completed).to(beTrue())
}
it("should complete if the trigger fires immediately") {
expect(lastValue).to(beNil())
expect(completed).to(beFalse())
sendNext(triggerSink, ())
expect(completed).to(beTrue())
expect(lastValue).to(beNil())
}
}
describe("takeUntilReplacement") {
var signal: Signal<Int, NoError>!
var sink: Signal<Int, NoError>.Observer!
var replacementSink: Signal<Int, NoError>.Observer!
var lastValue: Int? = nil
var completed: Bool = false
beforeEach {
let (baseSignal, observer) = Signal<Int, NoError>.pipe()
let (replacementSignal, replacementObserver) = Signal<Int, NoError>.pipe()
signal = baseSignal.takeUntilReplacement(replacementSignal)
sink = observer
replacementSink = replacementObserver
lastValue = nil
completed = false
signal.observe(
next: { lastValue = $0 },
completed: { completed = true }
)
}
it("should take values from the original then the replacement") {
expect(lastValue).to(beNil())
expect(completed).to(beFalse())
sendNext(sink, 1)
expect(lastValue).to(equal(1))
sendNext(sink, 2)
expect(lastValue).to(equal(2))
sendNext(replacementSink, 3)
expect(lastValue).to(equal(3))
expect(completed).to(beFalse())
sendNext(sink, 4)
expect(lastValue).to(equal(3))
expect(completed).to(beFalse())
sendNext(replacementSink, 5)
expect(lastValue).to(equal(5))
expect(completed).to(beFalse())
sendCompleted(replacementSink)
expect(completed).to(beTrue())
}
}
describe("takeWhile") {
var signal: Signal<Int, NoError>!
var observer: Signal<Int, NoError>.Observer!
beforeEach {
let (baseSignal, sink) = Signal<Int, NoError>.pipe()
signal = baseSignal.takeWhile { $0 <= 4 }
observer = sink
}
it("should take while the predicate is true") {
var latestValue: Int!
var completed = false
signal.observe(next: { value in
latestValue = value
}, completed: {
completed = true
})
for value in -1...4 {
sendNext(observer, value)
expect(latestValue).to(equal(value))
expect(completed).to(beFalse())
}
sendNext(observer, 5)
expect(latestValue).to(equal(4))
expect(completed).to(beTrue())
}
it("should complete if the predicate starts false") {
var latestValue: Int?
var completed = false
signal.observe(next: { value in
latestValue = value
}, completed: {
completed = true
})
sendNext(observer, 5)
expect(latestValue).to(beNil())
expect(completed).to(beTrue())
}
}
describe("observeOn") {
it("should send events on the given scheduler") {
let testScheduler = TestScheduler()
let (signal, observer) = Signal<Int, NoError>.pipe()
var result: [Int] = []
signal
.observeOn(testScheduler)
.observe(next: { result.append($0) })
sendNext(observer, 1)
sendNext(observer, 2)
expect(result).to(beEmpty())
testScheduler.run()
expect(result).to(equal([ 1, 2 ]))
}
}
describe("delay") {
it("should send events on the given scheduler after the interval") {
let testScheduler = TestScheduler()
let signal: Signal<Int, NoError> = Signal { observer in
testScheduler.schedule {
sendNext(observer, 1)
}
testScheduler.scheduleAfter(5, action: {
sendNext(observer, 2)
sendCompleted(observer)
})
return nil
}
var result: [Int] = []
var completed = false
signal
.delay(10, onScheduler: testScheduler)
.observe(next: { number in
result.append(number)
}, completed: {
completed = true
})
testScheduler.advanceByInterval(4) // send initial value
expect(result).to(beEmpty())
testScheduler.advanceByInterval(10) // send second value and receive first
expect(result).to(equal([ 1 ]))
expect(completed).to(beFalsy())
testScheduler.advanceByInterval(10) // send second value and receive first
expect(result).to(equal([ 1, 2 ]))
expect(completed).to(beTruthy())
}
it("should schedule errors immediately") {
let testScheduler = TestScheduler()
let signal: Signal<Int, TestError> = Signal { observer in
testScheduler.schedule {
sendError(observer, TestError.Default)
}
return nil
}
var errored = false
signal
.delay(10, onScheduler: testScheduler)
.observe(error: { _ in errored = true })
testScheduler.advance()
expect(errored).to(beTruthy())
}
}
describe("throttle") {
var scheduler: TestScheduler!
var observer: Signal<Int, NoError>.Observer!
var signal: Signal<Int, NoError>!
beforeEach {
scheduler = TestScheduler()
let (baseSignal, baseObserver) = Signal<Int, NoError>.pipe()
observer = baseObserver
signal = baseSignal.throttle(1, onScheduler: scheduler)
expect(signal).notTo(beNil())
}
it("should send values on the given scheduler at no less than the interval") {
var values: [Int] = []
signal.observe(next: { value in
values.append(value)
})
expect(values).to(equal([]))
sendNext(observer, 0)
expect(values).to(equal([]))
scheduler.advance()
expect(values).to(equal([ 0 ]))
sendNext(observer, 1)
sendNext(observer, 2)
expect(values).to(equal([ 0 ]))
scheduler.advanceByInterval(1.5)
expect(values).to(equal([ 0, 2 ]))
scheduler.advanceByInterval(3)
expect(values).to(equal([ 0, 2 ]))
sendNext(observer, 3)
expect(values).to(equal([ 0, 2 ]))
scheduler.advance()
expect(values).to(equal([ 0, 2, 3 ]))
sendNext(observer, 4)
sendNext(observer, 5)
scheduler.advance()
expect(values).to(equal([ 0, 2, 3 ]))
scheduler.run()
expect(values).to(equal([ 0, 2, 3, 5 ]))
}
it("should schedule completion immediately") {
var values: [Int] = []
var completed = false
signal.observe(next: { value in
values.append(value)
}, completed: {
completed = true
})
sendNext(observer, 0)
scheduler.advance()
expect(values).to(equal([ 0 ]))
sendNext(observer, 1)
sendCompleted(observer)
expect(completed).to(beFalsy())
scheduler.run()
expect(values).to(equal([ 0 ]))
expect(completed).to(beTruthy())
}
}
describe("sampleOn") {
var sampledSignal: Signal<Int, NoError>!
var observer: Signal<Int, NoError>.Observer!
var samplerObserver: Signal<(), NoError>.Observer!
beforeEach {
let (signal, sink) = Signal<Int, NoError>.pipe()
let (sampler, samplesSink) = Signal<(), NoError>.pipe()
sampledSignal = signal.sampleOn(sampler)
observer = sink
samplerObserver = samplesSink
}
it("should forward the latest value when the sampler fires") {
var result: [Int] = []
sampledSignal.observe(next: { result.append($0) })
sendNext(observer, 1)
sendNext(observer, 2)
sendNext(samplerObserver, ())
expect(result).to(equal([ 2 ]))
}
it("should do nothing if sampler fires before signal receives value") {
var result: [Int] = []
sampledSignal.observe(next: { result.append($0) })
sendNext(samplerObserver, ())
expect(result).to(beEmpty())
}
it("should send lates value multiple times when sampler fires multiple times") {
var result: [Int] = []
sampledSignal.observe(next: { result.append($0) })
sendNext(observer, 1)
sendNext(samplerObserver, ())
sendNext(samplerObserver, ())
expect(result).to(equal([ 1, 1 ]))
}
it("should complete when both inputs have completed") {
var completed = false
sampledSignal.observe(completed: { completed = true })
sendCompleted(observer)
expect(completed).to(beFalsy())
sendCompleted(samplerObserver)
expect(completed).to(beTruthy())
}
}
describe("combineLatestWith") {
var combinedSignal: Signal<(Int, Double), NoError>!
var observer: Signal<Int, NoError>.Observer!
var otherObserver: Signal<Double, NoError>.Observer!
beforeEach {
let (signal, sink) = Signal<Int, NoError>.pipe()
let (otherSignal, otherSink) = Signal<Double, NoError>.pipe()
combinedSignal = signal.combineLatestWith(otherSignal)
observer = sink
otherObserver = otherSink
}
it("should forward the latest values from both inputs") {
var latest: (Int, Double)?
combinedSignal.observe(next: { latest = $0 })
sendNext(observer, 1)
expect(latest).to(beNil())
// is there a better way to test tuples?
sendNext(otherObserver, 1.5)
expect(latest?.0).to(equal(1))
expect(latest?.1).to(equal(1.5))
sendNext(observer, 2)
expect(latest?.0).to(equal(2))
expect(latest?.1).to(equal(1.5))
}
it("should complete when both inputs have completed") {
var completed = false
combinedSignal.observe(completed: { completed = true })
sendCompleted(observer)
expect(completed).to(beFalsy())
sendCompleted(otherObserver)
expect(completed).to(beTruthy())
}
}
describe("zipWith") {
var leftSink: Signal<Int, NoError>.Observer!
var rightSink: Signal<String, NoError>.Observer!
var zipped: Signal<(Int, String), NoError>!
beforeEach {
let (leftSignal, leftObserver) = Signal<Int, NoError>.pipe()
let (rightSignal, rightObserver) = Signal<String, NoError>.pipe()
leftSink = leftObserver
rightSink = rightObserver
zipped = leftSignal.zipWith(rightSignal)
}
it("should combine pairs") {
var result: [String] = []
zipped.observe(next: { (left, right) in result.append("\(left)\(right)") })
sendNext(leftSink, 1)
sendNext(leftSink, 2)
expect(result).to(equal([]))
sendNext(rightSink, "foo")
expect(result).to(equal([ "1foo" ]))
sendNext(leftSink, 3)
sendNext(rightSink, "bar")
expect(result).to(equal([ "1foo", "2bar" ]))
sendNext(rightSink, "buzz")
expect(result).to(equal([ "1foo", "2bar", "3buzz" ]))
sendNext(rightSink, "fuzz")
expect(result).to(equal([ "1foo", "2bar", "3buzz" ]))
sendNext(leftSink, 4)
expect(result).to(equal([ "1foo", "2bar", "3buzz", "4fuzz" ]))
}
it("should complete when the shorter signal has completed") {
var result: [String] = []
var completed = false
zipped.observe(next: { (left, right) in
result.append("\(left)\(right)")
}, completed: {
completed = true
})
expect(completed).to(beFalsy())
sendNext(leftSink, 0)
sendCompleted(leftSink)
expect(completed).to(beFalsy())
expect(result).to(equal([]))
sendNext(rightSink, "foo")
expect(completed).to(beTruthy())
expect(result).to(equal([ "0foo" ]))
}
}
describe("materialize") {
it("should reify events from the signal") {
let (signal, observer) = Signal<Int, TestError>.pipe()
var latestEvent: Event<Int, TestError>?
signal
.materialize()
.observe(next: { latestEvent = $0 })
sendNext(observer, 2)
expect(latestEvent).toNot(beNil())
if let latestEvent = latestEvent {
switch latestEvent {
case let .Next(value):
expect(value).to(equal(2))
default:
fail()
}
}
sendError(observer, TestError.Default)
if let latestEvent = latestEvent {
switch latestEvent {
case .Error(_):
()
default:
fail()
}
}
}
}
describe("dematerialize") {
typealias IntEvent = Event<Int, TestError>
var sink: Signal<IntEvent, NoError>.Observer!
var dematerialized: Signal<Int, TestError>!
beforeEach {
let (signal, observer) = Signal<IntEvent, NoError>.pipe()
sink = observer
dematerialized = signal.dematerialize()
}
it("should send values for Next events") {
var result: [Int] = []
dematerialized.observe(next: { result.append($0) })
expect(result).to(beEmpty())
sendNext(sink, .Next(2))
expect(result).to(equal([ 2 ]))
sendNext(sink, .Next(4))
expect(result).to(equal([ 2, 4 ]))
}
it("should error out for Error events") {
var errored = false
dematerialized.observe(error: { _ in errored = true })
expect(errored).to(beFalsy())
sendNext(sink, .Error(TestError.Default))
expect(errored).to(beTruthy())
}
it("should complete early for Completed events") {
var completed = false
dematerialized.observe(completed: { completed = true })
expect(completed).to(beFalsy())
sendNext(sink, IntEvent.Completed)
expect(completed).to(beTruthy())
}
}
describe("takeLast") {
var sink: Signal<Int, TestError>.Observer!
var lastThree: Signal<Int, TestError>!
beforeEach {
let (signal, observer) = Signal<Int, TestError>.pipe()
sink = observer
lastThree = signal.takeLast(3)
}
it("should send the last N values upon completion") {
var result: [Int] = []
lastThree.observe(next: { result.append($0) })
sendNext(sink, 1)
sendNext(sink, 2)
sendNext(sink, 3)
sendNext(sink, 4)
expect(result).to(beEmpty())
sendCompleted(sink)
expect(result).to(equal([ 2, 3, 4 ]))
}
it("should send less than N values if not enough were received") {
var result: [Int] = []
lastThree.observe(next: { result.append($0) })
sendNext(sink, 1)
sendNext(sink, 2)
sendCompleted(sink)
expect(result).to(equal([ 1, 2 ]))
}
it("should send nothing when errors") {
var result: [Int] = []
var errored = false
lastThree.observe( next: { result.append($0) },
error: { _ in errored = true } )
sendNext(sink, 1)
sendNext(sink, 2)
sendNext(sink, 3)
expect(errored).to(beFalsy())
sendError(sink, TestError.Default)
expect(errored).to(beTruthy())
expect(result).to(beEmpty())
}
}
describe("timeoutWithError") {
var testScheduler: TestScheduler!
var signal: Signal<Int, TestError>!
var sink: Signal<Int, TestError>.Observer!
beforeEach {
testScheduler = TestScheduler()
let (baseSignal, observer) = Signal<Int, TestError>.pipe()
signal = baseSignal.timeoutWithError(TestError.Default, afterInterval: 2, onScheduler: testScheduler)
sink = observer
}
it("should complete if within the interval") {
var completed = false
var errored = false
signal.observe(completed: {
completed = true
}, error: { _ in
errored = true
})
testScheduler.scheduleAfter(1) {
sendCompleted(sink)
}
expect(completed).to(beFalsy())
expect(errored).to(beFalsy())
testScheduler.run()
expect(completed).to(beTruthy())
expect(errored).to(beFalsy())
}
it("should error if not completed before the interval has elapsed") {
var completed = false
var errored = false
signal.observe(completed: {
completed = true
}, error: { _ in
errored = true
})
testScheduler.scheduleAfter(3) {
sendCompleted(sink)
}
expect(completed).to(beFalsy())
expect(errored).to(beFalsy())
testScheduler.run()
expect(completed).to(beFalsy())
expect(errored).to(beTruthy())
}
}
describe("attempt") {
it("should forward original values upon success") {
let (baseSignal, sink) = Signal<Int, TestError>.pipe()
let signal = baseSignal.attempt { _ in
return .Success()
}
var current: Int?
signal.observe(next: { value in
current = value
})
for value in 1...5 {
sendNext(sink, value)
expect(current).to(equal(value))
}
}
it("should error if an attempt fails") {
let (baseSignal, sink) = Signal<Int, TestError>.pipe()
let signal = baseSignal.attempt { _ in
return .Failure(.Default)
}
var error: TestError?
signal.observe(error: { err in
error = err
})
sendNext(sink, 42)
expect(error).to(equal(TestError.Default))
}
}
describe("attemptMap") {
it("should forward mapped values upon success") {
let (baseSignal, sink) = Signal<Int, TestError>.pipe()
let signal = baseSignal.attemptMap { num -> Result<Bool, TestError> in
return .Success(num % 2 == 0)
}
var even: Bool?
signal.observe(next: { value in
even = value
})
sendNext(sink, 1)
expect(even).to(equal(false))
sendNext(sink, 2)
expect(even).to(equal(true))
}
it("should error if a mapping fails") {
let (baseSignal, sink) = Signal<Int, TestError>.pipe()
let signal = baseSignal.attemptMap { _ -> Result<Bool, TestError> in
return .Failure(.Default)
}
var error: TestError?
signal.observe(error: { err in
error = err
})
sendNext(sink, 42)
expect(error).to(equal(TestError.Default))
}
}
describe("combinePrevious") {
var sink: Signal<Int, NoError>.Observer!
let initialValue: Int = 0
var latestValues: (Int, Int)?
beforeEach {
latestValues = nil
let (signal, baseSink) = Signal<Int, NoError>.pipe()
sink = baseSink
signal.combinePrevious(initialValue).observe(next: { latestValues = $0 })
}
it("should forward the latest value with previous value") {
expect(latestValues).to(beNil())
sendNext(sink, 1)
expect(latestValues?.0).to(equal(initialValue))
expect(latestValues?.1).to(equal(1))
sendNext(sink, 2)
expect(latestValues?.0).to(equal(1))
expect(latestValues?.1).to(equal(2))
}
}
describe("combineLatest") {
var signalA: Signal<Int, NoError>!
var signalB: Signal<Int, NoError>!
var signalC: Signal<Int, NoError>!
var sinkA: Signal<Int, NoError>.Observer!
var sinkB: Signal<Int, NoError>.Observer!
var sinkC: Signal<Int, NoError>.Observer!
var combinedValues: [Int]?
var completed: Bool!
beforeEach {
combinedValues = nil
completed = false
let (baseSignalA, baseSinkA) = Signal<Int, NoError>.pipe()
let (baseSignalB, baseSinkB) = Signal<Int, NoError>.pipe()
let (baseSignalC, baseSinkC) = Signal<Int, NoError>.pipe()
signalA = baseSignalA
signalB = baseSignalB
signalC = baseSignalC
sinkA = baseSinkA
sinkB = baseSinkB
sinkC = baseSinkC
}
let combineLatestExampleName = "combineLatest examples"
sharedExamples(combineLatestExampleName) {
it("should forward the latest values from all inputs"){
expect(combinedValues).to(beNil())
sendNext(sinkA, 0)
sendNext(sinkB, 1)
sendNext(sinkC, 2)
expect(combinedValues).to(equal([0, 1, 2]))
sendNext(sinkA, 10)
expect(combinedValues).to(equal([10, 1, 2]))
}
it("should not forward the latest values before all inputs"){
expect(combinedValues).to(beNil())
sendNext(sinkA, 0)
expect(combinedValues).to(beNil())
sendNext(sinkB, 1)
expect(combinedValues).to(beNil())
sendNext(sinkC, 2)
expect(combinedValues).to(equal([0, 1, 2]))
}
it("should complete when all inputs have completed"){
expect(completed).to(beFalsy())
sendCompleted(sinkA)
sendCompleted(sinkB)
expect(completed).to(beFalsy())
sendCompleted(sinkC)
expect(completed).to(beTruthy())
}
}
describe("tuple") {
beforeEach {
combineLatest(signalA, signalB, signalC)
.observe(next: {
combinedValues = [$0, $1, $2]
}, completed: {
completed = true
})
}
itBehavesLike(combineLatestExampleName)
}
describe("sequence") {
beforeEach {
combineLatest([signalA, signalB, signalC])
.observe(next: {
combinedValues = $0
}, completed: {
completed = true
})
}
itBehavesLike(combineLatestExampleName)
}
}
describe("zip") {
var signalA: Signal<Int, NoError>!
var signalB: Signal<Int, NoError>!
var signalC: Signal<Int, NoError>!
var sinkA: Signal<Int, NoError>.Observer!
var sinkB: Signal<Int, NoError>.Observer!
var sinkC: Signal<Int, NoError>.Observer!
var zippedValues: [Int]?
var completed: Bool!
beforeEach {
zippedValues = nil
completed = false
let (baseSignalA, baseSinkA) = Signal<Int, NoError>.pipe()
let (baseSignalB, baseSinkB) = Signal<Int, NoError>.pipe()
let (baseSignalC, baseSinkC) = Signal<Int, NoError>.pipe()
signalA = baseSignalA
signalB = baseSignalB
signalC = baseSignalC
sinkA = baseSinkA
sinkB = baseSinkB
sinkC = baseSinkC
}
let zipExampleName = "zip examples"
sharedExamples(zipExampleName) {
it("should combine all set"){
expect(zippedValues).to(beNil())
sendNext(sinkA, 0)
expect(zippedValues).to(beNil())
sendNext(sinkB, 1)
expect(zippedValues).to(beNil())
sendNext(sinkC, 2)
expect(zippedValues).to(equal([0, 1, 2]))
sendNext(sinkA, 10)
expect(zippedValues).to(equal([0, 1, 2]))
sendNext(sinkA, 20)
expect(zippedValues).to(equal([0, 1, 2]))
sendNext(sinkB, 11)
expect(zippedValues).to(equal([0, 1, 2]))
sendNext(sinkC, 12)
expect(zippedValues).to(equal([10, 11, 12]))
}
it("should complete when the shorter signal has completed"){
expect(completed).to(beFalsy())
sendNext(sinkB, 1)
sendNext(sinkC, 2)
sendCompleted(sinkB)
sendCompleted(sinkC)
expect(completed).to(beFalsy())
sendNext(sinkA, 0)
expect(completed).to(beTruthy())
}
}
describe("tuple") {
beforeEach {
zip(signalA, signalB, signalC)
.observe(next: {
zippedValues = [$0, $1, $2]
}, completed: {
completed = true
})
}
itBehavesLike(zipExampleName)
}
describe("sequence") {
beforeEach {
zip([signalA, signalB, signalC])
.observe(next: {
zippedValues = $0
}, completed: {
completed = true
})
}
itBehavesLike(zipExampleName)
}
}
}
}
| [
227322
] |
553435002b6eeb776ef503e7f795c6a3b7eb3aab | 7c01c6e0167704b3989de430d65bc3dfd37ea356 | /JiveTalkQuiz/AppDelegate.swift | e71f8a2eaae657e03afec6489c52818f5272bca5 | [] | no_license | JiveTalkQuiz/JiveTalkQuiziOS | 020c95bb00694fb7f48f30f0207a92883425788f | 7687700bb891d5d5a42d8c2159e703280607d3d6 | refs/heads/master | 2020-12-24T03:27:25.696481 | 2020-06-17T15:41:01 | 2020-06-17T15:41:01 | 237,364,867 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,113 | swift | //
// AppDelegate.swift
// JiveTalkQuiz
//
// Created by sihon321 on 2020/02/02.
// Copyright © 2020 sihon321. All rights reserved.
//
import UIKit
import RxGesture
import Firebase
import GoogleMobileAds
import FBAudienceNetwork
@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.
if #available(iOS 13, *) {
} else {
FirebaseApp.configure()
GADMobileAds.sharedInstance().start(completionHandler: nil)
FBAudienceNetworkAds.initialize()
self.window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let vc = QuizListViewController()
vc.reactor = QuizListViewReactor(storageService: StorageService(),
localStorage: LocalStorage())
let nc = UINavigationController(rootViewController: vc)
self.window?.rootViewController = nc
}
return true
}
// MARK: UISceneSession Lifecycle
@available(iOS 13.0, *)
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)
}
@available(iOS 13.0, *)
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.
}
}
| [
-1
] |
9a76bd2051eece2820434afe00c4cdc103db0c3c | e8c1e4bb25616cfbf40c41b6fdbe4b6fab9a34ac | /EyePatchPlayer/EPPlaylistsListViewController.swift | b65b51903a79d05c5d3b681010ad41dcab69e7de | [] | no_license | mario2100/EyePatchPlayer | 8f02bee415b6358088bd1ddd37d93d67ddd80c0a | 734db298a15c4acd9a6efec098ddbbf7acbc31e5 | refs/heads/master | 2022-05-01T11:04:45.658392 | 2015-09-29T10:06:27 | 2015-09-29T10:06:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,317 | swift | //
// FirstViewController.swift
// EyePatchPlayer
//
// Created by Andr3y on 15/09/2015.
// Copyright (c) 2015 Apppli. All rights reserved.
//
import UIKit
class EPPlaylistsListViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var playlistsTableView: EPPlaylistsListTableView!
var playlists = ["My", "Friends"]
override func viewDidLoad() {
super.viewDidLoad()
log("EPPlaylistsListViewController")
self.playlistsTableView.delegate = self
self.playlistsTableView.dataSource = self
// 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.
}
//tableview
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell: UITableViewCell? = self.playlistsTableView.dequeueReusableCellWithIdentifier("CellIdentifier") as? UITableViewCell
if cell == nil {
cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "CellIdentifier")
}
cell!.textLabel?.text = self.playlists[indexPath.row]
return cell!
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let selectedCell: UITableViewCell = self.playlistsTableView.cellForRowAtIndexPath(indexPath)!
if let selectedText = selectedCell.textLabel?.text {
switch selectedText {
case "My":
self.performSegueWithIdentifier("seguePlaylist", sender: selectedText)
default:
println("unhandled selection of cell with text: \(selectedText)")
deselectRow()
}
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
switch segue.identifier! {
case "seguePlaylist":
switch sender as! String {
case "My":
println("segueing to playlist (My)")
let destinationViewController = segue.destinationViewController as! EPPlaylistViewController
destinationViewController.userID = VKSdk.getAccessToken().userId.toInt()!
default:
println("segueing to playlist (Friend)")
let destinationViewController = segue.destinationViewController as! EPPlaylistViewController
destinationViewController.userID = VKSdk.getAccessToken().userId.toInt()!
}
default:
println()
}
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
deselectRow()
}
func deselectRow() {
if (self.playlistsTableView.indexPathForSelectedRow() != nil) {
self.playlistsTableView.deselectRowAtIndexPath(self.playlistsTableView.indexPathForSelectedRow()!, animated: true)
}
}
}
| [
-1
] |
f350b192cf28dd349ec15c5a837b9d5cfeb611f1 | 574e6ccdc5779ca739034907db85ac311b68ec02 | /MyPlayground.playground/Contents.swift | 4768313bd97438d598af09c7f848603c43653e85 | [] | no_license | Abed97/iOS-Apps | b16c7b6de6359c8e5557916931db0721faa1dfdb | 733dfd9f0023b17bfb5e0c398d4a4f2e8f12afc8 | refs/heads/master | 2020-04-22T02:12:49.194694 | 2019-02-10T23:43:32 | 2019-02-10T23:43:32 | 170,040,591 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,960 | swift | //: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
//Arrays
var array = [3.87, 7.1, 8.9]
let bla = 1 //constant
array.append(5*7)
array.sort()
var lol = 8.7
print ("my age is \(lol)")
//Dictionnary
var dico = [ "pizza" : 10.99, "ice cream" : 4.99, "salad" : 7.99]
print("The total price is \(dico["pizza"]! + dico["salad"]!)")
// if statements
var username: String = "abed"
var password = 1234
if username == "abed" && password == 12345 {
print("Login succesfull")
} else
if username != "abed" && password != 12345 {
print("Wrong username and password")
} else if username != "abed" && password == 12345 {
print("wrong username")
} else if username == "abed" && password != 12345 {
print("Wrong password")
}
// While loops
var arra = [56, 97, 56, 3, 0]
var i = 0
while i < arra.count {
arra[i] += 1
i += 1
}
print(arra)
//for loops
let names : [String] = ["Hala", "Abed", "Omar", "Samer"]
for number in names {
print("hello \(number)") // is value for each index
}
var numbers : [Double] = [7, 8, 19, 28]
for (index, value) in numbers.enumerated() {
numbers[index] = value/2
}
print(numbers)
//Classes and Objects
class Monster {
var health = 20
var isAlive = true
func kill() {
isAlive = false
}
func isStrong() -> Bool {
if health > 15 {
return true
} else {
return false
}
}
}
var golem = Monster()
print(golem.health)
print(golem.isStrong())
golem.health = 14
print(golem.isStrong())
golem.kill()
print(golem.isAlive)
//Optional
var num: Int?
print(num)
let enter = "7"
let enternum = Int(enter)
if let out = enternum {
print(out * 5)
}
var jio = [1, 3, 6]
//Timer
var timer = Timer()
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: , userInfo: <#T##Any?#>, repeats: <#T##Bool#>)
| [
-1
] |
e42676a4bcb1036b5231c494f5b59148ac1d4483 | f3b7346ae4bd592ab0b2b3929fc410b6f475ad9c | /iOSFinal/ViewControllers/tabBarViewController.swift | 5ac736d23adee9cec188c9a0fb5db03a81fbaf08 | [
"MIT"
] | permissive | meetdoshi90/Zap-iOS-Game | 333349c12d6726d51c6b67acd2bd7c51a1822f87 | 287de1ac590042e3c930fc6826c7fe71034c4a36 | refs/heads/main | 2023-07-19T09:57:10.515539 | 2021-09-12T13:39:03 | 2021-09-12T13:39:03 | 319,028,454 | 0 | 0 | null | 2021-09-12T10:17:15 | 2020-12-06T12:31:41 | Swift | UTF-8 | Swift | false | false | 641 | swift | //
// tabBarViewController.swift
// iOSFinal
//
// Created by msb on 25/11/20.
//
import UIKit
class tabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
/*
// 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
] |
b5d22e9f062d8e4142d035c00f1f489128cef0ac | 82f8ccf536dbcf3124e1e607f08620050d26a2d3 | /WhoLetTheDogsOut/WhoLetTheDogsOut/Model/Dog.swift | 486279ff0b690bf16e751f64557f4fc4f3292328 | [] | no_license | GuihAntunes/WhoLetTheDogsOut | fcf5f28c8eda2b010b4a867634b82f464dbd20ff | 1f818850e37e7bf131fee3b463de6e8df3577045 | refs/heads/master | 2020-04-08T06:37:29.084534 | 2018-11-30T11:05:29 | 2018-11-30T11:05:29 | 159,103,087 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 318 | swift | //
// Dog.swift
// WhoLetTheDogsOut
//
// Created by Guilherme Antunes on 26/11/18.
// Copyright © 2018 Guilherme Antunes. All rights reserved.
//
import Foundation
struct Dog: Codable {
let category: String
let list: [URL]
var path: String {
return "storedDog\(category).json"
}
}
| [
-1
] |
ea1388305dc48fcf84c0256b1b9cd09b764439f4 | e90671c6b1cb69eaf57bd0ab4bbd1bd92ba9aea9 | /ios/versioned/sdk49/ExpoLinearGradient/LinearGradientModule.swift | 239a817ab555b1c0ee33a9c4df1c20dabf83bca8 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | expo/expo | 72fc802e3b6806789225bdd856031a8d150dd6f5 | 40f087fc0c0ab22270cfef2673bced44af170c34 | refs/heads/main | 2023-08-17T01:38:28.442098 | 2023-08-16T21:43:11 | 2023-08-16T21:43:11 | 65,750,241 | 23,742 | 5,421 | MIT | 2023-09-14T21:37:37 | 2016-08-15T17:14:25 | TypeScript | UTF-8 | Swift | false | false | 828 | swift | // Copyright 2021-present 650 Industries. All rights reserved.
import CoreGraphics
import ABI49_0_0ExpoModulesCore
public class LinearGradientModule: Module {
public func definition() -> ModuleDefinition {
Name("ExpoLinearGradient")
View(LinearGradientView.self) {
Prop("colors") { (view: LinearGradientView, colors: [CGColor]) in
view.gradientLayer.setColors(colors)
}
Prop("startPoint") { (view: LinearGradientView, startPoint: CGPoint?) in
view.gradientLayer.setStartPoint(startPoint)
}
Prop("endPoint") { (view: LinearGradientView, endPoint: CGPoint?) in
view.gradientLayer.setEndPoint(endPoint)
}
Prop("locations") { (view: LinearGradientView, locations: [CGFloat]?) in
view.gradientLayer.setLocations(locations)
}
}
}
}
| [
-1
] |
12a3fb7cdf27092baa1a85f04254f21e625c12ee | eb6c2afabe02976caab428ef97a55fda8d657806 | /Covid19Progect/LoginView/LoginViewController.swift | 6ad4035c6d3071efc69ca057e1481b1c9f7b89ef | [] | no_license | ritakazakova/Covid19Project | d55c83de45b3540b96308aed4e01a4d62fb900d7 | 90fbaeaaa75b08896535aa9db2e8332b4c0ff3f4 | refs/heads/master | 2023-03-05T07:02:22.021928 | 2021-02-17T11:09:43 | 2021-02-17T11:09:43 | 311,158,322 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,222 | swift | import UIKit
import Swinject
import KeychainAccess
class LoginViewController: UIViewController {
private let lastUsernameKey = "Value Username"
private let keyForPassword = "Value Password"
let keychain = Dependency().container.resolve(Keychain.self)
let notificationManager = NotificationManager()
@IBOutlet private weak var login: UIButton!
@IBOutlet private weak var password: UITextField!
@IBOutlet private weak var userName: UITextField!
@IBOutlet private weak var userNameTopView: NSLayoutConstraint!
@IBOutlet private var loginBottomView: NSLayoutConstraint!
private let validator = Dependency().container.resolve(FieldValidator.self)
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
userNameTopView.constant = 100
loginBottomView.constant = 100
UIView.animate(withDuration: 0.8,
delay: 0,
options: [],
animations: { [weak self] in
self?.view.layoutIfNeeded()
}, completion: nil)
if let savedUsername = keychain?[lastUsernameKey] {
userName.text = savedUsername
password.text = keychain?[savedUsername]
}
textFieldWithText()
}
override func viewDidLoad() {
super.viewDidLoad()
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tap)
notificationManager.notificationCenter.delegate = notificationManager
notificationManager.notification()
notificationManager.scheduleNotification()
}
@objc func dismissKeyboard() {
view.endEditing(true)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
userNameTopView.constant += view.bounds.maxY
loginBottomView.constant -= view.bounds.maxY
}
private func saveUsername() {
guard let userNameText = userName.text, let passwordText = password.text else { return }
keychain?[userNameText] = passwordText
keychain?[lastUsernameKey] = userNameText
}
@IBAction private func pressedLogin(_ sender: UIButton) {
saveUsername()
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "TabBarController")
present(viewController, animated: true, completion: nil)
}
private func textFieldWithText() {
if validator?.checkLoginAndPassword(userName: userName.text ?? "", password: password.text ?? "") == true {
login.isEnabled = true
} else {
login.isEnabled = false
}
}
@IBAction private func userNameAction(_ sender: UITextField) {
textFieldWithText()
}
@IBAction private func passwordAction(_ sender: UITextField) {
textFieldWithText()
}
}
| [
-1
] |
3dfd5e67cb728bfe4620b18d742eb7c2dbc658c1 | 655ae81da232efb49d21d5728be0ca91511121c3 | /Random Users/Operations/FetchThumbnailOperation.swift | 78ffa2637f4053d2e8d5545317684efcd76b49e8 | [] | no_license | iyinraphael/ios-sprint7-challenge | d8e7097961f83ce017bfddf4654e6a3bf7a3074a | 24cbd5fb2e0fdc7bf2abadd4cda78aa153938bca | refs/heads/master | 2020-04-01T02:12:16.926493 | 2018-10-12T17:50:15 | 2018-10-12T17:50:15 | 147,841,293 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,131 | swift | //
// FetchThumbnailOperation.swift
// Random Users
//
// Created by Iyin Raphael on 10/12/18.
// Copyright © 2018 Erica Sadun. All rights reserved.
//
import UIKit
class FetchThumbnailOperation: ConcurrentOperation {
init(randomUser: RandomUser) {
self.randomUser = randomUser
}
override func start() {
state = .isExecuting
guard let url = randomUser.thumbnailImageURL else { return }
dataTask = URLSession.shared.dataTask(with: url) { (data, _, error) in
defer { self.state = .isFinished }
if let error = error {
NSLog("Error retrieving image: \(error)")
return
}
guard let data = data else {
NSLog("No data found.")
return
}
self.thumbnailImage = UIImage(data: data)
}
dataTask?.resume()
}
override func cancel() {
dataTask?.cancel()
}
var randomUser: RandomUser
var thumbnailImage: UIImage?
private var dataTask: URLSessionDataTask?
}
| [
-1
] |
1d2a6f8e5af06e1730225cebe212f864e527b056 | eb468db1bf5134983d18bca0471159c5e0be3417 | /FestFriend02/TableCells/Profile/AboutVC.swift | 030dbc6cb21c4335e09d759043ac56f60a89e9c5 | [] | no_license | meadown/BuySellticket | ae08f7804166eaae0c2b801749706c24fa79228a | edb6a00f5f74cd408d62a0760250fd5f478d1cbb | refs/heads/main | 2023-02-25T18:04:01.744812 | 2021-01-30T13:01:33 | 2021-01-30T13:01:33 | 334,411,728 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,562 | swift | //
// AboutVC.swift
// FestFriend02
//
// Created by Biswajit Banik on 1/12/19.
// Copyright © 2019 MySoftheaven BD. All rights reserved.
//
import UIKit
import SafariServices
class AboutVC: UIViewController {
@IBOutlet weak var termsAndService: UILabel!
@IBOutlet weak var privacyAndPolicy: UILabel!
@IBOutlet weak var careersAndPartnership: UILabel!
@IBOutlet weak var howItWorks: UILabel!
@IBOutlet weak var facebookShare: UIImageView!
@IBOutlet weak var twitterShare: UIImageView!
@IBOutlet weak var instragramShare: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
//self.tabBarController?.tabBar.isHidden = true
let terms = UITapGestureRecognizer(target: self, action: #selector(AboutVC.tapTerms))
let privacy = UITapGestureRecognizer(target: self, action: #selector(AboutVC.tapPrivacy))
let careers = UITapGestureRecognizer(target: self, action: #selector(AboutVC.tapcareersAndPartnership))
let works = UITapGestureRecognizer(target: self, action: #selector(AboutVC.taphowItWorks))
let facebookAction = UITapGestureRecognizer(target: self, action: #selector(AboutVC.tapFacebook))
let twitterAction = UITapGestureRecognizer(target: self, action: #selector(AboutVC.taptwitter))
let instragramAction = UITapGestureRecognizer(target: self, action: #selector(AboutVC.tapInstragram))
termsAndService.isUserInteractionEnabled = true
privacyAndPolicy.isUserInteractionEnabled = true
careersAndPartnership.isUserInteractionEnabled = true
howItWorks.isUserInteractionEnabled = true
facebookShare.isUserInteractionEnabled = true
twitterShare.isUserInteractionEnabled = true
instragramShare.isUserInteractionEnabled = true
termsAndService.addGestureRecognizer(terms)
privacyAndPolicy.addGestureRecognizer(privacy)
careersAndPartnership.addGestureRecognizer(careers)
howItWorks.addGestureRecognizer(works)
facebookShare.addGestureRecognizer(facebookAction)
twitterShare.addGestureRecognizer(twitterAction)
instragramShare.addGestureRecognizer(instragramAction)
}
@objc func tapTerms(sender:UITapGestureRecognizer) {
performSegue(withIdentifier: "aboutView", sender: false)
}
@objc func tapPrivacy(sender:UITapGestureRecognizer) {
performSegue(withIdentifier: "aboutView", sender: false)
}
@objc func tapcareersAndPartnership(sender:UITapGestureRecognizer) {
performSegue(withIdentifier: "aboutView", sender: false)
}
@objc func taphowItWorks(sender:UITapGestureRecognizer) {
performSegue(withIdentifier: "aboutView", sender: false)
}
@objc func tapFacebook(sender:UITapGestureRecognizer) {
print("Facebook")
showSafriVC(for: "https://www.facebook.com/FestFriendsApp/")
}
@objc func tapInstragram(sender:UITapGestureRecognizer) {
showSafriVC(for: "https://www.instagram.com/festfriends.app/")
}
@objc func taptwitter(sender:UITapGestureRecognizer) {
showSafriVC(for: "https://twitter.com/festfriends_app")
}
func showSafriVC(for url: String) {
guard let url = URL(string: url) else {
return
}
let safariVC = SFSafariViewController(url: url)
present(safariVC , animated: true)
}
}
| [
-1
] |
702633c5d6af8da58738b86fe8e05f304f3389ca | 369d7491f529d027a99c54c145c6b2b4c4f5a408 | /Source/ServerTrustEvaluation.swift | 66850bed54ce5557ee3521dcff4d2d5b890e75ba | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | hgl753951/Alamofire | 2b18c4314933a5d216ed34096d4f308ab75ba0d5 | a7488832d274df2feb8b457c713a14e69e64b095 | refs/heads/master | 2023-03-16T00:33:58.265374 | 2023-03-10T08:37:55 | 2023-03-10T08:37:55 | 196,674,794 | 1 | 2 | MIT | 2023-03-10T08:38:10 | 2019-07-13T03:44:25 | Swift | UTF-8 | Swift | false | false | 37,491 | swift | //
// ServerTrustPolicy.swift
//
// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)
//
// 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 Foundation
/// Responsible for managing the mapping of `ServerTrustEvaluating` values to given hosts.
open class ServerTrustManager {
/// Determines whether all hosts for this `ServerTrustManager` must be evaluated. `true` by default.
public let allHostsMustBeEvaluated: Bool
/// The dictionary of policies mapped to a particular host.
public let evaluators: [String: ServerTrustEvaluating]
/// Initializes the `ServerTrustManager` instance with the given evaluators.
///
/// Since different servers and web services can have different leaf certificates, intermediate and even root
/// certificates, it is important to have the flexibility to specify evaluation policies on a per host basis. This
/// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key
/// pinning for host3 and disabling evaluation for host4.
///
/// - Parameters:
/// - allHostsMustBeEvaluated: The value determining whether all hosts for this instance must be evaluated. `true`
/// by default.
/// - evaluators: A dictionary of evaluators mapped to hosts.
public init(allHostsMustBeEvaluated: Bool = true, evaluators: [String: ServerTrustEvaluating]) {
self.allHostsMustBeEvaluated = allHostsMustBeEvaluated
self.evaluators = evaluators
}
#if !(os(Linux) || os(Windows))
/// Returns the `ServerTrustEvaluating` value for the given host, if one is set.
///
/// By default, this method will return the policy that perfectly matches the given host. Subclasses could override
/// this method and implement more complex mapping implementations such as wildcards.
///
/// - Parameter host: The host to use when searching for a matching policy.
///
/// - Returns: The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise.
/// - Throws: `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching
/// evaluators are found.
open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {
guard let evaluator = evaluators[host] else {
if allHostsMustBeEvaluated {
throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host))
}
return nil
}
return evaluator
}
#endif
}
/// A protocol describing the API used to evaluate server trusts.
public protocol ServerTrustEvaluating {
#if os(Linux) || os(Windows)
// Implement this once Linux/Windows has API for evaluating server trusts.
#else
/// Evaluates the given `SecTrust` value for the given `host`.
///
/// - Parameters:
/// - trust: The `SecTrust` value to evaluate.
/// - host: The host for which to evaluate the `SecTrust` value.
///
/// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`.
func evaluate(_ trust: SecTrust, forHost host: String) throws
#endif
}
// MARK: - Server Trust Evaluators
#if !(os(Linux) || os(Windows))
/// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the
/// host provided by the challenge. Applications are encouraged to always validate the host in production environments
/// to guarantee the validity of the server's certificate chain.
public final class DefaultTrustEvaluator: ServerTrustEvaluating {
private let validateHost: Bool
/// Creates a `DefaultTrustEvaluator`.
///
/// - Parameter validateHost: Determines whether or not the evaluator should validate the host. `true` by default.
public init(validateHost: Bool = true) {
self.validateHost = validateHost
}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
if validateHost {
try trust.af.performValidation(forHost: host)
}
try trust.af.performDefaultValidation(forHost: host)
}
}
/// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate
/// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates.
/// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS
/// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production
/// environments to guarantee the validity of the server's certificate chain.
public final class RevocationTrustEvaluator: ServerTrustEvaluating {
/// Represents the options to be use when evaluating the status of a certificate.
/// Only Revocation Policy Constants are valid, and can be found in [Apple's documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants).
public struct Options: OptionSet {
/// Perform revocation checking using the CRL (Certification Revocation List) method.
public static let crl = Options(rawValue: kSecRevocationCRLMethod)
/// Consult only locally cached replies; do not use network access.
public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled)
/// Perform revocation checking using OCSP (Online Certificate Status Protocol).
public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod)
/// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.
public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL)
/// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a
/// "best attempt" basis, where failure to reach the server is not considered fatal.
public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse)
/// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the
/// certificate and the value of `preferCRL`.
public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod)
/// The raw value of the option.
public let rawValue: CFOptionFlags
/// Creates an `Options` value with the given `CFOptionFlags`.
///
/// - Parameter rawValue: The `CFOptionFlags` value to initialize with.
public init(rawValue: CFOptionFlags) {
self.rawValue = rawValue
}
}
private let performDefaultValidation: Bool
private let validateHost: Bool
private let options: Options
/// Creates a `RevocationTrustEvaluator` using the provided parameters.
///
/// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
/// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
///
/// - Parameters:
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition to
/// performing the default evaluation, even if `performDefaultValidation` is `false`.
/// `true` by default.
/// - options: The `Options` to use to check the revocation status of the certificate. `.any` by
/// default.
public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) {
self.performDefaultValidation = performDefaultValidation
self.validateHost = validateHost
self.options = options
}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
if performDefaultValidation {
try trust.af.performDefaultValidation(forHost: host)
}
if validateHost {
try trust.af.performValidation(forHost: host)
}
if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
try trust.af.evaluate(afterApplying: SecPolicy.af.revocation(options: options))
} else {
try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { status, result in
AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options))
}
}
}
}
extension ServerTrustEvaluating where Self == RevocationTrustEvaluator {
/// Provides a default `RevocationTrustEvaluator` instance.
public static var revocationChecking: RevocationTrustEvaluator { RevocationTrustEvaluator() }
/// Creates a `RevocationTrustEvaluator` using the provided parameters.
///
/// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
/// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
///
/// - Parameters:
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition
/// to performing the default evaluation, even if `performDefaultValidation` is
/// `false`. `true` by default.
/// - options: The `Options` to use to check the revocation status of the certificate. `.any`
/// by default.
/// - Returns: The `RevocationTrustEvaluator`.
public static func revocationChecking(performDefaultValidation: Bool = true,
validateHost: Bool = true,
options: RevocationTrustEvaluator.Options = .any) -> RevocationTrustEvaluator {
RevocationTrustEvaluator(performDefaultValidation: performDefaultValidation,
validateHost: validateHost,
options: options)
}
}
/// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned
/// certificates match one of the server certificates. By validating both the certificate chain and host, certificate
/// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
/// Applications are encouraged to always validate the host and require a valid certificate chain in production
/// environments.
public final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating {
private let certificates: [SecCertificate]
private let acceptSelfSignedCertificates: Bool
private let performDefaultValidation: Bool
private let validateHost: Bool
/// Creates a `PinnedCertificatesTrustEvaluator` from the provided parameters.
///
/// - Parameters:
/// - certificates: The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`
/// certificates in `Bundle.main` by default.
/// - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing
/// self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE
/// FALSE IN PRODUCTION!
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition
/// to performing the default evaluation, even if `performDefaultValidation` is
/// `false`. `true` by default.
public init(certificates: [SecCertificate] = Bundle.main.af.certificates,
acceptSelfSignedCertificates: Bool = false,
performDefaultValidation: Bool = true,
validateHost: Bool = true) {
self.certificates = certificates
self.acceptSelfSignedCertificates = acceptSelfSignedCertificates
self.performDefaultValidation = performDefaultValidation
self.validateHost = validateHost
}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
guard !certificates.isEmpty else {
throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound)
}
if acceptSelfSignedCertificates {
try trust.af.setAnchorCertificates(certificates)
}
if performDefaultValidation {
try trust.af.performDefaultValidation(forHost: host)
}
if validateHost {
try trust.af.performValidation(forHost: host)
}
let serverCertificatesData = Set(trust.af.certificateData)
let pinnedCertificatesData = Set(certificates.af.data)
let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData)
if !pinnedCertificatesInServerData {
throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host,
trust: trust,
pinnedCertificates: certificates,
serverCertificates: trust.af.certificates))
}
}
}
extension ServerTrustEvaluating where Self == PinnedCertificatesTrustEvaluator {
/// Provides a default `PinnedCertificatesTrustEvaluator` instance.
public static var pinnedCertificates: PinnedCertificatesTrustEvaluator { PinnedCertificatesTrustEvaluator() }
/// Creates a `PinnedCertificatesTrustEvaluator` using the provided parameters.
///
/// - Parameters:
/// - certificates: The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`
/// certificates in `Bundle.main` by default.
/// - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing
/// self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE
/// FALSE IN PRODUCTION!
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition
/// to performing the default evaluation, even if `performDefaultValidation` is
/// `false`. `true` by default.
public static func pinnedCertificates(certificates: [SecCertificate] = Bundle.main.af.certificates,
acceptSelfSignedCertificates: Bool = false,
performDefaultValidation: Bool = true,
validateHost: Bool = true) -> PinnedCertificatesTrustEvaluator {
PinnedCertificatesTrustEvaluator(certificates: certificates,
acceptSelfSignedCertificates: acceptSelfSignedCertificates,
performDefaultValidation: performDefaultValidation,
validateHost: validateHost)
}
}
/// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned
/// public keys match one of the server certificate public keys. By validating both the certificate chain and host,
/// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
/// Applications are encouraged to always validate the host and require a valid certificate chain in production
/// environments.
public final class PublicKeysTrustEvaluator: ServerTrustEvaluating {
private let keys: [SecKey]
private let performDefaultValidation: Bool
private let validateHost: Bool
/// Creates a `PublicKeysTrustEvaluator` from the provided parameters.
///
/// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
/// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
///
/// - Parameters:
/// - keys: The `SecKey`s to use to validate public keys. Defaults to the public keys of all
/// certificates included in the main bundle.
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition to
/// performing the default evaluation, even if `performDefaultValidation` is `false`.
/// `true` by default.
public init(keys: [SecKey] = Bundle.main.af.publicKeys,
performDefaultValidation: Bool = true,
validateHost: Bool = true) {
self.keys = keys
self.performDefaultValidation = performDefaultValidation
self.validateHost = validateHost
}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
guard !keys.isEmpty else {
throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound)
}
if performDefaultValidation {
try trust.af.performDefaultValidation(forHost: host)
}
if validateHost {
try trust.af.performValidation(forHost: host)
}
let pinnedKeysInServerKeys: Bool = {
for serverPublicKey in trust.af.publicKeys {
for pinnedPublicKey in keys {
if serverPublicKey == pinnedPublicKey {
return true
}
}
}
return false
}()
if !pinnedKeysInServerKeys {
throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host,
trust: trust,
pinnedKeys: keys,
serverKeys: trust.af.publicKeys))
}
}
}
extension ServerTrustEvaluating where Self == PublicKeysTrustEvaluator {
/// Provides a default `PublicKeysTrustEvaluator` instance.
public static var publicKeys: PublicKeysTrustEvaluator { PublicKeysTrustEvaluator() }
/// Creates a `PublicKeysTrustEvaluator` from the provided parameters.
///
/// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
/// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
///
/// - Parameters:
/// - keys: The `SecKey`s to use to validate public keys. Defaults to the public keys of all
/// certificates included in the main bundle.
/// - performDefaultValidation: Determines whether default validation should be performed in addition to
/// evaluating the pinned certificates. `true` by default.
/// - validateHost: Determines whether or not the evaluator should validate the host, in addition to
/// performing the default evaluation, even if `performDefaultValidation` is `false`.
/// `true` by default.
public static func publicKeys(keys: [SecKey] = Bundle.main.af.publicKeys,
performDefaultValidation: Bool = true,
validateHost: Bool = true) -> PublicKeysTrustEvaluator {
PublicKeysTrustEvaluator(keys: keys, performDefaultValidation: performDefaultValidation, validateHost: validateHost)
}
}
/// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the
/// evaluators consider it valid.
public final class CompositeTrustEvaluator: ServerTrustEvaluating {
private let evaluators: [ServerTrustEvaluating]
/// Creates a `CompositeTrustEvaluator` from the provided evaluators.
///
/// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.
public init(evaluators: [ServerTrustEvaluating]) {
self.evaluators = evaluators
}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
try evaluators.evaluate(trust, forHost: host)
}
}
extension ServerTrustEvaluating where Self == CompositeTrustEvaluator {
/// Creates a `CompositeTrustEvaluator` from the provided evaluators.
///
/// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.
public static func composite(evaluators: [ServerTrustEvaluating]) -> CompositeTrustEvaluator {
CompositeTrustEvaluator(evaluators: evaluators)
}
}
/// Disables all evaluation which in turn will always consider any server trust as valid.
///
/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
/// certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
///
/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
@available(*, deprecated, renamed: "DisabledTrustEvaluator", message: "DisabledEvaluator has been renamed DisabledTrustEvaluator.")
public typealias DisabledEvaluator = DisabledTrustEvaluator
/// Disables all evaluation which in turn will always consider any server trust as valid.
///
///
/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
/// certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
///
/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
public final class DisabledTrustEvaluator: ServerTrustEvaluating {
/// Creates an instance.
public init() {}
public func evaluate(_ trust: SecTrust, forHost host: String) throws {}
}
// MARK: - Extensions
extension Array where Element == ServerTrustEvaluating {
#if os(Linux) || os(Windows)
// Add this same convenience method for Linux/Windows.
#else
/// Evaluates the given `SecTrust` value for the given `host`.
///
/// - Parameters:
/// - trust: The `SecTrust` value to evaluate.
/// - host: The host for which to evaluate the `SecTrust` value.
///
/// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`.
public func evaluate(_ trust: SecTrust, forHost host: String) throws {
for evaluator in self {
try evaluator.evaluate(trust, forHost: host)
}
}
#endif
}
extension Bundle: AlamofireExtended {}
extension AlamofireExtension where ExtendedType: Bundle {
/// Returns all valid `cer`, `crt`, and `der` certificates in the bundle.
public var certificates: [SecCertificate] {
paths(forResourcesOfTypes: [".cer", ".CER", ".crt", ".CRT", ".der", ".DER"]).compactMap { path in
guard
let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,
let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil }
return certificate
}
}
/// Returns all public keys for the valid certificates in the bundle.
public var publicKeys: [SecKey] {
certificates.af.publicKeys
}
/// Returns all pathnames for the resources identified by the provided file extensions.
///
/// - Parameter types: The filename extensions locate.
///
/// - Returns: All pathnames for the given filename extensions.
public func paths(forResourcesOfTypes types: [String]) -> [String] {
Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) }))
}
}
extension SecTrust: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == SecTrust {
/// Evaluates `self` after applying the `SecPolicy` value provided.
///
/// - Parameter policy: The `SecPolicy` to apply to `self` before evaluation.
///
/// - Throws: Any `Error` from applying the `SecPolicy` or from evaluation.
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
public func evaluate(afterApplying policy: SecPolicy) throws {
try apply(policy: policy).af.evaluate()
}
/// Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed.
///
/// - Parameters:
/// - policy: The `SecPolicy` used to evaluate `self`.
/// - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`.
/// - Throws: Any `Error` from applying the `policy`, or the result of `errorProducer` if validation fails.
@available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
@available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(afterApplying:)")
@available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
@available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(afterApplying:)")
public func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
try apply(policy: policy).af.validate(errorProducer: errorProducer)
}
/// Applies a `SecPolicy` to `self`, throwing if it fails.
///
/// - Parameter policy: The `SecPolicy`.
///
/// - Returns: `self`, with the policy applied.
/// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason.
public func apply(policy: SecPolicy) throws -> SecTrust {
let status = SecTrustSetPolicies(type, policy)
guard status.af.isSuccess else {
throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type,
policy: policy,
status: status))
}
return type
}
/// Evaluate `self`, throwing an `Error` if evaluation fails.
///
/// - Throws: `AFError.serverTrustEvaluationFailed` with reason `.trustValidationFailed` and associated error from
/// the underlying evaluation.
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
public func evaluate() throws {
var error: CFError?
let evaluationSucceeded = SecTrustEvaluateWithError(type, &error)
if !evaluationSucceeded {
throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))
}
}
/// Validate `self`, passing any failure values through `errorProducer`.
///
/// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an
/// `Error`.
/// - Throws: The `Error` produced by the `errorProducer` closure.
@available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
@available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate()")
@available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
@available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate()")
public func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
var result = SecTrustResultType.invalid
let status = SecTrustEvaluate(type, &result)
guard status.af.isSuccess && result.af.isSuccess else {
throw errorProducer(status, result)
}
}
/// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain.
///
/// - Parameter certificates: The `SecCertificate`s to add to the chain.
/// - Throws: Any error produced when applying the new certificate chain.
public func setAnchorCertificates(_ certificates: [SecCertificate]) throws {
// Add additional anchor certificates.
let status = SecTrustSetAnchorCertificates(type, certificates as CFArray)
guard status.af.isSuccess else {
throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status,
certificates: certificates))
}
// Trust only the set anchor certs.
let onlyStatus = SecTrustSetAnchorCertificatesOnly(type, true)
guard onlyStatus.af.isSuccess else {
throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: onlyStatus,
certificates: certificates))
}
}
/// The public keys contained in `self`.
public var publicKeys: [SecKey] {
certificates.af.publicKeys
}
/// The `SecCertificate`s contained in `self`.
public var certificates: [SecCertificate] {
#if swift(>=5.5.1) // Xcode 13.1 / 2021 SDKs.
if #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) {
return (SecTrustCopyCertificateChain(type) as? [SecCertificate]) ?? []
} else {
return (0..<SecTrustGetCertificateCount(type)).compactMap { index in
SecTrustGetCertificateAtIndex(type, index)
}
}
#else
(0..<SecTrustGetCertificateCount(type)).compactMap { index in
SecTrustGetCertificateAtIndex(type, index)
}
#endif
}
/// The `Data` values for all certificates contained in `self`.
public var certificateData: [Data] {
certificates.af.data
}
/// Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname.
///
/// - Parameter host: The hostname, used only in the error output if validation fails.
/// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
public func performDefaultValidation(forHost host: String) throws {
if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
try evaluate(afterApplying: SecPolicy.af.default)
} else {
try validate(policy: SecPolicy.af.default) { status, result in
AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init(host, type, status, result)))
}
}
}
/// Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as
/// hostname validation.
///
/// - Parameter host: The hostname to use in the validation.
/// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
public func performValidation(forHost host: String) throws {
if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
try evaluate(afterApplying: SecPolicy.af.hostname(host))
} else {
try validate(policy: SecPolicy.af.hostname(host)) { status, result in
AFError.serverTrustEvaluationFailed(reason: .hostValidationFailed(output: .init(host, type, status, result)))
}
}
}
}
extension SecPolicy: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == SecPolicy {
/// Creates a `SecPolicy` instance which will validate server certificates but not require a host name match.
public static let `default` = SecPolicyCreateSSL(true, nil)
/// Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname.
///
/// - Parameter hostname: The hostname to validate against.
///
/// - Returns: The `SecPolicy`.
public static func hostname(_ hostname: String) -> SecPolicy {
SecPolicyCreateSSL(true, hostname as CFString)
}
/// Creates a `SecPolicy` which checks the revocation of certificates.
///
/// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation.
///
/// - Returns: The `SecPolicy`.
/// - Throws: An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed`
/// if the policy cannot be created.
public static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy {
guard let policy = SecPolicyCreateRevocation(options.rawValue) else {
throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed)
}
return policy
}
}
extension Array: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == [SecCertificate] {
/// All `Data` values for the contained `SecCertificate`s.
public var data: [Data] {
type.map { SecCertificateCopyData($0) as Data }
}
/// All public `SecKey` values for the contained `SecCertificate`s.
public var publicKeys: [SecKey] {
type.compactMap(\.af.publicKey)
}
}
extension SecCertificate: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == SecCertificate {
/// The public key for `self`, if it can be extracted.
///
/// - Note: On 2020 OSes and newer, only RSA and ECDSA keys are supported.
///
public var publicKey: SecKey? {
let policy = SecPolicyCreateBasicX509()
var trust: SecTrust?
let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust)
guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil }
#if swift(>=5.3.1) // SecTrustCopyKey not visible in Xcode <= 12.1, despite being a 2020 API.
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {
return SecTrustCopyKey(createdTrust)
} else {
return SecTrustCopyPublicKey(createdTrust)
}
#else
return SecTrustCopyPublicKey(createdTrust)
#endif
}
}
extension OSStatus: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == OSStatus {
/// Returns whether `self` is `errSecSuccess`.
public var isSuccess: Bool { type == errSecSuccess }
}
extension SecTrustResultType: AlamofireExtended {}
extension AlamofireExtension where ExtendedType == SecTrustResultType {
/// Returns whether `self is `.unspecified` or `.proceed`.
public var isSuccess: Bool {
type == .unspecified || type == .proceed
}
}
#endif
| [
106150,
111367,
35048,
184266,
116619,
172427,
263758,
52879,
213424,
171374,
242672,
242354,
248982,
433143,
175766,
220,
64861,
59454
] |
37dc6e65fa9c02ff2b63269bee19d8ab32966f7e | 1674773f79151e3a3b33ef24645ff289b07f4c04 | /MySwiftApp/Data/Interactors/Intereactor.swift | 90a517240c4bbe4d1f1294c8f1b8baa973e7cbdc | [] | no_license | harsewaksingh13/theswiftapp | e1dd3d49a24d8af65b82773c1b04c4aa308d697c | 3c7f2a819345de6a5b3d854b3318c888882c21a0 | refs/heads/master | 2021-06-09T03:35:40.158932 | 2021-04-20T19:53:25 | 2021-04-20T19:53:25 | 158,457,317 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,921 | swift | //
// ViewModel.swift
// MySwiftApp
//
// Created by Harsewak Singh on 10/01/2019.
// Copyright © 2019 Harsewak Singh. All rights reserved.
//
import Foundation
import Alamofire
protocol Interactor {
associatedtype R
associatedtype T
func post(request: R,_ responseHandler:@escaping ResponseHandler<T>,_ errorHandler:@escaping ErrorHandler)
func put(request: R,_ responseHandler:@escaping ResponseHandler<T>,_ errorHandler:@escaping ErrorHandler)
func get(_ responseHandler:@escaping ResponseHandler<T>,_ errorHandler:@escaping ErrorHandler)
func delete(id: String,_ responseHandler:@escaping ResponseHandler<Bool>,_ errorHandler:@escaping ErrorHandler)
func getAll(_ responseHandler:@escaping ResponseHandler<[T]>,_ errorHandler:@escaping ErrorHandler)
}
//create default base class so serviceManager, dataManager instances will be used in all subclasses
class BaseInteractor<Req,Res>: Interactor {
//T is response object
typealias T = Res
//R is request
typealias R = Req
@Inject var serviceManager: ServiceManager
@Inject var dataManager: DataManager
var dataRequest: DataRequest?
func post(request: R,_ responseHandler:@escaping ResponseHandler<Res>,_ errorHandler:@escaping ErrorHandler){
}
func put(request: R,_ responseHandler:@escaping ResponseHandler<Res>,_ errorHandler:@escaping ErrorHandler){
}
func get(_ responseHandler:@escaping ResponseHandler<Res>,_ errorHandler:@escaping ErrorHandler){
}
func delete(id: String,_ responseHandler:@escaping ResponseHandler<Bool>,_ errorHandler:@escaping ErrorHandler){
}
func getAll(_ responseHandler:@escaping ResponseHandler<[Res]>,_ errorHandler:@escaping ErrorHandler){
}
func cancel() {
dataRequest?.cancel()
}
}
| [
-1
] |
e2236501c7ee7c0912f52f87f294c71a038d2d44 | f7f1b0d69e2c235b0d57fc8aabb0dd67d93e45e8 | /Oneline/ViewController.swift | d9a03c98a0733f96e7ea48df1d0d63a401182254 | [
"MIT"
] | permissive | hoangta/Oneline | d62a6ddf46541ec2acb1f65de99cfff6b9ff1a73 | 7829cd1c46b09d67c11b834b7cf67d0e81f97cca | refs/heads/master | 2020-03-15T04:15:49.463368 | 2019-06-23T08:08:25 | 2019-06-23T08:08:32 | 131,961,179 | 7 | 2 | MIT | 2019-05-30T05:52:07 | 2018-05-03T07:56:21 | Swift | UTF-8 | Swift | false | false | 304 | swift | //
// ViewController.swift
// One
//
// Created by Hoang Ta on 5/3/18.
// Copyright © 2018 2359Media. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func benchMark(_ sender: Any) {
}
}
| [
-1
] |
72b55b859d3c112aef0fdc1c474943718e0d0147 | fff43eec945b04f24afd16bb1cb56c4e6fba4379 | /Simple Notes/AppDelegate.swift | 1e56edeee13c22b9382f3035f17813ee9a37e068 | [] | no_license | nairaAbdallah/Simple-Notes | 16fe0910aa31275353dddcd4bdcdeadcbae6ef8a | 0c057da498e2e78aa4ba61ddb34f9b5a169ab530 | refs/heads/main | 2023-07-03T09:42:10.558449 | 2021-08-15T20:38:27 | 2021-08-15T20:38:27 | 395,522,907 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,809 | swift | //
// AppDelegate.swift
// Simple Notes
//
// Created by Naira Bassam on 03/08/2021.
//
import UIKit
import CoreData
import RealmSwift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// print(Realm.Configuration.defaultConfiguration.fileURL)
do {
_ = try Realm()
}catch {
print("Error initialising new realm, \(error)")
}
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.
}
// MARK: - Core Data stack
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "DataModel")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
| [
199680,
379906,
253443,
418820,
249351,
328199,
384007,
379914,
372747,
199180,
377866,
326668,
329233,
350738,
186387,
349202,
262677,
324121,
245274,
377371,
345630,
384032,
362529,
349738,
394795,
404523,
262701,
245293,
349744,
361524,
337975,
343609,
375867,
333373,
418366,
152127,
339009,
413250,
214087,
352840,
377930,
337994,
370253,
330319,
200784,
173647,
436306,
333395,
244308,
374358,
329815,
254042,
402522,
326239,
322658,
340579,
244329,
333422,
349295,
204400,
173169,
339571,
330868,
344693,
268921,
343167,
192639,
344707,
330884,
336516,
266374,
385670,
346768,
268434,
409236,
333988,
336548,
379048,
377001,
356520,
361644,
402614,
361655,
325308,
339132,
343231,
403138,
337092,
244933,
322758,
337606,
367816,
257738,
342736,
245460,
257751,
385242,
366300,
165085,
350433,
345826,
395495,
363755,
346348,
325358,
338158,
212722,
251122,
350453,
338679,
393465,
351482,
264961,
115972,
346890,
362251,
328460,
333074,
257814,
333592,
397084,
342813,
257824,
362272,
377120,
389416,
336680,
384298,
254252,
204589,
366383,
328497,
257842,
339768,
326969,
384828,
386365,
204606,
375615,
257852,
339792,
358737,
389970,
361299,
155476,
257880,
330584,
361305,
362843,
429406,
374112,
353633,
439137,
355184,
361333,
332156,
337277,
260992,
245120,
380802,
389506,
337290,
155020,
337813,
348565,
250262,
155044,
333221,
373671,
333736,
252845,
356781,
268210,
370610,
210356,
342452,
370102,
338362,
327612,
358335,
380352,
201157,
187334,
333766,
339400,
347081,
349128,
358347,
393670,
336325,
272848,
379856,
155603,
399317,
249302,
379863,
372697,
155102,
182754,
360429,
338927,
330224,
379895,
201723,
257020,
254461
] |
df009f183a952f607046e98f91e98620b4cb00c7 | a5a4d7a9c627e24d1532c191fd1728d1e6df6cc9 | /AMAppkit/UITableView+Reloading.swift | 284ec0b252335a73c03056867cb2c31f8bae3e5f | [] | no_license | ivkuznetsov/AMAppkit | 68c143923b3ef05c0b44bf73c50deac972ea7dae | 1e2ea595ff99198945499f29015a7431cf9acdb8 | refs/heads/master | 2021-06-03T05:19:30.738074 | 2020-06-02T16:18:03 | 2020-06-02T16:18:03 | 113,862,476 | 2 | 7 | null | 2019-11-25T12:08:13 | 2017-12-11T13:29:31 | Objective-C | UTF-8 | Swift | false | false | 2,452 | swift | //
// UITableView+Reloading.swift
// AMAppkit
//
// Created by Ilya Kuznetsov on 6/1/18.
//
import UIKit
public extension UITableView {
private func printDuplicates(_ array: [AnyHashable]) {
var allSet = Set<AnyHashable>()
for object in array {
if allSet.contains(object) {
print("found duplicated object %@", object.description)
} else {
allSet.insert(object)
}
}
}
func reload(oldData: [AnyHashable], newData: [AnyHashable], deferred: (()->())?, updateObjects: (()->())?, addAnimation: UITableView.RowAnimation) {
var toAdd: [IndexPath] = []
var toDelete: [IndexPath] = []
let oldDataSet = Set(oldData)
let newDataSet = Set(newData)
if oldDataSet.count != oldData.count {
printDuplicates(oldData)
}
if newDataSet.count != newData.count {
printDuplicates(newData)
}
let currentSet = NSMutableOrderedSet(array: oldData)
for (index, object) in oldData.enumerated() {
if !newDataSet.contains(object) {
toDelete.append(IndexPath(row: index, section: 0))
currentSet.remove(object)
}
}
for (index, object) in newData.enumerated() {
if !oldDataSet.contains(object) {
toAdd.append(IndexPath(row: index, section: 0))
currentSet.insert(object, at: index)
}
}
var itemsToMove: [(from: IndexPath, to: IndexPath)] = []
for (index, object) in newData.enumerated() {
let oldDataIndex = currentSet.index(of: object)
if index != oldDataIndex {
itemsToMove.append((from: IndexPath(row: oldData.firstIndex(of: object)!, section: 0), to: IndexPath(row: index, section: 0)))
}
}
self.beginUpdates()
updateObjects?()
if !toDelete.isEmpty {
self.deleteRows(at: toDelete, with: .fade)
}
if !toAdd.isEmpty {
self.insertRows(at: toAdd, with: addAnimation)
}
if !itemsToMove.isEmpty {
for couple in itemsToMove {
self.moveRow(at: couple.from, to: couple.to)
}
}
deferred?()
self.endUpdates()
}
}
| [
-1
] |
6be6f670936be061b3f070d3fb14a224de579c53 | 65487e7757627fadcf544a5a84affd3813c70bee | /Hospital.swift | e06b9365c79f30face69de43831cb94da41de9b7 | [] | no_license | danra2/HospitalFinderiOSApp | 85c195e141a28c991b00445785f980c73670b2ef | dec9a574e5138cf59dca43e330ad7e30fd27a897 | refs/heads/master | 2021-01-20T17:26:23.760061 | 2018-12-25T07:25:13 | 2018-12-25T07:25:13 | 64,176,531 | 0 | 1 | null | 2016-07-28T20:24:46 | 2016-07-26T00:20:21 | Makefile | UTF-8 | Swift | false | false | 1,616 | swift | //
// Hospital.swift
// HospitalFinder
//
// Created by Daniel Ra on 7/25/16.
// Copyright © 2016 Daniel Ra. All rights reserved.
//
import Foundation
import CoreData
import UIKit
import CoreLocation
class Hospital: NSObject {
var name: String = ""
var id = Int()
var location = ""
var latitude = 0.00 // Yung's code
var longitude = 0.00 // Yung's code
var startTime = "" // Yung's code
var endTime = "" // Yung's code
var consultingFee = 0.00
var phoneNumber = ""
var website = ""
var insurance = [] // Yung's code
var descript = "" // Yung's code
var rating:Float = 0.00
var imageUrl:String?
var image:UIImage?
var distanceFromUser:CLLocationDistance = 0 as! Double
// Insert code here to add functionality to your managed object subclass
static func getAllHospitals(completionHandler: (data: NSData?, response: NSURLResponse?, error: NSError?) -> Void) {
// Specify the url that we will be sending the GET Request to
let url = NSURL(string: "https://hospitalfinder.herokuapp.com/api/hospitals")
// Create an NSURLSession to handle the request tasks
let session = NSURLSession.sharedSession()
// Create a "data task" which will request some data from a URL and then run the completion handler that we are passing into the getAllPeople function itself
let task = session.dataTaskWithURL(url!, completionHandler: completionHandler)
// Actually "execute" the task. This is the line that actually makes the request that we set up above
task.resume()
}
}
| [
-1
] |
64033bebb443aee618b11d98ad72c4a8306a4798 | 4b90f5a12d25a596dcdcf5764d742d50ea477ae7 | /PixcelCity/Controller/PopVC.swift | 816b74b879596541c4c6891fc3834924cf215a57 | [] | no_license | tiskender2/PixcelCity | fb820d8185d0ee416ebf79a904aa19e502c5db6b | 9d8c97355f3102393730c12c6cf6259144d46d6e | refs/heads/master | 2020-03-25T16:06:28.702393 | 2018-08-07T18:54:00 | 2018-08-07T18:54:00 | 143,914,835 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 874 | swift | //
// PopVC.swift
// PixcelCity
//
// Created by tolga iskender on 7.08.2018.
// Copyright © 2018 tolga iskender. All rights reserved.
//
import UIKit
class PopVC: UIViewController, UIGestureRecognizerDelegate {
@IBOutlet weak var popImageView: UIImageView!
var passedImage: UIImage!
func initData(forImage image: UIImage)
{
self.passedImage = image
}
override func viewDidLoad() {
super.viewDidLoad()
popImageView.image = passedImage
addDoubleTap()
}
func addDoubleTap()
{
let doubleTap = UITapGestureRecognizer(target: self, action: #selector(doubleTapped))
doubleTap.numberOfTapsRequired = 2
doubleTap.delegate = self
view.addGestureRecognizer(doubleTap)
}
@objc func doubleTapped()
{
dismiss(animated: true, completion: nil)
}
}
| [
326327
] |
4f9430db74f2dc965f712761377c82e479fd2438 | 1bfc1c36923509ebb74397555da51d6ead0b6bdb | /Source/String+Subscript.swift | bc6a68ed96f690dd3fe2513b3b63f4e2a7bd07ac | [
"MIT"
] | permissive | InVisionApp/CallStackParser | 29c7dcc83e6771581d602b0cfc8e315238017773 | 7f366bc8e89f6680e52d32da74e5e871729c90e0 | refs/heads/master | 2023-05-11T02:09:12.771767 | 2023-05-02T12:24:03 | 2023-05-02T12:24:03 | 278,437,660 | 0 | 0 | MIT | 2020-10-07T16:41:24 | 2020-07-09T18:11:13 | Swift | UTF-8 | Swift | false | false | 2,565 | swift | //
// String+Extensions.swift
//
// https://stackoverflow.com/a/24144365
// Copyright © 2018 aleclarson. All rights reserved.
//
import Foundation
internal extension String {
subscript (i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
subscript (bounds: CountableRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[start ..< end]
}
subscript (bounds: CountableClosedRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[start ... end]
}
subscript (bounds: CountablePartialRangeFrom<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(endIndex, offsetBy: -1)
return self[start ... end]
}
subscript (bounds: PartialRangeThrough<Int>) -> Substring {
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[startIndex ... end]
}
subscript (bounds: PartialRangeUpTo<Int>) -> Substring {
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[startIndex ..< end]
}
}
internal extension Substring {
subscript (i: Int) -> Character {
return self[index(startIndex, offsetBy: i)]
}
subscript (bounds: CountableRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[start ..< end]
}
subscript (bounds: CountableClosedRange<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[start ... end]
}
subscript (bounds: CountablePartialRangeFrom<Int>) -> Substring {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(endIndex, offsetBy: -1)
return self[start ... end]
}
subscript (bounds: PartialRangeThrough<Int>) -> Substring {
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[startIndex ... end]
}
subscript (bounds: PartialRangeUpTo<Int>) -> Substring {
let end = index(startIndex, offsetBy: bounds.upperBound)
return self[startIndex ..< end]
}
}
| [
-1
] |
eb25547764a87faaa8f451093af7ce331509cb07 | 7bdd9378817db1607b153e61e72387a7fad58e66 | /UIKitten/UIKitten/DrawerView.swift | f0135cf7ed8ee7b05cfd6b271d61d90ef45b55b3 | [] | no_license | cargath/UIKitten | bfce0e48bdbed8fe0dbbf2f81f123f40416b70bc | 1ac8d6272a72fb0447321c976af89b7c64315d22 | refs/heads/master | 2021-01-10T13:31:01.909293 | 2017-06-28T12:06:37 | 2017-06-28T12:06:37 | 55,871,896 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 356 | swift | //
// DrawerView.swift
// UIKitten
//
// Created by Carsten Könemann on 24.04.16.
// Copyright © 2016 cargath. All rights reserved.
//
import UIKit
public protocol DrawerViewDataSource: class {
func widthForDrawerView(_ drawerView: DrawerView) -> CGFloat
}
open class DrawerView: UIView {
open weak var dataSource: DrawerViewDataSource?
}
| [
-1
] |
80aeb54ed327c70bbd428dd660671a1b55dbb819 | 843a35418cf57b3f4c41274d66f63317ab66e8e5 | /Merchant/App/Settings/SettingsBuilder.swift | e51ceb8f1edaa7f6812538fc755a37ce4953b9ae | [
"MIT"
] | permissive | moradutf/bitcoin-cash-merchant-ios | 3526890e65050a0938d8cd20734b08448d4e5d4a | 94ad5af50665a192ebc4221a0fa32c4a0d7a21f9 | refs/heads/master | 2022-09-08T16:46:33.122136 | 2020-02-16T22:38:10 | 2020-02-16T22:38:10 | 266,834,430 | 2 | 0 | MIT | 2020-05-25T17:00:32 | 2020-05-25T17:00:32 | null | UTF-8 | Swift | false | false | 864 | swift | //
// SettingsBuilder.swift
// Merchant
//
// Created by Jean-Baptiste Dominguez on 2019/03/26.
// Copyright © 2019 Bitcoin.com. All rights reserved.
//
import UIKit
import BDCKit
class SettingsBuilder: BDCBuilder {
func provide() -> UIViewController {
let viewController = SettingsViewController()
let getCurrenciesInteractor = GetCurrenciesInteractor()
let editUserInteractor = EditUserInteractor()
let router = SettingsRouter(viewController)
let presenter = SettingsPresenter()
presenter.getCurrenciesInteractor = getCurrenciesInteractor
presenter.editUserInteractor = editUserInteractor
presenter.viewDelegate = viewController
presenter.router = router
viewController.presenter = presenter
return viewController
}
}
| [
-1
] |
e118ae8be8c44c15dee2eae67d84e59670ef37cd | d0280f41da8d9f0dba676fadd277e6bdf741149d | /validation-test/compiler_crashers_fixed/01098-no-stacktrace.swift | e7be52f53f2c4ce5332f41058ba1c466819169d0 | [
"Apache-2.0",
"Swift-exception"
] | permissive | zhongaiyemaozi/swift | 310a5867a3f797986ddaa3769589c5cc484ee47a | ca165e5c4afae294ae386c2ca4593e5f22c416f0 | refs/heads/master | 2021-01-12T10:05:08.416860 | 2016-12-13T09:00:12 | 2016-12-13T09:00:12 | 76,355,607 | 4 | 0 | null | 2016-12-13T12:11:21 | 2016-12-13T12:11:21 | null | UTF-8 | Swift | false | false | 615 | 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 https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
private class B<C> {
init(c: C) {
s {
func g<U>(h: (A, U) -> U) -> (A, U) -> U {
}
func f() {
}
}
struct d<f : e, g: e where g.h == f.h> {
}
protocol e {
}
enum A : String {
case b = ""
}
let c: A? = nil
if c == .b {
| [
77825,
93198,
77326,
79894,
78368,
93220,
75307,
94770,
75316,
77877,
94270,
93767,
92745,
92235,
76886,
95334,
80488,
94317,
96370,
80500,
93819,
78979,
76931,
95366,
91806,
79013,
75433,
95916,
77495,
76990,
91839,
91858,
95955,
92374,
77014,
93410,
92394,
77040,
80112,
92402,
79612,
76030,
93453,
93967,
78098,
96023,
96026,
96548,
79655,
94518,
95037,
78141,
95553,
78659,
93509,
91975,
75593,
95561,
91983,
93530,
94556,
96612,
76648,
79213,
79728,
75123,
93556,
79731,
79223,
76155,
76673,
95107,
78735,
95633,
75159,
79273,
75178,
96175,
80305,
92089,
79302,
96721,
77269,
94681,
96731,
92636,
75742,
75763,
80373,
75774
] |
126919822c6b266d9fda7cb9375b0878ce1c6680 | 9e7d58f5ffd2d1d2d5ab07048ce4598b2adb2df9 | /ExamReviewKeyConcepts/ExamReviewKeyConcepts.playground/Pages/Sequence, part 1.xcplaygroundpage/Contents.swift | 7cd95c7469b811921cbf4eb6333608b57655a137 | [] | no_license | rsgc-hodgson-a/exam-review-key-concepts | 28a9ed033f74f713c4802e768d23517da67ecc70 | 818119bea4579254bcb15560ea6e1e4e3889faf0 | refs/heads/master | 2020-12-30T13:19:47.022821 | 2017-05-19T14:07:32 | 2017-05-19T14:07:32 | 91,343,696 | 0 | 0 | null | 2017-05-15T13:54:03 | 2017-05-15T13:54:03 | null | UTF-8 | Swift | false | false | 1,081 | swift | //: [Previous](@previous) / [Next](@next)
//: # Sequence
//: The following two statements are required to make the playground run. Please do not remove.
import Cocoa
import PlaygroundSupport
/*:
## Consider
Read the code below.
Try to predict the results before running the program.
*/
// Create the canvas
let canvas = Canvas(width: 400, height: 300)
// No borders on shapes
canvas.drawShapesWithBorders = false
// Draw circles
canvas.fillColor = Color.blue
canvas.drawEllipse(centreX: 175, centreY: canvas.height / 2, width: 100, height: 100)
canvas.fillColor = Color.red
canvas.drawEllipse(centreX: 225, centreY: canvas.height / 2, width: 100, height: 100)
/*:
## Notes
The red circle overlaps the blue circle because the red circle is drawn after the blue circle. This is because the statement that draws the red circle (line 21) occurs after the statement that draws the blue circle (line 19).
## Template code
The code below is necessary to see results in the Assistant Editor at right. Please do not remove.
*/
PlaygroundPage.current.liveView = canvas.imageView | [
-1
] |
2ccd09ad6bef12891e00291e821fda13b23181c7 | 9201427b38ec889928d04f5d8a7498822b033d03 | /grouplunch/grouplunch/ViewController.swift | febc76740ad592ed17aa51c37520898254a90b22 | [
"MIT"
] | permissive | randymelder/GroupLunch | e097f832604217c4fe4051d25d8389c373de9529 | f5a0f1e143271c75431b0d665d9ad5c755c35de5 | refs/heads/master | 2021-01-22T23:53:05.395378 | 2015-02-26T13:32:48 | 2015-02-26T13:32:48 | 30,072,187 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 13,495 | swift | //
// ViewController.swift
// grouplunch
//
// Created by Randy Melder on 1/30/15.
// Copyright (c) 2015 RCM Software, LLC. All rights reserved.
//
import UIKit
import iAd
import MessageUI
class GroupLunchViewController: UIViewController, UITextFieldDelegate, ADBannerViewDelegate, MFMailComposeViewControllerDelegate {
let DEFAULT_LABEL_AMT = "0.00"
let DEFAULT_LABEL_PAYERS = "Qty of Payers"
let DEFAULT_LABEL_TIP = "Tip"
let DEFAULT_TIP_PCT = 15.0
let MINIMUM_PAYERS = 1
let MINIMUM_TIP_PCT = 0
let MINIMUM_BILL_AMT = 0.0
let TEXTFIELD_TAG_BILL_AMT = 111
let DEBUG_ON = false
let SEGUE_ID_SUPPORT = "supportSegue"
let TAG_IMAGE_LOGO = 444
var qty_payers:Int = 1
var pct_tip:Int = 0
var bill_amount:Double = 0.0
var app:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate
var EMAIL_SUPPORT_SUBJ = "Our Lunch bill by GroupLunch™ iOS App" as String
var amtTipTotal:Double = 0.0
var amtJustTipEach:Double = 0.0
var amtPreTipEach:Double = 0.0
var amtWithTipEach:Double = 0.0
var amtTotalBill:Double = 0.0
// --------------- UI Outlets -------------- //
@IBOutlet weak var stepperPayers: UIStepper!
@IBOutlet weak var stepperTip: UIStepper!
@IBOutlet weak var labelQtyPayers: UILabel!
@IBOutlet weak var labelTipPct: UILabel!
@IBOutlet weak var labelAmountTipTotal: UILabel!
@IBOutlet weak var labelAmountPreTipEach: UILabel!
@IBOutlet weak var labelAmountWithTipEach: UILabel!
@IBOutlet weak var labelAmountTotalBill: UILabel!
@IBOutlet weak var textFieldAmountOnBill: UITextField!
@IBOutlet weak var appversionLabel: UILabel!
@IBOutlet weak var adBanner: ADBannerView!
// MARK: ------------- Email -----------------
func configuredMailComposeViewController() -> MFMailComposeViewController {
let mailComposerVC = MFMailComposeViewController()
mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property
mailComposerVC.setSubject("\(self.EMAIL_SUPPORT_SUBJ)")
mailComposerVC.setMessageBody(self.getEmailHTML(), isHTML: true)
return mailComposerVC
}
func showSendMailErrorAlert() {
self.app.printLogMessage("Device cannot send email")
let sendMailErrorAlert = UIAlertView(title: "No Email??", message: "Your device appears to not have an email account configured. Please add an account.", delegate: self, cancelButtonTitle: "OK")
sendMailErrorAlert.show()
}
func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!) {
if (nil != error) {
self.app.printLogMessage(error.description)
}
self.dismissViewControllerAnimated(true, completion: nil)
}
// MARK: --------------- UI Actions --------------
@IBAction func doEmailButton(sender: AnyObject) {
let mailComposeViewController = configuredMailComposeViewController()
if MFMailComposeViewController.canSendMail() {
self.presentViewController(mailComposeViewController, animated: true, completion: nil)
} else {
self.showSendMailErrorAlert()
}
}
@IBAction func doAmountChange(sender: UITextField) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
}
@IBAction func doQtyPayers(sender: UIStepper) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
var value:Int = Int(sender.value)
self.view.endEditing(true)
if (value > self.MINIMUM_PAYERS) {
self.qty_payers = value
} else {
self.qty_payers = MINIMUM_PAYERS
sender.value = Double(MINIMUM_PAYERS)
}
self.labelQtyPayers.text = NSString(format: "%@ %d:", self.DEFAULT_LABEL_PAYERS, self.qty_payers)
doCalculateAmounts()
}
@IBAction func doTipChange(sender: UIStepper) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
var value:Int = Int(sender.value)
self.view.endEditing(true)
if (value > self.MINIMUM_TIP_PCT) {
self.pct_tip = value
} else {
self.pct_tip = MINIMUM_TIP_PCT
sender.value = Double(MINIMUM_TIP_PCT)
}
self.labelTipPct.text = NSString(format: "%@ %d%%", self.DEFAULT_LABEL_TIP, self.pct_tip)
doCalculateAmounts()
}
func doCalculateAmounts() {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
self.amtTipTotal = self.bill_amount * (Double(self.pct_tip) / 100);
self.amtJustTipEach = amtTipTotal / Double(self.qty_payers)
self.amtPreTipEach = self.bill_amount / Double(self.qty_payers)
self.amtWithTipEach = amtJustTipEach + amtPreTipEach
self.amtTotalBill = amtTipTotal + self.bill_amount
self.labelAmountTipTotal.text = NSString(format: "%.2lf", self.amtTipTotal)
self.labelAmountPreTipEach.text = NSString(format: "%.2lf", self.amtPreTipEach)
self.labelAmountWithTipEach.text = NSString(format: "%.2lf", self.amtWithTipEach)
self.labelAmountTotalBill.text = NSString(format: "%.2lf", self.amtTotalBill)
}
// MARK: -------------- Initial UI SETUP
func doSetInitialValues() {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
self.pct_tip = Int(DEFAULT_TIP_PCT)
self.labelAmountTipTotal.text = self.DEFAULT_LABEL_AMT
self.labelAmountPreTipEach.text = self.DEFAULT_LABEL_AMT
self.labelAmountWithTipEach.text = self.DEFAULT_LABEL_AMT
self.labelAmountTotalBill.text = self.DEFAULT_LABEL_AMT
self.textFieldAmountOnBill.text = self.DEFAULT_LABEL_AMT
self.labelQtyPayers.text = NSString(format: "%@ %d:", self.DEFAULT_LABEL_PAYERS, self.qty_payers)
self.labelTipPct.text = NSString(format: "%@ %d%%", self.DEFAULT_LABEL_TIP, self.pct_tip)
self.stepperPayers.value = 1
self.stepperTip.value = DEFAULT_TIP_PCT
}
func getEmailHTML() -> String {
let html = " <p><img alt=\"\" src=\"http://cdn.spininternetmedia.com/spininternetmedia.com/grouplunchapp/logo_20150214.png\" style=\"border-width: 0px; border-style: solid; margin: 2px; width: 200px; height: 39px;\"/></p><p>Lunch Bill Breakdown</p><table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 350px;\"><tbody><tr><td style=\"text-align: right;\" width=\"50%\">Amount on Bill:</td><td width=\"50%\">$[[AMOUNT_ON_BILL]]</td></tr><tr><td style=\"text-align: right;\">Qty of Payers: </td><td>[[QTY_PAYERS]]</td></tr><tr><td style=\"text-align: right;\">Tip %: </td><td>[[TIP_PCT]]</td></tr><tr><td style=\"text-align: right;\">Tip Total:</td><td>$[[TIP_TOTAL]]</td></tr><tr><td style=\"text-align: right;\">Pre Tip Each:</td><td>$[[PRE_TIP_EACH]]</td></tr><tr><td style=\"text-align: right;\">With Tip Each:</td><td>$[[WITH_TIP_EACH]]</td></tr><tr><td style=\"text-align: right;\">Total Bill: </td><td>$[[TOTAL_BILL]]</td></tr></tbody></table><h2>Group Lunch™ for iOS</h2><p><a href=\"itmss://itunes.apple.com/us/app/group-lunch/id406438527\" target=\"_blank\"><img alt=\"Download Group Lunch at the App Store\" border=\"0\" src=\"http://spininternetmedia.com/wp-content/uploads/2013/11/Download_on_the_App_Store_Badge_US-UK_135x40.png\" style=\"margin: 2px; width: 135px; height: 40px; border:0;\"/></a></p><p>"Group Lunch" is a trademark of RCM Software, LLC</p>"
let html1 = html.stringByReplacingOccurrencesOfString("[[AMOUNT_ON_BILL]]", withString: self.textFieldAmountOnBill.text, options: NSStringCompareOptions.LiteralSearch, range: nil)
let html2 = html1.stringByReplacingOccurrencesOfString("[[QTY_PAYERS]]", withString: String(self.qty_payers), options: NSStringCompareOptions.LiteralSearch, range: nil)
let html3 = html2.stringByReplacingOccurrencesOfString("[[TIP_PCT]]", withString: String(self.pct_tip), options: NSStringCompareOptions.LiteralSearch, range: nil)
let html4 = html3.stringByReplacingOccurrencesOfString("[[TIP_TOTAL]]", withString: String(format:"%.2f", self.amtTipTotal), options: NSStringCompareOptions.LiteralSearch, range: nil)
let html5 = html4.stringByReplacingOccurrencesOfString("[[PRE_TIP_EACH]]", withString: String(format:"%.2f", self.amtPreTipEach), options: NSStringCompareOptions.LiteralSearch, range: nil)
let html6 = html5.stringByReplacingOccurrencesOfString("[[WITH_TIP_EACH]]", withString: String(format:"%.2f", self.amtWithTipEach), options: NSStringCompareOptions.LiteralSearch, range: nil)
let html7 = html6.stringByReplacingOccurrencesOfString("[[TOTAL_BILL]]", withString: String(format:"%.2f", self.amtTotalBill), options: NSStringCompareOptions.LiteralSearch, range: nil)
return html7
}
// MARK: --------------- Delegates ----------------
func textFieldDidBeginEditing(textField: UITextField) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
if (self.TEXTFIELD_TAG_BILL_AMT == textField.tag) {
textField.text = ""
}
}
func textFieldDidEndEditing(textField: UITextField) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
var amount:Double = self.MINIMUM_BILL_AMT
if (self.TEXTFIELD_TAG_BILL_AMT == textField.tag) {
amount = (textField.text as NSString).doubleValue
}
self.bill_amount = amount
textField.text = NSString(format: "%1.2lf", amount)
doCalculateAmounts()
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
textField.resignFirstResponder()
return true
}
func bannerViewWillLoadAd(banner: ADBannerView!) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
self.adBanner.hidden = false
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
println("Ad failed with error: %s", error.description)
self.adBanner.hidden = true
}
// MARK: --------------- Built Ins ----------------
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
var touch: UITouch = touches.anyObject() as UITouch
if (touch.view.isKindOfClass(UIImageView)) {
let touchedView: UIImageView = touch.view as UIImageView
if (self.TAG_IMAGE_LOGO == touchedView.tag) {
performSegueWithIdentifier(SEGUE_ID_SUPPORT, sender: self)
}
}
}
override func viewDidLoad() {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// AppDelegate
self.app = UIApplication.sharedApplication().delegate as AppDelegate
// Set start amounts
doSetInitialValues()
self.textFieldAmountOnBill.delegate = self
self.textFieldAmountOnBill.keyboardType = UIKeyboardType.DecimalPad
// Version
let appversion = NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleVersionKey as NSString) as String
self.appversionLabel.text = appversion
// Banner
self.canDisplayBannerAds = true
self.adBanner.delegate = self
self.adBanner.hidden = true
}
override func didReceiveMemoryWarning() {
if (self.DEBUG_ON) { app.printLogLine("\(__FUNCTION__)", fileName: "\(__FILE__)", lineNumber: (__LINE__)) }
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
81c0008e4c8be3e1d681042dcc5b77a84a45224e | 1ef3ecc5ed603e6dd94aca4f35935b6856b1b5a7 | /APISDKFront/APISDKFront/Data/ConfigModule.swift | f8e9b4f5d606f7a691385878f38b0067a505df82 | [] | no_license | emilioalvarezdiaz/api-sdk-front-ios | bbcbab2e751576efe44ce6be96e0e85d8dda0ae2 | 2e9011ecdaa4fb77c2250da0535efb7c79da4b18 | refs/heads/master | 2020-11-23T21:54:29.080258 | 2017-08-25T09:42:44 | 2017-08-25T09:42:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 494 | swift | //
// DataModule.swift
// SDKFrontiOS
//
// Created by Sergio Girao on 15/9/16.
// Copyright © 2016 Tagsonomy. All rights reserved.
//
import UIKit
open class ConfigModule: NSObject {
fileprivate(set) var moduleName : String?;
fileprivate(set) var targets : [Target]?;
var isValid : Bool = false;
init(moduleName : String, targets : [Target]? = nil){
super.init();
self.moduleName = moduleName;
self.targets = targets;
}
}
| [
-1
] |
483fd12abf55aded3f3d02aa7e8ebd93e646482a | 064ce7e6d8e19511159016ca7c4a5989d9019d49 | /Honest Badger/EditResponseTableViewController.swift | fcc88e8c7ce3b5b635737650ec67be744c987188 | [] | no_license | stevenjamescox/Honest-Badger | 7f266ab8f3f82b09853dc2d06c4c78a79342a7c2 | 4e9773c5a308e07d446a7fa35d92fd6eb12df8e1 | refs/heads/master | 2020-05-21T20:29:38.722297 | 2016-10-28T11:43:35 | 2016-10-28T11:43:35 | 62,829,076 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,936 | swift | //
// EditResponseTableViewController.swift
// Honest Badger
//
// Created by Steve Cox on 9/16/16.
// Copyright © 2016 stevecoxio. All rights reserved.
//
import UIKit
import MessageUI
class EditResponseTableViewController: UITableViewController, UITextViewDelegate, MFMailComposeViewControllerDelegate {
var question: Question?
var currentIndexPath: IndexPath?
var timer: Timer?
var formatter = DateComponentsFormatter()
var cellHeight: CGFloat?
var responseTextToPresent: String = ""
override func viewDidLoad() {
super.viewDidLoad()
navBar.barTintColor = UIColor.badgerBlue()
navBar.tintColor = UIColor.black
responseEntryField.becomeFirstResponder()
responseEntryField.delegate = self
questionPresent.text = "\(question!.questionText)"
ResponseController.getSingleResponse(question!) { (responseText) in
if responseText != nil {
self.responseTextToPresent = responseText!
self.responseEntryField.text = self.responseTextToPresent
}
}
timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerFired(_:)), userInfo: nil, repeats: true)
questionPresent.font = UIFont.init(name: "Rockwell", size: 21.0)
countdownClock.font = UIFont.init(name: "Rockwell", size: 26.0)
timeLeftOutlet.font = UIFont.init(name: "Rockwell", size: 25.0)
reviseResponseButtonOutlet.titleLabel?.font = UIFont.init(name: "Rockwell", size: 21.0)
deleteResponseButtonOutlet.titleLabel?.font = UIFont.init(name: "Rockwell", size: 21.0)
}
// MARK: - Outlets
@IBOutlet weak var navBar: UINavigationBar!
@IBOutlet weak var questionPresent: UILabel!
@IBOutlet weak var responseEntryField: UITextView!
@IBOutlet weak var countdownClock: UILabel!
@IBOutlet weak var reviseResponseButtonOutlet: UIButton!
@IBOutlet weak var reviseResponseBarButtonOutlet: UIBarButtonItem!
@IBOutlet weak var deleteResponseButtonOutlet: UIButton!
@IBOutlet weak var timeLeftOutlet: UILabel!
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newLength = textView.text!.characters.count + text.characters.count - range.length
if textView == responseEntryField {
return newLength <= 200
}
return true
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 13
}
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cell.separatorInset = UIEdgeInsets.zero
cell.layoutMargins = UIEdgeInsets.zero
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch (indexPath as NSIndexPath).row {
case 0:
return 65
case 1:
return 30
case 2:
return cellHeight! - 60
case 3:
return 30
case 4:
return 120
case 5:
return 50
case 6:
return 4
case 7:
return 70
case 8:
return 4
case 9:
return 70
case 10:
return 4
case 11:
return 90
case 12:
return 300
default:
return 50
}
}
func showSendMailErrorAlert(){
let sendMailErrorAlert =
UIAlertController(title: "Couldn't Send Email", message: "Your device could not send e-mail. Please check e-mail configuration and try again.", preferredStyle: .alert)
let dismissAction = UIAlertAction(title: "Dismiss", style: .cancel){ (action) in print(action)}
sendMailErrorAlert.addAction(dismissAction)
self.present(sendMailErrorAlert, animated: true, completion: nil)
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
self.dismiss(animated: true, completion: nil)
}
override func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none)
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Report question as inappropriate", style: .destructive) { action in
print("reported question at \(indexPath)")
if MFMailComposeViewController.canSendMail() {
let composeVC = MFMailComposeViewController()
composeVC.mailComposeDelegate = self
composeVC.setToRecipients(["[email protected]"])
composeVC.setSubject("Inappropriate Question Report")
composeVC.setMessageBody("Question to report:\n'\(self.question!.questionText)'\n\n Thank you for your report! Do you have any comments to add?: \n\n\n\n\n\n\n \n*******************\nDeveloper Data:\n\(self.question!.identifier!)\nts:\(self.question!.timestamp.timeIntervalSince1970)\ntL:\(self.question!.timeLimit.timeIntervalSince1970)\n*******************", isHTML: false)
self.present(composeVC, animated: true, completion: nil)
} else {
self.showSendMailErrorAlert()
}
tableView.deselectRow(at: indexPath, animated: true)
})
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { action in
tableView.deselectRow(at: indexPath, animated: true)
})
present(alert, animated: true, completion: nil)
}
@IBAction func cancelButtonTapped(_ sender: AnyObject) {
self.dismiss(animated: true, completion: nil)
}
@IBAction func didPressSubmitResponse(_ sender: AnyObject) {
if (responseEntryField.text != "") {
reviseResponseButtonOutlet.isEnabled = false
reviseResponseBarButtonOutlet.isEnabled = false
deleteResponseButtonOutlet.isEnabled = false
let responseText = responseEntryField.text
ResponseController.submitResponse(question!, responseText: responseText!, completion: { (success, questionID) in
if success {
if let questionID = questionID {
UserController.updateQuestionsAnsweredIDsForCurrentUser(questionID, completion: { (success) in
self.responseEntryField.text = ""
self.createAlert("Thanks!", message: "Your revised response has been received! Come back when the clock runs out to view the rest of the responses.")
self.reviseResponseButtonOutlet.isEnabled = true
self.reviseResponseBarButtonOutlet.isEnabled = true
self.deleteResponseButtonOutlet.isEnabled = true
})
}
}
})
} else {
return
}
}
@IBAction func didPressSubmitResponseAlternate(_ sender: AnyObject) {
if (responseEntryField.text != "") {
reviseResponseButtonOutlet.isEnabled = false
reviseResponseBarButtonOutlet.isEnabled = false
deleteResponseButtonOutlet.isEnabled = false
let responseText = responseEntryField.text
ResponseController.submitResponse(question!, responseText: responseText!, completion: { (success, questionID) in
if success {
if let questionID = questionID {
UserController.updateQuestionsAnsweredIDsForCurrentUser(questionID, completion: { (success) in
self.responseEntryField.text = ""
self.createAlert("Thanks!", message: "Your revised response has been received! Come back when the clock runs out to view the rest of the responses.")
self.reviseResponseButtonOutlet.isEnabled = true
self.reviseResponseBarButtonOutlet.isEnabled = true
self.deleteResponseButtonOutlet.isEnabled = true
})
}
}
})
} else {
return
}
}
@IBAction func didPressDeleteResponse(_ sender: AnyObject) {
if deleteResponseButtonOutlet.isEnabled == true {
reviseResponseButtonOutlet.isEnabled = false
reviseResponseBarButtonOutlet.isEnabled = false
deleteResponseButtonOutlet.isEnabled = false
ResponseController.deleteResponse(question!, completion: { (success, questionID) in
if success {
if let questionID = questionID {
UserController.deleteQuestionsAnsweredIDsForCurrentUser(questionID, completion: { (success) in
self.responseEntryField.text = ""
self.createAlert("Success!", message: "Your response has been deleted. You may submit another response if desired.")
self.reviseResponseButtonOutlet.isEnabled = true
self.reviseResponseBarButtonOutlet.isEnabled = true
self.deleteResponseButtonOutlet.isEnabled = true
})
}
}
})
} else {
return
}
}
func createAlert(_ title: String, message: String) {
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let okayAction = UIAlertAction(title: "Okay", style: .default) {
UIAlertAction in
self.dismiss(animated: true, completion: nil)
}
alert.addAction(okayAction)
self.present(alert, animated: true, completion: nil)
}
func timerFired(_ timer: Timer?){
guard let question = self.question else
{ return }
let dateComparisonResult: ComparisonResult = Date().compare(question.timeLimit as Date)
if dateComparisonResult == ComparisonResult.orderedAscending {
formatter.unitsStyle = .positional
let interval: Double = question.timeLimit.timeIntervalSince1970 - Date().timeIntervalSince1970
countdownClock.text = " \(formatter.string(from: interval)!)"
countdownClock.textColor = UIColor.black
} else{
self.dismiss(animated: true, completion: nil)
}
}
}
| [
-1
] |
781bd31bb1110d053c033665fbe7ece38404b6e9 | e279e1c11de23e2c3025fe8a73a37130c276603e | /Test/AppDelegate.swift | c59165df7c54fa4a9e9228ff53851577a1bd516f | [] | no_license | pdramoss/Viper-SwiftUI-UIKIt | 71a56f86199462c62633707c91915df3e29a6d6f | 05d755c7299a994b0014b11d300bc759900d95d1 | refs/heads/master | 2022-07-09T17:49:48.649867 | 2020-05-11T17:16:03 | 2020-05-11T17:16:03 | 263,108,751 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,409 | swift | //
// AppDelegate.swift
// Test
//
// Created by Pedro Ramos on 2/05/20.
// Copyright © 2020 Pedro Ramos. 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,
393230,
393250,
344102,
393261,
163891,
213048,
385081,
376889,
376905,
327756,
254030,
286800,
368727,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
180416,
377036,
180431,
377046,
377060,
327914,
205036,
393456,
393460,
418043,
336123,
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,
328206,
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,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
344776,
418507,
352971,
352973,
385742,
385748,
361179,
189153,
369381,
361195,
418553,
344831,
336643,
344835,
344841,
361230,
336659,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
336711,
328522,
336714,
426841,
254812,
361309,
197468,
361315,
361322,
328573,
369542,
361360,
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,
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,
337365,
271839,
329191,
361960,
116210,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
394786,
419362,
370213,
419368,
419376,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403070,
353919,
403075,
345736,
198280,
403091,
345749,
345757,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
419509,
419512,
337592,
337599,
419527,
419530,
419535,
272081,
419542,
394966,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
337659,
141051,
337668,
362247,
395021,
362255,
321299,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
370503,
329544,
345930,
370509,
354130,
247637,
337750,
370519,
313180,
354142,
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,
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,
321879,
379233,
354673,
321910,
248186,
420236,
379278,
272786,
354727,
338352,
330189,
338381,
338386,
256472,
338403,
338409,
248308,
199164,
330252,
199186,
420376,
330267,
354855,
10828,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
174774,
248504,
174777,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
338660,
338664,
264941,
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,
330760,
330768,
248862,
396328,
158761,
199728,
396336,
330800,
396339,
339001,
388154,
388161,
347205,
248904,
330826,
248914,
183383,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
347287,
248985,
339097,
44197,
380070,
339112,
249014,
126144,
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,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
208311,
388542,
372163,
216517,
380360,
216522,
339404,
372176,
208337,
339412,
413141,
339417,
249308,
339420,
339424,
249312,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
372337,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
339588,
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,
184094,
225058,
339747,
339749,
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,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
266297,
217157,
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,
332106,
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,
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,
389892,
373510,
389926,
152370,
348978,
340789,
348982,
398139,
127814,
357201,
357206,
389978,
430939,
357211,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
381813,
324472,
398201,
119674,
340858,
324475,
430972,
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,
201711,
381946,
349180,
439294,
431106,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
349267,
250967,
210010,
341091,
210025,
210027,
210030,
210039,
349308,
210044,
349311,
152703,
160895,
210052,
349319,
210055,
210067,
210071,
210077,
210080,
251044,
210084,
185511,
210088,
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,
251210,
357708,
210260,
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,
210631,
333511,
259788,
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,
358234,
341851,
350045,
399199,
259938,
399206,
268143,
358255,
399215,
358259,
341876,
333689,
243579,
325504,
333698,
333708,
333724,
382890,
350146,
358339,
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,
260298,
350410,
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,
366990,
416157,
342430,
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,
334420,
350822,
375400,
334465,
334468,
162445,
326290,
342679,
342683,
260766,
342710,
244409,
260797,
334528,
260801,
350917,
154317,
391894,
154328,
416473,
64230,
113388,
342766,
375535,
203506,
342776,
391937,
391948,
375568,
326416,
375571,
162591,
326441,
326451,
326454,
326460,
244540,
375612,
260924,
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,
384114,
343154,
212094,
351364,
384135,
384139,
384143,
351381,
384151,
384160,
384168,
367794,
244916,
384181,
384188,
384191,
351423,
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,
343393,
343398,
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,
327275,
245357,
138864,
155254,
155273,
368288,
245409,
425638,
425649,
155322,
425662,
155327,
245460,
155351,
155354,
212699,
245475,
155363,
245483,
155371,
409335,
155393,
155403,
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,
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,
360438,
253943,
393212,
155646
] |
a8019459004bd4560f93353bbef03f1137be78ab | 597c7d525c2a129a039bcb7183100ec95ed81934 | /Pitch Perfect/ViewController.swift | b0423d7c79dc49999e532fc39c1d6b30a419a370 | [] | no_license | shzznts/Pitch-Perfect | 3b7c7f6a34140ee7ee5a3f66eb0325fb207d1f2f | 2147ea5dde3baea71f4673daf2b214ab624d2438 | refs/heads/master | 2021-01-03T13:19:41.540441 | 2015-07-09T05:52:46 | 2015-07-09T05:52:46 | 38,667,258 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,073 | swift | //
// ViewController.swift
// Pitch Perfect
//
// Created by Lincoln Sea on 7/6/15.
// Copyright (c) 2015 Lincoln Sea. 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 viewWillAppear(animated: Bool) {
stopButton.hidden = true
recordButton.enabled = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func recordAudio(sender: UIButton) {
println("in recordAudio")
recordingLabel.hidden = false
stopButton.hidden = false
recordButton.enabled = false
}
@IBAction func stopAudio(sender: UIButton) {
recordingLabel.hidden = true
}
@IBOutlet weak var recordButton: UIButton!
@IBOutlet weak var recordingLabel: UILabel!
@IBOutlet weak var stopButton: UIButton!
}
| [
-1
] |
9444b9781a67f79dddf38d9b59e6aa5986bf450a | 460568823601d8026ceeca3ac7da1540d96e91cc | /studySocial/studySocial/FriendTableViewController.swift | 5b5c57acc654136dedf0452048a0479c7b020c9f | [] | no_license | PerspectiveProjection/studySocial | be715f1f173617d17a087c527e265f53254424a4 | 5007ef9a3152dae4475c008e1370e566c897b6a3 | refs/heads/master | 2020-12-30T13:28:58.660730 | 2017-05-14T10:40:40 | 2017-05-14T10:40:40 | 87,653,431 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,738 | swift | //
// FriendTableViewController.swift
// studySocial
//
// Created by William Wu on 5/13/17.
// Copyright © 2017 PerspectiveProjection. All rights reserved.
//
import UIKit
import Firebase
import FBSDKLoginKit
import FacebookCore
class FriendTableViewController: UITableViewController {
var handle: FIRAuthStateDidChangeListenerHandle?
var friendArray: NSArray!
var userDefaults: UserDefaults!
let ref = FIRDatabase.database().reference(withPath: "userdata")
override func viewDidLoad() {
super.viewDidLoad()
userDefaults = UserDefaults.standard
friendArray = userDefaults!.object(forKey: "friendArray") as! NSArray
tableView.tableFooterView = UIView(frame: .zero)
self.ref.observe(.value, with: { snapshot in
self.tableView.reloadData()
})
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if let friendCount = self.friendArray?.count {
return friendCount
}
else {
return 0
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "FriendStatusCell", for: indexPath) as! FriendStatusTableViewCell
// Configure the cell...
let friend = friendArray[indexPath.row] as! [String: Any?]
print(friend["name"]!!)
cell.username.text = friend["name"]!! as? String
let user_id = friend["id"] as! String
print(user_id)
cell.userPicture.image = getProfPic(fid: user_id)
let userRef = ref.child(user_id)
let statusRef = userRef.child("status")
statusRef.observe(.value, with: { snapshot in
if(snapshot.value as! String == "") {
cell.userStatus.text = "Inactive"
}
else {
cell.userStatus.text = snapshot.value as! String
}
})
let cyclesRef = userRef.child("pomodoroCycles")
cyclesRef.observe(.value, with: { snapshot in
cell.userCycles.text = String(describing: snapshot.value!) + " 🍅"
})
//cell.userStatus.text =
return cell
}
func getProfPic(fid: String) -> UIImage? {
if (fid != "") {
let imgURLString = "https://graph.facebook.com/" + fid + "/picture?type=large" //type=normal
let imgURL = NSURL(string: imgURLString)
let imageData = NSData(contentsOf: imgURL! as URL)
let image = UIImage(data: imageData! as Data)
return image
}
return nil
}
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/
/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {
}
*/
/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/
/*
// 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
] |
4a64f19d7f689131f22fd7c66b4c3abab98a21de | d1b3e69a20530dc5fec6540091662daec3c60291 | /Tests/GRDBTests/DatabaseQueueBackupTests.swift | 4bc739fd2bbaec94984cffaac26cb1495dfcc262 | [
"MIT"
] | permissive | groue/GRDB.swift | f786eab51136cd103741f382542d08d61c133556 | c12fff16d3a124137ea9d3dca519e5b3f639c5e0 | refs/heads/master | 2023-08-31T23:56:12.288619 | 2023-08-28T14:06:23 | 2023-08-28T14:06:23 | 38,304,949 | 6,459 | 866 | MIT | 2023-09-11T06:25:19 | 2015-06-30T11:17:06 | Swift | UTF-8 | Swift | false | false | 812 | swift | import GRDB
class DatabaseQueueBackupTests: BackupTestCase {
func testDatabaseWriterBackup() throws {
// SQLCipher can't backup encrypted databases: use a pristine Configuration
let source = try makeDatabaseQueue(filename: "source.sqlite", configuration: Configuration())
let destination = try makeDatabaseQueue(filename: "destination.sqlite", configuration: Configuration())
try testDatabaseWriterBackup(from: source, to: destination)
}
func testDatabaseBackup() throws {
let source = try makeDatabaseQueue(filename: "source.sqlite", configuration: Configuration())
let destination = try makeDatabaseQueue(filename: "destination.sqlite", configuration: Configuration())
try testDatabaseBackup(from: source, to: destination)
}
}
| [
-1
] |
c09788d7dd8e500097560fab9c21e48dee75f2b9 | 8923930cfd7f9cba9e4673a1013cc6d325582c63 | /DesignCode/UpdateDetail.swift | 7f7185c1d4b71ef272f73f381559bc2dc11a7d99 | [] | no_license | AntonOmelchuk/swift_design_app | cbb9df341eedeb6b1b9cfae9afb43e28bd661438 | bccc1eee15e289a4ab4f7499c86600ca7d84e8e1 | refs/heads/main | 2023-03-07T21:23:42.250446 | 2021-02-19T21:47:51 | 2021-02-19T21:47:51 | 337,547,035 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 809 | swift | import SwiftUI
struct UpdateDetail: View {
var title = "SwiftUI"
var text = "Loading..."
var image = "Illustration1"
var body: some View {
VStack(spacing: 20) {
Text(title)
.font(.largeTitle)
.fontWeight(.heavy)
Image(image)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 200)
Text(text)
.lineLimit(nil)
.frame(minWidth: /*@START_MENU_TOKEN@*/0/*@END_MENU_TOKEN@*/, maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/, alignment: .leading)
Spacer()
}.padding(30)
}
}
struct UpdateDetail_Previews: PreviewProvider {
static var previews: some View {
UpdateDetail()
}
}
| [
-1
] |
40bbf6754948bb7d14308578fb03af7825951c05 | 8dd74aa64d179db87e6680a9d8a40820ad74f327 | /Mocky/Models/StatusCode.swift | ae457a0dbf9da2cc2f795d48eba172e0a85803ca | [
"MIT"
] | permissive | nehayward/Mocky | 683b94b4767358251764fa506a32f8a63d9d04cd | 69d63976a1d8caa5a51a4c5f7650ca57c0446b19 | refs/heads/master | 2022-01-19T08:19:44.626148 | 2019-08-15T18:52:12 | 2019-08-15T18:52:12 | 200,546,947 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,854 | swift | //
// StatusCode.swift
// Mocky
//
// Created by Nick Hayward on 8/4/19.
// Copyright © 2019 Nick Hayward. All rights reserved.
//
import Foundation
enum StatusCode: Int, Codable {
// 100 Informational
case `continue` = 100
case switchingProtocols
case processing
// 200 Success
case ok = 200
case created
case accepted
case nonAuthoritativeInformation
case noContent
case resetContent
case partialContent
case multiStatus
case alreadyReported
case iMUsed = 226
// 300 Redirection
case multipleChoices = 300
case movedPermanently
case found
case seeOther
case notModified
case useProxy
case switchProxy
case temporaryRedirect
case permanentRedirect
// 400 Client Error
case badRequest = 400
case unauthorized
case paymentRequired
case forbidden
case notFound
case methodNotAllowed
case notAcceptable
case proxyAuthenticationRequired
case requestTimeout
case conflict
case gone
case lengthRequired
case preconditionFailed
case payloadTooLarge
case uriTooLong
case unsupportedMediaType
case rangeNotSatisfiable
case expectationFailed
case imATeapot
case misdirectedRequest = 421
case unprocessableEntity
case locked
case failedDependency
case upgradeRequired = 426
case preconditionRequired = 428
case tooManyRequests
case requestHeaderFieldsTooLarge = 431
case unavailableForLegalReasons = 451
// 500 Server Error
case internalServerError = 500
case notImplemented
case badGateway
case serviceUnavailable
case gatewayTimeout
case httpVersionNotSupported
case variantAlsoNegotiates
case insufficientStorage
case loopDetected
case notExtended = 510
case networkAuthenticationRequired
}
| [
211754,
179235
] |
d8f1728a64315be861879d1981295d89dd0efbc3 | 5e9fe941c6afd751ea5cff2c215686ef9337d7dc | /ciao-game/ModesViewController.swift | f53d885fedbc63ab77a3668681de32b5c7f21a97 | [
"Apache-2.0"
] | permissive | dmaulikr/ciao | f1717864a507afa93b9f40517aac94f9652f24a6 | fad0fa7796f1be939dd4ba520009b449c84e6237 | refs/heads/master | 2021-06-21T08:10:32.354402 | 2017-07-30T22:23:59 | 2017-07-30T22:23:59 | 103,119,835 | 1 | 0 | null | 2017-09-11T10:00:30 | 2017-09-11T10:00:30 | null | UTF-8 | Swift | false | false | 3,415 | swift | //
// AchievementsViewController.swift
// ciao-game
//
// Created by Clinton D'Annolfo on 8/12/2014.
// Copyright (c) 2014 Clinton D'Annolfo. All rights reserved.
//
import Foundation
import UIKit
class ModesViewController: UITableViewController {
// MARK: - Outlets
@IBOutlet var modeTableViewCells: [ModeTableViewCell]!
// MARK: - Properties
var game: LanguageGame!
var coreDataDelegate: CoreDataDelegate!
// MARK: - View Controller methods
override func viewDidLoad() {
super.viewDidLoad()
setCheckedCell()
navigationItem.title = Localization.Title.Modes
//tableView.insertRowsAtIndexPaths(path, withRowAnimation: UITableViewRowAnimation.Right)
// 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.
}
// MARK: - Table View Delegate
//Dictation Mode: Learn to Speak and Pronounce
//Verb Mode: Learn the most common verbs
//Grammar Mode: Learn the intricacies of Grammar
//Counting Mode: Learn to count
//Ultimate Mode: All the words are in it
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! ModeTableViewCell
switch cell.gameModeIndex {
case GameMode.introMode.rawValue:
game.gameMode = .introMode
case GameMode.grammarMode.rawValue:
game.gameMode = .grammarMode
case GameMode.alphabetMode.rawValue:
game.gameMode = .alphabetMode
case GameMode.phraseMode.rawValue:
game.gameMode = .phraseMode
case GameMode.verbMode.rawValue:
game.gameMode = .verbMode
case GameMode.dictationMode.rawValue:
game.gameMode = .dictationMode
default:
game.gameMode = .introMode
}
// setGameMode(cell?.textLabel?.text as String!)
setCheckedCell()
self.navigationController?.popViewController(animated: true)
}
//MARK: - Mode methods
// func setGameMode(mode: String) {
// switch (mode) {
// case GameMode.IntroMode.toString():
// game.gameMode = .IntroMode
// case GameMode.GrammarMode.toString():
// game.gameMode = .GrammarMode
// case GameMode.AlphabetMode.toString():
// game.gameMode = .AlphabetMode
// case GameMode.PhraseMode.toString():
// game.gameMode = .PhraseMode
// case GameMode.VerbMode.toString():
// game.gameMode = .VerbMode
// case GameMode.DictationMode.toString():
// game.gameMode = .DictationMode
// default:
// print("Error: game mode not found")
// game.gameMode = .IntroMode
// }
//// userDefaults.setValue(mode, forKey: UserDefaults.GameMode)
//// print("Set game mode to \(mode)")
// }
func setCheckedCell () {
for cell in modeTableViewCells {
if game.gameMode.rawValue == cell.gameModeIndex {
cell.accessoryType = UITableViewCellAccessoryType.checkmark
} else {
cell.accessoryType = UITableViewCellAccessoryType.none
}
}
}
}
| [
-1
] |
36e8ad0ed9ef4977c4726807ab7e161474a1312b | 617b77dd815fc7f5cd8c1638067216e50214f0ac | /Swift/WeatherTable/WeatherTable/AppDelegate.swift | 953e06ead2f3e8434ddc85126612f5b7443bb121 | [] | no_license | parkchanwoong/i.chanwoong.park | 077c98d02cc6c300e9c8e704e5f9640b18a019fd | 04f73a816a48850ecc81e8bb35136fc123662380 | refs/heads/master | 2021-01-11T20:43:47.935940 | 2017-09-22T07:06:02 | 2017-09-22T07:06:02 | 79,173,209 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,184 | swift | //
// AppDelegate.swift
// WeatherTable
//
// Created by 박찬웅 on 2017. 5. 11..
// Copyright © 2017년 Parkchanwoong. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
189331,
213902,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
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,
279929,
181631,
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,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
370279,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
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,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
226200,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
d960e917181f11336748302d444d9f324b1ed272 | 7c4aa594ab0ca2ecacf2b0bbc0d30caf5aba0212 | /Sources/SwiftCraft/Packets/Play/Clientbound/SpawnPlayerPacket.swift | d60f1780b98d90fe26bb46a6fded4f7cb5e1d835 | [
"BSD-2-Clause",
"MIT"
] | permissive | NoahPeeters/SwiftCraft | 69aeaba8d97e4a63c67ad112b0ffc9d79cee8bb2 | 8eb7cb18454e74dedade9e84527cbdef88d1ebad | refs/heads/master | 2020-03-18T06:25:49.503118 | 2018-07-24T18:09:55 | 2018-07-24T18:43:14 | 88,290,216 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,174 | swift | //
// SpawnPlayerPacket.swift
// SwiftCraft
//
// Created by Noah Peeters on 20.06.18.
// Copyright © 2018 Noah Peeters. All rights reserved.
//
import Foundation
/// Tells the client to spawn a player.
public struct SpawnPlayerPacket: DeserializablePacket, PlayPacketIDProvider {
public static func packetIndex(context: SerializationContext) -> Int? {
return 0x05
}
/// The id of the player entity.
public let entityID: EntityID
/// The uuid of the player.
public let playerUUID: UUID
/// The location of the player.
public let location: EntityLocation
/// The yaw of the player.
public let yaw: Angle
/// The pitch of the player
public let pitch: Angle
/// Additional metadata.
public let metaData: ByteArray
public init<Buffer: ByteReadBuffer>(from buffer: Buffer, context: SerializationContext) throws {
entityID = try VarInt32(from: buffer).value
playerUUID = try UUID(from: buffer)
location = try EntityLocation(from: buffer)
yaw = try Angle(from: buffer)
pitch = try Angle(from: buffer)
metaData = buffer.readRemainingElements()
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.