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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17c5df7f507921dcc03f9f70dae4215989c6b73f | 4245e228e392bc9d5be6670623f63c0601d78a8b | /Stunde/AppDelegate.swift | 44cb8ba05289cd10d925d4e1510664e23c270820 | [] | no_license | kailashrkk/--Stunde- | 6518b7f7f0dc1087670c3c623826c3f8c9fcef6d | d1ad24b44a54ad59703ef6a316570f0d3ec55375 | refs/heads/master | 2021-01-10T09:38:13.537255 | 2015-09-25T19:20:06 | 2015-09-25T19:20:06 | 43,170,050 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,347 | swift | //
// AppDelegate.swift
// Stunde
//
// Created by Kailash Ramaswamy on 18/06/15.
// Copyright (c) 2015 NCh. All rights reserved.
//
import UIKit
import Bolts
import Parse
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.enableLocalDatastore()
// Initialize Parse.
Parse.setApplicationId("cxQUfi0I9u0glPOZrysGutx3iGhODk2kGPZpII2O",
clientKey: "JOOtNx2oJ1XOs5qMeLmDJsAw32A9PGISCpWg0p1A")
var push = UIUserNotificationSettings(forTypes: .Alert, categories: nil)
application.registerUserNotificationSettings(push)
application.registerForRemoteNotifications()
// Register for Push Notitications
if application.applicationState != UIApplicationState.Background {
// Track an app open here if we launch with a push, unless
// "content_available" was used to trigger a background push (introduced in iOS 7).
// In that case, we skip tracking here to avoid double counting the app-open.
let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
let oldPushHandlerOnly = !self.respondsToSelector("application:didReceiveRemoteNotification:fetchCompletionHandler:")
var pushPayload = false
if let options = launchOptions {
pushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] != nil
}
if (preBackgroundPush || oldPushHandlerOnly || pushPayload) {
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
}
}
if application.respondsToSelector("registerUserNotificationSettings:") {
let userNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
let types = UIRemoteNotificationType.Badge | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Sound
application.registerForRemoteNotificationTypes(types)
}
// [Optional] Track statistics around application opens.
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
// Override point for customization after application launch.
return true
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackground()
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
if error.code == 3010 {
println("Push notifications are not supported in the iOS Simulator.")
} else {
println("application:didFailToRegisterForRemoteNotificationsWithError: %@", error)
}
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
if application.applicationState == UIApplicationState.Inactive {
PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
}
}
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:.
}
}
| [
-1
] |
c446bb37d2d2d74e13efa1bddcf994762cf8db46 | a3f278e95f4f8404ea73588a535cef2e85b7b2c3 | /QuotesTests/QuotesTests.swift | 9f8c445bf31de7894d28161a1cf5725cbf9a412e | [] | no_license | KharismaRizqi/Quotes | f1b17535689c14e6c6f925b4281947cb94940614 | 5f42b6ec80779921e187eccafe409f1880566346 | refs/heads/master | 2020-04-01T09:48:36.061326 | 2018-10-15T02:35:14 | 2018-10-15T02:35:14 | 153,090,550 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 960 | swift | //
// QuotesTests.swift
// QuotesTests
//
// Created by MacBook on 10/15/18.
// Copyright © 2018 MacBook . All rights reserved.
//
import XCTest
@testable import Quotes
class QuotesTests: 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,
229413,
204840,
344107,
155694,
229424,
229430,
163896,
180280,
376894,
286788,
352326,
311372,
196691,
385116,
237663,
254048,
319591,
278634,
221290,
204916,
131191,
131198,
311438,
278677,
196760,
426138,
278691,
377009,
180408,
131256,
278714,
295098,
139479,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
278797,
254226,
368916,
262421,
377114,
368923,
278816,
237856,
237857,
311597,
98610,
180535,
336183,
278842,
287043,
139589,
319813,
344401,
377169,
368981,
155990,
278869,
368984,
98657,
270701,
270706,
139640,
106874,
311681,
311685,
106888,
385417,
385422,
213403,
385454,
377264,
278970,
311738,
33211,
336320,
311745,
254406,
188871,
278989,
278993,
278999,
328152,
188894,
287198,
279008,
279013,
279018,
319981,
279029,
254456,
377338,
377343,
254465,
287241,
279050,
139792,
303636,
279062,
393751,
279065,
377376,
180771,
377386,
197167,
385588,
279094,
115270,
385615,
426576,
369235,
139872,
66150,
279146,
295536,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
287404,
205487,
303793,
336564,
287417,
287422,
377539,
287433,
287439,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
369385,
230125,
312047,
279280,
312052,
230134,
172792,
344827,
221948,
205568,
295682,
197386,
434957,
295697,
426774,
197399,
426775,
197411,
279336,
262954,
295724,
197422,
353070,
164656,
303920,
262962,
295729,
197431,
230199,
336702,
295744,
279362,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
279397,
230248,
246643,
295798,
279417,
361337,
254850,
369538,
287622,
295824,
189348,
279464,
140204,
377772,
304051,
230332,
189374,
377790,
353215,
213957,
213960,
345033,
386006,
304087,
418776,
50143,
123881,
320493,
287731,
271350,
295927,
304122,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
377869,
238610,
418837,
140310,
197657,
369701,
238639,
312373,
238651,
377926,
238664,
296019,
304222,
230499,
279660,
173166,
377972,
377983,
279685,
402565,
222343,
386189,
238743,
296092,
238765,
279728,
238769,
402613,
279747,
353479,
402634,
279760,
189652,
279765,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
279785,
328940,
279792,
386294,
386301,
320770,
386306,
279814,
328971,
353551,
173334,
320796,
222494,
353584,
345396,
386359,
378172,
312648,
337225,
304456,
230729,
296270,
238927,
353616,
378209,
386412,
230765,
296307,
116084,
181625,
337281,
148867,
296329,
296335,
9619,
370071,
173491,
304564,
279989,
353719,
361927,
296392,
280010,
280013,
280032,
271843,
280041,
296433,
280055,
288249,
296448,
329225,
230921,
296461,
304656,
329232,
370197,
230943,
402985,
394794,
288309,
312889,
288318,
280130,
288327,
239198,
157281,
99938,
312940,
222832,
337534,
337535,
263809,
239237,
312965,
288392,
239250,
419478,
337591,
280257,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
280278,
280280,
67292,
345821,
321247,
321249,
345833,
345834,
288491,
239341,
67315,
173814,
313081,
288512,
288516,
280327,
280329,
321302,
345879,
321310,
255776,
362283,
378668,
296755,
280372,
280380,
345919,
436031,
403267,
280392,
345929,
304977,
18262,
362327,
280410,
345951,
362337,
345955,
296806,
288620,
214895,
313199,
362352,
313203,
182144,
305026,
329622,
337815,
214937,
214938,
436131,
436137,
362417,
362431,
280514,
280519,
214984,
362443,
329695,
436191,
313319,
296941,
436205,
43014,
354316,
313357,
313375,
354343,
354345,
346162,
288828,
436285,
288833,
288834,
436292,
403525,
436301,
338001,
338003,
223316,
280661,
329814,
280675,
280677,
43110,
313447,
321637,
436329,
288879,
223350,
280694,
215164,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
182456,
223419,
379071,
280768,
149703,
280778,
346314,
321745,
280795,
387296,
280802,
379106,
346346,
321772,
436470,
149760,
411906,
272658,
338218,
321840,
379186,
321860,
280902,
289110,
215385,
321894,
313713,
354676,
199029,
436608,
362881,
240002,
436611,
108944,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
281040,
289232,
256477,
281072,
174593,
420369,
207393,
289332,
174648,
338489,
338490,
281166,
281171,
297560,
436832,
436834,
313966,
281199,
420463,
346737,
313971,
346740,
420471,
330379,
117396,
346772,
264856,
289434,
346779,
166582,
314040,
158394,
363211,
363230,
264928,
330474,
289518,
125684,
199414,
117517,
322319,
166676,
207640,
281377,
289576,
191283,
273207,
289598,
281408,
330609,
207732,
158593,
224145,
355217,
256922,
289690,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
248796,
347103,
289774,
183279,
347123,
240630,
257024,
330754,
322570,
330763,
248872,
314448,
339030,
281697,
281700,
257125,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
429214,
199839,
306338,
265379,
249002,
306346,
3246,
421048,
265412,
290000,
298208,
298212,
298213,
290022,
330984,
298221,
298228,
216315,
208124,
437505,
322824,
257305,
339234,
109861,
372009,
412971,
306494,
216386,
224586,
331090,
314710,
372054,
159066,
314720,
306542,
380271,
208244,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
224661,
282007,
290207,
314783,
314789,
314791,
282024,
396711,
396712,
380337,
380338,
150965,
380357,
339398,
306631,
306639,
413137,
429542,
306673,
306677,
290300,
282114,
372227,
306692,
306693,
323080,
282129,
175639,
282136,
388632,
396827,
282141,
134686,
347694,
290358,
265798,
282183,
265804,
224847,
396882,
290390,
306776,
44635,
396895,
323172,
282213,
224883,
314998,
323196,
339584,
290443,
282271,
282273,
282276,
298661,
290471,
282280,
298667,
224946,
110268,
224958,
282303,
274115,
282312,
306890,
282318,
241361,
282327,
298712,
298720,
12010,
282348,
282355,
282358,
339715,
339720,
282378,
372496,
323346,
282391,
339745,
257830,
421672,
282409,
200498,
307011,
307025,
413521,
216918,
307031,
241495,
282480,
241528,
339841,
282504,
315273,
315274,
110480,
184208,
372626,
380821,
282519,
118685,
298909,
298920,
323507,
290745,
290746,
274371,
151497,
372701,
298980,
380908,
315432,
233517,
102445,
176175,
241716,
225351,
315465,
315476,
307289,
315487,
356447,
438377,
233589,
233590,
266357,
422019,
241808,
381073,
233636,
184484,
299174,
233642,
405687,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
176362,
307435,
438511,
381172,
184575,
381208,
151839,
233762,
217380,
332083,
332085,
332089,
315706,
307517,
438596,
332101,
323913,
348492,
323920,
348500,
168281,
332123,
323935,
332127,
242023,
160110,
242033,
291192,
340357,
225670,
242058,
373134,
291224,
242078,
61857,
315810,
61859,
315811,
381347,
340398,
299441,
283064,
127427,
127428,
324039,
373197,
176601,
160225,
291311,
291333,
340490,
283153,
258581,
291358,
283182,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
381517,
332378,
201308,
111208,
184940,
373358,
389745,
209530,
291454,
373375,
152195,
348806,
152203,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
299746,
234217,
299759,
299770,
299776,
242433,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
234277,
283430,
152365,
422703,
422709,
152374,
160571,
430910,
160575,
160580,
381773,
201551,
242529,
349026,
357218,
127841,
177001,
308076,
242541,
209783,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308112,
349072,
234386,
324507,
390045,
185250,
283558,
185254,
373687,
373706,
316364,
349175,
201720,
127992,
357379,
234500,
234514,
308243,
316437,
357414,
300084,
308287,
218186,
234577,
341073,
439384,
234587,
300135,
316520,
300136,
357486,
144496,
300150,
300151,
291959,
160891,
300158,
349316,
349318,
373903,
169104,
177296,
308372,
185493,
119962,
300187,
300188,
300201,
300202,
373945,
283840,
259268,
283852,
259280,
316627,
333011,
234733,
292085,
234742,
292091,
128251,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
300359,
234827,
177484,
406861,
259406,
234831,
283991,
357719,
374109,
292195,
333160,
284014,
316787,
111993,
357762,
112017,
234898,
259475,
275859,
357786,
251298,
333220,
374191,
292283,
300487,
300489,
284107,
210390,
210391,
210393,
144867,
251378,
308723,
300535,
300536,
300542,
259599,
308756,
398869,
374296,
374299,
308764,
431649,
169518,
431663,
194110,
349763,
218696,
292425,
128587,
333388,
300630,
128599,
333408,
300644,
317032,
415338,
243307,
54893,
325231,
325245,
235135,
194180,
415375,
333470,
153251,
300714,
210603,
415420,
333503,
259781,
333517,
333520,
325346,
153319,
325352,
325371,
194304,
300811,
243472,
366360,
284442,
325404,
399147,
431916,
300848,
259899,
325439,
153415,
341836,
415567,
325457,
317269,
341847,
284507,
350044,
128862,
284512,
284514,
276327,
292712,
423789,
325492,
276341,
300918,
341879,
317304,
333688,
194429,
112509,
55167,
325503,
333701,
243591,
325518,
333722,
350109,
300963,
292771,
415655,
284587,
292782,
243637,
284619,
301008,
153554,
194515,
292836,
292837,
317415,
325619,
432116,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
227370,
325674,
129076,
243767,
358456,
309345,
227428,
194666,
260207,
432240,
284788,
292992,
194691,
227460,
415881,
104587,
235662,
284826,
333991,
284842,
227513,
227548,
194782,
301279,
317664,
243962,
375039,
309503,
325905,
325912,
309529,
227616,
211235,
432421,
211238,
358703,
358709,
227654,
6481,
366930,
6489,
383332,
383336,
285040,
211326,
317831,
227725,
252308,
293274,
285084,
121245,
285090,
342450,
293303,
358843,
293310,
416197,
129483,
342476,
326100,
342498,
358882,
334309,
391655,
432618,
375276,
301571,
416286,
375333,
244269,
375343,
236081,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
416351,
268899,
39530,
301689,
244347,
326287,
375440,
334481,
318106,
318107,
342682,
285361,
342706,
318130,
293556,
383667,
285373,
39614,
154316,
96984,
375526,
342762,
342763,
293612,
154359,
432893,
162561,
383754,
310036,
326429,
293664,
326433,
400166,
293672,
301871,
375609,
285497,
252741,
318278,
293711,
244568,
244570,
301918,
293730,
342887,
400239,
400252,
359298,
359299,
260996,
113542,
228233,
228234,
392074,
56208,
293781,
400283,
318364,
310176,
310178,
310182,
293800,
236461,
293806,
326581,
326587,
326601,
359381,
433115,
343005,
326635,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
433174,
252958,
203830,
359478,
277597,
113760,
392290,
253029,
228458,
15471,
351344,
285814,
392318,
187521,
384131,
302216,
326804,
351390,
253099,
253100,
318639,
367799,
113850,
294074,
302274,
367810,
195808,
310497,
228588,
302325,
261377,
253216,
261425,
351537,
286013,
294218,
146762,
294219,
318805,
425304,
294243,
163175,
327024,
318848,
253317,
384393,
368011,
318864,
318868,
318875,
310692,
245161,
286129,
286132,
228795,
425405,
302531,
425418,
310732,
64975,
228827,
286172,
187878,
286202,
359930,
286205,
302590,
294400,
253451,
359950,
146964,
253463,
286244,
245287,
245292,
196164,
56902,
228943,
286288,
179801,
343647,
310889,
204397,
138863,
188016,
294529,
286343,
229001,
310923,
188048,
425626,
229020,
302754,
40613,
40614,
40615,
229029,
286388,
286391,
384695,
327358,
286399,
212685,
384720,
302802,
278233,
278234,
294622,
278240,
212716,
212717,
360177,
229113,
319233,
311042,
360195,
286494,
294700,
409394,
319292,
360252,
360264,
376669,
245599,
237408,
425825,
425833,
417654,
188292,
294807,
294809,
376732,
294814,
311199,
319392,
294823,
327596,
294843,
188348,
98239,
237504,
294850,
384964,
344013,
212942,
24532,
212951,
294886,
311281,
311282
] |
63e4c1a3108260951cc3656f1d90ee772e222941 | 1bc0bd54002503fef1e78a2861c29f3ed9b8ae28 | /MZay learning 1.0/ViewController.swift | 6dfa3fce53f11ba62aa3017e159542e2b35fd190 | [] | no_license | MZayme/MZay | 10629143b2c2c905a791114899300091b4c8660f | 4ec4724e5175950d5c36b57e398e7b9a39b37c3c | refs/heads/master | 2021-01-18T10:05:05.631998 | 2016-09-16T08:37:34 | 2016-09-16T08:37:34 | 68,363,515 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,260 | swift | //
// ViewController.swift
// MZay learning 1.0
//
// Created by Nikita Savchenko on 8/21/16.
// Copyright © 2016 Nikita Savchenko. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet var label1: UILabel!
@IBOutlet var label2: UILabel!
@IBOutlet var label3: UILabel!
@IBOutlet weak var image1: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
print("Hello world")
// 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.
}
@IBAction func action1(_ text1: UITextField) {
label1.text="Hello, \(text1.text!)"
// After entering the name it turns Label1 into "Hello, [name].
}
@IBAction func action2(_ button1: AnyObject) {
label3.text="AWESOME! YOU CLICKED THE BUTTON!"
print("yeah, baby!")
// After clicking the button1 label3 turns into message.
}
@IBAction func action3(){
image1.image=UIImage(named: "picture1.png")
// After clicking the button1 image1 fills with picture
}
}
| [
-1
] |
3f0bff3d242acd9bfb533a75cdef9cb7ff8b0948 | 24c29919c934743369b4eeb781b905b1af667217 | /memes/CollectionViewCell.swift | 5748d02675b7630f38d7ccec9c7b07bb88debfe4 | [] | no_license | olya757/memes-generate | e5c49e7303b3420236b5eafcf83dad0698437e1c | 8a29606e6824abee0e7fc0248b4b848d6532f710 | refs/heads/master | 2020-03-23T20:24:27.376641 | 2018-07-26T16:33:32 | 2018-07-26T16:33:32 | 142,039,334 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 502 | swift | //
// CollectionViewCell.swift
// memes
//
// Created by Дмитрий Трофимов on 22.07.2018.
// Copyright © 2018 Ольга Шишкина. All rights reserved.
//
import UIKit
class CollectionViewCell: UICollectionViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
@IBOutlet weak var ivImage: UIImageView!
@IBOutlet weak var tvText: UITextView!
@IBOutlet weak var tvDescription: UITextView!
}
| [
-1
] |
b41f89e8d29b7a70f7b3555e8c462d460c4bcc8b | 47756a2cfce75de164041ab3c58a619fc42b5307 | /Coredata/ios-coredata-nspersistentstorecoordinator-demo/ios-coredata-nspersistentstorecoordinator-demo/ViewController.swift | d0cd23af662a9f7ba2766c824a6f582eeda3e8bd | [
"MIT"
] | permissive | sahara-ooga/ios-sample | c961f90fd66bc14e40c8df6e6552413138775e9a | f0707b66ce297f9200892670e130a66d754ef313 | refs/heads/master | 2021-06-24T15:20:29.085717 | 2020-11-29T06:43:21 | 2020-11-29T06:43:21 | 183,883,105 | 0 | 0 | MIT | 2020-11-29T06:43:23 | 2019-04-28T08:57:26 | Swift | UTF-8 | Swift | false | false | 2,930 | swift | //
// ViewController.swift
// ios-coredata-nspersistentstorecoordinator-demo
//
// Created by k_motoyama on 2017/02/18.
// Copyright © 2017年 k_moto. All rights reserved.
//
import UIKit
import CoreData
import Foundation
class ViewController: UIViewController {
var context : NSManagedObjectContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
var persistentStoreCoordinator: NSPersistentStoreCoordinator = NSPersistentStoreCoordinator()
var appDocument = URL(string: "")
override func viewDidLoad() {
super.viewDidLoad()
let url = Bundle.main.url(forResource: "ios_coredata_nspersistentstorecoordinator_demo",
withExtension: "momd")
let demoModel = NSManagedObjectModel(contentsOf: url!)!
persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: demoModel)
context = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
context.persistentStoreCoordinator = persistentStoreCoordinator
let fileManager = FileManager.default
appDocument = fileManager.urls(for: .documentDirectory,
in: .userDomainMask).first
addPersistentStore()
let persistentStore = getNSPersistentStoreForURL()
removeNSPersistentStore(persistentStore: persistentStore)
}
// 永続ストアを追加する
private func addPersistentStore(){
let storeURL = appDocument?.appendingPathComponent("test.sqlite")
do{
try persistentStoreCoordinator.addPersistentStore(ofType: NSSQLiteStoreType,
configurationName: nil,
at: storeURL,
options: nil)
}catch let error as NSError{
fatalError("\(error)")
}
}
// 追加されている永続ストアを全て取得する
private func getNSPersistentStore() -> NSPersistentStore {
return persistentStoreCoordinator.persistentStores.first!
}
// 追加されている永続ストアをURLから取得する
private func getNSPersistentStoreForURL() -> NSPersistentStore {
let storeURL = appDocument?.appendingPathComponent("test.sqlite")
return persistentStoreCoordinator.persistentStore(for: storeURL!)!
}
// 永続ストアを除去する
private func removeNSPersistentStore(persistentStore: NSPersistentStore){
do{
try persistentStoreCoordinator.remove(persistentStore)
print(persistentStoreCoordinator.persistentStores.count)
}catch let error as NSError{
fatalError("\(error)")
}
}
}
| [
-1
] |
f55d4fd9f2825f3dced154251ad04398102834c2 | 5bc5399a09d8b8d1f19530b2653dbb6294afe0d4 | /Tests/SOSwiftTests/EventTests.swift | 77dacbff963be2d7ce2e2cd481fd19e5fd019447 | [
"MIT"
] | permissive | ianleon/SOSwift | 1f81e0b0e3ff5748fea02aaa3c7dc2d0cab5969b | 8f86fc6ad9b58ae1dce01a7358592c5906a363e7 | refs/heads/main | 2023-03-17T03:08:01.158273 | 2020-12-04T00:37:01 | 2020-12-04T00:37:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,183 | swift | import XCTest
@testable import SOSwift
class EventTests: XCTestCase {
static var allTests = [
("testSchema", testSchema),
("testDecode", testDecode),
("testEncode", testEncode),
]
public static var event: Event {
let event = Event()
event.about = ThingTests.thing
event.actors = nil
event.aggregateRating = nil
event.attendees = nil
event.audience = nil
event.composer = nil
event.contributor = nil
event.directors = nil
event.doorTime = DateTimeTests.dateTime2
event.duration = nil
event.endDate = DateOnlyOrDateTime(DateTimeTests.dateTime1)
event.eventStatus = nil
event.inLanguage = nil
event.isAccessibleForFree = nil
event.location = nil
event.maximumAttendeeCapacity = nil
event.offers = nil
event.organizer = nil
event.performers = nil
event.previousStartDate = nil
event.recordedIn = nil
event.remainingAttendeeCapacity = nil
event.reviews = nil
event.sponsor = nil
event.startDate = DateOnlyOrDateTime(DateTimeTests.dateTime3)
event.subEvents = nil
event.superEvent = nil
event.translator = nil
event.typicalAgeRange = nil
event.workFeatured = nil
event.workPerformed = nil
return event
}
func testSchema() throws {
XCTAssertEqual(Event.schemaName, "Event")
}
func testDecode() throws {
let json = """
{
"about": {
"@type": "Thing",
"name": ""
},
"actor": [
{
"@type": "Person",
"name": ""
}
],
}
"""
let _ = try Event.make(with: json)
}
func testEncode() throws {
let dictionary = try EventTests.event.asDictionary()
let doorTime = dictionary[Event.EventCodingKeys.doorTime.rawValue] as? String
XCTAssertEqual(doorTime, DateTimeTests.dateTime2String)
}
}
| [
-1
] |
3bb18511159ce3b3210902f15564fae7e4b99737 | 1e1f641c0ace4a330c53308502772c9c6de1aeff | /tabBar/TabBar.swift | a5860420a9e7b578a8b54c958603cff9eb3275f0 | [] | no_license | dorofeeevs/tabBarDemo | cbce6f03e2507f43e88300770832bc8a958c792b | 9dababc9458436ae1194154cd987706b85e793f4 | refs/heads/main | 2023-05-30T17:24:57.738153 | 2021-06-04T18:25:28 | 2021-06-04T18:25:28 | 373,927,795 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 138 | swift | //
// TabBar.swift
// tabBar
//
// Created by Aleksandr Dorofeev on 03.06.2021.
//
import Foundation
class TabBar: UITabBar {
}
| [
-1
] |
4f6c8b46e769ae3f2d20b72f265e9dce52ff45c7 | a15d27b2bf2a7d8fbc395532a81a3a9732101a7f | /TemplateProjectTests/CurrencyDataSourceTests.swift | 146e2a14bb0fb3b0a9466d8ad619964f35126d13 | [
"MIT"
] | permissive | gradpratik/iosapp-mvvm | 0bfb3b0d3b6a63ab08e5282968b1f255a0da4901 | 42910fef75c859dbfed48d0d2e492b47e360c602 | refs/heads/master | 2023-07-23T18:42:35.909410 | 2021-06-03T07:19:47 | 2021-06-03T07:19:47 | 516,700,804 | 1 | 0 | null | 2022-07-22T10:03:44 | 2022-07-22T10:03:44 | null | UTF-8 | Swift | false | false | 2,388 | swift | //
// CurrencyDataSourceTests.swift
// TemplateProjectTests
//
// Created by Benoit PASQUIER on 01/02/2018.
// Copyright © 2018 Benoit PASQUIER. All rights reserved.
//
import XCTest
@testable import TemplateProject
class CurrencyDataSourceTests: XCTestCase {
var dataSource : CurrencyDataSource!
override func setUp() {
super.setUp()
dataSource = CurrencyDataSource()
}
override func tearDown() {
dataSource = nil
super.tearDown()
}
func testEmptyValueInDataSource() {
// giving empty data value
dataSource.data.value = []
let tableView = UITableView()
tableView.dataSource = dataSource
// expected one section
XCTAssertEqual(dataSource.numberOfSections(in: tableView), 1, "Expected one section in table view")
// expected zero cells
XCTAssertEqual(dataSource.tableView(tableView, numberOfRowsInSection: 0), 0, "Expected no cell in table view")
}
func testValueInDataSource() {
// giving data value
let euroRate = CurrencyRate(currencyIso: "EUR", rate: 1.14)
let dollarRate = CurrencyRate(currencyIso: "EUR", rate: 1.40)
dataSource.data.value = [euroRate, dollarRate]
let tableView = UITableView()
tableView.dataSource = dataSource
// expected one section
XCTAssertEqual(dataSource.numberOfSections(in: tableView), 1, "Expected one section in table view")
// expected two cells
XCTAssertEqual(dataSource.tableView(tableView, numberOfRowsInSection: 0), 2, "Expected two cell in table view")
}
func testValueCell() {
// giving data value
let dollarRate = CurrencyRate(currencyIso: "EUR", rate: 1.40)
dataSource.data.value = [dollarRate]
let tableView = UITableView()
tableView.dataSource = dataSource
tableView.register(CurrencyCell.self, forCellReuseIdentifier: "CurrencyCell")
let indexPath = IndexPath(row: 0, section: 0)
// expected CurrencyCell class
guard let _ = dataSource.tableView(tableView, cellForRowAt: indexPath) as? CurrencyCell else {
XCTAssert(false, "Expected CurrencyCell class")
return
}
}
}
| [
-1
] |
93c91e441c2caef6e2c77c1fa8c24b8788f2a9e7 | 2070e8deb52b4a725f1971e36c639b516327fc1a | /StrawberryPie/ViewControllers/HomeController.swift | 029dd557396793dc9513c54df9ea1171b08e0d85 | [] | no_license | RockRonnie/IosProject | bec96978b8d9274db999be0361e592d94b79aabf | 9f5bd9247b103bb1e84c90c93a3290efa730ed20 | refs/heads/master | 2020-11-25T20:11:39.495250 | 2019-12-12T00:22:46 | 2019-12-12T00:22:46 | 228,826,304 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,870 | swift | //
// HomeViewController.swift
// StrawberryPie
//
// Created by Joachim Grotenfelt on 22/11/2019.
// Copyright © 2019 Team Työkkäri. All rights reserved.
//
// This swift file is the controller for the Home-page and all its' elements.
import Foundation
import UIKit
import RealmSwift
class HomeController: UIViewController {
//Outlets
@IBOutlet weak var segmentBtns: UISegmentedControl!
@IBOutlet weak var ExpertTableView: ExpertTableViewController!
@IBOutlet weak var filterButton: UIButton!
let cellBorderColor = CgjudasBlack()
let tableBorderColor = CgjudasBlack()
let SearchController = UISearchController(searchResultsController: nil)
let transparentView = UIView()
let filterView = UITableView()
var selectedButton = UIButton()
var notificationToken: NotificationToken?
//Realm user sync and activate Realm
var user: SyncUser?
var realm: Realm!
lazy var sessions: Array<QASession> = []
lazy var filteredSessions: Array<QASession> = []
var upcomingSessions: Results<QASession>?
var liveSessions: Results<QASession>?
var archivedSessions: Results<QASession>?
var expertImage: UIImage?
var selectedState: String?
var isSearchBarEmpty: Bool {
return SearchController.searchBar.text?.isEmpty ?? true
}
var isFiltering: Bool {
return SearchController.isActive && !isSearchBarEmpty
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = "Qauncel"
print(RealmDB.sharedInstance.setup)
setupRealm("default", "default" , false)
setupSearchBar()
setupTables()
self.view.backgroundColor = judasGrey()
segmentBtns.setTitle((NSLocalizedString("Live", value: "Live", comment: "Selected segment")), forSegmentAt: 0)
segmentBtns.setTitle((NSLocalizedString("Upcoming", value: "Upcoming", comment: "Selected segment")), forSegmentAt: 1)
segmentBtns.setTitle((NSLocalizedString("Archived", value: "Archived", comment: "Selected segment")), forSegmentAt: 2)
segmentBtns.tintColor = judasBlue()
UITabBar.appearance().tintColor = judasBlue()
}
//Segmented Controllers Action, changes the state depending on which "tab" you choose.
@IBAction func segmentAction(_ sender: UISegmentedControl) {
switch sender.selectedSegmentIndex {
case 0:
print("live")
setState(state: "live")
getState()
ExpertTableView.reloadData()
case 1:
print("upcoming")
setState(state: "upcoming")
getState()
ExpertTableView.reloadData()
case 2:
print("archived")
setState(state: "archived")
getState()
ExpertTableView.reloadData()
default:
print("ERROR 404")
}
}
// State for filterbutton
func setState(state: String){
selectedState = state
}
//Initial state of the filterbutton(live)
func initialState(){
setState(state: "live")
}
//function for loading the data that is ran every time home view is selected.
func setupExperts(){
getSessions()
getState()
getPic()
}
//getting the sessions from realm.
func getSessions(){
liveSessions = realm.objects(QASession.self).filter("live = true")
upcomingSessions = realm.objects(QASession.self).filter("upcoming = true")
archivedSessions = realm.objects(QASession.self).filter("archived = true")
}
// updating the sessions array based on selected filter state.
// also checks if selected state is empty or not.
func getState(){
switch selectedState {
case "live":
if let liveSessions = self.liveSessions {
self.sessions = Array(liveSessions)
if liveSessions.isEmpty{
ExpertTableView.isHidden = true
createisEmptyLabel()
} else {
ExpertTableView.isHidden = false
removeIsEmptyLabel()
}
}
case "upcoming":
if let upcomingSessions = self.upcomingSessions {
self.sessions = Array(upcomingSessions)
if upcomingSessions.isEmpty{
ExpertTableView.isHidden = true
createisEmptyLabel()
} else {
ExpertTableView.isHidden = false
removeIsEmptyLabel()
}
}
case "archived":
if let archivedSessions = self.archivedSessions {
self.sessions = Array(archivedSessions)
if archivedSessions.isEmpty{
ExpertTableView.isHidden = true
createisEmptyLabel()
} else {
ExpertTableView.isHidden = false
removeIsEmptyLabel()
}
}
default: print("everything went to hell")
}
}
// Creates a subview label that indicates that there are no sessions available
func createisEmptyLabel(){
removeIsEmptyLabel()
let label = UILabel(frame: CGRect(x:0,y:0,width:200, height:21))
label.center.x = self.view.center.x
label.center.y = self.view.center.y
label.textAlignment = .center
label.text = "There seems to be no \(selectedState!) sessions available"
label.numberOfLines = 3
label.sizeToFit()
label.accessibilityIdentifier = "NoContentLabel"
label.tag = 69
self.view.addSubview(label)
}
// Removes the label from the view
func removeIsEmptyLabel(){
if let viewWithTag = self.view.viewWithTag(69){
viewWithTag.removeFromSuperview()
}
}
//setting up the notification token for observing the realm to achieve full synchronization and reactive UI
func updateExpertFeed(){
self.notificationToken = realm?.observe {_,_ in
self.setupExperts()
self.ExpertTableView.reloadData()
}
}
//INITIAL realm setup. logs in with default guest user the first time app is ran.
func setupRealm(_ username: String,_ password: String,_ register: Bool) {
if(RealmDB.sharedInstance.setup == false){
// Yritä kirjautua sisään --> Vaihda kovakoodatut tunnarit pois
SyncUser.logIn(with: .usernamePassword(username: username, password: password, register: false), server: Constants.AUTH_URL) { user, error in
if let user = user {
// Onnistunut kirjautuminen
// Lähetetään permission realmille -> read/write oikeudet käytössä olevalle palvelimelle. realmURL: Constants.REALM_URL --> Katso Constants.swift
let permission = SyncPermission(realmPath: Constants.REALM_URL.absoluteString, username: "default" , accessLevel: .write)
user.apply(permission, callback: { (error) in
if error != nil {
print(error?.localizedDescription ?? "No error")
} else {
print("success")
}
})
self.user = user
let admin = user.isAdmin
print(admin)
// Leivotaan realmia varten asetukset. realmURL: Constants.REALM_URL --> Katso Constants.swift
let config = user.configuration(realmURL: Constants.REALM_URL, fullSynchronization: true)
self.realm = try! Realm(configuration: config)
print("Realm connection has been setup")
self.initialState()
RealmDB.sharedInstance.realm = self.realm
RealmDB.sharedInstance.setup = true
print(RealmDB.sharedInstance.setup = true)
self.updateExpertFeed()
self.setupExperts()
self.ExpertTableView.reloadData()
} else if let error = error {
print("Login error: \(error)")
}
}
}else{
self.initialState()
self.realm = RealmDB.sharedInstance.realm
self.user = RealmDB.sharedInstance.user
self.updateExpertFeed()
self.setupExperts()
self.ExpertTableView.reloadData()
print(self.user?.identity ?? "No identity")
}
}
// Setting up tableviews
func setupTables(){
ExpertTableView.dataSource = self
ExpertTableView.delegate = self
ExpertTableView.reloadData()
ExpertTableView.backgroundColor = UIColor.clear
ExpertTableView.register(UINib(nibName: "QASessionCell", bundle: nil), forCellReuseIdentifier: "SessionCell")
}
// Setting up searchbar searchcontroller
func setupSearchBar(){
SearchController.searchResultsUpdater = self
SearchController.obscuresBackgroundDuringPresentation = false
SearchController.searchBar.placeholder = NSLocalizedString("Search sessions", value: "Search sessions", comment: "Session search")
navigationItem.searchController = SearchController
definesPresentationContext = true
}
// Filtering function for searchbar
func filterContentForSearchText(_ searchText: String?) {
if let searchText = searchText{
filteredSessions = sessions.filter { (session) -> Bool in
return session.title.lowercased().contains(searchText.lowercased())
}
ExpertTableView.reloadData()
}
}
}
//ExpertTableView
class ExpertTableViewController: UITableView{
}
extension HomeController: UITableViewDelegate, UITableViewDataSource{
func numberOfSections(in tableView: UITableView) -> Int {
if(tableView == ExpertTableView){
return 1
}else{
return 1
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
if(tableView == ExpertTableView){
if isFiltering {
return filteredSessions.count
}
return sessions.count
}else{
return 0
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
if(tableView == ExpertTableView){
_ = indexPath.row
}
let normalsession = UIStoryboard(name: "QA", bundle: nil)
let session = normalsession.instantiateViewController(withIdentifier: "QAController") as? QAController
var realmSession: QASession?
realmSession = self.sessions[indexPath.row] as QASession
session?.currentSession = realmSession
if let session = session{
self.navigationController?.pushViewController(session, animated: true)
}
}
func getPic() {
let imageProcessor = UserImagePost()
imageProcessor.getPic(image: "53bf7ebb568d8b78f51a8bbcf295a8b8", onCompletion: { (resultImage) in
if let result = resultImage {
print("kuva saatu")
self.expertImage = result
self.ExpertTableView.reloadData()
}
}
)}
func statusCheck(object: QASession) -> String{
var status = ""
if (object.live) {
status = NSLocalizedString("Live", value: "Live", comment: "Session status")
}else if(object.upcoming){
status = NSLocalizedString("Upcoming", value: "Upcoming", comment: "Session status")
}else if(object.archived){
status = NSLocalizedString("Archived", value: "Archived", comment: "Session status")
}
return status
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SessionCell", for: indexPath) as! QASessionCell
//Scaleing the image to fit ImageView
cell.profilePic?.contentMode = .scaleAspectFit
//Splits the array objects
var object: QASession
if isFiltering {
object = filteredSessions[indexPath.row] as QASession
} else {
object = sessions[indexPath.row] as QASession
}
let imageProcessor = UserImagePost()
imageProcessor.getPic(image: object.host[0].uImage, onCompletion: {(resultImage) in
if let result = resultImage {
cell.profilePic?.image = result
}
})
//sets the value to all cell elements from the split object.
cell.sessionDesc?.text = object.sessionDescription
cell.host?.text = object.host[0].firstName + " " + object.host[0].lastName
cell.title?.text = object.title
cell.category?.text = NSLocalizedString(object.sessionCategory, value: object.sessionCategory, comment: "Category name")
cell.status?.text = statusCheck(object: object)
cell.backgroundColor = judasGrey()
let border = CALayer()
border.backgroundColor = cellBorderColor
border.frame = CGRect(x: 0, y: cell.frame.size.height - 0.5, width: cell.frame.size.width, height: 0.5)
cell.layer.addSublayer(border)
return cell
}
}
extension HomeController: UISearchResultsUpdating {
func updateSearchResults(for searchController: UISearchController) {
let searchBar = searchController.searchBar
filterContentForSearchText(searchBar.text)
}
}
| [
-1
] |
44fd00cec4680b6556d4936d80cf58f40b91b6a1 | 15283ae8eddaa27829deb5edc4c8e196a64e031b | /WallPaper/Main/View/Hieu/AllWallpapers_Coll.swift | b31d1b7167e0bc0c1401bd4f17a9bd4bb134b30e | [] | no_license | NatsuSalamada/WallPaper | 570cee15acf119b42d78d5700dfd5943e02bb2cd | 2fab2c838128775bb4690af77b727a79f35d3085 | refs/heads/master | 2021-07-11T07:41:58.337511 | 2018-11-19T02:08:25 | 2018-11-19T02:08:25 | 135,959,225 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,160 | swift | //
// AllWallpapers_Coll.swift
// WallPaper
//
// Created by 5k on 6/7/18.
// Copyright © 2018 NatsuSalamada. All rights reserved.
//
import UIKit
private let reuseIdentifier = "Cell"
class AllWallpapers_Coll: UICollectionViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Register cell classes
self.collectionView!.register(UICollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
// MARK: UICollectionViewDataSource
override func numberOfSections(in collectionView: UICollectionView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 0
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of items
return 0
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath)
// Configure the cell
return cell
}
// MARK: UICollectionViewDelegate
/*
// Uncomment this method to specify if the specified item should be highlighted during tracking
override func collectionView(_ collectionView: UICollectionView, shouldHighlightItemAt indexPath: IndexPath) -> Bool {
return true
}
*/
/*
// Uncomment this method to specify if the specified item should be selected
override func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
return true
}
*/
/*
// Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item
override func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath) -> Bool {
return false
}
override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
return false
}
override func collectionView(_ collectionView: UICollectionView, performAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) {
}
*/
}
| [
332320,
234433,
345889,
290866,
345884
] |
a2f81178d16f8a9202356b52f22c691f82d21de9 | 140ff1b2d3e607d1548bcd87ae98bafcf496c850 | /AlphaWallet/Swap/SwapRoutes/ViewModels/SwapRouteSummaryViewModel.swift | ad3ef17779fd6ce50592e9aa0208fc5b69910fab | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | AlphaWallet/alpha-wallet-ios | d020a77c4ab0a2986328506a808fd7604cd096fc | 10efbb5280f8af660a65252a0167a1505e0e7c96 | refs/heads/master | 2023-09-01T17:54:03.813487 | 2023-09-01T15:26:03 | 2023-09-01T15:32:10 | 120,623,733 | 552 | 378 | MIT | 2023-09-13T01:14:48 | 2018-02-07T14:13:09 | Swift | UTF-8 | Swift | false | false | 3,615 | swift | //
// SwapRouteSummaryViewModel.swift
// AlphaWallet
//
// Created by Vladyslav Shepitko on 23.09.2022.
//
import UIKit
import AlphaWalletFoundation
import Combine
struct SwapRouteSummaryViewModelInput {
}
struct SwapRouteSummaryViewModelOutput {
let viewState: AnyPublisher<SwapRouteSummaryViewModel.ViewState, Never>
}
final class SwapRouteSummaryViewModel {
private let route: AnyPublisher<SwapRoute?, Never>
init(route: AnyPublisher<SwapRoute?, Never>) {
self.route = route
}
func transform(input: SwapRouteSummaryViewModelInput) -> SwapRouteSummaryViewModelOutput {
let viewState = route.map { route -> SwapRouteSummaryViewModel.ViewState in
let serverImage = route.flatMap { RPCServer(chainID: $0.toToken.chainId).iconImage }
return .init(
serverImage: serverImage,
amountToHeader: self.amountToHeader,
amountTo: self.amountTo(for: route),
currentPriceHeader: self.currentPriceHeader,
currentPrice: self.currentPrice(for: route))
}.eraseToAnyPublisher()
return .init(viewState: viewState)
}
private var currentPriceHeader: NSAttributedString {
return .init(string: "Current Price", attributes: [
.font: Fonts.regular(size: 14),
.foregroundColor: Configuration.Color.Semantic.alternativeText
])
}
private var amountToHeader: NSAttributedString {
return .init(string: "Amount To Swap", attributes: [
.font: Fonts.regular(size: 14),
.foregroundColor: Configuration.Color.Semantic.alternativeText
])
}
private func currentPrice(for swapRoute: SwapRoute?) -> NSAttributedString {
guard let route = swapRoute else { return attributedValue("-") }
let toAmount = Decimal(bigUInt: route.toAmount, decimals: route.toToken.decimals)
let fromAmount = Decimal(bigUInt: route.fromAmount, decimals: route.fromToken.decimals)
guard let toAmount = toAmount, let fromAmount = fromAmount else { return attributedValue("-") }
guard fromAmount > 0, let rate = (toAmount / fromAmount).nilIfNan else { return attributedValue("-") }
let string = NumberFormatter.shortCrypto.string(double: rate.doubleValue, minimumFractionDigits: 2, maximumFractionDigits: 4).droppedTrailingZeros
let currentPrice = "1 \(route.fromToken.symbol) = \(string) \(route.toToken.symbol)"
return attributedValue(currentPrice)
}
private func amountTo(for swapRoute: SwapRoute?) -> NSAttributedString {
guard let route = swapRoute else { return attributedValue("-") }
let fromAmount = Decimal(bigUInt: route.fromAmount, decimals: route.fromToken.decimals) ?? .zero
let string = NumberFormatter.shortCrypto.string(double: fromAmount.doubleValue, minimumFractionDigits: 6, maximumFractionDigits: 8).droppedTrailingZeros
let amountTo = "\(string) \(route.fromToken.symbol)"
return attributedValue(amountTo)
}
private func attributedValue(_ string: String) -> NSAttributedString {
return .init(string: string, attributes: [
.font: Fonts.semibold(size: 16),
.foregroundColor: Configuration.Color.Semantic.alternativeText
])
}
}
extension SwapRouteSummaryViewModel {
struct ViewState {
let serverImage: UIImage?
let amountToHeader: NSAttributedString
let amountTo: NSAttributedString
let currentPriceHeader: NSAttributedString
let currentPrice: NSAttributedString
}
}
| [
-1
] |
824aa3d09d08f371e0befba95e5152d89548b9bd | ad889fd374e87ef981d1e2f530af3f751f863dee | /ayakisi/Controller/TourVC.swift | e530798316052b76f45f6b4c17f0886a75e93d6a | [] | no_license | MilkLab34/ayakisi | 12e337801680a535fd2eb5d3852ffd8179f854bb | a01ee257b820af86e48d5cef2815fdccd8baea05 | refs/heads/master | 2021-01-18T20:56:20.527997 | 2016-09-28T10:51:28 | 2016-09-28T10:51:28 | 69,454,285 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 454 | swift | //
// TourVC.swift
// ayakisi
//
// Created by Mustafa Hastürk on 01/09/16.
// Copyright © 2016 Mustafa Hastürk. All rights reserved.
//
import UIKit
class TourVC: UIViewController {
@IBOutlet weak var loginButton: UIButton!
@IBOutlet weak var signupButton: UIButton!
// MARK: LC
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
| [
-1
] |
390f9088ea7f5e9d087bdfb1365a4be9014c8799 | 07c9f60c8d6deab926bf41c27ec41c04ba57d6b9 | /Sources/AST/Expression/IdentifierExpression.swift | 609d967e2206a1108a25c0c4f99c7886bbff6b61 | [
"Apache-2.0"
] | permissive | boyliang/swift-ast | 4287a042814f6a8855c538f5504c1e7beef781c1 | 4b3c8041087c39fd90af449c1ec5c85c5405e68f | refs/heads/master | 2021-01-02T09:17:49.959734 | 2017-08-01T23:33:53 | 2017-08-01T23:33:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,234 | swift | /*
Copyright 2016-2017 Ryuichi Saito, LLC and the Yanagiba project contributors
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.
*/
public class IdentifierExpression : ASTNode, PrimaryExpression {
public enum Kind {
case identifier(Identifier, GenericArgumentClause?)
case implicitParameterName(Int, GenericArgumentClause?)
}
public let kind: Kind
public init(kind: Kind) {
self.kind = kind
}
// MARK: - ASTTextRepresentable
override public var textDescription: String {
switch kind {
case let .identifier(id, generic):
return "\(id)\(generic?.textDescription ?? "")"
case let .implicitParameterName(i, generic):
return "$\(i)\(generic?.textDescription ?? "")"
}
}
}
| [
-1
] |
537405ce4e70d17f4dcc08c6c178ed3fc1c752da | 3a16a96269594993e44bddc65d877becd5a1e6f5 | /test/Incremental/Dependencies/reference-dependencies-members-fine.swift | 01e06c2dc6cb7e8834bb1a95988e009dd7f9d64a | [
"Apache-2.0",
"Swift-exception"
] | permissive | GulajavaMinistudio/swift | 5e38d36e6cec248b2f4643d06b27139c3fa54726 | e903630858ee3e156eb6a38a837bc962ee1c4666 | refs/heads/master | 2023-09-01T02:38:49.548812 | 2020-09-30T03:24:10 | 2020-09-30T03:24:10 | 86,411,471 | 0 | 0 | Apache-2.0 | 2020-09-29T06:42:50 | 2017-03-28T03:36:23 | C++ | UTF-8 | Swift | false | false | 3,714 | swift | // REQUIRES: shell
// Also uses awk:
// XFAIL OS=windows
// RUN: %empty-directory(%t)
// RUN: cp %s %t/main.swift
// Need -fine-grained-dependency-include-intrafile to be invarient wrt type-body-fingerprints enabled/disabled
// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t.swiftdeps
// RUN: %target-swift-frontend -fine-grained-dependency-include-intrafile -typecheck -primary-file %t/main.swift %S/../Inputs/reference-dependencies-members-helper.swift -emit-reference-dependencies-path - > %t-2.swiftdeps
// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t.swiftdeps %t-processed.swiftdeps
// RUN: %S/../../Inputs/process_fine_grained_swiftdeps.sh %swift-dependency-tool %t-2.swiftdeps %t-2-processed.swiftdeps
// RUN: diff %t-processed.swiftdeps %t-2-processed.swiftdeps
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL %s < %t-processed.swiftdeps
// RUN: %FileCheck -check-prefix=PROVIDES-NOMINAL-2 %s < %t-processed.swiftdeps
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER %s < %t-processed.swiftdeps
// RUN: %FileCheck -check-prefix=PROVIDES-MEMBER-NEGATIVE %s < %t-processed.swiftdeps
// RUN: %FileCheck -check-prefix=DEPENDS-NOMINAL %s < %t-processed.swiftdeps
// RUN: %FileCheck -check-prefix=DEPENDS-MEMBER %s < %t-processed.swiftdeps
// PROVIDES-NOMINAL-DAG: nominal implementation 4main4BaseC '' true
// PROVIDES-NOMINAL-DAG: nominal interface 4main4BaseC '' true
class Base {
// PROVIDES-MEMBER-DAG: potentialMember implementation 4main4BaseC '' true
// PROVIDES-MEMBER-DAG: potentialMember interface 4main4BaseC '' true
// PROVIDES-MEMBER-NEGATIVE-NOT: member {{.*}} 4main4BaseC {{[^']]+}} true
func foo() {}
}
// PROVIDES-NOMINAL-DAG: nominal implementation 4main3SubC '' true
// PROVIDES-NOMINAL-DAG: nominal interface 4main3SubC '' true
// DEPENDS-NOMINAL-DAG: nominal interface 4main9OtherBaseC '' false
class Sub : OtherBase {
// PROVIDES-MEMBER-DAG: potentialMember implementation 4main3SubC '' true
// PROVIDES-MEMBER-NEGATIVE-NOT: {{potentialM|m}}}}ember implementation 4main3SubC {{.+}} true
// DEPENDS-MEMBER-DAG: potentialMember interface 4main9OtherBaseC '' false
// DEPENDS-MEMBER-DAG: member interface 4main9OtherBaseC foo false
// DEPENDS-MEMBER-DAG: member interface 4main9OtherBaseC init false
func foo() {}
}
// PROVIDES-NOMINAL-DAG: nominal implementation 4main9SomeProtoP '' true
// PROVIDES-NOMINAL-DAG: nominal interface 4main9SomeProtoP '' true
// PROVIDES-MEMBER-DAG: potentialMember interface 4main9SomeProtoP '' true
protocol SomeProto {}
// PROVIDES-NOMINAL-DAG: nominal implementation 4main10OtherClassC '' true
// PROVIDES-NOMINAL-2-DAG: nominal interface 4main10OtherClassC '' true
// PROVIDES-MEMBER-DAG: potentialMember interface 4main10OtherClassC '' true
// DEPENDS-MEMBER-DAG: potentialMember interface 4main10OtherClassC '' true
extension OtherClass : SomeProto {}
// PROVIDES-NOMINAL-DAG: nominal implementation 4main11OtherStructV '' true
// PROVIDES-NOMINAL-DAG: nominal interface 4main11OtherStructV '' true
extension OtherStruct {
// PROVIDES-MEMBER-DAG: potentialMember interface 4main11OtherStructV '' true
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV foo true
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV bar true
// PROVIDES-MEMBER-DAG: member interface 4main11OtherStructV baz true
// DEPENDS-MEMBER-DAG: potentialMember interface 4main11OtherStructV '' true
func foo() {}
var bar: () { return () }
private func baz() {}
}
| [
83372
] |
b4502b0b5c413d1c7912462a677407e533f6c2f2 | 5bc806ecf1001397b2d93ba99de57be6e194ae57 | /Psychologist/AppDelegate.swift | 48fd5a3183922f5d267de80522d8a2a4604ec872 | [] | no_license | macgill4444/psychologist-swift | 08c3a8bae7cbb954dc85df673373939ef0d52ef9 | 120664ef9416fafdf4a3aaa3d7aa1cbc3847e8dd | refs/heads/master | 2021-01-20T21:53:21.348554 | 2015-08-27T16:05:50 | 2015-08-27T16:05:50 | 41,493,191 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,152 | swift | //
// AppDelegate.swift
// Psychologist
//
// Created by Macgill Davis on 8/27/15.
// Copyright (c) 2015 Macgill Davis. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
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,
417930,
303241,
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,
278760,
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,
230045,
303780,
172705,
287398,
172707,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
107208,
279241,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
230128,
312048,
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,
279383,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
295825,
304019,
189331,
279445,
58262,
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,
197645,
295949,
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,
350308,
230592,
279750,
312518,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
279788,
320748,
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,
279929,
181626,
304506,
304505,
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,
291754,
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,
223327,
149599,
321634,
149601,
149603,
329830,
280681,
313451,
223341,
280687,
313458,
280691,
215154,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
288936,
100520,
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,
280819,
157940,
125171,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
280835,
125187,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
313705,
280940,
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,
338823,
314249,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
281581,
183277,
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,
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,
324757,
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,
282410,
241450,
306988,
306991,
315184,
323376,
315190,
241464,
282425,
159545,
298811,
307009,
413506,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
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,
298984,
241640,
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,
282931,
307508,
315701,
307510,
332086,
151864,
307512,
176435,
307515,
168245,
282942,
307518,
151874,
282947,
282957,
323917,
110926,
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,
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,
225998,
299726,
226002,
226005,
119509,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
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,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
226182,
234375,
291716,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
324504,
234393,
209818,
308123,
324508,
234398,
234396,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
226230,
234422,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
226245,
234437,
234439,
234434,
234443,
291788,
193486,
275406,
193488,
234446,
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,
275545,
242777,
234585,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
144506,
275579,
234618,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
308379,
283805,
234653,
324766,
119967,
234657,
300189,
324768,
242852,
283813,
234661,
300197,
234664,
275626,
234667,
316596,
308414,
234687,
316610,
300226,
226500,
234692,
300229,
308420,
283844,
308418,
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,
283963,
243003,
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,
284076,
144812,
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,
276053,
284245,
284247,
317015,
284249,
243290,
284251,
300628,
284253,
235097,
284255,
300638,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
276098,
284290,
325250,
284292,
292479,
292485,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
276144,
284337,
284339,
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,
284449,
300834,
300832,
227109,
317221,
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,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
276539,
235579,
235581,
325692,
178238,
276544,
284739,
292934,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
194654,
227423,
350302,
194657,
227426,
276579,
178273,
194660,
227430,
276583,
309346,
309348,
276586,
309350,
309352,
309354,
276590,
350313,
227440,
350316,
284786,
350321,
276595,
301167,
350325,
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,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
276713,
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,
276789,
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,
277011,
317971,
309781,
309779,
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,
277106,
121458,
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,
285453,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277314,
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,
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,
285824,
392326,
285831,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
228526,
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,
286188,
310764,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
228864,
40448,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
286246,
294439,
286248,
278057,
294440,
294443,
40486,
294445,
40488,
310831,
40491,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
212560,
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,
229076,
286420,
319187,
286425,
319194,
278235,
301163,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
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
] |
bcf8c52a3cfc15bb15925b1c8193a79f42458e50 | dae6acd3432aebb1818e79ea9a459cb0a02d2026 | /JetLayout/Classes/Rx/Rx+Stack.swift | cdf73b3876de6383edb3e3fb54907745c0465441 | [
"MIT"
] | permissive | vbenkevich/JetLayout | 51f29f8fbf1ad272d45da896cc8d93d9d31c6136 | c254a48d1e027175afb773264ddd0c7933e53894 | refs/heads/master | 2023-02-20T02:58:06.949960 | 2021-01-23T13:11:28 | 2021-01-23T13:11:28 | 275,179,565 | 6 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,562 | swift | //
// JetLayout
//
// Copyright © 2021 Vladimir Benkevich
//
// 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 RxSwift
public extension Stack {
func content<T: ObservableType>(_ source: T) -> Self where T.Element == [View] {
bind(source) { view, views in
view.clearArrangedSubviews()
views.forEach { child in
let body = child.body
let subview = body.layout(container: view)
view.addArranged(view: subview, alignment: body.alignment)
}
view.setNeedsUpdateConstraints()
view.layoutIfNeeded()
}
}
}
public extension ZStack {
convenience init<T: ObservableType>(_ source: T) where T.Element == [View] {
self.init()
_ = content(source)
}
func content<T: ObservableType>(_ source: T) -> Self where T.Element == [View] {
bind(source) { view, views in
view.subviews.forEach { $0.removeFromSuperview() }
views.forEach { child in
_ = child.body.layout(container: view)
}
}
}
}
public extension HStack {
convenience init<T: ObservableType>(spacing: CGFloat = 0, _ source: T) where T.Element == [View] {
self.init(spacing: spacing)
_ = content(source)
}
}
public extension VStack {
convenience init<T: ObservableType>(spacing: CGFloat = 0, _ source: T) where T.Element == [View] {
self.init(spacing: spacing)
_ = content(source)
}
}
| [
229505,
334596,
142087,
142089,
334602,
229516,
337421,
334606,
201617,
27795,
394915,
57905,
144442,
124987,
198206,
370111,
319426,
141254,
210759,
279371,
34516,
185428,
141271,
141658,
229210,
285786,
115808,
192229,
185453,
312430,
334591
] |
8a3c388f34d8e40a5e2f92260c382aaefa679f19 | 0183d0f1db0dda4286c9e222036faf14752846cd | /FunctionalSwift/Kotlin.swift | 289001a099513216c8a0fa561caf527bf9c5e2cb | [] | no_license | geonu1109/FunctionalSwift | 5eb624881fd2fd0191e06561e22913cf55259f23 | 82c462fd4683da532e64f26d24648dd994b98238 | refs/heads/master | 2020-06-02T06:34:46.246164 | 2019-06-10T04:27:27 | 2019-06-10T04:27:27 | 191,071,486 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,297 | swift | //
// Kotlin.swift
// FunctionalSwift
//
// Created by Geonu Jeon on 10/06/2019.
// Copyright © 2019 Geonu Jeon. All rights reserved.
//
import Foundation
func run(_ block: () -> Void) -> Void {
block()
}
protocol KotlinHigherOrderFunctionsEnabled {
}
extension KotlinHigherOrderFunctionsEnabled {
func also(_ block: (Self) -> Void) -> Self {
block(self)
return self
}
func `let`<R>(_ block: (Self) -> R) -> R {
return block(self)
}
}
extension NSObject: KotlinHigherOrderFunctionsEnabled {
}
extension Bool: KotlinHigherOrderFunctionsEnabled {
}
extension Int: KotlinHigherOrderFunctionsEnabled {
}
extension UInt: KotlinHigherOrderFunctionsEnabled {
}
extension Float: KotlinHigherOrderFunctionsEnabled {
}
extension Double: KotlinHigherOrderFunctionsEnabled {
}
extension Character: KotlinHigherOrderFunctionsEnabled {
}
extension String: KotlinHigherOrderFunctionsEnabled {
}
extension Data: KotlinHigherOrderFunctionsEnabled {
}
extension Date: KotlinHigherOrderFunctionsEnabled {
}
extension Array: KotlinHigherOrderFunctionsEnabled {
}
extension Dictionary: KotlinHigherOrderFunctionsEnabled {
}
extension Set: KotlinHigherOrderFunctionsEnabled {
}
| [
-1
] |
faa63369c770ff219853b05355805c5150bf15fb | 23955f6ec4a965294226b4f2de591089059d0aae | /Landmarks/Landmarks/SceneDelegate.swift | 439506a353a46c58950e3ca802c04794e45f6551 | [] | no_license | Heo-Seoyeong/Study_SwiftUI | 4a1f29832b6c799c734d7b60469f0c3db54194ab | f74ea6decbc83ac864c55d2cc0d00dbc87936611 | refs/heads/master | 2020-05-31T07:51:20.033477 | 2019-06-11T06:34:55 | 2019-06-11T06:34:55 | 190,175,230 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,604 | swift | //
// SceneDelegate.swift
// Landmarks
//
// Created by Seoyeong Heo on 2019/06/10.
// Copyright © 2019 landmarks. 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).
// Use a UIHostingController as window root view controller
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: CategoryHome().environmentObject(UserData()))
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.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
163892,
393269,
213049,
376890,
385082,
16444,
393277,
254020,
376906,
327757,
254032,
286804,
254045,
368736,
180322,
376932,
286833,
368753,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
327872,
180418,
377037,
180432,
368854,
377047,
418008,
385243,
418012,
327915,
393466,
336124,
418044,
336129,
385281,
262405,
336140,
368913,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
262497,
418145,
262501,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
262567,
262574,
393649,
385460,
262587,
344512,
336326,
393671,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
197160,
377384,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
352844,
352865,
352875,
344694,
352888,
377473,
336517,
344710,
148106,
377485,
336549,
271018,
336556,
385714,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385749,
139998,
189154,
369382,
361196,
418540,
418555,
344832,
336644,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
418591,
418594,
336676,
418600,
336681,
418606,
328498,
271154,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
213848,
197469,
361310,
361318,
344936,
361335,
328574,
361361,
222129,
386004,
345046,
386023,
328690,
328703,
328710,
328715,
377867,
361490,
336922,
345119,
377888,
328747,
345134,
361525,
386102,
361537,
377931,
197708,
345172,
156762,
402523,
148580,
345200,
361591,
386168,
361594,
410746,
361599,
214150,
345224,
386187,
337048,
345247,
361645,
337072,
337076,
345268,
402615,
361657,
337093,
328925,
165086,
66783,
328933,
328942,
386292,
206084,
115973,
345377,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
353634,
197987,
337252,
345449,
99692,
271731,
378232,
337278,
271746,
181644,
361869,
181650,
181655,
230810,
263585,
181671,
181674,
181679,
337330,
181691,
181697,
361922,
181704,
337366,
271841,
329192,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419404,
419408,
214611,
419412,
345702,
222831,
370298,
403076,
345737,
403085,
140955,
419484,
345758,
345763,
345766,
370351,
419507,
337588,
419510,
419513,
337601,
337607,
419528,
272083,
419543,
419545,
345819,
419548,
181982,
419560,
337643,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
362256,
321300,
116512,
362274,
354107,
345916,
354112,
247618,
329545,
345932,
354124,
337743,
354132,
247639,
370520,
337751,
313181,
354143,
345965,
354157,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
337814,
329625,
436127,
436133,
337845,
190393,
346059,
247760,
354275,
329699,
247790,
354314,
346140,
337980,
378956,
395340,
329816,
100454,
329833,
329853,
329857,
329868,
329886,
346273,
100525,
387261,
256193,
346317,
411865,
411877,
387303,
395496,
346344,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
43279,
395539,
387350,
338201,
387353,
182559,
338212,
395567,
248112,
264502,
436556,
190797,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
354728,
338353,
338363,
338387,
248279,
256474,
182755,
338404,
338411,
248309,
199165,
248332,
199182,
330254,
330268,
191012,
330320,
199250,
191069,
248427,
191085,
346736,
338544,
191093,
346743,
330384,
346769,
174775,
248505,
174778,
223936,
273109,
264919,
183006,
338661,
338665,
264942,
330479,
338680,
207620,
191240,
338701,
256787,
338712,
199455,
396067,
396070,
215854,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
265056,
265059,
355185,
330612,
330643,
347082,
330711,
248794,
248799,
347106,
437219,
338928,
257009,
330750,
265215,
199681,
330761,
330769,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
248986,
44199,
339118,
249015,
339133,
322763,
330959,
330966,
265433,
265438,
388320,
388348,
339199,
175376,
175397,
208167,
273709,
44343,
175416,
396601,
208189,
437567,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
339401,
339406,
208338,
413143,
339418,
339421,
249310,
249313,
339425,
339429,
339435,
249329,
69114,
339464,
249355,
175637,
405017,
134689,
339504,
265779,
421442,
265796,
265806,
224854,
224858,
339553,
224871,
372328,
257647,
372338,
339572,
224888,
224891,
372354,
126597,
224905,
11919,
224911,
159375,
126611,
224917,
224920,
126618,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
257740,
339664,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
225021,
257791,
339711,
225027,
257796,
339722,
225039,
257808,
249617,
372500,
225044,
167701,
225049,
257820,
184096,
257825,
225059,
339748,
257837,
413485,
225071,
225074,
372533,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225097,
323404,
257869,
339795,
397140,
225113,
257881,
257884,
257887,
225120,
413539,
257897,
339818,
225138,
339827,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
225171,
380823,
225176,
372704,
356336,
372739,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
266351,
266365,
192640,
225430,
250008,
225439,
135328,
225442,
438434,
192674,
225445,
356521,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
225476,
389322,
225485,
225488,
225494,
266454,
225497,
225500,
225503,
225506,
356580,
217319,
225511,
225515,
225519,
381177,
389381,
356631,
381212,
258333,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
332091,
332098,
201030,
332107,
151884,
430422,
332118,
250201,
332126,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
332158,
389503,
250239,
332162,
389507,
348548,
332175,
160152,
373146,
340380,
373149,
176545,
356783,
373169,
324032,
266688,
201158,
127473,
217590,
340473,
324095,
324100,
266757,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
324156,
348734,
152128,
324161,
324165,
324171,
324174,
324177,
389724,
332381,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
373450,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
348926,
389927,
152371,
348983,
340792,
398141,
127815,
357202,
389971,
136024,
357208,
389979,
357212,
430940,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
324473,
398202,
119675,
324476,
340859,
430973,
324479,
340863,
324482,
373635,
324485,
324488,
185226,
324493,
324496,
324502,
324511,
324514,
201638,
373672,
324525,
5040,
111539,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
201712,
209904,
381947,
431100,
349181,
431107,
349203,
209944,
209948,
250915,
357411,
250917,
357419,
209966,
209969,
209973,
209976,
209988,
209991,
209996,
431180,
341072,
349268,
250968,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
373905,
210068,
210072,
210078,
210081,
210085,
251045,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
333016,
210139,
251123,
242947,
333075,
333079,
251161,
349486,
349492,
251211,
357710,
365912,
365922,
333164,
234867,
136591,
374161,
112021,
349591,
333222,
210357,
259516,
415168,
366035,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
415279,
415282,
349748,
415286,
210488,
415291,
349762,
333387,
333396,
333400,
366173,
333415,
333423,
210547,
333472,
333499,
333512,
210632,
333515,
358100,
366301,
153311,
333535,
366308,
366312,
399086,
366319,
210673,
366322,
399092,
333566,
268042,
210700,
366349,
399129,
333593,
333595,
210720,
358192,
366384,
210740,
366388,
399166,
325441,
366403,
341831,
325447,
341835,
341839,
341844,
358235,
341852,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333737,
382891,
382898,
333767,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
268299,
333838,
350225,
186388,
350232,
350238,
374819,
350245,
350249,
350252,
350257,
350272,
243782,
350281,
374865,
342113,
252021,
342134,
268435,
333989,
333998,
334012,
350411,
350417,
350423,
350426,
334047,
350449,
375027,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
391469,
350510,
383307,
334162,
383331,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
383375,
268702,
342431,
416159,
375209,
326059,
342453,
334263,
326087,
195041,
334306,
334312,
104940,
375279,
162289,
186898,
342546,
350740,
334359,
342551,
334364,
416294,
252463,
334386,
334397,
219719,
399957,
244309,
334425,
326240,
375401,
268922,
334466,
334469,
162446,
326291,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
64231,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
326463,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
326494,
326503,
433001,
375657,
326508,
400238,
326511,
211826,
392061,
351102,
359296,
351105,
252801,
260993,
342921,
236432,
342931,
252823,
400279,
400286,
252838,
359335,
211885,
252846,
187335,
326599,
359367,
359383,
383968,
359411,
261109,
261112,
244728,
383999,
261130,
326669,
261148,
343132,
384099,
384102,
367724,
384108,
326764,
326767,
187503,
384115,
384136,
384140,
384144,
351382,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
351424,
384192,
343232,
244934,
367817,
244938,
384202,
326858,
343246,
384209,
146644,
351450,
384225,
343272,
351467,
359660,
384247,
384250,
343307,
384270,
384276,
384284,
245021,
384290,
245032,
171304,
245042,
384324,
343366,
212296,
367966,
343394,
343399,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
40358,
245158,
245163,
114093,
327090,
359867,
384444,
146878,
327108,
327112,
384457,
327116,
327118,
359887,
343509,
155103,
343535,
343540,
368120,
343545,
253445,
359948,
359951,
245275,
359984,
400977,
400982,
343650,
245358,
138865,
155255,
155274,
245410,
245415,
425639,
155323,
245463,
155352,
155356,
212700,
245477,
155372,
245487,
245495,
409336,
155394,
155404,
245528,
360224,
155444,
155448,
417596,
384831,
360262,
155463,
155477,
425823,
376672,
327532,
376686,
262000,
327542,
425846,
147319,
262006,
262009,
262012,
155517,
155523,
155526,
376715,
155532,
262034,
262043,
155550,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
327655,
360432,
204785,
393204,
253944,
393209,
393215
] |
a4aec56f36f0c563c855a3a4dc3e03105c4c637a | bc85290cbbf183c95630f50bb585d775e02e833a | /Recipes/Configs.swift | 975f3beb0fd7dc90cd8eb87179618b08b607c94c | [] | no_license | dszheng92/BigCo-Nutriport | 94f5d2d3707a072a3af44bde0e32ab19747a89ac | 320a123a36b9033167683489a966cbb7bdebb6d3 | refs/heads/master | 2020-04-29T05:04:33.729903 | 2019-05-02T18:55:31 | 2019-05-02T18:55:31 | 175,869,294 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 5,704 | swift | /*-----------------------------------
- Recipes -
Created by cubycode ©2017
All Rights reserved
-----------------------------------*/
import Foundation
import UIKit
import Parse
// IMPORTANT: Replace the red string below accordingly to the new name you'll give to this app
//let APP_NAME = "Recipes"
let APP_NAME = "Nutriport"
// PARSE KEYS -> Replace these red keys with your own ones from your Parse app on back4app.com
//let PARSE_APP_KEY = "FH5tG5ceS6VNYphhG2bCygq4jG984qIv4wsCWlbV"
//let PARSE_CLIENT_KEY = "GcIndXBrHmseaKc2b5s1nlrWuuRFWccXJcCIgw2W"
let PARSE_APP_KEY = "5KZjExpjct9eOWsAIh9aoLDCp3LpEiVqDb2BuyOK"
let PARSE_CLIENT_KEY = "dVuvhmlctBZpulAY8mrAziFniq9AxBvKkjVs9Bv9"
// IMPORTANT: REPLACE THE RED STRING BELOW WITH THE UNIT ID YOU'VE GOT BY REGISTERING YOUR APP IN http://www.apps.admob.com
let ADMOB_BANNER_UNIT_ID = "ca-app-pub-3940256099942544/6300978111"
// FOOD CATEGORIES ARRAY (editable)
let categoriesArray = [
"Snack",
"Breakfast",
"Lunch",
"Dinner",
// "Healthy",
// "Holidays & Events",
// "Main Dish",
// "Seafood",
// "Vegetarian",
// "Salad",
// "Desserts",
// "Beverage",
// "Appetizer",
// You can add categories here...
// IMPORTANT: Also remember to add the proper images into the FOOD CATEGORIES folder in Assets.xcassets, naming them exactly like the red strings above!
]
// Custom yellow color
let yellow = UIColor(red: 155/255.0, green: 187/255.0, blue: 86/255.0, alpha: 1.0)
// HUD VIEW
var hudView = UIView()
var animImage = UIImageView(frame: CGRect(x: 0, y: 0, width: 80, height: 80))
extension UIViewController {
func showHUD() {
hudView.frame = CGRect(x: 0, y: 0, width: 80, height: 80)
hudView.center = view.center
hudView.backgroundColor = UIColor.yellow
hudView.alpha = 0.9
hudView.clipsToBounds = true
hudView.layer.cornerRadius = hudView.bounds.size.width/2
// let imagesArr = ["h0", "h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9", "h10"]
let imagesArr = ["h0", "h1", "h2", "h3"]
var images:[UIImage] = []
for i in 0..<imagesArr.count {
images.append(UIImage(named: imagesArr[i])!)
}
animImage.animationImages = images
animImage.animationDuration = 0.7
hudView.addSubview(animImage)
animImage.startAnimating()
view.addSubview(hudView)
}
func hideHUD() { hudView.removeFromSuperview() }
func simpleAlert(_ mess:String) {
let alert = UIAlertController(title: APP_NAME, message: mess, preferredStyle: .alert)
let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in })
alert.addAction(ok)
present(alert, animated: true, completion: nil)
}
}
/****** DO NOT EDIT THE CODE BELOW *****/
let USER_CLASS_NAME = "User"
let USER_FULLNAME = "fullName"
let USER_USERNAME = "username"
let USER_AVATAR = "avatar"
let USER_EMAIL = "email"
let USER_JOB = "job"
let USER_ABOUTME = "aboutMe"
let USER_IS_REPORTED = "isReported"
let USER_REPORT_MESSAGE = "reportMessage"
let LIKES_CLASS_NAME = "Likes"
let LIKES_LIKED_BY = "likedBy"
let LIKES_RECIPE_LIKED = "recipeLiked"
let RECIPES_CLASS_NAME = "Recipes"
let RECIPES_COVER = "cover"
let RECIPES_TITLE = "title"
let RECIPES_TITLE_LOWERCASE = "titleLowercase"
let RECIPES_CATEGORY = "category"
let RECIPES_LIKES = "likes"
let RECIPES_ABOUT = "aboutRecipe"
let RECIPES_DIFFICULTY = "difficulty"
let RECIPES_COOKING = "cooking"
let RECIPES_BAKING = "baking"
let RECIPES_RESTING = "resting"
let RECIPES_YOUTUBE = "youtube"
let RECIPES_VIDEO_TITLE = "videoTitle"
let RECIPES_INGREDIENTS = "ingredients"
let RECIPES_PREPARATION = "preparation"
let RECIPES_USER_POINTER = "userPointer"
let RECIPES_IS_REPORTED = "isReported"
let RECIPES_REPORT_MESSAGE = "reportMessage"
let RECIPES_COMMENTS = "comments"
let RECIPES_KEYWORDS = "keywords"
// Additional Numbers
let CALORIES = "calories_Kcal"
let FAT = "fat_g"
let CHOLESTEROL = "Cholesterol_mg"
let PROTEION = "Protein_g"
let VB = "VB"
let CARBS = "Carbs_g"
let VC = "VC"
let VE = "VE"
let CA = "CA"
let FE = "VE"
let SUGAR = "Sugar_g"
let ACTIVITY_CLASS_NAME = "Activity"
let ACTIVITY_CURRENT_USER = "currentUser"
let ACTIVITY_OTHER_USER = "otherUser"
let ACTIVITY_TEXT = "text"
let COMMENTS_CLASS_NAME = "Comments"
let COMMENTS_RECIPE_POINTER = "recipePointer"
let COMMENTS_USER_POINTER = "userPointer"
let COMMENTS_COMMENT = "comment"
let defaults = UserDefaults.standard
var currentUser = PFUser.current()
var justSignedUp = false
// MARK: - EXTENSION TO RESIZE A UIIMAGE
extension UIViewController {
func scaleImageToMaxWidth(image: UIImage, newWidth: CGFloat) -> UIImage {
let scale = newWidth / image.size.width
let newHeight = image.size.height * scale
UIGraphicsBeginImageContext(CGSize(width: newWidth, height: newHeight))
image.draw(in: CGRect(x:0, y:0, width:newWidth, height:newHeight))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage!
}
}
// EXTENSION TO FORMAT LARGE NUMBERS INTO K OR M (like 1.1M, 2.5K)
extension Int {
var abbreviated: String {
let abbrev = "KMBTPE"
return abbrev.enumerated().reversed().reduce(nil as String?) { accum, tuple in
let factor = Double(self) / pow(10, Double(tuple.0 + 1) * 3)
let format = (factor.truncatingRemainder(dividingBy: 1) == 0 ? "%.0f%@" : "%.1f%@")
return accum ?? (factor > 1 ? String(format: format, factor, String(tuple.1)) : nil)
} ?? String(self)
}
}
| [
-1
] |
7b1507a24648743c20a99d6111843caa9a2efb9f | 52c5425ca46e894f7e05ca541b02545f8041881c | /WeatherTracker_IOS/ViewController.swift | 036eed0e5d78045c9a1ffe49a05c0e8e9f0c5970 | [] | no_license | gupett/WeatherTracker_IOS | 441242f7cf50194e043a29b4da53e81157c82dcf | a1a198895011a1820802a01aedeef7cef63300b4 | refs/heads/master | 2016-09-13T10:26:18.390033 | 2016-04-11T13:44:03 | 2016-04-11T13:44:03 | 55,948,995 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 511 | swift | //
// ViewController.swift
// WeatherTracker_IOS
//
// Created by Gustav on 11/04/16.
// Copyright © 2016 Gustav. All rights reserved.
// test
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
279041,
307212,
281107,
279064,
282143,
294433,
284197,
292915,
290875,
243786,
284235,
288331,
284242,
300116,
300629,
307288,
212573,
307311,
312433,
284275,
189557,
294518,
278657,
307353,
287399,
198315,
302767,
307379,
184504,
282301,
283839,
285377,
285378,
287437,
239310,
299727,
230608,
302286,
239314,
302295,
282329,
363743,
228585,
199402,
234223,
286963,
289524,
286965,
286462,
309506,
292102,
278791,
282377,
295699,
288251,
287007,
130346,
282411,
289596,
283453,
293700,
283461,
300358,
238920,
311624,
230737,
230745,
241499,
289120,
289121,
296811,
306540,
300400,
315250,
284534,
292730,
291709,
183173,
298375,
324491,
310673,
304531,
304536,
294812,
304540,
277406,
284576,
284580,
304550,
304551,
284586,
305582,
285103,
324528,
230323,
144822,
130487,
292280,
293308,
278973,
296901,
306633,
310734,
286162,
292824,
293874,
293875,
290299,
290303
] |
a0996570ec34f869f20b14221cc87b31b795e451 | 38de284c7c242697e8069924a0f9d5f8c4f77fa1 | /Examples/BlueCap/BlueCap/Peripheral/PeripheralManagerBeaconViewController.swift | ace05ade2152d21782d7bde02015c37d10613b66 | [
"MIT"
] | permissive | UnifyID/BlueCap | 72283513ef4440747cf12ad91f9b5f29cf12de69 | 8b7490f8f5b57fdcb312739232521a634c9183c1 | refs/heads/master | 2020-05-25T14:57:03.997118 | 2017-02-22T02:35:04 | 2017-02-22T02:35:04 | 70,123,062 | 1 | 1 | null | 2016-12-17T00:21:08 | 2016-10-06T04:36:53 | Swift | UTF-8 | Swift | false | false | 8,059 | swift | //
// PeripheralManagerBeaconViewController.swift
// BlueCap
//
// Created by Troy Stribling on 9/28/14.
// Copyright (c) 2014 Troy Stribling. The MIT License (MIT).
//
import UIKit
import BlueCapKit
class PeripheralManagerBeaconViewController: UITableViewController, UITextFieldDelegate {
@IBOutlet var advertiseSwitch: UISwitch!
@IBOutlet var advertiseLabel: UILabel!
@IBOutlet var nameTextField: UITextField!
@IBOutlet var uuidTextField: UITextField!
@IBOutlet var majorTextField: UITextField!
@IBOutlet var minorTextField: UITextField!
@IBOutlet var generaUUIDBuuton: UIButton!
required init?(coder aDecoder:NSCoder) {
super.init(coder:aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.nameTextField.text = PeripheralStore.getBeaconName()
self.uuidTextField.text = PeripheralStore.getBeaconUUID()?.uuidString
let beaconMinorMajor = PeripheralStore.getBeaconMinorMajor()
if beaconMinorMajor.count == 2 {
self.minorTextField.text = "\(beaconMinorMajor[0])"
self.majorTextField.text = "\(beaconMinorMajor[1])"
}
let stateChangeFuture = Singletons.peripheralManager.whenStateChanges()
stateChangeFuture.onSuccess { [weak self] state in
self.forEach { strongSelf in
strongSelf.setUIState()
switch state {
case .poweredOn:
break
case .poweredOff:
strongSelf.present(UIAlertController.alert(message: "PeripheralManager powered off."), animated: true)
case .unauthorized:
strongSelf.present(UIAlertController.alert(message: "Bluetooth not authorized."), animated: true)
case .unknown:
break
case .unsupported:
strongSelf.present(UIAlertController.alert(message: "Bluetooth not supported."), animated: true)
case .resetting:
let message = "PeripheralManager state \"\(Singletons.peripheralManager.state)\". The connection with the system bluetooth service was momentarily lost."
strongSelf.present(UIAlertController.alert(message: message) { _ in
Singletons.peripheralManager.reset()
}, animated: true)
}
}
}
stateChangeFuture.onFailure { [weak self] error in
self?.present(UIAlertController.alert(error: error) { _ in
Singletons.peripheralManager.reset()
}, animated: true, completion: nil)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setUIState()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
NotificationCenter.default.removeObserver(self)
}
@IBAction func generateUUID(_ sender: AnyObject) {
self.uuidTextField.text = UUID().uuidString
}
// UITextFieldDelegate
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
if let enteredUUID = self.uuidTextField.text, !enteredUUID.isEmpty {
if let uuid = UUID(uuidString:enteredUUID) {
PeripheralStore.setBeaconUUID(uuid)
} else {
self.present(UIAlertController.alertOnErrorWithMessage("UUID '\(enteredUUID)' is invalid."), animated:true, completion:nil)
return false
}
}
if let enteredName = self.nameTextField.text, !enteredName.isEmpty {
PeripheralStore.setBeaconName(enteredName)
}
if let enteredMinor = self.minorTextField.text, let enteredMajor = self.majorTextField.text, !enteredMinor.isEmpty, !enteredMajor.isEmpty {
if let minor = UInt16(enteredMinor), let major = UInt16(enteredMajor), minor <= 65535, major <= 65535 {
PeripheralStore.setBeaconMinorMajor([minor, major])
} else {
present(UIAlertController.alertOnErrorWithMessage("major or minor not convertable to a number."), animated:true, completion:nil)
return false
}
}
setUIState()
return true
}
@IBAction func toggleAdvertise(_ sender:AnyObject) {
guard Singletons.peripheralManager.poweredOn else {
present(UIAlertController.alertOnErrorWithMessage("Bluetooth powered off"), animated:true, completion:nil)
return
}
if Singletons.peripheralManager.isAdvertising {
let stopAdvertisingFuture = Singletons.peripheralManager.stopAdvertising()
stopAdvertisingFuture.onSuccess { [weak self] in
self?.setUIState()
}
stopAdvertisingFuture.onFailure { [weak self] error in
self?.present(UIAlertController.alert(error: error) { _ in
Singletons.peripheralManager.reset()
}, animated: true, completion: nil)
}
return
}
let beaconMinorMajor = PeripheralStore.getBeaconMinorMajor()
if let uuid = PeripheralStore.getBeaconUUID(), let name = PeripheralStore.getBeaconName(), beaconMinorMajor.count == 2 {
let beaconRegion = BeaconRegion(proximityUUID: uuid, identifier: name, major: beaconMinorMajor[1], minor: beaconMinorMajor[0])
let startAdvertiseFuture = Singletons.peripheralManager.startAdvertising(beaconRegion)
startAdvertiseFuture.onSuccess { [weak self] in
self?.setUIState()
self?.present(UIAlertController.alert(message: "Started advertising."), animated: true, completion: nil)
}
startAdvertiseFuture.onFailure { [weak self] error in
self.forEach { strongSelf in
let stopAdvertisingFuture = Singletons.peripheralManager.stopAdvertising()
stopAdvertisingFuture.onSuccess { strongSelf.setUIState() }
stopAdvertisingFuture.onFailure { _ in strongSelf.setUIState() }
self?.present(UIAlertController.alert(error: error) { _ in
Singletons.peripheralManager.reset()
}, animated: true, completion: nil)
}
}
} else {
present(UIAlertController.alert(message: "iBeacon config is invalid."), animated: true, completion: nil)
}
}
func setUIState() {
if Singletons.peripheralManager.isAdvertising {
navigationItem.setHidesBackButton(true, animated:true)
advertiseSwitch.isOn = true
nameTextField.isEnabled = false
uuidTextField.isEnabled = false
majorTextField.isEnabled = false
minorTextField.isEnabled = false
generaUUIDBuuton.isEnabled = false
advertiseLabel.textColor = UIColor.black
} else {
navigationItem.setHidesBackButton(false, animated:true)
advertiseSwitch.isOn = false
nameTextField.isEnabled = true
uuidTextField.isEnabled = true
majorTextField.isEnabled = true
minorTextField.isEnabled = true
generaUUIDBuuton.isEnabled = true
if canAdvertise() {
advertiseSwitch.isEnabled = true
advertiseLabel.textColor = UIColor.black
} else {
advertiseSwitch.isEnabled = false
advertiseLabel.textColor = UIColor.lightGray
}
}
if !Singletons.peripheralManager.poweredOn {
advertiseSwitch.isEnabled = false
advertiseLabel.textColor = UIColor.lightGray
}
}
func canAdvertise() -> Bool {
return PeripheralStore.getBeaconUUID() != nil && PeripheralStore.getBeaconName() != nil && PeripheralStore.getBeaconMinorMajor().count == 2
}
}
| [
-1
] |
5432d566df45eafd2ba8c5c02d808d8d312cd751 | b6897b71cec2295321d47d243cd2e2b6f1b4503d | /MacroChallenge/View/Breath Page/Animation/AnimatedRing.swift | be00ae6ff678d891159e2955ecbd931a0c734cd2 | [] | no_license | jvincentac/MacroChallenge | bbb51fd2bc5ed568e3c40501caa7b8b21373c3a4 | 235124eb8e1c0d55abb1b6f804ecfbfeb8e9a8cc | refs/heads/development | 2023-01-27T19:52:40.141113 | 2020-12-05T07:59:12 | 2020-12-05T07:59:12 | 303,315,300 | 0 | 3 | null | 2020-12-05T07:59:13 | 2020-10-12T07:42:41 | Swift | UTF-8 | Swift | false | false | 2,114 | swift | //
// AnimatedRing.swift
// MacroChallenge
//
// Created by Aghawidya Adipatria on 29/10/20.
//
import SwiftUI
struct AnimatedRing: View {
@Binding var binding: CGFloat
var donutRadius: CGFloat = 0.6
var ringColour: Color = Color(UIColor(cgColor: CGColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.2)))
var body: some View {
GeometryReader { geometry in
ZStack {
// INNER BLUR
DonutShape(size: donutRadius, delta: 1.0)
.fill(Color.clear)
.background(
Blur(style: .regular)
.mask(DonutShape(size: donutRadius, delta: 1.0))
)
.scaleEffect(1.01)
// INNER BLUR PROGRESSION
DonutShape(size: donutRadius, delta: self.binding)
.fill(Color.clear)
.background(
Blur(style: .regular)
.mask(DonutShape(size: donutRadius, delta: self.binding))
)
// OUTER RIM BACKGROUND
Circle()
.stroke(style: StrokeStyle(lineWidth: 5))
.foregroundColor(ringColour)
// OUTER RIM
Circle()
.trim(from: 0.0, to: self.binding)
.stroke(style: StrokeStyle(lineWidth: 5, lineCap: .butt, lineJoin: .bevel))
.fill(Color.white)
.rotationEffect(Angle(degrees: 270))
// HEADER
Circle()
.fill(Color.white)
.frame(width: 20, height: 20)
.modifier(OrbitalEffect(percent: self.binding, radius: geometry.size.height < geometry.size.width ? geometry.size.height/2 : geometry.size.width/2))
}
}
}
}
//struct AnimatedRing_Previews: PreviewProvider {
// static var previews: some View {
// AnimatedRing()
// }
//}
| [
-1
] |
cd8dfcfaac87373e675a69dd5fec811516cae54e | 76b06e026305100cafbf2cf31aa5eb7474e2f8e7 | /CoffeeService/CoffeeService/CoffeeService.swift | 79805e365d948306320fbf8feea430e7bc7d8383 | [] | no_license | kraigspear/CoffeeRewards | 20ffb6f11cd3522df07f9f0f50ed0d65b7f5f34c | 09979f9ab26bb20bfee7ad655588eeaeacd65ba7 | refs/heads/master | 2020-09-26T05:16:05.162327 | 2016-08-31T10:21:13 | 2016-08-31T10:21:13 | 67,027,312 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 786 | swift | //
// CoffeeService.swift
// CoffeeService
//
// Created by Kraig Spear on 8/30/16.
// Copyright © 2016 Meijer. All rights reserved.
//
import Foundation
public protocol CoffeeServiceable {
func dispense(whenCompleted: (Int) -> Void)
var numberUntilReward: Int {get}
}
public final class CoffeeService: CoffeeServiceable {
private (set) public var dispenseCount = 0
private let maxDispense = 6
public init() {}
public func dispense(whenCompleted: (Int) -> Void) {
if dispenseCount + 1 < maxDispense {
dispenseCount += 1
}
else {
dispenseCount = 0
}
whenCompleted(dispenseCount)
}
public var numberUntilReward: Int {
return maxDispense - dispenseCount
}
}
| [
-1
] |
fb6cb69e4be63ba4e5b2d1f9892fa2122e84474b | 1ee37c829034e7d16b2a356eba4c386565533562 | /YDHYK/ZXPresetation/ZXStore/ZXStoreRootViewController.swift | 702673fd24d6b8c2610a189b638e9dc599408635 | [] | no_license | AidyBao/YDHYK1128 | 69edff518c7ff28e32a5b29883b5add27dcafa19 | 7e5b3ebc55d1401ac535fe959e5991f0f30b23c7 | refs/heads/master | 2021-01-25T17:12:03.364570 | 2018-02-27T07:39:27 | 2018-02-27T07:39:27 | 123,091,510 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 13,357 | swift | //
// ZXStoreRootViewController.swift
// YDHYK
//
// Created by screson on 2017/10/11.
// Copyright © 2017年 screson. All rights reserved.
//
import UIKit
/// Store BaseVC
class ZXSTUIViewController: UIViewController {
var onceLoad = false
var preferredCartButtonHidden: Bool { return false }
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if preferredCartButtonHidden {
ZXStoreRootViewController.cartButton.hide()
} else {
ZXStoreRootViewController.cartButton.show()
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
ZXStoreRootViewController.cartButton.hide()
}
func zx_refresh() {
}
func zx_loadmore() {
}
}
class ZXStoreParams: NSObject {
// static var storeId = "" {
// set {
//
// }
// get {
// return "2000002"
// }
// }
static var storeId: String {
set {
}
get {
return "2000002"
}
}
static var memberId = ""
// static var token = ""
static var token: String {
set {
}
get {
return "2cc786b91aeee087d54ad588e80dbc40"
}
}
static var storeInfo: ZXStoreDetailModel?
// static func clear() {
// self.storeId = ""
// self.memberId = ""
// self.token = ""
// self.storeInfo = nil
// }
}
// 店铺首页
class ZXStoreRootViewController: ZXSTUIViewController,ZXCartButtonDelegate {
fileprivate static var zxCartButton: ZXCartButton?
static var cartButton: ZXCartButton {
get {
if self.zxCartButton == nil {
zxCartButton = ZXCartButton()
}
return self.zxCartButton!
}
}
static func configVC(with storeId: String, memberId:String, token:String) -> ZXStoreRootViewController {
ZXStoreParams.storeInfo = nil
ZXStoreParams.storeId = storeId
ZXStoreParams.memberId = memberId
ZXStoreParams.token = token
return ZXStoreRootViewController()
}
var headerView: ZXStoreHeaderView!
var storeModel: ZXStoreModel?
var activeList: Array<ZXStoreActive> = []
var recommendList: Array<ZXDrugModel> = []
@IBOutlet weak var tblHomeList: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.fd_prefersNavigationBarHidden = false
self.view.backgroundColor = UIColor.zx_assist()
// Do any additional setup after loading the view.
self.tblHomeList.backgroundColor = UIColor.zx_assist()
self.tblHomeList.register(UINib.init(nibName: ZXStoreDrugCell.NibName, bundle: nil), forCellReuseIdentifier: ZXStoreDrugCell.reuseIdentifier)
self.tblHomeList.register(UINib.init(nibName: ZXActive1Cell.NibName, bundle: nil), forCellReuseIdentifier: ZXActive1Cell.reuseIdentifier)
self.tblHomeList.register(UINib.init(nibName: ZXActive2Cell.NibName, bundle: nil), forCellReuseIdentifier: ZXActive2Cell.reuseIdentifier)
self.tblHomeList.register(UINib.init(nibName: ZXActive3.NibName, bundle: nil), forCellReuseIdentifier: ZXActive3.reuseIdentifier)
self.tblHomeList.register(ZXSingleTextHeaderView.classForCoder(), forHeaderFooterViewReuseIdentifier: ZXSingleTextHeaderView.reuseIdentifier)
self.tblHomeList.zx_addHeaderRefreshActionUseZXImage(true, target: self, action: #selector(zx_refresh))
headerView = ZXStoreHeaderView.init(origin: CGPoint.zero)
self.tblHomeList.tableHeaderView = headerView
headerView.categoryView.delegate = self
headerView.searchButton.addTarget(self, action: #selector(searchAction), for: .touchUpInside)
ZXStoreRootViewController.cartButton.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(shoppingCartUpdated), name: NSNotification.Name.init("CartUpdateNotice"), object: nil)
}
func shoppingCartUpdated() {
ZXStoreRootViewController.cartButton.setCartNum(num: ZXCart.cart.totalCount)
}
func zxCartButtonTapped() {
let shoppingCart = ZXShoppingCartViewController()
self.navigationController?.pushViewController(shoppingCart, animated: true)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if !onceLoad {
onceLoad = true
self.loadStoreHomePage(showHUD: true)
self.loadRecommendList()
}
self.tblHomeList.reloadData()//购买数量修改
}
// override func viewWillDisappear(_ animated: Bool) {
// super.viewWillDisappear(animated)
// ZXStoreRootViewController.cartButton.hide()
// ZXStoreRootViewController.zxCartButton?.resignKey()
// }
//MARK: - ZXRefresh
override func zx_refresh() {
self.loadStoreHomePage(showHUD: false)
self.loadRecommendList()
}
//MARK: - Search Action
@objc func searchAction() {
let searchVC = ZXDrugSearchViewController()
self.navigationController?.pushViewController(searchVC, animated: true)
}
///MARK: - 店铺首页
fileprivate func loadStoreHomePage(showHUD: Bool) {
if showHUD {
ZXHUD.mbShowLoading(in: self.view, text: ZX_LOADING_TEXT, delay: 0)
}
ZXStoreHomeViewModel.getHomePage(storeId: ZXStoreParams.storeId, memberId: ZXStoreParams.memberId, token: ZXStoreParams.token) { (s, c, error, model) in
ZXHUD.mbHide(for: self.view, animate: true)
ZXEmptyView.dismiss(in: self.view)
self.tblHomeList.mj_header.endRefreshing()
if s {
if let model = model {
self.storeModel = model
self.reloadUI()
} else {
ZXEmptyView.showNoData(in: self.view, text1: "无相关数据", text2: "", heightFix: 0)
}
} else {
ZXHUD.mbShowFailure(in: self.view, text: error, delay: ZX.DELAY_INTERVAL)
}
}
//加载店铺信息
ZXDrugStoreViewModel.storeDetail(storeId: ZXStoreParams.storeId, memberId: ZXStoreParams.memberId, token: ZXStoreParams.token) { (s, c, error, model) in
if s {
ZXStoreParams.storeInfo = model
}
}
}
//MARK: - 推荐商品
fileprivate func loadRecommendList () {
ZXStoreHomeViewModel.recommendList(storeId: ZXStoreParams.storeId, memberId: ZXStoreParams.memberId, token: ZXStoreParams.token) { (s, c, errorMsg, list) in
if s {
self.recommendList = list
self.tblHomeList.reloadData()
}//失败不作处理
}
}
fileprivate func reloadUI () {
if let model = self.storeModel {
self.title = model.drugstoreName
self.headerView.categoryView.reloadData(model)
self.activeList = model.zx_ActiveList
}
self.tblHomeList.reloadData()
}
}
// MARK: - 分类点击
extension ZXStoreRootViewController: ZXStoreCategoryViewDelegate {
func zxStoreCategoryView(_ view: ZXStoreCategoryView, selectAt index: Int) {
if let model = self.storeModel {
if let sorts = model.zx_sorts {
if sorts.count == index {//全部
let allCategory = ZXDrugCategoryViewController()
self.navigationController?.pushViewController(allCategory, animated: true)
} else {
let categoryList = ZXDrugListViewController()
categoryList.category = sorts[index]
self.navigationController?.pushViewController(categoryList, animated: true)
}
} else {//全部
let allCategory = ZXDrugCategoryViewController()
self.navigationController?.pushViewController(allCategory, animated: true)
}
}
}
}
extension ZXStoreRootViewController: UITableViewDelegate {
// MARK: - 商品点击
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 1,self.recommendList.count > 0 {
let model = self.recommendList[indexPath.row]
let detail = ZXDrugDetailInfoViewController()
detail.goodsShortModel = model
self.navigationController?.pushViewController(detail, animated: true)
}
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == 1,self.recommendList.count > 0 {
return 40
}
return CGFloat.leastNormalMagnitude
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 10
}
}
extension ZXStoreRootViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
switch self.activeList.count {
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: ZXActive1Cell.reuseIdentifier, for: indexPath) as! ZXActive1Cell
cell.reloadData(model: self.storeModel)
cell.delegate = self
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: ZXActive2Cell.reuseIdentifier, for: indexPath) as! ZXActive2Cell
cell.reloadData(model: self.storeModel)
cell.delegate = self
return cell
case 3:
let cell = tableView.dequeueReusableCell(withIdentifier: ZXActive3.reuseIdentifier, for: indexPath) as! ZXActive3
cell.reloadData(model: self.storeModel)
cell.delegate = self
return cell
default:
break
}
} else if indexPath.section == 1{
let cell = tableView.dequeueReusableCell(withIdentifier: ZXStoreDrugCell.reuseIdentifier, for: indexPath) as! ZXStoreDrugCell
cell.delegate = self
let model = self.recommendList[indexPath.row]
cell.reloadData(model)
cell.reloadDataForNotReuse(ZXCart.cart.modelFor(storeId: "\(model.drugstoreId)", drugId: "\(model.baseDrugId)"))
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: ZXActive1Cell.reuseIdentifier, for: indexPath) as! ZXActive1Cell
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0:
if activeList.count > 0 {
return 1
}
case 1:
return recommendList.count
default:
break
}
return 0
}
func numberOfSections(in tableView: UITableView) -> Int {
return 2
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 1,self.recommendList.count > 0 {
let view = tableView.dequeueReusableHeaderFooterView(withIdentifier: ZXSingleTextHeaderView.reuseIdentifier) as! ZXSingleTextHeaderView
view.setText("猜您需药", image: #imageLiteral(resourceName: "hot-drug"))
return view
}
return nil
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
return 180
}
return 125
}
}
extension ZXStoreRootViewController: ZXStoreDrugCellDelegate, ZXStoreActiveCellDelegate {
//MARK: - 活动点击 -> 活动商品列表
func zxStoreActiveCell(_ cell: UITableViewCell, selectedAt index: Int, model: ZXStoreActive) {
let activeGoodsList = ZXActiveGoodsListViewController()
activeGoodsList.active = model
self.navigationController?.pushViewController(activeGoodsList, animated: true)
}
//MARK: - 单个活动下的商品->商品详情
func zxStoreActiveCell(_ cell: UITableViewCell, goodsSelectAt model: ZXDrugModel) {
//let model = self.drugList[indexPath.row]
let detail = ZXDrugDetailInfoViewController()
detail.goodsShortModel = model
self.navigationController?.pushViewController(detail, animated: true)
}
func zxStoreDrugCell(_ cell: UITableViewCell, controlType type: ZXGrugNumControlType) {
if let indexPath = self.tblHomeList.indexPath(for: cell) {
let model = self.recommendList[indexPath.row]
let sid = "\(model.baseDrugId)"
if type == .plus {
ZXCart.cart.plus(storeId: "\(model.drugstoreId)", drugId: sid)
} else {
ZXCart.cart.sub(storeId: "\(model.drugstoreId)", drugId: sid)
}
}
}
}
| [
-1
] |
f6dfacb948cb1075eec65b756c89707de65fb692 | e06cc3c0ad24a31defbe37fd0d2968196acba65c | /37-VenueMenu/Venue+CoreDataProperties.swift | 8d45d48505704b8930f7b717dee0f091cef7ab74 | [
"CC0-1.0"
] | permissive | stomp1128/TIY-Assignments | 388bb20a33872767f1a823b1660b566b3f3a5b10 | 4e5b66918b3dd64368d2f79b21662220beef6f11 | refs/heads/master | 2021-01-10T03:26:58.306351 | 2016-02-26T00:55:25 | 2016-02-26T00:55:25 | 43,462,189 | 0 | 0 | null | 2016-01-08T22:57:20 | 2015-09-30T22:08:34 | Objective-C | UTF-8 | Swift | false | false | 587 | swift | //
// Venue+CoreDataProperties.swift
// 37-VenueMenu
//
// Created by Chris Stomp on 12/7/15.
// Copyright © 2015 The Iron Yard. All rights reserved.
//
// Choose "Create NSManagedObject Subclass…" from the Core Data editor menu
// to delete and recreate this implementation file for your updated model.
//
import Foundation
import CoreData
extension Venue {
@NSManaged var address: String?
@NSManaged var name: String?
@NSManaged var rating: NSNumber?
@NSManaged var userLike: NSNumber?
@NSManaged var lat: NSNumber?
@NSManaged var lng: NSNumber?
}
| [
280135,
280136,
279721,
284649,
279865
] |
895ca3531253738f76ead1b28c49e1a376c6674f | 6be36b0e895ef548c9f366601c3b1a98f93ed1c9 | /UDS/Helpers/RegExHelper.swift | cb3410ccf431838740cbce91c2151c78e08d04c3 | [] | no_license | rooguima/UDS | 90378d8581a55f34b6b0ce70b71f35844ec7a662 | ad83b34890cf9aae759320da1412dec50c4db3cb | refs/heads/master | 2022-06-25T16:45:14.546790 | 2020-04-11T17:04:22 | 2020-04-11T17:04:22 | 263,196,998 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 450 | swift | //
// ValidEmailHelper.swift
// UDS
//
// Created by Rodrigo Guimarães on 10/04/20.
// Copyright © 2020 Rodrigo Guimarães. All rights reserved.
//
import Foundation
class RegExHelper {
func isValidEmail(_ email: String) -> Bool {
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
let emailPred = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
return emailPred.evaluate(with: email)
}
}
| [
-1
] |
2cc4f3f7b8c3f06d3c4f09ffe337bf39a0e31852 | 0145137bac10c2a22f1d0202395b040e388862c8 | /swift/tsurime.swift | b6eb284fd6dc39c03a6041343fc8d2e6aad939de | [] | no_license | saitomarch/POH7 | 6dece12b7d219ddf1d51ab41ba01f87b42891a64 | 9f5186dc8c63497e51b6a1df96ff073360acf414 | refs/heads/master | 2021-01-10T03:56:32.419577 | 2016-04-02T22:30:11 | 2016-04-02T22:30:11 | 47,622,534 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 129 | swift | let times = Int(readLine()!)
let ann = "Ann"
var str = "";
for (var cnt = 0; cnt < times; cnt++) {
str += ann;
}
print(str)
| [
-1
] |
63cb50d0328043bee7c9a0f98130b4a4f14247b1 | 4a850d4831ae3b25f29feacbd1d78d93c39d089b | /MathAndLogic.playground/Contents.swift | 9628c9e6d95b430a5d78b9a2362c60ff7da394f7 | [] | no_license | crystaljade1/MathAndLogic | 1e5ddb9490c80447d1e08f1649487d3e40ffb5cb | 43ec24218bc79da03d069e8347dd45b8d8e78a69 | refs/heads/master | 2021-01-19T11:53:22.936552 | 2017-04-16T06:21:25 | 2017-04-16T06:21:25 | 88,002,213 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,081 | swift | // Write a function named "strtupzer" which removes the 'odd' vowels from a word.
// The function should remove the first vowel it encounters, leave the second, remove the third, etc.
let vowels = ["a", "e", "i", "o", "u"]
let consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"]
var letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
// Create a function which accepts a string and returns all of the characters of the string in an [Character].
var array: [Character] = []
var string: String
func returnCharactersFromString(input: String) -> [Character] {
let array = Array(input.characters)
return array
}
print(returnCharactersFromString(input: "University"))
print(returnCharactersFromString(input: "Cupcake"))
print(returnCharactersFromString(input: "Bookkeeper"))
print(returnCharactersFromString(input: "Iron Yard"))
// Create a function which accepts a string and returns an array of the characters in the provided word excluding all vowels.
func returnCharactersFromStringExcludingVowels(input: String) -> [Character] {
let vowels: [Character] = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
let result = [Character](input.characters.filter {
!vowels.contains($0) }
)
return result
}
returnCharactersFromStringExcludingVowels(input: "University")
print(returnCharactersFromStringExcludingVowels(input: "Cupcake"))
print(returnCharactersFromStringExcludingVowels(input: "Bookkeeper"))
print(returnCharactersFromStringExcludingVowels(input: "Iron Yard"))
// Create a function which accepts a string and returns an array of the characters in the provided word excluding every other vowel.
func strtupzer(input: String) -> [Character]? {
let vowels: [Character] = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
var vowelCount = 0
var newArray = [Character]()
for char in input.characters {
if !vowels.contains(char) {
newArray.append(char)
}
if vowels.contains(char) {
vowelCount += 1
if vowelCount % 2 == 1 {
newArray.append(char)
}
}
}
return newArray
}
strtupzer(input: "bookkeeper")
strtupzer(input: "cupcake")
strtupzer(input: "Iron Yard")
// Create a function which accepts a string and returns a string containing the provided word excluding every other vowel.
func returnStringFromStringExcludingVowels(input: String) -> (String) {
let vowels: [Character] = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]
let result = (String)(input.characters.filter {
!vowels.contains($0) }
)
return result
}
returnStringFromStringExcludingVowels(input: "University")
print(returnStringFromStringExcludingVowels(input: "Cupcake"))
print(returnStringFromStringExcludingVowels(input: "Bookkeeper"))
print(returnStringFromStringExcludingVowels(input: "Iron Yard"))
| [
-1
] |
15215d4d8113d0bcc16f1c701b0fa75a0f6bc5bd | 879b88e3f1471f16df708e15834e2a40625f392a | /iOS Security.playground/Pages/Certificate Pinning.xcplaygroundpage/Contents.swift | 05c456c596b8c271aee61d0bebcfbb43ef77e2b9 | [] | no_license | szarleydwarf/bunchOfPlaygrounds | e5fdced867bb5ff563ceba41e2e647394e66466a | 3dd64ed462bc594dabb335e7b5e0fffdb81fb1d9 | refs/heads/master | 2023-03-22T20:42:28.130400 | 2021-03-24T17:43:34 | 2021-03-24T17:43:34 | 350,804,802 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,901 | swift | /*:
[Previous](@previous)
## Certificate Pinning
### At A Glace
SSL (Secure Socket Layer) ensures encrypted client-server communication over HTTP - specified by HTTPS (HTTP over SSL). The encryption is based on PKI (Public Key Infrastructure) and a session key. The session key was introduced because encrypting and decrypting a public/private key uses a lot of processing power and it would slow down the whole communication process.
The security aspect of SSL is based on the certificate's "chain of trust". When the communication starts, the client examines the server's SSL certificate and checks if the received certificate is trusted by the Trusted Root CA store or other user-trusted certificates.
Although SSL communication is considered pretty much secure and unbreakable in realistic time frames, the man-in-the-middle attack still poses an actual threat. It can be carried out using several methods, which include [ARP cache poisoning](https://www.thegeekstuff.com/2012/01/arp-cache-poisoning/) and [DNS spoofing](https://www.menandmice.com).
### SSL Pinning
We use SSL pinning to ensure that the app communicates only with the designated server itself.
One of the prerequisites for SSL pinning is saving the target's server SSL certificate within the app bundle.
The saved certificate is used when defining the pinned certificate(s) upon session configuration.
Things are a bit more tricky when it comes to NSURLSession SSL pinning. There is no way to set an array of pinned certificates and cancel all responses that don't match our local certificate automatically. We need to perform all checks manually to implement SSL pinning on NSURLSession. We'll happily use some of the Security's framework C API (like all other true hackers do).
We can start by instantiating an `URLSession` object with the default session configuration.
```
let session = URLSession(configuration: .default)
```
URLSession sends requests using tasks (URLSessionTask). We will use the `session.dataTask(with:, completionHandler:)` method for the SSL pinning test. The request we send will look something like this:
```
let session = URLSession(configuration: .default, delegate: self, delegateQueue: nil)
let url = URL(string: textField.text!)!
let task = session.dataTask(with: url) { (data, response, error) in
// response management code
}
task.resume()
```
The magic of SSL pinning is implemented within the `urlSession(_ session:didReceive challenge:completionHandler:)` method. Note that, upon the creation of the `URLSession` object, we assigned self as the delegate so that this method is called on our object.
```
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
if let serverTrust = challenge.protectionSpace.serverTrust {
var secresult = SecTrustResultType.invalid
let status = SecTrustEvaluate(serverTrust, &secresult)
if(errSecSuccess == status) {
print(SecTrustGetCertificateCount(serverTrust))
if let serverCertificate = SecTrustGetCertificateAtIndex(serverTrust, 0) {
// Certificate pinning, uncomment to use this instead of public key pinning
// let serverCertificateData:NSData = SecCertificateCopyData(serverCertificate)
// let certHash = sha256(data: serverCertificateData as Data)
// if (certHash == pinnedCertificateHash) {
// // Success! This is our server
// completionHandler(.useCredential, URLCredential(trust:serverTrust))
// return
// }
// Public key pinning
// let serverPublicKey = SecCertificateCopyPublicKey(serverCertificate)
// let serverPublicKeyData:NSData = SecKeyCopyExternalRepresentation(serverPublicKey!, nil )!
// let keyHash = sha256(data: serverPublicKeyData as Data)
// if (keyHash == pinnedPublicKeyHash) {
// // Success! This is our server
// completionHandler(.useCredential, URLCredential(trust:serverTrust))
// return
// }
}
}
}
}
// Pinning failed
completionHandler(.cancelAuthenticationChallenge, nil)
}
```
- NOTE: This code assumes that we already have a hash of the public key or certificate, which can created using FireFox or using the [methods outlined here](https://dzone.com/articles/ssl-certificate-pinning-in-ios-applications)
*/
| [
18165
] |
08a4ed6ae17f2f4cb650d00cd3c9c11781bfa3c4 | c9a706de4ff3ea84b9894136d58c8d55b789167e | /Groupa/ViewController.swift | 8f456b3c94894d5bd12a5ca44039310d4ffe3d34 | [] | no_license | iOSMentorship/ollaollu-groupa | 4fedb98aa81ccb5cf471777d8c1fb2ce7bfa78ef | 91cb1dee62b050918bc046c68c0a542c092da041 | refs/heads/master | 2021-01-19T01:16:32.133335 | 2017-04-04T21:21:56 | 2017-04-04T21:21:56 | 87,236,566 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,265 | swift | //
// ViewController.swift
// Groupa
//
// Created by ollaollu on 23/03/2017.
// Copyright © 2017 ollaollu. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var usernameField: UITextField!
var usernames = [String]()
@IBOutlet weak var groupNumberField: UITextField!
var groups = [[String]]()
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return usernames.count;
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "displayCell", for:indexPath) as! displayCell
cell.displayLabel.text = usernames[indexPath.item]
return cell;
}
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
usernames.remove(at: indexPath.row)
reloadTable()
}
}
func reloadTable() {
tableView.reloadData();
}
@IBAction func addUsername(_ sender: Any) {
usernames.append(usernameField.text!)
usernameField.text = "";
reloadTable()
}
@IBAction func generateGroups(_ sender: Any) {
let grouping = Int(groupNumberField.text!)
while usernames.isEmpty == false {
let grouped = usernames.prefix(grouping!)
groups.append(Array(grouped))
usernames = usernames.filter{ !grouped.contains($0) }
}
//print groupings to console
usernames = []
groupNumberField.text = ""
reloadTable()
print(groups)
}
}
| [
-1
] |
54b40d560bba77e622e04fac5d28daebada9ef50 | 23b822e813adf4f273b0555d010410666e7833ac | /SocketChat/SocketChat/View/ChatCell.swift | 705f4ec3a72a4697664b1cfd39870fe9b8626c97 | [] | no_license | huangmubin/SocketChat | 1fc0f343bbbbdd9a1c6b81df849f942e87b5a479 | 6bef191862f387abc6696e928a3350af18ed42d4 | refs/heads/master | 2021-01-19T23:49:28.991319 | 2017-06-21T13:59:18 | 2017-06-21T13:59:18 | 89,035,550 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 497 | swift | //
// ChatCell.swift
// SocketChat
//
// Created by Myron on 2017/4/22.
// Copyright © 2017年 myron. All rights reserved.
//
import UIKit
class ChatCell: UITableViewCell {
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var timesLabel: UILabel!
@IBOutlet weak var sizeLabel: UILabel!
func update(_ value: EventModel) {
}
}
class ChatCell0: ChatCell {
}
class ChatCell1: ChatCell {
}
class ChatCell2: ChatCell {
}
| [
-1
] |
fb7a462620a810da71739943fb881b490ac4684c | 2ebebd98506be3c1bc9bf8a215401d894621f351 | /TinyanLibSwift/classes/nnn/CCommonGeneral.swift | ceefd92ebd8278d5ac67d7eafa151d0560d49263 | [] | no_license | tinyan/TinyanLibSwift | b68114a0d93ca1a8009bb08edf3fb29c7a2d2a52 | 4189fed2cc0668493e58e3d55bcfb3a482863248 | refs/heads/master | 2016-09-06T13:26:04.415251 | 2015-04-09T06:59:33 | 2015-04-09T06:59:33 | 21,519,866 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,994 | swift | //
// CCommonGeneral.swift
// colors
//
// Created by Tinyan on 2014/08/11.
// Copyright (c) 2014 bugnekosoft. All rights reserved.
//
import Foundation
import SpriteKit
let COMMON_BUTTON_LAYER_Z : CGFloat = 50.0
public class CCommonGeneral : SKScene
{
override public func didMoveToView(view: SKView)
{
}
convenience required public init(coder aDecoder: NSCoder)
{
self.init(coder:aDecoder)
}
public var m_game : CCommonGame
public var m_modeNumber:Int
public var m_commonMenu : CCommonMenu!
public var m_commonCommand = -1
public var m_commonLastCount = 0
public var m_bgColorRed : CGFloat = 0.1
public var m_bgColorGreen : CGFloat = 0.1
public var m_bgColorBlue : CGFloat = 0.9
public var m_bgColorAlpha : CGFloat = 1.0
public var m_debugMessagePrintFlag = true
public init(modeNumber:Int , game : CCommonGame, size:CGSize)
{
m_game = game
m_modeNumber = modeNumber
super.init(size: size)
self.backgroundColor = UIColor(red: 0.5, green: 0.8, blue: 0.3, alpha: 1.0)
scaleMode = .AspectFit
}
public func ExitMode()
{
}
public func EnterMode()
{
m_commonCommand = -1
}
public func ReturnFromGamecenter()
{
}
// override public func touchesBegan(touches: NSSet, withEvent event: UIEvent)
override public func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent)
{
if m_game.checkActive()
{
if m_modeNumber == m_game.m_mode
{
onTouchesBegan(touches, withEvent: event)
}
}
}
// override public func touchesMoved(touches: NSSet, withEvent event: UIEvent)
override public func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent)
{
if m_game.checkActive()
{
if m_modeNumber == m_game.m_mode
{
onTouchesMoved(touches, withEvent: event)
}
}
}
// override public func touchesEnded(touches: NSSet, withEvent event: UIEvent)
override public func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent)
{
if m_game.checkActive()
{
if m_modeNumber == m_game.m_mode
{
onTouchesEnded(touches, withEvent: event)
}
}
}
//dummy routine
public func onTouchesBegan(touches: NSSet, withEvent event: UIEvent)
{
}
public func onTouchesMoved(touches: NSSet, withEvent event: UIEvent)
{
}
public func onTouchesEnded(touches: NSSet, withEvent event: UIEvent)
{
}
override public func update(currentTime: CFTimeInterval)
{
if m_game.checkActive()
{
m_game.onUpdate(currentTime)
if m_modeNumber == m_game.m_mode
{
onUpdate(currentTime)
}
}
}
//dummy
public func onUpdate(currentTime: CFTimeInterval)
{
}
public func onCommonClick(number:Int)
{
}
public func calcuCommonButtonResult() -> Int?
{
if m_commonCommand != -1
{
if m_commonLastCount > 0
{
m_commonLastCount--
if m_commonLastCount == 0
{
return m_commonCommand
}
}
}
return nil
}
public func captureImage(imageSize:CGSize,aspectFit:Bool = true) -> UIImage
{
var rect = self.frame
UIGraphicsBeginImageContextWithOptions(rect.size,false,UIScreen.mainScreen().scale)
if let view = self.view
{
view.drawViewHierarchyInRect(rect, afterScreenUpdates: true)
}
var image : UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
var w = imageSize.width
var h = imageSize.height
var x : CGFloat = 0.0
var y : CGFloat = 0.0
if aspectFit
{
var imageAspect = w / h
var aspect = rect.size.width / rect.size.height
if imageAspect >= aspect
{
h = w * aspect
}
else
{
w = h / aspect
}
x = ( imageSize.width - w ) * 0.5
y = ( imageSize.height - h ) * 0.5
}
// var w : CGFloat = 900.0 / 2.0
// var h : CGFloat = rect.size.height * (w / rect.size.width)
UIGraphicsBeginImageContext(CGSize(width: imageSize.width, height: imageSize.height))
image.drawInRect(CGRect(x: x, y: y, width: w, height: h))
var image2 = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image2
}
public func getCommonParam(json:CCommonJsonObject)
{
if var red : Int = json.getObject(keyList: "view","red")
{
m_bgColorRed = CGFloat(red) / 255.0
}
if var green : Int = json.getObject(keyList: "view","green")
{
m_bgColorGreen = CGFloat(green) / 255.0
}
if var blue : Int = json.getObject(keyList: "view","blue")
{
m_bgColorBlue = CGFloat(blue) / 255.0
}
if var alpha : Int = json.getObject(keyList: "view","alpha")
{
m_bgColorAlpha = CGFloat(alpha) / 255.0
}
//fit?etc
if var debugFlag : Bool = json.getObject(keyList: "debug","messageFlag")
{
m_debugMessagePrintFlag = debugFlag
}
}
public func getInitArray<T>(json:CCommonJsonObject,inout name:[T],keyList:String...) -> Bool
{
if var data : [T] = json.getArrayObject(keyList)
{
name = data
return true
}
return false
}
public func getInitParam<T>(json:CCommonJsonObject,inout name:T,keyList:String...) -> Bool
{
if var data : T = json.getObject(keyList)
{
name = data
return true
}
return false
}
/*
public func getInitCGPoint(json:CCommonJsonObject,inout name:CGPoint,keyList:String...) -> Bool
{
if var pt : CGPoint = json.getObject(keyList)
{
name = pt
return true
}
return false
}
public func getInitCGSize(json:CCommonJsonObject,inout name:CGSize,keyList:String...) -> Bool
{
if var pt : CGSize = json.getCGSizeObject(keyList)
{
name = pt
return true
}
return false
}
public func getInitCGVector(json:CCommonJsonObject,inout name:CGVector,keyList:String...) -> Bool
{
if var pt : CGVector = json.getCGVectorObject(keyList)
{
name = pt
return true
}
return false
}
*/
public func setBGColor()
{
self.backgroundColor = UIColor(red: m_bgColorRed, green: m_bgColorGreen, blue: m_bgColorBlue, alpha: m_bgColorAlpha)
}
public func printDebugMessage(mes:String)
{
if m_debugMessagePrintFlag
{
println(mes)
}
}
} | [
-1
] |
0035bf2a1e8d61594babbd7578eb86e7f2d34284 | 0111a8acf07c3c819d219f7046189d3151780c74 | /xianzhan/foundation/net/CRLURLLoader.swift | 6c77fd3144fb2fcc54070fb77a95c4d62ef8236c | [
"MIT"
] | permissive | crl/huoshu | 2aaf288f2174d8180666e3f5596f7d212da5901d | b69d9a04f6caf064567e0fa1f750fb17b80dc2f6 | refs/heads/master | 2020-04-08T03:57:46.657487 | 2019-04-12T08:16:17 | 2019-04-12T08:16:17 | 158,996,593 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,933 | swift | //
// URLLoader.swift
// xianzhan
//
// Created by crl on 2018/11/7.
// Copyright © 2018 lingyu. All rights reserved.
//
import UIKit
class CRLURLLoader: CRLEventDispatcher,URLSessionDelegate {
let url:String!;
var request:URLRequest!;
var data:Data?;
init(_ url:String) {
self.url=url;
}
func defaultEvent(_ handle: Selector, _ selfObj: AnyObject?,isBind:Bool=true){
if isBind{
self.on(CRLEvent.COMPLETE, handle,selfObj);
self.on(CRLEvent.ERROR, handle,selfObj);
}else{
self.off(CRLEvent.COMPLETE, handle,selfObj);
self.off(CRLEvent.ERROR, handle,selfObj);
}
}
func post(_ value:String) {
let data=value.data(using: .ascii, allowLossyConversion: true);
let postLength=String(format:"%lu",(data?.count)!);
request=URLRequest(url:URL(string: url)!);
request.httpMethod="POST";
request.setValue(postLength, forHTTPHeaderField: "Content-Length");
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type");
request.httpBody=data;
start(request);
}
func load() {
request=URLRequest(url:URL(string: url)!);
start(request);
}
var session:URLSession!;
private func start(_ request:URLRequest){
//let session=URLSession.shared;
if session == nil{
let configer = URLSessionConfiguration.default;
session = Foundation.URLSession(configuration: configer, delegate: self, delegateQueue: OperationQueue.main);
}
let task=session.dataTask(with: request) { (data, response, error) in
if(error != nil){
self.data=Data(base64Encoded: error.debugDescription);
self.simpleDispatch(CRLEvent.ERROR, error.debugDescription);
return;
}
self.data=data;
self.simpleDispatch(CRLEvent.COMPLETE, self.data);
}
self.simpleDispatch(CRLEvent.START);
task.resume();
}
func getDataString()->String {
if(data == nil){
return "";
}
return String(data: data!, encoding: .utf8)!;
}
//URLSessionDelegate
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void){
guard let serverTrust = challenge.protectionSpace.serverTrust else {
return completionHandler(.useCredential, nil);
}
let exceptions = SecTrustCopyExceptions(serverTrust);
SecTrustSetExceptions(serverTrust, exceptions);
completionHandler(.useCredential, URLCredential(trust: serverTrust));
}
}
| [
-1
] |
61d486f4f0ecd960567dd061427bdee8c7e59283 | ed4b50ee6de4dde87b243036db5f65261973a360 | /BaseProject/BaseProject/Model/UserWall/PostLike.swift | 29c0f8da2bf2660625736d049f4743f98218f133 | [
"Apache-2.0"
] | permissive | HEALINGBUDZ/healingbudzios | 449d0459c60cfb2f0e1442278bdb55c053b47701 | 7167240dbd7e042a887795c84167fd66500f622e | refs/heads/master | 2020-04-05T19:59:14.478691 | 2019-02-01T07:50:58 | 2019-02-01T07:50:58 | 157,159,890 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,968 | swift | //
// PostLike.swift
// BaseProject
//
// Copyright © 2018 Wave. All rights reserved.
//
import UIKit
import ObjectMapper
class PostLike: NSObject, NSCoding, Mappable {
var id:NSNumber?
var user_id:NSNumber?
var post_id:NSNumber?
var is_like:NSNumber?
var created_at:String?
var updated_at:String?
var reason:String?
var user: PostUser?
required init?(map: Map){
}
override init() {
}
func encode(with aCoder: NSCoder) {
aCoder.encode(id, forKey: "id")
aCoder.encode(post_id, forKey: "post_id")
aCoder.encode(user_id, forKey: "user_id")
aCoder.encode(is_like, forKey: "is_like")
aCoder.encode(reason, forKey: "reason")
aCoder.encode(created_at, forKey: "created_at")
aCoder.encode(updated_at, forKey: "updated_at")
aCoder.encode(user, forKey: "user")
}
required convenience init?(coder aDecoder: NSCoder) {
self.init()
self.id = aDecoder.decodeObject(forKey:"id") as? NSNumber ?? 0
self.post_id = aDecoder.decodeObject(forKey:"post_id") as? NSNumber ?? 0
self.user_id = aDecoder.decodeObject(forKey:"user_id") as? NSNumber ?? 0
self.is_like = aDecoder.decodeObject(forKey:"is_like") as? NSNumber ?? 0
self.reason = aDecoder.decodeObject(forKey:"reason") as? String ?? ""
self.created_at = aDecoder.decodeObject(forKey:"created_at") as? String ?? ""
self.updated_at = aDecoder.decodeObject(forKey:"updated_at") as? String ?? ""
self.user = aDecoder.decodeObject(forKey:"user") as? PostUser ?? PostUser()
}
func mapping(map: Map){
id <- map["id"]
user_id <- map["user_id"]
post_id <- map["post_id"]
is_like <- map["is_like"]
created_at <- map["created_at"]
updated_at <- map["updated_at"]
reason <- map["reason"]
user <- map["user"]
}
}
| [
-1
] |
a5c7144fff3e15476875689b5e22c155cbca053f | 990b7e545935b0733ef755e7030adbc412180f46 | /EvoRadio/Models/Channel.swift | 28b241c8d901d6b695baed580d295b786fe6ad15 | [] | no_license | NazgulLee/EvoRadio | 64d8fa46f392ee6ca46cb41ff0dba9f4497233b8 | 9a775e764d666b4c22c65658b42ee73e00d9d85c | refs/heads/master | 2021-01-12T15:59:52.867929 | 2016-09-28T15:55:34 | 2016-09-28T15:55:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,143 | swift | //
// Channel.swift
// EvoRadio
//
// Created by Jarvis on 16/4/18.
// Copyright © 2016年 JQTech. All rights reserved.
//
import Foundation
import EVReflection
class Channel: EVObject {
var channelID: String?
var channelName: String?
var channelNameShengmu: String?
var radioID: String?
var radioName: String?
var programNum: String?
var programFine: String?
var pubTime: String?
var sortOrder: String?
var picURL: String?
var status: String?
var recommend: String?
override func propertyMapping() -> [(String?, String?)] {
return [
("channelID", "channel_id"),
("channelName", "channel_name"),
("channelNameShengmu", "channel_name_shengmu"),
("radioID", "radio_id"),
("radioName", "radio_name"),
("programNum", "program_num"),
("programFine", "program_fine"),
("pubTime", "pub_time"),
("sortOrder", "sort_order"),
("picURL", "pic_url")
]
}
class func channelWithDict(dict: [String : AnyObject]) -> Channel {
let channel = Channel()
channel.channelID = dict["channel_id"] as? String
channel.channelName = dict["channel_name"] as? String
channel.channelNameShengmu = dict["channel_name_shengmu"] as? String
channel.radioID = dict["radio_id"] as? String
channel.radioName = dict["radio_name"] as? String
channel.programFine = dict["program_fine"] as? String
channel.programNum = dict["program_num"] as? String
channel.pubTime = dict["pub_time"] as? String
channel.sortOrder = dict["sort_order"] as? String
channel.picURL = dict["pic_url"] as? String
channel.status = dict["status"] as? String
channel.recommend = dict["recommend"] as? String
return channel
}
class func channelsWithDict(dicts: [[String : AnyObject]]) -> [Channel] {
var channels = [Channel]()
for dict in dicts {
channels.append(Channel.channelWithDict(dict))
}
return channels
}
}
| [
-1
] |
cada70050bade4998742f9c4b6ea925ec054f3b0 | 40946653c2028e5174c394d52ceba69b705166c1 | /TwitterClone/TwitterClone/Tweet.swift | 899d20e62136ee3f117f06ede977681aa2cb0bbd | [] | no_license | pakalewis/Parker-Lewis-CF | 577a02190ff72dc3c910d46a6eb3392c14c46f1d | 47dfc26980f9e942432690d58170c22cdef4c9e2 | refs/heads/master | 2021-06-03T02:25:25.954881 | 2018-11-20T19:54:24 | 2018-11-20T19:54:24 | 22,734,499 | 0 | 0 | null | 2014-08-27T16:07:20 | 2014-08-07T19:51:40 | Swift | UTF-8 | Swift | false | false | 1,114 | swift | //
// Tweet.swift
// TwitterClone
//
// Created by Bradley Johnson on 10/6/14.
// Copyright (c) 2014 Code Fellows. All rights reserved.
//
import UIKit
class Tweet {
var text : String
var avatarURL : String
var avatarImage : UIImage?
init ( tweetInfo : NSDictionary) {
self.text = tweetInfo["text"] as String
let userInfo = tweetInfo["user"] as NSDictionary
self.avatarURL = userInfo["profile_image_url"] as String
}
class func parseJSONDataIntoTweets(rawJSONData : NSData ) -> [Tweet]? {
var error : NSError?
if let JSONArray = NSJSONSerialization.JSONObjectWithData(rawJSONData, options: nil, error: &error) as? NSArray {
var tweets = [Tweet]()
for JSONDictionary in JSONArray {
if let tweetDictionary = JSONDictionary as? NSDictionary {
var newTweet = Tweet(tweetInfo: tweetDictionary)
tweets.append(newTweet)
}
}
return tweets
}
return nil
}
}
| [
-1
] |
10a183509833feda28d54ddbbcc160381ba18fef | f77f932b186bd18abc621f237ad61b27ff3bf3ba | /Constants and Variables.playground/Pages/Exercise-Shopping List.xcplaygroundpage/Contents.swift | a71fd743392cb4916aaf48c24288f3cedb53d7c5 | [] | no_license | JonatanOrtiz/Student-Explorations | 89cd7d7981da40ddfdcc2394856ae17e6ce70ce0 | 85843a6e386df334df4ad0eb6d73dfc972b2b4d4 | refs/heads/main | 2023-03-03T11:08:49.304515 | 2021-01-27T20:16:52 | 2021-01-27T20:16:52 | 333,542,667 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 674 | swift | /*:
## Exercise: Making a Shopping List
The constants below represent some of the things you might want to add to a shopping list:
*/
let eggs = "Eggs"
let milk = "Milk"
let cheese = "Cheese"
let bread = "Bread"
let rice = "Rice"
let newLine = "\n"
var list = ""
list = eggs + newLine + milk + newLine + cheese + newLine + bread + newLine + rice
print(list)
//: - callout(Exercise): Create a string variable with an initial value of `""`. Add each constant item above to the list, one at a time. Add a `newLine` between items. Remember you can join two strings using the `+` operator.
/*:
[Previous](@previous) | page 12 of 13 | [Next: Exercise: 501](@next)
*/
| [
324379
] |
a77c5ba4bbe774e475a116c8f6882832dc58a9a7 | 152f846fef8f6c0c8220705bf3663c4eb73c0a96 | /BitfinexSwiftAPI/OrderbookResponse.swift | 17d53ff62fe19511929221c28ea3ea978b78d4b5 | [] | no_license | atulpatilvaultbank/BitfinexSwiftAPI | 884427ff31b5a2608a529fc69bef7176c0c22a2a | f971f0d8d4f6b5538f4fc927660939e18a08a4bd | refs/heads/master | 2021-05-29T23:19:50.878457 | 2015-11-17T12:39:04 | 2015-11-17T12:39:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 217 | swift | //
// OrderbookResponse.swift
// BitfinexSwiftAPI
//
// Created by Alexander Moshkin on 12.11.15.
// Copyright © 2015 DarthRamone. All rights reserved.
//
public typealias OrderbookResponse = FundingbookResponse | [
-1
] |
27cb52bdcc11346bbb7a9df9025fdc7278004c03 | 1f62cf71e3ee421a2f6045e83e767db66e0da368 | /GrapeVyne/LaunchViewController.swift | 8611944dc352092fd420aef712c5b0978552e79e | [
"MIT"
] | permissive | chiataytuday/GrapeVyne | 3e3243b0bd5d9265355a9f678e3fdb6e4b0c31f0 | 3e714e8a2113be4e425849f3ab5c416920181a71 | refs/heads/master | 2022-04-08T12:06:33.792098 | 2017-06-04T07:02:16 | 2017-06-04T07:02:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,311 | swift | //
// LaunchViewController.swift
// GrapeVyne
//
// Created by Umair Sharif on 3/8/17.
// Copyright © 2017 usharif. All rights reserved.
//
import UIKit
import RevealingSplashView
import Async
import ReachabilitySwift
import PopupDialog
let reachability = Reachability()!
let snopesScrapeNetwork = SnopesScrapeNetwork()
let categoryRepo = CategoryRepo()
let storyRepo = StoryRepo()
class LaunchViewController: UIViewController {
var revealingSplashView: RevealingSplashView!
@IBOutlet weak var loadingLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
modalTransitionStyle = appModalTransitionStyle
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let popupDialog = PopupDialog(title: "Network Error!".uppercased(),
message: "Please check your internet connection and try again.".uppercased(),
image: nil, buttonAlignment: .horizontal,
transitionStyle: .fadeIn, gestureDismissal: false,
completion: nil)
let dialogAppearance = PopupDialogDefaultView.appearance()
dialogAppearance.backgroundColor = CustomColor.customPurple
dialogAppearance.titleFont = UIFont(name: "Gotham-Bold", size: 22.0)!
dialogAppearance.titleColor = .white
dialogAppearance.titleTextAlignment = .center
dialogAppearance.messageFont = UIFont(name: "Gotham-Bold", size: 14.0)!
dialogAppearance.messageColor = .white
dialogAppearance.messageTextAlignment = .center
let pcv = PopupDialogContainerView.appearance()
pcv.cornerRadius = 15
reachability.whenReachable = { reachability in
popupDialog.dismiss(animated: true, completion: nil)
}
reachability.whenUnreachable = { reachability in
self.present(popupDialog, animated: true, completion: nil)
}
do {
try reachability.startNotifier()
} catch {
print("Unable to start notifier")
}
revealingSplashView = RevealingSplashView(iconImage: #imageLiteral(resourceName: "logo_icon"),
iconInitialSize: CGSize(width: 100, height: 100),
backgroundColor: .black)
revealingSplashView.animationType = .heartBeat
self.view.insertSubview(revealingSplashView, belowSubview: loadingLabel)
loadingLabel.attributedText = NSAttributedString(string: "Loading database,\n please do not navigate away".uppercased(),
attributes: [NSFontAttributeName: UIFont(name: "Gotham-Bold", size: 22.0)!,
NSForegroundColorAttributeName: UIColor.white])
loadingLabel.numberOfLines = 2
loadingLabel.textAlignment = .center
loadingLabel.adjustsFontSizeToFitWidth = true
loadingLabel.isHidden = false
revealingSplashView.startAnimation()
Async.userInitiated({
storyRepo.arrayOfStories = snopesScrapeNetwork.prepareDB()
}).main({
self.loadingLabel.isHidden = true
self.revealingSplashView.playZoomOutAnimation({
let landingVC = self.storyboard?.instantiateViewController(withIdentifier: "LandingViewController") as! LandingViewController
self.present(landingVC, animated: true, completion: nil)
})
})
}
private func printTimeElapsedWhenRunningCode(title:String, operation:()->()) {
let startTime = CFAbsoluteTimeGetCurrent()
operation()
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
print("Time elapsed for \(title): \(timeElapsed) s")
}
private func timeElapsedInSecondsWhenRunningCode(operation:()->()) -> Double {
let startTime = CFAbsoluteTimeGetCurrent()
operation()
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
return Double(timeElapsed)
}
}
| [
-1
] |
e6ce44fa9bfbdc4acbdb06fa41f5c1f52d117384 | 4ab73adaa8f5f9660e8f4524ce6e2fa8492d132a | /FitNessTests/Cases/App Model/AppModelTests.swift | 8f27ebb2ebc8f0a4c8d919413257b887b19670af | [] | no_license | bradleyyin/TDD_chapter_3 | 9f4d6bd8df519afb9221ec39b0d435f7ef3f789e | 5740cf80277c02d99bf0607099d1a07794feb5df | refs/heads/master | 2023-01-21T00:12:11.188331 | 2020-12-01T05:53:12 | 2020-12-01T05:53:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,168 | swift | //
// AppModelTests.swift
// FitNessTests
//
// Created by Bradley Yin on 11/29/20.
// Copyright © 2020 Razeware. All rights reserved.
//
import XCTest
@testable import FitNess
class AppModelTests: XCTestCase {
var sut: AppModel!
override func setUp() {
super.setUp()
sut = AppModel()
}
override func tearDown() {
sut = nil
super.tearDown()
}
// override func setUpWithError() throws {
// // Put setup code here. This method is called before the invocation of each test method in the class.
// super.setUpWithError()
// sut = AppModel()
// }
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testAppModel_whenInitialized_isInNotStartedState() {
let initialState = sut.appState
XCTAssertEqual(initialState, AppState.notStarted)
}
func testAppModel_whenStarted_isInInProgressState() {
// 1 given app in not started
// 2 when started
sut.start()
// 3 then it is in inProgress
let observedState = sut.appState
XCTAssertEqual(observedState, AppState.inProgress)
}
}
| [
-1
] |
7bb2b1f9be8a2627b499368590211f714c5254e3 | 4e9701a78d60d930e3548d8e921b4e58234f53d6 | /Thataway/Waypoint.swift | d85ad1daad6094d15f7a433ba486409f6517e181 | [] | no_license | MatthewMarmalade/thataway | 887883aa7591319c3250402e3eb9f15fac9e290a | 45665d7bc735e87f42ddc18f4b7d674028e93234 | refs/heads/master | 2021-11-20T13:31:42.750298 | 2021-08-24T17:29:01 | 2021-08-24T17:29:01 | 214,200,986 | 0 | 0 | null | 2020-04-28T03:51:33 | 2019-10-10T14:15:02 | Swift | UTF-8 | Swift | false | false | 5,845 | swift | //
// Waypoint.swift
// Compass
//
// Created by Matthew Marsland on 8/12/19.
// Copyright © 2019 Matthew Marsland. All rights reserved.
//
import Foundation
import CoreLocation
import UIKit
import MapKit
class Waypoint: NSObject, NSCoding, MKAnnotation{
//Properties
static let defaults: UserDefaults = UserDefaults.standard
var location: CLLocation
var coordinate: CLLocationCoordinate2D
var name: String
var color: UIColor
var distance: Double?
var enabled: Bool
var waypointer: UIImageView?
// var starred: Bool
static let DocumentsDirectory = FileManager().urls(for: .documentDirectory, in: .userDomainMask).first!
static let ArchiveURL = DocumentsDirectory.appendingPathComponent("waypointFiles").path
struct Keys {
static let locationKey = "locationKey"
static let nameKey = "nameKey"
//static let colorTextKey = "colorTextKey"
static let colorKey = "colorKey"
static let distanceKey = "distanceKey"
static let enabledKey = "enabledKey"
// static let starredKey = "starredKey"
}
convenience init(latitude: Double, longitude: Double, name:String, colorText:String = "white", color:UIColor = UIColor.white, distance:Double = 0.0, enabled:Bool = true) {
let location = CLLocation(latitude: latitude, longitude: longitude)
self.init(location:location,name:name,/*colorText:colorText,*/color:color,distance:distance,enabled:enabled)
}
init(location: CLLocation, name: String, /*colorText:String = "white",*/ color:UIColor = UIColor.white, distance:Double = 0.0, enabled:Bool = true, starred:Bool = false) {
self.location = location
self.coordinate = location.coordinate
self.name = name
self.color = color
self.distance = distance
self.enabled = enabled
// self.starred = starred
}
//encoding for data storage
@objc func encode(with aCoder: NSCoder) {
aCoder.encode(self.location, forKey: Keys.locationKey)
aCoder.encode(self.name, forKey: Keys.nameKey)
//aCoder.encode(self.colorText, forKey: Keys.colorTextKey)
aCoder.encode(self.color, forKey: Keys.colorKey)
aCoder.encode(self.distance, forKey: Keys.distanceKey)
aCoder.encode(self.enabled, forKey: Keys.enabledKey)
// aCoder.encode(self.starred, forKey: Keys.starredKey)
}
//decoding from the data storage
@objc required convenience init?(coder aDecoder: NSCoder) {
let location = aDecoder.decodeObject(forKey: Keys.locationKey) as? CLLocation
let name = aDecoder.decodeObject(forKey: Keys.nameKey) as? String
//let colorText = aDecoder.decodeObject(forKey: Keys.colorTextKey) as? String
let color = aDecoder.decodeObject(forKey: Keys.colorKey) as? UIColor
let distance = aDecoder.decodeObject(forKey: Keys.distanceKey) as? Double
let enabled = aDecoder.decodeBool(forKey: Keys.enabledKey)
// let starred = aDecoder.decodeBool(forKey: Keys.starredKey)
//let colorText = "white"
//let color = UIColor.white
self.init(location:location ?? CLLocation(latitude: 37.3349, longitude: -122.0090), name:name ?? "", /*colorText:colorText ?? "white",*/ color:color ?? UIColor.white, distance:distance ?? 0.0, enabled:enabled)
}
func dirFromLocation(location:CLLocation) -> Double {
//should return the direction as a pure heading degree value, which can then be extrapolated/rotated to compensate for rotating the phone.
//so we need the inverse... cos, say, which will tell us better information to prevent 180deg errors.
let aLat = location.coordinate.latitude / 180 * .pi
let bLat = self.location.coordinate.latitude / 180 * .pi
let aLon = location.coordinate.longitude / 180 * .pi
let bLon = self.location.coordinate.longitude / 180 * .pi
let (x, y) = Waypoint.getXY(aLat:aLat,aLon:aLon,bLat:bLat,bLon:bLon)
let angle = atan2(x, y) / .pi * 180
//let angle = atan2(dy, dx) / .pi * 180
if angle < 0 {
return 360 + angle
} else {
return angle
}
}
static func getXY(aLat:Double, aLon:Double, bLat:Double, bLon:Double) -> (Double, Double) {
let dLon = bLon - aLon
let x = cos(bLat) * sin(dLon)
let y = (cos(aLat) * sin(bLat)) - (sin(aLat) * cos(bLat) * cos(dLon))
return (x, y)
}
static func formatDist(distance:Double?) -> String {
let formatter = NumberFormatter()
formatter.numberStyle = NumberFormatter.Style.decimal
var amount = (distance ?? 0) / 1000
let distanceUnit = defaults.integer(forKey: "distance_unit")
var unit : String = "km"
if distanceUnit == 0 {
amount = amount * 0.6213712
unit = "mi"
} else if distanceUnit == 1 {
unit = "km"
} else if distanceUnit == 2 {
amount = amount * 0.5399565119
unit = "nm"
}
if amount < 1 {
amount = floor(amount * 1000) / 1000
} else if amount < 10 {
amount = floor(amount * 100) / 100
} else if amount < 100 {
amount = floor(amount * 10) / 10
} else {
amount = floor(amount)
}
let formattedString = formatter.string(for: amount)
return "\(formattedString ?? "0.0") " + unit
}
func rename(newName : String) {
self.name = newName
}
var subtitle: String? {
return Waypoint.formatDist(distance:distance)
}
var title: String? {
return name
}
}
| [
-1
] |
50474d02f45170a3e5074a2cd3ce068f30a97918 | a3181006f07d94dc9c49d83a2e6e3164a732f40d | /Todoey/Todoey/AppDelegate.swift | 22133bb68445a2ef17e139413797299a5f860232 | [] | no_license | Sxy623/LearnSwift | 3308b49953834d2f0dcbcf11a6c498054e5d55d1 | 35b4a617007e2d80ae3567bda26d2f61220f7b5f | refs/heads/master | 2023-04-14T01:23:18.228561 | 2023-04-02T15:11:03 | 2023-04-02T15:11:03 | 240,896,682 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,573 | swift | //
// AppDelegate.swift
// Todoey
//
// Created by 沈心逸 on 2020/3/1.
// Copyright © 2020 Xinyi Shen. All rights reserved.
//
import UIKit
import RealmSwift
@UIApplicationMain
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 initializing 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.
}
}
| [
243781,
395339,
327756,
342111,
180320,
368735,
329832,
192639,
250002,
250004,
329885,
333997,
256191,
350410,
180431,
350416,
350422,
350425,
268507,
334045,
356578,
346343,
338152,
350445,
350458,
350461,
336128,
350464,
350467,
325891,
350475,
350480,
350486,
338199,
350490,
325917,
182558,
350493,
350498,
338211,
350504,
350509,
340275,
356660,
332090,
201028,
332106,
250199,
250202,
332125,
250210,
246123,
332152,
248186,
334203,
250238,
332172,
340379,
373148,
342430,
326058,
338352,
324030,
334275,
326084,
330189,
338381,
338386,
369118,
334304,
340451,
334311,
328177,
334321,
328179,
248308,
328182,
340472,
328189,
324094,
328192,
330252,
186897,
342545,
340500,
334358,
330267,
334363,
197159,
334394,
188987,
219718,
334420,
352856,
332380,
174695,
248425,
191084,
338543,
334468,
148105,
162445,
326290,
342679,
342683,
354974,
332453,
332459,
336555,
332463,
332471,
248504,
328378,
328386,
332483,
332486,
332493,
338660,
338664,
332520,
342766,
332533,
342776,
344831,
207619,
336643,
338700,
336659,
336675,
328484,
326441,
215853,
152370,
326451,
340789,
244540,
326460,
326467,
336708,
127814,
244551,
326473,
336714,
326477,
330580,
326485,
326490,
326502,
201579,
326507,
201582,
211825,
201588,
324472,
324475,
324481,
324484,
324487,
324492,
236430,
324495,
324498,
330642,
324501,
324510,
324513,
324524,
324533,
324538,
324541,
326598,
340939,
340941,
345043,
330710,
340963,
359407,
439294,
384007,
330760,
328714,
209943,
336921,
209946,
248862,
209968,
209971,
209975,
339001,
209987,
209990,
330826,
197707,
250967,
183383,
156761,
339036,
341091,
210027,
345199,
210039,
341113,
152703,
248985,
210077,
210080,
210084,
339112,
210088,
337071,
210098,
337075,
249014,
126144,
210115,
332997,
244937,
333009,
146642,
333014,
343270,
328941,
251128,
343306,
175375,
333078,
175396,
171302,
208166,
337205,
251189,
345399,
175415,
175423,
343365,
337222,
251210,
337229,
175450,
365921,
208227,
251235,
175460,
343398,
345448,
333162,
343409,
234866,
378227,
175477,
249208,
327034,
175483,
249214,
175489,
249218,
181643,
249227,
136590,
112020,
245142,
175513,
343450,
175516,
355748,
155044,
181673,
327084,
337329,
259515,
327110,
216522,
327115,
327117,
339417,
249308,
329191,
339434,
343539,
210420,
337398,
329226,
175635,
345625,
366117,
333386,
214610,
138864,
126596,
159374,
126610,
345762,
337592,
337599,
333511,
224981,
181977,
224993,
224999,
337642,
337645,
339695,
337659,
225020,
339710,
225025,
245525,
333594,
339747,
225066,
225070,
358191,
225073,
204606,
325440,
247617,
341829,
325446,
354117,
341834,
323402,
247637,
337750,
341851,
327531,
358259,
341876,
327539,
243579,
325504,
333698,
339844,
247691,
225165,
337808,
247700,
329623,
225180,
333724,
184244,
337844,
346057,
333774,
247759,
155603,
329697,
327654,
247789
] |
2868e547a4c75f0ce97284f410babe2e64fb0874 | fcf8999df994b1ba40e73a7f08a84e5804934297 | /YPImagePickerExample/YPImagePickerExample/ExampleViewController.swift | 3c4daaaba41471c37142e03f0cef21391bfbdbbe | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | decormatters/YPImagePicker | 0746103926c30edc14876ea2ba2ac688e9b8e7f5 | 3f97dffe5a0e3057941aed73f8855d049cd2e8b2 | refs/heads/master | 2023-04-27T05:15:53.361229 | 2023-04-19T16:19:10 | 2023-04-19T16:19:10 | 226,960,431 | 0 | 0 | MIT | 2020-02-03T18:05:48 | 2019-12-09T20:22:50 | Swift | UTF-8 | Swift | false | false | 11,248 | swift | //
// ExampleViewController.swift
// YPImagePickerExample
//
// Created by Sacha DSO on 17/03/2017.
// Copyright © 2017 Octopepper. All rights reserved.
//
import UIKit
import YPImagePicker
import AVFoundation
import AVKit
import Photos
class ExampleViewController: UIViewController {
var selectedItems = [YPMediaItem]()
let selectedImageV = UIImageView()
let pickButton = UIButton()
let resultsButton = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
selectedImageV.contentMode = .scaleAspectFit
selectedImageV.frame = CGRect(x: 0,
y: 0,
width: UIScreen.main.bounds.width,
height: UIScreen.main.bounds.height * 0.45)
view.addSubview(selectedImageV)
pickButton.setTitle("Pick", for: .normal)
pickButton.setTitleColor(.black, for: .normal)
pickButton.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
pickButton.addTarget(self, action: #selector(showPicker), for: .touchUpInside)
view.addSubview(pickButton)
pickButton.center = view.center
resultsButton.setTitle("Show selected", for: .normal)
resultsButton.setTitleColor(.black, for: .normal)
resultsButton.frame = CGRect(x: 0,
y: UIScreen.main.bounds.height - 100,
width: UIScreen.main.bounds.width,
height: 100)
resultsButton.addTarget(self, action: #selector(showResults), for: .touchUpInside)
view.addSubview(resultsButton)
}
@objc
func showResults() {
if selectedItems.count > 0 {
let gallery = YPSelectionsGalleryVC(items: selectedItems) { g, _ in
g.dismiss(animated: true, completion: nil)
}
let navC = UINavigationController(rootViewController: gallery)
self.present(navC, animated: true, completion: nil)
} else {
print("No items selected yet.")
}
}
// MARK: - Configuration
@objc
func showPicker() {
var config = YPImagePickerConfiguration()
/* Uncomment and play around with the configuration 👨🔬 🚀 */
/* Set this to true if you want to force the library output to be a squared image. Defaults to false */
// config.library.onlySquare = true
/* Set this to true if you want to force the camera output to be a squared image. Defaults to true */
// config.onlySquareImagesFromCamera = false
/* Ex: cappedTo:1024 will make sure images from the library or the camera will be
resized to fit in a 1024x1024 box. Defaults to original image size. */
// config.targetImageSize = .cappedTo(size: 1024)
/* Choose what media types are available in the library. Defaults to `.photo` */
config.library.mediaType = .photoAndVideo
config.library.itemOverlayType = .grid
/* Enables selecting the front camera by default, useful for avatars. Defaults to false */
// config.usesFrontCamera = true
/* Adds a Filter step in the photo taking process. Defaults to true */
// config.showsFilters = false
/* Manage filters by yourself */
// config.filters = [YPFilter(name: "Mono", coreImageFilterName: "CIPhotoEffectMono"),
// YPFilter(name: "Normal", coreImageFilterName: "")]
// config.filters.remove(at: 1)
// config.filters.insert(YPFilter(name: "Blur", coreImageFilterName: "CIBoxBlur"), at: 1)
/* Enables you to opt out from saving new (or old but filtered) images to the
user's photo library. Defaults to true. */
config.shouldSaveNewPicturesToAlbum = false
/* Choose the videoCompression. Defaults to AVAssetExportPresetHighestQuality */
config.video.compression = AVAssetExportPresetPassthrough
/* Choose the recordingSizeLimit. If not setted, then limit is by time. */
// config.video.recordingSizeLimit = 10000000
/* Defines the name of the album when saving pictures in the user's photo library.
In general that would be your App name. Defaults to "DefaultYPImagePickerAlbumName" */
// config.albumName = "ThisIsMyAlbum"
/* Defines which screen is shown at launch. Video mode will only work if `showsVideo = true`.
Default value is `.photo` */
config.startOnScreen = .library
/* Defines which screens are shown at launch, and their order.
Default value is `[.library, .photo]` */
config.screens = [.library, .photo, .video]
/* Can forbid the items with very big height with this property */
// config.library.minWidthForItem = UIScreen.main.bounds.width * 0.8
/* Defines the time limit for recording videos.
Default is 30 seconds. */
// config.video.recordingTimeLimit = 5.0
/* Defines the time limit for videos from the library.
Defaults to 60 seconds. */
config.video.libraryTimeLimit = 500.0
/* Adds a Crop step in the photo taking process, after filters. Defaults to .none */
config.showsCrop = .rectangle(ratio: (16/9))
/* Defines the overlay view for the camera. Defaults to UIView(). */
// let overlayView = UIView()
// overlayView.backgroundColor = .red
// overlayView.alpha = 0.3
// config.overlayView = overlayView
/* Customize wordings */
config.wordings.libraryTitle = "Gallery"
/* Defines if the status bar should be hidden when showing the picker. Default is true */
config.hidesStatusBar = false
/* Defines if the bottom bar should be hidden when showing the picker. Default is false */
config.hidesBottomBar = false
config.maxCameraZoomFactor = 2.0
config.library.maxNumberOfItems = 5
config.gallery.hidesRemoveButton = false
/* Disable scroll to change between mode */
// config.isScrollToChangeModesEnabled = false
// config.library.minNumberOfItems = 2
/* Skip selection gallery after multiple selections */
// config.library.skipSelectionsGallery = true
/* Here we use a per picker configuration. Configuration is always shared.
That means than when you create one picker with configuration, than you can create other picker with just
let picker = YPImagePicker() and the configuration will be the same as the first picker. */
/* Only show library pictures from the last 3 days */
//let threDaysTimeInterval: TimeInterval = 3 * 60 * 60 * 24
//let fromDate = Date().addingTimeInterval(-threDaysTimeInterval)
//let toDate = Date()
//let options = PHFetchOptions()
// options.predicate = NSPredicate(format: "creationDate > %@ && creationDate < %@", fromDate as CVarArg, toDate as CVarArg)
//
////Just a way to set order
//let sortDescriptor = NSSortDescriptor(key: "creationDate", ascending: true)
//options.sortDescriptors = [sortDescriptor]
//
//config.library.options = options
config.library.preselectedItems = selectedItems
// Customise fonts
//config.fonts.menuItemFont = UIFont.systemFont(ofSize: 22.0, weight: .semibold)
//config.fonts.pickerTitleFont = UIFont.systemFont(ofSize: 22.0, weight: .black)
//config.fonts.rightBarButtonFont = UIFont.systemFont(ofSize: 22.0, weight: .bold)
//config.fonts.navigationBarTitleFont = UIFont.systemFont(ofSize: 22.0, weight: .heavy)
//config.fonts.leftBarButtonFont = UIFont.systemFont(ofSize: 22.0, weight: .heavy)
let picker = YPImagePicker(configuration: config)
picker.imagePickerDelegate = self
/* Change configuration directly */
// YPImagePickerConfiguration.shared.wordings.libraryTitle = "Gallery2"
/* Multiple media implementation */
picker.didFinishPicking { [unowned picker] items, cancelled in
if cancelled {
print("Picker was canceled")
picker.dismiss(animated: true, completion: nil)
return
}
_ = items.map { print("🧀 \($0)") }
self.selectedItems = items
if let firstItem = items.first {
switch firstItem {
case .photo(let photo):
self.selectedImageV.image = photo.image
picker.dismiss(animated: true, completion: nil)
case .video(let video):
self.selectedImageV.image = video.thumbnail
let assetURL = video.url
let playerVC = AVPlayerViewController()
let player = AVPlayer(playerItem: AVPlayerItem(url:assetURL))
playerVC.player = player
picker.dismiss(animated: true, completion: { [weak self] in
self?.present(playerVC, animated: true, completion: nil)
print("😀 \(String(describing: self?.resolutionForLocalVideo(url: assetURL)!))")
})
}
}
}
/* Single Photo implementation. */
// picker.didFinishPicking { [unowned picker] items, _ in
// self.selectedItems = items
// self.selectedImageV.image = items.singlePhoto?.image
// picker.dismiss(animated: true, completion: nil)
// }
/* Single Video implementation. */
//picker.didFinishPicking { [unowned picker] items, cancelled in
// if cancelled { picker.dismiss(animated: true, completion: nil); return }
//
// self.selectedItems = items
// self.selectedImageV.image = items.singleVideo?.thumbnail
//
// let assetURL = items.singleVideo!.url
// let playerVC = AVPlayerViewController()
// let player = AVPlayer(playerItem: AVPlayerItem(url:assetURL))
// playerVC.player = player
//
// picker.dismiss(animated: true, completion: { [weak self] in
// self?.present(playerVC, animated: true, completion: nil)
// print("😀 \(String(describing: self?.resolutionForLocalVideo(url: assetURL)!))")
// })
//}
present(picker, animated: true, completion: nil)
}
}
// Support methods
extension ExampleViewController {
/* Gives a resolution for the video by URL */
func resolutionForLocalVideo(url: URL) -> CGSize? {
guard let track = AVURLAsset(url: url).tracks(withMediaType: AVMediaType.video).first else { return nil }
let size = track.naturalSize.applying(track.preferredTransform)
return CGSize(width: abs(size.width), height: abs(size.height))
}
}
// YPImagePickerDelegate
extension ExampleViewController: YPImagePickerDelegate {
func noPhotos() {}
func shouldAddToSelection(indexPath: IndexPath, numSelections: Int) -> Bool {
return true// indexPath.row != 2
}
}
| [
-1
] |
de631eaf6c36772d5d3f115cccabb8154b864cd9 | 432ad86c344118f419ba13bdea85cbd86ed1a6a3 | /PiedPipers/Screens/Notifications/presenter/NotificationCellPresentable.swift | b8a0b7dea319f256a41f8aea9dbc28b93be07bd2 | [] | no_license | davidrogel/PiedPipers_iOS | 0abb387261fd0398a53b0b81cd77a3d29f3c85d8 | 16ecf367495a24cb48345e45b2d097422bbb748f | refs/heads/master | 2020-08-30T12:38:50.940729 | 2020-01-11T10:15:00 | 2020-01-11T10:15:00 | 218,382,617 | 0 | 3 | null | null | null | null | UTF-8 | Swift | false | false | 364 | swift | //
// NotificationCellPresentable.swift
// PiedPipers
//
// Created by Jon Gonzalez on 12/12/2019.
// Copyright © 2019 david rogel pernas. All rights reserved.
//
import Foundation
struct NotificationCellPresentable {
let cuid: String
let image: String
let userCuid: String
let userName: String
let notiState: Piper_Notification.State
}
| [
-1
] |
70687e96c41ace0cf26cbd46cda5f27e9bb50c55 | d9b1493be2f33d39a096c2e6ea32abcae280347a | /HSTracker/UIs/Battlegrounds/Composition/BattlegroundsCompositionPopularityRow.swift | 0508376b61581a73759e4e110cf3aa64573b07fa | [
"MIT"
] | permissive | HearthSim/HSTracker | ee11b658b9e8be1dc4cc2b254d13e78a1dfc0f8c | 4caa8041729a78e51e5869bc230a422f2e41c594 | refs/heads/master | 2023-09-03T16:24:53.283205 | 2023-08-24T22:07:53 | 2023-08-24T22:07:53 | 32,101,439 | 868 | 209 | MIT | 2023-04-12T06:10:57 | 2015-03-12T20:44:08 | Swift | UTF-8 | Swift | false | false | 2,607 | swift | //
// BattlegroundsCompositionPopularityRow.swift
// HSTracker
//
// Created by Francisco Moraes on 12/17/22.
// Copyright © 2022 Benjamin Michotte. All rights reserved.
//
import Foundation
import CoreImage
class BattlegroundsCompositionPopularityRow: NSView {
@IBOutlet weak var contentView: NSView!
@IBOutlet weak var cardImage: NSImageView!
@IBOutlet weak var tribeXImage: NSImageView!
@IBOutlet weak var nameLabel: NSTextField!
@IBOutlet weak var popularityBar: BattlegroundsCompositionPopularityBar!
@IBOutlet weak var popularityLabel: NSTextField!
let viewModel: BattlegroundsCompositionPopularityRowViewModel
override var intrinsicContentSize: NSSize {
return NSSize(width: 252, height: 24)
}
init(frame: NSRect, viewModel: BattlegroundsCompositionPopularityRowViewModel) {
self.viewModel = viewModel
super.init(frame: frame)
commonInit()
}
override func awakeFromNib() {
update()
}
private func commonInit() {
Bundle.main.loadNibNamed("BattlegroundsCompositionPopularityRow", owner: self, topLevelObjects: nil)
translatesAutoresizingMaskIntoConstraints = false
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.frame = self.bounds
addSubview(contentView)
let gradient = CAGradientLayer()
gradient.colors = [ NSColor.black.cgColor, NSColor.clear.cgColor ]
gradient.startPoint = NSPoint(x: 0, y: 0)
gradient.endPoint = NSPoint(x: 0.85, y: 0)
gradient.locations = [ 0.5, 1.0 ]
gradient.frame = cardImage.bounds
cardImage.wantsLayer = true
cardImage.layer?.mask = gradient
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func update() {
tribeXImage.isHidden = !viewModel.compositionUnavailableVisibility
ImageUtils.tile(for: viewModel.cardImage, completion: { img in
DispatchQueue.main.async {
self.cardImage.image = img
}
})
cardImage.alphaValue = viewModel.opacity
nameLabel.alphaValue = viewModel.opacity
popularityBar.alphaValue = viewModel.opacity
popularityLabel.alphaValue = viewModel.opacity
nameLabel.stringValue = viewModel.name
popularityLabel.stringValue = viewModel.popularityText
popularityBar.highlight = viewModel.compositionAvailable
popularityBar.progress = viewModel.popularityBarValue
}
}
| [
-1
] |
33cd35a588b2569be8220a9764d74628c9f6b633 | 8600571a0f23424a300dc1fb33a6406a77212089 | /Travelogue/Travelogue/TripTableViewCell.swift | 2ac8444851a04cd29e3010c06cf48d9b957d6252 | [] | no_license | djpkvf/Travelogue | fee3441a3d6afbe3ec8e5f994f744ed796762292 | d230168ccb39c8826d86f2d5f69f66c5cf6954ba | refs/heads/master | 2021-07-14T21:43:16.838473 | 2020-05-27T04:30:59 | 2020-05-27T04:30:59 | 142,078,992 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 604 | swift | //
// TripTableViewCell.swift
// Travelogue
//
// Created by Dominic Pilla on 7/23/18.
// Copyright © 2018 Dominic Pilla. All rights reserved.
//
import UIKit
class TripTableViewCell: UITableViewCell {
@IBOutlet weak var tripTitleLabel: UILabel!
@IBOutlet weak var tripDescriptionLabel: 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
}
}
| [
-1
] |
fc5c5611ffc891852806f37a2f64f908f81bb2fe | 5aee634dea40d5b4a141121cc83526fab8d2b5d8 | /SARAssist_Swift/SARAssist/MapViewController.swift | c6317cc1feb99cb1c5abf0b47177a90b6125f856 | [] | no_license | SARSquad/iOS | 5d9fef1a01a2126e6c11cbda9409ea7b48b8a3b6 | 2c62984d12e82566c8dfeb12bd2fe7834603e9e8 | refs/heads/master | 2021-01-13T02:36:24.202556 | 2015-09-19T18:25:45 | 2015-09-19T18:25:45 | 39,307,790 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,549 | swift | //
// MapViewController.swift
// SARAssist
//
// Created by V-FEXrt on 9/19/15.
// Copyright © 2015 V-FEXrt. All rights reserved.
//
import UIKit
import MapKit
import Parse
class MapViewController: UIViewController, MKMapViewDelegate, SARAnnotationDelegate {
internal var selectedBlocks:[BlockModel] = []
internal var currentLocation:PFGeoPoint = PFGeoPoint()
@IBOutlet private var map: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
self.map.delegate = self
positionMap(self.map, location: self.currentLocation)
addAllAnnotations()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func positionMap(map:MKMapView, location:PFGeoPoint){
let spanX:Double = 0.00725;
let spanY:Double = 0.00725;
var region:MKCoordinateRegion = MKCoordinateRegion();
region.center.latitude = location.latitude;
region.center.longitude = location.longitude;
region.span.latitudeDelta = spanX;
region.span.longitudeDelta = spanY;
map.setRegion(region, animated: false)
}
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
if(annotation.isKindOfClass(MKUserLocation)){
return nil
}
if(annotation.isKindOfClass(SARAnnotation)){
let ann:SARAnnotation = annotation as! SARAnnotation
var pinView:MKPinAnnotationView?
if(ann.color == MKPinAnnotationColor.Red){
pinView = mapView.dequeueReusableAnnotationViewWithIdentifier("redColorPin") as? MKPinAnnotationView
}else{
pinView = mapView.dequeueReusableAnnotationViewWithIdentifier("greenColorPin") as? MKPinAnnotationView
}
if(pinView == nil){
pinView = ann.annotationView()
}else{
pinView!.annotation = annotation
}
return pinView
}
return nil
}
func removeAllAnnotations(){
//Remove all added annotations
self.map.removeAnnotations(self.map.annotations)
}
func addAllAnnotations(){
for block:BlockModel in self.selectedBlocks{
let title:String = "R: \(block.Row), C: \(block.Column)"
var color:MKPinAnnotationColor = MKPinAnnotationColor.Red
if(block.isComplete.isEqualToNumber(NSNumber(bool: true))){
color = MKPinAnnotationColor.Green
}
let annotation:SARAnnotation = SARAnnotation(coordinate: block.CoreLocation, title: title, color: color)
annotation.delegate = self
annotation.row = block.Row.integerValue
annotation.column = block.Column.integerValue
self.map.addAnnotation(annotation)
}
}
// MARK: - SARAnnotation Delegate
func annotationWasSelected(annotation:SARAnnotation){
let alertController:UIAlertController = UIAlertController(title: "Mark as complete?", message: "Are you sure you want to mark this block as complete?", preferredStyle: .ActionSheet)
if(UI_USER_INTERFACE_IDIOM() == .Pad){
alertController.popoverPresentationController?.sourceView = self.view
alertController.popoverPresentationController!.sourceRect = CGRectMake((self.view.bounds.origin.x / 2) - 10, (self.view.bounds.origin.y / 2)-10, 20, 20);
}
alertController.addAction(UIAlertAction(title: "Complete Pin", style: .Default, handler: { (UIAlertAction) -> Void in
let block:BlockModel = self.selectedBlocks[annotation.row]
block.isComplete = NSNumber(bool: true)
block.saveInBackgroundWithBlock({ (success:Bool, error:NSError?) -> Void in
if(success){
self.removeAllAnnotations()
self.addAllAnnotations()
}else{
print("Error \(error?.description)")
}
})
}))
alertController.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
}
}
| [
-1
] |
babe84f281c7c5e8b18ead934eb78cbd0a78cb76 | 769ae06af5f9c75c5830b203ce68351c5e013e17 | /Sopt3rd/SoptSecondStackView/SoptSecondStackView/Sources/ViewControllers/LoginVC.swift | 684c36b1d4f75edcab4f0ea046478df71d3933c3 | [] | no_license | 25thSoptiOS/OhJunhyun | c535e2efcbd17e2fe08d851ecf889f722bed7ea3 | 149cf0edb03c8cca0971f54832c62e8cc3d03c20 | refs/heads/master | 2020-07-26T06:22:28.020915 | 2019-11-16T06:09:43 | 2019-11-16T06:09:43 | 208,562,611 | 4 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 4,585 | swift | //
// ViewController.swift
// SoptSecondStackView
//
// Created by Junhyeon on 2019/10/12.
// Copyright © 2019 Junhyeon. All rights reserved.
//
import UIKit
class LoginVC: UIViewController {
@IBOutlet weak var logoImgView: UIImageView!
@IBOutlet weak var idView: UIView!
@IBOutlet weak var pwView: UIView!
@IBOutlet weak var idTextField: UITextField!
@IBOutlet weak var pwTextField: UITextField!
@IBOutlet weak var loginBtn: UIButton!
@IBOutlet weak var signupBtn: UIButton!
@IBOutlet weak var stackViewCenterY: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
initGestureRecognizer()
loginBtn.makeButtonRadius(0.64, .white, 20)
}
// 키보드 제어하는 메소드
override func viewWillAppear(_ animated: Bool) {
registerForKeyboardNotifications()
}
override func viewWillDisappear(_ animated: Bool) {
unregisterForKeyboardNotifications()
}
}
extension LoginVC : UIGestureRecognizerDelegate {
func initGestureRecognizer() {
let textFieldTap = UITapGestureRecognizer(target: self, action: #selector(handleTapTextField(_:)))
textFieldTap.delegate = self
view.addGestureRecognizer(textFieldTap)
}
// 다른 위치 탭했을 때 키보드 없어지는 코드
@objc func handleTapTextField(_ sender: UITapGestureRecognizer) {
self.idTextField.resignFirstResponder()
self.pwTextField.resignFirstResponder()
}
func gestureRecognizer(_ gestrueRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
if (touch.view?.isDescendant(of: idTextField))! || (touch.view?.isDescendant(of: pwTextField))! {
return false
}
return true
}
// keyboard가 보여질 때 어떤 동작을 수행
@objc func keyboardWillShow(_ notification: NSNotification) {
guard let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double else { return }
guard let curve = notification.userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt else { return }
guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else { return }
let keyboardHeight: CGFloat // 키보드의 높이
if #available(iOS 11.0, *) {
keyboardHeight = keyboardFrame.cgRectValue.height - self.view.safeAreaInsets.bottom
} else {
keyboardHeight = keyboardFrame.cgRectValue.height
}
// animation 함수
// 최종 결과물 보여줄 상태만 선언해주면 애니메이션은 알아서
// duration은 간격
UIView.animate(withDuration: duration, delay: 0.0, options: .init(rawValue: curve), animations: {
self.logoImgView.alpha = 0
// +로 갈수록 y값이 내려가고 -로 갈수록 y값이 올라간다.
self.stackViewCenterY.constant = -keyboardHeight/2 + 50
})
self.view.layoutIfNeeded()
}
// keyboard가 사라질 때 어떤 동작을 수행
@objc func keyboardWillHide(_ notification: NSNotification) {
guard let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double else {return}
guard let curve = notification.userInfo?[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt else {return}
UIView.animate(withDuration: duration, delay: 0.0, options: .init(rawValue: curve), animations: {
// 원래대로 돌아가도록
self.logoImgView.alpha = 1.0
self.stackViewCenterY.constant = 0
})
self.view.layoutIfNeeded()
}
// observer
func registerForKeyboardNotifications() {
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
func unregisterForKeyboardNotifications() {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
}
}
| [
-1
] |
737010fac0354ccf41e2ce5d43f30b9fd26137c0 | 3772ddafcb25274182d48dac393789f663db7985 | /Tips/View Controllers/AboutViewController.swift | 345268c2bf1a0d10e9d243623fc37699cd215d9d | [] | no_license | abb341/ScienceFactOfTheDay | 73dcf7ee380786501ae584f35111a3b19d0da93e | 0665613eae4228aba2a8821a88cc9e29d77059d3 | refs/heads/master | 2021-01-18T14:05:25.120627 | 2015-08-04T19:12:59 | 2015-08-04T19:12:59 | 38,945,500 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,318 | swift | //
// AboutViewController.swift
// Tips
//
// Created by Aaron Brown on 7/20/15.
// Copyright (c) 2015 BrownDogLabs. All rights reserved.
//
import UIKit
import MessageUI
class AboutViewController: UIViewController, MFMailComposeViewControllerDelegate {
@IBAction func contactUsButtonPressed(sender: AnyObject) {
let mailComposeViewController = configuredMailComposeViewController()
if MFMailComposeViewController.canSendMail() {
self.presentViewController(mailComposeViewController, animated: true, completion: nil)
} else {
self.showSendMailErrorAlert()
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
// MARK: MessageUI
func configuredMailComposeViewController() -> MFMailComposeViewController {
let mailComposerVC = MFMailComposeViewController()
mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property
mailComposerVC.setToRecipients(["[email protected]"])
mailComposerVC.setSubject("Pocket Facts")
//mailComposerVC.setMessageBody("Sending e-mail in-app is not so bad!", isHTML: false)
return mailComposerVC
}
func showSendMailErrorAlert() {
let sendMailErrorAlert = UIAlertView(title: "Could Not Send Email", message: "Your device could not send e-mail. Please check e-mail configuration and try again.", delegate: self, cancelButtonTitle: "OK")
sendMailErrorAlert.show()
}
// MARK: MFMailComposeViewControllerDelegate Method
func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!) {
controller.dismissViewControllerAnimated(true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
ceb7266809cc59c00b1f2cc678031beeffda7955 | 84ed8c89ea17580d7ce98cf8207d7792b2fd4011 | /RequestResponseServer/StreamType.swift | 9d36896b2f4f1be4af46b0588eff34ca6b8b7fee | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ajunlonglive/Epoch | 0bdecafb80cdaffdc7d5f8e617da5f866e56d0c9 | 77d87a4fed98e8afcfedfaf14b262d2c9c04f71c | refs/heads/master | 2021-01-18T01:33:20.963583 | 2015-11-16T14:39:35 | 2015-11-16T14:39:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,311 | swift | // StreamType.swift
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Zewo
//
// 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.
protocol StreamType {
func close()
func receive(completion: Result<[Int8]> -> Void)
func send(buffer: [Int8], completion: Result<Void> -> Void)
} | [
194560,
196615,
407569,
395282,
395283,
98341,
98344,
98346,
98347,
98349,
174135,
354359,
124987,
174139,
124988,
229441,
229443,
174148,
229444,
395334,
378951,
174152,
229449,
174159,
112721,
106580,
106582,
106584,
174170,
106586,
106587,
112730,
125048,
229504,
125057,
125064,
125065,
125066,
235658,
229526,
229532,
125087,
215205,
215206,
215208,
215211,
215212,
215215,
241846,
241852,
241862,
317638,
241864,
317640,
241868,
241873,
262353,
241878,
241879,
262359,
106713,
106714,
262366,
106720,
106725,
241904,
176370,
241907,
176373,
260342,
106742,
176378,
141566,
141569,
141576,
241928,
241931,
141583,
241937,
141588,
12565,
227607,
227608,
141593,
227610,
12571,
141595,
141597,
141594,
227612,
141600,
241952,
141602,
241955,
241954,
141598,
141599,
141607,
141606,
241961,
141609,
241963,
141612,
289068,
12592,
289074,
141627,
141629,
141632,
141634,
227609,
141640,
141641,
213320,
141642,
262475,
141646,
241998,
141650,
282967,
141655,
282969,
227613,
168285,
141663,
227614,
172391,
141674,
141677,
141679,
141681,
375154,
190840,
190842,
430458,
190844,
375165,
375168,
375172,
141701,
430471,
430475,
141711,
197016,
197018,
197019,
197021,
197029,
303550,
160208,
305638,
272872,
223741,
191007,
272931,
57893,
272934,
57896,
420394,
57899,
57900,
57903,
57904,
57905,
57906,
158257,
336445,
336446,
336450,
336451,
336460,
55890,
336466,
336469,
336470,
336471,
336472,
336473,
336475,
336480,
336481,
111202,
272994,
336482,
111206,
336488,
273003,
273021,
273023,
297615,
297625,
135854,
135861,
242361,
244421,
244430,
66257,
66261,
62174,
334563,
127722,
127727,
127729,
244469,
244470,
164601,
316155,
142076,
334590,
334591,
318211,
142083,
142087,
318218,
334602,
334604,
318220,
334606,
142095,
318223,
334607,
318228,
318233,
318234,
318239,
187173,
318246,
187175,
187176,
187178,
316216,
314168,
396094,
396095,
396098,
314180,
396101,
279366,
396104,
279374,
396112,
396114,
396117,
396118,
396119,
396120,
396122,
396123,
396126,
396127,
396133,
299880,
396137,
187248,
60304,
60318,
60322,
60323,
60328,
60331,
23469,
23470,
213935,
23472,
23473,
60337,
23475,
23476,
23487,
185280,
281538,
23494,
185286,
23502,
203755,
23559,
23560,
437256,
437258,
437269,
437273,
437281,
3119,
187442,
144435,
187444,
144440,
144441,
437305,
97339,
341052,
341054,
341055,
437310,
341057,
437314,
341058,
341060,
97347,
222278,
341062,
341063,
341066,
437326,
185428,
285781,
312407,
437340,
312413,
437349,
185446,
312423,
437353,
115817,
115819,
115820,
185452,
242796,
312427,
437356,
115825,
437364,
437371,
294012,
294016,
437390,
437392,
437394,
437396,
40089,
312474,
312473,
40092,
312476,
312478,
40095,
312479,
228510,
40096,
27811,
228512,
40098,
40101,
312480,
437416,
437415,
40105,
312489,
189612,
312493,
40109,
40110,
437424,
437426,
437428,
312501,
189621,
437431,
312502,
437433,
312504,
437436,
322751,
437440,
38081,
437443,
437445,
292041,
292042,
437451,
38092,
437453,
437456,
437457,
437458,
203990,
203991,
152795,
204000,
204003,
339176,
339177,
152821,
208117,
294138,
294142,
279818,
206094,
279823,
206097,
294162,
206108,
181533,
206109,
425247,
181544,
27945,
27948,
181559,
173368,
173376,
173379,
173394,
378206,
222566,
228717,
222573,
228721,
222577,
222579,
222581,
222582,
54655,
222591,
222597,
222601,
54666,
222604,
222605,
222606,
54673,
54678,
54680,
279961,
279969,
153009,
298431,
212420,
370118,
153037,
153049,
153051,
157157,
157159,
112111,
112115,
112117,
112120,
40451,
280068,
40453,
112131,
40455,
40458,
40460,
40463,
112144,
112145,
40466,
40469,
40471,
40475,
40477,
40479,
40480,
40481,
40482,
316993,
173634,
173635,
173639,
173646,
319085,
319088,
319089,
319094,
319098,
319101,
319103,
394899,
394900,
52886,
52887,
394908,
394910,
52896,
52899,
52900,
147116,
151218,
394935,
292536,
321210,
292544,
108234,
34516,
108245,
212694,
296660,
34522,
34531,
296679,
34538,
296682,
296687,
296691,
151285,
296694,
108279,
108281,
216826,
216828,
216829,
296700,
296701,
296703,
296704,
216834,
296708,
296710,
276232,
313099,
276236,
313102,
313108,
313111,
159518,
227116,
321342,
120655,
218960,
120656,
218959,
218962,
223064,
223065,
180059,
223069,
223070,
180062,
292705,
223075,
223076,
237413,
180070,
292709,
128874,
128875,
227180,
223087,
227183,
128881,
227188,
128884,
141189,
141202,
108436,
141208,
219033,
141220,
108455,
141225,
108460,
108462,
319426,
141253,
319432,
59349,
141272,
141273,
395247,
174063,
174066,
174067,
174074,
395259,
194559
] |
ecae7189a4645c1189c91325a3113b5270e3689f | 5d6a0ea0bf11d3d6606616e32159540e376fa05e | /iOSEngineerCodeCheck/Controller/ViewController2.swift | 9000af76f338c815f12458f18fc18f9806089b4b | [
"Apache-2.0"
] | permissive | junshu310/new-ios-engineer-codecheck | ed4b99e75c6d4fc2008141b035f30d3f3daa35c5 | 7ddd864b63826a20df0da9b64175fb783e3ac8c9 | refs/heads/main | 2023-09-05T08:07:35.151484 | 2021-11-19T14:46:15 | 2021-11-19T14:46:15 | 426,234,243 | 0 | 0 | Apache-2.0 | 2021-11-19T14:45:23 | 2021-11-09T13:11:57 | Swift | UTF-8 | Swift | false | false | 2,158 | swift | //
// ViewController2.swift
// iOSEngineerCodeCheck
//
// Created by 史 翔新 on 2020/04/21.
// Copyright © 2020 YUMEMI Inc. All rights reserved.
//
import UIKit
import SafariServices
class ViewController2: UIViewController {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var langLabel: UILabel!
@IBOutlet weak var starsLabel: UILabel!
@IBOutlet weak var watchersLabel: UILabel!
@IBOutlet weak var forksLabel: UILabel!
@IBOutlet weak var issuesLabel: UILabel!
var repo = [String : Any]()
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "リポジトリ詳細"
titleLabel.adjustsFontSizeToFitWidth = true
titleLabel.minimumScaleFactor = 0.5
presentData(repo: repo)
presentAvatarImage(repo: repo)
}
@IBAction func toSafari(_ sender: Any) {
if let urlString = repo[RepositoryData.Items.url] as? String {
let url = URL(string: urlString)
let safariVC = SFSafariViewController(url: url!)
self.present(safariVC, animated: true, completion: nil)
}
}
//MARK: FUNCTIONS
func presentData(repo: [String : Any]) {
titleLabel.text = repo[RepositoryData.Items.fullName] as? String
langLabel.text = "Written in \(repo[RepositoryData.Items.lang] as? String ?? "")"
starsLabel.text = "\(repo[RepositoryData.Items.stars] as? Int ?? 0) stars"
watchersLabel.text = "\(repo[RepositoryData.Items.watchers] as? Int ?? 0) watchers"
forksLabel.text = "\(repo[RepositoryData.Items.forks] as? Int ?? 0) forks"
issuesLabel.text = "\(repo[RepositoryData.Items.issues] as? Int ?? 0) open issues"
}
func presentAvatarImage(repo: [String : Any]) {
ImageManager.instance.getAvatarImage(repo: repo) { image in
if let image = image {
DispatchQueue.main.async {
self.imageView.image = image
}
}
}
}
}
| [
-1
] |
547f2bbe35869e66fab3b357647da43e1e260735 | 913faab213fe202a38c5ec1ba98e2903869b9c04 | /VKFileBrowserDemo/VKFileBrowserDemo/RemoteViewController.swift | d99ddd7ce54a7884a33c1d4e16a79cb4d939c33a | [] | no_license | V1ki/VKFileBrowser | b73104e756f9308a3556555ed75e9ef86a8e006a | 21382b9aaa0a15c24e81e1bdb24011656f8ff56d | refs/heads/master | 2021-11-25T03:07:02.662477 | 2021-10-25T11:47:09 | 2021-10-25T11:47:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 8,103 | swift | //
// RemoteViewController.swift
// VKFileBrowserDemo
//
// Created by Vk on 2017/8/23.
// Copyright © 2017年 vk. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
import RxDataSources
class RemoteViewController: BaseViewController {
let cellIdentifier = "CELL"
@IBOutlet weak var mTableView: UITableView!
var repo:Repository?
var remote:Remote?
var remoteName : String?
var remoteUrl : String?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if(self.remote == nil)
{
self.navigationController?.popViewController(animated: false)
}
let saveBtn = UIButton(frame: CGRect(x:0,y:0,width:50,height:30 ))
saveBtn.setTitle(LocalizedString("Save"), for: .normal)
saveBtn.rx.tap.bind {
if let remoteName = self.remoteName ,let remoteUrl = self.remoteUrl {
if(self.remote!.name == remoteName){
self.remote?.rename(self.repo!, remoteName)
}
if(self.remote!.URL == remoteUrl){
self.remote?.updatePushUrl(self.repo!, remoteUrl)
}
}
}.disposed(by: disposeBag)
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: saveBtn)
self.automaticallyAdjustsScrollViewInsets = false
self.title = LocalizedString("Remote")
self.mTableView.dataSource = nil
let dataSource = RxTableViewSectionedReloadDataSource<SectionModel<String, String>>()
let items = Observable.just([
SectionModel(model: "First section", items: [""]),
SectionModel(model: "Second section", items: [LocalizedString("Name"),LocalizedString("URL"),
// LocalizedString("Test")
]),
SectionModel(model: "Third section", items: [LocalizedString("Delete")])
])
//(TableViewSectionedDataSource<S>, Int) -> String?
dataSource.titleForHeaderInSection = {tDataSource,section in
return " "
}
dataSource.configureCell = { (tdataSource, tv, indexPath, element) in
var cell = tv.dequeueReusableCell(withIdentifier: self.cellIdentifier)
if(cell == nil){
cell = UITableViewCell(style: .default, reuseIdentifier: self.cellIdentifier)
}
if(element.isEmpty){
let fetchBtn = UIButton(frame: CGRect(x:20,y:0,width:50,height:cell?.mj_h ?? 40))
fetchBtn.backgroundColor = .clear
fetchBtn.setTitle(LocalizedString("Fetch"), for: .normal)
fetchBtn.setTitleColor(fetchBtn.tintColor, for: .normal)
fetchBtn.rx.tap.bind {
// let hud = MBProgressHUD.showAdded(to: self.view, animated: true)
RepositoryUtils.fetchRemote(self.repo!, self.remote!.name,{str,line in
print("\(str)")
})
}.disposed(by: self.disposeBag)
cell?.addSubview(fetchBtn)
let pushBtn = UIButton(frame: CGRect(x:self.view.mj_w - 20 - 50,y:0,width:50,height:cell?.mj_h ?? 40))
pushBtn.backgroundColor = .clear
pushBtn.setTitle(LocalizedString("Push"), for: .normal)
pushBtn.setTitleColor(fetchBtn.tintColor, for: .normal)
pushBtn.rx.tap.bind {
print("click push:\(self.repo!.HEAD())")
let head = self.repo!.HEAD().value
if(head == nil){
self.view.showTips("local has no content,Please fetch first")
return
}
var branch : Branch?
if(head is Branch){
// current Branch
print("current Branch")
branch = head as? Branch
}
else{
let branches = (self.repo!.localBranches().value)!
branch = branches.filter{$0.oid == head?.oid}.last
if(branch == nil){
self.view.showTips("local has no content,Please fetch first")
return
}
}
RepositoryUtils.pushBranch(self.repo!, (branch)!, (self.remote)!)
}.disposed(by: self.disposeBag)
cell?.addSubview(pushBtn)
}else{
cell?.textLabel?.text = element
if(element == LocalizedString("Delete")){
cell?.textLabel?.textAlignment = .center
cell?.textLabel?.textColor = .flatRed
return cell!
}
if(element == LocalizedString("Test")){
cell?.textLabel?.textAlignment = .center
cell?.textLabel?.textColor = .flatSkyBlue
return cell!
}
let textField = UITextField(frame: CGRect(x:80,y:0,width:self.view.mj_w - 100,height:cell?.mj_h ?? 40))
if(element == LocalizedString("Name")){
textField.text = self.remote?.name
textField.rx.text.bind{str in self.remoteName = str}.disposed(by: self.disposeBag)
}else if(element == LocalizedString("URL")){
textField.text = self.remote?.URL
textField.rx.text.bind{str in self.remoteUrl = str}.disposed(by: self.disposeBag)
}
cell?.addSubview(textField)
}
return cell!
}
self.mTableView.rx.itemSelected.bind{indexPath in
self.mTableView.deselectRow(at: indexPath, animated: true)
if indexPath.row == 0 && indexPath.section == 2{
//delete Action
let result = RepositoryUtils.deleteRemote(self.repo!, self.remote!.name)
if(result.error == nil){
self.navigationController?.popViewController(animated: true)
}
else{
self.view.showTips((result.error?.description)!)
}
}
}.disposed(by: disposeBag)
items
.bind(to: self.mTableView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
self.mTableView.hideExtraCell()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
extension RemoteViewController : UITableViewDelegate {
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
if(indexPath.row == 2 || (indexPath.row == 0 && indexPath.section == 2)){
return indexPath
}
return nil
}
}
| [
-1
] |
cac737c4985e996a32245ec5c515ed73d94fd7f0 | 3219c2e6bcaf3698fb8a407eb2d55f7af58e1530 | /MyWeChat/MyWeChat/Classes/Common/Category/UITextField+Extension.swift | e34d5be4114b43a8f413f31abdf554c2b7cad317 | [] | no_license | a270042126/MyWeChat | 3333db25388a10f204b3a95156c91d11990cf6b5 | d095dffd94e9481f80bfa395e1a1e55e585e5aa5 | refs/heads/master | 2021-01-10T14:41:20.071146 | 2016-01-09T11:41:47 | 2016-01-09T11:41:47 | 48,731,809 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 789 | swift | //
// UITextField+Extension.swift
// MyWeChat
//
// Created by GDG on 15/12/30.
// Copyright © 2015年 MyWeChat. All rights reserved.
//
import UIKit
extension UITextField {
func addLeftViewWithImage(image:String){
let leftView = UIImageView()
var imageBounds = self.bounds
imageBounds.size.width = imageBounds.size.height
leftView.bounds = imageBounds
leftView.image = UIImage(named: image)
leftView.contentMode = .Center
self.leftView = leftView
self.leftViewMode = .Always
}
func telphoneNum() -> Bool{
let telRegex = "^1[3578]\\d{9}$"
let prediate = NSPredicate(format: "SELF MATCHES %@", telRegex)
return prediate.evaluateWithObject(self.text)
}
}
| [
-1
] |
0fa7d1cf4c795b69c09f875d87756b92a441edac | 651157462ebcacb3acf7813bde57a3c617db6361 | /SwiftUI Test/SwiftUI Test/SceneDelegate.swift | 9e8da22950e2fff123ddf1a6da30b497bbcaae81 | [] | no_license | kodon0/iOS_Apps | 47c05040c7b34dde507d74be8917a1e9acbd5102 | c90547cf8515649a0177f21d962de34a90d253bd | refs/heads/master | 2023-03-18T14:23:55.492842 | 2021-03-03T00:55:52 | 2021-03-03T00:55:52 | 319,456,324 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,770 | swift | //
// SceneDelegate.swift
// SwiftUI Test
//
// Created by Kieran O'Donnell on 08/02/2021.
// Copyright © 2021 baxmanduppa. 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 = ContentView()
// 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.
}
}
| [
325633,
325637,
163849,
268299,
333838,
346140,
352294,
163892,
16444,
337980,
254020,
217158,
243782,
395340,
327757,
200786,
286804,
329816,
217180,
368736,
342113,
180322,
329833,
286833,
368753,
252021,
342134,
286845,
192640,
286851,
329868,
268435,
250008,
329886,
286880,
135328,
192674,
333989,
286889,
430257,
180418,
350411,
346317,
180432,
350417,
368854,
350423,
350426,
385243,
334047,
356580,
346344,
327915,
350449,
387314,
375027,
338161,
350454,
321787,
350459,
336124,
350462,
336129,
350465,
350469,
389381,
325895,
194829,
350477,
43279,
350481,
350487,
356631,
338201,
325915,
350491,
381212,
325918,
182559,
350494,
258333,
325920,
350500,
194854,
350505,
350510,
395567,
248112,
332081,
307507,
340276,
336181,
356662,
264502,
332091,
332098,
201030,
332107,
190797,
334162,
332118,
418135,
321880,
250201,
332126,
332130,
250211,
340328,
250217,
348523,
348528,
182642,
321911,
332153,
334204,
268669,
194942,
250239,
332158,
332162,
389507,
348548,
393613,
383375,
332175,
160152,
340380,
268702,
416159,
326059,
373169,
342453,
334263,
338363,
266688,
324032,
336326,
338387,
248279,
369119,
334306,
338404,
334312,
338411,
104940,
375279,
162289,
328178,
328180,
248309,
328183,
340473,
199165,
328190,
324095,
328193,
98819,
324100,
266757,
324103,
164362,
248332,
199182,
328207,
324112,
330254,
186898,
342546,
340501,
324118,
334359,
342551,
324122,
334364,
330268,
340512,
191012,
332325,
324134,
197160,
381483,
324141,
324143,
334386,
324156,
334397,
188990,
324161,
324165,
219719,
324171,
324174,
324177,
244309,
334425,
326240,
340580,
174696,
375401,
248427,
191085,
346736,
338544,
268922,
334466,
336517,
344710,
119432,
213642,
148106,
162446,
330384,
326291,
340628,
342685,
340639,
336549,
332455,
271018,
332460,
336556,
389806,
332464,
385714,
164535,
336568,
174775,
248505,
174778,
244410,
328379,
332473,
223936,
328387,
332484,
332487,
373450,
418508,
154318,
332494,
342737,
154329,
183006,
139998,
189154,
338661,
332521,
338665,
418540,
330479,
342769,
340724,
332534,
338680,
342777,
418555,
344832,
207620,
336644,
191240,
328462,
326417,
336660,
338712,
199455,
336676,
334633,
326444,
215854,
271154,
152371,
326452,
328498,
326455,
340792,
348983,
244542,
326463,
326468,
328516,
336709,
127815,
244552,
328520,
326474,
328523,
336712,
342857,
326479,
355151,
330581,
326486,
136024,
330585,
326494,
439138,
326503,
375657,
201580,
326508,
201583,
326511,
355185,
211826,
340850,
330612,
201589,
340859,
324476,
328574,
340863,
359296,
351105,
252801,
373635,
324482,
324488,
342921,
236432,
361361,
324496,
330643,
324502,
252823,
324511,
324514,
252838,
201638,
211885,
324525,
5040,
5047,
324539,
324542,
187335,
398280,
347082,
340940,
345046,
330711,
248794,
340958,
248799,
340964,
386023,
328690,
359411,
244728,
330750,
265215,
328703,
199681,
328710,
338951,
330761,
328715,
326669,
330769,
361490,
349203,
209944,
336922,
209948,
248863,
345119,
250915,
357411,
250917,
158759,
347178,
328747,
209966,
209969,
330803,
209973,
386102,
209976,
339002,
339010,
209988,
209991,
347208,
248905,
330827,
197708,
330830,
341072,
248915,
345172,
183384,
156762,
343132,
339037,
322660,
326764,
210028,
326767,
187503,
345200,
330869,
361591,
386168,
210042,
210045,
361599,
152704,
160896,
330886,
351366,
384136,
384140,
351382,
337048,
210072,
248986,
384152,
210078,
384158,
210081,
384161,
251045,
210085,
210089,
339118,
337072,
210096,
337076,
210100,
345268,
249015,
324792,
367801,
339133,
384189,
343232,
384192,
210116,
244934,
326858,
333003,
322763,
384202,
343246,
384209,
333010,
146644,
330966,
210139,
328925,
66783,
384225,
328933,
343272,
351467,
328942,
251123,
384247,
384250,
388348,
242947,
206084,
115973,
343307,
384270,
333075,
384276,
333079,
251161,
384284,
245021,
384290,
208167,
263464,
171304,
245032,
245042,
251190,
44343,
345400,
208189,
386366,
343366,
126279,
337224,
251211,
357710,
337230,
331089,
337235,
437588,
263509,
331094,
175458,
343394,
208228,
175461,
337252,
343399,
175464,
345449,
197987,
99692,
333164,
343410,
234867,
331124,
175478,
155000,
378232,
249210,
175484,
337278,
249215,
245121,
249219,
245128,
249225,
181644,
361869,
249228,
136591,
245137,
181650,
249235,
112021,
181655,
245143,
175514,
245146,
343453,
245149,
245152,
263585,
396706,
245155,
355749,
40358,
181671,
245158,
333222,
245163,
181679,
337330,
327090,
210357,
146878,
181697,
361922,
54724,
327108,
181704,
327112,
339401,
384457,
327116,
327118,
208338,
366035,
343509,
181717,
337366,
249310,
249313,
333285,
329195,
343540,
343545,
423424,
253445,
339464,
337416,
249355,
329227,
175637,
405017,
345626,
366118,
339504,
349748,
206397,
214594,
333387,
214611,
333400,
366173,
339553,
343650,
333415,
327276,
245358,
222831,
333423,
138865,
339572,
372354,
126597,
159375,
339602,
126611,
333472,
245410,
345763,
345766,
425639,
245415,
337588,
155323,
333499,
337601,
337607,
210632,
333512,
339664,
358100,
419543,
245463,
212700,
181982,
153311,
333535,
225000,
337643,
245487,
339696,
337647,
245495,
141052,
337661,
333566,
339711,
225027,
337671,
339722,
366349,
249617,
321300,
245528,
333593,
116512,
210720,
362274,
184096,
339748,
358192,
372533,
345916,
399166,
384831,
325441,
247618,
325447,
341831,
329545,
341835,
323404,
354124,
337743,
339795,
354132,
341844,
247639,
337751,
358235,
341852,
313181,
413539,
399208,
339818,
327532,
339827,
358260,
341877,
399222,
325494,
182136,
186233,
1914,
333690,
243584,
325505,
333699,
339845,
247692,
333709,
247701,
329625,
327590,
333737,
382898,
184245,
337845,
190393,
327613,
333767,
350153,
346059,
311244,
358348,
247760,
212945,
333777,
219094,
419810,
329699,
358372,
327655,
247790,
204785,
380919,
333819
] |
b5223b103076a9603ed46918293d94a91e7229e1 | 5a4a528dba9f262dcab436bad831205d214a0f4c | /rsqRecruitment/Model/PatientData.swift | f5a160662d5977ba44de314b03b7b188f76be937 | [] | no_license | malewski/rsqRecruitment | 80a7720fb086c0f11fd80900d6bfd9800d6528e3 | 28820f5e52f20faf16764252a5c28798435a07bf | refs/heads/master | 2021-12-14T01:50:49.443877 | 2019-10-04T00:02:40 | 2019-10-04T00:02:40 | 212,425,481 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 346 | swift | //
// PatientData.swift
// rsqRecruitment
//
// Created by Jan Malewski on 03/10/2019.
// Copyright © 2019 Jan Malewski. All rights reserved.
//
struct PatientData: Decodable, Equatable {
let patient: Patient
let date: String?
enum CodingKeys: String, CodingKey {
case patient
case date = "receiptdate"
}
}
| [
-1
] |
d50bb044d3183c01be5ad57e58cfaaf05a4e66be | e3dbb7d974a1fc5192b86cb2ba6fd3cd014fa64f | /cardGame/ViewController.swift | 03d111c88bcb85a650d8a0f4dcfb912a33a7fd4c | [] | no_license | vladislavSwift/Card-Wars-Game | b66ece4ba29112f94c8117be4ddd962e23ac0b59 | cd7cdadef82567edbed1ac3dcf720c73d1aadef6 | refs/heads/master | 2022-11-19T09:04:57.376879 | 2020-07-07T20:35:16 | 2020-07-07T20:35:16 | 260,071,736 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,761 | swift | //
// ViewController.swift
// cardGame
//
// Created by macOS on 10/04/20.
// Copyright © 2020 macOS. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var leftImageView: UIImageView!
@IBOutlet weak var rightImageView: UIImageView!
@IBOutlet weak var leftScoreLabel: UILabel!
@IBOutlet weak var rightScoreLabel: UILabel!
var leftScore = 0
var rightScore = 0
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func dealTapped(_ sender: Any) {
//Randomise numbers
let leftNumber = Int.random(in: 2...14)
//print(leftNumber)
let rightNumber = Int.random(in: 2...14)
//print(rightNumber)
// update the image view
leftImageView.image = UIImage(named: "card\(leftNumber)")
rightImageView.image = UIImage(named: "card\(rightNumber)")
//if statement for comparing the random numbers
if leftNumber > rightNumber
{
//Left wins
leftScore += 1
leftScoreLabel.text = String(leftScore)
}
else if leftNumber < rightNumber
{
rightScore += 1
rightScoreLabel.text = String(rightScore)
//right wins
}
else
{
// tie
}
//print("Deal Tapped!")
}
}
| [
-1
] |
b3da7833c09c12ee3fad26381ab41c9ce0810412 | 71c9ca7a13aae36c51ada717ad3b5330b763faa0 | /OpenEmu/SidebarController.swift | a7e33003d8970db4afb7f61568368c5408359765 | [] | no_license | inekipelov/OpenEmu | 040b4f3bf9b1d1c9214a86aef71fa1c37795b481 | 1b2a0989a3490c923a7c044ef1e4aa29af3ce80b | refs/heads/master | 2023-02-20T06:13:51.799808 | 2021-01-13T21:47:03 | 2021-01-13T21:47:03 | 326,738,414 | 0 | 0 | null | 2021-01-09T10:44:12 | 2021-01-04T16:11:37 | null | UTF-8 | Swift | false | false | 25,409 | swift | // Copyright (c) 2020, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import Cocoa
extension NSPasteboard.PasteboardType {
static let game = NSPasteboard.PasteboardType("org.openemu.game")
}
extension NSNotification.Name {
static let OESidebarSelectionDidChange = NSNotification.Name("OESidebarSelectionDidChange")
}
@objc(OESidebarController)
class SidebarController: NSViewController {
@IBOutlet var sidebarView: NSOutlineView!
@IBOutlet var gameScannerViewController: GameScannerViewController!
var database: OELibraryDatabase? {
didSet {
let lastSidebarSelection = self.lastSidebarSelection
reloadData()
self.lastSidebarSelection = lastSidebarSelection
guard
!lastSidebarSelection.isEmpty,
let item = lastSidebarSelectionItem
else { return }
selectItem(item)
}
}
@UserDefault(.lastSidebarSelection, defaultValue: "")
var lastSidebarSelection: String
var lastSidebarSelectionItem: OESidebarItem? {
systems.first(where: { $0.sidebarID == lastSidebarSelection }) ?? collections.first(where: { $0.sidebarID == lastSidebarSelection})
}
var groups = [
SidebarGroupItem(name: NSLocalizedString("Consoles", comment: ""),
autosaveName: .sidebarConsolesItem),
SidebarGroupItem(name: NSLocalizedString("Collections", comment: ""),
autosaveName: .sidebarCollectionsItem)
]
var systems: [OESidebarItem] = []
var collections: [OESidebarItem] = []
var selectedSidebarItem: OESidebarItem? {
let item = sidebarView.item(atRow: sidebarView.selectedRow)
precondition(item == nil || item is OESidebarItem, "All sidebar items must confirm to OESidebarItem")
return item as? OESidebarItem
}
private var token: NSObjectProtocol?
override func viewDidLoad() {
super.viewDidLoad()
sidebarView.register(NSNib(nibNamed: "SidebarHeaderView", bundle: nil), forIdentifier: Self.headerViewIdentifier)
sidebarView.register(NSNib(nibNamed: "SidebarItemView", bundle: nil), forIdentifier: Self.itemViewIdentifier)
sidebarView.registerForDraggedTypes([.fileURL, .game])
sidebarView.expandItem(nil, expandChildren: true)
let menu = NSMenu()
menu.delegate = self
sidebarView.menu = menu
menuNeedsUpdate(menu)
token = NotificationCenter.default.addObserver(forName: .OEDBSystemAvailabilityDidChange, object: nil, queue: .main) { [weak self] _ in
guard let self = self else { return }
self.reloadDataAndPreserveSelection()
}
NotificationCenter.default.addObserver(self, selector: #selector(libraryLocationDidChange(_:)), name: .OELibraryLocationDidChange, object: nil)
}
func reloadDataAndPreserveSelection() {
let possibleItem = self.selectedSidebarItem
let previousRow = self.sidebarView.selectedRow
reloadData()
guard let previousItem = possibleItem else { return }
var rowToSelect = previousRow
let reloadedRowForPreviousItem = sidebarView.row(forItem: previousItem)
if reloadedRowForPreviousItem == -1 {
func isSelectable(i: Int) -> Bool {
guard let item = sidebarView.item(atRow: i) else { return false }
return outlineView(sidebarView, shouldSelectItem: item)
}
rowToSelect =
// find a row before the previously selected one
(0...rowToSelect).reversed().first(where: isSelectable) ??
// find a row after the previously selected one
(rowToSelect..<sidebarView.numberOfRows).first(where: isSelectable) ??
// or nothing
NSNotFound
} else if reloadedRowForPreviousItem != previousRow {
rowToSelect = reloadedRowForPreviousItem
}
guard rowToSelect != NSNotFound else { return }
sidebarView.selectRowIndexes([rowToSelect], byExtendingSelection: false)
outlineViewSelectionDidChange(Notification(name: NSOutlineView.selectionDidChangeNotification))
}
func reloadData() {
guard let database = database else { return }
if sidebarView.currentEditor() != nil {
sidebarView.abortEditing()
}
systems = OEDBSystem.enabledSystemsinContext(database.mainThreadContext) ?? []
collections = database.collections
sidebarView.reloadData()
}
@objc func libraryLocationDidChange(_ notification: Notification) {
reloadData()
}
// MARK: - Actions
func selectItem(_ item: OESidebarItem) {
guard item.isSelectableInSidebar else { return }
let index = sidebarView.row(forItem: item)
guard index > -1 else { return }
if sidebarView.selectedRow != index {
sidebarView.selectRowIndexes([index], byExtendingSelection: false)
}
}
func startEditingItem(_ item: OESidebarItem) {
guard item.isSelectableInSidebar else { return }
let index = sidebarView.row(forItem: item)
guard index > -1 else { return }
let event = NSEvent()
sidebarView.editColumn(0, row: index, with: event, select: true)
}
@IBAction func endedEditingItem(_ sender: NSTextField) {
let index = sidebarView.row(for: sender)
guard let item = sidebarView.item(atRow: index) as? OEDBCollection,
item.name != sender.stringValue
else { return }
if !sender.stringValue.isEmpty {
item.name = sender.stringValue
item.save()
}
reloadDataAndPreserveSelection()
}
func renameItem(at index: Int) {
guard let item = sidebarView.item(atRow: index) as? OESidebarItem else { return }
selectItem(item)
startEditingItem(item)
}
private func removeItem(at index: Int) {
guard let item = sidebarView.item(atRow: index) as? OEDBCollection,
item.isEditableInSidebar,
OEAlert.removeCollection(name: item.sidebarName).runModal() == .alertFirstButtonReturn else { return }
item.delete()
item.save()
// keep selection on last object if the one we removed was last
var index = index
if sidebarView.selectedRowIndexes.first != index {
index = sidebarView.selectedRowIndexes.first ?? index
}
else if index == sidebarView.numberOfRows - 1 {
index -= 1
}
reloadData()
sidebarView.selectRowIndexes([index], byExtendingSelection: false)
}
@objc func addCollection() -> OEDBCollection {
let newCollection = database!.addNewCollection(nil)
reloadData()
selectItem(newCollection)
startEditingItem(newCollection)
return newCollection
}
@IBAction func newCollection(_ sender: AnyObject?) {
_ = addCollection()
}
func newCollection(games: [OEDBGame]) {
let newCollection = database!.addNewCollection(nil)
newCollection.games = Set(games)
if games.count == 1 {
newCollection.name = games.first?.displayName
}
newCollection.save()
reloadData()
selectItem(newCollection)
startEditingItem(newCollection)
}
@objc func duplicateCollection(_ originalCollection: Any?) {
guard let originalCollection = originalCollection as? OEDBCollection,
let originalName = originalCollection.value(forKey: "name") as? String else { return }
let duplicateName = String.localizedStringWithFormat(NSLocalizedString("%@ copy", comment: "Duplicated collection name"), originalName)
let duplicateCollection = database!.addNewCollection(duplicateName)
duplicateCollection.games = originalCollection.games
duplicateCollection.save()
reloadDataAndPreserveSelection()
}
@objc func renameItem(for menuItem: NSMenuItem) {
renameItem(at: menuItem.tag)
}
@objc func removeItem(for menuItem: NSMenuItem) {
removeItem(at: menuItem.tag)
}
@objc func duplicateCollection(for menuItem: NSMenuItem) {
duplicateCollection(menuItem.representedObject)
}
@objc func toggleSystem(for menuItem: NSMenuItem) {
let system = menuItem.representedObject as? OEDBSystem
system?.toggleEnabledAndPresentError()
}
@objc func changeDefaultCore(_ sender: AnyObject?) {
guard let data = sender?.representedObject as? [AnyHashable : Any],
let systemIdentifier = data["system"] as? String,
let coreIdentifier = data["core"] as? String else { return }
let defaultCoreKey = "defaultCore.\(systemIdentifier)"
UserDefaults.standard.set(coreIdentifier, forKey: defaultCoreKey)
}
@IBAction func selectSystems(_ sender: Any?) {
guard let v = sender as? NSView else { return }
let selectLibraryController = AvailableLibrariesViewController()
let po = NSPopover()
po.behavior = .transient
po.contentSize = NSSize(width: 200, height: 500)
po.contentViewController = selectLibraryController
selectLibraryController.transparentBackground = true
po.show(relativeTo: v.frame, of: sidebarView, preferredEdge: .maxX)
}
@IBAction func showIssuesView(_ sender: NSButton) {
presentAsSheet(gameScannerViewController)
}
override func keyDown(with event: NSEvent) {
if event.keyCode == 51 || event.keyCode == 117,
let index = sidebarView.selectedRowIndexes.first,
let item = sidebarView.item(atRow: index) as? OESidebarItem,
item.isEditableInSidebar {
removeItem(at: index)
}
else if event.keyCode == kVK_Return,
let index = sidebarView.selectedRowIndexes.first,
let item = sidebarView.item(atRow: index) as? OESidebarItem,
item.isEditableInSidebar {
renameItem(at: index)
}
else {
super.keyDown(with: event)
}
}
}
// MARK: - Delegate
extension SidebarController: NSOutlineViewDelegate {
func outlineViewSelectionDidChange(_ notification: Notification) {
if let id = selectedSidebarItem?.sidebarID {
lastSidebarSelection = id
}
NotificationCenter.default.post(name: .OESidebarSelectionDidChange, object: self, userInfo: nil)
}
func outlineView(_ outlineView: NSOutlineView, shouldCollapseItem item: Any) -> Bool {
false
}
func outlineView(_ outlineView: NSOutlineView, shouldExpandItem item: Any) -> Bool {
true
}
}
// MARK: - DataSource
extension NSUserInterfaceItemIdentifier: ExpressibleByStringLiteral {
public init(stringLiteral: String) {
self.init(stringLiteral)
}
}
extension SidebarController: NSOutlineViewDataSource {
static let headerViewIdentifier: NSUserInterfaceItemIdentifier = "SidebarHeaderView"
static let itemViewIdentifier: NSUserInterfaceItemIdentifier = "SidebarItemView"
static let rowViewIdentifier: NSUserInterfaceItemIdentifier = "SidebarRowView"
func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
switch item {
case let group as SidebarGroupItem where group.autosaveName == .sidebarConsolesItem:
return systems[index]
case let group as SidebarGroupItem where group.autosaveName == .sidebarCollectionsItem:
return collections[index]
default:
return groups[index]
}
}
func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
(item as? OESidebarItem)?.isGroupHeaderInSidebar ?? false
}
func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
if item == nil {
return groups.count
}
guard
let _ = database,
let item = item as? SidebarGroupItem
else { return 0 }
switch item.autosaveName {
case .sidebarConsolesItem:
return systems.count
case .sidebarCollectionsItem:
return collections.count
}
}
func outlineView(_ outlineView: NSOutlineView, objectValueFor tableColumn: NSTableColumn?, byItem item: Any?) -> Any? {
(item as? OESidebarItem)?.sidebarName
}
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
guard let item = item as? OESidebarItem else { return nil }
var view: NSTableCellView?
if item.isGroupHeaderInSidebar {
view = outlineView.makeView(withIdentifier: Self.headerViewIdentifier, owner: self) as? NSTableCellView
if let group = item as? SidebarGroupItem,
let button = (view as? SidebarHeaderView)?.button {
switch group.autosaveName {
case .sidebarConsolesItem:
button.title = NSLocalizedString("Edit", tableName: "OEControls", comment: "")
button.image = nil
button.action = #selector(selectSystems(_:))
case .sidebarCollectionsItem:
button.title = ""
button.image = NSImage(named: "sidebar_add")
button.action = #selector(newCollection(_:))
}
}
} else {
view = outlineView.makeView(withIdentifier: Self.itemViewIdentifier, owner: self) as? NSTableCellView
view?.imageView?.image = item.sidebarIcon
view?.textField?.isSelectable = false
view?.textField?.isEditable = item.isEditableInSidebar
}
view?.textField?.stringValue = item.sidebarName
return view
}
func outlineView(_ outlineView: NSOutlineView, shouldShowOutlineCellForItem item: Any) -> Bool {
false
}
func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {
return 24
}
func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
item is SidebarGroupItem
}
func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool {
!(item is SidebarGroupItem)
}
// MARK: - Drag & Drop
func outlineView(_ outlineView: NSOutlineView, acceptDrop info: NSDraggingInfo, item: Any?, childIndex index: Int) -> Bool {
let pboard = info.draggingPasteboard
var collection: OEDBCollection?
if item is OEDBCollection {
collection = item as? OEDBCollection
}
else if item as? SidebarGroupItem == groups[1] {
// create a new collection with a single game
var name: String?
if pboard.types?.contains(.game) ?? false {
let games = pboard.readObjects(forClasses: [OEDBGame.self], options: nil) as! [OEDBGame]
if games.count == 1 {
name = games.first?.displayName
}
}
else {
let games = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL]
if games?.count == 1 {
name = games?.first?.deletingPathExtension().lastPathComponent.removingPercentEncoding
}
}
collection = database!.addNewCollection(name)
reloadData()
let index = outlineView.row(forItem: collection)
if index != NSNotFound {
outlineView.selectRowIndexes([index], byExtendingSelection: false)
NotificationCenter.default.post(name: .OESidebarSelectionDidChange, object: self, userInfo: nil)
}
}
if pboard.types?.contains(.game) ?? false {
guard let collection = collection else { return true }
// just add to collection
let games = pboard.readObjects(forClasses: [OEDBGame.self], options: nil) as! [OEDBGame]
collection.mutableGames?.addObjects(from: games)
collection.save()
}
else {
// import and add to collection
if let files = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL] {
let collectionID = collection?.permanentID
let importer = database!.importer
importer.importItems(at: files, intoCollectionWith: collectionID)
}
}
return true
}
func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
guard let types = info.draggingPasteboard.types,
types.contains(.game) || types.contains(.fileURL),
item is OESidebarItem else {
return []
}
// Ignore anything that is between two rows
if index != NSOutlineViewDropOnItemIndex {
return []
}
// Allow drop on systems group, ignoring which system exactly is highlighted
if item as? SidebarGroupItem == groups[0] || item is OEDBSystem {
// Disallow drop on systems for already imported games
if types.contains(.game) {
return []
}
// For new games, change drop target to the consoles header
outlineView.setDropItem(groups[0], dropChildIndex: NSOutlineViewDropOnItemIndex)
return .copy
}
// Allow drop on regular collections
if type(of: item as! OESidebarItem) === OEDBCollection.self {
return .copy
}
// Allow drop on the collections header and on smart collections
if item as? SidebarGroupItem == groups[1] || item is OEDBCollection || item is OEDBAllGamesCollection {
// Find the first regular collection in the list
var i = 0
for collection in 0..<collections.count {
if type(of: collections[collection]) === OEDBCollection.self {
break
}
i += 1
}
// Register as a drop just before that collection
outlineView.setDropItem(groups[1], dropChildIndex: i)
return .copy
}
// Everything else is disabled
return []
}
}
// MARK: - NSMenuDelegate
extension SidebarController: NSMenuDelegate {
func menuNeedsUpdate(_ menu: NSMenu) {
menu.removeAllItems()
let index = sidebarView.clickedRow
guard index != -1 else { return }
let item = sidebarView.item(atRow: index) as! OESidebarItem
var menuItem: NSMenuItem
if item is SidebarGroupItem {
return
}
else if item is OEDBSystem {
if let cores = OECorePlugin.corePlugins(forSystemIdentifier: (item as! OEDBSystem).systemIdentifier),
cores.count > 1 {
let systemIdentifier = (item as! OEDBSystem).systemIdentifier!
let defaultCoreKey = "defaultCore.\(systemIdentifier)"
let defaultCoreIdentifier = UserDefaults.standard.object(forKey: defaultCoreKey) as? String
let coreItem = NSMenuItem()
coreItem.title = NSLocalizedString("Default Core", comment: "Sidebar context menu item to pick default core for a system")
let submenu = NSMenu()
cores.forEach { core in
let coreName = core.displayName
let systemIdentifier = (item as! OEDBSystem).systemIdentifier!
let coreIdentifier = core.bundleIdentifier
let item = NSMenuItem()
item.title = coreName ?? ""
item.action = #selector(changeDefaultCore(_:))
item.state = coreIdentifier == defaultCoreIdentifier ? .on : .off
item.representedObject = ["core": coreIdentifier,
"system": systemIdentifier]
submenu.addItem(item)
}
coreItem.submenu = submenu
menu.addItem(coreItem)
}
menuItem = NSMenuItem()
menuItem.title = .localizedStringWithFormat(NSLocalizedString("Hide \"%@\"", comment: ""), (item as! OEDBSystem).name)
menuItem.action = #selector(toggleSystem(for:))
menuItem.representedObject = item
menu.addItem(menuItem)
}
else if item is OEDBCollection || item is OEDBAllGamesCollection {
if item.isEditableInSidebar {
menuItem = NSMenuItem()
menuItem.title = .localizedStringWithFormat(NSLocalizedString("Rename \"%@\"", comment: "Rename collection sidebar context menu item"), item.sidebarName)
menuItem.action = #selector(renameItem(for:))
menuItem.tag = index
menu.addItem(menuItem)
menuItem = NSMenuItem()
menuItem.title = NSLocalizedString("Duplicate Collection", comment: "")
menuItem.action = #selector(duplicateCollection(for:))
menuItem.representedObject = item
menu.addItem(menuItem)
menuItem = NSMenuItem()
menuItem.title = NSLocalizedString("Delete Collection", comment: "")
menuItem.action = #selector(removeItem(for:))
menuItem.tag = index
menu.addItem(menuItem)
menu.addItem(NSMenuItem.separator())
}
menuItem = NSMenuItem()
menuItem.title = NSLocalizedString("New Collection", comment: "")
menuItem.action = #selector(newCollection(_:))
menu.addItem(menuItem)
}
}
}
class SidebarGroupItem: NSObject, OESidebarItem {
enum AutosaveName: String {
case sidebarConsolesItem, sidebarCollectionsItem
}
var name: String
var autosaveName: AutosaveName
init(name: String, autosaveName: AutosaveName) {
self.name = name
self.autosaveName = autosaveName
}
var sidebarIcon: NSImage?
var sidebarName: String {
return self.name
}
var sidebarID: String?
var viewControllerClassName: String?
var isSelectableInSidebar: Bool = false
var isEditableInSidebar: Bool = false
var isGroupHeaderInSidebar: Bool = true
var hasSubCollections: Bool = false
}
extension Key {
static let lastSidebarSelection: Key = "lastSidebarSelection"
}
| [
-1
] |
bbe62e2e3b0c6b65db64830a58a3519c45a3f502 | b42d0373213bf8d0da770a7c6e5bec6a75058766 | /ControlYourMoney/modules/MainPage/MainTableCreditModul.swift | df8ed7d6b42498a81ca1ccb28a7fc01400616fb9 | [] | no_license | miciny/ControlYourMoney | eff62cc16f0673072a40ee85ba89d43f4af23fcd | b19b41ee289ffeeb5f5b886d3ed191ab35004fa9 | refs/heads/master | 2021-01-21T04:44:36.668157 | 2017-06-30T04:13:39 | 2017-06-30T04:13:39 | 60,065,056 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,051 | swift | //
// MainTableCreditModul.swift
// ControlYourMoney
//
// Created by maocaiyuan on 16/5/11.
// Copyright © 2016年 maocaiyuan. All rights reserved.
//
import UIKit
class MainTableCreditModul: NSObject {
let periods: String! //剩余还款期数
let allPeriods: String! //总还款期数
let number: String! //每期还款
let title: String!
let all: String! //还款总额
let time: String! //下期还款时间
let date: String!
let index: Int! //按时间排序之后的index
let account : String!
let type: String!
init(periods: String!, number: String!, title: String!, all: String!, time: String!, date: String!, account: String!, type: String!, allPeriods: String!, index: Int!){
self.periods = periods
self.number = number //
self.all = all //
self.title = title
self.time = time
self.date = date
self.account = account
self.type = type
self.allPeriods = allPeriods
self.index = index
}
}
| [
-1
] |
08eb58ac04500f48cf54a7e0f677202ec5413e26 | 9066e89e4f913fe603e229cc8a1be4d501d83986 | /ActionExtension/ActionViewController.swift | 5d902c8022ec227b4b9e5ae386a087651d875dbf | [] | no_license | amazedkoumei/mix-and-match | 2e3e92ed0b18ab3c6314023ff023ddea58c1fd3c | 5195aa822422495fb30f8d37e00a26bff0a1742e | refs/heads/master | 2021-01-22T05:19:50.083560 | 2014-12-03T13:36:57 | 2014-12-03T13:36:57 | 27,488,937 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,519 | swift | //
// ActionViewController.swift
// ActionExtension
//
// Created by amazedkoumei on 2014/12/03.
// Copyright (c) 2014年 amazedkoumei. All rights reserved.
//
import UIKit
import MobileCoreServices
import EmbeddedFramework
class ActionViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
var swift = SwiftClass()
swift.run()
var objc = ObjcClass()
objc.run()
// Get the item[s] we're handling from the extension context.
// For example, look for an image and place it into an image view.
// Replace this with something appropriate for the type[s] your extension supports.
var imageFound = false
for item: AnyObject in self.extensionContext!.inputItems {
let inputItem = item as NSExtensionItem
for provider: AnyObject in inputItem.attachments! {
let itemProvider = provider as NSItemProvider
if itemProvider.hasItemConformingToTypeIdentifier(kUTTypeImage as NSString) {
// This is an image. We'll load it, then place it in our image view.
weak var weakImageView = self.imageView
itemProvider.loadItemForTypeIdentifier(kUTTypeImage as NSString, options: nil, completionHandler: { (image, error) in
if image != nil {
NSOperationQueue.mainQueue().addOperationWithBlock {
if let imageView = weakImageView {
imageView.image = image as? UIImage
}
}
}
})
imageFound = true
break
}
}
if (imageFound) {
// We only handle one image, so stop looking for more.
break
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func done() {
// Return any edited content to the host app.
// This template doesn't do anything, so we just echo the passed in items.
self.extensionContext!.completeRequestReturningItems(self.extensionContext!.inputItems, completionHandler: nil)
}
}
| [
276221
] |
f18294e2ecfafc326b7a8c30a2bd59bcd8231f7a | 90bf60ad9364735c827b23a98bf52591f1311adb | /CalFitness-iOS/CalFitness/CFConfigManager.swift | 7d3fb1511adddbdc623840d010e72fb4bb094454 | [] | no_license | mingyang511/CalFitness | 953becb2f94fcc4b4062a458eb79eb907dbdf7af | ee7a8434915be2ea273e278a1e3e10d1e312d085 | refs/heads/master | 2021-01-11T22:39:09.259989 | 2017-01-21T15:36:59 | 2017-01-21T15:36:59 | 79,009,300 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 419 | swift | //
// CFConfigManager.swift
// CalFitnesss
//
// Created by Lee on 1/15/17.
// Copyright © 2017 BerkeleyIEOR. All rights reserved.
//
import Foundation
import Parse
class CFConfigManager
{
// Method to fetch config from server
class func fetchConfigFromServer()
{
PFConfig.getConfigInBackgroundWithBlock
{
(config: PFConfig?, error: NSError?) -> Void in
}
}
}
| [
-1
] |
ed7613424114bd59df0f4c6a34c4cb5c024df1af | 0f1aca14b76420e9855197cb1cb14efc2f1ecd6f | /Picturize/Model/Videos.swift | 10b26880aab032ca901fcf4d7eccd72492073fce | [] | no_license | 7dp/Picturize | f9deb9829f057a93296c676a868be46c08e048a4 | ae13a5ca08798b8783e1a1db2025cc6088bb8956 | refs/heads/master | 2022-11-27T20:40:59.840079 | 2020-08-04T04:36:46 | 2020-08-04T04:36:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,968 | swift | //
// Videos.swift
// Picturize
//
// Created by Crocodic on 04/07/20.
// Copyright © 2020 WradDev. All rights reserved.
//
import Foundation
struct Videos: Decodable {
let page: Int
let perPage: Int
let totalResults: Int
let url: String?
let videos: [Video]
enum CodingKeys: String, CodingKey {
case page = "page"
case perPage = "per_page"
case totalResults = "total_results"
case url = "url"
case videos = "videos"
}
}
struct Video: Decodable {
let id: Int
let width: Int
let height: Int
let url: String
let image: String
let duration: Int
let user: User?
let videoFiles: [VideoFile]?
let videoPictures: [VideoPicture]?
enum CodingKeys: String, CodingKey {
case id = "id"
case width = "width"
case height = "height"
case url = "url"
case image = "image"
case duration = "duration"
case user = "user"
case videoFiles = "video_files"
case videoPictures = "video_pictures"
}
}
struct User: Decodable {
let id: Int
let name: String
let url: String
enum CodingKeys: String, CodingKey {
case id = "id"
case name = "name"
case url = "url"
}
}
struct VideoFile: Decodable {
let id: Int
let quality: Quality?
let fileType: FileType?
let width: Int?
let height: Int?
let link: String?
enum CodingKeys: String, CodingKey {
case id = "id"
case quality = "quality"
case fileType = "file_type"
case width = "width"
case height = "height"
case link = "link"
}
}
enum FileType: String, Decodable {
case videoMp4 = "video/mp4"
}
enum Quality: String, Decodable {
case hd = "hd"
case hls = "hls"
case sd = "sd"
case mobile = "mobile"
}
struct VideoPicture: Decodable {
let id: Int?
let picture: String?
let nr: Int?
enum CodingKeys: String, CodingKey {
case id = "id"
case picture = "picture"
case nr = "nr"
}
}
/* MARK: JSON Data
{
"page": 1,
"per_page": 15,
"total_results": 23624,
"url": "https://www.pexels.com/videos/",
"videos": [
{
"full_res": null,
"tags": [],
"id": 3363557,
"width": 1920,
"height": 1080,
"url": "https://www.pexels.com/video/a-couple-in-a-passionate-expression-of-love-3363557/",
"image": "https://images.pexels.com/videos/3363557/free-video-3363557.jpg?fit=crop&w=1200&h=630&auto=compress&cs=tinysrgb",
"duration": 27,
"user": {
"id": 801145,
"name": "Lay-Z Owl",
"url": "https://www.pexels.com/@lay-z-owl-801145"
},
"video_files": [
{
"id": 322188,
"quality": "hd",
"file_type": "video/mp4",
"width": 1920,
"height": 1080,
"link": "https://player.vimeo.com/external/378622664.hd.mp4?s=57281c6d638ceac4b475383d2a75e9cc1808b483&profile_id=175&oauth2_token_id=57447761"
},
[...]
],
"video_pictures": [
{
"id": 727195,
"picture": "https://images.pexels.com/videos/3363557/pictures/preview-0.jpg",
"nr": 0
},
[...]
]
},
[...]
]
}
*/
| [
-1
] |
9cd8fcfdbedec1055d0b12cb7040785da9dc5e69 | 4c3d083f5a55a970d579ab10c7e144bc858b6b5c | /BarButtonBlockActionItem.swift | 3eef78bea4feb28cef62ee34d177c4e395a1ec78 | [] | no_license | richrad/BarButtonBlockActionItem | e9325c877bd24d7472b5f28f7ab26559250af98e | e81455308b23586962c7220399764e054d6ba1c5 | refs/heads/master | 2021-01-10T05:10:30.312194 | 2015-05-22T19:09:40 | 2015-05-22T19:09:40 | 36,090,492 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 663 | swift | import UIKit
class BarButtonBlockActionItem: UIBarButtonItem {
private var blockAction: (() -> ())?
override init() {
super.init()
}
init(barButtonSystemItem systemItem: UIBarButtonSystemItem, blockAction block:(() -> ())?) {
super.init(barButtonSystemItem: systemItem, target: nil, action: Selector("performBlockAction:"))
self.target = self
self.blockAction = block
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func performBlockAction(sender: AnyObject) {
if let blockAction = blockAction {
blockAction()
}
}
}
| [
-1
] |
1b3eed2a28938b192882b58cc376a6728d36e990 | f3127d2080040db1f48cb88c510507d0c0fe13e8 | /LBTAYouTubeTutorial/App flow/Home/HomeController.swift | a76e58b1a85bc66eca909c381d947f370c99fcd6 | [] | no_license | iamhspatel2160419/LBTAYouTubeTutorial | 51cd603785d6ecba8599b1154bbe16ec97336c73 | c3ddfa36058f76105db4d20ebc08b771e01873cf | refs/heads/master | 2021-04-03T08:47:36.391024 | 2017-11-17T23:43:40 | 2017-11-17T23:43:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,669 | swift | //
// ViewController.swift
// LBTAYouTubeTutorial
//
// Created by Kevin Quisquater on 19/10/2017.
// Copyright © 2017 Kevin Quisquater. All rights reserved.
//
import UIKit
class HomeController: UICollectionViewController {
let menuBar: MenuBar = {
let menuBar = MenuBar()
return menuBar
}()
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
registerCells()
}
private func setupViews() {
collectionView?.backgroundColor = .white
collectionView?.contentInset = UIEdgeInsets(top: 50, left: 0, bottom: 0, right: 0)
collectionView?.scrollIndicatorInsets = UIEdgeInsets(top: 50, left: 0, bottom: 0, right: 0)
setupNavigationBar()
setupMenuBar()
}
private func setupMenuBar() {
view.addSubview(menuBar)
menuBar.anchor(view.topAnchor, left: view.leftAnchor, bottom: nil, right: view.rightAnchor, topConstant: 0, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 50)
}
private func setupNavigationBar() {
navigationController?.navigationBar.isTranslucent = false
let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.width - 20, height: view.frame.height))
titleLabel.text = "Home"
titleLabel.textColor = .white
titleLabel.font = .systemFont(ofSize: 20)
navigationItem.titleView = titleLabel
let searchIcon = #imageLiteral(resourceName: "search_icon").withRenderingMode(.alwaysOriginal)
let searchBarButtonItem = UIBarButtonItem(image: searchIcon, style: .plain, target: self, action: #selector(handleSearch))
let settingsIcon = #imageLiteral(resourceName: "nav_more_icon").withRenderingMode(.alwaysOriginal)
let settingsBarButtonItem = UIBarButtonItem(image: settingsIcon, style: .plain, target: self, action: #selector(handleOpenSettings))
navigationItem.rightBarButtonItems = [settingsBarButtonItem, searchBarButtonItem]
}
private func registerCells() {
collectionView?.register(VideoCell.self, forCellWithReuseIdentifier: VideoCell.reuseIdentifier)
}
@objc private func handleSearch() {
}
let settingsLauncher = SettingsLauncher()
@objc private func handleOpenSettings() {
settingsLauncher.openSettings()
}
}
extension HomeController {
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 5
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: VideoCell.reuseIdentifier, for: indexPath)
return cell
}
}
extension HomeController: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let cellHeight = VideoCellMetrics.cellHeight(viewWidth: view.frame.width)
return CGSize(width: view.frame.width, height: cellHeight)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
override func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) {
collectionView?.collectionViewLayout.invalidateLayout()
view.setNeedsDisplay()
}
}
| [
-1
] |
0cd9b323d8e80fa6abc6229cd636d17c1bf02e8a | 2be7c323f0400ff57ceacaa6671202681caf8103 | /Eventlisapp/ViewModels/EditEventViewModel.swift | b655b79389de8bffec3a6a437571cf4797bd248a | [] | no_license | medamine95/Eventlisapp | 8e4e9b6327eff6bcbe6b27c01bea4a9d52cb2275 | 4f45ecfc26953bcb7168f16d92bccbde81ecc8d3 | refs/heads/master | 2022-11-28T16:15:10.808265 | 2020-08-04T11:07:57 | 2020-08-04T11:07:57 | 272,956,978 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,277 | swift | //
// EditEventViewModel.swift
// Eventlisapp
//
// Created by MacBook Pro on 8/4/20.
// Copyright © 2020 Mint. All rights reserved.
//
import Foundation
import UIKit
final class EditEventViewModel{
let title = "Edit"
var onUpdate :() -> Void = {}
///embded enum
enum Cell {
case titleSubtitle(TitleSubtitleCellViewModel)
}
private(set) var cells: [EditEventViewModel.Cell] = []
weak var coordinator: EditEventCoordinator?
/// referneces
private var nameCellViewModel:TitleSubtitleCellViewModel?
private var dateCellViewModel:TitleSubtitleCellViewModel?
private var backgroundImageCellViewModel:TitleSubtitleCellViewModel?
private let cellBuilder : EventsCellBuilder
private let coreDataManager:CoreDataManager
private let event:Event
///Code cleaning and redendcy ceaning , coredata service if needed
lazy var dateFormatter:DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd.MM.yyy"
return dateFormatter }()
init(event:Event,cellBuilder:EventsCellBuilder, coreDataManager:CoreDataManager = CoreDataManager.shared) {
self.cellBuilder = cellBuilder
self.coreDataManager = coreDataManager
self.event = event
}
func viewDidload(){
setupCells()
onUpdate()
}
func viewDidDisappear() {
coordinator?.didFinsihAddEvent()
}
func numberOfRows() -> Int{
return cells.count
}
func cell(for indexPath:IndexPath) -> Cell {
return cells[indexPath.row]
}
func tappedDone(){
//extract info from cell view models and save in core date
// tell coordinator to dismiss
guard let name = nameCellViewModel?.subtitle, let dateString = dateCellViewModel?.subtitle, let image = backgroundImageCellViewModel?.image, let date = dateFormatter.date(from: dateString) else {return}
coreDataManager.updateEvent(event:event, name: name, date: date, image: image)
coordinator?.didFinishUpdateEvent()
print("tapped done")
}
func updateCell(indexPath:IndexPath,subtitle:String){
switch cells[indexPath.row] {
case .titleSubtitle(let titleSubtitleCellViewModel):
titleSubtitleCellViewModel.update(subtitle)
break
}
}
///when tapping the image
func didSelectRow(at indexPath:IndexPath){
switch cells[indexPath.row] {
case .titleSubtitle(let titleSubtitleCellViewModel):
guard titleSubtitleCellViewModel.type == .image else{
return
}
coordinator?.showImagePicker{
image in
titleSubtitleCellViewModel.update(image)
//do somthing in this closure
}
}
}
deinit {
print("deinit from addeventviewmodel")
}
}
/// setup views and cells progrmaticlly
private extension EditEventViewModel {
func setupCells() {
nameCellViewModel = cellBuilder.makeTitleSubtitleCellViewModel(.text)
dateCellViewModel = cellBuilder.makeTitleSubtitleCellViewModel(.date){[weak self] in
self?.onUpdate()
}
backgroundImageCellViewModel = cellBuilder.makeTitleSubtitleCellViewModel(.image){
[weak self] in
self?.onUpdate()
}
///safe unwrapping
guard let nameCellViewModel = nameCellViewModel, let dateCellViewModel = dateCellViewModel, let backgroundImageCellViewModel = backgroundImageCellViewModel else {return}
cells = [
.titleSubtitle(
nameCellViewModel
),
.titleSubtitle(
dateCellViewModel),
.titleSubtitle(
backgroundImageCellViewModel)]
guard let name = event.name, let date = event.date, let imageData = event.image, let image = UIImage(data: imageData) else {return}
nameCellViewModel.update(name)
dateCellViewModel.update(date)
backgroundImageCellViewModel.update(image)
}
}
| [
-1
] |
42b74a33cef005454d88aef4193ed9f11d0ebb65 | 081385122ff97429707428dcf00dd16be5dc6f24 | /QQMussic/Classes/Tools/JGCALayer-extension.swift | 99e6e12da9407e404347577e120fe39cebe727f7 | [
"Apache-2.0"
] | permissive | xutongle/JG-QQMusic | cc02b11eef3904bc9b4f6991f1b42d42f67d18cb | 647c9ef07238860d68a4c3c99f06faed1c03425d | refs/heads/master | 2021-01-18T19:00:24.780621 | 2016-11-28T12:59:25 | 2016-11-28T12:59:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,102 | swift | //
// JGCALayer-extension.swift
// QQMussic
//
// Created by 刘军 on 2016/11/27.
// Copyright © 2016年 刘军. All rights reserved.
//
import UIKit
extension CALayer {
/// 停止动画
func pauseAnim() {
let pausedTime = convertTime(CACurrentMediaTime(), from: nil)
speed = 0.0
timeOffset = pausedTime
}
/// 从停止的位置开始 恢复动画
func resumeAnim() {
let pausedTime = timeOffset
speed = 1.0
timeOffset = 0.0
beginTime = 0.0
let currentTime = convertTime(CACurrentMediaTime(), from: nil)
beginTime = currentTime - pausedTime
}
}
extension CAAnimation{
class func rotationAnim()->CAAnimation{
//1、创建动画
let rotationAni = CABasicAnimation(keyPath: "transform.rotation.z")
//2、设置动画参数
rotationAni.fromValue = 0
rotationAni.toValue = M_PI*2
rotationAni.repeatCount = MAXFLOAT
rotationAni.duration = 25 //30秒执行完这个动画
return rotationAni
}
}
| [
-1
] |
d9e9fe55de5817ef229befdbe9250f4dfc431e6a | 6ce95e33f67d9c5a755ca729866978ef8d154bee | /Rex/Projects/CreateProjectVC.swift | e86728d17a862d69251f64034536d1894638ee7f | [] | no_license | avriy/Rex | c465c1b99ea1c1092e10db46971c731c641aa929 | 1987418c7afce5d72dae9197cd5185d007c465fb | refs/heads/master | 2020-02-26T15:51:24.437457 | 2017-10-09T21:16:47 | 2017-10-09T21:16:47 | 95,672,088 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,323 | swift | //
// CreateProjectVC.swift
// Rex
//
// Created by Artemiy Sobolev on 09/08/2017.
// Copyright © 2017 splyshka. All rights reserved.
//
import Cocoa
class CreateProjectVC: NSViewController, ModernView {
@IBOutlet weak var textField: NSTextField!
@IBOutlet weak var createButton: NSButton!
@IBOutlet weak var projectImage: NSImageView!
@IBOutlet weak var progressIndicator: NSProgressIndicator!
@objc dynamic var viewModel: CreateProjectViewModel!
override func viewDidLoad() {
super.viewDidLoad()
textField.bind(.value, to: self, withKeyPath: #keyPath(viewModel.name),
options: [.continuouslyUpdatesValue : true, .nullPlaceholder : "New project name"])
projectImage.bind(.value, to: self, withKeyPath: #keyPath(viewModel.image))
textField.bind(.enabled, to: self, withKeyPath: #keyPath(viewModel.isProcessing),
options: [.valueTransformerName : NSValueTransformerName.negateBooleanTransformerName])
createButton.bind(.enabled, to: self, withKeyPath: #keyPath(viewModel.canCreateProject))
}
override func viewDidAppear() {
super.viewDidAppear()
apply(windowStyle: .dialog)
}
@objc func create() {
let progress = viewModel.create { [weak self] in
self?.view.window?.close()
}
progressIndicator.bind(to: progress)
}
}
| [
-1
] |
b699ebed3368da642679d46f9f74c9e820397e1c | 6fdbc546b1ad161e94d2b778f577551edb1b1989 | /Sources/Base/Animations/NVActivityIndicatorAnimationBallBeat.swift | 4738a179da08a1bf49fe6b2761b2c5ccd2693e9c | [
"MIT"
] | permissive | woojinlee/NVActivityIndicatorView | 7fb8db09b48cc22d729660323f5cf81d0ea89cc8 | 380c0abc6b286d66de5b6fa1bbf98ead5e508a25 | refs/heads/master | 2023-01-14T13:21:25.149792 | 2020-11-26T03:49:52 | 2020-11-26T03:49:52 | 288,935,310 | 0 | 0 | MIT | 2020-08-20T07:19:27 | 2020-08-20T07:19:27 | null | UTF-8 | Swift | false | false | 3,193 | swift | //
// NVActivityIndicatorAnimationBallBeat.swift
// NVActivityIndicatorView
//
// The MIT License (MIT)
// Copyright (c) 2016 Vinh Nguyen
// 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.
//
#if canImport(UIKit)
import UIKit
class NVActivityIndicatorAnimationBallBeat: NVActivityIndicatorAnimationDelegate {
func setUpAnimation(in layer: CALayer, size: CGSize, color: UIColor) {
let circleSpacing: CGFloat = 4
let circleSize = (size.width - circleSpacing * 2) / 3
let x = (layer.bounds.size.width - size.width) / 2
let y = (layer.bounds.size.height - circleSize) / 2
let duration: CFTimeInterval = 1.4
let beginTime = CACurrentMediaTime()
let beginTimes = [0.35, 0, 0.35]
// Scale animation
let scaleAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
scaleAnimation.keyTimes = [0, 0.5, 1]
scaleAnimation.values = [1, 0.75, 1]
scaleAnimation.duration = duration
// Opacity animation
let opacityAnimation = CAKeyframeAnimation(keyPath: "opacity")
opacityAnimation.keyTimes = [0, 0.5, 1]
opacityAnimation.values = [1, 0.2, 1]
opacityAnimation.duration = duration
// Aniamtion
let animation = CAAnimationGroup()
animation.animations = [scaleAnimation, opacityAnimation]
animation.timingFunction = CAMediaTimingFunction(name: .linear)
animation.duration = duration
animation.repeatCount = HUGE
animation.isRemovedOnCompletion = false
// Draw circles
for i in 0 ..< 3 {
let circle = NVActivityIndicatorShape.circle.layerWith(size: CGSize(width: circleSize, height: circleSize), color: color)
let frame = CGRect(x: x + circleSize * CGFloat(i) + circleSpacing * CGFloat(i),
y: y,
width: circleSize,
height: circleSize)
animation.beginTime = beginTime + beginTimes[i]
circle.frame = frame
circle.add(animation, forKey: "animation")
layer.addSublayer(circle)
}
}
}
#endif
| [
213175,
213176,
213177,
213179,
177366,
177367,
177368,
177369,
177370,
177371,
177372,
177373,
294141,
177375,
177376,
177377,
177378,
177381,
177383,
294146,
294147,
152826,
152827,
152828,
152829,
294148,
294143,
294144,
152832,
294145,
152834,
152836,
294149,
152837,
152839,
152840,
152841,
294150,
152843,
294153,
152845,
294154,
294155,
294156,
294160,
294151,
294163,
294159,
294165,
294166,
294167,
294168,
294164,
294170,
12570,
294172,
12573,
12574,
12572,
12575,
12576,
12578,
12577,
12580,
12581,
12583,
12584,
12585,
12586,
12589,
12590,
12593,
12594,
12595,
12596,
12597,
12598,
12599,
12601,
12603,
152830,
152831
] |
d570401c2fceba0a4852b27b8ca5423a62d9436e | 43da7214c9f2d17fa530c5aba27f27d0965f928c | /SocialExplorer/FoursquareClient.swift | 35798b250412cbb059bf05dd83aa832829fe08f9 | [] | no_license | humberaquino/SocialExplorer | d041132608653dbda11e50c1c9de7074cc4a95ef | 09a7b9c47e08bd54e74a85f696f77008ca82caf2 | refs/heads/master | 2021-01-21T05:37:20.826407 | 2015-05-15T00:18:21 | 2015-05-15T00:18:21 | 35,582,216 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,255 | swift | //
// FoursquareClient.swift
// SocialExplorer
//
// Created by Humberto Aquino on 5/13/15.
// Copyright (c) 2015 Humberto Aquino. All rights reserved.
//
import Foundation
import CoreLocation
import Alamofire
import SwiftyJSON
import ObjectMapper
// Foursquare API client. Handles request and gets JSON or DTOs as results
class FoursquareClient: BaseSocialClient {
let userSettings = UserSettings.sharedInstance()
override func serviceActive() -> Bool {
return userSettings.foursquare.isServiceActive()
}
// Get the list of venues for a particulate coordinate
func requestVenues(coordiante: CLLocationCoordinate2D, completion: (foursquareLocationDTOList: [FoursquareLocationDTO]!, error: NSError!) -> Void) {
let latitudeAndLongitude = "\(coordiante.latitude),\(coordiante.longitude)"
let parameters: [String: AnyObject] = [
ParameterKeys.LatitudeAndLongitude: latitudeAndLongitude,
ParameterKeys.ClientId: Config.Foursquare.ClientId,
ParameterKeys.ClientSecret: Config.Foursquare.ClientSecret,
ParameterKeys.VersionAPI: Config.Foursquare.VersionAPI,
ParameterKeys.Limit: Config.Foursquare.SearchVenueLimit,
ParameterKeys.Accuracy: Config.Foursquare.Accuracy
]
// 1. Request the location list for the provided coordinate
Alamofire.request(.GET, URI.VenueSearch, parameters: parameters).response {
(request, response, data, error) in
if let error = error {
// Request error
completion(foursquareLocationDTOList: nil, error: error)
return
}
// 2. Check for responses taht are valid but return errors. E.g. limit exceeded
self.updateLimitCount(response)
if let remainingRequests = self.xRatelimitRemaining {
if remainingRequests <= 0 {
// Error: Request limit exceeded for client
let error = ErrorUtils.errorForLimitExceeded()
completion(foursquareLocationDTOList: nil, error: error)
return
}
}
// 3. Parse the "data" element
let jsonData = data as! NSData
let json = JSON(data: jsonData)
let venuesList = json["response"]["venues"].arrayValue
var foursquareLocationDTOList: [FoursquareLocationDTO] = []
for venueElement in venuesList {
let venueElementString = venueElement.rawString()
if let foursquareLocationDTO = Mapper<FoursquareLocationDTO>().map(venueElementString!) {
foursquareLocationDTOList.append(foursquareLocationDTO)
} else {
logger.warning("Foursquare location skipped")
}
}
// Success. Let's map the JSON response and complete
completion(foursquareLocationDTOList: foursquareLocationDTOList, error: nil)
}
}
// Get the list of photos for a particular venue
func requestVenueInfoBy(venueId: String, completion: (foursquarePhotoDTOList: [FoursquarePhotoDTO]!, error: NSError!) -> Void) {
let parameters: [String: AnyObject] = [
ParameterKeys.ClientId: Config.Foursquare.ClientId,
ParameterKeys.ClientSecret: Config.Foursquare.ClientSecret,
ParameterKeys.VersionAPI: Config.Foursquare.VersionAPI,
ParameterKeys.Limit: Config.Foursquare.SearchVenuePhotoLimit,
]
// 1. Do the request to get the list of medias for the locationId
Alamofire.request(.GET, URI.VenueMediaPhotos(venueId), parameters: parameters).response {
(request, response, data, error) in
if let error = error {
// Request error
completion(foursquarePhotoDTOList: nil, error: error)
return
}
// 2. Check for responses taht are valid but return errors. E.g. limit exceeded
self.updateLimitCount(response)
if let remainingRequests = self.xRatelimitRemaining {
if remainingRequests <= 0 {
// Error: Request limit exceeded for client
let error = ErrorUtils.errorForLimitExceeded()
completion(foursquarePhotoDTOList: nil, error: error)
return
}
}
// 3. Parse the "response" element
let jsonData = data as! NSData
let json = JSON(data: jsonData)
let jsonPhotoList = json["response"]["photos"]["items"].arrayValue
// 4. Add every element in the data array
var result:[FoursquarePhotoDTO] = []
for photoElement in jsonPhotoList {
let photoElementString = photoElement.rawString()
if let foursquareVenueDTO = Mapper<FoursquarePhotoDTO>().map(photoElementString!) {
result.append(foursquareVenueDTO)
} else {
logger.warning("Foursquare recent media skipped")
}
}
// Success
completion(foursquarePhotoDTOList: result, error: nil)
}
}
}
// MARK: - Constants
extension FoursquareClient {
struct ParameterKeys {
static let LatitudeAndLongitude = "ll"
static let VersionAPI = "v"
static let ClientId = "client_id"
static let ClientSecret = "client_secret"
static let Limit = "limit"
static let Accuracy = "llAcc"
}
struct ResponseKeys {
static let Data = "data"
static let Id = "id"
}
struct URI {
static let BaseSecureURL = "https://api.foursquare.com/v2"
static let VenueSearch = "\(BaseSecureURL)/venues/search"
static func VenueMediaPhotos(venueId: String) -> String {
return "\(BaseSecureURL)/venues/\(venueId)/photos"
}
}
} | [
-1
] |
f60a9b3ec721ffba9246e48b7c05a39532c164cc | d6de16bac7032426a7127061e3c66c394e59e896 | /SportApp/SportApp/Models/LequesDetails/LastResultModels/Events.swift | fa503bcc37082e09f788a0d4a0ca75f5e5090a73 | [] | no_license | HebaIsmailNasrAllah/SportsApp | 298518e63e19fe92d8b34568167abc62411522d7 | 7bae31882474ef1850ae71856d275aa0963bf28a | refs/heads/main | 2023-04-03T20:44:42.822740 | 2021-04-20T19:28:34 | 2021-04-20T19:28:34 | 359,101,570 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 10,777 | swift | /*
Copyright (c) 2021 Swift Models Generated from JSON powered by http://www.json4swift.com
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.
For support, please feel free to contact me at https://www.linkedin.com/in/syedabsar
*/
import Foundation
struct Events : Codable {
let idEvent : String?
let idSoccerXML : String?
let idAPIfootball : String?
let strEvent : String?
let strEventAlternate : String?
let strFilename : String?
let strSport : String?
let idLeague : String?
let strLeague : String?
let strSeason : String?
let strDescriptionEN : String?
let strHomeTeam : String?
let strAwayTeam : String?
let intHomeScore : String?
let intRound : String?
let intAwayScore : String?
let intSpectators : String?
let strOfficial : String?
let strHomeGoalDetails : String?
let strHomeRedCards : String?
let strHomeYellowCards : String?
let strHomeLineupGoalkeeper : String?
let strHomeLineupDefense : String?
let strHomeLineupMidfield : String?
let strHomeLineupForward : String?
let strHomeLineupSubstitutes : String?
let strHomeFormation : String?
let strAwayRedCards : String?
let strAwayYellowCards : String?
let strAwayGoalDetails : String?
let strAwayLineupGoalkeeper : String?
let strAwayLineupDefense : String?
let strAwayLineupMidfield : String?
let strAwayLineupForward : String?
let strAwayLineupSubstitutes : String?
let strAwayFormation : String?
let intHomeShots : String?
let intAwayShots : String?
let strTimestamp : String?
let dateEvent : String?
let dateEventLocal : String?
let strTime : String?
let strTimeLocal : String?
let strTVStation : String?
let idHomeTeam : String?
let idAwayTeam : String?
let strResult : String?
let strVenue : String?
let strCountry : String?
let strCity : String?
let strPoster : String?
let strSquare : String?
let strFanart : String?
let strThumb : String?
let strBanner : String?
let strMap : String?
let strTweet1 : String?
let strTweet2 : String?
let strTweet3 : String?
let strVideo : String?
let strStatus : String?
let strPostponed : String?
let strLocked : String?
enum CodingKeys: String, CodingKey {
case idEvent = "idEvent"
case idSoccerXML = "idSoccerXML"
case idAPIfootball = "idAPIfootball"
case strEvent = "strEvent"
case strEventAlternate = "strEventAlternate"
case strFilename = "strFilename"
case strSport = "strSport"
case idLeague = "idLeague"
case strLeague = "strLeague"
case strSeason = "strSeason"
case strDescriptionEN = "strDescriptionEN"
case strHomeTeam = "strHomeTeam"
case strAwayTeam = "strAwayTeam"
case intHomeScore = "intHomeScore"
case intRound = "intRound"
case intAwayScore = "intAwayScore"
case intSpectators = "intSpectators"
case strOfficial = "strOfficial"
case strHomeGoalDetails = "strHomeGoalDetails"
case strHomeRedCards = "strHomeRedCards"
case strHomeYellowCards = "strHomeYellowCards"
case strHomeLineupGoalkeeper = "strHomeLineupGoalkeeper"
case strHomeLineupDefense = "strHomeLineupDefense"
case strHomeLineupMidfield = "strHomeLineupMidfield"
case strHomeLineupForward = "strHomeLineupForward"
case strHomeLineupSubstitutes = "strHomeLineupSubstitutes"
case strHomeFormation = "strHomeFormation"
case strAwayRedCards = "strAwayRedCards"
case strAwayYellowCards = "strAwayYellowCards"
case strAwayGoalDetails = "strAwayGoalDetails"
case strAwayLineupGoalkeeper = "strAwayLineupGoalkeeper"
case strAwayLineupDefense = "strAwayLineupDefense"
case strAwayLineupMidfield = "strAwayLineupMidfield"
case strAwayLineupForward = "strAwayLineupForward"
case strAwayLineupSubstitutes = "strAwayLineupSubstitutes"
case strAwayFormation = "strAwayFormation"
case intHomeShots = "intHomeShots"
case intAwayShots = "intAwayShots"
case strTimestamp = "strTimestamp"
case dateEvent = "dateEvent"
case dateEventLocal = "dateEventLocal"
case strTime = "strTime"
case strTimeLocal = "strTimeLocal"
case strTVStation = "strTVStation"
case idHomeTeam = "idHomeTeam"
case idAwayTeam = "idAwayTeam"
case strResult = "strResult"
case strVenue = "strVenue"
case strCountry = "strCountry"
case strCity = "strCity"
case strPoster = "strPoster"
case strSquare = "strSquare"
case strFanart = "strFanart"
case strThumb = "strThumb"
case strBanner = "strBanner"
case strMap = "strMap"
case strTweet1 = "strTweet1"
case strTweet2 = "strTweet2"
case strTweet3 = "strTweet3"
case strVideo = "strVideo"
case strStatus = "strStatus"
case strPostponed = "strPostponed"
case strLocked = "strLocked"
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
idEvent = try values.decodeIfPresent(String.self, forKey: .idEvent)
idSoccerXML = try values.decodeIfPresent(String.self, forKey: .idSoccerXML)
idAPIfootball = try values.decodeIfPresent(String.self, forKey: .idAPIfootball)
strEvent = try values.decodeIfPresent(String.self, forKey: .strEvent)
strEventAlternate = try values.decodeIfPresent(String.self, forKey: .strEventAlternate)
strFilename = try values.decodeIfPresent(String.self, forKey: .strFilename)
strSport = try values.decodeIfPresent(String.self, forKey: .strSport)
idLeague = try values.decodeIfPresent(String.self, forKey: .idLeague)
strLeague = try values.decodeIfPresent(String.self, forKey: .strLeague)
strSeason = try values.decodeIfPresent(String.self, forKey: .strSeason)
strDescriptionEN = try values.decodeIfPresent(String.self, forKey: .strDescriptionEN)
strHomeTeam = try values.decodeIfPresent(String.self, forKey: .strHomeTeam)
strAwayTeam = try values.decodeIfPresent(String.self, forKey: .strAwayTeam)
intHomeScore = try values.decodeIfPresent(String.self, forKey: .intHomeScore)
intRound = try values.decodeIfPresent(String.self, forKey: .intRound)
intAwayScore = try values.decodeIfPresent(String.self, forKey: .intAwayScore)
intSpectators = try values.decodeIfPresent(String.self, forKey: .intSpectators)
strOfficial = try values.decodeIfPresent(String.self, forKey: .strOfficial)
strHomeGoalDetails = try values.decodeIfPresent(String.self, forKey: .strHomeGoalDetails)
strHomeRedCards = try values.decodeIfPresent(String.self, forKey: .strHomeRedCards)
strHomeYellowCards = try values.decodeIfPresent(String.self, forKey: .strHomeYellowCards)
strHomeLineupGoalkeeper = try values.decodeIfPresent(String.self, forKey: .strHomeLineupGoalkeeper)
strHomeLineupDefense = try values.decodeIfPresent(String.self, forKey: .strHomeLineupDefense)
strHomeLineupMidfield = try values.decodeIfPresent(String.self, forKey: .strHomeLineupMidfield)
strHomeLineupForward = try values.decodeIfPresent(String.self, forKey: .strHomeLineupForward)
strHomeLineupSubstitutes = try values.decodeIfPresent(String.self, forKey: .strHomeLineupSubstitutes)
strHomeFormation = try values.decodeIfPresent(String.self, forKey: .strHomeFormation)
strAwayRedCards = try values.decodeIfPresent(String.self, forKey: .strAwayRedCards)
strAwayYellowCards = try values.decodeIfPresent(String.self, forKey: .strAwayYellowCards)
strAwayGoalDetails = try values.decodeIfPresent(String.self, forKey: .strAwayGoalDetails)
strAwayLineupGoalkeeper = try values.decodeIfPresent(String.self, forKey: .strAwayLineupGoalkeeper)
strAwayLineupDefense = try values.decodeIfPresent(String.self, forKey: .strAwayLineupDefense)
strAwayLineupMidfield = try values.decodeIfPresent(String.self, forKey: .strAwayLineupMidfield)
strAwayLineupForward = try values.decodeIfPresent(String.self, forKey: .strAwayLineupForward)
strAwayLineupSubstitutes = try values.decodeIfPresent(String.self, forKey: .strAwayLineupSubstitutes)
strAwayFormation = try values.decodeIfPresent(String.self, forKey: .strAwayFormation)
intHomeShots = try values.decodeIfPresent(String.self, forKey: .intHomeShots)
intAwayShots = try values.decodeIfPresent(String.self, forKey: .intAwayShots)
strTimestamp = try values.decodeIfPresent(String.self, forKey: .strTimestamp)
dateEvent = try values.decodeIfPresent(String.self, forKey: .dateEvent)
dateEventLocal = try values.decodeIfPresent(String.self, forKey: .dateEventLocal)
strTime = try values.decodeIfPresent(String.self, forKey: .strTime)
strTimeLocal = try values.decodeIfPresent(String.self, forKey: .strTimeLocal)
strTVStation = try values.decodeIfPresent(String.self, forKey: .strTVStation)
idHomeTeam = try values.decodeIfPresent(String.self, forKey: .idHomeTeam)
idAwayTeam = try values.decodeIfPresent(String.self, forKey: .idAwayTeam)
strResult = try values.decodeIfPresent(String.self, forKey: .strResult)
strVenue = try values.decodeIfPresent(String.self, forKey: .strVenue)
strCountry = try values.decodeIfPresent(String.self, forKey: .strCountry)
strCity = try values.decodeIfPresent(String.self, forKey: .strCity)
strPoster = try values.decodeIfPresent(String.self, forKey: .strPoster)
strSquare = try values.decodeIfPresent(String.self, forKey: .strSquare)
strFanart = try values.decodeIfPresent(String.self, forKey: .strFanart)
strThumb = try values.decodeIfPresent(String.self, forKey: .strThumb)
strBanner = try values.decodeIfPresent(String.self, forKey: .strBanner)
strMap = try values.decodeIfPresent(String.self, forKey: .strMap)
strTweet1 = try values.decodeIfPresent(String.self, forKey: .strTweet1)
strTweet2 = try values.decodeIfPresent(String.self, forKey: .strTweet2)
strTweet3 = try values.decodeIfPresent(String.self, forKey: .strTweet3)
strVideo = try values.decodeIfPresent(String.self, forKey: .strVideo)
strStatus = try values.decodeIfPresent(String.self, forKey: .strStatus)
strPostponed = try values.decodeIfPresent(String.self, forKey: .strPostponed)
strLocked = try values.decodeIfPresent(String.self, forKey: .strLocked)
}
} | [
-1
] |
1c3eee3f2c6b65109d878bbd86bb807bf284ed16 | 5a7fdd51bfba5f595390a0c4fc719227612c8de6 | /WeiBo/WeiBo/AppDelegate.swift | 02492472024ce92978ed00a60e780acab8f9ff65 | [
"MIT"
] | permissive | konanxu/WeiBoWithSwift | 36e0718dc35397b17a01e5188ffa6f2c21828f0b | e7fbc3edf8735ec2bfd88d5d316a1bfce378295f | refs/heads/master | 2021-01-10T08:27:41.239989 | 2016-03-22T03:30:13 | 2016-03-22T03:30:13 | 53,418,930 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,592 | swift | //
// AppDelegate.swift
// WeiBo
//
// Created by Konan on 16/3/8.
// Copyright © 2016年 Konan. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// NSUserDefaults.standardUserDefaults().setValue((UserAccount.loadAccount()) != nil ? true : false, forKeyPath: "isLogin")
//
//
// NSUserDefaults.standardUserDefaults().synchronize()
//
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = MainViewController()
window?.makeKeyAndVisible()
UINavigationBar.appearance().tintColor = UIColor.orangeColor()
UITabBar.appearance().tintColor = UIColor.orangeColor()
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,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
229408,
294950,
229415,
229417,
237613,
229422,
229426,
237618,
229428,
286774,
229432,
286776,
319544,
286791,
237640,
278605,
237646,
311375,
163920,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
327814,
303241,
417930,
311436,
319633,
286873,
286876,
311460,
32944,
327862,
286906,
180413,
286910,
131264,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
131314,
286962,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
287003,
287006,
287009,
287012,
287014,
287019,
311598,
287032,
155966,
278849,
319809,
319810,
319814,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
65943,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
319945,
278986,
319947,
278990,
278994,
279003,
279006,
172512,
279010,
279015,
172520,
319978,
279020,
172526,
279023,
311791,
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,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
311911,
189034,
295533,
189039,
189040,
172655,
172656,
352880,
189044,
295538,
172660,
287349,
287355,
287360,
295553,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
287377,
311957,
221850,
287386,
303773,
164509,
295583,
172702,
230045,
287390,
172705,
287394,
172707,
303780,
287398,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
287427,
312006,
107212,
172748,
287436,
172751,
295633,
172755,
303827,
279255,
172760,
279258,
287450,
213724,
189149,
303835,
303838,
279267,
312035,
295654,
279272,
312048,
312050,
230131,
205564,
328453,
295685,
230154,
33548,
312077,
295695,
369433,
295707,
328476,
295710,
303914,
279340,
205613,
279353,
230202,
222018,
295755,
377676,
287569,
279383,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
279438,
213902,
295822,
189329,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
304063,
295873,
189378,
213954,
304065,
213963,
279505,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
312321,
295945,
295949,
197645,
230413,
140312,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
230465,
238658,
296004,
336964,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
164973,
279669,
337018,
279679,
279683,
222340,
296084,
238745,
304285,
238756,
205991,
165035,
337067,
165038,
238766,
304311,
230592,
279750,
230600,
230607,
148690,
279769,
304348,
279777,
304354,
296163,
279781,
304360,
279788,
320748,
279790,
320771,
312585,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
173350,
312622,
296243,
312630,
222522,
222525,
230718,
296255,
378181,
230727,
222545,
230739,
312663,
222556,
337244,
312676,
230760,
173418,
230763,
230768,
296305,
230773,
304505,
304506,
181631,
312711,
288140,
230800,
288144,
304533,
288154,
337306,
288160,
288162,
279975,
304555,
370092,
279983,
173488,
279985,
312755,
296373,
279991,
312759,
337335,
173507,
296389,
222665,
230860,
280014,
230865,
288210,
370130,
222676,
288212,
280021,
288214,
239064,
288217,
288218,
280027,
288220,
329177,
239070,
288224,
280034,
288226,
280036,
370146,
320998,
280038,
288230,
288229,
288234,
288232,
288236,
288238,
288240,
288242,
296435,
288244,
296439,
288250,
148990,
296446,
206336,
321022,
296450,
402942,
230916,
214535,
230919,
370187,
304651,
222752,
108066,
296488,
230961,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
181854,
370272,
403039,
239202,
312938,
280183,
280185,
280188,
280191,
280194,
116354,
280208,
280211,
288408,
280218,
280222,
190118,
321195,
321200,
296626,
296634,
280260,
280264,
280276,
313044,
321239,
280283,
288478,
321252,
313066,
280302,
288494,
280304,
313073,
419570,
288499,
288502,
280314,
288510,
67330,
280324,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
345921,
280388,
304968,
280393,
280402,
313176,
280419,
321381,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280458,
280464,
124817,
280468,
280473,
124827,
214940,
247709,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
280515,
190403,
296900,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
288764,
239612,
239617,
313347,
288773,
313358,
305176,
313371,
354338,
305191,
313386,
354348,
124978,
215090,
124980,
288826,
313406,
288831,
67654,
223303,
280651,
354382,
288848,
280658,
354390,
280669,
313438,
223327,
280671,
321634,
149603,
329830,
280681,
313451,
223341,
280687,
215154,
280691,
313458,
313464,
321659,
280702,
288895,
141446,
215175,
321670,
141455,
141459,
280725,
313498,
288936,
100520,
280747,
288940,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
280783,
280786,
280788,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
280819,
157940,
125171,
280823,
280825,
280827,
280830,
280831,
280833,
280835,
125187,
125191,
125207,
125209,
321817,
321842,
223539,
280888,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
280937,
280940,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
240017,
190868,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289221,
289227,
281045,
281047,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
240132,
305668,
281095,
223752,
338440,
150025,
223757,
281102,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
281154,
322115,
158283,
281163,
281179,
199262,
338528,
281190,
281196,
19053,
158317,
313973,
281210,
297594,
158347,
133776,
117398,
314007,
289436,
174754,
330404,
174764,
240309,
133817,
314045,
314047,
199364,
199367,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322318,
281361,
281372,
322341,
215850,
281388,
207661,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
240535,
289687,
289694,
289696,
289724,
52163,
281567,
289762,
322534,
297961,
281581,
183277,
322550,
134142,
322563,
314372,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
248995,
306341,
306344,
306347,
306354,
142531,
289991,
249045,
290008,
363745,
298216,
126190,
216303,
322801,
257302,
363802,
199976,
199978,
298292,
257334,
298306,
281923,
224584,
224587,
224594,
216404,
150870,
224603,
265568,
281960,
306539,
290161,
216436,
306549,
298358,
306552,
290171,
298365,
290174,
224641,
281987,
265604,
298372,
281990,
298377,
298381,
142733,
224657,
306581,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
339431,
282089,
191985,
282098,
290291,
282101,
151036,
290302,
282111,
290305,
175621,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
282133,
290325,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
224875,
241260,
323181,
314994,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
282337,
216801,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
282402,
315174,
282410,
241450,
306991,
315184,
323376,
315190,
241464,
282425,
307009,
241475,
307012,
148946,
315211,
282446,
315221,
282454,
323414,
315223,
241496,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
110445,
282478,
282481,
110450,
315249,
315251,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
282520,
241560,
241563,
241565,
241567,
241569,
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,
299006,
282623,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
192596,
176213,
307287,
315482,
315483,
192605,
233567,
200801,
217188,
299109,
307303,
45163,
307307,
315502,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
307352,
299164,
184479,
315552,
184481,
315557,
184486,
307370,
184492,
307372,
307374,
307376,
176311,
184503,
307386,
258235,
176316,
307388,
307390,
184512,
307394,
299204,
184518,
323784,
307409,
176343,
299225,
233701,
184572,
282881,
184579,
282893,
291089,
282906,
233766,
176435,
168245,
307510,
315701,
151864,
332086,
307515,
282942,
307518,
151874,
282947,
282957,
110926,
323917,
233808,
323921,
315733,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
315771,
299388,
299398,
242057,
291212,
299405,
291222,
283033,
242075,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
283062,
291254,
127417,
291260,
283069,
127421,
127429,
283080,
176592,
315856,
315860,
176597,
127447,
299481,
283099,
176605,
242143,
291299,
242152,
291305,
176620,
291314,
291317,
135672,
233979,
291323,
291330,
283142,
127497,
135689,
233994,
291341,
233998,
234003,
234006,
234010,
135707,
242206,
135710,
291361,
242220,
291378,
152118,
234038,
70213,
111193,
242275,
299620,
168562,
184952,
135805,
291456,
135808,
299655,
373383,
316051,
225941,
316054,
299672,
135834,
225948,
299677,
373404,
135839,
299680,
225954,
299684,
242343,
209576,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
226002,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
234231,
234236,
226045,
234239,
242431,
209665,
234242,
242436,
234246,
226056,
234248,
291593,
242443,
242445,
234254,
234258,
242450,
242452,
234261,
201496,
283421,
234269,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
283452,
160572,
234302,
234307,
242499,
234309,
234313,
316235,
283468,
234316,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234344,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
234370,
291714,
291716,
234373,
226182,
234375,
226185,
308105,
234379,
234384,
234388,
234390,
226200,
234393,
308123,
234396,
324508,
234398,
291742,
234401,
291748,
234405,
291750,
234407,
324518,
324520,
291754,
226220,
291756,
234414,
291760,
201650,
226230,
234422,
275384,
234428,
291773,
226239,
234431,
242623,
234434,
324548,
226245,
234437,
234439,
234443,
291788,
275406,
193486,
234446,
193488,
234449,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
234481,
234484,
234485,
234487,
234490,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
234520,
316439,
234523,
234528,
300066,
234532,
234535,
234537,
234540,
144430,
234543,
275508,
234549,
300085,
300088,
234556,
234558,
316479,
234561,
234563,
316483,
234568,
234570,
316491,
234572,
300108,
300115,
234580,
234581,
234585,
242777,
275545,
234590,
234595,
234597,
300133,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
234614,
234618,
144506,
234620,
275579,
234623,
226433,
234627,
275588,
275594,
234634,
234636,
234640,
275602,
234643,
324757,
226453,
275606,
275608,
234647,
234648,
234650,
308373,
283805,
308379,
234653,
119967,
234657,
300189,
324766,
242852,
300197,
234664,
275626,
316596,
234687,
316610,
300226,
226500,
234692,
283844,
300229,
308420,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
300284,
275710,
300287,
283904,
300289,
300292,
300294,
275719,
177419,
300299,
283917,
242957,
275725,
177424,
349464,
283939,
259367,
283951,
300344,
226617,
283963,
243003,
226628,
300357,
177482,
283983,
316758,
357722,
316766,
218464,
316768,
292197,
243046,
316774,
218473,
284010,
136562,
275834,
333178,
275836,
275840,
316806,
226696,
226699,
316811,
226703,
300433,
234899,
226709,
357783,
316826,
144796,
300448,
144810,
284076,
144812,
144814,
284084,
144820,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
284099,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
292329,
300523,
259565,
259567,
300527,
226802,
316917,
308727,
300537,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284206,
284209,
284211,
194101,
284213,
194103,
284215,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
317015,
284249,
243290,
284251,
284253,
243293,
284255,
300638,
284258,
292452,
177766,
284263,
292454,
284265,
292458,
284267,
292461,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
276095,
292479,
284288,
276098,
284290,
284292,
292485,
325250,
284297,
317066,
284299,
317068,
284301,
284303,
276114,
284306,
284308,
284312,
284314,
284316,
276127,
284322,
284327,
276137,
284329,
284331,
317098,
284333,
284335,
284337,
284339,
300726,
284343,
284346,
284350,
276160,
358080,
284354,
284358,
358089,
276170,
284362,
276175,
284368,
276177,
284370,
317138,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358116,
276197,
284392,
325353,
284394,
358122,
284397,
276206,
284399,
358126,
358128,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
284418,
317187,
358146,
317191,
284428,
300816,
317207,
284440,
300828,
300830,
276255,
300832,
284449,
227109,
317221,
186151,
358183,
276268,
194351,
243504,
284469,
276280,
325436,
358206,
276291,
284484,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
178006,
317271,
276315,
292700,
284511,
227175,
292715,
284529,
292721,
300915,
284533,
317306,
284540,
292734,
325512,
169868,
276365,
284566,
350106,
284572,
276386,
284579,
276388,
292776,
284585,
358312,
276395,
317361,
276402,
161718,
358326,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
301015,
358360,
301017,
292828,
276446,
153568,
276448,
276452,
276455,
292843,
276460,
276464,
227314,
276466,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
276539,
235579,
325692,
178238,
276544,
284739,
276553,
194649,
227418,
309337,
194654,
227423,
178273,
227426,
276579,
194660,
227430,
276583,
292968,
309352,
276586,
301163,
309354,
276590,
227440,
284786,
276595,
292985,
301178,
292989,
292993,
301185,
227463,
301199,
350354,
350359,
276638,
284837,
153765,
227520,
227522,
301252,
227529,
301258,
276685,
276689,
301272,
276699,
194780,
309468,
301283,
317672,
276713,
243948,
194801,
227571,
276725,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
276775,
211241,
325937,
325943,
260421,
276809,
285002,
276811,
276816,
235858,
276829,
276833,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
317833,
178572,
285070,
178575,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
285098,
276907,
276917,
293304,
293314,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
317951,
309764,
236043,
317963,
342541,
55822,
113167,
317971,
309781,
55837,
227877,
227879,
227882,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
129603,
301636,
285265,
277080,
309849,
285277,
285282,
326244,
277100,
277106,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
285320,
277128,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
326430,
228128,
228135,
318248,
277291,
318253,
285489,
293685,
285494,
285499,
301884,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
228330,
318442,
277486,
326638,
318450,
293877,
285686,
302073,
285690,
121850,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
277526,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
293960,
277577,
310344,
277583,
203857,
293971,
310359,
236632,
277594,
138332,
277598,
285792,
277601,
203872,
310374,
203879,
277608,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
285824,
285831,
294026,
285835,
302218,
162964,
384148,
187542,
302231,
302233,
285852,
302237,
285854,
285862,
277671,
302248,
64682,
277678,
228526,
294063,
294065,
302258,
277687,
294072,
318651,
277695,
318657,
302275,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
228617,
138505,
318742,
204067,
277798,
277801,
113964,
285997,
277804,
277807,
285999,
113969,
277811,
318773,
277816,
318776,
286010,
277819,
294204,
277822,
417086,
286016,
294211,
302403,
277832,
277836,
277839,
326991,
277842,
277847,
277850,
179547,
277853,
277857,
302436,
277860,
294246,
327015,
277864,
310632,
327017,
351594,
277869,
277872,
351607,
277880,
310648,
310651,
277884,
277888,
310657,
310659,
277892,
294276,
277894,
327046,
253320,
310665,
277898,
318858,
351619,
277903,
310672,
277905,
351633,
277908,
277917,
277921,
310689,
277923,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
277944,
310712,
277947,
310715,
277950,
277953,
64966,
277959,
163272,
245191,
302534,
310727,
277963,
277966,
302543,
277971,
277975,
228825,
163290,
277978,
277981,
310749,
277984,
310755,
277989,
277991,
277995,
286188,
310764,
278000,
278003,
228851,
278006,
40440,
278009,
212472,
40443,
286203,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
286248,
278057,
40488,
294439,
40491,
294440,
294443,
294445,
310831,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
228944,
212560,
400976,
40533,
147032,
40537,
278109,
40541,
40544,
40548,
40550,
40552,
286313,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
278150,
310925,
286354,
278163,
302740,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
319171,
302789,
294599,
278216,
294601,
278227,
229076,
319187,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
302854,
294664,
311048,
319243,
311053,
294682,
278306,
294701,
278320,
319280,
319290,
229192,
302925,
237409,
360317,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
40865,
319394,
294821,
180142,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
278519,
237562
] |
89350007739f4f655c325ccceef4e0df48a582f6 | c6163f115f195932f4639d42053a5c6c782385ae | /Example/Backpack/ViewControllers/SnackbarViewController.swift | 25cc31fb820eae8a78bff3ca092bdaf93b71528f | [
"Apache-2.0"
] | permissive | stellz/backpack-ios | 96af77b27037d52aa8756fb5489c673b20602656 | 2ccb806603dc442db09b9c165eba348a140d264e | refs/heads/master | 2023-03-16T13:45:26.326185 | 2021-06-11T09:00:54 | 2021-06-11T09:00:54 | 216,554,253 | 0 | 0 | Apache-2.0 | 2023-03-06T11:01:06 | 2019-10-21T11:44:39 | Objective-C | UTF-8 | Swift | false | false | 7,635 | swift | /*
* Backpack - Skyscanner's Design System
*
* Copyright 2018-2021 Skyscanner Ltd
*
* 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
import Backpack
// The string value is the segue identifier
// that should use this style
enum SnackBarType: String {
case withText = "showWithText"
case withTextAndButton = "showWithTextAndButton"
case withTextTitleAndButton = "showWithTextTitleAndButton"
case withTextAndIconOnlyButton = "showWithTextAndIconOnlyButton"
case withTextButtonAndAccessoryIcon = "showWithTextButtonAndAccessoryIcon"
case indefiniteDuration = "showWithIndefiniteDuration"
case longDuration = "showWithLongDuration"
case shortDuration = "showWithShortDuration"
case withKeyboard = "showWithKeyboard"
case withDelegate = "showWithDelegate"
}
class SnackBarViewController: UIViewController, BPKSnackbarDelegate {
@IBOutlet weak var textField: UITextField!
var snackBarType: SnackBarType = .withText
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
textField.isHidden = snackBarType == .withKeyboard ? false : true
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
switch snackBarType {
case .withText:
showWithText()
case .withTextAndButton:
showWithTextAndButton()
case .withTextTitleAndButton:
showWithTextTitleAndButton()
case .withTextAndIconOnlyButton:
showWithTextAndIconOnlyButton()
case .withTextButtonAndAccessoryIcon:
showWithTextButtonAndAccessoryIcon()
case .indefiniteDuration:
showIndefiniteDuration()
case .longDuration:
showLongDuration()
case .shortDuration:
showShortDuration()
case .withKeyboard:
showWithKeyboard()
case .withDelegate:
showWithDelegate()
}
}
func showWithText() {
let snackbar = BPKSnackbar(
text: "Descriptive text", title: nil, duration: .long, viewController: self, delegate: nil
)
snackbar.show()
}
func showWithTextAndButton() {
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: nil,
button: BPKSnackbarButton(title: "Button Title"),
leftIcon: nil,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showWithTextTitleAndButton() {
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: "Snackbar Title",
button: BPKSnackbarButton(title: "Button Title"),
leftIcon: nil,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showWithTextAndIconOnlyButton() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Close"),
leftIcon: nil,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showWithTextButtonAndAccessoryIcon() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let accessoryIcon = BPKIcon.makeSmallTemplateIcon(name: .tickCircle)
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Close"),
leftIcon: accessoryIcon,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showIndefiniteDuration() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let snackbar = BPKSnackbar(
text: "Snackbar with indefinite duration",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: nil,
duration: .indefinite,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showLongDuration() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let snackbar = BPKSnackbar(
text: "Snackbar with long duration",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: nil,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showShortDuration() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let snackbar = BPKSnackbar(
text: "Snackbar with long duration",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: nil,
duration: .short,
viewController: self,
delegate: nil
)
snackbar.show()
}
func showWithKeyboard() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let accessoryIcon = BPKIcon.makeSmallTemplateIcon(name: .tickCircle)
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: accessoryIcon,
duration: .long,
viewController: self,
delegate: nil
)
snackbar.show()
textField.becomeFirstResponder()
}
func showWithDelegate() {
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let accessoryIcon = BPKIcon.makeSmallTemplateIcon(name: .tickCircle)
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: nil,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: accessoryIcon,
duration: .long,
viewController: self,
delegate: self
)
snackbar.show()
}
func snackbar(_ snackbar: BPKSnackbar!, dismissedWith cause: BPKSnackbarDismissCause) {
if cause == .actionButton {
let title = String(Int(arc4random_uniform(100)))
let buttonIcon = BPKIcon.makeSmallTemplateIcon(name: .close)
let accessoryIcon = BPKIcon.makeSmallTemplateIcon(name: .tickCircle)
let snackbar = BPKSnackbar(
text: "Descriptive text",
title: title,
button: BPKSnackbarButton(icon: buttonIcon, accessibilityLabel: "Icon"),
leftIcon: accessoryIcon,
duration: .long,
viewController: self,
delegate: self
)
snackbar.show()
}
}
}
| [
-1
] |
e2789247d8e04e2ded90a6af34d6d5addc9e7e15 | f54ad2ae01272fcf0ea43fcd10f1352bd947166d | /FoodTracker/AppDelegate.swift | 5337f3dc5275c215d99dc874d4170d71566566e0 | [] | no_license | carolineh101/FoodTracker | 2f36e5162b5d96ffbb223a291e623dd9d6b90278 | 9cac79b4a9d14149cbcccf358bf30a8c5968990d | refs/heads/master | 2021-01-18T21:37:34.166315 | 2017-03-06T07:53:36 | 2017-03-06T07:53:36 | 82,643,997 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,176 | swift | //
// AppDelegate.swift
// FoodTracker
//
// Created by Caroline Ho on 2/20/17.
// Copyright © 2017 HackOverflow. 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,
229388,
294924,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
229426,
237618,
229428,
311349,
286774,
229432,
286776,
286778,
319544,
204856,
352318,
286791,
237640,
278605,
286797,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
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,
131278,
278743,
278747,
295133,
155872,
131299,
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,
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,
172550,
287238,
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,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
189039,
295538,
189040,
172660,
189044,
287349,
352880,
287355,
287360,
295553,
172675,
287365,
311942,
303751,
295557,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
303773,
230045,
172702,
287390,
287394,
172705,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
279258,
303835,
213724,
189149,
303838,
287450,
279267,
312035,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
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,
279438,
189325,
295822,
189329,
213902,
304019,
295825,
189331,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
230413,
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,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
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,
230679,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
222525,
296253,
312639,
296255,
230718,
296259,
378181,
296262,
230727,
238919,
320840,
296264,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
279929,
304506,
181626,
304505,
181631,
148865,
312711,
312712,
296331,
288140,
230800,
288144,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
173488,
279985,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
148946,
288214,
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,
402942,
296446,
148990,
206336,
296450,
321022,
230916,
230919,
214535,
304651,
370187,
304653,
230923,
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,
263888,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
280302,
288494,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
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,
10170,
296890,
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,
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,
149618,
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,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
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,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
240132,
330244,
281095,
338440,
150025,
223752,
223749,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
289317,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
281210,
297594,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
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,
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,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
314773,
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,
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,
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,
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,
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,
298984,
241640,
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,
241821,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
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,
295583,
176435,
307508,
315701,
307510,
332086,
307512,
168245,
307515,
282942,
307518,
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,
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,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
127460,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
127480,
291323,
233979,
127485,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
152087,
127511,
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,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
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,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
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,
234434,
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,
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,
160835,
234563,
308291,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
324757,
234653,
324766,
119967,
308379,
300189,
324768,
283805,
234657,
234661,
283813,
300197,
234664,
242852,
275626,
234667,
177318,
316596,
308414,
234687,
300226,
308418,
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,
161027,
300292,
300294,
275719,
234760,
300299,
177419,
283917,
300301,
349451,
177424,
242957,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
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,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
259567,
308720,
226802,
292338,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
316983,
194103,
284218,
226877,
292414,
284223,
284226,
243268,
292421,
226886,
284231,
128584,
284228,
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,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
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,
317138,
284370,
284372,
358098,
284377,
276187,
284379,
284381,
284384,
284386,
358114,
358116,
276197,
317158,
358119,
284392,
325353,
284394,
358122,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
399252,
284566,
317332,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
292776,
276395,
292784,
276402,
358326,
161718,
276410,
276411,
358330,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
276455,
292839,
350186,
292843,
276460,
276464,
178161,
227314,
276466,
350200,
325624,
276472,
317435,
276476,
276479,
276482,
350210,
276485,
317446,
178181,
276490,
350218,
292876,
350222,
276496,
317456,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
178224,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
284739,
292934,
243785,
276553,
350293,
350295,
194649,
227418,
309337,
350302,
227423,
194654,
178273,
194657,
227426,
194660,
276579,
227430,
276583,
309346,
309348,
309350,
309352,
309354,
350308,
276590,
350313,
350316,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
350332,
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,
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,
276843,
293227,
276848,
293232,
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,
293370,
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,
219714,
129603,
318020,
301636,
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,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
137889,
383658,
285357,
318128,
277170,
342707,
154292,
293555,
277173,
318132,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
15224,
236408,
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,
228330,
318442,
228332,
277486,
326638,
351217,
318450,
293876,
293877,
285686,
302073,
285690,
121850,
302075,
293882,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
285821,
302205,
392326,
285831,
253064,
302218,
285835,
294026,
162964,
384148,
187542,
302231,
302233,
285849,
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,
294211,
302403,
384328,
277832,
277836,
146765,
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,
310727,
302534,
277959,
292968,
302541,
277963,
302543,
277966,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
187936,
146977,
286240,
187939,
40484,
294435,
286246,
40486,
294440,
278057,
245288,
294443,
40488,
294445,
294439,
310831,
40491,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
228944,
400976,
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,
278227,
286420,
319187,
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,
280021,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
294803,
40851,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
23ffdddb93fd3280e515c8c8992fa954a4eb92a4 | 45cc86540ea283c1599b374459e64d63ee8a3a69 | /Tests/SwiftTLSTests/RSATests.swift | 24c9352b54d8ac9afd732b8cdb7b1a37aaf29bdc | [
"MIT"
] | permissive | cwarer1/SwiftTLS | 9df39e068498a69ef8311b74ecdbbbf781fcc9d2 | c5ef2fd02df13d6a10dc3461bfca73378ffe5e2b | refs/heads/master | 2020-08-23T17:33:40.081205 | 2019-07-31T09:17:10 | 2019-07-31T09:31:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,358 | swift | //
// RSATests.swift
// SwiftTLS
//
// Created by Nico Schmidt on 29.12.15.
// Copyright © 2015 Nico Schmidt. All rights reserved.
//
import XCTest
@testable import SwiftTLS
class RSATests: XCTestCase {
static var allTests = [
("test_RSA_PSS_sign_someData_verifies", test_RSA_PSS_sign_someData_verifies),
("test_verify_signatureFromSelfSignedRSAPSSCertificate_verifies", test_verify_signatureFromSelfSignedRSAPSSCertificate_verifies),
("test_verify_signatureFromSelfSignedRSACertificate_verifies", test_verify_signatureFromSelfSignedRSACertificate_verifies),
("test_sign_someData_verifies", test_sign_someData_verifies),
("test_decrypt_encryptedData_givesOriginalData", test_decrypt_encryptedData_givesOriginalData),
]
override func setUp() {
var ctx = BigIntContext()
ctx.open()
_ = BigIntContext.setContext(ctx)
}
override func tearDown() {
_ = BigIntContext.setContext(nil)
}
func test_sign_someData_verifies()
{
let certificatePath = path(forResource: "mycert.pem")
guard var rsa = RSA.fromPEMFile(certificatePath) else {
XCTFail()
return
}
let signatureAlgorithm = X509.SignatureAlgorithm.rsa_pkcs1(hash: .sha1)
rsa.algorithm = signatureAlgorithm
let data = [1,2,3,4,5,6,7,8] as [UInt8]
let signature = try! rsa.sign(data: data)
print(signature)
var rsa2 = RSA(n: rsa.n, publicExponent: rsa.e)
rsa2.algorithm = signatureAlgorithm
let verified = try! rsa2.verify(signature: signature, data: data)
XCTAssert(verified)
}
func test_decrypt_encryptedData_givesOriginalData()
{
let certificatePath = path(forResource: "mycert.pem")
guard let rsa = RSA.fromPEMFile(certificatePath) else {
XCTFail()
return
}
do {
let data = [1,2,3,4,5,6,7,8] as [UInt8]
let rsa2 = RSA(n: rsa.n, publicExponent: rsa.e)
let encrypted = try rsa2.encrypt(data)
print(encrypted)
let decrypted = try rsa.decrypt(encrypted)
print(decrypted)
XCTAssert(data == decrypted)
} catch {
XCTFail()
}
}
func test_verify_signatureFromSelfSignedRSAPSSCertificate_verifies() {
let certificatePath = path(forResource: "Self Signed RSA-PSS SHA-256.pem")
guard let cert = X509.Certificate(PEMFile: certificatePath) else { XCTFail(); return }
let tbsData = cert.tbsCertificate.DEREncodedCertificate!
let publicKey = cert.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey
XCTAssert(publicKey.numberOfBits == publicKey.bits.count * 8)
let rsa = RSA(certificate: cert)
let verified = try! rsa!.verify(signature: cert.signatureValue.bits, data: tbsData)
XCTAssert(verified)
}
func test_verify_signatureFromSelfSignedRSACertificate_verifies()
{
let certificatePath = path(forResource: "Self Signed RSA SHA-256.cer")
let data = (try! Data(contentsOf: URL(fileURLWithPath: certificatePath))).UInt8Array()
guard let cert = X509.Certificate(derData: data) else { XCTFail(); return }
let tbsData = cert.tbsCertificate.DEREncodedCertificate!
let publicKey = cert.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey
XCTAssert(publicKey.numberOfBits == publicKey.bits.count * 8)
let rsa = RSA(certificate: cert)
let verified = try! rsa!.verify(signature: cert.signatureValue.bits, data: tbsData)
XCTAssert(verified)
}
func test_RSA_PSS_sign_someData_verifies()
{
let certificatePath = path(forResource: "mycert.pem")
guard var rsa = RSA.fromPEMFile(certificatePath) else {
XCTFail()
return
}
let signatureAlgorithm = X509.SignatureAlgorithm.rsassa_pss(hash: .sha256, saltLength: 64)
rsa.algorithm = signatureAlgorithm
let data = [1,2,3,4,5,6,7,8] as [UInt8]
let signature = try! rsa.rsassa_pss_sign(message: data)
print(signature)
var rsa2 = RSA(n: rsa.n, publicExponent: rsa.e)
rsa2.algorithm = signatureAlgorithm
let verified = try! rsa2.rsassa_pss_verify(message: data, signature: signature)
XCTAssert(verified)
}
// func test_encrypt_givesSameResultAsSecurityFramework() {
// let certificatePath = Bundle(for: self.dynamicType).url(forResource: "mycert2.pem", withExtension: nil)!.path!
//
// guard let rsa = RSA.fromPEMFile(certificatePath) else {
// XCTFail()
// return
// }
//
// let data = [1,2,3] as [UInt8]
//
// let identity = Identity(name: "Internet Widgits Pty Ltd")
// let publicKey = identity!.certificate.publicKey!
// let encryptedData = publicKey.encrypt(data)!
//
//
// let rsaDecryptedData = rsa.decrypt(encryptedData)
//
//
// XCTAssert(data == rsaDecryptedData)
//
// }
}
| [
-1
] |
6013388a97627638ae5be0cbd79c6d29c7f3cc6c | 26935e36b05d0b4cc75448f48c57ebc00dec72fb | /Notes-Firebase/Notes-Firebase/AppDelegate.swift | 964b2c4bbbe14e88bf64d58f575805a80efa30b8 | [] | no_license | stevelederer/Notes-Firebase | 8e48511b20adc31712abffe80f432b566baaef7d | adfce1afb1ef78129059fce397e2fcd998d34136 | refs/heads/master | 2020-04-16T17:00:12.728297 | 2019-01-15T00:56:52 | 2019-01-15T00:56:52 | 165,759,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,183 | swift | //
// AppDelegate.swift
// Notes-Firebase
//
// Created by Steve Lederer on 1/14/19.
// Copyright © 2019 Steve Lederer. 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,
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,
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,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
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,
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,
66690,
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,
148946,
288214,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
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,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
224151,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
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,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
324757,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
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,
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,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
318132,
342707,
154292,
277173,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
342749,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
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,
319163,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
a239df08073d71c3d7bf0e3dcaad8a95498cbaf8 | 76dda67fd8041993b66c831af402eb266390bef6 | /MailWeather/NetworkManager/URLRequestBuilder.swift | 437c7579403f28b9fe17d895f8797b8acfb4f8f7 | [] | no_license | rlukmanov/MailWeather | 75720f59681bba6fa66cc5503224fb437015cd88 | d49862537bb6b5cdb8acb3902cbb46fdf8c39c1c | refs/heads/main | 2023-01-22T07:10:49.018884 | 2020-11-26T07:31:34 | 2020-11-26T07:31:34 | 314,907,979 | 4 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 852 | swift | //
// NetworkManager.swift
// MailWeather
//
// Created by Ruslan Lukmanov on 22.11.2020.
//
import Foundation
import Alamofire
protocol URLRequestBuilder: URLRequestConvertible {
var baseURL: String { get }
var path: String { get }
var parameters: Parameters? { get }
var method: HTTPMethod { get }
}
extension URLRequestBuilder {
var baseURL: String {
return Constants.Api.url
}
func asURLRequest() throws -> URLRequest {
let url = try baseURL.asURL()
var request = URLRequest(url: url.appendingPathComponent(path))
request.httpMethod = method.rawValue
switch method {
case .get:
request = try URLEncoding.default.encode(request, with: parameters)
default:
break
}
return request
}
}
| [
-1
] |
89bb2cf2437942e8136140cd3883241fd74a1d21 | f35903264135e1d0d3322176ddfea8c6743ef2eb | /Swift303/Util/Request.swift | 60f5d918f145e87032b035ba9bb22a30c2c1a44c | [] | no_license | tegranjeet/Swift303 | 5274a08c63562ca5beab0cddb15d547bae6e54fe | 929ef69677026499338452bf8cdc4fe5ed3a5cb4 | refs/heads/master | 2020-06-30T19:55:22.767415 | 2019-08-07T00:54:54 | 2019-08-07T00:54:54 | 200,936,652 | 0 | 0 | null | 2019-08-07T00:54:55 | 2019-08-06T23:15:14 | Swift | UTF-8 | Swift | false | false | 1,058 | swift | //
// Request.swift
// Swift303
//
// Created by Eric Armstrong on 8/6/19.
// Copyright © 2019 Eric Armstrong. All rights reserved.
//
import Foundation
enum RequestError: Error {
case noData
}
struct Request {
static func get<T: Decodable>(_ urlString: String, completion: @escaping (Result<T, Error>) -> Void) {
guard let url = URL(string: urlString) else {
fatalError("URL could not be formed.")
}
URLSession.shared.dataTask(with: url) { (data, _, error) in
if let error = error {
completion(.failure(error))
return
}
guard let data = data else {
completion(.failure(RequestError.noData))
return
}
do {
let result = try JSONDecoder().decode(T.self, from: data)
completion(.success(result))
} catch let error {
completion(.failure(error))
}
}.resume()
}
}
| [
-1
] |
1976f2fd4861ffe427ffff9e5d533975db1351b5 | 2493aea9aa397cbe0d668d0ac2206646bcc66b48 | /AtomicKit/Source/RecursiveMutex.swift | c6855189ab31a15c1629cf2975e385526a6ba433 | [
"MIT"
] | permissive | macmade/AtomicKit | 9b2c44efe4951963530d31ad2ffc3d1951dc6755 | c50a8a940c1cbb31117d5db2e7658a2a8c18fae0 | refs/heads/main | 2023-03-04T20:03:42.186589 | 2023-02-24T10:02:26 | 2023-02-24T10:02:26 | 95,135,506 | 100 | 11 | null | null | null | null | UTF-8 | Swift | false | false | 3,272 | swift | /*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com
*
* 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
/**
* Swift wrapper class for `pthread_mutex_t`.
* Note that this is a recursive version.
*
* - seealso: Locakble
*/
public class RecursiveMutex: Lockable
{
/**
* `RecursiveMutex` errors.
*/
public enum Error: Swift.Error
{
/**
* Thrown when a failure occurs trying to initialize the native
* mutex type.
*/
case CannotCreateMutex
/**
* Thrown when a failure occurs trying to initialize the native
* mutex attributes type.
*/
case CannotCreateMutexAttributes
}
/**
* Initializes a recursive mutex object.
*
* - throws: `RecursiveMutex.Error` on failure.
*/
public required init() throws
{
var attr = pthread_mutexattr_t()
if( pthread_mutexattr_init( &attr ) != 0 )
{
throw Error.CannotCreateMutexAttributes
}
defer
{
pthread_mutexattr_destroy( &attr )
}
pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE )
if( pthread_mutex_init( &( self._mutex ), &attr ) != 0 )
{
throw Error.CannotCreateMutex
}
}
deinit
{
pthread_mutex_destroy( &( self._mutex ) )
}
/**
* Locks the recursive mutex.
*/
public func lock()
{
pthread_mutex_lock( &( self._mutex ) )
}
/**
* Unlocks the recursive mutex.
*/
public func unlock()
{
pthread_mutex_unlock( &( self._mutex ) )
}
/**
* Tries to lock the recursive mutex.
*
* - returns: `true` if the recursive mutex was successfully locked, otherwise `false`.
*/
public func tryLock() -> Bool
{
return pthread_mutex_trylock( &( self._mutex ) ) == 0
}
private var _mutex = pthread_mutex_t()
}
| [
-1
] |
7294ee53ebb88f47aca839066342c019937a64ff | af4999d7c502c25c2ace080b08fb79e233e94665 | /ZingMp3/AppDelegate.swift | 0bf5701774165af554ced40ae766b183f77b9abb | [] | no_license | jaysiliver/ZingMp3 | 13d5754c2d92bd7b22f0cc34fec66ecbd5dcd57d | 1cb26aac4465172cf88e5d9d4196dfc31397c6c6 | refs/heads/master | 2021-01-22T03:30:05.601690 | 2017-05-25T08:21:41 | 2017-05-25T08:21:41 | 92,381,598 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,589 | swift | //
// AppDelegate.swift
// ZingMp3
//
// Created by Jay Siliver on 5/25/17.
// Copyright © 2017 Jay Siliver. All rights reserved.
//
import UIKit
import CoreData
@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:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
// 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: "ZingMp3")
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)")
}
}
}
}
| [
294405,
243717,
163848,
313353,
320008,
320014,
313360,
288275,
322580,
289300,
290326,
329747,
139803,
103964,
322080,
306721,
229408,
296483,
322083,
229411,
306726,
309287,
308266,
292907,
217132,
322092,
40495,
316465,
288306,
322102,
324663,
164408,
308281,
322109,
286783,
315457,
313409,
349765,
320582,
309832,
288329,
242250,
215117,
196177,
241746,
344661,
231000,
212571,
300124,
287323,
309342,
325220,
306790,
290409,
310378,
296043,
311914,
322666,
334446,
307310,
152685,
292466,
314995,
307315,
314487,
291450,
314491,
288383,
318599,
312970,
239252,
311444,
294038,
311449,
323739,
300194,
298662,
233638,
233644,
313005,
286896,
295600,
300208,
286389,
294070,
125111,
234677,
309439,
235200,
284352,
296641,
242371,
302787,
284360,
321228,
319181,
298709,
284374,
189654,
182486,
320730,
241371,
311516,
357083,
179420,
322272,
317665,
298210,
165091,
311525,
288489,
290025,
229098,
307436,
304365,
323310,
125167,
313073,
286455,
306424,
322299,
319228,
302332,
319231,
184576,
309505,
241410,
311043,
366339,
309509,
318728,
254217,
125194,
234763,
321806,
125201,
296218,
313116,
237858,
326434,
295716,
313125,
300836,
289577,
125226,
133421,
317233,
241971,
316726,
318264,
201530,
313660,
159549,
287038,
292159,
218943,
182079,
288578,
301893,
234828,
292172,
300882,
379218,
321364,
243032,
201051,
230748,
258397,
294238,
298844,
291169,
199020,
293741,
266606,
319342,
292212,
313205,
244598,
316788,
124796,
196988,
305022,
317821,
243072,
314241,
303999,
242050,
313215,
325509,
293767,
316300,
306576,
322448,
308114,
319900,
298910,
313250,
308132,
316327,
306605,
316334,
324015,
324017,
200625,
300979,
316339,
322998,
296888,
316345,
67000,
300987,
319932,
310718,
292288,
317888,
323520,
312772,
214980,
298950,
306632,
310733,
289744,
310740,
235994,
286174,
315359,
240098,
323555,
236008,
319465,
248299,
311789,
326640,
188913,
203761,
320498,
314357,
288246,
309243,
300540,
310782
] |
2786a31dd50ec96e89c9a392f9237a197cef5d3c | 68820462fcb329f7c70f58fc512873f48c04dc63 | /Et3am/controller/AllCouponTableViewCell.swift | 96185afcf99096fe64b6a7b2a74e3522bc609003 | [] | no_license | elmahask/Et3am | 301b5c85913ed2c8cba9b2a368f94a94901b4906 | d08740fd216f7136960a79ff90380215955e7590 | refs/heads/master | 2020-06-15T12:28:19.848416 | 2019-07-02T20:45:30 | 2019-07-02T20:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 643 | swift | //
// AllCouponTableViewCell.swift
// Et3am
//
// Created by Jets39 on 5/10/19.
// Copyright © 2019 Ahmed M. Hassan. All rights reserved.
//
import UIKit
class AllCouponTableViewCell: UITableViewCell {
@IBOutlet weak var avaliableStatusLbl: UILabel!
@IBOutlet weak var couponValueLbl: UILabel!
@IBOutlet weak var couponCodeLbl: 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
}
}
| [
172545,
176228,
327248,
258931,
320404,
320793
] |
1793d3d88200ad2dfc1e08cb7fe445369ceedf59 | f4cc7a16b5290b8d3801790cc09b7074a728f46d | /Level1UITests/Level1UITests.swift | c3a75f6b6536c28e5bd28705b35a0affa10f3e05 | [] | no_license | KazukiOhta/CheckTest | a855df2dabd8f3a27c9b609ada7a366d5a003912 | 8368eaafed7a4e0c49efaa827121ad815ad4f425 | refs/heads/master | 2020-05-09T13:00:43.836816 | 2019-04-13T07:03:11 | 2019-04-13T07:03:11 | 181,133,774 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,165 | swift | //
// Level1UITests.swift
// Level1UITests
//
// Created by 太田 一毅 on 2019/04/13.
// Copyright © 2019 太田 一毅. All rights reserved.
//
import XCTest
class Level1UITests: 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.
}
}
| [
155665,
229414,
344106,
278571,
229425,
180279,
229431,
319543,
352314,
213051,
376892,
32829,
286787,
237638,
311373,
278607,
196687,
311377,
368732,
180317,
278637,
319599,
278642,
131190,
131199,
278669,
278676,
311447,
327834,
278684,
278690,
311459,
278698,
278703,
278707,
180409,
278713,
295099,
139459,
131270,
229591,
385240,
147679,
147680,
311520,
319719,
295147,
286957,
262403,
180494,
319764,
278805,
311582,
278817,
311596,
336177,
98611,
368949,
278843,
287040,
319812,
311622,
319816,
254285,
344402,
229716,
278895,
287089,
139641,
311679,
106893,
156069,
254373,
311723,
377265,
311739,
319931,
278974,
336319,
311744,
336323,
278979,
278988,
278992,
279000,
369121,
279009,
279014,
279017,
311787,
360945,
319986,
279030,
279033,
279042,
287237,
279053,
303634,
303635,
279060,
279061,
254487,
279066,
188954,
279092,
352831,
377419,
303693,
369236,
115287,
189016,
295518,
287327,
279143,
279150,
287345,
344697,
189054,
287359,
311944,
279176,
344714,
311948,
311950,
311953,
287379,
336531,
180886,
295575,
352921,
303772,
221853,
205469,
295591,
279207,
295598,
279215,
279218,
287412,
164532,
287418,
303802,
66243,
287434,
287438,
279249,
303826,
369365,
369366,
279253,
230105,
361178,
295653,
369383,
230120,
361194,
279278,
312046,
279293,
205566,
295688,
312076,
295698,
221980,
336678,
262952,
262953,
279337,
262957,
164655,
328495,
303921,
336693,
230198,
295745,
222017,
279379,
295769,
230238,
435038,
230239,
279393,
303973,
279398,
295797,
295799,
336765,
287623,
320394,
189327,
189349,
279465,
140203,
304050,
189373,
213956,
345030,
279499,
304086,
304104,
123880,
320492,
320495,
320504,
214009,
312313,
312317,
328701,
418819,
320520,
230411,
320526,
361487,
238611,
140311,
336930,
189487,
345137,
361522,
312372,
238646,
238650,
320571,
336962,
238663,
361547,
296023,
205911,
156763,
361570,
230500,
214116,
214119,
279659,
238706,
312435,
230514,
279666,
279686,
222344,
140426,
337037,
238764,
279729,
148674,
312519,
148687,
189651,
279766,
189656,
279775,
304352,
304353,
279780,
279789,
279803,
320769,
312588,
320795,
320802,
304422,
353581,
116014,
312628,
345397,
345398,
222523,
181568,
279874,
304457,
337226,
230730,
345418,
337228,
296269,
222542,
238928,
296274,
230757,
296304,
312688,
230772,
337280,
296328,
296330,
304523,
9618,
279955,
148899,
148900,
279979,
279980,
173492,
279988,
280003,
280011,
337359,
329168,
312785,
222674,
329170,
353751,
280025,
239069,
329181,
320997,
280042,
280043,
329198,
337391,
296434,
288252,
312830,
230922,
304655,
329231,
230933,
222754,
312879,
230960,
288305,
239159,
288319,
288322,
280131,
124486,
288328,
239192,
99937,
345697,
312937,
312941,
206447,
288377,
337533,
280193,
288391,
239251,
280217,
345753,
198304,
255651,
280252,
296636,
280253,
321217,
280259,
239305,
296649,
280266,
313042,
345813,
280279,
18139,
321250,
337638,
181992,
345832,
288492,
141037,
34547,
67316,
313082,
288508,
288515,
116491,
280333,
124691,
116502,
321308,
321309,
255781,
280367,
280373,
280377,
321338,
280381,
345918,
280386,
280391,
280396,
345942,
362326,
370526,
345950,
362336,
296807,
296815,
313200,
362351,
313204,
124795,
280451,
67464,
305032,
124816,
214936,
337816,
124826,
239515,
329627,
354210,
313257,
288698,
214978,
280517,
214983,
362442,
346066,
231382,
354268,
190437,
313322,
174058,
247786,
337899,
296942,
354283,
124912,
313338,
239610,
182277,
354312,
313356,
305173,
223269,
354342,
346153,
354346,
313388,
124974,
321589,
215095,
288829,
288835,
313415,
239689,
354386,
223317,
354394,
321632,
280676,
313446,
215144,
288878,
288890,
215165,
329884,
215204,
125108,
280761,
223418,
280767,
338118,
346319,
321744,
280792,
280803,
182503,
338151,
125166,
125170,
395511,
313595,
125180,
125184,
125192,
125197,
125200,
125204,
338196,
272661,
125215,
125216,
125225,
338217,
321839,
125236,
362809,
280903,
289109,
379224,
272730,
215395,
239973,
313703,
280938,
321901,
354671,
354672,
199030,
223611,
248188,
313726,
240003,
158087,
240020,
190870,
190872,
289185,
305572,
436644,
289195,
338359,
289229,
281038,
281039,
256476,
281071,
322057,
182802,
322077,
289328,
330291,
338491,
322119,
281165,
281170,
436831,
281200,
313970,
297600,
346771,
363155,
289435,
314020,
248494,
166581,
314043,
355006,
363212,
158424,
322269,
338658,
289511,
330473,
330476,
289517,
215790,
199415,
322302,
289534,
35584,
322312,
346889,
264971,
322320,
166677,
207639,
289580,
355129,
355136,
355138,
355147,
355148,
355153,
281426,
281434,
322396,
281444,
355173,
355174,
314240,
158594,
330627,
240517,
355216,
256920,
289691,
240543,
289699,
256934,
289704,
289720,
289723,
330688,
281541,
19398,
191445,
183258,
207839,
314343,
183276,
289773,
248815,
347122,
330759,
330766,
347150,
330789,
281647,
322609,
314437,
257093,
207954,
339031,
314458,
281699,
257126,
322664,
363643,
314493,
150656,
248960,
347286,
339101,
339106,
306339,
3243,
208044,
322733,
339131,
290001,
339167,
298209,
290030,
208123,
322826,
126229,
257323,
298290,
208179,
159033,
216387,
372039,
109899,
224591,
331091,
314708,
150868,
314711,
314721,
281958,
314727,
134504,
306541,
314734,
314740,
314742,
314745,
290170,
224637,
306558,
290176,
306561,
314759,
388488,
298378,
314765,
306580,
224662,
282008,
314776,
282013,
290206,
314788,
298406,
282023,
241067,
314797,
134586,
380350,
306630,
200136,
306634,
339403,
3559,
191980,
282097,
191991,
290304,
323079,
323083,
208397,
323088,
282132,
282135,
175640,
282147,
372261,
306730,
290359,
134715,
323132,
282182,
224848,
224852,
290391,
306777,
323171,
282214,
224874,
314997,
290425,
339579,
282244,
323208,
282248,
224907,
323226,
282272,
282279,
298664,
298666,
224951,
224952,
306875,
282302,
323262,
323265,
282309,
241360,
282321,
241366,
224985,
282330,
282336,
12009,
282347,
282349,
323315,
200444,
282366,
175874,
249606,
282375,
323335,
282379,
216844,
118549,
282390,
282399,
241440,
282401,
339746,
315172,
216868,
241447,
282418,
282424,
282428,
413500,
241471,
339782,
315209,
159563,
307024,
307030,
241494,
339799,
307038,
282471,
282476,
339840,
315265,
282503,
315272,
315275,
184207,
282517,
298912,
118693,
126896,
282572,
282573,
323554,
298987,
282634,
241695,
315431,
315433,
102441,
102446,
282671,
241717,
249912,
307269,
233548,
315468,
176209,
315477,
53334,
323678,
356446,
315489,
233578,
307306,
217194,
381071,
241809,
323730,
299166,
233635,
299176,
184489,
323761,
184498,
258233,
299197,
299202,
176325,
299208,
233678,
282832,
356575,
307431,
356603,
184574,
217352,
61720,
315674,
282908,
299294,
282912,
233761,
282920,
315698,
307514,
282938,
127292,
332100,
323914,
201037,
282959,
348499,
250196,
348501,
168280,
332128,
381286,
242027,
242028,
160111,
250227,
315768,
291193,
291194,
291200,
340356,
242059,
291225,
242079,
283039,
291266,
283088,
283089,
176602,
242138,
291297,
242150,
324098,
233987,
340489,
283154,
291359,
348709,
348710,
283185,
234037,
340539,
234044,
332379,
111197,
242274,
176751,
356990,
291455,
152196,
316044,
184974,
316048,
316050,
340645,
176810,
291529,
225996,
135888,
242385,
299737,
234216,
234233,
242428,
291584,
299777,
291591,
283418,
234276,
242481,
234290,
348999,
283466,
201562,
234330,
275294,
127840,
349025,
357219,
177002,
308075,
242540,
242542,
201590,
177018,
308093,
291713,
340865,
299912,
349066,
316299,
234382,
308111,
308113,
209820,
283551,
177074,
127945,
340960,
234469,
340967,
324587,
234476,
201721,
234499,
357380,
234513,
300087,
21567,
308288,
160834,
349254,
250955,
300109,
234578,
250965,
250982,
300145,
300147,
234626,
349317,
234635,
177297,
308375,
324761,
119965,
234655,
300192,
234662,
300200,
373937,
324790,
300215,
283841,
283846,
283849,
259275,
316628,
259285,
357594,
251124,
316661,
283894,
234741,
292092,
234756,
242955,
177420,
292145,
300342,
333115,
193858,
300354,
300355,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
292194,
234864,
316786,
243073,
292242,
112019,
234902,
374189,
284086,
259513,
284090,
54719,
415170,
292291,
300488,
300490,
234957,
144862,
300526,
259569,
308722,
251379,
300539,
210429,
366081,
292359,
218632,
316951,
374297,
349727,
374327,
210489,
235069,
349764,
194118,
292424,
292426,
333389,
128589,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
243306,
54895,
325246,
333438,
235136,
317102,
259780,
333508,
333522,
325345,
153318,
333543,
284410,
284425,
300812,
284430,
161553,
284436,
169751,
325403,
341791,
325411,
186148,
186149,
333609,
284460,
300849,
325444,
153416,
325449,
325460,
317268,
341846,
284508,
300893,
259937,
284515,
276326,
292713,
292719,
325491,
333687,
350072,
317305,
325508,
333700,
243592,
325514,
350091,
350092,
350102,
333727,
333734,
219046,
284584,
292783,
300983,
292835,
292838,
317416,
325620,
333827,
243720,
292901,
178215,
325675,
243763,
325695,
227432,
194667,
284789,
292987,
227459,
235661,
333968,
153752,
284827,
333990,
284843,
227517,
309443,
227525,
301255,
227536,
301270,
301271,
325857,
317676,
309504,
194832,
227601,
334104,
211239,
334121,
317738,
325930,
227655,
383309,
391521,
366948,
416103,
211327,
227721,
285074,
227730,
317851,
285083,
293275,
39323,
227743,
285089,
293281,
375211,
334259,
342454,
293309,
317889,
129484,
326093,
285152,
195044,
334315,
293368,
317949,
334345,
309770,
342537,
342560,
227881,
293420,
23093,
244279,
244280,
301635,
309831,
55880,
301647,
326229,
309847,
244311,
375396,
244326,
301688,
244345,
334473,
326288,
285348,
318127,
285360,
293552,
285362,
342705,
154295,
342714,
342757,
285419,
170735,
342775,
359166,
375552,
228099,
285443,
285450,
326413,
285457,
285467,
318247,
293673,
318251,
301872,
285496,
301883,
342846,
293702,
244569,
252766,
301919,
293729,
351078,
342888,
310132,
228214,
269179,
211835,
228232,
252812,
293780,
310166,
400282,
277404,
310177,
359332,
359333,
293801,
326571,
252848,
326580,
326586,
359365,
211913,
56270,
252878,
359380,
343020,
203758,
277493,
293894,
384015,
293911,
326684,
384031,
318515,
203829,
277600,
253028,
318571,
187508,
302202,
285819,
285823,
285833,
285834,
318602,
228492,
162962,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367798,
294075,
64699,
228541,
343230,
310496,
228587,
302319,
351475,
228608,
318732,
318746,
245018,
130342,
130344,
130347,
286012,
294210,
286019,
359747,
359748,
294220,
318804,
294236,
327023,
327030,
310650,
179586,
294278,
318860,
318876,
343457,
245160,
286128,
286133,
310714,
302523,
228796,
302530,
228804,
310725,
302539,
310731,
327122,
310747,
286176,
187877,
310758,
40439,
253431,
286201,
359931,
286208,
245249,
228868,
302602,
294413,
359949,
253456,
302613,
302620,
146976,
425534,
310853,
286281,
196184,
212574,
204386,
204394,
138862,
310896,
294517,
286344,
286351,
188049,
229021,
302751,
245413,
286387,
286392,
302778,
286400,
319176,
212684,
286419,
294621,
294629,
286457,
286463,
319232,
278273,
360194,
278292,
286507,
294699,
319289,
237397,
188250,
237411,
327556,
188293,
311183,
294806,
294808,
253851,
319393,
294820,
253868,
343993,
188349,
98240,
24531,
212953,
360416,
294887,
253930,
278507,
311277,
327666,
278515
] |
db3d10a6f986a6cac776861dfefb4439301782fc | 05122511b7a365c78a91768d6aca15d608af3e21 | /Study Problem/Study Problem/DataCacheNetwork.swift | 711cb3330606ae740637cc5af1f1425ed08ec6fe | [] | no_license | ShuntaNakajima/AskStudy | eef539e81e017ca02f816a57a286a87112ec5736 | 1ca9ed0ef1e276bf133b6e59a82c576f54db0fa1 | refs/heads/master | 2021-03-24T12:43:37.009152 | 2017-02-20T12:00:45 | 2017-02-20T12:00:45 | 72,967,813 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,119 | swift | //
// DataCacheNetwork.swift
// Study Problem
//
// Created by nakajimashunta on 2016/11/20.
// Copyright © 2016年 ShuntaNakajima. All rights reserved.
//
import Firebase
import SVProgressHUD
import TrueTime
import WebImage
class DataCacheNetwork{
func loadCache(limit:Int,success:@escaping ([Dictionary<String, AnyObject>]) -> Void,loadedimage:@escaping () -> Void){
let database = FIRDatabase.database().reference()
var posts = [Dictionary<String, AnyObject>]()
var photos = [Dictionary<String, AnyObject>]()
database.child("post").queryLimited(toLast: UInt(limit)).observe(.value, with: { snapshot in
if let snapshots = snapshot.children.allObjects as? [FIRDataSnapshot] {
posts = []
for snap in snapshots {
if var postDictionary = snap.value as? Dictionary<String, AnyObject> {
let key = snap.key
postDictionary["key"] = key as AnyObject?
posts.insert(postDictionary, at: 0)
}
}
}
for j in posts{
var aphoto=Dictionary<String, AnyObject>()
aphoto["key"] = j["key"]
aphoto["Photo"] = j["Photo"]
if j["Photo"] as! Int! != 0{
photos.append(aphoto)
}
}
success(posts)
})
}
func loadusername(uid:String,success:@escaping (String!) -> Void){
let database = FIRDatabase.database().reference()
var username = String()
let user = database.child("user").child(uid)
user.observe(FIRDataEventType.value, with: { snapshot in
username = (snapshot.value! as AnyObject)["username"] as! String
success(username)
}, withCancel: { (error) in
print(error)
})
}
func checkUser(client:TrueTimeClient,vc:Any,success:@escaping () -> Void){
if FIRAuth.auth()?.currentUser != nil{
let database = FIRDatabase.database().reference()
SVProgressHUD.show(withStatus: "loading userstate")
var now = Date()
client.fetchIfNeeded { result in
switch result {
case let .success(referenceTime):
now = referenceTime.now()
var myStatus = [Dictionary<String, AnyObject>]()
let recentUesrsQuery = (database.child("ban").queryOrdered(byChild: "uid").queryEqual(toValue: FIRAuth.auth()?.currentUser!.uid))
recentUesrsQuery.observe(.value, with: { snapshot in
if let snapshots = snapshot.children.allObjects as? [FIRDataSnapshot] {
for snap in snapshots{
if var postDictionary = snap.value as? Dictionary<String, AnyObject> {
let key = snap.key
postDictionary["key"] = key as AnyObject?
myStatus.append(postDictionary)
}
}
}
if myStatus.last?["date"] as? String != nil{
let date = (myStatus.last?["date"] as! String!).postDate()
if date.offset(toDate: now) != "Just"{
let storyboard = UIStoryboard(name: "BanScreenStoryboard", bundle: nil)
let viewController:UIViewController = storyboard.instantiateViewController(withIdentifier: "BanScreenStoryboard")
(vc as AnyObject).present(viewController, animated: true, completion: nil)
}
}
SVProgressHUD.show(withStatus: "loading data from database")
success()
})
case let .failure(error):
print("Error! \(error)")
}
}}
}
func cacheuserimage(uid:String!,success:@escaping (UIImage) -> Void){
_ = SDWebImageManager.shared().imageCache?.queryDiskCache(forKey: uid
, done: { (image,type: SDImageCacheType) -> Void in
if image != nil {
success(image!)
}else{
let storage = FIRStorage.storage()
let storageRef = storage.reference(forURL: "gs://studyproblemfirebase.appspot.com/user")
let autorsprofileRef = storageRef.child("/\(uid!)/profileimage.png")
autorsprofileRef.downloadURL{(URL,error) -> Void in
if error != nil {
let image = UIImage(named:"noimage.gif")
success(image!)
} else {
SDWebImageManager.shared().downloadImage(with: URL!,
options: SDWebImageOptions.cacheMemoryOnly,
progress: nil,
completed: {(image, error, a, c, s) in
SDWebImageManager.shared().imageCache.store(image, forKey: uid)
success(image!)
})
}
}
}
})
}
func cachereplayimage(post:String,uid:String,success:@escaping (UIImage) -> Void){
_ = SDWebImageManager.shared().imageCache?.queryDiskCache(forKey: post + uid
, done: { (image,type: SDImageCacheType) -> Void in
if image != nil {
success(image!)
}else{
let storage = FIRStorage.storage()
let storageRef = storage.reference(forURL: "gs://studyproblemfirebase.appspot.com/post/\(post)/reply")
let autorsprofileRef = storageRef.child("\(uid).png")
autorsprofileRef.downloadURL{(URL,error) -> Void in
if error != nil {
let image = UIImage(named:"noimage.gif")
success(image!)
} else {
SDWebImageManager.shared().downloadImage(with: URL!,
options: SDWebImageOptions.cacheMemoryOnly,
progress: nil,
completed: {(image, error, a, c, s) in
SDWebImageManager.shared().imageCache.store(image, forKey: post + uid)
success(image!)
})
}
}
}
})
}
}
| [
-1
] |
bf1d96f403d26e50e193903b4594a850af476a1c | 044f6f9cb3921849f6634891fb3e46f3839fe1a5 | /FoodTrackerTests/FoodTrackerTests.swift | 356ae50c0dcf5b1b987ff785c8a160ebce4a17ac | [] | no_license | Nzubareva/FoodTracker | e6def921f56e98c70b17c7221f041651729ff6be | 76b8e5bc17b21e557f67910108bd1b776c013ac5 | refs/heads/master | 2020-03-11T05:18:59.320345 | 2018-04-19T09:01:00 | 2018-04-19T09:01:00 | 129,799,476 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,372 | swift | //
// FoodTrackerTests.swift
// FoodTrackerTests
//
// Created by Natallia Zubareva on 16.04.2018.
// Copyright © 2018 Natallia. All rights reserved.
//
import XCTest
@testable import FoodTracker
class FoodTrackerTests: XCTestCase {
//MARK: Meal Class Tests
// Confirm that the Meal initializer returns a Meal object when passed valid parameters.
func testMealInitializationSucceeds() {
// Zero rating
let zeroRatingMeal = Meal.init(name: "Zero", photo: nil, rating: 0)
XCTAssertNotNil(zeroRatingMeal)
// Highest positive rating
let positiveRatingMeal = Meal.init(name: "Positive", photo: nil, rating: 5)
XCTAssertNotNil(positiveRatingMeal)
}
// Confirm that the Meal initialier returns nil when passed a negative rating or an empty name.
func testMealInitializationFails() {
// Negative rating
let negativeRatingMeal = Meal.init(name: "Negative", photo: nil, rating: -1)
XCTAssertNil(negativeRatingMeal)
// Rating exceeds maximum
let largeRatingMeal = Meal.init(name: "Large", photo: nil, rating: 6)
XCTAssertNil(largeRatingMeal)
// Empty String
let emptyStringMeal = Meal.init(name: "", photo: nil, rating: 0)
XCTAssertNil(emptyStringMeal)
}
}
| [
293671,
217193,
306997,
314426,
298719
] |
5b5897494dbc65b18fe3bc2e90da84f6cd67e4b7 | 617986923905f6d17c9a779277150d87fe270616 | /AptFinder/Struct.swift | a873d5fd88f08ca6ce601dd16c3f86e4fe4a064c | [] | no_license | dylancastillo/hack-challenge-ios | 25e3dc26147ad42f624e508a6b1f05f08aec5038 | 04b0465eeeec588f72350a50e29167a142b4ee6f | refs/heads/master | 2020-09-28T13:01:59.874293 | 2019-12-09T04:27:16 | 2019-12-09T04:27:16 | 226,783,946 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,258 | swift | //
// Struct.swift
// AptFinder
//
// Created by Jade Meyer on 12/8/19.
// Copyright © 2019 Mark Meyer. All rights reserved.
//
import Foundation
struct CreateApartment: Encodable {
let img: String
let title: String
let info: String
let address: String
let phone: String
let email: String
enum CodingKeys: String, CodingKey {
case img = "img"
case title = "title"
case info = "info"
case address = "address"
case phone = "phone"
case email = "email"
}
}
struct Apartment: Decodable {
let img: String
let title: String
let info: String
let address: String
let phone: String
let email: String
enum CodingKeys: String, CodingKey {
case img = "img"
case title = "title"
case info = "info"
case address = "address"
case phone = "phone"
case email = "email"
}
}
struct ApartmentResponse: Decodable {
let success: Bool
let data: [Apartment]
enum CodingKeys: String, CodingKey {
case success = "success"
case data = "data"
}
}
struct Result: Decodable {
let success: Bool
enum CodingKeys: String, CodingKey {
case success = "success"
}
}
| [
-1
] |
80593f340888cbd11fcd3886c32fd2c8b4814eec | 0818f544b6eabb4bb4a453207cf0fe7f66e99272 | /PizzaMe/DataStructures/Review.swift | ff7f189da04cfcb6878e3494b83241d34d793efa | [] | no_license | soriyanykeo/PizzaMe | f12cb454f8015a5ea9dbf52d64ca936597564c8a | 028c5798b5c979510791283b5e69c7e8342ab534 | refs/heads/master | 2021-01-20T18:39:54.916970 | 2016-06-27T21:39:18 | 2016-06-27T21:39:18 | 62,072,626 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 813 | swift | //
// Review.swift
// PizzaMe
//
// Created by Soriyany keo on 6/26/16.
// Copyright © 2016 Soriyany. All rights reserved.
//
import Foundation
class Review{
var averageRating:String?
var totalRatings:String?
var totalReviews:String?
var lastReviewDate:String?
var lastReviewIntro:String?
init(reviewObject:NSDictionary){
//mapJSONToReViewObject
self.averageRating = reviewObject.valueForKey("AverageRating") as? String
self.totalRatings = reviewObject.valueForKey("TotalRatings") as? String
self.totalReviews = reviewObject.valueForKey("TotalReviews") as? String
self.lastReviewDate = reviewObject.valueForKey("LastReviewDate") as? String
self.lastReviewIntro = reviewObject.valueForKey("LastReviewIntro") as? String
}
} | [
-1
] |
750b3d9947a0656a90d1c4f9fdb734ba052a6697 | a4be3d662137c4275363d196d9b8352cfbbecbc9 | /TextField-password-swift/ViewController.swift | 73b85a45f7e0fdabd2ca313abd4357b8f4824849 | [] | no_license | syu3/Textfield-Password-swift | 1c5b635d8b002797c04402434cf0dba3d65eed1c | a22d3ac6ddb3e7cd94133b0de843326e1170ae96 | refs/heads/master | 2016-09-05T17:05:31.509679 | 2015-03-05T13:32:10 | 2015-03-05T13:32:10 | 31,715,049 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,263 | swift | //
// ViewController.swift
// TextField-password-swift
//
// Created by 加藤 周 on 2015/03/05.
// Copyright (c) 2015年 mycompany. All rights reserved.
//
import UIKit
class ViewController: UIViewController,UITextFieldDelegate {
@IBOutlet weak var myTextField: UITextField!
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// 背景をオレンジ色に設定.
self.view.backgroundColor = UIColor.orangeColor()
// Delegateを設定.
myTextField.delegate = self
// 枠の線を表示.
myTextField.borderStyle = UITextBorderStyle.RoundedRect
// UITextFieldの表示する位置.
myTextField.layer.position = CGPointMake(self.view.bounds.width/2, 100)
// 入力された文字を非表示モードにする.
myTextField.secureTextEntry = true
// 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.
}
@IBAction func go(sender: AnyObject) {
label.text=myTextField.text
}
}
| [
-1
] |
4e04cf4b692c789dbb555d65347adb8da62d1556 | 2c301983aef28fb67242026590cca4ea1abccc13 | /DiaBLE/Nightscout.swift | 36dbe6a6beae7e774fc332eca67f5674d8815a51 | [] | no_license | markthomas93/DiaBLE | 068f0c7b17793309052b0e34fb966ee80359fd19 | b7cd04b9610673f8dcec5ad58e2163b113a084a5 | refs/heads/master | 2022-04-28T22:16:54.360225 | 2020-04-28T19:14:53 | 2020-04-28T19:14:53 | 259,732,375 | 0 | 1 | null | 2020-04-28T19:30:16 | 2020-04-28T19:30:15 | null | UTF-8 | Swift | false | false | 9,642 | swift | import Foundation
#if !os(watchOS)
import WebKit
#endif
class Nightscout: NSObject {
/// Main app delegate
var main: MainDelegate
#if !os(watchOS)
var webView: WKWebView?
#endif
init(main: MainDelegate) {
self.main = main
}
// https://github.com/ps2/rileylink_ios/blob/master/NightscoutUploadKit/NightscoutUploader.swift
// https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Managers/NightScout/NightScoutUploadManager.swift
// TODO: use URLQueryItems paramaters
func request(endpoint: String = "", query: String = "", handler: @escaping (Data?, URLResponse?, Error?, [Any]) -> Void) {
var url = "https://\(main.settings.nightscoutSite)"
if !endpoint.isEmpty { url += ("/" + endpoint) }
if !query.isEmpty { url += ("?" + query) }
if let url = URL(string: url) {
var request = URLRequest(url: url)
main.debugLog("Nightscout: URL request: \(request.url!.absoluteString)")
request.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data { self.main.debugLog("Nightscout: response data: \(data.string)")
if let json = try? JSONSerialization.jsonObject(with: data) {
if let array = json as? [Any] {
DispatchQueue.main.async {
handler(data, response, error, array)
}
}
}
}
}.resume()
}
}
func read(handler: (([Glucose]) -> ())? = nil) {
request(endpoint: "api/v1/entries.json", query: "count=100") {data, response, error, array in
var values = [Glucose]()
for item in array {
if let dict = item as? [String: Any] {
if let value = dict["sgv"] as? Int, let id = dict["date"] as? Int, let device = dict["device"] as? String {
values.append(Glucose(value, id: id, date: Date(timeIntervalSince1970: Double(id)/1000), source: device))
}
}
}
if values.count > 0 {
DispatchQueue.main.async {
self.main.history.nightscoutValues = values
handler?(values)
}
}
}
}
func post(_ jsonObject: Any, endpoint: String = "", handler: (((Data?, URLResponse?, Error?) -> Void))? = nil) {
let json = try! JSONSerialization.data(withJSONObject: jsonObject, options: [])
var request = URLRequest(url: URL(string: "https://\(main.settings.nightscoutSite)/\(endpoint)")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField:"Content-Type")
request.setValue("application/json", forHTTPHeaderField:"Accept")
request.setValue(main.settings.nightscoutToken.sha1, forHTTPHeaderField:"api-secret")
URLSession.shared.uploadTask(with: request, from: json) { data, response, error in
if let error = error {
self.main.log("Nightscout: error: \(error.localizedDescription)")
}
if let response = response as? HTTPURLResponse {
let status = response.statusCode
if status == 401 {
self.main.log("Nightscout: POST not authorized")
}
if let data = data {
self.main.debugLog("Nightscout: post \((200..<300).contains(status) ? "success" : "error") (\(status)): \(data.string)")
}
}
DispatchQueue.main.async {
handler?(data, response, error)
}
}.resume()
}
func post(entries: [Glucose], handler: (((Data?, URLResponse?, Error?) -> Void))? = nil) {
let dictionaryArray = entries.map { [
"type": "sgv",
"dateString": ISO8601DateFormatter().string(from: $0.date),
"date": Int64(($0.date.timeIntervalSince1970 * 1000.0).rounded()),
"sgv": $0.value,
"device": $0.source // TODO
// "direction": "NOT COMPUTABLE", // TODO
]
}
post(dictionaryArray, endpoint: "api/v1/entries") { data, response, error in
DispatchQueue.main.async {
handler?(data, response, error)
}
}
}
func delete(endpoint: String = "api/v1/entries", query: String = "", handler: (((Data?, URLResponse?, Error?) -> Void))? = nil) {
var url = "https://\(main.settings.nightscoutSite)"
if !endpoint.isEmpty { url += ("/" + endpoint) }
if !query.isEmpty { url += ("?" + query) }
var request = URLRequest(url: URL(string: url)!)
main.debugLog("Nightscout: DELETE request: \(request.url!.absoluteString)")
request.httpMethod = "DELETE"
request.setValue("application/json", forHTTPHeaderField:"Content-Type")
request.setValue("application/json", forHTTPHeaderField:"Accept")
request.setValue(main.settings.nightscoutToken.sha1, forHTTPHeaderField:"api-secret")
URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
self.main.log("Nightscout: error: \(error.localizedDescription)")
}
if let response = response as? HTTPURLResponse {
let status = response.statusCode
if status == 401 {
self.main.log("Nightscout: DELETE not authorized")
}
if let data = data {
self.main.debugLog("Nightscout: delete \((200..<300).contains(status) ? "success" : "error") (\(status)): \(data.string)")
}
}
DispatchQueue.main.async {
handler?(data, response, error)
}
}.resume()
}
// TODO:
func test(handler: (((Data?, URLResponse?, Error?) -> Void))? = nil) {
var request = URLRequest(url: URL(string: "https://\(main.settings.nightscoutSite)/api/v1/entries.json?token=\(main.settings.nightscoutToken)")!)
request.setValue("application/json", forHTTPHeaderField:"Content-Type")
request.setValue("application/json", forHTTPHeaderField:"Accept")
request.setValue(main.settings.nightscoutToken.sha1, forHTTPHeaderField:"api-secret")
URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
self.main.log("Nightscout: authorization error: \(error.localizedDescription)")
}
if let response = response as? HTTPURLResponse {
let status = response.statusCode
if status == 401 {
self.main.log("Nightscout: not authorized")
}
if let data = data {
self.main.debugLog("Nightscout: authorization \((200..<300).contains(status) ? "success" : "error") (\(status)): \(data.string)")
}
}
DispatchQueue.main.async {
handler?(data, response, error)
}
}.resume()
}
}
#if !os(watchOS)
extension Nightscout: WKNavigationDelegate, WKUIDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
main.debugLog("Nightscout: decide policy for action: \(navigationAction)")
decisionHandler(.allow)
main.debugLog("Nightscout: allowed action: \(navigationAction)")
}
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
main.debugLog("Nightscout: decide policy for response: \(navigationResponse)")
decisionHandler(.allow)
main.debugLog("Nightscout: allowed response: \(navigationResponse)")
}
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
main.log("Nightscout: webView did fail: \(error.localizedDescription)")
}
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
main.log("Nightscout: create veb view for action: \(navigationAction)")
// if navigationAction.targetFrame == nil {
webView.load(navigationAction.request)
// }
return nil
}
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
main.log("Nightscout: JavaScript alert panel message: \(message)")
main.app.JavaScriptConfirmAlertMessage = message
main.app.showingJavaScriptConfirmAlert = true
// TODO: block web page updates
completionHandler()
}
func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) {
main.log("Nightscout: TODO: JavaScript confirm panel message: \(message)")
main.app.JavaScriptConfirmAlertMessage = message
main.app.showingJavaScriptConfirmAlert = true
// TODO: block web page updates
completionHandler(true)
}
}
#endif
| [
-1
] |
ec23c5bd33bb4ffbf9903aa1ae7a70779e310785 | fc08121319f93e7122b51d5f70ebde204b4b753f | /Incord/Controller/CreateAccountViewController.swift | 1b9edf20350cfacea06e940a0751386f210bc402 | [] | no_license | Cartisim/Incord | fec9378f5ed5bba218305c3903e2e9a57dbded65 | 3c0b0d5a2714ebb388e63d38df8936e640c19535 | refs/heads/master | 2020-06-03T22:33:11.306016 | 2020-03-10T01:15:57 | 2020-03-10T01:15:57 | 191,758,211 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,021 | swift | //
// CreateAccountViewController.swift
// Incord
//
// Created by Cole M on 6/21/19.
// Copyright © 2019 Cole M. All rights reserved.
//
import Cocoa
import KeychainSwift
class CreateAccountViewController: NSViewController {
@IBOutlet weak var userNameTextField: NSTextField!
@IBOutlet weak var emailTextField: NSTextField!
@IBOutlet weak var passwordTextField: NSSecureTextField!
@IBOutlet weak var reEnterPasswordTextField: NSSecureTextField!
@IBOutlet weak var avatarImageView: NSImageView!
@IBOutlet weak var createAccountButton: NSButton!
@IBOutlet weak var progressIndicator: NSProgressIndicator!
let avatarPopover = NSPopover()
var avatarString = "avatar1"
static let shared = CreateAccountViewController()
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
setUpView()
avatarPopover.delegate = self
progressIndicator.stopAnimation(self)
progressIndicator.isHidden = true
}
func setUpView() {
avatarImageView.image = NSImage(named: avatarString)
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
}
lazy var errorViewController: NSViewController = {
return self.storyboard?.instantiateController(withIdentifier: "ErrorVC") as! NSViewController
}()
lazy var mismatchViewController: NSViewController = {
return self.storyboard!.instantiateController(withIdentifier: "MismatchVC") as! NSViewController
}()
lazy var logOutViewController: NSViewController = {
return self.storyboard!.instantiateController(withIdentifier: "LogOutVC") as! NSViewController
}()
@IBAction func chooseAvatarClicked(_ sender: NSButton) {
avatarPopover.contentViewController = AvatarViewController(nibName: "Avatars", bundle: nil)
avatarPopover.show(relativeTo: avatarImageView.bounds, of: avatarImageView, preferredEdge: .minX)
avatarPopover.behavior = .transient
}
@IBAction func createAccountClicked(_ sender: NSButton) {
self.progressIndicator.startAnimation(self)
self.progressIndicator.isHidden = false
if UserData.shared.isLoggedIn != true {
if passwordTextField.stringValue == reEnterPasswordTextField.stringValue, userNameTextField.stringValue.isEmpty == false, emailTextField.stringValue.isEmpty == false {
Authentication.shared.createUser(username: userNameTextField.stringValue, email: emailTextField.stringValue, password: passwordTextField.stringValue, avatar: UserData.shared.avatarName, completion: { (res) in
switch res {
case .success(let user):
print(user)
DispatchQueue.main.async {
Authentication.shared.login(email: self.emailTextField.stringValue, password: self.passwordTextField.stringValue, completion: { (res) in
switch res {
case .success(let login):
DispatchQueue.main.async {
Users.shared.currentUser(id: login.createAccountID) { (res) in
switch res {
case .success(let user):
print(user.email)
DispatchQueue.main.async {
UserData.shared.avatarName = user.avatar
UserData.shared.userEmail = user.email
UserData.shared.id = user.id!.uuidString
UserData.shared.username = user.username
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
NotificationCenter.default.post(name: NEW_CHANNEL, object: nil)
NotificationCenter.default.post(name: USER_DATA_CHANGED, object: nil)
NotificationCenter.default.post(name: GET_ALL_USERS, object: nil)
NotificationCenter.default.post(name: SET_TITLE_TO_LOGOUT, object: nil)
self.dismiss(self)
}
case .failure(let err):
print(err)
}
}
print(login)
}
case .failure(let err):
print(err)
DispatchQueue.main.async {
self.view.window?.contentViewController?.presentAsSheet(self.errorViewController)
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
}
}
})
}
case .failure(let err):
print(err)
DispatchQueue.main.async {
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
}
}
})
} else {
print("passwords must match")
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
self.view.window?.contentViewController?.presentAsSheet(self.mismatchViewController)
}
} else {
self.progressIndicator.stopAnimation(self)
self.progressIndicator.isHidden = true
view.window?.contentViewController?.presentAsSheet(logOutViewController)
}
}
@IBAction func closeSheetClicked(_ sender: NSButton) {
dismiss(self)
}
@IBAction func createAccountOnEnterClicked(_ sender: NSTextField) {
// createAccountButton.performClick(nil)
}
}
extension CreateAccountViewController: NSPopoverDelegate {
func popoverDidClose(_ notification: Notification) {
if UserData.shared.avatarName != "" {
avatarImageView.image = NSImage(named: UserData.shared.avatarName)
avatarString = UserData.shared.avatarName
}
}
}
| [
-1
] |
71baeda40f902a910278dc03332a7bcd30148c97 | 216eb6345085967746c7eb2ef9b0911ba567c297 | /test/Sema/diag_values_of_module_type.swift | 5b1527e7cb8b4a1b5efc6d7a3e1b7e34d79d068c | [
"Apache-2.0",
"Swift-exception"
] | permissive | 1043426357/swift | f762f00b188d420b0646d2682106aa418846a45a | bfba3a79680819874b081acf9fc9869628d3f082 | refs/heads/master | 2021-01-22T06:53:58.185979 | 2016-01-05T00:39:03 | 2016-01-05T00:45:31 | 49,036,550 | 2 | 0 | null | 2018-01-13T10:45:52 | 2016-01-05T02:25:26 | C++ | UTF-8 | Swift | false | false | 3,814 | swift | // RUN: %target-parse-verify-swift -I %S/Inputs -enable-source-import
import diag_values_of_module_type_foo
//===--- Allowed uses of module names.
var zero: Int8 = 0
var goodGlobal1: Swift.Int
var goodGlobal2 = Swift.Int(zero)
var goodGlobal3 = diag_values_of_module_type_foo.SomeStruct(a: 0)
class GoodClass1 : diag_values_of_module_type_foo.SomeClass {}
struct GoodStruct1 : diag_values_of_module_type_foo.SomeProtocol {
typealias Foo = Swift.Int
}
struct GoodStruct2 {
var instanceVar1: Swift.Int
var instanceVar2 = Swift.Int(zero)
var instanceVar3 = diag_values_of_module_type_foo.SomeStruct(a: 0)
static var staticVar1: Swift.Int = 42
static var staticVar2 = Swift.Int(zero)
static var staticVar3 = diag_values_of_module_type_foo.SomeStruct(a: 0)
}
enum GoodEnum {
case Foo1(Swift.Int)
}
protocol GoodProtocol1 : diag_values_of_module_type_foo.SomeProtocol {
typealias GoodTypealias1 : diag_values_of_module_type_foo.SomeProtocol
}
typealias GoodTypealias1 = Swift.Int
func goodTest1() {
_ = Swift.Int(zero)
var _ : diag_values_of_module_type_foo.SomeClass
var _ : diag_values_of_module_type_foo.SomeClass.NestedClass
var _ : diag_values_of_module_type_foo.SomeStruct
var _ : diag_values_of_module_type_foo.SomeEnum
var _ : diag_values_of_module_type_foo.SomeExistential
var _ : diag_values_of_module_type_foo.SomeTypealias
_ = diag_values_of_module_type_foo.SomeClass()
_ = diag_values_of_module_type_foo.SomeClass.NestedClass()
_ = diag_values_of_module_type_foo.SomeClass.staticFunc1
_ = diag_values_of_module_type_foo.SomeClass.staticFunc1()
_ = diag_values_of_module_type_foo.SomeClass.staticVar1
_ = diag_values_of_module_type_foo.SomeStruct()
_ = diag_values_of_module_type_foo.SomeEnum.Foo
// Cannot default-construct a protocol.
// _ = diag_values_of_module_type_foo.SomeExistential()
_ = diag_values_of_module_type_foo.SomeTypealias()
_ = diag_values_of_module_type_foo.someGlobal
diag_values_of_module_type_foo.someGlobal = 42
_ = diag_values_of_module_type_foo.someFunc
diag_values_of_module_type_foo.someFunc()
}
func goodTest2a(a: Swift.Int) {}
func goodTest2b(a: Swift.Int, withInt b: Swift.Int) {}
func goodTest3() -> Swift.Int {}
func goodTest4<T : diag_values_of_module_type_foo.SomeProtocol>(_: T) {}
func goodTest5<T : diag_values_of_module_type_foo.SomeProtocol
where T.Foo == Swift.Int>(_: T) {}
//===--- Disallowed uses of module names.
var badGlobal1 = Swift // expected-error {{expected module member name after module name}}
class BadClass1 {
var instanceVar1 = Swift // expected-error {{expected module member name after module name}}
func instanceFunc1() {
instanceVar1 = Swift // expected-error {{expected module member name after module name}}
}
}
func badTest1() {
var x = Swift // expected-error {{expected module member name after module name}}
x = Swift // expected-error {{expected module member name after module name}}
_ = x
}
func badTest2() {
var x = 0
x = Swift // expected-error {{cannot assign value of type 'module<Swift>' to type 'Int'}}
_ = x
}
func badTest3() {
var x = Swift. // expected-error {{postfix '.' is reserved}} expected-error {{expected member name following '.'}}
}
func badTest4() {
Swift // expected-error {{expected module member name after module name}}
}
func badTest5() {
Swift. // expected-error {{postfix '.' is reserved}} expected-error {{expected member name following '.'}}
}
func badTest6() {
_ = { () -> Int in
_ = Swift // expected-error {{expected module member name after module name}}
return 42 }()
_ = { Swift }() // expected-error {{expected module member name after module name}}
_ = { { Swift }() }() // expected-error {{expected module member name after module name}}
}
| [
89833,
71399
] |
e114bb45a6512b05ff010003e07b4e41269387b6 | 1c71432022501f2766fd9ceee05c1b24b637669c | /CalendarTests/CalendarTests.swift | d9e927ef6533d686efd86e5782317c7fca64d693 | [] | no_license | stewartyu/calendar-app | 084a1f21e0feb818b05da58ecbb9a01b6ec90400 | fe89883b000648534ad35da2dba5250975d40935 | refs/heads/master | 2021-01-13T04:36:54.631763 | 2016-03-01T04:04:24 | 2016-03-01T04:04:24 | 52,653,369 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 979 | swift | //
// CalendarTests.swift
// CalendarTests
//
// Created by Stewart Yu on 2016-02-26.
// Copyright © 2016 Stewart Yu. All rights reserved.
//
import XCTest
@testable import Calendar
class CalendarTests: 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.
}
}
}
| [
282633,
313357,
182296,
241692,
98333,
16419,
229413,
102437,
354343,
204840,
354345,
227370,
278570,
292902,
233517,
155694,
309295,
229424,
282672,
223274,
344107,
237620,
124975,
229430,
253999,
346162,
319542,
124984,
358456,
288833,
288834,
286788,
352326,
311372,
354385,
196691,
223316,
280661,
315476,
278615,
329814,
307289,
354393,
338007,
200794,
237663,
315487,
309345,
45153,
280675,
227428,
280677,
313447,
278634,
131178,
315498,
278638,
288879,
319598,
352368,
299121,
284788,
233589,
223350,
233590,
280694,
131191,
333940,
237689,
215164,
313469,
215166,
131198,
292992,
278655,
194691,
227460,
333955,
280712,
215178,
235662,
311438,
278670,
241808,
323729,
325776,
317587,
278677,
284825,
284826,
278685,
346271,
311458,
278691,
233636,
49316,
333991,
333992,
284841,
233642,
284842,
323236,
32941,
278704,
239793,
299187,
278708,
125109,
131256,
227513,
278714,
223419,
280762,
182456,
299198,
184505,
280768,
379071,
299203,
227524,
309444,
301251,
338119,
280778,
282831,
321745,
254170,
280795,
227548,
229597,
301279,
311519,
356576,
280802,
338150,
176362,
286958,
125169,
338164,
327929,
227578,
184570,
243962,
125183,
309503,
125188,
313608,
125193,
375051,
278797,
180493,
125198,
325905,
254226,
125203,
125208,
325912,
282909,
299293,
278816,
237857,
125217,
211235,
217380,
233762,
211238,
282919,
305440,
151847,
125235,
332085,
280887,
125240,
332089,
278842,
315706,
282939,
307517,
287041,
260418,
241986,
139589,
280902,
319813,
227654,
311621,
332101,
182598,
323916,
319821,
254286,
348492,
250192,
6481,
323920,
344401,
348500,
278869,
366929,
155990,
366930,
6489,
379225,
272729,
323935,
106847,
391520,
321894,
416104,
280939,
242029,
246127,
285040,
313713,
242033,
354676,
139640,
246136,
246137,
291192,
311681,
362881,
248194,
225670,
395659,
227725,
395661,
240016,
178582,
291224,
285084,
317852,
283038,
300489,
61857,
285090,
61859,
289189,
375207,
340398,
377264,
299441,
61873,
293303,
283064,
61880,
278970,
319930,
336317,
293310,
278978,
127427,
127428,
283075,
291267,
188871,
324039,
278989,
317901,
281040,
278993,
326100,
278999,
328152,
176601,
242139,
369116,
188894,
287198,
279008,
160225,
285150,
358882,
342498,
279013,
242148,
195045,
279018,
291311,
281072,
309744,
279029,
279032,
233978,
279039,
291333,
342536,
287241,
279050,
340490,
303631,
283153,
279057,
279062,
289304,
279065,
342553,
291358,
182817,
180771,
375333,
377386,
244269,
283182,
283184,
236081,
234036,
23092,
279094,
315960,
352829,
70209,
309830,
301638,
348742,
55881,
322120,
348749,
281166,
281171,
287318,
309846,
244310,
295519,
354911,
436832,
66150,
111208,
279144,
279146,
344680,
191082,
313966,
281199,
295536,
287346,
287352,
301689,
279164,
189057,
311941,
348806,
279177,
369289,
152203,
330379,
344715,
287374,
184973,
311949,
330387,
330388,
352917,
227990,
295576,
314009,
230040,
303771,
221852,
271000,
342682,
279206,
295590,
279210,
287404,
285361,
303793,
299699,
342706,
279217,
166582,
299700,
314040,
287417,
158394,
303803,
164533,
285373,
287422,
342713,
66242,
287433,
225995,
154316,
363211,
287439,
279252,
96984,
287452,
318173,
289502,
363230,
295652,
279269,
338662,
285415,
342762,
346858,
293612,
289518,
312047,
279280,
199414,
154359,
230134,
299770,
234234,
221948,
279294,
35583,
205568,
242433,
295682,
299776,
285444,
162561,
363263,
322313,
322319,
295697,
291604,
166676,
207640,
285466,
283419,
326429,
336671,
293664,
326433,
344865,
234277,
283430,
279336,
289576,
262954,
293672,
295724,
312108,
318250,
301871,
164656,
303920,
262962,
152365,
318252,
353069,
234294,
328499,
242485,
285497,
353078,
230199,
353079,
289598,
160575,
281408,
336702,
295746,
420677,
318278,
353094,
353095,
299849,
283467,
201551,
293711,
281427,
353109,
281433,
230234,
234331,
301918,
295776,
279392,
293730,
303972,
351077,
275303,
230248,
177001,
342887,
308076,
242541,
400239,
246641,
330609,
174963,
207732,
310131,
209783,
228215,
209785,
279417,
246648,
308092,
269178,
177019,
361337,
158593,
254850,
359298,
113542,
287622,
240518,
228233,
228234,
308107,
56208,
308112,
234386,
295824,
293781,
209817,
324506,
324507,
277403,
318364,
310176,
310178,
189348,
324517,
283558,
289703,
279464,
293800,
353195,
140204,
236461,
293806,
353197,
304051,
189374,
353216,
349121,
363458,
213960,
279498,
316364,
183248,
338899,
340955,
248797,
207838,
50143,
130016,
340961,
64485,
314342,
234472,
234473,
123881,
324586,
289774,
183279,
304110,
320494,
340974,
287731,
277492,
316405,
240630,
295927,
201720,
304122,
314362,
320507,
328700,
328706,
234500,
277509,
320516,
322570,
230410,
320527,
146448,
324625,
234514,
238610,
277524,
316437,
140310,
418837,
197657,
281626,
201755,
175132,
336929,
189474,
300068,
357414,
248872,
345132,
238639,
300084,
252980,
322612,
359478,
324666,
238651,
302139,
308287,
21569,
359495,
238664,
300111,
314448,
234577,
341073,
296019,
353367,
234587,
156764,
277597,
304222,
156765,
281697,
302177,
314467,
281700,
250981,
300135,
322663,
300136,
228458,
207979,
279660,
316520,
316526,
15471,
144496,
234609,
312434,
357486,
187506,
353397,
285814,
300151,
279672,
160891,
285820,
341115,
300158,
363644,
150657,
187521,
234625,
285828,
279685,
285830,
222343,
302216,
302213,
248961,
228491,
349316,
349318,
234638,
228493,
285838,
169104,
162961,
177296,
308372,
185493,
326804,
238743,
296086,
119962,
283802,
296092,
285851,
300187,
300188,
339102,
330913,
306338,
302240,
343203,
234663,
300201,
249002,
281771,
300202,
238765,
253099,
279728,
238769,
367799,
208058,
339130,
64700,
228540,
228542,
283840,
302274,
279747,
343234,
367810,
259268,
283847,
353479,
62665,
353481,
353482,
283852,
244940,
283853,
279760,
290000,
228563,
189652,
279765,
296153,
357595,
279774,
304351,
298212,
304356,
330984,
279785,
228588,
234733,
253167,
279792,
353523,
298228,
302325,
234742,
228600,
216315,
292091,
208124,
316669,
363771,
388349,
228609,
279814,
322824,
242954,
292107,
312587,
328971,
251153,
173334,
245019,
320796,
126237,
339234,
130338,
130343,
279854,
351537,
345396,
300343,
116026,
222524,
286013,
286018,
279875,
193859,
300359,
230729,
294218,
234827,
224586,
222541,
296270,
234831,
238927,
296273,
372043,
177484,
251213,
120148,
318805,
283991,
357719,
222559,
314720,
292195,
294243,
230756,
281957,
163175,
333160,
230765,
284014,
279920,
243056,
312689,
296307,
314739,
116084,
327025,
327031,
181625,
290173,
306559,
224640,
179587,
378244,
298374,
314758,
314760,
142729,
388487,
368011,
314766,
296335,
112017,
112018,
306579,
234898,
282007,
357786,
318875,
290207,
314783,
333220,
314789,
279974,
282022,
282024,
241066,
316842,
286129,
173491,
304564,
279989,
210358,
284089,
228795,
292283,
302529,
302531,
163268,
380357,
415171,
300487,
306631,
296392,
280010,
361927,
310732,
280013,
302540,
64975,
312782,
306639,
310736,
370123,
148940,
327121,
222675,
366037,
210390,
210391,
212442,
228827,
286172,
239068,
353750,
210393,
280032,
144867,
310757,
187878,
316902,
280041,
361963,
54765,
191981,
306673,
321009,
308723,
251378,
306677,
343542,
300535,
280055,
288249,
286202,
300536,
290300,
286205,
302590,
343543,
294400,
290301,
282114,
210433,
306692,
306693,
292356,
228867,
366083,
323080,
230921,
253452,
296461,
323087,
304656,
282129,
329232,
316946,
308756,
146964,
398869,
282136,
308764,
282141,
349726,
302623,
282146,
306723,
286244,
245287,
245292,
349741,
286254,
169518,
230959,
288309,
290358,
288318,
235070,
280130,
349763,
124485,
56902,
282183,
218696,
288327,
292425,
288326,
243274,
128587,
333388,
228943,
286288,
333393,
290390,
300630,
306776,
235095,
196187,
239198,
343647,
286306,
374372,
282213,
317032,
323178,
54893,
138863,
222832,
314998,
247416,
288378,
366203,
175741,
337535,
294529,
239237,
282246,
286343,
282245,
229001,
288392,
290443,
224901,
310923,
188048,
323217,
239250,
282259,
345752,
229020,
282271,
282273,
302754,
255649,
282276,
40613,
40614,
40615,
282280,
290471,
229029,
298667,
300714,
245412,
298661,
286388,
286391,
321207,
296632,
319162,
280251,
282303,
286399,
280257,
218819,
321219,
282312,
306890,
280267,
302797,
212685,
333517,
333520,
241361,
302802,
245457,
333521,
333523,
280278,
282327,
298712,
278233,
278234,
280280,
67292,
18138,
294622,
338613,
278240,
321247,
282339,
12010,
280300,
239341,
282348,
212716,
212717,
284401,
282355,
282358,
313081,
229113,
300794,
286459,
325371,
124669,
194303,
194304,
288512,
278272,
311042,
288516,
175873,
319233,
280327,
216839,
280329,
323331,
300811,
323332,
284429,
284431,
278291,
278293,
294678,
321302,
366360,
116505,
284442,
249626,
325404,
286494,
321310,
282400,
313120,
241441,
315171,
325410,
339745,
341796,
247590,
257830,
284459,
294700,
280366,
317232,
282417,
200498,
280372,
321337,
282427,
360252,
325439,
282434,
315202,
307011,
280390,
282438,
280392,
345929,
341836,
304977,
307025,
413521,
325457,
18262,
216918,
307031,
280410,
284507,
188251,
370522,
345951,
237408,
284512,
284514,
362337,
345955,
296806,
276327,
292712,
282474,
288619,
288620,
325484,
280430,
282480,
292720,
362352,
313203,
325492,
300918,
241528,
194429,
124798,
325503,
182144,
305026,
253829,
333701,
67463,
282504,
243591,
243597,
325518,
110480,
184208,
282518,
282519,
124824,
214937,
214938,
294809,
239514,
329622,
294814,
118685,
298909,
319392,
300963,
292771,
354212,
294823,
298920,
333735,
284587,
292782,
124852,
282549,
243637,
288697,
98239,
214977,
280514,
294850,
163781,
280519,
284619,
247757,
344013,
301008,
212946,
194515,
280541,
219101,
292836,
292837,
294886,
298980,
337895,
247785,
253929,
296941,
327661,
278512,
362480,
311282,
325619,
282612,
333817,
292858,
313339
] |
abcaf764dc5eddee4278acef991c97d6ef52a6a7 | 283d4cf2b0b6800a67fab32bbb4a7d893c9138c5 | /CalenDeck/ViewController/Login/LoginViewController.swift | feafdd094b25ba5d1a4ad060c1042096a2f5fe71 | [] | no_license | SongJeongHun/CalenDeck | 93833a2d5c2ccc10722a07c32a28bcadeab7126b | 4d8feaca043e2d9eafef3451094f643a73336211 | refs/heads/main | 2023-07-14T05:21:29.536093 | 2021-08-23T09:00:56 | 2021-08-23T09:00:56 | 331,897,686 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,831 | swift | //
// LoginViewController.swift
// CalenDeck
//
// Created by 송정훈 on 2021/01/27.
//
import UIKit
import RxSwift
import Action
import AuthenticationServices
class LoginViewController: UIViewController,ViewControllerBindableType {
var viewModel:LoginViewModel!
@IBOutlet weak var userID:UITextField!
@IBOutlet weak var userPassword:UITextField!
@IBOutlet weak var loginPanel:UIView!
@IBOutlet weak var submit:UIButton!
@IBOutlet weak var register:UIButton!
@IBOutlet weak var findPassword:UIButton!
@IBOutlet weak var loginStackView:UIStackView!
override func viewDidLoad() {
setGesture()
setUI()
super.viewDidLoad()
}
func setUI(){
userPassword.isSecureTextEntry = true
//Radius
userID.layer.cornerRadius = 7.0
loginPanel.layer.cornerRadius = 7.0
userPassword.layer.cornerRadius = 7.0
submit.layer.cornerRadius = 7.0
register.layer.cornerRadius = 7.0
findPassword.layer.cornerRadius = 7.0
loginStackView.layer.cornerRadius = 7.0
//Shadow Effect
loginPanel.layer.shadowRadius = 2.0
loginPanel.layer.shadowOffset = CGSize(width: 2, height: 3)
loginPanel.layer.shadowColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
loginPanel.layer.shadowOpacity = 0.2
}
func setGesture(){
let tapGesture:UITapGestureRecognizer = UITapGestureRecognizer()
tapGesture.delegate = self
self.view.addGestureRecognizer(tapGesture)
}
func bindViewModel() {
register.rx.action = viewModel.userJoinAction()
submit.rx.tap
.throttle(.milliseconds(5000), scheduler: MainScheduler.instance)
.subscribe(onNext:{_ in
guard let id = self.userID.text else { return }
guard let password = self.userPassword.text else { return }
if id == "" || password == ""{
self.present(self.viewModel.loginFailAlert(),animated: true,completion: nil)
}else{
self.viewModel.userStorage.login(userID:id , userPassword: password)
.subscribe(onCompleted:{
self.viewModel.loginSuccessAction(userID: id).execute()
}) { error in
self.present(self.viewModel.loginFailAlert(),animated: true,completion: nil)
}
.disposed(by: self.rx.disposeBag)
}
})
.disposed(by: rx.disposeBag)
}
}
extension LoginViewController:UIGestureRecognizerDelegate{
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
self.view.endEditing(true)
return true
}
}
| [
-1
] |
6f405ad979df45a4f7a963504ce801e9f6bad6ba | 7ed1592c18f12c5c984f0439e945ff073b68e9c6 | /Hoops/FirstViewController.swift | 91c8c48c355ec910b5059f7b36713d0bddefa86e | [] | no_license | yanbofang/Hoops | 43f9351991cecb086aa28614de5af5930be94084 | 4094003747e3ed1d3ca8520c357a618fb6051c7c | refs/heads/master | 2021-01-12T13:06:08.351726 | 2016-10-23T06:35:55 | 2016-10-23T06:35:55 | 70,113,690 | 0 | 1 | null | 2016-10-25T03:45:48 | 2016-10-06T01:34:52 | Swift | UTF-8 | Swift | false | false | 10,357 | swift | //
// FirstViewController.swift
// Hoops
//
// Created by Yanbo Fang on 10/5/16.
// Copyright © 2016 Yanbo Fang. All rights reserved.
//
import UIKit
import MapKit
import CoreLocation
class FirstViewController: UIViewController, CLLocationManagerDelegate, MKMapViewDelegate {
var nearbyCourts = [Court]()
var courtClicked_id = 0
var userLocation: CLLocation? = nil {
didSet {
let northEast = mapView.convert(CGPoint(x: mapView.bounds.width, y: 0), toCoordinateFrom: mapView)
let radius = haversine(lat1: northEast.latitude, lon1: northEast.longitude, lat2: (userLocation?.coordinate.latitude)!, lon2: (userLocation?.coordinate.longitude)!)
DispatchQueue.global(qos: .userInitiated).async {
self.getCourts(latitude: (self.userLocation?.coordinate.latitude)!, longitude: (self.userLocation?.coordinate.longitude)!, radius: Int(radius))
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
self.mapView.addAnnotations(self.nearbyCourts)
}
}
}
}
@IBAction func gameClicked(_ sender: AnyObject) {
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let identifier = segue.identifier {
switch identifier {
case "getGames":
if let vc = segue.destination as? GamesTableViewController {
// Need to pass which basketball court was clicked into the TableViewController
vc.court = courtClicked_id
}
default: break
}
}
}
@IBOutlet weak var mapView: MKMapView! {
didSet {
mapView.delegate = self
mapView.showsUserLocation = true
}
}
// Move to user's current location when button is pressed
@IBAction func moveToCurrentLocation(_ sender: AnyObject) {
moveToCurrent()
}
override func viewDidLoad() {
super.viewDidLoad()
// Authorization
self.locationManager.requestWhenInUseAuthorization()
moveToCurrent()
}
let regionRadius: CLLocationDistance = 1500
func centerMapOnLocation(location: CLLocation) {
let coodinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate,
regionRadius * 2.0, regionRadius * 2.0)
mapView.setRegion(coodinateRegion, animated: true)
}
let locationManager = CLLocationManager()
// locationManager() gets called whenever location changes/get updated
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let locValue:CLLocationCoordinate2D = manager.location!.coordinate
userLocation = CLLocation(latitude: locValue.latitude, longitude: locValue.longitude)
centerMapOnLocation(location: userLocation!)
// Stop updating location to conserve power
locationManager.stopUpdatingLocation()
}
// shift to user's current location
func moveToCurrent() {
if CLLocationManager.locationServicesEnabled() {
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.startUpdatingLocation()
}
}
var data = NSMutableData()
var index = 0
// initializes the 'nearbyCourts' array given latitude, longitude, and radius
func getCourts(latitude: Double, longitude: Double, radius: Int) {
//nearbyCourts.removeAll()
let tempUrl = "http://hoopsapp.netai.net/maps_op.php?function=getCourts&lat=" + String(latitude) + "&lng="
+ String(longitude) + "&radius=" + String(radius)
let url = NSURL(string: tempUrl)
let request = URLRequest(url: url as! URL)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("request failed \(error)")
return
}
do {
if let json = try JSONSerialization.jsonObject(with: data) as?
[AnyObject] {
for index in 0...json.count-1 {
if let item = json[index] as? [String: AnyObject] {
if let name = item["name"] as? String {
self.nearbyCourts.append(Court(
court_id: -1,
courtName: item["name"] as! String,
latitude: Double(item["lat"] as! String)!,
longitude: Double(item["lng"] as! String)!
))
}
}
}
}
} catch let parseError {
print("parsing error: \(parseError)")
let responseString = String(data: data, encoding: .utf8)
print("raw response: \(responseString)")
}
}
task.resume()
}
// get court id of a given latitude and longitude
func getCourt_Id(latitude: Double, longitude: Double) -> Int {
print("****************** PRINTING Lat lng")
print(String(latitude))
print(longitude)
let tempUrl = "http://minh.heliohost.org/hoops/database_op.php?function=getCourtId&lat=" + String(latitude) + "&lng="
+ String(longitude)
let url = NSURL(string: tempUrl)
let request = URLRequest(url: url as! URL)
var result = -1
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("request failed \(error)")
return
}
do {
if let json = try JSONSerialization.jsonObject(with: data) as?
[AnyObject] {
print("!!!!!!!!!!!!!!!!!!!!")
for index in 0...json.count-1 {
print("******************")
if let item = json[index] as? [String: AnyObject] {
print("*/////////")
if let court_id = item["court_id"] as? String {
print("-=-=-=-=-=-=-=-=-=")
result = Int((court_id as? String)!)!
print(result)
}
}
}
}
} catch let parseError {
print("parsing error: \(parseError)")
let responseString = String(data: data, encoding: .utf8)
print("raw response: \(responseString)")
}
}
task.resume()
return result
}
//The function mapview:viewForAnnotation has a map view and an annotation for parameters,
/*func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
var view : MKPinAnnotationView
guard let annotation = annotation as? Court else {return nil}
if let dequeuedView = mapView.dequeueReusableAnnotationView(withIdentifier: annotation.identifier) as? MKPinAnnotationView {
view = dequeuedView
}else { //make a new view
view = MKPinAnnotationView(annotation: annotation, reuseIdentifier: annotation.identifier)
view.canShowCallout = true
view.calloutOffset = CGPoint(x: -5, y: 5)
view.rightCalloutAccessoryView = UIButton(type: .detailDisclosure) as UIView
}
return view
}*/
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
if annotation is MKUserLocation {
return nil
}
let reuseId = "pin"
var pinView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseId)
if pinView == nil {
pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
pinView?.canShowCallout = true
let rightButton: AnyObject! = UIButton(type: .detailDisclosure)
pinView!.rightCalloutAccessoryView = rightButton as? UIView
}
else {
pinView?.annotation = annotation
}
return pinView
}
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
if control == view.rightCalloutAccessoryView {
// get the court_id from coordinate position
let coordinates = view.annotation?.coordinate
DispatchQueue.global(qos: .userInitiated).async {
let result = self.getCourt_Id(latitude: (coordinates?.latitude)!, longitude: (coordinates?.longitude)!)
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
self.courtClicked_id = result
print("=============================")
print(self.courtClicked_id)
}
}
if courtClicked_id != -1 {
performSegue(withIdentifier: "getGames", sender: view)
}
}
}
func haversine(lat1:Double, lon1:Double, lat2:Double, lon2:Double) -> Double {
let lat1rad = lat1 * M_PI/180
let lon1rad = lon1 * M_PI/180
let lat2rad = lat2 * M_PI/180
let lon2rad = lon2 * M_PI/180
let dLat = lat2rad - lat1rad
let dLon = lon2rad - lon1rad
var a = sin(dLat/2) * sin(dLat/2)
a += sin(dLon/2) * sin(dLon/2) * cos(lat1rad) * cos(lat2rad)
let c = 2 * asin(sqrt(a))
let R = 6372.8
return R * c * 1000
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
| [
-1
] |
151e61130e58a64180c9a797bde75538d3ff154c | e186cad4fc3ae3a5348469a67d0a4497433dc5fc | /QuizMaster/view/ViewComponents/CircularButton.swift | f5edc1970dded9555d4e63032ac67a4dce2ce163 | [] | no_license | pebo0602/Swift_QuizMaster | 7cfd177e0c6ca6873c84ce178653e8d426d70965 | 374dd420f1abce3e8c2460e98c70cb9d700e8f22 | refs/heads/master | 2021-01-19T12:55:52.697693 | 2017-05-22T22:05:17 | 2017-05-22T22:05:17 | 88,057,525 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 721 | swift | //
// Created by Kung Peter on 2017-04-26.
// Copyright (c) 2017 PeterBobergAB. All rights reserved.
//
import Foundation
import UIKit
@IBDesignable
class CircularButton: UIButton {
@IBInspectable var iBColor: UIColor = UIColor.orange {
didSet {
self.backgroundColor = iBColor
render()
}
}
override func awakeFromNib() {
super.awakeFromNib()
render()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
render()
}
private func render() {
self.layer.borderColor = UIColor.black.cgColor
self.layer.cornerRadius = self.bounds.width / 2
layoutIfNeeded()
}
}
| [
-1
] |
78c89f16b1900de4f14e71e454fed003b090de0b | 333dea44b920e8b8fed697549322baf6a735812c | /RecipesViewController.swift | 0f6c7f52ae3a00bab4727615072a53e4bb422d24 | [] | no_license | frederiknormann/NextShowTime | 45fde63b628d1447ad90d5f234610f41ca590a23 | e02b6edb537f86c16d03d5dbbfd4a18642404dc5 | refs/heads/master | 2020-04-25T12:20:44.998160 | 2015-01-03T14:47:09 | 2015-01-03T14:47:09 | 28,031,153 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,083 | swift | //
// RecipesViewController.swift
// Kogeri Tid
//
// Created by Jannie Henriksen on 10/12/14.
// Copyright (c) 2014 Normann Development. All rights reserved.
//
import UIKit
class RecipesViewController : UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
}
//UITableViewDataSource
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell : RecipeTableViewCell = tableView.dequeueReusableCellWithIdentifier("recipeCell") as RecipeTableViewCell
cell.recipeNameLabel.text = "Hindbær"
cell.typeLabel.text = "Rock"
return UITableViewCell()
}
// UITableViewDelegate
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
}
| [
-1
] |
57d0b38c0bfe456d1fac28ff48c35e28badfa26b | f3928440ab5be18102249ccec79a4fcca8b14588 | /NewsFeed/Extension/Data+Extension.swift | 3356d89ee87ab3fd723147a7518c19218b4b1f0b | [] | no_license | yanaMyn/NewsFeedMvvm | be9601ea867753b79d9436a72ad3ca0a61e3c75a | cd4601fa9e4f22ef42e346b0e909ad9d8c945590 | refs/heads/master | 2021-01-14T07:01:13.301240 | 2020-02-24T02:59:34 | 2020-02-24T02:59:34 | 242,633,930 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 906 | swift | //
// Data+Extension.swift
// NewsFeed
//
// Created by yana mulyana on 11/02/20.
// Copyright © 2020 LinkAJa. All rights reserved.
//
import Foundation
extension Data {
func decode<T: Decodable>(modelType: T.Type, data: Data) -> Any? {
do {
let object = try JSONDecoder().decode(modelType, from: data)
return object
} catch let err {
print(err.localizedDescription)
return err
}
}
var JSON: NSString? {
guard let object = try? JSONSerialization.jsonObject(with: self, options: []),
let data = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]),
let prettyPrintedString = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else { return nil }
return prettyPrintedString
//print(str!.data(using: .utf8)!.JSON!)
}
}
| [
-1
] |
f1df0892f54cd953ecbe858c80ffab813eeff948 | 05b682861d618264557e8870a23c581566946cf1 | /TestHapticFeedbackTests/TestHapticFeedbackTests.swift | 9a8fe039da8a97df4276db460cee0f2cda086910 | [] | no_license | tsuyoshi777/TestHapticFeedback | 827dbf982ea5bc5b1062101d2b159378b5913f62 | db0233cd940a9d7479cb7e33469f34ce414529b2 | refs/heads/master | 2020-05-27T13:00:24.378737 | 2019-05-26T03:19:33 | 2019-05-26T03:19:33 | 188,629,208 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 955 | swift | //
// TestHapticFeedbackTests.swift
// TestHapticFeedbackTests
//
// Created by tuyoshi tonobe on 2019/05/26.
// Copyright © 2019 tuyoshi tonobe. All rights reserved.
//
import XCTest
@testable import TestHapticFeedback
class TestHapticFeedbackTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
| [
360462,
98333,
16419,
229413,
204840,
278570,
344107,
155694,
253999,
319542,
229430,
163896,
180280,
376894,
352326,
311372,
196691,
278615,
385116,
237663,
254048,
319591,
221290,
278634,
319598,
352368,
204916,
131191,
237689,
278655,
278677,
196760,
426138,
278685,
311458,
278691,
49316,
32941,
278704,
377009,
278708,
131256,
295098,
139479,
254170,
229597,
311519,
205035,
286958,
327929,
344313,
147717,
368905,
180493,
254226,
368916,
262421,
377114,
237856,
237857,
278816,
311597,
98610,
336183,
180535,
278842,
287041,
319821,
254286,
344401,
377169,
368981,
155990,
368984,
106847,
98657,
270701,
246127,
270706,
246136,
139640,
246137,
311685,
106888,
385417,
311691,
385422,
213403,
246178,
385454,
311727,
377264,
319930,
311738,
33211,
336317,
278970,
336320,
311745,
278978,
254406,
188871,
278993,
278999,
328152,
369116,
287198,
279008,
279013,
279018,
319981,
279029,
254456,
279032,
377338,
377343,
279039,
254465,
287241,
279050,
139792,
303636,
393751,
279065,
377376,
377386,
197167,
385588,
352829,
115270,
385615,
426576,
369235,
139872,
66150,
344680,
139892,
287352,
344696,
279164,
189057,
311941,
336518,
311945,
369289,
344715,
279177,
311949,
287374,
377489,
311954,
352917,
230040,
271000,
377497,
303771,
377500,
205471,
344738,
139939,
279206,
295590,
287404,
205487,
303793,
336564,
164533,
287417,
287422,
66242,
377539,
164560,
385747,
279252,
361176,
418520,
287452,
295652,
369385,
312052,
312053,
172792,
344827,
221948,
205568,
295682,
336648,
197386,
434957,
312079,
426774,
197399,
426775,
336671,
344865,
197411,
279336,
295724,
353069,
197422,
353070,
164656,
295729,
312108,
328499,
353078,
197431,
230199,
353079,
336702,
353094,
353095,
353109,
377686,
230234,
189275,
435039,
295776,
303972,
385893,
246641,
246643,
295798,
246648,
361337,
279417,
254850,
369538,
287622,
295824,
189348,
353195,
140204,
377772,
353197,
304051,
230332,
377790,
353215,
353216,
213957,
213960,
345033,
279498,
386006,
418776,
50143,
123881,
304110,
320494,
271350,
295927,
304122,
320507,
328700,
328706,
410627,
320516,
295942,
386056,
353290,
230410,
377869,
320527,
238610,
418837,
140310,
320536,
197657,
336929,
369701,
345132,
238639,
312373,
238651,
336960,
214086,
377926,
238664,
353367,
156764,
156765,
304222,
173166,
377972,
353397,
337017,
377983,
402565,
279685,
222343,
386189,
296086,
238743,
296092,
238765,
279728,
238769,
402613,
279747,
353479,
353480,
353481,
402634,
353482,
189653,
419029,
148696,
296153,
279774,
304351,
304356,
222440,
328940,
279792,
353523,
353524,
386294,
386301,
320770,
386306,
279814,
328971,
312587,
353551,
320796,
222494,
353584,
345396,
386359,
312634,
116026,
378172,
222524,
279875,
345415,
312648,
337225,
304456,
230729,
238927,
353616,
296273,
222559,
378209,
230756,
386412,
230765,
279920,
312689,
296307,
116084,
337281,
148867,
378244,
296329,
304524,
296335,
9619,
370071,
279974,
173491,
304564,
353719,
361927,
370123,
148940,
280013,
312782,
222675,
353750,
271843,
280041,
361963,
296433,
321009,
280055,
288249,
329225,
230921,
296461,
304656,
329232,
370197,
402985,
394794,
230959,
312880,
288309,
312889,
288318,
124485,
288326,
288327,
239198,
99938,
345700,
312940,
222832,
247416,
337534,
337535,
263809,
312965,
288392,
239250,
419478,
345752,
255649,
337591,
321207,
296632,
280251,
321219,
280267,
403148,
9936,
9937,
370388,
272085,
345814,
181975,
280278,
280280,
18138,
345821,
321247,
321249,
345833,
345834,
280300,
67315,
173814,
313081,
124669,
288512,
288516,
280329,
321302,
345879,
116505,
321310,
255776,
247590,
362283,
378668,
296755,
321337,
345919,
436031,
403267,
345929,
18262,
362327,
370522,
345951,
362337,
345955,
296806,
288619,
313199,
214895,
362352,
313203,
124798,
182144,
305026,
247686,
67463,
329622,
337815,
124824,
214937,
436131,
354212,
313254,
436137,
362417,
124852,
288697,
362431,
214977,
174019,
214984,
362443,
247757,
280541,
329695,
436191,
313319,
337895,
174057,
247785,
436205,
362480,
313339,
43014,
354316,
313357,
182296,
223268,
329765,
354345,
223274,
124975,
346162,
124984,
288828,
436285,
288833,
288834,
436292,
403525,
313416,
436301,
338001,
354385,
338003,
280661,
329814,
338007,
354393,
280675,
321637,
329829,
280677,
43110,
436329,
313447,
288879,
280694,
215164,
313469,
215166,
280712,
215178,
346271,
436383,
362659,
239793,
125109,
182456,
379071,
338119,
149703,
346314,
321745,
387296,
280802,
379106,
338150,
346346,
321772,
125169,
338164,
436470,
125183,
149760,
411906,
125188,
313608,
321800,
125193,
125198,
272658,
125203,
338197,
125208,
305440,
125217,
338218,
321840,
379186,
125235,
280887,
125240,
321860,
182598,
289110,
215385,
272729,
379225,
354655,
321894,
280939,
354676,
313727,
436608,
362881,
240002,
436611,
248194,
395659,
395661,
108944,
240016,
190871,
149916,
420253,
141728,
289189,
108972,
272813,
338356,
436661,
289232,
281040,
256477,
330218,
281072,
109042,
174593,
420369,
289304,
207393,
182817,
289332,
174648,
338489,
338490,
322120,
281166,
297560,
354911,
436832,
436834,
191082,
313966,
420463,
281199,
346737,
313971,
346740,
420471,
330379,
330387,
117396,
346772,
330388,
264856,
289434,
346779,
338613,
314040,
109241,
158394,
248517,
363211,
363230,
289502,
264928,
338662,
330474,
346858,
289518,
322291,
199414,
35583,
363263,
191235,
322316,
117517,
322319,
166676,
207640,
289576,
191283,
273207,
289598,
420677,
281427,
281433,
109409,
330609,
207732,
158593,
240518,
109447,
224145,
355217,
256922,
289690,
240544,
420773,
289703,
363438,
347055,
289727,
273344,
330689,
363458,
379844,
19399,
338899,
248796,
248797,
207838,
347103,
314342,
289774,
347123,
240630,
314362,
257024,
330754,
330763,
322582,
281626,
248872,
322612,
314448,
339030,
314467,
281700,
257125,
322663,
273515,
207979,
404593,
363641,
363644,
150657,
248961,
330888,
363669,
339100,
380061,
339102,
199839,
429214,
265379,
249002,
306346,
3246,
421048,
339130,
265412,
290000,
298208,
298212,
298213,
330984,
298221,
298228,
216315,
208124,
363771,
388349,
437505,
322824,
257305,
126237,
339234,
208164,
372009,
412971,
306494,
216386,
224586,
372043,
331090,
314710,
372054,
159066,
314720,
380271,
314739,
208244,
314741,
249204,
290173,
306559,
314751,
298374,
314758,
314760,
142729,
388487,
314766,
306579,
282007,
290207,
314783,
314789,
314791,
396711,
396712,
241066,
282024,
314798,
380337,
380338,
150965,
380357,
339398,
306639,
413137,
429542,
191981,
290301,
282114,
372227,
323080,
323087,
175639,
388632,
396827,
134686,
282146,
306723,
347694,
290358,
265798,
265804,
396882,
290390,
44635,
396895,
323172,
282213,
323178,
224883,
314998,
323196,
175741,
339584,
224901,
282245,
282246,
323217,
282259,
323236,
298661,
282280,
61101,
224946,
110268,
224958,
323263,
323264,
282303,
274115,
306890,
241361,
241365,
298712,
298720,
12010,
282348,
282358,
175873,
323331,
339715,
323332,
339720,
372496,
323346,
249626,
282400,
241441,
241442,
339745,
257830,
421672,
282417,
282427,
315202,
307011,
159562,
216918,
241495,
241528,
339841,
315273,
315274,
372626,
380821,
282518,
282519,
118685,
298909,
323507,
290745,
274371,
151497,
372701,
298980,
380908,
282633,
241692,
102437,
315432,
102445,
233517,
176175,
241716,
225351,
315465,
315476,
307289,
200794,
315487,
356447,
438377,
315498,
299121,
233589,
266357,
422019,
241808,
323729,
381073,
233636,
299174,
241843,
405687,
184505,
299198,
258239,
389313,
299203,
299209,
372941,
282831,
266449,
356576,
176362,
307435,
438511,
381172,
184570,
12542,
184575,
381208,
315673,
299293,
151839,
233762,
217380,
151847,
282919,
332083,
127284,
332085,
332089,
315706,
282939,
241986,
438596,
332101,
323913,
323916,
348492,
323920,
250192,
348500,
168281,
332123,
332127,
323935,
242023,
242029,
160110,
242033,
250226,
291192,
340357,
225670,
332167,
242058,
373134,
291224,
242078,
283038,
61857,
315810,
315811,
381347,
61859,
340398,
61873,
61880,
283064,
127427,
127428,
283075,
324039,
373197,
176601,
242139,
160225,
242148,
242149,
127465,
291311,
233978,
324097,
291333,
340490,
258581,
291358,
283184,
234036,
315960,
348732,
242237,
70209,
348742,
70215,
348749,
340558,
381517,
332378,
201308,
242277,
111208,
184940,
373358,
389745,
209530,
373375,
152195,
348806,
184973,
316049,
111253,
316053,
111258,
111259,
176808,
299699,
299700,
422596,
422599,
291530,
225995,
242386,
422617,
422626,
234217,
299759,
299776,
291585,
430849,
291592,
62220,
422673,
430865,
291604,
422680,
152365,
422703,
422709,
152374,
242485,
160571,
430910,
160575,
160580,
299849,
283467,
381773,
201551,
242529,
349026,
357218,
275303,
201577,
308076,
242541,
209785,
177019,
185211,
308092,
398206,
291712,
381829,
316298,
308107,
349072,
308112,
209817,
324506,
324507,
390045,
127902,
185250,
324517,
185254,
283558,
373687,
349121,
373706,
316364,
340955,
340961,
324586,
340974,
316405,
349175,
201720,
127992,
357379,
324625,
308243,
316437,
201755,
300068,
357414,
300084,
324666,
308287,
21569,
218186,
250956,
300111,
341073,
439384,
250981,
300135,
316520,
300136,
357486,
316526,
144496,
300150,
291959,
300151,
160891,
341115,
300158,
349316,
349318,
373903,
177296,
169104,
308372,
324760,
119962,
300187,
300188,
300201,
300202,
373945,
259268,
283847,
62665,
283852,
283853,
259280,
316627,
333011,
357595,
234733,
234742,
128251,
316669,
242954,
439562,
292107,
414990,
251153,
177428,
349462,
382258,
300343,
382269,
193859,
177484,
406861,
259406,
234831,
251213,
120148,
283991,
374109,
292195,
333160,
243056,
316787,
357762,
112017,
112018,
234898,
259475,
275859,
357786,
251298,
333220,
316842,
374191,
210358,
284089,
292283,
415171,
300487,
300489,
366037,
210390,
210391,
210392,
210393,
144867,
103909,
54765,
251378,
308723,
300536,
210433,
366083,
259599,
316946,
308756,
398869,
374296,
374299,
308764,
349726,
431649,
349741,
169518,
431663,
194110,
235070,
349763,
218696,
292425,
243274,
128587,
333388,
333393,
300630,
128599,
235095,
333408,
300644,
374372,
415338,
243307,
120427,
54893,
325231,
366203,
325245,
194180,
415375,
153251,
300714,
210603,
415420,
333503,
218819,
259781,
333517,
333520,
333521,
333523,
325346,
333542,
153319,
325352,
284401,
325371,
194303,
284429,
243472,
366360,
284442,
325404,
325410,
341796,
399147,
431916,
317232,
300848,
259899,
325439,
325445,
153415,
341836,
415567,
325457,
317269,
341847,
350044,
128862,
284514,
292712,
325484,
423789,
292720,
325492,
276341,
341879,
317304,
333688,
112509,
194429,
325503,
55167,
333701,
243591,
325515,
243597,
325518,
333722,
350109,
292771,
333735,
415655,
284587,
243637,
301008,
153554,
219101,
292836,
292837,
317415,
325619,
432116,
333817,
292858,
415741,
333828,
358410,
399373,
317467,
145435,
292902,
325674,
243759,
129076,
243767,
358456,
309345,
194666,
260207,
432240,
284788,
333940,
292992,
333955,
415881,
104587,
235662,
325776,
317587,
284826,
333991,
333992,
284842,
301251,
309444,
334042,
194782,
301279,
317664,
243962,
375039,
309503,
194820,
375051,
325905,
334103,
325912,
211235,
432421,
211238,
325931,
358703,
358709,
260418,
325968,
6481,
366930,
366929,
6489,
391520,
383332,
383336,
211326,
317831,
227725,
252308,
317852,
121245,
285090,
375207,
342450,
334260,
293303,
293310,
416197,
129483,
342476,
317901,
326100,
285150,
342498,
358882,
334309,
195045,
391655,
432618,
375276,
342536,
342553,
416286,
375333,
244269,
375343,
23092,
375351,
244281,
301638,
309830,
293448,
55881,
416341,
244310,
416351,
268899,
244327,
39530,
244347,
326287,
375440,
334481,
227990,
318106,
318107,
342682,
318130,
383667,
293556,
342713,
285373,
39614,
334547,
318173,
375526,
285415,
342762,
342763,
293612,
154359,
432893,
162561,
285444,
383754,
326414,
310036,
326429,
293664,
326433,
400166,
293672,
318250,
318252,
375609,
342847,
252741,
293711,
244568,
244570,
293730,
351077,
342887,
326505,
269178,
400252,
359298,
359299,
260996,
113542,
228233,
392074,
228234,
236428,
56208,
326553,
318364,
310176,
310178,
293800,
236461,
326581,
326587,
326601,
359381,
433115,
343005,
130016,
64485,
326635,
187374,
383983,
318461,
293886,
293893,
433165,
384016,
146448,
433174,
326685,
252958,
252980,
203830,
359478,
302139,
359495,
392290,
253029,
228458,
318572,
351344,
187506,
285814,
392318,
187521,
384131,
302216,
228491,
228493,
285838,
162961,
326804,
351390,
302240,
343203,
253099,
253100,
318639,
367799,
113850,
294074,
64700,
302274,
367810,
343234,
244940,
228563,
195808,
310497,
228588,
253167,
302325,
261377,
228609,
318733,
245019,
253216,
130338,
130343,
130348,
261425,
351537,
318775,
286013,
286018,
146762,
294218,
294219,
318805,
425304,
294243,
163175,
327024,
327025,
327031,
318848,
253317,
384393,
368011,
318864,
318868,
310692,
245161,
286129,
286132,
228795,
425405,
302529,
302531,
163268,
425418,
310732,
64975,
327121,
228827,
310748,
286172,
310757,
187878,
343542,
343543,
286202,
359930,
286205,
302590,
228867,
253451,
253452,
359950,
146964,
253463,
286244,
245287,
245292,
286254,
196164,
56902,
179801,
196187,
343647,
310889,
204397,
138863,
188016,
294529,
229001,
310923,
188048,
425626,
229020,
302754,
245412,
40613,
40614,
40615,
229029,
384695,
319162,
327358,
286399,
319177,
212685,
384720,
245457,
302802,
278234,
294622,
278240,
212716,
212717,
360177,
286459,
278272,
319233,
360195,
278291,
294678,
286494,
409394,
319292,
360252,
360264,
188251,
376669,
245599,
425825,
425833,
417654,
188292,
327557,
253829,
294807,
376732,
311199,
319392,
294823,
327596,
294843,
188348,
237504,
294850,
384964,
163781,
344013,
212942,
212946,
24532,
294886,
253929,
327661,
311281,
311282
] |
301d87e38928ba4e13c2cf5f5f7142ec52eaefb8 | e47b65cee0471fbc16a6544b9e23d8678a0c6b91 | /TweetApp/AuthorizationViewOutput.swift | cc2de251a0fc78ab7655dbe33a96b638ec0e2066 | [] | no_license | complexityclass/TweetApp | bb56aad6338bce6ea81905cdb86b83d7abc18709 | e6908b407ca90dd0e723f483e5dc194dff853037 | refs/heads/master | 2021-01-12T11:43:29.529733 | 2016-10-30T21:43:58 | 2016-10-30T21:43:58 | 72,278,305 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 292 | swift | //
// AuthorizationViewOutput.swift
// TweetApp
//
// Created by Popov Valery on 29/10/2016.
// Copyright © 2016 Popov Valery. All rights reserved.
//
import Foundation
protocol AuthorizationViewOutput: class {
func viewDidFinishLoading()
func authButtonDidTapped()
} | [
-1
] |
b03e60cf9e8141e9d4c8046f3e4952aa2613b965 | e0b3848430f9233c7ca7595a8c8204e03f4e611b | /weatherForecast/WeatherVC.swift | 08a673b833aa38fbbfdd410191521df96091afb1 | [] | no_license | rashed008/WeatherForecast | 0a3420a19e8bc36f155323e6c91d7e26e6ab8740 | fe65c39e97a24cedf9f935471275b02984b28699 | refs/heads/master | 2021-07-09T16:07:31.228128 | 2017-10-01T16:52:25 | 2017-10-01T16:52:25 | 104,083,547 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,716 | swift | //
// ViewController.swift
// weatherForecast
//
// Created by RASHED on 9/19/17.
// Copyright © 2017 RASHED. All rights reserved.
//
import UIKit
import Alamofire
class WeatherVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var dateLabel: UILabel!
@IBOutlet var templabel: UILabel!
@IBOutlet var locationLabel: UILabel!
@IBOutlet var currentWeatherLabel: UIImageView!
@IBOutlet var currentWeatherTypeLabel: UILabel!
@IBOutlet var tableView: UITableView!
var currentweather: CurrentWeather!
var forecast: Forecast!
var forecasts = [Forecast]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
tableView.delegate = self
tableView.dataSource = self
currentweather = CurrentWeather()
currentweather.downloadWeatherdetails{
//setup UI to load download data
self.downloadForecastData{
self.updateMainUI()
}
}
}
func downloadForecastData(completed: @escaping DownloadComplete){
//Download weather forecast data for tableview
let forecastURL = URL(string: FORECAST_URL)!
Alamofire.request(forecastURL).responseJSON {response in
let result = response.result
//print(response)
if let dict = result.value as? Dictionary<String, AnyObject>{
if let list = dict["list"] as? [Dictionary<String, AnyObject>] {
for obj in list {
let forecast = Forecast(weatherDict: obj)
self.forecasts.append(forecast)
print(obj)
}
}
}
completed()
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 6
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "weatherCell", for: indexPath)
return cell
}
func updateMainUI() {
dateLabel.text = currentweather.date
templabel.text = "\(currentweather.currenttemp)"
currentWeatherTypeLabel.text = currentweather.weatherType
locationLabel.text = currentweather.cityName
currentWeatherLabel.image = UIImage (named: currentweather.weatherType)
}
}
| [
-1
] |
fbf86c08431bc5200607cb37300e0328b8e15c4c | 2f5d24f06ebbe6741f3d52f09f4e7ec33e85653c | /mambaSharedFramework/Pantos-Generic Playlist Parsing/Pantos-Generic Tag Parsers/NoOpTagParser.swift | 7135bb93501faa5859deeb743e1ada228e934c72 | [
"Apache-2.0"
] | permissive | Comcast/mamba | ab6c69ca5a2f6c4a17c8c8e32a75e48e9412ee3e | bb5860ed4a021a31432cf3920ed13af00e32d5a2 | refs/heads/develop | 2023-05-10T03:08:12.500518 | 2021-08-20T16:44:52 | 2021-08-20T16:44:52 | 88,876,515 | 181 | 42 | Apache-2.0 | 2023-05-09T15:20:54 | 2017-04-20T14:41:38 | Swift | UTF-8 | Swift | false | false | 1,174 | swift | //
// NoOpTagParser.swift
// mamba
//
// Created by David Coufal on 2/16/17.
// Copyright © 2017 Comcast Cable Communications Management, LLC
// 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
/// "No operation" Tag Parser. This is returned in cases when `PlaylistRegisteredTags` cannot determine a `PlaylistTagParser`. Usage of this class in production is a error.
public class NoOpTagParser: PlaylistTagParser {
public func parseTag(fromTagString string: String?) throws -> PlaylistTagDictionary {
assertionFailure("Should not use NoOpTagParser to parse a tag")
return PlaylistTagDictionary()
}
}
| [
-1
] |
77f026f9b5fda50621ba8565a9da76c7a31cf823 | d58e48e070adf5f17531b73ea923ea0aecd6be41 | /C0761706_FinalLabAssignment/AppDelegate.swift | bc3b5c53b1d6e62add99f4493939cfc53a63c46b | [] | no_license | RamaniOS/C0761706_FinalLabAssignment | 8b69f3c2d90ffcbdc025ae8d165c0c95156d5933 | 32a1ef5aadec16b98aabc404a524654a279d4dbd | refs/heads/master | 2020-12-20T14:20:16.478915 | 2020-01-25T00:35:59 | 2020-01-25T00:35:59 | 236,105,739 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,461 | swift | //
// AppDelegate.swift
// C0761706_FinalLabAssignment
//
// Created by Ramanpreet Singh on 2020-01-24.
// Copyright © 2020 Ramanpreet Singh. All rights reserved.
//
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
| [
393222,
393224,
393230,
393250,
344102,
393261,
393266,
213048,
385081,
376889,
393275,
376905,
327756,
254030,
286800,
368727,
180313,
368735,
180320,
376931,
286831,
368752,
286844,
417924,
262283,
286879,
286888,
377012,
327871,
377036,
180431,
377046,
418010,
377060,
327914,
393456,
393460,
336123,
336128,
385280,
262404,
180490,
368911,
262422,
377117,
262436,
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,
393747,
254490,
188958,
385570,
33316,
197159,
377383,
188987,
418363,
369223,
385609,
385616,
352864,
369253,
262760,
352874,
352887,
254587,
377472,
148105,
377484,
352918,
344744,
361129,
336555,
385713,
434867,
164534,
336567,
328378,
164538,
328386,
352968,
418507,
385742,
385748,
361179,
369381,
361195,
344831,
336643,
344835,
344841,
418580,
418585,
434970,
369435,
418589,
262942,
418593,
336675,
328484,
418598,
418605,
336696,
361273,
328515,
336708,
328519,
361288,
328522,
336714,
426841,
197468,
254812,
361309,
361315,
361322,
328573,
377729,
345035,
345043,
386003,
386011,
386018,
386022,
435187,
328714,
361489,
336921,
386073,
336925,
345118,
377887,
345133,
345138,
361536,
197707,
189520,
345169,
156761,
361567,
148578,
345199,
386167,
410745,
361598,
214149,
345222,
386186,
345246,
214175,
337071,
337075,
386258,
328924,
222437,
386285,
328941,
386291,
345376,
345379,
410917,
345399,
378169,
369978,
337222,
337229,
337234,
263508,
402791,
345448,
271730,
378227,
271745,
181638,
353673,
181643,
230809,
181670,
181673,
181678,
337329,
181681,
181684,
181690,
361917,
181696,
337349,
181703,
337365,
271839,
329191,
361960,
337398,
337415,
329226,
419339,
419343,
419349,
345625,
419355,
370205,
419359,
419362,
394786,
370213,
419368,
206395,
214593,
419400,
419402,
353867,
419406,
419410,
345701,
394853,
222830,
370297,
403075,
345736,
198280,
403091,
345749,
345762,
419491,
345765,
419497,
419501,
370350,
419506,
337592,
419512,
419517,
337599,
419527,
419530,
419535,
272081,
394966,
419542,
419544,
181977,
345818,
419547,
419550,
419559,
337642,
419563,
337645,
370415,
362247,
395021,
362255,
116509,
345887,
378663,
345905,
354106,
354111,
247617,
354117,
329544,
370509,
354130,
247637,
337750,
370519,
313180,
345964,
345967,
345970,
345974,
403320,
354172,
247691,
337808,
247700,
329623,
436126,
436132,
337844,
346057,
346063,
247759,
329697,
354277,
190439,
247789,
436289,
378954,
395339,
338004,
329832,
329885,
346272,
100524,
387249,
379066,
387260,
256191,
395466,
346316,
411861,
411868,
411873,
379107,
411876,
387301,
346343,
338152,
387306,
387312,
321786,
379134,
411903,
411916,
379152,
395538,
387349,
338199,
387352,
182558,
338211,
248111,
362822,
436555,
190796,
379233,
354673,
248186,
420236,
379278,
354727,
338352,
338381,
330189,
338386,
338403,
338409,
248308,
199164,
330252,
330267,
354855,
199249,
346721,
174695,
248425,
191084,
338543,
191092,
346742,
330383,
354974,
150183,
248504,
223934,
355024,
273108,
355028,
264918,
183005,
256734,
436962,
338660,
338664,
264941,
207619,
264964,
338700,
256786,
199452,
363293,
396066,
346916,
396069,
215853,
355122,
355131,
355140,
355143,
338763,
355150,
330580,
355166,
265055,
265058,
387944,
355179,
330610,
330642,
355218,
207808,
396245,
330710,
248792,
248798,
257008,
183282,
265207,
330748,
265214,
330760,
330768,
248862,
396328,
158761,
396336,
199728,
330800,
396339,
339001,
388154,
388161,
330826,
183383,
339036,
412764,
257120,
265320,
248951,
420984,
330889,
339097,
248985,
44197,
380070,
339112,
249014,
126144,
330965,
265432,
265436,
388319,
388347,
175375,
175396,
208166,
273708,
372015,
347441,
372018,
199988,
175415,
396600,
437566,
175423,
437570,
437575,
437583,
331088,
437587,
331093,
396633,
175450,
437595,
175457,
208227,
175460,
265580,
437620,
175477,
249208,
175483,
175486,
249214,
175489,
249218,
249224,
249227,
249234,
175513,
175516,
396705,
175522,
355748,
380332,
396722,
372163,
380360,
216522,
339404,
208337,
339412,
413141,
339417,
249308,
249312,
339424,
339428,
339434,
249328,
69113,
372228,
208398,
380432,
175635,
339503,
265778,
265795,
396872,
265805,
224853,
224857,
257633,
224870,
372327,
257646,
224884,
224887,
224890,
224894,
224897,
372353,
216707,
126596,
224904,
11918,
159374,
224913,
126610,
224916,
224919,
126616,
208538,
224922,
224926,
224929,
224932,
224936,
257704,
224942,
224947,
257716,
257720,
257724,
257732,
224969,
339662,
224981,
224986,
224993,
257761,
224999,
339695,
225012,
257787,
225020,
339710,
257790,
225025,
257794,
339721,
257801,
257804,
225038,
257807,
372499,
167700,
225043,
225048,
257819,
225053,
184094,
225058,
257833,
225066,
257836,
413484,
225070,
225073,
372532,
397112,
225082,
397115,
225087,
323402,
257868,
257871,
225103,
397139,
225108,
225112,
257883,
257886,
225119,
225127,
257896,
274280,
257901,
225137,
257908,
225141,
257912,
257916,
225148,
257920,
225155,
339844,
225165,
397200,
225170,
380822,
225175,
225180,
118691,
184244,
372664,
372702,
372706,
356335,
380918,
405533,
430129,
266294,
421960,
356439,
421990,
266350,
266362,
381068,
225423,
250002,
250004,
225429,
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,
225514,
225518,
381176,
397571,
389380,
356637,
356640,
356643,
266536,
356649,
356655,
332080,
340275,
356660,
397622,
332090,
225597,
332097,
201028,
348488,
332106,
250199,
250202,
332125,
250210,
348522,
348525,
348527,
332152,
250238,
389502,
356740,
373145,
340379,
389550,
266687,
160234,
127471,
340472,
324094,
266754,
324111,
340500,
381481,
356907,
324142,
356916,
324149,
324155,
348733,
324164,
356934,
348743,
381512,
324173,
324176,
332380,
373343,
381545,
340627,
184982,
373398,
258721,
332453,
332459,
389805,
332463,
381617,
332471,
332483,
332486,
373449,
357069,
332493,
357073,
332511,
332520,
340718,
332533,
348924,
373510,
389926,
152370,
340789,
398139,
127814,
357201,
357206,
389978,
357211,
430939,
357214,
201579,
201582,
349040,
340849,
201588,
430965,
324472,
398201,
340858,
119674,
324475,
340861,
324478,
430972,
324481,
398211,
324484,
324487,
381833,
324492,
324495,
324498,
430995,
324501,
324510,
422816,
324513,
398245,
324524,
340909,
324533,
324538,
324541,
398279,
340939,
340941,
209873,
340957,
431072,
398306,
340963,
209895,
201711,
349172,
349180,
439294,
209943,
209946,
250914,
357410,
185380,
357418,
209965,
209968,
209971,
209975,
209979,
209987,
209990,
341071,
250967,
210010,
341091,
210025,
210027,
210030,
210036,
210039,
349308,
210044,
160895,
152703,
349311,
210052,
210055,
349319,
210067,
210077,
210080,
251044,
210084,
210088,
210095,
210098,
210107,
210115,
332997,
210127,
333009,
210131,
333014,
210138,
210143,
218354,
218360,
251128,
275706,
275712,
275715,
275721,
333078,
251160,
349484,
349491,
251189,
415033,
251210,
357708,
210260,
259421,
365921,
333154,
251235,
374117,
234866,
390516,
333175,
357755,
136590,
112020,
349590,
357792,
259515,
415166,
415185,
366034,
415191,
415193,
415196,
415199,
423392,
333284,
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,
333498,
210631,
333511,
358099,
333534,
431851,
210672,
210695,
268041,
210698,
366348,
210706,
399128,
333594,
210719,
358191,
366387,
358200,
325440,
366401,
341829,
325446,
46920,
341834,
341838,
341843,
415573,
358234,
341851,
350045,
399199,
259938,
399206,
358255,
399215,
358259,
341876,
243579,
325504,
333698,
333724,
382890,
333774,
358371,
350189,
350193,
350202,
350206,
350213,
268298,
350224,
350231,
333850,
350237,
350240,
350248,
178218,
350251,
350256,
350259,
350271,
243781,
350285,
374864,
342111,
432271,
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,
350504,
358700,
350509,
391468,
358704,
358713,
358716,
383306,
334161,
383321,
383330,
383333,
391530,
334203,
268668,
194941,
391563,
366990,
416157,
342430,
375208,
326058,
375216,
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,
391894,
154328,
416473,
64230,
342766,
342776,
391937,
391948,
326416,
162591,
326441,
326451,
326454,
244540,
326460,
375612,
326467,
244551,
326473,
326477,
326485,
416597,
326490,
326502,
375656,
433000,
326507,
326510,
211825,
211831,
351097,
359295,
342915,
236430,
342930,
252822,
392091,
400285,
252836,
359334,
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,
384114,
351364,
384135,
384139,
384143,
384160,
384168,
367794,
384181,
367800,
351423,
326855,
244937,
253130,
343244,
146642,
359649,
343270,
351466,
351479,
343306,
261389,
359694,
384275,
245020,
245029,
171302,
351534,
245040,
212291,
384323,
343365,
212303,
367965,
343393,
343398,
367980,
425328,
343409,
154999,
253303,
343417,
327034,
245127,
384397,
245136,
245142,
245145,
343450,
245148,
245151,
245154,
245157,
245162,
327084,
359865,
384443,
146876,
327107,
384453,
327110,
327115,
327117,
359886,
359890,
343507,
368092,
343534,
343539,
368119,
343544,
368122,
409091,
359947,
359955,
359983,
343630,
327275,
245357,
138864,
155254,
155273,
368288,
425638,
155322,
425662,
155327,
155351,
155354,
212699,
155363,
245475,
245483,
409335,
155393,
155403,
155422,
360223,
155438,
155442,
155447,
155461,
360261,
155482,
261981,
425822,
155487,
376671,
155490,
155491,
327531,
261996,
376685,
261999,
262002,
327539,
262005,
147317,
262008,
262011,
155516,
155521,
155525,
360326,
155531,
262027,
262030,
262033,
262036,
262039,
262042,
155549,
262045,
262048,
262051,
327589,
155559,
155562,
155565,
393150,
393169,
155611,
155619,
253923,
155621,
253926,
327654,
204784,
393203,
360438,
393206,
393212,
155646
] |
b8eba26209d0975d8b1d9d24fa48b757cec6ae8e | a348dad3ecea3fc725e06903c0f89368b263ef70 | /Sources/AWSSDKSwift/Services/AccessAnalyzer/AccessAnalyzer_Shapes.swift | 76c0f17c294297ea123828b7acd64c39ae71bb0c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 0xTim/aws-sdk-swift | 9393e222cfa19f7f1136977c31c029093bd8ada6 | bdb0c83b61a2eb7874a6ae25bdf7059e6b55d747 | refs/heads/master | 2021-02-10T13:38:07.733152 | 2020-03-02T11:41:01 | 2020-03-02T11:41:01 | 244,384,563 | 1 | 0 | Apache-2.0 | 2020-03-02T13:58:47 | 2020-03-02T13:58:46 | null | UTF-8 | Swift | false | false | 53,101 | swift | // THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/swift-aws/aws-sdk-swift/blob/master/CodeGenerator/Sources/CodeGenerator/main.swift. DO NOT EDIT.
import Foundation
import AWSSDKSwiftCore
extension AccessAnalyzer {
//MARK: Enums
public enum FindingStatus: String, CustomStringConvertible, Codable {
case active = "ACTIVE"
case archived = "ARCHIVED"
case resolved = "RESOLVED"
public var description: String { return self.rawValue }
}
public enum FindingStatusUpdate: String, CustomStringConvertible, Codable {
case active = "ACTIVE"
case archived = "ARCHIVED"
public var description: String { return self.rawValue }
}
public enum OrderBy: String, CustomStringConvertible, Codable {
case asc = "ASC"
case desc = "DESC"
public var description: String { return self.rawValue }
}
public enum ResourceType: String, CustomStringConvertible, Codable {
case awsIamRole = "AWS::IAM::Role"
case awsKmsKey = "AWS::KMS::Key"
case awsLambdaFunction = "AWS::Lambda::Function"
case awsLambdaLayerversion = "AWS::Lambda::LayerVersion"
case awsS3Bucket = "AWS::S3::Bucket"
case awsSqsQueue = "AWS::SQS::Queue"
public var description: String { return self.rawValue }
}
public enum `Type`: String, CustomStringConvertible, Codable {
case account = "ACCOUNT"
public var description: String { return self.rawValue }
}
//MARK: Shapes
public struct AnalyzedResource: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "actions", required: false, type: .list),
AWSShapeMember(label: "analyzedAt", required: true, type: .timestamp),
AWSShapeMember(label: "createdAt", required: true, type: .timestamp),
AWSShapeMember(label: "error", required: false, type: .string),
AWSShapeMember(label: "isPublic", required: true, type: .boolean),
AWSShapeMember(label: "resourceArn", required: true, type: .string),
AWSShapeMember(label: "resourceType", required: true, type: .enum),
AWSShapeMember(label: "sharedVia", required: false, type: .list),
AWSShapeMember(label: "status", required: false, type: .enum),
AWSShapeMember(label: "updatedAt", required: true, type: .timestamp)
]
/// The actions that an external principal is granted permission to use by the policy that generated the finding.
public let actions: [String]?
/// The time at which the resource was analyzed.
public let analyzedAt: TimeStamp
/// The time at which the finding was created.
public let createdAt: TimeStamp
/// An error message.
public let error: String?
/// Indicates whether the policy that generated the finding grants public access to the resource.
public let isPublic: Bool
/// The ARN of the resource that was analyzed.
public let resourceArn: String
/// The type of the resource that was analyzed.
public let resourceType: ResourceType
/// Indicates how the access that generated the finding is granted.
public let sharedVia: [String]?
/// The current status of the finding generated from the analyzed resource.
public let status: FindingStatus?
/// The time at which the finding was updated.
public let updatedAt: TimeStamp
public init(actions: [String]? = nil, analyzedAt: TimeStamp, createdAt: TimeStamp, error: String? = nil, isPublic: Bool, resourceArn: String, resourceType: ResourceType, sharedVia: [String]? = nil, status: FindingStatus? = nil, updatedAt: TimeStamp) {
self.actions = actions
self.analyzedAt = analyzedAt
self.createdAt = createdAt
self.error = error
self.isPublic = isPublic
self.resourceArn = resourceArn
self.resourceType = resourceType
self.sharedVia = sharedVia
self.status = status
self.updatedAt = updatedAt
}
private enum CodingKeys: String, CodingKey {
case actions = "actions"
case analyzedAt = "analyzedAt"
case createdAt = "createdAt"
case error = "error"
case isPublic = "isPublic"
case resourceArn = "resourceArn"
case resourceType = "resourceType"
case sharedVia = "sharedVia"
case status = "status"
case updatedAt = "updatedAt"
}
}
public struct AnalyzedResourceSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", required: true, type: .string),
AWSShapeMember(label: "resourceType", required: true, type: .enum)
]
/// The ARN of the analyzed resource.
public let resourceArn: String
/// The type of resource that was analyzed.
public let resourceType: ResourceType
public init(resourceArn: String, resourceType: ResourceType) {
self.resourceArn = resourceArn
self.resourceType = resourceType
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case resourceType = "resourceType"
}
}
public struct AnalyzerSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "arn", required: true, type: .string),
AWSShapeMember(label: "createdAt", required: true, type: .timestamp),
AWSShapeMember(label: "lastResourceAnalyzed", required: false, type: .string),
AWSShapeMember(label: "lastResourceAnalyzedAt", required: false, type: .timestamp),
AWSShapeMember(label: "name", required: true, type: .string),
AWSShapeMember(label: "tags", required: false, type: .map),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// The ARN of the analyzer.
public let arn: String
/// A timestamp for the time at which the analyzer was created.
public let createdAt: TimeStamp
/// The resource that was most recently analyzed by the analyzer.
public let lastResourceAnalyzed: String?
/// The time at which the most recently analyzed resource was analyzed.
public let lastResourceAnalyzedAt: TimeStamp?
/// The name of the analyzer.
public let name: String
/// The tags added to the analyzer.
public let tags: [String: String]?
/// The type of analyzer, which corresponds to the zone of trust chosen for the analyzer.
public let `type`: `Type`
public init(arn: String, createdAt: TimeStamp, lastResourceAnalyzed: String? = nil, lastResourceAnalyzedAt: TimeStamp? = nil, name: String, tags: [String: String]? = nil, type: `Type`) {
self.arn = arn
self.createdAt = createdAt
self.lastResourceAnalyzed = lastResourceAnalyzed
self.lastResourceAnalyzedAt = lastResourceAnalyzedAt
self.name = name
self.tags = tags
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case arn = "arn"
case createdAt = "createdAt"
case lastResourceAnalyzed = "lastResourceAnalyzed"
case lastResourceAnalyzedAt = "lastResourceAnalyzedAt"
case name = "name"
case tags = "tags"
case `type` = "type"
}
}
public struct ArchiveRuleSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "createdAt", required: true, type: .timestamp),
AWSShapeMember(label: "filter", required: true, type: .map),
AWSShapeMember(label: "ruleName", required: true, type: .string),
AWSShapeMember(label: "updatedAt", required: true, type: .timestamp)
]
/// The time at which the archive rule was created.
public let createdAt: TimeStamp
/// A filter used to define the archive rule.
public let filter: [String: Criterion]
/// The name of the archive rule.
public let ruleName: String
/// The time at which the archive rule was last updated.
public let updatedAt: TimeStamp
public init(createdAt: TimeStamp, filter: [String: Criterion], ruleName: String, updatedAt: TimeStamp) {
self.createdAt = createdAt
self.filter = filter
self.ruleName = ruleName
self.updatedAt = updatedAt
}
private enum CodingKeys: String, CodingKey {
case createdAt = "createdAt"
case filter = "filter"
case ruleName = "ruleName"
case updatedAt = "updatedAt"
}
}
public struct CreateAnalyzerRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", required: true, type: .string),
AWSShapeMember(label: "archiveRules", required: false, type: .list),
AWSShapeMember(label: "clientToken", required: false, type: .string),
AWSShapeMember(label: "tags", required: false, type: .map),
AWSShapeMember(label: "type", required: true, type: .enum)
]
/// The name of the analyzer to create.
public let analyzerName: String
/// Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.
public let archiveRules: [InlineArchiveRule]?
/// A client token.
public let clientToken: String?
/// The tags to apply to the analyzer.
public let tags: [String: String]?
/// The type of analyzer to create. Only ACCOUNT analyzers are supported. You can create only one analyzer per account per Region.
public let `type`: `Type`
public init(analyzerName: String, archiveRules: [InlineArchiveRule]? = nil, clientToken: String? = CreateAnalyzerRequest.idempotencyToken(), tags: [String: String]? = nil, type: `Type`) {
self.analyzerName = analyzerName
self.archiveRules = archiveRules
self.clientToken = clientToken
self.tags = tags
self.`type` = `type`
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
try self.archiveRules?.forEach {
try $0.validate(name: "\(name).archiveRules[]")
}
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case archiveRules = "archiveRules"
case clientToken = "clientToken"
case tags = "tags"
case `type` = "type"
}
}
public struct CreateAnalyzerResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "arn", required: false, type: .string)
]
/// The ARN of the analyzer that was created by the request.
public let arn: String?
public init(arn: String? = nil) {
self.arn = arn
}
private enum CodingKeys: String, CodingKey {
case arn = "arn"
}
}
public struct CreateArchiveRuleRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "clientToken", required: false, type: .string),
AWSShapeMember(label: "filter", required: true, type: .map),
AWSShapeMember(label: "ruleName", required: true, type: .string)
]
/// The name of the created analyzer.
public let analyzerName: String
/// A client token.
public let clientToken: String?
/// The criteria for the rule.
public let filter: [String: Criterion]
/// The name of the rule to create.
public let ruleName: String
public init(analyzerName: String, clientToken: String? = CreateArchiveRuleRequest.idempotencyToken(), filter: [String: Criterion], ruleName: String) {
self.analyzerName = analyzerName
self.clientToken = clientToken
self.filter = filter
self.ruleName = ruleName
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
try self.filter.forEach {
try $0.value.validate(name: "\(name).filter[\"\($0.key)\"]")
}
try validate(self.ruleName, name:"ruleName", parent: name, max: 255)
try validate(self.ruleName, name:"ruleName", parent: name, min: 1)
try validate(self.ruleName, name:"ruleName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case clientToken = "clientToken"
case filter = "filter"
case ruleName = "ruleName"
}
}
public struct Criterion: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "contains", required: false, type: .list),
AWSShapeMember(label: "eq", required: false, type: .list),
AWSShapeMember(label: "exists", required: false, type: .boolean),
AWSShapeMember(label: "neq", required: false, type: .list)
]
/// A "contains" operator to match for the filter used to create the rule.
public let contains: [String]?
/// An "equals" operator to match for the filter used to create the rule.
public let eq: [String]?
/// An "exists" operator to match for the filter used to create the rule.
public let exists: Bool?
/// A "not equals" operator to match for the filter used to create the rule.
public let neq: [String]?
public init(contains: [String]? = nil, eq: [String]? = nil, exists: Bool? = nil, neq: [String]? = nil) {
self.contains = contains
self.eq = eq
self.exists = exists
self.neq = neq
}
public func validate(name: String) throws {
try validate(self.contains, name:"contains", parent: name, max: 20)
try validate(self.contains, name:"contains", parent: name, min: 1)
try validate(self.eq, name:"eq", parent: name, max: 20)
try validate(self.eq, name:"eq", parent: name, min: 1)
try validate(self.neq, name:"neq", parent: name, max: 20)
try validate(self.neq, name:"neq", parent: name, min: 1)
}
private enum CodingKeys: String, CodingKey {
case contains = "contains"
case eq = "eq"
case exists = "exists"
case neq = "neq"
}
}
public struct DeleteAnalyzerRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "clientToken", location: .querystring(locationName: "clientToken"), required: false, type: .string)
]
/// The name of the analyzer to delete.
public let analyzerName: String
/// A client token.
public let clientToken: String?
public init(analyzerName: String, clientToken: String? = DeleteAnalyzerRequest.idempotencyToken()) {
self.analyzerName = analyzerName
self.clientToken = clientToken
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case clientToken = "clientToken"
}
}
public struct DeleteArchiveRuleRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "clientToken", location: .querystring(locationName: "clientToken"), required: false, type: .string),
AWSShapeMember(label: "ruleName", location: .uri(locationName: "ruleName"), required: true, type: .string)
]
/// The name of the analyzer that associated with the archive rule to delete.
public let analyzerName: String
/// A client token.
public let clientToken: String?
/// The name of the rule to delete.
public let ruleName: String
public init(analyzerName: String, clientToken: String? = DeleteArchiveRuleRequest.idempotencyToken(), ruleName: String) {
self.analyzerName = analyzerName
self.clientToken = clientToken
self.ruleName = ruleName
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
try validate(self.ruleName, name:"ruleName", parent: name, max: 255)
try validate(self.ruleName, name:"ruleName", parent: name, min: 1)
try validate(self.ruleName, name:"ruleName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case clientToken = "clientToken"
case ruleName = "ruleName"
}
}
public struct Finding: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "action", required: false, type: .list),
AWSShapeMember(label: "analyzedAt", required: true, type: .timestamp),
AWSShapeMember(label: "condition", required: true, type: .map),
AWSShapeMember(label: "createdAt", required: true, type: .timestamp),
AWSShapeMember(label: "error", required: false, type: .string),
AWSShapeMember(label: "id", required: true, type: .string),
AWSShapeMember(label: "isPublic", required: false, type: .boolean),
AWSShapeMember(label: "principal", required: false, type: .map),
AWSShapeMember(label: "resource", required: false, type: .string),
AWSShapeMember(label: "resourceType", required: true, type: .enum),
AWSShapeMember(label: "status", required: true, type: .enum),
AWSShapeMember(label: "updatedAt", required: true, type: .timestamp)
]
/// The action in the analyzed policy statement that an external principal has permission to use.
public let action: [String]?
/// The time at which the resource was analyzed.
public let analyzedAt: TimeStamp
/// The condition in the analyzed policy statement that resulted in a finding.
public let condition: [String: String]
/// The time at which the finding was generated.
public let createdAt: TimeStamp
/// An error.
public let error: String?
/// The ID of the finding.
public let id: String
/// Indicates whether the policy that generated the finding allows public access to the resource.
public let isPublic: Bool?
/// The external principal that access to a resource within the zone of trust.
public let principal: [String: String]?
/// The resource that an external principal has access to.
public let resource: String?
/// The type of the resource reported in the finding.
public let resourceType: ResourceType
/// The current status of the finding.
public let status: FindingStatus
/// The time at which the finding was updated.
public let updatedAt: TimeStamp
public init(action: [String]? = nil, analyzedAt: TimeStamp, condition: [String: String], createdAt: TimeStamp, error: String? = nil, id: String, isPublic: Bool? = nil, principal: [String: String]? = nil, resource: String? = nil, resourceType: ResourceType, status: FindingStatus, updatedAt: TimeStamp) {
self.action = action
self.analyzedAt = analyzedAt
self.condition = condition
self.createdAt = createdAt
self.error = error
self.id = id
self.isPublic = isPublic
self.principal = principal
self.resource = resource
self.resourceType = resourceType
self.status = status
self.updatedAt = updatedAt
}
private enum CodingKeys: String, CodingKey {
case action = "action"
case analyzedAt = "analyzedAt"
case condition = "condition"
case createdAt = "createdAt"
case error = "error"
case id = "id"
case isPublic = "isPublic"
case principal = "principal"
case resource = "resource"
case resourceType = "resourceType"
case status = "status"
case updatedAt = "updatedAt"
}
}
public struct FindingSummary: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "action", required: false, type: .list),
AWSShapeMember(label: "analyzedAt", required: true, type: .timestamp),
AWSShapeMember(label: "condition", required: true, type: .map),
AWSShapeMember(label: "createdAt", required: true, type: .timestamp),
AWSShapeMember(label: "error", required: false, type: .string),
AWSShapeMember(label: "id", required: true, type: .string),
AWSShapeMember(label: "isPublic", required: false, type: .boolean),
AWSShapeMember(label: "principal", required: false, type: .map),
AWSShapeMember(label: "resource", required: false, type: .string),
AWSShapeMember(label: "resourceType", required: true, type: .enum),
AWSShapeMember(label: "status", required: true, type: .enum),
AWSShapeMember(label: "updatedAt", required: true, type: .timestamp)
]
/// The action in the analyzed policy statement that an external principal has permission to use.
public let action: [String]?
/// The time at which the resource-based policy that generated the finding was analyzed.
public let analyzedAt: TimeStamp
/// The condition in the analyzed policy statement that resulted in a finding.
public let condition: [String: String]
/// The time at which the finding was created.
public let createdAt: TimeStamp
/// The error that resulted in an Error finding.
public let error: String?
/// The ID of the finding.
public let id: String
/// Indicates whether the finding reports a resource that has a policy that allows public access.
public let isPublic: Bool?
/// The external principal that has access to a resource within the zone of trust.
public let principal: [String: String]?
/// The resource that the external principal has access to.
public let resource: String?
/// The type of the resource that the external principal has access to.
public let resourceType: ResourceType
/// The status of the finding.
public let status: FindingStatus
/// The time at which the finding was most recently updated.
public let updatedAt: TimeStamp
public init(action: [String]? = nil, analyzedAt: TimeStamp, condition: [String: String], createdAt: TimeStamp, error: String? = nil, id: String, isPublic: Bool? = nil, principal: [String: String]? = nil, resource: String? = nil, resourceType: ResourceType, status: FindingStatus, updatedAt: TimeStamp) {
self.action = action
self.analyzedAt = analyzedAt
self.condition = condition
self.createdAt = createdAt
self.error = error
self.id = id
self.isPublic = isPublic
self.principal = principal
self.resource = resource
self.resourceType = resourceType
self.status = status
self.updatedAt = updatedAt
}
private enum CodingKeys: String, CodingKey {
case action = "action"
case analyzedAt = "analyzedAt"
case condition = "condition"
case createdAt = "createdAt"
case error = "error"
case id = "id"
case isPublic = "isPublic"
case principal = "principal"
case resource = "resource"
case resourceType = "resourceType"
case status = "status"
case updatedAt = "updatedAt"
}
}
public struct GetAnalyzedResourceRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", location: .querystring(locationName: "analyzerArn"), required: true, type: .string),
AWSShapeMember(label: "resourceArn", location: .querystring(locationName: "resourceArn"), required: true, type: .string)
]
/// The ARN of the analyzer to retrieve information from.
public let analyzerArn: String
/// The ARN of the resource to retrieve information about.
public let resourceArn: String
public init(analyzerArn: String, resourceArn: String) {
self.analyzerArn = analyzerArn
self.resourceArn = resourceArn
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
try validate(self.resourceArn, name:"resourceArn", parent: name, pattern: "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case resourceArn = "resourceArn"
}
}
public struct GetAnalyzedResourceResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resource", required: false, type: .structure)
]
/// An AnalyedResource object that contains information that Access Analyzer found when it analyzed the resource.
public let resource: AnalyzedResource?
public init(resource: AnalyzedResource? = nil) {
self.resource = resource
}
private enum CodingKeys: String, CodingKey {
case resource = "resource"
}
}
public struct GetAnalyzerRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string)
]
/// The name of the analyzer retrieved.
public let analyzerName: String
public init(analyzerName: String) {
self.analyzerName = analyzerName
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
}
}
public struct GetAnalyzerResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzer", required: true, type: .structure)
]
/// An AnalyzerSummary object that contains information about the analyzer.
public let analyzer: AnalyzerSummary
public init(analyzer: AnalyzerSummary) {
self.analyzer = analyzer
}
private enum CodingKeys: String, CodingKey {
case analyzer = "analyzer"
}
}
public struct GetArchiveRuleRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "ruleName", location: .uri(locationName: "ruleName"), required: true, type: .string)
]
/// The name of the analyzer to retrieve rules from.
public let analyzerName: String
/// The name of the rule to retrieve.
public let ruleName: String
public init(analyzerName: String, ruleName: String) {
self.analyzerName = analyzerName
self.ruleName = ruleName
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
try validate(self.ruleName, name:"ruleName", parent: name, max: 255)
try validate(self.ruleName, name:"ruleName", parent: name, min: 1)
try validate(self.ruleName, name:"ruleName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case ruleName = "ruleName"
}
}
public struct GetArchiveRuleResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "archiveRule", required: true, type: .structure)
]
public let archiveRule: ArchiveRuleSummary
public init(archiveRule: ArchiveRuleSummary) {
self.archiveRule = archiveRule
}
private enum CodingKeys: String, CodingKey {
case archiveRule = "archiveRule"
}
}
public struct GetFindingRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", location: .querystring(locationName: "analyzerArn"), required: true, type: .string),
AWSShapeMember(label: "id", location: .uri(locationName: "id"), required: true, type: .string)
]
/// The ARN of the analyzer that generated the finding.
public let analyzerArn: String
/// The ID of the finding to retrieve.
public let id: String
public init(analyzerArn: String, id: String) {
self.analyzerArn = analyzerArn
self.id = id
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case id = "id"
}
}
public struct GetFindingResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "finding", required: false, type: .structure)
]
/// A finding object that contains finding details.
public let finding: Finding?
public init(finding: Finding? = nil) {
self.finding = finding
}
private enum CodingKeys: String, CodingKey {
case finding = "finding"
}
}
public struct InlineArchiveRule: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "filter", required: true, type: .map),
AWSShapeMember(label: "ruleName", required: true, type: .string)
]
/// The condition and values for a criterion.
public let filter: [String: Criterion]
/// The name of the rule.
public let ruleName: String
public init(filter: [String: Criterion], ruleName: String) {
self.filter = filter
self.ruleName = ruleName
}
public func validate(name: String) throws {
try self.filter.forEach {
try $0.value.validate(name: "\(name).filter[\"\($0.key)\"]")
}
try validate(self.ruleName, name:"ruleName", parent: name, max: 255)
try validate(self.ruleName, name:"ruleName", parent: name, min: 1)
try validate(self.ruleName, name:"ruleName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case filter = "filter"
case ruleName = "ruleName"
}
}
public struct ListAnalyzedResourcesRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", required: true, type: .string),
AWSShapeMember(label: "maxResults", required: false, type: .integer),
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "resourceType", required: false, type: .enum)
]
/// The ARN of the analyzer to retrieve a list of analyzed resources from.
public let analyzerArn: String
/// The maximum number of results to return in the response.
public let maxResults: Int?
/// A token used for pagination of results returned.
public let nextToken: String?
/// The type of resource.
public let resourceType: ResourceType?
public init(analyzerArn: String, maxResults: Int? = nil, nextToken: String? = nil, resourceType: ResourceType? = nil) {
self.analyzerArn = analyzerArn
self.maxResults = maxResults
self.nextToken = nextToken
self.resourceType = resourceType
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case maxResults = "maxResults"
case nextToken = "nextToken"
case resourceType = "resourceType"
}
}
public struct ListAnalyzedResourcesResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzedResources", required: true, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// A list of resources that were analyzed.
public let analyzedResources: [AnalyzedResourceSummary]
/// A token used for pagination of results returned.
public let nextToken: String?
public init(analyzedResources: [AnalyzedResourceSummary], nextToken: String? = nil) {
self.analyzedResources = analyzedResources
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case analyzedResources = "analyzedResources"
case nextToken = "nextToken"
}
}
public struct ListAnalyzersRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "maxResults", location: .querystring(locationName: "maxResults"), required: false, type: .integer),
AWSShapeMember(label: "nextToken", location: .querystring(locationName: "nextToken"), required: false, type: .string),
AWSShapeMember(label: "type", location: .querystring(locationName: "type"), required: false, type: .enum)
]
/// The maximum number of results to return in the response.
public let maxResults: Int?
/// A token used for pagination of results returned.
public let nextToken: String?
/// The type of analyzer.
public let `type`: `Type`?
public init(maxResults: Int? = nil, nextToken: String? = nil, type: `Type`? = nil) {
self.maxResults = maxResults
self.nextToken = nextToken
self.`type` = `type`
}
private enum CodingKeys: String, CodingKey {
case maxResults = "maxResults"
case nextToken = "nextToken"
case `type` = "type"
}
}
public struct ListAnalyzersResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzers", required: true, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// The analyzers retrieved.
public let analyzers: [AnalyzerSummary]
/// A token used for pagination of results returned.
public let nextToken: String?
public init(analyzers: [AnalyzerSummary], nextToken: String? = nil) {
self.analyzers = analyzers
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case analyzers = "analyzers"
case nextToken = "nextToken"
}
}
public struct ListArchiveRulesRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "maxResults", location: .querystring(locationName: "maxResults"), required: false, type: .integer),
AWSShapeMember(label: "nextToken", location: .querystring(locationName: "nextToken"), required: false, type: .string)
]
/// The name of the analyzer to retrieve rules from.
public let analyzerName: String
/// The maximum number of results to return in the request.
public let maxResults: Int?
/// A token used for pagination of results returned.
public let nextToken: String?
public init(analyzerName: String, maxResults: Int? = nil, nextToken: String? = nil) {
self.analyzerName = analyzerName
self.maxResults = maxResults
self.nextToken = nextToken
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case maxResults = "maxResults"
case nextToken = "nextToken"
}
}
public struct ListArchiveRulesResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "archiveRules", required: true, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// A list of archive rules created for the specified analyzer.
public let archiveRules: [ArchiveRuleSummary]
/// A token used for pagination of results returned.
public let nextToken: String?
public init(archiveRules: [ArchiveRuleSummary], nextToken: String? = nil) {
self.archiveRules = archiveRules
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case archiveRules = "archiveRules"
case nextToken = "nextToken"
}
}
public struct ListFindingsRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", required: true, type: .string),
AWSShapeMember(label: "filter", required: false, type: .map),
AWSShapeMember(label: "maxResults", required: false, type: .integer),
AWSShapeMember(label: "nextToken", required: false, type: .string),
AWSShapeMember(label: "sort", required: false, type: .structure)
]
/// The ARN of the analyzer to retrieve findings from.
public let analyzerArn: String
/// A filter to match for the findings to return.
public let filter: [String: Criterion]?
/// The maximum number of results to return in the response.
public let maxResults: Int?
/// A token used for pagination of results returned.
public let nextToken: String?
/// The sort order for the findings returned.
public let sort: SortCriteria?
public init(analyzerArn: String, filter: [String: Criterion]? = nil, maxResults: Int? = nil, nextToken: String? = nil, sort: SortCriteria? = nil) {
self.analyzerArn = analyzerArn
self.filter = filter
self.maxResults = maxResults
self.nextToken = nextToken
self.sort = sort
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
try self.filter?.forEach {
try $0.value.validate(name: "\(name).filter[\"\($0.key)\"]")
}
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case filter = "filter"
case maxResults = "maxResults"
case nextToken = "nextToken"
case sort = "sort"
}
}
public struct ListFindingsResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "findings", required: true, type: .list),
AWSShapeMember(label: "nextToken", required: false, type: .string)
]
/// A list of findings retrieved from the analyzer that match the filter criteria specified, if any.
public let findings: [FindingSummary]
/// A token used for pagination of results returned.
public let nextToken: String?
public init(findings: [FindingSummary], nextToken: String? = nil) {
self.findings = findings
self.nextToken = nextToken
}
private enum CodingKeys: String, CodingKey {
case findings = "findings"
case nextToken = "nextToken"
}
}
public struct ListTagsForResourceRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", location: .uri(locationName: "resourceArn"), required: true, type: .string)
]
/// The ARN of the resource to retrieve tags from.
public let resourceArn: String
public init(resourceArn: String) {
self.resourceArn = resourceArn
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
}
}
public struct ListTagsForResourceResponse: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "tags", required: false, type: .map)
]
/// The tags that are applied to the specified resource.
public let tags: [String: String]?
public init(tags: [String: String]? = nil) {
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case tags = "tags"
}
}
public struct SortCriteria: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "attributeName", required: false, type: .string),
AWSShapeMember(label: "orderBy", required: false, type: .enum)
]
/// The name of the attribute to sort on.
public let attributeName: String?
/// The sort order, ascending or descending.
public let orderBy: OrderBy?
public init(attributeName: String? = nil, orderBy: OrderBy? = nil) {
self.attributeName = attributeName
self.orderBy = orderBy
}
private enum CodingKeys: String, CodingKey {
case attributeName = "attributeName"
case orderBy = "orderBy"
}
}
public struct StartResourceScanRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", required: true, type: .string),
AWSShapeMember(label: "resourceArn", required: true, type: .string)
]
/// The ARN of the analyzer to use to scan the policies applied to the specified resource.
public let analyzerArn: String
/// The ARN of the resource to scan.
public let resourceArn: String
public init(analyzerArn: String, resourceArn: String) {
self.analyzerArn = analyzerArn
self.resourceArn = resourceArn
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
try validate(self.resourceArn, name:"resourceArn", parent: name, pattern: "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case resourceArn = "resourceArn"
}
}
public struct TagResourceRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", location: .uri(locationName: "resourceArn"), required: true, type: .string),
AWSShapeMember(label: "tags", required: true, type: .map)
]
/// The ARN of the resource to add the tag to.
public let resourceArn: String
/// The tags to add to the resource.
public let tags: [String: String]
public init(resourceArn: String, tags: [String: String]) {
self.resourceArn = resourceArn
self.tags = tags
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tags = "tags"
}
}
public struct TagResourceResponse: AWSShape {
public init() {
}
}
public struct UntagResourceRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "resourceArn", location: .uri(locationName: "resourceArn"), required: true, type: .string),
AWSShapeMember(label: "tagKeys", location: .querystring(locationName: "tagKeys"), required: true, type: .list)
]
/// The ARN of the resource to remove the tag from.
public let resourceArn: String
/// The key for the tag to add.
public let tagKeys: [String]
public init(resourceArn: String, tagKeys: [String]) {
self.resourceArn = resourceArn
self.tagKeys = tagKeys
}
private enum CodingKeys: String, CodingKey {
case resourceArn = "resourceArn"
case tagKeys = "tagKeys"
}
}
public struct UntagResourceResponse: AWSShape {
public init() {
}
}
public struct UpdateArchiveRuleRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerName", location: .uri(locationName: "analyzerName"), required: true, type: .string),
AWSShapeMember(label: "clientToken", required: false, type: .string),
AWSShapeMember(label: "filter", required: true, type: .map),
AWSShapeMember(label: "ruleName", location: .uri(locationName: "ruleName"), required: true, type: .string)
]
/// The name of the analyzer to update the archive rules for.
public let analyzerName: String
/// A client token.
public let clientToken: String?
/// A filter to match for the rules to update. Only rules that match the filter are updated.
public let filter: [String: Criterion]
/// The name of the rule to update.
public let ruleName: String
public init(analyzerName: String, clientToken: String? = UpdateArchiveRuleRequest.idempotencyToken(), filter: [String: Criterion], ruleName: String) {
self.analyzerName = analyzerName
self.clientToken = clientToken
self.filter = filter
self.ruleName = ruleName
}
public func validate(name: String) throws {
try validate(self.analyzerName, name:"analyzerName", parent: name, max: 255)
try validate(self.analyzerName, name:"analyzerName", parent: name, min: 1)
try validate(self.analyzerName, name:"analyzerName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
try self.filter.forEach {
try $0.value.validate(name: "\(name).filter[\"\($0.key)\"]")
}
try validate(self.ruleName, name:"ruleName", parent: name, max: 255)
try validate(self.ruleName, name:"ruleName", parent: name, min: 1)
try validate(self.ruleName, name:"ruleName", parent: name, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerName = "analyzerName"
case clientToken = "clientToken"
case filter = "filter"
case ruleName = "ruleName"
}
}
public struct UpdateFindingsRequest: AWSShape {
public static var _members: [AWSShapeMember] = [
AWSShapeMember(label: "analyzerArn", required: true, type: .string),
AWSShapeMember(label: "clientToken", required: false, type: .string),
AWSShapeMember(label: "ids", required: false, type: .list),
AWSShapeMember(label: "resourceArn", required: false, type: .string),
AWSShapeMember(label: "status", required: true, type: .enum)
]
/// The ARN of the analyzer that generated the findings to update.
public let analyzerArn: String
/// A client token.
public let clientToken: String?
/// The IDs of the findings to update.
public let ids: [String]?
/// The ARN of the resource identified in the finding.
public let resourceArn: String?
/// The state represents the action to take to update the finding Status. Use ARCHIVE to change an Active finding to an Archived finding. Use ACTIVE to change an Archived finding to an Active finding.
public let status: FindingStatusUpdate
public init(analyzerArn: String, clientToken: String? = UpdateFindingsRequest.idempotencyToken(), ids: [String]? = nil, resourceArn: String? = nil, status: FindingStatusUpdate) {
self.analyzerArn = analyzerArn
self.clientToken = clientToken
self.ids = ids
self.resourceArn = resourceArn
self.status = status
}
public func validate(name: String) throws {
try validate(self.analyzerArn, name:"analyzerArn", parent: name, pattern: "^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:analyzer/.{1,255}$")
try validate(self.resourceArn, name:"resourceArn", parent: name, pattern: "arn:[^:]*:[^:]*:[^:]*:[^:]*:.*$")
}
private enum CodingKeys: String, CodingKey {
case analyzerArn = "analyzerArn"
case clientToken = "clientToken"
case ids = "ids"
case resourceArn = "resourceArn"
case status = "status"
}
}
}
| [
-1
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.