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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c59f318fdf741bbc323737c20d0fab5fee59e656 | 25d5000a97fec4ab59a2e83f7bccdb20ea42e807 | /Patchr/AirRadioButton.swift | fd3cc135f1f01f181205993aa0fcd67433953767 | [] | no_license | 3meters/patchr-ios | 19359aa73a7e2199e60b15dc69e07370101c7b0d | 922703a157a645ba25ef5752ba9f442016836476 | refs/heads/master | 2021-09-25T23:05:55.561379 | 2017-08-21T15:28:09 | 2017-08-21T15:28:09 | 67,538,587 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 1,075 | swift | //
// AirButton.swift
// Patchr
//
// Created by Jay Massena on 11/27/15.
// Copyright © 2015 3meters. All rights reserved.
//
import UIKit
import DLRadioButton
class AirRadioButton: DLRadioButton {
required init(coder aDecoder: NSCoder) {
/* Called when instantiated from XIB or Storyboard */
super.init(coder: aDecoder)!
initialize()
}
override init(frame: CGRect) {
/* Called when instantiated from code */
super.init(frame: frame)
initialize()
}
func initialize() {
self.titleLabel!.font = Theme.fontButtonRadioTitle
self.setTitleColor(Theme.colorButtonRadioTitle, for: .normal)
self.setTitleColor(Theme.colorButtonTitleHighlighted, for: .highlighted)
self.iconColor = Theme.colorButtonRadioIcon
self.indicatorColor = Theme.colorButtonRadioIndicator
self.contentHorizontalAlignment = .left
self.isIconOnRight = false
self.iconSize = 20
self.iconStrokeWidth = self.iconSize / self.iconSize
self.indicatorSize = self.iconSize * 0.6
self.marginWidth = 8
}
override func layoutSubviews() {
super.layoutSubviews()
}
}
| [
-1
] |
a9be290635b3064ce89c497ce7ef0eeaf8b02cd7 | de5a4c2f0e72bcdf825d39ec558b8e1a81e5c067 | /Tests/HaversineTests/XCTestManifests.swift | 89dca976c8351bedec1e8cd558eb02838a5ebf72 | [
"MIT"
] | permissive | kiliankoe/Haversine | 7e8f42bcc832ae5dca6b4796d5a1d59144f4bfd6 | 07a47a412064b6cbc46b6388a579c35c6aabf099 | refs/heads/master | 2020-07-21T10:28:42.760220 | 2019-09-15T17:35:22 | 2019-09-15T17:35:22 | 206,833,428 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 159 | swift | import XCTest
#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(HaversineTests.allTests),
]
}
#endif
| [
324611,
254468,
222726,
340487,
35348,
192030,
323614,
217122,
342563,
438821,
333350,
30252,
35376,
199217,
343601,
321586,
347127,
168502,
321593,
145978,
162364,
35394,
339018,
332369,
352338,
187475,
332372,
332374,
184407,
341079,
327257,
248926,
343657,
139369,
194157,
350830,
333426,
337012,
192629,
338551,
339575,
343159,
253048,
346747,
347260,
323712,
245379,
160901,
245390,
186514,
258711,
330392,
319641,
315550,
175775,
343207,
181930,
248490,
352943,
336562,
153275,
350911,
326337,
225988,
323780,
339670,
223964,
354013,
254175,
352994,
344805,
378096,
337652,
211188,
353015,
65273,
194811,
353020,
356606,
319238,
126214,
202507,
148238,
136464,
338195,
365844,
272664,
353049,
353562,
347419,
150815,
321824,
348962,
192290,
134436,
342309,
334118,
325415,
254247,
336674,
52522,
342832,
328501,
347445,
321848,
354105,
30011,
368447,
166727,
344396,
325453,
244558,
345424,
251217,
323410,
353621,
253784,
339803,
253788,
240480,
253792,
253795,
244582,
253799,
211816,
251242,
253804,
351084,
253807,
106864,
243572,
359290,
151933,
164734,
349585,
325523,
200088,
327064,
321439,
254368,
35236,
421796,
141736,
354216,
178089,
222125,
344505,
201146,
150971,
326593,
329153,
343489,
344516,
254409,
373201,
340947,
355283,
338390,
343524,
241125,
319463,
351208,
340971,
6124,
330221,
145903,
350703,
343028,
200183,
350713,
219130
] |
c9395ff6919f79d86b4ef7d5880382c5b62649fc | 9f6ec5c64fbc43489e9f28a793bce709691403ba | /ResilientMe/ResilientMe/AppDelegate.swift | 085b4dc4fc1ebbf986a916aaebd74b92db7d4bd8 | [] | no_license | dmaulikr/PlayersGame | 98515dfaa2ac3fe4721edf78b671c45f64dd1cec | abf2215f5f3ca49f5987814e878c4c1a80bbb24b | refs/heads/master | 2021-01-15T22:51:47.884894 | 2015-09-29T02:36:06 | 2015-09-29T02:36:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,159 | swift | //
// AppDelegate.swift
// ResilientMe
//
// Created by Alexis Saint-Jean on 6/14/15.
// Copyright (c) 2015 Alexis Saint-Jean. 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,
229426,
237618,
229428,
286774,
229432,
286776,
286778,
319544,
204856,
286791,
237640,
278605,
237646,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
278648,
131192,
237693,
327814,
131209,
417930,
303241,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
278760,
237807,
303345,
286962,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
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,
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,
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,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
164509,
303773,
295583,
172702,
230045,
287394,
287390,
303780,
172705,
287398,
172707,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
279231,
287423,
328384,
287427,
312006,
172748,
287436,
107212,
172751,
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,
369433,
295707,
328476,
295710,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
279383,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
213895,
320391,
304007,
304009,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
304019,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
304063,
304065,
189378,
213954,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
295949,
197645,
230413,
320528,
140312,
295961,
238620,
197663,
304164,
189479,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
279661,
164973,
205934,
312432,
279669,
337018,
279679,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
350308,
230592,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
279788,
320748,
279790,
296189,
320771,
312585,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
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,
304506,
304505,
181626,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
288162,
288164,
279975,
304555,
370092,
279983,
288176,
279985,
173488,
312755,
296373,
279991,
312759,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
288208,
230865,
370130,
288210,
288212,
280021,
288214,
222676,
239064,
288217,
288218,
280027,
329177,
288220,
239070,
288224,
280034,
370146,
280036,
288226,
280038,
288229,
288230,
288232,
288234,
320998,
288236,
288238,
288240,
291754,
288242,
296435,
288244,
296439,
288250,
402942,
148990,
296446,
206336,
321022,
296450,
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,
321200,
337585,
296626,
296634,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
313044,
321239,
280283,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
345921,
280388,
304968,
280393,
280402,
313176,
42842,
280419,
321381,
280426,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280458,
280464,
124817,
280468,
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,
223303,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
223327,
280671,
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,
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,
280940,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
190868,
297365,
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,
199367,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
281401,
289593,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
183172,
158596,
240519,
322440,
338823,
314249,
289687,
240535,
297883,
289694,
289696,
289700,
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,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
298306,
380226,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
265604,
281990,
298377,
314763,
142733,
298381,
224657,
306581,
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,
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,
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,
307009,
241475,
307012,
148946,
315211,
282446,
307027,
315221,
282454,
315223,
241496,
323414,
241498,
307035,
307040,
282465,
110433,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
282499,
315267,
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,
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,
307512,
151864,
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,
291202,
299398,
242057,
291212,
299405,
291222,
283033,
291226,
242075,
315801,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
291247,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
283080,
176592,
315856,
315860,
176597,
127447,
283095,
299481,
176605,
242143,
291299,
127463,
242152,
291305,
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,
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,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
381677,
226037,
283382,
234231,
316151,
234236,
226045,
234239,
242431,
209665,
234242,
299778,
242436,
226053,
234246,
234248,
226056,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
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,
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,
234393,
324504,
209818,
308123,
324508,
234398,
234396,
291742,
234401,
291748,
234405,
291750,
234407,
324518,
324520,
234410,
324522,
226220,
291756,
234414,
324527,
291760,
234417,
201650,
324531,
234422,
226230,
275384,
324536,
234428,
291773,
234431,
242623,
324544,
324546,
226239,
324548,
234437,
226245,
234439,
234434,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
300628,
234585,
275545,
242777,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
234607,
160879,
275569,
234610,
300148,
234614,
398455,
234618,
275579,
144506,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
226453,
275606,
234647,
275608,
308373,
234650,
234648,
308379,
234653,
283805,
324766,
119967,
234657,
300189,
324768,
242852,
283813,
234661,
300197,
234664,
275626,
234667,
316596,
234687,
300226,
226500,
234692,
300229,
308420,
283844,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
161003,
300267,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
283904,
300289,
292097,
300292,
300294,
275719,
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,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
284076,
144812,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
284099,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
259567,
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,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
276052,
276053,
284245,
284247,
317015,
235097,
284249,
284251,
243290,
284253,
243293,
284255,
300638,
284258,
292452,
177766,
284263,
292454,
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,
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,
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,
300828,
300830,
276255,
325408,
284449,
300834,
300832,
227109,
317221,
358183,
186151,
276268,
194351,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
284529,
292721,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
358292,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292776,
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,
227314,
276466,
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,
276553,
243785,
350293,
350295,
194649,
227418,
309337,
350302,
227423,
194654,
194657,
178273,
276579,
227426,
194660,
227430,
276583,
309346,
309348,
276586,
309350,
309352,
309354,
276590,
350313,
350316,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
292989,
292993,
301185,
350339,
317573,
350342,
227463,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
276638,
350366,
284837,
153765,
350375,
350379,
350381,
350383,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
276689,
309462,
301272,
276699,
309468,
194780,
301283,
317672,
276713,
317674,
243948,
194801,
227571,
276725,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
276766,
211232,
276775,
211241,
325937,
276789,
325943,
260421,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
317951,
309764,
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,
309844,
277080,
309849,
285277,
285282,
326244,
277100,
277106,
121458,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
318094,
334476,
277136,
277139,
227992,
285340,
318108,
227998,
318110,
383658,
285357,
318128,
277170,
342707,
154292,
277173,
293555,
285368,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
326430,
228128,
228135,
318248,
277291,
293677,
318253,
285489,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277314,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
301921,
400236,
236397,
162671,
326514,
310134,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
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,
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,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
302233,
285852,
302237,
285854,
285856,
285862,
277671,
302248,
64682,
277678,
294063,
228526,
294065,
302258,
277687,
294072,
318651,
277695,
318657,
244930,
302275,
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,
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,
277892,
277894,
253320,
310665,
318858,
277898,
327046,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
277923,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
64966,
245191,
163272,
302534,
310727,
277959,
292968,
277963,
277966,
302543,
310737,
277971,
277975,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
286188,
310764,
278000,
278003,
310772,
228851,
278006,
40440,
278009,
212472,
40443,
286203,
228864,
40448,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187939,
294435,
40484,
286246,
294439,
294440,
278057,
40486,
294443,
40488,
294445,
286248,
310831,
40491,
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,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
343757,
212690,
278227,
229076,
286420,
319187,
286425,
319194,
278235,
301163,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
319243,
311053,
302862,
294682,
278306,
294701,
278320,
319280,
319290,
229192,
302925,
237409,
360317,
327554,
40840,
40851,
294803,
188312,
294811,
319390,
294817,
319394,
40865,
294821,
311209,
180142,
188340,
40886,
319419,
294844,
294847,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
2deef3632d0a575ba0592956d4a217c0dc53abae | 621360de0f4ce39eda33a4cfcf98316206d78e22 | /stopwatch/stopwatch/AppDelegate.swift | 66016c517eedecdd0e3aa89e1abfd22dae23ce9c | [] | no_license | d-hisa/rbcSampleCount | 1c9e2b579fc105b64e9259946c7fdef006a58f2e | 5042e72a18eaa2ae3d69719a618e8180c6208e52 | refs/heads/master | 2021-01-02T08:50:07.918769 | 2017-08-18T05:47:56 | 2017-08-18T05:47:56 | 99,076,079 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,165 | swift | //
// AppDelegate.swift
// stopwatch
//
// Created by nttr on 2017/07/14.
// Copyright © 2017年 nttr. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
287238,
320007,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
279178,
287371,
311946,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
164509,
303773,
172705,
287394,
172707,
303780,
287390,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304007,
304009,
304011,
230284,
304013,
295822,
279438,
189325,
189329,
295825,
304019,
213902,
189331,
58262,
304023,
304027,
279452,
234648,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
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,
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,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
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,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
215387,
354653,
354656,
313700,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
281095,
223752,
150025,
338440,
240132,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
240519,
322440,
314249,
338823,
183184,
142226,
289687,
224151,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307385,
307386,
307388,
258235,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
242206,
135710,
242208,
291361,
242220,
291378,
234038,
152118,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
291456,
135808,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
201603,
226182,
234375,
308105,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
226220,
291754,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
275384,
324536,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226245,
234437,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
324757,
308379,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
226500,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
349451,
275725,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
292192,
316768,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
227440,
316917,
308727,
292343,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276053,
284247,
317015,
284249,
243290,
284251,
235097,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
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,
276160,
358080,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
178006,
317271,
284502,
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,
227426,
276579,
227430,
276583,
309354,
301167,
276590,
350321,
350313,
350316,
284786,
350325,
252022,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
129486,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
293555,
342707,
154292,
318132,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
342745,
137946,
342747,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
56045,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
146765,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
64966,
245191,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
286233,
302617,
302621,
286240,
146977,
187936,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286313,
40554,
286312,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
278227,
286420,
229076,
286425,
319194,
278235,
301163,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
278320,
319280,
319290,
229192,
302925,
188247,
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,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
278516,
311283,
278519,
237562
] |
fc46bcdf314eacb15ca6b69a016d8e8adf1ad1c1 | e40afe6db8ad291b09052283fcc858c26064879f | /TodayNews/Classes/SmallVideo/Controller/SmallVIdeoCategoryController.swift | a2dc95a2d9cf5ffca1f34894506c99694f7fe603 | [
"MIT"
] | permissive | chenxiaopao/MyTodayNews | 2811a0ac708942caf7f929e3f840cd162db10a08 | b3c2e70263f1266188d5b0d58151fd295f178896 | refs/heads/master | 2020-03-19T12:18:01.989750 | 2018-06-07T23:27:51 | 2018-06-07T23:27:51 | 136,501,535 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 7,891 | swift | //
// SmallVIdeoCollectionViewController.swift
// TodayNews
//
// Created by 陈思斌 on 2018/4/4.
// Copyright © 2018年 陈思斌. All rights reserved.
//
import UIKit
private let SmallVideoCollectionViewCellID = "SmallVideoCollectionViewCellID"
private let kTabBarH:CGFloat = 49
//MARK: - SmallVIdeoCategoryController
class SmallVIdeoCategoryController: UIViewController{
var preIndex : Int = 0
var isDelete:Bool = false
var endConttentOffSet:CGFloat = 0
/// 标题
var newsTitle = HomeNewsTitle()
/// 刷新时间
var maxBehotTime: TimeInterval = 0.0
/// 视频数据
let vc = VideoPlayerController()
var smallVideos = [NewsModel](){
didSet{
vc.smallVideo = smallVideos
}
}
var originY:CGFloat!
private lazy var collectionView : UICollectionView = {
let layout = UICollectionViewFlowLayout()
let itemWidth = (kScreenW-15)/2
layout.scrollDirection = .vertical
layout.itemSize = CGSize(width: itemWidth, height: itemWidth*1.5)
layout.minimumLineSpacing = 1
layout.minimumInteritemSpacing = 1
let collectionVIew = UICollectionView(frame: self.view.bounds, collectionViewLayout: layout)
collectionVIew.delegate = self
collectionVIew.contentInset = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)
collectionVIew.dataSource = self
return collectionVIew
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.addSubview(collectionView)
originY = collectionView.frame.origin.y
collectionView.register(UINib(nibName: "SmallVideoCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: SmallVideoCollectionViewCellID)
collectionView.backgroundView = UIView()
collectionView.backgroundView?.backgroundColor = UIColor.white
setupRefresh()
}
// 添加刷新控件
func setupRefresh(){
// 下拉刷新
let header = RefreshHeader {
[weak self] in
NetWorkTool.loadApiNewsFeeds(category: self!.newsTitle.category, ttFrom: .enterAuto, { (maxBehotTime, newsModel) in
if (self?.collectionView.mj_header.isRefreshing)!{
self?.collectionView.mj_header.endRefreshing()
}
self?.maxBehotTime = maxBehotTime
// self?.smallVideos += newsModel
self?.smallVideos.insert(contentsOf: newsModel, at: 0)
self?.refreshCount = newsModel.count
self?.collectionView.reloadData()
if !(self?.isFirst)!{
//先执行endRefreshing()在执行completionBlock
self?.collectionView.mj_header.endRefreshing(completionBlock: {
// 显示刷新个数
let rect = CGRect(x: 0, y: 0, width: kScreenW, height: 30)
let headV = headView(frame: rect, refreshCount: (self?.refreshCount)!, collectionView: (self?.collectionView)!)
self?.view.addSubview(headV)
headV.show()
})
}
self?.isFirst = false
})
}
collectionView.mj_header = header
header?.beginRefreshing()
// 上啦刷新
collectionView.mj_footer = RefreshAutoGifFooter(refreshingBlock: { [weak self ] in
//加载更多
NetWorkTool.loadMoreApiNewsFeeds(category: (self?.newsTitle.category)!, ttFrom: .loadMore, maxBehotTime: self!.maxBehotTime-100, listCount: self!.smallVideos.count, {
if self!.collectionView.mj_footer.isRefreshing{
self!.collectionView.mj_footer.endRefreshing()
}
self!.collectionView.mj_footer.pullingPercent = 0.0
if $0.count == 0{
return
}
self!.smallVideos += $0
self!.collectionView.reloadData()
})
})
}
// 刷新次数
var isFirst:Bool = true
var refreshCount:Int=0
}
//MARK: - collectionView 数据源及代理方法
extension SmallVIdeoCategoryController:UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout{
func scrollViewDidScroll(_ scrollView: UIScrollView) {
endConttentOffSet = scrollView.contentOffset.y
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return smallVideos.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: SmallVideoCollectionViewCellID, for: indexPath) as! SmallVideoCollectionViewCell
cell.newsModel = smallVideos[indexPath.item]
cell.delegate = self
cell.index = indexPath.item
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
vc.originIndex = indexPath.item
vc.hidesBottomBarWhenPushed = true
// vc.smallVideo = smallVideos
vc.delegate = self
self.navigationController?.pushViewController(vc, animated: false)
}
}
//MARK: - refreshDelegate 播放视频时,右滑刷新
extension SmallVIdeoCategoryController:RefreshDelegate{
func scrollToItem(index: Int) {
collectionView.scrollToItem(at: IndexPath(item: index, section: 0), at: .centeredVertically, animated: false)
}
func refresh( complehander:@escaping ()->()) {
//加载更多
NetWorkTool.loadMoreApiNewsFeeds(category: (self.newsTitle.category), ttFrom: .loadMore, maxBehotTime: self.maxBehotTime-100, listCount: self.smallVideos.count, {
if self.collectionView.mj_footer.isRefreshing{
self.collectionView.mj_footer.endRefreshing()
}
self.collectionView.mj_footer.pullingPercent = 0.0
if $0.count == 0{
return
}
self.smallVideos += $0
self.collectionView.reloadData()
})
complehander()
}
}
//MARK: - 关闭按钮代理
extension SmallVIdeoCategoryController:SmallVideoCollectionViewCellDelegate{
func collectionCellRightClose(btn: UIButton, itemIndex index: Int) {
//根据item,找到关闭按钮的切确位置
let item = collectionView.cellForItem(at: IndexPath(item: index, section: 0))
// preIndex = index
guard item != nil else{return}
//btn.frame.origin = (0,0)
let itemY = item!.frame.origin.y - endConttentOffSet
let originY = itemY + kStatusBarH + kNavigationBarH
let originX = item!.frame.origin.x + btn.frame.origin.x
var frame = btn.frame
frame.origin.y = originY
frame.origin.x = originX
//添加popView
let popView = smallVIdeoPopView(frame: UIScreen.main.bounds, btnframe: frame,index:index)
popView.collectionView = self.collectionView
popView.smallVideos = smallVideos
popView.delegate = self
UIApplication.shared.keyWindow?.addSubview(popView)
}
}
//MARK: - 不感兴趣点击事件代理
extension SmallVIdeoCategoryController : smallVIdeoPopViewDelegate{
func popViewDelegate(index:Int) {
smallVideos.remove(at: index)
collectionView.deleteItems(at: [IndexPath(item: index, section: 0)])
collectionView.reloadData()
// isDelete = true
}
}
| [
-1
] |
4957b31483c7a6c109f1e0faa135f4e6f0a9c35b | 4955ac3c6d9c6e0521d9a3a1f9d670a16a61d2d4 | /stdlib/public/core/Integers.swift | 44fa86fe40a0d68bb797a6ea19b27f145da8893e | [
"Apache-2.0",
"Swift-exception"
] | permissive | daniel-grumberg/swift | 0c8137060b5a802ddcfc221ed95873739ede3b3d | 23f41a5914660c41e286dc0f47b13828975ea24c | refs/heads/master | 2022-06-07T02:36:38.245167 | 2018-09-05T23:52:15 | 2018-09-05T23:52:15 | 147,593,529 | 0 | 0 | Apache-2.0 | 2018-09-06T00:08:44 | 2018-09-06T00:08:43 | null | UTF-8 | Swift | false | false | 147,025 | swift | //===--- Integers.swift.gyb -----------------------------------*- swift -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
//===--- Bits for the Stdlib ----------------------------------------------===//
//===----------------------------------------------------------------------===//
// FIXME(integers): This should go in the stdlib separately, probably.
extension ExpressibleByIntegerLiteral
where Self : _ExpressibleByBuiltinIntegerLiteral {
@_transparent
public init(integerLiteral value: Self) {
self = value
}
}
//===----------------------------------------------------------------------===//
//===--- Numeric ----------------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// Declares methods backing binary arithmetic operators--such as `+`, `-` and
/// `*`--and their mutating counterparts.
///
/// The `Numeric` protocol provides a suitable basis for arithmetic on
/// scalar values, such as integers and floating-point numbers. You can write
/// generic methods that operate on any numeric type in the standard library
/// by using the `Numeric` protocol as a generic constraint.
///
/// The following example declares a method that calculates the total of any
/// sequence with `Numeric` elements.
///
/// extension Sequence where Element: Numeric {
/// func sum() -> Element {
/// return reduce(0, +)
/// }
/// }
///
/// The `sum()` method is now available on any sequence or collection with
/// numeric values, whether it is an array of `Double` or a countable range of
/// `Int`.
///
/// let arraySum = [1.1, 2.2, 3.3, 4.4, 5.5].sum()
/// // arraySum == 16.5
///
/// let rangeSum = (1..<10).sum()
/// // rangeSum == 45
///
/// Conforming to the Numeric Protocol
/// =====================================
///
/// To add `Numeric` protocol conformance to your own custom type, implement
/// the required mutating methods. Extensions to `Numeric` provide default
/// implementations for the protocol's nonmutating methods based on the
/// mutating variants.
public protocol Numeric : Equatable, ExpressibleByIntegerLiteral {
/// Creates a new instance from the given integer, if it can be represented
/// exactly.
///
/// If the value passed as `source` is not representable exactly, the result
/// is `nil`. In the following example, the constant `x` is successfully
/// created from a value of `100`, while the attempt to initialize the
/// constant `y` from `1_000` fails because the `Int8` type can represent
/// `127` at maximum:
///
/// let x = Int8(exactly: 100)
/// // x == Optional(100)
/// let y = Int8(exactly: 1_000)
/// // y == nil
///
/// - Parameter source: A value to convert to this type.
init?<T : BinaryInteger>(exactly source: T)
/// A type that can represent the absolute value of any possible value of the
/// conforming type.
associatedtype Magnitude : Comparable, Numeric
/// The magnitude of this value.
///
/// For any numeric value `x`, `x.magnitude` is the absolute value of `x`.
/// You can use the `magnitude` property in operations that are simpler to
/// implement in terms of unsigned values, such as printing the value of an
/// integer, which is just printing a '-' character in front of an absolute
/// value.
///
/// let x = -200
/// // x.magnitude == 200
///
/// The global `abs(_:)` function provides more familiar syntax when you need
/// to find an absolute value. In addition, because `abs(_:)` always returns
/// a value of the same type, even in a generic context, using the function
/// instead of the `magnitude` property is encouraged.
var magnitude: Magnitude { get }
/// Adds two values and produces their sum.
///
/// The addition operator (`+`) calculates the sum of its two arguments. For
/// example:
///
/// 1 + 2 // 3
/// -10 + 15 // 5
/// -15 + -5 // -20
/// 21.5 + 3.25 // 24.75
///
/// You cannot use `+` with arguments of different types. To add values of
/// different types, convert one of the values to the other value's type.
///
/// let x: Int8 = 21
/// let y: Int = 1000000
/// Int(x) + y // 1000021
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
static func +(lhs: Self, rhs: Self) -> Self
/// Adds two values and stores the result in the left-hand-side variable.
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
static func +=(lhs: inout Self, rhs: Self)
/// Subtracts one value from another and produces their difference.
///
/// The subtraction operator (`-`) calculates the difference of its two
/// arguments. For example:
///
/// 8 - 3 // 5
/// -10 - 5 // -15
/// 100 - -5 // 105
/// 10.5 - 100.0 // -89.5
///
/// You cannot use `-` with arguments of different types. To subtract values
/// of different types, convert one of the values to the other value's type.
///
/// let x: UInt8 = 21
/// let y: UInt = 1000000
/// y - UInt(x) // 999979
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
static func -(lhs: Self, rhs: Self) -> Self
/// Subtracts the second value from the first and stores the difference in the
/// left-hand-side variable.
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
static func -=(lhs: inout Self, rhs: Self)
/// Multiplies two values and produces their product.
///
/// The multiplication operator (`*`) calculates the product of its two
/// arguments. For example:
///
/// 2 * 3 // 6
/// 100 * 21 // 2100
/// -10 * 15 // -150
/// 3.5 * 2.25 // 7.875
///
/// You cannot use `*` with arguments of different types. To multiply values
/// of different types, convert one of the values to the other value's type.
///
/// let x: Int8 = 21
/// let y: Int = 1000000
/// Int(x) * y // 21000000
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
static func *(lhs: Self, rhs: Self) -> Self
/// Multiplies two values and stores the result in the left-hand-side
/// variable.
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
static func *=(lhs: inout Self, rhs: Self)
}
/// A type that can represent both positive and negative values.
///
/// The `SignedNumeric` protocol extends the operations defined by the
/// `Numeric` protocol to include a value's additive inverse.
///
/// Conforming to the SignedNumeric Protocol
/// ===========================================
///
/// Because the `SignedNumeric` protocol provides default implementations of
/// both of its required methods, you don't need to do anything beyond
/// declaring conformance to the protocol and ensuring that the values of your
/// type support negation. To customize your type's implementation, provide
/// your own mutating `negate()` method.
///
/// When the additive inverse of a value is unrepresentable in a conforming
/// type, the operation should either trap or return an exceptional value. For
/// example, using the negation operator (prefix `-`) with `Int.min` results in
/// a runtime error.
///
/// let x = Int.min
/// let y = -x
/// // Overflow error
public protocol SignedNumeric : Numeric {
/// Returns the additive inverse of the specified value.
///
/// The negation operator (prefix `-`) returns the additive inverse of its
/// argument.
///
/// let x = 21
/// let y = -x
/// // y == -21
///
/// The resulting value must be representable in the same type as the
/// argument. In particular, negating a signed, fixed-width integer type's
/// minimum results in a value that cannot be represented.
///
/// let z = -Int8.min
/// // Overflow error
///
/// - Returns: The additive inverse of this value.
static prefix func - (_ operand: Self) -> Self
/// Replaces this value with its additive inverse.
///
/// The following example uses the `negate()` method to negate the value of
/// an integer `x`:
///
/// var x = 21
/// x.negate()
/// // x == -21
///
/// The resulting value must be representable within the value's type. In
/// particular, negating a signed, fixed-width integer type's minimum
/// results in a value that cannot be represented.
///
/// var y = Int8.min
/// y.negate()
/// // Overflow error
mutating func negate()
}
extension SignedNumeric {
/// Returns the additive inverse of the specified value.
///
/// The negation operator (prefix `-`) returns the additive inverse of its
/// argument.
///
/// let x = 21
/// let y = -x
/// // y == -21
///
/// The resulting value must be representable in the same type as the
/// argument. In particular, negating a signed, fixed-width integer type's
/// minimum results in a value that cannot be represented.
///
/// let z = -Int8.min
/// // Overflow error
///
/// - Returns: The additive inverse of the argument.
@_transparent
public static prefix func - (_ operand: Self) -> Self {
var result = operand
result.negate()
return result
}
/// Replaces this value with its additive inverse.
///
/// The following example uses the `negate()` method to negate the value of
/// an integer `x`:
///
/// var x = 21
/// x.negate()
/// // x == -21
///
/// The resulting value must be representable within the value's type. In
/// particular, negating a signed, fixed-width integer type's minimum
/// results in a value that cannot be represented.
///
/// var y = Int8.min
/// y.negate()
/// // Overflow error
@_transparent
public mutating func negate() {
self = 0 - self
}
}
/// Returns the absolute value of the given number.
///
/// - Parameter x: A signed number.
/// - Returns: The absolute value of `x`.
@_transparent
public func abs<T : SignedNumeric>(_ x: T) -> T
where T.Magnitude == T {
return x.magnitude
}
/// Returns the absolute value of the given number.
///
/// The absolute value of `x` must be representable in the same type. In
/// particular, the absolute value of a signed, fixed-width integer type's
/// minimum cannot be represented.
///
/// let x = Int8.min
/// // x == -128
/// let y = abs(x)
/// // Overflow error
///
/// - Parameter x: A signed number.
/// - Returns: The absolute value of `x`.
@inlinable // FIXME(sil-serialize-all)
public func abs<T : SignedNumeric & Comparable>(_ x: T) -> T {
return x < 0 ? -x : x
}
extension Numeric {
/// Returns the given number unchanged.
///
/// You can use the unary plus operator (`+`) to provide symmetry in your
/// code for positive numbers when also using the unary minus operator.
///
/// let x = -21
/// let y = +21
/// // x == -21
/// // y == 21
///
/// - Returns: The given argument without any changes.
@_transparent
public static prefix func + (x: Self) -> Self {
return x
}
}
//===----------------------------------------------------------------------===//
//===--- BinaryInteger ----------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// An integer type with a binary representation.
///
/// The `BinaryInteger` protocol is the basis for all the integer types
/// provided by the standard library. All of the standard library's integer
/// types, such as `Int` and `UInt32`, conform to `BinaryInteger`.
///
/// Converting Between Numeric Types
/// ================================
///
/// You can create new instances of a type that conforms to the `BinaryInteger`
/// protocol from a floating-point number or another binary integer of any
/// type. The `BinaryInteger` protocol provides initializers for four
/// different kinds of conversion.
///
/// Range-Checked Conversion
/// ------------------------
///
/// You use the default `init(_:)` initializer to create a new instance when
/// you're sure that the value passed is representable in the new type. For
/// example, an instance of `Int16` can represent the value `500`, so the
/// first conversion in the code sample below succeeds. That same value is too
/// large to represent as an `Int8` instance, so the second conversion fails,
/// triggering a runtime error.
///
/// let x: Int = 500
/// let y = Int16(x)
/// // y == 500
///
/// let z = Int8(x)
/// // Error: Not enough bits to represent...
///
/// When you create a binary integer from a floating-point value using the
/// default initializer, the value is rounded toward zero before the range is
/// checked. In the following example, the value `127.75` is rounded to `127`,
/// which is representable by the `Int8` type. `128.25` is rounded to `128`,
/// which is not representable as an `Int8` instance, triggering a runtime
/// error.
///
/// let e = Int8(127.75)
/// // e == 127
///
/// let f = Int8(128.25)
/// // Error: Double value cannot be converted...
///
///
/// Exact Conversion
/// ----------------
///
/// Use the `init?(exactly:)` initializer to create a new instance after
/// checking whether the passed value is representable. Instead of trapping on
/// out-of-range values, using the failable `init?(exactly:)`
/// initializer results in `nil`.
///
/// let x = Int16(exactly: 500)
/// // x == Optional(500)
///
/// let y = Int8(exactly: 500)
/// // y == nil
///
/// When converting floating-point values, the `init?(exactly:)` initializer
/// checks both that the passed value has no fractional part and that the
/// value is representable in the resulting type.
///
/// let e = Int8(exactly: 23.0) // integral value, representable
/// // e == Optional(23)
///
/// let f = Int8(exactly: 23.75) // fractional value, representable
/// // f == nil
///
/// let g = Int8(exactly: 500.0) // integral value, nonrepresentable
/// // g == nil
///
/// Clamping Conversion
/// -------------------
///
/// Use the `init(clamping:)` initializer to create a new instance of a binary
/// integer type where out-of-range values are clamped to the representable
/// range of the type. For a type `T`, the resulting value is in the range
/// `T.min...T.max`.
///
/// let x = Int16(clamping: 500)
/// // x == 500
///
/// let y = Int8(clamping: 500)
/// // y == 127
///
/// let z = UInt8(clamping: -500)
/// // z == 0
///
/// Bit Pattern Conversion
/// ----------------------
///
/// Use the `init(truncatingIfNeeded:)` initializer to create a new instance
/// with the same bit pattern as the passed value, extending or truncating the
/// value's representation as necessary. Note that the value may not be
/// preserved, particularly when converting between signed to unsigned integer
/// types or when the destination type has a smaller bit width than the source
/// type. The following example shows how extending and truncating work for
/// nonnegative integers:
///
/// let q: Int16 = 850
/// // q == 0b00000011_01010010
///
/// let r = Int8(truncatingIfNeeded: q) // truncate 'q' to fit in 8 bits
/// // r == 82
/// // == 0b01010010
///
/// let s = Int16(truncatingIfNeeded: r) // extend 'r' to fill 16 bits
/// // s == 82
/// // == 0b00000000_01010010
///
/// Any padding is performed by *sign-extending* the passed value. When
/// nonnegative integers are extended, the result is padded with zeroes. When
/// negative integers are extended, the result is padded with ones. This
/// example shows several extending conversions of a negative value---note
/// that negative values are sign-extended even when converting to an unsigned
/// type.
///
/// let t: Int8 = -100
/// // t == -100
/// // t's binary representation == 0b10011100
///
/// let u = UInt8(truncatingIfNeeded: t)
/// // u == 156
/// // u's binary representation == 0b10011100
///
/// let v = Int16(truncatingIfNeeded: t)
/// // v == -100
/// // v's binary representation == 0b11111111_10011100
///
/// let w = UInt16(truncatingIfNeeded: t)
/// // w == 65436
/// // w's binary representation == 0b11111111_10011100
///
///
/// Comparing Across Integer Types
/// ==============================
///
/// You can use relational operators, such as the less-than and equal-to
/// operators (`<` and `==`), to compare instances of different binary integer
/// types. The following example compares instances of the `Int`, `UInt`, and
/// `UInt8` types:
///
/// let x: Int = -23
/// let y: UInt = 1_000
/// let z: UInt8 = 23
///
/// if x < y {
/// print("\(x) is less than \(y).")
/// }
/// // Prints "-23 is less than 1000."
///
/// if z > x {
/// print("\(z) is greater than \(x).")
/// }
/// // Prints "23 is greater than -23."
public protocol BinaryInteger :
Hashable, Numeric, CustomStringConvertible, Strideable
where Magnitude : BinaryInteger, Magnitude.Magnitude == Magnitude
{
/// A Boolean value indicating whether this type is a signed integer type.
///
/// *Signed* integer types can represent both positive and negative values.
/// *Unsigned* integer types can represent only nonnegative values.
static var isSigned: Bool { get }
/// Creates an integer from the given floating-point value, if it can be
/// represented exactly.
///
/// If the value passed as `source` is not representable exactly, the result
/// is `nil`. In the following example, the constant `x` is successfully
/// created from a value of `21.0`, while the attempt to initialize the
/// constant `y` from `21.5` fails:
///
/// let x = Int(exactly: 21.0)
/// // x == Optional(21)
/// let y = Int(exactly: 21.5)
/// // y == nil
///
/// - Parameter source: A floating-point value to convert to an integer.
init?<T : BinaryFloatingPoint>(exactly source: T)
/// Creates an integer from the given floating-point value, rounding toward
/// zero.
///
/// Any fractional part of the value passed as `source` is removed, rounding
/// the value toward zero.
///
/// let x = Int(21.5)
/// // x == 21
/// let y = Int(-21.5)
/// // y == -21
///
/// If `source` is outside the bounds of this type after rounding toward
/// zero, a runtime error may occur.
///
/// let z = UInt(-21.5)
/// // Error: ...the result would be less than UInt.min
///
/// - Parameter source: A floating-point value to convert to an integer.
/// `source` must be representable in this type after rounding toward
/// zero.
init<T : BinaryFloatingPoint>(_ source: T)
/// Creates a new instance from the given integer.
///
/// If the value passed as `source` is not representable in this type, a
/// runtime error may occur.
///
/// let x = -500 as Int
/// let y = Int32(x)
/// // y == -500
///
/// // -500 is not representable as a 'UInt32' instance
/// let z = UInt32(x)
/// // Error
///
/// - Parameter source: An integer to convert. `source` must be representable
/// in this type.
init<T : BinaryInteger>(_ source: T)
/// Creates a new instance from the bit pattern of the given instance by
/// sign-extending or truncating to fit this type.
///
/// When the bit width of `T` (the type of `source`) is equal to or greater
/// than this type's bit width, the result is the truncated
/// least-significant bits of `source`. For example, when converting a
/// 16-bit value to an 8-bit type, only the lower 8 bits of `source` are
/// used.
///
/// let p: Int16 = -500
/// // 'p' has a binary representation of 11111110_00001100
/// let q = Int8(truncatingIfNeeded: p)
/// // q == 12
/// // 'q' has a binary representation of 00001100
///
/// When the bit width of `T` is less than this type's bit width, the result
/// is *sign-extended* to fill the remaining bits. That is, if `source` is
/// negative, the result is padded with ones; otherwise, the result is
/// padded with zeros.
///
/// let u: Int8 = 21
/// // 'u' has a binary representation of 00010101
/// let v = Int16(truncatingIfNeeded: u)
/// // v == 21
/// // 'v' has a binary representation of 00000000_00010101
///
/// let w: Int8 = -21
/// // 'w' has a binary representation of 11101011
/// let x = Int16(truncatingIfNeeded: w)
/// // x == -21
/// // 'x' has a binary representation of 11111111_11101011
/// let y = UInt16(truncatingIfNeeded: w)
/// // y == 65515
/// // 'y' has a binary representation of 11111111_11101011
///
/// - Parameter source: An integer to convert to this type.
init<T : BinaryInteger>(truncatingIfNeeded source: T)
/// Creates a new instance with the representable value that's closest to the
/// given integer.
///
/// If the value passed as `source` is greater than the maximum representable
/// value in this type, the result is the type's `max` value. If `source` is
/// less than the smallest representable value in this type, the result is
/// the type's `min` value.
///
/// In this example, `x` is initialized as an `Int8` instance by clamping
/// `500` to the range `-128...127`, and `y` is initialized as a `UInt`
/// instance by clamping `-500` to the range `0...UInt.max`.
///
/// let x = Int8(clamping: 500)
/// // x == 127
/// // x == Int8.max
///
/// let y = UInt(clamping: -500)
/// // y == 0
///
/// - Parameter source: An integer to convert to this type.
init<T : BinaryInteger>(clamping source: T)
// FIXME: Should be `Words : Collection where Words.Element == UInt`
// See <rdar://problem/31798916> for why it isn't.
/// A type that represents the words of a binary integer.
///
/// The `Words` type must conform to the `Collection` protocol with an
/// `Element` type of `UInt`.
associatedtype Words : Sequence where Words.Element == UInt
/// A collection containing the words of this value's binary
/// representation, in order from the least significant to most significant.
///
/// Negative values are returned in two's complement representation,
/// regardless of the type's underlying implementation.
var words: Words { get }
/// The least significant word in this value's binary representation.
var _lowWord: UInt { get }
/// The number of bits in the current binary representation of this value.
///
/// This property is a constant for instances of fixed-width integer
/// types.
var bitWidth: Int { get }
/// Returns the integer binary logarithm of this value.
///
/// If the value is negative or zero, a runtime error will occur.
func _binaryLogarithm() -> Int
/// The number of trailing zeros in this value's binary representation.
///
/// For example, in a fixed-width integer type with a `bitWidth` value of 8,
/// the number -8 has three trailing zeros.
///
/// let x = Int8(bitPattern: 0b1111_1000)
/// // x == -8
/// // x.trailingZeroBitCount == 3
var trailingZeroBitCount: Int { get }
/// Returns the quotient of dividing the first value by the second.
///
/// For integer types, any remainder of the division is discarded.
///
/// let x = 21 / 5
/// // x == 4
///
/// - Parameters:
/// - lhs: The value to divide.
/// - rhs: The value to divide `lhs` by. `rhs` must not be zero.
static func /(lhs: Self, rhs: Self) -> Self
/// Divides the first value by the second and stores the quotient in the
/// left-hand-side variable.
///
/// For integer types, any remainder of the division is discarded.
///
/// var x = 21
/// x /= 5
/// // x == 4
///
/// - Parameters:
/// - lhs: The value to divide.
/// - rhs: The value to divide `lhs` by. `rhs` must not be zero.
static func /=(lhs: inout Self, rhs: Self)
/// Returns the remainder of dividing the first value by the second.
///
/// The result of the remainder operator (`%`) has the same sign as `lhs` and
/// has a magnitude less than `rhs.magnitude`.
///
/// let x = 22 % 5
/// // x == 2
/// let y = 22 % -5
/// // y == 2
/// let z = -22 % -5
/// // z == -2
///
/// For any two integers `a` and `b`, their quotient `q`, and their remainder
/// `r`, `a == b * q + r`.
///
/// - Parameters:
/// - lhs: The value to divide.
/// - rhs: The value to divide `lhs` by. `rhs` must not be zero.
static func %(lhs: Self, rhs: Self) -> Self
/// Divides the first value by the second and stores the remainder in the
/// left-hand-side variable.
///
/// The result has the same sign as `lhs` and has a magnitude less than
/// `rhs.magnitude`.
///
/// var x = 22
/// x %= 5
/// // x == 2
///
/// var y = 22
/// y %= -5
/// // y == 2
///
/// var z = -22
/// z %= -5
/// // z == -2
///
/// - Parameters:
/// - lhs: The value to divide.
/// - rhs: The value to divide `lhs` by. `rhs` must not be zero.
static func %=(lhs: inout Self, rhs: Self)
/// Adds two values and produces their sum.
///
/// The addition operator (`+`) calculates the sum of its two arguments. For
/// example:
///
/// 1 + 2 // 3
/// -10 + 15 // 5
/// -15 + -5 // -20
/// 21.5 + 3.25 // 24.75
///
/// You cannot use `+` with arguments of different types. To add values of
/// different types, convert one of the values to the other value's type.
///
/// let x: Int8 = 21
/// let y: Int = 1000000
/// Int(x) + y // 1000021
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
static func +(lhs: Self, rhs: Self) -> Self
/// Adds two values and stores the result in the left-hand-side variable.
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
static func +=(lhs: inout Self, rhs: Self)
/// Subtracts one value from another and produces their difference.
///
/// The subtraction operator (`-`) calculates the difference of its two
/// arguments. For example:
///
/// 8 - 3 // 5
/// -10 - 5 // -15
/// 100 - -5 // 105
/// 10.5 - 100.0 // -89.5
///
/// You cannot use `-` with arguments of different types. To subtract values
/// of different types, convert one of the values to the other value's type.
///
/// let x: UInt8 = 21
/// let y: UInt = 1000000
/// y - UInt(x) // 999979
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
static func -(lhs: Self, rhs: Self) -> Self
/// Subtracts the second value from the first and stores the difference in the
/// left-hand-side variable.
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
static func -=(lhs: inout Self, rhs: Self)
/// Multiplies two values and produces their product.
///
/// The multiplication operator (`*`) calculates the product of its two
/// arguments. For example:
///
/// 2 * 3 // 6
/// 100 * 21 // 2100
/// -10 * 15 // -150
/// 3.5 * 2.25 // 7.875
///
/// You cannot use `*` with arguments of different types. To multiply values
/// of different types, convert one of the values to the other value's type.
///
/// let x: Int8 = 21
/// let y: Int = 1000000
/// Int(x) * y // 21000000
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
static func *(lhs: Self, rhs: Self) -> Self
/// Multiplies two values and stores the result in the left-hand-side
/// variable.
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
static func *=(lhs: inout Self, rhs: Self)
/// Returns the inverse of the bits set in the argument.
///
/// The bitwise NOT operator (`~`) is a prefix operator that returns a value
/// in which all the bits of its argument are flipped: Bits that are `1` in
/// the argument are `0` in the result, and bits that are `0` in the argument
/// are `1` in the result. This is equivalent to the inverse of a set. For
/// example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let notX = ~x // 0b11111010
///
/// Performing a bitwise NOT operation on 0 returns a value with every bit
/// set to `1`.
///
/// let allOnes = ~UInt8.min // 0b11111111
///
/// - Complexity: O(1).
static prefix func ~ (_ x: Self) -> Self
/// Returns the result of performing a bitwise AND operation on the two given
/// values.
///
/// A bitwise AND operation results in a value that has each bit set to `1`
/// where *both* of its arguments have that bit set to `1`. For example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x & y // 0b00000100
/// // z == 4
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func &(lhs: Self, rhs: Self) -> Self
/// Stores the result of performing a bitwise AND operation on the two given
/// values in the left-hand-side variable.
///
/// A bitwise AND operation results in a value that has each bit set to `1`
/// where *both* of its arguments have that bit set to `1`. For example:
///
/// var x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// x &= y // 0b00000100
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func &=(lhs: inout Self, rhs: Self)
/// Returns the result of performing a bitwise OR operation on the two given
/// values.
///
/// A bitwise OR operation results in a value that has each bit set to `1`
/// where *one or both* of its arguments have that bit set to `1`. For
/// example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x | y // 0b00001111
/// // z == 15
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func |(lhs: Self, rhs: Self) -> Self
/// Stores the result of performing a bitwise OR operation on the two given
/// values in the left-hand-side variable.
///
/// A bitwise OR operation results in a value that has each bit set to `1`
/// where *one or both* of its arguments have that bit set to `1`. For
/// example:
///
/// var x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// x |= y // 0b00001111
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func |=(lhs: inout Self, rhs: Self)
/// Returns the result of performing a bitwise XOR operation on the two given
/// values.
///
/// A bitwise XOR operation, also known as an exclusive OR operation, results
/// in a value that has each bit set to `1` where *one or the other but not
/// both* of its arguments had that bit set to `1`. For example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x ^ y // 0b00001011
/// // z == 11
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func ^(lhs: Self, rhs: Self) -> Self
/// Stores the result of performing a bitwise XOR operation on the two given
/// values in the left-hand-side variable.
///
/// A bitwise XOR operation, also known as an exclusive OR operation, results
/// in a value that has each bit set to `1` where *one or the other but not
/// both* of its arguments had that bit set to `1`. For example:
///
/// var x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// x ^= y // 0b00001011
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
static func ^=(lhs: inout Self, rhs: Self)
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right.
///
/// The `>>` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a left shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*. An overshift results in `-1` for a
/// negative value of `lhs` or `0` for a nonnegative value.
/// - Using any other value for `rhs` performs a right shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted right by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x >> 2
/// // y == 7 // 0b00000111
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x >> 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a left shift
/// using `abs(rhs)`.
///
/// let a = x >> -3
/// // a == 240 // 0b11110000
/// let b = x << 3
/// // b == 240 // 0b11110000
///
/// Right shift operations on negative values "fill in" the high bits with
/// ones instead of zeros.
///
/// let q: Int8 = -30 // 0b11100010
/// let r = q >> 2
/// // r == -8 // 0b11111000
///
/// let s = q >> 11
/// // s == -1 // 0b11111111
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right.
static func >> <RHS: BinaryInteger>(lhs: Self, rhs: RHS) -> Self
/// Stores the result of shifting a value's binary representation the
/// specified number of digits to the right in the left-hand-side variable.
///
/// The `>>=` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a left shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*. An overshift results in `-1` for a
/// negative value of `lhs` or `0` for a nonnegative value.
/// - Using any other value for `rhs` performs a right shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted right by two bits.
///
/// var x: UInt8 = 30 // 0b00011110
/// x >>= 2
/// // x == 7 // 0b00000111
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// var y: UInt8 = 30 // 0b00011110
/// y >>= 11
/// // y == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a left shift
/// using `abs(rhs)`.
///
/// var a: UInt8 = 30 // 0b00011110
/// a >>= -3
/// // a == 240 // 0b11110000
///
/// var b: UInt8 = 30 // 0b00011110
/// b <<= 3
/// // b == 240 // 0b11110000
///
/// Right shift operations on negative values "fill in" the high bits with
/// ones instead of zeros.
///
/// var q: Int8 = -30 // 0b11100010
/// q >>= 2
/// // q == -8 // 0b11111000
///
/// var r: Int8 = -30 // 0b11100010
/// r >>= 11
/// // r == -1 // 0b11111111
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right.
static func >>= <RHS: BinaryInteger>(lhs: inout Self, rhs: RHS)
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left.
///
/// The `<<` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a right shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*, resulting in zero.
/// - Using any other value for `rhs` performs a left shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted left by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x << 2
/// // y == 120 // 0b01111000
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x << 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a right shift
/// with `abs(rhs)`.
///
/// let a = x << -3
/// // a == 3 // 0b00000011
/// let b = x >> 3
/// // b == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left.
static func << <RHS: BinaryInteger>(lhs: Self, rhs: RHS) -> Self
/// Stores the result of shifting a value's binary representation the
/// specified number of digits to the left in the left-hand-side variable.
///
/// The `<<` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a right shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*, resulting in zero.
/// - Using any other value for `rhs` performs a left shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted left by two bits.
///
/// var x: UInt8 = 30 // 0b00011110
/// x <<= 2
/// // x == 120 // 0b01111000
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// var y: UInt8 = 30 // 0b00011110
/// y <<= 11
/// // y == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a right shift
/// with `abs(rhs)`.
///
/// var a: UInt8 = 30 // 0b00011110
/// a <<= -3
/// // a == 3 // 0b00000011
///
/// var b: UInt8 = 30 // 0b00011110
/// b >>= 3
/// // b == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left.
static func <<=<RHS: BinaryInteger>(lhs: inout Self, rhs: RHS)
/// Returns the quotient and remainder of this value divided by the given
/// value.
///
/// Use this method to calculate the quotient and remainder of a division at
/// the same time.
///
/// let x = 1_000_000
/// let (q, r) = x.quotientAndRemainder(dividingBy: 933)
/// // q == 1071
/// // r == 757
///
/// - Parameter rhs: The value to divide this value by.
/// - Returns: A tuple containing the quotient and remainder of this value
/// divided by `rhs`. The remainder has the same sign as `rhs`.
func quotientAndRemainder(dividingBy rhs: Self)
-> (quotient: Self, remainder: Self)
/// Returns true if this value is a multiple of `other`, and false otherwise.
///
/// For two integers a and b, a is a multiple of b if there exists a third
/// integer q such that a = q*b. For example, 6 is a multiple of 3, because
/// 6 = 2*3, and zero is a multiple of everything, because 0 = 0*x, for any
/// integer x.
///
/// Two edge cases are worth particular attention:
/// - `x.isMultiple(of: 0)` is `true` if `x` is zero and `false` otherwise.
/// - `T.min.isMultiple(of: -1)` is `true` for signed integer `T`, even
/// though the quotient `T.min / -1` is not representable in type `T`.
///
/// - Parameter other: the value to test.
func isMultiple(of other: Self) -> Bool
/// Returns `-1` if this value is negative and `1` if it's positive;
/// otherwise, `0`.
///
/// - Returns: The sign of this number, expressed as an integer of the same
/// type.
func signum() -> Self
}
extension BinaryInteger {
/// Creates a new value equal to zero.
@_transparent
public init() {
self = 0
}
/// Returns `-1` if this value is negative and `1` if it's positive;
/// otherwise, `0`.
///
/// - Returns: The sign of this number, expressed as an integer of the same
/// type.
@_transparent
public func signum() -> Self {
return (self > (0 as Self) ? 1 : 0) - (self < (0 as Self) ? 1 : 0)
}
@_transparent
public var _lowWord: UInt {
var it = words.makeIterator()
return it.next() ?? 0
}
@inlinable // FIXME(sil-serialize-all)
public func _binaryLogarithm() -> Int {
_precondition(self > (0 as Self))
var (quotient, remainder) =
(bitWidth &- 1).quotientAndRemainder(dividingBy: UInt.bitWidth)
remainder = remainder &+ 1
var word = UInt(truncatingIfNeeded: self >> (bitWidth &- remainder))
// If, internally, a variable-width binary integer uses digits of greater
// bit width than that of Magnitude.Words.Element (i.e., UInt), then it is
// possible that `word` could be zero. Additionally, a signed variable-width
// binary integer may have a leading word that is zero to store a clear sign
// bit.
while word == 0 {
quotient = quotient &- 1
remainder = remainder &+ UInt.bitWidth
word = UInt(truncatingIfNeeded: self >> (bitWidth &- remainder))
}
// Note that the order of operations below is important to guarantee that
// we won't overflow.
return UInt.bitWidth &* quotient &+
(UInt.bitWidth &- (word.leadingZeroBitCount &+ 1))
}
/// Returns the quotient and remainder of this value divided by the given
/// value.
///
/// Use this method to calculate the quotient and remainder of a division at
/// the same time.
///
/// let x = 1_000_000
/// let (q, r) = x.quotientAndRemainder(dividingBy: 933)
/// // q == 1071
/// // r == 757
///
/// - Parameter rhs: The value to divide this value by.
/// - Returns: A tuple containing the quotient and remainder of this value
/// divided by `rhs`.
@inlinable // FIXME(sil-serialize-all)
public func quotientAndRemainder(dividingBy rhs: Self)
-> (quotient: Self, remainder: Self) {
return (self / rhs, self % rhs)
}
@inlinable
public func isMultiple(of other: Self) -> Bool {
// Nothing but zero is a multiple of zero.
if other == 0 { return self == 0 }
// Do the test in terms of magnitude, which guarantees there are no other
// edge cases. If we write this as `self % other` instead, it could trap
// for types that are not symmetric around zero.
return self.magnitude % other.magnitude == 0
}
//===----------------------------------------------------------------------===//
//===--- Homogeneous ------------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// Returns the result of performing a bitwise AND operation on the two given
/// values.
///
/// A bitwise AND operation results in a value that has each bit set to `1`
/// where *both* of its arguments have that bit set to `1`. For example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x & y // 0b00000100
/// // z == 4
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
@_transparent
public static func & (lhs: Self, rhs: Self) -> Self {
var lhs = lhs
lhs &= rhs
return lhs
}
/// Returns the result of performing a bitwise OR operation on the two given
/// values.
///
/// A bitwise OR operation results in a value that has each bit set to `1`
/// where *one or both* of its arguments have that bit set to `1`. For
/// example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x | y // 0b00001111
/// // z == 15
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
@_transparent
public static func | (lhs: Self, rhs: Self) -> Self {
var lhs = lhs
lhs |= rhs
return lhs
}
/// Returns the result of performing a bitwise XOR operation on the two given
/// values.
///
/// A bitwise XOR operation, also known as an exclusive OR operation, results
/// in a value that has each bit set to `1` where *one or the other but not
/// both* of its arguments had that bit set to `1`. For example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let y: UInt8 = 14 // 0b00001110
/// let z = x ^ y // 0b00001011
/// // z == 11
///
/// - Parameters:
/// - lhs: An integer value.
/// - rhs: Another integer value.
@_transparent
public static func ^ (lhs: Self, rhs: Self) -> Self {
var lhs = lhs
lhs ^= rhs
return lhs
}
//===----------------------------------------------------------------------===//
//===--- Heterogeneous non-masking shift in terms of shift-assignment -----===//
//===----------------------------------------------------------------------===//
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right.
///
/// The `>>` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a left shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*. An overshift results in `-1` for a
/// negative value of `lhs` or `0` for a nonnegative value.
/// - Using any other value for `rhs` performs a right shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted right by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x >> 2
/// // y == 7 // 0b00000111
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x >> 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a left shift
/// using `abs(rhs)`.
///
/// let a = x >> -3
/// // a == 240 // 0b11110000
/// let b = x << 3
/// // b == 240 // 0b11110000
///
/// Right shift operations on negative values "fill in" the high bits with
/// ones instead of zeros.
///
/// let q: Int8 = -30 // 0b11100010
/// let r = q >> 2
/// // r == -8 // 0b11111000
///
/// let s = q >> 11
/// // s == -1 // 0b11111111
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable
public static func >> <RHS: BinaryInteger>(lhs: Self, rhs: RHS) -> Self {
var r = lhs
r >>= rhs
return r
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left.
///
/// The `<<` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a right shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*, resulting in zero.
/// - Using any other value for `rhs` performs a left shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted left by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x << 2
/// // y == 120 // 0b01111000
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x << 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a right shift
/// with `abs(rhs)`.
///
/// let a = x << -3
/// // a == 3 // 0b00000011
/// let b = x >> 3
/// // b == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable
public static func << <RHS: BinaryInteger>(lhs: Self, rhs: RHS) -> Self {
var r = lhs
r <<= rhs
return r
}
}
//===----------------------------------------------------------------------===//
//===--- CustomStringConvertible conformance ------------------------------===//
//===----------------------------------------------------------------------===//
extension BinaryInteger {
@usableFromInline
@_transparent
internal func _description(radix: Int, uppercase: Bool) -> String {
_precondition(2...36 ~= radix, "Radix must be between 2 and 36")
if bitWidth <= 64 {
let radix_ = Int64(radix)
return Self.isSigned
? _int64ToString(
Int64(truncatingIfNeeded: self), radix: radix_, uppercase: uppercase)
: _uint64ToString(
UInt64(truncatingIfNeeded: self), radix: radix_, uppercase: uppercase)
}
if self == (0 as Self) { return "0" }
// Bit shifting can be faster than division when `radix` is a power of two
// (although not necessarily the case for builtin types).
let isRadixPowerOfTwo = radix.nonzeroBitCount == 1
let radix_ = Magnitude(radix)
func _quotientAndRemainder(_ value: Magnitude) -> (Magnitude, Magnitude) {
return isRadixPowerOfTwo
? (value >> radix.trailingZeroBitCount, value & (radix_ - 1))
: value.quotientAndRemainder(dividingBy: radix_)
}
let hasLetters = radix > 10
func _ascii(_ digit: UInt8) -> UInt8 {
let base: UInt8
if !hasLetters || digit < 10 {
base = UInt8(("0" as Unicode.Scalar).value)
} else if uppercase {
base = UInt8(("A" as Unicode.Scalar).value) &- 10
} else {
base = UInt8(("a" as Unicode.Scalar).value) &- 10
}
return base &+ digit
}
let isNegative = Self.isSigned && self < (0 as Self)
var value = magnitude
// TODO(FIXME JIRA): All current stdlib types fit in small. Use a stack
// buffer instead of an array on the heap.
var result: [UInt8] = []
while value != 0 {
let (quotient, remainder) = _quotientAndRemainder(value)
result.append(_ascii(UInt8(truncatingIfNeeded: remainder)))
value = quotient
}
if isNegative {
result.append(UInt8(("-" as Unicode.Scalar).value))
}
result.reverse()
return result.withUnsafeBufferPointer {
return String._fromASCII($0)
}
}
/// A textual representation of this value.
@inlinable // FIXME(sil-serialize-all)
public var description: String {
return _description(radix: 10, uppercase: false)
}
}
//===----------------------------------------------------------------------===//
//===--- Strideable conformance -------------------------------------------===//
//===----------------------------------------------------------------------===//
extension BinaryInteger {
// FIXME(ABI): using Int as the return type is wrong.
/// Returns the distance from this value to the given value, expressed as a
/// stride.
///
/// For two values `x` and `y`, and a distance `n = x.distance(to: y)`,
/// `x.advanced(by: n) == y`.
///
/// - Parameter other: The value to calculate the distance to.
/// - Returns: The distance from this value to `other`.
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public func distance(to other: Self) -> Int {
if !Self.isSigned {
if self > other {
if let result = Int(exactly: self - other) {
return -result
}
} else {
if let result = Int(exactly: other - self) {
return result
}
}
} else {
let isNegative = self < (0 as Self)
if isNegative == (other < (0 as Self)) {
if let result = Int(exactly: other - self) {
return result
}
} else {
if let result = Int(exactly: self.magnitude + other.magnitude) {
return isNegative ? result : -result
}
}
}
_preconditionFailure("Distance is not representable in Int")
}
// FIXME(ABI): using Int as the parameter type is wrong.
/// Returns a value that is offset the specified distance from this value.
///
/// Use the `advanced(by:)` method in generic code to offset a value by a
/// specified distance. If you're working directly with numeric values, use
/// the addition operator (`+`) instead of this method.
///
/// For a value `x`, a distance `n`, and a value `y = x.advanced(by: n)`,
/// `x.distance(to: y) == n`.
///
/// - Parameter n: The distance to advance this value.
/// - Returns: A value that is offset from this value by `n`.
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public func advanced(by n: Int) -> Self {
if !Self.isSigned {
return n < (0 as Int)
? self - Self(-n)
: self + Self(n)
}
if (self < (0 as Self)) == (n < (0 as Self)) {
return self + Self(n)
}
return self.magnitude < n.magnitude
? Self(Int(self) + n)
: self + Self(n)
}
}
//===----------------------------------------------------------------------===//
//===--- Heterogeneous comparison -----------------------------------------===//
//===----------------------------------------------------------------------===//
extension BinaryInteger {
/// Returns a Boolean value indicating whether the two given values are
/// equal.
///
/// You can check the equality of instances of any `BinaryInteger` types
/// using the equal-to operator (`==`). For example, you can test whether
/// the first `UInt8` value in a string's UTF-8 encoding is equal to the
/// first `UInt32` value in its Unicode scalar view:
///
/// let gameName = "Red Light, Green Light"
/// if let firstUTF8 = gameName.utf8.first,
/// let firstScalar = gameName.unicodeScalars.first?.value {
/// print("First code values are equal: \(firstUTF8 == firstScalar)")
/// }
/// // Prints "First code values are equal: true"
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func == <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Bool {
let lhsNegative = Self.isSigned && lhs < (0 as Self)
let rhsNegative = Other.isSigned && rhs < (0 as Other)
if lhsNegative != rhsNegative { return false }
// Here we know the values are of the same sign.
//
// There are a few possible scenarios from here:
//
// 1. Both values are negative
// - If one value is strictly wider than the other, then it is safe to
// convert to the wider type.
// - If the values are of the same width, it does not matter which type we
// choose to convert to as the values are already negative, and thus
// include the sign bit if two's complement representation already.
// 2. Both values are non-negative
// - If one value is strictly wider than the other, then it is safe to
// convert to the wider type.
// - If the values are of the same width, than signedness matters, as not
// unsigned types are 'wider' in a sense they don't need to 'waste' the
// sign bit. Therefore it is safe to convert to the unsigned type.
if lhs.bitWidth < rhs.bitWidth {
return Other(truncatingIfNeeded: lhs) == rhs
}
if lhs.bitWidth > rhs.bitWidth {
return lhs == Self(truncatingIfNeeded: rhs)
}
if Self.isSigned {
return Other(truncatingIfNeeded: lhs) == rhs
}
return lhs == Self(truncatingIfNeeded: rhs)
}
/// Returns a Boolean value indicating whether the two given values are not
/// equal.
///
/// You can check the inequality of instances of any `BinaryInteger` types
/// using the not-equal-to operator (`!=`). For example, you can test
/// whether the first `UInt8` value in a string's UTF-8 encoding is not
/// equal to the first `UInt32` value in its Unicode scalar view:
///
/// let gameName = "Red Light, Green Light"
/// if let firstUTF8 = gameName.utf8.first,
/// let firstScalar = gameName.unicodeScalars.first?.value {
/// print("First code values are different: \(firstUTF8 != firstScalar)")
/// }
/// // Prints "First code values are different: false"
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@_transparent
public static func != <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Bool {
return !(lhs == rhs)
}
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than that of the second argument.
///
/// You can compare instances of any `BinaryInteger` types using the
/// less-than operator (`<`), even if the two instances are of different
/// types.
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func < <Other : BinaryInteger>(lhs: Self, rhs: Other) -> Bool {
let lhsNegative = Self.isSigned && lhs < (0 as Self)
let rhsNegative = Other.isSigned && rhs < (0 as Other)
if lhsNegative != rhsNegative { return lhsNegative }
if lhs == (0 as Self) && rhs == (0 as Other) { return false }
// if we get here, lhs and rhs have the same sign. If they're negative,
// then Self and Other are both signed types, and one of them can represent
// values of the other type. Otherwise, lhs and rhs are positive, and one
// of Self, Other may be signed and the other unsigned.
let rhsAsSelf = Self(truncatingIfNeeded: rhs)
let rhsAsSelfNegative = rhsAsSelf < (0 as Self)
// Can we round-trip rhs through Other?
if Other(truncatingIfNeeded: rhsAsSelf) == rhs &&
// This additional check covers the `Int8.max < (128 as UInt8)` case.
// Since the types are of the same width, init(truncatingIfNeeded:)
// will result in a simple bitcast, so that rhsAsSelf would be -128, and
// `lhs < rhsAsSelf` will return false.
// We basically guard against that bitcast by requiring rhs and rhsAsSelf
// to be the same sign.
rhsNegative == rhsAsSelfNegative {
return lhs < rhsAsSelf
}
return Other(truncatingIfNeeded: lhs) < rhs
}
/// Returns a Boolean value indicating whether the value of the first
/// argument is less than or equal to that of the second argument.
///
/// You can compare instances of any `BinaryInteger` types using the
/// less-than-or-equal-to operator (`<=`), even if the two instances are of
/// different types.
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@_transparent
//@inline(__always)
public static func <= <Other : BinaryInteger>(lhs: Self, rhs: Other) -> Bool {
return !(rhs < lhs)
}
/// Returns a Boolean value indicating whether the value of the first
/// argument is greater than or equal to that of the second argument.
///
/// You can compare instances of any `BinaryInteger` types using the
/// greater-than-or-equal-to operator (`>=`), even if the two instances are
/// of different types.
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@_transparent
//@inline(__always)
public static func >= <Other : BinaryInteger>(lhs: Self, rhs: Other) -> Bool {
return !(lhs < rhs)
}
/// Returns a Boolean value indicating whether the value of the first
/// argument is greater than that of the second argument.
///
/// You can compare instances of any `BinaryInteger` types using the
/// greater-than operator (`>`), even if the two instances are of different
/// types.
///
/// - Parameters:
/// - lhs: An integer to compare.
/// - rhs: Another integer to compare.
@_transparent
//@inline(__always)
public static func > <Other : BinaryInteger>(lhs: Self, rhs: Other) -> Bool {
return rhs < lhs
}
}
//===----------------------------------------------------------------------===//
//===--- Ambiguity breakers -----------------------------------------------===//
//
// These two versions of the operators are not ordered with respect to one
// another, but the compiler choses the second one, and that results in infinite
// recursion.
//
// <T : Comparable>(T, T) -> Bool
// <T : BinaryInteger, U : BinaryInteger>(T, U) -> Bool
//
// so we define:
//
// <T : BinaryInteger>(T, T) -> Bool
//
//===----------------------------------------------------------------------===//
extension BinaryInteger {
@_transparent
public static func != (lhs: Self, rhs: Self) -> Bool {
return !(lhs == rhs)
}
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func <= (lhs: Self, rhs: Self) -> Bool {
return !(rhs < lhs)
}
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func >= (lhs: Self, rhs: Self) -> Bool {
return !(lhs < rhs)
}
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func > (lhs: Self, rhs: Self) -> Bool {
return rhs < lhs
}
}
//===----------------------------------------------------------------------===//
//===--- FixedWidthInteger ------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// An integer type that uses a fixed size for every instance.
///
/// The `FixedWidthInteger` protocol adds binary bitwise operations, bit
/// shifts, and overflow handling to the operations supported by the
/// `BinaryInteger` protocol.
///
/// Use the `FixedWidthInteger` protocol as a constraint or extension point
/// when writing operations that depend on bit shifting, performing bitwise
/// operations, catching overflows, or having access to the maximum or minimum
/// representable value of a type. For example, the following code provides a
/// `binaryString` property on every fixed-width integer that represents the
/// number's binary representation, split into 8-bit chunks.
///
/// extension FixedWidthInteger {
/// var binaryString: String {
/// var result: [String] = []
/// for i in 0..<(Self.bitWidth / 8) {
/// let byte = UInt8(truncatingIfNeeded: self >> (i * 8))
/// let byteString = String(byte, radix: 2)
/// let padding = String(repeating: "0",
/// count: 8 - byteString.count)
/// result.append(padding + byteString)
/// }
/// return "0b" + result.reversed().joined(separator: "_")
/// }
/// }
///
/// print(Int16.max.binaryString)
/// // Prints "0b01111111_11111111"
/// print((101 as UInt8).binaryString)
/// // Prints "0b11001001"
///
/// The `binaryString` implementation uses the static `bitWidth` property and
/// the right shift operator (`<<`), both of which are available to any type
/// that conforms to the `FixedWidthInteger` protocol.
///
/// The next example declares a generic `squared` function, which accepts an
/// instance `x` of any fixed-width integer type. The function uses the
/// `multipliedReportingOverflow(by:)` method to multiply `x` by itself and
/// check whether the result is too large to represent in the same type.
///
/// func squared<T: FixedWidthInteger>(_ x: T) -> T? {
/// let (result, overflow) = x.multipliedReportingOverflow(by: x)
/// if overflow {
/// return nil
/// }
/// return result
/// }
///
/// let (x, y): (Int8, Int8) = (9, 123)
/// print(squared(x))
/// // Prints "Optional(81)"
/// print(squared(y))
/// // Prints "nil"
///
/// Conforming to the FixedWidthInteger Protocol
/// ============================================
///
/// To make your own custom type conform to the `FixedWidthInteger` protocol,
/// declare the required initializers, properties, and methods. The required
/// methods that are suffixed with `ReportingOverflow` serve as the
/// customization points for arithmetic operations. When you provide just those
/// methods, the standard library provides default implementations for all
/// other arithmetic methods and operators.
public protocol FixedWidthInteger : BinaryInteger, LosslessStringConvertible
where Magnitude : FixedWidthInteger & UnsignedInteger,
Stride : FixedWidthInteger & SignedInteger {
/// The number of bits used for the underlying binary representation of
/// values of this type.
///
/// An unsigned, fixed-width integer type can represent values from 0 through
/// `(2 ** bitWidth) - 1`, where `**` is exponentiation. A signed,
/// fixed-width integer type can represent values from
/// `-(2 ** (bitWidth - 1))` through `(2 ** (bitWidth - 1)) - 1`. For example,
/// the `Int8` type has a `bitWidth` value of 8 and can store any integer in
/// the range `-128...127`.
static var bitWidth: Int { get }
/// The maximum representable integer in this type.
///
/// For unsigned integer types, this value is `(2 ** bitWidth) - 1`, where
/// `**` is exponentiation. For signed integer types, this value is
/// `(2 ** (bitWidth - 1)) - 1`.
static var max: Self { get }
/// The minimum representable integer in this type.
///
/// For unsigned integer types, this value is always `0`. For signed integer
/// types, this value is `-(2 ** (bitWidth - 1))`, where `**` is
/// exponentiation.
static var min: Self { get }
/// Returns the sum of this value and the given value, along with a Boolean
/// value indicating whether overflow occurred in the operation.
///
/// - Parameter rhs: The value to add to this value.
/// - Returns: A tuple containing the result of the addition along with a
/// Boolean value indicating whether overflow occurred. If the `overflow`
/// component is `false`, the `partialValue` component contains the entire
/// sum. If the `overflow` component is `true`, an overflow occurred and
/// the `partialValue` component contains the truncated sum of this value
/// and `rhs`.
func addingReportingOverflow(
_ rhs: Self
) -> (partialValue: Self, overflow: Bool)
/// Returns the difference obtained by subtracting the given value from this
/// value, along with a Boolean value indicating whether overflow occurred in
/// the operation.
///
/// - Parameter rhs: The value to subtract from this value.
/// - Returns: A tuple containing the result of the subtraction along with a
/// Boolean value indicating whether overflow occurred. If the `overflow`
/// component is `false`, the `partialValue` component contains the entire
/// difference. If the `overflow` component is `true`, an overflow occurred
/// and the `partialValue` component contains the truncated result of `rhs`
/// subtracted from this value.
func subtractingReportingOverflow(
_ rhs: Self
) -> (partialValue: Self, overflow: Bool)
/// Returns the product of this value and the given value, along with a
/// Boolean value indicating whether overflow occurred in the operation.
///
/// - Parameter rhs: The value to multiply by this value.
/// - Returns: A tuple containing the result of the multiplication along with
/// a Boolean value indicating whether overflow occurred. If the `overflow`
/// component is `false`, the `partialValue` component contains the entire
/// product. If the `overflow` component is `true`, an overflow occurred and
/// the `partialValue` component contains the truncated product of this
/// value and `rhs`.
func multipliedReportingOverflow(
by rhs: Self
) -> (partialValue: Self, overflow: Bool)
/// Returns the quotient obtained by dividing this value by the given value,
/// along with a Boolean value indicating whether overflow occurred in the
/// operation.
///
/// Dividing by zero is not an error when using this method. For a value `x`,
/// the result of `x.dividedReportingOverflow(by: 0)` is `(x, true)`.
///
/// - Parameter rhs: The value to divide this value by.
/// - Returns: A tuple containing the result of the division along with a
/// Boolean value indicating whether overflow occurred. If the `overflow`
/// component is `false`, the `partialValue` component contains the entire
/// quotient. If the `overflow` component is `true`, an overflow occurred
/// and the `partialValue` component contains either the truncated quotient
/// or, if the quotient is undefined, the dividend.
func dividedReportingOverflow(
by rhs: Self
) -> (partialValue: Self, overflow: Bool)
/// Returns the remainder after dividing this value by the given value, along
/// with a Boolean value indicating whether overflow occurred during division.
///
/// Dividing by zero is not an error when using this method. For a value `x`,
/// the result of `x.remainderReportingOverflow(dividingBy: 0)` is
/// `(x, true)`.
///
/// - Parameter rhs: The value to divide this value by.
/// - Returns: A tuple containing the result of the operation along with a
/// Boolean value indicating whether overflow occurred. If the `overflow`
/// component is `false`, the `partialValue` component contains the entire
/// remainder. If the `overflow` component is `true`, an overflow occurred
/// during division and the `partialValue` component contains either the
/// entire remainder or, if the remainder is undefined, the dividend.
func remainderReportingOverflow(
dividingBy rhs: Self
) -> (partialValue: Self, overflow: Bool)
/// Returns a tuple containing the high and low parts of the result of
/// multiplying this value by the given value.
///
/// Use this method to calculate the full result of a product that would
/// otherwise overflow. Unlike traditional truncating multiplication, the
/// `multipliedFullWidth(by:)` method returns a tuple containing both the
/// `high` and `low` parts of the product of this value and `other`. The
/// following example uses this method to multiply two `Int8` values that
/// normally overflow when multiplied:
///
/// let x: Int8 = 48
/// let y: Int8 = -40
/// let result = x.multipliedFullWidth(by: y)
/// // result.high == -8
/// // result.low == 128
///
/// The product of `x` and `y` is `-1920`, which is too large to represent in
/// an `Int8` instance. The `high` and `low` compnents of the `result` value
/// represent `-1920` when concatenated to form a double-width integer; that
/// is, using `result.high` as the high byte and `result.low` as the low byte
/// of an `Int16` instance.
///
/// let z = Int16(result.high) << 8 | Int16(result.low)
/// // z == -1920
///
/// - Parameter other: The value to multiply this value by.
/// - Returns: A tuple containing the high and low parts of the result of
/// multiplying this value and `other`.
func multipliedFullWidth(by other: Self) -> (high: Self, low: Self.Magnitude)
/// Returns a tuple containing the quotient and remainder obtained by dividing
/// the given value by this value.
///
/// The resulting quotient must be representable within the bounds of the
/// type. If the quotient is too large to represent in the type, a runtime
/// error may occur.
///
/// The following example divides a value that is too large to be represented
/// using a single `Int` instance by another `Int` value. Because the quotient
/// is representable as an `Int`, the division succeeds.
///
/// // 'dividend' represents the value 0x506f70652053616e74612049494949
/// let dividend = (22640526660490081, 7959093232766896457 as UInt)
/// let divisor = 2241543570477705381
///
/// let (quotient, remainder) = divisor.dividingFullWidth(dividend)
/// // quotient == 186319822866995413
/// // remainder == 0
///
/// - Parameter dividend: A tuple containing the high and low parts of a
/// double-width integer.
/// - Returns: A tuple containing the quotient and remainder obtained by
/// dividing `dividend` by this value.
func dividingFullWidth(_ dividend: (high: Self, low: Self.Magnitude))
-> (quotient: Self, remainder: Self)
init(_truncatingBits bits: UInt)
/// The number of bits equal to 1 in this value's binary representation.
///
/// For example, in a fixed-width integer type with a `bitWidth` value of 8,
/// the number *31* has five bits equal to *1*.
///
/// let x: Int8 = 0b0001_1111
/// // x == 31
/// // x.nonzeroBitCount == 5
var nonzeroBitCount: Int { get }
/// The number of leading zeros in this value's binary representation.
///
/// For example, in a fixed-width integer type with a `bitWidth` value of 8,
/// the number *31* has three leading zeros.
///
/// let x: Int8 = 0b0001_1111
/// // x == 31
/// // x.leadingZeroBitCount == 3
var leadingZeroBitCount: Int { get }
/// Creates an integer from its big-endian representation, changing the byte
/// order if necessary.
///
/// - Parameter value: A value to use as the big-endian representation of the
/// new integer.
init(bigEndian value: Self)
/// Creates an integer from its little-endian representation, changing the
/// byte order if necessary.
///
/// - Parameter value: A value to use as the little-endian representation of
/// the new integer.
init(littleEndian value: Self)
/// The big-endian representation of this integer.
///
/// If necessary, the byte order of this value is reversed from the typical
/// byte order of this integer type. On a big-endian platform, for any
/// integer `x`, `x == x.bigEndian`.
var bigEndian: Self { get }
/// The little-endian representation of this integer.
///
/// If necessary, the byte order of this value is reversed from the typical
/// byte order of this integer type. On a little-endian platform, for any
/// integer `x`, `x == x.littleEndian`.
var littleEndian: Self { get }
/// A representation of this integer with the byte order swapped.
var byteSwapped: Self { get }
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right, masking the shift amount to the
/// type's bit width.
///
/// Use the masking right shift operator (`&>>`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking right shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &>> 2
/// // y == 7 // 0b00000111
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &>> 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
static func &>>(lhs: Self, rhs: Self) -> Self
/// Calculates the result of shifting a value's binary representation the
/// specified number of digits to the right, masking the shift amount to the
/// type's bit width, and stores the result in the left-hand-side variable.
///
/// The `&>>=` operator performs a *masking shift*, where the value passed as
/// `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. The
/// shift is performed using this masked value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// var x: UInt8 = 30 // 0b00011110
/// x &>>= 2
/// // x == 7 // 0b00000111
///
/// However, if you use `19` as `rhs`, the operation first bitmasks `rhs` to
/// `3`, and then uses that masked value as the number of bits to shift `lhs`.
///
/// var y: UInt8 = 30 // 0b00011110
/// y &>>= 19
/// // y == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
static func &>>=(lhs: inout Self, rhs: Self)
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left, masking the shift amount to the
/// type's bit width.
///
/// Use the masking left shift operator (`&<<`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking left shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &<< 2
/// // y == 120 // 0b01111000
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &<< 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
static func &<<(lhs: Self, rhs: Self) -> Self
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left, masking the shift amount to the
/// type's bit width, and stores the result in the left-hand-side variable.
///
/// The `&<<=` operator performs a *masking shift*, where the value used as
/// `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. The
/// shift is performed using this masked value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// var x: UInt8 = 30 // 0b00011110
/// x &<<= 2
/// // x == 120 // 0b01111000
///
/// However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to
/// `3`, and then uses that masked value as the number of bits to shift `lhs`.
///
/// var y: UInt8 = 30 // 0b00011110
/// y &<<= 19
/// // y == 240 // 0b11110000
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
static func &<<=(lhs: inout Self, rhs: Self)
}
extension FixedWidthInteger {
/// The number of bits in the binary representation of this value.
@inlinable
public var bitWidth: Int { return Self.bitWidth }
@inlinable // FIXME(sil-serialize-all)
public func _binaryLogarithm() -> Int {
_precondition(self > (0 as Self))
return Self.bitWidth &- (leadingZeroBitCount &+ 1)
}
/// Creates an integer from its little-endian representation, changing the
/// byte order if necessary.
///
/// - Parameter value: A value to use as the little-endian representation of
/// the new integer.
@inlinable // FIXME(sil-serialize-all)
public init(littleEndian value: Self) {
#if _endian(little)
self = value
#else
self = value.byteSwapped
#endif
}
/// Creates an integer from its big-endian representation, changing the byte
/// order if necessary.
///
/// - Parameter value: A value to use as the big-endian representation of the
/// new integer.
@inlinable // FIXME(sil-serialize-all)
public init(bigEndian value: Self) {
#if _endian(big)
self = value
#else
self = value.byteSwapped
#endif
}
/// The little-endian representation of this integer.
///
/// If necessary, the byte order of this value is reversed from the typical
/// byte order of this integer type. On a little-endian platform, for any
/// integer `x`, `x == x.littleEndian`.
@inlinable // FIXME(sil-serialize-all)
public var littleEndian: Self {
#if _endian(little)
return self
#else
return byteSwapped
#endif
}
/// The big-endian representation of this integer.
///
/// If necessary, the byte order of this value is reversed from the typical
/// byte order of this integer type. On a big-endian platform, for any
/// integer `x`, `x == x.bigEndian`.
@inlinable // FIXME(sil-serialize-all)
public var bigEndian: Self {
#if _endian(big)
return self
#else
return byteSwapped
#endif
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right, masking the shift amount to the
/// type's bit width.
///
/// Use the masking right shift operator (`&>>`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking right shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &>> 2
/// // y == 7 // 0b00000111
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &>> 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func &>> (lhs: Self, rhs: Self) -> Self {
var lhs = lhs
lhs &>>= rhs
return lhs
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right, masking the shift amount to the
/// type's bit width.
///
/// Use the masking right shift operator (`&>>`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking right shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &>> 2
/// // y == 7 // 0b00000111
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &>> 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable
public static func &>> <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Self {
return lhs &>> Self(truncatingIfNeeded: rhs)
}
/// Calculates the result of shifting a value's binary representation the
/// specified number of digits to the right, masking the shift amount to the
/// type's bit width, and stores the result in the left-hand-side variable.
///
/// The `&>>=` operator performs a *masking shift*, where the value passed as
/// `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. The
/// shift is performed using this masked value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// var x: UInt8 = 30 // 0b00011110
/// x &>>= 2
/// // x == 7 // 0b00000111
///
/// However, if you use `19` as `rhs`, the operation first bitmasks `rhs` to
/// `3`, and then uses that masked value as the number of bits to shift `lhs`.
///
/// var y: UInt8 = 30 // 0b00011110
/// y &>>= 19
/// // y == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func &>>= <
Other : BinaryInteger
>(lhs: inout Self, rhs: Other) {
lhs = lhs &>> rhs
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left, masking the shift amount to the
/// type's bit width.
///
/// Use the masking left shift operator (`&<<`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking left shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &<< 2
/// // y == 120 // 0b01111000
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &<< 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func &<< (lhs: Self, rhs: Self) -> Self {
var lhs = lhs
lhs &<<= rhs
return lhs
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left, masking the shift amount to the
/// type's bit width.
///
/// Use the masking left shift operator (`&<<`) when you need to perform a
/// shift and are sure that the shift amount is in the range
/// `0..<lhs.bitWidth`. Before shifting, the masking left shift operator
/// masks the shift to this range. The shift is performed using this masked
/// value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x &<< 2
/// // y == 120 // 0b01111000
///
/// However, if you use `8` as the shift amount, the method first masks the
/// shift amount to zero, and then performs the shift, resulting in no change
/// to the original value.
///
/// let z = x &<< 8
/// // z == 30 // 0b00011110
///
/// If the bit width of the shifted integer type is a power of two, masking
/// is performed using a bitmask; otherwise, masking is performed using a
/// modulo operation.
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@_semantics("optimize.sil.specialize.generic.partial.never")
@inlinable
public static func &<< <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Self {
return lhs &<< Self(truncatingIfNeeded: rhs)
}
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left, masking the shift amount to the
/// type's bit width, and stores the result in the left-hand-side variable.
///
/// The `&<<=` operator performs a *masking shift*, where the value used as
/// `rhs` is masked to produce a value in the range `0..<lhs.bitWidth`. The
/// shift is performed using this masked value.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the shift amount requires no masking.
///
/// var x: UInt8 = 30 // 0b00011110
/// x &<<= 2
/// // x == 120 // 0b01111000
///
/// However, if you pass `19` as `rhs`, the method first bitmasks `rhs` to
/// `3`, and then uses that masked value as the number of bits to shift `lhs`.
///
/// var y: UInt8 = 30 // 0b00011110
/// y &<<= 19
/// // y == 240 // 0b11110000
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left. If `rhs` is
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func &<<= <
Other : BinaryInteger
>(lhs: inout Self, rhs: Other) {
lhs = lhs &<< rhs
}
}
extension FixedWidthInteger {
/// Returns a random value within the specified range, using the given
/// generator as a source for randomness.
///
/// Use this method to generate an integer within a specific range when you
/// are using a custom random number generator. This example creates three
/// new values in the range `1..<100`.
///
/// for _ in 1...3 {
/// print(Int.random(in: 1..<100, using: &myGenerator))
/// }
/// // Prints "7"
/// // Prints "44"
/// // Prints "21"
///
/// - Note: The algorithm used to create random values may change in a future
/// version of Swift. If you're passing a generator that results in the
/// same sequence of integer values each time you run your program, that
/// sequence may change when your program is compiled using a different
/// version of Swift.
///
/// - Parameters:
/// - range: The range in which to create a random value.
/// `range` must not be empty.
/// - generator: The random number generator to use when creating the
/// new random value.
/// - Returns: A random value within the bounds of `range`.
@inlinable
public static func random<T: RandomNumberGenerator>(
in range: Range<Self>,
using generator: inout T
) -> Self {
_precondition(
!range.isEmpty,
"Can't get random value with an empty range"
)
// Compute delta, the distance between the lower and upper bounds. This
// value may not representable by the type Bound if Bound is signed, but
// is always representable as Bound.Magnitude.
let delta = Magnitude(truncatingIfNeeded: range.upperBound &- range.lowerBound)
// The mathematical result we want is lowerBound plus a random value in
// 0 ..< delta. We need to be slightly careful about how we do this
// arithmetic; the Bound type cannot generally represent the random value,
// so we use a wrapping addition on Bound.Magnitude. This will often
// overflow, but produces the correct bit pattern for the result when
// converted back to Bound.
return Self(truncatingIfNeeded:
Magnitude(truncatingIfNeeded: range.lowerBound) &+
generator.next(upperBound: delta)
)
}
/// Returns a random value within the specified range.
///
/// Use this method to generate an integer within a specific range. This
/// example creates three new values in the range `1..<100`.
///
/// for _ in 1...3 {
/// print(Int.random(in: 1..<100))
/// }
/// // Prints "53"
/// // Prints "64"
/// // Prints "5"
///
/// This method is equivalent to calling the version that takes a generator,
/// passing in the system's default random generator.
///
/// - Parameter range: The range in which to create a random value.
/// `range` must not be empty.
/// - Returns: A random value within the bounds of `range`.
@inlinable
public static func random(in range: Range<Self>) -> Self {
var g = SystemRandomNumberGenerator()
return Self.random(in: range, using: &g)
}
/// Returns a random value within the specified range, using the given
/// generator as a source for randomness.
///
/// Use this method to generate an integer within a specific range when you
/// are using a custom random number generator. This example creates three
/// new values in the range `1...100`.
///
/// for _ in 1...3 {
/// print(Int.random(in: 1...100, using: &myGenerator))
/// }
/// // Prints "7"
/// // Prints "44"
/// // Prints "21"
///
/// - Parameters:
/// - range: The range in which to create a random value.
/// - generator: The random number generator to use when creating the
/// new random value.
/// - Returns: A random value within the bounds of `range`.
@inlinable
public static func random<T: RandomNumberGenerator>(
in range: ClosedRange<Self>,
using generator: inout T
) -> Self {
_precondition(
!range.isEmpty,
"Can't get random value with an empty range"
)
// Compute delta, the distance between the lower and upper bounds. This
// value may not representable by the type Bound if Bound is signed, but
// is always representable as Bound.Magnitude.
var delta = Magnitude(truncatingIfNeeded: range.upperBound &- range.lowerBound)
// Subtle edge case: if the range is the whole set of representable values,
// then adding one to delta to account for a closed range will overflow.
// If we used &+ instead, the result would be zero, which isn't helpful,
// so we actually need to handle this case separately.
if delta == Magnitude.max {
return Self(truncatingIfNeeded: generator.next() as Magnitude)
}
// Need to widen delta to account for the right-endpoint of a closed range.
delta += 1
// The mathematical result we want is lowerBound plus a random value in
// 0 ..< delta. We need to be slightly careful about how we do this
// arithmetic; the Bound type cannot generally represent the random value,
// so we use a wrapping addition on Bound.Magnitude. This will often
// overflow, but produces the correct bit pattern for the result when
// converted back to Bound.
return Self(truncatingIfNeeded:
Magnitude(truncatingIfNeeded: range.lowerBound) &+
generator.next(upperBound: delta)
)
}
/// Returns a random value within the specified range.
///
/// Use this method to generate an integer within a specific range. This
/// example creates three new values in the range `1...100`.
///
/// for _ in 1...3 {
/// print(Int.random(in: 1...100))
/// }
/// // Prints "53"
/// // Prints "64"
/// // Prints "5"
///
/// This method is equivalent to calling `random(in:using:)`, passing in the
/// system's default random generator.
///
/// - Parameter range: The range in which to create a random value.
/// - Returns: A random value within the bounds of `range`.
@inlinable
public static func random(in range: ClosedRange<Self>) -> Self {
var g = SystemRandomNumberGenerator()
return Self.random(in: range, using: &g)
}
}
//===----------------------------------------------------------------------===//
//===--- Operators on FixedWidthInteger -----------------------------------===//
//===----------------------------------------------------------------------===//
extension FixedWidthInteger {
/// Returns the inverse of the bits set in the argument.
///
/// The bitwise NOT operator (`~`) is a prefix operator that returns a value
/// in which all the bits of its argument are flipped: Bits that are `1` in
/// the argument are `0` in the result, and bits that are `0` in the argument
/// are `1` in the result. This is equivalent to the inverse of a set. For
/// example:
///
/// let x: UInt8 = 5 // 0b00000101
/// let notX = ~x // 0b11111010
///
/// Performing a bitwise NOT operation on 0 returns a value with every bit
/// set to `1`.
///
/// let allOnes = ~UInt8.min // 0b11111111
///
/// - Complexity: O(1).
@_transparent
public static prefix func ~ (x: Self) -> Self {
return 0 &- x &- 1
}
//===----------------------------------------------------------------------===//
//=== "Smart right shift", supporting overshifts and negative shifts ------===//
//===----------------------------------------------------------------------===//
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the right.
///
/// The `>>` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a left shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*. An overshift results in `-1` for a
/// negative value of `lhs` or `0` for a nonnegative value.
/// - Using any other value for `rhs` performs a right shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted right by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x >> 2
/// // y == 7 // 0b00000111
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x >> 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a left shift
/// using `abs(rhs)`.
///
/// let a = x >> -3
/// // a == 240 // 0b11110000
/// let b = x << 3
/// // b == 240 // 0b11110000
///
/// Right shift operations on negative values "fill in" the high bits with
/// ones instead of zeros.
///
/// let q: Int8 = -30 // 0b11100010
/// let r = q >> 2
/// // r == -8 // 0b11111000
///
/// let s = q >> 11
/// // s == -1 // 0b11111111
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the right.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func >> <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Self {
var lhs = lhs
_nonMaskingRightShiftGeneric(&lhs, rhs)
return lhs
}
@_transparent
@_semantics("optimize.sil.specialize.generic.partial.never")
public static func >>= <
Other : BinaryInteger
>(lhs: inout Self, rhs: Other) {
_nonMaskingRightShiftGeneric(&lhs, rhs)
}
@_transparent
public static func _nonMaskingRightShiftGeneric <
Other : BinaryInteger
>(_ lhs: inout Self, _ rhs: Other) {
let shift = rhs < -Self.bitWidth ? -Self.bitWidth
: rhs > Self.bitWidth ? Self.bitWidth
: Int(rhs)
lhs = _nonMaskingRightShift(lhs, shift)
}
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func _nonMaskingRightShift(_ lhs: Self, _ rhs: Int) -> Self {
let overshiftR = Self.isSigned ? lhs &>> (Self.bitWidth - 1) : 0
let overshiftL: Self = 0
if _fastPath(rhs >= 0) {
if _fastPath(rhs < Self.bitWidth) {
return lhs &>> Self(truncatingIfNeeded: rhs)
}
return overshiftR
}
if _slowPath(rhs <= -Self.bitWidth) {
return overshiftL
}
return lhs &<< -rhs
}
//===----------------------------------------------------------------------===//
//=== "Smart left shift", supporting overshifts and negative shifts -------===//
//===----------------------------------------------------------------------===//
/// Returns the result of shifting a value's binary representation the
/// specified number of digits to the left.
///
/// The `<<` operator performs a *smart shift*, which defines a result for a
/// shift of any value.
///
/// - Using a negative value for `rhs` performs a right shift using
/// `abs(rhs)`.
/// - Using a value for `rhs` that is greater than or equal to the bit width
/// of `lhs` is an *overshift*, resulting in zero.
/// - Using any other value for `rhs` performs a left shift on `lhs` by that
/// amount.
///
/// The following example defines `x` as an instance of `UInt8`, an 8-bit,
/// unsigned integer type. If you use `2` as the right-hand-side value in an
/// operation on `x`, the value is shifted left by two bits.
///
/// let x: UInt8 = 30 // 0b00011110
/// let y = x << 2
/// // y == 120 // 0b01111000
///
/// If you use `11` as `rhs`, `x` is overshifted such that all of its bits
/// are set to zero.
///
/// let z = x << 11
/// // z == 0 // 0b00000000
///
/// Using a negative value as `rhs` is the same as performing a right shift
/// with `abs(rhs)`.
///
/// let a = x << -3
/// // a == 3 // 0b00000011
/// let b = x >> 3
/// // b == 3 // 0b00000011
///
/// - Parameters:
/// - lhs: The value to shift.
/// - rhs: The number of bits to shift `lhs` to the left.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func << <
Other : BinaryInteger
>(lhs: Self, rhs: Other) -> Self {
var lhs = lhs
_nonMaskingLeftShiftGeneric(&lhs, rhs)
return lhs
}
@_transparent
@_semantics("optimize.sil.specialize.generic.partial.never")
public static func <<= <
Other : BinaryInteger
>(lhs: inout Self, rhs: Other) {
_nonMaskingLeftShiftGeneric(&lhs, rhs)
}
@_transparent
public static func _nonMaskingLeftShiftGeneric <
Other : BinaryInteger
>(_ lhs: inout Self, _ rhs: Other) {
let shift = rhs < -Self.bitWidth ? -Self.bitWidth
: rhs > Self.bitWidth ? Self.bitWidth
: Int(rhs)
lhs = _nonMaskingLeftShift(lhs, shift)
}
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public static func _nonMaskingLeftShift(_ lhs: Self, _ rhs: Int) -> Self {
let overshiftR = Self.isSigned ? lhs &>> (Self.bitWidth - 1) : 0
let overshiftL: Self = 0
if _fastPath(rhs >= 0) {
if _fastPath(rhs < Self.bitWidth) {
return lhs &<< Self(truncatingIfNeeded: rhs)
}
return overshiftL
}
if _slowPath(rhs <= -Self.bitWidth) {
return overshiftR
}
return lhs &>> -rhs
}
}
extension FixedWidthInteger {
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
public // @testable
static func _convert<Source : BinaryFloatingPoint>(
from source: Source
) -> (value: Self?, exact: Bool) {
guard _fastPath(!source.isZero) else { return (0, true) }
guard _fastPath(source.isFinite) else { return (nil, false) }
guard Self.isSigned || source > -1 else { return (nil, false) }
let exponent = source.exponent
if _slowPath(Self.bitWidth <= exponent) { return (nil, false) }
let minBitWidth = source.significandWidth
let isExact = (minBitWidth <= exponent)
let bitPattern = source.significandBitPattern
// `RawSignificand.bitWidth` is not available if `RawSignificand` does not
// conform to `FixedWidthInteger`; we can compute this value as follows if
// `source` is finite:
let bitWidth = minBitWidth &+ bitPattern.trailingZeroBitCount
let shift = exponent - Source.Exponent(bitWidth)
// Use `Self.Magnitude` to prevent sign extension if `shift < 0`.
let shiftedBitPattern = Self.Magnitude.bitWidth > bitWidth
? Self.Magnitude(truncatingIfNeeded: bitPattern) << shift
: Self.Magnitude(truncatingIfNeeded: bitPattern << shift)
if _slowPath(Self.isSigned && Self.bitWidth &- 1 == exponent) {
return source < 0 && shiftedBitPattern == 0
? (Self.min, isExact)
: (nil, false)
}
let magnitude = ((1 as Self.Magnitude) << exponent) | shiftedBitPattern
return (
Self.isSigned && source < 0 ? 0 &- Self(magnitude) : Self(magnitude),
isExact)
}
/// Creates an integer from the given floating-point value, rounding toward
/// zero. Any fractional part of the value passed as `source` is removed.
///
/// let x = Int(21.5)
/// // x == 21
/// let y = Int(-21.5)
/// // y == -21
///
/// If `source` is outside the bounds of this type after rounding toward
/// zero, a runtime error may occur.
///
/// let z = UInt(-21.5)
/// // Error: ...outside the representable range
///
/// - Parameter source: A floating-point value to convert to an integer.
/// `source` must be representable in this type after rounding toward
/// zero.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init<T : BinaryFloatingPoint>(_ source: T) {
guard let value = Self._convert(from: source).value else {
fatalError("""
\(T.self) value cannot be converted to \(Self.self) because it is \
outside the representable range
""")
}
self = value
}
/// Creates an integer from the given floating-point value, if it can be
/// represented exactly.
///
/// If the value passed as `source` is not representable exactly, the result
/// is `nil`. In the following example, the constant `x` is successfully
/// created from a value of `21.0`, while the attempt to initialize the
/// constant `y` from `21.5` fails:
///
/// let x = Int(exactly: 21.0)
/// // x == Optional(21)
/// let y = Int(exactly: 21.5)
/// // y == nil
///
/// - Parameter source: A floating-point value to convert to an integer.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init?<T : BinaryFloatingPoint>(exactly source: T) {
let (temporary, exact) = Self._convert(from: source)
guard exact, let value = temporary else {
return nil
}
self = value
}
/// Creates a new instance with the representable value that's closest to the
/// given integer.
///
/// If the value passed as `source` is greater than the maximum representable
/// value in this type, the result is the type's `max` value. If `source` is
/// less than the smallest representable value in this type, the result is
/// the type's `min` value.
///
/// In this example, `x` is initialized as an `Int8` instance by clamping
/// `500` to the range `-128...127`, and `y` is initialized as a `UInt`
/// instance by clamping `-500` to the range `0...UInt.max`.
///
/// let x = Int8(clamping: 500)
/// // x == 127
/// // x == Int8.max
///
/// let y = UInt(clamping: -500)
/// // y == 0
///
/// - Parameter source: An integer to convert to this type.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
public init<Other : BinaryInteger>(clamping source: Other) {
if _slowPath(source < Self.min) {
self = Self.min
}
else if _slowPath(source > Self.max) {
self = Self.max
}
else { self = Self(truncatingIfNeeded: source) }
}
/// Returns the sum of this value and the given value without checking for
/// arithmetic overflow.
///
/// Use this function only to avoid the cost of overflow checking when you
/// are certain that the operation won't overflow. In optimized builds (`-O`)
/// the compiler is free to assume that overflow won't occur. Failure to
/// satisfy that assumption is a serious programming error and could lead to
/// statements being unexpectedly executed or skipped.
///
/// In debug builds (`-Onone`) a runtime error is still triggered if the
/// operation overflows.
///
/// This method is not a synonym for the masking addition operator (`&+`).
/// Use that operator instead of this method when you want to discard any
/// overflow that results from an addition operation.
///
/// - Parameter rhs: The value to add to this value.
/// - Returns: The sum of this value and `rhs`.
@_transparent
public func unsafeAdding(_ other: Self) -> Self {
let (result, overflow) = self.addingReportingOverflow(other)
if overflow {
if (_isDebugAssertConfiguration()) {
_preconditionFailure("Overflow in unsafeAdding")
}
else {
Builtin.conditionallyUnreachable()
}
}
return result
}
/// Returns the difference obtained by subtracting the given value from this
/// value without checking for arithmetic overflow.
///
/// Use this function only to avoid the cost of overflow checking when you
/// are certain that the operation won't overflow. In optimized builds (`-O`)
/// the compiler is free to assume that overflow won't occur. Failure to
/// satisfy that assumption is a serious programming error and could lead to
/// statements being unexpectedly executed or skipped.
///
/// In debug builds (`-Onone`) a runtime error is still triggered if the
/// operation overflows.
///
/// This method is not a synonym for the masking subtraction operator (`&-`).
/// Use that operator instead of this method when you want to discard any
/// overflow that results from a subtraction operation.
///
/// - Parameter rhs: The value to subtract from this value.
/// - Returns: The result of subtracting `rhs` from this value.
@_transparent
public func unsafeSubtracting(_ other: Self) -> Self {
let (result, overflow) = self.subtractingReportingOverflow(other)
if overflow {
if (_isDebugAssertConfiguration()) {
_preconditionFailure("Overflow in unsafeSubtracting")
}
else {
Builtin.conditionallyUnreachable()
}
}
return result
}
/// Returns the product of this value and the given value without checking
/// for arithmetic overflow.
///
/// Use this function only to avoid the cost of overflow checking when you
/// are certain that the operation won't overflow. In optimized builds (`-O`)
/// the compiler is free to assume that overflow won't occur. Failure to
/// satisfy that assumption is a serious programming error and could lead to
/// statements being unexpectedly executed or skipped.
///
/// In debug builds (`-Onone`) a runtime error is still triggered if the
/// operation overflows.
///
/// This method is not a synonym for the masking multiplication operator
/// (`&*`). Use that operator instead of this method when you want to discard
/// any overflow that results from an addition operation.
///
/// - Parameter rhs: The value to multiply by this value.
/// - Returns: The product of this value and `rhs`.
@_transparent
public func unsafeMultiplied(by other: Self) -> Self {
let (result, overflow) = self.multipliedReportingOverflow(by: other)
if overflow {
if (_isDebugAssertConfiguration()) {
_preconditionFailure("Overflow in unsafeMultiplied")
}
else {
Builtin.conditionallyUnreachable()
}
}
return result
}
/// Returns the quotient obtained by dividing this value by the given value
/// without checking for arithmetic overflow.
///
/// Use this function only to avoid the cost of overflow checking when you
/// are certain that the operation won't overflow. In optimized builds (`-O`)
/// the compiler is free to assume that overflow won't occur. Failure to
/// satisfy that assumption is a serious programming error and could lead to
/// statements being unexpectedly executed or skipped.
///
/// In debug builds (`-Onone`) a runtime error is still triggered if the
/// operation overflows.
///
/// - Parameter rhs: The value to divide this value by.
/// - Returns: The result of dividing this value by `rhs`.
@_transparent
public func unsafeDivided(by other: Self) -> Self {
let (result, overflow) = self.dividedReportingOverflow(by: other)
if overflow {
if (_isDebugAssertConfiguration()) {
_preconditionFailure("Overflow in unsafeDivided")
}
else {
Builtin.conditionallyUnreachable()
}
}
return result
}
/// Creates a new instance from the bit pattern of the given instance by
/// truncating or sign-extending if needed to fit this type.
///
/// When the bit width of `T` (the type of `source`) is equal to or greater
/// than this type's bit width, the result is the truncated
/// least-significant bits of `source`. For example, when converting a
/// 16-bit value to an 8-bit type, only the lower 8 bits of `source` are
/// used.
///
/// let p: Int16 = -500
/// // 'p' has a binary representation of 11111110_00001100
/// let q = Int8(truncatingIfNeeded: p)
/// // q == 12
/// // 'q' has a binary representation of 00001100
///
/// When the bit width of `T` is less than this type's bit width, the result
/// is *sign-extended* to fill the remaining bits. That is, if `source` is
/// negative, the result is padded with ones; otherwise, the result is
/// padded with zeros.
///
/// let u: Int8 = 21
/// // 'u' has a binary representation of 00010101
/// let v = Int16(truncatingIfNeeded: u)
/// // v == 21
/// // 'v' has a binary representation of 00000000_00010101
///
/// let w: Int8 = -21
/// // 'w' has a binary representation of 11101011
/// let x = Int16(truncatingIfNeeded: w)
/// // x == -21
/// // 'x' has a binary representation of 11111111_11101011
/// let y = UInt16(truncatingIfNeeded: w)
/// // y == 65515
/// // 'y' has a binary representation of 11111111_11101011
///
/// - Parameter source: An integer to convert to this type.
@inlinable // FIXME(sil-serialize-all)
@inline(__always)
public init<T : BinaryInteger>(truncatingIfNeeded source: T) {
if Self.bitWidth <= Int.bitWidth {
self = Self(_truncatingBits: source._lowWord)
}
else {
let neg = source < (0 as T)
var result: Self = neg ? ~0 : 0
var shift: Self = 0
let width = Self(_truncatingBits: Self.bitWidth._lowWord)
for word in source.words {
guard shift < width else { break }
// Masking shift is OK here because we have already ensured
// that shift < Self.bitWidth. Not masking results in
// infinite recursion.
result ^= Self(_truncatingBits: neg ? ~word : word) &<< shift
shift += Self(_truncatingBits: Int.bitWidth._lowWord)
}
self = result
}
}
@_transparent
public // transparent
static var _highBitIndex: Self {
return Self.init(_truncatingBits: UInt(Self.bitWidth._value) &- 1)
}
/// Returns the sum of the two given values, wrapping the result in case of
/// any overflow.
///
/// The overflow addition operator (`&+`) discards any bits that overflow the
/// fixed width of the integer type. In the following example, the sum of
/// `100` and `121` is greater than the maximum representable `Int8` value,
/// so the result is the partial value after discarding the overflowing
/// bits.
///
/// let x: Int8 = 10 &+ 21
/// // x == 31
/// let y: Int8 = 100 &+ 121
/// // y == -35 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
@_transparent
public static func &+ (lhs: Self, rhs: Self) -> Self {
return lhs.addingReportingOverflow(rhs).partialValue
}
/// Adds two values and stores the result in the left-hand-side variable,
/// wrapping any overflow.
///
/// The masking addition assignment operator (`&+=`) silently wraps any
/// overflow that occurs during the operation. In the following example, the
/// sum of `100` and `121` is greater than the maximum representable `Int8`
/// value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// var x: Int8 = 10
/// x &+= 21
/// // x == 31
/// var y: Int8 = 100
/// y &+= 121
/// // y == -35 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to add.
/// - rhs: The second value to add.
@_transparent
public static func &+= (lhs: inout Self, rhs: Self) {
lhs = lhs &+ rhs
}
/// Returns the difference of the two given values, wrapping the result in
/// case of any overflow.
///
/// The overflow subtraction operator (`&-`) discards any bits that overflow
/// the fixed width of the integer type. In the following example, the
/// difference of `10` and `21` is less than zero, the minimum representable
/// `UInt` value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// let x: UInt8 = 21 &- 10
/// // x == 11
/// let y: UInt8 = 10 &- 21
/// // y == 245 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
@_transparent
public static func &- (lhs: Self, rhs: Self) -> Self {
return lhs.subtractingReportingOverflow(rhs).partialValue
}
/// Subtracts the second value from the first and stores the difference in the
/// left-hand-side variable, wrapping any overflow.
///
/// The masking subtraction assignment operator (`&-=`) silently wraps any
/// overflow that occurs during the operation. In the following example, the
/// difference of `10` and `21` is less than zero, the minimum representable
/// `UInt` value, so the result is the result is the partial value after
/// discarding the overflowing bits.
///
/// var x: Int8 = 21
/// x &-= 10
/// // x == 11
/// var y: UInt8 = 10
/// y &-= 21
/// // y == 245 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: A numeric value.
/// - rhs: The value to subtract from `lhs`.
@_transparent
public static func &-= (lhs: inout Self, rhs: Self) {
lhs = lhs &- rhs
}
/// Returns the product of the two given values, wrapping the result in case
/// of any overflow.
///
/// The overflow multiplication operator (`&*`) discards any bits that
/// overflow the fixed width of the integer type. In the following example,
/// the product of `10` and `50` is greater than the maximum representable
/// `Int8` value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// let x: Int8 = 10 &* 5
/// // x == 50
/// let y: Int8 = 10 &* 50
/// // y == -12 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
@_transparent
public static func &* (lhs: Self, rhs: Self) -> Self {
return lhs.multipliedReportingOverflow(by: rhs).partialValue
}
/// Multiplies two values and stores the result in the left-hand-side
/// variable, wrapping any overflow.
///
/// The masking multiplication assignment operator (`&*=`) silently wraps
/// any overflow that occurs during the operation. In the following example,
/// the product of `10` and `50` is greater than the maximum representable
/// `Int8` value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// var x: Int8 = 10
/// x &*= 5
/// // x == 50
/// var y: Int8 = 10
/// y &*= 50
/// // y == -12 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
@_transparent
public static func &*= (lhs: inout Self, rhs: Self) {
lhs = lhs &* rhs
}
}
extension FixedWidthInteger {
@inlinable
public static func _random<R: RandomNumberGenerator>(
using generator: inout R
) -> Self {
if bitWidth <= UInt64.bitWidth {
return Self(truncatingIfNeeded: generator.next() as UInt64)
}
let (quotient, remainder) = bitWidth.quotientAndRemainder(
dividingBy: UInt64.bitWidth
)
var tmp: Self = 0
for i in 0 ..< quotient + remainder.signum() {
let next: UInt64 = generator.next()
tmp += Self(truncatingIfNeeded: next) &<< (UInt64.bitWidth * i)
}
return tmp
}
}
//===----------------------------------------------------------------------===//
//===--- UnsignedInteger --------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// An integer type that can represent only nonnegative values.
public protocol UnsignedInteger : BinaryInteger { }
extension UnsignedInteger {
/// The magnitude of this value.
///
/// Every unsigned integer is its own magnitude, so for any value `x`,
/// `x == x.magnitude`.
///
/// The global `abs(_:)` function provides more familiar syntax when you need
/// to find an absolute value. In addition, because `abs(_:)` always returns
/// a value of the same type, even in a generic context, using the function
/// instead of the `magnitude` property is encouraged.
@_transparent
public var magnitude: Self { return self }
/// A Boolean value indicating whether this type is a signed integer type.
///
/// This property is always `false` for unsigned integer types.
@_transparent
public static var isSigned: Bool { return false }
}
extension UnsignedInteger where Self : FixedWidthInteger {
/// Creates a new instance from the given integer.
///
/// Use this initializer to convert from another integer type when you know
/// the value is within the bounds of this type. Passing a value that can't
/// be represented in this type results in a runtime error.
///
/// In the following example, the constant `y` is successfully created from
/// `x`, an `Int` instance with a value of `100`. Because the `Int8` type
/// can represent `127` at maximum, the attempt to create `z` with a value
/// of `1000` results in a runtime error.
///
/// let x = 100
/// let y = Int8(x)
/// // y == 100
/// let z = Int8(x * 10)
/// // Error: Not enough bits to represent the given value
///
/// - Parameter source: A value to convert to this type of integer. The value
/// passed as `source` must be representable in this type.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init<T : BinaryInteger>(_ source: T) {
// This check is potentially removable by the optimizer
if T.isSigned {
_precondition(source >= (0 as T), "Negative value is not representable")
}
// This check is potentially removable by the optimizer
if source.bitWidth >= Self.bitWidth {
_precondition(source <= Self.max,
"Not enough bits to represent the passed value")
}
self.init(truncatingIfNeeded: source)
}
/// Creates a new instance from the given integer, if it can be represented
/// exactly.
///
/// If the value passed as `source` is not representable exactly, the result
/// is `nil`. In the following example, the constant `x` is successfully
/// created from a value of `100`, while the attempt to initialize the
/// constant `y` from `1_000` fails because the `Int8` type can represent
/// `127` at maximum:
///
/// let x = Int8(exactly: 100)
/// // x == Optional(100)
/// let y = Int8(exactly: 1_000)
/// // y == nil
///
/// - Parameter source: A value to convert to this type of integer.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init?<T : BinaryInteger>(exactly source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source < (0 as T) {
return nil
}
// The width check can be eliminated by the optimizer
if source.bitWidth >= Self.bitWidth &&
source > Self.max {
return nil
}
self.init(truncatingIfNeeded: source)
}
/// The maximum representable integer in this type.
///
/// For unsigned integer types, this value is `(2 ** bitWidth) - 1`, where
/// `**` is exponentiation.
@_transparent
public static var max: Self {
return ~0
}
/// The minimum representable integer in this type.
///
/// For unsigned integer types, this value is always `0`.
@_transparent
public static var min: Self {
return 0
}
}
//===----------------------------------------------------------------------===//
//===--- SignedInteger ----------------------------------------------------===//
//===----------------------------------------------------------------------===//
/// An integer type that can represent both positive and negative values.
public protocol SignedInteger : BinaryInteger, SignedNumeric {
// These requirements are for the source code compatibility with Swift 3
static func _maskingAdd(_ lhs: Self, _ rhs: Self) -> Self
static func _maskingSubtract(_ lhs: Self, _ rhs: Self) -> Self
}
extension SignedInteger {
/// A Boolean value indicating whether this type is a signed integer type.
///
/// This property is always `true` for signed integer types.
@_transparent
public static var isSigned: Bool { return true }
}
extension SignedInteger where Self : FixedWidthInteger {
/// Creates a new instance from the given integer.
///
/// Use this initializer to convert from another integer type when you know
/// the value is within the bounds of this type. Passing a value that can't
/// be represented in this type results in a runtime error.
///
/// In the following example, the constant `y` is successfully created from
/// `x`, an `Int` instance with a value of `100`. Because the `Int8` type
/// can represent `127` at maximum, the attempt to create `z` with a value
/// of `1000` results in a runtime error.
///
/// let x = 100
/// let y = Int8(x)
/// // y == 100
/// let z = Int8(x * 10)
/// // Error: Not enough bits to represent the given value
///
/// - Parameter source: A value to convert to this type of integer. The value
/// passed as `source` must be representable in this type.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init<T : BinaryInteger>(_ source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source.bitWidth > Self.bitWidth {
_precondition(source >= Self.min,
"Not enough bits to represent a signed value")
}
// This check is potentially removable by the optimizer
if (source.bitWidth > Self.bitWidth) ||
(source.bitWidth == Self.bitWidth && !T.isSigned) {
_precondition(source <= Self.max,
"Not enough bits to represent the passed value")
}
self.init(truncatingIfNeeded: source)
}
/// Creates a new instance from the given integer, if it can be represented
/// exactly.
///
/// If the value passed as `source` is not representable exactly, the result
/// is `nil`. In the following example, the constant `x` is successfully
/// created from a value of `100`, while the attempt to initialize the
/// constant `y` from `1_000` fails because the `Int8` type can represent
/// `127` at maximum:
///
/// let x = Int8(exactly: 100)
/// // x == Optional(100)
/// let y = Int8(exactly: 1_000)
/// // y == nil
///
/// - Parameter source: A value to convert to this type of integer.
@inlinable // FIXME(sil-serialize-all)
@_semantics("optimize.sil.specialize.generic.partial.never")
@inline(__always)
public init?<T : BinaryInteger>(exactly source: T) {
// This check is potentially removable by the optimizer
if T.isSigned && source.bitWidth > Self.bitWidth && source < Self.min {
return nil
}
// The width check can be eliminated by the optimizer
if (source.bitWidth > Self.bitWidth ||
(source.bitWidth == Self.bitWidth && !T.isSigned)) &&
source > Self.max {
return nil
}
self.init(truncatingIfNeeded: source)
}
/// The maximum representable integer in this type.
///
/// For signed integer types, this value is `(2 ** (bitWidth - 1)) - 1`,
/// where `**` is exponentiation.
@_transparent
public static var max: Self {
return ~min
}
/// The minimum representable integer in this type.
///
/// For signed integer types, this value is `-(2 ** (bitWidth - 1))`, where
/// `**` is exponentiation.
@_transparent
public static var min: Self {
return (-1 as Self) &<< Self._highBitIndex
}
@inlinable
public func isMultiple(of other: Self) -> Bool {
// Nothing but zero is a multiple of zero.
if other == 0 { return self == 0 }
// Special case to avoid overflow on .min / -1 for signed types.
if other == -1 { return true }
// Having handled those special cases, this is safe.
return self % other == 0
}
}
/// Returns the given integer as the equivalent value in a different integer
/// type.
///
/// The `numericCast(_:)` function traps on overflow in `-O` and `-Onone`
/// builds.
///
/// You can use `numericCast(_:)` to convert a value when the destination type
/// can be inferred from the context. In the following example, the
/// `random(in:)` function uses `numericCast(_:)` twice to convert the
/// argument and return value of the `arc4random_uniform(_:)` function to the
/// appropriate type.
///
/// func random(in range: Range<Int>) -> Int {
/// return numericCast(arc4random_uniform(numericCast(range.count)))
/// + range.lowerBound
/// }
///
/// let number = random(in: -10...<10)
/// // number == -3, perhaps
///
/// - Parameter x: The integer to convert, and instance of type `T`.
/// - Returns: The value of `x` converted to type `U`.
@_transparent
public func numericCast<T : BinaryInteger, U : BinaryInteger>(_ x: T) -> U {
return U(x)
}
// FIXME(integers): These overloads allow expressions like the following in
// Swift 3 compatibility mode:
// let x = 1 << i32
// f(i32: x)
// At the same time, since they are obsolete in Swift 4, this will not cause
// `u8 << -1` to fail due to an overflow in an unsigned value.
extension FixedWidthInteger {
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func >>(lhs: Self, rhs: Self) -> Self {
var lhs = lhs
_nonMaskingRightShiftGeneric(&lhs, rhs)
return lhs
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func >>=(lhs: inout Self, rhs: Self) {
_nonMaskingRightShiftGeneric(&lhs, rhs)
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func <<(lhs: Self, rhs: Self) -> Self {
var lhs = lhs
_nonMaskingLeftShiftGeneric(&lhs, rhs)
return lhs
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4)
@_semantics("optimize.sil.specialize.generic.partial.never")
@_transparent
public static func <<=(lhs: inout Self, rhs: Self) {
_nonMaskingLeftShiftGeneric(&lhs, rhs)
}
}
extension FixedWidthInteger {
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4, message: "Use addingReportingOverflow(_:) instead.")
@_transparent
public static func addWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
let (partialValue, overflow) =
lhs.addingReportingOverflow( rhs)
return (partialValue, overflow: overflow)
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4, message: "Use subtractingReportingOverflow(_:) instead.")
@_transparent
public static func subtractWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
let (partialValue, overflow) =
lhs.subtractingReportingOverflow( rhs)
return (partialValue, overflow: overflow)
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4, message: "Use multipliedReportingOverflow(by:) instead.")
@_transparent
public static func multiplyWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
let (partialValue, overflow) =
lhs.multipliedReportingOverflow(by: rhs)
return (partialValue, overflow: overflow)
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4, message: "Use dividedReportingOverflow(by:) instead.")
@_transparent
public static func divideWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
let (partialValue, overflow) =
lhs.dividedReportingOverflow(by: rhs)
return (partialValue, overflow: overflow)
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4, message: "Use remainderReportingOverflow(dividingBy:) instead.")
@_transparent
public static func remainderWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
let (partialValue, overflow) =
lhs.remainderReportingOverflow(dividingBy: rhs)
return (partialValue, overflow: overflow)
}
}
extension BinaryInteger {
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 3.2,
message: "Please use FixedWidthInteger protocol as a generic constraint and addingReportingOverflow(_:) method instead.")
public static func addWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
fatalError("Unavailable")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 3.2,
message: "Please use FixedWidthInteger protocol as a generic constraint and subtractingReportingOverflow(_:) method instead.")
public static func subtractWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
fatalError("Unavailable")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 3.2,
message: "Please use FixedWidthInteger protocol as a generic constraint and multipliedReportingOverflow(by:) method instead.")
public static func multiplyWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
fatalError("Unavailable")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 3.2,
message: "Please use FixedWidthInteger protocol as a generic constraint and dividedReportingOverflow(by:) method instead.")
public static func divideWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
fatalError("Unavailable")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 3.2,
message: "Please use FixedWidthInteger protocol as a generic constraint and remainderReportingOverflow(dividingBy:) method instead.")
public static func remainderWithOverflow(
_ lhs: Self, _ rhs: Self
) -> (Self, overflow: Bool) {
fatalError("Unavailable")
}
}
// FIXME(integers): Absence of &+ causes ambiguity in the code like the
// following:
// func f<T : SignedInteger>(_ x: T, _ y: T) {
// var _ = (x &+ (y - 1)) < x
// }
// Compiler output:
// error: ambiguous reference to member '-'
// var _ = (x &+ (y - 1)) < x
// ^
extension SignedInteger {
@inlinable // FIXME(sil-serialize-all)
public static func _maskingAdd(_ lhs: Self, _ rhs: Self) -> Self {
fatalError("Should be overridden in a more specific type")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4.0,
message: "Please use 'FixedWidthInteger' instead of 'SignedInteger' to get '&+' in generic code.")
public static func &+ (lhs: Self, rhs: Self) -> Self {
return _maskingAdd(lhs, rhs)
}
@inlinable // FIXME(sil-serialize-all)
public static func _maskingSubtract(_ lhs: Self, _ rhs: Self) -> Self {
fatalError("Should be overridden in a more specific type")
}
@inlinable // FIXME(sil-serialize-all)
@available(swift, obsoleted: 4.0,
message: "Please use 'FixedWidthInteger' instead of 'SignedInteger' to get '&-' in generic code.")
public static func &- (lhs: Self, rhs: Self) -> Self {
return _maskingSubtract(lhs, rhs)
}
}
extension SignedInteger where Self : FixedWidthInteger {
// This overload is supposed to break the ambiguity between the
// implementations on SignedInteger and FixedWidthInteger
@inlinable // FIXME(sil-serialize-all)
public static func &+ (lhs: Self, rhs: Self) -> Self {
return _maskingAdd(lhs, rhs)
}
@_transparent
public static func _maskingAdd(_ lhs: Self, _ rhs: Self) -> Self {
return lhs.addingReportingOverflow(rhs).partialValue
}
// This overload is supposed to break the ambiguity between the
// implementations on SignedInteger and FixedWidthInteger
@inlinable // FIXME(sil-serialize-all)
public static func &- (lhs: Self, rhs: Self) -> Self {
return _maskingSubtract(lhs, rhs)
}
@_transparent
public static func _maskingSubtract(_ lhs: Self, _ rhs: Self) -> Self {
return lhs.subtractingReportingOverflow(rhs).partialValue
}
}
| [
88230
] |
18b062a058b958592027d6e7605fbbbe01681dbe | c766a3855c7f24f6ff77b8a1532ff79f5a474ad2 | /CoinSavers-main/CoinSaver/CoinSaver/OtherViewController.swift | 77869f07d2fed8d484aa25225778148087c69364 | [] | no_license | alyssai123/CoinSaver | 3c7087f670424361fc754a9b936c073a96d8429b | 6347093b0b44f8c61819b96bffc1967ba4276645 | refs/heads/main | 2023-06-29T23:20:56.671533 | 2021-08-04T22:06:43 | 2021-08-04T22:06:43 | 392,504,704 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 929 | swift | //
// OtherViewController.swift
// CoinSaver
//
// Created by Alyssa Idusuyi on 8/3/21.
//
import UIKit
class OtherViewController: UIViewController {
@IBOutlet weak var otherGoalInput: UITextField!
@IBOutlet weak var otherLabel: UILabel!
@IBOutlet weak var otherGoalOutput: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func otherGoalButtonTapped(_ sender: Any) {
otherGoalOutput.text = "Goal: $\(otherGoalInput.text!)"
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
f4dc504880326c3cbd330254d8417f8ff8619beb | a85ad75cd1802199837d7c4e9d183a2bfadde691 | /Swiftris/Array2D.swift | e5c44047ebcae7e624e8acb3a5708a888db41f8c | [] | no_license | mikeholp87/Swiftris | 30272add37b48d5028495d2257f7679ae7fc7d66 | 7f20c05e07fd4d22c45b1fe133ece9ca7ef7715f | refs/heads/master | 2016-09-05T08:58:52.188847 | 2014-09-24T01:25:20 | 2014-09-24T01:25:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 642 | swift | //
// Array2D.swift
// Swiftris
//
// Created by Mike Holp on 9/23/14.
// Copyright (c) 2014 Mike Holp. All rights reserved.
//
import Foundation
class Array2D<T> {
let columns: Int
let rows: Int
var array: Array<T?>
init(columns: Int, rows: Int) {
self.columns = columns
self.rows = rows
array = Array<T?>(count:rows * columns, repeatedValue: nil)
}
subscript(column: Int, row: Int) -> T? {
get {
return array[(row * columns) + column]
}
set(newValue) {
array[(row * columns) + column] = newValue
}
}
}
| [
282686
] |
14ab20847c93bce0f47de1195d72c55c136b2e2a | f5be4757248e23d3f86ff2c7c6d2143f4e96dc0f | /ThirdPartyLib/Alamofire/[email protected] | f27969926859c2fddcc92e713aedf6178a10913e | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | zach-freeman/swift-localview | cf45550b3174e6cbc98cfd29862a2c0321033a21 | 761f4b592e1e4ed9ce0313e6e26d469f86e2319e | refs/heads/master | 2022-08-12T22:04:17.938947 | 2021-05-02T21:28:52 | 2021-05-02T21:28:52 | 41,637,177 | 0 | 0 | MIT | 2022-07-22T01:45:10 | 2015-08-30T17:38:15 | HTML | UTF-8 | Swift | false | false | 1,342 | swift | // swift-tools-version:3.0
//
// [email protected]
//
// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
import PackageDescription
let package = Package(name: "Alamofire", dependencies : [], exclude: ["Tests"])
| [
194560,
196636,
98341,
98346,
98347,
98349,
329778,
59445,
174139,
395327,
327749,
229447,
174152,
174159,
112721,
112730,
354400,
237671,
235658,
229526,
229532,
125086,
125087,
346276,
215205,
241846,
241852,
191,
317640,
241870,
210,
262357,
241878,
262359,
106713,
106715,
106719,
106720,
35040,
262374,
241904,
106737,
176369,
176370,
176373,
260342,
176375,
106741,
106742,
176379,
141566,
106750,
141576,
39177,
141578,
141588,
12565,
39189,
141591,
141592,
227608,
227610,
141595,
141596,
141597,
141598,
141600,
141601,
141603,
176419,
141607,
289068,
289071,
289074,
141627,
141628,
141629,
141632,
141634,
141639,
141640,
141641,
141642,
241994,
241992,
241999,
141649,
141652,
141654,
141655,
141661,
141663,
215396,
141670,
375153,
287090,
375155,
190836,
334196,
276852,
190840,
375163,
190844,
375164,
375166,
287106,
375171,
141701,
375173,
141705,
375181,
197021,
213421,
61885,
303550,
160208,
305637,
305638,
223741,
125456,
191006,
57893,
57894,
328232,
420394,
57899,
295469,
57901,
57903,
250416,
324145,
336446,
336450,
336451,
336455,
336459,
336460,
55886,
336464,
336467,
336469,
336470,
336479,
336480,
336481,
111202,
336488,
297620,
135854,
135860,
135861,
242361,
299713,
299717,
248524,
127695,
66261,
334563,
334564,
127722,
187119,
172784,
172788,
244469,
316155,
111356,
142078,
334590,
318207,
142081,
318209,
142083,
66302,
142085,
244480,
142087,
66306,
142089,
318218,
334601,
318220,
334604,
318223,
142097,
318228,
318233,
318236,
203549,
187173,
318246,
187176,
396086,
396088,
396095,
396098,
279366,
279367,
279369,
299858,
396115,
396118,
396122,
396127,
293733,
396134,
299884,
248696,
297858,
60304,
60308,
60312,
60319,
60323,
23469,
185262,
60337,
23473,
23474,
23481,
23487,
105410,
281540,
23493,
23494,
23499,
23501,
23502,
56275,
23508,
56278,
259036,
56286,
259039,
23519,
242658,
203755,
23531,
433131,
324589,
324590,
242675,
324596,
381953,
23554,
23555,
437252,
23557,
23559,
23560,
437258,
23562,
437266,
437267,
23572,
23573,
23575,
437273,
23580,
437277,
23582,
437279,
437281,
3119,
189488,
187442,
144435,
189491,
189490,
187444,
187447,
187445,
144441,
189492,
97339,
144440,
189493,
341054,
341055,
437305,
144443,
341058,
437314,
341060,
341059,
144445,
341063,
189508,
341066,
23636,
437333,
312406,
285783,
293976,
23640,
285784,
437338,
437340,
285787,
312412,
189502,
312417,
312420,
185446,
437353,
185451,
185452,
437356,
185454,
312427,
185455,
142450,
437364,
15480,
437369,
437371,
142459,
294015,
142463,
294016,
15488,
38019,
437384,
437390,
248975,
437392,
38031,
40083,
437396,
312473,
189594,
189595,
312476,
312478,
312479,
189598,
40095,
228512,
40098,
437412,
312480,
312481,
437415,
437416,
189608,
189609,
312489,
40110,
437423,
437424,
437426,
312499,
189621,
312501,
312502,
437431,
437433,
437440,
437441,
437445,
437450,
437452,
437455,
437458,
203993,
204000,
204003,
281832,
152821,
294138,
279818,
279820,
206094,
206098,
206104,
206107,
206108,
181533,
206109,
27943,
27945,
27948,
245047,
173368,
173376,
245058,
64839,
152906,
152909,
290126,
290135,
245081,
64865,
171363,
222566,
173421,
228717,
173423,
173425,
173426,
222581,
222582,
222587,
222590,
173441,
222594,
222600,
222601,
363913,
222603,
279944,
222605,
279954,
173460,
54678,
173463,
173465,
54692,
153005,
298431,
189495,
212423,
64980,
153049,
189496,
157151,
222692,
157157,
112115,
153076,
112120,
65016,
280061,
40450,
40451,
206344,
40458,
40459,
40460,
112144,
112145,
40466,
355859,
40467,
40471,
40474,
40475,
40476,
40479,
40482,
282156,
34359,
34362,
316993,
173635,
173640,
173641,
263755,
34386,
34394,
106082,
106085,
314989,
319088,
319091,
300662,
52855,
319101,
319103,
175745,
175746,
319109,
175760,
175763,
52884,
52887,
106138,
394910,
52896,
394912,
278178,
394930,
108245,
212694,
34531,
192230,
296679,
192232,
34537,
34538,
296685,
34541,
155377,
296691,
52980,
155381,
296694,
296696,
296699,
296700,
52988,
296705,
296706,
296709,
296710,
276236,
276237,
311055,
313108,
313114,
227116,
227119,
210756,
218957,
120655,
218960,
120656,
120657,
223064,
223065,
180059,
223069,
169824,
292708,
292709,
128873,
223081,
227179,
128876,
169837,
227180,
227183,
227185,
227189,
116600,
108421,
108436,
169879,
169880,
169881,
108455,
141225,
169903,
141235,
184261,
290767,
59349,
141272,
141284,
174067,
237559,
395259,
194558,
194559
] |
86d59cdfc143f52f42e6a1271ccddafae0fa34a4 | 2180c4b59bae01a6f31dacd179609d4207ee75c2 | /lucien-ios/Models/AmazonS3ImageURL.swift | e0c70ac3bf807860089b5ece8cbd7a2382266643 | [] | no_license | IntrepidPursuits/lucien-ios | 7877464d62383d8b01569cac7de60cf48750759c | 73c39ff37d19f36b2a79d235287ccdc79a05c052 | refs/heads/develop | 2021-07-19T02:56:35.489823 | 2017-10-27T15:10:52 | 2017-10-27T15:10:52 | 104,785,342 | 1 | 1 | null | 2017-10-27T15:10:54 | 2017-09-25T18:14:59 | Swift | UTF-8 | Swift | false | false | 903 | swift | //
// S3ImageURL.swift
// lucien-ios
//
// Created by Ahmed, Guled on 10/12/17.
// Copyright © 2017 Intrepid Pursuits. All rights reserved.
//
import Foundation
struct AmazonS3ImageURL: Decodable {
var preSignedURL: String
var publicURL: String
private enum CodingKeys: String, CodingKey {
case s3Object = "s3_object"
}
private enum AmazonS3ImageURLKeys: String, CodingKey {
case preSignedURL = "presigned_url"
case publicURL = "public_url"
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
let s3ObjectContainer = try values.nestedContainer(keyedBy: AmazonS3ImageURLKeys.self, forKey: .s3Object)
preSignedURL = try s3ObjectContainer.decode(String.self, forKey: .preSignedURL)
publicURL = try s3ObjectContainer.decode(String.self, forKey: .publicURL)
}
}
| [
-1
] |
05e2d47589aa90e2f3172b9a3f5cd13a9e5137e4 | 8908d20fb480f48b977992ac4e2c81fa218d2365 | /Pods/TrustWalletCore/swift/Sources/Generated/Protobuf/IoTeX+Proto.swift | d2c865db637a51cf156947d456fa5e303e10316b | [
"MIT"
] | permissive | nodawallet/NodaWallet-IOS | de7363e512e1de05051a9eff90e7c5b97d879900 | d7831d4b2c15ab3014f8b37f82e0b99464e1f78b | refs/heads/master | 2022-11-20T02:10:24.099528 | 2020-07-22T14:03:41 | 2020-07-22T14:03:41 | 281,612,887 | 13 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 692 | swift | // Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
public typealias IoTeXTransfer = TW_IoTeX_Proto_Transfer;
public typealias IoTeXStaking = TW_IoTeX_Proto_Staking;
public typealias IoTeXContractCall = TW_IoTeX_Proto_ContractCall;
public typealias IoTeXSigningInput = TW_IoTeX_Proto_SigningInput;
public typealias IoTeXSigningOutput = TW_IoTeX_Proto_SigningOutput;
public typealias IoTeXActionCore = TW_IoTeX_Proto_ActionCore;
public typealias IoTeXAction = TW_IoTeX_Proto_Action;
| [
-1
] |
857082464c7f03f51ae8838d981a43cc097cc3a9 | df6753528355a9b6341da7dd88d24daca7940d40 | /OopsConcepts/AppDelegate.swift | 9dd9796f7a8ac6e359fb91021ec9c1d2d90469d1 | [] | no_license | Lavanya-Adishyam/OopsConcepts | 0ace025432795ad8104ae1f2af0bba64381c1571 | dc3564fed9b51df41c104ecafc6629326bb3c464 | refs/heads/master | 2020-08-15T01:19:15.200990 | 2019-10-16T07:23:19 | 2019-10-16T07:23:19 | 215,259,258 | 0 | 0 | null | 2019-10-16T07:23:20 | 2019-10-15T09:28:08 | Swift | UTF-8 | Swift | false | false | 4,602 | swift | //
// AppDelegate.swift
// OopsConcepts
//
// Created by Lavanya on 15/10/19.
// Copyright © 2019 Lavanya Akurathi. All rights reserved.
//
import UIKit
import CoreData
@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:.
// 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: "OopsConcepts")
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,
322080,
306721,
296483,
322083,
229411,
306726,
309287,
308266,
292907,
217132,
322092,
40495,
316465,
288306,
322102,
324663,
164408,
308281,
322109,
286783,
315457,
313409,
313413,
349765,
320582,
309832,
288329,
242250,
215117,
196177,
241746,
344661,
231000,
212571,
300124,
287323,
309342,
325220,
306790,
290409,
310378,
296043,
311914,
152685,
334446,
239726,
307310,
322666,
292466,
314995,
307315,
314487,
291450,
314491,
222846,
288383,
318599,
312970,
239252,
311444,
294038,
311449,
323739,
300194,
298662,
233638,
233644,
313005,
286896,
295600,
300208,
286389,
294070,
125111,
234677,
321212,
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,
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,
300380,
291169,
199020,
293741,
266606,
319342,
292212,
313205,
244598,
316788,
124796,
196988,
305022,
317821,
243072,
314241,
303999,
313215,
242050,
325509,
293767,
316300,
306576,
322448,
308114,
319900,
298910,
313250,
308132,
316327,
306605,
316334,
324015,
324017,
200625,
300979,
316339,
322998,
67000,
316345,
296888,
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
] |
ea8fae694cdd2bff4fa948bb1b1c3f731275c992 | c4747accdd00706d2b461f716850e792ae2324e6 | /apple_class/ContentView.swift | f7b165e474c1f2f5fb1b0c07dbd3adf0074b56e0 | [] | no_license | EriaWist/Creating-and-Combining-Views | 22a5ecf89a85b3b8dda54a887ad984e9a0d88608 | 6ef474f597bdf7fe43ca66c24f37753a60a145b0 | refs/heads/master | 2022-08-16T11:39:39.882719 | 2020-05-25T17:09:28 | 2020-05-25T17:09:28 | 266,835,972 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,064 | swift | //
// ContentView.swift
// apple_class
//
// Created by 阿騰 on 2020/5/20.
// Copyright © 2020 阿騰. All rights reserved.
//
import SwiftUI
struct ContentView: View {
var a = Text("asd")
var body: some View {
VStack {
SwiftUIView_map()
.frame(height: 300)
.edgesIgnoringSafeArea(.all)
SwiftUIView_image()
.offset(y:-130)
.padding(.bottom,-130)
HStack {
Text("Hello, World!")
.font(.title)
Spacer()
.frame(width: 20)
Button(action: {})
{
a
}
}
Button(action: {}) {
Text(/*@START_MENU_TOKEN@*/"Button"/*@END_MENU_TOKEN@*/)
}
Spacer()//把下半部塞滿
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
| [
-1
] |
c8a7effa639385141c26ae2c5f74e43c76509c4b | 4a502030fa92e21d9cebe064882dc97fdbc66a82 | /Example/Observable/Views/CollectionView.swift | 81e93a681e97e378a9276e9285c4f00f086a0598 | [
"MIT"
] | permissive | AlexandrGraschenkov/Observable | 5195a489072b0d9517ec9c6d49fe3a94e41b2f68 | 9d115a1c251f084714243fe1703722dc5605bc4f | refs/heads/master | 2020-05-01T17:32:30.852121 | 2019-04-16T20:59:09 | 2019-04-16T20:59:09 | 177,602,419 | 0 | 0 | MIT | 2019-04-16T20:59:10 | 2019-03-25T14:27:23 | Swift | UTF-8 | Swift | false | false | 1,774 | swift | import Foundation
import UIKit
import Observable
class CollectionView: UICollectionView {
var scrollPercentage = Observable(Float(0))
convenience init() {
let size = (UIScreen.main.bounds.width / 2) - 30
let layout = UICollectionViewFlowLayout()
layout.itemSize = CGSize(width: size, height: size)
layout.minimumLineSpacing = 10
layout.minimumInteritemSpacing = 10
layout.scrollDirection = .horizontal
self.init(frame: .zero, collectionViewLayout: layout)
register(UICollectionViewCell.self, forCellWithReuseIdentifier: "CellReuseIdentifier")
translatesAutoresizingMaskIntoConstraints = false
dataSource = self
delegate = self
contentInset = UIEdgeInsets(top: 30, left: 0, bottom: 40, right: 0)
backgroundColor = nil
clipsToBounds = false
showsHorizontalScrollIndicator = false
}
}
extension CollectionView: UICollectionViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
scrollPercentage.value = Float((scrollView.contentOffset.x / frame.width) / ((contentSize.width - frame.width) / frame.width))
}
}
extension CollectionView: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CellReuseIdentifier", for: indexPath)
cell.backgroundColor = UIColor(red: 95/255, green: 20/255, blue: 255/255, alpha: 1)
return cell
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 30
}
}
| [
-1
] |
e3ef79492244837703e0104790f850635c97d356 | 8e205a44c611512a5966b2f88bb0dc0bb7a01750 | /Additive Move to Tap/Additive Move to Tap/ViewController.swift | cd703e64b4b7c284c971d0f753a5a10f72b89064 | [
"MIT"
] | permissive | grubern/Additive-Animations-Playground | cee80bbe48d24a73a2269bc6e9b33b9f285b9cdd | 0c27de8c42a64d5695255c59a8fc436bd6ca2410 | refs/heads/master | 2017-10-07T15:33:50.407135 | 2014-06-24T20:33:10 | 2014-06-24T20:33:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,755 | swift | //
// ViewController.swift
// Additive Move to Tap
//
// Created by David Rönnqvist on 24/06/14.
// Copyright (c) 2014 David Rönnqvist. All rights reserved.
//
import UIKit
import QuartzCore
var myBlue = UIColor(red: 74.0/255.0, green: 165.0/255.0, blue: 227.0/255.0, alpha: 1.0)
var myOrange = UIColor(red: 1.0, green: 185.0/255.0, blue: 0.0, alpha: 1.0)
class ViewController: UIViewController {
var additiveAnimationsAreEnabled = false
let layer = CALayer()
override func viewDidLoad() {
super.viewDidLoad()
layer.frame = CGRect(x: 0, y: 0, width: 60, height: 60)
layer.backgroundColor = myOrange.CGColor
layer.position = view.center
view.layer.addSublayer(layer)
}
// Toggle the feature
@IBAction func additiveAnimationsDidToggle(sender: UISwitch) {
additiveAnimationsAreEnabled = sender.on
layer.backgroundColor = additiveAnimationsAreEnabled ? myBlue.CGColor : myOrange.CGColor
}
// Move the layer to the tapped point
@IBAction func userDidTap(sender: UITapGestureRecognizer) {
let touchPoint = sender.locationInView(view)
let presentation = layer.presentationLayer() as CALayer
let currentPoint = presentation.position
let animation = CABasicAnimation(keyPath: "position")
animation.duration = 1.5 // a long animation so that the effect is easier to see
animation.timingFunction = CAMediaTimingFunction(name: "easeInEaseOut")
// use nil when the animation is additive but a key when it's not
var animationKey: NSString? = nil // use nil or a unique key to not cancel the animations
if additiveAnimationsAreEnabled {
animation.additive = true
let difference = CGPoint(
x: layer.position.x - touchPoint.x,
y: layer.position.y - touchPoint.y
)
// from -(new-old) to zero (additive)
animation.fromValue = NSValue(CGPoint: difference)
animation.toValue = NSValue(CGPoint: CGPointZero)
} else {
// from old to new
animation.fromValue = NSValue(CGPoint: currentPoint)
animation.toValue = NSValue(CGPoint: touchPoint)
animationKey = "move the layer"
}
// disable the implicit animation
CATransaction.begin()
CATransaction.setDisableActions(true)
layer.position = touchPoint
CATransaction.commit()
// add the explicit animtion
layer.addAnimation(animation, forKey:animationKey)
}
}
| [
-1
] |
b0cd95c2d97449204249d66c8f10a8aaa1cb48a0 | 1758cb67670d96f0a47f856cc15c608dba884cf3 | /Assasins UI Layout/Targets/TargetDetailViewController.swift | e9581e41bf912d60f0fe838fd7d689c4a1e99684 | [] | no_license | tajmahalic/438FinalProject | 0dda2d3fbab76fc8b7a05da679ee34d4cd6647e9 | 1275ddeebb86fcc07f2684dc8cf78455cf249469 | refs/heads/master | 2020-04-20T03:22:27.664252 | 2019-01-31T21:22:13 | 2019-01-31T21:22:13 | 168,596,315 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,033 | swift | //
// TargetDetailViewController.swift
// Assasins UI Layout
//
// Created by Eliot Tong on 11/25/18.
// Copyright © 2018 CSE438. All rights reserved.
//
import UIKit
import Firebase
class TargetDetailViewController: UIViewController {
@IBOutlet weak var targetImageView: UIImageView!
@IBOutlet weak var sessionText: UILabel!
@IBOutlet weak var targetNameText: UILabel!
var game: Game!
var targetProPath: String!
var userID = UserClass.CurrentUserID!
var target: AssassinPlayer!
override func viewDidLoad() {
super.viewDidLoad()
let url = targetProPath!
let storage = Storage.storage()
var reference: StorageReference!
reference = storage.reference(withPath: url)
reference.downloadURL { (url, error) in
guard let imageURL = url, error == nil else {
//handle error here if returned url is bad or there is error
return
}
guard let data = NSData(contentsOf: imageURL) else {
//same thing here, handle failed data download
return
}
let image = UIImage(data: data as Data)
self.targetImageView.image = image
}
sessionText.text = "Session Name: " + game.name
targetNameText.text = "Target Name: " + target.name
//let currUser = Auth.auth().currentUser!
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func pressKillTarget(_ sender: Any) {
killTarget()
}
func killTarget() {
//Make user assassinplayer and get user id
let userPlayer = AssassinPlayer(id: userID, isActive: true, curKills: 0, username: "anyUsername", name: "anyName")
game.killPlayer(target: target, killer: userPlayer)
}
@IBAction func AssasinateAction(_ sender: Any) {
CameraHandler.shared.showActionSheet(vc: self)
CameraHandler.shared.imagePickedBlock = { (image) in
let destinationVC = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "cameraViewController") as! CameraViewController
destinationVC.image = image
destinationVC.target = self.target
destinationVC.game = self.game
self.navigationController?.pushViewController(destinationVC, animated: true)
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
a5d7198837067388d90879f3b46cb37396d94ad7 | 00ad31c76d0c5c6592778f1d418150de3d1f6265 | /CoreAnimationDemo/VTLabel.swift | 0f29bbf0c8e893df71a1aaf49c40965c09294c20 | [] | no_license | VitoNYang/CoreAnimationDemo | 545c8db48076328ec8f59dcb7a2c466037985f17 | 1a87a3f30df3350d25bcb4ce203d14a3876ce551 | refs/heads/master | 2021-01-22T07:47:17.111980 | 2017-04-01T10:39:18 | 2017-04-01T10:39:18 | 81,848,459 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,236 | swift | //
// VTLabel.swift
// CoreAnimationDemo
//
// Created by hao Mac Mini on 2017/2/17.
// Copyright © 2017年 Vito. All rights reserved.
//
import UIKit
class VTLabel: UILabel {
override class var layerClass: Swift.AnyClass {
return CATextLayer.self
}
override init(frame: CGRect) {
super.init(frame: frame)
setup()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func awakeFromNib() {
super.awakeFromNib()
setup()
}
var textLayer: CATextLayer {
return self.layer as! CATextLayer
}
func setup() {
font = super.font
text = super.text
textColor = super.textColor
layer.display()
}
override var text: String? {
didSet {
textLayer.string = text
}
}
override var textColor: UIColor! {
didSet {
textLayer.foregroundColor = textColor.cgColor
}
}
override var font: UIFont! {
didSet {
let fontName = font.fontName
textLayer.font = fontName as CFTypeRef?
textLayer.fontSize = font.pointSize
}
}
}
| [
-1
] |
f7139c17cf351cc3da55be297d230afe7e31be1f | c627ca3d1b44ff9f6ff6939b8fc79e62cdc473fe | /Pods/RxSwift/RxSwift/Observables/SkipWhile.swift | 1dde588f4ab60c3502362b778d9884297df5dcd4 | [
"MIT"
] | permissive | Jaykong/EFPV2 | 5e004bc21c7bcf98b8aa9116d6c54a7f9a80a4d1 | 92113713f37332d1973775654e8e63c19c760e63 | refs/heads/master | 2021-05-09T06:34:45.250603 | 2018-02-28T06:53:21 | 2018-02-28T06:53:21 | 119,324,673 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,543 | swift | //
// SkipWhile.swift
// RxSwift
//
// Created by Yury Korolev on 10/9/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
extension ObservableType {
/**
Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
- seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html)
- parameter predicate: A function to test each element for a condition.
- returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
public func skipWhile(_ predicate: @escaping (E) throws -> Bool) -> Observable<E> {
return SkipWhile(source: asObservable(), predicate: predicate)
}
}
fileprivate final class SkipWhileSink<O: ObserverType>: Sink<O>, ObserverType {
typealias Element = O.E
typealias Parent = SkipWhile<Element>
fileprivate let _parent: Parent
fileprivate var _running = false
init(parent: Parent, observer: O, cancel: Cancelable) {
_parent = parent
super.init(observer: observer, cancel: cancel)
}
func on(_ event: Event<Element>) {
switch event {
case let .next(value):
if !_running {
do {
_running = try !_parent._predicate(value)
} catch let e {
forwardOn(.error(e))
dispose()
return
}
}
if _running {
forwardOn(.next(value))
}
case .error, .completed:
forwardOn(event)
dispose()
}
}
}
fileprivate final class SkipWhile<Element>: Producer<Element> {
typealias Predicate = (Element) throws -> Bool
typealias PredicateWithIndex = (Element, Int) throws -> Bool
fileprivate let _source: Observable<Element>
fileprivate let _predicate: Predicate
init(source: Observable<Element>, predicate: @escaping Predicate) {
_source = source
_predicate = predicate
}
override func run<O: ObserverType>(_ observer: O, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where O.E == Element {
let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel)
let subscription = _source.subscribe(sink)
return (sink: sink, subscription: subscription)
}
}
| [
152331,
158581,
62069,
15639,
124639
] |
a4cc2d74144110e78b47dad25c6a62d015a59004 | 2ef7974f29ee0efb6ded04c8a9222f66c586e472 | /Sources/ExampleApp/Models/Dog.swift | 1afe38daf4308b07a36ef015f1df86e9e9155509 | [] | no_license | twof/RapidRepo | a9dd3315af0285be46480a912439d7b1d2e5f04d | fa7f76f4460df4fdf0d828536afdef3ffc1c355e | refs/heads/master | 2020-04-07T01:52:28.888572 | 2018-11-17T09:49:51 | 2018-11-17T09:49:51 | 157,955,688 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 126 | swift | import Vapor
import FluentSQLite
struct Dog: SQLiteModel, Content {
var id: Int?
var name: String
var age: Int
}
| [
-1
] |
a9bc2c52342b91e8e18833f8a0eafa2d3530591f | 3263aa1265d5da7bf9f41c2c36548a78a84254db | /2020/19.1.swift | a78d0f09b1562b6da6cc70981aff868c511db399 | [] | no_license | bilherron/advent-of-code | 26b830c2c08de105cdaec78f5626c99af44d01c3 | 604eebd835f45a2f102c8ab927f509098f4c436f | refs/heads/master | 2022-01-09T01:23:08.514991 | 2021-12-23T01:14:17 | 2021-12-23T01:14:17 | 225,863,466 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,553 | swift | import Foundation
// https://adventofcode.com/2020/day/19
let input = importPuzzleInput("./19.input.txt")
let testInput = """
0: 4 1 5
1: 2 3 | 3 2
2: 4 4 | 5 5
3: 4 5 | 5 4
4: "a"
5: "b"
ababbb
bababa
abbbab
aaabbb
aaaabbb
"""
let inputParts = input.components(separatedBy: "\n\n")
let rawRules = inputParts[0]
let messages = inputParts[1].components(separatedBy: "\n")
var rules = [Int: String]()
rawRules.components(separatedBy: "\n").forEach { ruleString in
let parts = ruleString.components(separatedBy: ": ")
rules[Int(parts[0])!] = String(parts[1]).replacingOccurrences(of: "\"", with: "")
}
var newRules = [Int: String]()
var terminalRules = [Int]()
for rule in rules {
if rule.value == "a" || rule.value == "b" {
terminalRules.append(rule.key)
}
}
let ruleZero = rules[0]!.components(separatedBy: " ")
var intermediateRuleZero = [String]()
for rulePart in ruleZero {
let rulePartInt = Int(rulePart)!
let ruleForNum = rules[rulePartInt]!
if terminalRules.contains(rulePartInt) {
intermediateRuleZero.append(rulePart)
continue
} else {
intermediateRuleZero.append("(\(ruleForNum))")
}
}
let modRuleZero = resolveRule(rules[0]!)
let ruleZeroRegex = regexify(modRuleZero)
var matchingMessages = 0
for message in messages {
if message.range(of: ruleZeroRegex, options: .regularExpression) != nil {
matchingMessages += 1
}
}
print("Matching messages:", matchingMessages)
func regexify(_ rule: String) -> String {
let ruleParts = rule.components(separatedBy: " ")
var regex = ""
for part in ruleParts {
if ["(", ")", "|"].contains(part) {
regex += String(part)
} else {
let intChar = Int(String(part))!
if terminalRules.contains(intChar) {
regex += rules[intChar]!
}
}
}
return "^\(regex)$"
}
func resolveRule(_ rule: String) -> String {
let ruleParts = rule.components(separatedBy: " ")
var resolvedRule = [String]()
for part in ruleParts {
if ["(", ")", "|"].contains(part) {
resolvedRule.append(String(part))
} else {
let intChar = Int(String(part))!
if terminalRules.contains(intChar) {
resolvedRule.append(String(part))
} else {
let recurse = resolveRule(rules[intChar]!)
resolvedRule.append("( \(recurse) )")
}
}
}
return resolvedRule.joined(separator: " ")
}
func importPuzzleInput(_ path: String) -> String {
var input = ""
do {
input = try String(contentsOfFile: path, encoding: .utf8)
}
catch let error {
print(error)
}
return input
}
| [
-1
] |
3c5d9dde1b4941738510402e1b4b1e63caaf1313 | f462c60c2d49bbda641ff9d9cd7d2f373bec8646 | /BasicAnimationDemo/AppDelegate.swift | 649cc9d6b2e62da910b385864690c58491adcda1 | [] | no_license | Silence-GitHub/BasicAnimationDemo | c378196206b689644f6b86361f6b930da79a3c22 | c8335a6631dab2a6585d669e2e9b9f1f3cd59073 | refs/heads/master | 2021-01-22T05:57:22.249048 | 2019-06-27T03:20:07 | 2019-06-27T03:20:07 | 81,722,640 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,182 | swift | //
// AppDelegate.swift
// BasicAnimationDemo
//
// Created by Kaibo Lu on 2017/2/13.
// Copyright © 2017年 Kaibo Lu. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
229388,
294924,
278542,
229391,
327695,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
319544,
204856,
229432,
286776,
286778,
286791,
237640,
278605,
286797,
311375,
163920,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
131209,
303241,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
278983,
319945,
278986,
278990,
278994,
311767,
279003,
279006,
188895,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
189039,
295538,
172660,
189040,
189044,
287349,
287355,
287360,
295553,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
287390,
303773,
164509,
172705,
287394,
172702,
303780,
172707,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
213895,
304009,
304011,
304013,
279438,
295822,
213902,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
295945,
295949,
230413,
197645,
320528,
140312,
295961,
238620,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
296259,
378181,
296262,
230727,
296264,
238919,
320840,
296267,
296271,
222545,
230739,
312663,
337244,
222556,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
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,
148990,
321022,
206336,
402942,
296450,
296446,
230916,
230919,
304651,
370187,
304653,
230923,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
239202,
312938,
280183,
280185,
280191,
116354,
280194,
280208,
280211,
288408,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
280276,
321239,
280283,
18140,
313052,
288478,
313055,
321252,
313066,
280302,
288494,
313073,
419570,
288499,
321266,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
288576,
345921,
280388,
337732,
304968,
280393,
280402,
173907,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
313258,
321458,
296883,
124853,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
239586,
313320,
231404,
124913,
165876,
321528,
313340,
239612,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
280681,
313451,
223341,
280687,
215154,
313458,
280691,
149618,
313464,
329850,
321659,
288895,
321670,
215175,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
280755,
288947,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
305464,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
280919,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289227,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
338440,
150025,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
174955,
224110,
207733,
207737,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
240535,
289687,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
216376,
298306,
380226,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
281990,
224647,
298377,
314763,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
282101,
241142,
191992,
290298,
151036,
290302,
290305,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
282133,
290325,
241175,
290328,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
315211,
307027,
315221,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
315253,
315255,
339838,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
241581,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
282645,
241693,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
307287,
315482,
217179,
315483,
192605,
233567,
200801,
299105,
217188,
299109,
307303,
315495,
356457,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
184479,
299167,
184481,
315557,
184486,
307370,
307372,
307374,
307376,
299185,
323763,
176311,
299191,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
307394,
307396,
299204,
184518,
307399,
323784,
233679,
307409,
307411,
299225,
233701,
307432,
282881,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
307508,
315701,
332086,
307510,
307512,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
127457,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
135672,
127480,
233979,
291323,
127485,
291330,
127490,
283142,
127494,
135689,
233994,
127497,
127500,
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,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
185173,
234329,
234333,
308063,
234336,
234338,
349027,
242530,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
234370,
201603,
291714,
234373,
316294,
226182,
234375,
308105,
291716,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
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,
324599,
234487,
234490,
234493,
234496,
316416,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
316439,
234520,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
160835,
234563,
234568,
234570,
316491,
300108,
234572,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
300133,
234597,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
275579,
234620,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324766,
324768,
283805,
234657,
242852,
234661,
283813,
300197,
234664,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
226500,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
300289,
292097,
161027,
300292,
300294,
275719,
234760,
300299,
177419,
242957,
283917,
300301,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
243003,
283963,
226628,
283973,
300357,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
218473,
284010,
324978,
136562,
275834,
333178,
275836,
275840,
316803,
316806,
316811,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
226802,
292338,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
308790,
284215,
316983,
194103,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
194130,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
284258,
292452,
292454,
284263,
284265,
292458,
284267,
292461,
284272,
284274,
276086,
284278,
292470,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
276122,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
276166,
284358,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
153417,
292681,
358224,
276308,
178006,
317271,
284502,
276315,
292700,
284511,
317279,
227175,
292715,
300912,
284529,
292721,
300915,
292729,
317306,
284540,
292734,
325512,
276365,
358292,
284564,
317332,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
284585,
317353,
276395,
292784,
358326,
161718,
276410,
276411,
358330,
276418,
301009,
301011,
301013,
292823,
301015,
301017,
358360,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
194654,
178273,
309346,
194657,
309348,
350308,
309350,
227426,
309352,
350313,
309354,
301163,
350316,
194660,
227430,
276583,
276590,
350321,
284786,
276595,
301167,
350325,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
309450,
301258,
276685,
309455,
276689,
309462,
301272,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
235858,
276829,
276833,
391523,
276836,
276843,
293227,
276848,
293232,
186744,
211324,
227709,
285061,
317833,
178572,
285070,
285077,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
342541,
113167,
309779,
317971,
309781,
277011,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
23094,
277054,
219714,
129603,
318020,
301636,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170619,
309885,
309888,
277122,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
334488,
318108,
285340,
318110,
227998,
137889,
383658,
285357,
318128,
277170,
342707,
318132,
154292,
293555,
277173,
277177,
277181,
318144,
277187,
277191,
277194,
277196,
277201,
137946,
113378,
228069,
277223,
342760,
285417,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
301884,
310080,
293696,
277317,
277322,
293706,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
310134,
15224,
236408,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
276586,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
285690,
293882,
302075,
244731,
121850,
293887,
277504,
277507,
138246,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
277583,
203857,
310355,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
285817,
367737,
302205,
285821,
392326,
285831,
253064,
302218,
294026,
285835,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
64768,
310531,
285958,
138505,
228617,
318742,
277798,
130345,
113964,
285997,
285999,
113969,
318773,
318776,
286010,
417086,
286016,
302403,
294211,
384328,
294221,
326991,
294223,
179547,
146784,
302436,
294246,
327015,
310632,
327017,
351594,
351607,
310648,
310651,
310657,
310659,
351619,
294276,
327046,
253320,
310665,
318858,
310672,
351633,
310689,
130468,
228776,
277932,
310703,
310710,
130486,
310712,
310715,
302526,
228799,
302534,
245191,
310727,
64966,
163272,
292968,
302541,
302543,
310737,
228825,
163290,
310749,
310755,
187880,
310764,
286188,
310772,
40440,
212472,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
146977,
187939,
40484,
294435,
40486,
286246,
40488,
278057,
294439,
40491,
294440,
294443,
294445,
310831,
245288,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
343757,
212690,
278227,
286420,
319187,
229076,
286425,
319194,
278235,
278238,
229086,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
40851,
294811,
319390,
237470,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
3e80487a7657b2654128d8c6b96f537e0ecde8f8 | 35ab9ef7c03f488f1466633ef2307d55666012fc | /NewDawn/NewDawn/ViewControllers/MainPageViewControllers/MainPageViewModels.swift | 90e2b08c57ef069be8982f23a8e8fd8f6f3daeb1 | [] | no_license | new-dawn/new_dawn_ios_playground | 3f59b2ea7eabf8e21922b9b59c484758048e538d | 52481c565bbff4dac91f16113bb16448a8af9f6f | refs/heads/master | 2020-04-07T15:27:03.778057 | 2019-07-29T01:05:28 | 2019-07-29T01:05:28 | 158,485,956 | 0 | 1 | null | 2019-07-29T01:05:29 | 2018-11-21T03:31:45 | Swift | UTF-8 | Swift | false | false | 14,112 | swift | //
// MainPageViewModels.swift
// NewDawn
//
// Created by 汤子毅 on 2019/1/5.
// Copyright © 2019 New Dawn. All rights reserved.
//
import Foundation
import UIKit
// An MVVM design of Main Page display
// The main page has different type of sections
// image, basic info, question answers, instagram/linkedin etc.
enum MainPageViewModelItemType: Int {
case MAIN_IMAGE = 1
case BASIC_INFO = 2
case QUESTION_ANSWER = 3
case INSTAGRAM = 4
case LINKEDIN = 5
case LIKE_IMAGE = 6
case LIKE_ANSWER = 7
case LIKE_ME = 8
}
enum UserActionType: Int{
case LIKE = 1
case BLOCK = 2
case MATCH = 3
case RELATIONSHIP = 4
case MESSAGE = 5
case REQUEST_TAKEN = 6
case UNMATCH = 7
case ACCEPT_TAKEN = 8
case ALREADY_TAKEN = 9
case UNTAKEN = 10
}
enum EntityType: Int{
case NONE = 0
case MAIN_IMAGE = 1
case BASIC_INFO = 2
case QUESTION_ANSWER = 3
}
// Standardize the requirement for each section
protocol MainPageViewModellItem: Codable {
var type: MainPageViewModelItemType { get }
var rowCount: Int { get }
var sectionTitle: String { get }
var likable: Bool { get }
var rowHeight: Int { get }
}
// Specify some default values
extension MainPageViewModellItem {
var rowCount: Int {
return 1
}
var likable: Bool {
return false
}
var rowHeight: Int {
return 50
}
}
// ---------- Build Main Page View Model ----------
class MainPageViewModel: NSObject {
var items = [MainPageViewModellItem]()
var image_items = [MainImageViewModelItem]()
var basic_info_item = [BasicInfoViewModelItem]()
var question_answer_items = [QuestionAnswerViewModelItem]()
var like_me_items = [LikeMeViewModelItem]()
init(userProfile: UserProfile, include_liked_info: Bool = true) {
super.init()
// Append image items
if !userProfile.mainImages.isEmpty {
for index in 0...userProfile.mainImages.count-1 {
image_items.append(
fetchMainImage(userProfile: userProfile, index: index))
}
}
// Append basic info
basic_info_item.append(fetchBasicInfo(userProfile: userProfile))
// Append question answers
if !userProfile.questionAnswers.isEmpty {
for index in 0...userProfile.questionAnswers.count-1 {
question_answer_items.append(
fetchQuestionAnswer(userProfile: userProfile, index: index))
}
}
// Append like me info
if include_liked_info == true, let info = fetchLikeMe(userProfile: userProfile) {
like_me_items.append(info)
}
// Apply some order on all items
self.sectionSort()
}
func fetchBasicInfo(userProfile: UserProfile) -> BasicInfoViewModelItem {
let basicInfo = BasicInfoViewModelItem(
firstName: userProfile.firstname,
degree: userProfile.degree,
drink: userProfile.drink,
height: userProfile.height,
location: userProfile.location,
hometown: userProfile.hometown,
school: userProfile.school,
smoke: userProfile.smoke,
employer: userProfile.employer,
jobTitle: userProfile.jobTitle,
age: userProfile.age
)
// Populate basic info field with existed data in user profile
return basicInfo
}
func fetchQuestionAnswer(userProfile: UserProfile, index: Int) -> QuestionAnswerViewModelItem {
let questionAnswer = QuestionAnswerViewModelItem(
question: userProfile.questionAnswers[index].question.question,
answer: userProfile.questionAnswers[index].answer,
name: userProfile.firstname + " " + userProfile.lastname,
user_id: userProfile.user_id,
id: userProfile.questionAnswers[index].id,
liked_me: userProfile.likedInfoFromYou.liked_entity_type != 0
)
return questionAnswer
}
func fetchMainImage(userProfile: UserProfile, index: Int) -> MainImageViewModelItem {
let mainImage = MainImageViewModelItem(
mainImageURL: userProfile.mainImages[index].image_url,
caption: userProfile.mainImages[index].caption,
name: userProfile.firstname + " " + userProfile.lastname,
age: userProfile.age,
jobTitle: userProfile.jobTitle,
employer: userProfile.employer,
isFirst: index == 0,
user_id: userProfile.user_id,
id: userProfile.mainImages[index].id,
liked_me: userProfile.likedInfoFromYou.liked_entity_type != 0
)
return mainImage
}
func fetchLikeMe(userProfile: UserProfile) -> LikeMeViewModelItem? {
// Append liked banner on top of the view
let likedInfo = userProfile.likedInfoFromYou
if hasLikedInfo(likedInfo: likedInfo) {
return LikeMeViewModelItem(
LikeMeInfo(
userProfile.mainImages.first?.image_url ?? UNKNOWN,
yourFirstName: userProfile.firstname,
likedInfo: likedInfo
)
)
}
return nil
}
func hasLikedInfo(likedInfo: LikedInfo) -> Bool {
if likedInfo.liked_entity_type == EntityType.MAIN_IMAGE.rawValue || likedInfo.liked_entity_type == EntityType.QUESTION_ANSWER.rawValue {
return true
}
return false
}
func sectionSort() -> Void {
// The first image
if image_items.count > 0 {
items.append(image_items[0])
image_items.removeFirst()
}
if like_me_items.count > 0 {
items.append(like_me_items[0])
like_me_items.removeFirst()
}
// Ordering of items
while true {
var hasNext = 0
if basic_info_item.count > 0 {
items.append(basic_info_item[0])
basic_info_item.removeFirst()
hasNext = 1
}
if image_items.count > 0 {
items.append(image_items[0])
image_items.removeFirst()
hasNext = 1
}
if question_answer_items.count > 0 {
items.append(question_answer_items[0])
question_answer_items.removeFirst()
hasNext = 1
}
if image_items.count > 0 {
items.append(image_items[0])
image_items.removeFirst()
hasNext = 1
}
if hasNext == 0 {
break
}
}
}
}
extension MainPageViewModel: UITableViewDataSource, UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items[section].rowCount
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = items[indexPath.section]
switch item.type {
case .QUESTION_ANSWER:
if let cell = tableView.dequeueReusableCell(withIdentifier: "questionAnswerCell", for: indexPath) as? QuestionAnswerViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
case .MAIN_IMAGE:
if let cell = tableView.dequeueReusableCell(withIdentifier: "mainImageViewCell", for: indexPath) as? MainImageViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
case .BASIC_INFO:
if let cell = tableView.dequeueReusableCell(withIdentifier: "basicInfoCell", for: indexPath) as? BasicInfoViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
case .INSTAGRAM:
return UITableViewCell()
case .LINKEDIN:
return UITableViewCell()
case .LIKE_IMAGE:
if let cell = tableView.dequeueReusableCell(withIdentifier: "likeImageCell", for: indexPath) as? LikeImageViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
case .LIKE_ANSWER:
if let cell = tableView.dequeueReusableCell(withIdentifier: "likeAnswerCell", for: indexPath) as? LikeAnswerViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
case .LIKE_ME:
if let cell = tableView.dequeueReusableCell(withIdentifier: "likeMeViewCell", for: indexPath) as? LikeMeViewCell {
cell.item = item
cell.selectionStyle = .none
return cell
}
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return CGFloat(items[indexPath.section].rowHeight)
}
}
// ---------- View Model Item Definitions ----------
class LikeImageViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .LIKE_IMAGE
}
var sectionTitle: String {
return "Like Image"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 150
}
// Customized Attributes
var likerFirstName: String
var likedImageURL: String
var likedMessage: String
init(likerFirstName: String, likedImageURL: String, likedMessage: String) {
self.likerFirstName = likerFirstName
self.likedImageURL = likedImageURL
self.likedMessage = likedMessage
}
}
class LikeAnswerViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .LIKE_ANSWER
}
var sectionTitle: String {
return "Like Answer"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 150
}
// Customized Attributes
var likerFirstName: String
var likedAnswer: String
var likedMessage: String
init(likerFirstName: String, likedAnswer: String, likedMessage: String) {
self.likerFirstName = likerFirstName
self.likedAnswer = likedAnswer
self.likedMessage = likedMessage
}
}
class LikeMeViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .LIKE_ME
}
var sectionTitle: String {
return "Like Me"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 80
}
// Customized Attributes
var likeMeInfo: LikeMeInfo
init(_ likeMeInfo: LikeMeInfo) {
self.likeMeInfo = likeMeInfo
}
}
class BasicInfoViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .BASIC_INFO
}
var sectionTitle: String {
return "Basic Info"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 330
}
// Customized Attributes
var firstName: String
var degree: String
var drink: String
var height: Int
var location: String
var hometown: String
var school: String
var smoke: String
var employer: String
var jobTitle: String
var age: Int
init(firstName: String, degree: String, drink: String, height: Int, location: String, hometown: String, school: String, smoke: String, employer: String, jobTitle: String, age: Int) {
self.firstName = firstName
self.degree = degree
self.drink = drink
self.height = height
self.location = location
self.hometown = hometown
self.school = school
self.smoke = smoke
self.employer = employer
self.jobTitle = jobTitle
self.age = age
}
}
class QuestionAnswerViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .QUESTION_ANSWER
}
var sectionTitle: String {
return "Question Answer"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 210
}
// Customized Attributes
var question: String
var answer: String
var name: String
var user_id: String
var id: Int
var liked_me: Bool
init(question: String, answer: String, name: String, user_id: String, id: Int, liked_me: Bool) {
self.question = question
self.answer = answer
self.name = name
self.user_id = user_id
self.id = id
self.liked_me = liked_me
}
}
class MainImageViewModelItem: MainPageViewModellItem {
// Required Attributes
var type: MainPageViewModelItemType {
return .MAIN_IMAGE
}
var sectionTitle: String {
return "Image"
}
var rowCount: Int {
return 1
}
var rowHeight: Int {
return 380
}
// Customized Attributes
var mainImageURL: String
var caption: String
var name: String
var age: Int
var jobTitle: String
var employer: String
var isFirst: Bool
var user_id: String
var id: Int
var liked_me: Bool
init(mainImageURL: String, caption: String, name: String, age: Int, jobTitle: String, employer: String, isFirst: Bool, user_id: String, id: Int, liked_me: Bool) {
self.mainImageURL = mainImageURL
self.caption = caption
self.name = name
self.age = age
self.jobTitle = jobTitle
self.employer = employer
self.isFirst = isFirst
self.user_id = user_id
self.id = id
self.liked_me = liked_me
}
}
| [
-1
] |
209d9bfbeb5ca6c8a2585c6ed969a6cb8324e12a | ef910afca59536efed20466d620f36fac855265f | /Panagram/main.swift | 5e29eaf98e119bd87448189c293e2adfe17aa328 | [] | no_license | atnon1/Panagram | b1ab9f8a12057f07ad552a078bf3c238c45fd985 | b864d2e247f227629a289541896b6aea66ca1775 | refs/heads/main | 2023-03-26T06:04:04.715197 | 2021-03-21T11:49:55 | 2021-03-21T11:49:55 | 349,982,557 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 222 | swift | //
// main.swift
// Panagram
//
// Created by Anton Makeev on 20.03.2021.
//
import Foundation
let panagram = Panagram()
if CommandLine.argc < 2 {
panagram.interactiveMode()
} else {
panagram.staticMode()
}
| [
-1
] |
014f0be2ec3015d8567886d9252ef25c2fd0a090 | 4fe1c0e1c0b5765ef7d8f7434504ba236d54310e | /Trackee/Controllers/AddEditCategoryViewController.swift | a0885ee332f09c5d3f2f90cf4013ee67c21c5aac | [] | no_license | apramodya/Trackee | 72b3878fb80cd62e1c35befe493919a4f8fc2464 | 3165ec45ae327d663cd9dfebdd96152c3e25d597 | refs/heads/master | 2020-05-05T06:44:09.063437 | 2019-04-21T12:36:40 | 2019-04-21T12:36:40 | 179,799,135 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,803 | swift | //
// AddEditCategoryViewController.swift
// Trackee
//
// Created by Pramodya Abeysinghe on 7/4/19.
// Copyright © 2019 Pramodya. All rights reserved.
//
import UIKit
import RealmSwift
class AddEditCategoryViewController: UIViewController, UINavigationControllerDelegate {
// IBOutlets
@IBOutlet weak var typePicker: UIPickerView!
@IBOutlet weak var categoryName: UITextField!
@IBOutlet weak var saveBtn: UIButton!
// variables
let realm = try! Realm()
var selectedType = types[0]
var categories: Results<Category>?
var selectedCategory: Category!
override func viewDidLoad() {
super.viewDidLoad()
// Button
saveBtn.layer.cornerRadius = 5
// Do any additional setup after loading the view.
typePicker.delegate = self
typePicker.dataSource = self
// load data if edit category
if let categoryToEdit = selectedCategory {
saveBtn.setTitle("Edit", for: .normal)
categoryName.text = categoryToEdit.name
if categoryToEdit.type == "Expence" {
typePicker.selectRow(1, inComponent: 0, animated: true)
selectedType = categoryToEdit.type
} else {
typePicker.selectRow(0, inComponent: 0, animated: true)
selectedType = categoryToEdit.type
}
}
// dismiss keyboard
self.hideKeyboard()
}
@IBAction func saveCategory(_ sender: Any) {
guard let category = categoryName.text, category.isNotEmpty else {
simpleAlert(title: "Error", message: "Category name is missing", toFocus: categoryName)
return
}
// add new
if selectedCategory == nil {
let newCategory = Category(name: category.capitalized,
type: selectedType)
self.saveCategory(cateogry: newCategory)
} else {
// edit
let updatingCategory = Category(categoryID: selectedCategory.categoryID,
name: category.capitalized,
type: selectedType)
self.updateCategory(cateogry: updatingCategory)
}
selectedCategory = nil
}
// save category
func saveCategory(cateogry: Category) {
do {
try realm.write {
realm.add(cateogry, update: false)
}
} catch {
debugPrint("Error in saving category. >>>> \(error.localizedDescription)")
return
}
navigationController?.popViewController(animated: true)
}
// update category
func updateCategory(cateogry: Category) {
do {
try realm.write {
realm.add(cateogry, update: true)
}
} catch {
debugPrint("Error in updating category. >>>> \(error.localizedDescription)")
return
}
navigationController?.popViewController(animated: true)
}
}
extension AddEditCategoryViewController: UIPickerViewDelegate, UIPickerViewDataSource {
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return types.count
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return types[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
selectedType = types[row]
}
}
| [
-1
] |
5cff922c5688275bd5d92a6d0a63f42e95bb0a7e | d0d9a41742927f4caa49322fb2bb6b0d2db5b58a | /Big Time Farts/BigTomFartsTableViewCell.swift | 12ec659c98b946833504b6df033f00f10a49a56d | [] | no_license | WikipediaBrown/Big-Time-Farts | 5bfdcd9525ed1fc9cccc7df26b4f5ebe2b103e12 | ae6d781a2b2b355f815d6a83ec3af2b0d15df1ce | refs/heads/master | 2021-01-19T06:40:54.047607 | 2016-07-25T08:44:59 | 2016-07-25T08:44:59 | 61,837,704 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 11,889 | swift | //
// BigTomFartsTableViewCell.swift
// Big Time Farts
//
// Created by Perris Davis on 6/25/16.
// Copyright © 2016 Wikipedia Brown. All rights reserved.
//
import UIKit
import AVFoundation
var playSaveStackView: UIStackView!
var fartRecordingSession = AVAudioSession.sharedInstance()
class BigTomFartsTableViewCell: UITableViewCell, AVAudioRecorderDelegate {
var stackView: UIStackView!
// var fartRecordingSession: AVAudioSession!
var fartRecorder: AVAudioRecorder!
var playRecordedFartButton: UIButton!
var saveRecordedFartButton: UIButton!
var fartPlayer: AVAudioPlayer!
let bigTimeFartsLogo: UIImageView = {
let logo = UIImageView()
logo.image = UIImage(named: "heart-full")
logo.contentMode = UIViewContentMode.ScaleAspectFit
logo.clipsToBounds = true
logo.userInteractionEnabled = true
logo.translatesAutoresizingMaskIntoConstraints = false
return logo
}()
let recordFart: UIButton = {
let button = UIButton()
button.backgroundColor = .clearColor()
button.layer.borderColor = primaryColor.CGColor
button.layer.borderWidth = 2
button.layer.cornerRadius = 17
button.setTitle("Record your own fart", forState: .Normal)
button.setTitleColor(primaryColor, forState: .Normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: "BigTomFartsCell")
do {
try fartRecordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try fartRecordingSession.setActive(true)
try fartRecordingSession.overrideOutputAudioPort(AVAudioSessionPortOverride.Speaker)
fartRecordingSession.requestRecordPermission() {[unowned self] (allowed: Bool) -> Void in
dispatch_async(dispatch_get_main_queue()) {
if allowed {
self.activateRecordButton()
} else {
self.deactivateRecordButton()
}
}
}
} catch {
self.deactivateRecordButton()
}
stackView = UIStackView()
stackView.spacing = 30
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.distribution = UIStackViewDistribution.FillEqually
stackView.alignment = UIStackViewAlignment.Center
stackView.axis = .Vertical
addSubview(stackView)
addSubview(bigTimeFartsLogo)
let tapped = UITapGestureRecognizer(target: self, action: #selector(logoTapped))
bigTimeFartsLogo.addGestureRecognizer(tapped)
backgroundColor = backColor
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[bigTimeFartsLogo]-|", options: NSLayoutFormatOptions.AlignAllCenterX, metrics: nil, views: ["bigTimeFartsLogo": bigTimeFartsLogo]))
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[stackView]-|", options: NSLayoutFormatOptions.AlignAllCenterX, metrics: nil, views: ["stackView": stackView]))
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|-[bigTimeFartsLogo]-[stackView]-|", options: NSLayoutFormatOptions.AlignAllCenterX, metrics: nil, views: ["bigTimeFartsLogo": bigTimeFartsLogo, "stackView": stackView]))
setupViews()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupViews() {
//stackView.addArrangedSubview(bigTimeFartsLogo)
stackView.addArrangedSubview(recordFart)
recordFart.addTarget(self, action: #selector(BigTomFartsTableViewCell.recordFartTapped), forControlEvents: .TouchUpInside)
playSaveStackView = UIStackView()
playSaveStackView.spacing = 10
playSaveStackView.translatesAutoresizingMaskIntoConstraints = false
playSaveStackView.hidden = true
playSaveStackView.alpha = 0
playSaveStackView.axis = .Horizontal
// playSaveStackView.
stackView.addArrangedSubview(playSaveStackView)
playRecordedFartButton = UIButton()
playRecordedFartButton.backgroundColor = primaryColor
playRecordedFartButton.translatesAutoresizingMaskIntoConstraints = false
playRecordedFartButton.setAttributedTitle(makeButtonTitle("Tap to Play"), forState: .Normal)
playRecordedFartButton.layer.borderWidth = 2
playRecordedFartButton.layer.borderColor = primaryColor.CGColor
playRecordedFartButton.layer.cornerRadius = 17
playRecordedFartButton.contentEdgeInsets = UIEdgeInsets(top: 20.0, left: 30.0, bottom: 20.0, right: 30.0)
playRecordedFartButton.addTarget(self, action: #selector(playTapped), forControlEvents: .TouchUpInside)
playSaveStackView.addArrangedSubview(playRecordedFartButton)
saveRecordedFartButton = UIButton()
saveRecordedFartButton.backgroundColor = primaryColor
saveRecordedFartButton.translatesAutoresizingMaskIntoConstraints = false
saveRecordedFartButton.setAttributedTitle(makeButtonTitle("Save Fart"), forState: .Normal)
saveRecordedFartButton.layer.borderWidth = 2
saveRecordedFartButton.layer.borderColor = primaryColor.CGColor
saveRecordedFartButton.layer.cornerRadius = 17
saveRecordedFartButton.contentEdgeInsets = UIEdgeInsets(top: 20.0, left: 40.0, bottom: 20.0, right: 40.0)
saveRecordedFartButton.addTarget(self, action: #selector(saveTapped), forControlEvents: .TouchUpInside)
playSaveStackView.addArrangedSubview(saveRecordedFartButton)
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[v0]-|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": recordFart]))
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[v0]-[v1]-|", options: NSLayoutFormatOptions(), metrics: nil, views: ["v0": playRecordedFartButton, "v1": saveRecordedFartButton]))
}
class func getDocumentsDirectory() -> NSString {
let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) as [String]
let documentsDirectory = paths[0]
return documentsDirectory
}
class func getFartURL() -> NSURL {
let audioFilename = getDocumentsDirectory().stringByAppendingPathComponent("fart.m4a")
let audioURL = NSURL(fileURLWithPath: audioFilename)
return audioURL
}
func activateRecordButton() {
print("poop")
}
func deactivateRecordButton() {
print("crap")
}
func recordFartTapped() {
if fartRecorder == nil {
startRecording()
} else {
finishRecording(success: true)
}
}
func playTapped() {
let audioURL = BigTomFartsTableViewCell.getFartURL()
do {
fartPlayer = try AVAudioPlayer(contentsOfURL: audioURL)
fartPlayer.play()
} catch {
let ac = UIAlertController(title: "Playback failed", message: "There was a problem playing your whistle; please try re-recording.", preferredStyle: .Alert)
ac.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
//presentViewController(ac, animated: true, completion: nil)
}
}
func saveTapped() {
}
func startRecording() {
recordFart.backgroundColor = secondaryColor
recordFart.layer.borderColor = secondaryColor.CGColor
recordFart.setTitleColor(.whiteColor(), forState: .Normal)
recordFart.setTitle("Tap to Stop", forState: .Normal)
let fartURL = BigTomFartsTableViewCell.getFartURL()
let fartSettings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVEncoderBitRateKey: 320000,
AVSampleRateKey: 44100.0,
AVNumberOfChannelsKey: 2 as NSNumber,
AVEncoderAudioQualityKey: AVAudioQuality.Max.rawValue
]
do {
fartRecorder = try AVAudioRecorder(URL: fartURL, settings: fartSettings)
fartRecorder.delegate = self
fartRecorder.record()
} catch {
finishRecording(success: false)
}
if !playRecordedFartButton.hidden {
UIView.animateWithDuration(0.35) { [unowned self] in
self.playRecordedFartButton.hidden = true
self.playRecordedFartButton.alpha = 0
self.saveRecordedFartButton.hidden = true
self.saveRecordedFartButton.alpha = 0
playSaveStackView.hidden = true
playSaveStackView.alpha = 0
}
}
}
func finishRecording(success success: Bool) {
recordFart.backgroundColor = .clearColor()
recordFart.setTitleColor(secondaryColor, forState: .Normal)
fartRecorder.stop()
fartRecorder = nil
if success {
recordFart.setTitle("Tap to Re-record", forState: .Normal)
recordFart.layer.borderColor = primaryColor.CGColor
if playRecordedFartButton.hidden {
UIView.animateWithDuration(0.35) { [unowned self] in
self.playRecordedFartButton.hidden = false
self.playRecordedFartButton.alpha = 1
self.saveRecordedFartButton.hidden = false
self.saveRecordedFartButton.alpha = 1
playSaveStackView.hidden = false
playSaveStackView.alpha = 1
}
}
} else {
recordFart.setTitle("Tap to Record", forState: .Normal)
recordFart.layer.borderColor = primaryColor.CGColor
let ac = UIAlertController(title: "Record failed", message: "There was a problem recording your whistle; please try again.", preferredStyle: .Alert)
ac.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
//presentViewController(ac, animated: true, completion: nil)
}
}
func audioRecorderDidFinishRecording(recorder: AVAudioRecorder, successfully flag: Bool) {
if !flag {
finishRecording(success: false)
}
}
func logoTapped() {
let documentDirectory = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let originPath = documentDirectory.URLByAppendingPathComponent(defaults.objectForKey("defaultFart") as! String).absoluteString
do {
self.fartPlayer = try AVAudioPlayer(contentsOfURL: NSURL(string: originPath)!)
self.fartPlayer.play()
} catch {
do {
self.fartPlayer = try AVAudioPlayer(contentsOfURL: NSURL(string: defaults.objectForKey("defaultFart") as! String)!)
self.fartPlayer.play()
} catch {
print("Error getting the fart file: \(error)")
}
print("Error getting the fart file: \(error)")
}
}
}
| [
-1
] |
1bb15ad344c76b7519b4f18593924a0f17bdbbcb | 2a0e702b0a4405d1ebcd53508928fc68fb10721a | /IOSCALC/IOSCALC/SceneDelegate.swift | b61f8a65ba1e71d29137a952b63907f5d31dd561 | [] | no_license | clos619/IOSCalculator | dd064a79fac085268fb2ad8f0b734e3666833291 | cd7364fbb2dfab88f1a53034a3006ae68a161afd | refs/heads/master | 2023-01-18T21:05:24.682590 | 2020-11-27T05:29:52 | 2020-11-27T05:29:52 | 315,759,190 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,292 | swift | //
// SceneDelegate.swift
// IOSCALC
//
// Created by Field Employee on 11/25/20.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
393277,
376906,
327757,
254032,
368728,
180314,
254045,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
377047,
418008,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
393613,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
164362,
328207,
410129,
393748,
262679,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
385671,
148106,
213642,
377485,
352919,
98969,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
344777,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
115661,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
361490,
386070,
271382,
336922,
345119,
377888,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
345172,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
361594,
410746,
214150,
345224,
386187,
345247,
361645,
345268,
402615,
361657,
337093,
402636,
328925,
165086,
66783,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
328967,
345377,
345380,
353572,
345383,
263464,
337207,
345400,
378170,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419543,
419545,
345819,
419548,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
362274,
378664,
354107,
345916,
354112,
370504,
329545,
345932,
370510,
354132,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
247760,
346064,
346069,
419810,
329699,
354275,
190440,
354314,
346140,
436290,
395340,
378956,
436307,
338005,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
387314,
436474,
321787,
379135,
411905,
411917,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
321911,
420237,
379279,
272787,
354728,
338353,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
330254,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
346736,
191093,
346743,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
355029,
264919,
256735,
338661,
264942,
363252,
338680,
264965,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
388348,
339199,
396552,
175376,
175397,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
437588,
331094,
396634,
175451,
437596,
429408,
175458,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
216518,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
208399,
380433,
175637,
405017,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
224885,
224888,
224891,
224895,
372354,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
257869,
257872,
225105,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
438438,
225448,
438441,
356521,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
397572,
389381,
381212,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
201030,
348489,
332107,
151884,
430422,
348503,
250201,
250203,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
389507,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
266688,
324032,
201158,
340452,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
258723,
332455,
332460,
389806,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
373499,
348926,
389927,
348979,
152371,
348983,
340792,
398141,
357202,
389971,
357208,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
373635,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
357411,
250915,
250917,
169002,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
341072,
349268,
177238,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
210132,
333016,
210139,
210144,
218355,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
349762,
333396,
374359,
333400,
366173,
423529,
423533,
210547,
415354,
333440,
267910,
267929,
333512,
259789,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
341877,
399222,
325494,
333690,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
382898,
350153,
358348,
333777,
219094,
399318,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
219144,
268299,
333838,
350225,
186388,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
268435,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
350449,
375027,
358645,
350459,
350462,
350465,
350469,
268553,
350477,
268560,
350481,
432406,
350487,
325915,
350491,
325918,
350494,
325920,
350500,
194854,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
334224,
268702,
342431,
375209,
375220,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
416255,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
334425,
326240,
375401,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
433001,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
252801,
260993,
351105,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
252838,
359335,
211885,
252846,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
384108,
367724,
187503,
343155,
384115,
212095,
351366,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
244917,
384182,
367801,
384189,
384192,
351424,
343232,
367817,
244938,
384202,
253132,
326858,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
359887,
359891,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
253445,
359948,
359951,
245295,
359984,
343610,
400977,
400982,
179803,
155241,
245358,
155255,
155274,
368289,
245410,
425639,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
fb6cc50e225ae30c02731196cc31bf633a8333af | b30511f539ebf4fb50977c1cc18d7b20df5c757c | /MSTripPlanner/MSTripPlanner/Helpers/MapHelper.swift | d774319a171e2e97655b91c41c3ec3f339c58905 | [] | no_license | MakeSchool-17/trip-planner-ios-client-beingadrian | b21d1e6c9d327e9437bbd76a4662a4885a480ca9 | 01b44ed2be96a32618f6b1c459a847843bec0199 | refs/heads/master | 2021-01-10T17:03:50.759560 | 2015-11-05T22:54:44 | 2015-11-05T22:54:44 | 44,568,468 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,323 | swift | //
// MapHelper.swift
// MSTripPlanner
//
// Created by Adrian Wisaksana on 10/27/15.
// Copyright © 2015 BeingAdrian. All rights reserved.
//
import Foundation
import GoogleMaps
import MapKit
class MapHelper {
// MARK: Properties
static let placesClient = GMSPlacesClient()
// MARK: Methods
static func requestUserPermission() {
let locationManager = CLLocationManager()
locationManager.requestWhenInUseAuthorization()
}
static func getCurrentPlace(completion: (coordinate: CLLocationCoordinate2D) -> Void) {
requestUserPermission()
placesClient.currentPlaceWithCallback() {
(placeLikelihoodList: GMSPlaceLikelihoodList?, error: NSError?) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let placeLicklihoodList = placeLikelihoodList {
let place = placeLicklihoodList.likelihoods.first?.place
if let place = place {
completion(coordinate: place.coordinate)
}
}
}
}
static func getPlacesSearchResults(string: String, completion: (results: [GMSAutocompletePrediction]) -> Void) {
placesClient.autocompleteQuery(string, bounds: nil, filter: nil) {
(results, error: NSError?) -> Void in
if let error = error {
print("Autocomplete error: \(error)")
}
if let results = results as? [GMSAutocompletePrediction] {
completion(results: results)
}
}
}
static func getPlaceByID(id: String, completion: (place: GMSPlace) -> Void) {
placesClient.lookUpPlaceID(id) {
(place: GMSPlace?, error: NSError?) -> Void in
if let error = error {
print("Lookup place id query error: \(error.localizedDescription)")
return
}
if let place = place {
completion(place: place)
}
}
}
} | [
-1
] |
0567c82befce4ea3afd7e5aec9abe3c7e9236457 | e64740cc746343418ee8b1573e988bab7a39e7f5 | /eQueue/Controllers/Auth&SignUp/AuthViewController.swift | b947e68a9f7fa5340caa61c2a5f544a8908cf3b4 | [] | no_license | gkashin/eQueue | d8193996a74c052a8d4054bfdea5c46d320df3b2 | 9df3ea341c7079930a11c334359a1662e48fdbe9 | refs/heads/master | 2022-12-26T14:30:12.122625 | 2020-10-04T15:42:05 | 2020-10-04T15:42:05 | 251,020,857 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,866 | swift | //
// AuthViewController.swift
// eQueue
//
// Created by Георгий Кашин on 04.03.2020.
// Copyright © 2020 Georgii Kashin. All rights reserved.
//
import UIKit
class AuthViewController: UIViewController {
// MARK: Delegates
weak var updateUIDelegate: UpdateUIDelegate?
// MARK: VCs
let loginVC = LoginViewController()
let signUpVC = SignUpViewController()
// MARK: Image Views
let logoImageView = UIImageView(image: #imageLiteral(resourceName: "queue_logo"), contentMode: .scaleAspectFill)
// MARK: Labels
let alreadyOnboardLabel = UILabel(text: "Уже зарегистрированы?")
let emailLabel = UILabel(text: "Или зарегистрируйтсь с")
let googleLabel = UILabel(text: "Начните с")
// MARK: Buttons
let emailButton = UIButton(title: "Email", backgroundColor: .buttonDark(), titleColor: .white, isShadow: false)
let googleButton = UIButton(title: "Google", backgroundColor: .white, titleColor: .black, isShadow: true)
let loginButton = UIButton(title: "Войти", backgroundColor: .white, titleColor: .buttonRed(), isShadow: true)
// MARK: UIViewController Methods
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
loginVC.delegate = self
signUpVC.delegate = self
// Targets
emailButton.addTarget(self, action: #selector(emailButtonTapped), for: .touchUpInside)
loginButton.addTarget(self, action: #selector(loginButtonTapped), for: .touchUpInside)
googleButton.addTarget(self, action: #selector(googleButtonTapped), for: .touchUpInside)
}
}
// MARK: - OBJC Methods
extension AuthViewController {
// MARK: Button's Targets
@objc private func emailButtonTapped() {
present(signUpVC, animated: true)
}
@objc private func loginButtonTapped() {
present(loginVC, animated: true)
}
@objc private func googleButtonTapped() {
// TODO: Google Auth
}
}
// MARK: - UI
extension AuthViewController {
private func setupUI() {
googleButton.customizeGoogleButton()
view.backgroundColor = .white
setupConstraints()
}
private func setupConstraints() {
logoImageView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(logoImageView)
NSLayoutConstraint.activate([
logoImageView.topAnchor.constraint(equalTo: view.topAnchor, constant: -40),
logoImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor)
])
let googleView = ButtonFormView(label: googleLabel, button: googleButton)
let emailView = ButtonFormView(label: emailLabel, button: emailButton)
let loginView = ButtonFormView(label: alreadyOnboardLabel, button: loginButton)
let stackView = UIStackView(arrangedSubviews: [googleView, emailView, loginView], axis: .vertical, spacing: 40)
stackView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(stackView)
NSLayoutConstraint.activate([
stackView.topAnchor.constraint(equalTo: logoImageView.bottomAnchor, constant: -70),
stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 40),
stackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -40)
])
}
}
// MARK: - AuthNavigatingDelegate
extension AuthViewController: AuthNavigatingDelegate {
func toLoginVC() {
present(loginVC, animated: true)
}
func toSignUpVC() {
present(signUpVC, animated: true)
}
func dismiss() {
dismiss(animated: true) {
self.updateUIDelegate?.updateUI()
}
}
}
| [
-1
] |
7c1e5913436d36004350fee2ef380d0950182ab3 | e3444a2e3c83d9ee6719f057bc4e80c2b386a155 | /iosReminder/iosReminder/Category+CoreDataProperties.swift | c35e1e112b6b60204406a30f6b88bd86cf075594 | [] | no_license | ivanzhujunwei/iosReminder | e62a7c29df625d90c4c9ff6da2afe700aa868ff3 | a73160105383bad4f68afd9b96ddaad09e6be77e | refs/heads/master | 2020-12-07T05:53:25.947203 | 2016-09-14T06:06:42 | 2016-09-14T06:06:42 | 66,899,081 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 754 | swift | //
// Category+CoreDataProperties.swift
// iosReminder
//
// Created by zjw on 11/09/2016.
// Copyright © 2016 FIT5140. 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 Category {
@NSManaged var color: String?
@NSManaged var latitude: NSNumber?
@NSManaged var location: String?
@NSManaged var longitude: NSNumber?
@NSManaged var notifyByArriveOrLeave: NSNumber?
@NSManaged var priority: NSNumber?
@NSManaged var radius: NSNumber?
@NSManaged var title: String?
@NSManaged var toogle: NSNumber?
@NSManaged var reminders: NSSet?
}
| [
-1
] |
f70c5d3cd6908251579e1c04b9c1876781ca6a0d | bb314c9a86eac04191a2db4ae8ef99da55649eab | /TelegramCharts/Extensions/CGFloat.swift | 5e95fdb0e9b37b39681e64bcbefeab0a496a7eaa | [] | no_license | ailinykh/TelegramCharts | 67c2241f808c1d0d6fc3f89d233198beb4fc7e9a | 27d6058d619fbb70d94a91b5359883768cb17500 | refs/heads/master | 2020-04-28T06:40:17.854133 | 2019-04-09T20:44:22 | 2019-04-09T20:44:22 | 175,067,851 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 269 | swift | //
// CGFloat.swift
// TelegramCharts
//
// Created by Anthony Ilinykh on 26/03/2019.
// Copyright © 2019 Anthony Ilinykh. All rights reserved.
//
import UIKit
extension CGFloat {
func rounded02() -> CGFloat {
return (self*100).rounded()/100
}
}
| [
-1
] |
e64c66f7f8f407bc9b1fa02b983d5db88e62907b | a2363e36b38dad63a20c0f8e07fc313ac45449db | /ManyFiles/B/B75.swift | 9951e266d554dc9825ab5a5d73c19161c062f646 | [] | no_license | chkpnt/ManyFiles | 5099224d1354e82212392364dba3963ba2898b1a | 0d2f93408099b0078d055e90e26347432ae228e9 | refs/heads/master | 2021-05-11T01:18:22.123331 | 2018-01-21T18:55:34 | 2018-01-21T18:55:34 | 118,326,560 | 0 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 116 | swift | import Foundation
class B75 {
func someMethod() -> Int {
return Int(arc4random_uniform(100))
}
}
| [
-1
] |
aca73598a4d3a004ad7e1be9544d03c99e6a6b59 | 838489f1cf1ec65f805b0ed17ea6780c0f6dbca0 | /Package.swift | 2aa51ee947909e9d591c13d52a5e13c414077193 | [
"MIT"
] | permissive | mindsnacks/appboy-segment-ios | 3e135208b38a9d9ba36b9fe74b153034b0c42db5 | cffd64ba611f6debd3dcd906b86434d9f9c76781 | refs/heads/master | 2021-09-27T22:59:15.061937 | 2021-04-14T07:45:34 | 2021-04-14T07:45:34 | 64,879,014 | 0 | 0 | NOASSERTION | 2021-09-14T21:43:45 | 2016-08-03T21:00:16 | Objective-C | UTF-8 | Swift | false | false | 1,102 | swift | // swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "Segment-Appboy",
defaultLocalization: "en",
platforms: [
.iOS(.v12)
],
products: [
.library(name: "Full-SDK", targets: ["Full-SDK"]),
.library(name: "Core", targets: ["Core"])
],
dependencies: [
.package(name: "Segment", url: "https://github.com/segmentio/analytics-ios.git", from: "4.1.1"),
.package(name: "Appboy_iOS_SDK", url: "https://github.com/Appboy/appboy-ios-sdk.git", from: "4.0.1"),
],
targets: [
.target(
name: "Full-SDK",
dependencies: [
.product(name: "Segment", package: "Segment"),
.product(name: "AppboyUI", package: "Appboy_iOS_SDK"),
],
publicHeadersPath: ".",
cSettings: [
.headerSearchPath(".")
]
),
.target(
name: "Core",
dependencies: [
.product(name: "Segment", package: "Segment"),
.product(name: "AppboyKit", package: "Appboy_iOS_SDK"),
],
publicHeadersPath: ".",
cSettings: [
.headerSearchPath(".")
]
)
]
)
| [
-1
] |
4f0c9d9aa01dfe5ac73342958b6f5a84837b784a | 41ab05b41e0ace17f992d383cfc23945a8205db1 | /Kizen/Source/Shared/Entities/FruitViewModel.swift | 08e1f9b789552ba4c13df70d34898d5a400acddb | [] | no_license | Melvin24/Kizen | 6c03ee290fdaa64f0e4888549b096217db93c84a | afb6f10924ab046729deec4ff8268c8a6d3a6215 | refs/heads/master | 2021-01-22T03:13:00.662315 | 2018-05-12T14:30:46 | 2018-05-12T14:30:46 | 102,258,564 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,089 | swift | //
// FruitViewModel.swift
// FruitViewer
import UIKit
/// Stuct represented for views to Utilize.
struct FruitViewModel {
let fruitImage: UIImage?
let fruitPrice: String
let fruitWeight: String
let fruitName: String
init(fruit: Fruit) {
fruitImage = fruit.image
var weightInKG = fruit.weight/1000
// Rounding to the nearest 2dp
weightInKG = round(100*weightInKG)/100
let priceInPound = fruit.price/100
if weightInKG < 0 {
fruitWeight = Strings.fruitWeightInvalid
} else {
fruitWeight = Strings.fruitWeightTitle(weight: (String(format: "%.2f", weightInKG)))
}
if priceInPound < 0 {
fruitPrice = Strings.fruitPriceInvalid
} else {
fruitPrice = Strings.fruitPriceTitle(price: (String(format: "%.2f", priceInPound)))
}
let nameOfFruit = fruit.name.lowercased()
fruitName = nameOfFruit.capitalized
}
}
| [
-1
] |
ca6564b9e99bbbc991ee7c9fc9910bd87badd2ec | cc05841ef61c286e71f00909869f94a774d447ac | /PlantApp/Classes/Helpers/LocationService.swift | eda5c34de8fa95fdba4cd4a907b1dacdc3c7b31a | [] | no_license | Ravichandrane/PlantApp | 89b7c528fe279781ba5764e1dc266c6dacf554d8 | c5329f2a2863ddefbb9e505bbf30636b2a7efc36 | refs/heads/master | 2021-01-10T16:14:46.264220 | 2016-01-04T15:55:10 | 2016-01-04T15:55:10 | 47,980,645 | 3 | 1 | null | null | null | null | UTF-8 | Swift | false | false | 3,205 | swift | //
// LocationService.swift
// PO Fleur
//
// Created by Ravichandrane Rajendran on 16/12/15.
// Copyright © 2015 Ravichandrane Rajendran. All rights reserved.
//
import UIKit
import CoreLocation
protocol LocationServiceDelegate: class {
func didFindNewLocation(latitude:Double, longitude:Double, placeName:String)
}
class LocationService: NSObject, CLLocationManagerDelegate {
static let sharedInstance = LocationService()
// MARK: - Variable
var locationManager: CLLocationManager?
var userLatitude: Double?
var userLongitude: Double?
var userPlace: String?
weak var delegate: LocationServiceDelegate?
// MARK: - Init
override init() {
super.init()
self.locationManager = CLLocationManager()
self.locationManager?.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager?.distanceFilter = kCLDistanceFilterNone
self.locationManager?.delegate = self
}
// MARK: - Function
func requestAlawaysAutorization() {
locationManager?.requestAlwaysAuthorization()
}
func startUpdatingLocation() {
self.locationManager?.startUpdatingLocation()
requestAlawaysAutorization()
}
func stopUpdatingLocation() {
self.locationManager?.stopUpdatingLocation()
}
// MARK: - CoreLocation Delegate
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
stopUpdatingLocation()
let location: AnyObject? = (locations as NSArray).lastObject
let currentLocation = location as! CLLocation
let coordinate = currentLocation.coordinate
self.userLatitude = coordinate.latitude
self.userLongitude = coordinate.longitude
let locations = CLLocation(latitude: userLatitude!, longitude: userLongitude!)
CLGeocoder().reverseGeocodeLocation(locations, completionHandler: { (placeUser, error) -> Void in
if error != nil {
NSNotificationCenter.defaultCenter().postNotificationName("AirplaneMode", object: nil)
self.stopUpdatingLocation()
return
}
if placeUser!.count > 0 {
self.stopUpdatingLocation()
let userLocation = placeUser![0]
self.userPlace = userLocation.locality
self.delegate?.didFindNewLocation(self.userLatitude!, longitude: self.userLongitude!, placeName: self.userPlace!)
}
})
}
func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
switch status{
case .AuthorizedAlways:
startUpdatingLocation()
case .NotDetermined:
requestAlawaysAutorization()
case .Restricted, .Denied:
NSNotificationCenter.defaultCenter().postNotificationName("AuthorizationDenied", object: nil)
default:
stopUpdatingLocation()
}
}
}
| [
-1
] |
7ae4c4500dc762ba8c5a3c80c7d2a75a8f60fe13 | 0bb91c5dd0df8da6f561d010b154df5a9136354a | /Swift/Swift2015/JMLearningSwift/AppDelegate.swift | 37cf60e571221ceea80ad6e393101b57d8324aa1 | [] | no_license | xserver/JMSevenLanguages | 013486d94726f1ff4ffa415916600675ccce9380 | a17061944312721d2507ae95a55abdd8afae2a75 | refs/heads/master | 2021-01-10T01:19:30.262093 | 2018-12-24T16:07:37 | 2018-12-24T16:07:37 | 36,585,204 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,534 | swift | //
// AppDelegate.swift
// JMLearningSwift
//
// Created by xserver on 15/4/28.
// Copyright (c) 2015年 https://github.com/xserver. 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.
// Create a window.
window = UIWindow(frame: UIScreen.screens.first!.bounds)
window?.makeKeyAndVisible()
window?.backgroundColor = UIColor.brown
window?.rootViewController = UINavigationController(rootViewController: CatalogCtrl.init())
// !会强制报错,?不处理
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,
278559,
229408,
294950,
229415,
229417,
237613,
229422,
229426,
237618,
229428,
286774,
229432,
286776,
319544,
286791,
237640,
278605,
237646,
311375,
163920,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
237693,
327814,
131209,
417930,
303241,
311436,
319633,
286873,
286876,
311460,
32944,
327862,
286906,
180413,
286910,
131264,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
131314,
286962,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
287003,
287006,
287009,
287012,
287014,
287019,
311598,
262448,
287032,
155966,
278849,
319809,
319810,
319814,
311628,
229709,
287054,
319822,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
65943,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
98756,
278980,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
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,
172609,
172612,
377413,
172614,
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,
287390,
295583,
172702,
230045,
172705,
287394,
172707,
303780,
287398,
287400,
279208,
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,
295685,
230154,
33548,
312077,
295695,
369433,
295707,
328476,
295710,
303914,
279340,
205613,
279353,
230202,
222018,
295755,
377676,
287569,
279383,
279390,
230241,
279394,
303976,
336744,
303985,
328563,
303987,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
213895,
304009,
304007,
304011,
230284,
304013,
213902,
279438,
295822,
189329,
189331,
279445,
58262,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
304063,
238528,
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,
361576,
296040,
164973,
205934,
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,
230752,
312676,
230760,
173418,
230763,
230768,
296305,
230773,
304505,
181626,
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,
230865,
288210,
370130,
222676,
288212,
280021,
288214,
239064,
329177,
288217,
280027,
288218,
288220,
239070,
288224,
288226,
370146,
280036,
288229,
320998,
280038,
288230,
288232,
288234,
280034,
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,
313093,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
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,
288855,
280669,
313438,
280671,
223327,
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,
280891,
289087,
280897,
280900,
239944,
305480,
280906,
239947,
305485,
305489,
379218,
280919,
354653,
313700,
313705,
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,
215526,
166378,
305647,
281075,
174580,
281084,
240124,
305662,
305664,
240129,
305666,
240132,
305668,
281095,
223752,
338440,
150025,
223757,
281102,
223763,
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,
289593,
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,
175134,
322599,
322610,
314421,
281654,
314427,
207937,
314433,
314441,
207949,
322642,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
306354,
142531,
289991,
306377,
249045,
363745,
298216,
126190,
216303,
322801,
257302,
363802,
199976,
199978,
298292,
257334,
298306,
224584,
224587,
224594,
216404,
150870,
224603,
159068,
265568,
281960,
306539,
290161,
216436,
306549,
298358,
306552,
290171,
298365,
290174,
224641,
281987,
265604,
298372,
281990,
298377,
142733,
298381,
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,
257658,
315016,
282249,
290445,
282261,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
282300,
323260,
323266,
282310,
323273,
282319,
306897,
241362,
282328,
298714,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
282402,
315174,
282410,
241450,
306988,
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,
315251,
315249,
315253,
315255,
339838,
282499,
315267,
315269,
241544,
282505,
241546,
241548,
298896,
282514,
298898,
241556,
298901,
282520,
241560,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
241640,
298984,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299006,
282623,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
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,
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,
282931,
176435,
168245,
307510,
315701,
151864,
307512,
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,
291226,
242075,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
283062,
291254,
127417,
291260,
283069,
127421,
127429,
283080,
176592,
315856,
315860,
176597,
283095,
127447,
299481,
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,
234316,
283468,
234319,
242511,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
234338,
242530,
349027,
234344,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
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,
193486,
234446,
193488,
234449,
275406,
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,
234634,
234636,
234640,
275602,
234643,
226453,
324757,
275606,
275608,
234647,
234648,
234650,
308373,
283805,
308379,
234653,
119967,
234657,
300189,
324766,
242852,
283813,
300197,
234664,
275626,
316596,
234687,
316610,
300226,
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,
283973,
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,
144820,
284084,
284087,
292279,
144826,
144828,
144830,
144832,
284099,
144835,
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,
366155,
276043,
317004,
284238,
226895,
284241,
194130,
284243,
276052,
284245,
276053,
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,
276109,
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,
186139,
300828,
300830,
276255,
300832,
300834,
227109,
317221,
186151,
358183,
276268,
194351,
243504,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
284499,
276308,
284502,
178006,
317271,
276315,
292700,
284511,
227175,
292715,
284529,
292721,
300915,
284533,
317306,
284540,
292734,
325512,
169868,
276365,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
292776,
284585,
358312,
276395,
292784,
276402,
161718,
358326,
276410,
358330,
276411,
276418,
276425,
276433,
301009,
301011,
301013,
301015,
358360,
301017,
292828,
276446,
153568,
276448,
276452,
276455,
292843,
276460,
276464,
276466,
227314,
276472,
325624,
317435,
276476,
276479,
276482,
276485,
276490,
292876,
276496,
317456,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
276539,
325692,
178238,
276544,
284739,
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,
227583,
276735,
276739,
211204,
276742,
227596,
325910,
276762,
309530,
342298,
276766,
211232,
276775,
211241,
325937,
325943,
260421,
285002,
276811,
276816,
235858,
276829,
276833,
276836,
276843,
293227,
276848,
293232,
186744,
285051,
211324,
227709,
317833,
178572,
285070,
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,
121352,
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,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
277368,
15224,
236408,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
310179,
293798,
293802,
236460,
277426,
293811,
293817,
293820,
203715,
326603,
293849,
293861,
228327,
228328,
228330,
318442,
228332,
277486,
326638,
318450,
293877,
285686,
302073,
285690,
244731,
121850,
293882,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
7232,
310336,
293956,
277573,
228422,
310344,
277577,
293960,
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,
228526,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
277695,
318657,
302275,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
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,
245191,
163272,
277959,
302534,
310727,
277963,
277966,
302543,
277971,
277975,
286169,
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,
286312,
286313,
40552,
40554,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
278168,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
319171,
302789,
294599,
278216,
294601,
278227,
319187,
229076,
286425,
319194,
278235,
229086,
278238,
286432,
294625,
294634,
302838,
319226,
286460,
171774,
278274,
302852,
302854,
294664,
311048,
319243,
311053,
294682,
278306,
294701,
278320,
319280,
319290,
229192,
302925,
237409,
229239,
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
] |
b90f90b3fe38943ae9f90d1e0555c4cc5d0d21fb | 709d784fced34f595557ab059a79ab35d8636a39 | /Field Survey/SurveyViewController.swift | a238ae81f4dad9d51c45d9802edbf49a789c64d0 | [] | no_license | leeoffir/FieldSurvey | 48537bb2e9388078f48fb5e6c215153ca830fc02 | 68eda4be7a1d76640ff0c6a81d1c2acf329f24d2 | refs/heads/master | 2020-03-08T15:43:09.271405 | 2018-04-06T16:04:45 | 2018-04-06T16:04:45 | 128,219,305 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,599 | swift | //
// SurveyViewController.swift
// Field Survey
//
// Created by Lee Offir on 4/6/18.
// Copyright © 2018 Lee Offir. All rights reserved.
//
import UIKit
class SurveyViewController: UIViewController {
var observation: FieldSurvey?
var dateFormat = DateFormatter()
@IBOutlet weak var SurveyImage: UIImageView!
@IBOutlet weak var matchupLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var descriptionView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
dateFormat.dateStyle = .medium
dateFormat.timeStyle = .medium
SurveyImage.image = observation?.classification.image
matchupLabel.text = observation?.title
descriptionView.text = observation?.description
if let date = observation?.date {
dateLabel.text = dateFormat.string(from: date)
} else {
dateLabel.text = ""
}
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| [
-1
] |
65327928276cb684ffa3bea49c232c9daf6e90b6 | 59224524fee20c30ca411c486f0ddccc2d07b0f5 | /Source/Base/NGEGalleryName.swift | b26f394feef7fe18a40f8ab672c03935df2bb0fd | [] | no_license | BLVudu/NextGenDataManager | 7df5e033d2c499b7be3908fc63294c967f2401fa | fd27283f9df42370fa5231863df013c74219c76c | refs/heads/master | 2021-01-12T15:34:22.244379 | 2017-04-10T23:40:27 | 2017-04-10T23:40:27 | 71,835,916 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,096 | swift | import Foundation
#if (arch(i386) || arch(x86_64)) && os(iOS)
import libxmlSimu
#else
import libxml
#endif
@objc
class NGEGalleryName : NSObject{
var `language`: Bool?
/**
the type's underlying value
*/
var value: String?
func readAttributes(_ reader: xmlTextReaderPtr) {
if let attrValue = xmlTextReaderGetAttribute(reader, "language") {
self.language = (String(cString: attrValue) == "true")
xmlFree(attrValue)
}
}
init(_ reader: xmlTextReaderPtr) {
let _complexTypeXmlDept = xmlTextReaderDepth(reader)
super.init()
self.readAttributes(reader)
var _readerOk = xmlTextReaderRead(reader)
var _currentNodeType = xmlTextReaderNodeType(reader)
var _currentXmlDept = xmlTextReaderDepth(reader)
while(_readerOk > 0 && _currentNodeType != 0/*XML_READER_TYPE_NONE*/ && _complexTypeXmlDept < _currentXmlDept) {
if(_currentNodeType == 1/*XML_READER_TYPE_ELEMENT*/ || _currentNodeType == 3/*XML_READER_TYPE_TEXT*/) {
if let _currentElementNameXmlChar = xmlTextReaderConstLocalName(reader) {
let _currentElementName = String(cString: _currentElementNameXmlChar)
if("#text" == _currentElementName){
if let contentValue = xmlTextReaderConstValue(reader) {
let value = String(cString: contentValue)
self.value = value
}
} else if(true) {
print("Ignoring unexpected in NGEGalleryName: \(_currentElementName)")
if superclass != NSObject.self {
break
}
}
}
}
_readerOk = xmlTextReaderRead(reader)
_currentNodeType = xmlTextReaderNodeType(reader)
_currentXmlDept = xmlTextReaderDepth(reader)
}
}
}
| [
-1
] |
0759a7b8efb249df645ae7e7d4296d300ba2d6b5 | 4caf1bcca35351eb08aee8acf67651e71be0cd8f | /FlicksBox/FlicksBox/ViewControllers/Auth/AuthInput.swift | 4f4c9c531f210ca26a6ac3b30c36dac9df105bc8 | [] | no_license | flicksbox-technopark-mail-ru/flicksbox-ios | c370ef098cd332ee8bb9091c1865528275652e91 | 3d5b2537eeb12b23ca451a3d4869be7ee8ee1074 | refs/heads/dev | 2023-05-10T05:48:12.822924 | 2021-06-05T12:49:54 | 2021-06-05T12:49:54 | 344,787,840 | 4 | 2 | null | 2021-06-05T11:24:08 | 2021-03-05T11:22:17 | Swift | UTF-8 | Swift | false | false | 1,240 | swift | //
// AuthInput.swift
// FlicksBox
//
// Created by Александр Бутолин on 21.04.2021.
//
import Botticelli
import UIKit
final class AuthIput: UITextField {
let padding = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)
override func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.inset(by: padding)
}
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
return bounds.inset(by: padding)
}
override func editingRect(forBounds bounds: CGRect) -> CGRect {
return bounds.inset(by: padding)
}
override init(frame: CGRect) {
super.init(frame: frame)
layer.cornerRadius = 5
backgroundColor = #colorLiteral(red: 0.9802892804, green: 0.9804533124, blue: 0.9802661538, alpha: 1)
tintColor = UIColor.black
attributedPlaceholder = NSAttributedString(string: "input", attributes: [NSAttributedString.Key.foregroundColor: #colorLiteral(red: 0.6000000238, green: 0.6000000238, blue: 0.6000000238, alpha: 1)])
textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
40b279511e0a87e2ecf4a23b0b59c48abdd80ac0 | 57862d4b73e41edfb2811d2bf5ea7462a65f8506 | /arcgis-ios-sdk-samples/Scenes/Add a point scene layer/AddPointSceneLayerViewController.swift | 4e1f5ae70cc7aab0c5b01c39c49e61a4d7d31a93 | [
"Apache-2.0"
] | permissive | mhdostal/arcgis-runtime-samples-ios | 7f736f4099ad6a86da5bd98d9923d0c59b2e48ab | b2694f9e5a97cd81ea042c1078708215ab4f3f48 | refs/heads/main | 2023-03-24T10:43:25.887525 | 2023-01-06T20:09:46 | 2023-01-06T20:09:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,172 | swift | //
// Copyright © 2019 Esri.
//
// 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 UIKit
import ArcGIS
class AddPointSceneLayerViewController: UIViewController {
@IBOutlet var sceneView: AGSSceneView! {
didSet {
sceneView.scene = makeScene()
}
}
/// Creates a scene with an point scene layer.
///
/// - Returns: A new `AGSScene` object.
func makeScene() -> AGSScene {
let scene = AGSScene(basemapStyle: .arcGISImagery)
// Create the elevation source.
let elevationServiceURL = URL(string: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer")!
let elevationSource = AGSArcGISTiledElevationSource(url: elevationServiceURL)
// Create the surface and add it to the scene.
let surface = AGSSurface()
surface.elevationSources = [elevationSource]
scene.baseSurface = surface
/// Add a point scene layer with points at world airport locations
let pointSceneLayerURL = URL(string: "https://tiles.arcgis.com/tiles/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Airports_PointSceneLayer/SceneServer/layers/0")!
// scene layer
let sceneLayer = AGSArcGISSceneLayer(url: pointSceneLayerURL)
scene.operationalLayers.add(sceneLayer)
return scene
}
override func viewDidLoad() {
super.viewDidLoad()
// add the source code button item to the right of navigation bar
(self.navigationItem.rightBarButtonItem as! SourceCodeBarButtonItem).filenames = ["AddPointSceneLayerViewController"]
}
}
| [
-1
] |
f96715029d49aafc0a637faaaf1c32a2ee168137 | c353189306caca7601251dcb8e981f41769d5809 | /Day 011 - Protocols And Extensions.playground/Pages/Intro.xcplaygroundpage/Contents.swift | fc81de5789a7e46b2a1f452cc33e503e2342e75c | [] | no_license | eduardorighes/OneHundredDaysOfSwift | 742bdda1bec2d08ad44a8ca46779913a5f3c4804 | 2a877cdd9cbdcf673ba40572edb3b1e1055bd2a4 | refs/heads/master | 2023-06-23T14:13:13.615476 | 2021-07-23T21:35:03 | 2021-07-23T21:35:03 | 363,367,234 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 97 | swift | // MARK: Protocols And Extensions
// https://www.hackingwithswift.com/100/11
//: [Next](@next)
| [
-1
] |
72437fc068e70db57821a764b94de800715b923e | 38a51dddb7f5f87bd76620fa4771c3597c69f5a0 | /Swerve/Swerve/Controllers/DisplayResultViewController.swift | c61c7173bce7989b7452446f6e90e7379d24e276 | [] | no_license | D-J-Harris/Swerve | c020db9fd512c014b2c94bb28615b46c73a58588 | 23814adaf95b97143254eb0c1f4d3a0f46d50f44 | refs/heads/master | 2020-03-23T21:19:57.616324 | 2019-11-28T23:29:08 | 2019-11-28T23:29:08 | 142,098,595 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,057 | swift | //
// DisplayResultViewController.swift
// Swerve
//
// Created by Daniel Harris on 29/07/2018.
// Copyright © 2018 Daniel Harris. All rights reserved.
//
import Foundation
import UIKit
import AlamofireImage
class DisplayResultViewController: UIViewController {
@IBOutlet weak var trackName: UILabel!
@IBOutlet weak var artistName: UILabel!
@IBOutlet weak var albumArtwork: UIImageView!
@IBOutlet weak var openInSpotifyButton: UIButton!
@IBOutlet weak var addToSpotifyButton: UIButton!
@IBOutlet weak var gradientView: UIView!
//Empty initialisations
var receivedID = ""
var receivedSpotifyMatchedID = ""
var currentSpotifyID = ""
//Initialisation of empty incoming instances
var track: Track = Track.init(name: "", artist: "", albumCoverURL: "", id: "", url: "", spotifyUri: "")
var playlist: Playlist = Playlist.init(name: "", creator: "", id: "", url: "", spotifyUri: "")
override func viewDidLoad() {
super.viewDidLoad()
let gradient = CAGradientLayer()
gradient.frame = gradientView.bounds
gradient.colors = [UIColor(displayP3Red: 0.431, green: 0.918, blue: 0.667, alpha: 1).cgColor,
UIColor(displayP3Red: 0.961, green: 0.408, blue: 0.349, alpha: 1).cgColor,
UIColor(displayP3Red: 0.878, green: 0.898, blue: 0.243, alpha: 1).cgColor]
gradientView.layer.insertSublayer(gradient, at: 0)
trackName.layer.masksToBounds = true
artistName.layer.masksToBounds = true
openInSpotifyButton.layer.masksToBounds = true
addToSpotifyButton.layer.masksToBounds = true
trackName.layer.cornerRadius = 9
artistName.layer.cornerRadius = 9
openInSpotifyButton.layer.cornerRadius = 5
addToSpotifyButton.layer.cornerRadius = 5
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
//having loading progress wait for the getTrack to complete
let dispatchGroup = DispatchGroup()
dispatchGroup.enter()
dispatchGroup.enter()
LoadingOverlay.shared.showOverlay(self.view)
getTrack(trackID: receivedID) { (track) in
if track.name != "" {
print("track downloaded")
self.track = track
}
else {
print("no track exists")
}
dispatchGroup.leave()
}
if track.name == "" {
getPlaylist(playlistID: receivedID, receivedSpotifyMatchedID) { (playlist) in
if playlist.name != "" {
print("playlist downloaded")
self.playlist = playlist
}
else {
print("no playlist exists")
}
dispatchGroup.leave()
}
} else {dispatchGroup.leave()}
//Once download complete, update track info
dispatchGroup.notify(queue: DispatchQueue.main) {
LoadingOverlay.shared.hideOverlayView(self.view)
if self.track.name != "" {
self.trackName.text = self.track.name
self.artistName.text = self.track.artist
guard let albumCoverURL = self.track.albumCoverURL else {return}
if albumCoverURL != "" {
self.albumArtwork.af_setImage(withURL: URL(string: self.track.albumCoverURL!)!)
}
} else if self.playlist.name != "" {
self.trackName.text = self.playlist.name
self.artistName.text = self.playlist.creator
self.albumArtwork.image = #imageLiteral(resourceName: "Swerve Logo")
}
else {
//Alert the user that no song was transferred
let alert = UIAlertController(title: nil, message: "No song found!", preferredStyle: .alert)
let actionOK = UIAlertAction(title: "Ok", style: .default, handler: { (action) in
self.performSegue(withIdentifier: Constants.Segue.displayResultsToMotion, sender: self)
})
alert.addAction(actionOK)
self.present(alert, animated: true, completion: nil)
}
}
}
@IBAction func openInSpotifyButtonTapped(_ sender: UIButton) {
//check if spotify installed
if SPTAuth.supportsApplicationAuthentication() {
//app login
if track.url != "" {
UIApplication.shared.open(URL(string: track.spotifyUri)!, options: [:], completionHandler: nil)
}
else {
UIApplication.shared.open(URL(string: playlist.spotifyUri)!, options: [:], completionHandler: nil)
}
}
else {
//web login
if track.url != "" {
UIApplication.shared.open(URL(string: track.url)!, options: [:], completionHandler: nil)
}
else {
UIApplication.shared.open(URL(string: playlist.url)!, options: [:], completionHandler: nil)
}
}
}
@IBAction func addToSpotifyButtonTapped(_ sender: UIButton) {
//if song passed
if track.id != "" {
addSongToSpotify(songID: track.id)
}
//if playlist passed
else {
let dispatchGroup = DispatchGroup()
dispatchGroup.enter()
getCurrentSpotifyID { (id) in
guard let id = id else{dispatchGroup.leave(); return}
self.currentSpotifyID = id
dispatchGroup.leave()
}
dispatchGroup.notify(queue: DispatchQueue.main) {
addPlaylistToSpotify(playlistID: self.playlist.id, self.currentSpotifyID)
}
}
}
}
| [
-1
] |
919450f1ed44e49aaffeb58f780ad77ef2affbaa | 283631b4aaf47b7a919be43c9a143dffc4f8a937 | /IbtikatTaskTests/MockRepository.swift | d688ffced1c2f9c80e33ef3b6c654d55962bcdf4 | [] | no_license | AhlamElgendy/IbtikarTask | 1b48536346154971b11fcd5269ee96dd79d48c0c | ec84398cd3ecc0ab95a8ccdef0a50c5d8676c7fd | refs/heads/main | 2023-04-30T14:20:12.435039 | 2021-05-22T02:24:29 | 2021-05-22T02:24:29 | 369,696,924 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 536 | swift | //
// MockDataSource.swift
// IbtikatTaskTests
//
// Created by Ahlam on 21/5/2021.
//
@testable import IbtikatTask
import RxSwift
import Foundation
class MockRepository: ICategoriesRepository{
func getChannels() -> Observable<[Channel]> {
return Observable.just([])
}
func getCategories() -> Observable<[CategoryItem]> {
return Observable.just([CategoryItem(name: "TEST")])
}
func getNewEpisodes() -> Observable<[Media]> {
return Observable.just([])
}
}
| [
-1
] |
d2beabf9a7560d79c3c3ec9d79beb051b6bf09a9 | e84e99e6fcf8f5724ca8b1f36e649f819036f3ad | /RoadGraph/Helpers/SVG.swift | 61e3e8e4f7bf16a34ebb788a356cd9799fa1c1f6 | [] | no_license | magauran/RoadGraph | d97287724f254430cdf0e156df3bd83c1e77d687 | df29c411debc587daaaa2961073c4acae36873d6 | refs/heads/master | 2021-04-03T07:45:49.468532 | 2018-05-18T10:38:55 | 2018-05-18T10:38:55 | 124,665,161 | 2 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,229 | swift | //
// SVG.swift
// RoadGraph
//
// Created by Алексей on 12.03.2018.
// Copyright © 2018 Алексей. All rights reserved.
//
import Foundation
class SVG {
private var imageRect: CGRect
private var sourceRect: CGRect
private var svgString: String
init(rect: CGRect) {
self.sourceRect = rect
self.imageRect = CGRect(x: 0.0, y: 0.0, width: 500, height: 500 * rect.height / rect.width)
self.svgString = ""
}
public func saveSVGToFile() {
let svg = "<svg height=\"\(self.imageRect.height)\" width=\"\(self.imageRect.width)\">" + self.svgString + "</svg>\n"
let svgUrl = Bundle.main.bundleURL.appendingPathComponent("Contents/Resources/graph.svg")
do {
try svg.write(to: svgUrl, atomically: true, encoding: .utf8)
} catch {
print("Failed writing to URL: \(svgUrl), Error: " + error.localizedDescription)
}
}
public func saveSVGToHTMLFile() {
let svg = "<!DOCTYPE html>\n<html>\n<body>" + "<svg height=\"\(self.imageRect.height)\" width=\"\(self.imageRect.width)\">\n" + self.svgString + "</svg>\n</body>\n</html>"
let svgUrl = Bundle.main.bundleURL.appendingPathComponent("Contents/Resources/graph.html")
do {
try svg.write(to: svgUrl, atomically: true, encoding: .utf8)
} catch {
print("Failed writing to URL: \(svgUrl), Error: " + error.localizedDescription)
}
}
public func drawLine(from p1: CGPoint, to p2: CGPoint, width: Double = 0.5, color: String = "#000050") {
let point1 = convertCoordinate(initialPoint: p1, initialRect: sourceRect, resultRect: imageRect)
let point2 = convertCoordinate(initialPoint: p2, initialRect: sourceRect, resultRect: imageRect)
self.svgString += "<line x1=\"\(point1.x)\" y1=\"\(point1.y)\" x2=\"\(point2.x)\" y2=\"\(point2.y)\" style=\"stroke:\(color); stroke-width:\(width)\" />\n"
}
public func drawCircle(center: CGPoint, radius: CGFloat = 2, color: String = "red") {
let centerPoint = convertCoordinate(initialPoint: center, initialRect: sourceRect, resultRect: imageRect)
self.svgString += "<circle cx=\"\(centerPoint.x)\" cy=\"\(centerPoint.y)\" r=\"\(radius)\" fill=\"\(color)\"/>\n"
}
public func drawCircleWithNumber(center: CGPoint, radius: CGFloat, color: String = "green", number: Int, numberColor: String = "white") {
let centerPoint = convertCoordinate(initialPoint: center, initialRect: sourceRect, resultRect: imageRect)
self.svgString += "<circle cx=\"\(centerPoint.x)\" cy=\"\(centerPoint.y)\" r=\"\(radius)\" fill=\"\(color)\"/>\n"
self.svgString += "<text x=\"\(centerPoint.x - (number >= 10 ? 3.3 : 1.7))\" y=\"\(centerPoint.y + 2.2)\" fill=\"\(numberColor)\" font-size=\"6\"\">\(number)</text>\n"
}
func convertCoordinate(initialPoint: CGPoint, initialRect: CGRect, resultRect: CGRect) -> CGPoint {
let x = (initialPoint.x / initialRect.width) * resultRect.width
let y = (initialPoint.y / initialRect.height) * resultRect.height
return CGPoint(x: x, y: y)
}
}
| [
-1
] |
62be453d1040195ae3bd26a542aa67dbc204fb9b | 44937a70900673b069c5497c2e3b40f9eaa8a52a | /Sello/Sello/UserCell.swift | 4d4efbea26c2ff88635f2def6d9241f9037f8c90 | [] | no_license | shanthinibaskar/Sello | 1153721fcb4f31298e2bd9121bd04f6671210c5f | 645f2c3b57bed6bbcd7f8bc62754638d1b22ad78 | refs/heads/master | 2020-04-05T06:13:01.892960 | 2018-12-03T07:01:57 | 2018-12-03T07:01:57 | 156,630,277 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 4,116 | swift | //
// UserCell.swift
// Sello
//
// Created by Shanthini Baskar on 29/11/18.
// Copyright © 2018 Sello. All rights reserved.
//
import UIKit
import Firebase
class UserCell: UITableViewCell {
var message: Message? {
didSet {
setupNameAndProfileImage()
detailTextLabel?.text = message?.text
if let seconds = message?.timestamp?.doubleValue {
let timestampDate = Date(timeIntervalSince1970: seconds)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "hh:mm:ss a"
timeLabel.text = dateFormatter.string(from: timestampDate)
}
}
}
fileprivate func setupNameAndProfileImage() {
print ("setupNameAndProfileImage")
if let id = message?.chatPartnerId() {
let ref = Database.database().reference().child("users").child(id)
ref.observeSingleEvent(of: .value, with: { (snapshot) in
if let dictionary = snapshot.value as? [String: AnyObject] {
self.textLabel?.text = dictionary["name"] as? String
let storage = Storage.storage()
let profileRef = storage.reference().child(id)
// Fetch the download URL
profileRef.downloadURL { url, error in
if let error = error {
print(error)
} else {
self.profileImageView.loadImageUsingCacheWithUrlString(url!)
}
}
}
}, withCancel: nil)
}
}
override func layoutSubviews() {
super.layoutSubviews()
textLabel?.frame = CGRect(x: 64, y: textLabel!.frame.origin.y - 2, width: textLabel!.frame.width, height: textLabel!.frame.height)
detailTextLabel?.frame = CGRect(x: 64, y: detailTextLabel!.frame.origin.y + 2, width: detailTextLabel!.frame.width, height: detailTextLabel!.frame.height)
}
let profileImageView: UIImageView = {
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.layer.cornerRadius = 24
imageView.layer.masksToBounds = true
imageView.contentMode = .scaleAspectFill
return imageView
}()
let timeLabel: UILabel = {
let label = UILabel()
// label.text = "HH:MM:SS"
label.font = UIFont.systemFont(ofSize: 13)
label.textColor = UIColor.darkGray
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
addSubview(profileImageView)
addSubview(timeLabel)
//ios 9 constraint anchors
//need x,y,width,height anchors
profileImageView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 8).isActive = true
profileImageView.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
profileImageView.widthAnchor.constraint(equalToConstant: 48).isActive = true
profileImageView.heightAnchor.constraint(equalToConstant: 48).isActive = true
//need x,y,width,height anchors
timeLabel.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
timeLabel.topAnchor.constraint(equalTo: self.topAnchor, constant: 18).isActive = true
timeLabel.widthAnchor.constraint(equalToConstant: 100).isActive = true
timeLabel.heightAnchor.constraint(equalTo: (textLabel?.heightAnchor)!).isActive = true
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
// fatalError("init(coder:) has not been implemented")
}
}
| [
316612
] |
e7e65cbbbb4f4cf787a35c55badb0339dfb7bbad | 15c5590e2d9c1e4d7bfc906567fa9eafb40d2c2c | /mm-merchant-ios/merchant-ios/Classes/ViewController/Storefront/Discover/View/MMCategoryCollectionView.swift | 742ca99278be8bdc515105129e2d2a2fd49497bc | [] | no_license | 8secz-johndpope/historyProject | 0b3c6cd2e968c14052a2ecd9e3c6081da20f2879 | d21d3f62cd83695ef90a57e7f68a4475e7354530 | refs/heads/master | 2020-12-24T01:42:32.515249 | 2019-11-25T08:15:58 | 2019-11-25T08:15:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,860 | swift | //
// MMCategoryCollectionView.swift
// storefront-ios
//
// Created by Demon on 14/6/18.
// Copyright © 2018年 WWE & CO. All rights reserved.
//
import UIKit
class MMCategoryCollectionHeaderView: UICollectionReusableView {
public var selelctedAllBtnBlock:(() -> Void)?
public var titleText: String = "" {
didSet {
titleLb.text = titleText
setNeedsUpdateConstraints()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
self.addSubview(titleLb)
self.addSubview(selectedAllBtn)
selectedAllBtn.addSubview(arrowImageView)
setNeedsUpdateConstraints()
}
override func updateConstraints() {
titleLb.snp.makeConstraints { (make) in
make.left.equalTo(self.snp.left).offset(15)
make.centerY.equalTo(self.snp.centerY)
make.height.equalTo(20)
make.right.equalTo(selectedAllBtn.snp.left).offset(-10)
}
selectedAllBtn.snp.makeConstraints { (make) in
make.right.equalTo(self.snp.right).offset(-15)
make.centerY.equalTo(self.snp.centerY)
make.height.equalTo(20)
make.width.equalTo(70)
}
arrowImageView.snp.makeConstraints { (make) in
make.right.equalTo(self.selectedAllBtn.snp.right)
make.centerY.equalTo(self.selectedAllBtn.snp.centerY)
make.size.equalTo(CGSize(width: 5, height: 8))
}
super.updateConstraints()
}
@objc private func selectedAllBtnClick() {
if let block = self.selelctedAllBtnBlock {
block()
}
}
private lazy var titleLb: UILabel = {
let titleLb = UILabel()
titleLb.textAlignment = .left
titleLb.font = UIFont.fontWithSize(14, isBold: true)
titleLb.textColor = UIColor(hexString: "#333333")
return titleLb
}()
public lazy var selectedAllBtn: UIButton = {
let btn = UIButton(type: .custom)
btn.titleLabel?.font = UIFont.regularFontWithSize(size: 12)
btn.setTitleColor(UIColor(hexString: "#999999"), for: .normal)
btn.setTitle("查看全部", for: .normal)
btn.addTarget(self, action: #selector(selectedAllBtnClick), for: UIControlEvents.touchUpInside)
return btn
}()
private lazy var arrowImageView: UIImageView = {
let v = UIImageView(image: UIImage(named: "category_selected"))
return v
}()
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - 左侧二级类目的cell
class MMCategoryTaleViewCell: UITableViewCell {
public var isSelectedCell: Bool = false {
didSet {
contentView.backgroundColor = isSelectedCell ? UIColor.white : UIColor(hexString: "#F5F5F5")
horiLine.isHidden = !isSelectedCell
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
loadUI()
}
public func setupModel(cat:Cat) {
titleLb.text = cat.categoryNameOrigin.insertSomeStr(element: "\n", at: 6)
}
private func loadUI() {
contentView.addSubview(titleLb)
contentView.addSubview(horiLine)
contentView.addSubview(verLine)
setNeedsUpdateConstraints()
}
override func updateConstraints() {
titleLb.snp.makeConstraints { (make) in
make.top.right.bottom.equalTo(contentView)
make.left.equalTo(horiLine.snp.right).offset(5)
}
horiLine.snp.makeConstraints { (make) in
make.top.equalTo(contentView.snp.top).offset(7)
make.left.equalTo(contentView.snp.left)
make.bottom.equalTo(contentView.snp.bottom).offset(-7)
make.width.equalTo(3)
}
verLine.snp.makeConstraints { (make) in
make.left.right.bottom.equalTo(contentView)
make.height.equalTo(1)
}
super.updateConstraints()
}
private lazy var titleLb: UILabel = {
let lb = UILabel()
lb.textColor = UIColor.secondary15()
lb.numberOfLines = 2
lb.font = UIFont.systemFont(ofSize: 12)
lb.textAlignment = .center
return lb
}()
private lazy var horiLine: UILabel = {
let line = UILabel()
line.backgroundColor = UIColor(hexString: "#ED2247")
return line
}()
private lazy var verLine: UILabel = {
let line = UILabel()
line.backgroundColor = UIColor(hexString: "#ECECEC")
return line
}()
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
// MARK: - 右侧 三级类目的cell
class MMCategoryContentCollectionCell: UICollectionViewCell {
public var option: Cat? {
didSet {
if let cat = option {
categoryName.text = cat.categoryName.insertSomeStr(element: "\n", at: 6)
categoryImageView.mm_setImageWithURL(ImageURLFactory.getRaw(cat.featuredImage, category: .category, width: Constants.DefaultImageWidth.Small), placeholderImage: UIImage(named: "brand_placeholder"), clipsToBounds: true, contentMode: .scaleAspectFit)
setNeedsUpdateConstraints()
} else {
categoryName.text = ""
categoryImageView.image = nil
}
}
}
override init(frame: CGRect) {
super.init(frame: frame)
self.backgroundColor = UIColor.white
contentView.addSubview(categoryImageView)
contentView.addSubview(categoryName)
setNeedsUpdateConstraints()
}
override func updateConstraints() {
categoryImageView.snp.makeConstraints { (make) in
make.top.equalTo(contentView.snp.top)
make.centerX.equalTo(contentView.snp.centerX)
make.width.height.equalTo(54)
}
categoryName.snp.makeConstraints { (make) in
make.top.equalTo(categoryImageView.snp.bottom).offset(5)
make.left.right.equalTo(contentView)
make.height.greaterThanOrEqualTo(14)
}
super.updateConstraints()
}
lazy var categoryImageView: UIImageView = {
let imgv = UIImageView()
return imgv
}()
lazy var categoryName: UILabel = {
let lb = UILabel()
lb.textAlignment = .center
lb.numberOfLines = 2
lb.textColor = UIColor.secondary15()
lb.font = UIFont.systemFont(ofSize: 12)
return lb
}()
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| [
-1
] |
5e61460b77bf954f2d489b1ea2612747a1922962 | 3ff5fc2860bdf41169ebd37686b7473ff7e33ae5 | /TongoNews/Common/Data/StorageMangeable/ProdSecureStorageManager.swift | a42ea54ae6151a3d1527273c6b0133ea32cd0186 | [] | no_license | lgoyes/TongoNews | f70616fe8957e0029678c242b8fa9806162ee522 | ec9d5a474e8e64e5843fa33a66cc97057dd22bbb | refs/heads/main | 2023-04-02T09:07:40.655560 | 2021-04-07T16:39:28 | 2021-04-07T16:39:28 | 343,539,561 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,533 | swift | //
// ProdSecureStorageManager.swift
// TongoNews
//
// Created by Luis Goyes Garces on 5/04/21.
//
import Foundation
import KeychainAccess
class ProdSecureStorageManager: StorageManageable {
private struct Service {
static let test = "com.tongo.TongoNews.test"
static let dev = "com.tongo.TongoNews.dev"
static let prod = "com.tongo.TongoNews"
}
private var keychain: Keychain
init(systemConfig: SystemConfig) {
var service: String
switch systemConfig {
case .dev:
service = Service.dev
case .prod:
service = Service.prod
case .test:
service = Service.test
}
keychain = Keychain(service: service)
}
func set<T: Encodable>(value: T, for key: String) {
keychain[data: key] = try! JSONEncoder().encode(value)
}
func removeValue(for key: String) {
keychain[key] = nil
}
func getValue<T: Decodable>(for key: String) throws -> T {
guard let value = keychain[data: key] else {
throw StorageError.keyDoesNotExist
}
guard let castedValue = try? JSONDecoder().decode(T.self, from: value) else {
throw StorageError.unableToConvertStoredValueToDesiredType
}
return castedValue
}
// MARK: - Testing
func supersed(keychain: Keychain) {
self.keychain = keychain
}
func getKeychain() -> Keychain {
return self.keychain
}
}
| [
-1
] |
874e80c35b131fc524945d8d0c456a42047204dd | 7d63d245fdef11462094b9810453d47a0fca16b5 | /Algorithm.playground/Pages/9. 前 K 个高频元素.xcplaygroundpage/Contents.swift | a81fd9e1b70929b3534be3485572fdef94014600 | [] | no_license | fozuyouxin/AlgorithmSet | f93e1200b0d60868a5a4c7c40e00112a95b47283 | 1cc467432c0a97c53e830737a918a57b6165c0a0 | refs/heads/master | 2023-01-09T10:01:58.666128 | 2020-11-08T09:14:14 | 2020-11-08T09:14:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,110 | swift | /*
9. 前 K 个高频元素
给定一个非空的整数数组,返回其中出现频率前 k 高的元素。
示例 1:
输入: nums = [1,1,1,2,2,3], k = 2
输出: [1,2]
示例 2:
输入: nums = [1], k = 1
输出: [1]
说明:
* 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。
* 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/top-k-frequent-elements
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
import UIKit
/*
思路1 遍历排序 时间复杂度O(n+mlogm+k) 空间复杂度S(2m+k)
*/
func topKFrequent1(_ nums: [Int], _ k: Int) -> [Int] {
var dict = [Int:Int]() // S(m)
//遍历储每个元素出现的次数 O(n)
for num in nums {
let count: Int = dict[num] ?? 0
dict[num] = count + 1
}
//排序 从大到小 S(m) O(mlogm) m是数组中不同元素的数量
// let stored: [(Int, Int)] = dict.sorted { (num1, num2) -> Bool in
// return num1.1 > num2.1
// }
//取出前K个 S(k)
// var array = [Int](repeating: 0, count: k)
// for i in (0..<k) {
// array[i] = stored[i].0 //O(k)
// }
//等价于上面注释掉的代码
let stored = dict.sorted { $0.value > $1.value }
let array = stored[0..<k].map { $0.key }
return array
}
/*
思路2 桶排序 时间复杂度O(n+m+n) 空间复杂度S(m+k) n数组元素数量 m不同的元素数量
*/
func topKFrequent2(_ nums: [Int], _ k: Int) -> [Int] {
var dict = [Int:Int]() // S(m)
//遍历存储每个元素出现的次数 O(n)
for num in nums {
let count: Int = dict[num] ?? 0
dict[num] = count + 1
}
//桶数组 索引是元素出现的次数
var bucketArray: [[Int]?] = [[Int]?](repeating: [], count: nums.count+1)
//把各个次数的元素放到对应的桶中 bucketArray[1] 表示所有出现次数为1的元素数组
// O(m)
for (key, value) in dict {
if bucketArray[value] == nil {
bucketArray.insert([key], at: value)
}else {
bucketArray[value]?.append(key)
}
}
//取出前K个元素 S(k) O(n)
var array: [Int] = []
for i in (0..<bucketArray.count).reversed() {
if array.count >= k {
break;
}
if array.count + bucketArray[i]!.count <= k {
array += bucketArray[i]!
}else {
array += bucketArray[i]![0..<(k-array.count)]
}
}
return array
}
/*
思路3 快速排序
*/
func topKFrequent3(_ nums: [Int], _ k: Int) -> [Int] {
var dict = [Int:Int]() // S(m)
//遍历存储每个元素出现的次数 O(n)
for num in nums {
let count: Int = dict[num] ?? 0
dict[num] = count + 1
}
//待完善
return []
}
//print(topKFrequent2([6,0,1,4,9,7,-3,1,-4,-8,4,-7,-3,3,2,-3,9,5,-4,0], 6))
print(topKFrequent2([1,1,1,2,2,3], 2))
| [
-1
] |
f9c458e3339888aacb57449d12179ff08c16f869 | c5b35d535c76066a17ec85bf2aecd428f5c76ba8 | /SwiftFormat/Rules.swift | e76f30fee61d7ebd8dcaf1974a45f61f8e715f76 | [
"Zlib"
] | permissive | vincethecoder/SwiftFormat | 3e476a4a2b645313c30a4b4376036701b950d50b | a3ecffd83661370486ac73eb836aa1ebc29142c2 | refs/heads/master | 2020-12-25T00:19:28.317727 | 2016-09-09T17:10:59 | 2016-09-09T17:10:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 48,428 | swift | //
// Rules.swift
// SwiftFormat
//
// Version 0.9.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
//
// https://github.com/nicklockwood/SwiftFormat
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
public typealias FormatRule = (Formatter) -> Void
/// Implement the following rules with respect to the spacing around parens:
/// * There is no space between an opening paren and the preceding identifier,
/// unless the identifier is one of the specified keywords
/// * There is no space between an opening paren and the preceding closing brace
/// * There is no space between an opening paren and the preceding closing square bracket
/// * There is space between a closing paren and following identifier
/// * There is space between a closing paren and following opening brace
/// * There is no space between a closing paren and following opening square bracket
public func spaceAroundParens(formatter: Formatter) {
func spaceAfter(identifier: String) -> Bool {
switch identifier {
case "internal",
"case",
"for",
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"catch",
"is",
"let",
"rethrows",
"throw",
"throws",
"try":
return true
default:
return false
}
}
formatter.forEachToken("(") { i, token in
guard let previousToken = formatter.tokenAtIndex(i - 1) else {
return
}
if spaceAfter(previousToken.string) {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
} else if previousToken.type == .Whitespace {
if let token = formatter.tokenAtIndex(i - 2) {
if (token.type == .EndOfScope && ["]", "}", ")", ">"].contains(token.string)) ||
(token.type == .Identifier && !spaceAfter(token.string)) {
formatter.removeTokenAtIndex(i - 1)
}
}
}
}
formatter.forEachToken(")") { i, token in
guard let nextToken = formatter.tokenAtIndex(i + 1) else {
return
}
if nextToken.type == .Identifier || nextToken.string == "{" {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
} else if nextToken.type == .Whitespace && formatter.tokenAtIndex(i + 2)?.string == "[" {
formatter.removeTokenAtIndex(i + 1)
}
}
}
/// Remove whitespace immediately inside parens
public func spaceInsideParens(formatter: Formatter) {
formatter.forEachToken("(") { i, token in
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
}
formatter.forEachToken(")") { i, token in
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace &&
formatter.tokenAtIndex(i - 2)?.type != .Linebreak {
formatter.removeTokenAtIndex(i - 1)
}
}
}
/// Implement the following rules with respect to the spacing around square brackets:
/// * There is no space between an opening bracket and the preceding identifier,
/// unless the identifier is one of the specified keywords
/// * There is no space between an opening bracket and the preceding closing brace
/// * There is no space between an opening bracket and the preceding closing square bracket
/// * There is space between a closing bracket and following identifier
/// * There is space between a closing bracket and following opening brace
public func spaceAroundBrackets(formatter: Formatter) {
func spaceAfter(identifier: String) -> Bool {
switch identifier {
case "case",
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"is":
return true
default:
return false
}
}
formatter.forEachToken("[") { i, token in
guard let previousToken = formatter.tokenAtIndex(i - 1) else {
return
}
if spaceAfter(previousToken.string) {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
} else if previousToken.type == .Whitespace {
if let token = formatter.tokenAtIndex(i - 2) {
if (token.type == .EndOfScope && ["]", "}", ")"].contains(token.string)) ||
(token.type == .Identifier && !spaceAfter(token.string)) {
formatter.removeTokenAtIndex(i - 1)
}
}
}
}
formatter.forEachToken("]") { i, token in
guard let nextToken = formatter.tokenAtIndex(i + 1) else {
return
}
if nextToken.type == .Identifier || nextToken.string == "{" {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
} else if nextToken.type == .Whitespace && formatter.tokenAtIndex(i + 2)?.string == "[" {
formatter.removeTokenAtIndex(i + 1)
}
}
}
/// Remove whitespace immediately inside square brackets
public func spaceInsideBrackets(formatter: Formatter) {
formatter.forEachToken("[") { i, token in
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
}
formatter.forEachToken("]") { i, token in
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace &&
formatter.tokenAtIndex(i - 2)?.type != .Linebreak {
formatter.removeTokenAtIndex(i - 1)
}
}
}
/// Ensure that there is space between an opening brace and the preceding
/// identifier, and between a closing brace and the following identifier.
public func spaceAroundBraces(formatter: Formatter) {
formatter.forEachToken("{") { i, token in
if let previousToken = formatter.tokenAtIndex(i - 1) {
switch previousToken.type {
case .Whitespace, .Linebreak:
break
case .StartOfScope:
if previousToken.string == "\"" {
fallthrough
}
default:
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
formatter.forEachToken("}") { i, token in
if formatter.tokenAtIndex(i + 1)?.type == .Identifier {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
}
/// Ensure that there is space immediately inside braces
public func spaceInsideBraces(formatter: Formatter) {
formatter.forEachToken("{") { i, token in
if let nextToken = formatter.tokenAtIndex(i + 1) {
if nextToken.type == .Whitespace {
if formatter.tokenAtIndex(i + 2)?.string == "}" {
formatter.removeTokenAtIndex(i + 1)
}
} else if nextToken.type != .Linebreak && nextToken.string != "}" {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
}
formatter.forEachToken("}") { i, token in
if let previousToken = formatter.tokenAtIndex(i - 1) where
previousToken.type != .Whitespace && previousToken.type != .Linebreak && previousToken.string != "{" {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
/// Ensure there is no space between an opening chevron and the preceding identifier
public func spaceAroundGenerics(formatter: Formatter) {
formatter.forEachToken("<", ofType: .StartOfScope) { i, token in
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace &&
formatter.tokenAtIndex(i - 2)?.type == .Identifier {
formatter.removeTokenAtIndex(i - 1)
}
}
}
/// Remove whitespace immediately inside chevrons
public func spaceInsideGenerics(formatter: Formatter) {
formatter.forEachToken("<", ofType: .StartOfScope) { i, token in
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
}
formatter.forEachToken(">", ofType: .EndOfScope) { i, token in
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace &&
formatter.tokenAtIndex(i - 2)?.type != .Linebreak {
formatter.removeTokenAtIndex(i - 1)
}
}
}
/// Implement the following rules with respect to the spacing around operators:
/// * Infix operators are separated from their operands by a space on either
/// side. Does not affect prefix/postfix operators, as required by syntax.
/// * Punctuation such as commas and colons is consistently followed by a
/// single space, unless it appears at the end of a line, and is not
/// preceded by a space, unless it appears at the beginning of a line.
public func spaceAroundOperators(formatter: Formatter) {
func isLvalue(token: Token) -> Bool {
switch token.type {
case .Identifier, .Number, .EndOfScope:
return true
default:
return false
}
}
func isRvalue(token: Token) -> Bool {
switch token.type {
case .Identifier, .Number, .StartOfScope:
return true
default:
return false
}
}
func isUnwrapOperatorSequence(token: Token) -> Bool {
for c in token.string.characters {
if c != "?" && c != "!" {
return false
}
}
return true
}
func spaceAfter(identifier: String) -> Bool {
switch identifier {
case "case",
"guard",
"if",
"in",
"let",
"return",
"switch",
"where",
"while",
"as",
"is":
return true
default:
return false
}
}
var scopeStack: [Token] = []
formatter.forEachToken { i, token in
switch token.type {
case .Operator:
if [":", ",", ";"].contains(token.string) {
if let nextToken = formatter.tokenAtIndex(i + 1) {
switch nextToken.type {
case .Whitespace, .Linebreak, .EndOfScope:
break
case .Identifier:
if token.string == ":" {
if formatter.tokenAtIndex(i + 2)?.string == ":" {
// It's a selector
break
}
}
fallthrough
default:
// Ensure there is a space after the token
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
if token.string == ":" && scopeStack.last?.string == "?" {
// Treat the next : after a ? as closing the ternary scope
scopeStack.popLast()
// Ensure there is a space before the :
if let previousToken = formatter.tokenAtIndex(i - 1) {
if previousToken.type != .Whitespace && previousToken.type != .Linebreak {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
} else if formatter.tokenAtIndex(i - 1)?.type == .Whitespace &&
formatter.tokenAtIndex(i - 2)?.type != .Linebreak {
// Remove space before the token
formatter.removeTokenAtIndex(i - 1)
}
} else if token.string == "?" {
if let previousToken = formatter.tokenAtIndex(i - 1), nextToken = formatter.tokenAtIndex(i + 1) {
if nextToken.type == .Whitespace || nextToken.type == .Linebreak {
if previousToken.type == .Whitespace || previousToken.type == .Linebreak {
// ? is a ternary operator, treat it as the start of a scope
scopeStack.append(token)
}
} else if previousToken.type == .Identifier && ["as", "try"].contains(previousToken.string) {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
} else if token.string == "!" {
if let previousToken = formatter.tokenAtIndex(i - 1), nextToken = formatter.tokenAtIndex(i + 1) {
if nextToken.type != .Whitespace && nextToken.type != .Linebreak &&
previousToken.type == .Identifier && ["as", "try"].contains(previousToken.string) {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
} else if token.string == "." {
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
if let previousToken = formatter.tokenAtIndex(i - 1) {
let previousTokenWasWhitespace = (previousToken.type == .Whitespace)
let previousNonWhitespaceTokenIndex = i - (previousTokenWasWhitespace ? 2 : 1)
if let previousNonWhitespaceToken = formatter.tokenAtIndex(previousNonWhitespaceTokenIndex) {
if previousNonWhitespaceToken.type != .Linebreak &&
previousNonWhitespaceToken.string != "{" &&
(previousNonWhitespaceToken.type != .Operator ||
(previousNonWhitespaceToken.string == "?" && scopeStack.last?.string != "?") ||
(previousNonWhitespaceToken.string != "?" &&
formatter.tokenAtIndex(previousNonWhitespaceTokenIndex - 1)?.type != .Whitespace &&
isUnwrapOperatorSequence(previousNonWhitespaceToken))) &&
!spaceAfter(previousNonWhitespaceToken.string) {
if previousTokenWasWhitespace {
formatter.removeTokenAtIndex(i - 1)
}
} else if !previousTokenWasWhitespace {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
} else if token.string == "->" {
if let nextToken = formatter.tokenAtIndex(i + 1) {
if nextToken.type != .Whitespace && nextToken.type != .Linebreak {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
if let previousToken = formatter.tokenAtIndex(i - 1) {
if previousToken.type != .Whitespace && previousToken.type != .Linebreak {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
} else if token.string != "..." && token.string != "..<" {
if let previousToken = formatter.tokenAtIndex(i - 1) where isLvalue(previousToken) {
if let nextToken = formatter.tokenAtIndex(i + 1) where isRvalue(nextToken) {
// Insert space before and after the infix token
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
case .StartOfScope:
scopeStack.append(token)
case .EndOfScope:
scopeStack.popLast()
default: break
}
}
}
/// Add space around comments, except at the start or end of a line
public func spaceAroundComments(formatter: Formatter) {
formatter.forEachToken(ofType: .StartOfScope) { i, token in
guard let previousToken = formatter.tokenAtIndex(i - 1) where
(token.string == "/*" || token.string == "//") else { return }
if !previousToken.isWhitespaceOrLinebreak {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
formatter.forEachToken("*/") { i, token in
guard let nextToken = formatter.tokenAtIndex(i + 1) else { return }
if !nextToken.isWhitespaceOrLinebreak {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
}
/// Add space inside comments, taking care not to mangle headerdoc or
/// carefully preformatted comments, such as star boxes, etc.
public func spaceInsideComments(formatter: Formatter) {
formatter.forEachToken("/*") { i, token in
guard let nextToken = formatter.tokenAtIndex(i + 1) else { return }
if !nextToken.isWhitespaceOrLinebreak {
let string = nextToken.string
if string.hasPrefix("*") || string.hasPrefix("!") || string.hasPrefix(":") {
if !string.hasPrefix("**") && !string.hasPrefix("* ") &&
!string.hasPrefix("*\t") && !string.hasPrefix("*/") {
let string = String(string.characters.first!) + " " +
string.substringFromIndex(string.startIndex.advancedBy(1))
formatter.replaceTokenAtIndex(i + 1, with: Token(.CommentBody, string))
}
} else {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
}
formatter.forEachToken("//") { i, token in
guard let nextToken = formatter.tokenAtIndex(i + 1) else { return }
if !nextToken.isWhitespaceOrLinebreak {
let string = nextToken.string
if string.hasPrefix("/") || string.hasPrefix("!") || string.hasPrefix(":") {
if !string.hasPrefix("/ ") && !string.hasPrefix("/\t") {
let string = String(string.characters.first!) + " " +
string.substringFromIndex(string.startIndex.advancedBy(1))
formatter.replaceTokenAtIndex(i + 1, with: Token(.CommentBody, string))
}
} else {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
}
}
formatter.forEachToken("*/") { i, token in
guard let previousToken = formatter.tokenAtIndex(i - 1) else { return }
if !previousToken.isWhitespaceOrLinebreak && !previousToken.string.hasSuffix("*") {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
/// Add or removes the space around range operators
public func ranges(formatter: Formatter) {
formatter.forEachToken(ofType: .Operator) { i, token in
if token.string == "..." || token.string == "..<" {
if !formatter.options.spaceAroundRangeOperators {
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i - 1)
}
} else if let nextToken = formatter.nextNonWhitespaceOrCommentOrLinebreakToken(fromIndex: i + 1) {
if nextToken.string != ")" && nextToken.string != "," {
if formatter.tokenAtIndex(i + 1)?.isWhitespaceOrLinebreak == false {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i + 1)
}
if formatter.tokenAtIndex(i - 1)?.isWhitespaceOrLinebreak == false {
formatter.insertToken(Token(.Whitespace, " "), atIndex: i)
}
}
}
}
}
}
/// Collapse all consecutive whitespace characters to a single space, except at
/// the start of a line or inside a comment or string, as these have no semantic
/// meaning and lead to noise in commits.
public func consecutiveSpaces(formatter: Formatter) {
formatter.forEachToken(ofType: .Whitespace) { i, token in
if let previousToken = formatter.tokenAtIndex(i - 1) where previousToken.type != .Linebreak {
if token.string == "" {
formatter.removeTokenAtIndex(i)
} else if token.string != " " {
let scope = formatter.scopeAtIndex(i)
if scope?.string != "/*" && scope?.string != "//" {
formatter.replaceTokenAtIndex(i, with: Token(.Whitespace, " "))
}
}
}
}
}
/// Remove trailing whitespace from the end of lines, as it has no semantic
/// meaning and leads to noise in commits.
public func trailingWhitespace(formatter: Formatter) {
formatter.forEachToken(ofType: .Linebreak) { i, token in
if formatter.tokenAtIndex(i - 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i - 1)
}
}
if formatter.tokens.last?.type == .Whitespace {
formatter.removeLastToken()
}
}
/// Collapse all consecutive blank lines into a single blank line
public func consecutiveBlankLines(formatter: Formatter) {
var linebreakCount = 0
var lastTokenType = TokenType.Whitespace
formatter.forEachToken { i, token in
if token.type == .Linebreak {
linebreakCount += 1
if linebreakCount > 2 {
formatter.removeTokenAtIndex(i)
if lastTokenType == .Whitespace {
formatter.removeTokenAtIndex(i - 1)
lastTokenType = .Linebreak
}
linebreakCount -= 1
return // continue
}
} else if token.type != .Whitespace {
linebreakCount = 0
}
lastTokenType = token.type
}
if linebreakCount > 1 {
if lastTokenType == .Whitespace {
formatter.removeLastToken()
}
formatter.removeLastToken()
}
}
/// Remove blank lines immediately before a closing brace, bracket, paren or chevron
public func blankLinesAtEndOfScope(formatter: Formatter) {
formatter.forEachToken(ofType: .EndOfScope) { i, token in
guard ["}", ")", "]", ">"].contains(token.string) else { return }
// Find previous non-whitespace token
var index = i - 1
var indexOfFirstLineBreak: Int?
var indexOfLastLineBreak: Int?
loop: while let token = formatter.tokenAtIndex(index) {
switch token.type {
case .Linebreak:
indexOfFirstLineBreak = index
if indexOfLastLineBreak == nil {
indexOfLastLineBreak = index
}
case .Whitespace:
break
default:
break loop
}
index -= 1
}
if let indexOfFirstLineBreak = indexOfFirstLineBreak, indexOfLastLineBreak = indexOfLastLineBreak {
formatter.removeTokensInRange(indexOfFirstLineBreak ..< indexOfLastLineBreak)
return
}
}
}
/// Adds a blank line immediately before a class, struct, enum, extension, protocol or function.
/// If the scope is immediately preceded by a comment, the line will be inserted before that instead.
public func blankLinesBetweenScopes(formatter: Formatter) {
formatter.forEachToken(ofType: .Identifier) { i, token in
switch token.string {
case "struct", "enum", "protocol", "extension":
break
case "class":
// Ignore class var/let/func
if let nextToken = formatter.nextNonWhitespaceOrCommentOrLinebreakToken(fromIndex: i + 1)
where nextToken.type == .Identifier {
switch nextToken.string {
case "var", "let", "func",
"private", "fileprivate", "public", "internal", "open",
"final", "required", "override", "convenience",
"lazy", "dynamic", "static":
return
default:
break
}
}
case "init":
// Ignore self.init() / super.init() calls
if formatter.previousNonWhitespaceOrCommentOrLinebreak(fromIndex: i)?.string == "." {
return
}
fallthrough
case "func", "subscript", "init":
// Ignore function prototypes inside protocols
if let startOfScope = formatter.indexOfPreviousToken(fromIndex: i, matching: {
return $0.type == .StartOfScope && $0.string == "{" }) {
if formatter.previousToken(fromIndex: startOfScope, matching: {
if $0.type == .Identifier && $0.string == "protocol" { return true }
return $0.type == .EndOfScope && $0.string == "}"
})?.string == "protocol" {
return
}
}
default:
return
}
// Skip specifiers
var index = i - 1
var reachedStart = false
var linebreakCount = 0
var lastLinebreakIndex = 0
while !reachedStart {
while let token = formatter.tokenAtIndex(index) {
if token.type == .Linebreak {
linebreakCount = 1
lastLinebreakIndex = index
index -= 1
break
}
index -= 1
}
loop: while let token = formatter.tokenAtIndex(index) {
switch token.type {
case .Whitespace:
break
case .Linebreak:
linebreakCount += 1
lastLinebreakIndex = index
case .Identifier:
switch token.string {
case "private", "fileprivate", "internal", "public", "open",
"final", "required", "override", "convenience":
break
default:
if !token.string.hasPrefix("@") {
reachedStart = true
break loop
}
}
linebreakCount = 0
case .CommentBody:
linebreakCount = 0
case .EndOfScope:
if token.string == ")" {
// Handle @available(...), @objc(...), etc
if let openParenIndex = formatter.indexOfPreviousToken(fromIndex: index, matching: {
return $0.type == .StartOfScope && $0.string == "("
}), nonWSIndex = formatter.indexOfPreviousToken(fromIndex: openParenIndex, matching: {
return !$0.isWhitespaceOrCommentOrLinebreak
}) where formatter.tokenAtIndex(nonWSIndex)?.string.hasPrefix("@") == true {
linebreakCount = 0
index = nonWSIndex
break
}
reachedStart = true
break loop
}
if token.string == "*/" {
linebreakCount = 0
break
}
reachedStart = true
break loop
case .StartOfScope:
if token.string == "/*" || token.string == "//" {
linebreakCount = 0
break
}
reachedStart = true
break loop
default:
reachedStart = true
break loop
}
index -= 1
}
if index < 0 {
return // we've reached the start of the file
}
}
if linebreakCount < 2 {
// Insert blank line
formatter.insertToken(Token(.Linebreak, formatter.options.linebreak), atIndex: lastLinebreakIndex)
}
}
}
/// Always end file with a linebreak, to avoid incompatibility with certain unix tools:
/// http://stackoverflow.com/questions/2287967/why-is-it-recommended-to-have-empty-line-in-the-end-of-file
public func linebreakAtEndOfFile(formatter: Formatter) {
var token = formatter.tokens.last
if token?.type == .Whitespace {
token = formatter.tokenAtIndex(formatter.tokens.count - 2)
}
if token?.type != .Linebreak {
formatter.insertToken(Token(.Linebreak, formatter.options.linebreak), atIndex: formatter.tokens.count)
}
}
/// Indent code according to standard scope indenting rules.
/// The type (tab or space) and level (2 spaces, 4 spaces, etc.) of the
/// indenting can be configured with the `options` parameter of the formatter.
public func indent(formatter: Formatter) {
var scopeIndexStack: [Int] = []
var scopeStartLineIndexes: [Int] = []
var lastNonWhitespaceOrLinebreakIndex = -1
var lastNonWhitespaceIndex = -1
var indentStack = [""]
var indentCounts = [1]
var lineIndex = 0
var linewrapped = false
func insertWhitespace(whitespace: String, atIndex index: Int) -> Int {
if formatter.tokenAtIndex(index)?.type == .Whitespace {
formatter.replaceTokenAtIndex(index, with: Token(.Whitespace, whitespace))
return 0 // Inserted 0 tokens
}
formatter.insertToken(Token(.Whitespace, whitespace), atIndex: index)
return 1 // Inserted 1 token
}
func currentScope() -> Token? {
if let scopeIndex = scopeIndexStack.last {
return formatter.tokens[scopeIndex]
}
return nil
}
func tokenIsEndOfStatement(i: Int) -> Bool {
if let token = formatter.tokenAtIndex(i) {
switch token.type {
case .Identifier, .EndOfScope:
// TODO: handle in
// TODO: handle context-specific keywords
// associativity, convenience, dynamic, didSet, final, get, infix, indirect,
// lazy, left, mutating, none, nonmutating, optional, override, postfix, precedence,
// prefix, Protocol, required, right, set, Type, unowned, weak, willSet
switch token.string {
case "associatedtype",
"import",
"init",
"inout",
"let",
"subscript",
"var",
"case",
"default",
"for",
"guard",
"if",
"switch",
"where",
"while",
"as",
"catch",
"is",
"super",
"throw",
"try":
return false
default:
return true
}
case .Operator:
if token.string == "." {
return false
}
if token.string == "," {
// For arrays or argument lists, we already indent
return ["[", "("].contains(currentScope()?.string ?? "")
}
if let previousToken = formatter.tokenAtIndex(i - 1) {
if previousToken.string == "as" || previousToken.string == "try" {
return false
}
if previousToken.isWhitespaceOrCommentOrLinebreak {
if formatter.previousNonWhitespaceOrCommentOrLinebreak(fromIndex: i)?.string == "=" {
return true
} else {
return false
}
}
}
default:
return true
}
}
return true
}
func tokenIsStartOfStatement(i: Int) -> Bool {
if let token = formatter.tokenAtIndex(i) {
switch token.type {
case .Identifier:
// TODO: handle "in"
switch token.string {
case "as",
"dynamicType",
"false",
"is",
"nil",
"rethrows",
"throws",
"true",
"where":
return false
case "else":
if let token = formatter.tokenAtIndex(lastNonWhitespaceOrLinebreakIndex) {
return token.string == "}"
}
return false
default:
return true
}
case .Operator:
if token.string == "." {
return false
}
if token.string == "," {
// For arrays or argument lists, we already indent
return ["[", "("].contains(currentScope()?.string ?? "")
}
if let nextToken = formatter.tokenAtIndex(i + 1) where
nextToken.isWhitespaceOrCommentOrLinebreak {
// Is an infix operator
return false
}
default:
return true
}
}
return true
}
insertWhitespace("", atIndex: 0)
formatter.forEachToken { i, token in
var i = i
if token.type == .StartOfScope {
// Handle start of scope
scopeIndexStack.append(i)
var indent = indentStack.last ?? ""
if lineIndex > scopeStartLineIndexes.last ?? -1 {
switch token.string {
case "/*":
// Comments only indent one space
indent += " "
default:
indent += formatter.options.indent
}
indentStack.append(indent)
indentCounts.append(1)
} else {
indentCounts[indentCounts.count - 1] += 1
}
scopeStartLineIndexes.append(lineIndex)
} else if token.type != .Whitespace {
if let scopeIndex = scopeIndexStack.last, scope = formatter.tokenAtIndex(scopeIndex) {
// Handle end of scope
if token.closesScopeForToken(scope) {
scopeStartLineIndexes.popLast()
scopeIndexStack.popLast()
let indentCount = indentCounts.last! - 1
if indentCount == 0 {
indentStack.popLast()
indentCounts.popLast()
} else {
indentCounts[indentCounts.count - 1] = indentCount
}
if lineIndex > scopeStartLineIndexes.last ?? -1 {
// If indentCount > 0, drop back to previous indent level
if indentCount > 0 {
indentStack.popLast()
indentStack.append(indentStack.last ?? "")
}
// Check if line on which scope ends should be unindented
let start = formatter.startOfLine(atIndex: i)
if let nextToken = formatter.nextNonWhitespaceOrCommentOrLinebreakToken(fromIndex: start)
where nextToken.type == .EndOfScope && nextToken.string != "*/" {
// Only reduce indent if line begins with a closing scope token
let indent = indentStack.last ?? ""
i += insertWhitespace(indent, atIndex: start)
}
}
} else if token.type == .Identifier {
// Handle #elseif/#else
if token.string == "#else" || token.string == "#elseif" {
let indent = indentStack[indentStack.count - 2]
i += insertWhitespace(indent, atIndex: formatter.startOfLine(atIndex: i))
}
}
}
// Indent each new line
if token.type == .Linebreak {
var indent = indentStack.last ?? ""
linewrapped = !tokenIsEndOfStatement(lastNonWhitespaceOrLinebreakIndex)
if linewrapped && lineIndex == scopeStartLineIndexes.last {
indent = indentStack.count > 1 ? indentStack[indentStack.count - 2] : ""
scopeStartLineIndexes[scopeStartLineIndexes.count - 1] += 1
}
lineIndex += 1
insertWhitespace("", atIndex: i + 1)
// Only indent if line isn't blank
if let nextToken = formatter.tokenAtIndex(i + 2) where nextToken.type != .Linebreak {
indent += (linewrapped ? formatter.options.indent : "")
insertWhitespace(indent, atIndex: i + 1)
}
}
}
// Track token for line wraps
if !token.isWhitespaceOrComment {
if !linewrapped && formatter.tokenAtIndex(lastNonWhitespaceIndex)?.type == .Linebreak &&
!tokenIsStartOfStatement(i) {
linewrapped = true
var indent = indentStack.last ?? ""
if lineIndex - 1 == scopeStartLineIndexes.last {
indent = indentStack.count > 1 ? indentStack[indentStack.count - 2] : ""
scopeStartLineIndexes[scopeStartLineIndexes.count - 1] += 1
}
indent += (linewrapped ? formatter.options.indent : "")
i += insertWhitespace(indent, atIndex: formatter.startOfLine(atIndex: i))
}
lastNonWhitespaceIndex = i
if token.type != .Linebreak {
lastNonWhitespaceOrLinebreakIndex = i
}
}
}
}
/// Implement K&R-style braces, where opening brace appears on the same line as
/// the related function or keyword, and the closing brace is on its own line,
/// except for inline closures where opening and closing brace are on same line.
public func knrBraces(formatter: Formatter) {
formatter.forEachToken("{") { i, token in
var index = i - 1
var linebreakIndex: Int?
while let token = formatter.tokenAtIndex(index) {
switch token.type {
case .Linebreak:
linebreakIndex = index
case .Whitespace, .CommentBody:
break
case .StartOfScope:
if token.string != "/*" && token.string != "//" {
fallthrough
}
case .EndOfScope:
if token.string != "*/" {
fallthrough
}
default:
if let linebreakIndex = linebreakIndex {
formatter.removeTokensInRange(linebreakIndex ... i)
formatter.insertToken(Token(.Whitespace, " "), atIndex: index + 1)
formatter.insertToken(Token(.StartOfScope, "{"), atIndex: index + 2)
}
return
}
index -= 1
}
}
}
/// Ensure that an `else` statement following `if { ... }` appears on the same line
/// as the closing brace. This has no effect on the `else` part of a `guard` statement
public func elseOnSameLine(formatter: Formatter) {
formatter.forEachToken("else") { i, token in
var index = i - 1
var containsLinebreak = false
while let token = formatter.tokenAtIndex(index) {
switch token.type {
case .Linebreak:
containsLinebreak = true
case .Whitespace:
break
case .EndOfScope:
if token.string == "}" && containsLinebreak {
formatter.replaceTokensInRange(index + 1 ..< i, with: [Token(.Whitespace, " ")])
}
return
default:
return
}
index -= 1
}
}
}
/// Ensure that the last item in a multi-line array literal is followed by a comma.
/// This is useful for preventing noise in commits when items are added to end of array.
public func trailingCommas(formatter: Formatter) {
// TODO: we don't currently check if [] is a subscript rather than a literal.
// This should't matter in practice, as nobody splits subscripts onto multiple
// lines, but ideally we'd check for this just in case
formatter.forEachToken("]") { i, token in
if let linebreakIndex = formatter.indexOfPreviousToken(fromIndex: i, matching: {
return !$0.isWhitespaceOrComment
}) where formatter.tokenAtIndex(linebreakIndex)?.type == .Linebreak {
if let previousTokenIndex = formatter.indexOfPreviousToken(fromIndex: linebreakIndex + 1, matching: {
return !$0.isWhitespaceOrCommentOrLinebreak
}), token = formatter.tokenAtIndex(previousTokenIndex) where token.string != "," {
formatter.insertToken(Token(.Operator, ","), atIndex: previousTokenIndex + 1)
}
}
}
}
/// Ensure that TODO, MARK and FIXME comments are followed by a : as required
public func todos(formatter: Formatter) {
formatter.forEachToken(ofType: .CommentBody) { i, token in
let string = token.string
for tag in ["TODO", "MARK", "FIXME"] {
if string.hasPrefix(tag) {
var suffix = string.substringFromIndex(tag.endIndex)
while suffix.characters.first == " " || suffix.characters.first == ":" {
suffix = suffix.substringFromIndex(suffix.startIndex.advancedBy(1))
}
formatter.replaceTokenAtIndex(i, with: Token(.CommentBody, tag + ": " + suffix))
break
}
}
}
}
/// Remove semicolons, except where doing so would change the meaning of the code
public func semicolons(formatter: Formatter) {
formatter.forEachToken(";") { i, token in
if let nextToken = formatter.nextNonWhitespaceOrCommentOrLinebreakToken(fromIndex: i + 1) {
let lastToken = formatter.previousNonWhitespaceOrCommentOrLinebreak(fromIndex: i)
if lastToken == nil || nextToken.string == "}" {
// Safe to remove
formatter.removeTokenAtIndex(i)
} else if lastToken?.string == "return" || formatter.scopeAtIndex(i)?.string == "(" {
// Not safe to remove or replace
} else if formatter.nextNonWhitespaceOrCommentToken(fromIndex: i + 1)?.type == .Linebreak {
// Safe to remove
formatter.removeTokenAtIndex(i)
} else if !formatter.options.allowInlineSemicolons {
// Replace with a linebreak
if formatter.tokenAtIndex(i + 1)?.type == .Whitespace {
formatter.removeTokenAtIndex(i + 1)
}
if let indentToken = formatter.indentTokenForLineAtIndex(i) {
formatter.insertToken(indentToken, atIndex: i + 1)
}
formatter.replaceTokenAtIndex(i, with: Token(.Linebreak, formatter.options.linebreak))
}
} else {
// Safe to remove
formatter.removeTokenAtIndex(i)
}
}
}
/// Standardise linebreak characters as whatever is specified in the options (\n by default)
public func linebreaks(formatter: Formatter) {
formatter.forEachToken(ofType: .Linebreak) { i, token in
formatter.replaceTokenAtIndex(i, with: Token(.Linebreak, formatter.options.linebreak))
}
}
/// Standardise the order of property specifiers
public func specifiers(formatter: Formatter) {
let order = [
"private(set)", "fileprivate(set)", "internal(set)", "public(set)",
"private", "fileprivate", "internal", "public", "open",
"final", "dynamic", // Can't be both
"optional", "required",
"convenience",
"override",
"lazy",
"weak", "unowned",
"static", "class",
]
let validSpecifiers = Set<String>(order)
formatter.forEachToken(ofType: .Identifier) { i, token in
switch token.string {
case "let", "var",
"typealias", "associatedtype",
"class", "struct", "enum", "protocol", "extension",
"func", "init", "subscript":
break
default:
return
}
var specifiers = [String: [Token]]()
var index = i - 1
var specifierIndex = i
while let token = formatter.tokenAtIndex(index) {
if !token.isWhitespaceOrCommentOrLinebreak {
var key = token.string
if token.type != .Identifier || !validSpecifiers.contains(key) {
if token.string == ")" && formatter
.previousNonWhitespaceOrCommentOrLinebreak(fromIndex: index)?.string == "set" {
// Skip tokens for entire private(set) expression
loop: while let token = formatter.tokenAtIndex(index) {
switch token.string {
case "private", "fileprivate", "internal", "public":
key = token.string + "(set)"
break loop
default:
break
}
index -= 1
}
} else {
// Not a specifier
break
}
}
specifiers[key] = [Token](formatter.tokens[index ..< specifierIndex])
specifierIndex = index
}
index -= 1
}
guard specifiers.count > 0 else { return }
var sortedSpecifiers = [Token]()
for specifier in order {
if let tokens = specifiers[specifier] {
sortedSpecifiers += tokens
}
}
formatter.replaceTokensInRange(specifierIndex ..< i, with: sortedSpecifiers)
}
}
public let defaultRules: [FormatRule] = [
linebreaks,
semicolons,
specifiers,
knrBraces,
elseOnSameLine,
indent,
spaceAroundParens,
spaceInsideParens,
spaceAroundBrackets,
spaceInsideBrackets,
spaceAroundBraces,
spaceInsideBraces,
spaceAroundGenerics,
spaceInsideGenerics,
spaceAroundOperators,
spaceAroundComments,
spaceInsideComments,
consecutiveSpaces,
trailingWhitespace,
consecutiveBlankLines,
blankLinesAtEndOfScope,
blankLinesBetweenScopes,
linebreakAtEndOfFile,
trailingCommas,
todos,
ranges,
]
| [
-1
] |
c19bc27b4cae69dc1ad9c2790d9c5211660eeaaf | f9801a32a316ddd2b1ad5ac59073da59ee31022e | /RideCell/RideCellTests/FleetTests.swift | e1376c392c58dac750eb2dbf45756b5416381af9 | [] | no_license | lbulendev/RideCell-take-home-test | 1ddb0b92782c73ec7442924c5983aa8ea987a212 | dc25494bb367497e6e8204c9bc289762896c82b6 | refs/heads/master | 2022-02-13T19:25:18.106352 | 2019-07-25T19:33:07 | 2019-07-25T19:33:07 | 198,318,258 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,482 | swift | //
// FleetTests.swift
// RideCellTests
//
// Created by Larry Bulen on 7/22/19.
// Copyright © 2019 Larry Bulen. All rights reserved.
//
import XCTest
@testable import RideCell
class FleetTests: 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 test_Init_WhenGivenFullFleet_SetsFleet() {
// Full fleet = fully populate attributes for fleet
let fullFleet = Fleet(id: "UHAUL001", name: "UHaul Fleet", logo: "base64")
XCTAssertEqual(fullFleet.id, "UHAUL001",
"fleet should be set id")
XCTAssertEqual(fullFleet.name, "UHaul Fleet",
"fleet should be set name")
XCTAssertEqual(fullFleet.logo, "base64",
"fleet should be set logo")
}
func test_Init_WhenGivenPartiallFleet_SetsFleet() {
// Partial fleet = partially populate attributes for fleet; leave some attributes as Nil
let partialFleet1 = Fleet(id: "UHAUL002", name: "UHaul Fleet2")
XCTAssertEqual(partialFleet1.id, "UHAUL002",
"fleet should be set id")
XCTAssertEqual(partialFleet1.name, "UHaul Fleet2",
"fleet should be set name")
}
}
| [
-1
] |
979212da5efd1cdca2ee196d38fcbc65ed435712 | 3bc3852c590988afbfa358732f73684790227224 | /iosMVVMPattern/Utils/Extensions/+UserDefaults.swift | baf22b87d279d7ff6e4f4d9ada0cc27b28ccc7b0 | [] | no_license | Sc4pego4t/iosMVVMPattern | 9cbf03f2dac657338ee36ff20c99d4d4d11fa155 | b95f7c604b1fe397c7e26fc859f9aaa9fb99a3f1 | refs/heads/master | 2020-06-03T22:13:13.010788 | 2019-06-13T11:45:12 | 2019-06-13T11:45:12 | 191,752,523 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 418 | swift | //
// +UserDefaults.swift
// aquadroid
//
// Created by Андрей Глухих on 05/06/2019.
// Copyright © 2019 Андрей Глухих. All rights reserved.
//
import Foundation
extension UserDefaults {
enum Keys {
static let userToken = "token"
static let tokenString = "tokenString"
static let refreshProfileImage = "refreshProfileImage"
static let isLoginedBefore = "isLoginedBeforeKey"
}
}
| [
-1
] |
7f8c06b6eb35749303625f154a64dec5d8ce6379 | 574a7016a72dfafb5d5f1bcb8a33df38773614fc | /allbeat-ios/allbeat/allbeat/Controller.swift | 17da4c87ada0c30af9367f90e9f23f59929a8b63 | [] | no_license | abrevnov17/Allbeat-iOS-App | 9cf488ebf8cefdd29c75f1d86a6139b409e217b4 | 176958001bf85b86d99251b7ba65ec3158a5cba7 | refs/heads/master | 2021-01-18T22:10:47.136252 | 2017-07-19T16:25:50 | 2017-07-19T16:25:50 | 87,035,109 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 502 | swift | //
// Controller.swift
// allbeat
//
// Created by Nathan Flurry on 6/5/16.
// Copyright © 2016 allbeat, LLC. All rights reserved.
//
import Foundation
protocol Controller {
associatedtype T
associatedtype Callback = (T, Error) -> Void
func index(_ callback: Callback)
func store(_ model: T, callback: Callback)
func show(_ id: String, callback: Callback)
func update(_ model: T, parameters: [String: Any], callback: Callback)
func destroy(_ model: Model, callback: Callback)
}
| [
-1
] |
edb643293d26c1f8ab1d7c1f55ca5b25ce4ffba1 | 8bc0b38058ebfcf82d707acf8e8830063d1bbb88 | /calculatormax/ViewController.swift | 47aa9e63e6f78ec2285deddb27e6eba9d5aa380f | [] | no_license | drmusic45/ios-calculatormax-app | 0f8768362efc52445a305fc21cb2a493f1e4c568 | 4c88b45afeaf1eced2dcad28b20df3ccc9635e94 | refs/heads/master | 2021-01-10T12:22:43.245871 | 2016-03-30T18:53:54 | 2016-03-30T18:53:54 | 55,021,708 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,395 | swift | //
// ViewController.swift
// calculatormax
//
// Created by mobilestudio on 3/28/16.
// Copyright © 2016 mobilestudio. All rights reserved.
//
import UIKit
import AVFoundation
class ViewController: UIViewController {
enum Operation: String {
case Divide = "/"
case Multiply = "*"
case Subtract = "-"
case Add = "+"
case Empty = "Empty"
}
@IBOutlet weak var calcDisplay: UILabel!
var btnSound: AVAudioPlayer!
var runningNumber = ""
var leftVal = ""
var rightVal = ""
var currentOperation: Operation = Operation.Empty
var result = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//setup sound
let path = NSBundle.mainBundle().pathForResource("btn", ofType: "wav")
let soundUrl = NSURL(fileURLWithPath: path!)
do {
try btnSound = AVAudioPlayer(contentsOfURL: soundUrl)
btnSound.prepareToPlay()
} catch let err as NSError {
print(err.debugDescription)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func numberPressed(btn: UIButton!) {
btnSound.play()
runningNumber += "\(btn.tag)"
calcDisplay.text = runningNumber
}
@IBAction func onMultiplyPressed(sender: AnyObject) {
processOperation(Operation.Multiply)
}
@IBAction func onDividePressed(sender: AnyObject) {
processOperation(Operation.Divide)
}
@IBAction func onSubtractPressed(sender: AnyObject) {
processOperation(Operation.Subtract)
}
@IBAction func onAddPressed(sender: AnyObject) {
processOperation(Operation.Add)
}
@IBAction func onEqualsPressed(sender: AnyObject) {
processOperation(currentOperation)
}
func processOperation(op: Operation) {
playSound()
if currentOperation != Operation.Empty {
if runningNumber != "" {
rightVal = runningNumber
runningNumber = ""
if currentOperation == Operation.Multiply {
result = "\(Double(leftVal)! * Double(rightVal)!)"
} else if currentOperation == Operation.Divide {
result = "\(Double(leftVal)! / Double(rightVal)!)"
} else if currentOperation == Operation.Subtract {
result = "\(Double(leftVal)! - Double(rightVal)!)"
} else if currentOperation == Operation.Add {
result = "\(Double(leftVal)! + Double(rightVal)!)"
}
leftVal = result
calcDisplay.text = result
}
currentOperation = op
}
else {
//This is the first time an operator is pressed
leftVal = runningNumber
runningNumber = ""
currentOperation = op
}
}
func playSound() {
if btnSound.playing {
btnSound.stop()
}
btnSound.play()
}
}
| [
-1
] |
d3e3f9310d2264381bb668160b27120b4c62db47 | 903adb3bdc4f4589cde764f65832a11b5a00f5e7 | /information about Jupiter/information about Jupiter/ViewController.swift | c02d71b21863f4d9ad5dab089a020207d2e15a2a | [] | no_license | AsmaRashed1/week-04_HW_Localization | ba92c9a6da1880410fe0eb3c1cfcfed63c8362a7 | 0ea3464e72ae9f13d5f368452a3c23520cd5b909 | refs/heads/main | 2023-08-23T17:11:41.197176 | 2021-10-30T08:37:40 | 2021-10-30T08:37:40 | 422,269,824 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 299 | swift | //
// ViewController.swift
// information about Jupiter
//
// Created by Asma Rasheed on 22/03/1443 AH.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| [
254464,
350725,
329235,
317972,
258589,
254494,
254495,
254497,
172578,
266816,
219715,
353869,
399958,
402524,
412766,
315492,
384103,
352876,
349297,
361595,
415355,
334467,
384145,
409238,
384153,
324769,
351400,
322735,
381618,
402616,
244411,
111292,
313029,
330960,
146645,
328926,
165087,
332513,
56046,
210674,
351486,
275714,
391441,
375576,
399130,
397091,
326435,
356652,
372017,
319284,
383797,
397114,
354113,
384325,
437582,
362845,
313182,
425824,
399201,
353635,
374122,
333177,
398203,
327555,
356742,
316810,
395149,
316825,
155551,
436128,
396707,
241071,
396725,
384447,
360903,
359368,
323016,
346065,
359390,
383969,
350187,
343541,
435189,
323575,
320506
] |
fa5b8a47c1757908b0d624406d3185d5f026596a | f94be1db425c638f39f6c28eaf83354623df1135 | /Focusin/About/AboutWindowController.swift | 1b964e9281f2911b8cf0337bf354541d9fcf52bf | [
"MIT"
] | permissive | yichaosun/Focusin | dfecbfbcc077690cd3d01f378367e3e37ee48f8a | 3743ad4cfa72f1e954d05dc0147a4d4d6ac9e0f2 | refs/heads/master | 2020-03-28T10:47:11.677948 | 2017-02-12T22:19:12 | 2017-02-12T22:19:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 963 | swift | //
// AboutWindowController.swift
// Pomodoro
//
// Created by Alberto Quesada Aranda on 13/6/16.
// Copyright © 2016 Alberto Quesada Aranda. All rights reserved.
//
import Cocoa
class AboutWindowController: NSWindowController {
override func windowDidLoad() {
super.windowDidLoad()
self.window?.center()
self.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
override var windowNibName : String! {
return "AboutWindowController"
}
@IBAction func openIcons8(_ sender: AnyObject) {
NSWorkspace.shared().open(URL(string: "http://icons8.com")!)
}
@IBAction func openAlberto(_ sender: AnyObject) {
NSWorkspace.shared().open(URL(string: "http://albertoquesada.com")!)
}
@IBAction func getCode(_ sender: AnyObject) {
NSWorkspace.shared().open(URL(string: "https://github.com/albertoqa/Focusin")!)
}
}
| [
-1
] |
853a858fd28528cb59417c2fb3c1f91870f644c7 | 325249fb8f1d02f435495d05a98b9b5cf3caae02 | /EvenizeViewController.swift | 8a334ae1213fcbf46c74dd84fafdbe6ea4b6dd4a | [] | no_license | christinemunar/CentMeFree | ccd8b4011e504679a723395218c5165b5d797442 | 8b15cd2286958fae3736a180363b896d1fc0baf4 | refs/heads/master | 2021-01-10T13:41:41.693637 | 2016-02-18T12:13:35 | 2016-02-18T12:13:35 | 52,004,064 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,687 | swift | //
// EvenizeViewController.swift
// TipCalc
//
// Created by Christine Munar on 2/17/16.
// Copyright © 2016 Christine Munar. All rights reserved.
//
import UIKit
class EvenizeViewController: UIViewController {
@IBOutlet weak var slider: UISlider!
@IBOutlet weak var totalAmount: UILabel!
@IBOutlet weak var tipPercent: UILabel!
@IBOutlet weak var tipAmount: UILabel!
var currentAmount = Double()
var totalAmountLabel = String()
var tipPercentLabel = String()
var tipAmountLabel = String()
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBarHidden = false
totalAmount.text = totalAmountLabel
tipPercent.text = tipPercentLabel
tipAmount.text = tipAmountLabel
slider.minimumTrackTintColor = UIColor.greenColor()
}
override func viewWillDisappear(animated: Bool) {
self.navigationController?.navigationBarHidden = false
}
@IBAction func valueChanged(sender: AnyObject) {
let sliderVal = slider.value
let sliderAmount:Double = round(currentAmount + (currentAmount * Double(sliderVal)))
totalAmount.text = "$"+String(format: "%.2f",sliderAmount)
let sliderTipAmount:Double = sliderAmount - currentAmount
tipAmount.text = "$"+String(format: "%.2f",sliderTipAmount)
let sliderTipPercent:Double = ((sliderAmount - currentAmount)/currentAmount) * 100
tipPercent.text = String(format: "%.1f", sliderTipPercent) + "%"
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
| [
-1
] |
115b24c52020de22deacee950448292f88c9594d | f755f101c195bd2608233462ecb12e1f926c4f06 | /DuckDuckGo/DaxDialogsSettings.swift | 3e891a2d25b1c384a9c881702a28f4655c12559f | [
"Apache-2.0",
"CC-BY-NC-ND-4.0"
] | permissive | samsymons/iOS | a7e16eded6a298c8b682df69b9d94d4ccb73beb8 | 843f47490c112e36f0bd1a8ab26c5c11118e2159 | refs/heads/develop | 2022-12-13T02:07:11.431666 | 2020-09-04T21:19:39 | 2020-09-04T21:19:39 | 293,172,661 | 1 | 0 | Apache-2.0 | 2023-08-26T02:57:43 | 2020-09-05T23:54:21 | HTML | UTF-8 | Swift | false | false | 2,213 | swift | //
// DaxDialogsSettings.swift
// DuckDuckGo
//
// Copyright © 2020 DuckDuckGo. All rights reserved.
//
// 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 Core
protocol DaxDialogsSettings {
var isDismissed: Bool { get set }
var homeScreenMessagesSeen: Int { get set }
var browsingAfterSearchShown: Bool { get set }
var browsingWithTrackersShown: Bool { get set }
var browsingWithoutTrackersShown: Bool { get set }
var browsingMajorTrackingSiteShown: Bool { get set }
}
class DefaultDaxDialogsSettings: DaxDialogsSettings {
@UserDefaultsWrapper(key: .daxIsDismissed, defaultValue: true)
var isDismissed: Bool
@UserDefaultsWrapper(key: .daxHomeScreenMessagesSeen, defaultValue: 0)
var homeScreenMessagesSeen: Int
@UserDefaultsWrapper(key: .daxBrowsingAfterSearchShown, defaultValue: false)
var browsingAfterSearchShown: Bool
@UserDefaultsWrapper(key: .daxBrowsingWithTrackersShown, defaultValue: false)
var browsingWithTrackersShown: Bool
@UserDefaultsWrapper(key: .daxBrowsingWithoutTrackersShown, defaultValue: false)
var browsingWithoutTrackersShown: Bool
@UserDefaultsWrapper(key: .daxBrowsingMajorTrackingSiteShown, defaultValue: false)
var browsingMajorTrackingSiteShown: Bool
}
class InMemoryDaxDialogsSettings: DaxDialogsSettings {
var isDismissed: Bool = false
var homeScreenMessagesSeen: Int = 0
var browsingAfterSearchShown: Bool = false
var browsingWithTrackersShown: Bool = false
var browsingWithoutTrackersShown: Bool = false
var browsingMajorTrackingSiteShown: Bool = false
}
| [
-1
] |
766bb5c95ada46f21b73facc5e0f8c0695e0a281 | 6b11ed848566af5afeb85a349963c61b32f59708 | /Pitch Perfect/Pitch Perfect/RecordedAudio.swift | 0c87dc9a86b6cda0c32bfc91e1c443afbb224eee | [] | no_license | parrajustin/pitch-perfect | c3545d8cc73ff77207e82aacbadf1486aff5141e | 8a9c019b1b477c712c04df2ce0bc7650124e29d3 | refs/heads/master | 2020-04-01T08:24:57.001531 | 2015-05-02T01:20:13 | 2015-05-02T01:20:13 | 153,029,815 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 370 | swift | //
// RecordedAudio.swift
// Pitch Perfect
//
// Created by Erik Parra on 4/20/15.
// Copyright (c) 2015 Erik Parra. All rights reserved.
//
import Foundation
class RecordedAudio: NSObject{
var filePathUrl: NSURL
var title: String
init( filePath path: NSURL, setTitle newtitle: String) {
filePathUrl = path
title = newtitle
}
} | [
-1
] |
5ea608bec6878e90377112afbe74a00894d40bf7 | a6fce65b0833f39cf366d252d8e6749c3c6bef30 | /Zensei/SceneDelegate.swift | 29b653ae2b073e8a7b9251a60d444c2d11d6d1f7 | [] | no_license | vccalvin33/MC1-Zensei | d6456983260b4806b3f15c3be039388464a3bc0d | 09a830b73a3bdc67acce0d563fdce743a6b41b8f | refs/heads/master | 2023-01-22T11:22:25.450913 | 2020-11-25T08:05:55 | 2020-11-25T08:05:55 | 315,867,916 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,561 | swift | //
// SceneDelegate.swift
// Zensei
//
// Created by Shendy Aditya Syamsudin on 07/04/20.
// Copyright © 2020 Apple Developer Academy. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
180491,
336140,
164107,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
189154,
369382,
361196,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
262943,
369439,
418591,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
222129,
345036,
386004,
345046,
386012,
386019,
386023,
328690,
435188,
328703,
328710,
418822,
377867,
328715,
386070,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
361594,
410746,
214150,
345224,
386187,
337048,
345247,
361645,
345268,
337076,
402615,
361657,
402636,
328925,
165086,
165092,
328933,
222438,
328942,
386286,
386292,
206084,
115973,
328967,
345377,
345380,
353572,
345383,
337207,
345400,
369979,
386366,
337224,
337230,
337235,
263509,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
419360,
370208,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
419401,
353868,
419404,
173648,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
345766,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
403139,
337607,
419528,
419531,
272083,
394967,
419543,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
378664,
354107,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
247639,
337751,
370520,
313181,
182110,
354143,
354157,
345965,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
395148,
247692,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
247760,
346064,
346069,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
395340,
378956,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
411806,
329886,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
346317,
411862,
256214,
411865,
411869,
411874,
379108,
411877,
387303,
395496,
346344,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
272787,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
273109,
264919,
338661,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
330711,
248794,
248799,
437219,
257009,
265208,
330750,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
126148,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
437576,
437584,
331089,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
175491,
249219,
249225,
249228,
249235,
175514,
175517,
396703,
396706,
175523,
355749,
396723,
388543,
380353,
339401,
380364,
339406,
372177,
339414,
249303,
413143,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
126597,
421509,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257802,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
397089,
257825,
225059,
339748,
225068,
257837,
413485,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
257891,
413539,
225128,
257897,
225138,
339827,
257909,
372598,
225142,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372698,
372704,
372707,
356336,
380919,
393215,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
192674,
225442,
438434,
225445,
225448,
438441,
225451,
258223,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
389322,
225485,
225488,
225491,
266454,
225494,
225497,
225500,
225503,
225506,
356580,
225511,
225515,
225519,
381177,
397572,
389381,
356631,
356638,
356641,
356644,
356647,
266537,
389417,
356650,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
332162,
348548,
356741,
332175,
160152,
373146,
373149,
70048,
356783,
266688,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
348745,
381513,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
332464,
332473,
381626,
332484,
332487,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
348926,
389927,
348979,
152371,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
201580,
201583,
349041,
340850,
201589,
381815,
430967,
324473,
398202,
119675,
340859,
324476,
430973,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
349173,
381947,
201724,
349181,
431100,
431107,
349203,
209944,
209948,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
431180,
209996,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
349313,
160896,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
234867,
390518,
357756,
374161,
112021,
349591,
357793,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
267929,
333472,
333512,
259789,
358100,
366301,
333535,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
210720,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
268144,
358256,
358260,
399222,
325494,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
333767,
358348,
333777,
219094,
358372,
350190,
350194,
333819,
350204,
325633,
325637,
350214,
333838,
350225,
350232,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
252021,
342134,
374904,
268435,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
334047,
350449,
375027,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
350494,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
194942,
391564,
366991,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
252483,
219719,
399957,
244309,
334425,
326240,
375401,
334466,
334469,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
334530,
260802,
350918,
154318,
342737,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
375616,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
252801,
260993,
400260,
211846,
342921,
342931,
252823,
400279,
392092,
400286,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
187335,
326599,
359367,
359383,
359389,
383968,
343018,
359411,
261109,
261112,
244728,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
384099,
384102,
384108,
367724,
326764,
187503,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
384189,
384192,
343232,
351424,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
343307,
384270,
359695,
261391,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
245042,
326970,
384324,
343366,
212296,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
359984,
400977,
400982,
179803,
138865,
155255,
155274,
368289,
245410,
425639,
245415,
425652,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
155488,
376672,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
262006,
147319,
262009,
327542,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
262046,
253854,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
253927,
327655,
360432,
393204,
360439,
253944,
393209,
155647
] |
40a8fd99626c77e79a1744b4ad8c19f5eaee4457 | 129eb9583f25a0d47e8ed2d198ccbaf6b132595d | /Heady/Heady/Model/Tax.swift | 1d0025ff8c05e42328674fb26c7db94662af7910 | [] | no_license | pritamsingh/Heady | 460aefce4ecd8c53e11e7fdff2963df543861ba3 | 95ad47e9d6bfbb689352a5bc43112567aeb99779 | refs/heads/master | 2020-04-13T01:38:19.448329 | 2018-12-26T19:38:00 | 2018-12-26T19:38:00 | 162,879,539 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 448 | swift | //
// Tax.swift
// Heady
//
// Created by Pritam on 20/12/18.
// Copyright © 2018 parihar. All rights reserved.
//
import UIKit
protocol Tax {
var name: String {get}
var value : Float {get}
}
struct ProductTax : Tax {
var name: String
var value: Float
init(_ dict : NSDictionary) {
name = dict.value(forKey: "name") as! String
value = dict.value(forKey: "value") as! Float
}
}
| [
-1
] |
eefd8e2cbd069eb721bee0664a9e1172e603e96f | ae047711e05919e91b125a55a594bf2eb3376cf7 | /Reminder/SceneDelegate.swift | 2897b1144f9a53cb746312037c27afd69f9d6d2e | [] | no_license | Erumaru/reminder | 5d4ccb23d5e8bff8dde8b798fca7bea5dcca1ea0 | aa39cc47883886f251894e1e718ad1ad3d05fef7 | refs/heads/master | 2020-08-26T16:33:41.066891 | 2019-10-23T14:14:44 | 2019-10-23T14:14:44 | 217,074,643 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,414 | swift | //
// SceneDelegate.swift
// Reminder
//
// Created by erumaru on 10/23/19.
// Copyright © 2019 KBTU. All rights reserved.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
window?.rootViewController = ClassStructEnumViewController()
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
| [
393221,
163849,
393228,
393231,
393251,
352294,
344103,
393260,
393269,
213049,
376890,
385082,
16444,
393277,
376906,
327757,
254032,
286804,
368728,
180314,
254045,
368736,
180322,
376932,
286833,
286845,
286851,
417925,
262284,
360598,
286880,
286889,
377003,
377013,
164029,
327872,
180418,
377030,
377037,
180432,
377047,
418008,
385243,
418012,
377063,
327915,
205037,
393457,
393461,
393466,
418044,
336124,
385281,
336129,
262405,
164107,
180491,
336140,
262417,
368913,
262423,
377118,
377121,
262437,
254253,
336181,
262455,
393539,
262473,
344404,
213333,
418135,
270687,
262497,
418145,
262501,
213354,
246124,
262508,
262512,
213374,
385420,
262551,
262553,
385441,
385444,
262567,
385452,
262574,
393649,
385460,
262587,
344512,
262593,
336326,
360917,
369119,
328178,
328180,
328183,
328190,
254463,
328193,
98819,
164362,
328207,
410129,
393748,
377372,
188959,
385571,
377384,
197160,
33322,
352822,
270905,
197178,
418364,
188990,
369224,
385610,
270922,
352844,
385617,
352865,
262761,
352875,
344694,
352888,
336513,
377473,
336517,
344710,
385671,
148106,
377485,
352919,
98969,
336549,
344745,
361130,
336556,
434868,
164535,
336568,
164539,
328379,
328387,
352969,
418508,
385743,
385749,
139998,
189154,
369382,
361196,
418555,
344832,
336644,
344837,
344843,
328462,
361231,
394002,
336660,
418581,
418586,
434971,
369436,
369439,
418591,
262943,
418594,
336676,
418600,
418606,
271154,
328498,
369464,
361274,
328516,
336709,
328520,
336712,
361289,
328523,
336715,
361300,
213848,
426842,
361307,
197469,
361310,
254813,
361318,
344936,
361323,
361335,
328574,
369544,
361361,
222129,
345036,
386004,
345046,
386012,
386019,
328690,
435188,
328703,
328710,
418822,
328715,
377867,
386070,
336922,
345119,
377888,
328747,
214060,
345134,
345139,
361525,
386102,
361537,
377931,
197708,
189525,
156762,
402523,
361568,
148580,
345200,
361591,
386168,
410746,
361594,
214150,
345224,
386187,
337048,
345247,
361645,
345268,
337076,
402615,
361657,
337093,
402636,
328925,
165086,
165092,
328933,
222438,
386286,
328942,
386292,
206084,
115973,
328967,
345377,
353572,
345380,
345383,
263464,
337207,
345400,
378170,
369979,
337224,
337230,
337235,
353634,
337252,
402792,
345449,
99692,
271731,
378232,
337278,
271746,
181639,
353674,
181644,
361869,
181650,
181655,
230810,
181671,
181674,
181679,
181682,
337330,
181687,
370105,
181691,
181697,
361922,
337350,
181704,
337366,
271841,
329192,
361961,
329195,
116211,
337399,
402943,
337416,
329227,
419341,
419345,
329234,
419351,
345626,
419357,
345631,
370208,
419360,
394787,
419363,
370214,
419369,
394796,
419377,
419386,
206397,
214594,
419401,
419404,
353868,
419408,
214611,
419412,
403040,
345702,
222831,
370298,
353920,
403073,
403076,
345737,
198282,
403085,
403092,
345750,
419484,
345758,
345763,
419492,
419498,
419502,
370351,
419507,
337588,
419510,
419513,
419518,
337601,
403139,
337607,
419528,
419531,
419536,
272083,
394967,
419545,
345819,
419548,
181982,
419551,
345829,
419560,
337643,
419564,
337647,
370416,
141052,
337661,
337671,
362249,
362252,
395022,
362256,
321300,
345888,
116512,
362274,
378664,
354107,
354112,
247618,
370504,
329545,
345932,
354124,
370510,
354132,
337751,
247639,
370520,
313181,
182110,
354143,
345965,
354157,
345968,
345971,
345975,
182136,
403321,
1914,
354173,
247692,
395148,
337809,
247701,
329625,
436127,
436133,
247720,
337834,
362414,
337845,
190393,
346059,
346064,
247760,
346069,
419810,
329699,
354275,
190440,
247790,
354314,
346140,
337980,
436290,
378956,
395340,
436307,
338005,
329816,
100454,
329833,
329853,
329857,
329868,
329886,
411806,
346273,
362661,
100525,
387250,
379067,
387261,
256193,
395467,
411862,
411865,
411869,
411874,
379108,
411877,
387303,
346344,
395496,
338154,
387307,
346350,
338161,
436474,
321787,
379135,
411905,
411917,
43279,
379154,
395539,
387350,
387353,
338201,
182559,
338212,
248112,
362823,
436556,
321880,
362844,
379234,
354674,
182642,
321911,
420237,
379279,
354728,
338353,
338363,
338382,
272849,
248279,
256474,
182755,
338404,
338411,
330225,
248309,
199165,
248332,
330254,
199182,
199189,
420377,
330268,
191012,
330320,
199250,
191069,
346722,
248427,
191085,
338544,
191093,
346743,
330384,
346769,
150184,
174775,
248505,
174778,
363198,
223936,
355025,
355029,
273109,
264919,
338661,
264942,
330479,
363252,
338680,
207620,
264965,
191240,
338701,
256787,
363294,
199455,
396067,
346917,
396070,
215854,
355123,
355141,
355144,
338764,
355151,
330581,
330585,
387929,
355167,
265056,
265059,
355176,
355180,
355185,
330612,
330643,
412600,
207809,
379849,
347082,
396246,
330711,
248794,
248799,
347106,
437219,
257009,
265208,
330750,
265215,
199681,
338951,
330761,
330769,
330775,
248863,
158759,
396329,
347178,
404526,
396337,
330803,
396340,
339002,
388155,
339010,
347208,
248905,
330827,
330830,
248915,
183384,
339037,
412765,
257121,
322660,
265321,
330869,
248952,
420985,
330886,
347288,
248986,
44199,
380071,
339118,
249018,
339133,
322763,
330959,
330966,
265433,
265438,
388320,
363757,
339199,
396552,
175376,
175397,
208167,
273709,
372016,
437553,
347442,
199989,
175416,
396601,
208189,
437567,
175425,
437571,
126279,
437576,
437584,
331089,
331094,
396634,
175451,
437596,
429408,
175458,
208228,
175461,
175464,
265581,
331124,
175478,
249210,
175484,
175487,
249215,
249219,
175491,
249225,
249228,
249235,
175514,
175517,
396703,
175523,
355749,
396723,
388543,
380353,
216518,
339401,
380364,
339406,
372177,
339414,
413143,
249303,
339418,
339421,
249310,
339425,
249313,
339429,
339435,
249329,
69114,
372229,
339464,
249355,
208399,
175637,
134689,
339504,
265779,
421442,
413251,
265796,
265806,
224854,
224858,
339553,
257636,
224871,
372328,
257647,
372338,
339572,
224885,
224888,
224891,
224895,
421509,
126597,
224905,
11919,
224911,
224914,
126611,
224917,
224920,
126618,
208539,
224923,
224927,
224930,
224933,
257705,
224939,
224943,
257713,
224949,
257717,
257721,
224954,
257725,
224960,
257733,
224966,
224970,
257740,
224976,
257745,
339664,
257748,
224982,
257752,
224987,
257762,
224996,
225000,
339696,
225013,
257788,
225021,
339711,
257791,
225027,
257796,
339722,
257805,
225039,
257808,
249617,
225044,
167701,
372500,
257815,
225049,
257820,
225054,
184096,
257825,
225059,
339748,
257834,
225068,
257837,
413485,
225071,
225074,
257843,
225077,
257846,
225080,
397113,
225083,
397116,
257853,
225088,
225094,
225097,
323404,
257869,
257872,
225105,
339795,
397140,
225109,
225113,
257881,
257884,
257887,
225120,
413539,
257891,
225128,
257897,
339818,
225138,
339827,
257909,
225142,
372598,
257914,
257917,
225150,
257922,
380803,
225156,
339845,
257927,
225166,
397201,
225171,
380823,
225176,
225183,
372665,
372698,
372704,
372707,
356336,
380919,
372739,
405534,
266295,
266298,
217158,
421961,
200786,
356440,
217180,
430181,
266351,
356467,
266365,
192640,
266375,
381069,
225425,
250003,
225430,
250008,
356507,
250012,
225439,
135328,
225442,
438434,
192674,
225445,
225448,
438441,
225451,
225456,
430257,
225459,
225462,
225468,
389309,
225472,
372931,
225476,
430275,
389322,
225485,
225488,
225491,
225494,
266454,
225497,
225500,
225503,
225506,
356580,
225511,
217319,
225515,
225519,
381177,
356631,
258333,
356638,
356641,
356644,
356647,
266537,
356650,
389417,
356656,
332081,
307507,
340276,
356662,
397623,
332091,
225599,
332098,
201030,
348489,
332107,
151884,
430422,
348503,
332118,
332130,
250211,
340328,
250217,
348523,
348528,
332153,
356734,
389503,
332158,
438657,
250239,
332162,
348548,
356741,
332175,
160152,
373146,
340380,
373149,
70048,
356783,
373169,
324032,
201158,
127473,
217590,
340473,
324095,
324100,
324103,
324112,
340501,
324118,
324122,
340512,
332325,
324134,
381483,
356908,
324141,
324143,
356917,
324150,
324156,
168509,
348734,
324161,
324165,
356935,
381513,
348745,
324171,
324174,
324177,
389724,
332381,
373344,
340580,
348777,
381546,
119432,
340628,
184983,
373399,
340639,
258723,
332455,
332460,
332464,
332473,
381626,
332484,
332487,
373450,
332494,
357070,
357074,
332512,
332521,
340724,
332534,
155647,
348926,
389927,
348979,
152371,
340792,
398141,
127815,
357202,
389971,
357208,
136024,
389979,
430940,
357212,
357215,
439138,
201580,
201583,
349041,
340850,
201589,
430967,
381815,
324473,
398202,
119675,
324476,
430973,
340859,
324479,
340863,
324482,
324485,
324488,
185226,
381834,
324493,
324496,
324499,
430996,
324502,
324511,
422817,
324514,
201638,
373672,
324525,
5040,
111539,
324534,
5047,
324539,
324542,
398280,
349129,
340940,
340942,
209874,
340958,
431073,
398307,
340964,
209896,
201712,
209904,
381947,
201724,
431100,
349181,
431107,
349203,
209944,
209948,
250915,
250917,
357419,
209966,
209969,
209973,
209976,
209980,
209988,
209991,
209996,
431180,
341072,
349268,
250968,
210011,
373853,
341094,
210026,
210028,
210032,
349296,
210037,
210042,
210045,
349309,
152704,
160896,
349313,
210053,
210056,
349320,
259217,
373905,
210068,
210072,
210078,
210081,
210085,
210089,
210096,
210100,
324792,
210108,
357571,
210116,
210128,
333010,
210132,
333016,
210139,
210144,
218355,
251123,
218361,
275709,
128254,
275713,
242947,
275717,
275723,
333075,
349460,
333079,
251161,
349486,
349492,
415034,
251211,
210261,
365912,
259423,
374113,
251236,
374118,
333164,
234867,
390518,
357756,
374161,
112021,
349591,
333222,
210357,
259516,
415168,
366035,
415187,
366039,
415192,
415194,
415197,
415200,
333285,
415208,
366057,
366064,
415217,
415225,
423424,
415258,
415264,
366118,
415271,
382503,
349739,
144940,
415279,
415282,
415286,
210488,
415291,
415295,
333387,
333396,
333400,
366173,
333415,
423529,
423533,
333423,
210547,
415354,
333440,
267910,
267929,
333472,
333512,
333515,
259789,
358100,
366301,
333535,
153311,
366308,
366312,
431852,
399086,
366319,
210673,
366322,
399092,
366326,
333566,
268042,
210700,
366349,
210707,
399129,
333593,
333595,
366384,
358192,
210740,
366388,
358201,
399166,
325441,
366403,
325447,
341831,
341835,
341839,
341844,
415574,
358235,
341852,
350046,
399200,
399208,
358256,
268144,
358260,
341877,
325494,
399222,
186233,
333690,
243584,
325505,
333699,
399244,
333709,
333725,
333737,
382891,
333767,
350153,
358348,
333777,
399318,
219094,
358372,
350190,
350194,
333819,
350204,
350207,
325633,
325637,
350214,
333838,
350225,
350232,
333851,
350238,
350241,
374819,
350245,
350249,
350252,
178221,
350257,
350260,
350272,
243782,
350281,
350286,
374865,
342113,
252021,
342134,
374904,
333989,
333998,
334012,
260299,
350411,
350417,
350423,
350426,
334047,
350449,
358645,
350454,
350459,
350462,
350465,
350469,
325895,
268553,
194829,
350477,
268560,
350481,
432406,
350487,
350491,
325915,
350494,
325918,
325920,
350500,
350505,
358701,
391469,
350510,
358705,
358714,
358717,
383307,
358738,
334162,
383331,
383334,
391531,
383342,
334204,
268669,
391564,
366991,
268702,
342431,
375209,
326059,
375220,
342453,
334263,
326087,
358857,
195041,
334312,
104940,
375279,
350724,
186898,
342546,
350740,
342551,
334359,
342555,
334364,
416294,
350762,
252463,
358962,
334386,
334397,
358973,
252483,
219719,
399957,
244309,
334425,
326240,
334466,
334469,
391813,
162446,
326291,
342680,
342685,
260767,
342711,
244410,
260798,
260802,
350918,
154318,
342737,
391895,
154329,
416476,
64231,
113389,
342769,
203508,
375541,
342777,
391938,
391949,
375569,
326417,
375572,
375575,
375580,
162592,
334633,
326444,
383794,
326452,
326455,
375613,
244542,
260925,
375616,
326463,
326468,
244552,
342857,
326474,
326479,
326486,
416599,
342875,
244572,
326494,
326503,
433001,
326508,
400238,
326511,
211826,
211832,
392061,
351102,
359296,
260993,
351105,
400260,
211846,
342931,
400279,
252823,
392092,
400286,
252838,
359335,
211885,
400307,
351169,
359362,
351172,
170950,
359367,
326599,
187335,
359383,
359389,
383968,
343018,
359411,
261109,
244728,
261112,
383999,
261130,
261148,
359452,
211999,
261155,
261160,
261166,
359471,
375868,
343132,
384099,
384102,
367724,
384108,
326764,
343155,
384115,
212095,
384136,
384140,
384144,
384152,
384158,
384161,
351399,
384169,
367795,
384182,
367801,
384189,
351424,
384192,
343232,
244934,
367817,
244938,
384202,
253132,
326858,
343246,
384209,
146644,
351450,
384225,
359650,
343272,
351467,
359660,
384247,
351480,
384250,
351483,
351492,
343307,
384270,
261391,
359695,
253202,
261395,
384276,
384284,
245021,
384290,
253218,
245032,
171304,
384299,
351535,
376111,
245042,
326970,
384324,
343366,
212296,
212304,
367966,
343394,
343399,
367981,
343410,
155000,
327035,
245121,
245128,
253321,
155021,
384398,
245137,
245143,
245146,
245149,
343453,
245152,
245155,
155045,
245158,
40358,
245163,
114093,
327090,
343478,
359867,
384444,
146878,
327108,
327112,
384457,
327118,
359887,
359891,
343509,
368093,
155103,
343535,
343540,
368120,
343545,
409092,
359948,
359951,
245295,
359984,
400977,
400982,
179803,
245358,
138865,
155255,
155274,
368289,
245410,
425639,
245415,
425652,
155323,
425663,
155328,
245463,
155352,
155356,
212700,
155364,
245477,
155372,
245487,
212723,
245495,
409336,
155394,
155404,
245528,
155423,
360224,
155439,
204592,
155444,
155448,
417596,
384829,
384831,
360262,
155463,
155477,
376665,
155484,
261982,
425823,
376672,
155488,
155492,
327532,
261997,
376686,
262000,
262003,
425846,
327542,
147319,
262006,
262009,
262012,
155517,
155523,
155526,
360327,
376715,
155532,
262028,
262031,
262034,
262037,
262040,
262043,
155550,
253854,
262046,
262049,
262052,
327590,
155560,
155563,
155566,
327613,
393152,
311244,
212945,
393170,
155604,
155620,
253924,
155622,
327655,
253927,
360432,
204785,
393204,
360439,
253944,
393209,
393215
] |
184fd5c60531ed5273c00d3ceb681d5544b4c374 | a2168830dfc07b4d156e9c1854d966fe180ca35f | /Allo-Apple-SwiftUI/View/MenuTableView.swift | 2e2d7d1262231ecd033b53ea40ad37d274d38af0 | [] | no_license | selimchiki/Allo-Apple-SwiftUI | d71a5bf98f8a7dbf52f466fdce29a05fab560a17 | ad201503af96ec95ffa4b8a6a7d0cc81abf31989 | refs/heads/master | 2020-08-27T13:45:51.349320 | 2019-10-25T08:36:12 | 2019-10-25T08:36:12 | 217,393,399 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 955 | swift | //
// MenuTableView.swift
// Allo-Apple-SwiftUI
//
// Created by Sélim Chiki on 23/10/2019.
// Copyright © 2019 Sélim Chiki. All rights reserved.
//
import SwiftUI
struct MenuTableView: View {
var category: String
@State var menuItems = [MenuItem]()
var body: some View {
List(menuItems) { menuItem in
NavigationLink(destination: MenuItemDetailView(menuItem: menuItem)) {
Text(menuItem.name)
}
}.navigationBarTitle(self.category)
.onAppear(perform: self.fetchMenuItem)
}
private func fetchMenuItem() {
MenuController.shared.fetchMenuItems(forCategory: category) { (menuItems) in
if let menuItems = menuItems {
self.menuItems = menuItems
}
}
}
}
struct MenuTableView_Previews: PreviewProvider {
static var previews: some View {
MenuTableView(category: "Entree")
}
}
| [
-1
] |
2af82435a9a380d1459741c9a9003527c7d1fa66 | 2cd0c46986e050a5296d2d9d09203d5a0c0095b0 | /YQImagePickerController/Classes/ViewController.swift | 1ad1714069252187540a0e95b74e9d50a6a0626c | [
"MIT"
] | permissive | xutongle/YQImagePickerController | 51a9b4eee588f110bf8251642bc6af07a77ecc3e | e645ee97237fd67c37583ce15e86cddea97f5159 | refs/heads/master | 2021-01-18T18:54:55.190865 | 2017-03-29T15:48:15 | 2017-03-29T15:48:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,250 | swift | //
// ViewController.swift
// YQImagePickerController
//
// Created by CoderYQ on 2017/3/11.
// Copyright © 2017年 CoderYQ. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func btnDidClick(_ sender: Any) {
let picker = YQImagePickerController(delegate: self)
self.present(picker, animated: true, completion: nil)
}
}
//MARK:- YQImagePickerControllerDelegate
extension ViewController: YQImagePickerControllerDelegate, UIImagePickerControllerDelegate {
func imagePickerController(_ picker: YQImagePickerController!, didFinishPickingVideo coverImage: UIImage!, sourceAssets asset: Any!) {
}
func imagePickerController(_ picker: YQImagePickerController!, didFinishPickingGifImage animatedImage: UIImage!, sourceAssets asset: Any!) {
}
func imagePickerController(_ picker: YQImagePickerController!, didFinishPickingPhotos photos: [UIImage]!, sourceAssets assets: [Any]!, isSelectOriginalPhoto: Bool) {
}
func imagePickerControllerDidClickCancelButton(_ picker: YQImagePickerController!) {
}
}
| [
-1
] |
d31444062f202fd4850d9a9a50f97507abd62546 | a752ab3e548b432cf53093d60ed74da6471af909 | /XZHouseKeeper/Class/View/Main/主控制器/XZNavigationController.swift | f67205d79406d1c4583b48848d54ee5423caee20 | [
"MIT"
] | permissive | CoderXAndZ/XZHousekeeper | 6db9fe2aff48c6819736984eab6f30bd41210f9a | 019f25c4069699f58179555aa951aefc74b967c3 | refs/heads/master | 2021-05-03T19:54:05.904498 | 2018-02-09T07:34:54 | 2018-02-09T07:34:54 | 120,389,044 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,788 | swift | //
// XZNavigationController.swift
// XZHousekeeper
//
// Created by admin on 2018/2/5.
// Copyright © 2018年 XZ. All rights reserved.
//
import UIKit
class XZNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
//
setupNavigationBar()
}
// // MARK: - 访客视图的注册/登录按钮添加点击事件
// /// 登录
// @objc func loginAction() {
// print("用户登录")
// // 发送通知
// NotificationCenter.default.post(name:NSNotification.Name(rawValue: XZUserShouldLoginNotification), object: nil)
// }
//
// /// 注册
// @objc func registerAction() {
// print("用户注册")
// }
// 重写 push 方法
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
// 如果不是栈底控制器才需要隐藏,根控制器不需要处理
if childViewControllers.count > 0 {
// 隐藏底部的 tabBar
viewController.hidesBottomBarWhenPushed = true
// 判断控制器的类型
if let vc = viewController as? XZBaseViewController {
var title = "返回"
// 只有一个子控制器的时候,显示栈底控制器的标题
if childViewControllers.count == 1 {
title = childViewControllers.first?.title ?? "返回"
}
// 取出自定义的 navItem,设置左侧按钮作为返回按钮
vc.navigationItem.leftBarButtonItem = UIBarButtonItem(title: title,target: self, action: #selector(backAction), isBack: true)
}
}
super.pushViewController(viewController, animated: true)
}
/// 返回上层控制器
@objc func backAction() {
popViewController(animated: true)
}
}
// MARK: -
extension XZNavigationController {
/// 设置导航条
private func setupNavigationBar() {
// 1>设置 navBar 的背景渲染颜色
navigationBar.barTintColor = UIColor(hex: 0xF6F6F6)
// 2>设置 navBar 的 title 颜色
navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.darkGray]
// 3>设置 navBar 的 BarButtonItem 文字渲染颜色
navigationBar.tintColor = .orange
// // 3.设置导航条按钮
// navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .plain, target: self, action: #selector(registerAction))
// navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .plain, target: self, action: #selector(loginAction))
}
}
| [
-1
] |
0df81e1e60186b06906e5ac65789a6d1920e3db1 | 690eb75fe5b4a6ffc04510c84f27dfeb47fc1319 | /Easytracking/AppDelegate.swift | 5489aad2a9af23de7205be028c4e28951bcb687b | [] | no_license | lucasfeitosatech/Easytracking_IOS | 536dcbe3468953bba76212fb5f7e69ecdb399bb9 | 643ae3a0005e2470556a91367fda9f3520369719 | refs/heads/master | 2020-07-11T07:06:02.867965 | 2019-08-28T17:25:28 | 2019-08-28T17:25:28 | 204,473,680 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,195 | swift | //
// AppDelegate.swift
// Easytracking
//
// Created by Lucas Freitas on 26/08/19.
// Copyright © 2019 lucasfeitosa.tech. 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,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
237618,
229426,
229428,
286774,
286776,
319544,
286778,
229432,
204856,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
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,
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,
189039,
172656,
352880,
295538,
189040,
172660,
287349,
189044,
172655,
287355,
287360,
295553,
172675,
295557,
287365,
311942,
303751,
352905,
311946,
287371,
279178,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
287400,
279208,
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,
304009,
213895,
304011,
230284,
304013,
295822,
189325,
213902,
189329,
295825,
304019,
279438,
189331,
58262,
304023,
304027,
279452,
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,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
164973,
205934,
279661,
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,
230679,
320792,
230681,
296215,
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,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
279991,
288185,
337335,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288217,
288218,
280027,
288220,
239070,
288224,
370146,
280034,
288226,
288229,
280036,
280038,
288232,
288230,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
402969,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
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,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
288499,
419570,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
337732,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
141455,
275606,
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,
280819,
157940,
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,
280937,
313705,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
150025,
338440,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
182926,
133776,
182929,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
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,
224151,
240535,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
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,
298365,
290174,
306555,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
323090,
282130,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
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,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
44948,
298901,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
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,
299191,
307385,
176311,
258235,
307388,
176316,
307390,
307386,
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,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
127440,
176592,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
127494,
283142,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
135707,
234010,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
299655,
373383,
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,
299778,
234242,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
292433,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
291711,
234368,
291714,
234370,
291716,
234373,
226182,
234375,
308105,
226185,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
324508,
234398,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
324522,
234410,
291756,
291754,
226220,
324527,
234414,
234417,
201650,
324531,
291760,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
226239,
226245,
234437,
234439,
234443,
291788,
193486,
234446,
193488,
234449,
275406,
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,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
226453,
234648,
234650,
308379,
275608,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
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,
316959,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
276043,
317004,
366155,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
276052,
284247,
276053,
235097,
243290,
284249,
284251,
317015,
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,
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,
399252,
284564,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
276466,
325624,
350200,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
317446,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
325700,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
227418,
350299,
194649,
350302,
194654,
350304,
178273,
309346,
227423,
194660,
350308,
309350,
309348,
292968,
309352,
350313,
309354,
350316,
227430,
276583,
301167,
276590,
350321,
284786,
276595,
227440,
350325,
252022,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
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,
227583,
276735,
227587,
276739,
211204,
276742,
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,
293346,
227810,
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,
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,
342707,
154292,
277173,
318132,
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,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
277368,
15224,
416639,
416640,
113538,
310147,
416648,
277385,
39817,
187274,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
293811,
276579,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
244731,
285690,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
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,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
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,
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,
310780,
286203,
40448,
228864,
286214,
228871,
302603,
302614,
302617,
286233,
302621,
286240,
187936,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
245288,
310831,
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,
302764,
278188,
278192,
319153,
278196,
319163,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
301163,
229086,
278238,
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,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
f2abbcf805e30518d4200dac8fc2a0877a5939c2 | 80296675725dddbdc1eada9a223a44b9bd9df3b7 | /Goodreads macOS ClientTests/Goodreads_macOS_ClientTests.swift | e80240f22254c4ec620ee45e1e75aa029b630517 | [] | no_license | mohannad-hassan/Goodreads-macOS-Client | 8d907a35663e45d5f5c6526df96eec4e70d08771 | 9f04cd7037416844708ce81ab8149fe98ce06eb5 | refs/heads/master | 2021-01-12T05:59:30.351326 | 2016-12-24T05:27:00 | 2016-12-24T05:27:00 | 77,266,259 | 3 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,038 | swift | //
// Goodreads_macOS_ClientTests.swift
// Goodreads macOS ClientTests
//
// Created by Mohannad Hassan on 12/24/16.
// Copyright © 2016 Mohannad Hassan. All rights reserved.
//
import XCTest
@testable import Goodreads_macOS_Client
class Goodreads_macOS_ClientTests: 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.
}
}
}
| [
282633,
98333,
229413,
102437,
354343,
354345,
278570,
233517,
309295,
229424,
282672,
237620,
229430,
319542,
325694,
288833,
288834,
311372,
315476,
280661,
354393,
315487,
237663,
45153,
309345,
280675,
280677,
313447,
280694,
131191,
280712,
311438,
284825,
284826,
311458,
284842,
239793,
299187,
280762,
223419,
280768,
227524,
309444,
280778,
280795,
227548,
311519,
280802,
176362,
286958,
227578,
278797,
282909,
278816,
237857,
211235,
217380,
211238,
280887,
282939,
260418,
311621,
332101,
6481,
379225,
323935,
416104,
280939,
285040,
242033,
313727,
311681,
311685,
227725,
190871,
285084,
293303,
278978,
127427,
283075,
291267,
278989,
281040,
328152,
188894,
279008,
358882,
279013,
291311,
281072,
309744,
279029,
279032,
279039,
303631,
279057,
283153,
279062,
279065,
283182,
283184,
23092,
242237,
70209,
309830,
55881,
281166,
281171,
287318,
309846,
285271,
295519,
242273,
279146,
313966,
287346,
301689,
287374,
311954,
314009,
303771,
221852,
279210,
287404,
285361,
303793,
299699,
314040,
287417,
230072,
303803,
285373,
287422,
287433,
225995,
279252,
287452,
289502,
285415,
330474,
293612,
312047,
279280,
230134,
154359,
234234,
299770,
221948,
299776,
285444,
322313,
310036,
293664,
234277,
283430,
312108,
353069,
285497,
289598,
160575,
281408,
342847,
318278,
353095,
201551,
281427,
281433,
301918,
295776,
293730,
303972,
174963,
207732,
310131,
209785,
279417,
308092,
158593,
113542,
228234,
308107,
56208,
295824,
293781,
324506,
324507,
279464,
353197,
213960,
316364,
183248,
50143,
314342,
234472,
234473,
287731,
330754,
234500,
234514,
175132,
189474,
330788,
238651,
308287,
238664,
234587,
277597,
304222,
113760,
281697,
302177,
281700,
207979,
279660,
15471,
144496,
234609,
312434,
285814,
300151,
279672,
291959,
160891,
300158,
150657,
187521,
234625,
285828,
302213,
285830,
302216,
330888,
228491,
234638,
308372,
185493,
238743,
283802,
285851,
300187,
339102,
234663,
249002,
238765,
3246,
238769,
208058,
339130,
64700,
228540,
228542,
283840,
302274,
283847,
283852,
228563,
333011,
279765,
296153,
279774,
304351,
304356,
228588,
328940,
302325,
216315,
208124,
316669,
228609,
292107,
312587,
339234,
286013,
286018,
279875,
304456,
224586,
222541,
238927,
283991,
357719,
230756,
281957,
163175,
284014,
279920,
181625,
224640,
179587,
142729,
368011,
112017,
282007,
318875,
282022,
173491,
304564,
228795,
292283,
296392,
302540,
280013,
312782,
306639,
310736,
228827,
239068,
316902,
187878,
280041,
308723,
306677,
300535,
286202,
286205,
306692,
306693,
282129,
308756,
282136,
302623,
306723,
288309,
312889,
282183,
218696,
288327,
292425,
228943,
286288,
306776,
286306,
325231,
222832,
288378,
282245,
282246,
288392,
229001,
290443,
323217,
282259,
229020,
282273,
302754,
282276,
40613,
40614,
40615,
229029,
300714,
298667,
286391,
321207,
282303,
218819,
306890,
280267,
302797,
302802,
280278,
282327,
298712,
278233,
278234,
282339,
282348,
282355,
229113,
300794,
278272,
288512,
311042,
319233,
288516,
216839,
300811,
284431,
278291,
278293,
282400,
313120,
241442,
315171,
284459,
280366,
282417,
200498,
280372,
280374,
319288,
282427,
280380,
282434,
280390,
282438,
18262,
188251,
284507,
284512,
284514,
276327,
292712,
282474,
288619,
280430,
313199,
282480,
305026,
67463,
282504,
243597,
184208,
282518,
282519,
214937,
239514,
214938,
284587,
323507,
288697,
294850,
280519,
294886,
290811
] |
5c633fbdd986b848db4b7a77cf5dee7fa2738a7d | 91fef5ea24459a898eea1a15567f823cf9f5b9a0 | /StateMachineTests/StateMachineTests.swift | 44d863bd065d3ec790037407d68e6671331728cb | [] | no_license | MarioBajr/StateMachine-Swift | 9c4b946a10e32c6dbf2f2adede086f8470a2db88 | affdbefd09e924e82ec5b83b38a99d40bc2da253 | refs/heads/master | 2020-05-26T22:38:29.732333 | 2019-07-29T21:23:45 | 2019-07-29T21:23:45 | 22,724,101 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,177 | swift | //
// StateMachineTests.swift
// StateMachineTests
//
// Created by Mario Barbosa on 8/4/14.
// Copyright (c) 2014 Mario Barbosa. All rights reserved.
//
import UIKit
import XCTest
enum StateEnum: CustomStringConvertible {
case Initial
case Open
case OpenHalf
case OpenCompletely
case Close
case CloseLocked
case CloseUnlocked
var description:String {
switch self {
case .Initial:
return "Initial"
case .OpenHalf:
return "Open"
default:
return "Lala"
}
}
}
class StateMachineTests: XCTestCase {
var stateMachine:StateMachine<StateEnum>!
override func setUp() {
super.setUp()
stateMachine = StateMachine<StateEnum>()
}
override func tearDown() {
super.tearDown()
}
func testSetInitialState() {
var passed = false
stateMachine.add(state: StateEnum.Initial, onEnter: { (from, to, current) -> Void in
passed = true
})
stateMachine.setInitial(state: StateEnum.Initial)
XCTAssertEqual(self.stateMachine.state, StateEnum.Initial, "State Not Initialized properly")
XCTAssert(passed, "onEnter callback not called")
}
func testChangeState() {
var passedOnEnter = false
var passedOnExit = false
var passedOnTransaction = false
stateMachine.add(state: StateEnum.Initial, onExit: { (from, to, current) -> Void in
passedOnExit = true
})
stateMachine.add(state: StateEnum.Open, fromStates: [StateEnum.Initial],
onEnter: { (from, to, current) -> Void in
passedOnEnter = true
})
stateMachine.setInitial(state: StateEnum.Initial)
stateMachine.onStateChangeSucceeded = { (from, to, current) -> Void in
passedOnTransaction = true
}
stateMachine.move(to: StateEnum.Open)
XCTAssert(passedOnEnter && passedOnExit && passedOnTransaction, "State transaction Didn't worked")
}
func testCanChangeToState() {
stateMachine.add(state: StateEnum.Initial)
stateMachine.add(state: StateEnum.Open, fromStates:[StateEnum.Initial])
stateMachine.add(state: StateEnum.Close)
stateMachine.setInitial(state: StateEnum.Initial)
XCTAssert(stateMachine.canMove(to: StateEnum.Open), "State change validation failed")
XCTAssert(!stateMachine.canMove(to: StateEnum.Close), "State change validation failed")
}
func testParentState() {
var checkpoint1 = false
var checkpoint2 = false
var checkpoint3 = false
let onEnterOpenState:(_ from:StateEnum?, _ to:StateEnum, _ current:StateEnum)->Void = {(from, to, current) in
checkpoint1 = true
}
let onEnterOpenCompletelyState:(StateEnum?, StateEnum, StateEnum)->Void = {(from, to, current) in
checkpoint2 = true
}
let onEnterOpenHalfState:(StateEnum?, StateEnum, StateEnum)->Void = {(from, to, current) in
checkpoint3 = true
}
stateMachine.add(state: StateEnum.Initial)
stateMachine.add(state: StateEnum.Open, onEnter:onEnterOpenState)
stateMachine.add(state: StateEnum.OpenCompletely, fromStates:[StateEnum.Initial], parent:StateEnum.Open, onEnter:onEnterOpenCompletelyState)
stateMachine.add(state: StateEnum.OpenHalf, fromStates:[StateEnum.Initial], parent:StateEnum.Open, onEnter:onEnterOpenHalfState)
stateMachine.setInitial(state: StateEnum.Initial)
stateMachine.move(to: StateEnum.OpenCompletely)
XCTAssert(checkpoint1 && checkpoint2 && !checkpoint3, "Change of state with hierarchy failed")
}
func testParentState2() {
var checkpoint1 = false
var checkpoint2 = false
var checkpoint3 = false
let onEnterOpenState:(StateEnum?, StateEnum, StateEnum)->Void = {(from, to, current) in
checkpoint1 = true
}
let onEnterOpenCompletelyState:(StateEnum?, StateEnum, StateEnum)->Void = {(from, to, current) in
checkpoint2 = true
}
let onEnterOpenHalfState:(StateEnum?, StateEnum, StateEnum)->Void = {(from, to, current) in
checkpoint3 = true
}
stateMachine.add(state: StateEnum.Initial)
stateMachine.add(state: StateEnum.Open, fromStates:[StateEnum.Initial], onEnter:onEnterOpenState)
stateMachine.add(state: StateEnum.OpenCompletely, fromStates:[StateEnum.Initial], parent:StateEnum.Open, onEnter:onEnterOpenCompletelyState)
stateMachine.add(state: StateEnum.OpenHalf, fromStates:[StateEnum.Initial], parent:StateEnum.Open, onEnter:onEnterOpenHalfState)
stateMachine.setInitial(state: StateEnum.Initial)
stateMachine.move(to: StateEnum.Open)
XCTAssert(checkpoint1 && !checkpoint2 && !checkpoint3, "Change of state with hierarchy failed")
}
}
| [
-1
] |
862bc7bfe4a5746cfce1b557e8ac03fbd02c9afa | 7b53531c4b71ad967a02720c0de1da18b622bb26 | /Sources/App/ViewControllers/ItemList/ItemListViewModel.swift | a9113ac181d73a00e5ae632d7d7f700755013c4e | [] | no_license | stefanomondino/Binge | 91efefc594d77060d437470051ea0dba540d9d52 | 8d4c4255daf660e16f24389dc983838dd16437ef | refs/heads/master | 2021-07-13T19:47:31.169386 | 2020-09-10T14:42:00 | 2020-09-10T14:42:00 | 204,140,333 | 2 | 0 | null | 2019-12-18T14:19:16 | 2019-08-24T10:05:47 | Swift | UTF-8 | Swift | false | false | 4,353 | swift | //
// ShowListViewModel.swift
// App
//
// Created by Stefano Mondino on 20/11/2019.
// Copyright © 2019 Synesthesia. All rights reserved.
//
import Boomerang
import Foundation
import Model
import RxRelay
import RxSwift
extension PageInfo {
var title: Translation {
switch self {
case .popular: return Strings.Shows.popular
case .trending: return Strings.Shows.trending
case .watched: return Strings.Shows.watched
case .collected: return Strings.Shows.collected
case .anticipated: return Strings.Shows.anticipated
}
}
}
class ItemListViewModel: RxListViewModel, RxNavigationViewModel, WithPage {
let uniqueIdentifier: UniqueIdentifier = UUID()
var routes: PublishRelay<Route> = PublishRelay()
typealias ShowListDownloadClosure = (_ current: Int, _ total: Int) -> Observable<[TraktItemContainer]>
var sectionsRelay: BehaviorRelay<[Section]> = BehaviorRelay(value: [])
var disposeBag = DisposeBag()
var layoutIdentifier: LayoutIdentifier
// let downloadClosure: ShowListDownloadClosure
let itemViewModelFactory: ItemViewModelFactory
var pageTitle: String { useCase.page.title.description }
var pageIcon: UIImage? {
return nil
}
private let loadingRelay = BehaviorRelay(value: false)
var isLoading: Observable<Bool> { loadingRelay.asObservable() }
private let useCase: ItemListUseCase
let routeFactory: RouteFactory
init(itemViewModelFactory: ItemViewModelFactory,
useCase: ItemListUseCase,
routeFactory: RouteFactory,
layout: SceneIdentifier = SceneIdentifier.itemList) {
self.useCase = useCase
self.routeFactory = routeFactory
layoutIdentifier = layout
self.itemViewModelFactory = itemViewModelFactory
}
func reload() {
disposeBag = DisposeBag()
sections = createSections(from: [])
}
func selectItem(at indexPath: IndexPath) {
guard let show = (self[indexPath] as? GenericItemViewModel)?.item as? TraktItemContainer else { return }
let route = routeFactory.showDetail(for: show)
routes.accept(route)
}
private func items(from items: [TraktItemContainer]) -> [ViewModel] {
let factory = itemViewModelFactory
return items.map { factory.item($0, layout: .posterOnly) }
}
func openSearch() {
routes.accept(routeFactory.search())
}
private func addItems(from shows: [TraktItemContainer]) {
guard var section = sections.first else { return }
let newItems = items(from: shows)
section.items = section.items.dropLast()
if newItems.isEmpty == false {
section.items += newItems + [loadMore()]
}
sections = [section]
}
private let loadMoreEnabled: BehaviorRelay<Bool> = BehaviorRelay(value: true)
private func loadMore() -> ViewModel {
return itemViewModelFactory.loadMore { [weak self] () -> Disposable in
guard let self = self else { return Disposables.create() }
return self.loadMoreEnabled
.filter { $0 }
.take(1)
// .delay(.milliseconds(100), scheduler: Scheduler.background)
.flatMapLatest { [weak self] _ -> Observable<[TraktItemContainer]> in
guard
let self = self,
let section = self.sections.first else { return Observable.empty() }
let currentPage = section.items.count / 20
let useCase = self.useCase
let trigger = self.loadMoreEnabled
Logger.log(currentPage)
return useCase
.items(currentPage: currentPage + 1, pageSize: 20)
.takeLast(1)
.debug("TESTING")
.do(onNext: { [weak self] in self?.addItems(from: $0) },
onSubscribe: { trigger.accept(true) },
onDispose: { trigger.accept(true) })
}
.subscribe()
}
}
private func createSections(from shows: [TraktItem]) -> [Section] {
let items = self.items(from: shows) + [loadMore()]
return [Section(id: "", items: items)]
}
}
| [
-1
] |
a860ced27da098d883d842de85eb8b5ee171b52f | d610a4b8eedc400e91f055796174edd12c050d71 | /Shared/Globals.swift | c2110982f1b1a5ea3af0259dfcb5235ef108d859 | [] | no_license | sammaffei/GTownRadio | 58976c114309c24c4e0b8cc5c6c1f4cd113aa46a | 6793f204a3bcc7844294821c853890ae363389b8 | refs/heads/master | 2020-03-28T06:52:12.881309 | 2018-12-22T00:08:56 | 2018-12-22T00:08:56 | 147,865,709 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 732 | swift | //
// Globals.swift
// gtownradio
//
// Created by Samuel Maffei on 12/21/18.
// Copyright © 2018 Samuel Maffei. All rights reserved.
//
// Class for global, non-static data
//
import Foundation
class Globals
{
static let shared = Globals()
var buildInfoStr: String
{
get
{
if let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString"),
let buildNum = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion")
{
return "\(version) (\(buildNum))"
}
else
{
return "????"
}
}
}
}
| [
-1
] |
546b94c7c9e9a2dfde1a8a1ce4e0ed9bd5bce0d8 | 57afd9405565a5f949727fac5a6a27a7091724b9 | /Elements/Network Services/ElementsAPIClient.swift | 894805bf9d83dda53c6b92224ed0ae12ed097963 | [
"MIT"
] | permissive | vaslee/ChemistryElements | 1c129187ea157939fdea0ee8637013bb021cf142 | 8cab597b7d0ee2384eadf5d8b595c0c2341edf55 | refs/heads/master | 2020-04-14T21:12:42.119950 | 2019-01-04T21:35:28 | 2019-01-04T21:35:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,274 | swift | //
// ElementsAPIClient.swift
// Elements
//
// Created by TingxinLi on 1/4/19.
// Copyright © 2019 Pursuit. All rights reserved.
//
import Foundation
final class ElementsAPIClient {
static func searchElements(keyword : String,completionHandler: @escaping (AppError?, [ElementsData]?) -> Void) {
NetworkHelper.shared.performDataTask(endpointURLString: "https://5c1d79abbc26950013fbcaa9.mockapi.io/api/v1/elements", httpMethod: "GET", httpBody: nil) { (appError, data, httpResponse) in
if let appError = appError {
completionHandler(appError, nil)
}
guard let response = httpResponse,
(200...299).contains(response.statusCode) else {
let statusCode = httpResponse?.statusCode ?? -999
completionHandler(AppError.badStatusCode(String(statusCode)), nil)
return
}
if let data = data {
do {
let elementsData = try JSONDecoder().decode([ElementsData].self, from: data)
completionHandler(nil, elementsData)
} catch {
completionHandler(AppError.decodingError(error), nil)
}
}
}
}
static func favoriteElements(data: Data, completionHandler: @escaping (AppError?, Bool) -> Void) {
NetworkHelper.shared.performUploadTask(endpointURLString: "https://5c1d79abbc26950013fbcaa9.mockapi.io/api/v1/favorites", httpMethod: "POST", httpBody: data) { (appError, data, httpResponse) in
if let appError = appError {
completionHandler(appError, false)
}
guard let response = httpResponse,
(200...299).contains(response.statusCode) else {
let statusCode = httpResponse?.statusCode ?? -999
completionHandler(AppError.badStatusCode(String(statusCode)), false)
return
}
if let _ = data {
completionHandler(nil, true)
}
}
}
static func getFavorites(name: String, completionHandler: @escaping (AppError?, [Favorite]?) -> Void) {
let getFavoritesEndpoint = "https://5c1d79abbc26950013fbcaa9.mockapi.io/api/v1/favorites"
NetworkHelper.shared.performDataTask(endpointURLString: getFavoritesEndpoint, httpMethod: "GET", httpBody: nil) { (appError, data, httpResponse) in
if let appError = appError {
completionHandler(appError, nil)
}
guard let response = httpResponse,
(200...299).contains(response.statusCode) else {
let statusCode = httpResponse?.statusCode ?? -999
completionHandler(AppError.badStatusCode(String(statusCode)), nil)
return
}
if let data = data {
do {
let favorites = try JSONDecoder().decode([Favorite].self, from: data)
completionHandler(nil, favorites)
} catch {
completionHandler(AppError.decodingError(error), nil)
}
}
}
}
}
| [
-1
] |
341ccec9d968bc71605bdc5f1b069e83097dc608 | 0a3b02b48ffe1999324bb9767fb280427d37c525 | /SwiftHub/Modules/Repository Details/RepositoryViewController.swift | 7e01a0d740149cd5b7efb4747b5330b20b28e754 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | iamchiwon/SwiftHub | ab8383f3716639e220dc1d5f5f04278aea9f06d0 | ffb0458e823d8ff4f276b39e31eef42c82c65b04 | refs/heads/master | 2020-04-12T02:55:28.246611 | 2018-12-17T21:24:33 | 2018-12-17T21:24:33 | 162,257,723 | 2 | 1 | null | 2018-12-18T08:45:58 | 2018-12-18T08:45:57 | null | UTF-8 | Swift | false | false | 11,376 | swift | //
// RepositoryViewController.swift
// SwiftHub
//
// Created by Sygnoos9 on 7/1/18.
// Copyright © 2018 Khoren Markosyan. All rights reserved.
//
import UIKit
import RxSwift
import RxCocoa
import RxDataSources
import AttributedLib
private let reuseIdentifier = R.reuseIdentifier.repositoryDetailCell.identifier
class RepositoryViewController: TableViewController {
var viewModel: RepositoryViewModel!
lazy var rightBarButton: BarButtonItem = {
let view = BarButtonItem(image: R.image.icon_navigation_github(), style: .done, target: nil, action: nil)
return view
}()
lazy var ownerImageView: SlideImageView = {
let view = SlideImageView()
view.cornerRadius = 40
return view
}()
lazy var starButton: Button = {
let view = Button()
view.borderColor = .white
view.borderWidth = Configs.BaseDimensions.borderWidth
view.tintColor = .white
view.cornerRadius = 20
return view
}()
lazy var headerStackView: StackView = {
let headerView = View()
headerView.addSubview(self.ownerImageView)
self.ownerImageView.snp.makeConstraints({ (make) in
make.top.centerX.centerY.equalToSuperview()
make.size.equalTo(80)
})
headerView.addSubview(self.starButton)
self.starButton.snp.remakeConstraints({ (make) in
make.bottom.equalTo(self.ownerImageView)
make.right.equalTo(self.ownerImageView).offset(15)
make.size.equalTo(40)
})
let subviews: [UIView] = [headerView]
let view = StackView(arrangedSubviews: subviews)
return view
}()
lazy var headerView: View = {
let view = View()
view.hero.id = "TopHeaderId"
let subviews: [UIView] = [self.headerStackView, self.actionButtonsStackView]
let stackView = StackView(arrangedSubviews: subviews)
stackView.axis = .vertical
view.addSubview(stackView)
stackView.snp.makeConstraints({ (make) in
make.edges.equalToSuperview().inset(self.inset)
})
return view
}()
lazy var watchersButton: Button = {
let view = Button()
return view
}()
lazy var starsButton: Button = {
let view = Button()
return view
}()
lazy var forksButton: Button = {
let view = Button()
return view
}()
lazy var actionButtonsStackView: StackView = {
let subviews: [UIView] = [self.watchersButton, self.starsButton, self.forksButton]
let view = StackView(arrangedSubviews: subviews)
view.axis = .horizontal
view.distribution = .fillEqually
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func makeUI() {
super.makeUI()
themeService.rx
.bind({ $0.primaryDark }, to: headerView.rx.backgroundColor)
.disposed(by: rx.disposeBag)
navigationItem.rightBarButtonItem = rightBarButton
emptyDataSetTitle = ""
emptyDataSetImage = nil
stackView.insertArrangedSubview(headerView, at: 0)
tableView.footRefreshControl = nil
tableView.register(R.nib.repositoryDetailCell)
}
override func bindViewModel() {
super.bindViewModel()
let refresh = Observable.of(Observable.just(()), headerRefreshTrigger).merge()
let input = RepositoryViewModel.Input(headerRefresh: refresh,
imageSelection: ownerImageView.rx.tap(),
openInWebSelection: rightBarButton.rx.tap.asObservable(),
watchersSelection: watchersButton.rx.tap.asObservable(),
starsSelection: starsButton.rx.tap.asObservable(),
forksSelection: forksButton.rx.tap.asObservable(),
selection: tableView.rx.modelSelected(RepositorySectionItem.self).asDriver(),
starSelection: starButton.rx.tap.asObservable())
let output = viewModel.transform(input: input)
viewModel.loading.asObservable().bind(to: isLoading).disposed(by: rx.disposeBag)
viewModel.headerLoading.asObservable().bind(to: isHeaderLoading).disposed(by: rx.disposeBag)
let dataSource = RxTableViewSectionedReloadDataSource<RepositorySection>(configureCell: { dataSource, tableView, indexPath, item in
switch item {
case .languageItem(let viewModel),
.sizeItem(let viewModel),
.createdItem(let viewModel),
.updatedItem(let viewModel),
.homepageItem(let viewModel),
.issuesItem(let viewModel),
.commitsItem(let viewModel),
.pullRequestsItem(let viewModel),
.eventsItem(let viewModel),
.contributorsItem(let viewModel),
.readmeItem(let viewModel),
.sourceItem(let viewModel):
let cell = (tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) as? RepositoryDetailCell)!
cell.bind(to: viewModel)
return cell
}
}, titleForHeaderInSection: { dataSource, index in
let section = dataSource[index]
return section.title
})
output.items
.bind(to: tableView.rx.items(dataSource: dataSource))
.disposed(by: rx.disposeBag)
output.selectedEvent.drive(onNext: { [weak self] (item) in
switch item {
case .homepageItem:
if let url = self?.viewModel.repository.value.homepage?.url {
self?.navigator.show(segue: .webController(url), sender: self)
}
case .issuesItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? IssuesViewModel {
self?.navigator.show(segue: .issues(viewModel: viewModel), sender: self)
}
case .commitsItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? CommitsViewModel {
self?.navigator.show(segue: .commits(viewModel: viewModel), sender: self)
}
case .pullRequestsItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? PullRequestsViewModel {
self?.navigator.show(segue: .pullRequests(viewModel: viewModel), sender: self)
}
case .eventsItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? EventsViewModel {
self?.navigator.show(segue: .events(viewModel: viewModel), sender: self)
}
case .contributorsItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? UsersViewModel {
self?.navigator.show(segue: .users(viewModel: viewModel), sender: self)
}
case .readmeItem:
if let url = self?.viewModel.readme.value?.htmlUrl?.url {
self?.navigator.show(segue: .webController(url), sender: self)
if let fullname = self?.viewModel.repository.value.fullname {
analytics.log(.readme(fullname: fullname))
}
}
case .sourceItem:
if let viewModel = self?.viewModel.viewModel(for: item) as? ContentsViewModel {
self?.navigator.show(segue: .contents(viewModel: viewModel), sender: self)
if let fullname = viewModel.repository.value.fullname {
analytics.log(.source(fullname: fullname))
}
}
default:
self?.deselectSelectedRow()
}
}).disposed(by: rx.disposeBag)
output.name.drive(onNext: { [weak self] (title) in
self?.navigationTitle = title
}).disposed(by: rx.disposeBag)
output.imageUrl.drive(onNext: { [weak self] (url) in
if let url = url {
self?.ownerImageView.setSources(sources: [url])
self?.ownerImageView.hero.id = url.absoluteString
}
}).disposed(by: rx.disposeBag)
output.hidesStarButton.drive(starButton.rx.isHidden).disposed(by: rx.disposeBag)
output.starring.map { (starred) -> UIImage? in
let image = starred ? R.image.icon_button_unstar() : R.image.icon_button_star()
return image?.template
}.drive(starButton.rx.image()).disposed(by: rx.disposeBag)
output.watchersCount.drive(onNext: { [weak self] (count) in
let text = R.string.localizable.repositoryWatchersButtonTitle.key.localized()
self?.watchersButton.setAttributedTitle(self?.attributetText(title: text, value: count), for: .normal)
}).disposed(by: rx.disposeBag)
output.starsCount.drive(onNext: { [weak self] (count) in
let text = R.string.localizable.repositoryStarsButtonTitle.key.localized()
self?.starsButton.setAttributedTitle(self?.attributetText(title: text, value: count), for: .normal)
}).disposed(by: rx.disposeBag)
output.forksCount.drive(onNext: { [weak self] (count) in
let text = R.string.localizable.repositoryForksButtonTitle.key.localized()
self?.forksButton.setAttributedTitle(self?.attributetText(title: text, value: count), for: .normal)
}).disposed(by: rx.disposeBag)
output.imageSelected.drive(onNext: { [weak self] (viewModel) in
self?.navigator.show(segue: .userDetails(viewModel: viewModel), sender: self)
}).disposed(by: rx.disposeBag)
output.openInWebSelected.drive(onNext: { [weak self] (url) in
if let url = url {
self?.navigator.show(segue: .webController(url), sender: self, transition: .modal)
}
}).disposed(by: rx.disposeBag)
output.repositoriesSelected.drive(onNext: { [weak self] (viewModel) in
self?.navigator.show(segue: .repositories(viewModel: viewModel), sender: self)
}).disposed(by: rx.disposeBag)
output.usersSelected.drive(onNext: { [weak self] (viewModel) in
self?.navigator.show(segue: .users(viewModel: viewModel), sender: self)
}).disposed(by: rx.disposeBag)
}
func attributetText(title: String, value: Int) -> NSAttributedString {
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .center
let valueAttributes = Attributes {
return $0.foreground(color: .textWhite())
.font(.boldSystemFont(ofSize: 20))
.paragraphStyle(paragraph)
}
let titleAttributes = Attributes {
return $0.foreground(color: .textWhite())
.font(.boldSystemFont(ofSize: 14))
.paragraphStyle(paragraph)
}
return "\(value)\n".at.attributed(with: valueAttributes) + title.at.attributed(with: titleAttributes)
}
}
| [
-1
] |
5146dd1ee825a05f315da8c5c5eb87f147a8ed6a | 9aeef2561b4a8992b922c64088cc006ed187c6c2 | /Web/Web/AppDelegate.swift | 60f2e1fe2f978b4e70ae2c4868527528a926f0ed | [] | no_license | Hyeongwon/Swift_Ex | cb41a80ad4282f173ae44f640518572703b2eafc | 2289f6f7c7c0b13fcef960eb8ed6612a859a12f6 | refs/heads/master | 2021-01-22T07:47:39.518326 | 2017-08-06T16:55:00 | 2017-08-06T16:55:00 | 92,576,383 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,185 | swift | //
// AppDelegate.swift
// Web
//
// Created by byunhyeongwon on 2017. 6. 1..
// Copyright © 2017년 Joshua HyeongwonByun. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
286776,
319544,
286778,
204856,
229432,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
295110,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312005,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
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,
230940,
222752,
108066,
296486,
296488,
157229,
239152,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
190118,
198310,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
313027,
280260,
206536,
280264,
206539,
206541,
206543,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
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,
239586,
313320,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
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,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
330244,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
182926,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
142226,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
307211,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
127440,
315860,
176597,
283095,
127447,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
127490,
283142,
127494,
135689,
233994,
127497,
127500,
291341,
233998,
127506,
234003,
127509,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
234396,
291742,
226200,
234398,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
308226,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349464,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
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,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
292845,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
292876,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
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,
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,
137946,
113378,
203491,
228069,
277223,
342760,
285417,
56041,
56043,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
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,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
280021,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
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,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
44d543b787a54702c31d409cab534b3648e3cfaf | 6a7f51acd15af4e24c1d8878ec385058b9ba6f2e | /MiniChallenge2/Views/Evaluation/History/HistoryTableViewController.swift | 1b26d7320eb13eb1cc8561f6368e1ce990a345f9 | [] | no_license | jajackleon/MiniChallenge2 | 3025b19ec24064cbc98bb0eb8d8920ce1696d84f | b3a6ff8dc203e2f332f08a767be86742d3381f09 | refs/heads/master | 2023-05-30T12:27:40.709817 | 2021-06-19T14:24:30 | 2021-06-19T14:24:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,713 | swift | //
// HistoryTableViewController.swift
// EvaluationPage
//
// Created by Jackie Leonardy on 08/06/21.
//
import UIKit
class HistoryTableViewController: UITableViewController {
let historyCell = HistoryTableViewCell()
let data = History.getData()
override func viewDidLoad() {
super.viewDidLoad()
self.title = "History"
navigationController?.navigationBar.prefersLargeTitles = true
navigationController?.navigationBar.backgroundColor = . systemBackground
setUpTable()
}
func registerXIBCell(cell : UITableViewCell){
tableView.register(UINib(nibName: "\(cell.self)", bundle: nil), forCellReuseIdentifier: "historyCell")
}
func setUpTable(){
tableView.register(historyCell.getNib(), forCellReuseIdentifier: "historyCell")
tableView.separatorStyle = .none
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "historyCell", for: indexPath) as! HistoryTableViewCell
cell.setData(history: data[indexPath.row])
return cell
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 92
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = TestResultViewController()
navigationController?.pushViewController(vc, animated: true)
}
}
| [
-1
] |
8b97c45666b1cf39b139b4bfa7e43ef50bd91598 | 647a3de34291c4cc778c6daef8eacc3727e36ac3 | /SyncanoChat/CTChannelDelegate.swift | 0ad30e741a8317f2fa34ba031c10f4de07d72566 | [] | no_license | baconw/SyncanoChat | bdcf52dbf6d4c9b6eee3e282030583558298ba90 | b73d97c5502cb37dac2b67954b45852a93615a33 | refs/heads/master | 2020-04-12T05:39:30.117652 | 2016-11-17T09:17:21 | 2016-11-17T09:17:21 | 64,265,678 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 315 | swift | //
// CTChannelDelegate.swift
// SyncanoChat
//
// Created by dongyi228 on 16/7/27.
// Copyright © 2016年 dongyi228. All rights reserved.
//
import UIKit
public protocol CTChannelDelegate : NSObjectProtocol {
func channelDidReceiveNotificationMessage(notificationMessage: CTChannelNotificationMessage)
} | [
-1
] |
7827f246364a7cdd072cb54c047ee56b4dab00e9 | 70a0271f1bfd9f7da5bf9654b19fde467a252c15 | /DrawingFun/DrawingFun/StretchView.swift | 810f7e784f38739cea5fa86d6cbe5b8bfb2d764b | [] | no_license | Jmannn/lab10-Drawing-Fun | 1fbcc744230b51154a97f7402e581f54a930df1d | 0b329caac7a4ca2b590389287293e03ada913817 | refs/heads/master | 2020-03-29T04:12:02.044233 | 2018-09-20T02:44:41 | 2018-09-20T02:44:41 | 149,520,272 | 0 | 0 | null | 2018-09-19T22:41:07 | 2018-09-19T22:41:07 | null | UTF-8 | Swift | false | false | 2,272 | swift | //
// StretchView.swift
// DrawingFun
//
// Created by Johnathan Mann on 9/20/18.
// Copyright © 2018 Johnathan Mann. All rights reserved.
//
import Cocoa
class StretchView: NSView {
var path = NSBezierPath()
@objc var opacity: Float = 0.5
@objc var image:NSImage = NSImage()
var downPoint = NSPoint()
// where it is dragged to, and released
var currentPoint = NSPoint()
required init?(coder: NSCoder) {
super.init(coder: coder)
srandom(2)
path.lineWidth = 3.0
var p:NSPoint = self.randomPoint()
path.move(to: p)
for _ in 0...14 {
p = self.randomPoint()
path.line(to: p)
}
path.close()
}
func randomPoint()->NSPoint {
let r:NSRect = self.bounds
let nx = r.origin.x + CGFloat(Int(arc4random()) % Int(r.size.width))
let ny = r.origin.y + CGFloat(Int(arc4random()) % Int(r.size.height))
return NSPoint(x: nx, y: ny)
}
override func draw(_ dirtyRect: NSRect) {
super.draw(dirtyRect)
let bounds = self.bounds
NSColor.green.set()
NSBezierPath.fill(bounds)
NSColor.white.set()
path.stroke()
}
override var intrinsicContentSize: NSSize {
return NSSize(width: 400, height: 400)
}
override func mouseDown(with theEvent: NSEvent) {
let p = theEvent.locationInWindow
downPoint = convert(p, from: nil)
currentPoint = downPoint
self.needsDisplay = true
}
override func mouseDragged(with theEvent: NSEvent) {
let p = theEvent.locationInWindow
currentPoint = convert(p, from: nil)
self.needsDisplay = true
}
override func mouseUp(with theEvent: NSEvent) {
let p = theEvent.locationInWindow
currentPoint = convert(p, from: nil)
self.needsDisplay = true
}
func currentRect()->NSRect{
let minX = min(downPoint.x, currentPoint.x)
let maxX = max(downPoint.x, currentPoint.x)
let minY = min(downPoint.y, currentPoint.y)
let maxY = max(downPoint.y, currentPoint.y)
return NSMakeRect(minX, minY, maxX-minX, maxY-minY)
}
}
| [
-1
] |
9e259ff3170968940cadd0a657cd45dbb184eb62 | 16723e0b1b82d7b7a880536537c4ea0e52bed57b | /Question BotUITests/Question_BotUITests.swift | d5b8bba36bd1370fb7d66ce5732b4e7f52b23171 | [] | no_license | WYJustin1213/Question-Bot | 6332b327799f5eec28724e809e7ea0998f0287e3 | 4a6221ebb6ed00d36df2c2233898dba265049307 | refs/heads/main | 2023-07-30T16:38:06.777332 | 2021-09-13T02:54:01 | 2021-09-13T02:54:01 | 405,813,239 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,435 | swift | //
// Question_BotUITests.swift
// Question BotUITests
//
// Created by Justin on 9/12/21.
//
import XCTest
class Question_BotUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}
| [
360463,
155665,
376853,
344106,
253996,
385078,
163894,
180279,
319543,
352314,
213051,
376892,
32829,
286787,
352324,
237638,
352327,
385095,
393291,
163916,
368717,
311373,
196687,
278607,
311377,
254039,
426074,
368732,
180317,
32871,
352359,
221292,
278637,
385135,
319599,
376945,
131190,
385147,
131199,
426124,
196758,
49308,
65698,
311459,
49317,
377008,
377010,
180409,
295099,
377025,
377033,
164043,
417996,
254157,
368849,
368850,
139478,
229591,
385240,
254171,
147679,
147680,
311520,
205034,
254189,
286957,
254193,
344312,
336121,
262403,
147716,
385291,
368908,
180494,
262419,
368915,
254228,
319764,
278805,
377116,
254250,
311596,
131374,
418095,
336177,
368949,
180534,
155968,
287040,
311622,
270663,
319816,
368969,
254285,
180559,
377168,
344402,
229716,
368982,
270703,
139641,
385407,
385409,
270733,
106893,
385423,
385433,
213402,
385437,
254373,
156069,
385448,
385449,
311723,
115116,
385463,
319931,
278974,
336319,
336323,
188870,
278988,
278992,
262619,
377309,
377310,
369121,
369124,
279014,
270823,
279017,
311787,
213486,
360945,
139766,
393719,
279030,
377337,
279033,
254459,
410108,
410109,
262657,
377346,
279042,
279053,
410126,
262673,
385554,
393745,
303635,
279060,
279061,
254487,
410138,
279066,
188957,
377374,
385569,
385578,
377388,
197166,
393775,
418352,
33339,
352831,
33344,
385603,
377419,
385612,
303693,
426575,
385620,
369236,
115287,
189016,
270938,
287327,
279143,
279150,
287345,
352885,
352886,
344697,
189054,
287359,
385669,
369285,
311944,
344714,
311950,
377487,
311953,
287379,
336531,
180886,
426646,
352921,
377499,
221853,
344737,
295591,
352938,
295598,
418479,
279215,
279218,
164532,
336565,
287418,
377531,
303802,
377534,
377536,
66243,
385737,
287434,
385745,
279249,
303826,
369365,
369366,
385751,
230105,
361178,
352989,
352990,
418529,
295649,
385763,
295653,
369383,
230120,
361194,
312046,
418550,
344829,
279293,
205566,
197377,
434956,
312076,
295698,
418579,
426772,
197398,
426777,
221980,
344864,
197412,
336678,
262952,
189229,
262957,
164655,
197424,
328495,
197428,
336693,
230198,
377656,
426809,
197433,
222017,
295745,
377669,
197451,
369488,
279379,
385878,
385880,
295769,
197467,
435038,
230238,
279393,
303973,
279398,
385895,
197479,
385901,
197489,
295799,
164730,
336765,
254851,
369541,
172936,
320394,
426894,
189327,
377754,
172971,
140203,
377778,
304050,
189362,
189365,
377789,
189373,
345030,
345034,
279499,
418774,
386007,
386009,
418781,
386016,
123880,
418793,
320495,
222193,
435185,
271351,
214009,
312313,
435195,
328701,
312317,
386049,
328705,
418819,
410629,
377863,
189448,
230411,
320526,
361487,
435216,
386068,
254997,
336928,
336930,
410665,
345137,
361522,
312372,
238646,
238650,
320571,
386108,
410687,
336962,
238663,
377927,
361547,
205911,
156763,
361570,
214116,
230500,
214119,
402538,
279659,
173168,
230514,
238706,
279666,
312435,
377974,
66684,
377986,
279686,
402568,
222344,
140426,
337037,
386191,
410772,
222364,
418975,
124073,
402618,
148674,
402632,
148687,
402641,
189651,
419028,
279766,
189656,
304353,
279780,
222441,
279789,
386288,
66802,
271607,
369912,
386296,
369913,
419066,
386300,
279803,
386304,
320769,
369929,
419097,
320795,
115997,
222496,
320802,
304422,
369964,
353581,
116014,
66863,
312628,
345397,
345398,
386363,
222523,
345418,
353611,
337228,
337226,
353612,
230730,
296269,
353617,
222542,
238928,
296274,
378201,
230757,
296304,
312688,
337280,
353672,
263561,
296328,
296330,
304523,
370066,
9618,
411028,
279955,
370072,
148899,
148900,
361928,
337359,
329168,
312785,
329170,
222674,
353751,
280025,
239069,
329181,
320997,
361958,
271850,
280042,
280043,
271853,
329198,
411119,
337391,
116209,
296434,
386551,
288252,
312830,
271880,
198155,
329231,
304655,
370200,
222754,
157219,
157220,
394793,
312879,
288305,
288319,
288322,
280131,
288328,
353875,
99937,
345697,
312937,
271980,
206447,
403057,
42616,
337533,
280193,
370307,
419462,
149127,
149128,
419464,
288391,
411275,
214667,
239251,
345753,
198304,
255651,
337590,
370359,
280252,
280253,
321217,
239305,
296649,
403149,
313042,
345813,
370390,
272087,
345817,
337638,
181992,
345832,
345835,
288492,
141037,
313082,
288508,
288515,
173828,
395018,
395019,
116491,
395026,
124691,
116502,
435993,
345882,
411417,
321308,
255781,
362281,
378666,
403248,
378673,
345910,
182070,
182071,
436029,
345918,
337734,
280396,
272207,
272208,
337746,
395092,
362326,
345942,
370526,
345950,
362336,
255844,
296807,
214894,
362351,
214896,
313200,
313204,
124795,
182145,
280451,
67464,
305032,
337816,
124826,
329627,
239515,
436130,
354210,
436135,
10153,
313257,
362411,
370604,
362418,
411587,
280517,
362442,
346066,
231382,
354268,
436189,
403421,
329696,
354273,
403425,
190437,
354279,
436199,
174058,
337899,
354283,
247787,
329707,
296942,
247786,
436209,
313322,
124912,
239610,
182277,
346117,
403463,
43016,
354312,
354311,
354310,
313356,
436235,
419857,
305173,
436248,
223269,
346153,
354346,
313388,
124974,
272432,
403507,
378933,
378934,
436283,
288835,
403524,
436293,
313415,
239689,
436304,
329812,
223317,
411738,
272477,
280676,
313446,
395373,
288878,
346237,
215165,
436372,
329884,
378186,
362658,
436388,
215204,
125108,
133313,
395458,
338118,
436429,
346319,
321744,
379102,
387299,
18661,
379110,
338151,
125166,
149743,
379120,
436466,
125170,
411892,
436471,
395511,
313595,
436480,
125184,
272644,
125192,
338187,
338188,
125197,
395536,
125200,
338196,
272661,
379157,
125204,
157973,
125215,
125216,
338217,
125225,
321839,
125236,
362809,
379193,
395591,
289109,
272730,
436570,
215395,
239973,
280938,
321901,
354671,
362864,
354672,
272755,
354678,
199030,
223611,
248188,
313726,
436609,
240003,
436613,
395653,
395660,
264591,
272784,
420241,
240020,
190870,
43416,
190872,
289185,
436644,
289195,
272815,
436659,
338359,
436677,
289229,
281038,
281039,
256476,
420326,
166403,
322057,
420374,
322077,
289328,
330291,
322119,
191065,
436831,
117350,
420461,
313970,
346739,
346741,
420473,
297600,
166533,
363155,
346771,
264855,
363161,
289435,
436897,
248494,
166581,
355006,
363212,
363228,
436957,
322269,
436960,
264929,
338658,
289511,
330473,
346859,
330476,
289517,
215790,
199415,
289534,
322302,
35584,
133889,
322312,
346889,
264971,
322320,
166677,
207639,
363295,
355117,
191285,
273209,
355129,
273211,
355136,
355138,
420680,
355147,
355148,
355153,
281426,
387927,
363353,
363354,
281434,
322396,
420702,
363361,
363362,
412516,
355173,
355174,
281444,
207724,
355182,
207728,
420722,
314240,
158594,
330627,
240517,
265094,
387977,
396171,
355216,
224146,
224149,
256918,
256919,
256920,
240543,
256934,
273336,
289720,
289723,
273341,
330688,
379845,
363462,
19398,
273353,
191445,
207839,
347104,
314343,
134124,
412653,
248815,
257007,
347122,
437245,
257023,
125953,
396292,
330759,
347150,
330766,
412692,
330789,
248871,
281647,
412725,
257093,
404550,
314437,
207954,
339031,
404582,
257126,
265318,
322664,
265323,
396395,
404589,
273523,
363643,
248960,
150656,
363658,
404622,
224400,
265366,
347286,
429209,
339101,
429216,
339106,
380069,
265381,
3243,
208044,
322733,
421050,
339131,
265410,
183492,
273616,
421081,
339167,
298209,
421102,
363769,
52473,
208123,
52476,
412926,
437504,
322826,
388369,
380178,
429332,
126229,
412963,
257323,
437550,
273713,
298290,
208179,
159033,
347451,
216387,
372039,
257353,
257354,
109899,
437585,
331091,
150868,
314708,
372064,
429410,
437602,
281958,
388458,
265579,
306541,
314734,
314740,
314742,
421240,
314745,
224637,
388488,
298378,
306580,
282008,
396697,
314776,
282013,
290206,
396709,
298406,
241067,
380331,
314797,
380335,
355761,
421302,
134586,
380348,
216510,
380350,
216511,
306630,
200136,
273865,
306634,
339403,
372172,
413138,
421338,
437726,
429540,
3557,
3559,
191980,
282097,
191991,
265720,
216575,
290304,
372226,
437766,
323083,
208397,
323088,
413202,
413206,
388630,
175640,
216610,
372261,
347693,
323120,
396850,
200245,
323126,
290359,
134715,
323132,
421437,
396865,
282182,
413255,
273992,
265800,
421452,
265809,
396885,
290391,
265816,
396889,
306777,
388699,
396896,
323171,
388712,
388713,
314997,
290425,
339579,
396927,
282248,
224907,
396942,
405140,
274071,
323226,
208547,
208548,
405157,
388775,
282279,
364202,
421556,
224951,
224952,
306875,
282302,
323262,
323265,
241360,
241366,
224985,
282330,
159462,
372458,
397040,
12017,
323315,
274170,
200444,
175874,
249606,
323335,
282379,
216844,
372497,
397076,
421657,
339746,
216868,
257831,
167720,
241447,
421680,
282418,
421686,
274234,
241471,
339782,
315209,
159563,
241494,
339799,
307038,
274276,
282471,
274288,
372592,
274296,
339840,
315265,
372625,
282517,
298912,
118693,
438186,
126896,
151492,
380874,
372699,
323554,
380910,
380922,
380923,
274432,
372736,
241695,
315431,
430120,
102441,
315433,
430127,
405552,
282671,
241717,
249912,
225347,
307269,
421958,
233548,
176209,
381013,
53334,
315477,
200795,
356446,
323678,
438374,
176231,
438378,
233578,
217194,
422000,
249976,
266361,
422020,
168069,
381061,
168070,
381071,
241809,
323730,
430231,
200856,
422044,
192670,
192671,
299166,
258213,
299176,
323761,
184498,
430263,
266427,
356550,
299208,
372943,
266447,
258263,
356575,
307431,
438512,
372979,
389364,
381173,
135416,
356603,
184574,
266504,
217352,
61720,
381210,
315674,
282908,
389406,
282912,
233761,
438575,
315698,
266547,
397620,
332084,
438583,
127292,
438592,
332100,
323914,
201037,
397650,
348499,
250196,
348501,
389465,
332128,
110955,
242027,
242028,
160111,
250227,
315768,
291193,
438653,
291200,
266628,
340356,
242059,
225684,
373141,
373144,
291225,
389534,
397732,
373196,
176602,
242138,
184799,
291297,
201195,
324098,
233987,
340489,
397841,
283154,
258584,
397855,
291359,
348709,
348710,
397872,
283185,
234037,
340539,
266812,
438850,
348741,
381515,
348748,
430681,
332379,
242274,
184938,
373357,
184942,
176751,
389744,
356983,
356984,
209529,
356990,
291455,
373377,
422529,
201348,
152196,
356998,
348807,
356999,
316044,
316050,
275102,
176805,
340645,
422567,
176810,
160441,
422591,
291529,
225996,
135888,
242385,
234216,
373485,
373486,
21239,
275193,
348921,
234233,
242428,
299777,
430853,
430860,
62222,
430880,
234276,
234290,
152372,
160569,
430909,
160576,
348999,
283466,
439118,
234330,
275294,
381791,
127840,
357219,
439145,
177002,
308075,
242540,
242542,
381811,
201590,
177018,
398205,
340865,
291713,
349066,
316299,
349068,
234382,
308111,
381840,
308113,
390034,
373653,
430999,
209820,
381856,
398244,
185252,
422825,
381872,
177074,
398268,
349122,
398275,
373705,
127945,
340960,
398305,
340967,
398313,
234476,
127990,
349176,
201721,
349179,
234499,
357380,
398370,
357413,
357420,
300087,
21567,
308288,
398405,
349254,
218187,
250955,
300109,
234578,
250965,
439391,
250982,
398444,
62574,
357487,
300147,
119925,
349304,
234626,
349315,
349317,
234635,
373902,
177297,
324761,
234655,
234662,
373937,
373939,
324790,
300215,
218301,
283841,
283846,
259275,
316628,
259285,
357594,
414956,
251124,
316661,
292092,
439550,
439563,
242955,
414989,
259346,
349458,
259347,
382243,
382246,
382257,
292145,
382264,
333115,
193853,
193858,
251212,
406862,
234830,
259408,
283990,
357720,
300378,
300379,
316764,
374110,
234864,
259449,
382329,
357758,
243073,
357763,
112019,
398740,
234902,
374189,
251314,
284086,
259513,
54719,
292291,
300490,
300526,
259569,
251379,
300539,
398844,
210429,
366081,
316951,
374297,
153115,
431646,
349727,
431662,
374327,
210489,
235069,
349764,
292424,
292426,
128589,
333389,
333394,
349780,
128600,
235096,
300643,
300645,
415334,
54895,
366198,
210558,
210559,
415360,
325246,
333438,
415369,
431754,
210569,
267916,
415376,
259741,
153252,
399014,
210601,
202413,
317102,
415419,
259780,
333508,
267978,
333522,
325345,
333543,
431861,
284410,
161539,
284425,
300812,
284430,
366358,
169751,
431901,
341791,
325411,
186148,
186149,
333609,
399148,
202541,
431918,
284460,
153392,
431935,
415555,
325444,
153416,
325449,
341837,
415566,
431955,
325460,
317268,
341846,
300893,
259937,
382820,
276326,
415592,
292713,
292719,
325491,
341878,
276343,
350072,
333687,
317305,
112510,
325508,
333700,
243590,
325514,
350091,
350092,
350102,
350108,
333727,
219046,
284584,
292783,
300983,
128955,
219102,
292835,
6116,
317416,
432114,
325620,
415740,
268286,
415744,
333827,
243720,
399372,
153618,
358418,
178215,
325675,
243763,
358455,
325695,
399433,
333902,
104534,
194667,
260206,
432241,
284789,
374913,
374914,
415883,
333968,
153752,
333990,
104633,
260285,
227517,
268479,
374984,
301270,
301271,
334049,
325857,
268515,
383208,
317676,
260337,
260338,
432373,
375040,
309504,
260355,
432387,
375052,
194832,
325904,
391448,
334104,
268570,
178459,
186660,
268581,
334121,
358698,
317738,
260396,
325930,
432435,
358707,
178485,
358710,
14654,
268609,
227655,
383309,
383327,
391521,
366948,
416101,
416103,
383338,
432503,
432511,
211327,
227721,
285074,
252309,
39323,
285083,
317851,
285089,
375211,
334259,
129461,
342454,
358844,
293309,
317889,
326083,
416201,
129484,
154061,
416206,
326093,
432608,
285152,
195044,
391654,
432616,
334315,
375281,
293368,
317949,
334345,
309770,
342537,
432650,
342549,
342560,
416288,
350758,
350759,
358951,
358952,
293420,
219694,
219695,
375345,
432694,
244279,
309831,
375369,
375373,
416334,
301647,
416340,
244311,
416353,
260705,
375396,
268901,
244326,
244345,
334473,
375438,
326288,
285348,
293552,
342705,
285362,
383668,
342714,
39616,
383708,
342757,
269036,
432883,
203511,
342775,
383740,
416509,
359166,
162559,
375552,
432894,
228099,
285443,
285450,
383755,
326413,
285467,
326428,
318247,
342827,
391980,
318251,
375610,
301883,
342846,
416577,
416591,
244569,
375644,
252766,
293729,
351078,
342888,
392057,
211835,
269179,
392065,
260995,
400262,
392071,
424842,
236427,
252812,
400271,
392080,
400282,
7070,
211871,
359332,
359333,
293801,
326571,
252848,
326580,
261045,
261046,
326586,
359365,
211913,
326602,
342990,
252878,
433104,
56270,
359380,
433112,
433116,
359391,
187372,
343020,
383980,
203758,
383994,
171009,
384004,
433166,
384015,
433173,
293911,
326684,
252959,
384031,
375848,
318515,
203829,
261191,
375902,
375903,
392288,
253028,
351343,
187505,
138354,
187508,
384120,
302202,
285819,
392317,
343166,
384127,
392320,
285823,
285833,
285834,
318602,
228492,
253074,
326803,
187539,
359574,
285850,
351389,
302239,
253098,
302251,
367791,
367792,
367798,
64699,
294075,
228541,
343230,
367809,
253124,
113863,
351445,
310496,
195809,
253168,
351475,
351489,
367897,
367898,
245018,
130342,
130344,
130347,
261426,
212282,
294210,
359747,
359748,
146760,
146763,
114022,
253288,
425327,
425331,
163190,
327030,
384379,
253316,
294278,
384391,
318860,
253339,
253340,
318876,
343457,
245160,
359860,
359861,
343480,
310714,
228796,
228804,
425417,
310731,
327122,
425434,
310747,
310758,
253431,
359931,
187900,
343552,
245249,
228868,
409095,
359949,
294413,
253456,
302613,
253462,
146976,
245290,
245291,
343606,
163385,
425534,
138817,
147011,
147020,
179800,
196184,
343646,
212574,
204386,
155238,
204394,
138862,
310896,
188021,
294517,
286351,
188049,
425624,
229021,
245413,
286387,
384693,
376502,
286392,
302778,
409277,
286400,
319176,
409289,
425682,
286419,
294621,
245471,
155360,
294629,
212721,
163575,
286457,
286463,
319232,
360194,
409355,
155408,
417556,
294699,
204600,
319289,
384826,
409404,
360253,
409416,
376661,
237397,
368471,
425820,
368486,
384871,
425832,
368489,
40809,
409446,
417648,
417658,
360315,
253828,
327556,
311183,
425875,
294806,
294808,
253851,
376733,
204702,
319393,
294820,
253868,
204722,
188349,
98240,
212947,
212953,
360416,
294887,
253930,
327666,
385011
] |
e05c1a59cc129b459610c444762f02fce741b110 | 969031b330a488f233f2a89c0ccea61031b37566 | /TheFirstGame-/TheFirstGame V3/TheFirstGame/Controllers/GameViewController/MovePlayer.swift | 565a119c572eb9a0dfe39dd0b722463df1f716af | [] | no_license | TuwaiqSky/FlyMe | 1b9c6ebb04c7959e712d995cbce1298b9a8ad97c | 1b4632d2997a3df1e1d58b07af0d6e5683ef54f0 | refs/heads/main | 2023-02-04T23:53:57.644405 | 2020-12-19T11:41:42 | 2020-12-19T11:41:42 | 322,831,080 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,524 | swift | //
// Move.swift
// TheFirstGame
//
// Created by Hanan on 28/11/2020.
//
import UIKit
extension GameViewController {
@IBAction func handlePan(_ sender: UIPanGestureRecognizer) {
let translation = sender.translation(in: view)
guard let gestureView = sender.view else {
return
}
gestureView.center = CGPoint(
x: gestureView.center.x + translation.x,
y: gestureView.center.y
)
sender.setTranslation(.zero, in: view)
let leftSideRestrction = self.view.frame.minX
let rightSideRestriction = self.view.frame.maxX
let spaceShipCurrentOrginXValue = self.player.frame.origin.x
let spaceShipCurrentOrginYValue = self.player.frame.origin.y
let spaceShipHeight = self.player.frame.size.height
let spaceShipWidth = self.player.frame.size.width
let spaceShipRightEdgePosition = spaceShipCurrentOrginXValue + spaceShipWidth
if spaceShipCurrentOrginXValue <= leftSideRestrction {
player.frame = CGRect(x: leftSideRestrction, y: spaceShipCurrentOrginYValue, width: spaceShipWidth, height: spaceShipHeight)
}
if spaceShipRightEdgePosition >= rightSideRestriction{
player.frame = CGRect(x: rightSideRestriction - spaceShipWidth, y: spaceShipCurrentOrginYValue, width: spaceShipWidth, height: spaceShipHeight)
}
}
}
| [
-1
] |
c039523b327fdb61a3f912cb1a5fade380e6c45d | 777b574fcf4a5eb1bcdc43804fff7ac432096e61 | /TravelCash/Views/MakeRequestView.swift | 89e6692fafa339f7f769b2776870a0e55b65faf9 | [] | no_license | lethanhtam1604/travel_cash_ios | 0732f04d6cd6b9730ba862ca860175c081159196 | 32d49af6dd3fb766cd74a31b763ede79bb2034dc | refs/heads/master | 2021-01-01T19:03:58.383138 | 2017-07-27T05:18:47 | 2017-07-27T05:18:47 | 98,496,580 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 6,158 | swift | //
// MakeRequestView.swift
// TravelCash
//
// Created by Thanh-Tam Le on 6/21/17.
// Copyright © 2017 Tam. All rights reserved.
//
import UIKit
import DropDown
class MakeRequestView: UIView {
var constraintsAdded = false
let titleLabel = UILabel()
let requestTypeField = UITextField()
let requestTypeBorder = UIView()
let requestTypeArrowDropDownView = UIView()
let requestTypeArrowDropDownImgView = UIImageView()
let requestTypeAbstract = UIView()
let requestTypeDropDown = DropDown()
let cancelBtn = UIButton()
let sendBtn = UIButton()
convenience init() {
self.init(frame: .zero)
backgroundColor = UIColor.white
tintColor = Global.colorMain
addTapToDismiss()
titleLabel.text = "Select your request type from the list below."
titleLabel.font = UIFont(name: "OpenSans", size: 16)
titleLabel.textAlignment = .left
titleLabel.textColor = UIColor.black.withAlphaComponent(0.8)
titleLabel.lineBreakMode = .byWordWrapping
titleLabel.numberOfLines = 0
requestTypeArrowDropDownView.backgroundColor = UIColor.white
requestTypeArrowDropDownView.addSubview(requestTypeArrowDropDownImgView)
requestTypeArrowDropDownImgView.clipsToBounds = true
requestTypeArrowDropDownImgView.contentMode = .scaleAspectFit
requestTypeArrowDropDownImgView.image = UIImage(named: "ic_arrow_drop_down")
requestTypeField.textAlignment = .left
requestTypeField.placeholder = "Request Types"
requestTypeField.textColor = UIColor.black
requestTypeField.returnKeyType = .next
requestTypeField.keyboardType = .phonePad
requestTypeField.inputAccessoryView = UIView()
requestTypeField.autocorrectionType = .no
requestTypeField.autocapitalizationType = .none
requestTypeField.font = UIFont(name: "OpenSans", size: 17)
requestTypeBorder.backgroundColor = Global.colorSeparator
requestTypeField.addSubview(requestTypeBorder)
requestTypeAbstract.backgroundColor = UIColor.clear
requestTypeField.addSubview(requestTypeArrowDropDownView)
requestTypeField.addSubview(requestTypeAbstract)
requestTypeDropDown.anchorView = requestTypeField
requestTypeDropDown.direction = .bottom
requestTypeDropDown.bottomOffset = CGPoint(x: 0, y: 1)
requestTypeDropDown.selectionAction = { [unowned self] (index, item) in
self.requestTypeField.text = item
}
cancelBtn.setTitle("CANCEL", for: .normal)
cancelBtn.backgroundColor = Global.colorMidBlue
cancelBtn.setTitleColor(UIColor.white, for: .normal)
cancelBtn.setTitleColor(Global.colorSelected, for: .highlighted)
cancelBtn.layer.cornerRadius = 5
cancelBtn.titleLabel?.font = UIFont(name: "OpenSans-semibold", size: 15)
cancelBtn.clipsToBounds = true
cancelBtn.titleLabel?.lineBreakMode = .byWordWrapping
cancelBtn.titleLabel?.textAlignment = .center
sendBtn.setTitle("SEND", for: .normal)
sendBtn.backgroundColor = Global.colorMidBlue
sendBtn.setTitleColor(UIColor.white, for: .normal)
sendBtn.setTitleColor(Global.colorSelected, for: .highlighted)
sendBtn.layer.cornerRadius = 5
sendBtn.titleLabel?.font = UIFont(name: "OpenSans-semibold", size: 15)
sendBtn.clipsToBounds = true
sendBtn.titleLabel?.lineBreakMode = .byWordWrapping
sendBtn.titleLabel?.textAlignment = .center
addSubview(titleLabel)
addSubview(requestTypeField)
addSubview(sendBtn)
addSubview(cancelBtn)
setNeedsUpdateConstraints()
}
override func updateConstraints() {
super.updateConstraints()
if !constraintsAdded {
constraintsAdded = true
let alpha: CGFloat = 40
titleLabel.autoPinEdge(toSuperviewEdge: .top, withInset: 10)
titleLabel.autoPinEdge(toSuperviewEdge: .left, withInset: 10)
titleLabel.autoPinEdge(toSuperviewEdge: .right, withInset: 10)
requestTypeArrowDropDownView.autoPinEdge(toSuperviewEdge: .right, withInset: 0)
requestTypeArrowDropDownView.autoPinEdge(toSuperviewEdge: .top, withInset: 0)
requestTypeArrowDropDownView.autoPinEdge(toSuperviewEdge: .bottom, withInset: 1)
requestTypeArrowDropDownView.autoSetDimension(.width, toSize: 25)
requestTypeArrowDropDownImgView.autoPinEdge(toSuperviewEdge: .top, withInset: 12)
requestTypeArrowDropDownImgView.autoPinEdge(toSuperviewEdge: .right, withInset: 1)
requestTypeArrowDropDownImgView.autoSetDimensions(to: CGSize(width: 25, height: 25))
requestTypeField.autoPinEdge(.top, to: .bottom, of: titleLabel, withOffset: 20)
requestTypeField.autoPinEdge(toSuperviewEdge: .left, withInset: alpha)
requestTypeField.autoPinEdge(toSuperviewEdge: .right, withInset: alpha)
requestTypeField.autoSetDimension(.height, toSize: 40)
requestTypeAbstract.autoPinEdgesToSuperviewEdges()
requestTypeBorder.autoPinEdge(toSuperviewEdge: .left)
requestTypeBorder.autoPinEdge(toSuperviewEdge: .right)
requestTypeBorder.autoPinEdge(toSuperviewEdge: .bottom)
requestTypeBorder.autoSetDimension(.height, toSize: 0.7)
sendBtn.autoPinEdge(toSuperviewEdge: .bottom, withInset: 10)
sendBtn.autoPinEdge(toSuperviewEdge: .right, withInset: 10)
sendBtn.autoSetDimensions(to: CGSize(width: 80, height: 30))
cancelBtn.autoPinEdge(.bottom, to: .bottom, of: sendBtn)
cancelBtn.autoMatch(.height, to: .height, of: sendBtn)
cancelBtn.autoMatch(.width, to: .width, of: sendBtn)
cancelBtn.autoPinEdge(.right, to: .left, of: sendBtn, withOffset: -10)
}
}
}
| [
-1
] |
04b52dd5c22cab94c6bfa9045af29bef38bbd8dc | 643bcb3934896c77dea50e995c91b351e85ee5e8 | /PoCDemoFriday/TrigonometricFunctions.swift | 69754e5e7581d9ea978be9a01d793ec7cd32d9b8 | [] | no_license | ibarra2521/PocCustomCharts_v2 | 2fb149a31dbc775344718789241095bdb010611b | a2a7ec9c6986d2a9dc99bb48bd584d882ea1731a | refs/heads/master | 2020-12-03T08:18:15.310281 | 2017-06-29T15:19:21 | 2017-06-29T15:19:21 | 95,683,579 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,239 | swift | //
// TrigonometricFunctions.swift
// PoCDemoFriday
//
// Created by Nivardo Ibarra on 6/27/17.
// Copyright © 2017 bbva. All rights reserved.
//
import UIKit
class TrigonometricFunctions {
func getHypotenuse(cathetusOpposite: CGFloat, cathetusAdjacent: CGFloat) -> Double {
let hypotenuseC = pow(Double(cathetusOpposite), Double(2)) + pow(Double(cathetusAdjacent), Double(2))
print("Double(cathetusOpposite), Double(2): \(Double(cathetusOpposite), Double(2))")
print("Double(cathetusOpposite), Double(2): \(Double(cathetusOpposite), Double(2))")
print("hypotenuseC: \(hypotenuseC)")
print("CGFloat(pow(Double(hypotenuseC), Double(0.5))): \(pow(Double(hypotenuseC), Double(0.5)))")
return pow(Double(hypotenuseC), Double(0.5))
}
func getAngleSin(cathetusOpposite: CGFloat, hypotenuse: CGFloat) -> Double {
let sin = cathetusOpposite / hypotenuse
print("sin: \(sin)")
let angle = asin(Double(sin)) * 180 / Double.pi //let arcsinus = asin(1.0) * 180 / Double.pi
print("CGFloat(angle): \(CGFloat(angle))")
return angle
}
func getCathetusOpposite(cathetusAdjacent: CGFloat, coTangent: CGFloat) -> Double {
let tang = tan(Double(coTangent) * Double.pi / 180) //tan(90 * M_PI / 180)
print("tang: \(tang)")
//let cathetusOpposite = tan(coTangent) * cathetusAdjacent
let cathetusOpposite = tang * Double(cathetusAdjacent)
print("cathetusOpposite__: \(cathetusOpposite))")
return Double(cathetusOpposite)
}
func getAnglesStartAndEnd(angle: CGFloat) -> (start: CGFloat, end: CGFloat) {
let constant: CGFloat = 35
if angle != 180 {
let angleEnd = (180.0 - angle) + constant
let angleStart = (180.0 - angle) - (constant - 10)
print("angleStart: \(angleStart)")
print("angleEnd: \(angleEnd)")
return (angleStart, angleEnd)
} else {
let angleEnd = (180) + constant
let angleStart = (180.0) - (constant - 10)
print("angleStart: \(angleStart)")
print("angleEnd: \(angleEnd)")
return (angleStart, angleEnd)
}
}
}
| [
-1
] |
c3c657732eeb57eef46f486c2fa8e349d852a77d | 57aedb223fbbac3b1afeb194c4d0014217c63b28 | /swift/30Days/11_GradientInTable/GradientInTable/GradientInTable/ViewController.swift | 3244508f3481b77c6c340fbd236207af146f4afb | [] | no_license | enre1008/swift | 033e611548a954618ed16450996c420deb9cd50c | 6cbd15c75b048b5aeb328dddb817a97dbad64870 | refs/heads/master | 2020-03-15T10:50:55.993559 | 2018-05-04T08:42:14 | 2018-05-04T08:42:14 | 132,108,333 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,735 | swift | //
// ViewController.swift
// GradientInTable
//
// Created by Sunny-Joy on 2018/1/17.
// Copyright © 2018年 Sunny. All rights reserved.
//
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
private let cellHeight:CGFloat = 66
private let colorRatio:CGFloat = 10
private let lyric = "when i was young i'd listen to the radio,waiting for my favorite songs,when they played i'd sing along,it make me smile,those were such happy times and not so long ago,how i wondered where they'd gone,but they're back again just like a long lost friend,all the songs i love so well,every shalala every wo'wo,still shines,every shing-a-ling-a-ling"
private var dataSource: Array<String>!
override func viewDidLoad() {
super.viewDidLoad()
let table = UITableView(frame: self.view.frame)
view.addSubview(table)
table.delegate = self
table.dataSource = self
table.separatorStyle = .none
self.dataSource = lyric.split(separator: ",").map(String.init)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return self.cellHeight
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.dataSource.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let uid = "userId"
let cell = UITableViewCell(style: .default, reuseIdentifier: uid)
cell.textLabel?.text = self.dataSource[indexPath.row]
cell.textLabel?.textColor = UIColor.black
let bgView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.cellHeight))
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bgView.frame
let lowerColor:CGColor = UIColor(red: 1.0, green:(CGFloat (indexPath.row * 2) * self.colorRatio)/255.0, blue: (CGFloat(indexPath.row * 2) * self.colorRatio)/255.0, alpha: 1.0).cgColor
let upperColor:CGColor = UIColor(red: 1.0, green:(CGFloat (indexPath.row * 2) * self.colorRatio + self.colorRatio)/255.0, blue: (CGFloat(indexPath.row * 2) * self.colorRatio + self.colorRatio)/255.0, alpha: 1.0).cgColor
gradientLayer.colors = [lowerColor, upperColor]
bgView.layer.addSublayer(gradientLayer)
cell.addSubview(bgView)
cell.sendSubview(toBack: bgView)
return cell
}
}
| [
-1
] |
df1edeebd54b9668312256eedb496ea45d747a4f | 0ee025a3c7cf6d621663b69dffda4af5975b22b3 | /Chapter 16/Facade/Facade/PirateShip.swift | 442e16edf969bace51d19d15db9b99fa3e8cd0a5 | [] | no_license | cHaLkdusT/Design-Patterns-in-Swift | 16ff2d5c47bd176c97c3fc9edc610ecc0a63be85 | f6c53c0f537a09ae6207adaf2ccb00734b455afa | refs/heads/master | 2021-01-19T04:47:09.132443 | 2016-08-16T13:22:06 | 2016-08-16T13:22:06 | 65,822,238 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 703 | swift | //
// PirateShip.swift
// Facade
//
// Created by jlundang on 21/07/2016.
// Copyright © 2016 15th Team. All rights reserved.
//
import Foundation
class PirateShip {
struct ShipLocation {
let NorthSouth: Int
let EastWest: Int
}
var currentPosition: ShipLocation
var movementQueue = dispatch_queue_create("shipQ", DISPATCH_QUEUE_SERIAL)
init() {
currentPosition = ShipLocation(NorthSouth: 5, EastWest: 5)
}
func moveToLocation(location: ShipLocation, callback: (ShipLocation) -> ()) {
dispatch_async(movementQueue) {
self.currentPosition = location
callback(self.currentPosition)
}
}
} | [
-1
] |
4e1757e22c326558a54fd7048e3ebf730d38a0e2 | 4d611ef78633fd4c86abfb5966a21c410c82b773 | /Sources/SignalBox.swift | 5eb5452edbc77d75ac180b14f5155efef1ba7abc | [
"MIT"
] | permissive | GothStar/SwiftGtk | ae7e92edc659706514af144db75363621ccab9ed | ca1577214d24a5c74dd0c33b933d9a5bd809e2b4 | refs/heads/master | 2021-07-02T15:00:50.432585 | 2020-09-29T15:18:17 | 2020-09-29T15:18:17 | 177,176,490 | 0 | 0 | BSD-2-Clause | 2019-03-22T16:41:15 | 2019-03-22T16:41:14 | null | UTF-8 | Swift | false | false | 2,558 | swift | //
// Copyright © 2016 Tomas Linhart. All rights reserved.
//
protocol SignalBox {
associatedtype CallbackType
var callback: CallbackType { get }
init(callback: CallbackType)
}
typealias SignalCallbackZero = () -> Void
typealias SignalCallbackOne = (UnsafeMutableRawPointer) -> Void
typealias SignalCallbackTwo = (UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
typealias SignalCallbackThree = (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
typealias SignalCallbackFour = (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
typealias SignalCallbackFive = (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
typealias SignalCallbackSix = (UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer, UnsafeMutableRawPointer) -> Void
/// Provides a box that captures a callback for a signal so it makes easier to add signals.
class SignalBoxZero: SignalBox {
typealias CallbackType = SignalCallbackZero
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxOne: SignalBox {
typealias CallbackType = SignalCallbackOne
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxTwo: SignalBox {
typealias CallbackType = SignalCallbackTwo
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxThree: SignalBox {
typealias CallbackType = SignalCallbackThree
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxFour: SignalBox {
typealias CallbackType = SignalCallbackFour
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxFive: SignalBox {
typealias CallbackType = SignalCallbackFive
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
class SignalBoxSix: SignalBox {
typealias CallbackType = SignalCallbackSix
let callback: CallbackType
required init(callback: @escaping CallbackType) {
self.callback = callback
}
}
| [
-1
] |
d9a03724610be656e69fa7f994c7345d6bba3971 | 64dd7b09860332b14a32674e6131224bf8f755ba | /MyRide/View/GradientView.swift | 8d85bcf7024a327757a7514f9f02c61ed31cd9e1 | [] | no_license | yogeshrathore123/MyRide | 784df8ae4bd3347853f156b0093a5d588a6b64a3 | 4fd667776de27dc03088a4c8e63bffa270b3af1a | refs/heads/master | 2020-04-19T22:43:50.430389 | 2019-02-01T11:47:15 | 2019-02-01T11:47:15 | 168,477,468 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 758 | swift | //
// GradientView.swift
// MyRide
//
// Created by Yogesh Rathore on 30/01/19.
// Copyright © 2019 Yogesh Rathore. All rights reserved.
//
import UIKit
class GradientView: UIView {
let gradient = CAGradientLayer()
override func awakeFromNib() {
setupGradientView()
}
func setupGradientView() {
// gradient.frame = self.bounds
gradient.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: self.bounds.height)
gradient.colors = [UIColor.white.cgColor, UIColor.init(white: 1.0, alpha: 0.0).cgColor]
gradient.startPoint = CGPoint.zero
gradient.endPoint = CGPoint(x: 0, y: 1)
gradient.locations = [0.8, 1.0]
self.layer.addSublayer(gradient)
}
}
| [
-1
] |
f3c78850c9fcba2aa15d360b9eadf6deb25370ab | 5e6b167b094063b57b5076dc4d5aeea288eb8492 | /Example/Lasso/Samples/TextScreen.swift | e67e4c383f0d746c38c3f9e2b094fa7b8070deb8 | [
"Apache-2.0"
] | permissive | Anhmike/lasso | 8f2427ff84b3c1bdef87af1ea45fe48d5d2d86f7 | 68353ed39c13c99c90dc3dba8334d444ca038eaf | refs/heads/master | 2021-01-26T12:21:02.508663 | 2020-02-21T14:19:25 | 2020-02-21T14:19:25 | 243,433,726 | 1 | 0 | Apache-2.0 | 2020-02-27T04:52:12 | 2020-02-27T04:52:11 | null | UTF-8 | Swift | false | false | 2,776 | swift | //
//===----------------------------------------------------------------------===//
//
// TextScreenModule.swift
//
// Created by Trevor Beasty on 5/10/19.
//
//
// This source file is part of the Lasso open source project
//
// https://github.com/ww-tech/lasso
//
// Copyright © 2019-2020 WW International, Inc.
//
//===----------------------------------------------------------------------===//
//
import UIKit
import WWLayout
import Lasso
enum TextScreenModule: PassthroughScreenModule {
static var defaultInitialState: State { return State() }
static func createScreen(with store: PassthroughStore<TextScreenModule>) -> Screen {
let controller = TextViewController(viewStore: store.asViewStore())
return Screen(store, controller)
}
struct State: Equatable {
let title: String?
let description: String?
let buttons: [String]
init(title: String? = nil, description: String? = nil, buttons: [String] = []) {
self.title = title
self.description = description
self.buttons = buttons
}
}
enum Action: Equatable {
case didTapButton(_ index: Int)
}
typealias Output = Action
}
class TextViewController: UIViewController, LassoView {
let store: TextScreenModule.ViewStore
init(viewStore: TextScreenModule.ViewStore) {
self.store = viewStore
super.init(nibName: nil, bundle: nil)
}
required init?(coder aDecoder: NSCoder) { fatalError() }
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .background
// set up labels
let titleLabel = UILabel(headline: store.state.title)
let descriptionLabel = UILabel(body: store.state.description)
// arrange labels
view.addSubviews(titleLabel, descriptionLabel)
titleLabel.layout
.fill(.safeArea, except: .bottom, inset: 20)
descriptionLabel.layout
.below(titleLabel, offset: 20)
.fill(.safeArea, axis: .x, inset: 20)
// add buttons
var previous: UIView = descriptionLabel
var offset: CGFloat = 50
for (index, title) in store.state.buttons.enumerated() {
let button = UIButton(standardButtonWithTitle: title)
view.addSubview(button)
button.layout
.below(previous, offset: offset)
.fillWidth(of: .safeArea, inset: 20, maximum: 300)
button.bind(to: store, action: .didTapButton(index))
previous = button
offset = 20
}
}
}
| [
-1
] |
a61f82a9dcf11974efff71389073feff29431209 | aebeeab7eb0a8847eab72111eb685690e49c53d9 | /AccountApp/UIView.swift | 12479435e7e801245859c02f7467e180109772c6 | [] | no_license | ITzombietux/HousekeepingBookApp | 3ca0c85a435255797c9a08020a20fe0580b3d958 | cf229a92392b6fad374bfcfc2f868d9c1ba2f6ea | refs/heads/master | 2020-04-16T17:53:32.639545 | 2019-01-15T11:43:31 | 2019-01-15T11:43:31 | 165,793,461 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,494 | swift | //
// UIColor.swift
// AccountApp
//
// Created by zombietux on 15/01/2019.
// Copyright © 2019 zombietux. All rights reserved.
//
import Foundation
import UIKit
extension UIColor {
class var lightGrassGreen: UIColor {
return UIColor(red: 171.0 / 255.0, green: 236.0 / 255.0, blue: 104.0 / 255.0, alpha: 1.0)
}
class var skyBlue: UIColor {
return UIColor(red: 84.0 / 255.0, green: 199.0 / 255.0, blue: 252.0 / 255.0, alpha: 1.0)
}
class var seafoamBlue: UIColor {
return UIColor(red: 93.0 / 255.0, green: 220.0 / 255.0, blue: 191.0 / 255.0, alpha: 1.0)
}
class var liliac: UIColor {
return UIColor(red: 201.0 / 255.0, green: 138.0 / 255.0, blue: 255.0 / 255.0, alpha: 1.0)
}
class var sunflowerYellow: UIColor {
return UIColor(red: 255.0 / 255.0, green: 205.0 / 255.0, blue: 0.0, alpha: 1.0)
}
class var carnation: UIColor {
return UIColor(red: 253.0 / 255.0, green: 100.0 / 255.0, blue: 147.0 / 255.0, alpha: 1.0)
}
class var peach: UIColor {
return UIColor(red: 253.0 / 255.0, green: 169.0 / 255.0, blue: 123.0 / 255.0, alpha: 1.0)
}
class var slate: UIColor {
return UIColor(red: 80.0 / 255.0, green: 107.0 / 255.0, blue: 120.0 / 255.0, alpha: 1.0)
}
class var darkLimeGreen: UIColor {
return UIColor(red: 111.0 / 255.0, green: 221.0 / 255.0, blue: 0.0, alpha: 1.0)
}
class func color(for index: Int) -> UIColor {
switch index % 6 {
case 0: return .lightGrassGreen
case 1: return .seafoamBlue
case 2: return .liliac
case 3: return .sunflowerYellow
case 4: return .peach
default: return .carnation
}
}
}
extension TransactionCategory {
struct Appearance {
let color: UIColor
let image: UIImage
}
var appearance: Appearance {
switch self {
case .income: return Appearance(color: .lightGrassGreen, image: #imageLiteral(resourceName: "income"))
case .groceries: return Appearance(color: .seafoamBlue, image: #imageLiteral(resourceName: "groceries"))
case .utilities: return Appearance(color: .liliac, image: #imageLiteral(resourceName: "utilities"))
case .home: return Appearance(color: .sunflowerYellow, image: #imageLiteral(resourceName: "home"))
case .transport: return Appearance(color: .peach, image: #imageLiteral(resourceName: "transport"))
case .fun: return Appearance(color: .carnation, image: #imageLiteral(resourceName: "fun"))
}
}
}
extension Float {
var dollarsFormatting: String {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.currencySymbol = "$"
return formatter.string(from: NSNumber(value: self))!
}
}
extension String {
var accountNumberFormatting: String {
var formattedString = ""
for (index, character) in characters.enumerated() {
if index % 4 < 3 || index == characters.count - 1 {
formattedString.append(character)
} else {
formattedString.append("\(character) ")
}
}
return formattedString
}
}
extension Date {
var transactionFormtting: String {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeStyle = .none
return formatter.string(from: self)
}
}
| [
-1
] |
68e23663ddd63fc6ed63933c433857ee5f95b1cd | 45d7c9d199aee3b28f66b475a64bd31b5be10891 | /tvOS/Foundation/NSPointerFunctions.swift | 7fa9d69de44863638524e198db7d017e9e8c4beb | [] | no_license | DougGregor/swift-concurrency-objc | f8ba0cfa2a4153d1cd129d7d61060d0a47067847 | 5ab47b4f70a675a4298dc00b1526505b964b4061 | refs/heads/xcode-12-2-beta-3 | 2023-01-28T12:41:18.646533 | 2020-10-15T19:42:00 | 2020-10-15T19:42:00 | 304,435,605 | 40 | 8 | null | 2020-10-15T20:05:54 | 2020-10-15T20:02:53 | Swift | UTF-8 | Swift | false | false | 2,361 | swift |
var __FOUNDATION_NSPOINTERFUNCTIONS__: Int32 { get }
extension NSPointerFunctions {
struct Options : OptionSet {
init(rawValue: UInt)
let rawValue: UInt
@available(tvOS 9.0, *)
static var strongMemory: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var opaqueMemory: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var mallocMemory: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var machVirtualMemory: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var weakMemory: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var objectPersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var opaquePersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var objectPointerPersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var cStringPersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var structPersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var integerPersonality: NSPointerFunctions.Options { get }
@available(tvOS 9.0, *)
static var copyIn: NSPointerFunctions.Options { get }
}
}
@available(tvOS 9.0, *)
class NSPointerFunctions : NSObject, NSCopying {
init(options: NSPointerFunctions.Options = [])
var hashFunction: (@convention(c) (UnsafeRawPointer, (@convention(c) (UnsafeRawPointer) -> Int)?) -> Int)?
var isEqualFunction: (@convention(c) (UnsafeRawPointer, UnsafeRawPointer, (@convention(c) (UnsafeRawPointer) -> Int)?) -> ObjCBool)?
var sizeFunction: (@convention(c) (UnsafeRawPointer) -> Int)?
var descriptionFunction: (@convention(c) (UnsafeRawPointer) -> String?)?
var relinquishFunction: (@convention(c) (UnsafeRawPointer, (@convention(c) (UnsafeRawPointer) -> Int)?) -> Void)?
var acquireFunction: (@convention(c) (UnsafeRawPointer, (@convention(c) (UnsafeRawPointer) -> Int)?, ObjCBool) -> UnsafeMutableRawPointer)?
@available(tvOS, introduced: 9.0, deprecated: 10.0, message: "Garbage collection no longer supported")
var usesStrongWriteBarrier: Bool
@available(tvOS, introduced: 9.0, deprecated: 10.0, message: "Garbage collection no longer supported")
var usesWeakReadAndWriteBarriers: Bool
}
| [
-1
] |
ecf2ccb520f5040aa6350068a83eef99e97a846b | 6973b833a7f77c5271d53158f3a50256aea0ce55 | /BreakPoint/View/InsetTextFiled.swift | 43f752fc29bf7d7754912e36a54b07df32414e4d | [] | no_license | msalaheldiin/Breakpoint | 9b9e9a8615147a0ec90c3b5b2b9837ac2c23a8fc | ff37d1233656b5073497c81d967791074b167218 | refs/heads/master | 2020-03-29T13:37:15.398996 | 2018-09-23T10:19:31 | 2018-09-23T10:19:31 | 149,000,003 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,019 | swift | //
// InsetTextFiled.swift
// BreakPoint
//
// Created by Mahmoud on 8/30/18.
// Copyright © 2018 Mahmoud. All rights reserved.
//
import UIKit
class InsetTextFiled: UITextField {
private var textRectOffset : CGFloat = 20
override func awakeFromNib() {
let placeholder = NSAttributedString(string: self.placeholder!, attributes: [NSAttributedStringKey.foregroundColor :#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)]
)
self.attributedPlaceholder = placeholder
super.awakeFromNib()
}
private var padding = UIEdgeInsetsMake(0, 20, 0, 0)
override func textRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
override func editingRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
return UIEdgeInsetsInsetRect(bounds, padding)
}
}
| [
233685
] |
4742cf4765b36d9561e18bf0c679b75a7af06d29 | b4ffe648405479c78f75d00660c30371fcdca500 | /RxSwiftPractice/Models/ArticleModel.swift | 7a7938d3ff02bc1588dd96c23fd83d1983d870a7 | [] | no_license | comeheredart/NewsApp-RxSwift | cb79e1d6dad6339054e2c3f568bcd959dc398593 | 8a17722aa8bb16ea3117db02124c555f9e4f8ec9 | refs/heads/main | 2023-05-08T09:49:55.028372 | 2021-05-26T11:32:06 | 2021-05-26T11:32:06 | 371,009,134 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 109 | swift | //
// ArticleModel.swift
// RxSwiftPractice
//
// Created by JEN Lee on 2021/05/26.
//
import Foundation
| [
-1
] |
21ddcccf0a8414fb1242ae44ef8fbd4f5c02073e | ecd3ef7c2b3188d069ac790423e9e6112645c35d | /Card_1/AppDelegate.swift | 6cbd8a29a23fb9712238da064a2c94d4fc0e18ac | [] | no_license | TapanPatel11/AR-Business-Card | 9693beed46c5cff41b16af34534134f286dd8d85 | 3ce80a5977a448507cd6e9b9881ae514a1bf39e3 | refs/heads/master | 2023-06-30T23:23:16.965830 | 2021-08-08T08:34:22 | 2021-08-08T08:34:22 | 277,278,019 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,172 | swift | //
// AppDelegate.swift
// Card_1
//
// Created by Tapan Patel on 28/01/20.
// Copyright © 2020 Tapan Patel. 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,
229388,
294924,
278542,
327695,
229391,
278545,
229394,
278548,
229397,
229399,
229402,
278556,
229405,
278559,
229408,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
286774,
319544,
204856,
229432,
286776,
286778,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
327814,
131209,
303241,
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,
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,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
320007,
287238,
172552,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
172618,
303690,
33357,
287309,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
189044,
287349,
189040,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
287371,
279178,
311951,
287377,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
295583,
287400,
279208,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
279231,
287427,
312005,
312006,
107208,
107212,
172748,
287436,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
279267,
312035,
295654,
279272,
312048,
230128,
312050,
230131,
189169,
205564,
303871,
230146,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
303914,
279340,
205613,
279353,
230202,
312124,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
304005,
295813,
304007,
320391,
304009,
213895,
304011,
230284,
189325,
304013,
295822,
279438,
189329,
295825,
189331,
304019,
58262,
304023,
279452,
410526,
279461,
279462,
304042,
213931,
304055,
230327,
287675,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
197645,
295949,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
238641,
312374,
238652,
238655,
230465,
238658,
296004,
132165,
336964,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
361576,
296040,
205931,
296044,
164973,
205934,
279661,
312432,
279669,
337018,
189562,
279679,
66690,
279683,
222340,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
165038,
238766,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
230679,
320792,
230681,
296215,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
296264,
320840,
238919,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
410987,
230763,
148843,
230768,
296305,
312692,
230773,
304505,
181626,
304506,
181631,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
288154,
337306,
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,
148946,
370130,
222676,
288210,
288212,
288214,
239064,
329177,
288218,
280021,
288220,
288217,
239070,
280027,
288224,
370146,
288226,
280036,
288229,
280038,
288230,
288232,
320998,
288234,
280034,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
148990,
321022,
206336,
402942,
296446,
296450,
230916,
230919,
214535,
304651,
370187,
230923,
304653,
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,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
280276,
313044,
321239,
280283,
18140,
313052,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
419570,
288499,
321266,
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,
337732,
280388,
304968,
280393,
194130,
280402,
173907,
313176,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
10170,
296890,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
313340,
288764,
239612,
239617,
313347,
288773,
313358,
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,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
215154,
313458,
149618,
280691,
313464,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
275606,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
321740,
313548,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
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,
289111,
248153,
215387,
354653,
354656,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
280959,
313731,
240011,
199051,
289166,
240017,
297363,
190868,
297365,
240021,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
305594,
289210,
281024,
289218,
289221,
289227,
436684,
281045,
281047,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
330244,
240132,
223752,
338440,
150025,
281095,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
158317,
19053,
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,
183172,
158596,
338823,
322440,
314249,
240519,
183184,
142226,
240535,
224151,
289687,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
420829,
281567,
289762,
322534,
297961,
183277,
322550,
134142,
322563,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
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,
306555,
314747,
298365,
290171,
290174,
224641,
281987,
314756,
298372,
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,
192008,
323084,
257550,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
282255,
282261,
175770,
298651,
323229,
282269,
298655,
323231,
61092,
282277,
306856,
196133,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
282337,
216801,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
307009,
413506,
241475,
307012,
298822,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
282481,
110450,
315251,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
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,
307307,
45163,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
299191,
176311,
307385,
307386,
258235,
307388,
176316,
307390,
184503,
299200,
184512,
307394,
307396,
299204,
184518,
307399,
323784,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
291089,
282906,
291104,
233766,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
282957,
110926,
233808,
323921,
315733,
323926,
233815,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
291226,
242075,
283033,
291231,
61855,
283042,
291238,
291241,
127403,
127405,
127407,
291247,
299440,
299444,
127413,
291254,
283062,
127417,
291260,
127421,
127424,
299457,
127429,
127431,
315856,
127440,
176592,
315860,
176597,
127447,
283095,
299481,
127449,
176605,
242143,
127455,
291299,
340454,
127463,
242152,
291305,
127466,
176620,
127469,
291314,
127474,
291317,
135672,
127480,
233979,
291323,
127485,
291330,
127494,
283142,
127497,
135689,
233994,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
135707,
234010,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
135844,
299684,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
225998,
299726,
226002,
119509,
226005,
226008,
242396,
299740,
201444,
299750,
283368,
234219,
283372,
185074,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
234246,
226056,
291593,
234248,
242443,
234252,
242445,
234254,
291601,
242450,
234258,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
234278,
299814,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
242511,
234319,
234321,
234324,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
234364,
291711,
234368,
234370,
291714,
291716,
234373,
316294,
234375,
226182,
308105,
226185,
234379,
234384,
234388,
234390,
226200,
234393,
209818,
308123,
234396,
324504,
291742,
234398,
324508,
234401,
291747,
291748,
234405,
291750,
324518,
324520,
234407,
234410,
291754,
291756,
324522,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
234431,
242623,
324544,
324546,
234434,
324548,
234437,
226239,
226245,
234439,
234443,
291788,
234446,
193486,
193488,
234449,
275406,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
324599,
234487,
234490,
234493,
234496,
316416,
234501,
308231,
234504,
234507,
234510,
234515,
300054,
234519,
234520,
316439,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
234543,
234546,
275508,
234549,
300085,
300088,
234553,
234556,
234558,
316479,
234561,
308291,
316483,
234563,
160835,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
234585,
275545,
242777,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
324757,
234647,
226453,
275608,
234650,
308379,
234648,
234653,
300189,
119967,
324766,
324768,
234657,
283805,
242852,
234661,
300197,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
300223,
234687,
300226,
308418,
283844,
300229,
308420,
308422,
234692,
283850,
300234,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
316663,
275703,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
349451,
177424,
275725,
283917,
349464,
415009,
283939,
259367,
292143,
283951,
300344,
226617,
243003,
283963,
226628,
283973,
300357,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
324978,
136562,
333178,
275834,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
226709,
357783,
316824,
316826,
300448,
144807,
144810,
144812,
284076,
144814,
144820,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
227430,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
284213,
194101,
284215,
316983,
194103,
284218,
226877,
284223,
284226,
284228,
243268,
292421,
284231,
226886,
128584,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
292433,
284243,
300628,
284245,
276053,
284247,
317015,
235097,
243290,
284249,
284251,
284253,
300638,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
292479,
284288,
292481,
284290,
325250,
284292,
292485,
325251,
276095,
276098,
284297,
317066,
284299,
317068,
276109,
284301,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
276206,
358128,
284399,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
325408,
300832,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
153417,
292681,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
358292,
284564,
317332,
399252,
284566,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
161718,
358326,
358330,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
301015,
358360,
301017,
292828,
276446,
276448,
153568,
276452,
292839,
276455,
350186,
292843,
276460,
292845,
178161,
227314,
276466,
350200,
325624,
276472,
317435,
276476,
276479,
350210,
276482,
178181,
276485,
350218,
276490,
292876,
350222,
317456,
276496,
317458,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
178224,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
243779,
284739,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350302,
194654,
227423,
178273,
309346,
227426,
309348,
350308,
309350,
194660,
309352,
350313,
309354,
301163,
350316,
292968,
276583,
301167,
276586,
350321,
276590,
227440,
284786,
350325,
276595,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
153765,
284837,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
309468,
194780,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
227571,
309491,
309494,
243960,
227583,
276735,
276739,
211204,
276742,
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,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
236043,
317963,
342541,
55822,
113167,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
318020,
301636,
301639,
301643,
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,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
293666,
285474,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
293696,
310080,
277317,
277322,
277329,
162643,
310100,
301911,
277337,
301913,
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,
276579,
293817,
293820,
203715,
326603,
342994,
293849,
293861,
228327,
228328,
318442,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
244731,
285690,
302075,
293887,
277504,
277507,
277511,
277519,
293908,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
310344,
293960,
277577,
277583,
203857,
293971,
310359,
236632,
277594,
138332,
277598,
203872,
285792,
277601,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
253064,
302218,
285835,
294026,
384148,
162964,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
302296,
384222,
310498,
285927,
318698,
302315,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
384302,
285999,
277804,
113969,
277807,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
302403,
294211,
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,
310659,
351619,
294276,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
130486,
310710,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
245191,
310727,
64966,
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,
302614,
302617,
286233,
302621,
187936,
146977,
286240,
187939,
40484,
294435,
40486,
286246,
40488,
245288,
294439,
40491,
294440,
294443,
294445,
310831,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
40521,
286283,
40525,
40527,
400976,
212560,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
302764,
278188,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
302793,
294601,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
311048,
294664,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
229233,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
acb9a1bd17bc8cfbcf927f03ebf4fd8a68c5ff33 | 55f64f121260b9527f5cc509621348e601bb7831 | /twofive/twofive/ViewController.swift | 65b1275d99d7c29d6cc4054b8af3421e02b17471 | [] | no_license | terojankko/random | 5b19ec0d7861f7ce4eb4ba8978902b8687764fb7 | 6d384c5d9ea257e58348aa2655cc1e7dbe3c164d | refs/heads/master | 2020-05-19T09:24:54.756142 | 2019-05-08T23:33:49 | 2019-05-08T23:33:49 | 184,945,895 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 5,289 | swift | //
// ViewController.swift
// twofive
//
// Created by Tero Jankko on 5/8/19.
// Copyright © 2019 Tero Jankko. All rights reserved.
//
import UIKit
import MultipeerConnectivity
class ViewController: UICollectionViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, MCBrowserViewControllerDelegate, MCSessionDelegate {
var images = [UIImage]()
var peerID = MCPeerID(displayName: UIDevice.current.name)
var mcSession: MCSession?
var mcAdvertiserAssistant: MCAdvertiserAssistant?
override func viewDidLoad() {
super.viewDidLoad()
title = "Selfie Share"
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .camera, target: self, action: #selector(importPicture))
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(showConnectionPrompt))
mcSession = MCSession(peer: peerID, securityIdentity: nil, encryptionPreference: .required)
mcSession?.delegate = self
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return images.count
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ImageView", for: indexPath)
if let imageView = cell.viewWithTag(1000) as? UIImageView {
imageView.image = images[indexPath.item]
}
return cell
}
@objc func importPicture() {
let picker = UIImagePickerController()
picker.allowsEditing = true
picker.delegate = self
present(picker, animated: true)
}
@objc func showConnectionPrompt() {
let ac = UIAlertController(title: "Connect to others", message: nil, preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "Host a session", style: .default, handler: startHosting))
ac.addAction(UIAlertAction(title: "Join a session", style: .default, handler: joinSession))
ac.addAction(UIAlertAction(title: "Cancel", style: .cancel))
present(ac, animated: true)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
guard let image = info[.editedImage] as? UIImage else { return }
dismiss(animated: true)
images.insert(image, at: 0)
collectionView.reloadData()
guard let mcSession = mcSession else { return }
if mcSession.connectedPeers.count > 0 {
if let imageData = image.pngData() {
do {
try mcSession.send(imageData, toPeers: mcSession.connectedPeers, with: .reliable)
} catch {
// 5
let ac = UIAlertController(title: "Send error", message: error.localizedDescription, preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
present(ac, animated: true)
}
}
}
}
func startHosting(action: UIAlertAction) {
guard let mcSession = mcSession else { return }
mcAdvertiserAssistant = MCAdvertiserAssistant(serviceType: "hws-project25", discoveryInfo: nil, session: mcSession)
mcAdvertiserAssistant?.start()
}
func joinSession(action: UIAlertAction) {
guard let mcSession = mcSession else { return }
let mcBrowser = MCBrowserViewController(serviceType: "hws-project25", session: mcSession)
mcBrowser.delegate = self
present(mcBrowser, animated: true)
}
func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID) {
}
func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress) {
}
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: Error?) {
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
dismiss(animated: true)
}
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
dismiss(animated: true)
}
func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {
switch state {
case .connected:
print("Connected: \(peerID.displayName)")
case .connecting:
print("Connecting: \(peerID.displayName)")
case .notConnected:
print("Not Connected: \(peerID.displayName)")
@unknown default:
print("Unknown state received: \(peerID.displayName)")
}
}
func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {
DispatchQueue.main.async { [weak self] in
if let image = UIImage(data: data) {
self?.images.insert(image, at: 0)
self?.collectionView.reloadData()
}
}
}
}
| [
241599,
350398,
300271
] |
a3cf0baf1dca512051c647d898192ec6449b9029 | c038b6e3932f71c1ebffee3e1e1d3e99dba2261e | /MarvelCharacters/Models/CharacterContained/Thumbnail.swift | 1664f54bb2267e37f82f22dcdb731610a1bf8765 | [] | no_license | tomasfn/marvel-ios | 4d3e0f06758c6cedb5f256fa4cc3caa78ecfaebc | 67383e37323fa3d203422ab69ea646285a4791a6 | refs/heads/main | 2023-05-23T21:24:02.337035 | 2021-06-16T19:37:51 | 2021-06-16T19:37:51 | 377,606,231 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 207 | swift | //
// Thumbnail.swift
// MarvelCharacters
//
// Created by Tomás Fernández Velazco on 15/06/2021.
//
import Foundation
struct Thumbnail: Codable {
var path: String
var `extension`: String
}
| [
-1
] |
899e389339a11f26a26bd6aead35d65eafb77745 | bc20de6d1a48bc2ba9eed16583a7f1995c5b80f1 | /StantUiIosLibrary/Classes/Menus/ServiceInspectionFormFilledDetailMenu/ServiceInspectionFormFilledDetailMenuView.swift | 24cee350356f857af3ef428c894a096b0dccf02c | [
"MIT"
] | permissive | stantmob/stant-ui-ios-library | c4e3df84282e74dad40968e6d86aa0cc4212b2fd | 3f0a29c104727e7b2896f346a8e8abf6c8167972 | refs/heads/master | 2021-07-03T23:10:19.385813 | 2020-10-15T12:33:59 | 2020-10-15T12:33:59 | 187,696,710 | 1 | 0 | MIT | 2020-10-15T12:34:01 | 2019-05-20T18:53:51 | Swift | UTF-8 | Swift | false | false | 5,226 | swift | //
// ServiceInspectionFormFilledDetailMenuView.swift
// StantUiIosLibrary
//
// Created by Leandro Martins on 27/05/20.
//
import UIKit
public class ServiceInspectionFormFilledDetailMenuView: UIView {
public var inChargeStackView: InChargeStackView?
public var mainTabView: CustomTabView?
public var formTabView: FormTabView?
public var teamTabView: TeamTabView?
public var attachmentTabView: AttachmentTabView?
public func configureInChargeStackView(personInChargeNames: [String],
personInChargePhotoUrls: [String]) {
inChargeStackView = InChargeStackView()
guard let inChargeStackView = inChargeStackView else { return }
self.addSubview(inChargeStackView)
inChargeStackView.anchor(top: self.topAnchor,
leading: self.leadingAnchor,
trailing: self.trailingAnchor,
size: CGSize(width: 0, height: 82))
inChargeStackView.configure(personNames: personInChargeNames,
photoUrls: personInChargePhotoUrls)
}
public func configureMainTabView() {
mainTabView = CustomTabView()
guard let mainTabView = mainTabView else { return }
mainTabView.delegate = self
self.addSubview(mainTabView)
mainTabView.anchor(top: inChargeStackView?.bottomAnchor,
leading: self.leadingAnchor,
trailing: self.trailingAnchor,
padding: UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0),
size: CGSize(width: 0, height: 38))
}
public func configureFormTab(beginDate: String,
endDate: String,
quantiy: String,
unitMeasurement: String,
tests: String) {
formTabView = FormTabView()
guard let formTabView = formTabView else { return }
formTabView.isHidden = false
self.addSubview(formTabView)
formTabView.anchor(top: mainTabView?.bottomAnchor,
leading: self.leadingAnchor,
bottom: self.bottomAnchor,
trailing: self.trailingAnchor,
padding: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
formTabView.configure(beginDate: beginDate,
endDate: endDate,
quantiy: quantiy,
unitMeasurement: unitMeasurement,
tests: tests)
}
public func configureTeamTab(delegate: TeamTabViewDelegate,
personNames: [String],
personRoles: [String] = [],
photoUrls: [String] = []) {
teamTabView = TeamTabView()
guard let teamTabView = teamTabView else { return }
teamTabView.delegate = delegate
teamTabView.isHidden = true
self.addSubview(teamTabView)
teamTabView.anchor(top: mainTabView?.bottomAnchor,
leading: self.leadingAnchor,
bottom: self.bottomAnchor,
trailing: self.trailingAnchor,
padding: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
teamTabView.configure(personNames: personNames,
personRoles: personRoles,
photoUrls: photoUrls)
}
public func configureAttachmentTab(photoUrls: [String] = []) {
attachmentTabView = AttachmentTabView()
guard let attachmentTabView = attachmentTabView else { return }
attachmentTabView.isHidden = true
self.addSubview(attachmentTabView)
attachmentTabView.anchor(top: mainTabView?.bottomAnchor,
leading: self.leadingAnchor,
bottom: self.bottomAnchor,
trailing: self.trailingAnchor,
padding: UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
attachmentTabView.configure(photoUrls: photoUrls)
}
}
extension ServiceInspectionFormFilledDetailMenuView: CustomTabViewDelegate {
public func goToFormTabView() {
setVisibilty(view: formTabView)
}
public func goToTeamTabView() {
setVisibilty(view: teamTabView)
}
public func goToAttachmentTabView() {
setVisibilty(view: attachmentTabView)
}
func setVisibilty(view: UIView?) {
formTabView?.isHidden = view != formTabView
teamTabView?.isHidden = view != teamTabView
attachmentTabView?.isHidden = view != attachmentTabView
}
}
| [
-1
] |
e437bdb84cb9e4ae88b574d5e8c4a803a12b9541 | db7f01bf52c1a9d53d59f0c19fbd737ede61aa6f | /test/AutoDiff/SILGen/sil_differentiability_witness.swift | 6b0600d7e1bcbea3badee588006841a5fe7ef4b7 | [
"Apache-2.0",
"Swift-exception"
] | permissive | cypherean/swift | a3d8ad9dcf69ef8f1071bd04f5afa982d132e3ab | cd724d492433915a0081537cd7b708a0593199cb | refs/heads/main | 2023-03-06T23:51:08.085017 | 2021-02-18T17:29:04 | 2021-02-18T17:29:04 | 334,955,980 | 0 | 0 | Apache-2.0 | 2021-02-01T13:18:26 | 2021-02-01T13:18:25 | null | UTF-8 | Swift | false | false | 11,556 | swift | // RUN: %target-swift-frontend -emit-silgen %s | %target-sil-opt | %FileCheck %s
// Test SIL differentiability witness SIL generation.
import _Differentiation
// Dummy `Differentiable`-conforming type.
public struct DummyTangentVector: Differentiable & AdditiveArithmetic {
public static var zero: Self { Self() }
public static func + (_: Self, _: Self) -> Self { Self() }
public static func - (_: Self, _: Self) -> Self { Self() }
public typealias TangentVector = Self
}
// Test public non-generic function.
// SIL differentiability witness:
// - Has public linkage (implicit).
// - Has no `where` clause.
public func foo(_ x: Float) -> Float { x }
@derivative(of: foo)
public func foo_jvp(_ x: Float) -> (value: Float, differential: (Float) -> Float) {
(x, { $0 })
}
@derivative(of: foo)
public func foo_vjp(_ x: Float) -> (value: Float, pullback: (Float) -> Float) {
(x, { $0 })
}
// CHECK-LABEL: // differentiability witness for foo(_:)
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3fooyS2fF : $@convention(thin) (Float) -> Float {
// CHECK-NEXT: jvp: @$s29sil_differentiability_witness3fooyS2fFTJfSpSr : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)
// CHECK-NEXT: vjp: @$s29sil_differentiability_witness3fooyS2fFTJrSpSr : $@convention(thin) (Float) -> (Float, @owned @callee_guaranteed (Float) -> Float)
// CHECK-NEXT: }
// Test internal non-generic function.
// SIL differentiability witness:
// - Has hidden linkage.
// - Has no `where` clause.
// - Has only VJP.
func bar<T>(_ x: Float, _ y: T) -> Float { x }
@derivative(of: bar)
func bar_jvp<T>(_ x: Float, _ y: T) -> (value: Float, differential: (Float) -> Float) {
(x, { $0 })
}
// CHECK-LABEL: // differentiability witness for bar<A>(_:_:)
// CHECK-NEXT: sil_differentiability_witness hidden [reverse] [parameters 0] [results 0] <τ_0_0> @$s29sil_differentiability_witness3baryS2f_xtlF : $@convention(thin) <T> (Float, @in_guaranteed T) -> Float {
// CHECK-NEXT: jvp: @$s29sil_differentiability_witness3baryS2f_xtlFlTJfSUpSr : $@convention(thin) <τ_0_0> (Float, @in_guaranteed τ_0_0) -> (Float, @owned @callee_guaranteed (Float) -> Float)
// CHECK-NEXT: }
// Test internal generic function.
// SIL differentiability witness:
// - Has hidden linkage.
// - Has `where` clause.
func generic<T>(_ x: T, _ y: Float) -> T { x }
@derivative(of: generic)
func generic_jvp<T: Differentiable>(_ x: T, _ y: Float) -> (
value: T, differential: (T.TangentVector, Float) -> T.TangentVector
) {
(x, { dx, dy in dx })
}
@derivative(of: generic)
func generic_vjp<T: Differentiable>(_ x: T, _ y: Float) -> (
value: T, pullback: (T.TangentVector) -> (T.TangentVector, Float)
) {
(x, { ($0, .zero) })
}
// CHECK-LABEL: // differentiability witness for generic<A>(_:_:)
// CHECK-NEXT: sil_differentiability_witness hidden [reverse] [parameters 0 1] [results 0] <τ_0_0 where τ_0_0 : Differentiable> @$s29sil_differentiability_witness7genericyxx_SftlF : $@convention(thin) <T> (@in_guaranteed T, Float) -> @out T {
// CHECK-NEXT: jvp: @$s29sil_differentiability_witness7genericyxx_SftlF16_Differentiation14DifferentiableRzlTJfSSpSr : $@convention(thin) <τ_0_0 where τ_0_0 : Differentiable> (@in_guaranteed τ_0_0, Float) -> (@out τ_0_0, @owned @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0, Float) -> @out τ_0_1 for <τ_0_0.TangentVector, τ_0_0.TangentVector>)
// CHECK-NEXT: vjp: @$s29sil_differentiability_witness7genericyxx_SftlF16_Differentiation14DifferentiableRzlTJrSSpSr : $@convention(thin) <τ_0_0 where τ_0_0 : Differentiable> (@in_guaranteed τ_0_0, Float) -> (@out τ_0_0, @owned @callee_guaranteed @substituted <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0) -> (@out τ_0_1, Float) for <τ_0_0.TangentVector, τ_0_0.TangentVector>)
// CHECK-NEXT: }
public struct Foo: Differentiable {
public typealias TangentVector = DummyTangentVector
public mutating func move(along _: TangentVector) {}
@differentiable(reverse)
public var x: Float
// CHECK-LABEL: // differentiability witness for Foo.x.getter
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3FooV1xSfvg : $@convention(method) (Foo) -> Float {
// CHECK-NEXT: }
@differentiable(reverse)
public init(_ x: Float) {
self.x = x
}
// CHECK-LABEL: // differentiability witness for Foo.init(_:)
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3FooVyACSfcfC : $@convention(method) (Float, @thin Foo.Type) -> Foo {
// CHECK-NEXT: }
@differentiable(reverse)
public func method() -> Float {
x
}
// CHECK-LABEL: // differentiability witness for Foo.method()
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3FooV6methodSfyF : $@convention(method) (Foo) -> Float {
// CHECK-NEXT: }
@differentiable(reverse)
public var computedProperty: Float {
x
}
// CHECK-LABEL: // differentiability witness for Foo.computedProperty.getter
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3FooV16computedPropertySfvg : $@convention(method) (Foo) -> Float {
// CHECK-NEXT: }
@differentiable(reverse)
public subscript() -> Float {
x
}
// CHECK-LABEL: // differentiability witness for Foo.subscript.getter
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] @$s29sil_differentiability_witness3FooVSfycig : $@convention(method) (Foo) -> Float {
// CHECK-NEXT: }
}
// Test function that is differentiable wrt subset of its parameters:
// - wrt x: explicit @differentiable(reverse) attribute, with no custom derivative specified
// - wrt y: explicit @differentiable(reverse) attribute, with custom derivative specified
// - wrt x, y: custom deriviative specified, with no explicit @differentiable(reverse) attribute
// Has a tuple argument to verify that indices are correctly lowered to SIL.
@differentiable(reverse, wrt: x)
public func wrt_subset(_ tup: (Int, Int), _ x: Float, _ y: Float) -> Float {
return 0
}
@derivative(of: wrt_subset, wrt: y)
public func wrt_subset_jvp_wrt_y(_ tup: (Int, Int), _ x: Float, _ y: Float) -> (value: Float, differential: (Float) -> Float) {
return (0, { $0 })
}
@derivative(of: wrt_subset, wrt: y)
public func wrt_subset_vjp_wrt_y(_ tup: (Int, Int), _ x: Float, _ y: Float) -> (value: Float, pullback: (Float) -> Float) {
return (0, { $0 })
}
@derivative(of: wrt_subset)
public func wrt_subset_jvp_wrt_x_y(_ tup: (Int, Int), _ x: Float, _ y: Float) -> (value: Float, differential: (Float, Float) -> Float) {
return (0, { $0 + $1 })
}
@derivative(of: wrt_subset)
public func wrt_subset_vjp_wrt_x_y(_ tup: (Int, Int), _ x: Float, _ y: Float) -> (value: Float, pullback: (Float) -> (Float, Float)) {
return (0, { ($0, $0) })
}
// CHECK-LABEL: // differentiability witness for wrt_subset(_:_:_:)
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 2] [results 0] @$s29sil_differentiability_witness10wrt_subsetySfSi_Sit_S2ftF : $@convention(thin) (Int, Int, Float, Float) -> Float {
// CHECK-NEXT: }
// CHECK-LABEL: // differentiability witness for wrt_subset(_:_:_:)
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 3] [results 0] @$s29sil_differentiability_witness10wrt_subsetySfSi_Sit_S2ftF : $@convention(thin) (Int, Int, Float, Float) -> Float {
// CHECK-NEXT: jvp:
// CHECK-NEXT: vjp:
// CHECK-NEXT: }
// CHECK-LABEL: // differentiability witness for wrt_subset(_:_:_:)
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 2 3] [results 0] @$s29sil_differentiability_witness10wrt_subsetySfSi_Sit_S2ftF : $@convention(thin) (Int, Int, Float, Float) -> Float {
// CHECK-NEXT: jvp:
// CHECK-NEXT: vjp:
// CHECK-NEXT: }
// Test original function with `@differentiable` and `@derivative` attributes.
protocol P1: Differentiable {}
extension P1 {
@differentiable(reverse) // derivative generic signature: none
func foo() -> Float { 1 }
}
extension P1 {
@derivative(of: foo) // derivative generic signature: `<P1 where Self: P1>`
func vjpFoo() -> (value: Float, pullback: (Float) -> (TangentVector)) {
fatalError()
}
}
// CHECK-LABEL: // differentiability witness for P1.foo()
// CHECK-NEXT: sil_differentiability_witness hidden [reverse] [parameters 0] [results 0] <τ_0_0 where τ_0_0 : P1> @$s29sil_differentiability_witness2P1PAAE3fooSfyF : $@convention(method) <Self where Self : P1> (@in_guaranteed Self) -> Float {
// CHECK-NEXT: vjp: @$s29sil_differentiability_witness2P1PAAE3fooSfyFAaBRzlTJrSpSr : $@convention(method) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float) -> @out τ_0_0 for <τ_0_0.TangentVector>)
// CHECK-NEXT: }
// Test custom derivatives of functions with generic signatures and `@differentiable` attributes.
@differentiable(reverse)
@_silgen_name("genericWithDiffAttr")
public func genericWithDiffAttr<T: Differentiable>(_ x: T) -> T { fatalError() }
@derivative(of: genericWithDiffAttr)
public func vjpGenericWithDiffAttr<T: Differentiable>(_ x: T)
-> (value: T, pullback: (T.TangentVector) -> T.TangentVector)
{
fatalError()
}
// CHECK-LABEL: // differentiability witness for genericWithDiffAttr
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] <τ_0_0 where τ_0_0 : Differentiable> @genericWithDiffAttr : $@convention(thin) <T where T : Differentiable> (@in_guaranteed T) -> @out T {
// CHECK-NEXT: vjp
// CHECK-NEXT: }
// CHECK-NOT: // differentiability witness for genericWithDiffAttr
@differentiable(reverse where T: Differentiable)
@_silgen_name("genericWithConstrainedDifferentiable")
public func genericWithConstrainedDifferentiable<T>(_ x: T) -> T { fatalError() }
@derivative(of: genericWithConstrainedDifferentiable)
public func vjpGenericWithConstrainedDifferentiable<T: Differentiable>(_ x: T)
-> (value: T, pullback: (T.TangentVector) -> T.TangentVector)
{
fatalError()
}
// CHECK-LABEL: // differentiability witness for genericWithConstrainedDifferentiable
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] <τ_0_0 where τ_0_0 : Differentiable> @genericWithConstrainedDifferentiable : $@convention(thin) <T> (@in_guaranteed T) -> @out T {
// CHECK-NEXT: vjp
// CHECK-NEXT: }
// CHECK-NOT: // differentiability witness for genericWithConstrainedDifferentiable
public extension Differentiable {
@differentiable(reverse)
@_silgen_name("protocolExtensionWithDiffAttr")
func protocolExtensionWithDiffAttr() -> Self { self }
@derivative(of: protocolExtensionWithDiffAttr)
func protocolExtensionWithDiffAttr() -> (value: Self, pullback: (TangentVector) -> TangentVector) {
fatalError("unimplemented")
}
}
// CHECK-LABEL: // differentiability witness for protocolExtensionWithDiffAttr
// CHECK-NEXT: sil_differentiability_witness [serialized] [reverse] [parameters 0] [results 0] <τ_0_0 where τ_0_0 : Differentiable> @protocolExtensionWithDiffAttr : $@convention(method) <Self where Self : Differentiable> (@in_guaranteed Self) -> @out Self {
// CHECK-NEXT: vjp
// CHECK-NEXT: }
// CHECK-NOT: // differentiability witness for protocolExtensionWithDiffAttr
| [
85323
] |
3b1c57cd9bcea7eec617b0781d09a02c79d40515 | 1cd239bbb4da61169498fded194102bb2fc5ad53 | /Experiences/Experiences/Custom Views/ExperienceTypeCollectionViewCell.swift | 3e0c49efcdeb8c1991ecb44c2fb06d0562519c9e | [] | no_license | alexnrhodes/ios-sprint-challenge-experiences | 4fe63fa4622858e2938404f2d057b5157234c6f3 | 48b16c1312fcbc5eaa2962a0429961971c433390 | refs/heads/master | 2020-09-01T17:19:39.000387 | 2019-11-04T16:26:30 | 2019-11-04T16:26:30 | 219,014,130 | 0 | 0 | null | 2019-11-01T15:38:36 | 2019-11-01T15:38:36 | null | UTF-8 | Swift | false | false | 248 | swift | //
// ExperienceTypeCollectionViewCell.swift
// Experiences
//
// Created by Alex Rhodes on 11/1/19.
// Copyright © 2019 Alex Rhodes. All rights reserved.
//
import UIKit
class ExperienceTypeCollectionViewCell: UICollectionViewCell {
}
| [
-1
] |
4925c63abb59af764eea58566c731c83c24c10ce | 3365a97289c15b0f859fcc22e1aed9837861d1d8 | /TestIntegration/TestIntegrationTests/TestIntegrationTests.swift | 40b8359e0f6724903c55a985eb15bb818eabda09 | [] | no_license | snehakasetty224/Testing | 39579fceaf557a40e8d50d11406043652a140a5b | 011ac90c92b89c57a05792388b7f1b56a8aa00de | refs/heads/master | 2021-05-12T02:34:37.133375 | 2018-01-16T00:00:57 | 2018-01-16T00:00:57 | 117,592,622 | 0 | 0 | null | 2018-01-16T00:00:58 | 2018-01-15T20:34:31 | Swift | UTF-8 | Swift | false | false | 1,025 | swift | //
// TestIntegrationTests.swift
// TestIntegrationTests
//
// Created by Sneha Kasetty Sudarshan on 1/15/18.
// Copyright © 2018 Sneha Kasetty Sudarshan. All rights reserved.
//
import XCTest
@testable import TestIntegration
class TestIntegrationTests: 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.
}
}
}
| [
306560,
311681,
301571,
333955,
302213,
279039,
304656,
238610,
239250,
347283,
345879,
169754,
283419,
237857,
40614,
283558,
155694,
253999,
298291,
237620,
292283,
160575,
70209,
302529,
302531,
415171,
319813,
301638,
70215,
279747,
312782,
307025,
309846,
314239,
248796,
301279,
304351,
358882,
299746,
281957,
307301,
322663,
319981,
289518,
309744,
67315,
308723,
310131,
191990,
228215,
381172,
237689,
300794,
286459,
215166,
184575
] |
9d6c3b7c2258d2acbd14beb17e894f9a18ca0e68 | 48bb9bf32f65e606a485afe4223555fb794dd74d | /iOS/MyStudies/MyStudies/Controllers/GatewayUI/StudyUI/StudyListViewController.swift | d84a9ab66ac4a9780d9672438b484d16b98f077e | [
"MIT"
] | permissive | clipcrow/fda-mystudies | cc8bdb41545828ab805ba65d50c7031bb26a8622 | 94fe6d0dc317c5c88c999cd9b8200c6cd154e30d | refs/heads/master | 2023-03-21T01:07:03.933903 | 2021-03-01T05:23:46 | 2021-03-01T05:23:46 | 326,676,917 | 0 | 0 | NOASSERTION | 2021-03-01T05:23:47 | 2021-01-04T12:29:01 | Java | UTF-8 | Swift | false | false | 38,735 | swift | // License Agreement for FDA MyStudies
// Copyright © 2017-2019 Harvard Pilgrim Health Care Institute (HPHCI) and its Contributors.
// Copyright 2020 Google LLC
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without
// limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so, subject to the following
// conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial
// portions of the Software.
// Funding Source: Food and Drug Administration (“Funding Agency”) effective 18 September 2014 as
// Contract no. HHSF22320140030I/HHSF22301006T (the “Prime Contract”).
// 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 NON-INFRINGEMENT. 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 IQKeyboardManagerSwift
import UIKit
let kHelperTextForFilteredStudiesNotFound = "No study found.\nPlease try different Filter Options."
let kHelperTextForSearchedStudiesNotFound =
"No study found.\nPlease check the spelling or try a different search."
let kHelperTextForOffline =
"No study available right now.\nPlease remain signed in to get notified when there are new studies available."
let kNotificationViewControllerIdentifier = "NotificationViewControllerIdentifier"
class StudyListViewController: UIViewController {
// MARK: - Outlets
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var labelHelperText: UILabel!
lazy var studyListRequestFailed = false
var searchView: SearchBarView?
lazy var isComingFromFilterScreen: Bool = false
lazy var studiesList: [Study] = []
lazy var previousStudyList: [Study] = []
/// Gatewaystudylist
lazy var allStudyList: [Study] = []
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default
}
// MARK: - Viewcontroller lifecycle
override func viewDidLoad() {
super.viewDidLoad()
addNavigationTitle()
isComingFromFilterScreen = false
DispatchQueue.main.async { [weak self] in
self?.setupStudyListTableView()
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if isComingFromFilterScreen {
isComingFromFilterScreen = false
return
}
addRightNavigationItem()
navigationController?.setNavigationBarHidden(false, animated: true)
navigationController?.navigationBar.isHidden = false
Study.currentStudy = nil
let ud = UserDefaults.standard
// Checking if User has missed out setting the passcode/TouchId
let isPasscodePending = ud.value(forKey: kPasscodeIsPending) as? Bool ?? false
if isPasscodePending == true {
if User.currentUser.userType == .loggedInUser {
tableView?.isHidden = true
// Fetch the User Profile
UserServices().getUserProfile(self as NMWebServiceDelegate)
}
}
labelHelperText.isHidden = true
setNavigationBarItem()
if User.currentUser.userType == .loggedInUser { // For LoggedIn User
tableView?.estimatedRowHeight = 145
tableView?.rowHeight = UITableView.automaticDimension
if !(fdaSlideMenuController()?.isLeftOpen())! {
sendRequestToGetUserPreference()
}
} else { // For ananomous User
tableView?.estimatedRowHeight = 140
tableView?.rowHeight = UITableView.automaticDimension
// Fetch StudyList
sendRequestToGetStudyList()
}
setNeedsStatusBarAppearanceUpdate()
self.navigationController?.view.layoutSubviews()
StudyListViewController.configureNotifications()
// Handling StudyList Request Failure condition
if studyListRequestFailed {
labelHelperText.isHidden = false
labelHelperText.text = kHelperTextForOffline
}
}
// MARK: - UI Utils
/// To update the navigation bar items , by adding Notification Button, Notification Indicator & Filter Button.
func addRightNavigationItem() {
guard navigationItem.rightBarButtonItems == nil
else { return } // No need to add again.
let view = UIView(frame: CGRect(x: 0, y: 4, width: 110, height: 40))
// Notification Button
let button = addNotificationButton()
view.addSubview(button)
button.isExclusiveTouch = true
// Notification Indicator
let label = addNotificationIndication()
view.addSubview(label)
let isShowNotification = UserDefaults.standard.bool(forKey: kShowNotification)
label.isHidden = isShowNotification ? false : true
// Filter Button
let filterButton = addFilterButton()
view.addSubview(filterButton)
filterButton.isExclusiveTouch = true
// Search Button
let searchButton = addSearchButton()
view.addSubview(searchButton)
searchButton.isExclusiveTouch = true
let barButton = UIBarButtonItem(customView: view)
navigationItem.rightBarButtonItems = [barButton]
}
func addSearchButton() -> UIButton {
let searchButton = UIButton(type: .custom)
searchButton.setImage(
#imageLiteral(resourceName: "search_small"),
for: UIControl.State.normal
)
searchButton.addTarget(self, action: #selector(searchButtonAction(_:)), for: .touchUpInside)
searchButton.frame = CGRect(x: 0, y: 4, width: 30, height: 30)
return searchButton
}
func addFilterButton() -> UIButton {
let filterButton = UIButton(type: .custom)
filterButton.setImage(
#imageLiteral(resourceName: "filterIcon"),
for: UIControl.State.normal
)
filterButton.addTarget(self, action: #selector(filterAction(_:)), for: .touchUpInside)
filterButton.frame = CGRect(x: 40, y: 4, width: 30, height: 30)
return filterButton
}
func addNotificationButton() -> UIButton {
let button = UIButton(type: .custom)
button.setImage(
#imageLiteral(resourceName: "notification_grey"),
for: UIControl.State.normal
)
button.addTarget(self, action: #selector(buttonActionNotification(_:)), for: .touchUpInside)
button.frame = CGRect(x: 80, y: 4, width: 30, height: 30)
return button
}
func addNotificationIndication() -> UILabel {
let label = UILabel(frame: CGRect(x: 100, y: 4, width: 10, height: 10))
label.font = UIFont.systemFont(ofSize: 10)
label.textColor = UIColor.white
label.textAlignment = NSTextAlignment.center
label.backgroundColor = kUIColorForSubmitButtonBackground
label.layer.cornerRadius = 5
label.clipsToBounds = true
label.text = ""
return label
}
/// Add the navigation title from the branding plist.
fileprivate func addNavigationTitle() {
let navTitle = Branding.navigationTitleName
let titleLabel = UILabel()
titleLabel.text = NSLocalizedString(navTitle, comment: "")
titleLabel.font = UIFont(name: "HelveticaNeue-Medium", size: 18)
titleLabel.textAlignment = .left
titleLabel.textColor = Utilities.getUIColorFromHex(0x007CBA)
titleLabel.frame = CGRect(x: 0, y: 0, width: 300, height: 44)
navigationItem.titleView = titleLabel
}
fileprivate func setupStudyListTableView() {
let refresher = UIRefreshControl()
refresher.addTarget(self, action: #selector(sendRequestToGetUserPreference), for: .valueChanged)
refresher.attributedTitle = NSAttributedString(string: "Pull to refresh")
tableView.refreshControl = refresher
}
// MARK: - Utils
func checkIfNotificationEnabled() {
var notificationEnabledFromAppSettings = false
// Checking the app notification settings.
LocalNotification.notificationsEnabled { (status) in
notificationEnabledFromAppSettings = status
}
if (User.currentUser.settings?.remoteNotifications)!,
(User.currentUser.settings?.localNotifications)!,
notificationEnabledFromAppSettings
{ // Notifications are enabled
// Do Nothing
} else { // Notification is Disabled
let ud = UserDefaults.standard
let previousDate = ud.object(forKey: "NotificationRemainder") as? Date
let todayDate = Date()
var daysLastSeen = 0
if previousDate != nil {
daysLastSeen = Schedule().getNumberOfDaysBetween(
startDate: previousDate!,
endDate: todayDate
)
}
if daysLastSeen >= 7 { // Notification is disabled for 7 or more Days
UIUtilities.showAlertWithTitleAndMessage(
title: NSLocalizedString(Branding.productTitle, comment: "") as NSString,
message: NSLocalizedString(kMessageAppNotificationOffRemainder, comment: "")
as NSString
)
ud.set(Date(), forKey: "NotificationRemainder")
ud.synchronize()
}
}
}
/// checkIfFetalKickCountRunning method verifies wheather if FetalKick Task is Still running and calculate the time difference.
func checkIfFetalKickCountRunning() {
let ud = UserDefaults.standard
if ud.bool(forKey: "FKC"), ud.object(forKey: kFetalKickStartTimeStamp) != nil {
let studyId = (ud.object(forKey: kFetalkickStudyId) as? String)!
let study = Gateway.instance.studies?.filter { $0.studyId == studyId }.last
if study?.userParticipateState.status == .enrolled, study?.status == .active {
Study.updateCurrentStudy(study: study!)
pushToStudyDashboard(animated: false)
}
} else {
checkIfNotificationEnabled()
if !NotificationHandler.instance.studyId.isEmpty {
let studyId = NotificationHandler.instance.studyId
let study = Gateway.instance.studies?.filter { $0.studyId == studyId }.first
Study.updateCurrentStudy(study: study!)
performTaskBasedOnStudyStatus()
}
}
}
/// Navigate to notification screen.
func navigateToNotifications() {
let gatewayStoryBoard = UIStoryboard(
name: kStoryboardIdentifierGateway,
bundle: Bundle.main
)
let notificationController =
(gatewayStoryBoard.instantiateViewController(
withIdentifier: kNotificationViewControllerIdentifier
)
as? NotificationViewController)!
navigationController?.pushViewController(notificationController, animated: true)
}
/// Navigate to StudyHomeViewController screen.
func navigateToStudyHome() {
let studyStoryBoard = UIStoryboard(name: kStudyStoryboard, bundle: Bundle.main)
let studyHomeController =
(studyStoryBoard.instantiateViewController(
withIdentifier: String(describing: StudyHomeViewController.classForCoder())
)
as? StudyHomeViewController)!
studyHomeController.delegate = self
navigationController?.pushViewController(studyHomeController, animated: true)
}
/// Navigate the screen to Study Dashboard tabbar viewcontroller screen.
func pushToStudyDashboard(animated: Bool = true) {
let studyStoryBoard = UIStoryboard(name: kStudyStoryboard, bundle: Bundle.main)
let studyDashboard =
(studyStoryBoard.instantiateViewController(
withIdentifier: kStudyDashboardTabbarControllerIdentifier
)
as? StudyDashboardTabbarViewController)!
navigationController?.navigationBar.isHidden = true
navigationController?.pushViewController(studyDashboard, animated: animated)
}
/// Method to display taskViewController for passcode setup if
/// passcode setup is enabled,called only once after signin.
func setPassCode() {
// Remove Passcode if already exist
ORKPasscodeViewController.removePasscodeFromKeychain()
let passcodeStep = ORKPasscodeStep(identifier: kPasscodeStepIdentifier)
passcodeStep.passcodeType = .type4Digit
passcodeStep.text = kSetPasscodeDescription
let task = ORKOrderedTask(identifier: kPasscodeTaskIdentifier, steps: [passcodeStep])
let taskViewController = ORKTaskViewController(task: task, taskRun: nil)
taskViewController.delegate = self
taskViewController.isNavigationBarHidden = true
taskViewController.navigationBar.prefersLargeTitles = false
taskViewController.modalPresentationStyle = .fullScreen
navigationController?.present(
taskViewController,
animated: false,
completion: {
self.tableView?.isHidden = false
}
)
}
/// Load the study data from Database.
func loadStudiesFromDatabase() {
DBHandler.loadStudyListFromDatabase { studies in
if studies.count > 0 {
self.tableView?.isHidden = false
self.studiesList = studies
self.tableView?.reloadData()
self.previousStudyList = studies
self.allStudyList = studies
Gateway.instance.studies = studies
// Applying Filters
let previousStudyFilters = StudyFilterHandler.instance.previousAppliedFilters
if previousStudyFilters.count > 0 {
if User.currentUser.userType == .loggedInUser {
self.appliedFilter(
studyStatus: previousStudyFilters.first!,
pariticipationsStatus: previousStudyFilters[safe: 2] ?? [],
categories: previousStudyFilters[safe: 3] ?? [],
searchText: "",
bookmarked: previousStudyFilters[1].count > 0 ? true : false
) // TBD: Crashed
} else {
self.appliedFilter(
studyStatus: previousStudyFilters.first!,
pariticipationsStatus: [],
categories: previousStudyFilters[1],
searchText: "",
bookmarked: false
)
}
} else {
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
appDelegate.setDefaultFilters(previousCollectionData: [])
// using default Filters
let filterStrings = appDelegate.getDefaultFilterStrings()
self.appliedFilter(
studyStatus: filterStrings.studyStatus,
pariticipationsStatus: filterStrings.pariticipationsStatus,
categories: filterStrings.categories,
searchText: filterStrings.searchText,
bookmarked: filterStrings.bookmark
)
}
self.checkIfFetalKickCountRunning()
} else {
if !self.studyListRequestFailed {
self.labelHelperText.isHidden = true
self.tableView?.isHidden = false
self.studyListRequestFailed = false
self.sendRequestToGetStudyList()
} else {
self.tableView?.isHidden = true
self.labelHelperText.isHidden = false
self.labelHelperText.text = kHelperTextForOffline
}
}
}
}
/// Sort Studies based on the Study Status.
func getSortedStudies(studies: [Study]) -> [Study] {
var sortedstudies2 = studies.sorted(by: { $0.name!.lowercased() < $1.name!.lowercased() })
sortedstudies2 = sortedstudies2.sorted(
by: { (study1: Study, study2: Study) -> Bool in
if study1.status == study2.status {
return
(study1.userParticipateState.status.sortIndex
< study2.userParticipateState
.status
.sortIndex)
}
return (study1.status.sortIndex < study2.status.sortIndex)
})
return sortedstudies2
}
// MARK: - Helpers
/// Request for notiffications and update to server.
static func configureNotifications() {
// Checking if registering notification is pending.
if UserDefaults.standard.bool(forKey: kNotificationRegistrationIsPending),
let appDelegate = UIApplication.shared.delegate as? AppDelegate
{
appDelegate.askForNotification()
}
}
// MARK: - Button Actions
/// Navigate to notification screen on button clicked.
@IBAction func buttonActionNotification(_: UIBarButtonItem) {
navigateToNotifications()
}
/// Refresh the StudyList.
@objc func refresh(sender _: AnyObject) {
sendRequestToGetStudyList()
}
/// Navigate to StudyFilter screen on button clicked.
@IBAction func filterAction(_: UIBarButtonItem) {
isComingFromFilterScreen = true
performSegue(withIdentifier: filterListSegue, sender: nil)
}
@IBAction func searchButtonAction(_: UIBarButtonItem) {
searchView = SearchBarView.instanceFromNib(
frame: CGRect(x: 0, y: -200, width: view.frame.size.width, height: 64.0),
detail: nil
)
UIView.animate(
withDuration: 0.2,
delay: 0.0,
options: UIView.AnimationOptions.preferredFramesPerSecond60,
animations: { () -> Void in
let y: CGFloat = DeviceType.isIPhoneXOrHigh ? 20.0 : 0.0
self.searchView?.frame = CGRect(
x: 0,
y: y,
width: self.view.frame.size.width,
height: 64.0
)
self.searchView?.textFieldSearch?.becomeFirstResponder()
self.searchView?.delegate = self
self.slideMenuController()?.leftPanGesture?.isEnabled = false
self.navigationController?.view.addSubview(self.searchView!)
if StudyFilterHandler.instance.searchText.count > 0 {
self.searchView?.textFieldSearch?.text = StudyFilterHandler.instance.searchText
}
},
completion: nil
)
}
// MARK: - Segue Methods
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.
if segue.identifier == filterListSegue {
let filterVc = (segue.destination as? StudyFilterViewController)!
if StudyFilterHandler.instance.previousAppliedFilters.count > 0 {
filterVc.previousCollectionData = StudyFilterHandler.instance.previousAppliedFilters
}
filterVc.delegate = self
}
}
@IBAction func unwindToStudyList(_: UIStoryboardSegue) {
// unwindStudyListSegue
}
// MARK: - Database Methods
/// Get the `Study` overview from DB if available and navigate.
/// - Parameter study: Instance of `Study`.
func checkDatabaseForStudyInfo(study: Study) {
DBHandler.loadStudyOverview(studyId: (study.studyId)!) { overview in
if overview != nil {
study.overview = overview
self.navigateToStudyHome()
} else {
// Call API to get StudyInfo.
self.sendRequestToGetStudyInfo(study: study)
}
}
}
// MARK: - Webservice Requests
/// Send the webservice request to get Study List.
@objc fileprivate func sendRequestToGetStudyList() {
WCPServices().getStudyList(self)
}
/// Send the webservice request to get Study Info.
/// - Parameter study: Instance of `Study`.
func sendRequestToGetStudyInfo(study: Study) {
WCPServices().getStudyInformation(studyId: study.studyId, delegate: self)
}
/// Send the webservice request to get UserPreferences.
@objc func sendRequestToGetUserPreference() {
EnrollServices().getStudyStates(self)
}
/// Send the webservice request to Update BookMarkStatus.
/// - Parameter userStudyStatus: Instance of `UserStudyStatus`.
func sendRequestToUpdateBookMarkStatus(userStudyStatus: UserStudyStatus) {
EnrollServices().updateStudyBookmarkStatus(studyStatus: userStudyStatus, delegate: self)
}
// MARK: - Webservice Responses
/// Handle the Study list webservice response.
func handleStudyListResponse() {
if (Gateway.instance.studies?.count)! > 0 {
loadStudiesFromDatabase()
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
if appDelegate.notificationDetails != nil, User.currentUser.userType == .loggedInUser {
appDelegate.handleLocalAndRemoteNotification(
userInfoDetails: appDelegate.notificationDetails!
)
}
} else {
tableView?.isHidden = true
labelHelperText.text = kHelperTextForOffline
labelHelperText.isHidden = false
}
DispatchQueue.main.async {
// Remove paused studies local notifications.
if let updatedStudies = Gateway.instance.studies {
let pausedStudies = updatedStudies.filter { $0.status == .closed || $0.status == .paused }
for study in pausedStudies {
DBHandler.deleteStudyDBLocalNotifications(for: study.studyId)
}
if pausedStudies.count > 0 {
LocalNotification.refreshAllLocalNotification()
}
}
}
}
/// Save information for study which feilds need to be updated.
func handleStudyUpdatedInformation() {
guard let currentStudy = Study.currentStudy else { return }
if currentStudy.userParticipateState.status == UserStudyStatus.StudyStatus.yetToEnroll {
StudyUpdates.studyConsentUpdated = false
StudyUpdates.studyActivitiesUpdated = false
StudyUpdates.studyResourcesUpdated = false
currentStudy.version = StudyUpdates.studyVersion
currentStudy.newVersion = StudyUpdates.studyVersion
}
DBHandler.updateMetaDataToUpdateForStudy(study: currentStudy, updateDetails: nil)
if StudyUpdates.studyInfoUpdated {
sendRequestToGetStudyInfo(study: currentStudy)
} else {
navigateBasedOnUserStatus()
}
}
/// navigateBasedOnUserStatus method navigates to StudyDashBoard or StudyHome based on UserParticipationStatus.
func navigateBasedOnUserStatus() {
guard let currentStudy = Study.currentStudy else { return }
if User.currentUser.userType == UserType.loggedInUser {
if currentStudy.status == .active {
// handle accoring to UserStatus
let userStudyStatus = currentStudy.userParticipateState.status
if userStudyStatus == .completed || userStudyStatus == .enrolled {
pushToStudyDashboard()
} else {
checkDatabaseForStudyInfo(study: currentStudy)
}
} else {
checkDatabaseForStudyInfo(study: currentStudy)
}
} else {
checkDatabaseForStudyInfo(study: currentStudy)
}
}
/// Checks `Study` status and do the action.
func performTaskBasedOnStudyStatus() {
guard let study = Study.currentStudy else { return }
if User.currentUser.userType == UserType.loggedInUser {
if study.status == .active {
let userStudyStatus = study.userParticipateState.status
if userStudyStatus == .completed || userStudyStatus == .enrolled {
// check if study version is udpated
if study.version != study.newVersion {
WCPServices().getStudyUpdates(study: study, delegate: self)
} else {
addProgressIndicator()
perform(#selector(loadStudyDetails), with: self, afterDelay: 1)
}
} else {
checkForStudyUpdate(study: study)
}
} else if Study.currentStudy?.status == .paused {
let userStudyStatus = study.userParticipateState.status
if userStudyStatus == .completed || userStudyStatus == .enrolled {
UIUtilities.showAlertWithTitleAndMessage(
title: "",
message: NSLocalizedString(
kMessageForStudyPausedAfterJoiningState,
comment: ""
)
as NSString
)
} else {
checkForStudyUpdate(study: study)
}
} else {
checkForStudyUpdate(study: study)
}
} else {
checkForStudyUpdate(study: study)
}
}
@objc func loadStudyDetails() {
guard let study = Study.currentStudy
else {
self.removeProgressIndicator()
return
}
DBHandler.loadStudyDetailsToUpdate(
studyId: study.studyId,
completionHandler: { _ in
self.pushToStudyDashboard()
self.removeProgressIndicator()
}
)
}
func checkForStudyUpdate(study: Study?) {
if study?.version != study?.newVersion {
WCPServices().getStudyUpdates(study: study!, delegate: self)
} else {
checkDatabaseForStudyInfo(study: study!)
}
}
}
// MARK: - Applied filter delegate
extension StudyListViewController: StudyFilterDelegates {
// Based on applied filter call WS
func appliedFilter(
studyStatus: [String],
pariticipationsStatus: [String],
categories: [String],
searchText: String,
bookmarked: Bool
) {
var previousCollectionData: [[String]] = []
previousCollectionData.append(studyStatus)
let currentUser = User.currentUser.userType ?? .anonymousUser
if currentUser == .loggedInUser {
previousCollectionData.append(bookmarked == true ? ["Bookmarked"] : [])
previousCollectionData.append(pariticipationsStatus)
}
previousCollectionData.append(categories.count == 0 ? [] : categories)
StudyFilterHandler.instance.previousAppliedFilters = previousCollectionData
StudyFilterHandler.instance.searchText = ""
if studyStatus.isEmpty
|| (pariticipationsStatus.isEmpty && currentUser != .anonymousUser)
|| categories.isEmpty
&& searchText.isEmpty
&& !bookmarked
{
self.studiesList = []
refreshTableViewWith(searchText: searchText)
return
}
/// 1. Filter by study category.
var categoryFilteredStudies: [Study] = []
if categories.count > 0 {
categoryFilteredStudies = allStudyList.filter { categories.contains($0.category!) }
}
/// 2. Filter by study status.
var statusFilteredStudies: [Study] = []
if studyStatus.count > 0 {
statusFilteredStudies = allStudyList.filter { studyStatus.contains($0.status.rawValue) }
}
/// 3. Filter by user participation status.
var participationFilteredStudies: [Study] = []
if pariticipationsStatus.count > 0 {
participationFilteredStudies = allStudyList.filter {
pariticipationsStatus.contains($0.userParticipateState.status.description)
}
}
/// 4. Filter bookmarked studies.
var bookmarkedStudies: [Study] = []
if bookmarked {
bookmarkedStudies = allStudyList.filter {
$0.userParticipateState.bookmarked == bookmarked
}
}
/// 5. Filter by searched text.
var searchTextFilteredStudies: [Study] = []
if !searchText.isEmpty {
searchTextFilteredStudies = allStudyList.filter {
($0.name?.containsIgnoringCase(searchText))!
|| ($0.category?.containsIgnoringCase(searchText))! || ($0.description?.containsIgnoringCase(searchText))!
|| ($0.sponserName?.containsIgnoringCase(searchText))!
}
}
/// 6. Perform Intersections.
let statusFilteredStudiesSet = Set<Study>(statusFilteredStudies)
let pariticipationStatusFilteredSet = Set<Study>(participationFilteredStudies)
let setCategories = Set<Study>(categoryFilteredStudies)
let setBookmarkedStudies = Set<Study>(bookmarkedStudies)
let setSearchedTextStudies = Set<Study>(searchTextFilteredStudies)
var statusFilteredSet = Set<Study>()
if currentUser == .loggedInUser {
statusFilteredSet = statusFilteredStudiesSet.intersection(pariticipationStatusFilteredSet)
} else {
statusFilteredSet = statusFilteredStudiesSet
}
statusFilteredSet = statusFilteredSet.intersection(setCategories)
if bookmarked {
statusFilteredSet = statusFilteredSet.intersection(setBookmarkedStudies)
}
if !setSearchedTextStudies.isEmpty, !searchText.isEmpty {
statusFilteredSet = statusFilteredSet.intersection(setSearchedTextStudies)
}
// Assigning Filtered result to Studlist
let allStudiesArray: [Study] = Array(statusFilteredSet)
studiesList = getSortedStudies(studies: allStudiesArray)
refreshTableViewWith(searchText: searchText)
}
private func refreshTableViewWith(searchText: String) {
previousStudyList = studiesList
tableView?.reloadData()
if studiesList.count == 0 {
tableView?.isHidden = true
labelHelperText.isHidden = false
if studyListRequestFailed {
labelHelperText.text = kHelperTextForOffline
} else if searchText.isEmpty {
labelHelperText.text = kHelperTextForFilteredStudiesNotFound
} else {
labelHelperText.text = kHelperTextForSearchedStudiesNotFound
}
} else {
tableView?.isHidden = false
labelHelperText.isHidden = true
}
}
func didCancelFilter(_: Bool) {
// Do Nothing
}
}
// MARK: - TableView Data source
extension StudyListViewController: UITableViewDataSource {
func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
return studiesList.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cellIdentifier = "studyCell"
// check if current user is anonymous
let user = User.currentUser
if user.userType == .anonymousUser {
cellIdentifier = "anonymousStudyCell"
}
let cell =
(tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
as? StudyListCell)!
cell.populateCellWith(study: studiesList[indexPath.row])
cell.delegate = self
return cell
}
}
// MARK: - TableView Delegates
extension StudyListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if searchView != nil {
searchView?.removeFromSuperview()
slideMenuController()?.leftPanGesture?.isEnabled = true
}
let study = studiesList[indexPath.row]
Study.updateCurrentStudy(study: study)
performTaskBasedOnStudyStatus()
}
}
// MARK: - StudyList Delegates
extension StudyListViewController: StudyListDelegates {
func studyBookmarked(_: StudyListCell, bookmarked: Bool, forStudy study: Study) {
let user = User.currentUser
var userStudyStatus: UserStudyStatus!
if bookmarked {
userStudyStatus = user.bookmarkStudy(studyId: study.studyId!)
} else {
userStudyStatus = user.removeBookbarkStudy(studyId: study.studyId!)
}
sendRequestToUpdateBookMarkStatus(userStudyStatus: userStudyStatus)
}
}
// MARK: SearchBarDelegate
extension StudyListViewController: searchBarDelegate {
func didTapOnCancel() {
slideMenuController()?.leftPanGesture?.isEnabled = true
if studiesList.count == 0, previousStudyList.count > 0 {
studiesList = previousStudyList
} else if searchView?.textFieldSearch?.text?.count == 0 {
if StudyFilterHandler.instance.previousAppliedFilters.count > 0 {
let previousCollectionData = StudyFilterHandler.instance.previousAppliedFilters
// Apply Filters
if User.currentUser.userType == .loggedInUser {
appliedFilter(
studyStatus: previousCollectionData.first!,
pariticipationsStatus: previousCollectionData[2],
categories: previousCollectionData[3],
searchText: "",
bookmarked: previousCollectionData[1].count > 0 ? true : false
)
} else {
appliedFilter(
studyStatus: previousCollectionData.first!,
pariticipationsStatus: [],
categories: previousCollectionData[1],
searchText: "",
bookmarked: false
)
}
} else {
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
if StudyFilterHandler.instance.filterOptions.count > 0 {
// setting default Filters
let filterStrings = appDelegate.getDefaultFilterStrings()
appliedFilter(
studyStatus: filterStrings.studyStatus,
pariticipationsStatus: filterStrings.pariticipationsStatus,
categories: filterStrings.categories,
searchText: filterStrings.searchText,
bookmarked: filterStrings.bookmark
)
}
}
}
if searchView != nil {
searchView?.removeFromSuperview()
}
tableView?.reloadData()
if studiesList.count == 0 {
labelHelperText.text = kHelperTextForSearchedStudiesNotFound
tableView?.isHidden = true
labelHelperText.isHidden = false
} else {
tableView?.isHidden = false
labelHelperText.isHidden = true
}
}
/// Searches for the text provided in the filtered StudyList.
/// - Parameter text: SearchText irrespective of case.
func search(text: String) {
if studiesList.count == 0 {
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
if StudyFilterHandler.instance.filterOptions.count > 0 {
let filterStrings = appDelegate.getDefaultFilterStrings()
appliedFilter(
studyStatus: filterStrings.studyStatus,
pariticipationsStatus: filterStrings.pariticipationsStatus,
categories: filterStrings.categories,
searchText: filterStrings.searchText,
bookmarked: filterStrings.bookmark
)
}
}
// filter by searched Text
var searchTextFilteredStudies: [Study]! = []
if text.count > 0 {
searchTextFilteredStudies = studiesList.filter {
$0.name!.containsIgnoringCase(text) || $0.category!.containsIgnoringCase(text)
|| $0.description!.containsIgnoringCase(text)
|| $0.sponserName!.containsIgnoringCase(text)
}
StudyFilterHandler.instance.searchText = text
previousStudyList = studiesList
studiesList = getSortedStudies(studies: searchTextFilteredStudies)
if studiesList.count == 0 {
labelHelperText.text = kHelperTextForSearchedStudiesNotFound
tableView?.isHidden = true
labelHelperText.isHidden = false
}
} else {
StudyFilterHandler.instance.searchText = ""
}
tableView?.reloadData()
if studiesList.count > 0 {
if searchView != nil {
searchView?.removeFromSuperview()
slideMenuController()?.leftPanGesture?.isEnabled = true
}
}
}
}
// MARK: - Webservices Delegates
extension StudyListViewController: NMWebServiceDelegate {
func startedRequest(_: NetworkManager, requestName: NSString) {
let appdelegate = (UIApplication.shared.delegate as? AppDelegate)!
if !self.topMostViewController().isKind(of: ORKTaskViewController.self) {
appdelegate.window?.addProgressIndicatorOnWindowFromTop()
}
}
func finishedRequest(_: NetworkManager, requestName: NSString, response: AnyObject?) {
let appdelegate = (UIApplication.shared.delegate as? AppDelegate)!
if requestName as String == WCPMethods.studyList.rawValue {
tableView.refreshControl?.endRefreshing()
handleStudyListResponse()
appdelegate.window?.removeProgressIndicatorFromWindow()
} else if requestName as String == WCPMethods.studyInfo.rawValue {
appdelegate.window?.removeProgressIndicatorFromWindow()
navigateBasedOnUserStatus()
} else if requestName as String == EnrollmentMethods.studyState.description {
sendRequestToGetStudyList()
} else if requestName as String == WCPMethods.studyUpdates.rawValue {
appdelegate.window?.removeProgressIndicatorFromWindow()
handleStudyUpdatedInformation()
} else if requestName as String == RegistrationMethods.userProfile.description {
appdelegate.window?.removeProgressIndicatorFromWindow()
if User.currentUser.settings?.passcode == true {
setPassCode()
} else {
UserDefaults.standard.set(false, forKey: kPasscodeIsPending)
UserDefaults.standard.synchronize()
}
} else if requestName as String == EnrollmentMethods.updateStudyState.description {
appdelegate.window?.removeProgressIndicatorFromWindow()
}
}
func failedRequest(_: NetworkManager, requestName: NSString, error: NSError) {
let appdelegate = (UIApplication.shared.delegate as? AppDelegate)!
appdelegate.window?.removeProgressIndicatorFromWindow()
if error.code == HTTPError.forbidden.rawValue { // unauthorized Access
UIUtilities.showAlertMessageWithActionHandler(
kErrorTitle,
message: error.localizedDescription,
buttonTitle: kTitleOk,
viewControllerUsed: self,
action: {
self.fdaSlideMenuController()?.navigateToHomeAfterUnauthorizedAccess()
}
)
} else {
if requestName as String == EnrollmentMethods.studyState.description {
sendRequestToGetStudyList()
} else if requestName as String == WCPMethods.studyList.rawValue {
studyListRequestFailed = true
loadStudiesFromDatabase()
} else {
if requestName as String == RegistrationMethods.userProfile.description {}
tableView.refreshControl?.endRefreshing()
UIUtilities.showAlertWithTitleAndMessage(
title: NSLocalizedString(kErrorTitle, comment: "") as NSString,
message: error.localizedDescription as NSString
)
}
}
}
}
// MARK: - StudyHomeViewDontroller Delegate
extension StudyListViewController: StudyHomeViewDontrollerDelegate {
func studyHomeJoinStudy() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
let appdelegate = (UIApplication.shared.delegate as? AppDelegate)!
appdelegate.window?.removeProgressIndicatorFromWindow()
let leftController = (self.slideMenuController()?.leftViewController as? LeftMenuViewController)!
leftController.changeViewController(.reachOutSignIn)
}
}
}
// MARK: - ORKTaskViewController Delegate
extension StudyListViewController: ORKTaskViewControllerDelegate {
func taskViewControllerSupportsSaveAndRestore(_: ORKTaskViewController) -> Bool {
return true
}
public func taskViewController(
_ taskViewController: ORKTaskViewController,
didFinishWith reason: ORKTaskViewControllerFinishReason,
error _: Error?
) {
switch reason {
case ORKTaskViewControllerFinishReason.completed:
let ud = UserDefaults.standard
ud.set(false, forKey: kPasscodeIsPending)
ud.synchronize()
case ORKTaskViewControllerFinishReason.failed: break
case ORKTaskViewControllerFinishReason.discarded: break
case ORKTaskViewControllerFinishReason.saved: break
@unknown default: break
}
perform(#selector(dismisscontroller), with: self, afterDelay: 1.5)
}
@objc func dismisscontroller() {
dismiss(animated: true, completion: nil)
}
func taskViewController(
_: ORKTaskViewController,
stepViewControllerWillAppear _: ORKStepViewController
) {}
}
extension Array {
subscript(safe index: Int) -> Element? {
return indices ~= index ? self[index] : nil
}
}
| [
-1
] |
88935ad1b663484d2ebe269243a9e707a05a9d3c | 91d6d2d6a35805e69c45deeefee14dd2d3b7eb1e | /Day3-OperatorsAndConditions/ArithmeticOperators.playground/Contents.swift | 518756234bf55e8e4d6e9507df7b9984134c1592 | [] | no_license | cyberShaw/100DaysOfSwift | 9cfd55a7a7baf9bb30b6d21229df0482dcfaf7dd | 018418d095a93e26e001eca65844d4b3f8c98b62 | refs/heads/master | 2023-04-01T08:28:12.440950 | 2021-04-02T14:01:53 | 2021-04-02T14:01:53 | 352,162,237 | 1 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 182 | swift | import UIKit
let first = 12
let second = 4
let total = first + second
let difference = first - second
let prod = first * second
let div = first / second
let mod = first % second
| [
-1
] |
ecec5eb1636c20bdc02e4a2c7055940e851f50bc | 49954c60a0221b63d9c3cd1f438fecea2264367d | /SudoKingTests/spys/OnePasswordSessionManagerSpy.swift | e1dd37aff101b15b45acfa25a65002da8c34de41 | [] | no_license | thejinxters/SudoKing | 86c766b7309f5410d54410e31c68108d4be4d967 | 458e47f5a04ec7f8505b948f42d305767c2aad73 | refs/heads/master | 2020-04-17T02:48:56.401072 | 2019-01-21T16:50:45 | 2019-01-21T16:50:45 | 166,154,184 | 0 | 0 | null | 2019-01-21T16:45:38 | 2019-01-17T03:30:17 | Swift | UTF-8 | Swift | false | false | 453 | swift | import Foundation
@testable import SudoKing
class OnePasswordSessionMangerSpy: OnePasswordSessionManager {
var session: String?
override func getStoredSessionToken() -> String? {
return session
}
override func createSession(session: String) throws {
self.session = session
}
func removeSession() {
session = nil
}
func reset() {
self.removeSession()
}
}
| [
-1
] |
43df7d6f6268e919d20ceabc0131bf920f6b9ef1 | 171e621708422af8bb2739006251c319a66bde09 | /PhotoTable.swift | 4740a4e88f6b4c98faa31ad3d13017e2c5a2f967 | [] | no_license | Pankaj1785/instagramfeed | a25f80e21773db9b73d325218d6ec828ef985fe7 | a14977a800b4f9f6b89c77a49e218636f9afdc49 | refs/heads/master | 2020-04-16T05:44:52.830641 | 2015-09-15T05:12:28 | 2015-09-15T05:12:28 | 42,496,464 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 433 | swift | //
// PhotoTable.swift
// InstagramFeed
//
// Created by Pankaj Manghnani on 9/11/15.
// Copyright © 2015 codepath. All rights reserved.
//
import UIKit
class PhotoTable: UITableView {
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
}
| [
-1
] |
49e975ef3de1c80ea65632ded8a41f17ee0f889c | cf4313501aa9bbc04052145082360e5bac1a28ee | /crap/ContentView.swift | 3b3b7660fc35d4980e00b300b657212bc0d0c5fc | [] | no_license | LittleDonnie/crap | d85a411ea26c5201b1e01dab9541249ef6dbbc00 | b439f06e42ae135c6ae69febdd8ed05b4eb948d4 | refs/heads/main | 2023-06-01T03:37:04.689362 | 2021-06-26T21:04:27 | 2021-06-26T21:04:27 | 380,595,824 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 330 | swift | //
// ContentView.swift
// crap
//
// Created by Monty Montgomery on 6/26/21.
//
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
| [
33292,
343054,
370198,
386582,
398870,
267800,
154143,
357409,
264739,
153638,
153644,
375348,
343100,
377406,
147012,
368710,
345165,
207441,
356437,
260702,
377438,
345188,
168045,
377982,
369287,
192656,
419473,
347284,
374935,
356504,
157851,
274083,
176806,
337594,
325307,
374977,
333510,
356551,
333514,
327382,
370394,
359645,
355043,
264933,
391944,
108814,
108815,
108816,
326415,
108818,
263442,
260372,
345880,
369946,
66845,
369958,
353585,
307506,
418108,
372030,
323401,
272204,
409936,
378198,
397150,
397151,
385889,
243042,
357220,
359786,
213357,
207725,
361325,
276339,
24462,
256912,
337812,
341916,
254374,
412588,
372654,
223152,
342451,
375227,
208320,
362436,
393669,
373194,
208332,
357838,
420816,
208339,
212948,
425429,
208343,
194525,
98787,
219117,
359928
] |
4c91c87192e7e34acdf34f8aeb48427cbbb2980e | 4ecdf6d047ce068d1a71149ada5c34187ac03991 | /calculator/calculator/AppDelegate.swift | 96c2b08a1759ac2d86bebeb61634d08c8dfaf09b | [] | no_license | revinkama/Calculator | f07a8b3fef77450d1c350e958421f3c73e445cf8 | 999925785be56b6a870c074de1f7025b9bbd3e4a | refs/heads/master | 2020-04-20T23:33:01.897726 | 2019-02-05T00:34:10 | 2019-02-05T00:34:10 | 169,171,329 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 2,172 | swift | //
// AppDelegate.swift
// calculator
//
// Created by Kevin Rama on 2/4/19.
// Copyright © 2019 Kevin Rama. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
| [
229380,
229383,
229385,
278539,
294924,
229388,
278542,
229391,
327695,
278545,
229394,
278548,
229397,
229399,
229402,
352284,
229405,
278556,
278559,
229408,
278564,
294950,
229415,
229417,
327722,
237613,
229422,
360496,
229426,
237618,
229428,
311349,
286774,
286776,
319544,
286778,
204856,
229432,
352318,
286791,
237640,
286797,
278605,
311375,
163920,
237646,
196692,
319573,
311383,
278623,
278626,
319590,
311400,
278635,
303212,
278639,
131192,
278648,
237693,
303230,
327814,
303241,
131209,
417930,
303244,
311436,
319633,
286873,
286876,
311460,
311469,
32944,
327862,
286906,
327866,
180413,
286910,
131264,
286916,
286922,
286924,
286926,
319694,
286928,
131281,
278743,
278747,
295133,
155872,
319716,
237807,
303345,
286962,
303347,
131314,
229622,
327930,
278781,
278783,
278785,
237826,
319751,
278792,
286987,
319757,
311569,
286999,
319770,
287003,
287006,
287009,
287012,
287014,
287016,
287019,
311598,
287023,
262448,
311601,
295220,
287032,
155966,
319809,
319810,
278849,
319814,
311623,
319818,
311628,
229709,
319822,
287054,
278865,
229717,
196963,
196969,
139638,
213367,
106872,
319872,
311683,
319879,
311693,
65943,
319898,
311719,
278952,
139689,
278957,
311728,
278967,
180668,
311741,
278975,
319938,
278980,
98756,
278983,
319945,
278986,
319947,
278990,
278994,
311767,
279003,
279006,
188895,
172512,
287202,
279010,
279015,
172520,
319978,
279020,
172526,
311791,
279023,
172529,
279027,
319989,
172534,
180727,
164343,
279035,
311804,
287230,
279040,
303617,
287234,
279045,
172550,
303623,
172552,
320007,
287238,
279051,
172558,
279055,
303632,
279058,
303637,
279063,
279067,
172572,
279072,
172577,
295459,
172581,
295461,
279082,
311850,
279084,
172591,
172598,
279095,
172607,
172609,
172612,
377413,
172614,
213575,
172618,
303690,
33357,
287309,
303696,
279124,
172634,
262752,
254563,
172644,
311911,
189034,
295533,
172655,
172656,
352880,
295538,
189039,
172660,
287349,
189040,
189044,
287355,
287360,
295553,
172675,
295557,
311942,
303751,
287365,
352905,
311946,
279178,
287371,
311951,
287377,
172691,
287381,
311957,
221850,
287386,
230045,
172702,
287390,
303773,
172705,
287394,
172707,
303780,
164509,
287398,
205479,
279208,
287400,
172714,
295595,
279212,
189102,
172721,
287409,
66227,
303797,
189114,
287419,
303804,
328381,
287423,
328384,
172737,
279231,
287427,
312006,
107208,
172748,
287436,
107212,
172751,
287440,
295633,
172755,
303827,
279255,
172760,
287450,
303835,
279258,
189149,
303838,
213724,
312035,
279267,
295654,
279272,
230128,
312048,
312050,
230131,
189169,
205564,
303871,
230146,
328453,
295685,
230154,
33548,
312077,
295695,
295701,
230169,
369433,
295707,
328476,
295710,
230175,
295720,
303914,
279340,
205613,
279353,
230202,
312124,
328508,
222018,
295755,
377676,
148302,
287569,
303959,
230237,
279390,
230241,
279394,
303976,
336744,
303981,
303985,
303987,
328563,
279413,
303991,
303997,
295806,
295808,
295813,
304005,
320391,
304007,
213895,
304009,
304011,
230284,
304013,
295822,
279438,
213902,
189329,
295825,
304019,
189331,
58262,
304023,
304027,
279452,
410526,
279461,
279462,
304042,
213931,
230327,
304055,
287675,
197564,
230334,
304063,
238528,
304065,
213954,
189378,
156612,
295873,
213963,
197580,
312272,
304084,
304090,
320481,
304106,
320490,
312302,
328687,
320496,
304114,
295928,
320505,
312321,
295945,
230413,
295949,
197645,
320528,
140312,
295961,
238620,
197663,
304164,
304170,
304175,
238641,
312374,
238652,
238655,
230465,
238658,
336964,
132165,
296004,
205895,
320584,
238666,
296021,
402518,
336987,
230497,
296036,
296040,
361576,
205931,
296044,
279661,
205934,
164973,
312432,
279669,
337018,
189562,
279679,
304258,
279683,
222340,
66690,
205968,
296084,
238745,
304285,
238756,
205991,
222377,
165035,
337067,
238766,
165038,
230576,
238770,
304311,
230592,
312518,
279750,
230600,
230607,
148690,
320727,
279769,
304348,
279777,
304354,
296163,
320740,
279781,
304360,
320748,
279788,
279790,
304370,
296189,
320771,
312585,
296202,
296205,
230674,
320786,
230677,
296213,
296215,
320792,
230681,
230679,
214294,
304416,
230689,
173350,
312622,
296243,
312630,
222522,
296253,
222525,
296255,
312639,
230718,
296259,
378181,
296262,
230727,
238919,
296264,
320840,
296267,
296271,
222545,
230739,
312663,
222556,
337244,
230752,
312676,
230760,
173418,
148843,
410987,
230763,
230768,
296305,
312692,
230773,
304505,
304506,
181626,
279929,
181631,
148865,
312711,
312712,
296331,
288140,
288144,
230800,
304533,
337306,
288154,
288160,
173472,
288162,
288164,
279975,
304555,
370092,
279983,
173488,
288176,
279985,
312755,
296373,
312759,
337335,
288185,
279991,
222652,
312766,
173507,
296389,
222665,
230860,
312783,
288208,
230865,
288210,
370130,
288212,
222676,
288214,
280021,
239064,
329177,
288217,
280027,
288220,
288218,
239070,
288224,
280034,
288226,
280036,
288229,
280038,
288230,
288232,
370146,
288234,
320998,
288236,
288238,
288240,
288242,
296435,
288244,
288250,
296446,
321022,
402942,
148990,
296450,
206336,
230916,
230919,
214535,
230923,
304651,
304653,
370187,
230940,
222752,
108066,
296486,
296488,
157229,
230961,
157236,
288320,
288325,
124489,
280140,
280145,
288338,
280149,
288344,
280152,
239194,
280158,
403039,
370272,
181854,
239202,
312938,
280183,
280185,
280188,
280191,
116354,
280194,
280208,
280211,
288408,
280218,
280222,
419489,
190118,
321195,
296622,
321200,
337585,
296626,
296634,
296637,
419522,
313027,
280260,
419525,
206536,
280264,
206539,
206541,
206543,
263888,
313044,
280276,
321239,
280283,
313052,
18140,
288478,
313055,
419555,
321252,
313066,
288494,
280302,
280304,
313073,
321266,
419570,
288499,
288502,
280314,
288510,
124671,
67330,
280324,
198405,
288519,
280331,
198416,
280337,
296723,
116503,
321304,
329498,
296731,
321311,
313121,
313123,
304932,
321316,
280363,
141101,
165678,
280375,
321336,
296767,
288576,
345921,
280388,
304968,
280393,
280402,
173907,
313171,
313176,
42842,
280419,
321381,
296809,
296812,
313201,
1920,
255873,
305028,
280454,
247688,
280464,
124817,
280468,
239510,
280473,
124827,
214940,
247709,
214944,
280487,
313258,
321458,
296883,
124853,
214966,
296890,
10170,
288700,
296894,
190403,
296900,
280515,
337862,
165831,
280521,
231379,
296921,
354265,
354270,
239586,
313320,
354281,
231404,
124913,
165876,
321528,
239612,
313340,
288764,
239617,
313347,
288773,
313358,
305176,
321560,
313371,
354338,
305191,
223273,
313386,
354348,
124978,
215090,
124980,
288824,
288826,
321595,
378941,
313406,
288831,
288836,
67654,
280651,
354382,
288848,
280658,
215123,
354390,
288855,
288859,
280669,
313438,
149599,
280671,
149601,
321634,
149603,
223327,
329830,
280681,
313451,
223341,
280687,
149618,
215154,
313458,
280691,
313464,
329850,
321659,
280702,
288895,
321670,
215175,
141446,
288909,
141455,
141459,
280725,
313498,
100520,
288936,
280747,
288940,
288947,
280755,
321717,
280759,
280764,
280769,
280771,
280774,
280776,
313548,
321740,
280783,
280786,
280788,
313557,
280793,
280796,
280798,
338147,
280804,
280807,
157930,
280811,
280817,
125171,
157940,
280819,
182517,
280823,
280825,
280827,
280830,
280831,
280833,
125187,
280835,
125191,
125207,
125209,
321817,
125218,
321842,
223539,
125239,
280888,
280891,
289087,
280897,
280900,
305480,
239944,
280906,
239947,
305485,
305489,
379218,
280919,
248153,
354653,
313700,
313705,
280937,
190832,
280946,
223606,
313720,
280956,
239997,
280959,
313731,
199051,
240011,
289166,
240017,
297363,
190868,
240021,
297365,
297368,
297372,
141725,
297377,
289186,
297391,
289201,
240052,
289207,
289210,
305594,
281024,
289218,
289221,
289227,
281045,
281047,
215526,
166378,
305647,
281075,
174580,
240124,
281084,
305662,
305664,
240129,
305666,
305668,
223749,
240132,
281095,
223752,
150025,
338440,
223757,
281102,
223763,
223765,
281113,
322074,
281116,
281121,
182819,
281127,
281135,
150066,
158262,
158266,
289342,
281154,
322115,
158283,
281163,
281179,
338528,
338532,
281190,
199273,
281196,
19053,
158317,
313973,
297594,
281210,
158347,
264845,
133776,
314003,
117398,
314007,
289436,
174754,
330404,
289448,
133801,
174764,
314029,
314033,
240309,
133817,
314045,
314047,
314051,
199364,
297671,
158409,
256716,
289493,
363234,
289513,
289522,
289525,
289532,
322303,
289537,
322310,
264969,
322314,
322318,
281361,
281372,
322341,
215850,
281388,
289593,
281401,
289601,
281410,
281413,
281414,
240458,
281420,
240468,
281430,
322393,
297818,
281435,
281438,
281442,
174955,
224110,
207733,
207737,
158596,
183172,
338823,
322440,
314249,
240519,
183184,
289687,
240535,
297883,
289694,
289696,
289700,
289712,
281529,
289724,
52163,
183260,
281567,
289762,
322534,
297961,
183277,
281581,
322550,
134142,
322563,
314372,
330764,
175134,
322599,
322610,
314421,
281654,
314427,
314433,
207937,
314441,
207949,
322642,
314456,
281691,
314461,
281702,
281704,
314474,
281708,
281711,
289912,
248995,
306341,
306344,
306347,
322734,
306354,
142531,
199877,
289991,
306377,
289997,
249045,
363742,
363745,
298216,
330988,
126190,
216303,
322801,
388350,
257302,
363802,
199976,
199978,
314671,
298292,
298294,
257334,
216376,
380226,
298306,
224584,
224587,
224594,
216404,
306517,
150870,
314714,
224603,
159068,
314718,
265568,
314723,
281960,
150890,
306539,
314732,
314736,
290161,
216436,
306549,
298358,
314743,
306552,
290171,
314747,
306555,
298365,
290174,
224641,
281987,
298372,
314756,
281990,
224647,
265604,
298377,
314763,
142733,
298381,
314768,
224657,
306581,
314773,
314779,
314785,
314793,
282025,
282027,
241068,
241070,
241072,
282034,
241077,
150966,
298424,
306618,
282044,
323015,
306635,
306640,
290263,
290270,
290275,
339431,
282089,
191985,
282098,
290291,
282101,
241142,
191992,
290298,
151036,
290302,
282111,
290305,
175621,
306694,
192008,
323084,
257550,
282127,
290321,
282130,
323090,
290325,
282133,
241175,
290328,
282137,
290332,
241181,
282142,
282144,
290344,
306731,
290349,
290351,
290356,
28219,
282186,
224849,
282195,
282199,
282201,
306778,
159324,
159330,
314979,
298598,
323176,
224875,
241260,
323181,
257658,
315016,
282249,
290445,
324757,
282261,
175770,
298651,
282269,
323229,
298655,
323231,
61092,
282277,
306856,
282295,
323260,
282300,
323266,
282310,
323273,
282319,
306897,
241362,
306904,
282328,
298714,
52959,
216801,
282337,
241380,
216806,
323304,
282345,
12011,
282356,
323318,
282364,
282367,
306945,
241412,
323333,
282376,
216842,
323345,
282388,
323349,
282392,
184090,
315167,
315169,
282402,
315174,
323367,
241448,
315176,
241450,
282410,
306988,
306991,
315184,
323376,
315190,
241464,
159545,
282425,
298811,
118593,
307009,
413506,
307012,
241475,
298822,
148946,
315211,
282446,
307027,
315221,
323414,
315223,
241496,
241498,
307035,
307040,
110433,
282465,
241509,
110438,
298860,
110445,
282478,
315249,
110450,
315251,
282481,
315253,
315255,
339838,
315267,
282499,
315269,
241544,
282505,
241546,
241548,
298896,
298898,
282514,
241556,
298901,
44948,
241560,
282520,
241563,
241565,
241567,
241569,
282531,
241574,
282537,
298922,
36779,
241581,
282542,
241583,
323504,
241586,
282547,
241588,
290739,
241590,
241592,
241598,
290751,
241600,
241605,
151495,
241610,
298975,
241632,
298984,
241640,
241643,
298988,
241646,
241649,
241652,
323574,
290807,
299003,
241661,
299006,
282623,
315396,
241669,
315397,
282632,
282639,
290835,
282645,
241693,
282654,
241701,
102438,
217127,
282669,
323630,
282681,
290877,
282687,
159811,
315463,
315466,
192589,
307278,
192596,
176213,
307287,
307290,
217179,
315482,
192605,
315483,
233567,
299105,
200801,
217188,
299109,
307303,
315495,
356457,
45163,
307307,
315502,
192624,
307314,
323700,
299126,
233591,
299136,
307329,
315524,
307338,
233613,
241813,
307352,
299164,
241821,
299167,
315552,
184479,
184481,
315557,
184486,
307370,
307372,
184492,
307374,
307376,
299185,
323763,
184503,
176311,
299191,
307386,
258235,
307388,
307385,
307390,
176316,
299200,
184512,
307394,
299204,
307396,
184518,
307399,
323784,
233679,
307409,
307411,
176343,
299225,
233701,
307432,
184572,
282881,
184579,
282893,
323854,
291089,
282906,
291104,
233766,
295583,
176435,
307508,
315701,
332086,
307510,
307512,
168245,
307515,
307518,
282942,
282947,
323917,
110926,
282957,
233808,
323921,
315733,
323926,
233815,
276052,
315739,
323932,
299357,
242018,
242024,
299373,
315757,
250231,
242043,
315771,
299388,
299391,
291202,
299398,
242057,
291212,
299405,
291222,
315801,
283033,
242075,
291226,
194654,
61855,
291231,
283042,
291238,
291241,
127403,
127405,
291247,
299440,
127407,
299444,
127413,
283062,
291254,
127417,
291260,
283069,
127421,
127424,
299457,
127429,
127431,
127434,
315856,
176592,
315860,
176597,
283095,
127447,
299481,
176605,
242143,
127457,
291299,
127463,
242152,
291305,
127466,
176620,
127469,
127474,
291314,
291317,
127480,
135672,
291323,
233979,
127485,
291330,
283142,
127494,
127497,
233994,
135689,
127500,
291341,
233998,
127506,
234003,
234006,
127511,
152087,
283161,
242202,
234010,
135707,
135710,
242206,
242208,
291361,
242220,
291378,
152118,
234038,
234041,
315961,
70213,
242250,
111193,
242275,
299620,
242279,
168562,
184952,
135805,
135808,
291456,
373383,
299655,
135820,
316051,
225941,
316054,
299672,
135834,
373404,
299677,
225948,
135839,
299680,
225954,
299684,
135844,
242343,
209576,
242345,
373421,
135870,
135873,
135876,
135879,
299720,
299723,
299726,
225998,
226002,
119509,
226005,
226008,
299740,
242396,
201444,
299750,
283368,
234219,
283372,
226037,
283382,
316151,
234231,
234236,
226045,
242431,
234239,
209665,
234242,
299778,
242436,
226053,
234246,
226056,
234248,
291593,
242443,
234252,
242445,
234254,
291601,
234258,
242450,
242452,
234261,
348950,
201496,
234264,
234266,
234269,
283421,
234272,
234274,
152355,
299814,
234278,
283432,
234281,
234284,
234287,
283440,
185138,
242483,
234292,
234296,
234298,
160572,
283452,
234302,
234307,
242499,
234309,
316233,
234313,
316235,
234316,
283468,
234319,
242511,
234321,
234324,
185173,
201557,
234329,
234333,
308063,
234336,
242530,
349027,
234338,
234341,
234344,
234347,
177004,
234350,
324464,
234353,
152435,
177011,
234356,
234358,
234362,
226171,
234364,
291711,
234368,
291714,
234370,
291716,
234373,
316294,
201603,
226182,
308105,
234375,
226185,
234379,
324490,
234384,
234388,
234390,
324504,
234393,
209818,
308123,
324508,
226200,
234396,
234398,
291742,
234401,
291747,
291748,
234405,
291750,
234407,
324520,
324518,
324522,
234410,
291756,
291754,
226220,
324527,
291760,
234417,
201650,
324531,
234414,
234422,
226230,
324536,
275384,
234428,
291773,
242623,
324544,
234431,
234434,
324546,
324548,
234437,
226245,
234439,
226239,
234443,
291788,
234446,
275406,
193486,
234449,
316370,
193488,
234452,
234455,
234459,
234461,
234464,
234467,
234470,
168935,
5096,
324585,
234475,
234478,
316400,
234481,
316403,
234484,
234485,
234487,
324599,
234490,
234493,
316416,
234496,
234501,
275462,
308231,
234504,
234507,
234510,
234515,
300054,
316439,
234520,
234519,
234523,
234526,
234528,
300066,
234532,
300069,
234535,
234537,
234540,
144430,
234543,
234546,
275508,
300085,
234549,
300088,
234553,
234556,
234558,
316479,
234561,
316483,
160835,
234563,
308291,
234568,
234570,
316491,
234572,
300108,
234574,
300115,
234580,
234581,
242777,
234585,
275545,
234590,
234593,
234595,
234597,
300133,
234601,
300139,
234605,
160879,
234607,
275569,
234610,
316530,
300148,
234614,
398455,
144506,
234618,
234620,
275579,
234623,
226433,
234627,
275588,
234629,
242822,
234634,
234636,
177293,
234640,
275602,
234643,
308373,
226453,
234647,
275606,
275608,
234650,
308379,
234648,
300189,
324766,
119967,
234653,
324768,
283805,
234657,
242852,
300197,
234661,
283813,
234664,
177318,
275626,
234667,
316596,
308414,
234687,
300223,
300226,
308418,
234692,
300229,
308420,
308422,
283844,
226500,
300234,
283850,
300238,
300241,
316625,
300243,
300245,
316630,
300248,
300253,
300256,
300258,
300260,
234726,
300263,
300265,
300267,
161003,
300270,
300272,
120053,
300278,
275703,
316663,
300284,
275710,
300287,
292097,
300289,
161027,
300292,
300294,
275719,
234760,
177419,
300299,
242957,
300301,
283917,
177424,
275725,
349451,
349464,
415009,
283939,
259367,
283951,
292143,
300344,
226617,
243003,
283963,
226628,
300357,
283973,
177482,
283983,
316758,
357722,
316766,
316768,
292192,
218464,
292197,
316774,
243046,
218473,
284010,
136562,
324978,
275834,
333178,
275836,
275840,
316803,
316806,
226696,
316811,
226699,
316814,
226703,
300433,
234899,
300436,
226709,
357783,
316824,
316826,
144796,
300448,
144807,
144810,
144812,
284076,
144814,
227426,
144820,
374196,
284084,
292279,
284087,
144826,
144828,
144830,
144832,
144835,
144837,
38342,
144839,
144841,
144844,
144847,
144852,
144855,
103899,
300507,
333280,
226787,
218597,
292329,
300523,
259565,
300527,
308720,
259567,
292338,
226802,
316917,
292343,
308727,
300537,
316933,
316947,
308757,
308762,
284191,
316959,
284194,
284196,
235045,
284199,
284204,
284206,
284209,
284211,
194101,
284213,
316983,
194103,
284215,
308790,
284218,
226877,
292414,
284223,
284226,
284228,
292421,
226886,
284231,
128584,
243268,
284234,
366155,
317004,
276043,
284238,
226895,
284241,
194130,
284243,
300628,
284245,
292433,
284247,
317015,
235097,
243290,
276053,
284249,
284251,
300638,
284253,
284255,
243293,
284258,
292452,
292454,
284263,
177766,
284265,
292458,
284267,
292461,
284272,
284274,
284278,
292470,
276086,
292473,
284283,
276093,
284286,
276095,
284288,
292481,
284290,
325250,
284292,
292485,
292479,
276098,
284297,
317066,
284299,
317068,
284301,
276109,
284303,
284306,
276114,
284308,
284312,
284314,
284316,
276127,
284320,
284322,
284327,
284329,
317098,
284331,
276137,
284333,
284335,
276144,
284337,
284339,
300726,
284343,
284346,
284350,
358080,
276160,
284354,
358083,
284358,
276166,
358089,
284362,
276170,
284365,
276175,
284368,
276177,
284370,
358098,
284372,
317138,
284377,
276187,
284379,
284381,
284384,
358114,
284386,
358116,
276197,
317158,
358119,
284392,
325353,
358122,
284394,
284397,
358126,
284399,
358128,
276206,
358133,
358135,
276216,
358138,
300795,
358140,
284413,
358142,
358146,
317187,
284418,
317189,
317191,
284428,
300816,
300819,
317207,
284440,
300828,
300830,
276255,
300832,
325408,
300834,
317221,
227109,
358183,
186151,
276268,
300845,
243504,
300850,
284469,
276280,
325436,
358206,
276291,
366406,
276295,
300872,
292681,
153417,
358224,
284499,
276308,
284502,
317271,
178006,
276315,
292700,
317279,
284511,
227175,
292715,
300912,
292721,
284529,
300915,
284533,
292729,
317306,
284540,
292734,
325512,
169868,
276365,
317332,
358292,
284564,
284566,
399252,
350106,
284572,
276386,
284579,
276388,
358312,
317353,
284585,
276395,
292776,
292784,
276402,
358326,
161718,
358330,
276410,
276411,
276418,
276425,
301009,
301011,
301013,
292823,
358360,
301017,
301015,
292828,
276446,
153568,
276448,
276452,
292839,
276455,
292843,
276460,
276464,
178161,
227314,
276466,
325624,
276472,
317435,
276476,
276479,
276482,
276485,
317446,
276490,
350218,
292876,
350222,
317456,
276496,
317458,
178195,
243733,
243740,
317468,
317472,
325666,
243751,
292904,
276528,
243762,
309298,
325685,
325689,
235579,
325692,
235581,
178238,
276539,
276544,
284739,
325700,
243779,
292934,
243785,
276553,
350293,
350295,
309337,
194649,
227418,
350299,
350302,
227423,
350304,
178273,
309346,
194657,
194660,
350308,
309350,
309348,
292968,
309352,
309354,
301163,
350313,
350316,
227430,
301167,
276583,
350321,
276590,
284786,
276595,
350325,
252022,
227440,
350328,
292985,
301178,
350332,
292989,
301185,
292993,
350339,
317570,
317573,
350342,
350345,
350349,
301199,
317584,
325777,
350354,
350357,
350359,
350362,
350366,
276638,
284837,
153765,
350375,
350379,
350381,
350383,
129200,
350385,
350387,
350389,
350395,
350397,
350399,
227520,
350402,
227522,
301252,
350406,
227529,
301258,
309450,
276685,
309455,
276689,
309462,
301272,
276699,
194780,
309468,
309471,
301283,
317672,
317674,
325867,
243948,
194801,
309491,
227571,
309494,
243960,
276735,
227583,
227587,
276739,
211204,
276742,
227593,
227596,
325910,
309530,
342298,
211232,
317729,
276775,
211241,
325937,
325943,
211260,
260421,
276809,
285002,
276811,
235853,
276816,
235858,
276829,
276833,
391523,
276836,
293227,
276843,
293232,
276848,
186744,
211324,
227709,
285061,
366983,
317833,
178572,
285070,
285077,
178583,
227738,
317853,
276896,
317858,
342434,
285093,
317864,
285098,
276907,
235955,
276917,
293304,
293307,
293314,
309707,
293325,
317910,
293336,
235996,
317917,
293343,
358880,
276961,
227810,
293346,
276964,
293352,
236013,
293364,
301562,
293370,
317951,
309764,
301575,
121352,
293387,
236043,
342541,
317963,
113167,
55822,
309779,
317971,
309781,
277011,
55837,
227877,
227879,
293417,
227882,
309804,
293421,
105007,
236082,
285236,
23094,
277054,
244288,
219714,
129603,
301636,
318020,
301639,
301643,
277071,
285265,
399955,
309844,
277080,
309849,
285277,
285282,
326244,
318055,
277100,
309871,
121458,
277106,
170618,
170619,
309885,
309888,
277122,
227975,
277128,
285320,
301706,
318092,
326285,
334476,
318094,
277136,
277139,
227992,
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,
277232,
228081,
56059,
310015,
285441,
310020,
285448,
310029,
228113,
285459,
277273,
293659,
326430,
228128,
285474,
293666,
228135,
318248,
277291,
318253,
293677,
285489,
301876,
293685,
285494,
301880,
285499,
301884,
310080,
293696,
277317,
277322,
293706,
277329,
162643,
310100,
301911,
301913,
277337,
301921,
400236,
236397,
162671,
326514,
310134,
236408,
15224,
277368,
416639,
416640,
113538,
310147,
416648,
39817,
187274,
277385,
301972,
424853,
277405,
277411,
310179,
293798,
293802,
236460,
277426,
276579,
293811,
293817,
293820,
203715,
326603,
342994,
276586,
293849,
293861,
228327,
228328,
318442,
228330,
228332,
326638,
277486,
351217,
318450,
293876,
293877,
285686,
302073,
121850,
293882,
302075,
285690,
244731,
293887,
277504,
277507,
277511,
293899,
277519,
293908,
302105,
293917,
293939,
318516,
277561,
277564,
310336,
7232,
293956,
277573,
228422,
293960,
310344,
277577,
277583,
203857,
293971,
310355,
310359,
236632,
277594,
138332,
277598,
203872,
277601,
285792,
310374,
203879,
310376,
228460,
318573,
203886,
187509,
285815,
367737,
285817,
302205,
285821,
392326,
285831,
253064,
294026,
302218,
285835,
162964,
384148,
187542,
302231,
285849,
302233,
285852,
302237,
285854,
285856,
302241,
285862,
277671,
302248,
64682,
277678,
294063,
294065,
302258,
277687,
294072,
318651,
294076,
277695,
318657,
244930,
302275,
130244,
302277,
228550,
302282,
310476,
302285,
302288,
310481,
302290,
203987,
302292,
302294,
310486,
302296,
384222,
310498,
285927,
318698,
302315,
195822,
228592,
294132,
138485,
228601,
204026,
228606,
204031,
64768,
310531,
285958,
138505,
228617,
318742,
204067,
277798,
130345,
277801,
113964,
285997,
277804,
285999,
277807,
113969,
277811,
318773,
318776,
277816,
286010,
277819,
294204,
417086,
277822,
286016,
302403,
294211,
384328,
277832,
277836,
294221,
294223,
326991,
277839,
277842,
277847,
277850,
179547,
277853,
146784,
277857,
302436,
277860,
294246,
327015,
310632,
327017,
351594,
277864,
277869,
277872,
351607,
310648,
277880,
310651,
277884,
277888,
310657,
351619,
294276,
310659,
327046,
277892,
253320,
310665,
318858,
277894,
277898,
277903,
310672,
351633,
277905,
277908,
277917,
310689,
277921,
130468,
228776,
277928,
277932,
310703,
277937,
310710,
130486,
310712,
277944,
310715,
277947,
302526,
228799,
277950,
277953,
302534,
310727,
245191,
64966,
163272,
277959,
277963,
302541,
277966,
302543,
310737,
277971,
228825,
163290,
277978,
310749,
277981,
277984,
310755,
277989,
277991,
187880,
277995,
310764,
286188,
278000,
228851,
310772,
278003,
278006,
40440,
212472,
278009,
40443,
286203,
310780,
40448,
228864,
286214,
228871,
302603,
65038,
302614,
302617,
286233,
302621,
286240,
146977,
187939,
40484,
294435,
40486,
286246,
294440,
40488,
294439,
294443,
40491,
294445,
278057,
310831,
245288,
286248,
40499,
40502,
212538,
40507,
40511,
40513,
228933,
327240,
40521,
286283,
40525,
40527,
212560,
400976,
228944,
40533,
147032,
40537,
40539,
40541,
278109,
40544,
40548,
40550,
40552,
286312,
40554,
286313,
310892,
40557,
40560,
188022,
122488,
294521,
343679,
294537,
310925,
286354,
278163,
302740,
122517,
278168,
179870,
327333,
229030,
212648,
278188,
302764,
278192,
319153,
278196,
302781,
319171,
302789,
294599,
278216,
294601,
302793,
343757,
212690,
319187,
286420,
278227,
229076,
286425,
319194,
278235,
278238,
229086,
286432,
294625,
294634,
302838,
319226,
286460,
278274,
302852,
278277,
302854,
294664,
311048,
352008,
319243,
311053,
302862,
319251,
294682,
278306,
188199,
294701,
319280,
278320,
319290,
229192,
302925,
188247,
188252,
237409,
294776,
360317,
294785,
327554,
360322,
40840,
40851,
294803,
188312,
294811,
237470,
319390,
40865,
319394,
294817,
294821,
311209,
180142,
343983,
294831,
188340,
40886,
319419,
294844,
294847,
237508,
393177,
294876,
294879,
294883,
393190,
294890,
311279,
278513,
237555,
311283,
278516,
278519,
237562
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.